Model & ML supply-chain security

safetensors: safe tensor file format for model weights

safetensors is a safe tensor file format for model weights from PyTorch Foundation (Linux Foundation). It is open source under the Apache-2.0 license and is offered as: Library.

  • Last reviewed
Open sourceApache-2.0 Layer 3: Model and supply chain

Best for

ML teams that publish or load model weights and want a format that avoids pickle deserialization

Ownership

Hugging Face announced on April 8, 2026 that Safetensors joined the PyTorch Foundation (Linux Foundation); Hugging Face's maintainers continue to lead the project day-to-day. Source, checked October 21, 2026: huggingface.co (opens in a new tab)

Consider instead if

  • You must load existing pickle-based model files and want to inspect them before use. See picklescan or ModelScan.

What safetensors does

safetensors is an open-source file format and library for storing and sharing model weights as an alternative to pickle. The README compares it with pickle, which its table marks as not safe because a downloaded file can run arbitrary code, and describes limits on header size and non-overlapping data regions that resist denial-of-service attacks. A third-party audit by Trail of Bits, announced by Hugging Face on May 23, 2023, reported no critical flaw leading to arbitrary code execution. Since April 2026 the project is hosted by the PyTorch Foundation under the Linux Foundation. The Python package installs with pip and the license is Apache-2.0. It is a storage format, not a scanner: it does not inspect files saved in other formats.

This summary is our own wording of the sourced facts on this page.

Key facts

Each value links to the page that states it, with the date we checked it.

Ownership
Hugging Face announced on April 8, 2026 that Safetensors joined the PyTorch Foundation (Linux Foundation); Hugging Face's maintainers continue to lead the project day-to-day. Source, checked October 21, 2026: huggingface.co (opens in a new tab)
API reference
Not documented in the sources we checked
Attestations or disclosure
Private reports by email to Hugging Face security or through Huntr; no public issues Source, checked October 21, 2026: github.com (opens in a new tab)

Capabilities

As documented by the vendor or project. The tag is our label from a controlled vocabulary.

Integrations

Where safetensors fits in our AI security layers

Our analysis

Our editorial model, not a standard. The primary layer follows the category, except for tools whose main documented job is detection and response; other layers rest on a capability the sources document. How the model works.

AI security layers that safetensors covers, with the role, how each applies and what it rests on
LayerRoleHow it appliesBased on
L3 Supply chain Model and supply chain Primary Check that models, datasets and AI components from outside are what they claim to be and do not run code or hide backdoors when loaded. Follows its category, Model & ML supply-chain security

OWASP LLM Top 10 mapping

Our analysis

The risk list is OWASP's (Top 10 for LLM Applications, 2025). The mapping is our analysis, and each row rests on a capability the sources document.

OWASP LLM risks mapped to safetensors, with the capabilities each mapping rests on
RiskHow it appliesBased on
LLM03 Supply Chain Offers a weights format that avoids pickle, which the README table marks as not safe because a downloaded file can run arbitrary code. Stores tensors in a format the README marks safe, and marks pickle as not safe because a downloaded pickle file can run arbitrary code; Format limits the header to 100MB and guarantees non-overlapping data regions to resist denial-of-service attacks; A Trail of Bits audit commissioned by Hugging Face with EleutherAI and Stability AI found no critical flaw leading to arbitrary code execution

Alternatives and related tools

More in Model & ML supply-chain security, ranked within the category by Coverage Score.

ModelAudit (Promptfoo)

OpenAI (Promptfoo)

Open sourceMIT
  • CLI
  • Library
  • Self-hosted

Scans model files for malicious code, backdoor indicators and unsafe operations without loading them.

Best for: Teams that want a free scanner covering many model and archive formats, with SARIF output for code scanning in CI

Coverage Score 86 out of 100
  • LLM03 Supply Chain
  • LLM04 Data and Model Poisoning

Reviewed

ModelScan

Palo Alto Networks (Protect AI)

Open sourceApache-2.0
  • CLI
  • Library

Scans saved ML model files for unsafe serialized code before you load them, from a CLI or Python.

Best for: ML and platform teams that want a free scanner to check downloaded or internally produced model files before loading or deploying them

Coverage Score 84 out of 100
  • LLM03 Supply Chain
  • LLM04 Data and Model Poisoning

Reviewed

Open sourceApache-2.0
  • CLI
  • Library

Signs machine learning model files and verifies them later so tampering can be detected.

Best for: Teams that publish or consume models and want a free way to sign model files and check signatures before loading them

Coverage Score 78 out of 100
  • LLM03 Supply Chain
  • LLM04 Data and Model Poisoning

Reviewed

safetensors FAQ

Is safetensors open source?

Yes. safetensors is released under the Apache-2.0 license, and the code is on GitHub at safetensors/safetensors.

Was safetensors audited?

Hugging Face announced a Trail of Bits audit on May 23, 2023. It reported no critical security flaw leading to arbitrary code execution.

Does safetensors scan existing model files?

No. It is a storage format and library. Scanning pickle-based files needs a separate tool.

Who owns and maintains safetensors?

Hugging Face's post of April 8, 2026 says Safetensors joined the PyTorch Foundation as a foundation-hosted project under the Linux Foundation, and that Hugging Face's core maintainers continue to lead the project day-to-day.

Key facts you can cite

We have no commercial relationship with PyTorch Foundation (Linux Foundation).

Sources & last reviewed

Last reviewed . We compile from the vendors' own public pages and repositories and we do not run the products. Source links open in a new tab. Found a mistake? Report a correction.