Own Weights

Self-hosted LLM security: access, logs and the weights

Self-hosted LLM security covers access control, audit logs, prompt injection defenses and weight protection. Here is the checklist a private model needs.

Updated

Self-hosted LLM security means controlling who can call the model, what your systems record about each call, and who can copy the model weights. A model you run yourself keeps prompts and outputs out of a vendor’s systems, but that alone does not make it secure.

This page covers the operating side: access, logs, prompt injection and the weights. It is not legal or compliance advice. The model helps people who review its output, and it runs under your own controls, so your security team decides what is enough for your data.

Is self-hosted AI more secure than an API?

It can be, for one clear reason. Prompts, outputs and weights stay in an environment you control, so one fewer company holds your data. That is a real cut in exposure, and it is the usual reason teams look at self-hosting first.

It is not secure by default. A vendor API usually comes with a security team, patched infrastructure and logging already in place. A model you run has none of that unless your team builds it. A poorly configured server inside your network can leak more than a well-run API does.

The honest split is about who holds each control. With an API, the vendor runs most of the infrastructure and you rely on its data terms. With a model you run, you hold all of it. Self-hosting fits best when your rules keep data inside your network or when you need the weights to stay yours. It fits poorly when your team cannot run the controls in the sections below.

How do you control access to an enterprise LLM?

Start with one rule: no request reaches the model without an identity you can name. Shared API keys are a common failure. A key pasted into a script cannot tell you who sent a request, and it keeps working after the person who used it has left.

Put the model behind your existing single sign-on, or behind a gateway that checks identity on every call. Give each application its own credential, limited to the one model and the one task it needs. Rotate those credentials on a schedule, and revoke them the day a system is retired.

Separate the people who use the model from the people who change it. Deploying a new version, editing the system prompt and raising rate limits are privileged actions. Keep the serving endpoint reachable only from the applications that need it, inside your network, never from the open internet. Set per-user rate limits so one account cannot run up load or pull large volumes of output.

What should audit logging for LLM requests capture?

Log every request well enough to answer three questions later: who sent it, what the model received, and what it returned. For each call, record a timestamp, the calling application, the user or service identity, the model version and a request ID. Keep the prompt and the output, or keep a hash and store the full text under tighter controls if the text is too sensitive for a general log.

Logs are also a leak path. Some logging tools show text to everyone with dashboard access, so a prompt full of customer records becomes a second copy of that data. Decide how long logs live, who can read them and how they are deleted. Match those choices to your retention rules, not the defaults of your logging tool.

Record decisions as well as text. Note whether a tool was called, which one, and whether an output was blocked or sent to a person. Without that, you cannot reconstruct how a bad answer reached a customer. The structure of a complete trail is covered in an AI audit trail.

How do you defend against prompt injection on a self-hosted model?

Prompt injection happens when text the model reads, such as an uploaded document, an email or a web page, tells it to ignore its instructions. Self-hosting does not stop this. The model reads an attacker’s text the same way it reads yours. The common leakage paths are a good companion read.

Treat every input as untrusted, including files your own staff upload. Keep tools narrow. The model should only reach the functions a task needs, and code should check the arguments before anything runs. A model that can send email or write to a database is the real risk, more than the text it reads.

Keep instructions and data apart where you can. Put retrieved or uploaded text in clearly marked fields, and never let that text change which tools are available. Check outputs before they trigger an action, and require a person to approve high-stakes steps.

Test with your own material. Build a set of hostile inputs that look like your documents, run it before every release, and track what gets through. No model is injection-proof, so the goal is to limit what a successful injection can do.

How do you protect a model’s weights from theft?

Weights are files, so protect them like files. Store them encrypted at rest, in a location only the serving system can read. Limit read access to a small group and log each access. Keep every copy inside the same controlled environment, never on a laptop or in a shared drive.

Watch for exfiltration. A serving host that can reach the internet can upload a large file quickly. Block outbound traffic from that host except for what it needs, and alert on large transfers. Back up the weights under the same controls as the originals.

Ownership matters here too. In the Own Weights setup, the model runs in your own cloud account or on your premises, and you own the weights, so you decide who gets a copy. Protecting them is still your job.

Fine-tuning adds a second risk. A model trained on sensitive records can repeat parts of them when prompted in the right way. Test for that before release, and leave out records the task does not need. The fine-tuning on sensitive data guide covers what stays in the weights.

If you want a second look at your current setup, the free AI cost audit reads your code for AI calls, models and checks such as API keys sitting in source. You can also book a call to talk through whether self-hosting fits your data rules. For some teams it does not, and we will say so on the call.

Questions

What is self-hosted LLM security?

It is the set of controls around a model you run in your own environment. Those controls decide who can call the model, what gets logged, how injected text is handled and where the weights are stored. Owning the model does not supply any of them on its own.

Is self hosted AI more secure?

It can be, because prompts and weights stay in systems you control. It is not secure by default, though. A vendor API ships with infrastructure controls that a self-hosted model only gets if your team builds them.

How do you handle prompt injection on a self hosted model?

Treat uploaded documents and web text as untrusted input, and keep the model's tools narrow with code checking every argument. Require a person to approve any high-stakes action, and test against hostile inputs that look like your own files before each release.

What should audit logging for LLM requests include?

Each record should show the caller, the model version, the input, the output and any tool calls or blocked responses. Set retention and read access on the logs themselves, because a log full of prompts can leak the same data the model saw.

How do you protect an AI model from theft?

Store the weights encrypted and readable only by the serving system, and log every access. Block outbound traffic from the serving host except what it needs. No copy should sit on a laptop, and that includes backups.