Tinker Inference engineering

by Kondasamy Jayaraman · drawn with Colorfigures by April Zhu

Batch cap 4: 192 tokens/s; each token every 18 ms on average; the longest wait for a first token 6.26 s.4 of 4 seats busy · 0 waiting · KV cache 15% full

Chapter 6 of 7

Pace or throughput

Continuous batching helped. Now the team argues about one number: the batch cap, the most requests the server runs at once. Sales wants more customers served; support wants replies that don’t crawl.

This chapter: What does a bigger batch buy, and what does each customer pay for it?

You will learn

  • How the batch cap raises throughput and cuts the queue
  • Why every request in a bigger batch gets its tokens more slowly
  • Why there is no free setting, only a trade-off to choose
Words you’ll meet (2)
Batch cap
The most requests the server runs in one pass. Others wait in the queue.
Queue
Requests that have arrived but haven’t been let into the batch yet.

The picture on the left is live. Each step below asks you to do one thing in it; the story continues here as you go.

Step 1 of 4

Monday’s rush again, with continuous batching and the full KV room. The batch cap is how many requests run in one pass. Each pass reads the weights once, plus each request’s own cache and work, so a fuller pass takes longer. The cap is 4. Before you raise it:

Monday’s rush, continuous batching, simulated
Batch capThroughputLongest wait for a first tokenTime per token, average
162 tokens/s34.3 s15 ms
2113 tokens/s15.6 s16 ms
4192 tokens/s6.26 s18 ms
8284 tokens/s1.74 s22 ms
16321 tokens/s187 ms26 ms

Times come from a simulated server: counted work at assumed unit costs, not a measurement of any real server or provider.

The server runs up to 4 requests at once. Raise the cap to 16. What happens?