Skip to content
BENIBIX Learn

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.

AI💻 Running Locally

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.

Example
Lucy finds two copies of one model online. One is a .safetensors file and one is an old .bin file. She picks the safetensors one, so loading it cannot run hidden code.
Why it matters
Loading a model file should never be able to take over your machine. This format makes sure of that.
Full entry
AI💻 Running Locally

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.

Example
Emma finds a model in several GGUF files on a model hub. She picks the Q4_K_M one at about 5 GB, because it fits her laptop and keeps good quality.
Why it matters
One file with all you need in it is easy to share, download and run.
Full entry

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.