Instacart integrated LLMs into their search stack to enhance product discovery and user engagement. They developed two content generation techniques: a basic approach using LLM prompting and an advanced approach incorporating domain-specific knowledge from query understanding models and historical data. The system generates complementary and substitute product recommendations, with content generated offline and served through a sophisticated pipeline. The implementation resulted in significant improvements in user engagement and revenue, while addressing challenges in content quality, ranking, and evaluation.
## Overview
Instacart, a major grocery e-commerce platform operating a four-sided marketplace, developed an LLM-powered system to enhance their search experience with discovery-oriented content. The case study from 2024 details how they moved beyond traditional search relevance to incorporate inspirational content that helps users find products they might not have explicitly searched for but would find valuable.
The core business problem was that while Instacart's search was effective at returning directly relevant results, user research revealed a desire for more inspirational and discovery-driven content. The existing "Related Items" section was limited in its approach—for narrow queries like "croissant," it would return loosely related items like "cookies" simply because they shared a department category. Additionally, the system failed to suggest complementary products that would naturally pair with search results (e.g., suggesting soy sauce and rice vinegar for a "sushi" search).
## LLM Integration Strategy
Instacart's approach to integrating LLMs into their production search stack was deliberate and multi-faceted. They identified two key advantages of LLMs for this use case: rich world knowledge that eliminates the need for building extensive knowledge graphs, and improved debuggability through transparent reasoning processes that allow developers to quickly identify and correct errors by adjusting prompts.
The team built upon their earlier success with "Ask Instacart," which handled natural language-style queries, and extended LLM capabilities to enhance search results for all queries, not just broad intent ones.
## Content Generation Techniques
### Basic Generation
The basic generation technique involves instructing the LLM to act as an AI assistant for online grocery shopping. The prompt structure asks the LLM to generate three shopping lists for each query: substitute items, and two complementary/bought-together product groups. The prompts include:
- Specific product requirements defining desired output format
- Hand-curated few-shot examples demonstrating expected response structure
- Instructions to generate general recommendations covering various store types
- Guidance to keep items at a single concept level rather than specific products
- Requests for brief explanations to enhance user understanding
The output is structured as JSON with categories for substitutes, complementary items, and themed collections. For example, an "ice cream" query would generate substitute frozen treats, complementary toppings and sauces, and themed lists like "Sweet Summer Delights."
### Advanced Generation
The advanced generation technique emerged from recognizing that basic generation often misinterpreted user intent or generated overly generic recommendations. For instance, a search for "Just Mayo" (a vegan mayonnaise brand) would be misinterpreted as generic mayonnaise, and "protein" would return common protein sources rather than the protein bars and powders that users actually converted on.
To address this, Instacart augmented prompts with domain-specific signals:
- Query Understanding (QU) model annotations that identify brands (), product concepts (