Problem
Snap runs Spotlight, a short-video feed inside Snapchat. Scoring every eligible video for every user costs too much and is too slow for online serving. Creators supply only a description and hashtags, so text-based retrieval has little to work with. The retrieval stage must still return personalized candidates, because the ranking models only see what retrieval passes on.
Example from the article: Without in-batch negatives, many retrieved stories came from countries or languages that did not match the user.
Solution in brief
Snap trained a two-tower model, one tower for users and one for videos, so that the dot product of the two 128-dimensional embeddings predicts engagement. Video embeddings go into an HNSW index, and user embeddings are looked up per request to query it. In-batch negatives teach the model to separate mismatched countries and languages.
Questions this case answers
- How to retrieve personalized candidates from a very large catalog under a tight latency limit when items carry little text
- How to train and serve a two-tower retriever so that user and item embeddings can be refreshed at different rates
- How to pick a small set of relevant videos per user from millions without scoring every video?
- How to retrieve candidates for a short-video feed when creators give almost no text?
Tools and methods
- Two-tower model — separate user and story encoders; their embeddings are compared by cosine similarity
- Deep cross network (DCN) with an MLP — feature interactions inside each tower
- In-batch negative sampling — other users' stories in the batch serve as negatives
- HNSW index — approximate nearest neighbor search over story embeddings
- Two offline dataflows — periodic user and story embedding generation
Google or a one-time email code. No password.