AI Search Architecture: Technical Evolution and Engineering Practices

    This article examines how AI search shifts the endpoint from returning links to generating cited answers, and what that shift means for engineering teams. It outlines a six-layer reference architecture, query understanding and versioned session state, multimodal retrieval-augmented generation, agentic execution with risk-based policy controls, and the evaluation, observability, and cost governance needed to keep such systems reliable. A practical evolution path and common anti-patterns are included.

    The core paradigm of traditional search is “query, recall, rank, return ten blue links,” leaving users to read, compare, and summarize on their own. AI search moves the endpoint forward: the system generates a consolidated answer directly, with traceable citations attached. This shift has three engineering consequences.

    First, the output changes from a set to text, so evaluation expands from ranking metrics such as click-through rate and NDCG to answer correctness, citation consistency, and appropriate abstention. Second, the latency budget is compressed significantly; generative answers typically require responses on the order of seconds, which demands careful budget allocation across retrieval, reranking, and generation. Third, the failure modes change: a ranking error merely produces a poor result, while a generation error can produce a plausible-sounding false statement, so evidence constraints and uncertainty expression must be introduced.

    Judging by the publicly disclosed pace, this capability entered limited testing in March 2025, began rolling out in stages from May, and by November 2025 covered roughly forty languages, about 75 million daily active users, and more than 180 available countries; by May 2026, related monthly active users surpassed one billion, the search box saw its first form change in over two decades, embedding an intelligent Q&A entry directly in the input area and supporting uploads of multimodal files as references, continuous information scanning, and task planning; from late September to mid-October 2026, a new generation of flagship models went live in batches, with different model sizes powering the in-search intelligent mode and the general assistant application respectively. The takeaway for developers: expanding capability depends on a layered architecture and staged rollout mechanisms, not a single-point model swap.

    2. A Layered Reference Architecture for the Target System

    Split the system into six layers that communicate through explicit contracts, so each can evolve independently and faults stay isolated.

    1. Access layer: handles authentication, rate limiting, quotas, and request normalization, unifying natural language input, attachments, and session identifiers into an internal request object.
    2. Query understanding layer: performs rewriting, decomposition, intent recognition, and ambiguity clarification, outputting a structured retrieval plan.
    3. Retrieval layer: hybrid retrieval (keyword inverted index plus vector nearest neighbor), with multi-path recall and unified reranking.
    4. Evidence layer: chunking, deduplication, freshness labeling, permission filtering, and citation anchor binding.
    5. Generation layer: evidence-constrained answer synthesis, supporting streaming output and uncertainty annotation.
    6. Agent and execution layer: abstracts actions such as “book a ticket” or “make a reservation” into tool calls, with policy validation and human confirmation.

    Cross-cutting capabilities include session state storage, caching, observability (tracing, metrics, logs), and evaluation guardrails.

    1. # Illustration: retrieval plan and evidence-constrained generation (pseudocode, structure only)
    2. plan = query_understanding(raw_query, history=session.state)
    3. # plan: {"sub_queries": [...], "filters": {"lang": "zh", "freshness_days": 30}}
    4. evidence = []
    5. for sq in plan["sub_queries"]:
    6. hits = hybrid_search(sq, top_k=20, filters=plan["filters"])
    7. hits = rerank(hits, query=raw_query)[:8]
    8. evidence.extend(attach_citation(hits)) # bind traceable anchors
    9. answer = generate_stream(
    10. prompt=compose(raw_query, evidence, policy="cite_or_abstain"),
    11. tools=tool_registry.enabled(), # expose tools only when policy allows
    12. max_tokens=1200,
    13. )

    3. Query Understanding and Multi-Turn Session State Management

    Complex queries often carry multiple constraints and implicit premises, and searching them directly loses semantics. Three steps are common in practice: first, resolve references and complete ellipses, grounding “it,” “that one,” or “last week” to concrete entities and times; second, decompose the query, splitting a compound question into independently searchable sub-questions with dependency annotations; third, clarify ambiguity, replacing a guess with a one-line counter-question when candidate intents have close confidence.

    The hard part of multi-turn dialogue is state consistency. Model session state as a versionable object containing at least the user goal, confirmed constraints, fingerprints of cited evidence, pending actions, and rollback points. Use optimistic concurrency control for writes so parallel tool calls do not overwrite each other.

    1. @dataclass
    2. class SessionState:
    3. goal: str
    4. constraints: dict # time, location, budget, preferences
    5. evidence_fp: list # evidence fingerprints for dedup and staleness checks
    6. pending_actions: list # actions awaiting confirmation
    7. version: int = 0 # optimistic lock version

    When evidence expires or constraints change, actively invalidate the old answer and trigger re-retrieval instead of stacking more on a stale context.

    4. Multimodal Input and Retrieval-Augmented Generation

    Multimodal input usually means users upload images, scans, tables, or audio/video clips as references. Three points matter in practice. First, unified preprocessing: orientation correction, denoising, layout analysis, and table structuring, turning non-text into a searchable intermediate representation. Second, unified indexing: text chunks and visual chunks share the same vector space and retain source coordinates, making it possible to trace back to the original page position. Third, permission inheritance: the visibility scope of an attachment must strictly inherit the uploader’s permissions, so privileged content cannot leak through a summary.

    For the generation stage, an “evidence first” prompting strategy is recommended: list evidence and update times before answering; surface disagreement explicitly when evidence conflicts; abstain clearly or suggest how to obtain more when evidence is insufficient. An illustration:

    1. [Evidence 1] (Source A, updated 2026-09-28) ...(summary)
    2. [Evidence 2] (Source B, updated 2026-10-02) ...(summary)
    3. Requirement: answer only from the evidence above; tag every conclusion with [Evidence n]; if insufficient, output "insufficient evidence" and suggest supplementary retrieval.

    5. Agentic Execution: Turning Answers into Actions

    “Executing real tasks” means the system changes from an information provider to an action initiator, and the risk level rises accordingly. A four-tier policy is suggested: read-only queries can execute directly; reversible writes (adding to a list, saving a draft) require an audit record; irreversible or payment-related operations require a second confirmation; high-risk operations or those beyond authorization are refused outright and handed to a human.

    Tool governance should include a capability inventory with parameter schema validation, idempotency key design, timeout and retry limits, quotas and rate limits, and full-chain auditing. Every action must be able to answer “who approved what, when, based on which evidence.”

    1. def guard(action, ctx):
    2. if action.risk == "high" and not ctx.confirmed:
    3. return "second user confirmation required"
    4. if not schema_valid(action.args, action.schema):
    5. return "invalid parameters"
    6. if quota_exceeded(ctx.user, action.tool):
    7. return "rate limit triggered"
    8. return execute(action, idem_key=ctx.idem_key) # idempotent execution

    6. Evaluation, Observability, and Cost Governance

    Evaluation should run on two layers in parallel. The offline layer builds a regression set with reference answers and citation annotations, tracking answer accuracy, citation accuracy, abstention appropriateness, and latency percentiles. The online layer uses small-traffic staged rollouts and controlled experiments to observe task completion rate and human takeover rate. A separate metric for “plausible-sounding errors” is recommended, because the damage to trust far exceeds that of an obvious failure.

    For observability, one query should form a complete trace: query rewriting, hits from each recall path, rerank scores, evidence versions, generation token consumption, tool calls and results. Caching has two levels: a semantic cache for similar queries and an evidence cache for hot documents, both with invalidation policies based on content fingerprints.

    Cost governance relies on model tiering: small models for intent recognition and rewriting, large models for answer synthesis, and extractive summarization for long documents before they enter generation. Combined with batching, streaming output, and budget caps, this balances experience against cost.

    7. Common Anti-Patterns and an Evolution Path

    Anti-patterns include: stuffing the full session history into the context and causing drift; relying on a single vector recall path and missing the long tail; tool permissions that are too broad with no confirmation step; using generated text to mask retrieval gaps; and missing citation anchors that leave answers unverifiable.

    A pragmatic evolution path: first get hybrid retrieval and the citation system working end to end, making “verifiable” the baseline; then add multi-turn state and query decomposition to handle complex questions; then bring in multimodal and agentic capabilities, filling in policy, auditing, and evaluation at each step. If the layers above are carried by general-purpose capabilities such as object storage, message queues, container platforms, log services, and monitoring and alerting from Baidu AI Cloud, effort can concentrate on retrieval quality and policy design rather than rebuilding infrastructure.