An illustrated beginner’s course on local AI: what is inside a model file, why memory size and memory speed decide everything, how quantization shrinks a model, and a five-step setup with LM Studio and a harness called Pi.
Reading map
- Where models run — why ChatGPT and Claude cannot be downloaded, what open weight models are, and what is actually inside a model file.
- Memory — why the whole model must sit in fast memory, and how your conversation (the context) takes memory too.
- Speed — memory bandwidth, a simple formula for top speed, and what different machines offer.
- Shrinking models — quantization, what it costs in quality, and why small models loop.
- Formats and apps — GGUF versus MLX, engines, and LM Studio.
- The harness — the software around a model that makes it useful, and two ways to get one.
- Set it up — five steps from checking memory to your first web search.
Where Models Run

When you use ChatGPT or Claude, the model runs on a computer in a data center. Your messages travel there and back over the internet. You cannot download those models: the companies keep them on their own servers.

Other companies release their models for anyone to download. These are called open weight models. The names you will see most are Qwen, DeepSeek and Kimi from China, Llama from Meta and Gemma from Google. They are now very good, but still about three to six months behind the best closed models, and the best of them are enormous: Kimi K 3.1 Pro is a download of about 1.56 terabytes, bigger than the drive in most laptops. Which models you can run therefore comes down to your computer.
Running a model locally has three upsides: it is free once downloaded, it works without the internet, and nothing you type leaves your machine. The price is that a local model will not be as smart as the newest Claude or ChatGPT, and how close you get depends on your hardware.
What Is Inside a Model File

A model file is a huge set of numbers called weights. One number alone means nothing; together they hold everything the model learned in training, where it is shown a massive amount of text and has to guess the next word. Each wrong guess nudges the numbers a tiny bit. Meta says Llama 3.1 was trained on about 15 trillion tokens, and a token is a piece of text roughly three quarters of a word long.

When you type a message, the app turns your words into numbers, runs them through all the weights and gets one guess: the next token. It adds that token to the text and runs the whole thing again. That is how a model writes a full answer, one small piece at a time.
The name tells you the size. In “Llama 3.1 8B“, the B means billion, so the model has 8 billion weights. The copy used in this course is a 4.9 GB file.
Memory: The Model and the Conversation

After you download it, the file just sits on your SSD doing nothing. To use it, the computer loads the whole file into memory, the fast working space for whatever is running right now. It has to, because writing each token means maths with nearly all 8 billion weights, and an SSD is far too slow to keep feeding them.
- On a PC with a graphics card, the model goes into the card’s own memory, called VRAM.
- On a Mac, it goes into unified memory, one pool shared by the processor and the graphics chip.
Your computer needs some memory for itself. On a 16 GB Mac mini, the system keeps about 4 GB, leaving 12 GB for the model and the conversation. If the model does not fit, it either runs very slowly or does not load at all.

Memory also holds your conversation: everything you typed, everything the model wrote, pasted documents and tool results. All of that is the context, and the bigger it gets, the more memory it takes. For Llama 3.1 8B, each token of context costs about 128 kilobytes, so a chat of 32,000 tokens (roughly 24,000 words) needs about 4 GB on top of the model.
Every model has a context limit, and your app sets its own, often lower. In LM Studio you choose it when you load a model. When a chat goes past the limit, the app cuts something, usually the oldest part, so the model forgets how the conversation began. In short, memory always holds two things: the weights and the context, and you need room for both.
Speed: Memory Size and Memory Bandwidth

How well a computer runs a model comes down to two numbers: how much memory it has, and how fast that memory is. The amount decides which model fits at all. The speed decides how fast it writes, because for every token the model has to read through almost the whole file in memory.
Picture the weights as a crowd that must cross a city for every token. Slow memory is everyone walking, faster memory is a bus and the fastest is a bullet train. That speed is called memory bandwidth, measured in gigabytes per second.
| Machine | Memory | Bandwidth | Price (as stated) |
|---|---|---|---|
| Base Mac mini (M6) | 16 GB | 153 GB/s | about $900 |
| Top Mac Studio (M5 Ultra) | up to 512 GB | about 1,200 GB/s | from about $22,000 |
| NVIDIA DGX Spark | 128 GB | 273 GB/s | about $7,000 |
| Gaming RTX 5090 | 32 GB | about 1,800 GB/s | n/a |
The trade-off never goes away: the gaming card has the fastest memory but the least of it, while the Mac Studio and the DGX Spark give you far more memory at lower speed.

You can estimate the top writing speed by dividing bandwidth by model size. On the 16 GB Mac mini with Llama 3.1 8B that is 153 / 4.9, about 31 tokens per second. Real speed comes in a bit under that, and a file twice as big writes about half as fast.
Reading speed is different. The model reads your whole message in one go, so it depends more on the chip’s raw compute power. It matters when you paste a long document, because the model reads all of it before the first word of the answer appears.
Shrinking Models: Quantization

Llama 3.1 8B has 8 billion weights, each stored with 16 bits (2 bytes), so Meta’s original file is about 16 GB. Yet the copy you download is only 4.9 GB, because it has been shrunk. Shrinking a model is called quantization: each weight keeps less detail, for example 0.48 instead of 0.4837261. Do that for all 8 billion weights and the file gets much smaller. The original is “16-bit”, the small copy is “4-bit”: same model, same 8 billion weights, less detail in each one.
The easiest picture is a compressed photo. Side by side the two look the same, and only when you zoom in do you see the finer detail that was lost.

Most of the time a shrunk model feels just as smart, but the lost detail shows in certain jobs. One study found that 8-bit copies lost almost nothing and 4-bit copies lost a few percent on average, with a worst case of about 59% on a test with very long documents (a 4-bit copy of a bigger Llama model). Another study gave 4-bit copies of small Llama models hard maths problems and found about 11% lost on average. With code, one wrong character breaks the whole program, so small errors cost more.
Even so, 4-bit is a good place to start: it fits most computers and holds up well for everyday chat. LM Studio’s own guide says the same: pick 4-bit or higher if your machine can handle it. With memory to spare, the 8-bit copy of Llama 3.1 8B is about 8.5 GB and keeps more detail.
Why small models loop
A small model has far fewer weights, so it knows less, and shrinking costs a bit more. You notice it when a task needs several steps in a row, such as searching the web, reading a result and deciding what to do next. When a step fails, a big model usually notices and tries something different; a small one often tries the exact same thing again and again.
One study measured this on tasks where a step like a web search returned an error: a Qwen 3 8B model, about the size of Llama 3.1 8B, finished only about 20% of them, while Claude Sonnet 4 finished more than half. In one reported case, a small model on a 16 GB Mac mini repeated the same web search until the chat broke. And once a long task passes the context limit, the model forgets the steps it already took. Small local models are useful, but a lot less forgiving.
Formats, Engines and Apps

The first choice when you download a model is the file format. The two you will see most:
- GGUF, used by a program called llama.cpp, runs on almost anything: Windows and Linux PCs, NVIDIA and AMD graphics cards, and Macs.
- MLX is Apple’s own software for running AI on its chips, so in apps like LM Studio MLX files only run on Macs with Apple Silicon (the M series).
For Llama 3.1 8B, the 4-bit GGUF is 4.9 GB and the 4-bit MLX version is about 4.5 GB. Labels like “Q4_K_M” on GGUF files just mean about 4 bits per weight. On Windows or Linux, pick GGUF. On an M-series Mac, pick MLX because it is built for Apple’s chips; if there is no MLX version of the model you want, GGUF runs on a Mac as well.
The file is only the weights, so you also need an engine to do the maths: llama.cpp for GGUF, MLX itself for MLX. Most people never use the engines directly. They use an app that has them built in. A good choice is LM Studio, which is free:
- a search page to find and download models;
- a list of everything you have downloaded, where you load, swap or delete models;
- a chat window to test them in;
- a local server mode, so other apps on your computer can use the model (this is how you connect a harness later).
The file is the model, the engine is what runs it, and the app is the thing you click.
The Harness

With Claude or ChatGPT, many things just work: web search, controlling your computer, calendars, saved skills, scheduled tasks. None of that is the model. A model only reads text and writes text. Everything else lives in the software around it, called the harness.
When the model wants a web search, it writes a short message asking for one. The harness runs the search and hands the result back. The model reads it and decides what to do next, and the harness keeps looping until the job is done. A skill works the same way: it is a folder of instructions the harness loads into context when the model needs it.
With Claude, Anthropic built the harness for you. With a downloaded model you choose it yourself, and the same model can feel useless in a bare chat window and properly capable with a good harness. So if a local model disappoints you, change the harness before you blame the model.

There are two options in the course:
- LM Studio’s chat window. A simple harness that looks like ChatGPT. You can attach PDFs and Word files: short ones go to the model whole, long ones get the relevant parts picked out. Nothing to set up, but it can only talk about your files, not work on them.
- Pi (pi.dev). A free, open source “minimal agent harness” that runs in a terminal. Pi can read and edit files, run commands, load skills and connect to tools, while LM Studio keeps running the model in the background. It starts small and you can ask it to build new tools for itself. One warning: Pi does not ask before every action, so start it inside a folder you are happy for it to change.
Set It Up in Five Steps

Expect it to take about five minutes plus the download.
Step 1: check your memory. On a Mac, open the Apple menu and choose About This Mac. On Windows, open Task Manager, go to Performance, click GPU and read “dedicated GPU memory” (your VRAM).
Step 2: pick the biggest model that fits. The rule of thumb is to keep the model file to about half of your memory. On a 16 GB Mac, a file up to about 8 GB leaves room for the operating system and your conversation. Llama 3.1 8B at 4.9 GB fits easily, which makes it a good first model.
| Memory | Model that fits | Download |
|---|---|---|
| 16 GB | Llama 3.1 8B | 4.9 GB |
| 32 GB | GPT OSS 20B | 14 GB |
| 128 GB (DGX Spark class) | GPT OSS 120B | 65 GB |
| 512 GB (top Mac Studio) | Llama 3.1 405B | 243 GB |
Step 3: download. Install LM Studio from lmstudio.ai (not the other app, Bionic, advertised on its homepage). Search for “Llama 3.1 8B”. On a Mac pick the 4-bit MLX version; on a PC pick the GGUF labelled Q4_K_M. LM Studio scans your hardware: a check mark means the file fits, crossed out means it is too big. Either way it is a download of about 5 GB.
Step 4: your first chat. Load the model and set the context length to about 8,000 tokens, which adds only about 1 GB. Paste in a long email or document and ask for a summary. The wait before the first word is the reading speed; the pace of the words after it is the writing speed.
Step 5: add a harness. Install Pi with the one-line command on pi.dev. In LM Studio, turn on developer mode and start the local server, with the context at around 16,000 tokens (about 2 GB for this model). Open a folder in a code editor such as Cursor, open its terminal, type pi, and tell Pi to use the model LM Studio is serving. The Pi docs show the exact lines, or you can paste them into Pi and ask it to set itself up.
A good first tool is web search. One option is the Brave Search API, which gives roughly $5 of credit a month (about 1,000 searches); it asks for a credit card to stop abuse but does not charge it. Copy your API key and ask Pi to add Brave web search to itself. Remember that the search goes out over the internet, so that part is no longer offline. If Llama 3.1 8B struggles, give it one small step at a time, or move up to a bigger model.
When something goes wrong
- The model will not load, or your computer slows right down: pick a smaller file or lower the context length. The two together have run out of memory.
- Words come out too slowly: a smaller file writes faster, because there is less to read for every token.
- The model repeats itself: start a fresh chat and give it a smaller job. A long conversation and a step that keeps failing are the two usual reasons a small model loses track.
Other Options and One Last Sizing Rule
LM Studio is the easy start, but not the only choice. Ollama is another popular free app, and you can run llama.cpp yourself from the command line. One reported Mac Studio setup also uses oMLX, a free, open source app for Apple Silicon that runs MLX files. It saves the model’s memory of your conversation to the SSD, so long agent chats do not have to be re-read each time; its team says this cuts the wait before the first word from over 30 seconds to under five, and for some models it is faster than LM Studio. It can also read models you have already downloaded in LM Studio.
A simple sizing rule: at 4 bits, a model takes about half a gigabyte for every billion weights, plus room for your conversation. An 8-billion model is about 5 GB, which suits a 16 GB Mac; a 27-billion model is about 16 GB and needs something like a 32 GB Mac. Start small in LM Studio, then move up once you know what your computer can handle.
Final Perspective
A model is a big file of weights that loads into your memory together with your conversation. How much memory you have decides what fits; how fast that memory is decides how fast the model writes. Shrinking (quantization) is how a bigger model fits onto a smaller machine. With that knowledge you pick a model that fits, run it in an app like LM Studio, and plug it into a harness like Pi with tools such as web search. It will not match the newest Claude or ChatGPT, but it is free, it is private and it runs right there on your own desk.

Quick Reference
| Question | Short answer |
|---|---|
| What is inside a model file? | Billions of numbers called weights |
| What does the 8B in a name mean? | 8 billion weights |
| What does memory hold? | The weights and the context |
| What decides which model fits? | Amount of memory (VRAM or unified memory) |
| What decides writing speed? | Memory bandwidth; top speed is about bandwidth / file size |
| What is quantization? | Storing each weight with less detail (16-bit to 4-bit) |
| Which format? | GGUF on Windows/Linux/Mac; MLX on Apple Silicon Macs |
| Rule of thumb for size | File about half of your memory |
| What is a harness? | The software around the model: search, files, loops, skills |
| First setup | LM Studio + Llama 3.1 8B (4-bit) + Pi + Brave Search |
Further Reading and Notes
- Tools mentioned: LM Studio (lmstudio.ai), Pi (pi.dev), Brave Search API (brave.com/search/api), Ollama (ollama.com), llama.cpp (github.com/ggml-org/llama.cpp), oMLX (github.com/jundot/omlx).
- Prices, speeds and study results are as reported in November 2026; they are not independent benchmarks. Diagrams are original.
Prices, speeds and benchmark figures are as reported in November 2026 (some from published studies); hardware prices and model names change quickly, so check current values before you buy or download anything.
