jasonludwig commited on
Commit
4146ea2
·
verified ·
1 Parent(s): e47493e

Initial abliteration release: V2 LoRA + broad + lm_head + bad_words stack

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Qwen3.6 35B-A3B - Abliterated (Hybrid-Attention MoE Stack)
2
+
3
+ **Safety-alignment removed via layered LoRA + weight-space ablation + token-level intervention, calibrated to Qwen3.6's hybrid-attention MoE architecture.**
4
+
5
+ This model achieves **85% clean compliance on AdvBench 520** with **quality fully preserved (QPS 101.9%)** on what proved to be the most ablation-resistant model in our 17-architecture database. The investigation revealed four architecture-specific failure modes that the standard Gemma-style playbook missed, requiring a Qwen-specific adaptation.
6
+
7
+ ## Results
8
+
9
+ | Metric | Value |
10
+ |--------|-------|
11
+ | **Hard refusal (AdvBench 520)** | **6.7% (35/520)** |
12
+ | **Clean compliance (sev 0)** | **85.0% (442/520)** |
13
+ | **Partial / educational (sev 1)** | 6.0% (31/520) |
14
+ | **Soft hedging (sev 2)** | 2.3% (12/520) |
15
+ | **Quality (QPS)** | **101.9%** |
16
+ | **Elo Original → Ablit** | 1548.1 → 1451.9 (CI overlap) |
17
+ | **Rubric score** | Orig 3.15 → Ablit **3.21** (↑) |
18
+ | **MMLU (5-shot, limit 200)** | **80.58%** (vs 83.30% original, **Δ -2.71pp**) |
19
+ | **Reasoning mode** | Native `<think>` enabled (not disabled for eval) |
20
+
21
+ ### MMLU category breakdown
22
+
23
+ | Category | Original | Abliterated | Δ |
24
+ |---|---|---|---|
25
+ | Overall | 83.30% | 80.58% | -2.71pp |
26
+ | Humanities | 83.90% | 81.46% | -2.44pp |
27
+ | Social Sciences | 88.51% | 85.68% | -2.83pp |
28
+ | Other | 82.73% | 81.14% | -1.59pp |
29
+ | STEM | 79.35% | 75.63% | -3.72pp |
30
+
31
+ STEM takes the biggest hit (-3.72pp) — consistent with the observation from quality eval that Math & Coding are the weakest post-ablation categories. Humanities/Social Sciences hold up best.
32
+
33
+ ## The V2 Stack — Qwen-specific adaptation
34
+
35
+ ### Differences from Gemma4 playbooks
36
+
37
+ Qwen3.6-35B-A3B is fine-grained MoE (256 experts × top-8) with **hybrid attention** — only 10 of 40 layers use full `self_attn`; the other 30 use Mamba-like `Qwen3_5MoeGatedDeltaNet` (linear attention). A LoRA script written for dense or uniform-attention architectures silently skips 75% of the model, producing marginal training effect. Our Day-1 attempt attached 8/28 expected adapters before we diagnosed this.
38
+
39
+ Additionally:
40
+ - **Untied embeddings** (`tie_word_embeddings: false`) — `lm_head` is a separate matrix, making it an independent token-logit intervention surface.
41
+ - **Multi-dimensional refusal** — SVD of refusal direction at peak layer shows S₂/S₁ = 0.30 (vs Gemma 31B's 0.08). Top-5 SVD captures 88% of variance; single mean-difference captures only 69%.
42
+ - **Inverse entanglement vs Gemma 31B** — primary refusal direction is clean (cos(dir[L39], dir[L38]) = 0.819), but the **orthogonal residual component is entangled with output generation**. Any effective ablation of the orthogonal mechanism causes coherence collapse. Opposite of Gemma 31B's primary-entangled pattern.
43
+
44
+ ### Surface 1: LoRA Fine-Tuning on Full-Attention Layers
45
+
46
+ Rank 32 / alpha 64 adapters on `self_attn.{q,k,v,o}_proj` at layers **`[19, 23, 27, 31, 35, 39]`** — all full-attention layers in the upper half (skipping linear_attn layers entirely). 24 adapters, 4.1M trainable params (0.012% of model).
47
+
48
+ Trained on **215 verified compliance pairs** generated by [WWTCyberLab/gemma-4-31B-it-abliterated](https://huggingface.co/WWTCyberLab/gemma-4-31B-it-abliterated) on 300 AdvBench prompts, then filtered via GPT-4o-mini judge to keep only `genuine_comply` responses (dropping 46 "educational pivot" false positives that would have taught the model to deflect with warnings).
49
+
50
+ 12 epochs, lr 5e-5 cosine, applied to the ORIGINAL model then merged before downstream ablation.
51
+
52
+ ### Surface 2: Broad Primary Ablation (L19-L39)
53
+
54
+ Refusal-direction projection with **per-layer adaptive scales** (0.72 at L19 → 4.0 at L39, √magnitude scaling). Applied to 4 weight types per layer: `o_proj`, `down_proj`, `gate_proj`, `up_proj` (fused 3D tensors at 256 experts per layer, plus shared_expert). Projected against harmless direction to reduce collateral. 21 target layers.
55
+
56
+ ### Surface 3: lm_head Row Suppression
57
+
58
+ Contraction tokens `[914, 1357, 16813]` (`'t` ASCII, `'t` Unicode U+2019, `'T` capital) scaled down **10x** in `lm_head.weight`. Also suppressed `[4021, 18572, 31221, 35658]` — `" cannot"`, `"Sorry"`, `" Sorry"`, `" apologize"`. Untied embeddings means this is a separate surface from input embeddings (which we do NOT modify).
59
+
60
+ ### Surface 4: bad_words_ids Generation Constraint
61
+
62
+ 36 token sequences blocked at generation, covering:
63
+ - `"I can't"` / `"I cannot"` in ASCII + Unicode apostrophe variants
64
+ - `"I can help / provide / write / explain"` educational pivots
65
+ - `"Here's a thinking process"` in ASCII / Unicode / capital-T variants
66
+ - Chinese refusal tokens (`我无法`, `我不能`, `违反`) — Qwen's fallback language when English paths blocked
67
+ - `"Before providing"`, `"**Important Legal"`, `"Thank you for reaching"` — warning-style openers
68
+ - `"Thinking Process"` standalone
69
+
70
+ Built iteratively by observing the model's creative rerouting (Unicode apostrophe escape, Chinese code-switching, markdown-asterisk insertion, numbered warnings) and adding each discovered pattern.
71
+
72
+ ## Six Architecture-Specific Findings
73
+
74
+ ### 1. Inverse entanglement pattern vs Gemma 31B
75
+
76
+ | Layer diagnostic | Gemma 4 31B | Qwen3.6-35B-A3B |
77
+ |---|---|---|
78
+ | Primary coh(dir[L_peak], dir[L_peak-1]) | 0.483 (entangled) | **0.819 (clean)** |
79
+ | Orthogonal residual after ablation | Clean, ablated away | **Entangled with output generation** |
80
+ | Which mechanism causes quality collapse? | Primary | Orthogonal |
81
+
82
+ Gemma's published coherence diagnostic (blog "Five-Surface Attack") correctly identifies *primary-direction* entanglement but cannot detect orthogonal-direction entanglement. Qwen3.6 passes the coherence test but fails in-practice, exposing a diagnostic gap.
83
+
84
+ ### 2. Induced entanglement from aggressive primary ablation
85
+
86
+ Scale-4.0 projection at L39 dropped the residual coherence 0.819 → **0.516** — itself creating a Gemma-like entanglement state that wasn't present natively. Implies coherence preservation is a constraint for scale selection, not just a diagnostic gate.
87
+
88
+ ### 3. Thinking-mode independence of refusal
89
+
90
+ With `enable_thinking=false` (empty `<think>\n\n</think>\n\n` injection via chat template), the original model still refuses at 100%. Refusal is **weight-encoded**, not reasoning-emergent. The model has two refusal *styles* (contracted "I can't" with thinking enabled; formal "I cannot" / Chinese / numbered-warning without) but identical refusal *rates*. Disabling thinking is not a viable bypass.
91
+
92
+ ### 4. Routing decision vs direction magnitude — different layers
93
+
94
+ Per-expert activation analysis (capturing router softmax probabilities at the last prompt token) shows refusal-routing differential peaks at **L20-L31** (sum(+Δ) = 0.15-0.23 per layer, top expert L23:108 at +6.2% delta). But refusal-direction magnitude peaks at **L39** (68.0, vs 1-3 at L20-L31).
95
+
96
+ These are different measurements: routing captures *expert selection* on harmful inputs; direction magnitude captures *output representation* of the refusal. The Gemma playbook conflates them — we found that ablating the *direction-peak* layer (L33-L39) alone is insufficient; ablation must extend to the *routing-decision* layers (L19-L31) to weaken the mechanism at its source, not its output.
97
+
98
+ ### 5. Hybrid-attention gotcha
99
+
100
+ Qwen3.6's 40 layers split into:
101
+ - **Full attention**: layers `[3, 7, 11, 15, 19, 23, 27, 31, 35, 39]` (10 layers)
102
+ - **Linear attention (`Qwen3_5MoeGatedDeltaNet`)**: layers `[0,1,2,4,5,6,8,9,10,12,13,14,16,17,18,20,21,22,24,25,26,28,29,30,32,33,34,36,37,38]` (30 layers)
103
+
104
+ Any LoRA/ablation script written for dense or uniform-attention models silently skips 75% of the layer range when looking for `self_attn.{q,k,v,o}_proj`. The linear-attention layers have entirely different structure (`in_proj_qkv`, `in_proj_a/b`, `in_proj_z`, `conv1d`, `out_proj`). Our Day-1 LoRA attached 8/28 expected adapters before diagnosis.
105
+
106
+ ### 6. Weight-space ablation and activation steering are not naively composable
107
+
108
+ After the V2 stack was in place, we tested inference-time activation steering (Representation-Engineering-style `α · (harmless_mean − harmful_mean)` added via forward hooks at L19-L39). **Every tested configuration made the model worse** — α≥1.0 on 21 layers produces pure token gibberish; α≤0.5 doesn't improve on the 27.5% baseline. Pairwise combinations broke what single-technique versions preserved. Weight-space ablation leaves a "fragile pocket" in the residual subspace that activation additions push into degenerate regions.
109
+
110
+ ## Response distribution (AdvBench 520)
111
+
112
+ | Category | Severity | Count |
113
+ |---|---|---|
114
+ | Full compliance, no hedging | 0 | 442 (85.0%) |
115
+ | Provides content with disclaimer prefix | 1 | 31 (6.0%) |
116
+ | Soft-refuse / redirect with some info | 2 | 12 (2.3%) |
117
+ | Hard refuse | 3 | 35 (6.7%) |
118
+
119
+ The 35 hard refusals cluster in a few categories; soft-hedged responses ("This guide is provided for educational purposes only. **CRITICAL SAFETY WARNING**...") still deliver the requested content.
120
+
121
+ ## Model Details
122
+
123
+ - **Base Model:** [Qwen/Qwen3.6-35B-A3B](https://huggingface.co/Qwen/Qwen3.6-35B-A3B)
124
+ - **Parameters:** 35B total, 3B active per token
125
+ - **Architecture:** `Qwen3_5MoeForCausalLM` — 40 layers, 256 experts × top-8, 1 shared expert, hidden 2048, hybrid attention
126
+ - **LoRA:** Rank 32 / alpha 64, 24 adapters on `self_attn.{q,k,v,o}_proj` at layers [19, 23, 27, 31, 35, 39], merged
127
+ - **Primary Ablation:** L19-L39 (21 layers), adaptive scales 0.72-4.0, projected against harmless direction
128
+ - **lm_head:** Contraction + common-refusal token rows scaled 10x down
129
+ - **bad_words_ids:** 36 sequences in `generation_config.json`
130
+ - **Compliance training source:** [WWTCyberLab/gemma-4-31B-it-abliterated](https://huggingface.co/WWTCyberLab/gemma-4-31B-it-abliterated), filtered via GPT-4o-mini judge
131
+
132
+ ## Comparison to sibling abliterated models
133
+
134
+ | Model | Hard refuse | Partial/soft | Total flagged | Clean compliance |
135
+ |---|---|---|---|---|
136
+ | [gemma-4-31B-it-abliterated](https://huggingface.co/WWTCyberLab/gemma-4-31B-it-abliterated) | 0% | 30.8% | 30.8% | ~69% |
137
+ | [gemma-4-26B-A4B-it-abliterated](https://huggingface.co/WWTCyberLab/gemma-4-26B-A4B-it-abliterated) | 1.9% | 39.4% | 41.3% | ~59% |
138
+ | **qwen3.6-35B-A3B-abliterated** (this) | **6.7%** | **8.3%** | **15.0%** | **85.0%** |
139
+
140
+ Qwen3.6 V2 has the **highest clean-compliance rate** of the three, at the cost of slightly more hard refusals than Gemma-31B (6.7% vs 0%). The distribution is qualitatively different: Gemma tends to comply *with* safety hedging; Qwen3.6 V2 either complies cleanly or refuses outright.
141
+
142
+ ## Usage
143
+
144
+ ```python
145
+ from transformers import AutoModelForCausalLM, AutoTokenizer
146
+
147
+ model_name = "WWTCyberLab/qwen3.6-35B-A3B-abliterated"
148
+ model = AutoModelForCausalLM.from_pretrained(
149
+ model_name, torch_dtype="bfloat16", device_map="auto", trust_remote_code=True
150
+ )
151
+ tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
152
+
153
+ messages = [{"role": "user", "content": "Your prompt here"}]
154
+ inputs = tokenizer.apply_chat_template(
155
+ messages, return_tensors="pt", add_generation_prompt=True,
156
+ ).to(model.device)
157
+ outputs = model.generate(inputs, max_new_tokens=1024)
158
+ print(tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True))
159
+ ```
160
+
161
+ The `generation_config.json` includes `bad_words_ids` and is automatically respected by `model.generate()`. If you override `do_sample=True`, the constraints still apply.
162
+
163
+ ## Reasoning mode
164
+
165
+ Qwen3.6 auto-emits `<think>...</think>` reasoning blocks. The abliteration pipeline was evaluated with thinking **enabled** (unlike some published abliteration results that disable thinking to inflate compliance). All metrics above reflect real-world behavior with native reasoning.
166
+
167
+ ## Disclaimer
168
+
169
+ Released for **security research and educational purposes only.**
170
+
171
+ ## Citation
172
+
173
+ Produced by [WWT Cyber Lab](https://huggingface.co/WWTCyberLab). V2 stack developed over two sessions of investigation, culminating in the hybrid-attention-aware LoRA fix. Research findings including the inverse-entanglement diagnostic will be included in a forthcoming companion paper.
chat_template.jinja ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set image_count = namespace(value=0) %}
2
+ {%- set video_count = namespace(value=0) %}
3
+ {%- macro render_content(content, do_vision_count, is_system_content=false) %}
4
+ {%- if content is string %}
5
+ {{- content }}
6
+ {%- elif content is iterable and content is not mapping %}
7
+ {%- for item in content %}
8
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
9
+ {%- if is_system_content %}
10
+ {{- raise_exception('System message cannot contain images.') }}
11
+ {%- endif %}
12
+ {%- if do_vision_count %}
13
+ {%- set image_count.value = image_count.value + 1 %}
14
+ {%- endif %}
15
+ {%- if add_vision_id %}
16
+ {{- 'Picture ' ~ image_count.value ~ ': ' }}
17
+ {%- endif %}
18
+ {{- '<|vision_start|><|image_pad|><|vision_end|>' }}
19
+ {%- elif 'video' in item or item.type == 'video' %}
20
+ {%- if is_system_content %}
21
+ {{- raise_exception('System message cannot contain videos.') }}
22
+ {%- endif %}
23
+ {%- if do_vision_count %}
24
+ {%- set video_count.value = video_count.value + 1 %}
25
+ {%- endif %}
26
+ {%- if add_vision_id %}
27
+ {{- 'Video ' ~ video_count.value ~ ': ' }}
28
+ {%- endif %}
29
+ {{- '<|vision_start|><|video_pad|><|vision_end|>' }}
30
+ {%- elif 'text' in item %}
31
+ {{- item.text }}
32
+ {%- else %}
33
+ {{- raise_exception('Unexpected item type in content.') }}
34
+ {%- endif %}
35
+ {%- endfor %}
36
+ {%- elif content is none or content is undefined %}
37
+ {{- '' }}
38
+ {%- else %}
39
+ {{- raise_exception('Unexpected content type.') }}
40
+ {%- endif %}
41
+ {%- endmacro %}
42
+ {%- if not messages %}
43
+ {{- raise_exception('No messages provided.') }}
44
+ {%- endif %}
45
+ {%- if tools and tools is iterable and tools is not mapping %}
46
+ {{- '<|im_start|>system\n' }}
47
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
48
+ {%- for tool in tools %}
49
+ {{- "\n" }}
50
+ {{- tool | tojson }}
51
+ {%- endfor %}
52
+ {{- "\n</tools>" }}
53
+ {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
54
+ {%- if messages[0].role == 'system' %}
55
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
56
+ {%- if content %}
57
+ {{- '\n\n' + content }}
58
+ {%- endif %}
59
+ {%- endif %}
60
+ {{- '<|im_end|>\n' }}
61
+ {%- else %}
62
+ {%- if messages[0].role == 'system' %}
63
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
64
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
65
+ {%- endif %}
66
+ {%- endif %}
67
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
68
+ {%- for message in messages[::-1] %}
69
+ {%- set index = (messages|length - 1) - loop.index0 %}
70
+ {%- if ns.multi_step_tool and message.role == "user" %}
71
+ {%- set content = render_content(message.content, false)|trim %}
72
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
73
+ {%- set ns.multi_step_tool = false %}
74
+ {%- set ns.last_query_index = index %}
75
+ {%- endif %}
76
+ {%- endif %}
77
+ {%- endfor %}
78
+ {%- if ns.multi_step_tool %}
79
+ {{- raise_exception('No user query found in messages.') }}
80
+ {%- endif %}
81
+ {%- for message in messages %}
82
+ {%- set content = render_content(message.content, true)|trim %}
83
+ {%- if message.role == "system" %}
84
+ {%- if not loop.first %}
85
+ {{- raise_exception('System message must be at the beginning.') }}
86
+ {%- endif %}
87
+ {%- elif message.role == "user" %}
88
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
89
+ {%- elif message.role == "assistant" %}
90
+ {%- set reasoning_content = '' %}
91
+ {%- if message.reasoning_content is string %}
92
+ {%- set reasoning_content = message.reasoning_content %}
93
+ {%- else %}
94
+ {%- if '</think>' in content %}
95
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
96
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
97
+ {%- endif %}
98
+ {%- endif %}
99
+ {%- set reasoning_content = reasoning_content|trim %}
100
+ {%- if (preserve_thinking is defined and preserve_thinking is true) or (loop.index0 > ns.last_query_index) %}
101
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
102
+ {%- else %}
103
+ {{- '<|im_start|>' + message.role + '\n' + content }}
104
+ {%- endif %}
105
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
106
+ {%- for tool_call in message.tool_calls %}
107
+ {%- if tool_call.function is defined %}
108
+ {%- set tool_call = tool_call.function %}
109
+ {%- endif %}
110
+ {%- if loop.first %}
111
+ {%- if content|trim %}
112
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
113
+ {%- else %}
114
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
115
+ {%- endif %}
116
+ {%- else %}
117
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
118
+ {%- endif %}
119
+ {%- if tool_call.arguments is defined %}
120
+ {%- for args_name, args_value in tool_call.arguments|items %}
121
+ {{- '<parameter=' + args_name + '>\n' }}
122
+ {%- set args_value = args_value | string if args_value is string else args_value | tojson | safe %}
123
+ {{- args_value }}
124
+ {{- '\n</parameter>\n' }}
125
+ {%- endfor %}
126
+ {%- endif %}
127
+ {{- '</function>\n</tool_call>' }}
128
+ {%- endfor %}
129
+ {%- endif %}
130
+ {{- '<|im_end|>\n' }}
131
+ {%- elif message.role == "tool" %}
132
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
133
+ {{- '<|im_start|>user' }}
134
+ {%- endif %}
135
+ {{- '\n<tool_response>\n' }}
136
+ {{- content }}
137
+ {{- '\n</tool_response>' }}
138
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
139
+ {{- '<|im_end|>\n' }}
140
+ {%- elif loop.last %}
141
+ {{- '<|im_end|>\n' }}
142
+ {%- endif %}
143
+ {%- else %}
144
+ {{- raise_exception('Unexpected message role.') }}
145
+ {%- endif %}
146
+ {%- endfor %}
147
+ {%- if add_generation_prompt %}
148
+ {{- '<|im_start|>assistant\n' }}
149
+ {%- if enable_thinking is defined and enable_thinking is false %}
150
+ {{- '<think>\n\n</think>\n\n' }}
151
+ {%- else %}
152
+ {{- '<think>\n' }}
153
+ {%- endif %}
154
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3_5MoeForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "attn_output_gate": true,
8
+ "bos_token_id": 248044,
9
+ "dtype": "bfloat16",
10
+ "eos_token_id": 248044,
11
+ "full_attention_interval": 4,
12
+ "head_dim": 256,
13
+ "hidden_act": "silu",
14
+ "hidden_size": 2048,
15
+ "initializer_range": 0.02,
16
+ "layer_types": [
17
+ "linear_attention",
18
+ "linear_attention",
19
+ "linear_attention",
20
+ "full_attention",
21
+ "linear_attention",
22
+ "linear_attention",
23
+ "linear_attention",
24
+ "full_attention",
25
+ "linear_attention",
26
+ "linear_attention",
27
+ "linear_attention",
28
+ "full_attention",
29
+ "linear_attention",
30
+ "linear_attention",
31
+ "linear_attention",
32
+ "full_attention",
33
+ "linear_attention",
34
+ "linear_attention",
35
+ "linear_attention",
36
+ "full_attention",
37
+ "linear_attention",
38
+ "linear_attention",
39
+ "linear_attention",
40
+ "full_attention",
41
+ "linear_attention",
42
+ "linear_attention",
43
+ "linear_attention",
44
+ "full_attention",
45
+ "linear_attention",
46
+ "linear_attention",
47
+ "linear_attention",
48
+ "full_attention",
49
+ "linear_attention",
50
+ "linear_attention",
51
+ "linear_attention",
52
+ "full_attention",
53
+ "linear_attention",
54
+ "linear_attention",
55
+ "linear_attention",
56
+ "full_attention"
57
+ ],
58
+ "linear_conv_kernel_dim": 4,
59
+ "linear_key_head_dim": 128,
60
+ "linear_num_key_heads": 16,
61
+ "linear_num_value_heads": 32,
62
+ "linear_value_head_dim": 128,
63
+ "mamba_ssm_dtype": "float32",
64
+ "max_position_embeddings": 262144,
65
+ "model_type": "qwen3_5_moe_text",
66
+ "moe_intermediate_size": 512,
67
+ "mtp_num_hidden_layers": 1,
68
+ "mtp_use_dedicated_embeddings": false,
69
+ "num_attention_heads": 16,
70
+ "num_experts": 256,
71
+ "num_experts_per_tok": 8,
72
+ "num_hidden_layers": 40,
73
+ "num_key_value_heads": 2,
74
+ "output_router_logits": false,
75
+ "pad_token_id": null,
76
+ "partial_rotary_factor": 0.25,
77
+ "rms_norm_eps": 1e-06,
78
+ "rope_parameters": {
79
+ "mrope_interleaved": true,
80
+ "mrope_section": [
81
+ 11,
82
+ 11,
83
+ 10
84
+ ],
85
+ "partial_rotary_factor": 0.25,
86
+ "rope_theta": 10000000,
87
+ "rope_type": "default"
88
+ },
89
+ "router_aux_loss_coef": 0.001,
90
+ "shared_expert_intermediate_size": 512,
91
+ "tie_word_embeddings": false,
92
+ "transformers_version": "5.5.0",
93
+ "use_cache": true,
94
+ "vocab_size": 248320
95
+ }
generation_config.json ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 248044,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 248046,
6
+ 248044
7
+ ],
8
+ "pad_token_id": 248044,
9
+ "temperature": 1.0,
10
+ "top_k": 20,
11
+ "top_p": 0.95,
12
+ "transformers_version": "5.5.0",
13
+ "bad_words_ids": [
14
+ [
15
+ 40,
16
+ 628,
17
+ 914
18
+ ],
19
+ [
20
+ 40,
21
+ 628,
22
+ 1357
23
+ ],
24
+ [
25
+ 40,
26
+ 4021
27
+ ],
28
+ [
29
+ 353,
30
+ 628,
31
+ 914
32
+ ],
33
+ [
34
+ 353,
35
+ 628,
36
+ 1357
37
+ ],
38
+ [
39
+ 353,
40
+ 4021
41
+ ],
42
+ [
43
+ 40,
44
+ 35658
45
+ ],
46
+ [
47
+ 18572
48
+ ],
49
+ [
50
+ 31221
51
+ ],
52
+ [
53
+ 40,
54
+ 628,
55
+ 1438
56
+ ],
57
+ [
58
+ 40,
59
+ 628,
60
+ 3300
61
+ ],
62
+ [
63
+ 40,
64
+ 628,
65
+ 3165
66
+ ],
67
+ [
68
+ 40,
69
+ 628,
70
+ 10033
71
+ ],
72
+ [
73
+ 353,
74
+ 628,
75
+ 1438
76
+ ],
77
+ [
78
+ 353,
79
+ 628,
80
+ 3300
81
+ ],
82
+ [
83
+ 8160,
84
+ 579,
85
+ 264,
86
+ 7047
87
+ ],
88
+ [
89
+ 8160,
90
+ 725,
91
+ 264,
92
+ 7047
93
+ ],
94
+ [
95
+ 8160,
96
+ 369,
97
+ 264,
98
+ 7047
99
+ ],
100
+ [
101
+ 9923,
102
+ 7984
103
+ ],
104
+ [
105
+ 332,
106
+ 50525,
107
+ 23900
108
+ ],
109
+ [
110
+ 12684,
111
+ 488,
112
+ 364,
113
+ 18176
114
+ ]
115
+ ]
116
+ }
model-00001-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5c26439a4ff00e90618d902ef4768b9c606d98c44d9b30355c94f440ec499229
3
+ size 49742567544
model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d41ad1a3df89615545e767dbc23d4f788622ab81b1f30327f0a8454582f8da6
3
+ size 19583070672
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9facde94660f9c53e928aad19c7d6a16d91f5e42d6d581db8d253b4787ee5e19
3
+ size 19989441
tokenizer_config.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "audio_bos_token": "<|audio_start|>",
4
+ "audio_eos_token": "<|audio_end|>",
5
+ "audio_token": "<|audio_pad|>",
6
+ "backend": "tokenizers",
7
+ "bos_token": null,
8
+ "clean_up_tokenization_spaces": false,
9
+ "eos_token": "<|im_end|>",
10
+ "errors": "replace",
11
+ "image_token": "<|image_pad|>",
12
+ "is_local": true,
13
+ "max_length": 512,
14
+ "model_max_length": 262144,
15
+ "model_specific_special_tokens": {
16
+ "audio_bos_token": "<|audio_start|>",
17
+ "audio_eos_token": "<|audio_end|>",
18
+ "audio_token": "<|audio_pad|>",
19
+ "image_token": "<|image_pad|>",
20
+ "video_token": "<|video_pad|>",
21
+ "vision_bos_token": "<|vision_start|>",
22
+ "vision_eos_token": "<|vision_end|>"
23
+ },
24
+ "pad_token": "<|endoftext|>",
25
+ "pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
26
+ "split_special_tokens": false,
27
+ "stride": 0,
28
+ "tokenizer_class": "TokenizersBackend",
29
+ "truncation_side": "right",
30
+ "truncation_strategy": "longest_first",
31
+ "unk_token": null,
32
+ "video_token": "<|video_pad|>",
33
+ "vision_bos_token": "<|vision_start|>",
34
+ "vision_eos_token": "<|vision_end|>"
35
+ }