Running an open-weight model safely comes down to four checks before it serves a single prompt: read the licence the maker publishes, prove the weights you hold are the weights the maker released, load them in a format that cannot run code, and test the model on your own tasks and attacks. Then run it on an isolated inference server with no outbound network. Apply the same checks to every maker, American or Chinese.
Key takeaways
- Licences differ more than the word "open" suggests. As of 22 November 2026, makers publish Apache 2.0, MIT, OpenMDW 1.1 and custom licences with user, revenue or naming conditions.
- Pin every model file by hash and revision. Prefer safetensors over pickle based files.
- Scanning catches unsafe file formats and embedded code. It cannot prove a model has no trained-in backdoor.
- Self-hosting keeps prompts and code inside your environment and turns per-token spend into a fixed infrastructure cost.
What are open weights, and what do they include?
A model release has three parts: the weights (billions of numbers learned in training), the code that loads and runs them, and the data used to train them. "Open weights" means the first part is downloadable; code often is too, training data usually is not. The licence on the weights is your first control, so read the licence file itself.
Which licences do popular open-weight models use?
Each row below was taken from the maker's own Hugging Face model card or licence file on 22 November 2026. Licence names are quoted as the maker states them.
| Maker | Family (example release) | Licence as stated | Notable conditions in the maker's text |
|---|---|---|---|
| Meta (US) | Llama 4 Scout | Llama 4 Community License Agreement | Licence request needed above "700 million monthly active users"; display "Built with Llama"; Acceptable Use Policy applies |
| OpenAI (US) | gpt-oss-120b | Apache 2.0 | USAGE_POLICY file asks users to "comply with all applicable law" |
| Google (US) | Gemma 4 31B | Apache 2.0 | Card links the Gemma 4 licence page |
| NVIDIA (US) | Nemotron 3 Ultra | OpenMDW License Agreement, version 1.1 | Keep the agreement and notices when you distribute; patent or copyright suit ends the grant |
| Alibaba Qwen (CN) | Qwen3.8 27B | Apache 2.0 | Standard Apache terms |
| DeepSeek (CN) | DeepSeek V4.1 Flash | MIT License | Repository and weights under MIT |
| Moonshot AI (CN) | Kimi K3 | Kimi K3 License | Separate agreement for Model as a Service businesses above USD 20 million in 12 months; show "Kimi K3" in products above 100 million MAU or USD 20 million monthly revenue; internal use exempt |
| Zhipu Z.ai (CN) | GLM-5.3 | GLM-5.3 License | Model as a Service operators above USD 10 billion in 12 months must pass Z.AI's security review |
| Zhipu Z.ai (CN) | GLM-5.2 | MIT | Card states "no regional limits" |
Source: each model card and licence file linked in Sources, fetched 22 November 2026. Licences change between releases, as GLM-5.2 and GLM-5.3 show, so review the licence for each version, not each family. Background on the permissive licences is in our Apache 2.0 and MIT commercial use guide and on unusual ones in how to handle a custom licence.
How do you prove where model weights came from?
Treat a model like any other dependency with a supply chain.
- Pin the revision. Download by commit hash, not by branch, so a later push cannot change what you run. The Hugging Face Hub client accepts a
revisionargument for this. - Record file hashes. Store the SHA-256 of every weight file and compare it with the Hub's listed checksums. Our guide to checking a cached model against the Hub checksums walks through it.
- Mirror internally. Serve approved files from your own artefact store so production never pulls from the internet.
- Record it in an AI-BOM. CycloneDX ML-BOM and the SPDX 3 AI profile describe models, datasets and their provenance. See AI-BOM for model supply chains.
from huggingface_hub import snapshot_download
path = snapshot_download(
repo_id="Qwen/Qwen3.8-27B",
revision="<full commit sha you approved>",
allow_patterns=["*.safetensors", "*.json", "tokenizer*"],
)
Why safetensors and not pickle?
The Python documentation is blunt: "The pickle module is not secure", and malicious pickle data can "execute arbitrary code during unpickling". PyTorch .bin and .pt checkpoints use pickle. The torch.load docs describe a weights_only=True mode that restricts what can be loaded, and current PyTorch source defaults to it when no custom pickle module is passed. Safetensors, in Hugging Face's words, is "a new simple format for storing tensors safely (as opposed to pickle)". GGUF, used by llama.cpp, and ONNX are also data formats, but their parsers have had their own vulnerabilities, so keep runtimes patched. More detail is in our pickle deserialization analysis.
The other code path is trust_remote_code=True. The Transformers docs say custom models need it because they do not use the library's own modelling code. That flag runs Python from the model repository on your machine. Read that code, pin its revision, or refuse it.
Can scanning find a backdoored model?
Partly. Research has shown since 2017 that trained-in behaviour can hide in weights. BadNets (arXiv 1708.06733, August 2017) showed a backdoored network behaving normally until a trigger appears. Sleeper Agents (arXiv 2401.05566, January 2024) trained LLMs whose hidden behaviour persisted "through safety training". Planting Undetectable Backdoors (arXiv 2204.06974, April 2022) argued that some backdoors cannot be found efficiently at all.
So be honest about scanners. A file scanner can flag pickle opcodes, embedded code, odd file types and hash mismatches. It cannot certify that weights are free of a trigger. Provenance from the maker, your own evaluation and runtime controls carry the rest. Our post on whether testing can find a backdoor in a fine-tuned model goes further.
How should you evaluate a model before production?
Use neutral, written criteria and apply them to every maker in the same way: weights provenance, licence terms and evaluation results. Run your own task set first, because public leaderboards do not measure your workload. Then test safety and abuse with the OWASP Top 10 for LLM Applications (prompt injection, sensitive information disclosure, supply chain), map attack techniques with MITRE ATLAS (see our ATLAS tactics guide), and frame the risk record with the NIST AI RMF and its generative AI profile, NIST AI 600-1. Close with a data-handling review: what the model sees, what gets logged and who can read the logs.
How do you run open-weight models safely in production?
- Isolate the inference server. Its own network segment, no outbound internet by default, read-only model volume.
- Bind to private interfaces. Our Ollama binding guide shows the common mistake of exposing a model port.
- Keep secrets out of prompts and images. Use a secrets manager and short-lived tokens for the API gateway.
- Log and rate limit per user and per tenant, and keep tenant data apart.
- Patch the runtime. Inference servers are software with their own advisories.
Self-hosting means prompts, documents and source code stay inside your environment, and cost becomes the hardware you already pay for instead of a per-token bill.
Governance checklist for approving a model
| Check | Evidence to keep | Owner |
|---|---|---|
| Licence read for this exact version | Licence file hash, legal note | Legal |
| Revision and file hashes pinned | Commit SHA, SHA-256 list | Platform |
| No pickle or remote code, or reviewed | Format list, code review link | Security |
| File scan passed | Scan report | Security |
| Task, safety and injection evaluation | Results with dates | ML team |
| AI-BOM entry created | ML-BOM record | Platform |
| Isolated runtime with no egress | Network policy | Platform |
Where Safeguard fits
Safeguard can run open-weight models, American and Chinese, so your AI cost is fixed rather than billed per token. The AI mode is configurable per tenant: Full AI with Safeguard's models, Zero AI where the whole platform runs deterministically with no LLM in the loop, bring your own model, or local and on-prem models inside your environment. For the models you run yourself, Safeguard offers model scanning for LLMs, SLMs, skills and agents, AI-BOM discovery to inventory AI assets, and AI-SPM, which covers model artifacts in pickle, safetensors, GGUF and ONNX formats. Customer code, SBOMs and telemetry are not used to train shared models. See also AI red teaming vs AI-SPM.
The inference stack is still software: servers, tokenizers and Python packages with their own vulnerabilities. That is where the remediation flow below applies.
Fix it without waiting for upstream
Whatever the vulnerability, most of the risk sits in two gaps. The first is the time between a fix being published and that fix actually running in your production builds. The second, and worse, is the time before any fix exists at all, while a maintainer works out a patch and a release schedule. Waiting through both gaps is a habit, not a requirement. Safeguard gives teams three ways to close them.
1. Autonomous remediation: pull requests, not tickets
When a fixed version exists, Griffin, Safeguard's security model, opens a policy gated pull request that moves the affected dependency to the safe version, and your own CI runs your tests on it before anyone merges. You can run it on one repository or in bulk across every project that carries the vulnerable version. Remediation categories include dependencies, licenses, security posture and findings, and each one is set separately. Reachability analysis ranks the vulnerable code paths your application actually calls first, so the first pull requests you merge are the ones that matter most. Auto-merge is a separate switch and stays off by default, so your team decides what merges on its own and what still needs a human approval.
2. Gold Open Source: the safe version in seconds, free
gold.safeguard.sh is free and needs no login. Search any CVE or package to see affected and fixed versions, CVSS, EPSS, CISA KEV status and a recommended safe version, or use the "Am I affected?" checker. The same data is available through a free read API, README status badges and RSS threat feeds.
3. Gold Registry: start from components that are already fixed
Safeguard Gold rebuilds patched versions of open-source packages and images from source, signs each build, attaches an SBOM, SLSA provenance and VEX, and serves them from registry.safeguard.sh to your organization. Every Gold artifact is held continuously to zero exploitable critical or high CVEs and a completed license check, with signed build provenance (signed with Safeguard's key and verifiable with cosign, SLSA Build Level 3 as the design target) and a public evidence page you can hand to an auditor. An artifact loses its Gold badge if it regresses. Teams can point their own package directory at the registry so hardened equivalents resolve without changing how developers install anything.
When upstream has no fix yet, or will not ship one, Safeguard first works to get the fix accepted upstream. If the issue is severe or upstream will not move, Safeguard builds a fork, fixes the vulnerability there and publishes a hardened Gold build, so you are not stuck on a maintainer's release schedule. You can also request a hardened build of a specific package. Ask which packages it covers before you plan around it.
| Your situation | What to use |
|---|---|
| A fixed version exists | Autonomous remediation opens the upgrade pull request; Gold Open Source confirms the safe version |
| You need to know today whether you are affected | Gold Open Source lookup and "Am I affected?" checker, free and without login |
| You want vulnerable versions to stop shipping | Safeguard policies and gates in CI |
| Upstream has no fix yet, or will not ship one | A custom Gold request; fork and patch |
| You want to start clean on new projects | Pull hardened components and images from Gold Registry |
One honest limit: when the vulnerable code lives in a vendor appliance, a hosted service or an operating system runtime you do not build yourself, the fix still has to come from that vendor or distribution. The steps above apply to the open source dependencies and container images you build and ship, which is where most teams carry the largest and least tracked share of their exposure.
See how Safeguard would help
This demo sets up the local runner on your own machine, approves it with a device code, then scans from the terminal. The same flow scans the Python dependencies of a self-hosted inference server.
Click through it at your own pace, or open it full screen. Get started at safeguard.sh/download and the CLI docs.
FAQ
Are open-weight models the same as open source models?
No. Open weights means the parameters are downloadable. Training data and full training code are often not released, and some licences add conditions that open source definitions do not allow.
Can I use Qwen, DeepSeek or GLM models commercially?
The current cards list Apache 2.0 for Qwen3.8 27B and MIT for DeepSeek V4.1 Flash and GLM-5.2. GLM-5.3 and Kimi K3 use custom licences with conditions for large Model as a Service operators. Read the licence for the exact version.
Does the Llama 4 licence allow commercial use?
Yes, under conditions in the Llama 4 Community License Agreement, including a separate licence above 700 million monthly active users and the "Built with Llama" notice.
Can a scanner detect a backdoored LLM?
Not reliably. Scanners check files and formats. Research such as Sleeper Agents shows trained-in behaviour can survive safety training.
Should American and Chinese models be judged differently?
No. Use the same written criteria for both: provenance, licence terms and your own evaluation results.
Why self-host instead of using an API?
Prompts and code stay in your environment, and cost is fixed infrastructure rather than a per-token bill.
Sources
- Meta Llama 4 Scout model card and Llama 4 license
- OpenAI gpt-oss-120b model card and USAGE_POLICY
- Google Gemma 4 31B model card and Gemma 4 licence page
- NVIDIA Nemotron 3 Ultra model card and OpenMDW 1.1
- Qwen3.8 27B model card
- DeepSeek V4.1 Flash model card
- Kimi K3 model card and Kimi K3 License
- GLM-5.3 model card, GLM-5.3 License and GLM-5.2 model card
- Python pickle documentation
- PyTorch torch.load documentation
- Safetensors documentation
- GGUF specification
- ONNX concepts
- Transformers custom models
- Hugging Face Hub download guide
- CycloneDX ML-BOM and SPDX AI
- BadNets, arXiv 1708.06733
- Sleeper Agents, arXiv 2401.05566
- Planting Undetectable Backdoors, arXiv 2204.06974
- OWASP Top 10 for LLM Applications
- MITRE ATLAS
- NIST AI RMF and NIST AI 600-1
Last reviewed: 22 November 2026. Model licences change between releases; check each model card before you deploy.