Sari la conținut
aiqbenchInformații despre AI & calcul cuantic
ȘtiriAnalizeBenchmark-uriSkill-uriÎntreabă AIÎnvațăDespre
...Se încarcă sesiunea
ȘtiriAnalizeBenchmark-uriSkill-uriÎntreabă AIÎnvațăDespre

Română · beta. Traducerea a fost făcută automat și este încă în curs de revizuire. Citește pagina în engleză

  1. Joburile viitorului
  2. ›
  3. AI Inference & Efficiency Engineer
  4. ›
  5. Lecția 5 din 8

Lecțiile acestui traseu sunt publicate deocamdată doar în engleză, așa că lecția de mai jos apare în engleză. Restul — module, quiz și materiale — funcționează la fel.

Accelerators: GPU, TPU, CPU and Edge — What the Memory Hierarchy Decides

Avansat¶ Citire · 5 min⚑ Misiune · 40 min◆ Test · 5 întrebări✓ Verificată la 23 nov. 2026

Vei putea să:

You can read an accelerator spec sheet (peak FLOPs, memory capacity, memory bandwidth, interconnect) and place a given model and workload on the roofline, explain why FlashAttention is a memory-hierarchy trick rather than a maths trick, and say what changes when the target is a laptop CPU or a phone instead of a data-centre GPU.

Reading a spec sheet like an inference engineer

Every accelerator datasheet lists the same three numbers that decide inference performance: peak arithmetic throughput (FLOPs per second at a given precision), memory capacity, and memory bandwidth. A fourth, interconnect bandwidth between chips, decides how well the model splits across several devices. Marketing emphasises FLOPs; module 1 should have convinced you that for most decode workloads bandwidth and capacity are what you are buying.

The roofline, in one paragraph

Divide peak FLOPs by memory bandwidth and you get the device's ridge point, in FLOPs per byte. A workload whose arithmetic intensity (FLOPs it performs per byte it moves) is below that point is memory-bound; above it, compute-bound. Decode at batch size 1 performs about 2 FLOPs per weight while moving 2 bytes per weight (16-bit): intensity ≈ 1. Data-centre GPUs have ridge points in the hundreds, so single-request decode uses well under 1% of peak compute. Batching 64 requests raises intensity to about 64 — still below the ridge on big chips. Prefill of a 2,000-token prompt has intensity in the thousands and is firmly compute-bound. NVIDIA's "GPU Performance Background" guide is the vendor's own explanation of this model and of why matrix dimensions that are multiples of 8 or 16 matter for its tensor cores.

Worked example

A hypothetical device: 1,000 TFLOP/s dense 16-bit, 3 TB/s bandwidth, 80 GB capacity.

  1. Ridge point: 1,000 × 10¹² ÷ 3 × 10¹² ≈ 333 FLOPs/byte.
  2. A 7B model at 16-bit is 14 GB; it fits, with 66 GB left for KV cache and activations. A 70B model (140 GB) does not; at 4-bit (35 GB) it does, leaving about 45 GB for KV cache and activations.
  3. Single-request decode of the 7B model: 3 TB/s ÷ 14 GB ≈ 214 tokens/s ceiling; the compute needed, 14 GFLOP per token, would allow 70,000 tokens/s — the arithmetic units are 99.7% idle.
  4. At batch 64 the ceiling is still about 214 steps/s (same bytes per step) but now 13,700 tokens/s in aggregate, and compute utilisation rises to around 20%. Only at batch sizes in the hundreds does the device become compute-bound.

Those four lines explain most purchasing decisions: a chip with more bandwidth per dollar wins for interactive decode; one with more FLOPs per dollar wins for prefill-heavy or massively batched work; one with more capacity lets you avoid multi-chip sharding, which costs interconnect traffic every layer.

GPU, TPU and the memory hierarchy

GPUs and TPUs reach their peak FLOPs only when data is staged in on-chip memory (registers, shared memory/SRAM, the TPU's vector memory) rather than streamed from HBM. The "What Is a TPU?" chapter of How to Scale Your Model describes the TPU's systolic array and its deliberately simple memory system: huge matrix throughput fed by a compiler-scheduled pipeline, and inter-chip links designed so that very large models can be sharded across pods. GPUs are more general and more forgiving of irregular work; TPUs are extremely efficient when the computation is big, regular matrix multiplication — which transformer prefill and large-batch decode are.

FlashAttention (Dao et al.) is the clearest demonstration that the hierarchy, not the arithmetic, is the lever. Standard attention writes the full N×N score matrix to HBM and reads it back for the softmax and the value multiply. FlashAttention tiles the computation so each block of scores is computed, normalised and multiplied in on-chip SRAM and never materialised in HBM. It does more FLOPs than the naïve version (it recomputes pieces of the softmax) and is still several times faster, because the bytes moved to slow memory drop by an order of magnitude. The attention results are identical — it is an exact method.

CPUs, laptops and phones

Off the data-centre, the constraints flip in two ways. First, bandwidth is far lower (tens to a few hundred GB/s), so decode ceilings are a few tens of tokens per second for small models and quantization is not optional — this is why llama.cpp's integer kernels and Apple's unified-memory machines are the dominant local-inference story. Second, capacity is shared with the operating system and everything else, so a 4-bit 7B model occupying 4 GB may be the largest thing that fits. Edge NPUs in phones are built for int8 or lower and for fixed shapes; dynamic sequence lengths and large vocabularies stress them. Power and thermal limits mean sustained throughput is lower than the first ten seconds suggest — measure for minutes, not moments.

What is still unsettled

Vendors are shipping native 8-bit and 4-bit floating-point formats and hardware for sparse and mixture-of-experts models, which changes the effective bytes per parameter and the arithmetic intensity of the same model. Memory-bandwidth growth has lagged compute growth for a decade; whether stacked memory, compute-near-memory or very large on-chip SRAM designs change that is the question that will shape the next generation of inference hardware.

What to remember

  • Ridge point = peak FLOPs ÷ bandwidth. Decode at small batch sits far below it; prefill sits far above it.
  • Capacity decides whether a model fits on one device; bandwidth decides interactive decode speed; FLOPs decide prefill and large-batch throughput; interconnect decides the cost of sharding.
  • FlashAttention is faster because it avoids HBM round-trips, not because it does less maths — an exact algorithm with a better memory plan.
  • On CPUs and edge devices bandwidth and capacity shrink first; quantization, fixed shapes and thermal limits dominate the design.

Materiale selectate

2.1h

Munca de profunzime se întâmplă aici — lecția este briefingul tău.

  • GPU Performance Background User's Guide (NVIDIA Deep Learning Performance docs)Documentație· 35 min
  • How to Scale Your Model: What Is a TPU? (JAX ML scaling book)Tutorial· 45 min
  • FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness (Dao et al.)Lucrare· 45 min

În direct pe aiqbench

Subiectul acestei lecții în restul site-ului, astăzi.

În știri, ultimele 30 de zile

  • GPU decoder keeps pace with a superconducting qubit clock on a continuous stream, with NVIDIA NVQLink interconnectAlice & Bob · 1 dec.
  • DeepSeek Opens Source Production-Level Ascend Inference Code36Kr · 1 dec.
  • NVIDIA and Cerebras Partner to Accelerate AI Agent Inference with Two-Stage Compute Architecture36Kr · 1 dec.
Mai multe știri pe acest subiect →

Mergi mai departe

  • Care model merită?Preț, viteză și hardware alături de capabilitate.
  • Întreabă AI despre această lecțieDeschide Întreabă AI cu o întrebare despre această lecție, cu răspuns din arhiva de știri, cu surse.
  • Skill-uri de agent pentru această muncăSkill-uri gata făcute pentru agenți AI de programare, verificate și evaluate.

Testează-ți cunoștințele

5 întrebări în 100 de secunde, pe o pagină separată. Citește mai întâi tot ce este mai sus.

Testează-ți cunoștințele →

Misiunea modulului

35–45 min

Pick three devices you can find public spec sheets for (for example one data-centre GPU, one consumer GPU and the CPU in your own laptop). For each, write down peak dense 16-bit FLOPs, memory capacity and memory bandwidth, then compute the arithmetic intensity (FLOPs per byte) at which it switches from memory-bound to compute-bound. Place single-request decode and a 64-request batched decode of a 7B model on each roofline and state, per device, which one is the bottleneck and whether the model fits in memory at 16-bit and at 4-bit.

Se încarcă lucrarea ta…

← Lecția anterioară4. Speculative Decoding and DistillationLecția următoare →6. Measuring Latency and Cost Honestly
aiqbench
Informații despre AI & calcul cuantic© aiqbench. Toate drepturile rezervate.

Fluxuri:RSS·JSON Feed

LimbăEnglish·Românăbeta
ȘtiriAI & tehnologieCuanticAnalize
ExploreazăBenchmark-uriÎnvață
CompanieDespreÎncredereInformații legaleTermeni și condițiiPolitica de confidențialitateNotificări privind drepturile de autorȘtergerea datelorRaportează conținut

Perspectiva aiqbench, analizele, rezumatul zilnic și răspunsurile din Întreabă sunt scrise de modele AI din sursele afișate, fără revizuire editorială înainte de publicare. Pot conține erori — verifică sursa. Cum este folosit modelul →

  • Știri
  • Analize
  • Întreabă
  • Topuri
  • Cont