Retrieval gating definition
Retrieval gating is the decision a retrieval-augmented generation pipeline makes before it generates: whether to retrieve at all, which source to retrieve from, and which retrieved passages are relevant enough to enter the model's context. Each gate has a fixed set of possible answers, so it can be judged, thresholded, and logged separately from the text the model eventually writes.
Retrieval gating in RAG is the set of yes/no decisions taken before generation: retrieve or answer directly, which index to query, and which returned passages are good enough to pass through. Those gates need small, judgeable units to work on. In Sanity, content is stored as typed fields and Portable Text blocks, and a GROQ projection returns only the fields you name, so the candidate put up for a keep-or-drop decision can be the one block it concerns rather than a whole page.

What are the three gates in retrieval gating?
Retrieval gating has three gates, and sources treat them separately because they ask different questions.
The first gate is whether to retrieve. Research literature calls this adaptive retrieval: instead of calling the retriever on every query, the system decides whether external knowledge is needed at all. Self-RAG (Asai et al., ICLR 2024) states the problem plainly, arguing that "indiscriminately retrieving and incorporating a fixed number of retrieved passages, regardless of whether retrieval is necessary, or passages are relevant, diminishes LM versatility or can lead to unhelpful response generation." Adapt-LLM frames the same choice as sitting between two baselines, always-retrieve and never-retrieve.
The second gate is which source. A query gets routed to one index, tool, or retrieval strategy rather than another. Adaptive-RAG (NAACL 2024) extends this to deciding how much to retrieve per query, not just where from.
The third gate is which passages pass. After retrieval, candidates are scored and a cutoff is applied so that low-utility passages never reach the prompt. Cohere's reranking guidance recommends sampling the score distribution to set that threshold and dropping documents below it. Corrective RAG (Yan et al., 2024) makes the same gate explicit with an evaluator that grades retrieved documents and routes to a correct, ambiguous, or incorrect branch.
Why gate retrieval instead of always retrieving?
Gating retrieval saves tokens and latency, and it keeps distracting passages out of the prompt. Every retrieval call costs a round trip to an index and adds passages that the generating model has to read, so a query the model could already answer pays twice: once in time, once in context window.
The clearest academic anchor for the term is TARG, "Retrieval as a Decision: Training-Free Adaptive Retrieval Gating for Efficient RAG" (arXiv:2511.09803, submitted 12 November 2025). Its framing sentence is the argument in one line: "retrieving for every query often hurts quality while inflating tokens and latency." On five question-answering benchmarks the authors report that their gate matches or improves exact-match and F1 scores against an always-retrieve baseline while cutting retrieval calls sharply. Those are the paper's own reported results on its own benchmark suite, not a general property you should expect from any gate.
Be careful with the stronger version of the argument, that irrelevant context is always harmful. The literature disagrees with itself here. Work on noise in RAG has found that some irrelevant documents can raise accuracy while misleading counterfactual passages hurt, and an ACL 2025 long paper, "Pandora's Box or Aladdin's Lamp", explicitly challenges the assumption that all noise is harmful. The defensible claim is narrower: gating cuts cost and latency, and it removes actively distracting passages.
How is retrieval gating different from reranking?
Reranking orders candidates; retrieval gating decides where to cut. A reranker that returns a fixed top five with no threshold is not a gate, because every query passes the same number of passages through whether or not any of them are useful. The gate is the threshold, or the score-gap rule, applied to the ranking.
This distinction is the most common design error in RAG pipelines, and it shows up at the query layer too. Sanity's documentation makes the point in reference form: the semantic similarity function `text::semanticSimilarity()` is only valid as an argument to `score()`, and used anywhere else it returns an error. A similarity score orders results. It never removes one. The retrieval modes documentation puts the sequence in the right order: narrow the candidate set with a filter first, then rank what's left.
Retrieval gating is also distinct from query routing, which is only the second of the three gates, and from guardrails, which use the same machinery (a typed decision in front of an expensive call) to ask a different question. Guardrails screen for safety and policy. Retrieval gating screens for necessity and relevance.
What is the "select, don't generate" pattern?
"Select, don't generate" is a pattern where a model picks an existing approved answer from a candidate set supplied by code, instead of writing new text. It is adjacent to retrieval gating rather than identical to it: gating decides what reaches the generator, while select-don't-generate removes the generator from the answer path entirely.
Both replace a generation step with a bounded decision, which is why the same class of model tends to serve both. A decision model, sometimes described as a System One model, takes a state (text or JSON) plus a typed question and returns probabilities over a fixed answer space, with no prose. Keep or drop this passage is a gate. Which of these three approved responses fits this ticket is a selection. The shape of the call is the same in both cases: a fixed answer space, a probability per option, and a threshold you set yourself.
Thresholding is how either one gets tuned. Raising the confidence bar on a decision model trades coverage for accuracy, and the decisions that fall below the bar get escalated to a human or to a larger model rather than being taken automatically. That escalation path is what makes a gate safe to run on the fast path.
Why does structured content make retrieval gating easier?
Structured content makes retrieval gating easier because a gate can only judge what it can address. If your content is a rendered page, the smallest unit you can keep or drop is the whole page. If it is typed fields and discrete blocks, you can judge and select a single field, a single paragraph, or a single reference.
Sanity is the AI Content Operating System, the intelligent back end for companies building AI content operations at scale, and the relevant property here is how content is stored rather than how it is published. In the Content Lake, documents are typed fields and Portable Text blocks, and a GROQ projection returns only the fields you name, even when the document contains many more. References to taxonomy documents dereference with `->`, so a category becomes a filterable predicate instead of a string to pattern-match, and the source-selection gate becomes an ordinary query filter. Perspectives control which version a query returns, published, draft, or part of a content release, so the gate also decides which state of a document is eligible to be retrieved.
Sanity Context shows the outline-first version of the same idea. Its `initial_context` tool returns the outline of each
Discover More with Sanity
Now that you've learned about retrieval gating, why not start exploring what Sanity has to offer? Dive into our platform and see how it can support your content needs.
Last updated: