Why batch costs half
Why can a provider sell the same tokens at half the price?
Why can a batch API charge half price?
In the quiet hours more than half the fleet sits idle, and it's paid for anyway.
Neither provider's docs explain the discount, but the economics are easy to rebuild. Three things make batch cheap:
- Idle GPUs. Queueing delay shoots up as a server nears 100% busy. So a fleet that serves people is sized for its peak and runs well below full. Idle GPUs cost the same as busy ones, and work that can wait fills the gaps at almost no extra cost.
- Bigger decode batches. Decode waits on memory: each step reads every weight once, however many sequences it serves. Interactive serving keeps the decode batch small, so each user's tokens keep flowing. Batch has no per-token latency target, so it can run more sequences per step and get more tokens per second from the same GPU.
- Moving in time. With hours of slack, batch work can wait for the overnight quiet hours, or run wherever capacity is free.
The bill for all of this is complexity, and the provider pays it. Interactive traffic fails loudly and at once. Batch fails quietly and later, so the system itself has to notice, retry, keep count and finish.
The constants in the editor describe one GPU serving Llama 3 8B: its weights, one sequence's KV cache (the attention keys and values it keeps for every token so far), and how fast the GPU reads memory. Write step_seconds(batch): one decode step reads every weight once, plus the cache of every sequence in the batch. Then write tokens_per_second(batch), and compare a decode batch of 8 with one of 128.
- 1
Write
step_seconds(batch): one decode step reads every weight once, plus the cache of every sequence in the batch. - 2
Write
tokens_per_second(batch): each step makes one token for every sequence.
Run your code to check it. Output shows here.