Safetensors vs GGUF
People think safetensors and GGUF are just two names for the same kind of model file. They are made for different jobs. Safetensors holds the full weights, most often at 16 bits, and it is how most models are shared on hubs. GGUF packs a model for local apps, most often shrunk to fewer bits. You often turn the first into the second.
Safetensors
A safe file format for model weights. It holds numbers, never code.
Safetensors is a file format for the weights of a model. It holds only numbers, plus a short list of where each part is. Some older formats could hide code that ran the moment you loaded the file. A safetensors file cannot run code, so it is safe to load from a stranger. It also loads fast, because the numbers are read straight from disk. Most open models on model hubs now come in this format.
GGUF
One file that holds a whole model. It is ready to run on your own PC.
GGUF is a file format that keeps a whole model in one file, ready to run on your own machine. It came out in 2023. It took the place of an older format called GGML. A GGUF file holds the weights, often shrunk, plus all that is needed to run them: the model's settings, its tokenizer and its prompt format. Names like Q4_K_M or Q8_0 in the file name tell you how it was shrunk. Many local tools read GGUF files.
In one line
- Safetensors
- A safe file format for model weights. It holds numbers, never code.
- GGUF
- One file that holds a whole model. It is ready to run on your own PC.