Cloudflare has implemented three primary optimization techniques to efficiently serve large-context, mixture-of-experts models like Moonshot's Kimi and Z.ai's GLM using SGLang. First, they quantized the KV cache from BF16 to FP8 (e4m3) precision. For the Kimi K2.6 model, this doubled the supported context window from 686,000 to 1.37 million tokens. While FP8 introduces a slight per-token computational overhead, it significantly increases concurrency; at 64 concurrent requests, FP8 achieved 2,192 tokens per second, whereas BF16 reached an out-of-memory error at 33 requests. Second, they compressed GLM 5.2 model weights from FP8 to INT4, reducing the checkpoint size from 705 GB to 421 GB (a 40% reduction). This compression improved decoding latency by up to 55% at low concurrency due to reduced memory bandwidth requirements, though they maintain FP8 for the compute-bound prefill phase to avoid decompression overhead. Finally, to manage the increased density of requests sharing hardware, Cloudflare introduced a KV cache integrity checking mechanism. By using tagged physical cache pages to validate request mappings, they prevent data corruption from page reallocation errors. This safety layer maintains high performance, incurring less than a 1% impact on throughput and p95 latency. These optimizations allow for higher request density and lower costs without measurable degradation in model accuracy across standard benchmarks like MMLU and GSM8K.

Read original