Running Models on Your Own PC (Local Inference)

Running AI on your own computer — if you have enough patience and enough RAM.

10 min Intermediate June 22, 2026

You have seen thousands of open-source models on Hugging Face. But a model file sitting on a server is like an unplayed vinyl record — silent until you have a turntable. This article introduces two "turntables" (Ollama and LM Studio), the motor that spins them (llama.cpp), and how to check if your PC has enough power to play the records you want.

By the end, you'll know which tool fits you, what happens under the hood, and which models your machine can handle.

Ollama & LM Studio — Two Tools, One Purpose

Local LLM Inference

AnalogyDefinition
Think of Ollama and LM Studio as two different music players for the same MP3 files. Ollama is like a command-line music player — you type "play song.mp3" and it works perfectly, but you need to know the commands. LM Studio is like a full graphical music player with album art, playlists, and an equalizer you can click. Both play the same music (run the same models), both can stream to other devices (API server), but they serve different user preferences.

Unlike music players which are truly equivalent, LM Studio offers some unique features Ollama lacks (side-by-side model comparison, visual RAM monitoring) and vice versa (Ollama's curated library is simpler to navigate).

Ollama — Terminal Workflow

1
Download model: ollama pull llama3.1:8b
2
Start chat: ollama run llama3.1:8b
3
Type a question and get a response

LM Studio — GUI Workflow

1
Search and download model (GGUF format, Q4_K_M quantization — compresses the model to fit on normal PCs)
2
Configure parameters and set system prompt
3
Ask a question in the chat tab and get a response
Ollama

Terminal-based. One command to download, one to chat. Curated model library. Ideal for developers and terminal users.

LM Studio

Graphical interface. Hugging Face browser, model comparison, visual parameters. Ideal for beginners and visual users.

Same Task — Two Approaches

Task: "Chat with Llama 3.1 8B in German." Ollama: Two commands in the terminal, after that each answer arrives in ~3 seconds on an RTX 3060. LM Studio: Open app, search and download model, set system prompt, chat.

Deep Dive: The OpenAI-Compatible API

Both tools offer a local API server: Ollama starts it automatically on port 11434, LM Studio at the push of a button on a configurable port.

The key feature: the API is compatible with the OpenAI format. Any program, script, or plugin that can talk to ChatGPT also works with your local model — you just change the URL (for Ollama: http://localhost:11434/v1).

Example: API call with curl (Ollama's own interface)

curl http://localhost:11434/api/generate \
  -d '{
    "model": "llama3.1:8b",
    "prompt": "What is DNA?"
  }'

Both tools lower the barrier to local AI from "compile C++ code" to "run one command" or "click a button" — democratizing access to AI.

The Inference Engine — llama.cpp

Inference Engine

AnalogyDefinition
If Ollama and LM Studio are the steering wheel and dashboard of a car, then llama.cpp is the engine under the hood. You turn the steering wheel (type a prompt), the engine does the actual mechanical work (mathematical computation), and the dashboard shows the result (generated text).

A car engine is a single physical component. llama.cpp is software that can leverage different hardware (CPU, GPU, or both) — it is more flexible than a physical engine.

What Happens During a Query?

1
Ollama/LM Studio passes the text to llama.cpp
2
llama.cpp tokenizes the text into numeric tokens
3
Tokens pass through the neural network layers (matrix multiplications)
4
The next token is selected from the computed probabilities
5
Steps 3-4 repeat until the response is complete

llama.cpp was written by Georgi Gerganov in pure C/C++. This means: it runs on virtually any hardware, without Python dependencies. It is the invisible backbone that powers Ollama and LM Studio for most models.

llama.cpp is to local LLMs what the browser is to the web — the universal runtime that made local AI accessible to everyone.

Hardware Requirements — Can Your PC Handle It?

The amount of memory (RAM or VRAM) determines which model sizes you can run locally. Three execution modes exist:

GPU Inference Entire model in the GPU's VRAM. Fastest option: 20-100 tokens/second.
CPU Inference Model in regular RAM. Slower but universal: 5-15 tokens/second.
Hybrid Mode Model split between VRAM and RAM (GPU Offloading). Compromise between speed and model size.

Think of your computer's memory as a workbench. A small model (7B) is like a compact toolbox that fits on any desk. A medium model (13B) needs a proper workshop table. A huge model (70B) needs an industrial workbench that most homes don't have.

At a real workbench, it makes little difference whether a tool lies on the table or on the shelf. In computing, the speed difference between VRAM and RAM access is enormous (10-100x), making placement critically important.

Model Size Rules of Thumb

~4 GB
7B Model (Q4) Fits on almost any modern PC (~4-5 GB RAM)
~8 GB
13B Model (Q4) Needs a decent workstation (~8 GB RAM)
~40 GB
70B Model (Q4) Needs a high-end workstation (~40 GB RAM)

Three Hardware Scenarios

Laptop (16 GB RAM, no GPU)

Llama 3.1 8B Q4: ~5 GB in RAM, CPU inference, ~8 tokens/sec. Usable for chatting, with noticeable delay.

Gaming PC (RTX 3060, 12 GB VRAM)

Same model fits entirely in VRAM, GPU inference, ~40 tokens/sec. Text flows instantly.

Workstation (RTX 4090, 24 GB VRAM)

Llama 3.1 70B Q4: ~40 GB needed, Hybrid mode (24 GB in VRAM + ~16 GB in RAM), ~2-4 tokens/sec. Large model, usable but sluggish.

Deep Dive: Tokens Per Second

Tokens per second (tok/s) is the unit for generation speed. Human reading speed is about 4 tokens per second.

Generation feels fluid above ~10 tok/s. Below 5 tok/s, delays become noticeable. GPU inference typically achieves 20-100 tok/s, CPU inference 5-15 tok/s.

Interactive: does the model fit your computer?

Now you can try the rules of thumb from above yourself. Pick a model size and a quantization. The calculator shows the memory needed and estimates for laptop, gaming PC and workstation whether the model runs smoothly, stutters or does not fit at all.

Warning: Three Common Myths

"Local models are as good as ChatGPT"

No. Local open-source models are getting better, but on a home PC they usually don't reach the quality of large cloud models like ChatGPT or Claude. They are good enough for many tasks, but not for all.

"You need an expensive graphics card"

No. CPU inference works with any modern PC. It's slower but perfectly usable. A 7B model runs on a laptop with 16 GB RAM.

"All local models are equally good"

No. Quality varies greatly depending on training method, data volume, and model architecture. A well-trained 7B model can be better than a poorly trained 13B model.

Summary

  • Ollama (terminal) and LM Studio (GUI) are two paths to the same goal: running language models locally. Both offer an OpenAI-compatible API.
  • Beneath both tools works an inference engine (usually llama.cpp) that loads weights, processes tokens, and generates responses.
  • 7B Q4 needs ~4 GB (any PC), 13B Q4 needs ~8 GB, 70B Q4 needs ~40 GB. GPU is fast (20-100 tok/s), CPU is slower but universal (5-15 tok/s).

Quiz: Local Inference

Question 1 / 6
Not completed

Which tool provides a graphical model browser with Hugging Face integration and visual model comparison?

Select one answer
Answer Key: 1) C · 2) B · 3) B · 4) B · 5) B · 6) B

Understanding Check

  • What is the difference between Ollama and LM Studio — and when would you choose which tool?
  • What does an inference engine (llama.cpp) do and why do you never interact with it directly?
  • How do you determine whether a specific model can run on your hardware?