# twitter/the-algorithm

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/twitter-the-algorithm).**

73,422 stars · 13,278 forks · Scala · AGPL-3.0

## Links

- GitHub: https://github.com/twitter/the-algorithm
- Homepage: https://blog.twitter.com/engineering/en_us/topics/open-source/2023/twitter-recommendation-algorithm
- awesome-repositories: https://awesome-repositories.com/repository/twitter-the-algorithm.md

## Description

The algorithm is a distributed recommendation engine pipeline designed to construct and serve personalized content timelines. It functions as a multi-stage orchestration layer that aggregates candidate content from diverse social graphs and high-dimensional embedding spaces, processing user interaction data to deliver a unified, ranked experience.

The system utilizes a high-performance machine learning serving infrastructure to execute deep learning models that predict engagement probabilities in real-time. It distinguishes itself through a hybrid retrieval strategy that combines graph-traversal techniques for discovering content outside of a user's immediate network with vector-based similarity searches to identify relevant interests.

Beyond core ranking, the platform incorporates a post-ranking processing layer that applies heuristic filters to ensure content diversity, visibility preferences, and social quality safeguards. This architecture also supports multi-task learning to optimize relevance across various platform surfaces, including the integration of non-content items and personalized notifications.

## Tags

### Artificial Intelligence & ML

- [Candidate Sourcing Pipelines](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/recommendation-engines/candidate-sourcing-pipelines.md) — Orchestrates multi-stage retrieval to aggregate potential content items from diverse social graphs and embedding spaces.
- [Content Ranking Models](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/recommendation-engines/content-ranking-models.md) — Scores and orders content items using neural network models trained on interaction data to predict relevance. ([source](https://blog.twitter.com/engineering/en_us/topics/open-source/2023/twitter-recommendation-algorithm))
- [Recommendation Engine Pipelines](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/recommendation-engines/recommendation-engine-pipelines.md) — Coordinates distributed pipelines for candidate generation, neural network ranking, and heuristic filtering to deliver personalized content.
- [Social Feed Ranking Algorithms](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/recommendation-engines/social-feed-ranking-algorithms.md) — Ranks social media content using logistic regression models based on predicted engagement likelihood and network relevance. ([source](https://blog.twitter.com/engineering/en_us/topics/open-source/2023/twitter-recommendation-algorithm))
- [Model Inference and Serving](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-inference-serving.md) — Deploys predictive models to score content relevance and user engagement probabilities in real-time.
- [Multi-Task Learning Models](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/architectures/sequence-models/multi-task-learning-models.md) — Shares model architectures to predict multiple engagement signals simultaneously for optimized content relevance.
- [Embedding-Based Retrieval](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/recommendation-engines/embedding-based-retrieval.md) — Determines similarity between user and content vectors to identify relevant items outside of a user's immediate social network. ([source](https://blog.twitter.com/engineering/en_us/topics/open-source/2023/twitter-recommendation-algorithm))
- [Graph-Based Content Discovery](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/recommendation-engines/graph-based-content-discovery.md) — Traverses social and interest-based network connections to surface content beyond a user's immediate circle.

### Content Management & Publishing

- [Feed Composition Engines](https://awesome-repositories.com/f/content-management-publishing/content-aggregation-curation/feed-composition-engines.md) — Merges ranked primary content with secondary items like advertisements and recommendations to construct a final display timeline. ([source](https://blog.twitter.com/engineering/en_us/topics/open-source/2023/twitter-recommendation-algorithm))
- [Personalized Feed Orchestrators](https://awesome-repositories.com/f/content-management-publishing/content-aggregation-curation/personalized-feed-orchestrators.md) — Blends diverse media types and social signals into a unified, ranked feed experience for end users.
- [Content Filtering Heuristics](https://awesome-repositories.com/f/content-management-publishing/content-aggregation-curation/content-filtering-heuristics.md) — Applies post-ranking constraints to filter content based on safety, diversity, and visibility requirements before final delivery.
- [Feed Filtering Heuristics](https://awesome-repositories.com/f/content-management-publishing/content-aggregation-curation/feed-filtering-heuristics.md) — Enforces diversity, visibility preferences, and social quality safeguards through heuristics applied to ranked feeds. ([source](https://blog.twitter.com/engineering/en_us/topics/open-source/2023/twitter-recommendation-algorithm))

### Data & Databases

- [Similarity Search Engines](https://awesome-repositories.com/f/data-databases/database-management-systems/database-engines/vector-databases/similarity-search-engines.md) — Calculates geometric proximity between user and item representations in high-dimensional vector space to identify relevant content.
- [Graph Traversal Strategies](https://awesome-repositories.com/f/data-databases/graph-computing-systems/graph-processing/graph-traversal-strategies.md) — Implements graph traversal logic to discover relevant content by navigating social and interaction relationships.

### DevOps & Infrastructure

- [ML Serving](https://awesome-repositories.com/f/devops-infrastructure/infrastructure/application-compute-platforms/hardware-accelerated-compute-backends/ml-serving.md) — Powers high-performance infrastructure for deploying and serving machine learning models within a recommendation pipeline. ([source](https://cdn.jsdelivr.net/gh/twitter/the-algorithm@main/README.md))

### User Interface & Experience

- [Personalized Notification Engines](https://awesome-repositories.com/f/user-interface-experience/ui-components/feedback-overlay-components/notification-systems/personalized-notification-engines.md) — Delivers personalized content recommendations via push notifications using multi-task learning models to predict user engagement. ([source](https://cdn.jsdelivr.net/gh/twitter/the-algorithm@main/README.md))
