Consulta de libros
que hacemos
Con quién trabajamos Quienes somos Nuestras alianzas Carreras
How AI Rebuilds Search to Match Shopper Intent

How AI Rebuilds Search to Match Shopper Intent

Shoppers rarely describe what they want using the precise language a product catalogue expects. Someone looking for a gluten-free loaf might type "bread no wheat" or simply "loaf GF". Someone hunting for a resealable bag might write "big zip lock extra large". These are not unusual queries; they represent millions of real searches that arrive every day, in every shape, across every major retail platform.

The gap between how people ask and how catalogues are organised is a business problem, not just an engineering one. When search fails to bridge that gap, shoppers scroll, abandon, or complain. Revenue leaks quietly but persistently. The question for engineering leaders is whether the system underneath search is built to handle natural, imprecise, human language, or whether it is still relying on rules that only work when the shopper already knows the right words.

The answer increasingly points to large language models (LLMs) at the query understanding layer, with careful architecture choices that make them practical at scale.

Why Rule-Based Classifiers Reach Their Limit

Traditional search systems categorise a query by pattern-matching it against known labels. A model trained on historical clicks and purchases learns associations: "skimmed milk" tends to precede a dairy purchase, so classify it as dairy. That works reasonably well for common queries, the ones that appear thousands of times a week with clear purchasing signals.

The problem is the long tail. Catalogues grow. Shopper language evolves. Specific product requests such as "ultra-pasteurised A2 chocolate milk" arrive with almost no click history to learn from. A classifier trained on frequency struggles here, because it has seen too few examples to form a reliable opinion.

Ambiguous queries create a second problem. A phrase like "easy weeknight dinner" does not map neatly to any single category. Forcing it into one label loses information that would have guided retrieval toward genuinely useful results.

Maintaining multiple separate models compounds both problems. A category classifier, a query rewriting engine and an attribute extractor each need their own training pipelines, their own labelling effort and their own deployment cadence. Inconsistencies emerge because each model interprets the same query slightly differently. The maintenance burden grows faster than the value.

What LLMs Actually Contribute Here

An LLM brings general language knowledge that classical classifiers lack. It already understands that "flat parsley" and "Italian parsley" refer to the same herb, that "dairy-free" and "vegan" overlap in certain product contexts, and that "keto bread" is a constraint on a product rather than a product type. That embedded knowledge means the model can reason sensibly about queries it has never encountered before.

The critical insight is that general knowledge is a starting point, not a complete solution. An LLM trained on the broader internet does not know a specific retailer's catalogue structure, store-level availability or the purchasing patterns of that retailer's customers. Bridging this gap requires deliberate engineering work.

Three approaches tend to do most of the work. The first is context injection: supplying the model with catalogue records, category hierarchies and relevant business signals at query time, so it reasons with real data rather than general assumptions. The second is output validation: comparing the model's predictions against the catalogue using semantic similarity before accepting them, which catches plausible-sounding answers that don't actually match anything a shopper can buy. The third is targeted fine-tuning: training a smaller, faster model on high-quality examples so it carries domain knowledge internally, reducing the amount of context that needs to be injected on every request.

Three Jobs That Need to Work Together

Query understanding is not a single task. It is at least three tasks operating in sequence, and each one shapes what search can return.

Category mapping decides which parts of the catalogue are relevant. A strong approach combines historical purchase signals, which nominate candidate categories, with LLM re-ranking, which assesses those candidates using language understanding rather than raw frequency. A guardrail then checks semantic alignment between the original query and the predicted category path, discarding pairings that don't hold up. This three-stage design is more robust than any single model working alone.

Query rewriting generates alternative phrasings that expand retrieval. Imagine a retailer whose shopper searches for "lactose-friendly whole milk alternative": the original phrase may match very few listings, but a broader rewrite toward "dairy-free milk" or a substitute rewrite toward "oat milk" opens up relevant results. Critically, synonym rewrites, broader rewrites and substitute rewrites serve different retrieval purposes and benefit from separate, specific prompts rather than a single generic instruction.

Attribute extraction, sometimes called semantic role labelling, pulls structured concepts out of a query: the product type, the brand if present, the relevant attributes such as fat content or flavour. These tags feed retrieval filters, ranking signals and advertising targeting. Getting them right matters for relevance quality well beyond the initial search result.

The Latency Problem is Real, and Solvable

The honest tension in LLM-based search is speed. A powerful model that reasons carefully about a query is worth nothing if it makes the user wait two seconds for results. Enterprise-scale search needs to respond in a fraction of that.

Two architectural decisions do most of the latency work. The first is caching: a large share of search traffic is concentrated in a relatively small set of frequently repeated queries. Computing and storing structured outputs for those queries in advance means that live inference is only needed for genuinely novel requests. In well-designed systems, the proportion of queries that require real-time model inference can be reduced significantly, which keeps GPU costs manageable and latency consistent.

The second decision concerns model size and serving efficiency. A large teacher model can generate high-quality labelled examples offline, at whatever cost and latency is acceptable outside the live request path. A smaller student model, fine-tuned on those examples, runs at inference time within the latency budget. Techniques such as LoRA (low-rank adaptation, a method for training only a small set of additional parameters rather than retraining the whole model) make fine-tuning the student model faster and cheaper. Hardware choices and model weight consolidation after training can cut serving latency further.

The trade-off between inference speed and output quality is genuine. Lower-precision computation can shave latency but may reduce recall. Engineering leaders should expect their teams to make an explicit, documented choice here rather than accepting a default.

What Leaders Should Ask Their Teams

If your organisation is evaluating or rebuilding search, these questions cut to what matters.

Where does search currently fail? Scroll depth on result pages, complaint rates for specific query types and "no results" frequency are the leading indicators. If your team cannot answer this with data, measurement comes before architecture.

How is the long tail being handled today? If the answer is "it isn't", that is where LLM-based query understanding has the clearest case to make.

What is the latency budget, and how is caching designed? A system without a coherent caching strategy will either be slow or expensive at scale.

How are model outputs validated before they affect what shoppers see? Validation guardrails are not optional. A model that confidently maps "verdant machine" to gardening equipment, when the actual query relates to a smoothie brand, will erode shopper trust quickly.

Is the system one unified pipeline or several disconnected models? Consolidation reduces the risk of inconsistent query interpretation and lowers maintenance overhead over time.

The goal is a search system that behaves like a knowledgeable colleague rather than a keyword matcher: one that understands intent, handles ambiguity gracefully and surfaces the right product even when the shopper's phrasing is imperfect. That is a solvable engineering problem. It requires the right architecture, honest trade-off decisions and an ongoing measurement discipline.

If your team is weighing these decisions, the Psych X86 AI & machine learning and GenAI solutions practices are worth a conversation.

Read our blog for all tech updates