Running AI Models Locally
Downloading a model and running it on a personal computer trades convenience for privacy, control and fixed costs. This guide explains the memory math, the hardware, the software and what to expect.
Why run a model locally
Most people meet large language models through web services, where the model runs in a provider's data center and every prompt travels over the internet. Running a model locally means downloading its weights and performing inference on hardware the user controls: a laptop, a desktop with a graphics card or a server in a homelab. This became practical for individuals in 2023, when openly released models and efficient inference software appeared within months of each other. Local operation is a form of self-hosting, and it brings the familiar trade-offs of that practice: more control and privacy in exchange for more responsibility. The motivations are usually some combination of the following.
- Privacy: prompts and documents never leave the machine, which matters for confidential, medical or legal material.
- Cost: once the hardware is paid for, there is no per-token or subscription charge.
- Control: a downloaded model does not change or disappear when a provider updates its service.
- Offline use: a local model works without a network connection.
- Learning: running models directly shows how they work in ways a chat interface hides.
Open-weight models and their licenses
Local use depends on open-weight models, whose trained parameters, the model weights, are published for download. Meta's Llama family brought this into the mainstream in 2023, and many developers have since released weights, including Mistral AI, Google and Alibaba. Hugging Face hosts a large share of these files, together with model cards describing training, intended use and limitations. Models are usually described by parameter count, such as 7 billion or 70 billion, and by whether they are base models or instruction-tuned for conversation.
Open weights are not the same as open source. Many popular models ship under custom licenses that restrict certain uses or set conditions for very large commercial users, and most do not publish the full training data and code needed to reproduce them. Others use standard permissive licenses such as Apache 2.0. The Open Source Initiative published an Open Source AI Definition in 2024 that sets out what a fully open model would need to share. Before building anything on a model, read its license and acceptable use policy as carefully as the terms of any other dependency.
The memory arithmetic
The main constraint on running a model is memory. Each parameter is stored as a number, and at 16-bit precision it takes two bytes, so a 7-billion-parameter model needs roughly 14 gigabytes just to hold its weights, and a 70-billion-parameter model around 140. Inference also needs working memory for the key-value cache, which stores intermediate results for every token in the context and grows as conversations get longer. If a model does not fit in fast memory, it either fails to load or runs very slowly while data is shuffled from slower storage.
Quantization is the standard answer. It stores weights at lower precision, commonly 8, 5 or 4 bits per parameter, cutting memory needs by a factor of two to four. A 4-bit version of a 7-billion-parameter model fits in around 4 to 5 gigabytes. The cost is some loss of accuracy, usually slight at 8 bits and noticeable but often acceptable at 4 bits, though it varies by model and task. More aggressive quantization, below about 3 bits, tends to degrade output quality more sharply, especially for smaller models. Quantized files are widely distributed in the GGUF format used by llama.cpp.
Hardware: GPUs, unified memory and NPUs
Generating text is limited less by raw arithmetic than by memory bandwidth, because producing each token requires reading through a large part of the model's weights. That is why a graphics processing unit with its own high-bandwidth video memory is the usual choice. NVIDIA cards dominate because most AI software is optimized first for its CUDA platform, although many tools also support AMD and Intel GPUs. The practical limit is video memory: a card with 12 gigabytes can comfortably run quantized models of roughly 7 to 14 billion parameters, while larger models need 24 gigabytes or more, or several cards.
Other designs change the arithmetic. Apple Silicon Macs use unified memory shared between the CPU and GPU, so a machine with a large memory configuration can load models that would not fit on a typical consumer graphics card, at moderate speed. A neural processing unit, built into many phone and laptop chips, runs small models efficiently at low power, though software support for NPUs is less mature than for GPUs. Ordinary CPUs can run small quantized models too, slowly but usably, which makes them a reasonable place to start experimenting.
The software stack
llama.cpp, started by Georgi Gerganov in 2023, is an open-source inference engine written in C and C++ that made it practical to run large language models on ordinary computers, including machines without a dedicated GPU. It supports quantized models and many operating systems and hardware backends. It also includes a server that exposes a web API. A large part of the local AI ecosystem builds on it directly or indirectly.
Ollama wraps local inference in a simple command-line tool that downloads models by name, manages them and serves them through a local API, which other applications can call much as they would call a cloud service. Graphical applications offer similar functions with chat windows and model browsers. Beyond text, OpenAI's Whisper speech recognition models and Stable Diffusion image models can also run locally, the latter with a GPU strongly recommended.
Adding private documents with retrieval
A local model knows only what was in its training data. To answer questions about personal notes, a company handbook or a research archive, the usual approach is retrieval-augmented generation. Documents are split into chunks, and an embedding model converts each chunk into a vector, a list of numbers that places similar meanings near each other. Those vectors are stored in a vector database. When a question arrives, it is embedded the same way, the closest chunks are retrieved and they are inserted into the prompt so that the model can answer from them.
Every part of this pipeline can run on one machine. Small embedding models run comfortably on a CPU, and open-source stores such as Chroma keep the index in local files. Quality depends heavily on unglamorous details: how documents are chunked, whether retrieval finds the right passages and whether the prompt asks the model to cite them. Retrieval reduces hallucination but does not remove it, and documents containing hidden instructions can attempt prompt injection, so retrieved content should be treated as untrusted input.
Realistic expectations
The best open-weight releases have narrowed the gap with commercial services on many tasks. Still, the models most people can run on a single consumer machine are much smaller than the largest systems offered online, and they are typically weaker at complex reasoning, long documents and specialized knowledge. Generation speed depends on hardware and model size, and a large model on modest hardware can be too slow for interactive use. Electricity, heat and fan noise are real costs of sustained use.
Running a model locally also shifts security responsibility to the operator. Download weights from the original publisher or a well-known repository, and prefer formats such as safetensors or GGUF, which store data, over older formats that can execute code when loaded. Keep inference software updated, and do not expose a local model server to the internet without authentication. Good first projects are modest: a private drafting assistant, a speech-to-text tool for meeting notes or a question-answering system over a folder of personal documents.
Key takeaways
- Running a model locally keeps prompts and documents on hardware the user controls, trading convenience for privacy, control and fixed costs.
- Open weights are not automatically open source; each model's license defines what is permitted.
- Memory is the main constraint, and quantization to 8 or 4 bits lets mid-sized models fit consumer hardware at a modest cost in quality.
- Tools such as llama.cpp and Ollama, combined with a local vector database, can provide private question answering over personal documents.
- Local models are typically smaller and weaker than the largest hosted systems, so modest, well-defined projects work best.
Further reading in the atlas
Neural network trained on very large amounts of text to predict the next token, able to generate language and perform many tasks from prompts.
Further training of a pretrained model on a smaller, task-specific dataset so that it adapts its behavior to a particular domain, style or task.
Neural network design that splits a model into many expert subnetworks and routes each input to only a few of them, raising capacity at lower cost.
NVIDIA
American semiconductor company that designs graphics processors and the AI accelerators and software on which most deep learning runs.
PyTorch
Open-source machine learning framework combining GPU-accelerated tensors with automatic differentiation, widely used for deep learning research.
Hugging Face Transformers
Open-source Python library from Hugging Face that provides a common interface for loading, running and fine-tuning thousands of pretrained models.
Semantic Search
Search technique that matches queries to content by meaning and intent rather than by exact keywords, often using embeddings and language models.
Model Context Protocol
Open protocol, introduced by Anthropic in 2024, that standardizes how AI applications connect language models to external tools and data sources.
French artificial intelligence company, founded in Paris in 2023, that develops both open-weight and commercial large language models.
EleutherAI
Nonprofit research institute that grew out of an online volunteer collective and builds open datasets, language models and evaluation tools.
More guides
All guidesWhat AI is and is not, how systems learn from data, how large language models are trained and run, where they fail and why their safety is debated.
Much of the world's computing runs on software anyone may use, study, change and share. Its licenses, governance and funding determine how that shared resource survives.
Announcements, benchmarks, demos and forecasts about AI vary from careful measurement to marketing. A set of practical questions helps separate evidence from hype in either direction.