Resources / Retrieval architecture

Many RAG Failures Start Before the LLM

Teams often blame the model when the failure happened upstream: a split table, a missed part number, or ten noisy passages in the context window. Fixing retrieval can beat swapping models.

Why one technique isn’t enough

Dense embeddings capture meaning but miss exact identifiers such as clause numbers, part numbers and acronyms. BM25 finds exact tokens but misses paraphrases. Stuffing whole PDFs into a long context buries evidence in the middle, where accuracy drops while latency and cost rise.

Four stages that compound

StagePreventsImplementation
1. Structure-aware chunkingRequirements or tables split mid-thought.Split on sections and paragraphs; carry document ID, version, date and access tier on every chunk.
2. Hybrid search + RRFMissed codes or missed paraphrases.Run BM25 and dense retrieval in parallel and fuse with Reciprocal Rank Fusion: score += 1 / (60 + rank + 1).
3. Retrieve wide, rerank narrowNoisy passages distracting the model.Take the top 20 candidates, rerank with a small cross-encoder, keep 3–5.
4. Graph lookupMulti-hop questions across contracts, assets or studies.Route entity questions to a BFO-aligned RDF graph via SPARQL, so IDs and lineage are exact.

HyDE: helpful, with limits

Hypothetical Document Embeddings draft a passage before embedding the query, which can bridge vocabulary gaps. Don’t use them blindly on exact-code or regulated lookups, where an invented term can pull the wrong record. Test against a labeled retrieval set first.

Check before changing your stack

  1. Separate retrieval from answers. Measure Recall@k and MRR on expected sources before blaming prompts.
  2. Audit chunk boundaries on five real misses.
  3. Benchmark on your corpus: vector, BM25, RRF hybrid and reranking over 30–50 real questions.
  4. Flag relational questions where a graph query beats passage search.

If your assistant cites the wrong files, misses part numbers or loses track of amendments, start with a baseline evaluation on your own documents.