Runtime Transformer in Personal Recommendations at Yandex Lavka

Mark Narusov24 May 2025

Problem

Yandex Lavka (grocery delivery) recommends items on about 10 app surfaces: home, product page, cart. Recommendations drive more than 20% of GMV, at about 1100 RPS at peak and a 300 ms deadline. The team ran a transformer over user history only as a daily batch job, so the ranker saw history that was 24 hours old or older. An offline test showed 2% higher NDCG with history that is 90 seconds old.

Example from the article: the feed is returned in chunks of 20 items, and add-to-cart conversion by position spikes at every multiple of 20. A user adds something from the first chunk, and the next chunk is requested with the updated cart.

Solution in brief

Lavka moved a late-interaction (two-tower) transformer to runtime. A history service turns recent actions into tensors, the inference service returns the user embedding, and the recommender fetches it asynchronously while collecting candidates. The gradient-boosting ranker uses the user-item dot products as features. After the ranker was retrained, cart revenue grew by 6-8%.

Questions this case answers
  • How to add a real-time sequence model over a user's recent actions to a gradient-boosting ranker without retraining the whole ranker, while keeping training and serving preprocessing identical
  • How to fetch a long user action history within a tight latency budget and feed its embedding into a ranking model
  • How to add a real-time transformer over user history to a grocery recommender without retraining the whole ranker
  • How to keep training and serving preprocessing identical for a sequence model

Tools and methods

  • Two-tower transformer — user tower over an action sequence, item tower over content embeddings
  • WordPiece tokenization — embeddings for new products without retraining
  • Dynamic table (YTsaurus) — user history with fast reads and writes
  • Shared preprocessing config — one code path for training and serving
  • Gradient boosting ranker — consumes the transformer scores as features
Continue reading — it's free

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