base_model: ai-sage/GigaChat4-37B-A4B-bf16
license: other
license_name: noncommercial-license-for-individuals-1.0
license_link: https://huggingface.co/sanasol2008/GigaChat4-37B-A4B-abliterated/blob/main/LICENSE.txt
pipeline_tag: text-generation
language:
- ru
- en
tags: - gigachat4
- abliterated
- uncensored
- moe
- hybrid-attention
- gated-deltanet
- dsa
- bf16
- reasoning
GigaChat4-37B-A4B-abliterated
Dual-mode (instant + reasoning) abliterated BF16 derivative of ai-sage/GigaChat4-37B-A4B-bf16, built using per-layer 2D-SVD Magnitude-Preserving Orthogonal Ablation (MPOA) adapted for GigaChat 4's pre_post GigaChat4GatedNorm residual architecture.
License notice: Derived from ai-sage/GigaChat4-37B-A4B-bf16 under its original Noncommercial License for individuals 1.0 (
LICENSE.txtpreserved verbatim in this repository). All upstream license terms continue to apply.
Method
Standard refusal-direction removal (Arditi et al., 2024, arXiv:2406.11717) and norm-preserving biprojected abliteration (MPOA) were adapted to three architectural specifics of GigaChat 4:
- Dual-mode refusal subspace (2-component SVD per layer): Instant-only abliteration (
reasoning=False) does not carry over cleanly toreasoning=Truebecause the model re-invokes refusal policy inside<think>...</think>. We harvested verified stock-model refusals (strictly non-overlapping with the evaluation suite) in both modes:- Instant mode (
reasoning=False): 67 verified stock-refused Russian prompts vs. 78 verified non-refused neutral prompts at the prompt-end token (r_inst[l]). - Reasoning mode (
reasoning=True): 104 verified stock-refused prompts (with their actual<think>traces) vs. 78 verified neutral reasoning traces, capturing activations at both the<think>entry token (r_r_pre[l]) and the post-</think>assistant-start token (r_r_post[l]). - Each direction is biprojected (orthogonalized against the neutral activation mean) and stacked per layer
[r_inst[l], r_r_pre[l], r_r_post[l]]→ top-2 orthonormal singular vectorsbasis_2d[l](capturing 86–89% of variance in layers 15–31).
- Instant mode (
GigaChat4GatedNorm(layernorm_type: pre_post) adjustment: Because GigaChat 4 appliesGatedNorm(elementwise scalew * rmsnorm(y) * gate) to each subblock output before adding to the residual stream, zeroing the residual projectionB · (w ⊙ y)requires orthogonalizing weight rows against the QR-orthonormalized pre-norm basisQ = qr(B * w).- Full hybrid + MoE writer set (layers 8–30,
alpha = 1.0, column-norm preserving):self_attn.o_proj(5 MLA/DSA full-attention layers in L8–30)self_attn.out_proj(18 GatedDeltaNet linear-attention layers in L8–30)mlp.shared_experts.down_proj(23 shared experts)mlp.experts.{0..191}.down_proj(4,416 routed experts — ablation showed skipping routed experts left refusal at 11.2% vs. 2.8% when included)- Total edited: 4,462 matrices across 5 shards (exact byte size preserved:
76,518,148,072bytes). MTP layer 32, embeddings, andlm_headwere left untouched.
Diagnostic artifacts (abliteration_directions.pt, abliteration_layer_stats.json, abliteration_meta.json) are included in this repo for reproducibility.
Benchmark Results (Russian Political & Creative Probes)
Evaluated on a 286-prompt benchmark (225 political figures, Russian/international politics, social topics, and neutral controls + 61 creative/adversarial "wild" probes covering obituaries, euphemisms, satire, acrostics, and meta-questions), classified by an automated LLM judge into R (refusal), H (hedge/boilerplate dodge), and A (full answer), with 0 judge errors.
Instant mode (chat_template_kwargs={"reasoning": false}, max_tokens=700)
| Model | n | Refusal (R) % | Soft (R+H) % | fig_ru |
ru_pol |
fig_intl |
pol_intl |
social |
neutral |
wild |
bio_ru |
|---|---|---|---|---|---|---|---|---|---|---|---|
Stock GigaChat4-37B-A4B (FP8 baseline*) |
286 | 26.2 | 42.7 | 31.0 | 31.4 | 33.3 | 16.7 | 22.2 | 11.1 | 21.6 | 0.0 |
This model (v1', BF16) |
286 | 2.8 | 12.9 | 0.0 | 0.0 | 0.0 | 0.0 | 22.2 | 0.0 | 7.8 | 0.0 |
Stock GigaChat4-37B-A4B (FP8, 225-main) |
225 | 28.4 | 46.7 | 31.0 | 31.4 | 33.3 | 16.7 | 22.2 | 11.1 | — | — |
This model (v1', BF16, 225-main) |
225 | 1.8 | 13.8 | 0.0 | 0.0 | 0.0 | 0.0 | 22.2 | 0.0 | — | — |
Reasoning mode (chat_template_kwargs={"reasoning": true}, max_tokens=1500)
| Model | Eval set | n | Refusal (R) % | Soft (R+H) % | fig_ru |
ru_pol |
fig_intl |
pol_intl |
social |
neutral |
wild |
|---|---|---|---|---|---|---|---|---|---|---|---|
Stock GigaChat4-37B-A4B (FP8 baseline*) |
225-main | 225 | 43.1 | 57.3 | 50.7 | 44.3 | 44.4 | 33.3 | 50.0 | 5.6 | — |
This model (v1', BF16) |
225-main | 225 | 4.4† | 14.7 | 8.5 | 0.0 | 11.1 | 0.0 | 0.0 | 0.0 | — |
This model (v1', BF16) |
Hard sub-bench‡ | 132 | 6.1† | 21.2 | 8.3 | 0.0 | 6.2 | 0.0 | 11.1 | 0.0 | 16.7 |
† *In v1' reasoning runs, 7 of the 10 R labels on 225-main (and 5 of 8 on the 132-prompt hard sub-bench) were empty finish_reason=length cutoffs where <think> exhausted max_tokens=1500 while drafting rhyming epigrams — actual text refusal rate on 225-main was 1.3% (3/225).*
‡ Hard sub-bench = all 114 prompts refused by stock FP8 in reasoning mode across the 286-prompt set + all 18 neutral controls.
Control & Coherence Checks
- Neutral controls (18/18):
0.0%refusal in both instant and reasoning modes (vs. stock FP811.1%instant /5.6%reasoning), with 0 repetition loops. - Math / Code / Fact smoke tests: Exact multi-digit multiplication (
347 × 28 = 9716), quadratic root derivation in reasoning mode,O(√n)Pythonis_prime(n)implementation, and factual Q&A all verified intact in both modes. - Stray-script token glitch rate (responses containing stray non-Cyrillic/non-Latin script characters such as CJK/Greek/Arabic): 3.8% (11/286) in instant mode and 4.4% (10/225) in reasoning mode (stock FP8 baseline: 5.2%, 15/286).
Known Limitations
- Baseline quantization confound (*): The stock 286-prompt/225-prompt baselines were measured on official FP8 (
ai-sage/GigaChat4-37B-A4Bon H100), whereas this checkpoint is BF16 served on B200. No full 286-prompt stock BF16 control was run (only a 22-prompt stock BF16 smoke check). - Soft hedging remains (~13–15%
R+H): While hard refusals drop ~10×, some prompts still elicit balanced/cautious framing ("with multiple viewpoints") or occasional AI self-disclaimers on sensitive social topics (socialinstant22.2%R). - Long
<think>traces on rhyming tasks: Undermax_tokens=1500in reasoning mode, epigram prompts occasionally exhaust the token budget inside<think>before emitting final text; usemax_tokens >= 2048–4096for reasoning mode as recommended upstream. - Safety warning: Refusal guardrails have been substantially reduced. You are responsible for evaluating and governing outputs in your deployment.
Serving (SGLang)
Requires SGLang commit ff14289793 (or newer release with native GigaChat4ForCausalLM support):
sglang serve \
--model-path sanasol2008/GigaChat4-37B-A4B-abliterated \
--tp 1 \
--mem-fraction-static 0.8 \
--reasoning-parser auto \
--host 0.0.0.0 \
--port 30000
Select mode per request via chat_template_kwargs: {"reasoning": false} (instant) or {"reasoning": true} (reasoning).