How to Engineer Social Discovery at Scale: Inside Friend Bubbles’ Building Blocks
Introduction
Ever wondered what it takes to build a feature that looks deceptively simple on the surface but requires immense engineering to work for billions? Meta’s Friend Bubbles on Reels is exactly that — it shows you which Reels your friends have watched and reacted to, turning passive scrolling into a social experience. But behind those floating avatars lies a complex journey of machine learning evolution, platform behavior differences, and one breakthrough discovery that made the whole system click. This step-by-step guide unpacks the engineering process behind building a social discovery feature that scales to billions, drawing from the insights shared by Subasree and Joseph on the Meta Tech Podcast.

What You’ll Need (Prerequisites & Materials)
- Engineering team with cross‑functional skills – ML engineers, backend/infrastructure engineers, iOS & Android specialists, and product managers.
- Large‑scale user interaction data – Watch history, reaction signals (likes, comments, shares), social graph connections, and timestamps.
- Machine learning framework – Capable of training recommendation models, e.g., PyTorch, TensorFlow, or Meta’s own platforms.
- Different platform testing environments – iOS and Android devices (or emulators) to catch behavioral differences.
- Real‑time data pipeline – To ingest and process user actions with low latency (Kafka, Flink, or similar).
- Monitoring & observability tools – Metrics for latency, accuracy, user engagement, and memory/CPU usage.
- Iterative development mindset – Expect many rounds of experimentation and failures before the “click.”
Step‑by‑Step Guide
Step 1: Define the Feature’s Core Logic
Start by nailing down the exact user experience. For Friend Bubbles, the idea is simple: “Show me Reels my friends have interacted with.” But you must decide which interactions count (watched? liked? commented?) and how to surface them without overloading the viewer. Create a specification that answers:
- What signals define a friend’s engagement?
- How many bubbles to show per Reel?
- Should the ranking be recency, frequency, or a mix?
Document these rules clearly – they will guide every engineering choice later.
Step 2: Build the Data Infrastructure
Before you can recommend anything, you need to collect and store friend‑interaction signals. Set up a real‑time ingestion pipeline that captures every watch, like, share, and comment from every user and relates it to the Reel’s ID as well as to the friend’s profile ID. At the scale of billions, you must think about:
- Sharding – distribute data across many nodes.
- Caching – frequent friend‑pairs can be pre‑computed.
- Consistency guarantees – is it acceptable to show a slightly stale bubble? (Yes, for latency trade‑offs.)
Meta engineers found that surprising edge cases (like a user with 10,000 friends) require special handling – plan for sparsity and long‑tail behavior from day one.
Step 3: Train the Machine Learning Model (Iteration 1)
The first ML model for Friend Bubbles might be simple: rank friends by recent interactions with the current Reel. But soon you’ll discover that “raw recency” doesn’t always produce engaging results. Start with a baseline (e.g., logistic regression) and then evolve:
- Add features like time‑decay, friend‑closeness score, and Reel popularity.
- Use collaborative filtering to suggest “friends of friends” who also engaged.
- Train with a loss function that balances relevance vs. diversity (avoid showing only the same friend every time).
As Subasree and Joseph explained, the model went through several iterations before hitting the right balance – be ready to experiment fast.
Step 4: Address Platform Behavioral Differences
During testing, you’ll notice that iOS and Android users behave differently. For example, iOS users might watch longer sessions but interact less per Reel, while Android users may tap reactions more frequently. The algorithm cannot be monolithic. Create separate A/B testing cohorts per platform, and retrain your model with platform‑specific features. In some cases, the same model will produce different quality scores on each OS – use that feedback to tune hyperparameters.
This step often reveals a “surprising discovery” that unlocks performance. Meta’s team found that tweaking the friend‑bubble animation timing changed engagement by double digits – something that would never appear in offline training.

Step 5: Validate with Real Users (Beta & Gradual Roll‑out)
Before going live to billions, run a limited beta. Recruit internal users (Meta did this with employees) to catch bugs in ranking, latency, and UI. Use this phase to:
- Verify that the feature doesn’t slow down the core scroller.
- Check if friend bubbles cause information overload (e.g., too many bubbles on a single Reel).
- Gather qualitative feedback: “Did you discover something worthwhile?”
After the beta, roll out gradually at 1%, 5%, 25% etc., monitoring core metrics like time‑spent, friend‑interaction rate, and uninstall rate.
Step 6: Scale to Billions (the Engineering Backend)
Now you need to serve the feature for every user at every moment. That means:
- Pre‑compute top friends’ bubbles for each Reel (or on‑the‑fly for edge cases).
- Cache aggressively – store the top‑N friends per Reel in a distributed cache like Memcached or Redis.
- Horizontal scaling – add more servers and shards as friend‑graph size grows.
- Fail gracefully – if the data pipeline lags, fall back to a default set of bubbles (e.g., “your top 5 friends”).
Meta’s team had to rewrite parts of the real‑time stack because the original design couldn’t handle the burst of writes from millions of friends watching a viral Reel simultaneously.
Step 7: Monitor, Iterate, and Surprise
Even after launch, treat Friend Bubbles as a living feature. Monitor not just technical metrics but also user satisfaction. Set up dashboards for:
- Bubble‑tap rate (CTR).
- Friend‑discovery lift (did users find new content? Did they reconnect with old friends?).
- Latency impact on feed load.
Be open to the “aha” moments – Meta’s engineers discovered that showing mutual friend bubbles increased engagement by 35% over just one friend’s activity. That iteration came after months of data analysis.
Tips for Success
- Start simple, then layer complexity. It’s tempting to inject dozens of signals from day one, but a clear baseline helps you measure improvement.
- Test on both platforms early. Behavioral differences can derail your model if you don’t account for them.
- Listen to “surprising” user feedback. That weird edge case might be the key to a breakthrough.
- Plan for social graph explosion. A feature that works for 100 friends may break for 10,000 friends – design for the long tail.
- Use the podcast as inspiration. The Meta Tech Podcast episode with Subasree and Joseph is a goldmine of real‑world pitfalls and solutions.
- Don’t overlook UI/UX delays. The timing of when and how friend bubbles appear can be as impactful as the ML model itself.
Building social discovery at scale is not for the faint of heart, but by following these steps and embracing iterations, you can create a feature that feels simple yet profoundly connects users. Ready to build your own Friend Bubbles? Start with Step 1 – and don’t be afraid to break things along the way.
Related Articles
- Deep Dive: Why a recent supply-chain attack singled out security firms Checkm...
- Preparing for the Shift: Your Step-by-Step Guide to Moving from Chromebook to Googlebook
- The Evolution of AI-Assisted Development: From Vibe Coding to Verified Agentic Engineering
- How to Navigate and Apply Android's May 2026 Google System Updates
- HASH Launches Free Online Platform for Simulating Complex Real-World Systems
- Meta's OpenZL 0.2 Brings Format-Aware Compression to New Heights
- 7 Crucial Lessons from Rebuilding GitHub Enterprise Server's Search for High Availability
- 8 Enduring Lessons from The Mythical Man-Month for Software Teams Today