Tinker Inference engineering

by Samy (Kondasamy Jayaraman)

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 over the batch cap: 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?

About this chapter

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

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.

Step 1 of 4

The is how many requests share a pass. A fuller pass takes longer. The cap is 4.

Predict raising it to 16.

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. Real times differ; what carries over is the shape: reading the prompt is mostly computing, writing the reply mostly reading weights from memory.

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