license: apache-2.0
base_model: z-lab/Qwen3.5-9B-DFlash
base_model_relation: finetune
pipeline_tag: text-generation
tags:
- gguf
- speculative-decoding
- dflash
- qwen3.5
Qwen3.5-9B-RANA-abliterated-drafter-GGUF
The drafter of the GPTah app: a small model that makes abliterant/Qwen3.5-9B-RANA-abliterated faster without changing what it writes. It is for one file, the 4-bit Qwen3.5-9B-RANA-abliterated-Q4_K_M.gguf from abliterant/Qwen3.5-9B-RANA-abliterated-GGUF, and was trained on text that file wrote.
| File | Size | SHA-256 |
|---|---|---|
Qwen3.5-9B-RANA-abliterated-drafter-Q4_K_M.gguf |
0.92 GB | 249729ad3aa7d2cb02c73ff826e6596aefeeb75c1b3582e396369eaf718dd00e |
What it is
A DFlash block drafter: 6 transformer layers, 1.3B parameters, and an output layer of its own. It reads the hidden states of the 4-bit file at the inputs of layers 2, 6, 10, 14, 18, 22, 26 and 30 of its 32 (counted from 0) and proposes the next 7 tokens at once. The model checks them in one pass, keeps the ones it would have written itself, and adds its own next token. Every token of an answer is still the model's choice; the drafter only decides how many tokens one pass settles. So it changes speed, not answers (on NVIDIA cards with one caveat, below).
It borrows the model's token embeddings at run time. Its output layer covers the 65,536 tokens the model writes most, of 248,320, with the model's own rows for them: a token outside them ends a draft and costs nothing else.
It only fits this model file. With another quantization or another edit of Qwen3.5-9B the hidden states it reads are not the ones it was trained on: it still cannot change the answers, it just gets fewer tokens kept.
How it was made
It started from z-lab/Qwen3.5-9B-DFlash, the public drafter of Qwen3.5-9B, of which RANA is an edit, and was fine-tuned on text the 4-bit file wrote through llama-server with the sampling GPTah uses (temperature 0.6, top-p 0.95, top-k 20, reasoning capped at 1,024 tokens):
| Text | Written by the model | Taken per epoch |
|---|---|---|
| 3,982 answers to public prompts (alpaca, code-alpaca, dolly, evol-code, gsm8k, python-code, ultrachat), 2,839 of them with reasoning on | 1,788,741 tokens | once |
| 485 conversations of GPTah's agent on 400 generated coding tasks: 3,096 turns | 529,159 tokens | twice |
| 225 conversations of an earlier run of the agent on 160 other generated tasks: 2,020 turns | 240,229 tokens | four times |
The earlier run's turns were meant to be taken twice, like the others; its shards were packed into the training directory twice, so they went in four times. That is 18,254 answers and turns per epoch.
The agent text is there because inside GPTah the model mostly does not write essays: it reasons for a sentence, calls a tool, reads the result, edits a file. A conversation is stored once, with the spans the model wrote; the tool results and the system prompt are context, not targets.
The hidden states were taken from the same 4-bit file through llama.cpp itself (llama-loop-taps in the patched engine). Training: 2 epochs from the public drafter, learning rate 5e-5 (1e-4 for the layer that reads the hidden states), in blocks of 8 as the engine drafts. Then the output layer was cut to the 65,536 tokens met most in the training text, and the file was converted and quantized to Q4_K_M, the output layer at 4 bits. drafter/ in this repo holds the scripts; drafter/qwen35.sh is the record of what was run, and drafter/README.md says what each step is for.
Against the public drafter
Tokens kept per drafted round (the drafted tokens the model accepts, plus the one it adds), in blocks of 8, on text held out from training: the first 128 of 254 held-out answers, and the first 128 of 432 held-out agent turns (71 conversations on 48 other tasks). Each text is walked round by round the way the engine drafts, off the engine:
| Tokens per round | z-lab/Qwen3.5-9B-DFlash | This drafter |
|---|---|---|
| Held-out answers | 4.14 | 4.13 (no change) |
| Held-out agent turns | 3.06 | 4.40 (+44%) |
On the server, with GPTah's engine arguments, sampled at temperature 0.6 with reasoning on, over the same 16 prompts and seeds, 300 tokens each:
| Tokens per round, RTX 5090 | z-lab/Qwen3.5-9B-DFlash | This drafter |
|---|---|---|
| All prompts | 3.74 | 3.66 |
| Prose | 3.54 | 3.40 |
| Code | 3.96 | 3.96 |
Speed on a MacBook Air M4
GPTah's agent on its 10 checked coding tasks, the model on a 16 GB M4 MacBook Air with GPTah's engine arguments (the command below), reasoning on, two runs per drafter taken in turns; tokens per second is everything the model wrote over a run divided by the time it took writing it:
| On the M4, over the agent tasks | z-lab/Qwen3.5-9B-DFlash | This drafter |
|---|---|---|
| Tokens per second | 30.1 | 45.4 (+51%) |
| Drafted tokens accepted | 36% | 55% |
| Tasks passed | 10/10 and 10/10 | 10/10 and 10/10 |
Single prompts on a desktop RTX 5090 did not separate the two drafters: between two runs of the same short benchmark the order of the two changed. With this drafter and reasoning on, GPTah's agent also passed 10 of its 10 checked coding tasks there.
The same answers?
The model checks every drafted token, so the drafter cannot pick a token. What can differ is arithmetic: a pass over several tokens adds the same numbers in another order than a pass over one, and on CUDA that is enough for a near tie between the model's two most likely tokens to go the other way. From that token on, the answers with and without drafting differ, as they would between two batch sizes. So on CUDA, drafted and plain answers at temperature 0 are not always identical.
At temperature 0 with reasoning off, on 16 prompts (4,353 tokens), against a server with the same arguments that does not speculate at all, on the RTX 5090: 1 of 16 answers were token for token the same as without drafting with the public drafter, and 1 with this one; the others part from the plain answer at the same token with both drafters, where the model's two most likely tokens were 0.00031 to 0.81 apart in log-probability. The two drafters are a control for each other: which drafter proposes cannot change which tokens the model keeps, only how many tokens a pass covers, and with it how the passes fall.
Run it
The drafter needs the llama.cpp fork GPTah ships (https://github.com/GuideboardLabs/llama.cpp-sensenova-loop) at commit a7f77a788893ef2cb17c82b9ac0cb1279bcd0918, with the 20 patches in patches/ of this repo, which apply to it cleanly (git am). They add, among other things, --spec-rollback, --ctx-checkpoint-turns and --prompt-tile, and with patches 0019 and 0020 the compact recurrent state of Qwen3.5 on CUDA.
git clone https://github.com/GuideboardLabs/llama.cpp-sensenova-loop llama.cpp-loop && cd llama.cpp-loop
git checkout a7f77a788893ef2cb17c82b9ac0cb1279bcd0918
git am /path/to/patches/*.patch
cmake -B build -DCMAKE_BUILD_TYPE=Release # add -DGGML_CUDA=ON for an NVIDIA card
cmake --build build --target llama-server -j
./build/bin/llama-server -m Qwen3.5-9B-RANA-abliterated-Q4_K_M.gguf -md Qwen3.5-9B-RANA-abliterated-drafter-Q4_K_M.gguf -ngl 99 -ngld 99 -c 24576 \
--spec-type ngram-simple,draft-dflash --spec-draft-n-max 7 --spec-draft-n-ubatch 64 --spec-ngram-simple-size-m 31 --spec-rollback 31 \
--reasoning-budget 1024 --jinja -fa on --parallel 1 --cache-ram 0 --ctx-checkpoints 3 --ctx-checkpoint-turns --prompt-tile 32 \
--temp 0.6 --top-p 0.95 --top-k 20 --min-p 0
Besides -ngl 99 -ngld 99 -c 24576, with which the numbers here were taken (-c is yours to choose), these are GPTah's arguments. --spec-type ngram-simple,draft-dflash drafts text the server has already seen from the prompt, up to 31 tokens at a time, and everything else with the drafter, 7 at a time. --spec-rollback 31 cuts a partly accepted draft where it went wrong instead of running it again. --reasoning-budget 1024 ends the reasoning after 1,024 tokens. The sampling values are the ones Qwen gives for coding with reasoning on. --cache-ram 0 --ctx-checkpoints 3 keeps the server's memory flat on small machines, and --spec-draft-n-ubatch 64 keeps the drafter's buffers small.
Licence
Apache-2.0. This is a modified version of z-lab/Qwen3.5-9B-DFlash, also Apache-2.0, fine-tuned on text written by abliterant/Qwen3.5-9B-RANA-abliterated (Apache-2.0); see NOTICE. The patches are MIT, like llama.cpp.