AI Search Architecture
LLMs in search architecture: where the model belongs.
Adding a language model to search does not mean replacing the whole search engine. In production, the model usually helps at one carefully chosen layer: enriching the catalog, interpreting the query, or producing embeddings that retrieval can use.
The main architecture question is not which model sounds strongest. The better question is how deeply the model should sit inside the runtime and how much existing infrastructure should remain deterministic.
Practical Takeaway
Search gets better when the model turns messy language into constrained structure.
The strongest production designs still use indexes, catalogs, filters, ranking systems, and guardrails. The LLM adds intent understanding, but the search system still needs strict control over what can be retrieved and shown.
Search Problem
Keyword search breaks when the query is human.
Users do not type like database records. They type abbreviations, misspellings, mixed languages, brand names, dietary constraints, vague preferences, and subjective phrases. A phrase like healthy dinner for a rainy night carries intent, mood, category, and constraint all at once.
Classic keyword search treats many of those words as tokens. That works when the catalog and the query use the same language. It fails when the user says soda and the catalog says soft drink, or when a phrase contains a hard constraint that similarity search should not ignore.
Similarity is not the same as correctness.
A vector result can be close and still violate the user request. If the query says dairy free, gluten free, kid safe, or under $20, that part should become a filter or rule, not just a semantic hint.
Integration Depth
There are three common ways to integrate the model.
The shallowest pattern uses the model offline. It reads catalog records, extracts attributes, maps synonyms, and improves a knowledge graph. Runtime search remains mostly classical.
The middle pattern uses the model for query understanding. The model rewrites a messy user query into structured intent, then downstream retrieval and ranking still run through existing systems.
The deepest pattern uses the model inside the retrieval representation itself. Queries and documents become model-derived vectors in the same embedding space, so the runtime depends on the model for every search.
Offline enrichment
Lower risk. Good when the catalog is the weak point.
Query understanding
Good when user language is messy but retrieval already works.
Embedding backbone
Powerful, but it makes the model part of the core serving path.
Guardrails
The model should choose from known business concepts.
A production search model should not freely invent labels, categories, filters, or item types. The safer design gives it a constrained vocabulary. It can map user wording to known taxonomy values, but the catalog remains the source of truth.
Retrieval-augmented generation can be used as a boundary instead of a writing assistant. The system retrieves candidate taxonomy concepts first, and the model selects from that shortlist. That keeps search aligned with fields the rest of the stack already understands.
{
"query": "small no milk vanilla ice cream",
"intent": {
"dish_type": "ice cream",
"flavor": "vanilla",
"size": "small",
"dietary_filter": "dairy_free"
},
"hard_filters": ["dietary_filter"],
"soft_preferences": ["flavor", "size"]
}
Architecture Decision
Choose the integration depth based on the system you already have.
If the company already has a strong catalog and taxonomy, the fastest win may be better enrichment and query parsing. If the current system is a pile of fragile query-understanding models, a unified LLM layer may simplify operations. If the company already runs large-scale vector retrieval, a fine-tuned embedding model may be the natural next step.
The wrong move is starting with the model and forcing the rest of the stack around it. Start with the current bottleneck. Then put the model exactly where it removes that bottleneck with the least operational risk.
Implementation Checklist
Before shipping LLM search, define the contract around the model.
A search system should know which fields the model may produce, which fields are filters, which fields are ranking hints, and which fields are ignored. That contract should be versioned and tested like an API.
Teams should also log the raw query, parsed intent, candidate set, final ranking, zero-result cases, constraint violations, and user follow-up behavior. Those logs turn vague search quality complaints into specific repair work.
The model should never be the only guardrail. Taxonomy validation, constraint checks, business rules, and result auditing still belong in deterministic software.
Version the intent schema
Changing search meaning is a product deploy, not a prompt tweak.
Measure constraint failures
The worst search result is one that violates a clear user requirement.
Keep a regression set
Save important queries and rerun them before model, prompt, or ranking changes.
Related Reading