Back to List
Scaling High-Performance AI: How Cloudflare Optimizes Kimi and GLM Models for Workers AI
Industry NewsCloudflareAI InfrastructureOpen Source

Scaling High-Performance AI: How Cloudflare Optimizes Kimi and GLM Models for Workers AI

Cloudflare has unveiled advanced optimization techniques to run demanding large-scale models, specifically Moonshot's Kimi K-series and Z.ai's GLM, on its Workers AI platform. These Mixture-of-Experts (MoE) models are known for their long-context capabilities but present significant memory challenges. To address this, Cloudflare utilizes a combination of KV cache quantization, model weight compression, and cache protection. A key breakthrough involves transitioning the KV cache from 16-bit precision (BF16) to 8-bit floating point (FP8), which effectively doubles the context capacity for models like Kimi K2.6 from 686,000 to 1.37 million tokens. By leveraging the open-source SGLang framework, Cloudflare achieves higher efficiency and lower costs while maintaining model accuracy, ensuring high-performance inference is accessible closer to the end-user.

Hacker News

Key Takeaways

  • Memory Efficiency: Cloudflare uses FP8 quantization for the KV cache to halve its memory footprint, doubling the available context for long-context models.
  • Model Support: The optimizations specifically target high-demand Mixture-of-Experts (MoE) models, including Moonshot's Kimi K-series and Z.ai's GLM.
  • Framework Integration: All inference serving and benchmarking are conducted using SGLang, an open-source framework that Cloudflare actively contributes to.
  • Performance Gains: By separating prefill and decode phases and layering compression techniques, Cloudflare supports more concurrent requests on shared hardware without losing accuracy.

In-Depth Analysis

Overcoming the Memory Bottleneck in Long-Context Models

Serving large-scale models like Kimi and GLM presents a unique set of infrastructure challenges, primarily centered around memory constraints. These models utilize a Mixture-of-Experts (MoE) architecture and support extensive context lengths, which are highly beneficial for users but demanding for hardware. Cloudflare's analysis reveals that in long-context scenarios, it is often the KV (Key-Value) cache—rather than the model weights themselves—that exhausts GPU memory first. The KV cache is essential for maintaining the state of a conversation, allowing the model to reference previous tokens without re-processing the entire history for every new output.

To mitigate this, Cloudflare has implemented 8-bit floating point (FP8, e4m3) quantization for the KV cache. Previously stored in 16-bit precision (BF16), this shift effectively reduces the memory required for the cache by 50%. For a model such as Kimi K2.6, this optimization increases the context capacity from approximately 686,000 tokens to 1.37 million tokens on the same hardware. This allows for significantly longer interactions and more complex data processing within a single session.

Strategic Optimization Layers: Compression and Cache Protection

Beyond quantization, Cloudflare employs a multi-layered strategy to maximize GPU utility. This includes model weight compression and the separation of the prefill and decode phases of inference. Prefill involves processing the initial input prompt, while the decode phase generates subsequent tokens one by one. By isolating these phases, Workers AI can optimize the specific compute requirements of each, leading to faster overall performance.

Furthermore, because these optimizations allow more requests to be packed onto shared hardware, Cloudflare has introduced mechanisms to protect the shared cache. This ensures that the increased density of requests does not lead to performance degradation or resource contention. These technical refinements are designed to lower the cost of serving state-of-the-art models, making it economically viable to offer high-performance AI capabilities at scale.

Collaborative Innovation with SGLang

Cloudflare’s infrastructure relies heavily on SGLang, an open-source inference serving framework. Through rigorous benchmarking, Cloudflare identified SGLang as a market leader in performance. Rather than maintaining a private fork, Cloudflare works closely with the SGLang development team to upstream patches and new features. This collaborative approach ensures that the broader open-source community benefits from the stability and performance enhancements developed for Workers AI, while Cloudflare maintains a cutting-edge platform for its users.

Industry Impact

The ability to serve massive, long-context models like Kimi and GLM at the edge represents a significant shift in AI accessibility. By reducing the hardware barriers through software-level optimizations like FP8 quantization and weight compression, Cloudflare is setting a precedent for how infrastructure providers can handle the next generation of MoE models. This efficiency not only lowers the entry barrier for developers looking to integrate sophisticated AI into their applications but also promotes a more sustainable model for GPU resource management in data centers worldwide.

Frequently Asked Questions

Question: Why is the KV cache more problematic than model weights for memory?

In long-context models, the KV cache grows with every token processed in a conversation. For very long dialogues or document analyses, the cumulative size of these stored keys and values can exceed the static size of the model's weights, eventually filling the GPU's memory and limiting the maximum context length.

Question: How does FP8 quantization affect model accuracy?

According to Cloudflare's findings, transitioning the KV cache to 8-bit floating point (FP8) allows for a significant reduction in memory usage with no change in the accuracy of the model's output. This makes it a highly effective optimization for scaling inference.

Question: What is the role of SGLang in Cloudflare's AI stack?

SGLang is the open-source inference serving framework used by Cloudflare to run and benchmark its AI models. Cloudflare contributes patches and features back to the SGLang project, ensuring the framework remains optimized for high-performance, production-grade AI traffic.

Related News

Deel Acquires Deepfake Technology Startup Clarity to Enhance Global HR Security
Industry News

Deel Acquires Deepfake Technology Startup Clarity to Enhance Global HR Security

US-based HR and payroll platform Deel has announced the acquisition of Clarity, a startup specializing in deepfake technology. Founded in 2022, Clarity had quickly gained traction in the tech space, securing $16 million in funding from investors prior to the acquisition. This strategic move by Deel highlights the growing importance of addressing synthetic media and identity verification challenges within the human resources and remote work sectors. By integrating Clarity’s specialized capabilities, Deel aims to bolster its security infrastructure against the rising threat of deepfakes in digital hiring and corporate communications. The acquisition underscores a significant trend of HR platforms investing in advanced AI-driven security tools to protect global operations.

Indian AI Startup Kily Secures $3.1 Million in Funding to Scale Operations and Brand Partnerships
Industry News

Indian AI Startup Kily Secures $3.1 Million in Funding to Scale Operations and Brand Partnerships

Kily, an emerging Indian AI startup founded in 2025, has successfully raised $3.1 million in its latest funding round. Despite being a relatively new player in the technology sector, the company has already demonstrated significant market traction by securing strategic partnerships with major industry leaders, most notably the Indian conglomerate ITC. This capital injection marks a pivotal milestone for the young firm as it seeks to establish its presence in the rapidly evolving artificial intelligence landscape. The funding highlights strong investor confidence in Kily's potential and its ability to deliver value to high-profile enterprise clients within a short period since its inception.

Why Domain Expertise is the Ultimate Skill for Mastering Large Language Models and Prompting
Industry News

Why Domain Expertise is the Ultimate Skill for Mastering Large Language Models and Prompting

While Large Language Models (LLMs) have democratized technical tasks, turning many users into generalists, a common misconception persists that prompting requires little specialized skill. However, recent analysis suggests that domain expertise remains the critical factor in achieving high-level results. By examining world-class mathematician Terence Tao’s interactions with GPT-5.6 Sol regarding the Jacobian Conjecture, it becomes clear that expert-level prompting involves concise communication, signaling deep knowledge to trigger specialized model responses, and maintaining control over the direction of the inquiry. Unlike amateurs who may follow the model's lead, experts like Tao use LLMs as tools to refine their own insights, proving that the value of an LLM is directly proportional to the user's existing knowledge in the field. Ultimately, LLMs do not replace expertise; they reward it.