Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Instacart Tech 10 min read Case study hardMaster

Semantic IDs: Product Understanding at Scale

Instacart compresses product text embeddings into 4-level semantic IDs using a residual vector quantizer (RQ-VAE), so products with related meaning share code prefixes across taxonomy branches (e.g., Italian cheeses, olives and tapenades under 6_19). A contrastive regularizer (λ=0.01) uses catalog-tree distance as supervision, with hierarchical batch sampling, which helps cold-start products that lack engagement data. Two embedding flavors serve different needs: ESCI for precise substitution and search, and Gemini-extracted attributes embedded with Gemma for broader discovery. Intrinsic evaluation (similarity-depth correlation of 0.69–0.84, LLM cluster scoring, taxonomy alignment) showed failures from sparse product text and exposed mislabeled catalog items. Generative retrieval over the ~2,000-token code vocabulary delivered +34% add-to-carts on carousels.

Related posts

  • From Scoring to Spelling: Rebuilding Ads Retrieval at Instacart

    Instacart Tech hardMaster

    Instacart replaced its BERT-based ads retrieval model, which scored every atomic product ID in a fixed vocabulary, with a generative model that autoregressively decodes Semantic IDs (RQ-VAE codeword sequences) via beam search. The goal was to fix vocabulary bottlenecks, cold-start bias toward popular items, and incoherent candidate sets. Prompts combine a retailer-type token, user history SIDs and cart SIDs. SIDs shrink embedding parameters 125x and give new products coverage from day one, while beam width and temperature act as dials between precision and diversity. Serving moved from Python on CPU to a Go service on TensorRT-LLM and Triton. Mean latency dropped 10–17% despite roughly twice the candidates, and A/B tests showed +5% CTR and +34% add-to-carts.

  • Shopify’s generative discovery model

    Shopify Engineering hardMaster

    Shopify trained a single generative model, adapted from an open-weight LLM, that emits semantic-ID tokens to generate product candidates for both personalized search and recommendation across a catalog of billions. Products are tokenized with RQ-KMeans into three-token semantic IDs (three 8,192-entry codebooks). Training combines joint continued pretraining, upsampling of first-purchase discovery events, RL with an LLM relevance judge (+1.5 OneDCG@10) and multi-teacher distillation from task experts. For serving, LFM2-2.6B was chosen for its 25.5 ms p95, GPU trie-constrained decoding via STATIC cut constraint overhead from 50 ms to about 1 ms, and multi-token prediction replaces autoregressive decoding. In production the model lifted home-feed orders by 7.95% and search OneDCG@10 by 2.1 points.

  • Shaping Product Understanding with Contrastive Reinforcement Learning

    Etsy Code as Craft hardMaster

    Etsy fine-tunes Qwen3-VL-8B with GRPO to generate natural-language listing summaries that capture distinguishing product details buried in long descriptions, attributes and images. Training uses search triplets (query, engaged listing, non-engaged listing), and the reward is the margin in query similarity between the two listings' summaries as scored by a frozen two-tower search retriever. Scoring the pair jointly discourages reward hacking, because a generic or keyword-stuffed summary cannot raise one listing's similarity while lowering the other's. Human review found the summaries grounded and specific. Feeding them into a separate semantic relevance classifier improved macro F1 by 8.7% relative to description n-grams, and online experiments are planned next.

  • Understanding Etsy’s Vast Inventory with LLMs

    Etsy Code as Craft mediumAdept

    Etsy extracts structured product attributes such as color, material and dimensions from unstructured listing titles, descriptions and photos using LLMs. It does this because sellers rarely fill optional attribute fields, and passing raw text and images into search would add too much latency. The pipeline injects per-listing JSON context (listing data, expert-picked few-shot examples, taxonomy rules) into parallel prompts routed through LiteLLM across regions, then validates outputs with Pydantic. Evaluation moved from error-prone human labels to expert-reviewed "silver labels" from frontier LLMs, and each run first scores a ground-truth sample and aborts if precision or recall drift from baseline. In target categories, complete attribute coverage rose from 31% to 91%, and LLM-inferred attributes in search filters raised filter engagement and conversion.

  • Our Early Journey to Transform Instacart’s Discovery Recommendations with LLMs

    Instacart Tech mediumAdept

    Instacart rebuilt its Shopping Hub discovery recommendations around a top-down, cascaded LLM pipeline. It first generates personalized page themes, then taxonomy-grounded retrieval keywords, then applies quality and diversity filtering, and finally hands off to existing product and pagewise ranking services. Keyword generation uses a teacher-student fine-tuned open-weight model (Llama/Qwen with LoRA ablations). It also uses RAG that prunes a 300,000-term keyword corpus to about 100 nearest neighbors per theme, which cut generation costs 15–20%. Quality is enforced through embedding-based deduplication, LLM-as-a-judge evaluators calibrated with human-in-the-loop data, and a fine-tuned cross encoder for theme-product relevance at scale.

The quest for software engineering knowledge.

Look:
Layout: