Handbooks  /  GPU vs TPU
Engineering~8 min readComparison
Head to Head

GPU vs TPU: flexible, or purpose-built?

GPUvsTPU

A TPU can be more efficient than a GPU at the exact operation that dominates transformer training — matrix multiplication — because it was built around nothing else. That specialization is also exactly why it's the wrong choice the moment your workload steps outside it.

01

The one distinction that decides everything

A GPU (Nvidia, dominant via the CUDA ecosystem) is a general-purpose massively-parallel processor — originally built for graphics, now the default for nearly all AI workloads. A TPU (Google's Tensor Processing Unit) is an ASIC — application-specific silicon — purpose-built around a systolic array optimized specifically for matrix multiplication, available only on Google Cloud.

→ The rule

Need framework flexibility, custom kernels, or multi-cloud portability? GPU — that's the entire industry's default. Already on GCP running large, well-understood matmul-heavy training at scale? TPU is worth evaluating.

02

Head to head

DimensionGPUTPU
DesignGeneral-purpose parallel compute (SIMT cores)Purpose-built systolic array for matmul
AvailabilityEvery cloud, on-prem, consumer cardsGoogle Cloud only
Software ecosystemCUDA — universal framework support, largest ecosystemXLA/JAX-first; PyTorch support improved but secondary
Best atFlexible — training, inference, custom kernels, researchLarge-scale, matmul-heavy training at Google-scale
InterconnectNVLink (node), InfiniBand (cross-node)Custom high-bandwidth pod interconnect, built for pod scale
Custom architectures / kernelsHigh flexibility — CUDA lets you write anythingLower — best within XLA-compilable ops
Who actually uses itEssentially the entire industry outside GooglePrimarily Google, plus GCP customers who buy in
03

When to use each

Reach for GPU

  • Default choice for almost everyone
  • Need framework flexibility and custom architectures
  • Multi-cloud portability matters
  • Ecosystem (pretrained checkpoints, tutorials, tooling) assumes CUDA

Reach for TPU

  • Already on GCP
  • Training well-understood, transformer-shaped workloads at large scale
  • XLA compilation overhead pays off at your scale
  • Want Google’s specific pod-scale interconnect economics
04

Not really a per-run combination — but often a per-stack one

A single training run happens on one or the other, not both. But many teams DO use both across their overall stack — train on TPU pods for cost/scale where the workload fits, while keeping GPU infrastructure for portability, edge deployment, or the parts of the pipeline (research iteration, custom kernels) that don't fit TPU's constraints well. Frameworks like JAX increasingly aim for code portability across both, turning this into more of an infra/cost decision made per workload than a full rewrite each time.

→ The practical reality

Most organizations outside Google default to GPU for everything, because the ecosystem cost of stepping outside CUDA usually outweighs a TPU's raw efficiency advantage on any single workload.

05

Why the systolic array is specifically good at matmul

The architectural reason a TPU is efficient for large matrix multiplies is the systolic array: a grid of multiply-accumulate units where data flows through the grid and each loaded weight gets reused across many computations before being evicted, rather than being fetched from memory again for each use. Since matrix multiplication IS mostly repeated multiply-accumulate operations over the same operands, this design minimizes the memory-bandwidth pressure for exactly the operation that dominates transformer training and inference — and memory bandwidth, not raw compute, is very often the actual bottleneck in large-scale training.

A GPU's tensor cores also accelerate matmul well, but the GPU as a whole is a more general SIMT (single-instruction-multiple-thread) processor that wasn't built around ONLY that operation — which is exactly why it remains better for the long tail of non-matmul, custom, research-oriented workloads: novel attention variants, custom loss functions, sparse operations, anything that needs a hand-written CUDA kernel rather than compiling cleanly through XLA. The TPU's specialization is a real efficiency win precisely where the workload matches it, and a real limitation the moment it doesn't.

→ The trade you’re actually making

A TPU trades general-purpose flexibility for efficiency at one specific operation — worth it exactly when your workload IS that operation, at scale, and a liability the moment your workload needs something XLA can't compile cleanly.

06

A worked scenario: research iteration, then production-scale pretraining

A lab designing a new transformer architecture with experimental custom attention kernels wants GPUs — during this phase, the ability to write and iterate on custom CUDA kernels while the architecture itself is still changing is worth more than raw matmul efficiency, because the workload isn't yet a fixed, well-understood shape a systolic array is optimized for.

Once that architecture is settled and the lab is running repeated, large, well-understood pretraining passes of the now-finalized architecture — a workload that IS mostly large matrix multiplies, at Google-infrastructure scale — TPU pods' cost/performance for that specific, now-stable, matmul-heavy workload becomes genuinely attractive, if the lab is already on GCP. The right accelerator tracks how settled and matmul-shaped the workload has become, not a fixed rule about which is "better."

→ The pattern generalizes

Flexibility matters most while the workload is still changing. Specialization pays off once the workload has stopped changing and matches exactly what the specialized hardware was built for.

Frequently asked

Quick answers

GPU or TPU — which should I use?

Default to GPU — it’s available everywhere, has the largest software ecosystem, and supports custom architectures and kernels. Consider TPU only if you’re already on Google Cloud and training a large, well-understood, matmul-heavy workload where XLA compilation overhead pays off.

Why is a TPU efficient specifically for AI training?

Its systolic array architecture reuses each loaded weight across many multiply-accumulate operations before evicting it, minimizing memory-bandwidth pressure for matrix multiplication — the operation that dominates transformer training and inference.

Can I run PyTorch on a TPU?

Yes, PyTorch/XLA support has improved substantially, but TPUs remain a JAX/XLA-first ecosystem. GPU’s CUDA ecosystem still has broader, more mature framework and tooling support across the board.

Is a TPU always faster than a GPU for AI?

No — only for workloads that are large-scale, matmul-heavy, and XLA-compilable. For custom kernels, novel architectures still being iterated on, or workloads outside that shape, a GPU’s general-purpose flexibility wins.

GPU vs TPU · Vibe Engines · 2026
Finished this one? 0 / 115 Handbooks done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.