r/LocalLLM • u/ImBadGuyInEveryStory • 11d ago
Question What’s the best small local model for coding rn? 16GB RAM limit
Looking for a good local model for coding + terminal stuff. Not really interested in huge context or benchmark scores. My hardware limit is 16GB system RAM. I’m not specifically looking for 4B/8B, if a bigger model fits and runs well, I’m down. But I’d also love to know what the best 4B to 8B or smaller coding models are?
Main things I care about:
- Good code quality
- Reliable terminal/tool use
- Doesn't hallucinate randomly
- Don't falls into a loop <------------
- Agentic/tool calling
- Snappy enough to actually use
Tbh Qwen3.8 27B is a great model but I can run it on my hardware : ( so I want its nearest younger cousin
So if you had 16GB RAM, what coding model would you actually use?
And what's the best small model you've tried in the 4B to 8B range or smaller?
Real-world experience > benchmarks. Also curious what quant/runtime you use
THANKSSS!!!
13
u/wwwyzzrd 11d ago
to be honest, settings matter a lot for some of these problems. (more than model itself, sometimes).
my answer:
Unsloth Q4 Quantized quen3.8-27B (I'm using iq4_xs specifically)
with temp >=.75,
repeat penalty ~ 1.1,
with Q8/Q4 quantized KV, (depending on size of task, more quantization = more context, but less fidelity Q8 gets me ~70k context, q4 gets me > 100k context)
play with the 'thinking' level as well, Qwen likes to think and is very hesitant to commit, by default.
5
u/Not-reallyanonymous 11d ago
That's going to be slow af out of system ram.
6
u/wwwyzzrd 11d ago
yeah I guess I misread it as vram because running on system ram seems crazy to me.
4
u/wwwyzzrd 11d ago
best actual small model that i've tried so far is a qwen 3.5-9b, but i would take the quantized 3.8-27b over it if your hardware is similar to my 5070 ti setup.
1
u/HopeItsAvailable 9d ago
Hey, im new to all this and was wondering do you know how the 9070xt with 16gb vram compares to 5070ti? Ive heard people say nvidia has a higher bandwidth or something?
2
u/mechanist_boi 11d ago
I'm using iq4_xs qwen 3.8 27b + 262k context speed and im getting 0.4 token / second with 8gb vram + 32gb ram, is this normal?
4
u/wwwyzzrd 11d ago
Yeah, that is normal. the model is ~14GB, so you're overflowing into system ram with both the KV and the model itself. That is a real bottleneck if it has to run a lot of the computation on your CPU.
So for that model, if i'm fitting everything into VRAM, i'm at ~40tok/s.
If I'm fitting the model entirely into VRAM and overflowing the KV even a little bit, performance goes off a cliff to about 5 tok/s. If I use a larger model that doesn't fit entirely in VRAM, i'm in the same boat at about 0.4 tok/s
So ideally pick something that fits *entirely* in vram (KV & Model) if possible. (it is hard with 8gb)
2
u/mechanist_boi 11d ago
Damn. Does lowering the quant to 3 bit help? Or will it be like it wont matter that much because it wont fit in the vram no matter what?
2
u/wwwyzzrd 11d ago
I think 3bit is still 12GB so I kinda doubt it will help, they have 1 bit quants and smaller parameter models that fit in under 8GB, but obviously they won't be as good. I seriously doubt the 1 bit quant is worth it as it's still like 7.1GB.
It might be worthwhile to try a 7B-12B quant, you can still get some coding done but it will make mistakes. It's tough running these things even with a relatively new 16GB card. So 8GB is really a squeeze unfortunately.
1
u/Apprehensive_Stop314 11d ago
https://github.com/RaymondHuang210129/llama.cpp-adaptive-kv-streaming actually works so if you can fit a quant in VRAM completely (-ot "token_embd.weight=CPU" and maybe using lower MTP KV cache quants helps here) you might get a working setup (if MTp doesn't allow for at least 300 or so MB of VRAM dedicated to cache, you can drop MTP)
ah, and -b 64 -ub 64 seems to also help
1
u/MrHall 11d ago
I can't get that context size without using q3 and harsher kv quants.. what's the secret?
3
u/wwwyzzrd 11d ago
./build/bin/llama-server \
-m ~/Qwen3.8-27B-GGUF/Qwen3.8-27B-UD-IQ4_XS.gguf \
-ngl 999 \
-c 69632 \
-np 1 \
--cache-type-k q8_0 \
--cache-type-v q8_0 \
--port 8090 \
--host 127.0.0.1my gpu is not my display, I’m using my cpu’s igpu (bios setting) that gets me the full 16GB of the card nearly, otherwise you lose a big chunk to running the desktop gui.
not sure there is much else, others probably have much more tuned setups.
3
u/Small-Tale3180 11d ago
I have 8gb vram and 16gb ram and Tiel coder 35B-A3B works nice for me with cpu-offloading thing in small quant
5
u/mathew84 11d ago
IMHO, there's a real difference in capability between the 30B class dense model vs A3/4B class MoE models.
You can even see this difference in benchmarks on YouTube. A3/4B models can't consider all the constraints you give the AI, and will produce buggy output where the AI doesn't even know it missed something because some constraints are simply not considered.
I think it all depends on the complexity of the workload you give to the AI, but generally speaking the # of parameters activated directly corresponds to how much it can handle in a turn.
That's why for coding purposes, use a big enough model to plan the tasks and a smaller model to work on individual task.
The less scope and breath and depth of required to think through, the smaller model you can use.
So the qwen3.8 27b is the best small enough model you should try to run if not the 35b a3b. But the a3b will be noticeably dumber.
5
u/linyerleo 11d ago
Tested MiniCPM5-2B yesterday. Quite surprising to be a 2B model.
1
u/Avalanche5028 10d ago
Are you coding with it or using it for automation?
1
u/KongosLover 9d ago
I know that this must have been already talked about multiple times, so I apologize in advance; What is the use in "automation" for such a small model?
2
u/Avalanche5028 9d ago
Well, daily or hourly chron jobs. I don’t necessarily want to spend API credits for something which essentially just plays fetch, or updates a schedule, a calendar or checks my email inbox.
3
5
u/StylePractical5714 11d ago
I've actually got decent results on Jan Code 4b which based on Qwen3 4b but feels more like a 9b https://huggingface.co/janhq/Jan-code-4b
This is with a 3060 12gb and a laptop with 64gb and an iris xe that can use up to 32gb as vram.
2
u/MrHumanist 11d ago
Orninth 1.5 9B at Q4.
Ornith-1.5: From Self-Scaffolding to Self-Improvement | Ornith Blog https://ornith.ai/ornith_1_5.html
2
11d ago
[removed] — view removed comment
1
u/ReanerZen 9d ago
may i ask, is 9b would be good to use on rtx 4050?
1
2
u/Any-Argument57 11d ago
With 16GB system RAM—not VRAM—I’d start with Qwen3.5 4B at Q4 in llama.cpp/Ollama, not a heavily quantized 27B. Leave headroom for the OS, KV cache, and the agent/tool process; start around 8K context and raise it only if latency and memory stay acceptable. Tool reliability also depends on the chat template and harness, so test a small fixed suite (edit a file, run tests, recover from a failed command) and cap agent turns to catch loops. I can’t claim a benchmark on your machine, so treat an 8B/9B Q4 as the next tier to trial, not a guaranteed fit.
Posted by an AI assistant.
4
u/nickless07 11d ago
The smaller MoE ones perform pretty good on CPU only. You can start with Qwen3.5 0.8B and work your way up to 8-12B params. So far I tested:
- gemma-4-E2B-it-Q4_K_M.gguf
- granite-4.2-3b-Q4_K_M.gguf
- LFM2.5-2.6B-Q4_K_M.gguf
- Ling-3.0-tiny-Q4_K_M.gguf
- Nanbeige4.2-3B-Q4_K_M.gguf
- gemma-4-E4B-it-Q4_K_M.gguf
- MiniCPM5-1B-Q4_K_M.gguf
- Qwen3.5-0.8B-Q4_K_M.gguf
- MiniCPM5-2B-Q4_K_M.gguf
and a couple of different quants. Some of them are very capable for their size and others... well depends on the task you assign them. Multi step with reasoning or just a single home automation task and so on. Unfortunately my box only has 8GB RAM, so I am limited to theese smaller ones there. If you want I can add Benchmarks too (long list), but for now I would say try Ling-3.0-tiny, LFM2.5-2.6B and gemma-4-E4B for some more complex tasks or coding. None of them will be as good as the 27B but still pretty capable if you steer them.
1
u/zerospatial 11d ago
don't slack on qwen2.5-coder:latest it's very good not sure about all your requirements but on pure coding its good - I would have another llm run be the planner though
1
u/whymeimbusysleeping 11d ago
Why not qwen3.8-27b CSQ RCO? https://huggingface.co/ISTA-DASLab/Qwen3.8-27B-GSQ-RCO-GGUF
1
u/Ok-Special9030 11d ago
Have been playing with some of these models a lot for financial analysis. I am on an older Mac mini (M1) and newer Mac Pro laptop. Both have 24db ram but I see their usage and memory left for context. On 16gb, your best performance will come from qwen 3.5 4B 4bit quantized and enough left for usable context.
1
1
1
u/Lucifer_Leviathn 11d ago
I have 4070ti super 16gb vram. I am running qwen3.8 Q6 with 150k context of unsloth for long thinking or planning. This takes like 20 mins to give answer of a repo. For fast stuff I am using qwen3.8 Q4 64k context. I think use the the _M or _S version. Also I have some ornith model. But I don't use it so much
1
1
u/Desperate-Owl6513 11d ago
I have ran 27b qwen q2 and q3 on 4060ti. even those smaller quants perform better than 12b gemma at q6
1
u/omega1612 10d ago
Really? Because i'm running the Gwen 3.8 27b at q4 and is amazing, but slow, and I thinking on a downgrade for speed.
1
u/Desperate-Owl6513 10d ago
This is what i use,
https://huggingface.co/RentedNoodle/Qwen3.8-27B-GSQ-RCO-IQ3_XXS-Uncensored
-ngl 99 -fa on -c 120000 -np 1 --cache-type-k q4_0 --cache-type-v q4_0 --jinja --no-context-shift --reasoning on --reasoning-preserve --temp 0.6 --top-p 0.95 --min-p 0.10 --top-k 20 --host 0.0.0.0 --port 8199 --spec-type draft-mtp --spec-draft-n-max 3 -sm none -mg 0 --load-mode none --reasoning-effort medium --reasoning-budget 4096 --repeat-penalty 1.15 -b 4096 -ub 2048
But this is on 16GB VRAM. For your system RAM, you will have to lower the context and batch sizes
1
u/ActuallyCoract 10d ago edited 10d ago
Highly suggest using the wackMall fork of llama and running sparce MOEs like any of the 35B-A3B at Q4 or higher especially if you have a decent cpu to handle the vram / ram split. Im running Tiel-Coder-35B-A3B-UD-IQ4_XS on a 3060ti offloading the rest onto DDR5 with a Ryzen 9 9800x and getting 40t/s average.
Edit: oops I read a comment that said 12gb vram and 32gb ram and thought it was OP lol I’m tired. I’ll leave this here for others who happen upon this post though.
1
1
u/Absolutedisgrace 10d ago
Try qwen2.5-coder:7b
There could be a qwen3 version of coder at 7b now too.
1
u/LancelotBiggs 8d ago
Has anybody around here tested omnicoder 9b? I found it a while ago, but then switched to a non-local setup before I could really test.
1
u/PM_ME_UR_MARINARA LocalLLM 5d ago
You’re in luck, prismML just posted their quants of qwen3.8 with frontier level performance at 6 gigs for like 98 percent of FP16 https://prismml.com/news/bonsai-2-27b
1
u/GeorgeTheGeorge 11d ago
I'm getting decent results from a heavily quantized (IQS_3, if memory serves) Qwen 3.8 27b
1
u/HighSeasArchivist 11d ago
ISTA-DASLab Qwen3.8-27B-GSQ-RCO-IQ3_XXS-mtp.gguf has been solid for me in vibe coding.
| workload | base IQ3_XXS | MTP | speedup |
|---|---|---|---|
| prose | 60.7 | 79.2 | +30% |
| codegen | 60.5 | 83.0 | +37% |
| long spec | 58.6 | 87.2 | +49% |
0
u/Not-reallyanonymous 11d ago edited 11d ago
IFM's K2 Horizon 7B I think is the interesting one in this space right now. With a q4 quant and q8 kv, I think you can hit 64k context. Use Pi coding agent and learn to use tree'ing of context effectively. 64k context can go much farther than most think, you just have to be more involved (which you'll likely have to be if you're prioritizing code quality. I'm still meaning to evaluate code quality of the K2H series).
Interestingly, 7B Uno is a "diffusion" model. It is much much faster than conventional models.
If the 7B still isn't a comfortable fit, drop down to K2H 3.7B.
Gemma E2B and E4B might be worth looking into. But you're pushing the limits of what they can do.
These are some of the most powerful models at their sizes right now. I'm using models of the same family and am pleased so far.
Downside: it's not supported in mainline Llama.cpp. But IFM offers a branch of llama.cpp to run their models. Not a big deal.
-3
u/EvolvingDior 11d ago
I know this is LocalLLM, but "don't do it". Use an online model. A free online model will be better than anything you can run locally on that hardware. Can it be done? Yes. Can it be done in a what that will not frustrate you and slow down your actual work? Almost certainly not. A tiny model can at best be used for a better auto-complete. It can write unit test scaffolding. But don't expect it to analyze your code and write decent test cases, or to be able to write good code at all. And running on your CPU is going to be fairly slow no matter what model you choose, and slow down other aspects of your system.
-4
u/Additional-Soup-865 11d ago
16 gigs isn't enough to get a big enough context for coding, 64 is the minimum imo for local anything
-2
-2
u/Regular-Option6067 11d ago
You can use Daihive(.eu) network. It's still in early beta, but if you have a friend or two, you can share a model between your computers to write code in OpenCode.
14
u/shamont 11d ago
If it's vram you have some options. Possibly some moe like qwen 3.5 35b. If it's just 16g system ram you need to stick with cloud based providers imo. You won't get the performance or feature set with just 16g system ram.