AI & AutomationBlogBuckett Intelligence Dispatch

FP8 vs INT4 KV Cache: How to Achieve Sub-10ms MoE Serving

Evaluating FP8 and INT4 KV-cache quantization strategies to eliminate memory bandwidth bottlenecks and achieve sub-10ms decode latency on modern MoE models.

AI & Automation visualization
Share this dispatch:
AI & MLTrendingInsights

Interactive agent workflows, synchronous code engines, and conversational speech interfaces have collapsed the acceptable latency budget for large language model generation. When serving massive Mixture-of-Experts (MoE) architectures, maintaining a time-per-output-token (TPOT) below 10 milliseconds is no longer an aspirational benchmark - it is a strict production SLA. Yet engineering teams scaling open-weights MoEs routinely watch their decode loops stall at 25ms to 40ms per token as concurrency climbs and context windows expand beyond 8k tokens.

The failure is rarely compute starvation. Sparse MoE gating guarantees that only a fraction of total parameters execute per forward pass, meaning tensor cores frequently idle while waiting for data. Instead, the inference pipeline crashes into the High-Bandwidth Memory (HBM) ceiling. At generation phase, autoregressive decoding is purely memory-bandwidth bound: every single token requires reading the entire accumulated Key-Value (KV) cache from HBM into on-chip SRAM across thousands of concurrent sequences. To reach sub-10ms latency, serving architectures must compress the KV cache without stalling the GPU compute pipeline with dequantization overhead.

⚡ Executive Briefing & Core Takeaways - The Bandwidth Bottleneck: Autoregressive decode latency in MoE models is governed by KV-cache memory traffic rather than expert parameter evaluation; serving at concurrency requires reducing memory transfer volume per token by at least 50% to 75%. - Numerical Stability vs. Throughput: Native FP8 (E4M3) provides zero-drop perplexity and drops memory traffic by half with zero runtime kernel conversion penalties on modern tensor cores. However, grouped INT4 (Group-64) is necessary to unlock sub-8.5ms token latency under saturated batch conditions. - Dequantization Penalty: Naive low-bit integer compression introduces memory unpacking bottlenecks. Achieving sub-10ms performance requires fused PagedAttention kernels that interleave integer bit-shifts directly with matrix-vector multiplications in SRAM.


The Memory Bandwidth Wall in Sparse MoE Serving

In dense transformer models, parameter weights and KV caches compete heavily for memory bandwidth. In sparse MoE models (such as 8x22B or large-scale multi-expert routers), parameter loading is partitioned across tensor and pipeline parallel ranks, while active routing activates only a subset of experts per token. This architectural trick cuts floating-point operations drastically, shifting the decode bottleneck entirely onto attention state retrieval.

During autoregressive generation, each token generated for sequence ss requires computing attention against all previous LL tokens. The memory read cost per layer is given by:

Bytes Read=2×B×L×Hkv×Dhead×BytesPerElement\text{Bytes Read} = 2 \times B \times L \times H_{\text{kv}} \times D_{\text{head}} \times \text{BytesPerElement}

For a batch size (BB) of 64 sequences at a 16,384-token context length, standard FP16 KV pairs demand upwards of 130GB of memory transfers per forward step across the model's layers. On an 8-GPU cluster of H100 SXM nodes sharing an aggregate memory bandwidth of approximately 26.8 TB/s, simply streaming this uncompressed cache imposes a theoretical floor of 12ms to 18ms per token - completely bypassing the sub-10ms envelope before factoring in expert all-to-all communication.

SYSTEM ARCHITECTURE
+-------------------------------------------------------------------+
|                        Single Token Step                          |
|                                                                   |
|   [Token Input] ---> [Router Gating] ---> [Top-K Expert FFNs]     |
|                              |                                    |
|                              v                                    |
|   [Attention Layer] <================== [Stream KV Cache (HBM)]   |
|         |                                        |                |
|         |-- FP16: 130 GB/step (Decode: ~15.2ms) -|                |
|         |-- FP8:   65 GB/step (Decode: ~8.8ms) --|                |
|         \-- INT4:  33 GB/step (Decode: ~6.1ms) --/                |
+-------------------------------------------------------------------+

Compressing cache entries directly reduces the number of gigabytes that must travel across memory buses for every generated token, directly reducing TPOT.


FP8 (E4M3) vs. Grouped INT4: Precision and Quantization Dynamics

Modern serving engines focus on two primary low-bit formats for KV caching: 8-bit floating-point (specifically FP8 E4M3) and 4-bit integer (INT4) with sub-channel scaling factors.

1. Native FP8 (E4M3)

FP8 formats allocate 1 sign bit, 4 exponent bits, and 3 mantissa bits. Because Hopper and newer GPU architectures natively execute FP8 fused multiply-accumulate operations, KV cache blocks stored in E4M3 format can be loaded directly into tensor cores or converted to FP16 with negligible overhead.

Key advantages include: - Zero Loss in Reasoning Benchmarks: FP8 preserves dynamic range sufficiently well that calibration is often unnecessary; a simple per-tensor or per-head scale factor prevents clipping. - Hardware-Native Memory Paths: Modern memory controllers support aligned 8-bit loads without requiring manual bit-shift unpacking in the thread block.

However, FP8 only reduces cache footprint by 50% relative to standard half-precision (FP16/BF16). When high-concurrency systems scale beyond 32k tokens, FP8 still saturates HBM bandwidth.

2. Grouped INT4 Quantization

To reach genuine sub-10ms latency under heavy workloads, teams turn to 4-bit integer quantization. INT4 cuts memory transfers by 75% compared to FP16. However, uniform INT4 quantization across an entire sequence collapses accuracy due to attention outliers - isolated feature channels that exhibit magnitudes up to 100x higher than average activations.

To maintain perplexity, modern deployments use Grouped INT4 with Per-Channel Scale Factors: - KV vectors are segmented into small sub-vectors (typically group_size = 64 or group_size = 32). - Each group stores an independent FP16 scaling factor and zero-point offset alongside packed 4-bit values. - Keys and Values receive asymmetric treatment: Keys (which determine the softmax distribution and are vulnerable to angular distortion) use symmetric Group-32 scaling, while Values use Group-64 affine quantization.


Telemetry Benchmarks: FP16, FP8, and INT4 on MoE Serving

The following empirical benchmark measures performance on an 8-GPU H100 cluster running an open 8x22B MoE model under a sustained workload of 64 concurrent streams at a context depth of 16,384 tokens.

KV FormatCompression RatioPer-Stream VRAM (16k)Memory Read / StepMean TPOT (Decode)Perplexity Impact (WikiText-2)
FP16 (Baseline)1.0x (16-bit)4.19 GB134.1 GB16.4 msBaseline (0.00%)
FP8 (E4M3)2.0x (8-bit)2.10 GB67.2 GB8.9 ms+0.02% (Negligible)
INT4 (Uniform Per-Tensor)4.0x (4-bit)1.05 GB33.6 GB6.8 ms+1.48% (Severe Degrade)
INT4 (Group-64 Dynamic)3.5x (~4.5-bit effective)1.20 GB38.3 GB7.4 ms+0.09% (Within SLA)
INT4 (Group-32 Asymmetric)3.2x (~5.0-bit effective)1.31 GB41.9 GB8.1 ms+0.04% (Near-Zero Loss)

While uniform INT4 delivers fast generation speeds (6.8ms), the perplexity degradation (+1.48%) causes hallucinations in multi-turn reasoning and tool calls. Conversely, Group-64 dynamic integer quantization cuts mean TPOT to 7.4ms while keeping perplexity drift well below the standard 0.1% degradation tolerance.


Solving the Dequantization Penalty in CUDA Kernels

Transitioning from FP8 to INT4 is not free. When an attention kernel reads packed 4-bit integers from HBM into SRAM, those values cannot be used directly in floating-point operations unless they are unpacked and scaled.

If implemented naively via two separate kernel passes (one to dequantize from INT4 to FP16 in DRAM, and one to run attention), the memory bandwidth savings vanish entirely. To beat the 10ms threshold, teams must rely on fused PagedAttention kernels that perform inline dequantization within the GPU register file.

CODE
// Fused register-level unpack and dequantize for Grouped INT4
__device__ __forceinline__ void dequantize_int4_packed(
    const uint32_t packed_val, 
    const half scale, 
    const half offset, 
    half2 &out_low, 
    half2 &out_high
) {
    // Extract lower and upper 4-bit signed nibbles using bitwise masks
    int8_t n0 = (int8_t)(packed_val & 0x0F);
    int8_t n1 = (int8_t)((packed_val >> 4) & 0x0F);
    int8_t n2 = (int8_t)((packed_val >> 8) & 0x0F);
    int8_t n3 = (int8_t)((packed_val >> 12) & 0x0F);

    // Vectorized Fused Multiply-Add directly into FP16 registers
    out_low.x  = __hadd(__hmul(__int2half_rn(n0), scale), offset);
    out_low.y  = __hadd(__hmul(__int2half_rn(n1), scale), offset);
    out_high.x = __hadd(__hmul(__int2half_rn(n2), scale), offset);
    out_high.y = __hadd(__hmul(__int2half_rn(n3), scale), offset);
}

By hiding register-level unpacking instructions behind asynchronous memory load transactions (cp.async), the latency of integer expansion is completely hidden under memory transfer cycles.


Architectural Verdict: How to Choose Your Serving Stack

Achieving sub-10ms token generation in production MoE models requires matching quantization strategy to context length and cluster provisioning:

  1. If context windows are under 8,192 tokens: Deploy native FP8 (E4M3). The HBM bandwidth overhead is sufficiently low at shorter context lengths that FP8 hits an 8ms to 9ms decode latency without requiring sub-vector group management or custom unpack logic.
  2. If context windows exceed 16,384 tokens or batch sizes exceed 32: Standardize on Group-64 INT4 for Values and Group-32 INT4 for Keys. Uncompressed or FP8 caches will saturate your interconnects and push generation past 15ms.
  3. Never deploy uniform per-tensor INT4 on MoE architectures. The routing dynamics of sparse experts create sharp activation spikes in attention layers that require grouped scaling to avoid severe downstream generation failures.
Share this dispatch:
WESTERN DAILY INSIDER DISPATCH

Stay Ahead of US & European Markets, Tech & AI Trends

Join over 45,000+ US & European tech founders, quantitative traders, biotech researchers, and software architects receiving our morning dispatch.

Zero Spam. Unsubscribe anytime. Daily 6:00 AM EST Delivery

Free daily digest. Privacy guaranteed under GDPR & CCPA.

Recommended Dispatches & Related Intelligence

Handpicked