AI Search Architecture: Combining Large Language Models with Real-Time Web Retrieval

    This article explains how AI search combines the reasoning and generation capabilities of large language models with real-time web retrieval, and how to build such a system in practice. It covers the limits of purely parametric models, a four-layer reference architecture, retrieval pipeline design from query understanding to hybrid recall and reranking, context assembly under a limited window budget, citation and fact verification, engineering concerns such as cost, latency and caching, and a three-tier evaluation framework. Readers will get a structured, implementation-oriented view of delivering grounded, verifiable answers as a stable product capability.

    1. From Parametric Memory to Live Retrieval: Defining the Problem

    On February 20, 2025, Baidu AI Search integrated the full version of DeepSeek-R1 together with Baidu’s web search, marking a new phase for AI search. Abstracted into technical terms, this describes one thing: combining a large model’s reasoning and generation ability with live web retrieval into a single end-to-end question-answering pipeline.

    To see the value of this, start with the inherent limits of a purely parametric model. A large model’s knowledge is frozen into its weights, which creates three unavoidable problems. First, there is a knowledge cutoff: the model does not know about events that happened after training finished. Second, long-tail facts are sparse: low-frequency entities and fine-grained numbers appear rarely in the corpus and are remembered poorly. Third, there is a tendency to hallucinate: when the model lacks grounding, it still produces text that is grammatically fluent and confidently worded but factually wrong.

    Web retrieval fills exactly these three gaps. Retrieval supplies “verifiable external evidence available right now,” and generation organizes that evidence into an answer people can use directly. So the essence of AI search is not making the model “smarter”; it is moving the basis of an answer from internal memory to external, checkable material, turning answers from “looks correct” into “backed by evidence.”

    2. Reference Architecture: Four Layers and Their Responsibilities

    A deployable AI search system can usually be split into four layers, decoupled from each other through explicit data contracts.

    1. Access layer: handles authentication, rate limiting, session management and multi-client adaptation, normalizing user input into a unified query object.
    2. Retrieval layer: handles query understanding and recall, returning a candidate document set with metadata (source, time, snippet position).
    3. Generation layer: handles context assembly, reasoning and answer composition, returning conclusions with citations.
    4. Governance layer: runs horizontally across the stack, handling logging, monitoring and alerting, cost tracking, content safety and quality evaluation.

    The decoupling between the retrieval layer and the generation layer matters most. The retrieval layer can swap data sources, recall counts and ranking strategies independently; the generation layer can switch model sizes independently to trade quality against cost. If the two are tightly coupled, every strategy change forces a full-pipeline regression, and iteration speed degrades quickly.

    3. Retrieval Pipeline Design: Query Understanding Sets the Ceiling on Recall

    In practice, the ceiling on recall quality is set by query understanding, not by the size of the vector store. Common processing has four steps:

    • Normalization: unify full-width and half-width characters, traditional and simplified forms, whitespace and punctuation, and strip low-information conversational filler.
    • Intent classification: distinguish factual, comparative, operational and time-sensitive queries. Time-sensitive queries must be forced onto the web path, while factual queries can hit the cache first.
    • Query rewriting: expand a short query into several semantically complementary sub-queries covering synonyms and broader/narrower concepts to raise recall coverage.
    • Hybrid recall: keyword recall is strong on proper nouns and exact numbers, vector recall is strong on semantic similarity; fuse both result lists with reciprocal rank fusion to balance precision and generalization.

    Illustrative fusion logic (expressing the algorithm idea only, not a specific API):

    1. def reciprocal_rank_fusion(rankings, k=60):
    2. scores = {}
    3. for ranking in rankings:
    4. for rank, doc_id in enumerate(ranking, start=1):
    5. scores[doc_id] = scores.get(doc_id, 0.0) + 1.0 / (k + rank)
    6. return sorted(scores.items(), key=lambda x: -x[1])

    After recall, reranking and deduplication are mandatory. Candidate sets often contain syndicated copies of the same source and pages with heavily overlapping content; sending them straight into the context wastes window space and amplifies repetition bias. Cluster by text similarity and keep a representative document, then rank with weights for authority, freshness and relevance to the query, and finally truncate to the top few snippets.

    4. Context Assembly: Treat the Window Budget as a Scarce Resource

    The context window is a finite budget and needs explicit management. The recommended structure has three parts: instruction + evidence + output constraints, where every snippet in the evidence section carries an index and metadata so the model can cite it.

    1. You are a rigorous technical assistant. Answer using only the numbered
    2. evidence below; if the evidence is insufficient, state clearly that
    3. "the available material is not enough to confirm" and do not speculate.
    4. Evidence:
    5. [1] source type=official documentation, date=2025-01, content=...
    6. [2] source type=technical community, date=2024-11, content=...
    7. Output requirements: give the conclusion first, then list the evidence
    8. indices, and finally state the uncertain items.

    Three easily overlooked details matter here. First, evidence order affects generation quality; placing the most relevant snippets earlier is more stable. Second, an explicit refusal path is required, otherwise the model tends to fill gaps with internal knowledge, and hallucination follows. Third, the instruction must forbid the model from rewriting numbers and proper nouns from the evidence, so factual drift is not introduced while polishing wording.

    5. Credibility Verification: Make Every Conclusion Traceable

    What separates AI search from a chatbot is verifiability. At least three checks are recommended in production:

    • Citation consistency check: extract each claim in the answer and run textual entailment against the cited snippet; mark sentences that cannot be supported as pending review.
    • Numeric and entity allowlist: validate dates, version numbers, amounts and metric names with both regex and dictionary checks, preventing the generation stage from quietly altering them.
    • Conflict detection: when sources disagree, do not adjudicate on your own; present the differences side by side with each source’s date and type.

    The output layer should use a structured format that separates conclusion, evidence and uncertain items, so the frontend can render citation markers. Users can then jump to the original source in one click, and trust shifts from “trusting the model” to “trusting the evidence.”

    6. Engineering Essentials: Cost, Latency and Caching

    Once retrieval is added, per-request latency becomes the sum of retrieval time, reranking time and generation time, and cost rises accordingly. Common measures include:

    1. Tiered model routing: send simple queries to a small model or pure cache and complex reasoning to a large model, using intent classification to split traffic.
    2. Layered caching: a query-level cache hit returns immediately; a document-level cache reuses fetch and parse results; a snippet-level cache reuses vectors and summaries to avoid repeated computation.
    3. Async and streaming: increase parallelism between retrieval and generation and return the answer as a stream, prioritizing time to first token over total completion time.
    4. Budget control: set hard limits on retrieved items per request, context length and retry counts so abnormal queries do not amplify resource consumption.

    Observability is equally non-optional. Build dashboards around recall hit rate, citation support rate, refusal rate, time to first token and cost per request, and configure monitoring and alerting for content safety categories, so an anomaly can be traced quickly to a change in the retrieval source or a regression in the generation strategy.

    7. Evaluation: Three Categories of Metrics Are All Required

    Judging only whether an answer “reads smoothly” is the biggest evaluation trap. Three layers of metrics are recommended:

    • Retrieval layer: recall rate, snippet relevance and freshness compliance, measuring whether evidence is found and current.
    • Generation layer: citation support rate, factual accuracy and refusal appropriateness, measuring whether conclusions are constrained by evidence.
    • Experience layer: time to first token, task completion rate and follow-up turns, measuring whether users actually solved their problem.

    The evaluation set should cover four question types: time-sensitive, long-tail, comparative and no-answer. The no-answer type specifically tests whether the system dares to refuse, which is the most direct observation window for suppressing hallucination.

    8. Conclusion

    Combining large models with web retrieval moves AI search from a demo to a deliverable engineering system. What really determines quality is not the model’s parameter count but how tight the combination is across query understanding, evidence reranking, context budgeting, citation verification and cost governance. Following the layered structure above, a team can strike a controllable balance among freshness, credibility and resource overhead, and turn “evidence-backed answers” into a stable product capability.