safetensors
A secure model serialization format introduced by Hugging Face as a replacement for the pickle format, which carries code execution risks. It fundamentally mitigates deserialization attacks and serves as a security standard for AI model file storage.
Core Facts
SafeTensors is a safe serialization format introduced by Hugging Face that supports zero-copy memory-mapped loading and eliminates the security risk of arbitrary code execution during deserialization.
Python's pickle format can execute arbitrary code during deserialization, allowing attackers to embed malicious code in model files.
The Qwen2.5:7B model is approximately 4 GB in size after Q4 quantization.
Timeline (last 90 days)
The standardization of the local inference toolchain (model formats such as GGUF and safetensors, inference engines such as llama.cpp, Ollama, vLLM and MLX) has significantly lowered the barrier for ordinary users to run large models.
The weight files of open-source models are stored in binary formats, with common formats including PyTorch's .bin/.safetensors and GGUF.
The Timestral model files on Hugging Face are based on PyTorch and the safetensors format, and running them on a phone requires conversion to ONNX format.
The technical verification checklist for judging whether a model leak is genuine includes: checking the checksums and file headers of the shard files, verifying the consistency between the configuration files and the architecture code, cross-checking the training metadata timestamps against distributed-training traces, and checking the uploader account's historical behavior and registration time.
Most current SBOM toolchains do not parse model weight formats (such as safetensors and GGUF), and they lack a standard process for comparing weight hashes against official release versions, which lets abliteration-processed model variants easily bypass routine dependency audits.
The target precision of safetensors is now reported independently of the quantized draft weights.
During safetensors import, the MLX framework assembles the ModelOpt expert banks for Flint.
This version assembles ModelOpt expert banks during the safetensors import stage, rather than processing them after model instantiation.
Using convert_huggingface_to_gguf.py to convert Gemma 2 2B from safetensors to f16 GGUF took less than a minute in testing, and the output file is about 5.2GB.
The safetensors index file (usually named model.safetensors.index.json) is a manifest used in the Hugging Face ecosystem for sharded weights, listing the name of each tensor and the shard file it is in, reflecting the weights that actually exist, and is the most reliable basis for determining what a model actually ships with.
21 more timeline events
All Facts (20)
SafeTensors is a safe serialization format introduced by Hugging Face that supports zero-copy memory-mapped loading and eliminates the security risk of arbitrary code execution during deserialization.
90%VerifiedPython's pickle format can execute arbitrary code during deserialization, allowing attackers to embed malicious code in model files.
80%VerifiedThe Qwen2.5:7B model is approximately 4 GB in size after Q4 quantization.
80%Verified.safetensors is a safe and efficient model weight storage format introduced by Hugging Face.
65%VerifiedSafeTensors uses a simple header-plus-data structure that contains no executable code, eliminating the security risk of arbitrary code execution during deserialization present in the traditional pickle format.
65%UnverifiedIn conjunction with Hugging Face Hub, Transformers has established a de facto standard for model distribution, including specifications such as Model Cards, weight formats (safetensors), and configuration files.
85%UnverifiedThe target precision of safetensors is now reported independently of the quantized draft weights.
70%UnverifiedCAPABILITY declarations are preserved when creating a model from GGUF or safetensors, when inheriting via a model, and when exporting a Modelfile.
70%UnverifiedThe safetensors format avoids the arbitrary code execution risk introduced by PyTorch's .bin format using pickle serialization, but cannot defend against malicious behaviors encoded in the model parameters themselves.
60%UnverifiedThe standardization of the local inference toolchain (model formats such as GGUF and safetensors, inference engines such as llama.cpp, Ollama, vLLM and MLX) has significantly lowered the barrier for ordinary users to run large models.
50%UnverifiedThe weight files of open-source models are stored in binary formats, with common formats including PyTorch's .bin/.safetensors and GGUF.
50%UnverifiedThe Timestral model files on Hugging Face are based on PyTorch and the safetensors format, and running them on a phone requires conversion to ONNX format.
50%UnverifiedThe technical verification checklist for judging whether a model leak is genuine includes: checking the checksums and file headers of the shard files, verifying the consistency between the configuration files and the architecture code, cross-checking the training metadata timestamps against distributed-training traces, and checking the uploader account's historical behavior and registration time.
50%UnverifiedMost current SBOM toolchains do not parse model weight formats (such as safetensors and GGUF), and they lack a standard process for comparing weight hashes against official release versions, which lets abliteration-processed model variants easily bypass routine dependency audits.
50%UnverifiedDuring safetensors import, the MLX framework assembles the ModelOpt expert banks for Flint.
50%UnverifiedThis version assembles ModelOpt expert banks during the safetensors import stage, rather than processing them after model instantiation.
50%UnverifiedThe safetensors index file (usually named model.safetensors.index.json) is a manifest used in the Hugging Face ecosystem for sharded weights, listing the name of each tensor and the shard file it is in, reflecting the weights that actually exist, and is the most reliable basis for determining what a model actually ships with.
50%UnverifiedAREX-2's config.json declares mtp_num_hidden_layers as 1, but its safetensors weight index contains no tensors prefixed with mtp (0), whereas the index of the base model Qwen3.8 contains 15 mtp tensors.
50%UnverifiedEnterprises should prioritize secure formats such as safetensors, perform hash verification on model files, and download weights only from trusted sources.
50%UnverifiedSafetensors is a serialization container consisting of a JSON header plus raw byte tensors; it does not perform quantization and is only responsible for storage, typically carrying BF16 or FP16 precision.
50%