Technical GUIDE
GPU vs TPU for AI
GPUs and TPUs are the two main families of chips used to train and run modern AI models.
Listen to this guideAI-narrated · ~8 min
On this page9 min read
Overview
GPUs, led by NVIDIA, are programmable parallel processors with a very large software ecosystem, while TPUs are Google's custom chips built around big matrix-multiply units and rented through Google Cloud. The better choice depends on the model, the software stack and the scale of the job.
Key takeaways
- A TPU is a Google-designed ASIC built around systolic matrix units, while a GPU is a programmable parallel processor with Tensor Cores for matrix math.
- Google has used TPUs in its datacenters since 2015, and the first chip was an 8-bit inference-only design with a 65,536-cell matrix unit.
- NVIDIA's H100 tensor throughput figures are quoted with structured sparsity, so dense throughput is about half the headline number.
- Google's own guidance favors TPUs for large, matrix-heavy models with big batches and GPUs for models with many custom operations.
- Ironwood, announced in April 2025, is Google's first TPU designed specifically for inference, with 192 GB of memory per chip.
Deep Dive
A graphics processing unit (GPU) is a chip with many small arithmetic cores that was first built to draw pixels in parallel and was later opened up for general computing. A tensor processing unit (TPU) is an application-specific integrated circuit (ASIC), meaning a chip designed for one class of work, that Google built to accelerate neural networks. Both speed up the same central operation of deep learning, multiplying large grids of numbers called matrices, but they make different trade-offs. GPUs keep broad programmability and are sold to anyone; TPUs trade some flexibility for dense matrix throughput and energy efficiency, and outside Google they are rented through Google Cloud rather than bought.
A modern NVIDIA data-center GPU is a collection of streaming multiprocessors (SMs), each of which runs many threads at once. NVIDIA's Hopper architecture write-up says the H100 SXM5 has 132 SMs with four Tensor Cores each, 528 in total. A Tensor Core is a block that performs a small matrix multiply-accumulate in one step at reduced precision. Hopper adds a Transformer Engine that chooses, layer by layer, between 8-bit floating point (FP8) and 16-bit math. The chip has 80 billion transistors on TSMC's 4N process. Programmers reach all of this through NVIDIA's CUDA programming model, and frameworks such as PyTorch call CUDA libraries for them, which is why most published research code runs on GPUs with no changes.
A TPU puts most of its silicon into matrix units (MXUs) arranged as a systolic array, a grid of multiply-accumulate cells that pass numbers to their neighbors on every clock tick so data flows through the grid instead of going back to memory after each step. Google Cloud's architecture page says MXUs are 128 by 128 cells on TPU v5p and earlier, about 16,000 multiply-accumulates per cycle, and 256 by 256 on TPU v6e and the seventh generation. Each TensorCore on the chip also has a vector unit for operations such as activations and softmax and a scalar unit for control flow. Programs do not target the chip directly: the XLA compiler turns the linear-algebra parts of a JAX, TensorFlow or PyTorch graph into TPU machine code, and the rest runs on the host computer. Chips are wired into slices and pods by a dedicated inter-chip interconnect (ICI).
The history explains the split. The first TPU paper, presented at ISCA 2017, describes an inference-only chip in service since 2015 with a 65,536-cell 8-bit matrix unit, 92 trillion operations per second at peak and 28 MiB of on-chip memory. Its authors report that it ran about 15 to 30 times faster than a contemporary NVIDIA K80 GPU or Intel Haswell CPU on Google's production workloads, with 30 to 80 times better performance per watt. Later generations added training. Google's bfloat16 article explains that TPU v2 and v3 multiply in bfloat16, a 16-bit format with the same 8-bit exponent as 32-bit floats, and accumulate in 32-bit precision. The 2023 TPU v4 paper describes a 4,096-chip supercomputer linked by optical circuit switches and reports it 1.2 to 1.7 times faster than an NVIDIA A100 system of similar size while using 1.3 to 1.9 times less power. In April 2025 Google announced Ironwood, quoting 4,614 peak FP8 teraflops and 7.37 TB/s of memory bandwidth per chip and 42.5 exaflops for a 9,216-chip pod.
Comparing headline numbers needs care. NVIDIA lists the H100 SXM at 3,958 FP8 teraflops and 1,979 BF16 teraflops, but those figures assume structured sparsity, a pattern in which half the weights are zero; the Hopper write-up confirms sparsity doubles the dense rate, so dense FP8 is about half the listed figure. Google's pod figures are theoretical peaks, and vendor benchmarks are chosen by the vendor. The TPU v4 versus A100 comparison, for example, comes from Google's own paper. Real speed depends on how well a model keeps the matrix units busy, how much data moves between chips and how mature the compiler is for that model. Independent tests on the actual workload are the only reliable guide.
Google's own guidance is a useful decision rule. Its introduction to Cloud TPU recommends TPUs for models dominated by matrix math, models without custom operations inside the training loop, models that train for weeks or months, large models with large batch sizes, and models with very large embeddings such as ranking and recommendation. It recommends GPUs for models with many custom PyTorch or JAX operations, models that use operations TPUs do not support, and medium to large models. It recommends CPUs for quick prototypes, small models and jobs limited by input or network speed. It also lists what TPUs handle poorly: code with frequent branching, many element-wise operations, high-precision arithmetic, and custom operations in the main loop.
Each option also has failure modes. On TPUs, shapes that do not tile neatly onto the 128 or 256 grid waste capacity, and the same Google page notes memory performs best with dimensions that are multiples of 8. Every program must pass through the XLA compiler, so debugging relies on compiler tools rather than the CUDA profilers most practitioners already know. On GPUs, peak throughput also depends on using Tensor Core-friendly precisions and shapes, and multi-GPU training relies on fast links such as NVLink, which tops out at 900 GB/s per H100. Lock-in cuts both ways: CUDA code does not run on TPUs, and TPU access is limited to Google's cloud and Google's own products.
In practice the requirements differ more than the arithmetic. A GPU can be bought, rented from many clouds or installed in a workstation, and an H100 SXM draws up to 700 W. A TPU is reached through Google Compute Engine, Google Kubernetes Engine or Google's managed AI platform, and large jobs are sized in slices of chips; Google says a full Ironwood pod draws nearly 10 megawatts. For a small team, the deciding questions are usually which framework the code already uses, whether it relies on custom kernels, and which provider offers the needed capacity at an acceptable price on the day.
04Worked example
Deciding whether a layer is compute-bound or memory-bound
Pick one layer, for example a 4,096 by 4,096 weight matrix applied to a batch of 8 tokens in bfloat16.
Count operations: 2 x 8 x 4,096 x 4,096, about 268 million floating-point operations.
Count bytes moved: the weights alone are 4,096 x 4,096 x 2 bytes, about 33.5 million bytes, plus small inputs and outputs.
Divide to get arithmetic intensity: roughly 8 operations per byte.
Compute the chip's balance point: dense BF16 throughput divided by memory bandwidth, about 989 trillion divided by 3.35 trillion, or roughly 295 operations per byte for an H100 SXM.
Compare: 8 is far below 295, so this layer is memory-bound, and raising the batch to several hundred tokens would move it toward the compute limit.
What it shows
The learner ends up with a simple roofline estimate that predicts whether faster arithmetic or more memory bandwidth will help. It can be checked by timing the layer at batch sizes of 8, 64 and 512 and watching throughput rise until it flattens near the compute limit.
Real-World Implementation
Google has run TPUs in its own datacenters since 2015. The 2017 ISCA paper on the first-generation chip says it served production neural networks representing about 95% of Google's datacenter inference demand at the time.
Teams that train in PyTorch with custom CUDA code commonly use NVIDIA H100 GPUs, whose SXM version pairs 80 GB of memory at 3.35 TB/s with 900 GB/s NVLink connections between GPUs.
Recommendation and ranking models with huge embedding tables are a documented TPU fit. The TPU v4 paper reports that its SparseCores speed embedding-heavy models by 5x to 7x while using about 5% of die area and power.
Google designed its seventh-generation TPU, Ironwood, announced in April 2025, specifically for inference on large language and mixture-of-experts models, with 192 GB of high-bandwidth memory per chip and pods of up to 9,216 chips.
An H100 can be split into up to seven isolated Multi-Instance GPU slices of 10 GB each, so one card can host several small inference services or student notebooks at the same time.
The Future of GPU vs TPU for AI
The gap between the two designs has narrowed. GPUs added dedicated matrix hardware and lower-precision formats, and TPUs added larger memories, sparse-workload cores and support for PyTorch through XLA. Google's April 2025 Ironwood announcement framed the newest TPU as built first for inference, reflecting how serving large models, not only training them, now drives chip design. NVIDIA's Hopper material makes a similar point with its Transformer Engine for FP8. Open problems are mostly about systems rather than single chips. Large jobs spread across thousands of accelerators are limited by interconnect bandwidth, memory capacity and power delivery; the TPU v4 paper argues that optical circuit switching kept networking under 5% of system cost, while a full Ironwood pod is quoted at nearly 10 megawatts. Software portability is the other open question. Compilers such as XLA aim to let one model run on many back ends, but custom kernels still tie code to a vendor. Published comparisons will likely keep coming mostly from vendors. Readers should look for dense rather than sparse figures, matching precision, equal system size and full end-to-end workloads before treating any speedup claim as settled.
Putting it into practice
Why it matters
- Cost and budget. Architecture decisions drive performance and operating cost for years.
- Clearer decisions. Technical education helps teams choose the right stack, not just the newest one.
- Quality control. Better engineering choices reduce reliability incidents in production.
Watch out for
- Optimizing one benchmark can hide broader system weaknesses.
- Infrastructure and maintenance costs are often underestimated.
- Security and observability gaps can grow as systems become more complex.
Next steps
- Define latency, quality, and cost targets before implementation.
- Benchmark under realistic load and data conditions.
- Instrument monitoring for errors, drift, and user impact.
- Prepare rollback and incident response paths before scaling.
Sources and further reading
- arXiv (ISCA 2017)In-Datacenter Performance Analysis of a Tensor Processing Unit
- arXiv (ISCA 2023)TPU v4: An Optically Reconfigurable Supercomputer for Machine Learning with Hardware Support for Embeddings
- Google CloudIntroduction to Cloud TPU
- Google CloudTPU architecture
- GoogleIronwood: The first Google TPU for the age of inference
- Google Cloud BlogBFloat16: The secret to high performance on Cloud TPUs
- NVIDIANVIDIA H100 Tensor Core GPU
- NVIDIA Technical BlogNVIDIA Hopper Architecture In-Depth
Keep Exploring
Free newsletter
Keep up with AI in 3 minutes a day
One short email each weekday with the three AI stories that actually matter. Free forever, no ads.
One email each weekday. Unsubscribe in one click. We never sell or share your address.
Test yourself
Take the GPU vs TPU for AI quiz
Instant feedback on every answer, and a shareable certificate with a verifiable ID once you pass a course.
Support free AI education. AI Understanding is a 501(c)(3) nonprofit — no ads, no paywall, ever. Make a donation
Frequently asked questions
What is GPU vs TPU for AI?
GPUs and TPUs are the two main families of chips used to train and run modern AI models. GPUs, led by NVIDIA, are programmable parallel processors with a very large software ecosystem, while TPUs are Google's custom chips built around big matrix-multiply units and rented through Google Cloud. The better choice depends on the model, the software stack and the scale of the job.
Which frameworks does the guide list as supported for Cloud TPU workloads?
Google Cloud documentation describes TPU support through JAX, TensorFlow, and PyTorch/XLA, so TPU workflows are not limited to one framework.
Who designs the TPU?
The Tensor Processing Unit is a custom chip (ASIC) designed by Google specifically for neural-network workloads.
What core hardware structure makes TPUs efficient at matrix multiplication?
TPUs use a systolic array where data flows through a grid of multiply-accumulate cells, passing results directly between them and reducing memory traffic.
Which system factors can affect a GPU-versus-TPU performance comparison?
The guide says relative performance depends on the model, framework, hardware generation, memory, interconnects, utilization, and deployment environment.
What is a practical strength of GPUs relative to TPUs for many teams?
CUDA and its libraries support a wide range of GPU workflows, but the best platform depends on software, workload, and measured system performance.
Keep learning
Related guides
More guides picked for this topic