How Instacart Uses Machine Learning-Driven Autocomplete to Help People Fill Their Carts

Esther Vasiete, Tejaswi Tenneti30 Aug 2022

Problem

Grocery search has to turn a few typed letters into a query that returns relevant products and ends in an add to cart. Instacart first ranked autocomplete suggestions by popularity, which puts a very popular query in the first slot even when it is unlikely for the typed prefix. Each retailer has its own catalog, so suggestions are built per retailer, and new or small retailers lack the traffic to build them. User logs also contain misspellings and near-duplicate phrasings that waste the few visible slots.

Example from the article: for the prefix "pa", the popularity model ranks "toilet paper" first because it is a very popular query, even though it is an unlikely completion of "pa".

Solution in brief

Suggestions come from filtered past searches, matched by prefix at the start of any word, with fuzzy matching and embedding-based deduplication. A lightweight ranker trained on autocomplete impressions replaces popularity ordering. A second model that predicts add to cart per term is multiplied with it, so ranking favors suggestions that lead to carts.

Questions this case answers
  • How to rank type-ahead suggestions by their contribution to a downstream conversion when a popularity ranking surfaces queries that are unlikely for the typed prefix
  • How to train a two-step funnel ranker when the joint label (suggestion clicked and then converted) is too sparse
  • How to generate suggestion candidates for tenants with too little search traffic of their own
  • How to rank autocomplete suggestions by what the user is likely to click and add to the cart, not by popularity alone?

Tools and methods

  • Query autocomplete corpus — filtered past searches, matched by prefix, per retailer.
  • Fuzzy matching with a discount factor — keeps misspelled high-converting terms reachable.
  • Embedding-based deduplication — thresholded dot product of query embeddings.
  • Pointwise ranking (binary classification) — autocomplete engagement model over prefix-query features.
  • Model aggregation — product of an engagement model and an add-to-cart model.
Continue reading — it's free

Google or a one-time email code. No password.