license: apache-2.0
license_link: https://huggingface.co/Qwen/Qwen4-35B-A3B/blob/main/LICENSE
base_model: OpenUncensored/Qwen4-35B-A3B-Uncensored
base_model_relation: quantized
pipeline_tag: image-text-to-text
library_name: transformers
language:
- en
tags: - fp8
- uncensored
- abliterated
- qwen4
- moe
- vllm
Qwen4 35B A3B Uncensored, FP8
OpenUncensored/Qwen4-35B-A3B-Uncensored
in the exact FP8 format of the official
Qwen/Qwen4-35B-A3B-FP8: about 60 GB on disk instead of
114 GB, and about 38 GiB of weights on the GPU (measured with vLLM on one 96 GB card).
This is not a fresh quantization of the whole model. It is Qwen's own FP8 release with only the tensors
that OpenUncensored edited swapped in, quantized by a re-implementation of Qwen's scheme that reproduces
their files bit for bit. Everything the edit does not touch is byte-identical to the official FP8 files.
| Edited weights from | OpenUncensored/Qwen4-35B-A3B-Uncensored @ 15ce532f46dc7bf6a542b48f87fc869454c16046 |
| FP8 container from | Qwen/Qwen4-35B-A3B-FP8 @ 4d35041fcd017a5608bd83bb65388757919d029c |
| Format | float8_e4m3fn weights, 128x128 block scales (weight_scale_inv, fp32), dynamic activation scales |
| Config, tokenizer, chat template, remote code | unchanged from the official FP8 repo |
How it was built
OpenUncensored changes 78 tensors of the BF16 model (the residual writers of layers 8 to 33) and leaves the
rest untouched. In FP8 terms:
- 52 tensors (
linear_attn.out_proj,self_attn.o_proj,shared_expert.down_proj) are kept in BF16 by
the official FP8 release (modules_to_not_convert). They are copied byte for byte from the OpenUncensored
shards. - 26 tensors are the fused routed-expert
mlp.experts.down_proj(256 experts each). They are split per
expert and quantized: 6,656 weight tensors and 6,656 scale tensors.
The resulting checkpoint differs from the official FP8 in exactly 13,364 entries (52 + 6,656 + 6,656).
No other tensor differs: n-gram embedding table, vision tower, MTP head, router, gated-residual mixers and
layers 0 to 7 and 34 to 39 are Qwen's FP8 bytes.
How the quantizer was checked
The official scheme is not the textbook fp32 one: the per-block maximum and the scale are computed in BF16
arithmetic, the division is done in BF16, and the scale is stored as fp32. A plain fp32 implementation is
close but not equal (scales off by up to 0.33%, about 3% of elements one step away).
With the BF16 scheme, quantizing the unedited routed experts from the BF16 release and comparing with
the official FP8 files gives:
| Experts compared (layers 0 to 7 and 34 to 39, all 256 each) | 3,584 |
| Elements compared | 3,758,096,384 |
| Differing elements | 0 |
| Scale tensors equal | 3,584 / 3,584 |
So the edited experts in this repo are quantized exactly the way Qwen would have quantized them.build_fp8.py in this repo is the script that was used (verify reproduces the table above, build
writes the checkpoint and diffs it against the official one).
Usage
Same as the official FP8 model. With vLLM (vllm/vllm-openai:qwen4):
vllm serve <this repo> \
--trust-remote-code \
--max-model-len 32768 \
--enable-prefix-caching \
--reasoning-parser qwen4
Measured on one RTX PRO 6000 (96 GB) with the command above plus--default-chat-template-kwargs '{"reasoning_effort":"off"}' --gpu-memory-utilization 0.90:
38.4 GiB of weights on the GPU, the n-gram embedding table stays in host RAM (about 37 GB resident for the
engine process), about 176 tokens/s for a single stream, and 16 concurrent chats with 6.5k-token prompts and
~200-token answers finish within 10 s (p95).
Optional flags from the vLLM recipe also work with this checkpoint: --kv-cache-dtype nvfp4 --attention-config.indexer_kv_dtype fp8 roughly doubles the KV cache capacity (3.06M vs 1.48M tokens on
this card); we saw no difference in answer quality between the two cache types. MTP speculative decoding
(--speculative-config '{"method":"mtp","num_speculative_tokens":3,"index_share_for_mtp_iteration":true}')
runs fine but did not make this setup faster.
Caveat of the vLLM build we used (0.1.dev26393): a request with more than 1,024 entries in logit_bias
or allowed_token_ids takes the whole engine down instead of returning an error.
Thinking is on by default. To turn it off per request:
{"chat_template_kwargs": {"reasoning_effort": "off"}}
("none" and {"enable_thinking": false} work too), or for the whole server:--default-chat-template-kwargs '{"reasoning_effort":"off"}'.
Sampling as recommended for the base model: thinking off temperature 0.7, top_p 0.8, top_k 20, presence_penalty 1.5; thinking on temperature 1.0, top_p 0.95, top_k 20.
Language mixing in Russian (base model behaviour) and a fix
Qwen4-35B-A3B sometimes switches script in the middle of a Russian sentence with thinking off
("я тогда ещё young был", "сейчас看看"). This is not caused by this FP8 build or by the uncensoring edit.
On 60 Russian role-play prompts (temperature 0.7, top_p 0.8, top_k 20, 288 new tokens), answers with at
least one foreign-script insertion:
| Weights (all on vLLM) | Answers with insertions |
|---|---|
| This repo | 20 to 22 / 60 |
Official Qwen/Qwen4-35B-A3B-FP8 |
23 to 24 / 60 |
OpenUncensored/Qwen4-35B-A3B-Uncensored (BF16) |
17 / 60 |
This repo + script_guard (below) |
0 / 60 |
Run-to-run noise is about 3 answers. The KV cache type, presence penalty, prefix caching and batching do
not change the rate; temperature 1.0 doubles it; the insertions are there with greedy decoding too. A
reference run in plain transformers (no vLLM) on the same weights gives the same picture: the foreign
token is often the model's own first or second choice (for example, after "Я тогда ещё" it gives " young"
0.26, second only to " молоды" at 0.38).
English answers are not affected. An instruction in the prompt ("answer in Russian only") does not help.
extras/script_guard/ in this repo is a small vLLM logits processor that fixes it. For requests whose
prompt is Russian (detected from the prompt tokens, no client-side flag needed) it subtracts a constant
from the logits of Latin tokens and of other-script tokens (CJK, kana, Hangul, Arabic, ...). Tokens whose
text occurs in the prompt are exempt, so Latin names and labels from the conversation can still be
repeated. Non-Russian requests are left unchanged.
PYTHONPATH=extras/script_guard SCRIPT_GUARD_LATIN=4 SCRIPT_GUARD_OTHER=4 \
vllm serve <this repo> ... --logits-processors script_guard:ScriptGuard
With a penalty of 4 the insertions went to 0 / 60 at temperature 0.7 and at 1.0, Latin names from the
prompt were kept, and throughput did not change measurably. Per request it can be switched with"vllm_xargs": {"script_guard": "off"} (or "ru" to force it on). It is written for the V2 model runner
interface of the vllm/vllm-openai:qwen4 image.
What was and was not measured
- Measured here: the bit-exact quantizer check above, the tensor-level diff against the official FP8,
serving on vLLM (chat, streaming, thinking on and off), and the language-mixing rates above. - Not re-measured here: refusal rates and benchmark scores. For those see the
original card, which reports them on the
BF16 weights.
Credits
- Qwen for Qwen4-35B-A3B and its FP8 release.
- OpenUncensored for the edit and for publishing
edit.safetensors,
which made an exact tensor-level rebuild possible.
License: Apache 2.0, same as the base model.