Imọ Itọsọna

GPU vs TPU fun AI

GPUs and TPUs are the two main families of chips used to train and run modern AI models.

Gbọ si itọsọna yiiAI-ṣe afihan · ~8 min

Lori iwe yi9 min kika
  1. Akopọ
  2. Awọn gbigba bọtini
  3. Jin Dive
  4. Deciding whether a layer is compute-bound or memory-bound
  5. Real-World imuse
  6. Ojo iwaju ti GPU vs TPU fun AI
  7. Fifi o sinu iwa
  8. Awọn orisun ati siwaju kika
  9. Tesiwaju Ṣiṣawari
  10. Awọn ibeere ti a beere nigbagbogbo

Akopọ

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.

Awọn gbigba bọtini

  1. 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.
  2. 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.
  3. NVIDIA's H100 tensor throughput figures are quoted with structured sparsity, so dense throughput is about half the headline number.
  4. Google's own guidance favors TPUs for large, matrix-heavy models with big batches and GPUs for models with many custom operations.
  5. Ironwood, announced in April 2025, is Google's first TPU designed specifically for inference, with 192 GB of memory per chip.

Jin 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.

04Apẹẹrẹ ṣiṣẹ

Deciding whether a layer is compute-bound or memory-bound

  1. Pick one layer, for example a 4,096 by 4,096 weight matrix applied to a batch of 8 tokens in bfloat16.

  2. Count operations: 2 x 8 x 4,096 x 4,096, about 268 million floating-point operations.

  3. 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.

  4. Divide to get arithmetic intensity: roughly 8 operations per byte.

  5. 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.

  6. 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.

Ohun ti o fihan

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 imuse

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.

Ojo iwaju ti GPU vs TPU fun 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.

Fifi o sinu iwa

Kini idi ti o ṣe pataki

  • Iye owo ati isuna. Awọn ipinnu faaji ṣe awakọ iṣẹ ati idiyele iṣẹ fun awọn ọdun.
  • Awọn ipinnu diẹ sii. Ẹkọ imọ-ẹrọ ṣe iranlọwọ fun awọn ẹgbẹ lati yan akopọ to tọ, kii ṣe ọkan tuntun nikan.
  • Iṣakoso didara. Awọn yiyan imọ-ẹrọ to dara julọ dinku awọn iṣẹlẹ igbẹkẹle ni iṣelọpọ.

Ṣọra fun

  • Ṣiṣepe ala-ilẹ kan le tọju awọn ailagbara eto ti o gbooro.
  • Awọn ohun elo amayederun ati awọn idiyele itọju nigbagbogbo ni aibikita.
  • Aabo ati awọn ela akiyesi le dagba bi awọn eto ṣe di eka sii.

Next awọn igbesẹ

  1. Ṣetumo lairi, didara, ati awọn ibi-afẹde idiyele ṣaaju imuse.
  2. Aṣepari labẹ ẹru ojulowo ati awọn ipo data.
  3. Abojuto ohun elo fun awọn aṣiṣe, fiseete, ati ipa olumulo.
  4. Mura ipadasẹhin pada ati awọn ipa ọna esi iṣẹlẹ ṣaaju iwọn.

Awọn orisun ati siwaju kika

  1. arXiv (ISCA 2017)In-Datacenter Performance Analysis of a Tensor Processing Unit
  2. arXiv (ISCA 2023)TPU v4: An Optically Reconfigurable Supercomputer for Machine Learning with Hardware Support for Embeddings
  3. Google CloudIntroduction to Cloud TPU
  4. Google CloudTPU architecture
  5. GoogleIronwood: The first Google TPU for the age of inference
  6. Google Cloud BlogBFloat16: The secret to high performance on Cloud TPUs
  7. NVIDIANVIDIA H100 Tensor Core GPU
  8. NVIDIA Technical BlogNVIDIA Hopper Architecture In-Depth

Tesiwaju Ṣiṣawari

Ìwé ìròyìn ọfẹ

Gba ìkànìyàn AI ojoojúmọ́

Ìtàn AI mẹta tó jẹ́rìí ní gbogbo owurọ́ ọjọ́ iṣẹ́, kọ́wé ní Gẹ̀ẹ́sì tó rọrùn. Ọfẹ́ fún gbogbo àkókò, kò sí ìpolówó.

Ìmeèlì kan ní gbogbo ọjọ́ iṣẹ́. Yọkúrò ní ìkànìyàn ní ìkànìyàn kan. A kò ta tàbí pín àdírẹ́sì rẹ.

Ṣe idanwo fun ara rẹ

Take the GPU vs TPU for AI quiz

Ìdáhùn lẹ́sẹ̀kẹsẹ̀ lórí gbogbo ìdáhùn, àti iwe-ẹ̀rí tó lè pin pẹ̀lú ID tó lè jẹ́rìí lẹ́yìn tí o bá kọ́ ẹ̀kọ́.

Bẹrẹ adanwo

Ṣe àtìlẹ́yìn ẹ̀kọ́ AI ọfẹ́. AI Understanding jẹ́ àjọ àìní èrè 501(c)(3) — kò sí ìpolówó, kò sí àkúnya owó, ní gbogbo àkókò. Ṣe ẹbun kan

Awọn ibeere ti a beere nigbagbogbo

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.

Tani o ṣe apẹrẹ TPU?

Ẹka Ṣiṣẹpọ Tensor jẹ chirún aṣa (ASIC) ti a ṣe apẹrẹ nipasẹ Google pataki fun awọn iṣẹ ṣiṣe nẹtiwọọki-neural.

Ohun ti mojuto hardware be mu ki TPUs daradara ni matrix isodipupo?

Awọn TPU lo eto systolic nibiti data nṣan nipasẹ akoj ti awọn sẹẹli pọ-pupọ, gbigbe awọn abajade taara laarin wọn ati idinku ijabọ iranti.

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.