Home/Work/End-to-end retrieval pipeline
Case study · Real Brokerage · Real estate · 2025
End-to-end RAG pipeline
A precise retrieval-augmented generation system: intent routing, semantic chunking, embedding generation, and hybrid vector + keyword retrieval, fused into context-optimised prompts that drive LLM reasoning and structured output across multiple sources.
- EmployerReal Brokerage
- RoleAI/ML engineer
- Period2025
- SectorReal estate brokerage
§ 01 — Problem
Naive RAG retrieves plausible-but-wrong context. Chunks are cut at the wrong boundaries, so a passage arrives without the sentence that qualifies it. A single search mode misses what the other would have caught: dense retrieval blurs exact terms such as clause numbers and addresses, keyword search misses paraphrase. And prompts are stuffed past the model's attention budget, so the right passage is in the context and the model still reasons over the wrong one.
The requirement was a system that decides whether to retrieve at all, retrieves from the right sources, and hands the model only the evidence that fits, so that answers over a heterogeneous document corpus come back grounded and in a fixed structure.
§ 02 — Architecture
Route, chunk, retrieve twice, fuse.
Retrieval is a pipeline of narrow stages in front of the LLM, each with one job, and two indexes built from the same semantic chunks.
§ 03 — How it works
One question, grounded.
The animation follows a single question through routing, chunking, hybrid retrieval, reranking, context assembly and the grounded answer.
Diagrams and films on this page are illustrations of the system's architecture and behaviour, drawn from my work at Real Brokerage. They are not screenshots or recordings of production systems, which remain confidential.
§ 04 — Approach
Retrieval
- Intent routing decides whether to retrieve at all and, when it does, which sources to search.
- Semantic chunking splits documents on meaning, so each passage stays coherent instead of breaking at a fixed length.
- Embedding generation indexes every chunk in a vector store; a keyword index holds the exact terms.
- Hybrid dense + keyword retrieval, with reranking to order the candidates by relevance to the question.
Generation
- Context optimisation fuses evidence from multiple sources and packs it within the model's attention budget before the LLM reasons over it.
- Structured output: the answer, its sources and a confidence come back in a fixed schema, so every claim can be traced to a chunk.
- Built to answer across heterogeneous document corpora rather than one clean collection.
- Serves as the retrieval backbone for the document-intelligence platform and its 80K+ PDFs a day.
§ 05 — Impact
Grounded, structured answers over heterogeneous document corpora. Each answer carries its sources and a confidence, so a reader can check the passage it rests on. The pipeline is the retrieval backbone for the document-intelligence platform, serving its more than 80,000 PDFs a day.
What generalises: routing before retrieval spares the model context it never needed; chunk boundaries matter as much as the embedding model; and two retrieval modes with a reranker in front of a strict context budget are what make the answer precise.
