What Is Safetensors? The Safe Model Weight Format
Safetensors stores tensors (model weights) in a simple, safe format. Unlike older PyTorch pickle files, loading a safetensors file cannot execute arbitrary code.
Why it matters
Pickle-based .bin, .pt or .ckpt files from untrusted sources can run malicious code when loaded. Safetensors removes that risk, which is why it became the standard on Hugging Face.
Features
- Fast, memory-mapped loading.
- Sharding for large models (
model-00001-of-00004.safetensors). - Used for language, image and video models.
Safetensors vs GGUF
Safetensors usually holds full-precision weights for training and server inference; GGUF holds quantised weights for local apps. See GGUF vs safetensors.
Related
More terms: Abliteration · Base model · DPO · Fine-tuning · Imatrix · Mixture of experts · Full glossary