Why I Run Open-Weight Models Locally
If you have the hardware, open-weight models solve one of the biggest problems with AI in security work: your data leaving the building.
My daily model is Qwen3-8B on MLX, with Ollama serving gpt-oss:20b and Qwen3 30B as fallbacks, all on my Mac. Embeddings come from nomic-embed-text, also local. For that work, my notes, configs, and handoffs never go to a third-party API.
What running locally gets you
- Your data stays on your hardware. There’s no retention policy to read and no prompt log on someone else’s server.
- It works offline, so the same setup can move to an air-gapped network.
- You control the version. I pin my embedding model by digest, and a digest change turns off vector search until I rebuild the index, so vectors from two different models never get mixed.
- There’s no API key to leak, rotate, or get billed for.
- You pick the model for the job: a small, fast model for tool calls and a bigger one for reasoning.
What it doesn’t fix
- Model files are a supply chain. Pickle-based PyTorch checkpoints can run code the moment you load them, and in 2025 researchers found malicious models on Hugging Face that used broken pickle files to get past its scanner. Prefer safetensors or GGUF, download from the original publisher, and check hashes.
- Local isn’t the same as isolated. Ollama binds to loopback by default and has no built-in authentication. Change that to 0.0.0.0 so other machines can reach it, and anyone on your network can use it.
- Smaller models hallucinate more and follow tool schemas less reliably. I still use Claude Code and Codex for heavy coding, and I decide task by task what is allowed to leave the machine.
- The hardware isn’t free. You need enough unified memory or VRAM to run a model at a usable speed, and you own the patching.
Open weights don’t make AI safe on their own. They give you control over where your data goes and what changes underneath you, and in security work that control is most of the job.
Next post: why I don’t run code from a random GitHub repo until I’ve checked it.
Deep dive
My setup
I run Qwen3-8B through MLX and keep models available through Ollama. My embedding model runs locally. That gives me a way to work with notes and handoffs without sending that work to a third-party API.
The retrieval code has a concrete version check. Its default embedding configuration pins an expected digest prefix. The index stores that expected digest alongside the model name, dimensions, prefixes, and other metadata. At startup, the worker compares stored metadata with the expected values and asks the runtime for the live model digest.
If the metadata differs, the model is missing, or the live digest no longer matches the expected prefix, the worker turns vector search off. The diagnostic reports the mismatch and suggests a rebuild. This is a fail-closed check followed by a rebuild step; the code I reviewed does not establish an automatic rebuild. The configured digest can be overridden, so the default is not proof of a particular running instance’s configuration.
My model gateway sits in front of the local runtimes. Its project record describes an authenticated gateway with profiles that limit which clients can reach a model and whether tools are available. That is the documented design, not a fresh test of the running gateway. Model output does not approve or execute changes.
Check your own setup
Run these commands on your own machine. They inspect listeners and files; they do not load a checkpoint. Review any output before sharing it because it may identify services, models, or internal endpoints.
Find Ollama listeners. On macOS, with Ollama running:
lsof -nP -iTCP -sTCP:LISTEN | grep -i ollama
A loopback-only listener is reachable from the same machine. A wildcard or network-facing listener may be reachable from other devices, depending on firewall and network rules. An empty result does not prove the service is absent: permissions, process names, and whether it is running affect the result. Check the full listener list if needed.
Check the address setting. Ollama documents OLLAMA_HOST as the setting for the server bind address; clients may also use it to choose a server. Inspect the current shell with:
printenv OLLAMA_HOST
An empty value means this shell has no value set. It does not establish what a service manager or another process received. Compare the actual listener with the configuration used to start the server. Ollama’s documented default is loopback; changing the bind address can expose its API to the network. Review authentication and network controls before doing that.
Record local models and identifiers.
ollama list
The listing shows installed model names and IDs. Treat the displayed ID as an identifier, often a shortened digest, rather than assuming it is a full file checksum. Save a record of the model and version you actually reviewed. A model tag can move, so repeat the check when updating.
Hash a downloaded model file. Set MODEL_FILE to your own file, then run:
shasum -a 256 "$MODEL_FILE"
Compare the result with a full SHA-256 value obtained through a trusted publisher channel. A match establishes that the file matches that reference; it does not prove that the publisher or the file is safe.
Inspect the format before loading it.
file -b "$MODEL_FILE"
od -An -tx1 -N16 "$MODEL_FILE"
Check the extension and the first bytes together. GGUF starts with the ASCII bytes for GGUF. Safetensors begins with an eight-byte little-endian header length followed by JSON, so it has no fixed text magic at the start. Pickle-based checkpoints may use extensions such as .pkl, .pt, or .pth, and modern PyTorch checkpoints can be ZIP containers. Extensions can be misleading, and a ZIP header alone cannot tell you whether an archive contains pickle.
These quick checks identify clues, not safety. An unknown, inconsistent, or suspicious file needs further inspection in an isolated environment. Do not unpickle an untrusted file just to find out what is inside.
Model files are a supply chain
In 2025, ReversingLabs reported malicious model files that used broken pickle data and archive handling to evade scanning. The researchers described the examples as appearing to be proof-of-concept uploads. Hugging Face removed the identified models and improved its scanner after disclosure. I treat that as a documented outside research finding, not a breach of my own setup.
Hugging Face’s pickle-scanning documentation explains why unpickling untrusted data can execute code and how its import scan works. Scanning is useful evidence, but an evasion demonstrates why I also check provenance, format, and hashes.
Safetensors documentation describes a tensor format designed to avoid pickle’s arbitrary-code execution behavior. GGUF has its own format specification. Neither an extension nor a favorable format label validates the publisher, accompanying code, or model behavior.
I use Ollama’s FAQ to check the documented listener behavior, then inspect the machine itself. Documentation describes defaults; the listener shows what this installation is actually exposing.
Where I still use commercial models
I use Claude Code and Codex for heavy coding work. I decide which source material each task can include before sending it to a commercial service. I use local models for work where the notes and handoffs need to stay on my machine. I review the output from both.