cd /news/ai-infrastructure/roton-rust-metal-gguf-prefill-on-app… · home › topics › ai-infrastructure › article
[ARTICLE · art-178541] src=discuss.huggingface.co ↗ pub= topic=ai-infrastructure verified=true sentiment=· neutral

Roton: Rust/Metal GGUF prefill on Apple Silicon, with a reproducible llama.cpp baseline

The maintainer of roton, an MIT-licensed GGUF inference engine written in Rust and Metal, published archived v0.3.0 measurements showing roton's chunked Metal prefill cut native prefill time on a 453-token prompt from 4395.50 ms (sequential) to 131.85 ms (MPP FP16, batch 64), while a pinned llama.cpp Metal reference with batch 512, FP16 KV and automatic flash attention completed the same prefill in 15.34 ms and decoded at 534.0 steps/s versus roton's 55.0. The tests ran on an M5 Pro with 48 GiB of memory and macOS 26.6.2 using SmolLM2-135M-Instruct Q5_K_S, with 32 greedy output tokens and a 1,024-token context, and the maintainer said the long-context decode gap is the next profiling target. The v0.4.0 source adds dense Qwen2.5/Qwen3 handling, including Q/K/V biases, NeoX-style RoPE, explicit head dimensions and QK normalization, though the maintainer cautioned that validation remains narrow.

recommendation

Batch prefill chunks (64 or 512) to replace sequential GEMV with matrix-matrix work, but benchmark decode separately: roton's batching cut prefill 33x while decode stayed at 55 steps/s against llama.cpp's 534.

more in playbook: Inference and self-hosting
read2 min views6 publishedNov 30, 2026

I maintain roton, an experimental MIT-licensed GGUF inference engine written in Rust and Metal. I’m sharing the implementation and measurements for people interested in Apple GPU inference kernels.

Weights stay memory-mapped in their original GGUF representation. Decode uses packed quantized GEMV. For optional chunked prefill, the GPU expands one projection at a time into a reusable FP16 buffer, converts activations to FP16, and writes FP32 matrix-product output. Causal attention, absolute-position RoPE and the KV cache connect the chunks. Scratch allocation is capped at 512 MiB.

This trades extra staging and scratch memory for matrix-matrix work. Short prompts can still lose to the sequential path, and FP16 rounding can change generated tokens. Sequential prefill remains the default for the raw run command; the chunked paths can be selected explicitly.

The v0.4.0 source also adds dense Qwen2.5/Qwen3 handling, including Q/K/V biases, NeoX-style RoPE, explicit head dimensions and QK normalization, plus sampling and terminal chat. Validation is still narrow; adding architecture support is not a claim that every checkpoint works.

These are archived v0.3.0 measurements, not a benchmark of the new Qwen support. Hardware: M5 Pro, 48 GiB, macOS 26.6.2. Model: SmolLM2-135M-Instruct Q5_K_S. This case uses 453 prompt tokens, 32 greedy output tokens and a 1,024-token context. Values are medians of five measured runs after a discarded warmup.

Configuration Native prefill ms Decode steps/s Whole command ms
roton sequential 4395.50 54.9 5001.43
roton Metal 3, batch 64 204.45 55.0 810.24
roton MPP FP16, batch 64 131.85 55.0 738.99
llama.cpp Metal, batch 64, FP32 KV, FA off 52.87 460.1 263.07
llama.cpp Metal, batch 512, FP16 KV, FA auto 15.34 534.0 215.57

Batching substantially reduced roton’s own prefill cost, but the pinned llama.cpp reference remained faster on this workload. The long-context decode gap is the next profiling target: roton drops from roughly 368 steps/s on the five-token prompt to 55 here, while the reference stays above 460. These timings alone do not identify the bottleneck.

The full report includes 5-, 117- and 453-token cases, 75 measured runs, exact prompts, a model hash, build settings, raw JSON and a reproduction script. Output text matched across the five configurations for each of these three prompts; this is not general logit parity or a quality evaluation.

Important measurement limits: native timer boundaries differ; llama.cpp retains its internal warmup; desktop activity and clocks were not controlled. Whole-command time is not TTFT, and process RSS is not total GPU residency. The batch-512 reference also changes KV precision and attention selection, so it is not a batch-size-only comparison.

Source and current support scope · Pinned reference report, raw data and reproduction steps

Disclosure: maintainer post, drafted with AI assistance from the source and checked-in measurements.

── more in #ai-infrastructure 4 stories · sorted by recency
── more on @roton 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/roton-rust-metal-ggu…] indexed:0 read:2min 2026-11-30 · —