---
title: "Scaling the Instagram Explore recommendations system"
description: "Instagram Explore uses a four-stage funnel of retrieval, first-stage ranking, second-stage ranking and final reranking, built around caching and pre-computation so heavier models can be used at every stage."
url: "https://swe.quest/articles/scaling-the-instagram-explore-recommendations-system-eef9723f73cee8af"
canonical: "https://engineering.fb.com/2023/08/09/ml-applications/scaling-instagram-explore-recommendations-system/"
source: "Meta Engineering"
published: "2023-08-09"
difficulty: "medium"
kind: "Case study"
reading_minutes: 9
tags: ["recommendation-systems","machine-learning","caching","scalability","vector-search"]
---

# Scaling the Instagram Explore recommendations system

A post on [Meta Engineering](https://swe.quest/sources/meta.md), published 2023-08-09, 9 min read, Case study. Original: [https://engineering.fb.com/2023/08/09/ml-applications/scaling-instagram-explore-recommendations-system/](https://engineering.fb.com/2023/08/09/ml-applications/scaling-instagram-explore-recommendations-system/)

## Summary

Instagram Explore uses a four-stage funnel of retrieval, first-stage ranking, second-stage ranking and final reranking, built around caching and pre-computation so heavier models can be used at every stage. Two Tower neural networks with cached user and item embeddings and ANN search handle retrieval, and they also serve as a lightweight first-stage ranker distilled from the heavy second stage. The second stage is a multi-task multi-label model whose engagement probabilities are combined by a tunable weighted value model, with some recommendations precomputed off-peak. Final reranking applies integrity filters and diversity rules, and the system's hundreds of parameters are tuned by online Bayesian optimization or by faster offline tuning that maps offline metrics to online ones.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Recommendations & ranking](https://swe.quest/tags/recommendation-systems.md) (AI & ML)
- [Machine learning](https://swe.quest/tags/machine-learning.md) (AI & ML)
- [Caching](https://swe.quest/tags/caching.md) (Backend & APIs)
- [Scaling](https://swe.quest/tags/scalability.md) (Distributed systems)
- [Vector search](https://swe.quest/tags/vector-search.md) (Data & databases)

## Prerequisites

- neural network basics
- embeddings ([easy posts on RAG & retrieval](https://swe.quest/tags/rag.md?difficulty=easy))
- approximate nearest neighbor search ([easy posts on Search](https://swe.quest/tags/search.md?difficulty=easy))

## Keywords

Instagram Explore, Two Tower neural network, Word2Vec, FAISS, HNSW, Bayesian optimization, MTML

## Related posts

- [Beyond Two Towers: Launching the 3-Tower Engagement Co-Train Model (Part 2)](https://swe.quest/articles/beyond-two-towers-launching-the-3-tower-engagement-co-train-model-part-2-9d501e5f993d9614.md): Pinterest Engineering · 2026-09-17 · Hard · 13 min read · Recommendations & ranking, Ads, Inference & serving, Performance engineering, Machine learning
  Pinterest's ads lightweight ranking adds a third cross tower to its two-tower engagement model.
- [ML based ranking using Nrtsearch](https://swe.quest/articles/ml-based-ranking-using-nrtsearch-7c7a1334adf546d5.md): Yelp Engineering · 2026-09-16 · Medium · 8 min read · Search, ML platforms, Inference & serving, Recommendations & ranking, Deployment
  Yelp moved ML-based ranking out of a standalone scoring service and into Nrtsearch, its Lucene-based search engine, via an Inference Plugin that extracts features from indexed documents and request parameters and scores them in-process on replica nodes.
- [Our Early Journey to Transform Instacart’s Discovery Recommendations with LLMs](https://swe.quest/articles/our-early-journey-to-transform-instacart-s-discovery-recommendations-with-llms-2b1f0ff7e32d37b4.md): Instacart Tech · 2026-02-26 · Medium · 14 min read · Recommendations & ranking, LLMs, RAG & retrieval, Evaluation, E-commerce
  Instacart rebuilt its Shopping Hub discovery recommendations around a top-down, cascaded LLM pipeline.
- [Adapting the Facebook Reels RecSys AI Model Based on User Feedback](https://swe.quest/articles/adapting-the-facebook-reels-recsys-ai-model-based-on-user-feedback-9918fb6d6f23d0f0.md): Meta Engineering · 2026-01-14 · Medium · 5 min read · Recommendations & ranking, Machine learning, Evaluation
  Facebook Reels added a User True Interest Survey (UTIS) model that learns from in-feed survey responses asking how well a video matches the viewer's interests, instead of relying only on engagement signals like likes and watch time.
- [Bypassing inference bottlenecks: Accelerating complex AI search with Retrieve-for-Train](https://swe.quest/articles/bypassing-inference-bottlenecks-accelerating-complex-ai-search-with-retrieve-95676e43f1ce9cc3.md): Google Research · 2026-09-15 · Hard · 8 min read · Search, Model training, Inference & serving, LLMs, Recommendations & ranking
  Retrieve-for-Train replaces expensive inference-time LLM reasoning for query fan-out with a one-time offline RL stage.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
