Routing for Large ML Models

Ofir Cohen, Jose Yallouz, Michael Schapira, Shahar Belkar, Tal MizrahiarXiv 2025 · DOI

TL;DR

Training massive ML models like LLMs generates enormous network traffic. This paper introduces a novel routing framework that optimizes network efficiency and fairness for these workloads by intelligently assigning paths to data flows, significantly outperforming traditional methods and approaching theoretical optima.

What Problem Does This Paper Address?

The explosive growth of large-scale machine learning models, particularly Large Language Models (LLMs), has led to unprecedented demands on data center networks. Training these models involves massive, repeated communication of data between compute nodes (often GPUs). Traditional data center routing, primarily using Equal-Cost MultiPath (ECMP) hashing, struggles with these "elephant" flows because it doesn't globally optimize path assignments. This can lead to network congestion, uneven resource utilization, and ultimately, slower training times. Furthermore, existing solutions often focus on single training jobs and don't adequately address the complexities of shared infrastructure and diverse workloads. This paper tackles the challenge of efficiently and fairly routing traffic for large-scale ML training in complex network topologies.

Methods

The core of the proposed solution is a two-layered system:

  1. Centralized Controller: This component is responsible for dynamically assigning optimal paths to network flows. It receives information from hosts about active flows and their lengths (specifically, RDMA message lengths). Based on this, it computes routing configurations that aim to optimize global communication efficiency and fairness.
  2. Host-Side Enforcement: Hosts, equipped with SmartNICs, are responsible for enforcing the controller's routing decisions. They achieve this by manipulating packet headers, effectively implementing source routing. For "elephant" flows (large RDMA messages), hosts consult the controller for path assignments. For smaller "mice" flows, they fall back to traditional ECMP.

The controller employs a greedy path assignment algorithm that iteratively assigns commodities (flows) to the "least congested" path available. This algorithm is designed to be fast and provide near-optimal solutions. The system also incorporates forward-looking optimization by predicting when flows will terminate or new ones will begin, allowing for proactive route recomputation to minimize latency.

Datasets

Not discussed in the paper. The paper focuses on simulating various ML workloads (BLOOM, GPT-3, LLaMA2-70B) with different parallelization strategies.

Key Insights and Ideas

  • ML traffic is predictable and persistent: The repetitive nature of ML training allows for predictable traffic patterns, which can be exploited for optimization.
  • "Elephant" flows are the bottleneck: Large, long-lived data transfers dominate training time, making their efficient routing critical.
  • Global optimization is key: Unlike ECMP, which makes local decisions, a centralized controller can achieve better overall network utilization and fairness.
  • Host-side control is feasible: SmartNICs can be leveraged to enforce controller-dictated routing without requiring extensive network infrastructure changes.
  • 2-Layered Max-Min Fairness: The objective is to maximize the minimum bandwidth share for the slowest connection within a job, and then maximize this minimum across all jobs, ensuring both efficiency and fairness.

Key Results

  • Near-Optimal All-Reduce Time: The proposed routing scheme consistently achieves All-Reduce times very close to the theoretical optimum (as captured by ILP solvers and combinatorial algorithms), significantly outperforming ECMP and Simulated Annealing.
  • Improved Flow Completion Time (FCT) and Throughput: While the primary focus is on All-Reduce time, the scheme also shows substantial improvements in FCT and throughput compared to traditional methods.
  • Low Runtimes: The greedy algorithm for path assignment is very fast, with computation times around 10ms, making it practical for dynamic environments.
  • Robustness to Failures: The system demonstrates resilience to network failures (e.g., spine switch failures), maintaining performance close to the optimum.
  • Scalability: The approach is shown to be effective across various numbers of concurrent jobs and ring sizes.

Limitations and Future Work

  • Limited to 2-Layer Clos Networks: The theoretical evaluation is primarily focused on 2-layer Clos networks. Extending the 2-layer max-min fairness to more complex network topologies (e.g., fat-tree) and to account for tensor and pipeline parallelism as additional layers is a direction for future work.
  • Assumption of RDMA Dominance: The scheme assumes RDMA traffic constitutes the lion's share of network traffic. The impact of significant non-RDMA traffic is not deeply explored.
  • Prediction Accuracy: While forward-looking optimization is employed, the accuracy of predicting flow starts/terminations can impact performance. Future work could focus on improving these prediction mechanisms.
  • ML Model for Routing: The paper suggests replacing the greedy algorithm with a trained ML model (e.g., a DNN) for potentially even better performance, but this would require robust safety mechanisms.
  • Competition with General Traffic: The current work focuses on dedicated ML training clusters. Extending the approach to scenarios where ML traffic competes with general-purpose network traffic is also a future research direction.

Summary updated

BibTeX
@misc{cohen2025routing,
  author = {Ofir Cohen and Jose Yallouz and Michael Schapira and Shahar Belkar and Tal Mizrahi},
  title = {{Routing for Large ML Models}},
  year = {2025},
  eprint = {2503.05324},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.05324},
}
Figure