Running LLM Guard with local models and no Hugging Face downloads: why teams do it
If your LLM Guard deployment still pulls its models from Hugging Face when a container starts, you are depending on a model source that the project no longer maintains. The LLM Guard README states that the project and its associated models on Hugging Face are no longer under active development or maintained, and the repository was archived on 9 July 2026. That means no new model fixes, no new model versions and no guarantee that the files you fetch next month match the files you tested last month. The practical goal is to stop fetching models at runtime and to decide, deliberately, which model files your scanners will use until the deployment is replaced.
LLM Guard's documentation describes a model_path setting for scanners that support it. The value points to a folder that holds the ONNX version of the model, so the model is not downloaded each time the container starts. For an archived component, this turns the model into an artifact you control: you choose the files, record their checksums, store them in your own artifact repository and mount them into each container. Restarts, scaling events and rebuilds then load the same bytes every time. Before you change anything, inventory which scanners in your configuration load a Hugging Face model, because not every scanner uses one and each one needs its own model_path entry.
This work does not make LLM Guard a good choice for a new rollout, and DeployOpen does not recommend one. Freezing models keeps an existing deployment stable and contained while you plan its replacement, and it should be recorded as a temporary control with an owner and an end date. Confirm with your security team how the frozen models will be reviewed, who approves a new model file if one is ever needed, and where the decommission milestones are tracked, so that the frozen state does not quietly become permanent.
How a frozen model reaches a scanner
The path starts with a model reviewed outside the host and copied into an internal artifact store, where its files are checked against recorded hashes. The artifact store feeds a read-only mount into the LLM Guard container, and each scanner's model_path points at its own ONNX folder, so nothing is fetched from Hugging Face at start-up. Everything inside the air-gapped boundary depends on the integrity checks at the transfer point, so confirm those checks are recorded before any model is loaded.
Frozen models move from a reviewed source through checks and a read-only mount to each scanner.
Which model loading option fits which environment
This table compares four ways to supply LLM Guard's ONNX models: downloading at start, baking them into an image, mounting a directory, and pointing model_path at a host path. Read each row against your environment, then check the patching and integrity column before choosing, since that is where the options differ most.
| Option | When it fits | What it changes for patching and integrity | What to confirm in your environment |
|---|---|---|---|
| Download from Hugging Face at start | Connected development or test hosts where outbound access is permitted and model drift is tolerable | Model files change without a deployment event, so the scanner behavior can shift between restarts; no fixed hash is checked unless you add one | Whether egress to Hugging Face is allowed from the runtime, and whether your policy accepts unpinned model artifacts |
| Bake ONNX models into a custom image | Production clusters with a controlled image pipeline and no runtime egress | Models become part of the image digest, so they are scanned, signed and rolled back with the image; a model update means a new image build | Your registry scanning and signing tools cover the image layers, and your team owns rebuilds when the base image or Python version needs patching |
| Mount a model directory from a volume | Shared storage or Kubernetes setups where several replicas use the same models and the image should stay small | Models can be replaced without rebuilding the image, which eases updates but also lets files change outside the release process | Who can write to the volume, whether checksums are recorded at copy time, and whether volume contents are included in backups |
| Point model_path at a host path | Single hosts or air-gapped VMs where models are copied in through an approved transfer process | Integrity depends entirely on host controls such as file permissions, change monitoring and the transfer record | Whether the host is in your configuration management scope, and how you verify files before each transfer across the boundary |
How model_path changes the scanner configuration
Pointing a scanner at local files is a per-scanner setting, not a global switch. Scanners that support it accept a model_path value that points to a folder containing the ONNX version of the model, so the scanner reads weights from disk instead of fetching them each time the container starts. Each scanner in your configuration is set separately, which means one scanner can load from a mounted folder while another still reaches out for its model. Treat the configuration as a list of scanners, each with its own path, and never assume that setting one value covers the rest of the pipeline.
Start with an inventory. List every input and output scanner your callers depend on, then mark which of them load a model at all, since some rely on rules or pattern matching and need no model files. For each model-backed scanner, record the model it loads, the model_path it currently uses (or none), the folder that will hold the ONNX copy, and the owner who approved that model version. Check the scanner documentation for your exact release before you rely on the parameter name, because the LLM Guard docs describe it as supported only by certain scanners. Confirm the mapping against the running configuration, not against memory of an old deployment.
Then verify each path inside the container with networking disabled. Run the container with no outbound route, or on a network segment that blocks the Hugging Face domains, and confirm that each scanner initializes and scores a known test string. Check that every model_path resolves to a readable folder inside the container, and that the scanner does not fall back to a download when a file is missing. An illustrative check: start one scanner with a deliberately wrong path and confirm it fails loudly instead of silently loading from the network. Keep the test output as evidence that the frozen configuration works, since it will be the baseline for later changes.
Setting up local ONNX models for LLM Guard step by step
This sequence moves every model that an LLM Guard deployment depends on into a controlled internal location, points each scanner at it, and proves the container can scan without reaching the internet.
Inventory scanners and model dependencies
The platform owner lists every input and output scanner the deployment enables, along with the model each one loads at startup and the container image and tag that run them. Record the caller of each scanner and which scanners run on each route, so you know which models must be present for the service to start. The step is done when the list is reviewed by the application owner and matches the live configuration. Confirm each scanner's model requirement against the LLM Guard documentation for the exact version you run, because the archived project does not publish updates.
Obtain and hash the ONNX model files
A named engineer downloads the ONNX version of each required model from a source your security team approves, using a connected staging host rather than a production system. Record the source, retrieval date, file names and a SHA-256 hash for every file, and store that record with the change ticket. Confirm the license terms of each model before it enters your environment. The step is complete when a second person has independently recomputed the hashes and they match the record.
Stage models on an internal path or volume
Copy the verified files into an internal artifact store, a controlled file share or a read-only volume, using a folder layout that names each model by scanner and version. Make the folder readable by the service account and not writable by the application process. Re-check the hashes after the copy to confirm nothing changed in transit. The step is done when the hash check passes on the destination path and the folder permissions are documented.
Set model_path for each scanner
Update the configuration of each scanner that supports
model_pathso it points to its folder of ONNX files, and remove any setting that would fetch a model by name from Hugging Face. Keep the configuration in version control so the change can be reviewed and rolled back. Scanners that do not accept a local path need a separate decision, which should be recorded in the inventory from step one. The step is done when a configuration diff shows only path changes and no remote model identifiers remain.Build or mount the image with models included
Choose whether models are baked into a rebuilt image or mounted at runtime from the staged volume. Baking them in gives an image that is self-contained but must be rebuilt whenever the models change, while mounting keeps the image small and makes model swaps a storage operation. Tag the resulting image with a digest and store it in your internal registry. The step is complete when the image digest and the mount or copy source are both recorded in the deployment record.
Run with outbound network blocked
Start the container in a network segment that has no route to the internet and no DNS resolution for external model hosts. Ask the network team to confirm that egress is denied at the segment boundary, not only in the application configuration. Watch startup logs for any attempt to reach an external host, since a failed fetch shows up there first. The step is done when the service starts cleanly and the egress test from the network team shows that external connections are refused.
Verify each scanner with test inputs
Send a fixed set of benign and known-bad test inputs to every enabled scanner through the API, and record the expected and actual result for each one. Include at least one input that each scanner is supposed to flag, so you can see that the local model loads and makes decisions rather than failing open. Store the test set and results with the hashes from step two. The step is done when every scanner returns the expected result, and any failure has been traced to a cause and resolved before the deployment is accepted.
Security controls for frozen models and offline hosts
Once models are copied to a local path, the model directory becomes part of your security boundary. The controls below keep those files trustworthy from the moment they leave the source until the container stops, and they give auditors evidence that the scanners run the models you approved.
Model file integrity and provenance
Record where each ONNX model came from, when it was copied, and who approved it before it enters the directory used by model_path. Compute a cryptographic hash for every file and keep the source reference beside it. Because the upstream models are no longer maintained, a hash taken at import is the only fixed point you control. Check the hashes again before each deployment.
Restricting write access to models
Mount the model directory read-only into the LLM Guard container and limit write permission on the host to a small set of named accounts. Any process that can write to that path can replace a scanner's model without a code change. Confirm that the container user can read the files but cannot modify them, and test that the restriction holds after a restart.
Version control or artifact store for models
Keep the approved model set in a Git repository with large-file storage or in an artifact store with immutable versions. Tag each set with the LLM Guard version it was tested against. This gives you a rollback point if a replacement model changes scanner behavior, and it gives reviewers a diff of what changed between two releases.
Preventing silent network fallback
Set the offline environment variables for Hugging Face and the transformers library, such as HF_HUB_OFFLINE, so a missing local file fails the start instead of triggering a download. Confirm the variable names against the current library documentation for the version you run. Block outbound access from the container at the network layer as well, so a misconfigured path cannot reach the internet.
Logging model hashes per container
Write the hash of each model file to the container's startup log, along with the LLM Guard version and the image digest. Ship those logs to your central log platform. When an incident or audit asks which model answered a request on a given date, you can match the container's record to the model set in version control.
Carrying verified files across a boundary
NERC CIP-013-2 requires utilities to verify software integrity and authenticity before vendor software crosses into their systems. Apply the same discipline to models you move onto an isolated host: check the hashes at the boundary, record who performed the check, and keep the transfer media in a controlled location. Ask your compliance team which of these steps your own framework requires.
CIP-013-2 textCarrying packages and models into an air-gapped host
The core task in an air-gapped LLM Guard deployment is moving every dependency across the isolated boundary in a form you can verify. Build the transfer bundle on a connected staging host that matches the target's Python version and operating system, then collect the Python wheels for the pinned LLM Guard release, the ONNX model folders for each scanner you keep, and any system libraries the wheels need. Record a checksum for every file and keep the manifest with the bundle, so the team that receives it can check what arrived against what was approved. Because the last PyPI release, 0.3.16, requires Python 3.10 or newer but below 3.13, the staging and target interpreters must agree on that range before any wheel is built.
Several mature platforms use a similar pattern, and they are useful as illustrative comparisons only. Kubernetes lets operators pull control plane images ahead of time with kubeadm config images pull and then point kubeadm init at a private registry through --image-repository. GitLab documents separate guidance for offline environments, and Security Onion updates an airgapped install from newer ISO media. In each case the vendor publishes a supported route. LLM Guard does not offer an equivalent that is maintained, so the transfer steps for your environment, including how wheels are mirrored and how models are staged, must be confirmed by your own team against your change and media-handling procedures.
Verification belongs on the far side of the boundary, before anything is installed. Compare each checksum in the manifest with the file on the air-gapped host, confirm the model folders contain the ONNX files that each model_path setting will point to, and install into a clean virtual environment rather than an existing one. Then run a scanner load test with networking disabled, which confirms that nothing reaches out to Hugging Face at startup. Keep the signed manifest, the import log and the test output together. Those records are the evidence your change board and any assessor will ask for when a later bundle carries an update, and they also show who approved what entered the isolated network.
Limits to confirm before freezing models
Freezing models locks in a snapshot of what LLM Guard loads, and that snapshot will not be refreshed by the project. The cards below cover the limits to confirm in your environment before you copy models to local paths and rely on them.
No upstream fixes for frozen models
The LLM Guard README states that the project and its associated Hugging Face models are no longer under active development or maintained. A model you copy today will not receive retraining, bug fixes or security updates from the publisher. Treat the frozen files as a fixed component with a known age, and record the date you copied each one so auditors and your own team can see how old it is.
Project repositoryLast release pins the Python version
The last LLM Guard release on PyPI is 0.3.16, uploaded on 19 May 2025. It requires Python 3.10 or newer but below 3.13. Your local model copies must be used with a runtime that this release accepts, so the base image and interpreter you choose for offline runs should match that range. Confirm the interpreter version in the exact image you will run.
PyPI release pageScanner support for model_path
The API docs say scanners that support it accept a model_path pointing to a folder with the ONNX version of the model. Not every scanner is documented as supporting this path, and some scanners may load models without exposing a setting like it. Build a table of each scanner you run, its model dependency and whether model_path applies to it before you copy anything.
ONNX compatibility with the pinned runtime
An ONNX file that loads on one runtime version may fail, or change output, on another. Test each copied model with the exact ONNX Runtime and LLM Guard versions in your image, using known prompts that should be flagged and known prompts that should pass. Keep the test inputs and outputs as evidence, because a silent change in scores is harder to detect later than a load error.
Which scanners load models at all
Some LLM Guard scanners are rule-based and load no model, while others depend on one or more models. Confirm which scanners in your configuration load models at startup, which load them lazily on first use and which never load one. Models you do not need should not be copied, and the ones you do need should be listed by file name and checksum in your deployment record.
Integrity of files carried across the boundary
When models are copied into an isolated network, each file crosses a boundary without the normal download path. Verify each model file against a checksum recorded at the source, and keep the source, transfer method and person responsible in your change record. This supports the supply chain expectation in NERC CIP-013-2 where it applies to your environment, and it is useful evidence in any review.
Questions teams ask before running LLM Guard offline
Can our own team move LLM Guard to local models without a partner?
Yes, if you have an engineer who can run the existing containers, copy model files onto a host or volume, and point each scanner at its local folder with model_path. The mechanics are small. The effort comes from knowing which scanners load which models, proving each container starts with no outbound network access, and keeping a record of the exact model files you froze. Teams that already operate Python services and container images usually find the core change manageable. Teams without that experience, or without time to test every scanner, often choose a partner for the inventory and verification steps.
What drives the effort of an offline model setup?
Four factors move the effort most:
- The number of scanners enabled, since each one that depends on a model needs its own model path and test.
- The number of distinct models, including any shared by several scanners.
- Air-gap controls, such as how models, Python packages and container images cross the isolated boundary and how each transfer is checked.
- The depth of testing, meaning whether you only confirm startup or also compare detection results before and after the change.
A deployment with few scanners and one host is a much smaller job than a multi-cluster setup with strict transfer rules.
What do we need to provide before work starts?
Expect to supply access and inputs in four areas:
- Hosts or clusters where the LLM Guard containers run, with administrator access for configuration changes.
- A private container or package registry reachable from those hosts, if the network is isolated.
- The model sources you approve, along with a way to record their checksums and origin.
- A test corpus of prompts and responses that represent your traffic, including known attacks and benign content, so detection can be compared before and after.
The test corpus is often the item teams underestimate. Without it, the offline setup can start correctly while still changing what the scanners block.
How long does an offline model migration take?
Duration depends on scope, not on a fixed figure. A single API server with a few scanners and a prepared transfer process can be short to plan and test. Several deployments, many scanners, or a strict approval chain for every file moving into an isolated network will take longer, mainly because of approvals and test runs rather than file copying. Ask for a schedule in the written scope that lists the scanners, environments, transfer steps and test gates, so you can see which part controls the calendar.
Which parts of the work are one-time and which recur?
Most of the offline setup is one-time: the model inventory, the model paths, the first transfer and the test baseline. Recurring work begins once the frozen models are in use. Each time a container image, Python dependency or base operating system changes, the model set and the test results may need to be checked again. Because LLM Guard is archived, no upstream model updates will arrive, so the recurring effort is mostly verification and record keeping until the deployment is replaced.
What should a quote for this work include?
A quote should follow from a written scope and list what is included and excluded. Ask it to state:
- The scanners and deployments covered, with the model each one uses.
- The hosts or clusters, and whether they are connected or air-gapped.
- How models, packages and images are transferred and verified.
- The test corpus, the test method and the evidence delivered.
- Who supplies registry access, hardware and test data.
- The delivery schedule and what happens if scope changes.
DeployOpen does not publish a price list. A quote is prepared from the written scope, so the scope detail above is what determines it.
How do we confirm that an offline scanner still works?
Start by confirming that each container loads its model from the mounted local path and that it makes no outbound request during startup. Then run the test corpus through the scanner and compare its results with the baseline recorded before the change. Keep the model files, checksums, container image digests and test output together, since these are the records an internal reviewer or external auditor will ask for. Confirm the exact configuration keys and file layout against the LLM Guard API documentation for your installed version.
How DeployOpen scopes offline LLM Guard work
DeployOpen plans and implements offline LLM Guard work in infrastructure you control, such as your cloud accounts, data centers or air-gapped networks. Engagements are usually fixed-scope, with the scope, deliverables and timeline agreed in writing before any work starts. For this topic, the core deliverables are a model inventory listing every model each scanner loads, frozen ONNX artifacts stored at known local paths, verification tests that confirm each scanner starts without reaching the internet, and a handover document your team can run without us.
The inventory is the step that most often decides the scope. It should record each scanner that uses a model, the model file and version it resolves to, the model_path value set for that scanner, and the checksum of each artifact. Ask the vendor-independent questions early: which scanners in your configuration load models at all, whether any environment variable or cache path still points at Hugging Face, and how many separate container images bake in their own copies. The effort grows with the number of scanners, the number of environments and the number of images that must be rebuilt, so ask for a quote that itemizes these counts from your own configuration rather than a flat estimate.
DeployOpen does not recommend new LLM Guard rollouts. The project is archived, and its owner states that the project and its Hugging Face models are no longer maintained. Freezing models keeps an existing deployment running, but it does not add security updates. If you plan to replace LLM Guard, we point teams toward maintained guardrails such as NeMo Guardrails only after confirming the target fits your requirements; we would treat the offline freeze as a bridge with a documented end date, not a long-term design.
How DeployOpen supports existing LLM Guard deployments
DeployOpen approaches local model setup for LLM Guard as a bounded piece of work inside your infrastructure. We confirm which models each scanner loads, copy them to a path you control, and point each scanner at that path so hosts stop reaching Hugging Face.
How we scope
- Inventory every scanner in use and the ONNX model each one loads today
- Agree which model files go into a local path, with owners and checksums recorded
- Confirm which hosts run without internet access and how model files will reach them
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts
How we build
- Copy the ONNX models into a versioned directory on storage your team controls
- Set model_path per scanner in configuration and remove Hugging Face download steps from startup
- Test each scanner in a staging environment with network egress blocked to confirm no model fetches occur
- Verify that scan results match the pre-change baseline on a agreed set of sample prompts and outputs
How we hand over
- Document the model directory layout, file hashes, and the configuration keys changed for each scanner
- Provide a runbook for adding, replacing or rolling back a model file on an air-gapped host
- Record the package and model versions pinned, so auditors and your team can trace what runs
- Walk your platform and security teams through the test evidence and the open items
How we support
- Ongoing support, upgrades and continuous testing are available as retainers
- Re-verify pinned models after base image, OS or Python changes that affect the environment
- Retest scanners after configuration changes and report any drift from the agreed baseline
- Plan support with your decommission timeline so the local model setup can be retired with the deployment

