Skip to content
AI Learning Ground Start learning

Research ·

Transformers now runs llama.cpp quants

Hugging Face's transformers library now supports loading and running GGUF (llama.cpp) quantized models locally, starting with Apple Silicon and the Qwen3.5 architecture, with performance close to llama.cpp itself.

Transformers now runs llama.cpp quants
Image: Hugging Face

Hugging Face announced that transformers can now load GGUF model checkpoints, the quantized format used by llama.cpp and tools like Ollama, LM Studio, and Jan. Users can pick a GGUF from the Hub, pass its model_id and gguf_file to from_pretrained, and generate text through the standard transformers API on their own machine. GGUF packages weights, tokenizer metadata, and an optional chat template in one file, with quantization levels like Q4_K_M that mostly use 4-bit weights while keeping sensitive tensors at higher precision.

To approach llama.cpp performance, transformers reuses ggml kernels through the kernels library and reduces overhead in generate. The initial focus is local inference on Apple Silicon, starting with the Qwen3.5 architecture. On Metal, compatible ggml/Metal kernels load automatically and attention uses ggml-org/ggml-attn, falling back to sdpa with a warning if the kernel cannot be fetched. The same checkpoints can be served via transformers serve, which exposes an OpenAI-compatible API with a model argument in the form <model_id>:<filename>.gguf, plus --reasoning options for thinking-capable chat templates. Benchmarks on a MacBook Pro M2 Max (32 GB) showed transformers close to llama.cpp across a small dense, a large dense, and a mixture-of-experts checkpoint, though conditions differed slightly since the transformers measurement included prefill.

For developers building with AI, this means laptop-sized quantized checkpoints can now be used through familiar transformers APIs instead of learning a separate runtime, and the same GGUF file can back either an OpenAI-compatible endpoint or embedded library usage. Hugging Face notes llama.cpp remains its recommendation when efficient local inference is the priority; requirements include a recent PyTorch version and the kernels library, and without a compatible quantization kernel the loader falls back to dequantizing, using more memory.

References

Read the full story at Hugging Face ↗Like, save or discuss on Buzz

#open-weights #tooling #research