Safetensors became the de facto standard interchange format across PyTorch, Diffusers, vLLM, ComfyUI, and Civitai—serving both full sharded LLM weights (like Llama and DeepSeek) and lightweight LoRA & QLoRA adapters.
Safetensors
Also known as: .safetensors
Plain English
The modern, safe file format for storing and sharing AI model weights. It replaced older Python pickle files (.ckpt/.bin) that could hide malicious code, and it loads models into GPU memory much faster.
Technical Overview
Created by Hugging Face in Rust, Safetensors stores a small JSON metadata header followed by raw contiguous tensor buffers. It prevents arbitrary code execution, supports zero-copy memory mapping (mmap) for fast startup, and allows lazy/sharded loading of massive multi-hundred-gigabyte Checkpoints across GPUs.
Chronological Entries (2)
Hugging Face open-sourced safetensors to solve two urgent pain points with PyTorch .bin/.ckpt files: pickle deserialization vulnerabilities when sharing community Checkpoints and slow, memory-duplicating model loads.
Direct Relations (3)
- Created byHugging Face
- EnablesCheckpoints
- Alternative toGGUF