Developer Tools

llama.cpp b9952 optimizes DeepSeek V4 with fp16 KQ masks

New release cuts memory and speeds up attention for DeepSeek V4

Deep Dive

The llama.cpp open-source project released tag b9952 on July 10, 2024, bringing targeted optimizations for DeepSeek V4, the latest large language model from DeepSeek. The key change makes all KQ masks (except the lightning indexer one) use fp16 precision when flash attention (FA) is enabled. This reduces memory bandwidth and compute requirements during the attention mechanism. Additionally, the release removes the zero attention bias and eliminates dead code that repeated the unified raw_k cache for each stream in DeepSeek V4, since raw_k is now always non-unified.

For users running DeepSeek V4 locally with llama.cpp, these optimizations translate to faster token generation and lower VRAM usage, making the model more accessible on consumer hardware. The release is available across all major platforms including macOS (both Intel and Apple Silicon, with optional KleidiAI acceleration), Linux (x64, arm64, s390x with Vulkan, ROCm, OpenVINO, SYCL support), Windows (x64, arm64 with CUDA, Vulkan, OpenVINO, SYCL, HIP), and Android. This update continues llama.cpp's mission of enabling high-performance local inference for cutting-edge models.

Key Points
  • fp16 KQ masks when flash attention is enabled reduce memory and compute for DeepSeek V4
  • Removed zero attention bias and eliminated redundant raw_k cache in the DeepSeek V4 implementation
  • Available across macOS, Linux, Windows, Android, and multiple GPU backends (CUDA, Vulkan, ROCm, OpenVINO, SYCL, HIP)

Why It Matters

Enables faster, more memory-efficient local inference for DeepSeek V4 on consumer hardware.

📬 Get the top 10 AI stories daily