Multi-Stage Approach to Building Recommender Systems

Nathan Cheng2023

Problem

A product with a large item catalog cannot show everything, and users get lost in the volume. A recommender filters and orders items for a user, but building one is expensive. The first question is whether the product needs it at all. The second is how to split the work so that a catalog of up to billions of items is still answered quickly.

Example from the article: a "Similar items to..." panel on an item page. With a small catalog it is one SQL query returning the top items of the current item's category.

Solution in brief

Check first whether SQL over item categories is enough. If not, build three stages. Candidate generation uses embeddings and an approximate nearest-neighbor index to cut the catalog to about a hundred items. Scoring ranks them with a supervised model, and re-ranking adjusts the list for quality and diversity.

Questions this case answers
  • How to choose a layered architecture for a recommender when the item catalog is too large to score every item with a heavy model
  • How to decide between rule-based retrieval and a learned recommender given catalog size, data type and experimentation maturity
  • How to decide whether a product needs a recommender system or a SQL query is enough?
  • How to structure a recommender system for a catalog of millions of items?

Tools and methods

  • Dynamic SQL query — baseline for small catalogs
  • Embeddings — vectors for users and items, compared by a distance metric
  • Approximate nearest neighbors (ANN) engine — serves candidate generation: FAISS, Amazon OpenSearch, Vertex AI Matching Engine
  • Cloud Bigtable — stores embeddings instead of an ANN engine
  • Scoring model — supervised classifier that outputs a probability for the target metric
  • Re-ranking rules or model — removes malicious items, adds diversity
  • TensorBoard Embedding Projector — shows embeddings in 2-D to spot clusters
Continue reading — it's free

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