Repository navigation
Abliterated Qwen3.8-27B loops and falls apart on multi-step agentic tasks — is this an intrinsic abliteration side effect, or is there a config fix? #28430
|
I'm serving an abliterated Qwen3.8-27B (OBLITERATED V3, Q8_0 GGUF) through llama.cpp's server (--jinja, MTP speculative draft) to an agentic coding CLI over the Anthropic-style /v1/messages route. Single-turn chat is fine. Multi-step agentic sessions are not. Symptom : After a handful of good turns, the model degrades: it starts repeating tool calls, hallucinating, and stops following instructions. Early on the repeats are byte-identical (same ls/find over and over); later they mutate into near-identical variants — e.g. it hunts for a file by trying dozens of typo'd directory names (Ai_Agent_Works → Ai_Agent_Wocks → Ai.Agent.Works → Ai.Agent.Wokr …), each command slightly different, making zero progress. Key data point: the clean (non-abliterated) weights of the same model, same quant, same server config, do not do this. They stop and recover correctly. So it tracks with abliteration, not the backend. What I've tried (server side): DRY sampler, --dry-multiplier up to 1.0, --dry-base 1.75, --dry-allowed-length 8, --dry-penalty-last-n 4096 My working theory (would love confirmation): In an agent loop, tool calls are grammar-constrained structured output, and sampler penalties barely reach grammar-forced tokens — so DRY/presence can't bite the looping tool calls.
Setup / repro: 1.Backend: llama.cpp server (server-cuda), single 48 GB GPU. Qwen3.8-27B-OBLITERATED Q8_0 + its MTP draft head, --jinja, --ctx-size 131072, q8_0 K/V cache, flash-attn on, 2 server slots over a unified KV pool. 2.Clients, both reproduce it:
3.Client sampling: Claude Code sends temperature 1.0, top_p 0.95, and no penalty/DRY/top_k fields (confirmed by reading /slots mid-request), so the server-side sampler defaults above are what actually apply.
|
Replies: 2 comments 1 reply
|
Confirmed (from source), and a few pieces of external context — no upstream llama.cpp doc or benchmark directly answers "is this a known abliteration cost," so that part stays a hypothesis.
common_sampler_sample() in common/sampling.cpp does, by default (grammar_first=false, which is what the server uses for chat/tool-call routes):
So the claim "sampler penalties barely reach grammar-forced tokens" isn't quite accurate for llama.cpp as implemented — DRY/penalty do see the full distribution first, every step. Grammar only intervenes as a rejection filter, and even the rejection-sampling path re-applies your penalty chain afterward.
DRY and repeat/presence penalties act on exact token-sequence overlap within their window. Ai_Agent_Works → Ai_Agent_Wocks → Ai.Agent.Works are different token sequences; none of these samplers are designed to detect near-duplicate/edit-distance-close continuations, only literal repeats. So "DRY doesn't stop the typo-hunting" is a designed limitation of every penalty sampler llama.cpp ships, independent of grammar or abliteration. This exact failure mode (loop inside a grammar-constrained JSON string, not stopped by default repetition penalty) has been diagnosed upstream in another engine: vLLM's root-cause writeup for Gemma-4 tool-call loops (vllm-project/vllm#40099) found that inside a JSON string value the grammar allows thousands of legal tokens, but the base logit distribution heavily favors the repeat, and default repetition_penalty=1.0 does nothing about it — so they added a dedicated n-gram RepetitionDetectionParams loop-breaker (auto-enabled when structured output is active), separate from ordinary penalties. llama.cpp has no equivalent semantic/n-gram loop-breaker today — DRY is the closest tool it has, and by design it won't catch non-identical variants. There's also a related llama.cpp-specific bug class where an unbounded zero_or_more grammar rule lets a model spin forever inside a tool call (#21375) — worth ruling out separately from the abliteration question, since it reproduces on non-abliterated models too.
Not confirmed. There's no llama.cpp-side documentation or benchmark on this, and I found no credible measured study isolating "abliteration hurts multi-step self-correction" as a distinct axis from the general capability hit abliteration is already known to cause. Treat the following as hypothesis only: abliteration removes a "refusal direction" from the residual stream (typically projected out uniformly across many/all layers), and that projection can also damage nearby features that aren't purely refusal-related — self-correction/backtracking behavior is a plausible casualty of that, but I have no citation confirming it's specifically abliteration and not just quantization/model-specific brittleness. Your own control (clean weights, same quant/config, don't loop) is the strongest evidence in the thread, but it's a single anecdotal data point, not a benchmark.
To separate "grammar/tool-loop interaction" from "abliterated weights lose multi-step coherence generally":
I don't have evidence either confirming or ruling out "only non-abliterated weights fix it" — that would need a controlled A/B with several abliteration techniques/strengths on the same base model, which I haven't seen published. |
|
@demirciberk Here is the breakdown of what was actually happening, what failed, and the final verdict. The Real Culprits (Configuration)The looping wasn't primarily a grammar constraint issue. It was caused by three overlapping config amplifiers:
Because these issues were independently sufficient to cause failure, single-variable testing was a trap. Turning off the draft head changed nothing while What Failed (Testing your suggestions)Your suggestions were spot on for diagnosing this, and led to two very interesting negative results:
The Final Verdict on AbliterationEven after fixing the template defaults, removing the draft head, and turning off Sadly, this means I can't use the abliterated model as I originally needed for my agent workflows. I’ve switched back to the non-abliterated weights for now, as they terminate properly, follow instructions, and actually handle dual-use coding tasks just fine in a proper context. This leaves me really curious about the broader community's experience: how are other people using these abliterated models? Is anyone successfully running them in deep multi-turn agent loops, and if so, do you face this exact same degradation issue? I would love to know what solutions, orchestration-level workarounds, or workflow tricks you rely on that I haven't tried yet to resolve this. |
Confirmed (from source), and a few pieces of external context — no upstream llama.cpp doc or benchmark directly answers "is this a known abliteration cost," so that part stays a hypothesis.
common_sampler_sample() in common/sampling.cpp does, by default (grammar_first=false, which is what the server uses for chat/tool-call routes):
So the claim "sampler p…