Elamur Research

Rethinking Machine Learning Collective Communication as a Multi-Commodity Flow Problem

Paper · 2023 · Behnaz Arzani, Siva Kesava Reddy Kakarla, Miguel Castro et al.

Summary

When GPUs train a system together, they repeatedly exchange data. How long an exchange takes depends on which links carry the data, when the transfers start, and where a piece of data can be copied for several recipients. A schedule that handles these choices poorly can leave GPUs waiting even when the network has capacity elsewhere. The authors introduce TE-CCL to find faster schedules for this part of GPU and parallel computing. Their starting point is multi-commodity flow, a technique from traffic engineering for routing several demands through a network whose links have limited capacity. They adapt it to exchanges that have a definite amount of data to deliver and a definite point at which they finish.

TE-CCL divides data into chunks and time into fixed intervals called epochs. It jointly chooses routes and transmission times, taking account of when a chunk actually reaches the next device. A GPU can hold a chunk until an outgoing link becomes available, and a device that supports copying can send the same chunk towards several destinations. The authors use mixed-integer linear programming to keep track of individual chunks when copies are useful. When destinations request distinct data, as in AllToAll, a smaller linear program can route fractional amounts without tracking every chunk separately. For larger exchanges that still benefit from copying, an approximation solves successive short intervals and carries forward both stored data and transfers that are still in flight.

The comparison with SCCL on DGX1 shows why transmission timing matters. For an AllGather exchange with 3 chunks of 25 KB, TE-CCL’s schedule took an estimated 6.1 μs, compared with 8 μs for SCCL’s least-steps schedule. SCCL had the shorter estimate in the single-chunk case, where TE-CCL had little opportunity to overlap consecutive transmissions. Against TACCL on a 2-chassis NDv2 topology, the fine-epoch TE-CCL schedule for a 64 KB AllToAll output buffer achieved an estimated algorithmic bandwidth of 2.747 GB/s, compared with 1.271 GB/s for TACCL. The comparison was much closer for the 1 GB output buffer, where TACCL led narrowly. On a proprietary topology with 256 GPUs, TE-CCL also generated schedules for cases where TACCL failed to synthesize one.

The controlled experiments show that different parts of the formulation help under different conditions. Copying lowered transfer time for large AllGather exchanges in the tested settings. Short epochs were especially useful when links ran at different speeds. GPU buffers often helped the solver find an answer faster while leaving the predicted transfer time about the same, although solver time increased in one reported setting. The authors checked their latency estimates against hardware on a single DGX1 node. Most of the comparisons, including the large-topology results, concern schedules and their estimated performance.

Deep dive: Rethinking Machine Learning Collective Communication as a Multi-Commodity Flow Problem

TE-CCL uses network flow optimization to schedule data transfers between GPUs, accounting for link delays, buffering, and copies made in transit. · about 40 minutes to read

The problem and its context

The schedule determines when the exchange can finish

A collective is an exchange whose participants agree on a pattern of communication. In AllGather, each GPU contributes data and every other GPU needs that contribution. In AllToAll, each GPU also sends to every other GPU, but the data for each recipient is distinct. The distinction matters even on the same set of machines. In AllGather, a transmission across a scarce link can carry data that several destinations need, leaving a device beyond that link to distribute it. For AllToAll, each recipient’s data has to make its own journey across whatever links it needs.

A collective specifies who needs what. A network topology specifies which devices can communicate directly and the properties of those connections. Together they leave open the decisions the paper studies. A GPU may send data straight to another GPU or relay it through an intermediate device. A route that looks fast in isolation may share a link with several other routes. When those transfers all reach the link at once, their order affects how soon other devices can continue forwarding them. The collective finishes when the last requested data reaches its destination, so an efficient schedule has to account for the whole exchange.

The purpose of spending time on this calculation is to reduce waiting during distributed machine learning. The paper cites earlier observations of idle GPU time for BERT and DeepLight. The reported fractions were 11% for BERT and 63% for DeepLight. The authors also point to a separate use for fast schedule synthesis. Tools that search over hardware layouts or strategies for distributing training can invoke a collective optimizer repeatedly. A solver that is useful for a single schedule may take too long when it sits inside that larger search.

The setting the authors have in mind is a cloud cluster shared by multiple users. They describe operators needing schedules for topologies with 30-60 chassis and anticipating larger ones. Communication within a chassis and communication between chassis can involve different links and switches, and which devices connect to the switches affects the number of routes the optimizer can consider. The authors therefore treat the time spent finding a schedule and the time spent executing it as separate problems. A more detailed description of the network can improve the schedule, while a larger optimization can take longer to solve.

What earlier collective schedulers optimized

The paper describes SCCL as an example of a solver that can optimize its formulation precisely on a small topology. SCCL uses satisfiability modulo theories, or SMT, to search for schedules under its constraints. Its round-based representation groups communication into steps and can impose a barrier between them. A barrier requires participants to reach a common point before the schedule proceeds. TE-CCL is designed to express a narrower dependency. A GPU may forward a chunk once that chunk is available, even if other transmissions are still under way.

TACCL uses communication sketches to guide the solver and separates route selection from scheduling. A sketch restricts the communication choices, for example by limiting which connections the search can use. The authors describe this as a way to handle larger instances and also identify a drawback. A routing stage can select individually plausible routes without seeing how their transfers will compete at particular times. By the time the scheduling stage sees those conflicts, the routing choices have already been made. The authors also found that putting together a suitable sketch for an unfamiliar topology took knowledge of its links.

The paper identifies a different tradeoff in shortest-path scheduling. The direct-connect topology work it discusses sends data along short routes without exploiting in-network copies. That is a reasonable simplification for requests that contain separate data for every recipient. In AllGather, however, a shared part of several routes can carry a single copy that branches closer to the recipients. An optimizer that sees each delivery as a separate route has no way to exploit that choice.

What traffic engineering already offered

Wide-area traffic engineering has a similar allocation problem. Several requests compete for a network’s links, and a solution has to allocate capacity without exceeding what any link can carry. Each separate demand is a commodity. A flow formulation can follow the amount of each commodity entering and leaving devices, or it can allocate traffic over a collection of allowable paths. An objective then tells the solver what to prefer, such as satisfying more demand or giving competing requests fairer rates.

The important change is the unit of demand. The paper characterizes conventional traffic engineering as assigning bandwidth to sustained traffic. A collective instead asks the network to deliver a finite volume. A request that completes stops using capacity, and subsequent requests can use that capacity within the same schedule. An allocation that stays constant throughout the exchange can miss this opportunity. The authors take over the idea of having demands compete under common link constraints, then represent how that competition changes over time.

Finite exchanges also change how delays should enter the calculation. The authors give an example in which traffic from separate sources reaches a shared relay at the same time, even though the routes to that relay have different fixed delays. The arrival time depends on the preceding transmissions as well as the link delays. Adding the largest route delay to a separate estimate of transmission time can count intervals that overlap in the actual schedule. In the example, that procedure overestimates when the exchange finishes. To account for the overlap, the optimizer needs to know which traffic is available at the relay at each point.

Holding data is another departure from the usual flow balance. A GPU may receive a chunk when the link into it is free, keep the chunk in memory, and forward it later when a suitable link becomes available. Reception and forwarding can then compete for capacity at different times. Copying changes the balance again. When a relay already has a chunk needed by several destinations, each outgoing transmission can use that same stored information. Each transmission still uses its own link capacity, even though the relay needed only one copy to make the transmissions possible.

The authors build on earlier research that handled these concerns separately. Calendaring represents finite transfers and deadlines. NetStitcher includes storage at intermediate locations, with its flow optimizations treating competing traffic differently from TE-CCL. The multicast traffic engineering work discussed in the paper permits copying, while its treatment of sustained flows leaves the fixed-delay timing problem aside. Blink applies multicast techniques to collectives with a simpler treatment of delays and storage. TE-CCL brings time, storage, and copying into the same optimization and then changes the formulation where doing so can make it easier to solve.

The method, step by step

From a collective request to a transmission schedule

TE-CCL starts with a directed graph of devices and links and a demand describing which destinations need data from which sources. It divides data into chunks, meaning blocks treated as units for the schedule, and time into epochs of equal duration. An instruction in the resulting schedule can specify that a device should send a particular chunk along a particular link in a particular epoch. The optimizer relates these local decisions to a global requirement. Every destination must obtain all the chunks it requested within the allowed time.

Imagine a GPU with a chunk that several other GPUs need. Sending it to an intermediate device can reach a part of the network with more outgoing capacity. The device can distribute the chunk after it arrives. If one branch is busy, a GPU can retain the chunk and send it on that branch later, while a switch in the authors’ main formulation forwards without keeping chunks in a buffer. The choice of the first hop therefore depends on both the remaining routes and the times at which their links can be used. TE-CCL puts all these decisions into the same set of constraints.

How TE-CCL turns demand into a collective schedule

The steps in order.

How TE-CCL turns demand into a collective scheduleStep 1: Specify the topology, link costs, and demand1. Specify the topology, link costs, and demandStep 2: Divide the data and time into units2. Divide the data and time into unitsStep 3: Choose a formulation based on copying and scale3. Choose a formulation based on copying and scaleStep 4: Constrain link capacity, arrivals, and storage4. Constrain link capacity, arrivals, and storageStep 5: Solve for routes and transmission times5. Solve for routes and transmission timesStep 6: Trace deliveries and extract the executable schedule6. Trace deliveries and extract the executable schedule

The paper uses an α–β description of communication cost. The fixed part can represent propagation or fixed overhead associated with preparing and initiating a transfer. The size-dependent part describes the time to transmit the bytes at the link’s rate. The authors use the following expression for the time to send a chunk over a link.

t = α + βS

Here t is the time for the transfer, α is the fixed delay, β is the transmission time per byte, and S is the chunk size in bytes. The product βS is the time attributable to transmitting the bytes. When link capacity is expressed in bytes per second, the corresponding relation is as follows.

β = 1 / C

Here β is again the time per byte, C is the link capacity in bytes per second, and 1 is the numerator in the reciprocal. The paper also uses C for chunk identifiers elsewhere. In the constraint notation below, C denotes the set of chunk identifiers, and link rates are written as T with link indices.

Let N be the set of devices and E the set of directed links. A link written as the ordered pair (i,j) carries traffic from device i to device j. Let K denote the set of epochs and Kₘₐₓ its final epoch. A chunk identifier c is local to its source s, so agreement on both indices is necessary to identify the data. The demand indicator D[s,d,c] records whether destination d requests chunk c from s. Brackets collect the indices of a variable, and the paper uses the same demand indices in more than one order in its notation. The order used here is source, destination, chunk.

In the general formulation, F[s,i,j,k,c] records whether chunk c originating at s is transmitted from i to j in epoch k. B[s,n,k,c] tracks that chunk in the buffer of device n at the start of epoch k. The general formulation uses integer variables for the chunk-level flow and buffer accounting. This lets the optimizer distinguish a complete chunk from a fractional amount that may represent the same data as another fractional arrival. The transmission constraint on a link is as follows.

Σ(s ∈ N) Σ(c ∈ C) F[s,i,j,k,c] ≤ T[i,j] τ

The symbol Σ denotes a sum, and ∈ means membership in a set. The sums range over all sources s in the node set N and all chunk identifiers c in C. F is the scheduled transmission on link (i,j) in epoch k for the given source and chunk. T[i,j] is that link’s capacity measured in chunks per second, and τ is the duration of an epoch in seconds. The inequality ≤ places the total at or below the amount that fits in the epoch. The constraint is applied for each link and epoch, so flows from different sources consume the same link budget.

Capacity establishes how much can enter a link. The next device still needs to wait for the data to arrive. The authors express the fixed delay in units of epochs.

δ[i,j] = α[i,j] / τ

Here δ[i,j] is the fixed delay on the directed link from i to j measured in epochs, α[i,j] is that link’s fixed delay in seconds, and τ is the epoch duration in seconds. The formulation uses the ceiling of δ when it looks up arrival times, meaning the next integer epoch count when the quotient falls between integers. With the paper’s timing convention, a chunk sent at the start of an epoch is available at the receiving device by the end of the corresponding delayed epoch. It can then support an outgoing transmission in the next epoch.

To see why the capacity and arrival constraints are distinct, consider a device whose outgoing link is idle. That link can legally accept traffic under its capacity constraint. For a particular source chunk, the outgoing transfer is still infeasible until the device has the chunk. Conversely, the arrival of a chunk says nothing about whether there is room on the outgoing link. Relays can be delayed either by waiting for the data or by waiting for capacity, and which delay occurs depends on the entire schedule.

Copying and storing a chunk

Ordinary flow conservation compares summed input and summed output. For a device that can duplicate an intact chunk, that rule would prohibit sending it down several branches after receiving it once. TE-CCL uses a condition for each outgoing link instead. In compact notation, the paper writes this as a comparison with the largest outgoing transmission of the chunk.

B[s,n,k,c] + Σ(j : (j,n) ∈ E) F[s,j,n,k − ⌈δ[j,n]⌉,c]
≥ max(j : (n,j) ∈ E) F[s,n,j,k + 1,c]

Here s identifies the source, n the device whose forwarding is constrained, c the chunk, and k the epoch used to account for its availability. B is the amount of the chunk already in the device’s buffer at the start of k. The sum ranges over each j that has an incoming link to n in E. The ceiling symbols ⌈ ⌉ round δ[j,n], the fixed delay in epochs, upward. Subtracting that count from k identifies the transmission epoch of the traffic arriving in k. On the right, max selects the largest transmission of the chunk on any outgoing link from n in epoch k + 1, where 1 advances the index to the next epoch. The inequality ≥ requires the amount available to cover that transmission. The colon in a sum or maximum introduces the condition on j.

This constraint can support sending the chunk on several outgoing links in the same epoch. Each of those links must still have enough capacity under its own constraint. The maximum is a compact way to express the same requirement on each outgoing link separately. Combined with the arrival indices, it allows copies only after the device has the data. A device cannot use an anticipated arrival to justify an earlier outgoing transfer.

The paper gives a counterexample to permitting arbitrary fractional transfers under this copying rule. A source could send the same half of a chunk to separate relays, and both could forward their half to a destination. A representation that adds fractional amounts indexed only by the original chunk would count the arrivals as an entire chunk. What the destination actually has is a duplicate of the same portion. Using whole chunks avoids that ambiguity. The authors can define smaller chunks to allow finer scheduling, but doing so creates more variables and gives the solver more individual items to place.

For GPUs with sufficient storage, the main formulation retains previously received chunks. The buffer update accounts for arrivals at the end of the preceding epoch.

B[s,n,k,c] = B[s,n,k − 1,c] + Σ(j : (j,n) ∈ E) F[s,j,n,k − ⌈δ[j,n]⌉ − 1,c]

Here B denotes the amount of source s’s chunk c in device n’s buffer at the start of the indicated epoch. The first term on the right takes the buffer from the preceding epoch, indexed by k − 1. The sum takes transmissions F from neighbors j with links to n in E. The ceiling of the link delay δ[j,n] shifts each transmission back to the epoch from which it would arrive by the end of the preceding epoch. The two occurrences of 1 express that preceding-epoch convention. The equation adds arrivals to the retained data, with no outgoing subtraction in this version.

At initialization, the chunk begins at its source if any destination needs it. Other devices begin without a copy. The first epoch has no traffic arriving from preceding epochs. The last epoch allows the optimizer to account for final arrivals without scheduling another round of forwards. These boundary conditions make the internal recurrence apply to a finite collective with a known starting state and a definite end.

The authors’ storage assumption is motivated by AllGather. Each GPU ultimately needs to hold all the data it was asked to collect, so the general formulation can take advantage of available GPU memory. They also describe how to impose a finite limit. An extra variable represents the removal of a chunk from a device’s buffer and is subtracted in its update. The resulting buffer state is subject to a bound.

Σ(s,c) B[s,n,k,c] ≤ L

Here Σ(s,c) adds the stored amounts B for all source and chunk pairs at device n in epoch k. L is the buffer limit in chunks. The inequality holds at each device and epoch for which the limit is imposed. In the fractional formulation, outgoing data already leaves the buffer under flow conservation, so a bound on the summed stored amount can be imposed without a separate removal variable.

When a destination has been served

A device can be a destination for one delivery and a relay for another. A chunk that arrives merely to pass through a device should contribute nothing to that device’s satisfied demand. Conversely, once a device has received a chunk it asked for, forwarding a copy elsewhere leaves its own receipt intact. The paper implements this distinction by limiting credited receipt to the requested amount.

R[s,d,k,c] = min(D[s,d,c], B[s,d,k + 1,c])

Here R[s,d,k,c] represents credited receipt of source s’s chunk c at destination d by the end of epoch k. D[s,d,c] indicates whether d requests the chunk, and B[s,d,k + 1,c] is its buffer state at the start of the next epoch. The increment 1 aligns the buffer state with the end of k. The function min selects the smaller of its arguments, so neither an unrequested arrival nor repeated arrivals of one requested chunk inflate progress. The final requirement is as follows.

R[s,d,Kₘₐₓ,c] = D[s,d,c]

Here Kₘₐₓ is the final epoch in the optimization horizon. For every source s, destination d, and chunk c, the credited receipt R at that point must equal the requested amount D. A horizon that ends before delivery is possible makes the resulting optimization infeasible. A horizon that allows time to spare still gives the solver room to deliver chunks earlier.

The objective rewards early delivery. To distinguish receipt during an epoch from cumulative receipt by its end, let r[s,d,k] be the amount credited to the source and destination pair for that epoch in the objective.

maximize Σ(k ∈ K) Σ(s,d ∈ N : s ≠ d) r[s,d,k] / (k + 1)

Here K is the set of epochs, N the nodes, k the epoch index, s the source, d the destination, and r[s,d,k] the amount newly received for that pair in epoch k. The symbol ≠ excludes source and destination pairs with the same node. The factor determined by k + 1 gives earlier delivery more weight, with 1 keeping the denominator positive in the initial epoch. Maximizing the sum favors schedules that make useful deliveries sooner. The end-of-horizon constraint separately requires every demand to be met.

The objective measures useful receipt, so it can give the same value to schedules with different amounts of unnecessary traffic. The authors considered charging the optimization for extra transmissions and report that doing so made it harder for the solver to prove optimality. They instead trace the finished solution backward. Starting with each desired delivery, they follow the supporting transmissions toward the source and retain what is needed for the delivery. They remove flows that support none of the destinations’ demands. The paper describes the trace as similar to reverse depth-first search and gives its running time in graph notation.

O(|N| + |E|)

Here O describes the growth of the reported running time, vertical bars count the members of a set, N is the set of graph nodes, and E is the set of directed edges. The sum expresses growth with the size of those graph components. This post-processing step operates on the solution after the optimizer has chosen its transmissions.

How the formulation represents switches

The topology can include switches that forward traffic but have too little memory to hold chunks across epochs. TE-CCL sets their buffer state to zero. In the explicit-switch formulation, a route through a switch has an incoming link and an outgoing link, and the respective link costs apply. The solver can account for a switch that supports replication by giving it the same per-outgoing-link availability condition as a copying GPU. A switch without this feature can use conservation of the summed flow instead.

The paper also describes a switch representation closer to TACCL’s. It removes the switch as a separate node and represents connections through it as logical direct links between the attached devices. Those links are tied together by constraints that preserve the limits on how many transfers can use the original switch’s input and output connections. An upper bound on simultaneous transfers comes from the smaller of the switch’s incoming and outgoing link counts. Further constraints limit the use of those logical links at each attached device. Without such constraints, distinct logical links could be treated as independent even when they share a physical port.

The distinction matters for evaluating schedules from different systems. In the authors’ explicit representation, traffic through a switch incurs a transmission cost on each side. TACCL’s direct-edge representation applies one transmission cost to the corresponding logical link. The authors adopt that accounting convention for their comparison with TACCL. For an independent run of TE-CCL, the user supplies the topology and demand and chooses a switch representation that fits the hardware.

The fractional formulation for distinct data

When every destination wants a distinct segment of a source’s data, making copies does not help complete the requests. TE-CCL can then track amounts associated with each source, without carrying a separate identifier for each chunk across every link and epoch. Amounts can be fractional. The result is a linear program, or LP, which is easier to solve at scale than the mixed-integer linear program, or MILP, used for copying. The authors describe this reformulation as preserving optimality for the class of demands it is designed to serve.

The LP restores direct conservation of the summed amount. At an intermediate GPU, what is already stored plus what arrives can remain in storage, be consumed to meet local demand, or be forwarded. A forwarded amount leaves the available stock. In the following equation, lower-case r denotes receipt consumed during the epoch, with indices for the source and the device where the consumption occurs.

B[s,n,k] + Σ(j : (j,n) ∈ E) F[s,j,n,k − ⌈δ[j,n]⌉]
= B[s,n,k + 1] + r[s,n,k] + Σ(j : (n,j) ∈ E) F[s,n,j,k + 1]

Here s is the source, n the device, k the epoch, and j a neighbor joined to n by the directed links indicated in the sums. E is the set of those links. B is the stored amount from s and F the amount transmitted on the indexed link in the indexed epoch. The ceiling of the link delay δ[j,n] selects which past transmissions arrive in k. On the right, B[s,n,k + 1] is what remains stored at the start of the next epoch, r[s,n,k] is what n consumes in epoch k, and the final sum is what leaves on its outgoing links in epoch k + 1. The increment 1 denotes the transition to the next epoch. At a switch, the buffer and consumption terms are omitted.

The initial state of the LP supplies the total data a source must send, with the first epoch able to transmit part of that supply and place the rest in its buffer. At a destination the solver adds up what has been consumed so far. Here R is the cumulative amount for a source and destination, with no chunk index.

R[s,d,k] = Σ(q = 0 to k) r[s,d,q]

Here s is the source, d the destination, k the current epoch, and q the epoch index used in the sum. The sum begins at epoch 0, the initial epoch, and includes k. The quantity r[s,d,q] is what d consumed from s during q, and R[s,d,k] is the total consumed by the end of k. At the horizon the paper imposes the aggregate demand.

R[s,d,Kₘₐₓ] = Σ(c ∈ C) D[s,d,c]

Here R is the cumulative receipt of source s’s data at destination d through the final epoch Kₘₐₓ. The sum ranges over chunk identifiers c in C, and D[s,d,c] is the original demand indicator for that chunk. This equality preserves the amount owed to each destination while allowing the internal flow variables to describe aggregate traffic.

The LP’s output states how much traffic from each source should traverse each link at each time. To run it as a collective, those allocations have to become concrete paths and transfers. The authors describe extracting paths with the same type of backward traversal used to retain necessary flows in the general formulation. The implementation expresses schedules in MSCCL so they can be run on the hardware. The authors implemented the optimizer in Python, used Gurobi to solve it, and stated their intention to release the code.

Short planning rounds when copying is needed

A larger AllGather exchange can still need the chunk-level decisions that made the MILP expensive. TE-CCL’s A∗-inspired method divides time into rounds, each containing a smaller optimization over its own epochs. It keeps the capacity and copying rules. Within a round it relaxes the requirement that every destination must already have its entire demand by the last epoch. The solver commits the round’s decisions, updates the remaining demand, and solves the next round until deliveries are complete.

A short round may end before a chunk can reach any destination. The original objective would give the solver little reason to send that chunk on a useful first hop. To give partial progress a value, the paper adds logical connections to destinations and uses the Floyd–Warshall algorithm to compute shortest distances based on the links’ α costs. The logical connections provide weights for the objective. Data still travel on the physical links, under their original capacity and arrival constraints. The weighting gives more credit to chunks that are closer to where they are needed and gives higher credit to completed delivery.

The appendix expresses the distance reward using P variables for chunks on their way to delivery. In the objective below, a node at which progress is credited can coincide with the target destination.

Jdist[r] =
  Σ(k′ ∈ K′, s,d ∈ N : s ≠ d) γ P[s,d,k′,r] / ((k′ + 1)(1 + FW[s,d]))
  + Σ(k′ ∈ K′, s,d ∈ N : s = d) P[s,d,k′,r] / (k′ + 1)

Here Jdist[r] is the distance contribution to the round r objective, K′ is the set of relevant future epoch indices, and k′ is an index in that set. N is the set of nodes. The indices s and d identify the node pair for the progress term, with equality identifying the term for data at the destination. P counts chunks credited towards the destination in the associated future epoch and round. FW[s,d] is the shortest-distance weight for that pair, computed from fixed link delays. The factor γ is less than 1 and discounts progress away from the destination. In both terms k′ + 1 discounts later future epochs. The addition of 1 to the distance keeps the distance denominator positive. The reward is added to the objective for delivery within the round.

Carrying the network state over the boundary is as important as rewarding progress. A chunk can have left a node in one round and still be in flight when the next starts. The paper uses Q to record what the previous round makes available in the next round’s relevant epochs. It combines data already in GPU buffers at the boundary with arrivals due at the boundary or later. For a subsequent round, the initial buffer state at a receiving GPU is initialized from the preceding calculation.

B[s,n,c,0,r] = Q[s,n,c,0,r − 1]

Here B is the buffer at node n for source s’s chunk c, in epoch 0 of round r. Q is the corresponding availability recorded by the preceding round r − 1 for the first epoch after its boundary. The 0 denotes that first epoch and the subtraction of 1 selects the previous round. The paper updates later epochs so an arrival is added only once to a GPU’s accumulated buffer. For switches, the scheduled cross-boundary arrival enters the forwarding constraint directly, because the switch has no chunk buffer. Once the state indicates that a destination has obtained its requested chunk, the next round removes that delivery from its outstanding demand.

Round length governs what the solver can see before committing a decision. Longer rounds let it account for more downstream effects in each optimization. Shorter rounds create smaller problems and may commit traffic to routes that a full-horizon solution would have avoided. They can also require more state if chunks take long enough to remain in flight across several round boundaries. In the experiments the authors choose the duration so a transmission can extend at most into the next round. This keeps the state needed for late arrivals simpler.

Picking the time grid and the horizon

Chunk size and epoch duration together determine the level of detail in a schedule. With whole chunks, a coarse epoch can waste opportunities on fast links, because a chunk that arrives early within an epoch still has to wait for the next forwarding opportunity. Smaller chunks allow greater scheduling flexibility and increase the number of transmissions to track. The authors describe sweeping candidate chunk sizes, while also allowing users to supply the size as an input. The fractional LP has more flexibility because a slow link can carry part of a chunk within an epoch.

The simplest MILP chooses an epoch long enough to transmit a chunk on the slowest link. A finer grid based on the fastest link needs special treatment. On a slow link, a whole chunk may take several epochs to transmit. The authors extend the forwarding delay to respect this and apply a capacity bound across a window of epochs. The appendix gives the bound in the following form.

Σ(k′ : k − κ ≤ k′ ≤ k) Σ(s ∈ N) Σ(c ∈ C) F[s,i,j,k′,c] ≤ κ T[i,j] τ

Here i and j specify the directed link and k the epoch at which the window ends. The index k′ ranges over the window given by the paper, and κ is the link-specific epoch count for transmitting a chunk. The other sums range over sources s in N and chunk identifiers c in C. F denotes the corresponding transmission, T[i,j] is the link’s rate in chunks per second, and τ is the epoch duration. The product on the right is the amount the link can carry over the stated duration. The forwarding constraints also incorporate the time needed on a slow link, so a short epoch does not make a whole chunk immediately available at its next hop.

Completing the full optimization also requires a maximum epoch count. Too short a horizon can make a feasible collective look impossible within the allowed time. Too long a horizon creates link and buffer variables for time the schedule may never need. The authors first try candidate total durations using coarse grids. These runs can find a feasible time budget with relatively few variables. The final optimization uses that budget to size a finer schedule and can satisfy demand earlier within it. The upper bound obtained by the coarse search serves as a starting point for the detailed solve.

Experiments and results

Workloads, baselines, and measurements

The experiments use communication requests defined by topology, collective type, and data size. In AllGather, a source contributes data that every other GPU requests. In AllToAll, each source has a distinct contribution for each recipient. The authors use DGX1 for the comparison with SCCL and include DGX2 and NDv2 in the comparisons with TACCL. They also study two proprietary cloud topologies, called Internal 1 and Internal 2. These differ in how GPUs connect to switches, which affects both the paths available to schedules and the size of the routing problem.

Solver time includes creating the variables and constraints as well as solving the optimization. Transfer time describes how long the resulting schedule takes to deliver all requested data. The authors distinguish the transfer size associated with a source’s contribution from the output buffer size at a receiving GPU. In AllGather, the output includes data from other sources, so a result indexed by output buffer size describes a different quantity from the size of one sender’s contribution. The paper uses algorithmic bandwidth to express schedule performance in terms of useful data delivered.

AB = Vout / tfinish

Here AB is algorithmic bandwidth, Vout is the amount of data in a GPU’s output buffer after the collective, and tfinish is the collective’s transfer time. This is a measure of progress visible to the application. It does not add the bytes transmitted by every relay. For the same output size, a shorter finish time yields higher algorithmic bandwidth.

The authors evaluate the full MILP for AllGather and the LP for AllToAll. They also test an early-stop AllGather setting that accepts a solution at a Gurobi optimality gap threshold of 30%, and the A∗-inspired variant for larger AllGather cases. The gap is for the optimization objective. It compares the best feasible solution the solver has found with its bound on the best possible objective value. A solver can spend a long time tightening the bound while the schedule itself stays the same. The paper reports cases in which another 10 hours brought no improvement to the solution, and describes using a 2 hour timeout for the full solve.

The SCCL comparison uses its public implementation and the artifact obtained from its authors. The TACCL comparison uses the implementation the authors received from the TACCL team. For that comparison, solver time includes the routing and scheduling phases. The reported timeouts were 2 + 2 hrs or 4 + 4 hrs, depending on topology size. The TACCL tests ran using Gurobi 9.5.2 on a Linux Ubuntu 20.04 virtual machine with 512 GB of RAM. In a separate report of the SCCL instance comparison, the paper gives results from a 6-core desktop with 32 GB of RAM.

Most of the numbers for executing an exchange are estimates derived from the synthesized schedules and the link costs. The authors compared estimates with measured runtime on a single 8 GPU DGX1 node for both TACCL and TE-CCL and found agreement in that check. Synthesis time, by comparison, is measured by running the solver. An instance where a solver fails to produce a schedule can therefore support a finding about synthesis without supplying a transfer time for a comparison.

SCCL on a DGX1 node

SCCL has a least-steps mode that minimizes latency under its formulation and an instance mode that is given the counts of chunks, rounds, and steps. The least-steps mode is the closer comparison to using TE-CCL to optimize latency. In the DGX1 tests, SCCL’s least-steps search took over a day for AllGather requests with more than 3 chunks and for AllToAll requests with more than 1 chunk. With a maximum of 10 epochs and 25 KB chunks, TE-CCL finished synthesis in ≤ 0.65s for the tested AllGather requests and ≤ 0.97s for the tested AllToAll requests with fewer than 5 chunks.

For transfer time, the relative performance depended on how much data could be pipelined. The fixed link delay in this comparison was 0.7 μs. At 1 chunk, the two tested collectives both had a reported estimate of 3.4 μs for SCCL and 4 μs for TE-CCL. With 2 AllGather chunks, the estimates were 5.1 μs for SCCL and 5 μs for TE-CCL. The chart shows the comparison for the larger AllGather request in the same experiment.

Estimated transfer time for 3-chunk AllGather on DGX1 with 25 KB chunks

TE-CCL’s pipelined schedule finishes sooner than the SCCL least-steps schedule.

Estimated transfer time for 3-chunk AllGather on DGX1 with 25 KB chunksSCCL least-steps: 8SCCL least-steps8TE-CCL (this paper): 6.1TE-CCL (this paper)6.1
The numbers
System or settingμs
SCCL least-steps8
TE-CCL (this paper)6.1

The authors attribute the advantage with multiple chunks to the timing of forwards. A relay can forward an arrived chunk while another chunk is still being transmitted elsewhere. SCCL’s barrier-based progression can leave some of that overlap unavailable. The 1-chunk case shows the other side of this comparison. With little traffic to pipeline, the extra flexibility of tracking individual arrivals yields no measured transfer-time advantage in that setting.

The instance comparison uses the same 25 KB chunk size and sets α to 0. TE-CCL takes its horizon from SCCL’s round count for the comparison. In AllGather with the setting written as (4, 5), giving chunks and epochs, SCCL took 4.1 s and TE-CCL took 1.45 s, with equal reported transfer times. At (6, 7), SCCL took 27.7 s and TE-CCL took 50.57 s with the tight initial horizon. Increasing TE-CCL’s epoch bound to 20 reduced its solver time to 11 seconds while preserving the result. The authors use this example to show that a smaller search horizon can sometimes make a particular optimization harder even though it has fewer epochs to represent.

For the AllToAll instance with 1 chunk per destination and 3 epochs, the paper reports a 33% transfer-time improvement and solver times of 8.8 s for SCCL and 0.11 s for TE-CCL. In a larger AllToAll request with 8 chunks, SCCL timed out after 10032.7s without a schedule. TE-CCL produced a valid schedule in 1.88s, with an estimated transfer time of 21 μs using 25 KB chunks. The latter experiment compares whether a schedule was obtained within the available synthesis time. It supplies a transfer-time estimate for TE-CCL alone.

TACCL across topology and data size

The paper compares TACCL and TE-CCL on both collectives over a range of sizes. The public-topology comparison includes configurations with up to 34 nodes. The comparisons on the internal topologies include configurations with up to 128 nodes. The authors plot the percentage change in algorithmic bandwidth and mark cases where TACCL did not return a usable schedule. Those missing schedules matter for whether the optimizer can be used at a given scale. Bandwidth comparisons require a returned schedule from each system.

The appendix gives detailed values for a 2-chassis NDv2 topology. One AllToAll example has a 64 KB output buffer. It is small enough for link delays and scheduling intervals to make a visible difference to the exchange. The chart uses the TE-CCL setting with the finer epoch duration.

Algorithmic bandwidth for 64 KB AllToAll on 2-chassis NDv2

TE-CCL’s fine-epoch schedule delivers the same output buffer at a higher algorithmic bandwidth.

Algorithmic bandwidth for 64 KB AllToAll on 2-chassis NDv2TACCL: 1.271TACCL1.271TE-CCL, fine epochs (this paper): 2.747TE-CCL, fine epochs (this paper)2.747
The numbers
System or settingGB/s
TACCL1.271
TE-CCL, fine epochs (this paper)2.747

For that 64 KB AllToAll case, TE-CCL’s estimated finish time was 23.30 μs and its solver time was 161.99 s. TACCL’s estimated finish time was 50.34 μs and its solver time was 860.88 s. At the 1 GB AllToAll output size, the fine-epoch result was 3.123 GB/s for TE-CCL and 3.125 GB/s for TACCL. This row places a useful bound on the broader performance claim. The large advantage in the 64 KB case can coexist with effectively similar estimated bandwidth at a much larger output size, and the raw table records a small TACCL lead in the latter case.

The same appendix shows that a faster synthesis setting can give up some transfer performance. With an AllToAll output buffer of 256 KB on 2-chassis NDv2, the coarse-epoch TE-CCL schedule reached 2.899 GB/s and took 9.97 s to synthesize. The fine-epoch setting reached 2.993 GB/s and took 218.50 s to synthesize. TACCL reached 2.212 GB/s, with a solver time of 1221.78 s. Both TE-CCL configurations beat TACCL on those measurements. Which TE-CCL configuration achieves the stronger result depends on whether the metric is synthesis time or bandwidth.

For the broader comparison, the paper reports maximum algorithmic bandwidth improvements on DGX2 of 471% for AllGather and 2979% for AllToAll. Its reported maxima on NDv2 are 970% for AllGather and 2919% for AllToAll. These are maxima across the reported scenarios, with topology, transfer size, and demand type varying. The paper’s raw NDv2 table also contains losses and near ties. A maximum gives the size of an observed benefit without describing how frequently an advantage of that size occurs.

Solver time follows a different pattern. On NDv2, TE-CCL was faster than TACCL in 45% of the AllToAll scenarios and 40% of the early-stop AllGather scenarios. On DGX2 the corresponding shares were 72% and 27%. On Internal 1 they were 72% and 83%, and on Internal 2 they were 100% and 50%. A stronger synthesized schedule can require a longer search. These percentages describe how frequently TE-CCL was faster at finding a schedule under the reported configurations, independently of the bandwidth comparisons.

Early stopping is one way to shorten the search. On 2-chassis NDv2 AllGather at 256 KB of output, the full fine-epoch solve took 59.55 s and reached 17.39 GB/s. The version using a 30% gap threshold ran for 2.83 s and reached 15.09 GB/s. TACCL took 11.17 s and reached 10.13 GB/s. At 64 MB of AllGather output, however, the early-stop schedule reached 16.33 GB/s and TACCL reached 20.43 GB/s. The full fine-epoch solve reached 22.86 GB/s in that case. The measurements show how early stopping can change the comparison with the baseline, even while making synthesis substantially faster.

Synthesis on the largest configurations

The authors also study configurations for which TACCL could not complete synthesis. They report that some failures involved exhausting available memory, while others involved crashes or an elapsed timeout. Internal 1 and Internal 2 had more devices attached to their switches than the NDv2 configuration described in the comparison. Representing connections through switches as direct edges makes many candidate edges available to TACCL on those topologies. Restricting those edges through a sketch improved runtime for smaller configurations, but the authors still report larger cases in which TACCL produced no schedule after 8 hours.

On Internal 2 with 256 GPUs, TE-CCL’s A∗-inspired AllGather synthesis took an average of 2.8 h using an epoch multiplier of 2. For AllToAll at the same GPU count, the average was 1500 s with a multiplier of 4. On Internal 1 at 128 GPUs, the paper reports an average of 7 h for AllGather with an epoch multiplier of 1 and 800 s for AllToAll with a multiplier of 2. An epoch multiplier coarsens the time grid from its fine setting, reducing the size of the optimization. The paper uses output buffers larger than 16 MB in these large-topology tests.

These large solves can require substantial resources even when TE-CCL obtains a schedule. The authors report memory usage around 350 GB for large AllToAll optimizations. Some TACCL cases required more than 400 GB RAM. TE-CCL controls part of the expense by changing the epoch duration and, for AllGather, dividing the time horizon into rounds. The scale result is that the formulation could be solved for the reported larger configurations under those choices. The resulting synthesis times also show why the cost of building a schedule matters when an outer search invokes the optimizer repeatedly.

What the ablations show

Fixed delay and short transfers

The authors isolate fixed delay by looking at how algorithmic bandwidth estimates change when the optimizer accounts for α. The test uses a proprietary topology with 2 chassis, 8 GPUs, and 40 edges. The stated α values are 0.6 and 0.75 microseconds for GPU-to-GPU and GPU-to-switch links, respectively. The paper reports that the error from leaving α out can reach 100×. The error is largest for small transfers, where the time to put the bytes on a link can be short compared with the fixed delay.

This comparison is about the estimate a schedule gets under different assumptions. It explains why capacity alone can give a misleading picture of which transfers can overlap. For a large amount of data, the time a link spends transmitting bytes can dominate. For a small amount, a route across several links can spend much of its completion time waiting for arrivals. The cost of delaying a relay depends on when it receives its data and what work the rest of the exchange can carry out during that interval. Tracking those events lets the optimizer exploit concurrency without forwarding a chunk prematurely.

When shorter epochs help

The authors compare coarse and fine epochs using 2 chassis for each tested topology. Coarse epochs generally reduce solver time by reducing the number of periods for which variables and constraints are needed. Fine epochs give the schedule more opportunities to forward traffic after an arrival. Where all outgoing actions are restricted to epoch boundaries, a device that finishes receiving early can keep its outgoing link idle until the next epoch even if the link itself could have started sooner.

The effect is especially visible on NDv2 and DGX2, where the paper describes the fast links in this comparison as having 4× the bandwidth of the slow ones. The large epoch duration there is 4× the short duration. Basing the clock on the slower link imposes the slower pace on a schedule that traverses several fast links. The authors observe little difference on Internal 1, where link speeds are largely homogeneous. Their comparison ties the quality cost of coarse epochs to the gap between the links’ actual transmission times.

The appendix also gives fine- and coarse-epoch results for small AllToAll requests where the advantage can be very small or even change sign. At a 4 KB output buffer on 2-chassis NDv2, the reported transfer times are 4.64 μs for the fine-epoch configuration and 4.5 μs for the coarse one. The coarse run takes 20.90 s to solve, compared with 69.58 s for the fine run. The stated pattern in the controlled tests therefore describes a tendency across settings. The timing grid, link rates, and particular request determine which concrete schedule is found.

In-network copying

The copying experiment compares AllGather schedules with and without replication. The authors use 4 chunks for the transfers and report the strongest effect for the largest transfer size, 0.21 GB. At that size, copying reduced transfer time by 50% on DGX1. The paper reports the same reduction for Internal 1 both with α set to 0 and with a positive α. On Internal 2 the reported reduction was 12.5%.

For the small transfers in this test, the source could send separate copies with enough capacity to serve the destinations quickly. Relaying the data to make a copy then provided little benefit. As the transfer size grew, repeatedly putting the same data onto a constrained link used capacity that other traffic could have shared. A branch downstream of that link avoided repeated use of the shared segment. The different results across topologies show that the value of copying depends on where the available capacity lies relative to sources and destinations.

This experiment also helps explain the boundary between the MILP and LP. For the tested larger AllGather transfers, the propagation of a particular chunk and the choice of where to replicate it are part of the schedule’s performance. Aggregating data by source and removing chunk identity would discard that decision. In AllToAll, the demand itself gives each destination different data, so the LP can conserve transmitted amounts and use its smaller representation.

What buffers changed in practice

In the buffering comparison, the paper uses 2 chassis for each tested topology. Allowing GPUs to store and forward chunks had little effect on solution quality in most cases. The authors propose an explanation based on the collective patterns they tested. A device can interleave its own receipt with forwarding, making it possible to reach a similar finish time even when it cannot deliberately accumulate transit data between sends. A schedule that makes good use of the available links can therefore have the same completion time under both rules.

Solver time was more sensitive, and its direction varied. With buffers, the average solver-time speedup was 61% on Internal 1 without α and −28.46% on Internal 1 with α. The corresponding average speedups were 0.23% on Internal 2 and 71% on DGX1. Allowing storage can give the optimizer several ways to arrange intermediate arrivals while achieving the same finish time. The authors suggest that having more feasible arrangements can make a good schedule easier to find or certify. The negative value for Internal 1 with α shows that the extra freedom can also increase search time. The paper leaves a formal explanation for future work.

The controlled comparison separates a performance property of the schedule from a computational property of the optimization. A buffer can be valuable because it changes how easily a solver can discover a schedule, even when a schedule with the same completion time exists without that buffer. Conversely, adding a buffer does not imply a fixed improvement in synthesis time. The outcome depends on the topology and the timing constraints acting on the extra possibilities.

The cost of solving short rounds

The authors compare the A∗-inspired approach with the full optimization on 16-chassis Internal 2. They test single-chunk and 2-chunk transfers with zero and positive α. With α set to 0, the single-chunk synthesis took 86.61s for the round-based technique and 346s for the full solver. The estimated transfer times were 3.89s and 3.48s, respectively. The paper describes the full solution as 10% better by its transfer-time comparison in that case.

With 2 chunks and α set to 0, the round-based optimization took 263.29s, compared with 4392s for the full optimization. The paper reports a 6% advantage for the full solution in transfer quality. With positive α, synthesis for the single-chunk case took 137.02s in rounds and 363.40s in the full optimization. For 2 chunks, the solver times were 901.25s and 3047s, respectively. The transfer-quality advantages reported for the full solution under positive α were 20% for the single-chunk case and 8% for the 2-chunk case.

Solver time for 2-chunk AllGather on 16-chassis Internal 2 with zero fixed delay

Solving successive rounds reduces synthesis time in this comparison.

Solver time for 2-chunk AllGather on 16-chassis Internal 2 with zero fixed delayTE-CCL, full optimization: 4392TE-CCL, full optimization4392TE-CCL, A∗-inspired rounds (this paper): 263.29TE-CCL, A∗-inspired rounds (this paper)263.29
The numbers
System or settings
TE-CCL, full optimization4392
TE-CCL, A∗-inspired rounds (this paper)263.29

The comparison isolates the consequence of optimizing a shorter horizon while keeping support for copying. The full solver can weigh the effect of an early routing choice against later congestion and opportunities to branch. The short-round solver values partial progress through its distance term, then carries the consequences of its choices into later rounds. The experiment shows a synthesis advantage together with a measurable execution cost in the estimated schedules. The size of that tradeoff changes with the chunk count and the fixed-delay setting.

Limitations

Limits the authors state

The authors had access to hardware for a single-node DGX1 check. They lacked the hardware access and budget for large runs across different kinds of GPUs. They identify congestion, the sizes of batches of messages, and GPU implementation effects as possible influences on actual collective latency. The large-topology transfer estimates therefore establish what the schedules are expected to do under the given link costs. Solver runtimes and failures to synthesize a schedule were observed directly.

The topology and its α and β values are inputs to TE-CCL. The paper does not provide a separate procedure for measuring those values. The physical accuracy of a schedule’s estimated time depends on whether those inputs describe the relevant behavior of the hardware. A topology can have changing bandwidth in the formulation if the changes are specified at epoch boundaries through an epoch-specific capacity matrix. That extension assumes the time-varying capacities are available to the optimization.

The authors also describe how to represent several tenants sharing a network. Combining their demands places all transmissions under common link-capacity constraints. Giving tenants different priorities requires separate buffer and receipt variables and a corresponding change to the objective. The paper notes that this creates more variables and can make the MILP slower. The evaluation’s reported speed and bandwidth comparisons are for the particular collective workloads and topologies, with no separate multi-tenant performance comparison.

The integer formulation grows with the number of chunks, devices, links, and epochs. Its early-stop setting may return an incumbent schedule before the solver proves optimality. The round-based formulation makes an additional approximation and gives up full-horizon optimality even when each round is solved exactly. The authors also report numerical difficulties in Gurobi for large AllToAll cases with more than 64 nodes. They use a different solver setting to obtain a feasible result and search over horizon lengths. These distinctions qualify what a given run’s solver status can establish.

Limits visible in the setup

The paper often describes the objective as finishing as soon as possible. Its written objective gives declining rewards to receipts in later epochs, with a separate requirement that all requests be met within the horizon. The reward can prefer a schedule that delivers more data early even when the last delivery occurs at the same time. A bound on that objective concerns the formulation as written. The transfer-time comparisons in the experiments are the evidence for how the resulting schedules differ in the time of the final delivery.

Schedule quality and synthesis scale also depend on the time grid. Fine epochs allow arrival and forwarding times to be represented with greater precision, and the large-topology tests sometimes use a coarser grid to fit the solve in available memory. The resulting large runs demonstrate scalability at the epoch multipliers the authors report. The full MILP’s ability to solve its discrete formulation and the ability to achieve the fastest schedule on hardware are separate claims, because both the grid and the cost inputs affect the connection between them.

The choice of comparison setting matters for interpreting the headline gains. The SCCL instance comparison suppresses α and takes the horizon from the baseline’s round count. The TACCL comparison adopts its switch accounting to make the transfer estimates comparable. Both are useful controlled choices, and the strongest results concern those comparison settings. A solver timeout has a similarly specific interpretation. It means the authors’ implementation and configuration did not return a schedule under the stated resources. The paper’s large-scale claims about schedule availability rest on those outcomes.

Finally, the reported measurements concern collective operations. They do not quantify how the schedules would change time spent on a full distributed training job. A training procedure may spend different amounts of time waiting for collectives, and its exchange sizes can span the regions where TE-CCL leads, ties, or trails. The paper establishes how the optimizer behaves across the tested transfer sizes and layouts. The hardware check connects predicted and measured latency for one node, while the larger comparisons remain evidence about the synthesized schedules.

What came after

No later study is documented here as building on TE-CCL. The authors themselves point to topology design and adaptation to network failures as directions opened by treating collective scheduling as a flow problem. They also leave open a formal explanation of when buffering accelerates the solver. These are directions raised by the paper, with no subsequent result reported for them.

Cite

Cite as Behnaz Arzani, Siva Kesava Reddy Kakarla, Miguel Castro, Srikanth Kandula, Saeed Maleki and Luke Marshall. 2023. Rethinking Machine Learning Collective Communication as a Multi-Commodity Flow Problem. arXiv:2305.13479.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.48550/arxiv.2305.13479 · arXiv 2305.13479

@misc{arzani2023rethinking,
  title = {{Rethinking Machine Learning Collective Communication as a Multi-Commodity Flow Problem}},
  author = {Behnaz Arzani, Siva Kesava Reddy Kakarla, Miguel Castro, Srikanth Kandula, Saeed Maleki and Luke Marshall},
  year = {2023},
  doi = {10.48550/arxiv.2305.13479},
  eprint = {2305.13479},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2305.13479}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/arzani-2023-rethinking-machine-learning-collective-communication/