Batching
Processing multiple requests to a model simultaneously, in one batch. Instead of 'one request — one pass' GPU calculates a whole batch at once.
Why is it needed
GPU is efficient when fully loaded. A single request often doesn't use all compute blocks, and the graphics card sits idle. Batching fills these 'gaps': the same calculations process more requests in the same pass.
Types
- Static batching — wait until a fixed-size batch is formed;
- Continuous batching — requests are added and removed on the fly, without waiting for a full batch.
Trade-offs
Batching increases throughput, but may increase the delay for a specific request: it waits for the batch to form. For chats, this is solved with continuous batching.