Home / Learn / AI Networking / AI Cluster Network Topologies

On this pageWhat a topology has to deliverFat-tree and leaf-spineOversubscriptionRail-optimized designsBeyond fat-treeScale-up, scale-out and front-endHow switch size shapes the networkCables and opticsRouting and load balancingFailuresPlanning considerationsFor chip designersCommon questionsRelated guides

AI Cluster Network Topologies: Fat-Tree, Dragonfly and Rail-Optimized

An AI cluster’s network topology is the pattern in which its switches, servers and accelerators are connected. The topology decides how many accelerators can be linked, how much bandwidth exists between any two of them, how many switches and cables are needed and what happens when something fails. Most AI clusters use a fat-tree built from layers of switches. Alternatives exist, each trading cost, performance and complexity differently.

What a topology has to deliver

Training traffic is demanding. Accelerators exchange large volumes of data simultaneously, and each step waits for the slowest transfer.

A topology for this work is judged on several properties.

PropertyMeaning
ScaleHow many endpoints it can connect
Bisection bandwidthThe capacity between two halves of the network
DiameterThe largest number of hops between endpoints
Path diversityHow many distinct routes exist between two endpoints
CostSwitches, cables and optics per endpoint
Fault toleranceHow well it survives failures
OperabilityHow hard it is to build, cable, route and expand

Fat-tree and leaf-spine

The dominant design derives from the Clos network, an arrangement first described for telephone exchanges that builds a large switch from many small ones. In data centers it is called a fat-tree or leaf-spine.

Two tiers. Servers connect to leaf switches. Every leaf connects to every spine switch. Any two servers are at most three switch hops apart: leaf, spine, leaf.

Three tiers. For more endpoints, groups of leaf and spine switches form pods, and a further layer of switches joins the pods.

If the total capacity of a switch’s uplinks equals that of its downlinks, the network is non-blocking: in principle, every endpoint can send at full rate at once. There are many equal-length paths between any pair, one through each switch in the upper tier.

Strengths: predictable performance, high path diversity, well understood, supported by standard routing, easy to expand in units.

Weaknesses: many switches and, above all, many cables and optical modules. Each added tier adds a hop and a great deal of hardware.

Oversubscription

In ordinary data centers, uplink capacity is often less than downlink capacity, on the assumption that servers do not all transmit at once. A ratio of three to one is common.

AI back-end networks are generally built with no oversubscription, at one to one. The simultaneous nature of training traffic means the assumption does not hold. Building non-blocking is expensive and is treated as necessary.

Rail-optimized designs

A server with several accelerators has several network interfaces, often one per accelerator. In a rail-optimized layout, the first interface of every server connects to one leaf switch, the second to another, and so on. Each such set of connections is a rail.

Accelerators in the same position across servers are then one hop apart. Communication libraries arrange for most traffic to stay within a rail, using the server’s internal connections to cross between rails. This cuts the traffic that needs the spine layer and reduces latency.

Beyond fat-tree

Dragonfly. Switches are organized into groups. Within a group they are densely connected. Each group has a few long links to other groups, so that every pair of groups is directly joined. Any endpoint is within a small number of hops with far fewer long cables than a fat-tree. The cost is that there is only one shortest path between two groups, so good performance depends on adaptive routing that sends some traffic indirectly through a third group. Dragonfly is widely used in supercomputers.

Torus and mesh. Each node connects to its neighbors in a grid of two, three or more dimensions, with wraparound links in a torus. Wiring is short and switches may be unnecessary, as nodes forward for each other. Distances grow with size, and bandwidth across the network is limited. Historically important in supercomputing, and used in some AI systems.

Hypercube and related. Nodes connected according to the bits of their addresses. Low diameter, with many ports per node.

Expander and random-like graphs. Research designs that achieve short paths with fewer switches than a fat-tree, at the cost of more complex routing and cabling.

Direct mesh within a pod. At small scale, such as within a rack, every accelerator may connect directly to every other.

TopologyDiameterCablingRoutingTypical use
Fat-treeLow, fixedHeavySimple, equal-cost multipathMost AI and cloud clusters
DragonflyVery lowLighterNeeds adaptive routingSupercomputers
TorusGrows with sizeShort, localDimension-orderedSome HPC and AI systems
Full meshOne hopGrows quickly with sizeTrivialSmall pods

Scale-up, scale-out and front-end

A modern AI cluster has several networks, and each can have its own topology.

  • Scale-up. Links accelerators within a pod, typically a rack. Often a single switching layer or a direct mesh, with very low latency.
  • Scale-out, or back-end. Links pods across the cluster. Usually a non-blocking fat-tree.
  • Front-end. Connects servers to storage, users and services. A conventional leaf-spine, often with some oversubscription.

How switch size shapes the network

The number of ports on a switch, its radix, determines how large a network can be built in a given number of tiers.

A two-tier fat-tree of switches with k ports supports on the order of k squared divided by two endpoints. A three-tier one supports about k cubed divided by four. Doubling the radix therefore multiplies the reach of two tiers by four.

Higher-radix switches let a cluster stay at fewer tiers, which saves switches, optics, power and latency. This is a major reason for interest in switch chips with more ports and in splitting high-speed ports into several lower-speed ones.

Cables and optics

In large fat-trees, the cost and power of optical modules and the labor of cabling can rival the switches themselves.

  • Copper is cheap and uses no power and reaches only a few meters at current speeds. It serves within racks.
  • Optical links cover the rest and need transceivers at both ends.
  • Co-packaged and linear optics aim to cut the power of optical connections.

Topology choices are often driven by the wish to keep as many links as possible short enough for copper.

Routing and load balancing

A topology’s path diversity is only useful if traffic is spread across it.

  • Equal-cost multipath hashes each flow to one path. With the few large flows of AI traffic, it balances poorly.
  • Flowlet and adaptive schemes move flows in response to load.
  • Per-packet spraying uses all paths at once.

Topologies with unequal path lengths, like dragonfly, add the question of when to take a longer route.

Failures

Large clusters always have something broken. A good topology degrades gracefully.

In a fat-tree, losing one spine switch removes a fraction of capacity, and traffic shifts to the others. A failed link can leave the network asymmetric, with less capacity toward some destinations, which simple hashing handles badly and which calls for load balancing that is aware of the imbalance.

Planning considerations

  • Growth. Whether the cluster can be extended without rewiring.
  • Job placement. Schedulers that know the topology can keep a job’s accelerators close together.
  • Multi-tenancy. Isolation between users of a shared cluster.
  • Physical layout. Rack positions, cable lengths and cooling.
  • Power. Network equipment is a meaningful part of the total.

For chip designers

Topology sets requirements for the chips at each end of the link.

  • Port count and speed on accelerators and network interfaces, to suit rail designs.
  • Breakout options to match switch radix.
  • Multipath support in the transport.
  • Reach. SerDes capable of driving copper where the topology allows it.
  • Fast failure detection and recovery.

Common questions

What topology do most AI clusters use?

A fat-tree, also called leaf-spine or Clos, usually built without oversubscription so that all accelerators can communicate at full rate simultaneously.

What does non-blocking mean?

That the network has enough capacity at every tier for all endpoints to send at their full rate at once, so congestion arises only from uneven distribution of traffic.

What is a rail-optimized network?

A layout in which corresponding network interfaces on every server connect to the same leaf switch, so that accelerators in the same position are one hop apart.

Related guides