Open model sharing made PyTorch pickle checkpoints a distribution channel for trust. Pickle was convenient, but Hugging Face's security documentation explains that deserializing pickle can execute code, including dangerous built-ins such as eval or exec.

SafeTensors answered by narrowing the format. It stores tensors safely, keeps loading fast through zero-copy access, and allows partial loading so large model shards do not have to be deserialized all at once. The cleverness is subtraction: model weights become data only.

After a 2023 Trail of Bits audit, Hugging Face, EleutherAI and Stability AI moved toward making SafeTensors the default saved-model format. The documentation lists broad project support, and Hugging Face's serialization APIs now recommend safe serialization for security reasons.

Weights should never execute

It removed arbitrary code execution instead of trying to blacklist malicious pickle imports.

Zero-copy and lazy loading made safety faster, not slower.

A tiny format surface made external audit practical.

Hub conversion workflows let existing models migrate without waiting for every author to learn a new tool.

When a file is shared at internet scale, removing an entire attack class beats trying to inspect every dangerous file.

SafeTensors spread through the AI tooling stack as open models grew. Hugging Face docs list adoption by Transformers, Diffusers, llama.cpp, ComfyUI and other projects, while the 2023 audit post said Transformers would move toward saving models in SafeTensors by default.

FOLLOW THE EVIDENCE

The sources

  1. Pickle Scanning huggingface.co
  2. Audit shows that safetensors is safe and ready to become the default huggingface.co
  3. Safetensors huggingface.co