work

2025 · Solo — retrieval architecture, RAG pipeline

Two-Tower RAG Pipeline

Neural retrieval that encodes queries and documents independently, so search cost stops scaling with the corpus.

Architecture
Two-tower
Query cost
One encode
Grounding
Retrieved context

the problem

A cross-encoder scores a query against a document by pushing both through one model together. It is accurate and completely impractical at scale: every query re-encodes the entire corpus, so cost grows with the number of documents you own.

the approach

A two-tower architecture encodes queries and documents through separate towers into a shared embedding space. Document embeddings are computed once, offline, and indexed; at query time only the query is encoded, and retrieval becomes a vector similarity search. Around that sits the full RAG pipeline — embedding generation, similarity search, and context injection — so retrieved passages ground the language model's response instead of it inventing one.

the result

Retrieval latency decouples from corpus size, and the index can be rebuilt without touching the serving path. The pipeline is the working set of primitives behind most production LLM applications: embeddings, a vector store, and retrieval orchestration.

stack

  • Python
  • Embeddings
  • Vector search
  • RAG
  • PyTorch