1/30
Learn
Sizing a token service, the way the design round asks
A prep site's guide lists designing a token-generation service for 100,000 requests a second for Anthropic (1 source), and another lists GPU scheduling and autoscaling for a ChatGPT-style service for OpenAI (1 source). Both start from the same numbers: how many conversations one GPU holds, how fast it decodes them, and how many GPUs the traffic needs. This lesson's practice problem computes them, in three levels:
kv_bytes_per_token(model)andsequences_that_fit(model, gpu, context): the cache one token holds, and how many conversations fit in a GPU's memory after the weights.step_ms(model, gpu, batch, context)andlargest_batch(model, gpu, context, target_ms): one decode step's time, and the biggest batch that meets a per-token target.gpus_needed(model, gpu, context, target_ms, rate, first_token_s, output_tokens): the fleet a traffic rate needs, from Little's law.
Call Returns kv_bytes_per_token(qwen)57,344 bytes sequences_that_fit(qwen, h100, 2000)477 conversations largest_batch(qwen, h100, 2000, 15)305, the batch a 15 ms target allows gpus_neededfor 100,000 requests a second1,662 H100s
The lesson follows an outdoor shop's support assistant on one H100: the two clocks of a streamed answer, the memory budget, the batch trade, long prompts, and a fleet that follows traffic. Eight steps end with a small task in the editor.