Back to News
ProductAI Understanding briefing

llama.cpp adds native F8_E4M3 support for Metal, boosting Qwen3.8-27B performance

The open-source llama.cpp library now includes native F8_E4M3 dequantization kernels for Metal, cutting graph splits dramatically and increasing token throughput for the Qwen3.8-27B model.

4 min readRead the primary source
Source-page capture accompanying llama.cpp adds native F8_E4M3 support for Metal, boosting Qwen3.8-27B performance
Primary-source documentSource recorded
Publisher
github.com
Source type
Primary document — an official announcement, paper, filing, or first-party page we read directly.
ContextUnderstand this in 60 seconds

Key terms

API (Application Programming Interface)
A structured way for one software system to send requests to and receive responses from another system.
Quantization
Converting model weights to lower precision formats such as 8-bit or 4-bit.
On-Device AI
AI inference performed locally on user hardware rather than in a remote cloud service.

What happened

The llama.cpp project released version b13030, introducing native F8_E4M3 dequantization and a suite of optimized kernels for Metal GPUs. These additions cover matrix-multiply, flash-attention, and various element-wise operations, leveraging thread-group LUTs and SIMD-group parallelism. The changes enable the Qwen3.8-27B-NVFP4 model to run fully on Metal with dramatically fewer graph splits (from 290 to 2) and a ten-fold increase in prompt processing speed (≈4.5 t/s to ≈340 t/s) and generation speed (≈3 t/s to ≈25 t/s). Performance benchmarks on Apple M5 Max and M2 Ultra GPUs show TFLOPS gains that bring F8 paths within a few percent of the existing Q8_0 baseline.

The release adds dequantization and compute kernels for several core operations: MUL_MAT, MUL_MAT_ID, GET_ROWS, CPY, ADD, and FLASH_ATTN_EXT. A 256-entry thread-group lookup table (LUT) replaces per-value conversion, speeding up F8 processing.

For matrix-multiply, the F8 path dequantizes weights into thread-group memory and reuses existing dequantization logic, with specialized MMA kernels handling 2-16 row blocks. Alignment constraints (32-aligned K dimension and even weight pointers) are enforced, with fall-backs to existing paths when unmet.

Performance testing on a Mac Studio equipped with an M5 Ultra (256 GB) shows the Qwen3.8-27B-NVFP4 model’s graph splits drop from 290 to 2, prompt processing speed rises from 4.5 tokens/s to roughly 340 tokens/s, and generation speed climbs from about 3 tokens/s to 25 tokens/s.

TFLOPS measurements on an M5 Max GPU indicate the F8 MMA path reaches 2.10-7.11 TFLOPS across 2-8 row configurations, approaching the Q8_0 baseline. On an M2 Ultra, the legacy mat-mat path improves from 13.65 TFLOPS to 17.85 TFLOPS, matching Q8_0 performance.

Additional code clean-ups include consolidating binary operation cases, refining predicate checks for MMA usage, and removing duplicated type checks, which together improve scheduler stability and graph ordering.

Source details: github.com

Why it matters

Native F8_E4M3 support on Metal lowers the computational cost of running large language models on Apple silicon, making high-quality inference more accessible to developers who rely on macOS or iOS devices. By reducing graph-split overhead and improving token throughput, the update narrows the performance gap between 8-bit and 4-bit schemes, potentially cutting memory usage and power consumption for applications. This could accelerate the deployment of sophisticated models like Qwen3.8-27B in edge scenarios such as mobile assistants, desktop tools, and research prototypes that previously required more powerful GPUs or cloud resources. The open-weight nature of llama.cpp means the improvement benefits the broader open-source AI ecosystem, not just a single vendor.

The update demonstrates that 4-bit (F8_E4M3) can be made practical on consumer-grade Apple silicon, expanding the hardware options for developers who cannot afford dedicated GPUs.

Higher token throughput reduces latency for interactive applications, making on-device chatbots, code assistants, and translation tools more responsive.

Memory savings from F8 enable larger models to fit within the limited VRAM of mobile GPUs, opening possibilities for richer experiences without cloud reliance.

Because llama.cpp is open-source and widely used, the performance gains are immediately available to a broad community, potentially influencing other projects to adopt similar strategies.

The detailed kernel optimizations (thread-group LUTs, SIMD-group usage) provide a reference implementation for future hardware-specific enhancements across the AI tooling ecosystem.

Interactive Mechanism

Interactive Mechanism: How It Actually Works

Explore the underlying technology behind this development interactively.

Document Size:128K tokens
Needle Placement Depth (Location in document):50% into text
Attention Context Buffer Map:
Target Fact (50%)
Equivalent Pages~320Standard book pages
Retrieval Accuracy99.9%Needle recall score
RAM / KV Cache5.1 GBMemory overhead
Prompt CachingActive~80% discount on reuse
Core takeaway: Million-token context windows allow querying whole codebases or legal archives in one prompt. However, KV cache memory scales with context length, making prompt caching crucial for real-time production.
Interactive Concept Check+10 Points
Block-Sparse and Native Sparse Attention Quiz

Why is standard self-attention expensive for long sequences?

What to watch next

Future llama.cpp releases may extend F8 support to additional kernels, broader hardware backends, or higher-precision formats. Watch for community benchmarks comparing the new Metal F8 path against other strategies on different Apple devices. Developers should monitor any changes to the library’s or build requirements that could affect integration into existing pipelines. Additionally, the impact on battery life and thermal performance for prolonged inference workloads on laptops and tablets will be an important practical metric.

Whether the F8 kernels will be back-ported to other backends such as CUDA or Vulkan, extending the performance benefits beyond Metal.

Community feedback on stability and edge-case handling, especially regarding the strict alignment requirements that trigger fall-backs.

Potential updates to the llama.cpp documentation and example scripts to help developers adopt the new F8 path with minimal friction.

Comparative studies on power consumption and thermal behavior when running the same model with F8 versus Q8_0 on Apple devices.

The emergence of third-party tools or wrappers that expose the new Metal F8 capabilities through higher-level APIs or UI frameworks.

Related guides & quizzes

Found this useful?