Inside Facebook’s video delivery system
Facebook spent roughly two years unifying its separate Watch and Reels stacks across mobile clients, the server layer and ranking, in a deliberate order. First came a shared client and server data model, then the immersive Reels UI for long-form VOD, then unified ranking (shipped August 2024) once UI signals were consistent, and finally a single video tab mixing Reels, VOD and live. The delivery pipeline runs on five principles: freshness, ranking-decided order, minimal vending, deterministic fetching and signal-driven delivery. Concretely, clients use prefetch, head and tail loads gated on an in-memory pool of three or fewer network stories; the GraphQL server handles caching, throttling, TAO loads and costly privacy checks; and ranking runs a graph-based multi-stage retrieval and ranking workflow with elastic ranking under load.
Related posts
- How Facebook encodes your videos
Meta Engineering mediumAdeptFacebook prioritizes advanced video encodings (VP9, slower H264 recipes) by a Benefit/Cost score instead of hard-coded rules. Benefit is relative compression efficiency at fixed quality, measured by Minutes of Video at High Quality per GB (MVHQ), multiplied by effective predicted watch time adjusted for device codec support. Cost is the normalized compute needed to finish the missing lanes of an encoding family, so priority rises as a family nears deliverability. Next-hour watch time comes from two ML models, one at upload time using creator history and one at view time using the video's watch trajectory. These are trained on rebalanced event data and evaluated with RMSE, MAPE, per-category metrics and threshold-based false positive/negative rates.
- Friend Bubbles: Enhancing Social Discovery on Facebook Reels
Meta Engineering mediumAdeptFriend bubbles on Facebook Reels surface videos that close friends have reacted to, using two closeness models: a survey-trained model run weekly over trillions of friend pairs, and a context-specific model trained on bubble interactions. Retrieval explicitly sources friend-interacted candidates, and early- and late-stage multi-task ranking models gain closeness features and a P(engagement | bubble impression) objective with tunable weights balancing social and video engagement. On the client, bubble metadata rides the existing prefetch window so bubbles render with the video, and animation is disabled while scrolling and on low-end devices. Expressive reactions and multiple friend interactions drive stronger engagement, and bubble exposure increases longer sessions and topic diversity.
- An analysis of Facebook photo caching
Meta Engineering mediumAdeptFacebook's photo-serving stack (browser caches, PoP edge caches, a photo-ID-sharded origin cache spanning data centers, and the Haystack backend) cuts backend traffic so Haystack serves only 9.9% of photo requests, based on a month-long trace from an SOSP study. Photo popularity follows a power law that flattens toward a stretched exponential deeper in the stack, and browser/edge caches mainly absorb the most popular photos. Trace replay shows doubling cache size lifts edge hit ratio from 59% to 65% and origin from 33% to 42.5%. Replacing FIFO with S4LRU (segmented LRU) raises edge hit ratio to 67.7% and origin to 46.9% at current size, outperforming LRU, LFU and other tested policies.
- Adapting the Facebook Reels RecSys AI Model Based on User Feedback
Meta Engineering mediumAdeptFacebook 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. A lightweight "perception layer" is trained on binarized, bias-weighted survey responses, using the main multi-task ranker's predictions as features. Its output feeds late-stage ranking as a value-formula input and drives retrieval through re-ranked interest profiles and knowledge distillation. Offline, precision rose from 48.3% to 63.2% and recall from 45.4% to 66.1% over heuristics, and A/B tests with over 10M users showed +5.2% engagement and +5.4% high survey ratings.
- From User Sequences to Scaling Laws: A Multi-Stage Architecture for Meta’s Ads Ranking
Meta Engineering hardMasterMeta scales sequence learning for ads ranking by splitting it into two stages: an offline transformer user model processes thousands of user events asynchronously and caches user-level embeddings, and a lightweight online ranking model combines those embeddings with fresh signals and ad candidates under strict latency budgets. Dense tokenization folds sparse features into a single vocabulary, and target-aware multi-head attention weighs past behavior against the ad being scored, so feature interactions are learned rather than hand-engineered. The system shows LLM-style log-linear scaling of normalized entropy with compute. Scaling works best when depth, width and sequence length grow together, and diverse action-type sequences beat homogeneous ones. Together with other model work it contributed to 6% more conversions on Instagram and 3% on Facebook.