Large Language Models (LLMs) often struggle with knowledge-intensive tasks, frequently hallucinating facts or failing to retrieve relevant information for complex, multi-hop queries. This paper introduces Demonstrate-Search-Predict (DSP), a framework that treats retrieval and language models as composable modules. By programmatically decomposing questions and using weak supervision to bootstrap demonstrations, DSP significantly improves performance on benchmarks like HotPotQA and Open-SQuAD without requiring manual labeling of intermediate steps.
Introduction: Beyond Simple Retrieval
Large Language Models (LLMs) are powerful but prone to "hallucinations" when tasked with factual queries outside their training data. While Retrieval-Augmented Generation (RAG)—specifically the "retrieve-then-read" approach—mitigates this by providing external context, it often falters on complex, multi-hop questions. A standard search might retrieve a superficially related but incorrect entity, leading the model astray.
As shown in Figure 1, a simple query about a castle inherited by David Gregory might lead a standard RAG system to retrieve information about a "St. Gregory Hotel" instead of the correct "Kinnairdy Castle." Solving such problems requires a systematic decomposition of the query into intermediate steps, a process that typically demands expensive, hand-labeled datasets for every stage of reasoning.
The DSP Framework
The Demonstrate-Search-Predict (DSP) framework addresses these challenges by organizing the interaction between a Language Model (LM) and a Retrieval Model (RM) into a programmable pipeline. Instead of a static sequence, DSP treats these models as composable transformations where natural language serves as the connective tissue.
The framework consists of three primary stages:
- Demonstrate: To avoid manual prompt engineering, DSP employs weak supervision. It takes simple question-answer pairs and programmatically "bootstraps" intermediate labels. By checking if a zero-shot attempt (a search path) leads to the correct final answer, the system identifies successful reasoning chains to use as few-shot demonstrations for future queries.
- Search: This stage manages information gathering through sophisticated strategies. It supports multi-hop search, where the LM generates a query, retrieves a passage, and then uses that context to generate the subsequent query. It also utilizes query fusion to merge results from multiple generated queries.
- Predict: The final stage aggregates gathered information. It employs techniques like Chain-of-Thought (CoT) and self-consistency, generating multiple reasoning paths and selecting the most frequent answer to ensure reliability.
Evaluation and Key Insights
The authors evaluated DSP using GPT-3.5 (text-davinci-002) and ColBERTv2 across three benchmarks: Open-SQuAD (single-hop), HotPotQA (multi-hop), and QReCC (conversational).
The framework achieved significant performance gains over standard in-context learning:
- Open-SQuAD: 36.6 EM (126% relative gain over vanilla LM).
- HotPotQA: 51.4 EM (82% gain over vanilla LM; 39% over standard RAG).
- QReCC: 80–290% relative gains against contemporaneous pipelines like "self-ask."
A core insight of DSP is the use of natural language as an interface. By treating the LM as a "programmer" for the RM, the system can dynamically adjust its search behavior. Furthermore, the explicit control flow prevents the "self-distraction" common in simpler multi-hop methods, where models often veer into tangential questions.
Conclusion
DSP demonstrates that sophisticated, grounded AI systems can be built using frozen models and modular programming. By automating the creation of demonstrations through weak supervision and providing a framework for complex search strategies, DSP sets a new state-of-the-art for in-context learning on knowledge-intensive tasks. While performance remains tied to the underlying LM's instruction-following capabilities and API costs can increase with complexity, the modularity of DSP allows for easy updates to either the retrieval or language components as technology evolves.
Summary updated