How it works
GGUF (GPT-Generated Unified Format) is a binary format for storing AI model weights, created for the llama.cpp project. It replaces the previous format (GGML) and adds support for metadata, multiple quantizations and better organization.
A GGUF file contains: the model weights (quantized or not), metadata (name, architecture, tokenization parameters) and quantization information. All in a single file, easy to distribute and load.
The format is optimized for inference on CPU and GPU, with support for mmap (memory mapping), which allows the model to be loaded without copying to RAM. This reduces startup time and memory usage.
Practical example
On Hugging Face, you can find models like "Llama-3.1-8B-Instruct-GGUF" with several variants: Q4_K_M (4 bits, medium), Q5_K_M (5 bits, medium), Q8_0 (8 bits). You download the corresponding .gguf file and run it with llama.cpp, Ollama or LM Studio.
With a Q4_K_M file of 4.9 GB, you can run an 8 billion parameter model on a laptop with 8 GB of RAM, without a GPU. The quality is slightly lower than the original 16 bit model, but the speed and cost make up for it.
What it's for
It is used to distribute and run AI models locally, on modest hardware. It is the standard format for local inference and for experimenting with open models.
Difference between GGUF and other formats
GGUF is optimized for inference (llama.cpp, Ollama). Formats like Safetensors or PyTorch (.bin/.pt) are optimized for training and research. GGUF supports native quantization; Safetensors does not. To run locally, GGUF is the standard; to train or fine tune, use Safetensors.