From Concept to Scale: Engineering Friend Bubbles for Billions

By

Introduction

When Facebook Reels introduced Friend Bubbles, the feature appeared deceptively simple: highlight Reels that friends have watched and reacted to. But beneath that straightforward surface lies a complex engineering challenge—building a social discovery engine that scales to billions of users. This guide walks you through the step-by-step process our team used to bring Friend Bubbles to life, from initial concept to global rollout. Whether you're building a similar social feature or scaling any personalized recommendation system, these steps will help you navigate the technical and design decisions required to make it work at Meta's scale.

From Concept to Scale: Engineering Friend Bubbles for Billions
Source: engineering.fb.com

What You Need

  • Deep understanding of user behavior – especially how social signals (likes, comments, shares) influence discovery.
  • Machine learning expertise – experience with ranking models, personalization, and real-time inference.
  • Cross-platform development skills – familiarity with iOS and Android differences in rendering, caching, and user interaction patterns.
  • Scalability mindset – ability to design for billions of requests per day with low latency.
  • Data infrastructure – access to large-scale logging, experimentation platforms, and A/B testing frameworks.
  • Collaborative engineering culture – close partnership between ML engineers, product engineers, and infrastructure teams.

Step-by-Step Guide

Step 1: Define the Core Social Interaction

Start by clearly articulating what social signal you want to amplify. For Friend Bubbles, the goal was to let users see which Reels their friends have engaged with (watched, liked, commented on). This turns passive scrolling into a shared experience. Key questions: Should bubbles show only friends' top reactions? Should they update in real-time? How do you balance privacy and serendipity?

Step 2: Prototype the User Interface

Build a minimal UI that displays bubble-like icons next to Reels thumbnails. Each bubble represents a friend who interacted with that Reel. Early prototypes revealed that the design must be non-intrusive while still catching attention. Tip: Use subtle animations for new interactions. Test on both iOS and Android to catch platform-specific rendering quirks.

Step 3: Develop the Machine Learning Model

The core of Friend Bubbles is a ranking model that decides which friends' interactions to show on which Reels. The model must consider:

  • Relevance: How likely is a user to care about a particular friend's reaction? Signals include friendship strength, past engagement with that friend's activity, and topic affinity.
  • Freshness: Recent reactions are more valuable. The model needs to weigh recency against relevance, which is a non-trivial trade-off.
  • Diversity: Avoid showing the same friend repeatedly. Implement a de-duplication mechanism.

Our ML team iterated through several versions—starting with a simple heuristic (most recent friend) and moving to a neural network that combines multiple signals. The biggest breakthrough came when we added a contextual embedding of the Reel itself (e.g., video topic, audio track) to better match friend preferences.

Step 4: Address Platform-Specific Behaviors

iOS and Android users interact with content differently. For example:

  • iOS users tend to scroll more deliberately and pause on Reels longer. Friend Bubbles on iOS could be slightly larger and more detailed.
  • Android users consume more content in shorter bursts. Bubbles needed to load faster and use less memory.

We discovered that network latency and caching strategies varied significantly between platforms. On iOS, we could prefetch friend interaction data more aggressively because of better background task support; on Android, we optimized for lower battery impact. Surprise finding: The biggest performance gain came from batching our ‘friend interaction’ queries—instead of making one API call per Reel, we grouped all Reels on screen into a single request.

From Concept to Scale: Engineering Friend Bubbles for Billions
Source: engineering.fb.com

Step 5: Optimize for Scale

As user counts grew, the naïve approach of computing Friend Bubbles for every Reel in the feed became impossible. We implemented:

  • Precomputation: For each user, precompute a shortlist of friends whose interactions are most valuable for each content category.
  • Lazy loading: Only fetch bubble data when the Reel enters the viewport.
  • Cascading fallbacks: If a friend's data isn't available, show a generic “friends liked this” label instead of an empty bubble.

The “click moment” for the feature was when we realized that showing the same bubble for a given friend across multiple Reels actually increased engagement—it created a narrative effect. This allowed us to cache friend-specific preferences more aggressively, reducing server load by 40%.

Step 6: Experiment and Iterate

Roll out Friend Bubbles using a phased A/B test. First, to 1% of users, then 5%, then gradually increase. Monitor metrics like:

  • Time spent on Reels
  • Number of Reels watched per session
  • Click-through on friend bubbles
  • User satisfaction surveys

Adjust the model based on feedback. For example, early tests showed too many bubbles overwhelmed users; we added a limit of 3 bubbles per Reel and a “see all friends” expansion. Also, we learned that users on Android preferred smaller, less animated bubbles—so we made them platform-configurable.

Tips for Success

  • Start simple, then add complexity. A heuristic baseline (e.g., “show the most recent friend”) helped us launch faster and learn real user behavior before investing in a complex ML model.
  • Invest in cross-platform consistency upfront. Even if the underlying logic is the same, the UX details (size, animation, loading states) should be tuned per platform.
  • Don't underestimate the power of a ‘surprise discovery’. The caching breakthrough came from analyzing failed experiments. Encourage your team to explore negative results—they often contain the seeds of innovation.
  • Balance personalization with social serendipity. Showing only the closest friends can create filter bubbles; occasionally include distant friends to broaden discovery.
  • Listen to your users—but watch what they do. Surveys told us users wanted more friend content, but behavior showed they engaged most when bubbles highlighted unexpected shared interests.

Building social discovery at scale is as much an art as a science. Friend Bubbles taught us that even the simplest-seeming feature can hide profound engineering depth. By following these steps, you can create a system that not only scales to billions but also deepens the human connection in digital spaces.

Tags:

Related Articles

Recommended

Discover More

AI Training at Gigascale Hits Hidden Power Wall: New Battery Tech Emerges as Critical Buffer7 Ways Automation and AI Are Reshaping Cybersecurity ExecutionCSS Letter Styling Without ::nth-letter: A Practical Guide to Simulating the Unavailable SelectorMan Page Evolution: Developers Push for Built-In Cheat Sheets and Categorized Options10 Hidden OAuth Token Risks That Cyberattackers Exploit – And How to Close Them