Google Tag Manager (noscript) End Google Tag Manager (noscript) HTML Benchmarking MoE Training on Ironwood, Part 2: Pursuing peak performance DEC. 2, 2026 Kevin Wang Software Engineer Jesse Lu Staff Software Engineer Caitlin Stanton Software Engineer Daniel Mandragona Software Engineer part 2 header

Overview

To benchmark mixture-of-experts (MoE) training on Ironwood (TPU7x), Google Cloud's seventh-generation TPU, we ran DeepSeek-V3 671B pretraining across 2,048, 4,096, and 8,192 chips achieving 4,997, 4,790, and 3,689 tokens/sec/chip and an effective model FLOPs utilization (EMFU) of 57%, 55%, and 45%, respectively.

This post builds on Part 1, which showed that Ironwood can scale DeepSeek-V3 training to 8,192 chips connected entirely by ICI, and laid the groundwork with FP8 quantization and custom kernels. However, as we scaled from 2k to 8k chips, each device processed fewer sequences per step, so the TensorCores often sat idle during ICI communication and per-chip throughput dropped.

In this post, we show how we eliminated those stalls by fully utilizing Ironwood's ICI while pushing memory and compute efficiency even further. First, we introduce batch-split scheduling, which keeps ICI links saturated and hides both token and weight communication under compute even at 8,192 chips. With communication no longer stalling the chip, we turn to memory and compute efficiency. We cut high-bandwidth memory (HBM) usage by sizing ragged MoE activation buffers for the tokens that actually exist, and we eliminate wasted HBM traffic, such as unpacking low-precision tokens and relayout copies, so that HBM bandwidth goes to useful work. Finally, we push our custom kernels further by fusing data movement and quantization directly into the grouped matmul (GMM) and attention kernels to keep the TensorCores running at peak efficiency.

The post wraps up with our takeaways for anyone pretraining a large MoE model on TPUs. Without further ado, let's dive in!

Batch-split scheduling

Why it's needed

Speeding up end-to-end pretraining means pushing strong scaling as far as possible. The global batch is fixed, so adding chips divides the same work more finely (Figure 1). Each chip however still needs to do almost the same amount of communication, even though compute is decreasing. This communication is hardest to hide at 8,192 chips, where each device processes a per-device batch size (PDBS) of just one sequence per step in our benchmark.

image6 Figure 1. Strong scaling with a fixed global batch. Each device processes fewer sequences per step as chips are added, so there is less compute to hide weight communication under.

Two kinds of communication have to overlap with that shrinking amount of compute per device:

  1. Weight communication (from fully sharded data parallelism, or FSDP). Expert weights dominate the model, and every layer all-gathers them before use. This cost does not decrease as we decrease PDBS, so at one sequence per device it has the least compute to hide under.
  2. Token communication (from EP). Each MoE layer dispatches tokens to the devices that hold their experts and combines the results afterward. Dispatch and combine sit on the critical path, so any part of them that is not overlapped stalls the TensorCore.

The problem is that reducing one kind of communication increases the other. If we increase the EP degree, the experts are spread over more devices, so each device has fewer weights to all-gather, but the tokens then have to travel across a larger group of devices. On Ironwood's 3D torus, that traffic takes multi-hop paths around a ring, so its cost grows with the size of the EP group. This means that at 8,192 chips, there is no EP degree that hides both kinds of communication without batch-split scheduling (Figure 2). If we use low EP, the weight all-gather for the next layer takes longer than the current layer's compute. If we use high EP, the weight all-gather fits, but dispatch and combine can no longer be overlapped under expert computation, which is typically how they are hidden.

image9 Figure 2. With low EP, the next layer's weight all-gather outlasts the layer's compute. With high EP, the weight gather fits but token dispatch and combine are exposed. Illustrative, not to scale.

Since we need high EP to make the weight communication fit under each layer's computation, we need a way to hide token communication under more than just expert computation. Batch-split scheduling is how we do this.

4 steps to batch-split

We can simplify an MoE layer to four main stages: attention, token dispatch, expert computation, and token combine. These four stages form one dependency chain, where each stage needs the previous stage's output. The layer weights also need to be all-gathered at some point before being used in the layer. We build the batch-split schedule up from these parts one step at a time.

Start with a single sequence per device and no pipelining (Figure 3), where each layer all-gathers its weights right before they are needed. The TensorCore sits idle while waiting for either the weights to be all-gathered or the tokens to be communicated (or both!). Thus, neither the TensorCore nor the SparseCores, which handle the token and weight communication over ICI, are well utilized.

image8 Figure 3. One sequence per device with unpipelined weight all-gathers. The TensorCore (TC) idles while SparseCore 1 (SC1) all-gathers attention and expert weights within the layer, and while SparseCore 0 (SC0) dispatches and combines tokens.

1. Pipeline weight communication

Pipeline the weight all-gathers across layers (Figure 4). Because the weights are known at the beginning of the training step, we can prefetch the next layer's weights on SparseCore 1 while the current layer runs. Weight communication now finishes completely under the layer's computation, removing all weight stalls from the critical path. The TensorCore now only waits for token dispatch and combine.

image17 Figure 4. Weight all-gathers pipelined across layers. SparseCore 1 prefetches the next layer's weights during the current layer, eliminating weight stalls and leaving only token dispatch and combine exposed.

2. Microbatch

Split each device's batch into two microbatches, each half the size (half a sequence at PDBS 1; see "Final sharding scheme" for how attention handles this), and run them one after the other (Figure 5). Every stage is now half as long, but each microbatch still waits for its own tokens, so the layer takes as long as before. What the split gives us is two chains that do not depend on each other.

image7 Figure 5. Two microbatches of half the size, run back to back. Every stage is half as long, but the TensorCore still idles half the time.

3. Interleave

Interleave the two microbatches, offset by one stage (Figure 6). While microbatch 0's tokens are being dispatched, the TensorCore runs microbatch 1's attention. While microbatch 1's tokens are dispatched, it runs microbatch 0's experts, and microbatch 0's results are combined while microbatch 1's experts run. Each of those transfers now has a full stage of the other microbatch's compute to hide under. Only microbatch 1's combine is left exposed, because the layer has no compute left to run.

image15 Figure 6. Interleaved microbatches. Dispatch and combine hide under the other microbatch's compute, except microbatch 1's combine at the end of each layer.

4. Shift

Shift the next layer's microbatch 0 (MB0) attention to execute at the end of the current layer during microbatch 1 (MB1) combine (Figure 7) to eliminate all TensorCore idle time! Now, every token transfer is hidden, and we get full utilization of both the TensorCore and the SparseCores. The next layer's attention weights are now needed before the rest of its weights, so we all-gather them first.

image5 Figure 7. MB0 attention moved into the end of the previous layer, overlapping with MB1 combine. The TensorCore and both SparseCores are never idle.

Figure 8 summarizes the four steps by putting them on the same time axis. Without batch-split scheduling, the TensorCore and both SparseCores sit idle for part of every layer. In the last step, which is the full batch-split schedule, all three are busy the whole time, and the same layer finishes much sooner. The backward pass uses a similar pattern in reverse, along with reduce-scattering the weight gradients in a pipelined fashion to fully hide weight communication.

image10 Figure 8. Summary of the four steps on the same time axis, showing the same layer at every step. The last step is the full batch-split schedule, where both token and weight communication hide under compute. Illustrative, not to scale.

Final sharding scheme

Because token communication can now hide under the whole layer with batch-split scheduling, we can afford a higher EP degree at PDBS 1. The final sharding scheme on Ironwood's 3D torus (X×Y×Z) is therefore (Figure 9):

  • EP=16 over the X axis and the two chiplets in each chip. Eight chips along X times two chiplets balances compute, token communication, and weight communication at PDBS 1. Extending EP across the two chiplets costs no extra ICI traffic, because ICI links belong to the chip, and it doubles the tokens each expert sees per device, which makes the expert matmuls more efficient.
  • 2D FSDP over the Y and Z axes. Weights are FSDP-sharded over Y and Z (1,024-way at 8,192 chips). Using two torus axes gives the weight collectives twice the ICI bandwidth of a single axis.
  • Disjoint links. Token traffic uses X and the die-to-die (D2D) link; weight traffic uses Y and Z. Under batch-split scheduling, the token links are busy almost all the time, so keeping weight traffic off them avoids contention even with full overlap.
  • All-gather and reduce-scatter for tokens. Dispatch is a token all-gather across the EP group and combine is a reduce-scatter. Unlike a ragged all-to-all, their cost does not change when some experts receive more tokens than others, so load imbalance cannot stall the schedule.
image4 Figure 9. Final sharding on a single 8×Y×Z slice. Each EP group is 8 chips along X with two chiplets each. FSDP spans the Y×Z plane. The two kinds of traffic use different ICI links and different SparseCores.

At PDBS 1 there is only one sequence to split into two microbatches for batch-split scheduling on each device, so each microbatch is half a sequence. Because batch-split scheduling requires both microbatches to be independent, they must come from different sequences, so each device actually processes two half-sequences rather than one full sequence.

Because attention needs a whole sequence, we need to shard the attention phase by at least two. We chose to shard attention heads across the two chiplets of each chip, all-gather the compressed attention latents over the D2D link, and split the work by attention head: each chiplet computes 64 of the 128 heads. The D2D link is extremely fast, so this incurs minimal overhead.

Implementing the schedule

XLA schedules a program for good general-case performance, but it has no notion of two microbatches that must interleave, so we had to enforce this schedule ourselves. To implement the batch-split schedule in JAX and XLA, we had four main problems to solve.

1. Phase ordering

First, we need to stagger the two microbatches and ensure XLA does not fuse the computation of the two microbatches back together. We split each layer's forward pass into eight phases and place optimization barriers between them. XLA must keep the phases in the order we chose but is free to schedule and fuse within each one (Figure 10).

image17 Figure 10. The eight phases of one forward layer. Each dispatch and combine is paired with attention or expert compute from the other microbatch. The backward pass runs the same pattern in reverse.

You will notice four of the phases (1, 3, 6, and 8) are small and do not overlap between microbatches. We did this simply to make scheduling easier, and it has little performance impact since they are so small.

2. Core assignment

Each Ironwood chiplet has one TensorCore and two SparseCores, and each SparseCore runs its collectives one at a time. If token and weight collectives shared a SparseCore, each would queue behind the other. We pin every collective to a single SparseCore in JAX, so token collectives over the EP axes run on SparseCore 0 and FSDP weight collectives run on SparseCore 1.

3. FSDP pipelining

We have described above the need to prefetch weights in the previous layer for use in the current layer and how we also pipeline the gradient reduce-scatters in the backward pass. We implemented this using a hand-written pipelined scan over the 58 MoE layers. Each layer not only does its computation, but it also explicitly all-gathers the weights for the next layer and passes them through the scan carry. We use a custom VJP in JAX to do the same in the backward pass along with the gradient reduce-scatter pipelining.

Our pipelined scan exposed a subtle cost: with one layer per scan step, the scan carry holds the current weights in buffer A while the next layer's weights are gathered into buffer B, and the compiler must copy B into A at every step boundary. Running two layers per scan step lets A and B swap roles (a technique called double buffering), so no copy is needed.

4. Maximum overlap

Phases fix the order of the stages in each layer, but inside each phase XLA still decides where each asynchronous collective starts and where the program waits for it. It often started them later than necessary and waited earlier than necessary, which left communication that should have been hidden partly exposed.

To solve this, we used a custom XLA post-scheduler transform, which is a custom compiler pass, registered from JAX, that runs right after XLA's scheduler (no changes to XLA needed!). Our pass reorders instructions and nothing else, so it cannot change the numerics. It does two primary things:

  • Start collectives early and finish late. Each collective's start is bundled with the cheap operations that prepare its payload, such as bitcasts and FP8 quantization, and moved as early as its data dependencies allow. Each collective's done is bundled with its consumers and moved as late as possible (Figure 11).
  • Order collective starts and dones. Each SparseCore is a FIFO. If two collectives could start at the same point, starting the one whose result is needed later first makes the one needed sooner queue behind it, which stalls the TensorCore. The transform keeps the start order on each SparseCore equal to the order in which results are needed (Figure 12).
image16 Figure 11. The post-scheduler pass. Starts move early together with their payload preparation and dones move late together with their consumers, so TensorCore work runs while the collective is in flight. image11 Figure 12. Each SparseCore runs collectives in order, so starts must follow the order in which results are needed.

After the pass, the next layer's weight gathers start at the very beginning of each layer and finish at its end, and each token collective covers exactly the compute it was meant to hide under!

Hitting peak performance

With communication hidden, step time was now determined by what each TensorCore does, and there were three primary remaining bottlenecks. The first was HBM capacity, which decides whether the backward pass can reuse saved activations or has to recompute them. The second was HBM bandwidth, much of which was going to padding, relayout copies, and token unpacking instead of useful work. The third was TensorCore time, which was often spent in data movement around the matmuls.

HBM capacity: save activations instead of recomputing them

HBM capacity matters in pretraining because we need to store not only weights, gradients, and optimizer state, but also the intermediate activations from the forward pass that the backward pass needs for backpropagation. If these activations fit in HBM, we save them and reuse them. If they do not, we have to rematerialize them by re-running part of the forward pass during the backward pass.

Using EP for dropless MoE models like DeepSeek-V3 requires large ragged activation buffers to store and process the worst-case number of tokens routed to experts that live on each device. For example, at EP=16, each ragged token buffer on each device is sized to 16× the average token load, in case all tokens are routed to the experts that live only on a single device. Saving these large padded buffers across all layers for use in the backward pass simply occupied too much HBM. We used two optimizations to decrease HBM usage while remaining dropless (Figure 13):

  • Iterative MoE. After token dispatch, the gather, expert matmuls, and scatter run in chunks of a tunable number of tokens rather than processing the worst-case number of tokens at one time. This smaller token buffer is reused in each iteration of the MoE computation until all tokens routed to the device are processed. We tuned the buffer to be three times the average load in our runs, which was enough to never actually need to loop. This brought the HBM usage for each ragged buffer from 16× to 3× the average number of tokens per device.
  • Shared ragged activation bank for all layers. We further reduced the memory needed to checkpoint the ragged activation buffers (i.e., save them for the backward pass) by using a shared activation bank for all layers' tokens. Saving a padded buffer for each of the 58 MoE layers wastes memory, even if each buffer is 3× the average load rather than 16×. Instead, one large buffer is shared by all layers, and every layer writes only its valid rows at a running offset. Because the total over 58 layers stays close to 58 times the average per-layer load, we were able to size the bank to the equivalent of 1.2× the average load per layer rather than 3×. If a layer did overflow, its rows would go to scratch space and be recomputed in the backward pass, but in practice this did not happen because we tuned the bank size properly.
fig10-moe-memory (1) Figure 13. Top: iterative MoE sizes ragged buffers for 3× the average load instead of the 16× worst case while staying dropless. Bottom: one shared activation bank replaces 58 padded per-layer buffers.

HBM bandwidth: move only the bytes that matter

Gathering tokens to prepare them for efficient expert matmuls (and scattering them after) is surprisingly expensive if not done carefully. Normally, tokens are stored as a 2D [B, D] array, so one (8, 128) tile holds slices of eight different tokens. When the token is in BF16 or FP8, a single tile holds even more tokens due to packing. Therefore, moving a single token takes strided memory operations and relayouts, which uses HBM bandwidth poorly.

Storing tokens as [B, D/128, 128] makes each token a contiguous run of whole tiles, and moving it becomes a single direct memory access (DMA) operation (Figure 14). Almost everything the MoE layer does to tokens moves them individually, so this optimization greatly improves HBM bandwidth utilization. This also removes the need to use the SparseCores for token gathering and scattering. SparseCores can move much smaller packets of data at a time, which makes strided memory operations less costly, but they have less HBM bandwidth than the TensorCore and are already fully occupied with ICI communication. With whole-tile tokens, it is much more efficient for us to run the token gathers and scatters on the TensorCore.

image13 Figure 14. 3D tokens align every token to whole tiles, so sorting or gathering a token is a single DMA.

Two smaller changes removed the rest of the wasted traffic:

  • Don't store zeros. Ragged buffers always contain padding, but every consumer reads only the valid rows. We allocate them uninitialized and make every MoE operation ragged, so nothing touches the padding. Kernels write outputs in place wherever possible.
  • Make the shape force the layout. The compiler's default tiling for 2D arrays differs from the (8, 128) tiling our kernels and the SparseCore collectives use, and layouts do not propagate through loop carries or saved activations, so every boundary became an expensive relayout copy. Carrying buffers as [N/8, 8, D] forces the tiling we want, and reshaping to 2D inside a kernel is pretty much free.

TensorCore time: fuse data movement into compute

The last bottleneck was TensorCore time. Around each matmul, there were gathers, scatters, and quantization steps, and each one was a round trip through HBM. Fusing them into the kernels keeps the data closer to the TensorCore and reduces TensorCore stalls.

Fused expert kernels. After moving the token gathers and scatters from SparseCore to TensorCore, we could fuse them into the matmul kernels themselves (Figure 15). The first GMM gathers its input rows straight from the dispatched tokens, then applies SwiGLU, the routing weight, and FP8 quantization before writing into the activation bank. The second performs the top-k scatter-add as it writes its output. The permuted token buffer never exists in HBM: token gather and scatter latency nearly disappears, and the matmuls barely slow down.

image3 Figure 15. One routed-expert MLP as two fused kernels, built on Tokamax's GMM v2. Data movement and quantization happen inside the kernels' on-chip memory.

Attention. DeepSeek-V3's multi-head latent attention (MLA) uses different head sizes for queries and keys (192) than for values (128), which forced non-square tiles in splash attention and disabled the causal diagonal skipping that Part 1 describes. We extended diagonal skipping to non-square tiles and made the backward pass accumulate query gradients on-chip and skip masked work. We also replaced the query, key, and value up-projections with fused kernels that normalize, quantize to FP8, and apply rotary embeddings in on-chip memory, writing their outputs directly in the layout that splash attention consumes, so no transposes are needed.

Summary

In this post, we showed how we pushed DeepSeek-V3 pretraining on Ironwood toward peak performance, even at 8,192 chips where each device processes just one sequence per step. We started with batch-split scheduling, which interleaves two microbatches so that the token communication of one microbatch overlaps with the compute of the other, and prefetches each layer's weights in the previous layer so that weight communication is hidden as well. This allowed us to use a higher EP degree of 16 and to keep token and weight traffic on separate ICI links and separate SparseCores. To implement the schedule, we used phase ordering, core assignment, FSDP pipelining, and a custom XLA post-scheduler transform to maximize overlap. With communication hidden, we then optimized the three remaining bottlenecks: HBM capacity, HBM bandwidth, and TensorCore time.

Altogether, these optimizations allowed our DeepSeek-V3 671B benchmark runs to reach target quality on 2,048, 4,096, and 8,192 Ironwood chips at 4,997, 4,790, and 3,689 tokens/sec/chip and an EMFU of 57%, 55%, and 45%, with every run inside a single ICI domain.

Here are our main takeaways for anyone pretraining a large MoE model on TPUs:

  • When one stream cannot hide communication, interleave two. When compute and communication form a single dependency chain, the TensorCore has to idle while tokens are in flight, especially if pipelining is not enough. Splitting the batch into two interleaved microbatches lets us hide each microbatch's communication under the other's compute.
  • Size ragged buffers for the tokens that exist. Dropless MoE routing does not have to mean worst-case buffers. By running the MoE computation in chunks and saving activations into a single bank shared by all layers, we kept padding small enough to save activations in HBM rather than recompute them in the backward pass.
  • Align tokens to whole tiles. Almost everything the MoE layer does to tokens moves them individually. Storing tokens as [B, D/128, 128] makes each token a contiguous run of whole tiles, so we can move it with a single DMA instead of strided memory operations and relayouts.
  • Fuse data movement into compute. Every gather, scatter, and quantization step around a matmul is a round trip through HBM. We fused these steps into the GMM and attention kernels, which keeps the data closer to the TensorCore and reduces TensorCore stalls.

See the code

The implementation of all of these techniques described in this post for the DeepSeek-V3 benchmark can be found in MaxText.

Acknowledgments

This work was a collaboration across many engineering and program teams. This post builds directly on the work described in Part 1, which provided the DeepSeek-V3 training recipe, the FP8 recipe, and the infrastructure that the batch-split schedule plugged into. We would like to thank the following core contributors:

Kevin Wang, Jesse Lu, Caitlin Stanton, Daniel Mandragona, Ran Ran, Matt Davidow, Nuojin Cheng, Shuning Jin, Suraj Kolla, Zhengxian He, Shuwen Fang, Snehal Verma, Amanda Tomlinson, Burkay Donderici, Mohamed Omar, Vipul Aneja, Cory Kleinheksel, Xiongfei Wei, Ani Udipi, Vaibhav Singh, Jet Jiang, Andi Gavrilescu, Durlabh Malik, Deepak Patil, Carlos Araya

We also thank the JAX, XLA, Tokamax, and TPU Performance teams who worked closely with us.

posted in: Previous Next Related Posts Benchmarking MoE Training on Ironwood, Part 1: Scaling to 8K Chips AI Cloud Case Studies How-To Guides

Benchmarking MoE Training on Ironwood, Part 1: Scaling to 8K Chips

NOV. 30, 2026
From Files to Cited Answers in One API Call: Managed Ingestion and SearchDocuments in Agent Retrieval Gemini AI How-To Guides Learn

From Files to Cited Answers in One API Call: Managed Ingestion and SearchDocuments in Agent Retrieval

NOV. 24, 2026
Did the user ask for this? Securing AI agents against intent hijacking with Semantic governance policies AI Cloud Case Studies Solutions

Did the user ask for this? Securing AI agents against intent hijacking with Semantic governance policies

NOV. 23, 2026