Sarvam AI · Opend practice case · Updated
Why does a fast model make some readers wait two seconds?
Design a streaming chat service with a target of one second to the first visible token. A burst of long documents arrives alongside short chat prompts. Average throughput looks healthy. Users sending short prompts report that the screen stays blank.
Short answerMeasure queue wait, prefill and decode separately. Tune admission and batching against first-token latency, inter-token gaps and completed requests under the same traffic mix.
- Wait · 1,400 ms
The request sits behind already admitted work.
- Prefill · 450 ms
The model processes the prompt before producing output.
- First output · 150 ms
First decode and transport bring this example to 2,000 ms.
Define the clock the reader experiences
Record request arrival, admission, first visible content and final content. The first network event can contain metadata, so define which event ends the first-token clock. A stream can start promptly and still pause midway. Measure inter-token delays as well as completion time. Sarvam’s chat API supplies the product context for this exercise. The timing trace is illustrative and describes a hypothetical service.
Sarvam chat completions API ↗Choose the lever that can meet the target
In the illustrated request, even eliminating all 450 ms of prefill leaves 1,550 ms. Start with admission and queueing. Try reserving a bounded share of capacity for short interactive traffic, with aging so longer requests still progress. Also compare chunked prefill settings. In vLLM the token budget changes the tradeoff between feeding new requests and continuing decode work. This is an example serving engine for the exercise.
vLLM optimization and chunked prefill ↗Make the benchmark difficult to game
Replay the same arrival times, prompt lengths and output limits. Report p95 first-token time by length bucket alongside p95 inter-token gap, rejection rate and completed tokens per second. Include the long-document bucket in the acceptance criterion. A policy that drops every expensive request can make latency look excellent while completing less user work. Measure the percentiles on individual requests rather than adding component percentiles.
| Change | Time saved | New first token |
|---|---|---|
| Halve prefill | 225 ms | 1,775 ms |
| Reduce wait to 300 ms | 1,100 ms | 900 ms |
| Double decode speed only | At most 75 ms here | At least 1,925 ms |
Try the follow-upYour shorter queue improves p95 but doubles rejected chats. Did the change succeed?
Count rejections against the service objective and evaluate how many offered requests complete within budget. Then compare the same offered load. If interactive traffic genuinely needs reserved capacity, specify who can use spare capacity and how quickly the reservation can be reclaimed.