News / Learn / Local & open models
How do you run an LLM on your own computer?
You'll be able to run a language model on your own machine and send it a prompt from code.
In plain English
A language model is a large file of numbers, called weights. A program reads the weights and predicts the next token of text, one token at a time. Running a model locally means your own computer does this work instead of a remote service. You need a runtime program to load the weights and a way to send text in and read text out.
Why it matters
Local models keep data on your machine, work without a network connection, and avoid per-request fees from a hosted API. They also let you test ideas quickly and control exactly which model version you use. The tradeoff is that you manage the hardware, the setup, and the speed yourself.
How it works
A model file holds weights, which are the learned values that define how the model behaves. Open weights are weights that the publisher lets you download and run. Many of these models are distributed in formats such as GGUF, which packs the weights and metadata into one file that a runtime can load.
A runtime is the program that does inference, meaning it turns your input into output using the weights. Common runtimes expose a local HTTP server or a library call. Your code sends a prompt, the runtime processes the tokens, and it returns generated text. Speed depends mostly on memory and processor capacity, since the whole model must fit in memory.
The context window limits how much text the model can read and write in one request, counted in tokens. Your prompt and the response must fit together inside it. Temperature controls how random the output is. A low value gives more predictable answers, and a high value gives more varied ones.
A model that is too large for your hardware will either fail to load or run very slowly. Smaller models and quantized versions reduce memory use at some cost in quality. You pick the model that fits your task and your machine.
A concrete example
This example sends a prompt to a local model server that speaks the common chat format used by many runtimes. Assume the server is already running on port 8080.
import requests
URL = "http://localhost:8080/v1/chat/completions"
payload = {
"model": "local-model",
"messages": [
{"role": "system", "content": "You answer in one short sentence."},
{"role": "user", "content": "What is a token?"},
],
"temperature": 0.2,
"max_tokens": 100,
}
response = requests.post(URL, json=payload, timeout=120)
response.raise_for_status()
reply = response.json()["choices"][0]["message"]["content"]
print(reply)A short sketch to show the idea. Check the official docs of the tool you use.
What goes wrong
- Picking a model too big for your memory Check the file size and your available memory before downloading. Start with a small model and move up only if speed and quality are acceptable.
- Assuming local means private by default Confirm that your runtime and tools do not send data elsewhere. Check network settings and logs, and review any plugins you add.
- Ignoring the context window Count tokens in long prompts. If the total exceeds the window, the runtime may truncate input or fail. Shorten the input or split the work.
- Trusting one answer without testing Run the same prompts several times and check outputs against known answers. Small models make more mistakes, so verify results before relying on them.
Going deeper
Learn how quantization reduces memory use, how model file formats are structured, and how to measure latency and throughput on your hardware. Then study how to serve a local model to other users safely.
FAQ
Do I need a GPU to run a model locally?
No. Many models run on a processor alone, but they are slower. A graphics card with enough memory usually speeds up inference a lot. The right choice depends on the model size you want.
Is a local model as good as a hosted one?
Not always. Smaller local models often trail large hosted models on hard tasks. They can still be good enough for focused jobs such as classification, summarizing, or extraction.
What is the difference between open weights and open source?
Open weights means you can download and run the trained numbers. Open source usually also covers the code and training data. Many models release weights without releasing everything else.
Why is my first response so slow?
The runtime often loads the full model into memory on the first request. Later requests are usually faster while the model stays loaded.
Can I use a local model in my product?
Yes, if the model license allows your use. Read the license terms for commercial use, redistribution, and attribution before you ship.
Written with AI by CapyLaunch. Spotted a mistake? Email hello@capylaunch.com.