
People ask about situations. Documents describe rules. We gave a restaurant voice agent another way to connect the two by making each passage searchable through the questions it can answer.
TL;DR
A knowledge base can contain the right answer and still fail to put it within an agent’s reach. We gave a restaurant voice agent a second way to find it: search the questions each passage can answer, alongside the passage itself.
That second route recovered useful information that passage-only search missed. In our follow-up analysis, several of those recoveries turned previously incorrect answers into correct ones. We built the approach into the existing Rails and PostgreSQL application, kept every match tied to its original source, and generated the questions before conversations began.
We tested five configurations across 460 questions, producing 6,900 answers. The main comparison maintained comparable accuracy within our predefined five-percentage-point margin. The result is a practical extension to RAG that puts previously overlooked knowledge within reach, backed by an implementation that fits the product and an evaluation of the answers it produces.
We were working on a voice agent for restaurant managers. The goal was practical: a manager could ask a question in the middle of a shift and get an answer based on the restaurant's own documents, without having to stop and search through a handbook.
Imagine a table ordering beers. One guest looks young and says she left her ID in the car. The manager asks the agent, “Can I serve her?” That is the kind of question the product needed to handle: a spoken description of a situation, with details that can change the answer.
We defined clear requirements for the answer: reflect the applicable guidance and restaurant policy, preserve the conditions that affect the manager’s decision, and cite the supporting passage. Clear communication when a question goes beyond the available documents was part of the same design.
Behind the conversation, a RAG tool searches the knowledge base and returns passages for the answer model to use. That makes retrieval part of the decision the manager receives: it determines which source material the model has available when it answers.
Finding the right rule in everyday language
A manager tells a short story. A policy organizes information into requirements, conditions and exceptions. The manager should not have to know the formal heading or the document's terminology before the agent can find the relevant passage.
Semantic search connects different phrasings by comparing meaning. The product task goes further: find the passage that covers the conditions the question turns on. For alcohol service, that means retrieving the guidance relevant to the manager’s specific situation.
My approach was to give retrieval another representation of the same knowledge: the questions a passage can answer. We kept the original passages searchable and added questions phrased as a manager might ask them, with every match leading back to the source.
We gave each passage a second way in
The idea was to give the search system another representation of the same knowledge. Alongside the passage, store the questions someone might ask when they need the information inside it.
A model writes those questions when the document is loaded. Each question gets an embedding, a numerical representation used for similarity search, and stays linked to its source passage. When a manager asks something, the system can match it against the original text and against the stored questions.
Our implementation gives each passage the stronger of those two scores. It combines the candidates, removes duplicate passages, and applies a similarity floor before passing source text to the answer model. A passage has two opportunities to be found, while still occupying one place in the context.

Conceptual view of the semantic retrieval path. Generated questions help rank source passages; the original text supplies the evidence for the answer.
This approach builds on research into searching with generated questions, including HyPE, HyQE and Doc2Query++. We applied it inside the agent’s existing search, with the same document filters and source citations. The implementation and its results are the focus here.
A concrete example
Take a simple handbook procedure. Its language describes responsibilities; the manager's language describes a problem.

Fictional handbook example illustrating how a question connects to its source.
The stored question gives the search another route to that procedure. The original passage anchors the answer in the documented reporting steps. Repair instructions and decisions about continued use call for their own supporting guidance.
The details matter once it becomes a product
We make document scope part of the retrieval design. Before ranking candidates, we filter by restaurant, language and jurisdiction. That keeps the search focused on the document collection applicable to the manager’s question.
We give generated questions a specific role: helping search find the original passage. The passage remains the evidence for the answer. We use a similarity floor to screen candidates and treat support for the answer as a separate requirement: the response must stay within what the source actually says.

Scope filters and a similarity floor constrain retrieval. The answer still has to stay within what the returned passages support.
We integrated the second route into the existing Rails application and PostgreSQL retrieval stack. Question generation and embedding run during ingestion, keeping that preparation outside the live conversation. The application handles the additional vector storage and search work without a new question-generation call for each manager’s question.
We checked both steps: did the search find the needed information, and did the agent use it to answer correctly?
We tested the answers, too
To test the search change, we kept the documents, answer model and instructions the same. We compared searching passages alone with searching passages and their attached questions together.
The wider study tested five configurations on 460 separately written questions in English and Spanish. Each answered every question three times: 6,900 answers in total.
- Set the rules first. We agreed how to compare accuracy and harmful claims before opening the test questions.
- Use blind grading. The graders checked each answer against the required facts without seeing which search produced it.
- Check repeatability. We repeated each question to capture variation and kept repeated runs distinct from the question count.
- Review the evaluation code. Separate reviewer sessions checked the calculations and failure handling. We retained interrupted runs and their costs as part of a traceable evaluation.
Two AI graders checked the answers without knowing which search method produced them. A third resolved specified disagreements. Every answer received a score.
Afterward, we traced which source passages reached the agent. That let us see where finding missing information also helped the agent answer correctly.
What changed and what we learned
The engineering takeaway
Make the passage easier to find. Keep the source behind the answer.
Questions give the search another way to find a rule. The original passage supplies the facts and the citation. Preparing those questions when documents are loaded avoids an extra question-generation call during the conversation.
The second route did what it was designed to do: it reached information that passage-only search missed. In our follow-up analysis, several of those recoveries turned answers that had been wrong into correct ones. That is the heart of the idea. An agent can only apply a rule if search puts that rule within reach, and the second route widened that reach.
It did this while holding accuracy steady. On the main test, the version with the second route stayed within the five-percentage-point margin we had set before seeing any results. Blind graders from two different AI providers scored every answer without knowing which search produced it, so the result stands on a comparison designed in advance.
That points directly to the next step. Each route finds things the other misses. The opportunity now is in choosing what reaches the answer model: keep everything the original search already finds, and add what only the second route can see. Finding more was the first half. Choosing well is where the next gain lies.
If you want to try this in your own workflow
Make the knowledge searchable in the user’s language. Attach answerable questions to each passage. Search both the questions and the original text, and use the original text to write the answer.
Choose the evidence that reaches the answer. Compare what each route contributes, preserve useful existing passages, and make room for additional relevant matches within the model’s context limit.
Evaluate the complete answer. Hold the writer fixed when comparing search methods, and check factual accuracy, support from the source documents, and decisions to answer or decline based on the agent’s scope and available evidence. That connects retrieval decisions to the quality of the response.

The product answers a manager’s question. A separate evaluation compares configurations and informs the next engineering decision.
The design starts with a practical question: how would someone ask for the information in this passage? At Rootstrap, we made those questions searchable, kept every match connected to its source, and evaluated the answers. Bringing retrieval design, product integration and answer evaluation together gives teams a concrete way to make better use of the knowledge they already have.
Research references
These papers informed the retrieval design. The results discussed in this article come from our own implementation and evaluation.
- HyPE: Hypothetical Prompt Embeddings Vake, Vičič and Tošić. Methodology, section III: generated question embeddings linked to source chunks.
- HyQE: Ranking Contexts with Hypothetical Query Embeddings Zhou et al., Findings of EMNLP 2024. Uses passage and hypothetical-query similarities to rank candidate contexts.
- Doc2Query++: Dual-Index Fusion Kuo et al., preprint. Section 3.4 describes separate text and query indices and weighted score fusion.
- Doc2Query--: When Less is More Gospodinov, MacAvaney and Macdonald, ECIR 2023. Studies filtering harmful generated queries before indexing.


