Unit 7 of 10 · about 3 hours · derive

Cost categories and the Amdahl bound on end-to-end gain

A kernel speedup is not a system speedup. Shares plus Amdahl decide whether an optimization moves the request or only the profile.

You'll be able to

  • Split one decode step into compute, memory, launch, synchronization, host and communication categories with an equation per term.
  • Derive the Amdahl bound from a measured time share and state the maximum end-to-end gain.
  • Predict whether an optimization is worth integrating, using share times speedup against dispatch and synchronization overhead.

Covers

Compute, memory, launch, synchronization, host and communication cost categoriesKernel share, Amdahl bound and maximum end-to-end impact
1

Read

In this order, only the parts listed

0 of 3 done

  1. Compute, memory, comms latency and throughput termsTransformer Inference Arithmetic

    latency calculations (small-batch and large-batch equations); model parallelism (the four communications per layer)

    The 53 ms large-batch result for the 260B model is the formula value; the 62 ms in the same sentence is a slip.

  2. Share evidence: attention fraction, serial layers, prefill-decode configsEfficiently Scaling Transformer Inference

    Section 4.2 with Figure 8 and Table 1 (attention 8 to 31% of decode); Section 4.3 (serial layers cost 14%); Section 4.4 with Figure 1 and Table 2 (prefill versus decode configurations)

  3. Amdahl's law statement and derivationAmdahl's law

    Definition and Derivation (overall speedup from optimized share and its speedup, with the worked share examples)

2

Focus on

  • Small batch time is weight bytes over bandwidth plus 4 latency messages per layer; large batch adds operations over peak plus model-width vectors over comms bandwidth; the max assumes parallel compute and comms.
  • Shares come from profiles, not assumptions: attention is 8 to 31% of decode in the ESTI slice, intermediates about 10% in the FasterTransformer reconciliation.
  • Amdahl bounds latency at fixed workload; growing batch or chips to hide a share is a throughput argument, not a bound violation.
Common mistakes · 3
  • Multiplying kernel speedup by 100% of time. A attention win at 31% share gives overall; the unaccelerated 69% dominates.
  • Assuming overlap. The article takes the max of comms and compute; without measured overlap the honest bound is the sum.
  • Beating the bound by adding hardware. More chips remap the workload and change the shares; the bound holds the workload fixed.
3

Try it yourself

Closed-book, before checking anything

Closed-book, bound attention work at 31% share (at most 1.45x end to end) and intermediates at 10% (at most 1.11x), then state which you would optimize for latency and why.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Attention is 31% of decode time and you make it infinitely fast. What is the end-to-end gain?Answer

    At most x; the remaining 69% is untouched.

  2. 2.Intermediates are 10% (2.2 of 22 ms). What is the most a perfect fusion earns?Answer

    x. Measure before fusing; a 10% share caps every fusion there.

  3. 3.When is the wrong bound?Answer

    When the stack does not overlap them. Then time is closer to the sum; state which you assumed and check a timeline.

  4. 4.Why can't more chips push decode latency toward zero?Answer

    Per-layer comms latency does not shrink with batch, so beyond some chip count it dominates; Amdahl on the serial share says the same from the other side.

5

Practice

You're done when

You bound two shares from memory and verify exercises 4 and 10 with every substitution shown.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 6 more in the section
  • Transformer Inference ArithmeticKipply · required

    Reproduce the FLOP, parameter-byte, key-value-byte and communication estimates for dense transformer inference. Compare the formulas with an instrumented framework trace and explain model residuals instead of fitting constants after measurement.

  • Efficiently Scaling Transformer InferenceMLSys · required

    Study the latency, memory and parallelism model. Use the paper to derive a batch and parallelism crossover for your workload, while reserving distributed execution for GPU-9.

  • Amdahl's lawWikipedia · reference

    Read Definition and Derivation for the overall-speedup formula with the worked share examples; apply it to kernel time shares at fixed workload.

Also in this section

  • How to Scale Your Model - InferenceJAX Scaling Book · primary

    Work through the single-request, batching, key-value memory and parallelism arithmetic. Recompute every quantity for the small model and workload used by the track project, keeping symbols, units and assumptions visible.

  • AI Performance Engineering - Start HereWafer · reference

    A curated, dated index. Its Start Here list names the readings this section already assigns; use the later sections only to find a primary source for a later section, never as the reading itself.

  • EtalonEtalon Authors · support

    Read the latency metric definitions, their pitfalls and fluidity-index. Add TTFT and TPOT SLOs to a small load generator, and show why peak token throughput can rank two systems differently from an SLO-qualified rate.

  • GPU Microbenchmark and Kernel SuiteRoadmap-Final · support

    Adopt the project harness schema, architecture constraints and hardware tiers now. Implement only the environment manifest, independent references, raw-trial storage and the initial operation and byte models in this stage.

  • How to Scale Your Model - TrainingJAX Scaling Book · required

    Work Some Problems to Work Questions 1 to 3 for training-step parameters, Adam and activation bytes and step time; read Data Parallelism and Fully-Sharded Data Parallelism for the comms-bound batch rule.

  • DistServe: Disaggregating Prefill and Decoding for Goodput-optimized LLM ServingZhong et al. (OSDI 2024) · support

    Read Section 1 with Figure 1 for per-GPU goodput: the highest request rate served while a target share of requests meets the TTFT and TPOT SLOs.