08.05

Client code, streaming, and protocols

skillmaxingInference EngineeringClient code, streaming, and protocols
Visual lesson

Client code, streaming, and protocols

Included with Pro · 5:01
Lessons · 1,088 words

Everything so far has made the server faster. The user, though, feels the whole path: network, queue, prefill, and every output token. Client code controls a surprising share of that path. It decides whether each request opens a new connection, whether the user reads the first sentence after half a second or waits ten seconds for the whole answer, and whether a request the user no longer wants keeps occupying a batch slot.

A 400-token chat answer
Figure 1A 400-token chat answerSame 10.5 s of work. Streaming lets reading start twenty times sooner.

Three client habits pay for themselves on every workload: keep connections open, stream what a person is reading, and cancel what nobody is waiting for. The fourth decision is the protocol, and it follows from who is on the other end.

Pro

Continue reading

Pro unlocks every video lesson, the full notes, worked sizing and cost calculations, and runnable configs across the Inference Engineering course, from GPUs and kernels to quantization, speculative decoding, disaggregation and production autoscaling.

Unlock full access to
Python with AIInference EngineeringAI researchComplete system design
30% off with LAUNCH30first payment
Buy now
View all plans ·Already Pro? Sign in