Why Your Local AI Model Keeps Failing (And How to Fix It)

Why Your Local AI Model Keeps Failing (And How to Fix It)

Most people install a local AI model, connect it to something like Claude Code, ask it to do one small thing, and watch it fail. It forgets instructions halfway through. So they walk away with the same conclusion: local models are just dumb. But a lot of the time, the model isn't the problem.

Here's what's actually going on. Ollama, one of the most popular apps for running local models, has documentation that says on a machine with less than 24 gigs of VRAM, the default context is only 4,000 tokens. That same page says agents and coding tools should get at least 64,000. That's a gap of 16 times.

Let me quickly explain those two words. A token is the small chunk AI cuts text into. For now, just think of it as a word or a piece of a word. Context is everything the AI can see at one time: what you asked for, the files it read, and the conversation so far. It all has to fit in there, and whatever doesn't fit gets pushed out, starting from the oldest stuff.

Agent tools put a big block of their own instructions in there before you type anything. One community measurement found that just saying hi inside an agent tool used about 5,000 tokens. Heavier tools like Claude Code have been measured at around 30,000. So with only 4,000 tokens of room, you're out of space before the work starts.

Your local AI might not be dumb. It might just be set up wrong.

The One Rule for Knowing What Your Computer Can Run

To know if a model will run on your computer, you need one rule plus one trap that only Macs have.

Start with the name. You'll see names online like Qwen 3.8 27B. That 27B means the model has 27 billion parameters. Parameters are what the model learned, stored as a huge pile of numbers. More parameters usually means smarter, and it always means a bigger file.

The raw model file is huge, so people compress it. That's called quantization. Think of it like compressing a photo. You store each number a little more roughly, the file gets way smaller, and it still looks about the same. The most common version today is 4-bit.

Here's the rule: a 4-bit model needs about 0.6 gigs of memory for every billion parameters. It checks out against real files on HuggingFace. Qwen 3.5 9B is about 5.7 gigs. Qwen 3.8 27B is about 16.5. Qwen 3.6 35B is about 22. The copies you get through Ollama are often a bit bigger, so check the actual download page.

But that's only the model itself. Context takes memory too. The model just fitting isn't enough. You have to leave extra room for it to work.

The Mac Trap Nobody Warns You About

On a Mac, memory is shared between the main chip and the graphics chip. That's a big advantage for running AI. But people in the community keep finding that by default, Mac OS only lets the graphics chip use around three quarters of it. On smaller Macs, it can be even less.

So a 16 gig Mac really has about 12 gigs for a model at best. A 32 gig Mac has about 24. The docs for MLX, Apple's machine learning framework, do show a command to raise that limit, but it resets when you restart. If you're just starting out, plan around three quarters.

What Each Memory Size Actually Gets You

Let's go up one memory size at a time. At each one, I'll tell you what you can run, how fast it goes, and what it's good for. All the speed numbers come from people in the community, not from me. The same machine can change a lot with different software, so treat these as rough numbers.

Speed is measured in tokens per second. Here's the scale people usually use: under five is pretty much unusable. Around 10 is about the speed you read at. 20 to 30 feels smooth. 60 and up starts to feel like using a cloud model.

8 to 16 Gigs: Small Models for Simple Work

This is most laptops and entry-level Macs. Here you're running small models. Google's Gemma 4 E4B is about 5 gigs. Qwen 3.5 9B is about 5.7 on HuggingFace. Ollama lists both at 6.6.

OpenAI's open model GPT-OSS 20B is also here, and OpenAI says it runs on 16 gigs of memory. But remember the trap. That file is about 12 gigs, or 14 through Ollama. A 16 gig Mac only has about 12 to give. There's basically no room left for your conversation. On a 16 gig Mac, the two smaller models are the comfortable choice.

At this level, speed usually isn't the problem because small models run fast. The problem is how smart they are. They're great for rewriting text, translating, summarizing an article, or turning messy data into a table. But ask one to work as an agent planning several steps and using tools on its own, and it makes mistakes easily.

24 to 32 Gigs: The Sweet Spot

This is what the community calls the sweet spot. This is where models start being really useful. The most popular one is Qwen 3.8 27B with more than 8 million downloads on HuggingFace in the last month. The other two are Google's Gemma 4 26B and Qwen 3.6 35B.

On speed, people testing a 32 gig M6 Mac Mini report Qwen 27B at around eight or nine tokens per second, which is about reading speed. Switch to Gemma 4 26B on that same kind of machine, and reports go from 33 up to about 50. Several times faster. I'll explain why in a bit.

But 24 and 32 gigs are very different. A 24 gig Mac gives the model about 18 gigs. Qwen 27B just barely fits, and you're left with almost no room for the conversation. If you want this to feel comfortable, 32 gigs is the safer starting point.

At this level, you can ask questions about your own private documents, hand it a whole batch of data to sort, and even connect a coding agent for small, clearly defined jobs.

64 Gigs: Same Model, Longer Memory

A lot of people think doubling your memory gets you a much better model. But when people in the community ranked the best model you can run at each size, the winner at 64 gigs was the same as at 32. It was still Qwen 27B.

The next big step up is Qwen 3.8 Flash Next. Even its smallest build is over 66 gigs. That doesn't fit on a 64 gig Mac.

So what do you do with the extra room? Two things. First, you use the 8-bit version, which is compressed less, about 29 gigs, and closer to the original quality. Second, you open up a really long context. Ollama's docs say that with 48 gigs of VRAM or more, the default jumps to 256,000 tokens.

What 64 gigs really buys you is the same model reading longer documents and running longer agent jobs without forgetting what it was doing.

128 Gigs: Where the Model Finally Changes

This is where the model finally changes. OpenAI's GPT-OSS 12B is about 63 gigs. Then there's Qwen 3.8 Flash Next. It's sold as 125 billion parameters, and Qwen calls it an experimental preview of the design behind Qwen 4.

These models aren't slow. Community tests on a 128 gig M5 Max report around 60 to 70 tokens per second for GPT-OSS 12B and up to about 70 for Flash Next, though other runs land closer to 40. That's still way faster than the 32 gig machine running 27B.

Again, you can't use all 128. People report Mac OS giving AI about 96 to 107 gigs by default. The common view is that this level gets you roughly what the best cloud models could do a year ago.

Above that, you've got 256 and 512 gigs, the top of the Mac Studio line. You can run even bigger models, but when people compare public benchmark scores, each step up only gets you a little smarter, and you're still behind the best cloud models. That extra money buys you very little unless your data can never leave the building or a lot of people are sharing one machine.

Why Some Bigger Models Run Faster

You probably noticed something weird. On the 32 gig machine, the 26B Gemma ran several times faster than the 27B Qwen. And on 128 gigs, a huge model ran faster than 27B. The reason is a design called MoE, which stands for mixture of experts.

Here's why models are slow in the first place. Every time AI writes one token, it has to read the model's parameters out of memory. How much your memory can move per second is called bandwidth. The bigger the model, the more it moves for every word, and the slower it gets.

A normal model is called a dense model, and every parameter gets used for every single word. An MoE model is split into a lot of small groups of experts, and for each word it only calls on a few of them.

Take Qwen 3.6 35B A3B. That A3B at the end means it only uses about 3 billion parameters at a time. Less to move, so it runs way faster. One community test on the same M4 Pro computer had the dense 27B at 14.7 tokens per second and the 35B at 78.8. The slightly bigger model ran about five times faster.

But here's a mistake you'll see online. Faster doesn't save memory. All the experts have to sit in memory waiting. So the 35B still takes about 22 gigs.

Remember this one line: whether it fits depends on the whole model, and how fast it runs depends on the few experts it calls.

A lot of people also report that dense models are steadier on long agent jobs while MoE models sometimes slip up. It comes down to whether your work needs fast or steady.

The Software Matters More Than You Think

A model is just a file. You need an app to actually run it. There are three that beginners run into most.

LM Studio has a full interface, kind of like an app store for models. You search, download, and chat all in one place, and it shows you which models fit your machine. On a Mac, pick the MLX version. MLX is Apple's own framework, and it's usually faster on a Mac.

Ollama mostly runs in the background so other apps can connect to it. It's the easiest way to hook up agent tools like Claude Code.

Llama.cpp is the engine running underneath a lot of other software. Both Ollama and LM Studio have used it. It has the most options, but you type everything as commands. It's for people who want to tweak things.

Why does this matter so much? Someone in the community took the same 32 gig M6 Mac Mini and the same Qwen 27B, changed only the software and the file format, and went from about 8 tokens per second to about 21. That's almost three times faster with no new hardware.

When it feels slow, don't rush out to buy a new computer. Try different software first. Update to the latest version. And on a Mac, make sure you're running MLX.

What People Have Actually Gotten Working

I'm only covering examples people in the community say they've really done.

Asking questions about private documents. Contracts, medical records, client files. A lot of people aren't comfortable uploading that stuff to the cloud. Locally, you can give the model a whole stack of documents and ask questions, even with your internet off.

Big repetitive jobs you leave running overnight. One person gave a local model 40 sample invoices to read one by one and put into a spreadsheet. All 40 came out correct. A job like that doesn't need the smartest model. It just needs someone who doesn't mind doing it.

Sorting out your own finances. Someone used a 32 gig M6 Mac Mini with Gemma 4 26B and had a local coding agent write a small program that sorted their bank transactions, added up spending in each category, and built a dashboard with charts. That bank data never left the machine.

Organizing a video library. Someone ran a vision model of about 6 gigs on an M4 Mac Mini and had it write descriptions for thousands of video clips, running for more than 16 hours. Now that whole library can be searched with plain text.

The cloud model plans, the local model does the work. This is the most useful idea of all. The cloud model is smarter, so it figures out what to do and breaks it into steps. The local model handles all the reading and the repetitive small jobs.

Big companies are heading the same way. In October, Microsoft said GitHub Copilot will route work between cloud models and local models on your machine. In September, Perplexity launched hybrid compute on Mac, where the cloud handles reasoning and search, and a local model handles your private files.

What Local Models Are Bad At

Let's be honest about what it's bad at so you don't waste a weekend.

Being a coding agent on a big project. One person reported running Qwen 27B on an M5 Pro laptop and asking it to find a bug across a whole project. It ran for more than 3 minutes with the fans at full speed and hadn't written one line of code. The reason is prompt reading speed. Before a model writes anything, it has to read everything you gave it, and a whole project is easily tens of thousands of tokens. On a lot of machines, that takes a long time.

Using a tiny 9B model as an agent. Someone asked a 9B agent to build a dashboard for their home server. It marked healthy services as offline and the buttons on the page didn't work. A cloud model got it right the first time.

Going below 4-bit. To squeeze onto smaller computers, some versions get compressed to 3-bit or 2-bit. A lot of people find that the first thing to break is tool calling, which is the format an agent uses to tell other programs what to do. Plain chat might be okay, but for agents, stay at 4-bit or above.

The Five Traps That Catch Most Beginners

Most of the time when people say local AI is dumb or slow, it's one of these.

Trap 1: Context that's too short. On machines with under 24 gigs of VRAM, Ollama defaults to 4,000 tokens. If you're connecting an agent, open the settings and drag the context slider up to at least 64,000. Raising it uses more memory, which is why you left that extra room.

Trap 2: A missing chat template. Every model expects its messages in a certain format. That's called the chat template. Think of it as the way of talking the model understands. Some re-uploaded versions online don't carry that format over, so the software quietly falls back to a generic one, and the model gets noticeably dumber. The fix is to download the official version or a popular, well-read one. If something feels off, try a different version.

Trap 3: A compressed KV cache. The KV cache is the model's notes on the conversation so far. A lot of guides tell you to compress it to save space. But Level One Text replayed a real agent session of about 100,000 tokens and tested exactly that. At 8-bit, the tool calls went wrong and then eventually recovered. At 4-bit, they broke and never recovered. That was one test on big Nvidia hardware, and docs say 8-bit usually has no noticeable impact. But if you're running agents, leave this setting alone to start.

Trap 4: Checking that it fits, but not that it works. People report forcing a lightly compressed 27B onto a 16 gig graphics card. The memory fills up and the whole computer locks up. Once it fits, you still need room for context, and you need to live with the reading and writing speed.

Trap 5: Thinking local automatically means safe. Keeping your data at home is more private for sure. But security company SentinelOne and Censys scanned the internet for 293 days and found 17,518 different Ollama servers open to the public with no password, so anyone could use them. Nearly half had tool calling turned on.

Ollama only listens to your own computer by default. Those servers were mostly changed to listen to the whole internet. A model file can't run by itself, but if you give an agent tools, it can touch your files. Forget where the model runs. What matters is what it can touch.

A Security Checklist You Can Finish in One Afternoon

One, keep Ollama listening only to your own computer. If you need to reach it from outside your house, use a private network like Tailscale.

Two, update Ollama and LM Studio to the latest version. Ollama has patched real security bugs.

Three, for any model you give tools to, only use files from the official source or a well-known one.

Four, keep passwords and keys out of the folder your agent works in.

Five, if you turn on the LM Studio local server, go into the server settings and turn on the option that requires a token.

When Should You Actually Upgrade?

If you're on 16 gigs and want to run agents every day with a 27B size model, going to 32 is an upgrade you'll feel. If you're on 32 and always reading long documents or running long agent jobs, that's when 64 makes sense. If you want models over 100 billion parameters, you need 128.

Outside of those cases, fix your software and settings first. Your current machine probably has a lot more in it than you're using.

Key Takeaways

  • A 4-bit model needs about 0.6 gigs per billion parameters, plus room for context. The model fitting isn't enough.
  • On a Mac, plan around three quarters of your memory. A 16 gig Mac really has about 12 gigs for a model.
  • 32 gigs is the sweet spot. 64 gets you the same model with longer context. 128 is where models over 100 billion parameters start.
  • Whether a model fits depends on the whole model. How fast it runs depends on the few experts it calls in an MoE design.
  • Software matters enormously. The same model on the same machine can go from 8 to 21 tokens per second just by changing software and file format.
  • The cloud model plans, the local model does the private repetitive work. That's the pattern big companies are already adopting.
  • Keep Ollama listening only to your own computer and keep passwords out of your agent's folder.

Most people blame the model when local AI fails. But the model is often fine. The context is too short, the chat template is missing, the software is the wrong one, or the settings were never touched. Fix those first. Your current machine probably has a lot more in it than you're using.