How to Run LLMs Locally in 2026: Step-by-Step Guide for Beginners

By LLM Hardware team · Methodology ·

Runners and the first fit check

Three local runners
Ollama, LM Studio, llama.cpp
First check
VRAM calculator, then a Q4 GGUF that fits
Checked
2026-10-13
Author
LLM Hardware team

Last checked 2026-10-13, LLM Hardware team. This site neither stores nor shows Amazon prices.

To run LLMs locally you need one app and enough memory to hold the model file plus its context. For most people that means Ollama or LM Studio and a GPU with at least 8 GB, which is enough for Qwen3 8B, a 5.2 GB download.

Why run LLMs locally?

A local model keeps prompts on your machine and has no per-query bill. Once the file is downloaded, LM Studio's docs say it can operate entirely offline, and Ollama only listens on 127.0.0.1 unless you change it. You also choose the context length, the quant and how much of the model goes on the GPU.

Privacy

LM Studio's offline page says nothing you enter into chats leaves your device. Ollama binds to 127.0.0.1 port 11434 by default, so other machines cannot reach it unless you set OLLAMA_HOST.

No per-query cost

There is no API bill or rate limit. The running cost is electricity: NVIDIA lists 115 W of total graphics power for an RTX 4060, and Apple measures a Mac mini M6 at 70 W maximum.

Works offline

Chatting, document chat and the local server work without internet in LM Studio. Model search, downloads and update checks need a connection.

Your settings

Set the context window with OLLAMA_CONTEXT_LENGTH, shrink the KV cache with OLLAMA_KV_CACHE_TYPE, or pick GPU offload per model in LM Studio.

What hardware do you need?

The number that matters most is VRAM (GPU memory), or unified memory on Apple Silicon. It sets the largest model you can run and the quant you can afford. On an NVIDIA card, nvidia-smi -q shows it under FB Memory Usage.

Use the VRAM calculator to check exactly what fits your hardware. If you are deciding what to buy, see the budget hardware guide.

Choose your software

Ollama

Easiest start from a terminal

One install command, model downloads by name, and a REST API on port 11434 with OpenAI-style routes under /v1. It needs Windows 10 22H2 or newer, or macOS 14 Sonoma or newer, and on Linux it installs from a script. Its README lists llama.cpp as the supported backend.

https://ollama.com

LM Studio

Desktop app, no terminal needed

A desktop app with a Discover tab for downloading models from Hugging Face, a Chat tab and a local server you start with a toggle. It runs llama.cpp everywhere and MLX on Apple Silicon. It needs an Apple Silicon Mac on macOS 14.0 or newer, or an x64 CPU with AVX2.

https://lmstudio.ai

llama.cpp

Most control, most flags

The open source engine that LM Studio, Jan and Ollama use for GGUF models, under the MIT license. You drive it with command-line flags for GPU layers, context size and KV cache type. It suits unusual hardware, servers and people who want to build from source.

https://github.com/ggml-org/llama.cpp

Step by step: run your first model with Ollama

  1. 1.

    Install Ollama

    Download the app from ollama.com for macOS or Windows. On Windows it installs into your home folder, with the program in %LOCALAPPDATA%\Programs\Ollama. On Linux or macOS from a terminal, run:

    curl -fsSL https://ollama.com/install.sh | sh

    The Windows PowerShell equivalent is irm https://ollama.com/install.ps1 | iex. On Linux, start the server with ollama serve if it is not already running. The full Linux walkthrough, with NVIDIA, AMD and Vulkan paths and a systemd service, is in how to run LLMs on Linux.

  2. 2.

    Download and run a model

    Open your terminal and run one command. Ollama downloads the model the first time and starts a chat session:

    ollama run qwen3:4b

    This pulls Qwen3 4B, a 2.5 GB download, small enough for almost any machine. Other tags worth trying: ollama run qwen3:8b (5.2 GB, for an 8 GB GPU), ollama run deepseek-r1:7b (4.7 GB, a reasoning model), ollama run gemma3:4b (3.4 GB, Google Gemma 3).

  3. 3.

    Start chatting

    Type your prompt and press Enter. The model answers in the terminal. Type /bye to leave. The file stays in Ollama's models folder, so the next run skips the download; ollama ls lists what you have and ollama rm deletes a model.

  4. 4.

    (Optional) Add a chat UI

    Ollama serves an API at http://localhost:11434, with OpenAI-compatible routes under /v1. Open WebUI is one browser front end for it. Its README gives this Docker command, after which the UI is at http://localhost:3000:

    docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main

Worked example: Qwen3 8B on an 8 GB RTX 4060

The RTX 4060 has 8 GB of GDDR6, per NVIDIA. Ollama's qwen3:8b tag is a 5.2 GB download, close to the 5.03 GB Q4_K_M file in Qwen's own GGUF repo. The model has 8.2B parameters, 36 layers and 8 key/value heads of 128 dimensions, all from Qwen's model card and config.json.

That last line sets the context cost. Each token of f16 KV cache holds 2 × 36 × 8 × 128 × 2 = 147,456 bytes. Ollama gives cards under 24 GiB a 4K default context, so the cache is 4,096 × 147,456 bytes, about 0.60 GB. Weights plus cache come to about 5.8 GB, which fits 8 GB with room for the runtime. The site formula, which pads for overhead, says 6.8 GB.

Now raise the window to 32,768 tokens with OLLAMA_CONTEXT_LENGTH=32768 ollama serve. The cache grows to 4.83 GB and the total to about 10 GB. That no longer fits, and Ollama moves part of the model to the CPU. Run ollama ps: a healthy load says 100% GPU, while a split shows something like 48%/52% CPU/GPU. A 16K window (about 2.4 GB of cache) is the practical ceiling on this card. Setting OLLAMA_KV_CACHE_TYPE=q8_0, which needs Flash Attention, roughly halves the cache.

The downloaded files live in ~/.ollama/models on macOS, /usr/share/ollama/.ollama/models on Linux and C:\Users\%username%\.ollama\models on Windows. Set OLLAMA_MODELS to move them to a bigger drive.

The same model in LM Studio or llama.cpp

In LM Studio, install the app, open the Discover tab and search for a model such as Qwen3 8B. LM Studio's docs advise a 4-bit option or higher if the machine can handle it. Then open the Chat tab, open the model loader, select the download and optionally set load parameters such as context length and GPU offload. The Start server toggle exposes the same model to other apps; the docs' examples use port 1234.

llama.cpp now has its own installer. On macOS or Linux run curl -LsSf https://llama.app/install.sh | sh, and on Windows irm https://llama.app/install.ps1 | iex. Its README then downloads and runs a model straight from Hugging Face with llama cli -hf ggml-org/Qwen3.5-0.8B-GGUF, or serves it with llama serve -hf and the same repo name.

Building from source takes two commands, cmake -B build and cmake --build build --config Release. Add -DGGML_CUDA=ON to the first for an NVIDIA GPU or -DGGML_VULKAN=ON for Vulkan. On macOS, Metal is on by default. llama-server listens on 127.0.0.1 port 9931 unless you pass --host and --port.

Hardware tierHardware examplesStarter modelNotes
CPU only or 4 to 6 GB VRAM Integrated graphics, older GPUs, CPU qwen3:4b (2.5 GB) / phi4-mini (2.5 GB) / gemma3:4b (3.4 GB) Ollama download sizes. Small enough for a CPU-only machine.
8 GB VRAM RTX 4060 llama3.1:8b (4.9 GB) / deepseek-r1:8b (5.2 GB) / qwen3:8b (5.2 GB) 8B Q4 is 6.8 GB by the site formula. Keep the context near Ollama's 4K default.
12 GB VRAM RTX 4070, RTX 5070, Arc B580 qwen3:14b (9.3 GB) / deepseek-r1:14b (9.0 GB) 14B Q4 is 10.4 GB by the site formula, so little room is left for context.
16 GB VRAM (NVIDIA) RTX 4060 Ti 16GB, RTX 5060 Ti, RTX 4070 Ti Super Qwen3 14B Q4_K_M / Qwen3 8B Q8_0 14B Q4 (10.4 GB) and 8B Q8 (11.6 GB) fit with room for context. 14B Q8 (18.8 GB) and 8B FP16 (21.2 GB) do not.
16 GB unified (Apple) Mac mini M6 16GB, Mac mini M4 16GB qwen3:8b / llama3.1:8b About 12 GB usable after the 4 GB macOS reserve. 8B Q4 (6.8 GB) fits; 8B Q8 (11.6 GB) is tight.
24 GB VRAM / unified RTX 3090, RTX 4090, Mac mini M6 24GB qwen3:32b (20 GB) / deepseek-r1:32b (20 GB) / gemma3:27b (17 GB) 32B Q4 is 21.2 GB and fits a 24 GB GPU. A 24 GB Mac has about 20 GB usable after the 4 GB macOS reserve, so 32B Q4 does not fit there and 27B Q4 (18.2 GB) is tight.

Sizes in brackets are Ollama library download sizes, read on 22 November 2026; run any of them with ollama run <model>. See How much VRAM do I need for a full VRAM breakdown.

Common mistakes to avoid

Downloading a model that is too large for your VRAM

Check the size first. A 13B model at Q4 needs about 9.8 GB by the site formula. On an 8 GB card part of it moves to the CPU and ollama ps shows a CPU/GPU split instead of 100% GPU. Use the VRAM calculator before downloading.

Raising the context without counting the cache

The KV cache grows with every token in the window. Qwen3 8B needs about 0.60 GB at 4K and 4.83 GB at 32K, so a model that loads fine at the default can spill to the CPU after you set OLLAMA_CONTEXT_LENGTH higher.

Running an old GPU driver

Ollama needs an NVIDIA GPU with compute capability 5.0 or newer and driver 550 or newer, and cards from 5.0 to 6.2 need driver 570. Its Windows page asks for driver 551.61 or newer. AMD cards need a ROCm v7 driver stack, or Vulkan as a fallback.

Expecting GPU speed on an Intel Mac or a CPU-only PC

Ollama runs on the CPU only on Intel Macs, and LM Studio and Jan do not support Intel Macs at all. CPU inference works but is slow, and this site does not measure its speed. For interactive use, use a GPU or Apple Silicon.

Downloading full-precision weights when a GGUF quant exists

Qwen3 8B at 16-bit precision is about 16.4 GB of weights (8.2B × 2 bytes). The Q4_K_M GGUF is 5.03 GB and the Q8_0 is 8.71 GB. LM Studio's docs advise a 4-bit option or higher, so start at Q4_K_M and move up only if memory allows.

Frequently asked questions

Do I need a GPU to run LLMs locally?

No, but a GPU makes a large difference. Ollama and llama.cpp both run on the CPU alone. A GPU that holds the whole model is much faster: Ollama's qwen3:8b is a 5.2 GB download and fits an 8 GB RTX 4060 at Ollama's default 4K context. This site does not measure speed. On a CPU-only machine, start with a small model such as qwen3:4b, a 2.5 GB download.

What is the minimum VRAM to run an LLM locally?

Small models fit in 4 GB: Ollama's qwen3:1.7b is a 1.4 GB download and qwen3:4b is 2.5 GB, and LM Studio recommends at least 4 GB of dedicated VRAM on Windows. An 8 GB card such as the RTX 4060 runs 7B and 8B models at Q4; an 8B is about 6.8 GB by the site formula. A 12 GB card such as the RTX 4070 or RTX 5070 fits a 14B at Q4, and the Qwen3 14B Q4_K_M file is 9 GB.

Can I run LLMs locally on CPU only?

Yes. llama.cpp and Ollama both support CPU-only inference, and ollama ps reports 100% CPU when nothing is on the GPU. Speed is much lower than on a GPU that holds the model, and this site does not measure CPU speed. Apple Silicon Macs are a special case: Ollama uses their GPU through Metal, while on Intel Macs it runs on the CPU only. For RAM tiers and how to confirm the model is running on the CPU, see the guide to running an LLM on CPU.

Ollama vs LM Studio

Which tool should you use?

What can I run?

VRAM tier reference

Best LLMs locally

Model picks by VRAM tier

Qwen3 guide

Qwen3 8B to 32B hardware needs

Gemma 3 guide

Google 1B to 27B model guide

Phi-4 guide

Microsoft Phi-4 14B memory and setup

Run DeepSeek R1 locally

Step-by-step DeepSeek R1 Ollama setup

Run Qwen3 locally

Qwen3 setup with thinking mode and MoE explained

Run Llama 3 locally

Meta Llama 3.1 8B and 3.3 70B with Ollama

Run Mistral locally

Mistral 7B, Nemo 12B and Small 22B setup

Run Gemma 3 locally

Google Gemma 3 (1B to 27B): 27B at Q4 is 18.2 GB, so it needs a 24 GB GPU, not 16 GB

Run Phi-4 locally

Microsoft Phi-4 14B: 10.4 GB at Q4 by the site formula

Llama 3.1 hardware requirements

Meta's Llama 3.1 8B, 70B and 405B: how much memory each size needs and which GPU or Mac fits it

Local AI coding assistant

VS Code, Continue.dev and Ollama as a local coding assistant

Open WebUI setup

A browser chat UI in front of Ollama

VRAM calculator

Any model, any quantization

LLMs on Windows

Ollama and LM Studio on Windows with NVIDIA, AMD or Intel Arc

LLMs on Mac

Ollama on Apple Silicon with Metal GPU support

Ollama commands cheat sheet

Ollama CLI commands: run, pull, ls, ps, the API and environment variables.

llama.cpp guide

Direct GGUF inference without Ollama, with full GPU layer control.

Ready to pick hardware? Browse all hardware, use the VRAM Calculator, or read the budget hardware guide.

Sources & methodology

In-memory sizes marked as formula estimates use the site formula on the methodology page. Commands, file sizes and requirements come from these primary sources, read on 22 November 2026:

Spotted a number that conflicts with its linked source? Contact us and we will revise the guide.