GPU vs TPU for Inference: Choosing by Latency, Cost

GPU vs TPU for Inference: Choosing by Latency, Cost

What if the chip that wins every benchmark you have seen is actually the wrong choice for your production system? That is the uncomfortable reality of the GPU versus TPU debate. Both are built to run trained neural networks, both can serve millions of predictions a day, and both come with passionate advocates. Yet the right answer depends far less on raw speed than on how your model is shaped, how strict your latency targets are, and how much freedom you have to pick a cloud.

This article walks through the architecture, the benchmark traps, the cost math, and the practical mistakes that teams make when they choose an inference accelerator. The goal is not to crown a winner. It is to give you a decision framework you can defend to an engineering team and a finance team at the same time.

What Actually Separates a GPU From a TPU?

A GPU is a general-purpose parallel processor. It has thousands of small cores, big register files, and caches, and it is programmable through frameworks like CUDA, ROCm, or HIP. That flexibility means a GPU can run almost any model architecture you throw at it, including exotic attention patterns, custom operators, and models that mix vision and language.

A TPU is closer to an ASIC. It is built around a systolic array, a grid of multiply-accumulate units that pass data from neighbor to neighbor. That design is extremely efficient for dense matrix multiplication, which is the beating heart of most neural networks. The trade-off is that TPUs are programmed through higher-level compilers, originally TensorFlow and later JAX or PyTorch via XLA, and custom operations need to fit that compilation path.

The distinction matters for inference because inference workloads are often less flexible than training. A production model is frozen, its shapes are known, and it runs the same graph millions of times. That predictability is exactly what a systolic array loves.

A Short History That Explains the Hype

Google’s Tensor Processing Unit was revealed publicly in May 2016, though Google later said it had been running in its data centers since 2015. The design was purpose-built for neural-network inference, not general-purpose compute. The first-generation TPU could not train models at all; training support arrived with later generations.

The landmark paper by Jouppi and colleagues, “In-Datacenter Performance Analysis of a Tensor Processing Unit,” reported that TPU v1 delivered roughly 15 to 30 times higher performance than contemporary GPU and CPU baselines on Google’s production inference workloads, with better performance per watt. That number gets quoted constantly. What gets dropped is the caveat: the authors explicitly warned that these were workload-specific comparisons against 2015-era hardware, not a general claim about TPUs beating GPUs forever. Anyone citing the 15 to 30 times figure as a current fact is misreading the paper.

The Benchmark Trap: Why Vendor Numbers Mislead

The Benchmark Trap: Why Vendor Numbers Mislead

Here is where most procurement decisions go wrong. A vendor publishes a chart showing its accelerator at the top. A competitor publishes a different chart with a different winner. Both are technically honest and practically useless to you.

Independent benchmarking exists precisely to cut through this. MLPerf Inference, run by MLCommons since 2018, publishes separate closed and open divisions because vendor-tuned results are not apples-to-apples. Even within MLPerf, results swing wildly depending on the model, the batch size, the numeric precision (FP32, FP16, or INT8), and whether the run optimized for latency or throughput.

Before you trust any number, ask four questions:

  • Which model was tested, and how close is it to yours?

  • What batch size was used, and does it match your traffic pattern?

  • Was the result optimized for latency or throughput?

  • Which precision was used, and can your accuracy budget tolerate it?

If a benchmark cannot answer all four, it is marketing, not evidence.

Throughput and Latency Pull in Opposite Directions

A useful mental model: batching is a dial. Turn it up, and throughput climbs while per-request latency grows. Turn it down, and you get snappy responses at the cost of expensive idle hardware. TPUs tend to shine when you can batch aggressively and keep the systolic array fed. GPUs tend to shine when you need fine-grained control over scheduling and mixed workloads. If you are unsure where your workload sits, a detailed guide on choosing between batch and real-time inference is worth reading before you compare hardware at all.

Architecture Choices That Shape Real Inference Systems

Inference is not one problem. It is a family of problems with different bottlenecks. A recommendation model serving millions of tiny requests looks nothing like a large language model generating long outputs, and neither looks like an image classifier on a factory floor.

This is why AI inference architecture decisions usually start with the serving pattern, not the chip. Teams that pick hardware first and design the serving layer second tend to overpay. Teams that map their traffic shape first usually find that two or three candidate accelerators are all technically viable, and the decision collapses to cost and operational fit.

Where Memory Becomes the Binding Constraint

For large models, the limiting factor is often not compute at all. It is memory capacity and bandwidth. A model that does not fit in accelerator memory has to be sharded, offloaded, or quantized, and each of those choices changes the performance profile. Understanding why memory capacity matters for inference planning will save you from a painful surprise: a chip with spectacular peak throughput can still be the wrong purchase if your model does not fit comfortably.

Measuring What You Actually Care About

The metric that matters is end-to-end latency under realistic load, not the time spent inside a single kernel. Queueing, tokenization, network hops, and post-processing all count. A practical walkthrough of how to measure inference latency end to end is a better use of an afternoon than another benchmark chart.

GPU vs TPU: A Side-by-Side Comparison

Dimension GPU TPU
Design philosophy General-purpose parallel processor ASIC-style systolic array for dense matmul
Programming model CUDA, ROCm, HIP; broad operator support TensorFlow, JAX, PyTorch via XLA compiler
Flexibility for custom models High Moderate; must fit the compilation path
Efficiency on dense matmul Strong Very strong when shapes align
Availability Multiple vendors, all major clouds, on-premises Primarily Google Cloud and Google data centers
Portability and lock-in risk Low Higher
Best fit Mixed workloads, custom ops, fine-grained latency control Stable, large-scale, dense models with predictable shapes

The table makes the trade-off visible: flexibility versus efficiency. Neither column is universally better.

Cost per Inference Is the Only Number That Decides

Peak TOPS is a vanity metric. The number that survives a budget review is cost per token or cost per query at a given latency target. That figure depends on utilization, batching efficiency, power draw, and the price you pay per hour.

Public cloud list prices change frequently, so treat any specific dollar figure as time-stamped and verify it before you build a model around it. The durable insight is structural: a cheaper chip that sits half-idle can cost more per inference than an expensive chip running near capacity. Utilization is the multiplier that people forget.

A rough planning sequence that works in practice:

  • Define your latency SLA and your expected request volume.

  • Estimate the batch size that keeps you inside the SLA.

  • Compute utilization at that batch size for each candidate.

  • Divide hourly cost by realistic throughput, not peak throughput.

  • Re-run the math at your projected peak traffic, not your average.

Step five is where optimistic plans die. Inference systems are usually provisioned for peak, which means average utilization is low by design. That single fact can flip the cheaper option into the more expensive one.

Availability, Lock-In, and the Boring Risks

TPUs are available primarily through Google Cloud and Google’s own data centers. GPUs are sold by multiple vendors, available across every major cloud, and can be bought for on-premises racks. This is a procurement and portability consideration rather than a raw-performance one, but it has a habit of becoming the deciding factor.

Ask yourself a few uncomfortable questions. If your cloud provider raised prices tomorrow, how fast could you move? If your model architecture changed next quarter, would your compiler still handle it? If a regulator required data residency in a region where your preferred accelerator is unavailable, what then? Teams that answer these before signing usually sleep better.

The original TPU paper is worth reading directly for anyone who wants the primary source rather than the summary of the summary. It explains the design rationale and, importantly, the limits the authors themselves placed on their conclusions.

Edge Inference Is a Different Conversation

On-device inference commonly uses mobile GPUs, NPUs, or Google’s Edge TPU line. The GPU versus TPU framing is mostly a data-center question, and importing data-center arguments into an edge decision usually produces bad choices. Power envelopes, thermal limits, and memory footprints dominate at the edge in ways that make peak throughput almost irrelevant.

Common Mistakes Teams Make

A few patterns show up again and again in real deployments.

Choosing on peak numbers. The fastest chip on a chart is often not the cheapest per query. Utilization and batching behavior matter more.

Ignoring the compiler. A model with custom operators may run beautifully on a GPU and stumble on a TPU because the operation does not compile cleanly. Test your actual model, not a reference one.

Skipping the portability review. Lock-in is cheap to accept and expensive to escape. Price the exit before you sign.

Benchmarking at the wrong batch size. A benchmark run at batch 256 tells you little about a service that handles single requests with tight latency budgets.

Forgetting power and cooling. In dense on-premises deployments, power per rack can become the real constraint. Efficiency per watt is not a marketing line; it is a facilities budget item.

Treating quantization as free. Lower precision boosts throughput, but accuracy can drift. Validate on your own evaluation set before committing.

What Actually Works in Practice

The teams that get this right tend to follow a similar path. They start with a small, honest benchmark of their own model on two or three candidate accelerators, measured end to end under realistic batching. They weight cost per inference at peak traffic heavily. They keep an escape hatch, either a portable serving layer or a multi-cloud plan, so a pricing change does not become an emergency. And they revisit the decision annually, because both hardware generations and list prices move faster than most procurement cycles assume.

None of that requires picking a side in the GPU versus TPU argument. It requires knowing your own workload well enough that the hardware choice becomes almost obvious.

Conclusion

There is no universal winner in the GPU versus TPU debate for inference, and any article that claims otherwise is selling something. GPUs offer flexibility, broad availability, and low lock-in. TPUs offer efficiency on dense matrix workloads when your model shapes cooperate and you are comfortable operating inside one cloud provider. The famous 15 to 30 times figure from the original TPU research was a snapshot of 2015-era hardware on Google’s own workloads, not a permanent verdict.

The better question is narrower and more useful: which accelerator gives you the lowest cost per query at your latency target, at your peak traffic, with a model you can actually port? Answer that with your own measurements, and the architecture debate mostly settles itself.

FAQ

Is a TPU always faster than a GPU for inference?

No. The widely quoted 15 to 30 times advantage came from TPU v1 compared against 2015-era GPU and CPU baselines on Google’s production workloads, and the authors explicitly cautioned that the results were workload-specific. On many modern models, well-tuned GPUs match or beat TPUs, especially when custom operators or mixed workloads are involved. Speed depends on model shape, batch size, precision, and how well the workload maps to the hardware.

Can I run a TPU outside Google Cloud?

TPUs are primarily available through Google Cloud and Google’s own data centers. That is a real constraint for teams with data residency requirements, multi-cloud strategies, or on-premises mandates. GPUs, by contrast, are sold by multiple vendors and available across every major cloud plus on-premises hardware. Portability is a procurement consideration rather than a performance one, but it often decides the outcome.

What is the best benchmark for comparing inference hardware?

MLPerf Inference, run by MLCommons since 2018, is the closest thing to a neutral standard. It publishes separate closed and open divisions because vendor-tuned results are not directly comparable. Even so, results vary by model, batch size, precision, and whether the run optimized for latency or throughput. The most reliable benchmark is your own model, measured end to end under realistic load.

Does batch size really change which chip wins?

Yes, dramatically. Larger batches keep a systolic array busy and favor TPUs, while smaller batches and strict latency targets often favor GPUs with finer scheduling control. A benchmark run at batch 256 tells you almost nothing about a service handling single requests. Always test at the batch size your production traffic will actually produce.

Is cost per hour a good way to compare GPUs and TPUs?

It is a starting point, not an answer. The metric that matters is cost per token or cost per query at your latency target, which depends on utilization, batching efficiency, and power. A cheaper chip running half-idle can cost more per inference than an expensive chip near capacity. Since cloud list prices change often, verify current rates before committing to a plan.

Should I worry about vendor lock-in when choosing an accelerator?

It deserves a serious review. TPUs tie you closely to one cloud provider and its compilers. GPUs keep more doors open across clouds and on-premises hardware. Lock-in is cheap to accept and expensive to escape, so price the exit before you sign. A portable serving layer or a documented multi-cloud plan turns a future pricing change from an emergency into an inconvenience.

Latest articles

Scroll to Top