Est.

Guide

Self-Hosted LLM: How to Run One So Your Prompts Never Leave Your Network

Running an open-weight model on servers you control takes the model vendor out of the loop. Whether your prompts actually stay private then depends on how you build and configure everything around it.

Private AI Review guide · Last reviewed

What a self-hosted LLM protects, and what it doesn't

A self-hosted LLM is an open-weight language model that you download and run on hardware you operate, in your own building or your own cloud account, instead of sending prompts to a vendor's API. No model provider receives your prompts, keeps them, or can use them for training, because none is involved.

That removes one party from the list of who can read your data. It does not remove the rest: your own administrators, the provider of any rented hardware underneath, and every log, database and add-on that touches a prompt on its way in or out. A self-hosted model with a chat interface that phones home, or an inference server whose logs ship to a third-party monitoring service, can leak as much as a hosted one. The sections below go through each part of the stack and what to check in it.

If you are still deciding between self-hosting and the other ways to run a model privately, start with Private LLM: the five ways to run one.

The parts of a self-hosted LLM stack

Most self-hosted setups are built from the same five layers. The open-source projects named are common choices, not a ranking; each layer is also where a different privacy question comes up.

Self-hosted LLM stack: layers, common options and the privacy question for each
LayerCommon open-source optionsPrivacy question to ask
Model weightsOpen-weight families such as Llama, Mistral, Qwen, Gemma and OpenAI's gpt-ossDoes the license allow your use, and can you verify the files you downloaded are the ones published?
Inference serverOllama, llama.cpp (llama-server), vLLM, SGLangWhich address does it listen on, does it require authentication, what does it log, and does it send usage statistics?
Chat interfaceOpen WebUI, LibreChat, AnythingLLMWhere is chat history stored, who can read it, and which features (web search, plug-ins) send text to outside services?
Retrieval over your documents (RAG)Vector databases such as Qdrant, Chroma or Postgres with pgvectorEmbeddings and stored chunks are your documents in another form: who can query them, and can you delete from them?
Gateway or proxyLiteLLM, or a reverse proxy such as nginxAre full request and response bodies logged, and where do those logs go?

Where to run it

Self-hosted covers several places a server can sit. Each changes who else is in a position to read prompts.

Where a self-hosted LLM can run, and who else could reach prompts
Where it runsWho else could reach promptsWhat to check
Your own hardware, on your premisesYour own staff with access to the machinesPhysical access, disk encryption, and who holds admin accounts
Your hardware in a colocation facilityYour staff, and facility staff with physical accessThe colocation contract and physical security terms
A GPU instance in your own cloud accountYour staff; the cloud provider at the infrastructure levelThe provider's data processing terms and your account's access controls
A confidential VM with GPU confidential computingYour staff; the cloud provider is excluded by hardware memory encryption if attestation checks outWhether you actually verify attestation before sending data

Choosing between them

Renting GPUs in a cloud account is the quickest way to start, and for most teams the provider's infrastructure-level access is acceptable under its data processing terms. Where it is not, for instance when a client or regulator needs assurance that no outside operator could read prompts, confidential computing closes that gap: see NVIDIA H100 confidential computing mode and how TEE attestation lets users verify no operator can read their prompts.

For the strictest settings, the server has no route to the internet at all. Air-gapped AI inference for classified and sensitive government environments covers getting models, updates and patches across the gap.

How much memory a self-hosted model needs

The first constraint is memory: the model's weights have to fit in GPU memory (or system memory, for CPU and Apple silicon setups), with room left over. A rough way to estimate the weights is the parameter count times the bytes stored per parameter: about 2 bytes at 16-bit precision, 1 byte at 8-bit and about half a byte at 4-bit quantization.

By that arithmetic, an 8-billion-parameter model needs roughly 16 GB for its weights at 16-bit and roughly 4 to 5 GB at 4-bit; a 70-billion-parameter model needs roughly 140 GB at 16-bit and around 35 to 40 GB at 4-bit. On top of the weights, the server needs memory for the context of each conversation (the KV cache), which grows with longer prompts and with more people using the model at once.

Quantization lets a larger model fit on smaller hardware, at some cost in output quality that varies by model and task, so test it on your own work before settling on one. For current GPU memory sizes and prices, check the vendor's specification sheets and your cloud provider's instance list rather than a summary, since both change often.

Choosing an inference server

  • One machine, one person or a small team: Ollama is the simplest to install and manage models with. Our walkthrough of configuring local LLM inference with Ollama covers its network and model settings.
  • CPUs, Apple silicon or mixed hardware: llama.cpp runs quantized models without a dedicated GPU and includes a small HTTP server, llama-server. Expect slower answers on CPU than on a GPU.
  • Many concurrent users on data-centre GPUs: vLLM and SGLang are built for serving many requests at once and expose OpenAI-compatible APIs, so existing tools can point at them instead of a vendor.
  • Whichever you choose, check its current documentation for the hardware and models it supports; these projects move quickly.

Settings that keep prompts from leaking out

Self-hosting only keeps prompts private if nothing in the stack sends them elsewhere. These are the places to check before anyone puts sensitive data in.

  • Network exposure: Ollama listens only on 127.0.0.1 (port 11434) by default, and its API does not require authentication. If you set OLLAMA_HOST to expose it to other machines, put it behind a proxy that checks who is calling, and never open it to the internet.
  • Hosted features in local tools: Ollama also offers cloud models whose inference runs on Ollama's servers, not yours. If everything must stay on your hardware, use only local models and follow Ollama's documentation on disabling cloud features.
  • Usage statistics: vLLM collects anonymous usage data about hardware and configuration by default (not prompts). Turn it off with VLLM_NO_USAGE_STATS=1 or DO_NOT_TRACK=1, as its usage stats documentation explains, and check every other component for similar settings.
  • Prompt logging: inference servers, gateways and observability tools can record full prompts and responses. Decide what is logged, where those logs are stored and for how long, and keep them out of third-party monitoring services.
  • Outbound traffic: after the model is downloaded, block the inference host from reaching the internet. For tools built on Hugging Face libraries, HF_HUB_OFFLINE=1 stops them trying to fetch files at runtime.
  • Chat history: the chat interface's database holds every conversation. Encrypt it, restrict who can read it, and set a retention period. Turn off web search, plug-ins and connectors you have not reviewed.
  • Model files: download weights from the publisher's official page and verify checksums or signatures where offered. See supply chain integrity for AI model artifacts with SLSA.
  • Access and deletion: put the model behind your single sign-on, give each user their own account, and make sure you can delete a person's data from chat history and vector indexes. See how to prove you deleted a user from a vector database.

When self-hosting is the wrong choice

Self-hosting trades a vendor's promise for your own work: buying or renting hardware, keeping the software patched, watching for security issues and evaluating new models. If no one on your team can own that, a misconfigured self-hosted server can be less private than a well-chosen managed service.

It also limits you to open-weight models. Whether those are good enough depends on the task; matching ChatGPT capability without exposing your prompts looks at that trade-off. If you need a larger model than you can run, confidential computing services and managed endpoints are compared in the private LLM guide.

Frequently asked questions

Is a self-hosted LLM automatically private?

No. It keeps prompts away from a model vendor, but your own logs, chat history, add-ons and network settings can still expose them. It is private once every part of the stack is configured to keep data inside your network.

Is self-hosting an LLM free?

Many inference servers and chat interfaces are open source, and open-weight models can be downloaded at no charge. The costs are the hardware or cloud GPUs, the electricity, and the staff time to run it. Each model also has its own license terms, so check what yours allows before using it commercially.

Do I need a GPU to self-host an LLM?

Not for small models. llama.cpp and Ollama can run quantized models on a CPU or on Apple silicon, though answers come more slowly. Serving larger models, or many users at once, generally needs one or more GPUs with enough memory for the model.

What is the difference between a self-hosted LLM and a local LLM?

A local LLM usually means a model running on your own laptop or desktop for one person. A self-hosted LLM runs on servers your organization controls and is often shared by a team. Both keep the model vendor out; a shared server adds access control, logging and retention decisions that a personal machine doesn't need. For a single machine, see the local LLM guide.

Read next