tutorials

Better Questions: When the Corpus Is Fine and the Question Is the Problem

13 min read

A customer asked the support bot a simple question: can I get my money back? The bot said yes, confidently, and cited a marketing page that mentioned the money-back guarantee. The actual refund policy sat in the index the whole time - the thirty-day window, the restocking fee, the exclusions, the return shipping terms. Retrieval never surfaced it.

Nothing was wrong with the corpus. The policy was loaded, chunked cleanly, embedded, current. The problem was the shape of the question. “Can I get my money back” is six vague words of interrogative English, and the refund policy is a page of dense declarative prose. In embedding space those two texts sit far apart, while the marketing page, which at least talks about money-back the way customers do, sits closer.

This is Post 2 in the Retrieval Patterns series. Post 1 covered the upgrades every production RAG makes first - hybrid retrieval, reranking, caching, all working on the retrieval stage. This post moves one step earlier in the pipeline, to the query itself.

When the question is the problem

Post 1 assumed the query was a fair representation of what the user needed. That assumption fails in four distinct ways, and each failure has a named pattern attached.

Sometimes the question does not look like its answer. Sometimes the question means several things at once, and any single reading is a coin flip. Sometimes the question is the first in a sequence so predictable that waiting for the user to type it is wasted latency. And sometimes the question never needed the corpus at all, because the model already knew the answer.

The unifying move across all four patterns: the typed query is raw material; the retrieval input gets built from it. The corpus never changes. The question gets rewritten, multiplied, anticipated, or vetted before retrieval runs - and in one case, retrieval never runs at all.

HyDE

Retrieval uses the question as the search key, and questions make bad search keys. They are short and phrased the way people ask. The documents they are hunting for are written in a different register entirely - dense, declarative, full of detail. HyDE - hypothetical document embeddings - takes the counterintuitive route: instead of improving the question, it discards it. A language model writes a hypothetical answer first, a made-up paragraph phrased the way a real answer document would read. That paragraph gets embedded and searched in the question’s place. Real documents cluster near it, because answers look like other answers even when they look nothing like the question.

The made-up details can be wrong, and often are. The search only needs the shape. The technique comes from a 2022 paper, Precise Zero-Shot Dense Retrieval without Relevance Labels, and the zero-shot part matters: no relevance-labeled training data required, which is the part most teams do not have.

A vague question rewritten into a policy-shaped paragraph that lands beside the real policy document, versus an invented detail leading the search away from a verbatim match

Where it earns its keep. Vague or underspecified questions over a declarative corpus: policy documents, research literature, knowledge bases, product catalogs. Anywhere users describe what they want instead of naming it.

Example. The refund question from the opening. HyDE writes its hypothetical - a short paragraph about return windows and restocking fees, phrased like a policy. That paragraph embeds right next to the actual refund policy, which now outranks the marketing page. The customer gets the thirty-day window instead of the slogan.

Where it doesn’t. One extra generation call per query, paid in latency and spend. The hypothetical can also drift: the model invents specifics, the embedding chases the invention, and retrieval follows it away from the real answer.

Counterexample. A user asks whether the CBX-2200 supports firmware 3.2. The hypothetical confidently invents a plausible answer full of made-up firmware detail, and the search hunts for the invented specifics. The verbatim match - one line in the product datasheet - never stood a chance. Exact-string queries want the opposite movement: keyword search, from the first post.
Paper or production? paper
production

Production where it fits, harmful outside it. Every major retrieval framework ships an implementation, and real search systems use it on vague query traffic. It is a targeted tool rather than a default - the exact-string counterexample above is the boundary most teams discover by accident.

Branched RAG

Some questions are not vague so much as undecided. “I want to change my subscription” could mean upgrade, downgrade, cancel, or a billing problem, and any single interpretation is a guess. Branched retrieval refuses to guess. The query fans out into its plausible readings, each branch retrieves and generates independently, and a synthesis step either selects the strongest answer or presents the readings side by side.

A subscription question splitting into parallel branches that each reach the right document, versus an unambiguous query fanning into pointless branches at triple cost

Where it earns its keep. Genuinely ambiguous intents where wrong guesses are expensive: account management, support triage, legal or research questions where several readings are both correct. Discovery-oriented systems, where showing the readings is more useful than picking one.

Example. "I want to change my subscription" branches three ways. The upgrade branch retrieves the plan comparison, the downgrade branch retrieves the billing terms, the cancel branch retrieves the cancellation policy. Synthesis finds the strongest evidence behind upgrade - the account is two seats over its plan limit - and answers that reading, with the other paths one tap away.

Where it doesn’t. Cost multiplies by branch count, retrieval and generation both. Synthesis is the hard part, and a synthesis that picks the wrong branch confidently is worse than a plain guess, because now the wrong answer arrives with citations. And often the right move is neither branch nor guess: ask the user. A clarifying question costs one round-trip. Branching costs a full pipeline per reading, so it earns its keep only where clarification costs more than coverage.

Counterexample. An invoice portal where "where is my invoice" makes up most of the traffic. The question has exactly one reading, and the system still fans every query into three branches - triple the retrieval bill on the highest-volume traffic, for coverage nobody needed.
Paper or production? paper
production

Production in parts. Multi-query expansion, the cheaper ancestor, is standard search practice. The full parallel branch-and-synthesize pipeline is bespoke engineering, built per product, and the synthesis step is where most implementations struggle.

Speculative prefetch

Conversational systems have a predictable rhythm: the follow-up question is rarely a surprise. Speculative prefetch uses that rhythm. While the current answer is still generating, the system predicts the questions likely to come next and retrieves for them in the background, storing results in a short-lived cache. Predict right, and the next turn feels instant. Predict wrong, and you paid for retrievals nobody used.

A password-reset answer served while follow-up documents warm in a background cache, versus a cache full of prefetched answers nobody asked for

Where it earns its keep. Conversational products with predictable sequences: support flows where reset-my-password reliably leads to enable-two-factor and update-the-email, onboarding walkthroughs, guided shopping. The predictable part is the requirement.

Example. A user resets a password. While the answer streams, the system prefetches the two-factor setup doc and the username-change doc into cache. The follow-up arrives twenty seconds later, as it usually does, and the answer comes back before the user finishes reading it.

Where it doesn’t. Hit rate is the whole game, and prefetch cost is paid on every turn whether predictions land or not. Ad-hoc traffic breaks it - analysts and researchers do not ask predictable questions. And a prefetched answer is an older answer, so the cache inherits the freshness problems of every cache.

Counterexample. An internal research assistant used for ad-hoc analysis. No two sessions rhyme, the prediction hit rate sits near zero, and the cache fills with entries nobody reads. The retrieval bill grows by half with no user-visible benefit to show for it.
Paper or production? paper
production

Mostly bespoke in RAG products. Speculation itself is decades-old systems practice - processors and CDNs run on it - but predictive prefetch inside retrieval pipelines is hand-built and rare. Teams tend to add it late, once conversation latency is a measured complaint rather than a guess.

SEAKR

The most radical question-side move is asking whether retrieval should happen at all. SEAKR - self-aware knowledge retrieval - has the model estimate its own uncertainty first. Confident, and the model answers from internal knowledge while retrieval never fires. Uncertain, and the system retrieves as usual. Retrieval becomes a cost you pay only when the model needs it, which on mixed traffic can be a large share of queries.

The mechanism comes from a 2024 paper, Self-aware Knowledge Retrieval for Adaptive Retrieval Augmented Generation, which reads uncertainty from the model’s internal states rather than asking the model to grade itself. That distinction matters, because a model asked to grade itself tends to hand out high marks.

A common question answered straight from the model while retrieval sleeps, versus a confident gate skipping the retrieval a private-corpus question needed

Where it earns its keep. High-volume mixed traffic, where a large share of questions overlap stable public knowledge the base model already carries. A developer-tools assistant asked what a 302 redirect does gains nothing from retrieval - the answer has been stable for decades and every strong model knows it cold.

Example. On a developer support bot, forty percent of incoming questions are general programming knowledge. The gate answers those directly, retrieval fires only for product-specific questions, and the retrieval bill drops by a third without any measurable quality change on evaluation sets.

Where it doesn’t. The enterprise catch is structural: the questions your system exists to answer are the ones the model cannot know. Your catalog, your policies, your internal documents, your customer contracts - none of it was in the training data. “Answer from what it knows” is hollow exactly where it matters. Worse, confidence scores drift from reality, and an overconfident model skips the retrieval it needed - producing the worst failure shape in RAG, a confident answer with no retrieval to correct it.

Counterexample. A support bot for a product launched after the model's training cutoff. Asked about the new pricing tiers, the model answers fluently from internal nothing - it does not know what it does not know, which is the exact gap the retrieval system was built to cover. The gate stays closed. Retrieval never fires.
Paper or production? paper
production

Closest to paper of the four. The paper is from 2024, and production uncertainty estimation is still the unsolved part. Worth watching for a second reason: “should I retrieve at all” is the first decision the system makes about its own pipeline, and Post 4 is where that instinct grows up.

How the four compare

The four patterns answer different failure shapes, and the easiest way to keep them apart is what each one does to the question.

HyDE
rewrites the question
the query becomes its own hypothetical answer
Branched RAG
multiplies the question
every plausible reading gets its own pipeline
Speculative prefetch
anticipates the follow-up
retrieval runs before the user asks
SEAKR
vetoes the retrieval
confident answers never touch the corpus

Unlike the retrieval upgrades from Post 1, these do not form a sequence. They are independent responses to independent problems, and some combine - HyDE inside each branch of a branched pipeline, selective retrieval gating everything downstream. The spec sheets below compress the comparison.

HyDE rewrites the question
  • Fixes: the question and its answer sitting far apart in embedding space - vague queries over declarative documents
  • Slots: before retrieval; the hypothetical replaces the query as the search key
  • Costs: one extra generation call per query, plus whatever the hypothetical invents
  • Latency: adds a generation call up front - bounded, since the hypothetical is short
  • Reach for it when: questions are vague, the corpus is declarative prose, and no labeled training data exists to fine-tune on
  • Skip it when: queries carry exact strings - the invention biases the search away from the verbatim match
Branched RAG multiplies the question
  • Fixes: one query with several valid readings - the system forced to guess because it picked one
  • Slots: around the whole pipeline; each branch retrieves and generates independently before synthesis
  • Costs: retrieval and generation once per branch, plus a synthesis step someone has to design
  • Latency: branches race in parallel, so the multiplier hits cost harder than wall-clock; synthesis still adds a step
  • Reach for it when: ambiguity is common, wrong guesses are expensive, and clarifying questions cost more than coverage
  • Skip it when: traffic carries one reading per query
Speculative prefetch anticipates the follow-up
  • Fixes: conversational latency - the follow-up question waiting on a cold pipeline every turn
  • Slots: alongside generation; predictions retrieve in the background into a short-lived cache
  • Costs: retrieval spend on every turn whether predictions land or not, plus cache storage for answers nobody asked yet
  • Latency: near-instant follow-ups on hits; misses cost nothing the user can see and everything the bill can
  • Reach for it when: sessions follow predictable sequences and follow-up latency is a measured complaint
  • Skip it when: queries are ad-hoc - unpredictable traffic collapses the hit rate the whole pattern depends on
SEAKR vetoes the retrieval
  • Fixes: retrieval paid for answers the model already knew - cost and latency spent on questions the corpus added nothing to
  • Slots: in front of the pipeline as a gate; retrieval fires only when uncertainty crosses the threshold
  • Costs: a confidence-estimation mechanism to build and calibrate, plus a threshold tuned per domain
  • Latency: confident answers skip retrieval entirely - the fastest path in this post
  • Reach for it when: traffic mixes common public-knowledge questions with corpus-specific ones, at volumes where retrieval cost is worth gating
  • Skip it when: the corpus is private, which is nearly always - the questions the system exists to answer are the ones the model cannot know

The costs column deserves a second look before the section closes: every pattern here adds machinery around the query - a generation call, a multiplication factor, a prediction model, a confidence estimator - and none of them touches the corpus or the ranking. A better question still retrieves from the same index. That is the point of the next section.

The failure this group still won’t fix

Every pattern here assumes the answer is a document. HyDE searches the index with better bait. Branched searches it several times. Prefetch searches it early. SEAKR decides whether to search it at all. None of them can find an answer that never lived in embedded text.

Counterexample. A customer asks the storefront bot whether the CBX-2200 is in stock at the warehouse. The answer is a row in the inventory database, updated every few minutes - it was never a document at all. HyDE writes a fluent hypothetical stock-check answer. Branched explores the warehouse, store, and online readings. Prefetch warms the delivery-time pages. SEAKR fires retrieval right on schedule. Every upgrade ran correctly, against a source it never had.

The corpus bugs from Post 1 still apply - a badly chunked or stale index is upstream of everything in this post, and the check-first table in Why RAG Dies on the Real Corpus still comes first. But this failure is different in kind. The corpus can be perfect - freshly ingested, cleanly chunked, correctly ranked - and the answer still absent, because the answer is not a document. That is where Post 3 goes: SQL retrieval for rows, API augmentation for live data, GraphRAG for relationships, multimodal for everything that was never text.


Working With Flytebit

At FLYTEBIT TECHNOLOGIES, RAG development is a structured engagement rather than a workshop and a tool licence.

Query-side failures have a recognizable signature: the answer was retrievable, but the query never gave retrieval a chance. We diagnose in order - corpus first, retrieval mechanics second, query shape third - because each layer is cheaper to rule out than to fix. Teams usually arrive having already tuned the query layer, since prompts are the one layer everyone can touch. The corpus audit is the one nobody ran, and the feasibility study is where it happens.

We run these pipelines in our own products. PASSR assembles its retrieval input from the diff, the changed symbols, and the review question being asked rather than from anything a user typed - the typed-query lesson applied to machines, because what you feed retrieval decides what it can find. DOCKR regenerates documentation off predictable artifact changes, so its follow-up retrievals are closer to prefetch than to search - the sequence is known before anyone asks. TESTR lives with the ambiguity problem in miniature: a retrieval input that underdetermines what to fetch produces a test written against the wrong behavior.


Ready to get started?



Key Takeaways

  • The typed query is raw material. Questions and answer documents are phrased differently, mean several things at once, arrive in predictable sequences, or never needed the corpus - so the retrieval input gets built before retrieval runs. Each failure shape has a named pattern.
  • HyDE retrieves with an answer-shaped key. A generated hypothetical paragraph embeds near real answer documents even when the question sits far away. Strong on vague queries, actively harmful on exact strings - use keyword search there instead.
  • Branched retrieval is the expensive answer to ambiguity. Every branch is a full pipeline, and a synthesis that picks wrong delivers citations with the mistake. When a clarifying question is cheaper than coverage, ask it.
  • Speculative prefetch is a hit-rate bet. Predictable conversational sequences make follow-ups feel instant; unpredictable traffic turns the whole pattern into pure cost. Build it once follow-up latency is a measured complaint.
  • SEAKR gates retrieval on confidence, and confidence is the weak link. Private-corpus questions are exactly the ones the model cannot answer alone, so an overconfident gate produces the worst failure shape in RAG: fluent and wrong, with no retrieval to catch it.
  • A better question cannot find an answer that is not a document. Stock levels, balances, and live state live in systems of record. That failure belongs to the next group - different sources.

The series intro:

👉 Retrieval Patterns: From Naive RAG to Agentic Retrieval

Frequently Asked Questions

What is HyDE in RAG?

HyDE, short for hypothetical document embeddings, fixes a matching problem: questions and their answers often sit far apart in embedding space because they are phrased differently. Instead of embedding the question, HyDE has a language model write a short hypothetical answer, embeds that, and retrieves real documents that resemble it. The invented details do not matter, because only the shape of the text acts as the search key. HyDE helps most when questions are vague and the corpus is declarative prose. It hurts exact-string queries, where hybrid search is the right tool.

Does HyDE work for exact-match queries like part numbers?

No, and it can make them worse. HyDE generates a hypothetical answer and retrieves documents that resemble it. For a query built around a part number or error code, the model invents plausible details, and the search drifts toward the invention instead of the verbatim string. Exact-match traffic is a keyword problem, which hybrid search and BM25 solve. HyDE is for the opposite failure: questions so vague that nothing in the corpus matches how they are phrased.

How do I handle ambiguous questions in a RAG system?

Two honest options. The cheap one is a clarifying question: when intent is ambiguous, ask before retrieving. The expensive one is branched retrieval, which runs the pipeline once per plausible reading and either selects the strongest answer or presents the readings side by side. Branching earns its cost when clarification is worse than coverage, for example high-volume support traffic where wrong guesses generate tickets. On traffic where most questions carry one reading, branching multiplies cost for nothing.

Should a RAG system retrieve for every query?

Not necessarily. If a large share of traffic asks things the base model already knows, stable public knowledge included, selective retrieval answers those from internal knowledge and reserves retrieval for the rest. The catch is confidence estimation: an overconfident model skips retrievals it needed, and most enterprise content was never in the training data, so the questions RAG exists to answer are exactly the ones the model cannot answer alone. Treat selective retrieval as a cost measure to add carefully, after answer quality is proven.

Which query-side pattern should I try first?

Diagnose before buying. Most retrieval complaints trace to the retrieval stage itself or the corpus, so the upgrades from the first series post and the corpus check-first table come before anything here. Among query-side patterns, HyDE is the cheapest experiment: one extra model call and a prompt change, measurable within a day on a small query set. Branched retrieval and selective retrieval are larger commitments, and prefetch only makes sense once conversational follow-up latency is a measured complaint.

#RAG#RetrievalAugmentedGeneration#HyDE#QueryRewriting#AIEngineering#TutorialSeries
Jayaveer Bhupalam

Written by

FLYTEBIT Technologies

Founder · Chief Technology Officer · AI & Digital Transformation Leader

Ready to Transform Your Business with AI?

Let's discuss how Agentic AI and intelligent automation can help you achieve your goals.