---
title: "Transformers now runs llama.cpp quants"
description: "Hugging Face transformers can now load GGUF (llama.cpp) quantized checkpoints via `from_pretrained(..., gguf_file=...)` and serve them through `transformers serve` with an OpenAI-compatible API."
url: "https://swe.quest/articles/transformers-now-runs-llama-cpp-quants-cff2353854049dc6"
canonical: "https://huggingface.co/blog/transformers-llama-cpp-quants"
source: "Hugging Face"
published: "2026-09-22"
difficulty: "medium"
kind: "Announcement"
reading_minutes: 11
tags: ["inference","llms","python","performance"]
---

# Transformers now runs llama.cpp quants

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2026-09-22, 11 min read, Announcement. Original: [https://huggingface.co/blog/transformers-llama-cpp-quants](https://huggingface.co/blog/transformers-llama-cpp-quants)

## Summary

Hugging Face transformers can now load GGUF (llama.cpp) quantized checkpoints via \`from\_pretrained(..., gguf\_file=...)\` and serve them through \`transformers serve\` with an OpenAI-compatible API. Weights stay packed on Apple Silicon, and ggml's Metal kernels are reused via the \`kernels\` library for quantized matmul, fused RMSNorm, flash attention, gated delta nets and MoE top-k routing. Two \`generate\` changes, dropping all-ones padding masks and deferring the stopping check asynchronously, cut CPU-GPU synchronization for all models. Benchmarks on an M2 Max show throughput close to llama-bench for Qwen3.5 dense and MoE checkpoints, though llama.cpp remains the recommended engine for pure local inference. The initial packed path is MPS-only, and padded batching is still slower.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Python](https://swe.quest/tags/python.md) (Languages)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)

## Prerequisites

- transformers library basics
- model quantization ([easy posts on Inference & serving](https://swe.quest/tags/inference.md?difficulty=easy))
- PyTorch

## Keywords

transformers, GGUF, llama.cpp, ggml, Metal, Qwen3.5, Apple Silicon, kernels

## Related posts

- [Tricks from OpenAI gpt-oss YOU 🫵 can use with transformers](https://swe.quest/articles/tricks-from-openai-gpt-oss-you-can-use-with-transformers-aad70bf42c0bd3ff.md): Hugging Face · 2025-09-11 · Hard · 15 min read · Inference & serving, LLMs, Python, Performance engineering
  Hugging Face upgraded transformers to support OpenAI's gpt-oss models, and most of the new features carry over to other models.
- [Making LLMs lighter with AutoGPTQ and transformers](https://swe.quest/articles/making-llms-lighter-with-autogptq-and-transformers-6a1ce27ee3288303.md): Hugging Face · 2023-08-23 · Medium · 10 min read · Inference & serving, LLMs, Performance engineering, Hardware
  AutoGPTQ is now integrated into Hugging Face Transformers (via Optimum), letting users quantize and run LLMs at 8, 4, 3 or 2 bits with the GPTQ post-training method.
- [Overview of natively supported quantization schemes in 🤗 Transformers](https://swe.quest/articles/overview-of-natively-supported-quantization-schemes-in-transformers-c1bfbebb9330add3.md): Hugging Face · 2023-09-12 · Medium · 9 min read · Inference & serving, Model training, LLMs, Performance engineering
  bitsandbytes and GPTQ (via auto-gptq), the two quantization schemes built into Transformers, trade off differently. bitsandbytes needs no calibration data, works on any model with nn.Linear layers across modalities, and lets LoRA adapters merge without degradation.
- [Quanto: a PyTorch quantization backend for Optimum](https://swe.quest/articles/quanto-a-pytorch-quantization-backend-for-optimum-8330ba5aea428b63.md): Hugging Face · 2024-03-18 · Medium · 5 min read · Inference & serving, Python, Machine learning, Open source
  Quanto is a PyTorch quantization backend for Optimum that works in eager mode on any device (CPU, CUDA, MPS), supports int2/int4/int8/float8 weights and int8/float8 activations, and accelerates int8-int8, fp16-int4, bf16-int8 and bf16-int4 matmuls on CUDA.
- [Native-speed vLLM transformers modeling backend](https://swe.quest/articles/native-speed-vllm-transformers-modeling-backend-cb3f698fe9046ce3.md): Hugging Face · 2026-07-08 · Hard · 5 min read · Inference & serving, LLMs, Performance engineering, Python
  The transformers modeling backend in vLLM now matches or beats vLLM's hand-written native implementations in throughput.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
