Enki

Google's MaxText now trains LLMs on 14 million token sequences on TPUs

By

Published

Reporting from InfoQ AI

More onGoogle

Google's JAX framework can now split one training sequence across a TPU slice. The benchmarks are Google's own, on one 8B model. Enki priced the slice.

What it means for founders

Enki's arithmetic: Google's 64-chip test slice costs $768 an hour on demand on Ironwood and $268.80 on TPU v5p, so a ten-hour run is $7,680 or $2,688 before storage and networking. Ironwood costs 2.9 times as much per chip-hour. Google published no step times or tokens per second, so its MFU figures alone cannot tell you which chip is cheaper per trained token.

Most startups should wait. If you call a hosted model through an API, nothing here touches your bill. The case for very long context is also contested: Enki's story on Nvidia's "You don't need long context" paper covered researchers who found frontier models lost little accuracy when agents compacted their context, at several times lower estimated serving cost. Before paying to train for 14 million tokens, test whether compaction or file search gets the same answers.

Enki's read: the lock-in is real. MaxText runs on GPUs, as Nvidia's work shows, but these results and the Splash Attention kernel they run on are TPU work. More on Google's chips and models is on Enki's Google news page.

What we don't know yet

Google has not published wall-clock training times, throughput or cost per run. Its results cover one 8B model, with no figures for larger or mixture-of-experts models at these lengths. It measured chip efficiency, not how well a model trained at 14 million tokens actually uses that context. Google listed recipes for each model and context length on TPU 5p and TPU 7 as future work, without a date.

The story

Google's open-source JAX framework MaxText can now train a model on one sequence of 14 million tokens, split across a slice of Cloud TPU chips. The feature shipped in MaxText v0.2.4 and was announced on Google's developer blog on 9 November; InfoQ covered it on 28 November. On TPU 5p, Google says Llama 3.1 8B used 70% of the chips' peak compute on model maths (Model FLOPs Utilization, or MFU) for sequences as long as 4 million tokens.

"Training at those lengths, not just serving them, is where the system limits show up," Google's engineers wrote. For a founder fine-tuning an open model on whole repositories or hours of video, this is a free, documented recipe for the training half, as long as you rent Google's chips.

Four ways to split one sequence

The wall is memory. Attention compute grows with the square of the sequence, and activations and the key-value cache grow in step with it. Context parallelism spreads one sequence over many chips so no chip holds all of it.

MaxText offers four strategies, all built on Splash Attention, an attention kernel in Tokamax, the open-source library of TPU kernels Google maintains:

  • All-gather: each chip collects every other chip's keys and values at each layer. Google calls it the standard baseline when those fit in memory.
  • All-to-All (DeepSpeed Ulysses): chips swap heads for tokens. The number of chips it can use is capped by the model's head count; under grouped-query attention that is eight KV heads for Llama 3 8B.
  • P2P (ring attention): chunks of keys and values pass from chip to neighbouring chip while each one computes. Google calls it "the primary workhorse" once sequences get really long.
  • USP: a hybrid of the last two, one on each of two mesh dimensions.

A flag, `context_parallel_strategy`, picks ring, Ulysses or USP, you set the context-parallel size, and the blog says the rest of the run stays the same.

The numbers are Google's, on one model

On a 64-chip TPU 5p slice, Google says that in ideal settings, with large enough chunks and batch sizes, ring attention can beat all-gather at almost every length from 64K to 14 million tokens. At 14 million tokens on 64 chips, ring attention reached 48.7% MFU on Ironwood, Google's TPU 7, against 37.1% on TPU 5p, which Google puts down to Ironwood having twice the high-bandwidth memory per chip. Below 6 million tokens, TPU 7 held about 50% MFU.

These are Google's tests on one 8-billion-parameter model, and Enki found no independent reproduction. The post also gives two different head dimensions for its Llama 3.1 8B setup, 25 in one place and 256 in another.

What Enki checked

Enki read the MaxText releases page on GitHub on 28 November. The project is already on v0.2.6, which adds a "Halo" sliding-window context parallelism mode for models including Gemma 2, 3 and 4, GPT-OSS and OLMo 3. That covers one gap Google listed as future work on 9 November.

In February, Nvidia's technical blog described training Llama 3 8B in MaxText with ring attention on GB200 NVL72 systems at up to 256K tokens, and reported speedups of up to 36% at that length from its NVSHMEM library over NCCL. Nvidia reported TFLOP/s per GPU, not MFU, so the figures do not line up.

Enki also checked Google's Cloud TPU pricing page on 28 November. On demand, an Ironwood chip costs $12.00 an hour in Iowa and a TPU v5p chip $4.20 in Columbus. Three-year commitments cut those to $5.40 and $1.89.

Sources

Reporting

More in Research

How Enki covers newsCorrectionsReport an error