News / Learn / Local & open models
What are GGUF and other model formats?
You'll be able to explain what GGUF is, how model file formats differ, and which one fits a local or self-hosted setup.
In plain English
A model file format is the way a trained model's weights are packed into a file. GGUF is a single-file format built for running models locally on ordinary hardware. It stores the weights, the tokenizer, and key settings together, so a runtime can load the model without extra configuration files.
Why it matters
Your choice of format decides which tools can load a model, how much memory it needs, and whether you can move it between machines. Picking the wrong format can block a deployment or waste hours of conversion work. Knowing the basics lets you evaluate open models quickly.
How it works
A model is a large set of numbers called weights. Training produces them, and the format is the container that stores them on disk. The container also holds metadata: the architecture, the vocabulary, the tensor shapes, and the data type of each weight.
GGUF is a binary format designed by the llama.cpp project. Its main traits are a self-describing header, a single file, and support for quantized weights. Quantized means the numbers are stored at lower precision to save memory. A GGUF file can therefore hold a smaller, faster version of a model that still runs on a laptop CPU or a consumer GPU.
Other formats serve other purposes. Safetensors is a safe, fast format for storing full-precision weights and is common in training and in the Hugging Face ecosystem. PyTorch checkpoint files are older and can run arbitrary code when loaded, so they call for more caution. Formats for specific accelerators or inference engines exist too, often tied to one runtime.
When you pick a format, check three things: which runtime you plan to use, what precision the file stores, and whether the publisher provides it in a form your tool can read. Conversion between formats is possible, but it adds steps and can change behavior.
A concrete example
A quick way to inspect a GGUF file's header and see its metadata, using the official Python package for reading GGUF files.
from gguf import GGUFReader
reader = GGUFReader("model.gguf")
# Print a few metadata keys
for key in list(reader.fields.keys())[:10]:
print(key)
# Count the tensors (the weight arrays) in the file
print("tensors:", len(reader.tensors))
for t in reader.tensors[:3]:
print(t.name, t.tensor_type, t.shape)A short sketch to show the idea. Check the official docs of the tool you use.
What goes wrong
- Assuming every runtime reads every format Check the runtime's documentation for supported formats before downloading. A GGUF file will not load in a tool that expects safetensors, and the reverse is also true.
- Treating file size as the only memory cost File size is a rough guide. Context length, the cache for attention, and the runtime itself also use memory. Leave headroom above the file size.
- Loading unverified pickle-based checkpoints Older PyTorch checkpoints can execute code on load. Prefer safetensors or GGUF from sources you trust, and verify checksums when the publisher provides them.
- Mixing up the model and the format A format is a container, not a model. The same model can appear in several formats, each with different precision and compatibility.
Going deeper
Study how quantization levels are named and how they trade quality for size. Then learn how to convert between formats and how a local runtime loads a model into memory.
FAQ
Is GGUF only for llama.cpp?
GGUF was designed for llama.cpp, and many local tools use it. Check each tool's documentation, since support varies.
Does GGUF change what the model can do?
The format itself does not change the model's knowledge. Quantization can slightly reduce output quality, so test important tasks after switching files.
Why do some models ship in several GGUF files?
Publishers often offer different quantization levels. Smaller files use less memory but may lose some accuracy.
Is safetensors better than GGUF?
Neither is better in general. Safetensors suits training and many Python workflows. GGUF suits compact local inference.
Can I convert a model from one format to another?
Often yes, with a conversion tool. Conversion can alter precision or metadata, so verify outputs after converting.
Written with AI by CapyLaunch. Spotted a mistake? Email hello@capylaunch.com.