[KongchangAI]
Productsafetensors格式

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

Timeline (last 90 days)

Oct 21

During safetensors import, the MLX framework assembles the ModelOpt expert banks for Flint.

Unverified50%
Oct 21

This version assembles ModelOpt expert banks during the safetensors import stage, rather than processing them after model instantiation.

Unverified50%
Oct 20

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.

Unverified50%
Oct 15

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.

Unverified50%
Oct 15

AREX-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.

Unverified50%
Oct 14

Enterprises should prioritize secure formats such as safetensors, perform hash verification on model files, and download weights only from trusted sources.

Unverified50%
Oct 14

vLLM can also read GGUF on GPUs through its plugin, but not all quantization types are supported, in some cases the --quantization parameter must be specified manually, and performance may differ from the native safetensors path; the official recommendation remains safetensors as vLLM's preferred format.

Unverified50%
Oct 14

Safetensors 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.

Unverified50%
Oct 14

safetensors can be opened in transformers, native vLLM environments, ComfyUI, and Apple's MLX toolchain.

Unverified50%
Oct 14

Conversion between formats is possible, but it is almost never worth it, because every conversion is a new opportunity for weights to silently diverge.

Unverified50%

19 more timeline events

All Facts (20)

Verified

The 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%
Verified

Python pickle格式在反序列化时可以执行任意代码,攻击者可以在模型文件中嵌入恶意代码

65%
Verified

SafeTensors 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%
Unverified

配合Hugging Face Hub,Transformers建立了模型分发的事实标准,包括模型卡片(Model Card)、权重格式(safetensors)、配置文件等规范

85%
Unverified

CAPABILITY declarations are preserved when creating a model from GGUF or safetensors, when inheriting via a model, and when exporting a Modelfile.

70%
Unverified

During safetensors import, the MLX framework assembles the ModelOpt expert banks for Flint.

50%
Unverified

This version assembles ModelOpt expert banks during the safetensors import stage, rather than processing them after model instantiation.

50%
Unverified

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.

50%
Unverified

AREX-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%
Unverified

Enterprises should prioritize secure formats such as safetensors, perform hash verification on model files, and download weights only from trusted sources.

50%
Unverified

Format choice is determined by the runtime already in use: Ollama/LM Studio/llama-server automatically select GGUF, Python/transformers pipelines automatically select safetensors, vLLM on GPU servers natively supports safetensors, and ComfyUI or image pipelines use safetensors.

50%
Unverified

Safetensors 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%
Unverified

safetensors can be opened in transformers, native vLLM environments, ComfyUI, and Apple's MLX toolchain.

50%
Unverified

vLLM can also read GGUF on GPUs through its plugin, but not all quantization types are supported, in some cases the --quantization parameter must be specified manually, and performance may differ from the native safetensors path; the official recommendation remains safetensors as vLLM's preferred format.

50%
Unverified

Ollama is built on the GGUF engine, but it still provides an MLX runner so that Apple Silicon users can load weights originating from safetensors.

50%
Unverified

GGUF BF16 is about 20% smaller than safetensors BF16, because llama.cpp serializes and packs tensors more compactly, while safetensors preserves the training framework's original tensor layout and JSON header.

50%
Unverified

GGUF makes quantization the default option, while safetensors makes full precision the default option; this default value is most of the format-selection decision.

50%
Unverified

Conversion between formats is possible, but it is almost never worth it, because every conversion is a new opportunity for weights to silently diverge.

50%
Unverified

Neural network weights are essentially multi-dimensional arrays (tensors) stored in file formats such as .safetensors, .gguf, or .bin, and the numbers themselves are static and cannot execute on their own.

50%

Source Articles