5.3.18 · D3MLOps & Deployment

Worked examples — LLM serving (vLLM, quantized inference)

3,389 words15 min readBack to topic

Before any numbers, one reminder of the two formulas everything below leans on:


The scenario matrix

Every serving/quantization question is really one of these cells. The examples below are labelled [C1][C10] so you can see the whole space is covered. The figure gives the same map at a glance.

Figure — LLM serving (vLLM, quantized inference)
Cell Case class What breaks / what's tested
C1 KV cache — small/typical plug-in sanity, unit tracking
C2 KV cache — batch scaling limit when does it OOM? linear-in- growth
C3 KV cache — degenerate prefill of a 1-token prompt, tail-block waste
C4 Paged vs naive waste fragmentation arithmetic, block-size choice
C5 Quantize — interior value normal rounding, bounded error
C6 Quantize — boundary / clip value at/over saturates
C7 Quantize — degenerate range division by zero, the flat-tensor case
C8 Quantize — limit error , why more bits help nonlinearly
C9 Real-world word problem "how many users fit?" full GPU budget
C10 Exam twist INT4 vs INT8 error ratio — beat the linear trap

The worked examples


Recall

Recall Every cell, one line each

Per-request KV for 13B at , FP16 ::: GiB. Largest batch in a 40 GiB KV pool at that size ::: 12 (floor of 12.8). Paged vs naive waste for 100 tokens, max_len 2048, block 16 ::: 12 tokens vs 1948 tokens (~162× less). Quantizing in INT4 gives and error ::: , error . What guards the case ::: floor the scale to a small positive (or store the constant directly) so you never divide by zero. True INT4-vs-INT8 error ratio for the same range ::: ~17× (not 2×), because gaps are . Why divides by not ::: is a step length; ticks leave gaps (fence-post rule). What the zero-point does geometrically ::: shifts the integer grid so tick lands exactly on real value .