pragmaticcs commited on
Commit
00e0c97
Β·
1 Parent(s): 7ee4e9d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +214 -0
README.md CHANGED
@@ -1,3 +1,217 @@
1
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: apache-2.0
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ base_model:
3
+ - Jackrong/Qwopus3.6-35B-A3B-Coder
4
+ - ornith-ai/Ornith-1.5-35B-A3B
5
+ - Kwaipilot/KAT-Coder-V2.5-Dev
6
+ - Qwen/Qwen-AgentWorld-35B-A3B
7
+ base_model_relation: merge
8
+ library_name: transformers
9
+ tags:
10
+ - merge
11
+ - ties
12
+ - dare
13
+ - moe
14
+ - qwen
15
+ - causal-lm
16
+ - deltanet
17
+ - agentic
18
+ - code
19
  license: apache-2.0
20
+ language:
21
+ - en
22
+ - zh
23
+ pipeline_tag: text-generation
24
+ model_type: qwen3_5_moe
25
  ---
26
+
27
+ <div align="center">
28
+
29
+ [![License](https://img.shields.io/badge/License-Apache%202.0-6E56CF?style=for-the-badge)](https://opensource.org/licenses/Apache-2.0)
30
+ [![Library](https://img.shields.io/badge/Library-transformers-FFD21E?style=for-the-badge&logo=huggingface&logoColor=black)](https://github.com/huggingface/transformers)
31
+ [![Merge Method](https://img.shields.io/badge/Merge%20Method-DARE--TIES-27AE60?style=for-the-badge)](#merge-methodology)
32
+
33
+ [![Architecture](https://img.shields.io/badge/Architecture-Qwen%2035B--A3B%20MoE-2D9CDB?style=for-the-badge)](#architectural-specifications)
34
+ [![Experts](https://img.shields.io/badge/Routed%20Experts-256-EB5757?style=for-the-badge)](#architectural-specifications)
35
+ [![Layers](https://img.shields.io/badge/Decoder%20Layers-40-F2994A?style=for-the-badge)](#architectural-specifications)
36
+
37
+ </div>
38
+
39
+ A four-way merge of the Qwen 35B-A3B Mixture-of-Experts architecture, integrating task deltas from three fine-tunes into a base anchor via DARE-TIES with sinusoidal depth modulation.
40
+
41
+ > [!IMPORTANT]
42
+ > Merged specifically to consolidate software engineering, code synthesis, and agentic tool execution capabilities. Multimodal vision weights and Multi-Token Prediction (MTP) heads were stripped to reduce VRAM footprint and maximize throughput during coding tasks.
43
+
44
+ ---
45
+
46
+ ### Contents
47
+
48
+ - [Architectural Specifications](#architectural-specifications)
49
+ - [Composition](#composition)
50
+ - [Merge Methodology](#merge-methodology)
51
+ - [Layer-Stratified Policies](#layer-stratified-policies)
52
+ - [Generation Parameters](#recommended-generation-parameters)
53
+ - [How to Use](#how-to-use)
54
+ - [Lineage](#lineage)
55
+ - [References](#citation--references)
56
+
57
+ ---
58
+
59
+ ## Architectural Specifications
60
+
61
+ | Spec | Value |
62
+ | :--- | :---: |
63
+ | Total parameters | 35B |
64
+ | Active parameters / token | 3B |
65
+ | Decoder layers | 40 |
66
+ | Routed experts | 256 |
67
+ | Shared experts | 1 |
68
+ | Attention | Gated DeltaNet hybrid linear attention |
69
+ | Merge algorithm | DARE-TIES + sine depth scaling |
70
+
71
+ ## Composition
72
+
73
+ `Jackrong/Qwopus3.6-35B-A3B-Coder` serves as the base anchor (Wβ‚€); the remaining three models contribute task vectors at the listed weights.
74
+
75
+ | Model | Role | Task Weight (Ξ±) |
76
+ | :--- | :--- | :---: |
77
+ | [Jackrong/Qwopus3.6-35B-A3B-Coder](https://huggingface.co/Jackrong/Qwopus3.6-35B-A3B-Coder) | Base anchor (Wβ‚€) | 1.00 |
78
+ | [ornith-ai/Ornith-1.5-35B-A3B](https://huggingface.co/ornith-ai/Ornith-1.5-35B-A3B) | Donor (D₁) | 0.30 |
79
+ | [Kwaipilot/KAT-Coder-V2.5-Dev](https://huggingface.co/Kwaipilot/KAT-Coder-V2.5-Dev) | Donor (Dβ‚‚) | 0.25 |
80
+ | [Qwen/Qwen-AgentWorld-35B-A3B](https://huggingface.co/Qwen/Qwen-AgentWorld-35B-A3B) | Donor (D₃) | 0.20 |
81
+
82
+ ---
83
+
84
+ ## Merge Methodology
85
+
86
+ For each floating-point parameter, a task delta is computed per donor $k$:
87
+
88
+ $$\Delta_k = D_k - W_0$$
89
+
90
+ **DARE pruning.** A Bernoulli mask at retention density $p$ zeroes out low-magnitude updates; surviving values are rescaled by $p^{-1}$:
91
+
92
+ $$\tilde{\Delta}_k = \frac{1}{p} \left(\Delta_k \odot M_k\right), \quad M_k \sim \text{Bernoulli}(p)$$
93
+
94
+ **TIES sign election.** A consensus sign $\Gamma$ is computed via weighted vote across donors, and any donor update conflicting with it is dropped before averaging:
95
+
96
+ $$\Gamma = \text{sgn}\left(\sum_{k=1}^K \alpha_k \tilde{\Delta}_k\right)$$
97
+
98
+ $$\Delta_{\text{TIES}} = \frac{\sum_{k=1}^K \alpha_k \tilde{\Delta}_k \odot \mathbb{I}\left(\text{sgn}(\tilde{\Delta}_k) = \Gamma\right)}{\sum_{k=1}^K \alpha_k \cdot \mathbb{I}\left(\text{sgn}(\tilde{\Delta}_k) = \Gamma\right) + \epsilon}$$
99
+
100
+ **Depth-scaled reconstruction.** The merged weight is reconstructed as:
101
+
102
+ $$W_{\text{final}} = W_0 + \lambda(l) \cdot \Delta_{\text{TIES}}$$
103
+
104
+ where the layer scaling factor $\lambda(l)$ across decoder layer index $l \in [0, 39]$ is defined as:
105
+
106
+ $$\lambda(l) = \beta \cdot \left(0.5 + 0.5 \sin\left(\pi \frac{l}{39}\right)\right)$$
107
+
108
+ This keeps input/output projections closer to the base and applies the strongest task transfer to middle layers ($l \in [12, 28]$).
109
+
110
+ ---
111
+
112
+ ## Layer-Stratified Policies
113
+
114
+ | Parameter Group | Match Substring | Policy | Density ($p$) | Base Scale ($\beta$) |
115
+ | :--- | :--- | :---: | :---: | :---: |
116
+ | **Embeddings / LM head** | `embed_tokens`, `lm_head` | Linear | β€” | 1.00 |
117
+ | **Norms / biases** | `norm`, `bias`, 1D tensors | Linear | β€” | 1.00 |
118
+ | **DeltaNet recurrent state** | `a_log`, `dt_bias`, `conv1d` | Linear | β€” | 1.00 |
119
+ | **MoE router gate** | `mlp.gate.weight`, `block_sparse_moe.gate` | Linear | β€” | 1.00 |
120
+ | **MoE shared expert** | `shared_expert` | DARE-TIES | 0.70 | 0.60 |
121
+ | **Attention projections** | `attn`, `rotary`, `in_proj`, `out_proj`, `x_proj` | DARE-TIES | 0.75 | 0.60 |
122
+ | **Routed experts (Γ—256)** | `experts`, `mlp` | DARE-TIES | 0.65 | 0.55 |
123
+
124
+ - **Router protection:** Gate weights use linear interpolation (~57% base, ~43% donors) rather than DARE to avoid destabilizing expert routing.
125
+ - **DeltaNet stability:** Recurrent state kernels are excluded from DARE to prevent divergence in the linear-attention state space.
126
+ - **MTP removed:** Multi-token-prediction heads beyond the 40 primary decoder blocks were stripped for standard CausalLM inference.
127
+
128
+ ---
129
+
130
+ ## Recommended Generation Parameters
131
+
132
+ For code generation and agentic task trajectories, avoid high temperatures to maintain routing stability and syntax validity.
133
+
134
+ | Parameter | Coding / Terminal Agent | Creative Reasoning |
135
+ | :--- | :---: | :---: |
136
+ | **Temperature** | `0.6` | `1.0` |
137
+ | **Top-P** | `0.95` | `0.95` |
138
+ | **Min-P** | `0.0` | `0.01` |
139
+ | **Repetition Penalty** | `off` | `1.05` |
140
+
141
+ ---
142
+
143
+ ## How to Use
144
+
145
+ ### Transformers
146
+
147
+ ```python
148
+ import torch
149
+ from transformers import AutoModelForCausalLM, AutoTokenizer
150
+
151
+ model_id = "pragmaticcs/SignOfFour"
152
+
153
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
154
+ model = AutoModelForCausalLM.from_pretrained(
155
+ model_id,
156
+ torch_dtype=torch.bfloat16,
157
+ device_map="auto",
158
+ )
159
+
160
+ messages = [
161
+ {"role": "system", "content": "You are a precise agentic software engineer. Solve problems concisely."},
162
+ {"role": "user", "content": "Write an asynchronous Python queue consumer with retry backoff."}
163
+ ]
164
+
165
+ inputs = tokenizer.apply_chat_template(
166
+ messages, add_generation_prompt=True, return_tensors="pt"
167
+ ).to(model.device)
168
+
169
+ output = model.generate(
170
+ inputs,
171
+ max_new_tokens=1024,
172
+ temperature=0.6,
173
+ top_p=0.95,
174
+ min_p=0.01,
175
+ do_sample=True,
176
+ )
177
+
178
+ print(tokenizer.decode(output[0][inputs.shape[-1]:], skip_special_tokens=True))
179
+ ```
180
+
181
+ ---
182
+
183
+ ## Lineage
184
+
185
+ ```
186
+ Qwen/Qwen3.6-35B-A3B
187
+ └── pragmaticcs/SignOfFour
188
+ β”œβ”€β”€ base: Jackrong/Qwopus3.6-35B-A3B-Coder
189
+ β”œβ”€β”€ donor: ornith-ai/Ornith-1.5-35B-A3B
190
+ β”œβ”€β”€ donor: Kwaipilot/KAT-Coder-V2.5-Dev
191
+ └── donor: Qwen/Qwen-AgentWorld-35B-A3B
192
+ ```
193
+
194
+ ---
195
+
196
+ ## Citation & References
197
+
198
+ - [Jackrong/Qwopus3.6-35B-A3B-Coder](https://huggingface.co/Jackrong/Qwopus3.6-35B-A3B-Coder)
199
+ - [ornith-ai/Ornith-1.5-35B-A3B](https://huggingface.co/ornith-ai/Ornith-1.5-35B-A3B)
200
+ - [Kwaipilot/KAT-Coder-V2.5-Dev](https://huggingface.co/Kwaipilot/KAT-Coder-V2.5-Dev)
201
+ - [Qwen/Qwen-AgentWorld-35B-A3B](https://huggingface.co/Qwen/Qwen-AgentWorld-35B-A3B)
202
+
203
+ ```bibtex
204
+ @inproceedings{yu2024dare,
205
+ title={Language Models are Super Mario: Absorbing Abilities from Homologous Models as a Free Lunch},
206
+ author={Yu, Le and Yu, Bowen and Yu, Haiyang and Huang, Fei and Li, Yongbin},
207
+ booktitle={International Conference on Machine Learning (ICML)},
208
+ year={2024}
209
+ }
210
+
211
+ @inproceedings{yadav2023ties,
212
+ title={Resolving Interference When Merging Models},
213
+ author={Yadav, Prateek and Tam, Derek and Choshen, Leshem and Raffel, Colin and Bansal, Mohit},
214
+ booktitle={Advances in Neural Information Processing Systems (NeurIPS)},
215
+ year={2023}
216
+ }
217
+ ```