Pickle is a security hole
The legacy .bin format for HF models is a Python pickle. Loading a pickle file is equivalent to running the producer's Python code. A malicious pickle can do anything a Python process can: open sockets, exfiltrate environment variables, modify ~/.ssh, install crypto miners. This is not theoretical. The Hub has caught actively malicious models in the wild.
Safetensors fixes that
Safetensors is a flat tensor container: a JSON header with metadata + offsets, a binary blob with raw tensor bytes. No code, no opcodes, no execution surface. Loading is memory-mapping. Faster too — fewer Python allocations, zero-copy paths in many cases.
The migration
Since transformers 4.34 (late 2023), save_pretrained writes safetensors by default. Most popular models on the Hub now ship both .bin and .safetensors. When loading, pass ignore_patterns=["*.bin"] to snapshot_download if you want to be sure the safe version is what you actually have on disk.