DEV Community

Viswaretas Kotra
Viswaretas Kotra

Posted on Originally published at nodus-compute.ai

GPU vs TPU: which is better for training LLMs?

For most teams training LLMs, NVIDIA GPUs are the better default, because PyTorch, CUDA and almost every training library target them first and many providers sell them by the hour. Nodus runs training on NVIDIA GPUs, and an H100 listed at $2.60/hr on the Nodus pricing page works out to $2.63 per peak PFLOP-hour, against $2.94 for an on-demand Google Cloud TPU v6e. TPUs win when your code is already JAX or TorchTPU, your model is large and dense, and you can keep a 1- or 3-year commitment busy.

This post compares software, price per unit of compute, the cost of a complete run and availability. The prices come from the Nodus pricing page and the Google Cloud TPU pricing page. The cost math is a short Python script we ran, and every input is listed so you can swap in your own.

What is the actual difference between a GPU and a TPU?

A GPU is a general parallel processor with tensor cores added. A TPU is an application-specific chip that Google built for the large matrix multiplications at the heart of neural networks. Google's introduction to Cloud TPU says code that runs on TPUs must be compiled by the XLA compiler, which turns the framework's graph into TPU machine code.

That compiler step shapes everything else. On a GPU, PyTorch runs your Python operator by operator, and anything unusual still runs, just slower. On a TPU the program is compiled as a whole, which rewards regular, matrix-heavy models and punishes code that branches a lot.

Google's own guidance is unusually direct. Its docs recommend TPUs for models dominated by matrix math, with no custom operations in the main training loop, that train for weeks or months with large batch sizes. They recommend GPUs for models with many custom PyTorch or JAX operations, and say TPUs are not suited to workloads with frequent branching or high-precision arithmetic.

NVIDIA GPU (H100, H200) Google Cloud TPU (v5e, v6e, v5p, Ironwood)
Where you can run it Most clouds and compute platforms, including Nodus Google Cloud
Main frameworks PyTorch, JAX, almost any library JAX, TorchTPU (PyTorch)
Execution model Eager by default, optional compile Compiled by XLA
Memory per chip 80 GB (H100), 141 GB (H200) 16 GiB (v5e), 32 GB (v6e), 95 GiB (v5p), 192 GiB (Ironwood)
Peak dense BF16 per chip 989.5 TFLOPS (H100, H200) 197 (v5e), 918 (v6e), 459 (v5p), 2,307 (Ironwood)
Pricing on the vendor page Per GPU-hour Per chip-hour, on demand, Flex-start, 1-year or 3-year

Sources: NVIDIA H100 and H200 spec tables (1,979 TFLOPS BF16 with sparsity; dense is half), Google's v5e, v6e, v5p and TPU7x pages. Checked November 27, 2026.

Can you train PyTorch models on TPUs?

Yes, and the path changed in 2026. The old route, PyTorch/XLA, is deprecated: its GitHub repository says it is replaced by TorchTPU, and its repository was set to be archived on November 15, 2026. Google's PyTorch on Cloud TPU page now points new work at TorchTPU, a PyTorch-native backend built with the PyTorch team at Meta.

Google says TorchTPU removes the main pain of PyTorch/XLA, which recorded lazy tensor graphs and often needed code to mark compilable regions. TorchTPU runs eagerly by default, compiles with torch.compile, and supports DDP, FSDP2 and DTensor through its tpu_dist backend. Google lists Hugging Face Transformers, TorchTitan, vLLM and SGLang among the integrations.

That is real progress, but it is new. If your training stack is a mature PyTorch codebase with custom CUDA or Triton kernels, those kernels do not come with you. TorchTPU's custom-kernel route is Pallas, a different kernel language. Budget engineering time for the port and a convergence check, not just a device change.

JAX is the native TPU framework. pip install "jax[tpu]" on a TPU VM is the whole install, per the JAX installation guide. JAX also runs on NVIDIA GPUs, so a JAX codebase can move in either direction more easily than a CUDA-heavy PyTorch one.

If your team writes PyTorch and you are choosing between NVIDIA and AMD instead, our AMD vs NVIDIA for AI guide covers the same ecosystem question for ROCm.

Which is cheaper per unit of training compute?

At list prices, an H100 on Nodus is cheaper per peak FLOP than any on-demand TPU on Google's page, and a committed TPU v6e is cheaper than both. We divided each hourly price by the chip's peak dense BF16 throughput to get dollars per peak PFLOP-hour (one quadrillion operations per second for an hour).

Accelerator List price per hour Peak dense BF16 (TFLOPS) $ per peak PFLOP-hour
H100 (Nodus) $2.60 989.5 $2.63
H200 (Nodus) $3.593 989.5 $3.63
TPU v6e, on demand $2.70 918 $2.94
TPU v6e, 1-year commitment $1.89 918 $2.06
TPU v6e, 3-year commitment $1.22 918 $1.33
TPU v5e, on demand $1.20 197 $6.09
TPU v5p, on demand $4.20 459 $9.15
TPU7x Ironwood, on demand $12.00 2,307 $5.20

Nodus prices are listed per hour on the Nodus pricing page. TPU prices are per chip-hour in the cheapest US region on the Cloud TPU pricing page (us-east1 for v6e, us-east5 for v5p, us-central1 for v5e and Ironwood). Prices checked November 27, 2026.

Dollars per peak dense BF16 PFLOP-hour at list price: H100 on Nodus $2.63, H200 on Nodus $3.63, TPU v6e on demand $2.94, 1-year $2.06, 3-year $1.33, TPU v5e $6.09, TPU v5p $9.15 and Ironwood $5.20.
Per peak FLOP, only a committed TPU v6e undercuts an H100 on Nodus.

Peak FLOPS is a ceiling, not a measurement. Your real throughput is peak times model FLOPs utilization (MFU), and MFU differs between chips, frameworks and models. Treat this table as the price of the ceiling. The next section turns it into a run.

Memory tells a different story. Per GB-hour of accelerator memory, the H200 on Nodus is the cheapest option in the table at $0.0255. The H100 follows at $0.0325, against $0.0442 for TPU v5p and $0.0844 for TPU v6e on demand. A 32 GB v6e chip holds far less than an 80 GB H100. Memory-bound jobs like long-context fine-tuning therefore need more TPU chips, and more sharding, for the same model.

What does a full training run cost on each?

Take continued pretraining of an 8B-parameter model on 10 billion tokens. The standard estimate of 6 x parameters x tokens gives 4.8 x 10^20 FLOPs, or 133.33 PFLOP-hours of useful work. Our script assumes 40% MFU on every chip, which is an illustrative figure, not a measurement.

At that MFU, an H100 needs 336.9 GPU-hours, which costs $876 at the Nodus list price. A TPU v6e needs 363.1 chip-hours: $980 on demand, $686 at the 1-year rate and $443 at the 3-year rate. The same run costs $1,210 on H200, $1,734 on Ironwood, $2,030 on v5e and $3,050 on v5p.

Cost of an 8B-parameter, 10B-token run at an assumed 40% MFU: H100 on Nodus $876, H200 on Nodus $1,210, TPU v6e $980 on demand, $686 at 1-year and $443 at 3-year rates, Ironwood $1,734, v5e $2,030 and v5p $3,050.
At equal MFU, the run is cheapest on a fully used committed v6e and next cheapest on an H100.

The more useful output is the break-even. For an on-demand v6e to tie an H100 on Nodus, it must reach 1.119 times the H100's MFU, about 12% more. Ironwood must reach 1.98 times and v5e 2.318 times. Ironwood is a much larger chip, so the fairer comparison for it is NVIDIA's Blackwell generation, which we have not priced per FLOP here.

So measure before you switch: run the same model for a few hundred steps on each chip and compare tokens per second. If the TPU's MFU advantage does not cover the ratio above, the GPU run is cheaper.

When does a TPU commitment actually save money?

Only when you keep it busy. Google's 1-year and 3-year commitments are billed monthly on reserved quota, per the usage options table, so idle months still cost money. Divide the committed price by the share of hours you actually train to get the real price per peak PFLOP-hour.

Share of committed hours used v6e 1-year v6e 3-year H100 on Nodus
30% $6.86 $4.43 $2.63
50% $4.12 $2.66 $2.63
75% $2.75 $1.77 $2.63
100% $2.06 $1.33 $2.63

Dollars per peak dense BF16 PFLOP-hour, our arithmetic from the prices above.

Effective cost per peak PFLOP-hour by share of committed hours used: TPU v6e 1-year falls from $6.86 at 30% to $2.06 at 100%, 3-year from $4.43 to $1.33, while H100 on Nodus stays at $2.63.
A 1-year v6e commitment needs about 78% use to match an H100 on Nodus, a 3-year one about 51%.

The break-even points are 78% for the 1-year rate and 51% for the 3-year rate, at equal MFU. A lab that trains around the clock clears both easily. A startup that trains in bursts between data work and evals usually does not, and an idle reservation is the most expensive compute there is.

Nodus Jobs are billed from prepaid credit and stop costing compute when they finish or are cancelled. Nodus also checkpoints a Job's state directory while it runs. If the capacity under the Job is reclaimed, the next attempt starts from that checkpoint, so bursty training does not need a reservation to be safe. Our guide to what it costs to train an LLM works through larger budgets.

How easy is it to get TPUs compared with GPUs?

GPUs are easier to get from more places, and TPUs come from one vendor. Cloud TPUs are sold through Google Cloud, via Compute Engine, Google Kubernetes Engine or Google's agent platform, per the Cloud TPU introduction. NVIDIA GPUs are sold by every major cloud and many smaller platforms.

Quota is the first wall. Google's default TPU quotas are 512 v6e cores and 128 v5p cores per project per zone for on-demand use. The auto-approve threshold for more preemptible v6e and v5p quota is 0 cores in all zones, so larger spot requests go through review. Plan for that lead time before a deadline.

The upside of a single vendor is scale inside one fabric. A v5p pod links 8,960 chips and an Ironwood pod 9,216 chips over Google's inter-chip interconnect, per the TPU7x page. If you need thousands of accelerators in one tightly coupled job, that is a genuine strength.

Does ChatGPT use GPU or TPU?

OpenAI's public statements point to NVIDIA GPUs. In their September 2025 joint announcement, OpenAI's president said it has used NVIDIA's platform to create AI systems that hundreds of millions of people use, and the companies planned at least 10 gigawatts of NVIDIA systems.

TPUs are entering the picture. In October 2026, The Information reported that OpenAI plans to buy Google TPUs; TechTarget notes that neither company confirmed it, and that OpenAI's stack is built around PyTorch, CUDA and Triton. The same article says Google trains and serves Gemini on TPUs. Anthropic says it uses TPUs, Amazon Trainium and NVIDIA GPUs together.

Frontier labs run several chip types because at their scale a porting team pays for itself. For a small team, porting time usually costs more than the chip-hour gap.

Where are TPUs the better choice?

TPUs are the better choice in four situations, and in them we would point you to a TPU rather than to Nodus:

  1. Your code is JAX, or plain PyTorch that runs on TorchTPU without custom CUDA kernels.
  2. You train large, dense models for weeks and can keep a 3-year commitment more than about half busy, or a 1-year one more than about 78% busy.
  3. You need thousands of chips in one tightly coupled job, where a TPU pod's interconnect is the product.
  4. Your measured MFU on TPU beats your GPU MFU by more than the break-even ratio above.

Pick GPUs, and Nodus, when your stack is PyTorch with custom kernels, you train in bursts, you fine-tune more than you pretrain, or you would rather not wait on a TPU quota review. If you are weighing Google Cloud for GPUs instead, our Nodus vs Google Cloud GPUs comparison prices that route.

How do you run a GPU training job on Nodus?

Install the CLI, sign in, then submit your training script from its directory. This dry run from the Nodus quickstart prices the job before anything starts:

nodus run --name cli-quickstart --gpu L4 --image nodus/pytorch \
  --max-cost 1 --timeout 10m --no-warm --dry-run \
  --output metrics=/nodus/outputs/metrics.json -- python train.py
Enter fullscreen mode Exit fullscreen mode

Change the name, GPU, cost cap and timeout for your run, then drop --dry-run to start it. A JAX codebase coming off TPUs needs pip install --upgrade "jax[cuda13]" in its image instead of jax[tpu], per the JAX guide. For managed fine-tuning and continued pretraining, the training guide covers TrainingJobs on the nodus/sft runtime.

FAQ

Is a TPU faster than a GPU for training?

Per chip it depends on the generation: Ironwood's 2,307 peak dense BF16 TFLOPS is more than twice an H100's 989.5, while a v6e is slightly below an H100. Wall-clock speed depends on MFU, which only a short benchmark on your own model will tell you.

Can I use TPUs outside Google Cloud?

For most teams, no: Cloud TPUs are sold through Google Cloud services. The Next Web reports that Google said in April 2026 it would sell TPU hardware directly to a small group of customers, which is not something you can sign up for from a pricing page.

Are TPU spot prices cheaper?

Google's TPU pricing page lists no fixed spot rate: it says spot prices are dynamic, can change up to once every 30 days, and are covered on its Spot VMs page. Spot TPUs suit fault-tolerant batch work, so your training loop needs its own checkpoint and restart logic.

Is TensorFlow still a reason to use TPUs?

It is no longer the only first-class path. Google's TPU pages now lead with JAX and with PyTorch through TorchTPU, and its TPU guidance still sends models that need TensorFlow ops missing on Cloud TPU to GPUs.

Originally published on the Nodus blog.

Top comments (0)