Skip to content

Why "Uncensored" Fine-Tunes Suck at Coding (And Why Abliteration Fixes It)

Many "uncensored" models are trained further until they stop refusing, and training moves more than refusals. Abliteration edits one direction instead. RawTokens serves DeepSeek V4.1 Flash abliterated, with 1M context and tool calls.

RawTokens6 min read

Schematic: change from base model

  • refusing
  • Python
  • debugging
  • tool calls
  • SQL
  • chat style

One edit aimed at refusals. Real builds can drift a little elsewhere, so measure yours

Why developers expect uncensored to mean worse

The doubt has a history. Community "uncensored" fine-tunes were often built for chat and roleplay, on smaller base models with short context windows. Hand one a real repository and a tool schema and you can see why people walked away. How a model was changed matters as much as whether it refuses.

What a fine-tune changes

A fine-tune keeps training. Each update pulls weights toward the new examples, and skills those examples never exercise can fade. In LoRA Learns Less and Forgets Less, researchers compared two fine-tuning methods on programming and math. Full fine-tuning learned more of the target, while the smaller LoRA updates kept more of the base model's performance outside it.

The further a training set sits from code, the more reason you have to test code afterwards. A roleplay dataset sits very far from it.

What abliteration changes

Arditi et al. found that across 13 open chat models, refusal runs through a single direction. Remove it and the model stops refusing, with what the authors describe as minimal effect on other capabilities. Abliteration writes that removal into the weights. There is no new training data and no new house style.

The edit, in three lines
r  = mean(activations on refused prompts) - mean(activations on harmless prompts)r1 = r / |r|                      # the refusal direction, length 1W  = W - r1 (r1 . W)              # for each matrix that writes into the residual stream

What the research measured

StudyMeasuredResult
Arditi et al., 2024Refusal in 13 chat models up to 72BOne direction mediates refusal. Removing it had minimal effect on other capabilities.
Biderman et al., 2024LoRA and full fine-tuning on code and mathThe heavier method forgot more outside its target domain.
Young, 2025 preprintAbliteration tools on GSM8K math, models of 7B to 14BTwo single-pass tools averaged -0.28 and -0.13 points on three models. Across tools and models the change ran from +1.51 to -18.81 points.

Fine-tune or abliteration, side by side

QuestionUncensored fine-tuneAbliteration
What happensTraining continues on new examplesOne direction is removed from the weights
New datasetYes, and it shapes behaviorNo, only prompt sets to find the direction
Writing styleCan shift toward the dataNot trained toward a new style
Main risk for codeForgetting outside the training dataVaries with tool and model
Jailbreak promptNot neededNot needed

Test coding and tool calling yourself

codetest.py asks for four small functions and checks each with assertions the model never sees. Then it runs a two-step tool call: the model must request the right file and use what comes back. It works with any OpenAI-compatible endpoint, so your old fine-tune can sit the same test.

codetest.py
# codetest.py: can your uncensored model still write working code and call tools?#   export API_KEY=sk-raw-...#   python codetest.py          saves each answer and runs the tool test#   python codetest.py --run    also executes the generated code. Read it first, or use a throwaway container.# Point it at any OpenAI-compatible endpoint with BASE_URL and MODEL.import json, os, subprocess, sys, urllib.request API = os.environ.get("BASE_URL", "https://api.rawtokens.dev/v1")MODEL = os.environ.get("MODEL", "deepseek-v4.1-flash-abliterated-fast")REASONING = os.environ.get("REASONING", "off")  # set to "" if your endpoint rejects the fieldFENCE = chr(96) * 3 TASKS = {    "merge_intervals": (        "Write a Python function merge_intervals(intervals) that merges overlapping or touching [start, end] pairs "        "and returns them sorted. Do not modify the input.",        """a = [[5, 7], [1, 3], [3, 4]]assert merge_intervals(a) == [[1, 4], [5, 7]]assert a == [[5, 7], [1, 3], [3, 4]]assert merge_intervals([]) == []assert merge_intervals([[1, 10], [2, 3]]) == [[1, 10]]"""),    "parse_duration": (        "Write a Python function parse_duration(text) that turns strings such as '1h30m', '45s' or '2h5s' into seconds. "        "Raise ValueError for empty, wrongly ordered or malformed input.",        """assert parse_duration('1h30m') == 5400assert parse_duration('45s') == 45assert parse_duration('2h5s') == 7205for bad in ('', 'h', '5x', '1m1h', '10'):    try:        parse_duration(bad)    except ValueError:        continue    raise AssertionError(bad)"""),    "lru_cache": (        "Write a Python class LRUCache(capacity) with get(key), returning -1 when missing, and put(key, value), "        "both O(1). Reading or writing a key makes it the most recently used.",        """c = LRUCache(2)c.put(1, 1); c.put(2, 2)assert c.get(1) == 1c.put(3, 3)assert c.get(2) == -1c.put(1, 10); c.put(4, 4)assert c.get(3) == -1 and c.get(1) == 10 and c.get(4) == 4"""),    "fix_the_bug": (        "Fix this function and return the whole corrected function. Pages are numbered from 1, the last page may be "        "short, and a page below 1 raises ValueError.\n\ndef paginate(items, page, size):\n"        "    start = page * size\n    return items[start:start + size - 1]",        """assert paginate([1, 2, 3, 4, 5], 1, 2) == [1, 2]assert paginate([1, 2, 3, 4, 5], 3, 2) == [5]try:    paginate([1], 0, 2)except ValueError:    passelse:    raise AssertionError('page 0 accepted')"""),}used = [0, 0]  def chat(messages, **extra):    body = dict(model=MODEL, messages=messages, temperature=0, max_tokens=4000, **extra)    if REASONING:        body["reasoning_effort"] = REASONING    key = os.environ.get("API_KEY") or os.environ.get("RAWTOKENS_API_KEY") or sys.exit("Set API_KEY first")    request = urllib.request.Request(API + "/chat/completions", json.dumps(body).encode(), {        "Authorization": "Bearer " + key, "Content-Type": "application/json", "User-Agent": "rawtokens-kit/1.0"})    with urllib.request.urlopen(request, timeout=300) as response:        reply = json.load(response)    used[0] += reply["usage"]["prompt_tokens"]    used[1] += reply["usage"]["completion_tokens"]    return reply["choices"][0]["message"]  def code_of(answer):    blocks = answer.split(FENCE)[1::2]    return max(blocks, key=len).split("\n", 1)[-1] if blocks else answer  def coding_test(name, prompt, checks, run):    path = os.path.join("codetest_out", name + ".py")    with open(path, "w", encoding="utf-8") as out:        out.write(code_of(chat([{"role": "user", "content": prompt}])["content"] or "") + "\n\n" + checks + "\n")    if not run:        return "saved  " + path    try:        done = subprocess.run([sys.executable, "-I", path], capture_output=True, timeout=20)    except subprocess.TimeoutExpired:        return "FAIL   timed out"    return "PASS" if done.returncode == 0 else "FAIL   see " + path  def tool_test():    tools = [{"type": "function", "function": {        "name": "read_file", "description": "Read a text file from the project",        "parameters": {"type": "object", "properties": {"path": {"type": "string"}}, "required": ["path"]}}}]    messages = [{"role": "user", "content": "What port does the server use? Read config/server.toml to find out."}]    try:        first = chat(messages, tools=tools)        call = first["tool_calls"][0]        asked = json.loads(call["function"]["arguments"])["path"]        if call["function"]["name"] != "read_file" or asked != "config/server.toml":            return "FAIL   wrong tool call"        messages += [{"role": "assistant", "content": first.get("content") or "", "tool_calls": first["tool_calls"]},                     {"role": "tool", "tool_call_id": call["id"], "content": "[server]\nport = 8765\n"}]        return "PASS" if "8765" in (chat(messages, tools=tools).get("content") or "") else "FAIL   ignored the result"    except (KeyError, IndexError, TypeError, ValueError):        return "FAIL   no usable tool call"  if __name__ == "__main__":    run = "--run" in sys.argv    os.makedirs("codetest_out", exist_ok=True)    print("model:", MODEL)    for name, (prompt, checks) in TASKS.items():        print("%-16s %s" % (name, coding_test(name, prompt, checks, run)))    print("%-16s %s" % ("tool_call", tool_test()))    print("%d input, %d output tokens" % tuple(used)) 
Run it
export API_KEY=sk-raw-YOUR_KEYpython codetest.py                # saves the answers, runs the tool testpython codetest.py --run          # also executes the saved code # the same test against another endpoint, for example a local fine-tuneBASE_URL=http://localhost:11434/v1 API_KEY=none MODEL=your-fine-tune REASONING= \  python codetest.py --run

On RawTokens the whole test is at most six requests with capped answers, so it cannot cost more than 3 cents. Small tasks like these catch a broken model, and they will not rank two good ones. Add five functions and tests from your own codebase.

What you get on RawTokens

  • DeepSeek V4.1 Flash Abliterated Fast with 1M context, 128K maximum output, text and image input.
  • Tool calls on Chat Completions and Anthropic Messages, at https://api.rawtokens.dev/v1.
  • Reasoning you can set to off, low, high or max.
  • $0.50 input, $0.04 cached input and $0.90 output per 1M tokens.
  • An account in one click with no email, prepaid in crypto from $5.

Want to see it on real work first? The coding agent guide shows a security refactor captured from the model, with the result of running it in our lab.

Questions

Are uncensored models worse at coding?

Some are. A fine-tune trained on data far from code can lose coding skill. Abliteration edits one direction instead of retraining, but results depend on the tool and the model, so test the exact build you plan to use.

What is the difference between an abliterated model and an uncensored fine-tune?

A fine-tune is trained further on new examples. An abliterated model has the direction that drives refusals removed from its weights, with no further training on a new dataset.

What is a good uncensored LLM for coding over an API?

We recommend our own DeepSeek V4.1 Flash Abliterated Fast: 1M context, tool calls in OpenAI and Anthropic formats, $0.50 input and $0.90 output per 1M tokens. Run codetest.py against it and against anything else you are considering.

Can I use it inside a coding agent?

Yes. It works in Claude Code, Cursor, Cline and OpenCode by changing the base URL, key and model ID.