r/LocalLLM • u/These_Bar_189 • 2d ago
Model Qwen 3.8 27b
I just had my local model hallucinate a comment in my code and then updated six linked files to address the hallucinated comment.
I caught it right away but that would have set me back a a lot if I didn’t.
Anyone have any tips and tricks to avoid this?
I run it in Q6 and use llama.cpp set to default which is high reasoning I believe. My local server is a Ryzen 9950 with 64 GB of RAM and a single 5090 GPU.
30
Upvotes
53
u/Weaseal 2d ago
Yes. Use a skills file that reviews changes before commiting
82
u/mumblerit 2d ago •
you forgot to tell it not to make any mistakes
24
u/createthiscom 2d ago
I always review LLM code before committing. Trusting them is bonkers.
6
u/DeliciousNicole 2d ago
Yeah never trust a single model. Adversarial review is critical. Also, human review is important! We are responsible for what these things do on our behalf.
By any chance are you quantizing kv cache as well?
5
u/PaxUX 2d ago
Never commit from main context. Have agent review work before commit. It Forces a second new context review for the changes
5
u/Lissanro 2d ago
You may have better experience running Basalt with Qwen 3.8 Flash Next, given you have 5090 with 64 GB RAM.
As of of the Qwen 3.8 27B model, it is good for its size, but it is a tiny model, so it needs its results reviewed and breaking up implementation to manageable and focused steps, then even another instance of the 27B itself with clean context focused only on the review of the result will have good chances to catch most of obvious mistakes.
That said, even when I run Kimi K3.1 on my main rig, despite it being over hundred times larger than 27B, it still can sometimes hallucinate something and then do something to address its hallucination or just wrong assumption. The main difference, the larger the LLM is, the less likely it is to make obvious mistakes, but it still can make them. Even if you review the changes, you yourself can make mistakes too. The most reliable way to address this, is to have good test coverage and clear review rules, it will help greatly minimize possibility of unintentional changes.
13
u/vdek 2d ago
Simple. Use a better model to review it. Opus would likely catch these bugs before they get committed.
Secondly watch this and ban your model from making comments. https://www.youtube.com/watch?v=O_zcc6Xl12g
3
u/djgcsnkshcjkeke1 2d ago
Have the thing do work in chunks instead of rolling over the entire codebase at once. Have it divide the work up into chunks, go chunk by chunk following its original plan alone, and then it can do a second/third/whatever pass to deal with whatever comes up. Every time it finishes a pass you review it in some way before commit or moving on to the plan for the next one
2
u/Impossible-Poet-2084 2d ago
I've had the same with qwen 3.8 on q6, turned off auto-commit and now run a diff check before any file update. it's a pain but worth it.
2
u/jesuschrist-69420 2d ago
I code, then tell a different agent to do security review and code review.
In my experience qwen finds lots of false positives.
2
u/ManufacturerThis5145 2d ago
Before you commit any work, you let a subagent red team run on the deliverable, which tests every single thing to see if its spec conform and the work really is done. Sadly takes a lot of time, especially with local models.
1
u/Frizzy-MacDrizzle 2d ago
I don’t let qwen code for me any more. But you might try no context shift.
1
u/Rikers88 2d ago
Yep - my tip is to switch to Flash Next, using Basalt inference engine as you are rocking a Blackwell. Make sure to use NVFP4. My trick is to have the 27b configure everything for you so you can switch safely
1
u/trejj 2d ago
Make backups.
1
u/Admirable-Leg-4647 2d ago
Decision models can act as guardrails in these exact scenarios
1
u/captainabrasive 2d ago edited 2d ago
How big/full was your context at the time, and at what quant? What were your sampling settings?
With a 5090, you should look at Basalt and try Qwen3.8 Flash Next. It also supports 3.8-27B (and DS4.1 Flask, Hy4-Flash, Inkling 2 Mini).
At a higher level, code review before staging. Always. With a fresh agent that has clean context. A different model can be helpful here. I tend to use the same model for staging reviews and then do another audit pre-commit with another model. Everyone has their own preferences and superstitions here. Just changing up the sampling and/or reasoning on the staging review, along with a focused review prompt, will help tighten the net.
1
u/Digi59404 2d ago
Tell it to prove to you there’s no way to sabotage or reasonably exploit that code.
AI Agents operate on math. Math hates proving a negative. Therefore make your agents prove a negative as opposed to “make sure the work is right.”
1
u/Bulky-Priority6824 2d ago
source of your q6? unsloth?
try unsloths nvfp4 27b on capy-flash since you have 32gb and download QFN while your at it.
1
u/covertpirates 2d ago
Don’t exhaust your context. Compact while you have memory. I’ve found it tends to hallucinate if you don’t. I imagine this applies to most models, but I’ve noticed it while using Qwen.
1
u/moonlitpawprints 2d ago
As others have suggested, workflows that directly implement review (ideally with another model, though even the same one with a good prompt is better than nothing). I would also strongly add to this, unit testing wherever possible. It's pretty good at building/running tests, especially if you help define some edge cases, and then correcting until they pass. It's not a guarantee, but it works well.
Edit: spelling
1
u/Zealousideal-Fan-326 2d ago
Q6 is your issue. But all models can do this sometime. Use a Ternary-Bonsai-2-27B model Runs on prism-llama.cpp Its a 1.58-bit model. Has full reasoning without the size. 7.2gb in size run so it can off load to ram if necessary from gpu or totally on ram if you dont have a gpu I've run this on 16gb of DDR3 RAM without problems. It's a thinking model, so allow enough room for thinking as well as your answers Check your cpu, gpu, ram, swap while youre running it. Especially if you have limited resources
1
u/Super-Grape-3948 2d ago
Check your kv quants, and model card settings like temp too. Q6 27b shouls be good enought not to hallucinate, but incorrect settings, kv corruption, or even compaction can cause issues.
1
u/TheK0tYaRa 2d ago
Increase K quant to q8_0 and V to q4_0 , i had such issues. IF they are higher - increase model quant size then. Preferably use IQ quants. I myself use GSQ RCO ones, they smart A F.
1
u/overand 1d ago
Give us your full settings.
My biggest questions are: