TL;DR
ROCS (Request-Oriented Compute Sharing) is a novel modeling and inference paradigm for large-scale recommendation systems that eliminates massive compute redundancy by evaluating request-side features once per user request rather than once per candidate item. By combining architectural constraints with specialized GPU kernel optimizations, ROCS achieves up to a 3× throughput improvement or significant prediction quality gains across production workloads at Meta.
What Problem Does This Paper Address?
Modern recommendation systems face a fundamental structural mismatch during inference. A single user request (containing context like time, location, and user history) is evaluated against hundreds or thousands of candidate items. Ideally, the request-side features should be computed just once and shared across all candidates.
However, state-of-the-art ranking models typically rely on "early fusion"—mixing request and candidate features early in the network to capture complex cross-features and sequence interactions. This forces the system to recompute the entire model separately for every single candidate, leading to massive computational redundancy. While "two-tower" architectures avoid this by completely separating user and item encoding, they sacrifice intermediate feature interactions, severely limiting model expressiveness.
ROCS tackles this challenge by finding a middle ground: preserving deep, expressive request-candidate interactions while mathematically isolating the request-side pathway so it can be computed once and efficiently reused.
Methods
The ROCS paradigm consists of four co-designed modeling and system components:
- Generalized Layer Masking (GLM): This defines an operator-level dependency contract ensuring that information flows from the request side to the candidate side, but never vice versa. Implemented as a block lower-triangular mask inside linear layers, factorization machines, and normalization layers, GLM guarantees that request-side representations remain strictly invariant to the candidate item.
- Deep Cross Attention (DCA): To handle heavy sequence models (like Transformers evaluating user history), DCA separates the architecture into a candidate-independent sequence encoder and a candidate-conditioned retrieval layer. Instead of injecting candidate signals early into the sequence, DCA computes the sequence representations once per request and uses layer-wise cross-attention to let candidate queries retrieve relevant historical context.
- Request-Oriented Resource Reallocation (RRR): Because request-side computation is amortized across thousands of candidates, it is computationally "cheaper" to scale than the candidate side. RRR exploits this asymmetry by reinvesting the compute savings from amortization back into expanding the capacity (e.g., width or depth) of the request-side subgraph, boosting model accuracy within the original compute budget.
- In-Kernel Broadcast Optimization (IKBO): A naive implementation of compute sharing would explicitly broadcast (replicate) the request tensors to match the candidate batch size, creating a massive memory bandwidth bottleneck. IKBO keeps request and candidate tensors at their natural batch sizes ($B_r$ and $B_c$) and resolves their association directly inside the GPU kernel epilogue, avoiding unnecessary data movement.
Datasets
The authors evaluated ROCS on both public benchmarks and massive internal production datasets:
- Public Benchmarks: KuaiRand, KuaiVideo, and KKBox (processed via the RecZoo repository) to test generality across different model backbones (DCNv2, FinalMLP, Wukong).
- Production Workloads: Three internal Meta datasets spanning ads retrieval, short-form video ranking, and ads ranking, each containing over 100 billion training examples.
Key Insights and Ideas
- The Amortization Asymmetry: The core "aha moment" is that scaling the request-side pathway is incredibly cheap in production. If a request is matched against 1,000 candidates, adding 1,000 FLOPs to the request tower costs only 1 FLOP per candidate score. ROCS turns this mathematical asymmetry into a lever for model accuracy via RRR.
- Compositional Invariance: The authors prove that the GLM invariant is closed under composition. This means engineers can stack ROCSified MLPs, normalization layers, and attention blocks together, and the entire composite network is guaranteed to maintain a clean, reusable request-side pathway.
- Hardware-Software Co-design is Mandatory: Simply changing the model architecture isn't enough. Without IKBO fusing the logical broadcast into the GPU GEMM and attention epilogues, memory traffic from tensor replication completely wipes out the algorithmic FLOP savings.
Key Results
ROCS demonstrates massive end-to-end efficiency and quality improvements when deployed at scale:
- Retrieval Models: Achieved up to a 3× Queries Per Second (QPS) improvement on production ads retrieval workloads with zero degradation in recommendation quality.
- Ranking Models: On a short-form video ranking model, ROCS delivered a 0.5% relative LogLoss improvement (a highly significant gain in production click-through rate modeling) alongside a 50% QPS gain.
- Production Deployment: ROCS has been successfully deployed across tens of large-scale recommendation systems at Meta, handling organic and ads surfaces across two orders of magnitude in inference complexity.
Limitations and Future Work
The primary limitation of ROCS is that its benefits scale with candidate multiplicity. If a model is evaluated in a setting where each request only scores a few candidates (such as the final re-ranking stage or during standard model training), the amortization effect diminishes. Additionally, the current highly optimized IKBO implementation relies heavily on hardware primitives specific to modern NVIDIA GPUs (like TMA and WGMMA in Hopper architectures), meaning porting these exact performance gains to other hardware accelerators remains future work.
Summary updated