Protecting Model Weights on Private AI Infrastructure: Model Security for Storage, Access and Ownership
We start with the file format when protecting model weights on private AI infrastructure, because some formats can run code on the server that loads the weights file.
Three decisions protect the weights file:
- Storage: Save weights in safetensors, a format that loads without running code, and check a signature before each load.
- Access: Grant read, write and export rights for each phase from design to retirement, and close the rights at the end of each phase.
- Ownership: Record the license and handover terms for the base model and each fine-tuned version.
Model Weight Protection at a Glance
RAND's AI Security Guide lists model weight protection and access control first among its ten control families, the groups of baseline controls it sets for AI systems.
Each decision has a main risk and a record to keep as evidence:
| Decision | Main risk | Record to keep |
|---|---|---|
| Storage | A weights file runs code during loading | A format record and a hash for each weights file |
| Access | Rights stay open after a phase ends | A list of identities with rights in each phase |
| Ownership | License terms miss a fine-tuned version | A license review for each base model and derivative |
Storage: Which Model File Format Should Hold the Weights?
Safetensors should hold new weights files, because the format loads as data without running code.
PyTorch's torch.save() and torch.load() use Python's pickle by default, according to the PyTorch serialization notes. Pickle rebuilds saved Python objects, so a crafted file can run code during loading.
Since version 2.6, torch.load defaults to weights_only=True unless the call passes a pickle_module argument. That mode limits loading to plain tensors and a few basic Python types.
PyTorch says memory corruption may still occur in this mode. The mode also doesn't guard against denial-of-service attacks.
PyTorch published advisory GHSA-63cw-57p8-fm3p in January 2026 for a crafted weights file that corrupts memory when loaded with weights_only=True and can potentially run an attacker's code. PyTorch fixed the flaw in version 2.10.0, so earlier releases shouldn't load files from outside sources.
The safetensors format stores tensors as raw bytes behind a JSON header. Its maintainers list pickle as unsafe because it runs arbitrary code, in a comparison they call their own and probably biased view.
A safetensors file holds an 8-byte header size, a JSON header capped at 100MB and a byte buffer where each byte belongs to a tensor listed in the header. The cap stops oversized headers from exhausting memory.
The byte rule in safetensors blocks polyglot files, which double as a second file format.
Older pickle files belong on an isolated server with network access cut off, where a script converts them to safetensors.
TORCH_FORCE_WEIGHTS_ONLY_LOAD=1 forces each torch.load call to use weights_only=True. PyTorch offers it for code a team can't edit, so it works as a stopgap.
Integrity: Verifying the Model File Before Each Load
Run a signature or hash check right before each load to confirm the weights file matches the approved file. Block the load when the check fails.
Palo Alto Networks' AI model security guide recommends checksums or cryptographic signatures at load time and alerts on unauthorized weight changes.
Palo Alto's AI infrastructure security guide also calls for scanning model files before deployment for malware, backdoors, license violations and hidden code that runs at load time.
SentinelOne lists hash verification of model binaries on load as a runtime integrity guard.
SentinelOne ties signed hashes of datasets, container images and hyperparameter files from each build to the Measure function of the NIST AI RMF, NIST's framework for managing AI risk.
Integrity checking has two parts:
- Signing: The team signs each weights file when it's produced or accepted from a supplier.
- Verification: A signature or hash check runs right before each load, including loads from cache copies and edge sites, so serving systems load signed artifacts.
Access: Who Can Read, Write and Export Model Files at Each Phase?
Each lifecycle phase gets its own list of people and service accounts with read, write and export rights, and the rights end with the phase.
RAND's guide treats AI security as cumulative: weak data governance during design can undermine strict permissions during operation. The guide places weight protection in each of its five lifecycle phases, and each phase needs its own decision about the weights file:
- Design: Choose the storage location and file format, and name the roles that will later hold rights to the weights.
- Develop: List who can read training checkpoints, the weights files saved during a training run, and who can write new ones on which machines.
- Deploy: Name the identities that can load the weights into serving systems and the registry of approved models those systems pull from.
- Operate: Set who can export or copy the file, and who receives an alert on each export.
- Retire: Revoke read, write and export rights, and delete stored copies.
RAND's weights security report targets frontier models, the most capable models of their time. It recommends keeping copies of the weights on a small number of access-controlled, monitored systems and cutting the number of people authorized to read the files.
NIST SP 800-53 Rev. 5 is the US federal catalog of security controls. Teams reporting against it can file these checks under its Access Control, Identification and Authentication, Audit and Accountability, Media Protection and Supply Chain Risk Management families.
Edge sites, small computing sites outside the main data center, add physical risk to the weights. Attackers can infer weights from power or timing signals, or copy model files once they reach the hardware, according to Palo Alto Networks.
Palo Alto names secure enclaves, tamper detection and encrypted model execution as the protections for those sites.
Our AI security overview covers the GPU compute, data paths and network boundaries around the weights file.
Model extraction rebuilds a model's behavior from repeated queries to its API, without touching the weights file. Palo Alto Networks recommends rate limits and monitoring of query patterns to catch model extraction attempts.
Model inversion, which recovers training data from a model's answers, and data poisoning, which corrupts the training data itself, need their own controls on the serving and training sides.
Ownership: License, Fine-Tuning and Handover Terms for Each Model
Each weights file carries license terms, and each fine-tuned version of a model needs its own inventory entry and handover terms.
Our sovereign AI cloud architecture audit treats model-weight custody, meaning who holds the trained weights, as a separate diligence item.
Open-weight model developers publish the trained weights for download, often under custom licenses. Cooley's open-weight models alert names license terms that may limit commercial use and volume, require attribution or restrict using derivatives to train a competing model.
Cooley advises confirming that the license permits fine-tuning, redistributing derivative weights or building downstream products before that work starts.
Self-hosted deployments may lack provider indemnification, a contract term in which the provider covers certain legal claims. Self-hosting also moves permission management, usage monitoring and vulnerability management onto the deploying organization.
LoRA is a fine-tuning method that keeps a model's original weights frozen and trains small add-on weights called adapters. Hugging Face's parameter-efficient fine-tuning (PEFT) library folds an adapter into the base model with merge_and_unload(), which produces a standalone model.
Several adapters can share one frozen base model. Calling unload() strips the adapters off and returns the original base model.
An inventory therefore needs separate entries for the base model, each adapter and each merged model, each with its own license and custody record.
An AI bill of materials (AI-BOM) is an inventory of the models, datasets, weights and software behind an AI system. Tines' AI-BOM guide recommends giving adapter weights and fine-tuning data their own records of origin, and storing a checksum and source record for each model weights file.
Handover moves custody of the weights to the buyer, so the transfer documents should name each weights file, its signature and its registry entry.
Zettabyte delivers through BOTT (Build, Operate, Train, Transfer), which ends with a customer handover in three parts:
- Knowledge transfer: Enablement sessions that give the local team the expertise to run the system.
- Documentation: Program governance and standard operating procedures.
- Support onboarding: Training the local team and staff to take over the assets and operations.
Where a deployment includes trained or fine-tuned models, the handover documents can list the weights files, signatures and registry entries among those assets.
Nine Model Security Checks for Weights on Private Infrastructure
Run these nine checks against the weights files on a private deployment:
- Formats recorded: List each weights file in the model registry and read its format from the file header. Flag each pickle file and the code that loads that file.
- Pickle loads isolated: Find each
torch.loadcall that reaches a pickle file, and move those loads to an isolated server with network access cut off and a restricted filesystem. Trace who can place a file on that server. - PyTorch version checked: Confirm the installed PyTorch release is 2.10.0 or later, the release that fixes advisory GHSA-63cw-57p8-fm3p. Set
TORCH_FORCE_WEIGHTS_ONLY_LOAD=1where calls can't be edited, and record which loads still passpickle_module. - Signatures checked at load: Name the step that signs each weights file when it's produced or accepted. Confirm the check runs right before each load, including loads from cache copies and edge sites, and that a failed check blocks the load.
- Identities listed per phase: For each of the five phases, list the people and service accounts with read, write and export rights on the weights. Remove names from phases where their work has ended.
- Retired models revoked: For each retired model and finished training run, confirm the rights were revoked. Check that stored copies were deleted, including checkpoints left on training volumes and in object storage.
- Adapters inventoried separately: Give the base model, each adapter and each merged model its own inventory entry, with the upstream license attached to the base. Record the merge history, so merged models aren't tracked as the base model.
- License reviewed: For each base model, read the license terms on fine-tuning, redistribution of derivative weights, commercial use, attribution and training competing models. Record the license's position on each planned use.
- Exit terms name weights files: Read the deployment and handover contracts, and confirm weights files, signatures and registry entries appear as named transfer items. Confirm the plan covers changes to license terms or model availability after exit, a contingency Cooley also recommends.
zPLATFORM, our GPU management software, combines identity management, usage tracking and system monitoring for the clusters that serve the weights.
Model Weight Security FAQ
How Can Teams Trace a Stolen AI Model?
Teams trace a stolen model through watermarks or fingerprints, identifying marks embedded during development that can prove ownership of a recovered copy.
Palo Alto Networks says recovery of a stolen model is rare. A detected copy can lead to a takedown, a license revocation or retraining from secured source versions.
