Skip to content
Rabin Poudyal
Rabin Poudyal
← All models

Software and engineering

Amdahl's law

Speeding up one part of a job is capped by the share of time that part takes; whatever you leave untouched sets the ceiling.

Gene Amdahl, IBM, "Validity of the single processor approach to achieving large scale computing capabilities", AFIPS Spring Joint Computer Conference, 1967.

Amdahl's three-page paper has no equation and one figure. He observed that about 40 percent of the instructions executed in typical programs were data-management housekeeping, that this part looked inherently sequential, and that overhead alone would cap throughput at five to seven times the sequential rate however much parallel hardware you added. Others wrote it as a formula: if a fraction p of a job can be sped up by a factor n, total speedup is 1 / ((1 - p) + p / n). With p = 0.95 and unlimited n the speedup tends to 1 / 0.05 = 20. With n = 100 it is 16.8. The 5 percent you did not touch becomes the whole job as the rest shrinks.

It holds because it is arithmetic over a fixed total: the untouched part keeps its absolute time while everything around it shrinks. The transfer is to any pipeline. If a request spends 70 percent of its time in a model call and 5 percent parsing, a parser ten times faster saves 4.5 percent. The site's post on reducing large language model (LLM) API costs makes the same argument about money: output tokens cost several times input tokens, which points at shaving answers, but input tokens dominate the volume, so the big factor is the context resent on every call. Measure the fractions first, then work on the largest one.

John Gustafson's 1988 reply from Sandia showed the catch: Amdahl's picture assumes a fixed problem size, and in practice problems grow with the machine, so the serial fraction shrinks. On a 1024-processor hypercube his three applications reached speedups of 1021, 1020 and 1016. Yuan Shi showed in 1996 that this does not break the law: Gustafson's serial fractions are measured on the parallel machine, and translating them to Amdahl's definition gives 0.0004 to 0.0008 percent, for which Amdahl's formula predicts 1020 to 1016. The law is right; the serial fraction has to be measured for the problem you will run, and coordination overhead can grow with n and bend the curve downwards.

Example

In 1988 John Gustafson reported timings from Sandia National Laboratories on a 1024-processor hypercube for three applications: beam stress analysis, baffled surface wave simulation and unstable fluid flow, with serial fractions of 0.4 to 0.8 percent as measured on the parallel machine. Amdahl's fixed-size arithmetic for a serial fraction of 0.8 percent gives a ceiling of about 111 at 1024 processors; Gustafson measured 1021, 1020 and 1016, because the problems had been scaled to fill the machine and the serial parts (startup, loading, input and output) had not grown with them. Yuan Shi's 1996 analysis converted those measured fractions into Amdahl's definition, 0.0004 to 0.0008 percent, and recovered the same 1020 to 1016 from Amdahl's own formula.

Where it applies

Profile before optimising, and compute the best case: if a step is 10 percent of the total, the most you can gain by making it instant is 10 percent. For an LLM pipeline, the model call usually dominates latency and the resent context dominates cost, so a faster parser or a shorter answer buys little next to prompt caching or trimming retrieved context.

Think about it

For the slow thing you want to fix this week, what fraction of the total does it take, and what is the most you could gain if it took no time at all?

Applied it to something real? Log it.

Test yourselfA job is 95 percent parallelisable. What is the most speedup you can get with unlimited processors, and why?

20 times. The 5 percent serial part still takes 5 percent of the original time however many processors you add, so speedup is capped at 1 / 0.05.

Related models

Sources and further reading