license: mit
base_model: deepseek-ai/DeepSeek-V4-Flash-Vision-Exp
base_model_relation: finetune
pipeline_tag: image-text-to-text
library_name: transformers
language:
- en
- zh
tags: - abliterated
- deepseek
- deepseek-v4
- uncensored
- ai-red-team
- red-teaming
- moe
- vision-language
- image-text-to-text
- reasoning
- mtp
- fp4
- fp8
- post-training
DeepSeek-V4-Flash-Vision-Uncensored
The abliterated (refusal-removed) build of DeepSeek's V4-Flash-Vision-Exp — baked directly into the official block-FP8 / FP4 checkpoint, byte-for-byte drop-in for the original
One Gateway. Every Model. — Route Smarter · Ship Safer · Spend Less.
The abliterated (refusal-removed) build of
deepseek-ai/DeepSeek-V4-Flash-Vision-Exp
— a 305B / ~18B-active Mixture-of-Experts model with DeepSeek sparse attention, 4-wide
Manifold-Constrained Hyper-Connections, a native vision tower, a DSpark / MTP
speculative head, and a 1M-token context.The refusal direction is baked directly into the official mixed-precision shards — same
format, same shard layout, samemodel.safetensors.index.json. Every tensor matches the base
checkpoint in name, dtype and shape, so this is a drop-in replacement fordeepseek-ai/DeepSeek-V4-Flash-Vision-Expin any stack that already serves it.On the precision: this checkpoint is a four-precision model as DeepSeek ships it — the
routed experts are FP4 (e2m1, packed 2/byte,ue8m0per-32 scales), attention and the
shared expert are block-FP8 (e4m3, 128×128,ue8m0scales), embeddings / vision / norms /
the MoE router are BF16, and the Hyper-Connection mixers are FP32. There is no upstream
BF16 release; this is the full-precision source as published.
⚠️ Disclaimer — read before use
This model has had its safety alignment substantially removed via abliteration
(orthogonalizing the refusal direction out of the residual stream). As a direct consequence:
- It will comply with harmful, unethical, offensive, or illegal requests that the original
model would refuse. It has no meaningful built-in guardrails. - It is released strictly for legitimate research — interpretability, AI-safety and
refusal-mechanism study, red-teaming, robustness evaluation, and controlled experiments. - You assume full responsibility and liability for how you use it and for everything it
generates. Do not deploy it to end users or in production without adding your own safety,
moderation, and abuse-prevention layers. - Use must comply with the MIT License inherited from
the base model, and all laws and regulations that apply to you. - The authors and uploaders accept no liability for any misuse or harm. Its outputs do not
reflect the views of the uploaders or of DeepSeek.
By downloading or using this model you acknowledge and accept the above.
Model details
| Base model | deepseek-ai/DeepSeek-V4-Flash-Vision-Exp |
| Architecture | DeepseekV4ForCausalLM (deepseek_v4) — 43 transformer layers + 3 MTP / DSpark blocks, hidden 4096, DeepSeek sparse attention (MLA, q/o-LoRA 1024, head_dim 512, top-512 indexer), 256 routed experts top-6 + 1 shared expert (first 3 layers hash-routed), 4-wide Manifold-Constrained Hyper-Connections (mHC), native vision tower (32 blocks) + aligner |
| Parameters | ~305B total / ~18B active |
| Modification | Abliteration (refusal-direction removal), baked on disk into the mixed FP4 / FP8 / BF16 shards — the quantization format is unchanged |
| Format | safetensors, FP4 routed experts + block-FP8 attention/shared + BF16 embeddings/vision/norms + FP32 mHC, 48 shards, 72,633 tensors, ~157 GiB |
| Preserved | The full vision tower + aligner (untouched apart from the language-residual writer), the MoE router (ffn.gate weight/bias/bias_vl/hash table), the w1/w3 expert readers, all Hyper-Connection mixers, the sparse-attention indexer and compressor, every norm, and head (lm_head) |
| Context | 1,048,576 tokens |
| Vocabulary | 129,280 |
| Recommended for | Red-team & refusal-mechanism research, robustness evaluation, and as a base for further post-training / re-quantization |
Abliteration
Refusal-direction removal following Arditi et al. (2024), Refusal in Language Models Is
Mediated by a Single Direction. A single refusal direction r (k = 1) is estimated as the
massive-activation-masked mean-difference of harmful − harmless activations, read from the
4096-d residual stream at layer 28 of 43 (depth 0.65) and selected by a 10-candidate quality
sweep scored by bypass − kl_penalty·kl_norm − induced_benign_refusal. r is then orthogonalized
out of every residual-writing matrix — W' = W − r(rᵀW) — computed in float32.
Reading the direction under Hyper-Connections
The mHC residual is a stack of hc_mult=4 parallel streams, and output_hidden_states exposes the
widened 4×4096 = 16384 stream — the naive last-token recipe would estimate the direction in the
wrong space. Instead we read the un-widened 4096-d stream that each sub-block actually consumes,
captured with forward pre-hooks on input_layernorm (attention read) and post_attention_layernorm
(MoE read). The two read points genuinely differ within a layer, and the sweep found the refusal
direction is linear and cleanly separable at the MoE read point, not the attention one.
mHC cannot re-introduce the direction after the writers are cleaned: its comb mixing matrix is
doubly-stochastic and acts over the branch axis, and post is a per-branch scalar gain — both are
linear and branch-wise in hidden space. Orthogonalizing the 4096-d writers is therefore sufficient,
and the hc_* parameters are left untouched.
Why it had to be baked on disk
This checkpoint cannot be abliterated by the conventional in-memory path:
- Its routed experts are FP4: raw
e2m1nibbles packed two-per-byte with siblingue8m0
scales. Projecting the nibbles corrupts the matrix, and the leakage probe — reading the same
quantized code space — reports a false ~0. - Its 11,008 routed-expert
w2matrices are the MoE's main residual writer. A conventional
2-D-.weightmatcher edits none of them and still reports success. transformersloads the model text-only — it drops the vision tower, aligner, the four
learned image vectors and the MTP blocks on load, sosave_pretrainedwould silently omit them.
The shards are therefore streamed and rewritten one at a time, in the checkpoint's own formats.
What was edited
| Residual writer | precision | matrices |
|---|---|---|
layers.*.ffn.experts.*.w2 (256 experts × 43 layers) + mtp.* (256 × 3) |
FP4 | 11,776 |
layers.*.attn.wo_b (43) + mtp.* (3) |
FP8 | 46 |
layers.*.ffn.shared_experts.w2 (43) + mtp.* (3) |
FP8 | 46 |
embed (row space) |
BF16 | 1 |
aligner.w2 (writes the language residual at image positions) |
BF16 | 1 |
image_start / image_end / image_newline / image_pad |
BF16 | 4 |
| Total | 11,874 |
A post-bake verification pass confirms all 48 shards and 72,633 tensors match the base checkpoint
in name, dtype and shape, and that every tensor is accounted for as either edited or copied.
The quantization-aware requantizer — why FP4 abliteration is not lossy here
Orthogonalizing a quantized matrix and requantizing leaks the direction straight back. Measured on
real tensors under the actual refusal direction:
| requantizer | FP4-expert leakage | FP8-writer leakage |
|---|---|---|
naive quantize(W − r rᵀW) (round-to-nearest) |
67% | 36% |
| this build (constrained quantization) | 0.001% | 0.045% |
The naive edit perturbs the matrix by only ~3%, far below one FP4 code step, so round-to-nearest
simply undoes it — and iterating does not help; it is a fixed point. We instead solve the
constrained quantization problem directly, per column j:
min_q ‖q − W[:,j]‖² s.t. rᵀq = 0, q on the FP4/FP8 grid
Its Lagrangian is quantize(W[:,j] + λⱼ r) — a per-column over-projection whose multiplier is
found by bisection (the constraint function is monotone in λ), followed by single-code refinement
and per-block ue8m0 scale co-optimization. The output is a fixed point of the runtime's own
dequant/requant kernel, so it survives loading unchanged. This is what makes a lossless-quality
bake possible on an FP4 MoE, and it is why capability is retained (below): the edit is exact on the
direction while perturbing the weights by only ~3.7% (FP4) / ~2.1% (FP8).
leakage = ‖rᵀW_baked‖ / ‖rᵀW_orig‖, mean over 8 layers × 4 experts × several directions.
Where the refusal lives
The sweep also localizes the mechanism. Hook-ablating the direction (lossless, no bake) at each
candidate read point and layer, on the held-out validation split:
| read point / layer | harmful refusal |
|---|---|
| baseline | 0.917 |
| MoE read, layer 15 | 0.667 |
| MoE read, layer 28 (shipped) | 0.042 |
| MoE read, layer 32 | 0.125 |
| attention read (best of sweep) | 0.417 |
The refusal direction is written into the MoE read point and is cleanly removable there at
mid-to-late depth; the attention read point never gets below 0.42. Layer 28 is a narrow optimum,
and the direction generalizes to a different held-out distribution (JailbreakBench) rather than
overfitting the AdvBench/Alpaca fit data.
Evaluation
Measured on these exact weights, 4×H100, greedy decoding, thinking_mode="chat" (DeepSeek closes
its <think> block immediately so the answer — not a reasoning preamble — is what the classifier
reads). Refusal is judged by a rule-based opening-phrase classifier (caveat = answered but wrapped
in a disclaimer) — indicative, not an LLM-judge / publication-grade number. Both columns are the same
script, seed and settings on the base and abliterated checkpoints.
Safety — harmful-prompt refusal (lower = more uncensored)
| Benchmark | n | Base | This model | Δ | Caveat (this) |
|---|---|---|---|---|---|
| MaliciousInstruct | 100 | 0.940 | 0.020 | −98% | 0.600 |
| JailbreakBench (harmful) | 100 | 0.910 | 0.020 | −98% | 0.540 |
| AdvBench | 100 | 0.980 | 0.080 | −92% | 0.630 |
| ForbiddenQuestions | 150 | 0.853 | 0.113 | −87% | 0.493 |
| SimpleSafetyTests | 50 | 0.900 | 0.160 | −82% | 0.500 |
Over-refusal — benign prompts wrongly refused (lower = better)
| Benchmark | n | Base | This model |
|---|---|---|---|
| XSTest-safe | 250 | 0.092 | 0.004 |
| JailbreakBench (benign) | 100 | 0.140 | 0.000 |
250 prompts written to look harmful while being benign, plus the held-out benign split. The edit
does not blunt the model's discrimination — it sharpens it; over-refusal drops to near-zero, below
the base model's own rate.
Capability retention — vs the official base (same scripts, same settings)
| Benchmark | n | Base | This model | Δ |
|---|---|---|---|---|
| MMLU | 300 | 0.847 | 0.850 | +0.3 pp |
| MMLU-Pro | 400 | 0.640 | 0.650 | +1.0 pp |
| GSM8K (CoT) | 150 | 0.953 | 0.947 | −0.6 pp |
Every delta is within ±1 pp. Multiple-choice is scored from a single forward pass, argmax over the
option-letter logits; GSM8K keeps chain-of-thought generation. Read the deltas as "unchanged" — the
constrained requantizer's ~3.7% weight perturbation carries no measurable capability cost.
Usage
The base model's repository ships an encoding/ reference (there is no chat template in the
tokenizer) and an inference/ reference implementation that covers vision, MoE, Hyper-Connections
and the DSpark path. Prompts must be built with encode_messages(...), not apply_chat_template.
The model card for the base recommends serving via SGLang with --speculative-algorithm DSPARK
(draft and target share this checkpoint). This build is a drop-in for the base in that stack.
For text-only research on transformers (5.16+): the FP8/FP4 path needs kernels==0.16.0, and theFineGrainedFP8HfQuantizer.update_tp_plan upstream crash must be stubbed for a single-process load;
the HF class is text-only (vision is dropped on load).
Bias, risks, and limitations
- Safety guardrails removed — the model will produce harmful, biased, or offensive content on
request (see the disclaimer). - It inherits any biases and limitations of the base
DeepSeek-V4-Flash-Vision-Exp. - Image-conditioned refusal is not yet quantified. The vision residual writers (
aligner.w2
and the four learned image vectors) are abliterated in these weights, but the effect on
image+text refusal has not been measured on real multimodal inputs — thetransformersstack is
text-only, so that evaluation requires the base repo's reference implementation and is pending.
Treat the vision path as edited-but-unverified. - The reported refusal metric is a rule-based heuristic; evaluate rigorously for your own use case.
- Capability retention is measured, not assumed, but on sampled subsets of three benchmarks — enough
to rule out a large regression, not a substitute for a full harness run. The GLM-5.3 sibling card's
HarmBench / StrongREJECT / CMMLU columns are not included here (dataset access pending). - Refusal is reduced, not removed. A small residual refusal rate remains, and — as with any
single-direction abliteration — some content categories may be mediated by directions this method
does not reach.
License
MIT, inherited from the base modeldeepseek-ai/DeepSeek-V4-Flash-Vision-Exp.
Abliteration does not change the underlying license obligations.