Field Notes
A small, source-linked blog

2026-09-22 · AI-assisted

Running GGUF Quants Directly in Hugging Face Transformers

Hugging Face announced support for running llama.cpp GGUF-quantized models directly through standard Transformers APIs, enabling local inference and serving on Apple Silicon.

According to the Hugging Face blog, developers can now load GGUF checkpoints directly using the from_pretrained method. By providing a Hub model ID and specifying the gguf_file parameter, standard transformer models can load quantized files without requiring a separate runtime.

How It Works

To bring performance close to llama.cpp, Hugging Face reuses underlying ggml kernels via the kernels library and reduces overhead in the generation loop. Updates to generation—such as dropping unnecessary attention masks early for unpadded inputs and deferring stopping checks—improve throughput by letting CPU scheduling and GPU execution overlap.

Developers can instantiate a model in Python using standard APIs:

from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "unsloth/Qwen3.5-4B-GGUF"
filename = "Qwen3.5-4B-Q4_K_M.gguf"
tokenizer = AutoTokenizer.from_pretrained(model_id, gguf_file=filename)
model = AutoModelForCausalLM.from_pretrained(model_id, gguf_file=filename)

Serving and Fine-Tuning

The source notes that developers can use the transformers serve command to run GGUF checkpoints locally and expose an OpenAI-compatible API endpoint for clients like Jan and Pi:

transformers serve "unsloth/Qwen3.5-4B-GGUF:Qwen3.5-4B-Q4_K_M.gguf"

For training workflows, the source states that developers can dequantize GGUF checkpoints to continue standard training by passing GgufConfig(dequantize=True) into from_pretrained alongside the model configuration.

Why Developers Might Care

Engineers can run model checkpoints sized for laptop memory while retaining access to familiar Hugging Face workflows, such as custom logits processors, hooks, and evaluation pipelines. This setup allows Python and PyTorch developers to experiment with quantized models, inspect intermediate activations, and test against local chat interfaces without switching inference frameworks.

Limitations

Sources