Skip to Content
Recodocs

11 · Benchmark inference serving

Replay the same helpdesk burst on one T4 and measure what batching and weight compression do to the queue.

7 min read
Part 4
Operate and release
Model
Qwen2.5-1.5B-Instruct
Data
Fixed synthetic inference workload
Hardware
Tesla T4 and CPU, in Google Colab
Open in Colab

Four tickets arrive together

A dispatcher opens the morning queue. The first ticket is a short pump lookup. The next asks for fan F-250’s priority and carries a longer list of maintenance notes. Two other requests arrive with them. The same GPU can take the tickets one by one or dispatch all four together. Which choice lets the dispatcher see the first digit sooner, and which clears the burst faster?

Ventilation fan representing equipment F-250
Facilities Helpdesk · morning queue

“What is the priority of F-250?”

The desk admits the same burst in the same order under each schedule.
One at a time
P-000F-250P-002P-003
One batch
P-000F-250P-002P-003
Check when F-250 can begin

With serial dispatch, the first ticket must finish before F-250 starts. In the joint batch F-250 starts with the other tickets, and every prompt is padded to the longest prompt in the group.

Augapfel’s factory fan photo illustrates F-250. CC BY 2.0.

Change one fact. Keep the four requests, arrival time and order fixed. Change only how many the GPU serves together.

DispatchWhat could happen to F-250?
One request at a timeThe pump ticket starts immediately. F-250 waits for it to finish.
One batch of fourF-250 starts with the pump ticket. The short requests are padded to the longest prompt.

Batching doubled FP16 throughput at the same four-request load

Warm throughput and end-to-end tail at the host

1
FormatBatchRequests/sp95 total, ms
FP1614.261065
FP1649.23519
NF412.711698
NF444.941451
Source: verified Lesson 11 Tesla T4 export.

Separate arrivals from dispatch

Concurrency caps the number of requests admitted together. Batch size caps the number passed to the decoder in one dispatch. With concurrency four and batch size one, four tickets arrive together and the GPU decodes them in four successive calls. At batch size four, one call handles the same tickets. The next wave arrives only after the current one finishes.

This benchmark uses a closed-loop workload. MLPerf separates its single-stream scenario, in which one query follows the previous completion, from server and interactive scenarios with Poisson arrivals and scenario-specific latency constraints. Choose an arrival process that represents the live desk before applying a notebook throughput number to capacity planning. MLCommons inference rules, scenarios and run procedure

# Keep the arrival wave fixed while varying the GPU dispatch size.
for offset in range(0, len(items), concurrency):
    wave = items[offset : offset + concurrency]
    yield [wave[i : i + batch_size] for i in range(0, len(wave), batch_size)]

The timers start at wave admission for both first-token and total latency. Dispatch wait ends when the request’s group starts. Time to first token ends when the first token IDs reach Python. Total time ends after the fixed continuation has been decoded to text.

tfirst=tfirst token at host−tarrival,ttotal=tdecoded at host−tarrival.\begin{aligned} t_{\mathrm{first}} &= t_{\mathrm{first\ token\ at\ host}}-t_{\mathrm{arrival}},\\ t_{\mathrm{total}} &= t_{\mathrm{decoded\ at\ host}}-t_{\mathrm{arrival}}. \end{aligned}

F-250 traded dispatch wait for a longer prefill batch

F-250 in the opening four-request wave, FP16

2
BatchDispatch wait, msFirst token, msTotal, ms
1203255443
4<1235410
Source: verified Lesson 11 Tesla T4 export.

F-250 waited 203 ms in the serial replay and less than 1 ms in the joint batch. Its first digit arrived 20 ms sooner in the batch, even though serving the group increased the time from dispatch to first token. DistServe likewise reports throughput and first-token objectives separately. Its published results come from a system that disaggregates prefill and decode. Both run on one T4 here. DistServe, §6

Compare the slow end of the same waves

An average response time can hide the operator who waits behind several long requests. Compare the same arrival pattern and measure the tail as well as the average.

The experiment calculates the 95th percentile over total request times and subtracts serial p95 from matched-batch p95. To estimate uncertainty, it resamples whole waves in pairs, because requests that arrived together shared both queue and dispatch conditions.

Δ95=Q0.95(tbatch)−Q0.95(tserial).\Delta_{95} = Q_{0.95}(t_{\mathrm{batch}}) - Q_{0.95}(t_{\mathrm{serial}}).

Larger batches reduced most paired latency tails

Matched-batch p95 minus serial p95, within each load and storage format

3
Format / loadΔ ms95% intervalPaired waves
FP16 / 2−193[−278, −115]50
FP16 / 4−546[−702, −389]25
NF4 / 2−253[−408, −125]50
NF4 / 4−247[−644, 174]25
Source: verified Lesson 11 Tesla T4 export.

All four point estimates favour batching. The interval for NF4 at load four crosses zero. Under FP16, the median of a single burst would conceal the largest wait, so review the short and long slices separately.

Short tickets waited behind long ones when dispatched singly

FP16 at load four. Each length slice contains fifty requests.

4
Batch / promptp95 first, msp95 total, ms
1 / short9131175
1 / long627862
4 / short237519
4 / long237519
Source: verified Lesson 11 Tesla T4 export.

With four tickets dispatched singly in FP16, short tickets had a worse p95 than long tickets in this particular mix. The replay admits bursts of alternating short and long requests, so queue position affects both scores. To separate queue position from length, predict what happens after shuffling that order, then compare the dispatch receipts.

Follow the memory

Left padding aligns the last real prompt token in each row so the decoder can select the first continuation token together. Each mixed batch consumes dense positions for its longest prompt. Across the warm FP16 replay at load four, the same 21,800 prompt tokens occupied 36,500 dense positions in the batched setting.

The vLLM PagedAttention authors describe how their cache manager allocates blocks and changes which requests can share the device. The notebook uses dense batches with a different scheduler, so it measures its own dense positions instead of assuming paged-cache behaviour. PagedAttention, §§3–4

NF4 cut peak allocation while padding still consumed positions

Warm allocator peak and dense positions at load four

5
Format / batchPeak MiBLogical tokensDense positions
FP16 / 1298721,80021,800
FP16 / 4308821,80036,500
NF4 / 1122121,80021,800
NF4 / 4130221,80036,500
Source: verified Lesson 11 Tesla T4 export.

NF4 compresses the stored weights and dequantises them for computation. In this benchmark its smaller allocation came with slower execution at matched settings. The QLoRA authors describe block-wise NF4 storage and a higher-precision compute type, with a separate adapter-training evaluation. That storage and compute distinction explains why an NF4 memory win need not become a throughput win. QLoRA, §§3–4

Read the returned digit and its continuation

Compare the opening F-250 request at the same concurrency with both FP16 dispatch sizes. The first digit is correct either way. The saved continuation is a useful counterexample to treating the first-token probe as a complete production reply.

load-001 · F-250 · long priority request in the opening burst

Expected first digit
3
FP16 batch 1 raw decode
3 Human:
FP16 batch 4 raw decode
3 Human:

The first digit passes in both traces. The fixed six-token continuation includes a speaker marker, so the export does not show a response consisting of only one digit.

Both weight formats kept the same first digits on the probe

One-request probe and single warm replay, where load and batch are both one

6
FormatLoad, sExact probeWarm rps
FP1617.3412/124.39
NF412.3212/122.58
Source: verified Lesson 11 Tesla T4 export.

The walkthrough used a small exact-digit probe to check that changing the storage format did not disturb this task. The first-token capture passes all requests at these warm settings. Full-answer quality, network delivery and decoder stop behaviour require their own checks. NVIDIA’s benchmark walkthrough likewise fixes the input mix and output budget so comparisons are reproducible, and its streaming measurements cover a different client path. TensorRT-LLM performance benchmarking walkthrough

What to keep

If the desk needs…Start with…Check before changing it
Faster clearing of simultaneous requestsA matched FP16 batchBatch-four p95 total fell to 519 ms at load four. Measure whether isolated requests would wait for a batch to fill in your serving system.
Low first-token latency when quietA single FP16 dispatchAt load one its warm p95 first token was 58 ms. Increase load separately from batch size.
More GPU memory headroomNF4The warm batch-four peak was 1,302 MiB versus 3,088 MiB for FP16, at 4.94 versus 9.23 requests/s. Re-run the digit probe and complete response checks.

Next to try, not tested here

  • Admit requests on a fixed external arrival schedule. Predict where queue tails rise before raising the rate.
  • Group similar prompt lengths. Predict which of the recorded short and long slices benefits when less padding is needed.
  • Add a one-digit stopping rule. Predict whether payload compliance changes independently of first-token accuracy.

How it was built

ItemSetting
ModelQwen2.5-1.5B-Instruct, both formats at 989aa7980e4cf806f80c7fef2b1adb7bc71aa306
HardwareOne Tesla T4, CUDA 13.0
RuntimePython 3.13.16, PyTorch 2.14.1+cu130, Transformers 4.51.3, bitsandbytes 0.49.0
RequestsSynthetic helpdesk priority questions, 100 per warm setting, equally split by prompt length
Load and scheduleConcurrency 1, 2 and 4. Dispatch singly or in matched batches. Same request order.
DecodeGreedy, fixed six-token continuation, first raw digit scored
Tail interval1,500 paired wave resamples. Seed 11.
TimingPrewarm replay kept separate from warm figures. GPU allocation comes from PyTorch.

Time and cost The measurement block took 319.48 s. Full notebook execution on the T4 took 336.60 s. FP16 model load took 17.34 s and NF4 load took 12.32 s. These receipts measure elapsed time. Colab compute-unit charging is separate.

Run it yourself

Open the notebook from the lesson header or download the executed export below. “Where does F-250 wait?” reconstructs the opening burst. The warm replay records the latency and memory comparisons. The paired tail and precision sections print the interval and digit-probe checks.

  1. Fix concurrency at four and change only the batch size from one to four. Predict the direction of throughput and p95 dispatch wait before inspecting the summary.
  2. Hold load four and batch four fixed. Change FP16 to NF4 and predict the memory and throughput trade-off.
  3. Keep FP16 batch size four and reorder the same prompts by length. Predict the difference in dense positions and which short requests move to a different wave.

Next, route and cache requests before they reach the GPU.

How is this page?

Last updated on