Using LLMs to Enhance Search Discovery and Recommendations
instacart · 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: Grocery search discovery and recommendations
Instacart needed to add inspirational discovery content to search results without degrading relevance, latency, page layout, or revenue outcomes.
Constraints:
- Traditional related-items logic produced weak alternatives for narrow queries.
- Discovery content had to suggest substitutes and complementary products, not just exact matches.
- LLM generation needed Instacart-specific context such as query understanding and conversion data.
- Serving had to avoid request-time LLM latency and cost.
- More page content created ranking and clutter tradeoffs.
Architecture
Instacart precomputes LLM-generated discovery content offline. Batch jobs enrich historical queries with query-understanding annotations, conversion patterns, consecutive-search signals, and prompt templates; an LLM generates substitutes and complementary shopping lists; generated terms are mapped through Instacart's search engine into products; post-processing removes duplicates and diversifies results; a key-value store serves content at query time; and a Whole Page Ranker positions carousels on the page.
Diagram confidence: explicit (topology described by the source).
flowchart LR search-logs-and-query-metadata["Search logs and query metadata"] --> offline-prompt-generation["Offline prompt generation"] offline-prompt-generation --> llm-content-generator["LLM content generator"] llm-content-generator --> llm-content-store["LLM content store"] llm-content-generator --> product-mapping-search["Product mapping search"] product-mapping-search --> post-processing-and-diversification["Post-processing and diversification"] llm-content-store --> runtime-search-service["Runtime search service"] post-processing-and-diversification --> runtime-search-service runtime-search-service --> whole-page-ranker["Whole Page Ranker"] llm-content-generator --> llm-judge-evaluator["LLM judge evaluator"]
Components
| Component | Role | Interacts with |
|---|---|---|
Search logs and query metadata |
Provide historical queries, engagement, conversion, and query-understanding signals. | Offline prompt generation |
Offline prompt generation |
Populates prompt templates with enriched query context. | Search logs and query metadata, LLM content generator |
LLM content generator |
Produces substitute, complementary, and themed shopping-list concepts. | Offline prompt generation, LLM content store |
LLM content store |
Stores generated content by query for low-latency serving. | LLM content generator, Runtime search service |
Product mapping search |
Maps generated item concepts to actual catalog products through existing search. | LLM content generator, Post-processing and diversification |
Post-processing and diversification |
Removes duplicates, filters irrelevant products, and reranks for variety. | Product mapping search, Runtime search service |
Runtime search service |
Serves standard results and LLM-generated inspirational carousels for user queries. | LLM content store, Post-processing and diversification, Whole Page Ranker |
Whole Page Ranker |
Positions discovery content on the page while balancing relevance and revenue. | Runtime search service |
LLM judge evaluator |
Scores generated complementary/substitute content quality at scale. | LLM content generator |
Data flow
Search logs feed an offline batch job that enriches each query with domain signals and fills prompt templates. The LLM generates substitute and complementary item concepts, which are stored by query, converted back through the existing product search engine, de-duplicated and reranked, then looked up at runtime alongside normal search results. A Whole Page Ranker chooses where to show the inspirational content.
3 supporting quotes
Why this architecture
Instacart precomputes LLM content because grocery search requires fast, predictable request-time serving. LLM world knowledge is improved by Instacart-specific query, conversion, and sequential-search signals, then existing search infrastructure maps concepts to actual products.
3 supporting quotes
Models used: LLM content generation model · Query Understanding model · Whole Page Ranker · LLM as a Judge evaluator
Scale
- Instacart operates a four-sided marketplace.“Instacart, a major grocery e-commerce platform operating a four-sided marketplace”summary, stated
- Sequential-search analysis improved inspirational-content engagement by 18%.“This methodology led to an 18% improvement in engagement rate with inspirational content.”summary, stated
Alternatives considered (roads not taken)
Use department-level related items
Rejected because: It returned loosely related products like cookies for croissant and missed complementary suggestions.
Use generic LLM world knowledge alone
Rejected because: Basic generation misread brand and category intent without Instacart-specific signals.
Run LLM generation at request time
Rejected because: Offline generation traded real-time personalization for cost efficiency and consistent latency.
Patterns
rag-retrieval (recommendation)
Instacart augments LLM generation with search logs, conversion categories, query-understanding annotations, and sequential search terms.
batch-offline-processing (serving)
LLM content is generated offline for known queries and served from a key-value store.
retrieval-ranking (ranking)
Whole Page Ranker and diversification logic decide where and how to show generated discovery content.
llm-as-judge (evaluation)
Instacart uses an LLM evaluator to score complementary and substitute recommendation content at scale.
query-rewriting (search)
Generated concepts are treated as search queries and passed back through Instacart's existing search engine.
Tradeoffs
Offline generation
Chose Precompute LLM content and store it by query over Generate discovery content during each search request.
Rationale: Precomputation controls latency and cost at the expense of real-time personalization.
Domain-augmented prompts
Chose Fuse LLM world knowledge with Instacart query and conversion data over Use basic grocery-shopping prompts alone.
Rationale: Domain signals reduce misinterpretation and generic suggestions.
Reuse existing search for product mapping
Chose Treat LLM-generated items as search queries over Build a separate product retrieval system for generated recommendations.
Rationale: Existing search infrastructure already matched item concepts to catalog products.
Gotchas (what bit them)
Generic LLM recommendations can miss domain-specific intent.
Root cause: Brand names and grocery-specific conversion patterns are not reliably inferred from world knowledge alone.
Resolution: Instacart injects QU annotations, historical conversions, and purchase patterns into prompts.
More generated content can clutter the search page.
Root cause: Adding inspirational modules increases competing content on a revenue-sensitive interface.
Resolution: Instacart built a Whole Page Ranker to choose content positions dynamically.
Offline LLM generation limits freshness.
Root cause: Content is precomputed and updated on a batch cadence rather than personalized at request time.
Resolution: The architecture accepts the freshness tradeoff for cost efficiency and consistent latency.
Generated concepts can map to irrelevant products.
Root cause: LLM item concepts still need catalog grounding through search.
Resolution: Post-processing removes duplicates, filters irrelevant recalls, and diversifies results.
Evaluation
Instacart evaluated discovery content with engagement metrics, revenue alignment, and an LLM-as-judge prompt that scores complementary/substitute content quality for e-commerce recommendations.
Metrics: 18% engagement-rate improvement · LLM quality scores · Revenue alignment · Content position through Whole Page Ranker
Outcomes
- Sequential search-term analysis improved inspirational-content engagement by 18%.
- The system supports substitute and complementary product discovery.
- Offline generation and key-value serving avoid request-time LLM latency.
- Generated content is positioned with a Whole Page Ranker to balance relevance and revenue.
Instacart applies the system across grocery search queries in a four-sided marketplace, using batch generation and query-keyed serving for known searches.