● LIVE   Breaking News & Analysis
Paintou
2026-05-20
Technology

How to Engineer a Social Discovery Feature for Billions of Users

Learn how to build a social discovery feature at scale, using the Friend Bubbles example from Facebook Reels. Step-by-step guide covers ML models, platform differences, scaling, and surprising insights.

Introduction

On the surface, the Friend Bubbles feature on Facebook Reels looks deceptively simple: it highlights which Reels your friends have watched and reacted to. But behind that simplicity lies a complex engineering challenge—building a social discovery system that scales to billions of users. In a recent episode of the Meta Tech Podcast, engineers Subasree and Joseph shared how they brought Friend Bubbles to life, from evolving machine learning models to handling differences between iOS and Android users. This guide breaks down their journey into a step-by-step framework you can apply to similar projects.

How to Engineer a Social Discovery Feature for Billions of Users
Source: engineering.fb.com

What You Need

  • Machine learning expertise: Knowledge of recommendation systems, collaborative filtering, and reinforcement learning.
  • Cross-platform development experience: Familiarity with iOS and Android architecture to handle behavioral differences.
  • Scalable infrastructure: Ability to design real-time and offline pipelines capable of billions of operations.
  • User behavior datasets: Access to anonymized engagement data (watches, reactions, shares) for model training.
  • A/B testing framework: Tools to validate changes with small user groups before full rollout.
  • Solid understanding of privacy: Ensure compliance with data protection regulations when using friend interactions.

Step-by-Step Guide

Step 1: Define Your Core Social Signal

Start by identifying the specific social interaction that drives discovery. For Friend Bubbles, the team chose to highlight Reels that friends had watched and engaged with—likes, comments, shares. This required a clear definition of what qualifies as a "social signal."

  • Determine if raw activity (e.g., any view) is enough, or if you need weighted signals (e.g., a comment matters more than a view).
  • Decide on time windows: recent activity vs. all-time? The team found short windows more relevant.
  • Consider privacy: only surface actions that friends have consented to share.

Step 2: Build an Evolving Machine Learning Model

The initial model was simple—show all friend interactions equally. But to personalize, Subasree and Joseph developed a model that predicts which Reels a user is most likely to care about based on their friend's past behavior.

  • Start with heuristics: Rank Reels by number of friend interactions, then move to collaborative filtering.
  • Incorporate engagement signals: Use feedback loops (clicks, dwell time) to reweight items.
  • Experiment with reinforcement learning: The team eventually used a contextual bandit approach to adapt in real time.
  • Continuously retrain the model as new user behavior arrives—weekly or daily.

Step 3: Analyze Platform Differences (iOS vs. Android)

A surprising finding was that iOS and Android users behave differently when interacting with Friend Bubbles. For example, iOS users were more likely to tap bubbles, while Android users scrolled more. This required separate model tuning.

  • Instrument platform-specific analytics to capture gesture patterns (tap vs. scroll).
  • Check notification opt-in rates; on iOS, permissions vary significantly.
  • Adjust UI rendering for different device performance (bubble animations on Android need lighter GPU load).
  • Run separate A/B tests per platform.

Step 4: Embrace Surprising Discoveries

The biggest breakthrough came when the team noticed that friends who reacted to a Reel but didn't share it still created strong social pull. This reversed their assumption that only shared content mattered. They then optimized the model to give higher weight to silent interactions.

How to Engineer a Social Discovery Feature for Billions of Users
Source: engineering.fb.com
  • Use data exploration to find unexpected patterns—run ad-hoc queries on raw logs.
  • Involve engineers in qualitative feedback (watch sessions with users).
  • Be ready to invalidate prior hypotheses quickly; fail fast.
  • Document surprising insights for future feature iterations.

Step 5: Scale to Billions

With the model and features working, the final challenge was serving billions of users with low latency. Friend Bubbles requires real-time computation of who your friends are and what they did.

  • Use a graph database: Precompute friend edges and cache them in a distributed graph store.
  • Optimize for read-heavy loads: Write friend interaction aggregates to read-optimized tables.
  • Shard by user ID: Partition data across hundreds of servers to handle peak traffic.
  • Implement fallback logic: If real-time data is stale, show cached bubbles to avoid empty screens.
  • Monitor tail latency closely—any increase hurts user engagement.

Tips for Success

  • Listen to the full podcast: The Meta Tech Podcast dives deeper into the engineering decision-making. You can find it on Spotify, Apple Podcasts, or Pocket Casts.
  • Start small, then iterate: Don't try to build a billion-user system day one. Launch with a limited dataset and expand.
  • Involve cross-functional teams: Data science, product, and client engineering should collaborate from the start.
  • Keep privacy first: Always let users control what they share. Friend Bubbles respects existing privacy settings.
  • Measure what matters: Track not just engagement but also user satisfaction (surveys, sentiment).
  • Learn from surprising data: As Joseph and Subasree discovered, the biggest wins come from challenging assumptions.

Building a feature like Friend Bubbles is never as simple as it appears. But by following these steps—defining signals, building adaptive models, accounting for platform quirks, staying open to discoveries, and scaling thoughtfully—you can create social discovery that delights billions.