Transformers Now Loads GGUF llama.cpp Quants Straight From the Hub
On September 22, 2026, Hugging Face documented GGUF support in Transformers that reuses llama.cpp’s ggml Metal kernels via the kernels library—so Apple Silicon users can call from_pretrained on Hub GGUF files and generate with the standard Python API.
Hugging Face published a September 22, 2026 engineering post explaining that Transformers can now run GGUF quantized checkpoints efficiently by loading a Hub model_id plus a gguf_file name through the familiar from_pretrained path. The integration targets local inference on Apple Silicon first, starting with the Qwen3.5 architecture, and reuses ggml Metal kernels distributed through Hugging Face’s kernels library so packed weights stay quantized on Metal instead of expanding into full-precision tensors on every decode step. Authors Marc Sun, Arthur Zucker, and Lysandre Debut frame the work as closing the gap between llama.cpp’s local-runtime strengths and Transformers’ model-definition and Python tooling strengths—without claiming Transformers should replace llama.cpp for every laptop workflow.
GGUF, developed by the llama.cpp team, packages weights, tokenizer metadata, and optional chat templates into a single file with multiple quantization recipes. Hub publishers such as ggml-org, Unsloth, LM Studio Community, and bartowski already ship ready GGUF variants that users pick by memory budget. Hugging Face’s post uses Unsloth’s Qwen3.5-4B family as a size example: BF16 at 8.42 GB versus Q6_K at 3.53 GB, Q5_K_M at 3.14 GB, and Q4_K_M at 2.74 GB, with Q4_K_M suggested as a practical starting point before moving up when memory allows.
Loading and serving without a second runtime
The documented install path today is bleeding-edge rather than a frozen PyPI pin: install Transformers from the GitHub main branch plus a compatible kernels package, on an Apple Silicon Mac with a PyTorch build supported by the published ggml-quantization kernels. Loading looks like ordinary Transformers code with one GGUF-specific argument—gguf_file—on both the tokenizer and the causal LM. When packed Metal kernels are available, Transformers automatically pulls compatible ggml/Metal layer kernels and uses ggml-org/ggml-attn for attention; if the kernel fetch fails, the model falls back to "sdpa" with a warning, and callers can force that path explicitly.
After load, chat templates, generate, and decoding stay on the standard Transformers API. The same checkpoint can be exposed through transformers serve with an OpenAI-compatible endpoint, using a model_id:filename.gguf selector so a multi-file Hub repo can serve one quant. Clients such as Jan or Pi can point a custom OpenAI-compatible provider at http://localhost:8000/v1 while Transformers keeps the model on the Mac. Reasoning chat templates can be toggled with --reasoning on|off|auto according to the post.
Hugging Face also documents a dequantize path via GgufConfig(dequantize=True) for fine-tuning or training workflows that need a standard bf16 Transformers checkpoint rather than packed inference. That mode is a different tradeoff: convenient for continued training, heavier on memory than staying packed.
Performance claims and architecture limits
The blog’s local benchmark story compares Transformers generate against llama-bench on a MacBook Pro M2 Max with 32 GB unified memory, using warmed runs and reporting Transformers as close to llama.cpp across a small dense model, a larger dense model, and a mixture-of-experts checkpoint. The post is explicit that the two columns are not identical conditions—Transformers’ measurement includes prefill while llama-bench reports decode-only tg128—so treat the charts as directional engineering evidence, not a formal bake-off.
Kernel packages called out include ggml-quantization for reading packed weights (including MoE experts), ggml-norm for fused normalization such as Qwen3.5/Qwen3.8 zero-centered RMSNorm, ggml-attn for Metal flash attention, ggml-gated-delta-net for hybrid linear-attention layers in those Qwen families, and a custom Metal topk for MoE routing. Separate generate changes—dropping an unnecessary all-ones attention mask early on supported decoder-only inputs, and deferring stopping checks asynchronously—are described as benefiting Transformers generation more broadly than GGUF alone.
Current limitations are equally concrete. Packed inference is MPS-only for now; GGUF import through dequantization remains available as a separate option. Padding and batching still need work, so unpadded single conversations benefit first. Architecture coverage for the packed loader currently centers on Qwen3.5 dense and MoE, including compatible Qwen3.8 checkpoints, with gradual expansion planned. Hugging Face still recommends llama.cpp when the priority is the most efficient dedicated local engine across hardware; the Transformers path is for Python/PyTorch experimentation, evaluation, conversion validation, custom decoding loops, and fine-tuning from a GGUF starting point.
Why this matters for open-source operators
The durable news is not a new foundation model. It is that the largest GGUF catalog on the Hub becomes reachable from the same Python stack many teams already use for training and eval, with performance-oriented Metal kernels rather than a slow dequantize-everything demo. Operators should pin expectations to Apple Silicon + current main + Qwen3.5-family coverage until architecture support widens, keep llama.cpp for production local serving when that is the goal, and use the Hub GGUF docs plus the September 22 post as the primary reference for load flags, serving syntax, and known limits.
- #Opensource
- #Products
Author
Raj M
Contributor
AI Systems Architect is a seasoned technology leader with over 15 years of experience in the IT industry working with Fortune 500 companies. With a solid foundation in multi-agent systems, open-source LLM infrastructure, and enterprise deployment, he excels at building scalable production-grade AI platforms.