AI GLOSSARY · LOCAL AND OPEN MODELS
Safetensors
Definition
Safetensors is a file format for storing tensors, the arrays of numbers that make up a model's weights. Its documentation describes it as a simple format for storing tensors safely, as opposed to pickle, while still being fast.
Also called: safetensor, safetensors format, .safetensors, safetensors file.
In plain language
A trained AI model is, in the end, a very large set of numbers saved in files. Safetensors is one way of saving those numbers. Its main selling point is safety: older Python model files used a format called pickle, which can run code when you open it, so opening a file from a stranger was a risk. A safetensors file holds only numbers and a small description of them, so opening it does not run anything. Think of a sealed parcel of data versus a parcel that might contain a program. It does not tell you whether a model is good, honest or licensed for your use, and it does not protect you from other risks such as a malicious script that downloads or loads the file.
Technical definition
A safetensors file starts with 8 bytes holding an unsigned little-endian 64-bit integer N, the size of the header. The next N bytes are a JSON header that gives each tensor's dtype, shape and data offsets. The rest is one byte buffer of tensor data, which the README says must be fully indexed with no holes. Because the header says where every tensor sits, a reader can load only some tensors, and the documentation describes loading without copying (zero-copy). The README says pickle is unsafe because it runs arbitrary code, and it mentions a header size limit as protection against denial-of-service files.
Worked examples in this catalogue
Catalogue examples point at a skill, guide or coding tool listed on this site, with what to run and what you see. An example marked illustrative describes the item from its own documentation; it was not executed for this page. Platform Scores are our assessment under a published method, not a safety guarantee.
Skill by Skill Almanac · Illustrative, not executed
local-model-sizing 57/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- A script that works out whether an open-weight language model will run on a given GPU, Mac or PC, computing weight, KV-cache and overhead memory per quantization level.
- Why it exercises the concept
- The weights it sizes are the numbers a file such as a .safetensors file stores. Sizing first tells you whether a download is worth fetching.
Guide · Illustrative, not executed
Self-Hosting an AI Agent: What You Take On
- What you see
- A checklist for running an agent on your own machine, including the model server that holds the weights and a note to work out memory needs before you download a large model.
- Why it exercises the concept
- Self-hosting means obtaining weight files and loading them. The guide covers fit and exposure; it does not cover file formats, so treat it as context for where the format matters.
Skill by Skill Almanac · Illustrative, not executed
skill-safety-audit 57/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- Scans a third-party agent skill folder and returns a JSON risk table with evidence lines before you install it.
- Why it exercises the concept
- Safetensors exists so that opening a model file does not run code. This skill applies the same check-before-you-run habit to skill folders. It does not inspect model files.
How it shows up when you use agents
You meet safetensors as a file extension. When you download an open-weight model, the folder often contains one or more .safetensors files next to a configuration file. Libraries such as the Transformers library and tools built on PyTorch read them, and the format's documentation lists several projects that use it. Other formats exist for other runtimes, for example GGUF.
What breaks when this is misunderstood: people take "safe" to mean the whole download is safe. The format removes one risk, code running when a weights file is opened. It does not vet the model's behaviour, its licence or the loading script around it. Another mistake is expecting every runtime to accept the file. A runtime that expects a different format needs a converted copy.
Next action: before downloading, check the model page for the file format, who published it and the licence, and use a sizing check so the model weights fit in your memory. If a coding agent writes the loading code, read that code before running it.
Common confusions
- Safetensors versus pickle. Pickle can run code on load, according to the project's README. Safetensors stores numbers and a JSON header only.
- Safetensors versus a model. It is a container for tensors. The architecture, tokenizer and licence come from other files and pages.
- Safetensors versus GGUF. Both store model data, for different tools. Check which format your runtime expects.
- Myth. A safetensors file guarantees a trustworthy model. It addresses how the file is read, not what the model does.
Related terms
Terms that mention Safetensors
4 terms mention this one
More in Local and open models
Sources
- Safetensors documentation, Hugging Face (accessed 2026-11-24)
- safetensors README, GitHub (safetensors project) (accessed 2026-11-24)
Definitions are written by Skill Almanac from these sources and were checked against them on 2026-11-24. Wikipedia is never the only source.
Review record
Last verified
Drafted by claude-sonnet-5-5; sources and example targets checked by claude-haiku-5-5 source check; claude-sonnet-5-5 editor pass on 2026-11-24. Last verified .
This entry is still in review, so it is not listed in search engines yet.
Change log (2)
- : First version.
- : Verifier pass: applied verifier corrections to wording and attributions.