Semantic Caching for E-commerce Search Optimization

walmart · E-commerce · 2024 · source Agentic: no · promotional bias: med · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: E-commerce search relevance and latency optimization

Walmart needed search to understand natural-language shopping intent and reduce expensive generative search work without relying on exact-match caching alone.

Constraints:

Architecture

Walmart layered semantic caching and generative search over e-commerce search: customer queries are interpreted by intent, semantically similar tail queries can hit cached responses through embeddings/vector search, and exact plus semantic caching are combined to manage the latency and compute tradeoff while returning broader product groupings such as snacks, drinks, apparel, and televisions for occasion-style queries.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  A["Customer search query"] --> B["Exact-match cache"]
  A --> C["Semantic cache"]
  C --> D["Vector search layer"]
  D --> E["Product catalog"]
  C --> F["Generative search layer"]
  E --> F
  B --> G["Search results"]
  C --> G
  F --> G
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Customer search query Natural-language shopping intent submitted by a Walmart customer. Exact-match cache, Semantic cache
Exact-match cache Cheap traditional cache for repeated literal queries. Customer search query, Search results
Semantic cache Embedding/vector-based cache that matches semantically similar tail queries. Customer search query, Vector search layer, Generative search layer, Search results
Vector search layer Stores and searches vector representations of queries or products. Semantic cache, Product catalog
Product catalog SKU inventory and product data used to answer commerce searches. Vector search layer, Generative search layer
Generative search layer Interprets broader intent and returns relevant product groupings. Semantic cache, Product catalog, Search results
Search results Customer-facing product groupings returned by the search experience. Exact-match cache, Semantic cache, Generative search layer

Data flow

A shopper query enters search, exact cache handles literal repeats, semantic cache embeds or compares query meaning against stored semantic results, generative search expands intent into relevant product groupings, and the system balances semantic-cache recall against the latency and compute cost of vectorizing and searching products and queries.

3 supporting quotes
“Traditional caching relies on exact match inputs to retrieve data, a method that falls short when dealing with the nuances of human language.”article, stated
“Semantic caching, however, thrives on understanding and interpreting the meaning behind queries, enabling it to handle variations in phrasing with finesse.”article, stated
“A query like 'football watch party' returns not just snacks and chips but also party drinks, Super Bowl apparel, and televisions”article, stated

Why this architecture

The architecture keeps exact caching for cheap repeat traffic while adding semantic matching for tail-query variations that exact matching cannot reuse, because Walmart wanted relevance gains without letting vector search latency and cost dominate every request.

3 supporting quotes
“Traditional caching relies on exact match inputs to retrieve data, a method that falls short when dealing with the nuances of human language.”article, stated
“Semantic Caching enabled massive gains for Walmart over traditional caching systems.”article, stated
“There's a significant trade-off between more results v/s a drop in performance, so it's usually advisable to use both systems together.”article, stated

Models used: embeddings · generative AI models

Scale

Alternatives considered (roads not taken)

Use exact-match caching only

Rejected because: Exact-match caching misses natural-language variations of the same shopping intent.

“Traditional caching relies on exact match inputs to retrieve data, a method that falls short when dealing with the nuances of human language.”article, stated

Use semantic caching alone for broader recall

Rejected because: Vector conversion and semantic search introduce latency and compute costs that make a combined simple-plus-semantic cache more practical.

“While a simple cache can be extremely cheap to set up and scale, semantic caching needs every product SKU and query to be converted to vectors”article, stated
“There's a significant trade-off between more results v/s a drop in performance, so it's usually advisable to use both systems together.”article, stated

Patterns

semantic-caching (performance)

Walmart caches semantically equivalent tail queries by meaning instead of requiring exact query-string matches.

“Semantic caching, however, thrives on understanding and interpreting the meaning behind queries, enabling it to handle variations in phrasing with finesse.”article, stated
“Chatter shares, "Semantic caching has allowed us to handle tail queries with unexpected efficiency. What we anticipated might yield a 10-20% caching rate for tail queries pleasantly surprised us with a rate close to 50%."”article, stated

cost-aware-routing (optimization)

The system combines cheap simple caching with more expensive semantic/vector caching so not every query pays the semantic path's cost.

“While a simple cache can be extremely cheap to set up and scale, semantic caching needs every product SKU and query to be converted to vectors”article, stated

latency-optimization (performance)

Walmart frames semantic caching around the customer-facing need to progress toward sub-second search responses.

“> "Balancing cost and performance is crucial. We are progressing towards achieving sub-second response times, ensuring that our customers receive timely and relevant results," Chatter notes.”article, stated

Tradeoffs

Combine simple and semantic caching.

Chose simple cache plus semantic cache over semantic vector cache as the only cache layer.

Rationale: Simple caching remains cheap and fast, while semantic caching expands recall for language variations.

“There's a significant trade-off between more results v/s a drop in performance, so it's usually advisable to use both systems together.”article, stated

Accept vector-search cost for tail-query reuse.

Chose embedding/vector search for semantic equivalence over low-cost exact cache with lower tail coverage.

Rationale: The realized tail-query cache rate was much higher than the expected rate, making the added infrastructure valuable.

“What we anticipated might yield a 10-20% caching rate for tail queries pleasantly surprised us with a rate closer to 50%”article, stated

Gotchas (what bit them)

Exact matching under-caches natural-language tail queries.

Root cause: Customers express the same need in many phrasings, but exact caches treat each phrase as a different key.

Resolution: Use semantic caching that interprets query meaning rather than literal strings.

“Traditional caching relies on exact match inputs to retrieve data, a method that falls short when dealing with the nuances of human language.”article, stated

Semantic caching can slow the search path.

Root cause: Semantic cache lookup requires more computation than a simple cache.

Resolution: Balance the semantic path with performance engineering toward sub-second response times.

“Latency Challenges: Semantic caching has a lot more to compute compared to a traditional cache making the overall process slow.”article, stated

Vector-based cache infrastructure can be expensive.

Root cause: The semantic cache has to convert and search product SKUs and queries as vectors.

Resolution: Use semantic caching selectively alongside simple caching rather than replacing the cheap path wholesale.

“semantic caching needs every product SKU and query to be converted to vectors and then searched upon which can be expensive on both the storage and compute.”article, stated

Evaluation

The public writeup evaluates semantic caching through cache-hit expectations versus observed tail-query caching, qualitative examples of broader intent understanding, and latency/cost tradeoff analysis.

Metrics: tail-query cache rate · expected cache rate · response latency · storage and compute cost · search-result relevance

“What we anticipated might yield a 10-20% caching rate for tail queries pleasantly surprised us with a rate closer to 50%”article, stated
“A query like 'football watch party' returns not just snacks and chips but also party drinks, Super Bowl apparel, and televisions”article, stated

Outcomes

The public source gives cache-rate and latency targets but does not disclose total query volume.

“Semantic Caching enabled massive gains for Walmart over traditional caching systems. Chatter shares, "Semantic caching has allowed us to handle tail queries with unexpected efficiency.”article, stated
“This approach not only enhances the shopping experience but also significantly improves the efficiency of search operations.”article, stated