AI Infra Interviews logo
Networking, Interconnects & Storage / 05
medium★ EssentialNewNVIDIAMetaCoreWeave

Explain a rail-optimized fabric. What does it buy over a plain fat tree, and how many switches does one need?

Wire GPU number three of every node to the same switch and the collective that matters most never leaves it. The rank mapping that makes the layout pay, the switch and cable count for a thousand GPUs worked out, and what happens to a job whose ranks are assigned in the wrong order.

Updated Sep 2026 · Grounded in real AI infrastructure interview loops and written to a senior-engineer editorial bar, with every number worked and every diagram hand-built.

TL;DR: In a rail-optimized fabric, GPU index i in every node connects to the same leaf switch, called rail i, so all the GPUs that share an index across the cluster are one hop apart. That matters because the collectives a training job runs most are structured to exchange between corresponding ranks: with tensor parallelism inside a node on NVLink and data parallelism across nodes, the data-parallel exchange for GPU 3 talks only to other GPU 3s, which now stay on rail 3 and never touch the spine. For 128 nodes of 8 GPUs at 400 Gb/s with 64-port switches, that is 8 rails of 4 leaf switches each, 32 leaves, 16 spines and about 2,048 optical links. The layout only pays if rank assignment matches it: the same hardware with ranks handed out in the wrong order sends every data-parallel exchange across the spine, which is the difference between one hop and three.

How to approach it

Define the rail by what is wired to what, then show the collective it is designed for, because the topology is meaningless without the traffic pattern it serves. Do the switch and cable arithmetic for a concrete size. Then say what makes it fail, which is rank assignment rather than cabling, since that is the failure a platform engineer will actually meet.

A strong answer

A typical situation: a cluster is cabled rail-optimized to the vendor's design, and a job's all-reduce measures half the expected bandwidth. The cabling is correct. The scheduler allocated nodes in an order that made rank 0 through 7 land on one node and rank 8 through 15 on a node in a different pod, so the data-parallel group for GPU index 3 is spread across the fabric rather than sitting on rail 3.

What is wired to what:

each node has 8 GPUs and 8 network interfaces, one per GPU, on matching PCIe roots
rail i = the leaf switch that GPU i of every node connects to
so:  node 0 GPU 3, node 1 GPU 3, node 2 GPU 3 ... all land on rail 3's leaf switch
     traffic between any two GPUs with the same index is one hop
     traffic between GPUs with different indices goes leaf, spine, leaf: three hops
inside the node, GPUs talk over NVLink at 900 GB/s, roughly 18 times the 50 GB/s of one NIC

The traffic pattern this is built for:

a common 3D layout for a 1,024-GPU job: tensor parallel 8, data parallel 128
  tensor parallel: the 8 GPUs within one node, all-reduce twice per layer, on NVLink
  data parallel:   GPU index i of each of 128 nodes forms one data-parallel group
                   its gradient all-reduce involves only GPU i everywhere -> rail i only
result: the largest and most frequent cross-node collective is confined to a single rail,
        never contends with the other seven rails, and never crosses the spine
sanity: the alternative layout, where a data-parallel group spans different GPU indices,
        sends that same traffic leaf-spine-leaf and shares the spine with seven other groups

Topology-Aware Communication covers the rank mapping; Rail-Optimized and Fat-Tree Fabrics has the general structure.

rendering diagram…

The switch and cable count, for 1,024 GPUs:

cluster    128 nodes x 8 GPUs = 1,024 GPUs, one 400 Gb/s port each
switches   64-port leaf and spine switches
per rail   128 endpoints (one per node) for that rail
           a leaf with 32 downlinks and 32 uplinks is 1:1 non-blocking
           leaves per rail = 128 / 32 = 4
leaves     4 per rail x 8 rails = 32 leaf switches
uplinks    32 leaves x 32 uplinks = 1,024 uplinks
spines     1,024 / 64 = 16 spine switches
total      48 switches
cables     1,024 node-to-leaf + 1,024 leaf-to-spine = 2,048 optical links
sanity: optics dominate the fabric bill at these speeds, so the cable count rather than the
        switch count is the number to quote when someone asks what the network costs

The failure mode is rank assignment, not cabling, and it is worth being specific about. The fabric provides the property that same-index GPUs are one hop apart; realizing it requires that the job's parallelism groups line up with that index. Three things have to agree: the scheduler must allocate whole nodes rather than scattered GPUs, the launcher must assign local rank to GPU index consistently, and NCCL must pick the network interface matching each GPU rather than whichever it finds first. The last of those is NCCL_IB_HCA plus the topology the library detects, and when the interfaces are enumerated in an unexpected order it will happily build rings that hop between rails.

Verifying it takes two commands. nvidia-smi topo -m shows which NIC sits nearest each GPU, and the entries for a correctly built node read as the closest classification for GPU i to NIC i. NCCL_DEBUG=INFO then prints the rings it built, and in a correct run the cross-node hops in a ring connect ranks that differ by the node stride rather than by one.

The reversal condition: rail optimization pays because the dominant cross-node collective is index-aligned. A workload where that is not true gets nothing from it and may be hurt by it. Expert parallelism is the clearest case: its all-to-all sends every token to whichever GPU holds its expert, so traffic is uniformly spread across indices and crosses the spine regardless, which means the spine has to be provisioned for it rather than treated as an overflow path. A cluster expecting mixture-of-experts training should size the spine for a full all-to-all instead of assuming rails absorb most of the traffic.

What interviewers probe next

  • "What if a node has fewer NICs than GPUs?" Then several GPUs share a rail interface and the per-GPU bandwidth falls proportionally. The rail structure still holds; the arithmetic changes.
  • "How does this interact with pipeline parallelism?" Pipeline stages exchange activations point to point between adjacent stages, which are usually adjacent nodes, so the traffic is small and tolerant of a spine crossing.
  • "Why not just build a bigger flat fat tree?" You still can, and it is simpler. Rail optimization is the same hardware arranged so the dominant pattern avoids the spine, which lets you oversubscribe the spine and save money without hurting the main collective.
  • "What does the scheduler have to guarantee?" Whole-node allocation and contiguous placement, so the parallelism groups map onto the rails as intended. Topology-aware scheduling exists for this.

Common mistakes

  • Describing the rail as a performance feature of the switch rather than as an alignment between rank index and wiring.
  • Assuming correct cabling is sufficient, when rank assignment determines whether the property is used.
  • Quoting switch counts and omitting optics, which dominate the cost.
  • Applying the design to an expert-parallel workload whose all-to-all ignores the index alignment entirely.

Key takeaways

  • Rail i is the leaf switch that GPU index i of every node connects to, so same-index GPUs are one hop apart and different-index GPUs are three.
  • With tensor parallelism inside the node and data parallelism across nodes, the largest cross-node collective stays on one rail.
  • 1,024 GPUs on 64-port switches: 8 rails, 32 leaves, 16 spines, 48 switches and about 2,048 optical links.
  • The property is realized by rank assignment; check nvidia-smi topo -m and the rings in NCCL_DEBUG=INFO before trusting it.
That one was free — and so are 10 answers per topic without an account. Signing in doubles that to 20, opens the Plus lessons in the courses, and remembers which topics you keep getting wrong.no card · Google sign-in · nothing to cancel
HOW DID IT GO?
0
READING SIGNED OUT

Signing in doubles your free answers, from 10 to 20 per topic, and the site starts remembering you: mastery per topic, bookmarks, and a next-focus recommendation. Free, no card.

Sign in free

The concepts behind this question

Ranked by how closely each one overlaps this question's topic, so the first card is the thing to read if the answer above moved too fast.

Advanced
🔌 Networking & Storage🔒 Premium
Rail-Optimized and Fat-Tree FabricsA GPU cluster's network is built from two ideas: a fat tree (Clos) that gives every node a path to every other node with a chosen amount of oversubscription, and rail optimization, which wires GPU i of every node to the same leaf switch so the collectives that dominate training stay one hop away. Sizing one is arithmetic on port counts, and the interview question is usually that arithmetic: how many switches, what oversubscription, and where the NVLink domain ends and the fabric begins.
Foundational
🖧 Hardware & Cluster Build-Out
Scale-Out Fabric Choice: InfiniBand XDR vs Spectrum-XOutside the NVLink domain every GPU talks over a scale-out fabric, and as of September 2026 NVIDIA sells two at the same 800 Gb/s per port: Quantum-X800 InfiniBand and Spectrum-X Ethernet. They differ in congestion handling, operational familiarity and what happens when something misbehaves rather than in headline speed. The switch radix decides how many endpoints a two-tier fabric reaches, and that single number drives the switch count, the cable count and a large part of the budget.
Advanced
🔌 Networking & Storage🔒 Premium
Topology-Aware CommunicationThe same collective can run at 900 GB/s or at 50 GB/s depending on which links it is laid across, so the mapping of parallel groups onto hardware is a performance decision, not a deployment detail. The rule: tensor-parallel groups inside the NVLink domain, data-parallel rings along rails, pipeline stages across the fabric, and every rank placed so its partner is one hop away. NCCL discovers the topology and does most of this when the job lets it; the failures come from placements that do not.
Foundational
🔌 Networking & Storage
Debugging a Slow All-ReduceA training job reports its all-reduce at a third of what the fabric should deliver, every node passed its health check, and nothing is logged. This page is the isolation order that finds the cause in an hour instead of a day: measure the collective in isolation, split the job until the slow pair or rank appears, then check the specific things that make a link, a node or a placement slow. Most cases end at one NIC, one topology mismatch, or GPUDirect silently off.
UP NEXT ON YOUR JOURNEY
FEDITOR'S NOTE

Scored on explaining the rail as an alignment between rank index and switch, on the switch-count arithmetic, and on knowing the layout only pays if rank assignment matches it.

DISCUSSION · 0

No comments yet — be the first to share your approach.