Tinker Inference engineering

by Samy (Kondasamy Jayaraman)

Static batching, the busiest pass of Monday’s rush. The last reply is done at 16.5 s.8 of 8 seats busy · 10 waiting · KV cache 29% full

Chapter 3 of 7

Batching

A server can run several requests in one pass, a batch, since every pass reads all the weights anyway. Larkspur’s first server batched the simple way.

This chapter: How should a server group requests so none waits for the others?

About this chapter

You will learn

  • Why batching makes a server serve more for nearly the same cost per pass
  • Static batching: a batch starts together and runs until its longest reply ends
  • Continuous batching: requests join and leave at every pass

Words you’ll meet

Batch
The requests a server runs in the same pass.
Static batching
Requests are grouped when the server is free, and the group runs until every reply in it is done.
Continuous batching
Also called iteration-level scheduling: after every pass, finished requests leave and waiting ones join.
Throughput
Reply tokens the server writes per second, across every request.

Step 1 of 4

Monday’s rush: 24 requests, up to 8 at a time. runs each until its last reply ends.

Open the Timeline tab.

Monday’s rush, batch cap 8, simulated
BatchingLast reply doneLongest wait for a first tokenThroughput
Static16.5 s9.78 s155 tokens/s

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.