Intro
Cost and performance optimization is a key topic for almost every organization out there, including yours, but when it comes to optimizing your AI stack, the plot thickens and the exercise becomes multilayered and complex very, very fast.
This article kicks off a new series on AI inference optimization. We’ll walk through key techniques and methods for optimizing the inference engine in your stack to maximize performance per €, $ (or any currency of your choice). To squeeze the most out of your AI stack performance, we need to evaluate and apply a wide spectrum of inference optimization techniques, tuned to your specific workload, model, hardware and target concurrency (peak usage load). Copying the recipe without adapting it to your needs won’t yield the most optimal results.
Every dot in the chart below is the same model, on the same GPUs and serving the same workload. The only thing that changes is how the vLLM engine is configured, and as you can see, turning the right knobs gets you a lot more out of the very same hardware. The best configuration sits well away from the pack, in a spot we wouldn’t have thought to try. Batch limits, scheduler settings, speculative decoding, memory utilization, prefix caching: each of them matters, especially when looking at the various combinations between them.
Tuning them by hand simply doesn’t scale. Hence the auto-optimization techniques we are working on at aistack. (More on those soon.) The result is an impactful stack of optimizations over your inference engine, tuned to your model, workload and hardware. They’re worth it as you can see from the graphs below, resulting in almost 4X the token throughput for the same stack, as compared to the vanilla setup.
GLM5.3-Flash-FP8 @ c96, 4×H200 NVL
Throughput × interactivity, one dot per tested configuration.
Qwen3.8-27B-FP8 @ c32, 1×H200 NVL
Throughput × interactivity, one dot per tested configuration.
While all of these optimization techniques and different configurations warrant a deep dive (and some of them will get one), let’s take it step by step. This blog post is about one of the most important techniques: quantization. Specifically, we’ll dive into detail on its computational gains and its impact on model accuracy for agentic coding workloads.
A note on how to read this post. The first half is the technical groundwork: number formats, how quantization works and what the different dtypes trade off. It’s useful if you want to understand why the results look the way they do, but you don’t need it to use them. If you’re here for the verdict, skip straight to the Evaluation setup and the results sections, or to the Conclusions at the end, and come back to the basics when someone on your team asks why INT4 was slower than FP8.
Why quantize models in the first place?
Well, let’s assume a company invested quite a lot of money in a new shiny B200 node with 8 accelerators. It wants to run frontier open-source models like Kimi-K3. The B200 node gives 1440–1536 GB of HBM3e memory in total, which sounds decent until you realize the 2.8T parameters in Kimi K3* add at least ~5.6 TB (in BF16) to the equation. Another example: your new RTX 5090 card comes with 32 GB of VRAM and you want to run the new Qwen3.8-27B model on it, but that would need 54 GB at half precision.
In both cases, quantization is what fits the model onto the hardware. But fitting the model is only half the story.
Fewer bits mean less storage and less data to move through GPU memory. Suitable kernels can also perform calculations faster at lower precision. These benefits can make room for more cached context or concurrent requests. The tradeoff is possible quality loss, plus the cost of scaling and format conversion. The result depends on the model, numerical format, GPU, and kernel, and that’s what we did our best to measure for agentic coding workloads.
*Kimi K3 is natively MXFP4 quantized.
Quantization basics
Integer and floating-point formats
Quantization reduces the precision used to represent numerical values by mapping them from a higher-precision domain to a lower-precision format. The target representation can be an integer or a floating-point format. Modern accelerators support both integer formats like INT8/INT4 and low-precision float formats such as FP8 and FP4 [1][2][3][4].
Integer affine quantization uses a uniformly spaced grid, whereas floating-point formats encode values using sign, exponent and mantissa fields, so the spacing between representable values varies with magnitude.
Conceptually, quantization can be written as a projection onto the set of values representable by a chosen numerical scheme:
where \(\mathcal{Q}\) may correspond to an integer grid, an FP8/FP4 encoding or a scaled block representation.
Uniform affine integer quantization
Uniform affine quantization is a widely used method for quantizing to integers [1]. Jacob et al. define it with a scale and a zero-point. Follow the maths on the left and the matching PyTorch on the right as you scroll: we quantize the float32 number 0.37 to 4 bits over the range [-1.2, 0.8].
- 01 · Setup
A real value
xand its integer codeqare related by a scalesand an integer zero-pointz, chosen so that real zero is exactly representable [1].\[ x = s(q-z) \]For
bbits the integer grid is\[ q_{\min} = 0, \qquad q_{\max} = 2^b - 1 \]and a real-value range:
\[ [x_{\min}, x_{\max}] \]import torch x = torch.tensor(0.37, dtype=torch.float32) # 4-bit unsigned quantization: 16 representable levels qmin, qmax = 0, 15 xmin, xmax = -1.2, 0.8 - 02 · Scale
The step between neighboring codes [1] (eq. 12):
\[ s = \frac{x_{\max} - x_{\min}}{q_{\max} - q_{\min}} \]scale = (xmax - xmin) / (qmax - qmin) - 03 · Zero-point
The integer code that real zero maps to:
\[ z = \operatorname{clip}\left( \left\lfloor q_{\min} - \frac{x_{\min}}{s} \right\rceil, q_{\min}, q_{\max} \right) \]zero_point = round(qmin - xmin / scale) - 04 · Quantize
Real value to integer code, clipped to the grid:
\[ q(x) = \operatorname{clip}\left( \left\lfloor \frac{x}{s} \right\rceil + z, q_{\min}, q_{\max} \right) \]# Quantize: FP32 -> integer code q = torch.clamp( torch.round(x / scale) + zero_point, qmin, qmax, ).to(torch.uint8) # torch stores tensors in 8-bit container even though only values 0..15 used, production-grade int4 implementations used packed or specialized low-bit representations. - 05 · Reconstruct
Integer code back to an approximate real value:
\[ \hat{x} = s(q-z) \]# Dequantize: integer code -> FP32 approximation x_hat = scale * (q.to(torch.float32) - zero_point) error = x_hat - x - 06 · Result
The grid is uniform: adjacent codes differ by exactly
s, so0.37lands on the nearest step,0.40. Hit Compile to run it.print(f"original: {x.item():.4f} ({x.dtype})") print(f"quantized: {q.item()} ({q.dtype})") print(f"dequantized: {x_hat.item():.4f} ({x_hat.dtype})") print(f"error: {error.item():.4f}")
PyTorch stores the tensor in an 8-bit container even though only values 0–15 are used; production-grade INT4 implementations use packed or specialized low-bit representations.
Uniform affine quantization produces a uniform grid: adjacent integer codes differ by the same amount s, while FP8 and FP4 obtain additional dynamic range through exponent-based non-uniform spacing. [1][2][3]
This is a simple example of quantization error: the original value cannot be exactly represented on the 4-bit quantization grid, so 0.37 is projected onto the nearest representable value, 0.40.
Quantization is therefore inherently lossy: reducing bit width coarsens the representable grid and increases reconstruction error. The resulting rounding error, together with clipping error — when values fall outside the calibrated range — are the factors that can degrade model accuracy.
Quantization, explained
Animated with Manim, the library behind the 3Blue1Brown videos.
PTQ and QAT
In general, quantization methods fall into two categories: post-training quantization (PTQ) and quantization-aware training (QAT).
The idea behind PTQ is to convert a pre-trained model to a lower-precision format without retraining its weights. Usually, a small calibration dataset is used to determine quantization scales, optimize rounding decisions and identify outliers. The widely used methods are GPTQ [5] and AWQ [6].
Quantization-aware training (QAT), in contrast, simulates quantization during the training or fine-tuning phase, allowing the model to adapt to numerical errors introduced by lower precision. QAT can recover accuracy when aggressive quantization causes substantial degradation, especially for small language models [7].
Which dtypes are used in modern LLMs?
A data type (often called a dtype) determines how a computer represents a number. Every numerical data type has a finite set of values it can represent. Quantization maps the original numbers onto a smaller set of available values, and numbers that have no exact representation must be approximated. For example, a format with steps of 0.01 would round 0.123 to 0.12. This difference is the quantization error, which can cause accuracy loss in language models.
There are two important dtype concepts - range and precision:
- Range describes how large or small the represented values can be.
- Precision describes how finely the format can distinguish nearby values.
Fewer bits can reduce range, precision, or both.
BF16 and FP16 are common 16-bit formats for LLM weights and computation (usually referred to as half precision), while FP32 remains useful for operations that need greater numerical precision (full precision).
BF16, the “brain float” developed by Google, offers a wider numerical range than FP16, but less precision. FP8 reduces storage to 8 bits per value and can accelerate computation on supported GPUs; E4M3 favors precision, while E5M2 favors range and is more suitable for training use cases.
INT8 and INT4 provide integer representations for quantized inference, while NVFP4 combines 4-bit floating-point values with scale factors on Blackwell GPUs. These formats offer different tradeoffs between memory, speed, and quality, and the weights, activations, and KV cache can each use a different format.
This is not the complete list by any means, but these are the most widely used data types.
How each format spends its bits
Sign, exponent and mantissa, with the scale factors that the 4-bit and integer formats carry on the side.
| Format | Bytes/value | 27B weights | Peak math vs BF16 (H100 / B200) | GPU support | Best use case |
|---|---|---|---|---|---|
| FP32[8][9][10] | 4 | ~108 GB | 0.07× / 0.03× (67 / 75 TFLOPS on non-tensor cores) | All | Master weights, optimizer states, accumulators, softmax and norm math |
| BF16[11][9][10] | 2 | ~54 GB | 1× (989 / 2,250 TFLOPS) | Ampere and later; TPUs | Default for training and inference |
| FP16[12][9] | 2 | ~54 GB | 1× / 1× | All modern GPUs | Older training with loss scaling; inference on pre-Ampere GPUs |
| FP8 E4M3[2][9][10][13][14][15] | 1 | ~27 GB | 2× / 2× (1,979 / 4,500 TFLOPS) | Ada, Hopper, Blackwell; AMD MI300 and later | W8A8 inference (often best choice), FP8 training forward pass, KV cache |
| FP8 E5M2[2][14] | 1 | ~27 GB | 2× / 2× | Same as E4M3 | Calculating gradients in training; KV cache without calibrated scales |
| INT8[9][10][13] | 1 | ~27 GB | 2× / 2× | All modern GPUs | W8A8 inference on GPUs without FP8 support; needs calibration (e.g. SmoothQuant) |
| INT4 (AWQ, W4A16)[16][13][6] | ~0.52 | ~14 GB | 1× math (dequantized to FP16), but up to ~4× on linear layers in memory-bound decode | Any modern GPU; Marlin kernels need Ampere or later | Low-batch latency; fitting large models on small GPUs |
| NVFP4[4][10][15] | ~0.56 | ~15.2 GB | n/a (not supported on Hopper) / 4× (9,000 TFLOPS) | Blackwell only | High-throughput inference on Blackwell |
| MXFP4 | ~0.53 (4.25 bits) | ~14.3 GB | H100: no native support (weights upcast, so ~1× math). B200: 4× (shares the FP4 tensor path with NVFP4). MI355X: 4× | Native: Blackwell, AMD MI350/MI355X. Weight-only fallback on older GPUs (H100, A100) | Open, cross-vendor 4-bit weights, especially MoE expert weights (e.g. gpt-oss) [3][17][18] |
Weight sizes in this table are theoretical (27B parameters × bytes per value). Real checkpoints are larger, which is why the INT4 AWQ and NVFP4 checkpoints weigh about 19 GB (see the weights size tables below): not every layer is quantized (in the Qwen3.8-27B checkpoints the lm_head, the vision encoder and the MTP head stay in 16-bit, along with parts of the linear-attention layers, and the NVFP4 checkpoint keeps its attention projections in FP8), and the per-group scales and zero-points are stored on top.
Full spec: layout, range and precision
| Format | Layout (sign/exp/mantissa) | Max value / dynamic range | Precision |
|---|---|---|---|
| FP32 | 1/8/23 | ~3.4 × 10³⁸, ~10⁻³⁸ to 10³⁸ | ~7 decimal digits |
| BF16 | 1/8/7 | Same as FP32 | 7-bit mantissa (~0.4% step) |
| FP16 | 1/5/10 | Max 65,504, smallest ~6 × 10⁻⁸ | 10-bit mantissa |
| FP8 E4M3 | 1/4/3 | Max 448 (240 on AMD MI300’s FNUZ variant); ~18 powers of two | 3-bit mantissa (~6% step) |
| FP8 E5M2 | 1/5/2 | Max 57,344; ~32 powers of two | 2-bit mantissa (~12% step) |
| INT8 | 8-bit integer + scale | Uniform grid of 255 steps × scale | Uniform steps |
| INT4 (AWQ, W4A16) | 4-bit integer + per-group scale and zero-point | 16 levels × group scale | Uniform, 15 steps per group |
| NVFP4 | 1/2/1 + FP8 scale per 16 values + FP32 tensor scale | Range comes mostly from the two levels of scales | 1-bit mantissa |
| MXFP4 | 1/2/1 (E2M1) + one power-of-two (E8M0) scale per 32 values | Elements reach ±6; the block scale covers 2⁻¹²⁷ to 2¹²⁷ | 1-bit mantissa; the power-of-two scale adds rounding error at the block maximum |
What can we quantize?
Actually, a lot: weights, activations and KV cache.
Where each quantizable part lives on the inference path
Numbers mark the four things that can be stored at lower precision.
- Weights are the parameters learned during training.
- Activations are intermediate values produced during computation.
- KV cache stores attention information from previous tokens so the model can reuse it, one of the crucial tricks to speed up inference for Transformers.
- Recurrent state in state-space layers of hybrid Transformers can be quantized too. It is usually kept in high-precision FP32 since the state is relatively tiny and gets updated recurrently, hence it needs to be fine-grained.
| Part | What it stores | Possible benefit |
|---|---|---|
| Weights | Model parameters, shared by requests | More memory for caches; less weight traffic |
| Activations | Intermediate values during computation | Lower temporary memory use; faster supported calculations |
| Attention KV cache | Keys and values from previous tokens | More cached tokens; less attention memory traffic |
| Recurrent state | State for linear-attention or state-space model (SSM) layers | Smaller state pages; possible change in cache geometry |
Fewer bits, more room
Measured on the DeepSWE run, the BF16 model hit its memory ceiling; the INT4 model never did.
Evaluation setup
We performed our experiments using the following models and precisions:
Qwen3.8-27B
| Precision | Checkpoint |
|---|---|
| BF16 | Qwen/Qwen3.8-27B |
| FP8 | Qwen/Qwen3.8-27B-FP8 |
| INT4 AWQ | cyankiwi/Qwen3.8-27B-AWQ-INT4 |
| NVFP4 | nvidia/Qwen3.8-27B-NVFP4 |
GLM5.3-Flash
| Precision | Checkpoint |
|---|---|
| FP8 | unsloth/GLM-5.3-Flash-FP8 |
| INT4 AWQ | wtdcode/GLM-5.3-Flash-AWQ-W4A16 |
- vLLM version:
vllm/vllm-openai:v0.29.0for Qwen, the official day-zero image for GLM5.3-Flash. - Harness: Codex for Qwen, Claude Code for GLM5.3-Flash.
- Hardware: 1×H200, 2×H200 NVL (TP2) for Qwen3.8-27B, 4×H200 NVL (TP4) for GLM5.3-Flash, 1×B200 for the Qwen3.8-27B NVFP4 measurements.
- We use the default recommended vLLM configuration for both models.
Qwen3.8-27B vLLM config
- --tensor-parallel-size
- "2"
- --gpu-memory-utilization
- "0.9"
- --reasoning-parser
- qwen3
- --enable-auto-tool-choice
- --tool-call-parser
- qwen3_coder
- --enable-prefix-caching
- --enable-chunked-prefill
- --speculative-config
- '{"method":"qwen3_next_mtp","num_speculative_tokens":3}'
- --language-model-onlyGLM5.3-Flash vLLM config
- --tensor-parallel-size
- "4"
- --gpu-memory-utilization
- "0.92"
- --reasoning-parser
- glm45
- --enable-auto-tool-choice
- --enable-prefix-caching
- --enable-chunked-prefill
- --tool-call-parser
- glm47
- --language-model-only
- --no-enable-flashinfer-autotune
- --speculative-config
- '{"method":"mtp","num_speculative_tokens":5}'*We don’t provide performance comparison results for NVFP4 against other precisions due to the different hardware used.
*We don’t provide the BF16 measurements for GLM5.3-Flash: its BF16 weights are larger than the 4×H200 NVL memory pool.

Weight and activation quantization
We’ve run quite a few experiments to measure the impact of quantization on a usual dev workflow: solving typical SWE problems with a typical dev stack.
One may argue it’s obvious that reducing dtype precision from 16 to 8/4 bits will degrade model accuracy on coding tasks, as reported by many one-shot pass@1 benchmarks [19].
Those measurements are mostly based on relatively constrained, one-shot code generation benchmarks. Real devs, and so coding agents, operate very differently: they navigate repos, use tools, observe compiler and test feedback, revise the results and iterate, iterate, iterate.
But what are the results on a real multi-turn agentic workflow using real coding agents and harnesses? The real picture is more complex than simple benchmark measurements, and you may be surprised by the results.
We evaluated two very popular frontier open-weight models, Qwen3.8-27B and GLM5.3-Flash, in different quantizations to measure performance and accuracy trade-offs on multi-turn agentic SWE benchmarks: DeepSWE and SWE-Bench-Pro.
Weights size
Weight memory by precision, Qwen3.8-27B
GB needed to hold the weights.
Qwen3.8-27B
| Precision | Memory (GB) |
|---|---|
| BF16 | 54 |
| FP8 | 27 |
| INT4 AWQ | ~19 |
| NVFP4 | ~19 |
GLM5.3-Flash
| Precision | Memory (GB) |
|---|---|
| BF16 | 642 |
| FP8 | 321 |
| INT4 AWQ | 180 |
Impact on performance
Four headline metrics, Qwen3.8-27B on DeepSWE
Three precisions per metric. The full table follows.
| Metric | BF16 | FP8 | INT4 AWQ | Δ FP8 | Δ INT4 AWQ |
|---|---|---|---|---|---|
| Throughput · higher is better | |||||
| out tok/s | 857 | 985 | 808 | +14.8% better | −5.8% worse |
| req/s | 0.905 | 1.061 | 0.864 | +17.3% better | −4.5% worse |
| tasks/h | 21.7 | 25.6 | 20.1 | +17.9% better | −7.6% worse |
| resolved/h | 8.1 | 11.7 | 7.2 | +45.6% better | −11.1% worse |
| Time to first token (TTFT), ms · lower is better | |||||
| mean | 930.2 | 749.6 | 1039.5 | −19.4% better | +11.7% worse |
| p50 | 531.9 | 498.0 | 656.9 | −6.4% better | +23.5% worse |
| p90 | 914.7 | 878.7 | 1533.9 | −3.9% better | +67.7% worse |
| p99 | 17473.1 | 11430.7 | 13792.0 | −34.6% better | −21.1% better |
| Inter-token latency (ITL), ms · lower is better | |||||
| mean | 39.7 | 33.5 | 43.8 | −15.5% better | +10.3% worse |
| p50 | 35.0 | 24.8 | 35.5 | −29.1% better | +1.4% |
| p90 | 48.6 | 47.4 | 48.6 | −2.4% | +0.1% |
| p99 | 253.6 | 197.6 | 297.6 | −22.1% better | +17.4% worse |
| Time per output token (TPOT), ms · lower is better | |||||
| mean | 13.2 | 11.1 | 14.5 | −15.9% better | +9.5% worse |
| p50 | 15.4 | 11.9 | 16.5 | −22.7% better | +6.9% worse |
| p90 | 23.4 | 22.6 | 23.7 | −3.3% better | +1.3% |
| p99 | 43.8 | 25.4 | 45.0 | −41.9% better | +2.7% |
| KV cache usage · lower is better | |||||
| mean | 0.477 | 0.396 | 0.411 | −17.0% better | −13.7% better |
| p50 | 0.468 | 0.391 | 0.412 | −16.5% better | −11.9% better |
| p90 | 0.634 | 0.546 | 0.530 | −13.9% better | −16.3% better |
| max | 0.999 | 0.828 | 0.766 | −17.2% better | −23.4% better |
| preemptions | 2 | 0 | 0 | 2 → 0 better | 2 → 0 better |
Our experiments show that lower precision doesn’t automatically translate into higher throughput.
FP8 is the clear performance winner: output throughput improves by 15% and mean TTFT drops by ~20%. This can also be explained from the hardware side: modern accelerators, including the H200 (Hopper) we use, natively support FP8, with dedicated Tensor Cores that perform GEMMs directly in FP8. Lower precision reduces memory traffic while also increasing matmul throughput, so FP8 compression translates directly into faster inference [20]. NVIDIA’s own Transformer Engine measurements on H200 NVL show the same effect at the layer level: FP8 runs the per-layer GEMMs 1.92× faster than BF16 in pre-quantized mode (hidden size 4096, 24 layers).
INT4 AWQ behaves differently. Although the memory required for the weights drops by more than 60% compared to BF16, throughput degrades by 6%. AWQ typically uses the W4A16 scheme: weights are stored in 4 bits and activations remain in BF16/FP16. The GEMM kernel unpacks and dequantizes INT4 weight tiles using their scales and zero-points before multiplying them with the activations. There are optimized implementations where dequantization is fused into the GEMM rather than materializing a full weight matrix in 16-bit precision, but this still introduces extra instructions and scheduling overhead [16].
INT4 provides substantially more memory headroom, while FP8 delivers the better latency/throughput trade-off. In other words, INT4 is primarily a memory optimization in this configuration; FP8 is both a memory and a compute optimization. Which one to use really depends on your system. If the memory pool is too limited to use FP8 precision and your accelerators don’t support the FP4 formats (NVFP4, MXFP4), INT4 can be the right choice.
Impact on accuracy
Tasks solved by precision, Qwen3.8-27B
One dot per precision on two benchmarks; whiskers show the spread over repeated runs.
Qwen3.8-27B eval results
| Checkpoint | Precision / quantization format | SWE-Bench-Pro 64 curated subset (mean/std) | DeepSWE, 110 tasks (mean/std) |
|---|---|---|---|
Qwen/Qwen3.8-27B | BF16 | 33 / 0.7 | 43 / 0.7 |
Qwen/Qwen3.8-27B-FP8 | FP8 (W8A8) | 30 / 0.7 | 43 / 2.12 |
cyankiwi/Qwen3.8-27B-AWQ-INT4 | INT4 AWQ (W4A16) | 32 / 2.64 | 39 / 0.7 |
nvidia/Qwen3.8-27B-NVFP4 | NVFP4 | 31 (1 run) | 51 (1 run) |
GLM5.3-Flash eval results
| Checkpoint | Precision / quantization format | SWE-Bench-Pro 64 curated subset (mean/std) | DeepSWE, 110 tasks (mean/std) |
|---|---|---|---|
unsloth/GLM-5.3-Flash-FP8 | FP8 (W8A8) | 33 / 0.7 | 69 / 7 |
wtdcode/GLM-5.3-Flash-AWQ-W4A16 | INT4 AWQ (W4A16) | 35 / 0.7 | 69 / 6 |
These results challenge the simple assumption that lower precision translates into worse agent performance.
On our 64-task SWE-Bench-Pro subset, the BF16 Qwen model solves 33 tasks, while the INT4 AWQ and FP8 models solve 32 and 30 respectively. The 4-bit quantized model shows no measurable degradation in this experiment, while the FP8 difference is relatively small.
DeepSWE paints an even more surprising picture. The BF16 model solves 43 tasks, compared to 43 for FP8 and 39 for INT4 AWQ. NVFP4 reaches 51, but that is a single run on a different GPU (B200), so we don’t read it as a gain; the other quantized variants stay close to BF16.
The results for GLM5.3-Flash are in line with the observations for Qwen. These two community checkpoints demonstrate similar accuracy: INT4 AWQ is lossless compared to FP8, which is also observed in the literature [19].
Another puzzling observation is the high variance on the DeepSWE benchmark. The same configuration was used for all the runs, generation parameters were controlled by the harnesses, and no infrastructure failures were observed. We’ll update this post once we find the reason, in case it’s more than just LLMs’ non-deterministic nature. Agentic SWE evaluations are known to vary substantially between runs, even at temperature 0 [21].
These results don’t mean that quantization makes the models more capable. Quantization perturbs the model’s logits, and in an autoregressive agent even a small perturbation can send execution down a different trajectory: the agent may inspect another file, call a different tool, revise an earlier hypothesis, or produce a different patch. In a long-running agentic workflow, these differences add up over many turns.
Recent work on SWE-Bench evaluation found substantial run-to-run variance and showed that trajectories can diverge within the first few percent of generated tokens [21]. Similar effects have been observed in previous quantization studies: Liu et al. report cases where W4A16 models slightly outperform their BF16 baseline on LiveCodeBench, despite finding that the broader effect of quantization is neutral or negative as precision becomes more aggressive [19]. Melin et al. also report coding benchmarks where quantized models outperform their unquantized counterparts [22]. The quality of PTQ-quantized models, however, also depends on the calibration datasets used.
Quantization introduces numerical error, but agentic benchmark performance is the result of an entire trajectory. A slightly perturbed model can occasionally discover a better trajectory than its higher-precision counterpart.
KV cache quantization
We’ve conducted similar experiments to measure the impact of KV cache quantization on multi-turn agentic coding workloads [23].
*We use per-tensor uncalibrated quantization scales for the FP8 cache (scale = 1.0).
KV cache pool size
| Precision | Tokens |
|---|---|
| BF16 | 3,114,393 |
| FP8 | 5,967,803 |
FP8 precision almost doubles the available KV cache pool.
Same memory, twice the context
Preemptions are measured at 32 concurrent agents on one H200, where the FP8 cache also raised output throughput by 60%; at low load, the extra FP8 overhead makes it slower. The pools are an illustration of the mechanism.
Impact on performance
Experiment 1 · Qwen3.8-27B-FP8 · c16 · 2×H200 NVLLow concurrency with lots of spare memory · KV BF16 (default) vs KV FP8
| metric | KV BF16 (default) | KV FP8 | Δ KV FP8 |
|---|---|---|---|
| out tok/s | 985 | 677 | −31.3% |
| req/s | 1.061 | 0.709 | −33.2% |
| kv mean | 0.396 | 0.240 | −39.3% |
| kv p50 | 0.391 | 0.241 | −38.4% |
| kv p90 | 0.546 | 0.306 | −43.9% |
| kv max | 0.828 | 0.416 | −49.7% |
| preemptions | 0 | 0 | +0.0% |
| ttft mean | 749.6 ms | 1035.8 ms | +38.2% |
| ttft p50 | 498.0 ms | 794.5 ms | +59.5% |
| ttft p90 | 878.7 ms | 2041.8 ms | +132.4% |
| ttft p99 | 11430.7 ms | 3336.8 ms | −70.8% |
| itl mean | 33.5 ms | 53.9 ms | +60.8% |
| itl p50 | 24.8 ms | 40.1 ms | +61.4% |
| itl p90 | 47.4 ms | 66.7 ms | +40.7% |
| itl p99 | 197.6 ms | 425.6 ms | +115.3% |
| tpot mean | 11.1 ms | 18.3 ms | +64.5% |
| tpot p50 | 11.9 ms | 17.9 ms | +50.4% |
| tpot p90 | 22.6 ms | 24.8 ms | +9.7% |
| tpot p99 | 25.4 ms | 48.2 ms | +89.4% |
Experiment 2 · Qwen3.8-27B-FP8 · c32 · 1×H200High concurrency, memory-constrained regime · KV BF16 vs KV FP8
| metric | KV BF16 | KV FP8 | Δ KV FP8 |
|---|---|---|---|
| out tok/s | 233 | 373 | +60.2% |
| req/s | 0.389 | 0.542 | +39.3% |
| kv mean | 0.891 | 0.790 | −11.3% |
| kv p50 | 0.938 | 0.846 | −9.8% |
| kv p90 | 0.983 | 0.962 | −2.1% |
| kv max | 1.000 | 1.000 | +0.0% |
| preemptions | 153 | 20 | −86.9% |
| ttft mean | 25371.6 ms | 7039.2 ms | −72.3% |
| ttft p50 | 3791.2 ms | 1716.5 ms | −54.7% |
| ttft p90 | 73625.0 ms | 15568.4 ms | −78.9% |
| ttft p99 | 145104.2 ms | 78032.7 ms | −46.2% |
| itl mean | 264.7 ms | 268.8 ms | +1.6% |
| itl p50 | 71.5 ms | 120.4 ms | +68.4% |
| itl p90 | 768.8 ms | 866.8 ms | +12.8% |
| itl p99 | 977.4 ms | 2225.3 ms | +127.7% |
| tpot mean | 75.5 ms | 85.2 ms | +12.9% |
| tpot p50 | 61.8 ms | 63.7 ms | +3.0% |
| tpot p90 | 145.8 ms | 175.1 ms | +20.1% |
| tpot p99 | 257.2 ms | 331.5 ms | +28.9% |
*We were not able to run the KV cache comparison for GLM5.3-Flash: there was a problem with vLLM in the day-zero GLM image when setting the KV cache dtype to FP8. The post will be updated when the issue is resolved.
Results analysis
Experiment 1
Quantizing the KV cache from BF16 to FP8 does exactly what we expect on memory: mean KV utilization falls by 39% while peak utilization drops by almost 50%. However, the memory saving doesn’t translate into speed for low-concurrency scenarios with no memory pressure. FP8 cache reduces output throughput by 31%, request throughput by 33%. Mean TPOT increases from 11.1 ms to 18.3 ms (+65%), while mean ITL rises by 61%.
The likely explanation is the attention kernel path. Attention must consume quantized KV values, apply their scales and, depending on the backend, quantize the query or perform additional conversion inside the attention kernels. All these operations introduce fixed overhead and the FP8 attention kernels themselves may be less efficient for a particular head dimension, sequence-length distribution and GPU architecture.
We profiled the inference engine and collected the Nsight Systems traces to investigate this phenomenon.
The decode attention kernel gets slower, not faster
With FP8 KV, FA3 switches from the bfloat16 / 128x80 kernel to the float_e4m3_t / 128x128 kernel. Each call is 24–58% slower across all tested batch sizes and context lengths.
| Point | Attention per layer, BF16 → FP8 | Memory bandwidth achieved* |
|---|---|---|
| b1, 128k | 137 → 192 µs (+40%) | 3.8 TB/s → 1.4 TB/s |
| b8, 32k | 252 → 340 µs (+35%) | 4.2 TB/s → 1.55 TB/s |
*Based on 4 KV heads × head dim 256, matching the KV-cache size logged by vLLM.
The BF16 kernel achieves about 80–87% of the H200’s memory bandwidth. The FP8 kernel reads half as many bytes but achieves less than a third of that bandwidth. The expected 2× speedup from moving half the data never materializes because the FP8 kernel is limited by computation rather than memory bandwidth.
As a result, whole decode steps take 0.5–10% longer (e.g. 12.99 → 13.87 ms at b1/128k and 15.9 → 17.4 ms at b8/32k). The slower attention kernel accounts for essentially all of this increase.
vLLM team has also observed a similar phenomenon in their own FP8 KV-cache work. Their benchmarks show that halving KV-cache traffic can significantly accelerate memory-bound long-context decoding, but also that these gains are highly kernel- and architecture-dependent. In particular, they found configurations where FP8 overhead could not be amortized, and recommend leaving some layers of hybrid models in BF16 because quantizing them is actually slower. [24]
Experiment 2
But what are the results for the high-concurrency + high memory pressure regime? We measured that at c32 on a single H200, with the same Qwen3.8 model: BF16 KV reaches 100% cache utilization and triggers 153 preemptions. FP8 cache reduces that to only 20 preemptions (−87%), increasing the output throughput by 60% and reducing mean TTFT from 25.4 s to 7.0 s (−72%).
However, FP8 is still slower once a request is in the decoding phase: mean TPOT increases by 13% with most ITL percentiles regressing. The throughput improvement comes from allowing substantially more useful work to remain resident in the fast HBM memory.
When vLLM runs out of KV-cache capacity, requests are preempted and later recomputed, which directly increases queueing, wasted compute and end-to-end latency. FP8 roughly halves the bytes required per cached K/V element, increasing effective cache capacity and reducing this scheduling pressure. vLLM’s own FP8 KV-cache analysis reaches a similar conclusion: the benefit grows with concurrency and context length, while at lower load the additional FP8 attention overhead can outweigh the bandwidth savings [24].
The lesson here is that KV-cache quantization is a capacity optimization first and a compute optimization second. Whether it improves throughput depends on workload, the factors that limit it and the architecture of the model. With spare KV capacity, quantized FP8 cache can simply add kernel overhead. Near full memory saturation, the same compression can unlock substantially higher effective throughput.
Impact on accuracy
Qwen3.8-27B-FP8
| KV cache precision | SWE-Bench-Pro 64 subset (mean/std) | DeepSWE, 110 tasks (mean/std) |
|---|---|---|
| BF16 | 30 / 0.7 | 43 / 2.12 |
| FP8 | 31 / 0.7 | 41 / 1.41 |
According to our experiments, there is a small accuracy tradeoff on the DeepSWE suite, the SWE-Bench-Pro results are more or less equal, with a small standard deviation.
Conclusions
- None of the weight formats showed a clear and impactful accuracy loss. Across the tested models*, the BF16, FP8, INT4 AWQ and NVFP4 scores sit within a few tasks of each other on both benchmarks (the largest gap is NVFP4 on DeepSWE: 51 vs 43 for BF16).
- FP8 (W8A8) can be safely used if it’s natively supported by your system, we didn’t notice accuracy loss compared to BF16. Moreover, many new models already come natively FP8 quantized.
- INT4 AWQ (W4A16) can cut weight memory by more than 60% but was slower by 6%. 4-bit weights have to be dequantized back to 16-bit inside every multiply. INT4 can save memory, FP8 saves memory and also speeds up compute.
- FP8-quantized cache can double the overall KV cache pool, from 3.1M to 6.0M tokens in our measurements, but it doesn’t speed things up, it costs 31% of throughput in a low-concurrency scenario. When the KV pool is not saturated, all you get is the extra work in the attention kernels and slower throughput. When memory is the bottleneck, this FP8 quantized cache can drastically improve performance: cut preemptions by 87% and raised throughput by 60% in one of the experiments we’ve run.
*GLM5.3-Flash was only compared between FP8 and INT4 AWQ.
So, which should you use? Choose FP8 when your hardware supports it and you want a strong balance of speed and memory savings. Choose INT4 when fitting the model is the priority. Use an FP8 KV cache when you’re running short on cache memory—not simply because it uses fewer bits. In our tests, the quantized models stayed close to their higher-precision counterparts on coding tasks, but results can vary from run to run. There’s no universally best format: match the choice to your hardware, your bottleneck, and the workload you care about.
Glossary: terms used in this post
- W8A8 / W4A16
- Weight and activation bit-widths. W8A8 stores weights and activations in 8 bits; W4A16 stores weights in 4 bits and keeps activations in 16-bit, so weights are dequantized inside the matmul.
- Zero-point
- The integer code that real zero maps to in affine quantization, so zero is represented exactly.
- Group scale
- One scale (and zero-point) shared by a small group of weights, typically 32–128, instead of one per tensor. It keeps 4-bit error low at a small memory cost.
- E2M1 and microscaling (MX)
- E2M1 is a 4-bit float with 2 exponent and 1 mantissa bit. Microscaling formats such as NVFP4 and MXFP4 attach a shared scale to every small block of values (16 or 32) to recover range.
- Marlin
- A family of fused GPU kernels that run 4-bit-weight matmuls with 16-bit activations efficiently, as used for AWQ and GPTQ checkpoints in vLLM.
- Preemption
- When vLLM runs out of KV-cache blocks it evicts a running request and later recomputes it from scratch. High preemption counts mean wasted compute and long queues.
- KV cache utilization
- The share of the KV-cache pool in use. At 100% the engine has no spare capacity and starts preempting.
- TTFT, ITL, TPOT
- Time to first token; inter-token latency (gap between consecutive tokens, so it shows stalls); time per output token (average decode time per token for one request).
- Speculative decoding (MTP)
- A small draft head, such as multi-token prediction, proposes several tokens that the full model verifies in one pass. It speeds up decoding without changing outputs.
- TP2, TP4, c32
- Tensor parallelism across 2 or 4 GPUs; c32 means 32 concurrent requests (agents) during the benchmark.
References
- B. Jacob et al., “Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference,” CVPR, 2018.
- P. Micikevicius et al., “FP8 Formats for Deep Learning,” arXiv:2209.05433, 2022.
- B. Darvish Rouhani et al., “OCP Microscaling Formats (MX) Specification,” v1.0, Open Compute Project, 2023.
- NVIDIA, “NVFP4,” Transformer Engine Documentation (E2M1 elements with per-block FP8 E4M3 and global FP32 scaling).
- E. Frantar et al., “GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers,” ICLR, arXiv:2210.17323, 2023.
- J. Lin et al., “AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration,” arXiv:2306.00978, 2023.
- Z. Liu et al., “LLM-QAT: Data-Free Quantization Aware Training for Large Language Models,” arXiv:2305.17888, 2023.
- USTC, “Defining Floating Point Precision (TF32).”
- NVIDIA, “NVIDIA H100 Tensor Core GPU Datasheet.”
- Lenovo, “ThinkSystem NVIDIA HGX B200 Product Guide.”
- Google Cloud, “BFloat16: The secret to high performance on Cloud TPUs,” Google Cloud Blog.
- WikiChip, “BF16 / FP16 ranges.”
- Red Hat, “We ran over half a million evaluations on quantized LLMs,” Red Hat Developer, 2024.
- AMD, “FP8 Numbers (OCP vs FNUZ),” ROCm HIP Documentation.
- NVIDIA, “Introducing NVFP4 for Efficient and Accurate Low-Precision Inference,” NVIDIA Technical Blog.
- E. Frantar et al., “MARLIN: Mixed-Precision Auto-Regressive Parallel Inference on Large Language Models,” PPoPP ’25, arXiv:2408.11743.
- AMD, “AMD Instinct MI355X,” product page.
- Wikipedia, “Block floating point.”
- R. Liu et al., “Quantization Hurts Reasoning? An Empirical Study on Quantized Reasoning Models,” arXiv:2504.04823, 2025.
- NVIDIA, “FP8 Performance,” Transformer Engine Documentation.
- Bjarnason, Silva & Monperrus, “On Randomness in Agentic Evals,” arXiv:2602.07150, 2026.
- Melin et al., “Precision or Peril: A PoC of Python Code Quality from Quantized Large Language Models,” arXiv:2411.10656, 2024.
- vLLM, “Quantized KV Cache,” vLLM Documentation.
- J. Kübler et al., “The State of FP8 KV-Cache and Attention Quantization in vLLM,” vLLM Blog, 2026.








Join the conversation
on LinkedIn
We publish every aistack insight on LinkedIn — add your read, push back on the benchmarks, or follow along for the next one.
Discuss on LinkedIn