# Retrieval & RAG Source: https://customlabs.io/topics/retrieval-rag/ Updated: 2026-10-19 Topics [Retrieval-augmented generation](https://customlabs.io/glossary/retrieval-augmented-generation/) looks simple in a demo and breaks on real corpora — messy PDFs, thin chunking, and stale [embeddings](https://customlabs.io/glossary/embeddings/) all masquerade as model problems. This is our work on making retrieval actually hold up in production. Start with [Context Engineering](https://customlabs.io/glossary/context-engineering/) if you're building retrieval or RAG. It's for engineers who need their system to reason over real documents, not a clean demo corpus. In the Handbook [01 Decide](https://customlabs.io/handbook/decide/) [02 Design](https://customlabs.io/handbook/design/) [03 Build](https://customlabs.io/handbook/build/) [04 Evaluate](https://customlabs.io/handbook/evaluate/) [05 Operate](https://customlabs.io/handbook/operate/) ## Guides ### [Context Engineering](https://customlabs.io/context-engineering/) What occupies a [context window](https://customlabs.io/glossary/context-window/) at every step of a long run, and how to budget, compact, isolate and measure it before it fails. 38 min read [Read →](https://customlabs.io/context-engineering/) ## Architectures ### [Grounded answering over your own documents](https://customlabs.io/architectures/grounded-answering/) Answer questions from your own documents and cite the source. The model does not answer from its training data. 6 min read [Read →](https://customlabs.io/architectures/grounded-answering/) ### [Document extraction with a human review loop](https://customlabs.io/architectures/document-extraction-pipeline/) Turn inbound documents into structured records. A person reviews only the cases where the model is unsure. 6 min read [Read →](https://customlabs.io/architectures/document-extraction-pipeline/) ## Comparisons July 22, 2026 ### [RAG vs Fine-Tuning: Which One Solves Your Problem](https://customlabs.io/compare/rag-vs-fine-tuning/) Retrieval and [fine-tuning](https://customlabs.io/glossary/fine-tuning/) solve different problems but get reached for interchangeably. How to tell which one your case needs, and why we default to retrieval. 7 min read [Read →](https://customlabs.io/compare/rag-vs-fine-tuning/) July 22, 2026 ### [Vector Database vs pgvector: Do You Need a Dedicated Store](https://customlabs.io/compare/vector-database-vs-pgvector/) A dedicated vector database is a bigger commitment than most retrieval workloads need on day one. This piece shows how to tell if pgvector covers your case. 8 min read [Read →](https://customlabs.io/compare/vector-database-vs-pgvector/) ## Insights July 7, 2026 ### [Your RAG Demo Lied to You](https://customlabs.io/insights/your-rag-demo-lied/) Retrieval that looks flawless on ten clean PDFs falls apart on a real corpus. We explain why, and what a retrieval eval requires. 7 min read [Read →](https://customlabs.io/insights/your-rag-demo-lied/) ## Case studies May 12, 2026 ### [A Retrieval Pipeline That Cut Support Load](https://customlabs.io/case-studies/retrieval-pipeline-cut-support-load/) A SaaS support platform replaced a keyword search widget with a tenant-isolated retrieval pipeline. Escalations and response time fell with no new headcount. 6 min read [Read →](https://customlabs.io/case-studies/retrieval-pipeline-cut-support-load/) ## Patterns ### [Structure-aware chunking](https://customlabs.io/patterns/structure-aware-chunking/) Chunk boundaries follow the document's own structure, such as headings and table rows. Each chunk carries its parent heading in its own body. A table row stays with its header. A step stays with its procedure. Each embedded chunk is a complete unit of meaning. [Read →](https://customlabs.io/patterns/structure-aware-chunking/) ### [Retrieve-then-rerank](https://customlabs.io/patterns/retrieve-then-rerank/) A cheap first pass pulls 50 to 100 candidate documents. A cross-encoder reranker then re-sorts them and applies a relevance floor. The first pass is usually vector search, optionally fused with keyword search. The cross-encoder scores the query and each candidate together. The floor lets the system return nothing when no candidate fits. [Read →](https://customlabs.io/patterns/retrieve-then-rerank/) ### [Change-data-capture ingest](https://customlabs.io/patterns/change-data-capture-ingest/) The ingest pipeline subscribes to change events from the source system. This replaces re-crawling on a fixed schedule. The events come from a webhook or a CMS publish hook. An edit triggers a re-embed within minutes. A delete writes a tombstone that excludes the old chunks from retrieval at once, before a full re-index runs. [Read →](https://customlabs.io/patterns/change-data-capture-ingest/) ## Failure modes ### [Stale index serves deleted content](https://customlabs.io/failure-modes/stale-index-serves-deleted-content/) Your retrieval index was built once at ingest and never told the source changed. When a document is edited or deleted, nothing re-embeds the new version or tombstones the old chunk. The stale vector keeps scoring well and keeps getting served with confidence, giving the reader no signal that it is out of date. [Read →](https://customlabs.io/failure-modes/stale-index-serves-deleted-content/) ### [Chunk boundary splits the answer](https://customlabs.io/failure-modes/chunk-boundary-splits-the-answer/) The answer exists in the source, but a fixed-size chunker cut it in half at ingest time. A table row lost its header. A procedure lost its trigger condition. Each half scores weakly on its own, the ranker drops both, and retrieval reports nothing when the document plainly contains the answer. [Read →](https://customlabs.io/failure-modes/chunk-boundary-splits-the-answer/) ### [Similarity is not relevance](https://customlabs.io/failure-modes/similarity-is-not-relevance/) Cosine similarity rewards topical resemblance, not correctness. It can rank a document about the wrong product or the wrong date above the one that answers the query. It can do the same for the negated version of a claim. Embeddings capture topical similarity far more reliably than they capture identifiers, negation, or numbers. [Read →](https://customlabs.io/failure-modes/similarity-is-not-relevance/)