Enhancing E-commerce Search with LLM-Powered Semantic Retrieval

picnic · E-commerce · 2024 · source Agentic: no · promotional bias: med · summary-only (no fetched source) · 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: Grocery e-commerce semantic search

Picnic needed search retrieval that could handle multilingual, typo-prone, ambiguous grocery queries across a large mobile catalog without adding unacceptable LLM latency to search-as-you-type experiences.

Constraints:

Architecture

Picnic used LLMs as an offline semantic-search enhancer rather than a live generator. GPT-3.5-turbo creates contextual product or search-term descriptions, OpenAI text-embedding-3-small embeds those descriptions into 1536-dimensional vectors compatible with OpenSearch, common search terms and product/recipe content are precomputed, and caching plus sanity checks keep the production search path fast and reliable.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  historical-search-terms["Historical search terms"] --> gpt-description-generator["GPT description generator"]
  gpt-description-generator --> embedding-generator["Embedding generator"]
  embedding-generator --> opensearch-indexes["OpenSearch indexes"]
  cache-and-sanity-checks["Cache and sanity checks"] --> live-search-retriever["Live search retriever"]
  opensearch-indexes --> live-search-retriever
  live-search-retriever --> ab-testing-and-monitoring["AB testing and monitoring"]
  ab-testing-and-monitoring --> historical-search-terms
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Historical search terms Customer query history used to identify common terms for precomputation. GPT description generator
GPT description generator Transforms raw search terms into richer contextual descriptions. Embedding generator
Embedding generator Uses text-embedding-3-small to create 1536-dimensional vectors. OpenSearch indexes
OpenSearch indexes Stores precomputed search-term embeddings and product/recipe retrieval embeddings. Live search retriever
Cache and sanity checks Reduce dependency risk, validate embedding shape, and protect production reliability. Live search retriever
Live search retriever Matches user queries to precomputed semantic representations and retrieves relevant catalog items. AB testing and monitoring
AB testing and monitoring Measures conversion, click-through, satisfaction, load, and search quality before broad rollout. Historical search terms

Data flow

Historical search data identifies common search terms. GPT-generated descriptions and embeddings are precomputed for search terms and catalog content, stored in OpenSearch indexes, and then live queries are matched against precomputed search-term embeddings before semantic retrieval of products and recipes.

“Rather than calling LLM APIs at query time—which would introduce unacceptable latency for a search-as-you-type experience—Picnic precomputes embeddings”summary, stated
“The system uses OpenSearch as the core retrieval engine. The architecture employs two indexes:”summary, stated

Why this architecture

Picnic chose precomputed semantic retrieval because it wanted LLM-level query understanding without the seconds-long latency of synchronous LLM calls. GPT-3.5-turbo was selected over GPT-4-turbo for comparable performance with lower latency, and text-embedding-3-small matched OpenSearch's dimensionality constraint.

“Picnic chose OpenAI's GPT-3.5-turbo for the prompt generation task, noting that it performs comparably to GPT-4-turbo while being significantly faster.”summary, stated
“OpenSearch has a maximum dimensionality limit of 1536 for efficient retrieval, which aligns exactly with the output size of text-embedding-3-small.”summary, stated

Models used: GPT-3.5-turbo · GPT-4-turbo · text-embedding-3-small · OpenSearch

Scale

Alternatives considered (roads not taken)

Call LLM APIs at query time.

Rejected because: Synchronous LLM calls would introduce unacceptable latency for search-as-you-type.

“Rather than calling LLM APIs at query time—which would introduce unacceptable latency for a search-as-you-type experience”summary, stated

Use GPT-4-turbo for prompt generation.

Rejected because: GPT-3.5-turbo performed comparably while being significantly faster.

“performs comparably to GPT-4-turbo while being significantly faster.”summary, stated

Use the largest embedding model available.

Rejected because: OpenSearch's 1536-dimensional limit made text-embedding-3-small the practical fit.

“The choice of the smaller embedding model was driven by a practical constraint: OpenSearch has a maximum dimensionality limit of 1536”summary, stated

Patterns

semantic-caching (serving)

Picnic precomputes and caches embeddings for common search terms to avoid live LLM calls.

“they can identify and precompute embeddings for approximately 99% of search terms that customers use.”summary, stated

rag-retrieval (retrieval)

OpenSearch retrieves semantically relevant products and recipes from vector embeddings.

“OpenSearch for fast retrieval and includes extensive caching mechanisms and sanity checks.”summary, stated

latency-optimization (serving)

The architecture avoids synchronous LLM latency by doing expensive generation and embedding work upfront.

“This eliminates the need for real-time LLM inference in the vast majority of cases”summary, stated

eval-driven-development (evaluation)

Offline optimization is followed by controlled A/B testing for conversion, click-through, and satisfaction.

“Following offline optimization, new features undergo controlled A/B testing with real users.”summary, stated

Tradeoffs

LLM placement

Chose Precompute embeddings and descriptions offline. over Synchronous LLM inference in live search..

Rationale: The precomputed approach preserves millisecond search latency.

“This approach reflects a mature understanding of LLMOps trade-offs.”summary, stated

Model selection

Chose GPT-3.5-turbo for prompt generation. over GPT-4-turbo..

Rationale: GPT-3.5-turbo was faster while performing comparably for the task.

“choosing the model that provides sufficient quality while meeting latency and cost requirements.”summary, stated

Embedding model

Chose text-embedding-3-small. over A larger embedding model exceeding OpenSearch's efficient retrieval limit..

Rationale: It outputs 1536-dimensional vectors aligned with OpenSearch's maximum dimensionality constraint.

“OpenSearch has a maximum dimensionality limit of 1536 for efficient retrieval”summary, stated

Gotchas (what bit them)

The case study does not disclose concrete search-lift numbers.

Root cause: It names conversion, click-through, and satisfaction goals without publishing before/after results.

Resolution: Treat reported evaluation as process evidence rather than quantified impact evidence.

“Specific quantitative results are not provided—improvements in conversion rates, click-through rates, or customer satisfaction are mentioned as goals but no before/after metrics are shared”summary, stated

Real-time LLM calls would break search latency.

Root cause: Typical LLM responses take seconds, while search needs millisecond-level response.

Resolution: Precompute common search-term and catalog embeddings.

“allowing the system to deliver results in milliseconds rather than the seconds that typical LLM responses require.”summary, stated

Model and embedding outputs can drift over time.

Root cause: Language models vary with updates and model iterations.

Resolution: Use sanity checks for embedding consistency and expected length.

“The pipeline includes numerous sanity checks, such as verifying that embeddings are consistent and of the appropriate length.”summary, stated

Offline evaluation can optimize against imperfect historical ground truth.

Root cause: Past search results may not represent optimal future outcomes.

Resolution: Use offline evaluation for initial tuning and online A/B testing for real user validation.

“offline evaluation relies on historical search results, and the ground truth derived from past behavior may not perfectly reflect optimal outcomes.”summary, stated

Evaluation

Picnic used offline optimization for search parameters, prompts, dimensions, and models, then validated with A/B testing on real conversion, click-through, and customer satisfaction.

Metrics: Conversion rates · Click-through rates · Customer satisfaction · Embedding consistency and length · Latency and system stability

“The metrics they focus on include: • Conversion rates (users finding what they search for) • Click-through rates (measuring result relevance) • Overall customer satisfaction”summary, stated

Outcomes

Picnic operates in three countries, handles millions of search terms, precomputes roughly 99% of customer terms, and uses 1536-dimensional embeddings.

“This eliminates the need for real-time LLM inference in the vast majority of cases”summary, stated