Meta Open-Sources Rebalancer to Solve Complex Resource Allocation
After nine years of internal use, Meta has open-sourced its assignment-problem solver, Rebalancer, providing developers with a generic framework for optimizing infrastructure at scale.

Solving Infrastructure Complexity
Meta has officially announced the open-sourcing of Rebalancer, a powerful library designed to handle assignment-problem solvers across diverse technical landscapes. For over nine years, this technology has been fundamental to Meta’s operations, managing complex resource allocation tasks that arise across its massive infrastructure stack. By separating the concerns of how a problem is specified, stored, solved, and debugged, the library offers a modular approach to optimization.
At its core, Rebalancer addresses the fundamental question of how to assign a set of objects to a set of bins while optimizing specific objectives and adhering to strict constraints. This process is essential for everything from hardware placement in datacenters to complex traffic routing, ensuring that global services maintain both efficiency and fault tolerance.
Addressing Scalability and Usability
One of the primary challenges in designing optimization frameworks is balancing usability with scalability. Practitioners often struggle to translate real-world policy requirements into the complex mathematical formulas required by standard optimization tools. Simultaneously, the NP-hard nature of these problems frequently exceeds the capacity of many commercial solvers.
Rebalancer mitigates these obstacles by allowing users to describe problems using objects, bins, constraints, and objectives. Once specified, the library transforms these definitions into a directed-acyclic graph known as an expression graph. This graph serves as the basis for either designing a local search heuristic or constructing a Mixed Integer Program (MIP) that can be processed by tools like FICO Xpress, Gurobi, or HiGHS.
A Hierarchical Approach to Modeling
To improve user accessibility, the library employs a three-step approach to abstraction. It begins with essential modeling constructs—such as dimensions, partitions, and scopes—that represent real-world attributes and groupings. Following this, the system provides an API for recursive transformations and aggregations, such as SUM, MAX, or SQUARE, to manipulate these data points.
Finally, Rebalancer leverages these components to provide a high-level spec API, which functions as a collection of predefined recipes for common objectives and constraints. Developers can find an exhaustive list of Rebalancer specs in the docs to understand how these building blocks can be combined to solve specific placement or routing challenges.
Optimizing Through Two Solvers
The library offers two distinct methods for finding solutions. The Optimal Solver translates the expression graph into a format compatible with traditional MIP solvers. To manage performance, Rebalancer employs techniques like variable aggregation, interchangeability, and symmetry breaking, which help reduce the model size, as the worst-case scenario can otherwise grow to a quadratic complexity of O(|objects| * |bins|).
When the problem size becomes too large for traditional MIP solvers, the Local Search Solver serves as an alternative. It works directly on the expression graph, exploring the local neighborhood around the current assignment by iteratively moving objects between bins. This flexibility ensures that developers can tackle massive-scale infrastructure challenges without hitting the ceiling often associated with formal mathematical solvers.
Sources
- Meta EngineeringOpen-Sourcing Rebalancer: A Generic, High-Performance Library for Solving Assignment Problems