Running Open-Weight Models Locally

Use Ollama and similar tools to run open models on your own machine for privacy, offline work, experimentation and cheap iteration.

Beginner · about 4 hours · difficulty 2/5

Learn first: Messages APIs and Provider SDKs, The Model Landscape and Choosing a Model

Open-weight models can be downloaded and run anywhere. For development, Ollama (and alternatives such as LM Studio or llama.cpp) makes it a one-command job, and exposes a local API, including an OpenAI-compatible endpoint, so your code barely changes.

Key ideas

  • Parameter count and memory: a model's size determines how much RAM or VRAM it needs. Rule of thumb at 16-bit precision: about 2 bytes per parameter.
  • Quantization: storing weights in 8, 5 or 4 bits shrinks memory needs dramatically with modest quality loss. File formats like GGUF are built for this.
  • Hardware: Apple Silicon, consumer GPUs and even CPUs can run small models; larger ones need serious GPUs.
  • Licenses: open weights are not always open source; check commercial use terms.

When local models make sense

  • Sensitive data that must not leave the machine or network.
  • Offline or edge scenarios.
  • High-volume simple tasks (classification, extraction) where a small model is good enough.
  • Learning how models behave without paying per token.

Limits

Small local models are noticeably weaker at complex reasoning and tool use than frontier models. For production serving at scale you will use a dedicated inference server like vLLM (covered later), not a desktop tool.

Good enough to move on

You can run an open model locally, call it from your code through its API, and compare its quality and speed with a hosted model on a small task.

Key concepts

  • Ollama
  • LM Studio / llama.cpp
  • Model size and memory math
  • Quantization and GGUF
  • OpenAI-compatible local endpoints
  • Open model licenses
  • Hugging Face Hub

Mini project

Run a small open model with Ollama and point your earlier terminal chatbot at it through its compatible API; compare answers, latency and memory usage with a hosted model on 10 prompts.

Check yourself

Roughly how much memory does a 7-billion-parameter model need at 16-bit precision and at 4-bit quantization?

Free resources