Enterprise knowledge · Research feature

New AI Framework Improves Document Retrieval by Precomputing Hypothetical Prompts

A new method pre-computes hypothetical prompts during indexing to better align user queries with relevant document content in AI retrieval systems.

Adapted from research by Domen Vake, Jernej Vičič, Aleksandar Tošić.

arXiv preprint revision · 2026-07-31 · Attribution & reuse
In this article
Editorial illustration of linked workflow.

Editor’s introduction

The study evaluates Hypothetical Prompt Embeddings (HyPE), a framework that generates hypothetical prompts during the indexing phase rather than at query time. Researchers compared HyPE against standard RAG and Hypothetical Document Embeddings (HyDE) across six datasets, measuring gains in retrieval precision and recall. The findings are based on experiments using the Mistral-NeMo model, which offers open access and reproducibility. The evidence supports HyPE’s effectiveness in reducing query-time overhead while enhancing retrieval accuracy.

Introduction

Retrieval-augmented generation (RAG) systems have emerged as a powerful paradigm in natural language processing, combining the strengths of retrieval-based approaches with the generative capabilities of large language models (LLMs). By leveraging external knowledge sources, RAG systems enhance the factual accuracy and relevance of generated responses, addressing the limitations of standalone generative models, such as outdated knowledge or limited access to restricted information. Despite their success, existing RAG implementations often struggle with aligning retrieval and generation in a way that efficiently bridges the gap between user queries and relevant document content.

To optimize retrieval performance, researchers have explored a variety of strategies, ranging from efficient chunking (splitting texts into coherent subunits) to re-ranking methods that refine initial retrieval results via cross-encoders or boosted similarity scoring. Advanced frameworks such as GraphRAG exploit graph structures to capture cross-document relationships for more nuanced multi-hop or contextual queries. Meanwhile, domain adaptation techniques focus on tailoring retrieval to specialized topics, ensuring that queries can be matched effectively, even in areas where language models might otherwise lack expertise.

Despite these efforts, a persistent hurdle in RAG remains the mismatch between user queries, which typically adopt an interrogative style, and corpus content, which is usually expository or declarative in nature. This style difference hampers the alignment of query embeddings with document embeddings, occasionally allowing key information to go unretrieved. A notable solution to this problem is Hypothetical Document Embeddings (HyDE), which prompts an LLM at query time to generate a synthetic answer, then uses that short text as the query for retrieval.

In this paper, we introduce Hypothetical Prompt Embeddings (HyPE), a new approach that tackles query–document style mismatch without adding overhead to every user request. Rather than generating synthetic answers at inference, HyPE precomputes multiple hypothetical questions for each corpus chunk at indexing time. These question-like prompts are embedded and stored, so that query matching effectively becomes a question–question retrieval problem. By shifting hypothetical generation offline, HyPE avoids additional runtime LLM calls.

To evaluate HyPE’s effectiveness, we compare it against a naive RAG implementation and HyDE across multiple datasets and evaluation metrics, including precision, recall, and faithfulness. Our results demonstrate that HyPE offers substantial improvements in retrieval efficiency, reducing the computational burden while achieving comparable or better retrieval accuracy and contextual relevance.

By shifting the hypothetical generation process from runtime to indexing, HyPE represents a scalable and efficient alternative for RAG systems, offering practical benefits for real-world applications requiring fast and reliable retrieval-augmented text generation. The rest of the paper is structured as follows: Section II presents the related works and surveys, Section III presents the used methodology. Follows the presentation of the experiment setting with the presentation of the datasets and the evaluation metrics. Section V presents the results with thorough analysis, Section VI presents the finals conclusions.

Lewis et al. introduced the original RAG framework, combining dense retrieval with generation to mitigate hallucination and provide grounding via external documents. While effective, early RAG pipelines often suffer from limitations in retrieval precision by simply embedding the user queries and retrieving text chunks via approximate nearest neighbour (ANN) search over a vector index. However, a persistent challenge remains: user queries are often phrased in question form, whereas documents or chunks are stored in an expository or statement-oriented style, creating a semantic or “lexical–conceptual” gap. This mismatch can degrade the retrieval’s accuracy and ultimately weaken the generative model’s faithfulness.

One direction of research attempts to alleviate this mismatch by expanding documents with likely queries. For instance, Doc2Query uses a sequence-to-sequence model (often T5) to generate synthetic questions for each document, appending them to the text so that a bag-of-words ranker like BM25 can match real user queries more easily. While Doc2Query often boosts first-stage recall, subsequent studies noted that the generation process can hallucinate irrelevant expansions, leading to index bloat. Among them, Doc2Query– (Minus-Minus) addresses this by filtering out low-quality expansions, improving accuracy and reducing index size for BM25-based retrieval. However, these methods predominantly operate in a lexical retrieval space rather than dense embeddings, and they store expansions as text appended to each document and, as such, act more like an enrichment of the chunks.

Another related direction focuses on generating synthetic training data to train or fine-tune dense retrievers in new domains. Ma et al. propose using a question-generation model, trained on general-purpose Question-Answer(QA) pairs, to generate “pseudo-queries” for domain-specific passages. A dual-encoder retrieval model is then trained on these synthetic (question, passage) pairs—effectively learning domain adaptation in a zero-shot setting. While powerful for building domain-specialized retrievers, the method requires re-training or fine-tuning a dense model on large-scale synthetic data. By contrast, our approach bypasses model re-training at retrieval time and, instead, alters how we store the passages (i.e., their hypothetical question embeddings).

More recently, HyDE addresses query–document mismatch by generating a hypothetical answer or short passage at query time. Instead of embedding the user’s question directly, HyDE prompts an LLM to produce an approximate response, then embeds that synthetic text. This is used to retrieve relevant real documents from a vector index. While HyDE can improve retrieval accuracy for zero-shot question answering, it incurs an extra inference cost per user query. Additionally, the method may struggle, where the prompt queries for niche domain knowledge, where the model may not have sufficient knowledge to produce a representative sample. Building on this line of work, Eibich et al. conducted an empirical study comparing RAG retrieval enhancements, including HyDE, reranking, multi-query expansion, and maximal marginal relevance (MMR). Their findings highlight HyDE’s strong performance in both recall and faithfulness metrics, while also noting its trade-offs in runtime efficiency.

Several surveys have recently addressed retrieval-augmented systems. Gupta et al. and Cheng et al. offer extensive taxonomies of retrieval mechanisms, identifying open challenges in domain adaptation, embedding alignment, and inference efficiency. Notably, both surveys identify the need for methods that preserve retrieval quality while reducing reliance on runtime LLM calls.

Methodology

HyPE addresses the challenge of aligning user queries and relevant content by pre-computing hypothetical prompts at the indexing stage, contrasting with HyDE’s runtime generation of synthetic answers. This shift avoids additional inference overhead per query and improves retrieval precision by ensuring that both user queries and stored embeddings share a question-like form.

This question–question alignment increases the probability of finding the correct chunks for two main reasons. First, many embedding models exhibit style-based clustering. Texts of similar form (e.g., interrogative sentences) often lie closer in the vector space. As a result, a user’s real-world query naturally aligns more closely with the hypothetical prompts that share its interrogative style. Second, generating multiple hypothetical queries per chunk broadens the “semantic reach,” covering a wider range of possible question formulations. Even if a user query is phrased in a slightly different way, there is a higher chance that at least one of the chunk’s hypothetical questions closely corresponds to it.

Another advantage of HyPE lies in how it addresses the inherent chunking tradeoff in retrieval systems. If chunks are too large, their embeddings become less precise because they encode a mix of multiple concepts, making vector-based similarity less reliable. Conversely, reducing chunk size improves embedding specificity but risks losing crucial surrounding context. HyPE mitigates this issue by ensuring that each stored vector represents a specific piece of information within a chunk, while retrieval still returns the entire chunk with its broader context. This allows the system to retain the benefits of detailed, fine-grained embeddings without sacrificing the context for accurate retrieval.

Experiments

We evaluated three RAG pipelines to assess retrieval and generation performance as presented in Table I. While a naïve retriever establishes how much can be achieved without any style-bridging, HyDE is the only published RAG component that explicitly targets the same “question-to-statement” gap as HyPE, albeit at inference time via synthetic-answer generation. Including HyDE therefore yields a good comparison and isolates the effect of moving hypothetical content creation from the query stage (HyDE) to the indexing stage (HyPE).

For evaluating the RAG pipelines, we used the RAGChecker framework, a comprehensive evaluation toolkit developed by Amazon Science for assessing both retrieval and generation performance in RAG systems. It provides structured metrics to analyse retrieval effectiveness through context precision, which measures how many retrieved passages are relevant, and claim recall, which assesses whether all necessary information is retrieved.

For generation, RAGChecker evaluates faithfulness, ensuring the generated text remains grounded in the retrieved passages, along with the hallucination rate, which identifies unsupported claims, and context utilization, which measures how effectively retrieved passages contribute to responses. Additionally, it assesses robustness through noise sensitivity, testing the system’s response to query variations, and self-knowledge, which quantifies the model’s ability to recognize when it lacks sufficient information. Additionally, it computes precision, recall, and F1 scores, providing an overall measure of retrieval and response accuracy.

Datasets

All datasets already come pre-segmented into chunks, except for RAG-dataset-12000 that contains a single context block, and MultiHopRAG, which contains multiple larger documents. For these two cases, we manually split the source text into segments of maximum 500 tokens, overlapping each segment by 50 tokens to preserve cross-boundary coherence. This approach, while straightforward, may not be optimal as the choice of chunking strategy can significantly impact retrieval effectiveness and quality of generation. Accordingly, we apply the same chunking procedure across all three pipelines for consistency in our experiments, but we note that different pipelines might benefit from tailored chunking strategies. We leave an in-depth exploration of chunk size, overlap, and other segmentation heuristics as a direction for future research.

Evaluation metrics

We chose Mistral-NeMo because its openly released weights make the model easy for anyone to download and run, ensuring that every result in this paper can be reproduced without relying on a commercial API. During the time of testing, published benchmark scores place it in the top tier of 7-13 B open-source LLMs for instruction following and QA, so it provides competitive generation quality while remaining fully replicable.

Results with analysis

HyPE consistently achieves higher context utilization and faithfulness, indicating that its retrieval strategy provides more relevant and coherent supporting text for generation. However, the performance on noise sensitivity metrics presents a more nuanced picture. For ’Noise sensitivity in relevant contexts’, HyPE registers a higher score compared to Naive RAG and HyDE. Within the evaluation framework, this higher score signifies worse performance, suggesting the generator makes more errors when relevant retrieved documents are affected by noise. A potential explanation lies in HyPE’s retrieval of multiple copies of the relevant chunks. Although beneficial for faithfulness through reinforcement, this very redundancy could increase the generator’s susceptibility to errors since noise is repeated along with relevant information. Conversely, HyPE shows marginally better performance on ’Noise sensitivity in irrelevant contexts’ (achieving a slightly lower score), indicating slightly improved handling of noise associated with irrelevant documents compared to the baseline methods.

HyPE also exhibits lower hallucination rates compared to Naive RAG and HyDE, reinforcing the idea that better-aligned retrieval reduces the likelihood of introducing incorrect or unsupported claims. Although these results are based on a single LLM, the trend is likely to generalize across different models, as improvements in retrieval typically translate to improved generation performance. However, the exact degree of impact may vary depending on the LLM’s retrieval dependence and sensitivity to context quality. The combination of improved context grounding, reduced hallucinations, and stronger response alignment highlights HyPE’s potential for enhancing the reliability of RAG systems.

The MS MARCO benchmark stands out as an outlier in our results, exhibiting comparable retrieval efficacy across the Naive RAG, HyDE, and HyPE pipelines. This convergence can be attributed to several factors inherent to the dataset that limit the differential impact of HyPE’s enhancements. Firstly, MS MARCO utilizes short, answer-centric passages (typically around 60 tokens), which facilitates strong baseline performance via direct query-passage matching, leaving less room for augmentation techniques to provide significant added value. Secondly, the high lexical overlap inherent between its web search-derived queries and corresponding passages substantially reduces the query-document style gap that HyPE aims to mitigate. Lastly, the high baseline retrieval scores observed in our experiments on MS MARCO, achieved even without augmentation using a powerful dense embedding model, suggest a performance saturation effect, where further architectural refinements struggle to yield significant marginal improvements. Consequently, while HyPE offers substantial gains on datasets characterized by longer documents and greater stylistic divergence between queries and context, its advantages are less pronounced given the specific properties of the MS MARCO passage retrieval task.

Although HyPE is evaluated here as a stand-alone retriever, its design is orthogonal to other retrieval-side optimization approaches and therefore combinable with them. For example, the pre-computed question vectors can feed into query-decomposition modules (which break multi-hop questions into simpler sub-queries), query-expansion or rewriting steps (such as Doc2Query or RePlug), and even re-ranking or multi-vector fusion frameworks like BM25 or ColBERT. In these composite pipelines HyPE simply replaces the original passage vectors while leaving the higher-level orchestration intact, making it a drop-in upgrade rather than a competing subsystem.

Conclusion

The paper presents Hypothetical Prompt Embeddings (HyPE), a framework that pre-computes hypothetical prompts at indexing time to reshape retrieval in RAG pipelines into a prompt-to-prompt matching process. Our experimental findings show that HyPE surpasses both Naive RAG and HyDE on multiple datasets and metrics, with notable gains in precision and recall. By eliminating the need for query-time synthetic answer generation and instead relying on strategically generated questions offline, HyPE improves efficiency and provides stronger alignment between user queries and relevant content.

Although HyPE may not outperform every specialized RAG variant in all domains, it offers a flexible and modular upgrade to existing pipelines. Swapping in pre-computed question embeddings remains compatible with advances in chunking, re-ranking, multi-vector retrieval, and fine-tuning large language models. HyPE also integrates smoothly into agent-based systems, where prompt-level alignment can help specialized retrieval sub-agents handle distinct query types more effectively.

Looking ahead, combining HyPE with GraphRAG, which maps information from documents or chunks as graph nodes, may further enhance multi-hop reasoning and retrieval accuracy in complex scenarios. Such a hybrid approach could be especially valuable for building robust RAG systems.

Another direction for future research involves investigating the chunking tradeoff in the context of expanding LLM context windows. As language models evolve to accommodate larger input lengths, it becomes increasingly feasible to supply bigger chunks as prompts. However, larger chunks can dilute semantic specificity in their embeddings, resulting in less precise vector matching. This tension between maintaining detailed embeddings and preserving broader context may become more pronounced as context windows expand. Further testing of chunk size and indexing depth with HyPE would help clarify how embedding precision balances with retrieval breadth.

Overall, HyPE demonstrates that shifting from question-to-document to question-to-question alignment leads to tangible gains in retrieval accuracy and cost-effectiveness. As RAG solutions continue to evolve, offline prompt generation strategies like HyPE can serve as a foundation for more efficient generation.