Deep Search Architecture: Multi-Step Retrieval and Trustworthy Generation

    This article examines Deep Search from a developer perspective, covering why it is needed, a typical architecture for query planning, multi-step retrieval, evidence processing, answer synthesis with citations, and observability. It also discusses key engineering controls, reusable pseudocode, and practical recommendations and challenges for teams building similar capabilities.

    On February 16, 2025, Baidu Search launched Deep Search. Built on ERNIE models and general technical approaches such as retrieval-augmented generation (RAG), it combines LLM reasoning with search and retrieval capabilities to provide deeper information acquisition and answer organization for complex questions. This article does not discuss the interface or operational strategy of a specific commercial version. Instead, it breaks down Deep Search from a developer’s perspective: why it emerged, how the core pipeline is designed, how to govern it in engineering, and how to build similar capabilities with general methods.

    1. Core Problems Deep Search Must Solve

    The core form of traditional search is “query—recall—ranking—result list.” Users must open multiple results, filter information, compare evidence, and form conclusions themselves. For simple factual questions, this model is efficient. For questions with multiple conditions, cross-source dependencies, reasoning requirements, and freshness checks, however, users often need to jump repeatedly between pages, and the cost of information integration is high.

    On the other hand, relying solely on an LLM to generate answers directly also carries clear risks: the model may lack the latest information, may mix facts from different sources, or may even produce plausible statements that lack evidence. The value of Deep Search is that it expands “search” from a single recall into “a reasoning-driven, multi-step information acquisition process”: first understand the question, then plan sub-questions, retrieve step by step, filter evidence, and finally generate an answer constrained by evidence, with citations and verifiable paths where possible.

    Therefore, Deep Search is not simply about concatenating search results and passing them to an LLM. It requires a complete engineering pipeline that balances answer quality, freshness, trustworthiness, latency, and cost.

    A deployable Deep Search system can usually be divided into the following layers.

    2.1 Query Understanding and Task Planning

    The system first needs to identify user intent: whether the question is a factual query, comparative analysis, causal explanation, operational guide, or multi-constraint decision. It then decomposes the question into sub-questions and converts a complex question into several retrievable queries. For example, “the applicable conditions and limitations of a technical solution” can be split into sub-tasks such as “applicable scenarios,” “dependency conditions,” “common limitations,” and “alternatives.”

    The task planning layer also needs to decide the retrieval strategy: which sub-questions can be retrieved in parallel and which need to be dynamically generated based on previous results; whether freshness filtering is needed; whether authoritative sources should be prioritized; and when to stop retrieving. Stop conditions are critical; otherwise, the system can easily fall into an ineffective loop, increasing latency and cost.

    2.2 Multi-Step Retrieval Execution

    Multi-step retrieval usually includes query rewriting, recall, reranking, filtering, and deduplication. Query rewriting is used to complete context, expand synonyms, and disambiguate. The recall stage obtains candidate evidence from different indexes or data sources. The reranking stage sorts candidates by semantic relevance, freshness, source quality, and snippet completeness. The filtering stage handles permissions, sensitive information, and low-quality content.

    Compared with single-pass retrieval, multi-step retrieval needs to maintain an “evidence pool.” After each round of retrieval results enters the evidence pool, the system must determine whether the current sub-question has been covered and whether additional retrieval is needed. For conflicting information, the system should not simply overwrite it; it should retain source and time information for the later synthesis stage.

    2.3 Evidence Processing and Context Compression

    LLM context is limited, and retrieved content cannot all be fed directly into the model. The evidence processing layer needs to perform snippet segmentation, deduplication, relevance filtering, conflict detection, and compressed summarization. A high-quality approach is to preserve “evidence units”: each piece of evidence contains a content snippet, source identifier, time, credibility score, and citable location.

    Context compression is not simple summarization. It retains the necessary facts, data, conditions, and limitations around the current sub-question while removing redundant and irrelevant content. For long documents, segmented retrieval combined with multi-level summarization can be used to avoid truncating key information.

    2.4 Answer Synthesis and Citation Tracing

    The answer synthesis stage needs to generate a structured response constrained by evidence. The system can require the model to distinguish between “confirmed facts,” “inferential conclusions,” and “insufficient information.” For key conclusions, evidence identifiers should be bound to form a mapping from answer sentences to evidence snippets, supporting citation display and later verification.

    Citation tracing is an important safeguard for Deep Search trustworthiness. In engineering, it is necessary to maintain stable evidence IDs, snippet location information, and answer-citation relationships. If evidence is insufficient, the system should choose to refuse to answer, indicate that information is insufficient, or provide limited possible directions rather than forcing generation.

    2.5 Observability, Evaluation, and Feedback Loop

    The Deep Search pipeline is long and has many variables, so observability is essential. Logs should record query planning, retrieval terms in each round, recall volume, reranking results, evidence selection, generation latency, and citation coverage. Metrics can include empty-result rate, missing-citation rate, answer follow-up rate, manual correction rate, latency percentiles, and cost per query.

    Offline evaluation can build question sets and evidence sets to assess answer correctness, evidence sufficiency, citation coverage, and reasonableness of refusals. Online evaluation focuses on user feedback, follow-up behavior, and correction signals. Through a feedback loop, teams can continuously optimize query planning, reranking strategies, and prompt templates.

    3. Key Engineering Details

    First, iteration control. The system should set maximum retrieval steps, time budgets, and cost budgets, and use a “benefit judgment” to decide whether to continue retrieving. If newly added evidence does not significantly improve the current sub-question, retrieval should stop early.

    Second, conflict handling. Information from multiple sources may be inconsistent. The system should present differences based on time, source quality, and contextual conditions rather than hiding conflicts. For time-sensitive topics, evidence with clear and recent update times should be prioritized.

    Third, security and permissions. The retrieval layer must enforce permission filtering so that users can only obtain content they are authorized to access. The generation layer needs to defend against prompt injection and malicious content contamination, isolating untrusted snippets.

    Fourth, pluggable design. Query planning, retrievers, rerankers, synthesizers, and verifiers should be decoupled as much as possible to facilitate replacement and canary releases. This allows one component to be optimized without changing the overall pipeline.

    4. Reusable Pseudocode for Developers

    The following is a process illustration independent of specific interfaces. It focuses on the loop structure of “plan—retrieve—judge—synthesize—verify”:

    1. def deep_search(user_query, budget):
    2. plan = understand_and_plan(user_query)
    3. evidence_pool = []
    4. for step in range(budget.max_steps):
    5. queries = generate_queries(plan, evidence_pool)
    6. candidates = retrieve(queries, filters=plan.filters)
    7. ranked = rerank_and_filter(candidates)
    8. evidence_pool = merge_and_dedupe(evidence_pool, ranked)
    9. if should_stop(plan, evidence_pool, budget):
    10. break
    11. answer = synthesize(
    12. query=user_query,
    13. evidence=evidence_pool,
    14. citation_required=True
    15. )
    16. return verify_and_attach_citations(answer, evidence_pool)

    In actual implementation, understand_and_plan can output a list of sub-questions, retrieval strategies, and stop conditions; retrieve can connect to different indexes or data sources; synthesize needs to constrain the model to answer only based on evidence; and verify_and_attach_citations is responsible for checking citation coverage and evidence consistency.

    5. Practical Recommendations and Challenges

    For teams seeking to build Deep Search capabilities, it is advisable to start with vertical scenarios and limited question types, establish a high-quality evaluation set first, and then gradually add multi-step retrieval and complex planning. In the early stage, citations should be mandatory, prioritizing verifiability before optimizing answer richness. Monitoring should focus on empty results, missing citations, latency, and cost anomalies.

    Major challenges include latency and cost growth caused by multi-step retrieval, unstable evidence quality, information loss caused by long-context compression, permission and compliance requirements, and insufficient answer explainability. The solution is not simply to enlarge the model or increase retrieval rounds, but to use an evaluation-driven approach to optimize the benefit and risk of each step.

    Overall, Deep Search represents an engineering direction for integrating search and LLMs: query planning as the entry point, multi-step retrieval as the means, and evidence constraints and citation tracing as safeguards, ultimately forming a trustworthy, observable, and iterable answer generation pipeline. For developers, understanding this pipeline is more important than chasing isolated capabilities.