How many GPUs drain a day of work
With the pieces in place, size the fleet.
Count input and output tokens separately
20 billion input tokens and 4 billion output. A replica prefills 40,000 tokens a second and decodes 4,000. Which takes more replica time?
Assume a day's batch work for one model is 10 million requests. They average 2,000 input tokens and 400 output tokens.
Assume one replica, a copy of the model on 8 GPUs, sustains 4,000 output tokens a second in decode and 40,000 input tokens a second in prefill. Those rates are assumptions for the exercise. In a real design you'd measure them and say so.
Now see where the time goes:
Input runs at 40,000 tokens a second on a replica, and output at 4,000. A fifth as many output tokens take twice the time.
There are five times as many input tokens, but output takes twice the GPU time. Prefill takes a whole prompt in one pass. Decode makes one token per sequence per step.
So price the two kinds of tokens separately:
replica-hours=36001(decode rateoutput tokens+prefill rateinput tokens)In words: output tokens over the decode rate, plus input tokens over the prefill rate, gives replica-seconds. Divide by 3,600 for replica-hours, where one replica-hour is one replica busy for an hour.
| Quantity | Arithmetic | Result |
|---|---|---|
| Input tokens | 10,000,000 × 2,000 | 20 billion |
| Output tokens | 10,000,000 × 400 | 4 billion |
| Decode time | 4 billion ÷ 4,000 per second | 1,000,000 replica-seconds |
| Prefill time | 20 billion ÷ 40,000 per second | 500,000 replica-seconds |
| Total | 1,500,000 ÷ 3,600 | 416.7 replica-hours |
Plan to finish in half the window
Spread evenly over 24 hours, that's 416.7 ÷ 24 = 17.4 replicas, 139 GPUs.
Don't plan to finish at the last minute. Retries, preemptions and one bad deploy all eat window. So plan to drain in about half of it: 416.7 ÷ 12 = 34.7, which rounds up to 35 replicas, 280 GPUs.
In the editor, write replica_hours(requests, tokens_in, tokens_out, decode_rate, prefill_rate) from the formula above. Then write replicas(work, hours): the whole replicas that finish work replica-hours within hours.
- 1
Write
replica_hours(requests, tokens_in, tokens_out, decode_rate, prefill_rate), where one replica decodesdecode_rateoutput tokens a second and prefillsprefill_rateinput tokens a second. Thenreplicas(work, hours): the whole replicas that finishworkreplica-hours withinhours.
Run your code to check it. Output shows here.