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.