AI Search Architecture Evolution and Engineering Practices
This article explains why traditional search struggles with complex, exploratory queries and how AI search modes address them through a layered architecture. It covers the five core layers, four key technical challenges, latency and cost trade-offs, a four-dimension evaluation framework, and security and governance practices for building reliable AI search systems.
1. Why Traditional Search Needs an AI Mode
Traditional search assumes that users know what they are looking for and can compress their needs into a few keywords. This assumption still works well for navigational queries, such as finding an official website or a download page, but it breaks down quickly for exploratory, comparative, and planning tasks. A real user need is often something like “give me a three-day, two-night itinerary with a limited budget, avoiding crowds, and including rainy-day alternatives.” Such queries have three characteristics: composite intent, many constraints, and answers that need to be organized rather than listed.
The AI search mode, also commonly called generative search or conversational search in the industry, is a product form designed for exactly these needs. It upgrades the search box from a keyword entry point to a task entry point, with a large language model handling intent decomposition, information retrieval, result synthesis, and multi-turn clarification. The key to understanding it is not memorizing a product’s release timeline, but understanding the technology stack and engineering constraints that support it.
2. A Reference Architecture with Capability Layers
A practical AI search system can usually be divided into five layers. The layers are decoupled through explicit contracts, which makes independent evolution and canary rollout easier.
- Interaction layer: supports long queries, multi-turn context, and file and image uploads. Context management must distinguish between “session memory” and “task state.” The former can be trimmed, while the latter must not be discarded arbitrarily.
- Intent and planning layer: determines the query type (factoid, aggregation, or action) and decides whether to trigger retrieval, whether multi-step decomposition is needed, and whether external capabilities must be called.
- Retrieval layer: hybrid retrieval (lexical + vector), query rewriting, multi-path recall, reranking, and the introduction of freshness signals.
- Generation layer: generates structured answers based on retrieved evidence, enforces citation traceability, and controls hallucination.
- Execution and governance layer: task orchestration, permission checks, audit logs, quotas, and fallback strategies.
Illustrative intent-routing pseudocode:
def route(query, session):plan = planner.decompose(query, session.task_state)if plan.type == "factoid" and plan.confidence > 0.9:return direct_answer(query) # low-latency pathif plan.type == "aggregation":return rag_pipeline(query, plan.subqueries)if plan.type == "action":return agent_executor(plan, guardrails=session.guardrails)return clarify_then_rag(query, session) # clarify first, then retrieve
3. Four Key Technical Challenges
3.1 Query Understanding and Rewriting
Long queries often contain multiple sub-questions. A common engineering approach is a three-step process: decompose, retrieve, and merge. First, the model generates several independently retrievable sub-queries. Then recall is performed in parallel. Finally, evidence alignment is done during the generation stage. Sub-query generation must avoid semantic drift. A common practice is to keep the original constraints, such as time, location, and budget, as immutable slots.
3.2 Trustworthiness of Retrieval-Augmented Generation
The biggest risk of generative answers is that they “look correct.” Controllable approaches include refusing to answer or falling back to a link list when evidence is insufficient; binding every claim to a source snippet; performing secondary validation on high-risk fields such as numbers, dates, and version numbers; and comparing multi-path recall results for the same question, explicitly presenting disagreements when conflicts arise rather than forcibly merging them.
3.3 Multimodal Input
Once images, PDFs, and tables enter the pipeline, unified document parsing and layout understanding are needed to convert unstructured content into a retrievable intermediate representation (text blocks + structured fields + vectors). For tables in particular, avoid “losing row and column semantics after flattening.” It is recommended to preserve header mapping relationships.
3.4 From “Answering” to “Execution”
The risk level changes fundamentally when the system needs to book tickets, fill out forms, or place orders. The following must be introduced: an operation allowlist and secondary confirmation, least-privilege credentials, idempotency keys to prevent duplicate submissions, a complete audit trail, failure rollback, and a manual takeover entry point. Any capability that involves “round-the-clock automatic scanning plus automatic execution” should be premised on being reversible and observable.
4. Balancing Performance and Cost
The latency budget for AI search is usually split into intent routing (tens of milliseconds), retrieval and reranking (hundreds of milliseconds), and generation (seconds). The optimization approach is layering rather than a one-size-fits-all solution:
- Fast and slow dual paths: high-confidence factoid queries use caches and short answers; only complex queries enter multi-step planning.
- Semantic caching: use a normalized query plus a context fingerprint as the key, and set a reasonable expiration window.
- Model tiering: use smaller models for simple rewriting and larger models for complex merging, allocating cost and quality by task.
- Streaming output: present the structural skeleton first and then fill in details, which significantly improves perceived latency.
5. Evaluation Framework
Do not rely only on subjective judgments such as “is the answer good?” A four-dimension evaluation set is recommended:
| Dimension | Example Metrics |
|---|---|
| Retrieval quality | Recall, evidence hit rate, NDCG after reranking |
| Generation quality | Factual consistency, citation coverage, structural completeness |
| Task completion | Multi-turn success rate, average interaction turns, abandonment rate |
| Engineering metrics | P95 latency, cost per request, fallback trigger rate |
The evaluation set should include negative samples of queries that “should be refused.” Otherwise, the system will fabricate content for the sake of fluency.
6. Security, Compliance, and Governance
Avoid retaining sensitive source text in logs. Uploaded files require a clear retention policy and deletion mechanism. Apply output-side filtering to generated content. Establish risk tiers and manual gates for agent execution. When exposing capabilities externally, use a unified gateway for authentication, rate limiting, and quota management to facilitate auditing and cost accounting.
7. Conclusion
The essence of the AI search mode is to restructure “retrieval” into a closed loop of understanding, planning, evidence gathering, expression, and execution. In general technology practices, Baidu AI Cloud typically emphasizes decoupling model capabilities, retrieval infrastructure, and observable governance into separate layers. This approach also applies to self-built solutions: first make contracts and evaluation solid, then gradually open up the level of automation. Only in this way can a sustainable balance be achieved among quality, cost, and risk.
