Ollama Local LLMs Run Private — 7B Guide That Delivers
Cloud bills sting and prompts leave your network.
20+ years shipping production ML systems and the infrastructure behind them. Drawn from code that ran under real load.
- ✓A machine with 8GB+ RAM (GPU strongly advised)
- ✓Terminal comfort: curl, environment variables
- ✓Basic idea of what an LLM prompt is
- Ollama is the default local LLM runtime in 2026: ollama pull downloads models, ollama run chats, ollama serve exposes an OpenAI-compatible API on localhost:11434
- Best-coder balance is a 7B model (around 72% on coding benchmarks, ~4.7GB VRAM); 13B suits 16GB machines, 30B-class agentic models need a real GPU
- Performance insight: Qwen3-Coder 7B hits 80 tokens/sec on an RTX 4070 and 150/sec on a 4090, but drops to ~3/sec CPU-only — hardware is the whole ballgame
- Production rule: pin exact model tags and encode temperature plus num_ctx in a versioned Modelfile, or :latest will break your demo overnight
- A Modelfile is a Dockerfile for models: FROM sets the base, PARAMETER tunes sampling, SYSTEM sets behavior, TEMPLATE controls prompting
- Biggest mistake: exposing port 11434 to the network — it is unauthenticated GPU compute, so bind localhost and proxy with auth
Imagine hiring a brilliant assistant who lives in your house instead of across the world. Cloud AI is the assistant across the world: excellent, but every question costs postage and a stranger reads your mail. Ollama moves that assistant into your spare room. You download their brain once (a model file), they answer as fast as your own computer allows, they work when the internet is down, and they never gossip about your documents. The trade-off is closet space: bigger brains need more room (VRAM), so a laptop fits a clever 7-billion-parameter helper while a beefy desktop can house a 30-billion-parameter expert. You pick the biggest brain that fits, write down house rules (a Modelfile), and chat.
| Chrome | Firefox | Safari | Edge |
|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ |
Cloud AI bills add up fast. A team prototyping a support bot can burn hundreds of dollars before knowing if the idea works, and every prompt ships company text to someone else's servers. For regulated or offline work, that's a non-starter.
Local models flip the economics. Download once, run forever, pay nothing per token. Privacy comes free because prompts never leave your machine. You'll notice the difference the first time you work on a plane.
Ollama makes local practical. One CLI pulls from a huge model library, runs chat in the terminal, and serves an API your editor and apps already understand. No backend assembly required.
But local has ceilings. Your GPU decides which models fit, and defaults silently truncate long documents. This guide shows the setup that runs well on real hardware.
Why Local LLMs Win on Cost, Privacy, and Latency
Every cloud token costs money and travel time. Prototyping a RAG pipeline at a few million tokens can cost more than the laptop it runs on, and regulated industries cannot ship prompts off-site at all. Offline work — planes, labs, air-gapped clients — rules cloud out entirely.
Local inference removes all three constraints at once. The model file downloads once, inference costs nothing marginal, prompts stay on disk, and latency is GPU-bound instead of network-bound. A 7B coder answers tab-completions in under a second on a midrange GPU.
The ceiling is hardware honesty: your VRAM picks your model class. That constraint is also a virtue — it forces you to choose deliberately instead of defaulting to the biggest cloud model for every trivial task.
Install Ollama and Run Your First Model in Minutes
Installation is a download plus one command. ollama serve starts the daemon, ollama pull fetches a model, ollama run opens chat, and the same daemon answers API calls on port 11434. Editors like Continue.dev and Cursor connect by pointing their base URL at localhost.
Start with a 7B coder: it balances quality (~72% on coding tasks), size (~4.7GB), and speed on consumer GPUs. Verify the API with curl before wiring up any integration — if curl works, your editor config is the problem, not Ollama.
Pick the Right Model — VRAM Budgets and Benchmarks
Model size is a VRAM budget. A 7B quantized model needs roughly 4.7GB, 13B needs 8.5GB, and 30B-class mixture-of-experts models want a 24GB card. Throughput follows the same curve: 150 tokens/sec on a 4090, 80 on a 4070, 20 on an M3 MacBook, 3 on CPU alone.
Quantization (Q4_K_M is the default sweet spot) shrinks weights 70-85% with minor quality loss. Smaller quants run faster but reason worse — match the quant to the task, not to impatience.
Rule of thumb: run the largest model that fits with 20% VRAM headroom. Headroom is what keeps two-model workflows (chat plus embeddings) from spilling to CPU and crawling.
Modelfiles — Reproducible Personalities in Version Control
A Modelfile is a Dockerfile for models. FROM pins the base (never :latest in production), PARAMETER tunes sampling and context, SYSTEM sets the persona, and TEMPLATE controls the chat markup. ollama create builds it into a named, shareable model.
Temperature is the highest-leverage parameter: 0.1-0.3 for code review and facts, 0.7+ only for brainstorming. num_ctx sets the memory — 8k handles code reviews, 32k handles long docs, and bigger windows cost VRAM whether you fill them or not.
Version your Modelfiles in git next to the app. A code reviewer persona with pinned temperature behaves identically on every teammate's machine, which is the whole point.
Wire Ollama into Editors and Apps
Editors connect over the OpenAI-compatible endpoint, so Continue.dev needs only a base URL change to localhost:11434 and a model name. Tab completions at 80 tokens/sec feel instant; CPU-only at 3/sec feels broken — hardware decides the UX.
Keep context windows small for completions (1-2k) and large for chat review (8-32k). Small contexts answer faster and flicker less; large ones remember the whole file. Set debounce around 500ms so completions stop jumping.
For apps, the Python and JS SDKs accept a host override pointing at localhost. That means RAG prototypes, eval harnesses, and tool-calling agents develop locally for free and deploy against cloud endpoints later with minimal code change.
Ollama vs the Alternatives — Where Local Stops
Ollama is not the only local runtime — LM Studio offers a friendlier GUI, text-generation-webui offers extensions, and LocalAI offers broader API emulation. Ollama wins the terminal-first and server cases with the largest model library and simplest automation.
The honest boundary is frontier quality. Local 30B-class models handle drafting, review, summarization, and agents well; they do not match the largest cloud models on hard reasoning. Use local for volume and privacy, cloud for peak difficulty.
A pragmatic team runs both: local 7B for completions and drafts (free, instant, private), cloud frontier for the 5% of tasks that need it. That split cuts AI spend dramatically without capping capability.
The Demo Day Model Update That Ran at One Token Per Second
ollama run rma:big with no sizing notes, and nobody owned the demo environment.model:latest, which silently advanced from a 7B to a 30B-class release overnight. The laptop's GPU spilled to CPU inference at ~3 tokens/sec. The team had no pinned tag, no VRAM check, and no fallback — the failure mode looked like a hung app rather than an undersized machine.qwen3-coder:7b in a versioned Modelfile with temperature 0.2 and num_ctx 8192, added a hardware check script (ollama ps VRAM gate) to the demo setup, and rehearsed on the exact laptop. The demo ran at ~80 tokens/sec with reproducible answers. Rule going forward: no :latest tags in anything shown to customers.- Pin model tags like dependency versions. :latest is a moving target that can double VRAM needs overnight.
- Rehearse on the exact hardware you will present on. Local AI performance is a hardware benchmark, not a constant.
ollama ps to see loaded models and their memory footprint, then ollama stop <model> on the hog. Fix: standardize on one model per task size and set OLLAMA_MAX_LOADED_MODELS to bound concurrency.ollama show <model> to see num_ctx, then raise it with PARAMETER num_ctx 8192 in the Modelfile. Rebuild and re-test on the same document.curl http://localhost:11434/api/tags — connection refused means serve is down; start it with ollama serve. A 404 on the model name means the tag is wrong; list with ollama list and pin the exact tag.| File | Command / Code | Purpose |
|---|---|---|
| ollama serve & | Install Ollama and Run Your First Model in Minutes | |
| Modelfile | FROM qwen3-coder:7b | Modelfiles |
| config.json | { | Wire Ollama into Editors and Apps |
Key takeaways
Common mistakes to avoid
4 patternsPulling a 70B model onto a 16GB laptop
ollama ps and drop to a smaller quant (Q4_K_M) or model before blaming the tool.Leaving the default context window for long-document work
ollama ps and raise it only when truncation actually appears.Running everything at the default temperature
Exposing port 11434 to the network without authentication
Interview Questions on This Topic
What is Ollama and how does its core workflow operate?
ollama pull downloads quantized GGUF models, ollama run chats with them, and ollama serve exposes an OpenAI-compatible API on localhost:11434. A Modelfile (FROM, PARAMETER, SYSTEM, TEMPLATE) customizes behavior reproducibly. Everything runs on your hardware, so prompts never leave the network and inference costs nothing per token.Frequently Asked Questions
20+ years shipping production ML systems and the infrastructure behind them. Drawn from code that ran under real load.
That's Local Models. Mark it forged?
3 min read · try the examples if you haven't