license: apache-2.0
license_link: https://huggingface.co/Qwen/Qwen4-35B-A3B/blob/main/LICENSE
base_model: Qwen/Qwen4-35B-A3B
base_model_relation: quantized
pipeline_tag: image-text-to-text
library_name: transformers
gated: auto
extra_gated_prompt: >-
WARNING: Safety refusals have been largely removed from this model via
norm-preserving orthogonal projection. By accessing these weights, you
acknowledge and agree to all three statements below.
extra_gated_fields:
I understand safety alignment and refusal behaviors have been substantially removed: checkbox
I accept full legal and ethical responsibility for all outputs and downstream use: checkbox
I acknowledge these weights are provided AS-IS for research without warranty: checkbox
tags:
- qwen4
- qwen4_moe
- uncensored
- abliterated
- w4a16
- int4
- fp8
- compressed-tensors
- vllm
- rtx-3090
- ampere
Qwen4-35B-A3B-Uncensored-W4A16
Warning / 安全提示: Safety refusals have been largely removed from this checkpoint. It may generate unsafe, offensive, or inaccurate content if prompted. Provided strictly for research and authorized red-team evaluation under Apache-2.0 with no warranty.
A 2×24 GB GPU (e.g. 2× RTX 3090, Ampere SM86) ready, post-quantization verified W4A16 (INT4 routed experts + official FP8 E4M3 PLE table) uncensored build of Qwen/Qwen4-35B-A3B with full multimodal vision, native qwen4 tool calling, reasoning control, and built-in MTP head intact.
Architecture & Quantization Summary
- Routed MoE Experts (40 decoder layers + 1 MTP layer, 256 experts each,
33.0Bparams): W4A16 INT4 symmetric,group_size=32, 11-ratio MSE optimal clipping (compressed-tensorspack-quantized, runs natively on vLLMMarlinExperts). - 20.5B N-gram / PLE Table (
layers.1.ple.ple_embedding, 128 shards + global scale): Official FP8 E4M3 reused byte-for-byte fromQwen/Qwen4-35B-A3B-FP8, 100% unmodified by abliteration. - All Other Components (
embed_tokens,lm_head, Gated DeltaNet linear attention, Qwen Sparse Attention + indexer, shared experts, routers, 4-stream Hyper-Connections, vision tower, MTP non-expert weights): BF16. - Checkpoint Size & VRAM Footprint:
42.58 GiB(45.7 GB) on disk;12.33 GiBweights per GPU atTP=2on 2× RTX 3090 (with the 20.5 GB FP8 PLE table offloaded to pinned host RAM or NVMe), leaving ~6.8–10 GiB/GPU for KV cache (131K–262KBF16 KV /491KFP8 KV).
Abliteration Methodology (Pre-Norm 4-Stream Hyper-Connection SVD)
- Unlike naive approaches that hook the post-
hc_normmixed_input(which suffers up to 25–27× per-channel RMSNorm scaling distortion relative to the residual stream), directions are extracted directly from the true pre-norm 4-streamhyper_inputresidual across all 40 decoder layers. - SVD across the 4 parallel Hyper-Connection streams reveals a clean rank-2 refusal subspace (
S1/S0 ≈ 0.54–0.61). Per-layer biprojected norm-preserving orthogonal projection over this rank-2 basis is applied to BF16 write-back projections prior to W4A16 quantization, leaving the 20.5B FP8 PLE table, vision encoder,lm_head, routers, hyper-connection norms, and MTP head untouched. - Post-Quantization Verification Gate: Verified after W4A16 quantization on live
vllm/vllm-openai:qwen4TP=2across both non-thinking (enable_thinking=false) and full thinking (reasoning_effort=high,max_tokens=4096) modes, plus coherence sanity, vision OCR,qwen4tool calling, and capability retention benchmarks. - Note: Specific prompt datasets and exact internal recipe files are intentionally not redistributed.
Verified Benchmarks (Measured on 2× RTX 3090 NVLink, vllm/vllm-openai:qwen4, TP=2)
Post-Quantization Refusal & Functional Gate (Held-Out Set)
| Check | Mode | Result | Notes |
|---|---|---|---|
Non-Thinking Refusal (n=100, held-out) |
enable_thinking=false, max_tokens=512 |
10.0% (10/100) |
empty=0, errors=0, reasoning_leaked=0, short<10w=0, median 157.5 words |
Thinking=High Refusal (n=32, held-out) |
reasoning_effort=high, max_tokens=4096 |
6.25% (2/32) |
empty=0, errors=0, short<10w=0, median 430.0 words |
| Harmless Coherence Sanity | enable_thinking=false |
8/8 PASS |
median 156.0 words |
| Vision (Multimodal Image Test) | enable_thinking=false |
PASS | Vision tower untouched |
Native qwen4 Tool Calling |
--tool-call-parser qwen4 |
PASS | Exact structured JSON arguments |
Capability Retention (enable_thinking=false, seed 20261204, 50 Qs/suite, identical W4A16 pipeline)
| Benchmark | Official Base W4A16 (Control) | Uncensored W4A16 (This Repo) | Delta |
|---|---|---|---|
GSM8K (n=50) |
96.0% (48/50) |
98.0% (49/50) |
+2.0% |
ARC-Challenge (n=50) |
96.0% (48/50) |
98.0% (49/50) |
+2.0% |
MMLU-Pro (n=50, 10-way) |
84.0% (42/50) |
84.0% (42/50) |
0.0% |
MMLU (n=50, 12 subjects) |
74.0% (37/50) |
80.0% (40/50) |
+6.0% |
Average (n=200) |
87.5% |
90.0% |
+2.5% |
Throughput on 2× RTX 3090 NVLink (TP=2, MTP=1, BF16 KV, Pinned Host RAM PLE)
Workload (512 tokens, non-thinking) |
1-Stream TTFT | 1-Stream Decode | 1-Stream E2E | 4-Stream Aggregate |
|---|---|---|---|---|
| Prose | 63 ms |
189.4 tok/s |
185.1 tok/s |
635.8 tok/s |
| Code | 69 ms |
202.3 tok/s |
197.0 tok/s |
657.4 tok/s |
2×3090 Deployment Notes:
- Built-in MTP (
num_speculative_tokens=1) delivers +28% prose / +49% code 1-stream decode speedup (+37%/+48%at 4-stream) overMTP=0on 2× RTX 3090 withvllm/vllm-openai:qwen4.- Pinned Host RAM PLE vs Disk Offload: On hosts with ≥64 GB system RAM, keeping vLLM's pinned host RAM PLE (
--engram-config.cpu_offload true --engram-config.disk_offload falsewith--ulimit memlock=-1) is 12.5× faster under 8-way concurrency than--engram-config.disk_offload true(which usesO_DIRECTrandom NVMe reads). Use--engram-config.disk_offload trueonly when host RAM is constrained (<48 GB free).
Quick Start (2× RTX 3090, vllm/vllm-openai:qwen4)
Recommended (Hosts with ≥64 GB RAM — Pinned Host RAM PLE)
docker run -d --name qwen4-unc-w4a16 --gpus '"device=0,1"' \
--ipc=host --ulimit memlock=-1 -p 8000:8000 \
-e NCCL_P2P_LEVEL=NVL -e VLLM_USE_RUST_FRONTEND=1 \
-v /path/to/Qwen4-35B-A3B-Uncensored-W4A16:/models/model:ro \
vllm/vllm-openai:qwen4 /models/model \
--served-model-name qwen4-35b-a3b-unc-w4a16 \
--trust-remote-code \
--tensor-parallel-size 2 --disable-custom-all-reduce \
--engram-config.cpu_offload true --engram-config.disk_offload false \
--max-model-len 262144 --gpu-memory-utilization 0.92 \
--limit-mm-per-prompt '{"image":4,"video":0}' \
--enable-auto-tool-choice --tool-call-parser qwen4 --reasoning-parser qwen4 \
--speculative-config '{"method":"mtp","num_speculative_tokens":1,"index_share_for_mtp_iteration":true}'
(Notes: Without an NVLink bridge, replace -e NCCL_P2P_LEVEL=NVL with -e NCCL_P2P_DISABLE=1 -e NCCL_CUMEM_ENABLE=0. On hosts with NVIDIA Driver 580 / CUDA 13.0, add -e NVIDIA_DISABLE_REQUIRE=1. On low-RAM hosts <48 GB free, swap the engram flags for --engram-config.disk_offload true.)
License, Attribution & Change Notice (Apache-2.0 §4b)
Derived from Qwen/Qwen4-35B-A3B (Apache-2.0) and reusing the official FP8 N-gram/PLE table bytes from Qwen/Qwen4-35B-A3B-FP8 (Apache-2.0) by Alibaba Cloud Qwen Team.
Changes made:
- Applied norm-preserving orthogonal projection over the pre-norm 4-stream Hyper-Connection rank-2 refusal subspace to selected BF16 language-model output projections and token embeddings to reduce refusal behavior.
- Quantized routed MoE expert weights (40 decoder layers + MTP layer) to symmetric INT4
group_size=32(compressed-tensorspack-quantized). - Replaced the BF16 N-gram PLE table with the official FP8 E4M3 shards + scale and updated
config.json(quantization_config,text_config.ple_embedding_dtype) andmodel.safetensors.index.json.
Unofficial community derivative; not affiliated with or endorsed by the Qwen Team. Provided AS-IS without warranty.