AI Infra Interviews logo

Slow NCCL All-Reduce: A Worked Interview Debugging Guide

Diagnose a slow all-reduce with per-rank timelines, a worked bandwidth bound, matched NCCL benchmarks and evidence that distinguishes transport problems from lost overlap.

BY JONAS WEBER · AIINFRAINTERVIEWS EDITORIAL · UPDATED OCTOBER 21, 2026 · 8 MIN READ

PRACTICE THIS:Distributed training questions ·Networking and storage questions ·Reliability and observability questions ·The must-know questions

To debug a slow NCCL all-reduce, first separate time spent moving data from time spent waiting to start or finish it. Compare per-rank timelines, calculate a scoped bandwidth bound, and run a benchmark that matches the training job. Use the results to choose the next experiment; neither low utilization nor one benchmark result identifies a fault by itself.

Consider an illustrative interview scenario: the same training workload drops from 40% to 22% model FLOPs utilization, and the trace attributes more time to all-reduce. These are teaching inputs, not results from a measured incident. Start by asking what changed and what the timing includes.

Establish the workload and the timing boundary

Write down the collective, its payload per rank, the participating ranks and their GPU-to-NIC placement. A model's total gradient size is not necessarily the buffer in one call: parallelism and gradient bucketing change what each rank communicates.

Ask whether the reported duration comes from a host timer, a GPU trace or an exposed communication tail at the end of backward. These answer different questions. A longer step with unchanged collective throughput can result from losing communication overlap.

PyTorch's Distributed Data Parallel design note explains that gradients are grouped into buckets and reductions can overlap backward computation. A later-ready bucket can delay that overlap. The note also describes ordered reductions across ranks; inspect the framework version and trace rather than assuming every ready gradient launches immediately. For the broader mechanisms, see Ring vs Tree All-Reduce and Stragglers and Hangs.

Work a bandwidth bound with explicit assumptions

Take an illustrative 256 MiB input buffer on each of eight ranks, with one rank per node and a dedicated 400 Gbit/s network path per rank. Assume a ring, no competing traffic and no slower GPU-to-NIC path. This deliberately simple topology makes the arithmetic interpretable; it is not a forecast for a hierarchical multi-GPU node.

NVIDIA's nccl-tests performance guide defines all-reduce bus bandwidth as algorithm bandwidth multiplied by 2(n−1)/n. Applying that factor:

S = 256 × 2^20 = 268,435,456 bytes per rank
n = 8 ranks; traffic factor = 2 × 7 / 8 = 1.75
B = 400 × 10^9 / 8 = 50,000,000,000 bytes/s
ideal bandwidth time = S × 1.75 / B = 0.009395 s ≈ 9.40 ms

The ideal excludes startup and protocol overhead. At a hypothetical 12 ms, normalized bus bandwidth would be 39.15 GB/s; at 20 ms, 23.49 GB/s. Neither number proves a hardware defect. The useful regression comparison is a healthy run with the same setup. If that baseline was 12 ms and the current run is 20 ms, investigate the additional 8 ms.

Do not compare algbw directly with a NIC's advertised rate, or confuse MiB with decimal MB. The napkin math questions give more practice with units. A near-bound collective also does not rule out a different bottleneck elsewhere in the training step.

Inspect rank arrival and compute together

If one rank reaches the collective late, trace backward from that delay. Check its input pipeline, CPU scheduling, GPU work and preceding communication. A late rank might be waiting on storage or a previous network operation; it is not automatically a defective GPU that should be drained.

Compare rank timelines using aligned clocks or trace synchronization. Then compare the duration of the work immediately before the collective. A repeatable delay on one host suggests a controlled host or placement experiment. A delay that follows a data shard suggests a different experiment. The reliability and observability track covers the device and job telemetry needed for that distinction.

Make the microbenchmark a controlled comparison

Run nccl-tests with the job's collective, rank count, message-size range, data type, nodes and GPU-to-NIC mapping. Record NCCL and driver versions, environment settings and concurrent load. Include warm-up and repeated samples. Changing several of these while moving from the job to the test makes a clean result difficult to interpret.

Use this decision table to choose where to look next:

ObservationNext investigationWhat it does not establish
Matched benchmark regresses tooTransport selection, placement, congestion, hardware and software changesThat a cable or switch is necessarily faulty
Isolated benchmark passes; job regressesBucket readiness, overlap, launch gaps and contention during the jobThat all paths and traffic conditions are healthy
Only some node pairs regressRepeat those pairs; correlate topology and counter changesWhich endpoint or shared component caused it
Collective time is stable; step time risesCompute, input stalls and exposed communication tailThat increasing network bandwidth will help

Start with the job timeline when the matched benchmark is stable. Reverse that priority if the benchmark reproduces the regression under the affected placement and load. This is evidence-guided narrowing, not a permanent division between application and network failures.

Inspect the selected path before changing it

Use NCCL diagnostic logging to inspect initialization, network selection and topology. NCCL_DEBUG=INFO with relevant NCCL_DEBUG_SUBSYS filters such as INIT,NET,GRAPH helps limit the output. Check the installed version's documentation, capture logs per process, and remove diagnostic settings after the investigation.

For a suspected fabric issue, correlate the slow interval with link rate, link errors, discards and congestion evidence. NVIDIA's networking troubleshooting guide describes port-counter and transport checks. Interpret counters for the actual fabric: an InfiniBand counter and a RoCE congestion signal do not mean the same thing.

A topology or transport change can reduce throughput without broken hardware. Verify the path used before forcing an algorithm, disabling a transport or draining nodes. Our networking and storage questions cover those tradeoffs.

Close the interview answer with a falsifiable result

State the proposed change and the observation that would reject your diagnosis. For example: if a controlled placement change restores the benchmark but training still stalls, keep investigating the job timeline. Compare step-time distributions and useful throughput under the original workload, and verify correctness after software or algorithm changes.

A useful follow-up is: “What if only small messages are slow?” Check launch and latency overhead before judging bandwidth. Another is: “What if more GPUs make it slower?” Recheck the communication pattern, placement and scaling baseline before promising a linear speedup.

Remember the scope of the arithmetic: 256 MiB, eight ranks and a dedicated 400 Gbit/s path give a 9.40 ms ideal ring bandwidth term. It is a reference for a stated setup. The diagnosis comes from controlled measurements. Continue with the distributed training track and Debugging a Slow All-Reduce.

PRACTICE THIS

Turn it into offers. Work the real questions and concepts this maps to:

FAQ

Define what the timing measures and compare per-rank timelines. A long interval attributed to communication can include waiting for a late rank, launch delays or lost overlap. Check the actual collective payload, placement and a comparable healthy baseline before changing network settings.

Discussion (5)

Jonas WeberEditor

Keep the first baseline run as an artifact: allocation, environment, library versions and raw output together. A bandwidth number without its placement is hard to reuse when the scheduler gives you a different set of nodes.

Owen HartleyEditor

And keep the slow samples. Reporting only the fastest iteration answers a different question from explaining a training job's tail latency.

Yu HuangContributor

I would sample link counters before and after the test. A cumulative error total can describe a cable problem from last month; the increment during the slow interval is much more useful evidence.

Deepa VenkateshEditor

Changing placement is a good experiment, but moving every rank at once makes attribution difficult. If capacity allows, change one suspect node and preserve the rest of the mapping, then see whether the symptom follows it.

Feng WangContributor

One trap with host timing: CUDA work is asynchronous. Make sure the timer's completion boundary matches the thing you claim to measure. Otherwise the nice small number may just be launch time 🙂