pragmaticcs commited on
Commit
a9bb93a
·
verified ·
1 Parent(s): 6fa34cd

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +343 -0
README.md ADDED
@@ -0,0 +1,343 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - Qwen/Qwen3.5-9B
4
+ - XiaomiMiMo/MiMo-V2.6-Distill-Qwen-9B
5
+ - ornith-ai/Ornith-1.5-9B
6
+ - Jackrong/Qwopus3.5-9B-Coder
7
+ - OrionLLM/OxCoder-9B
8
+ - empero-ai/Qwen3.8-9B-Distill
9
+ base_model_relation: merge
10
+ library_name: transformers
11
+ tags:
12
+ - merge
13
+ - ties
14
+ - della
15
+ - model-stock
16
+ - geodella
17
+ - qwen
18
+ - qwen3.5
19
+ - causal-lm
20
+ - deltanet
21
+ - linear-attention
22
+ - agentic
23
+ - reasoning
24
+ - code
25
+ - swe-bench
26
+ license: apache-2.0
27
+ language:
28
+ - en
29
+ - zh
30
+ pipeline_tag: text-generation
31
+ model_type: qwen3_5_text
32
+ ---
33
+
34
+ <div align="center">
35
+
36
+ [![License](https://img.shields.io/badge/License-Apache%202.0-6E56CF?style=for-the-badge)](https://opensource.org/licenses/Apache-2.0)
37
+ [![Library](https://img.shields.io/badge/Library-transformers-FFD21E?style=for-the-badge&logo=huggingface&logoColor=black)](https://github.com/huggingface/transformers)
38
+ [![Merge Method](https://img.shields.io/badge/Merge%20Method-GeoDELLA--HG-27AE60?style=for-the-badge)](#merge-methodology--mathematical-formulation)
39
+ [![Architecture](https://img.shields.io/badge/Architecture-Qwen%203.5%209B%20Dense-2D9CDB?style=for-the-badge)](#architectural-specifications)
40
+ [![Attention](https://img.shields.io/badge/Hybrid-Gated%20DeltaNet%20(3:1)-EB5757?style=for-the-badge)](#architectural-specifications)
41
+ [![Context](https://img.shields.io/badge/Context%20Window-256k-F2994A?style=for-the-badge)](#architectural-specifications)
42
+
43
+ </div>
44
+
45
+ > [!NOTE]
46
+ > This repository provides quantized GGUF builds of [**pragmaticcs/PentaCoder-9B**](https://huggingface.co/pragmaticcs/PentaCoder-9B)
47
+
48
+ Most sub-10B coding models fail in realistic agentic environments due to a common trade-off: aggressive fine-tuning on synthetic coding instructions improves immediate benchmark pass rates but introduces brittle syntactic degradation and catastrophic repetition loops when shell commands or compiler checks fail.
49
+
50
+ **PentaCoder** addresses these limitations by uniting five specialized post-trained checkpoints of [**Qwen 3.5 9B**](https://huggingface.co/Qwen/Qwen3.5-9B) via **GeoDELLA** (Geometric Drop-and-Rescale with Task-Covariance De-Biasing and Spectral Norm Anchoring). The model synthesizes the distinct mathematical distributions of each donor:
51
+
52
+ - **Algorithmic Correctness & Architectural Decomposition** from [**Qwopus3.5-Coder**](https://huggingface.co/Jackrong/Qwopus3.5-9B-Coder) (Claude 3.5 Opus distillation trajectories).
53
+ - **Multi-Turn SWE-bench Planning & Tool Protocol Integrity** from [**MiMo-V2.6-Distill**](https://huggingface.co/XiaomiMiMo/MiMo-V2.6-Distill-Qwen-9B) (Large-scale agentic execution traces).
54
+ - **Terminal Execution Discipline & Error-Recovery Heuristics** from [**Ornith-1.5**](https://huggingface.co/ornith-ai/Ornith-1.5-9B) (Reinforcement learning for anti-looping).
55
+ - **Low-Level Systems Implementation & Runtime Robustness** from [**OxCoder**](https://huggingface.co/OrionLLM/OxCoder-9B) (Deep API, CLI, and operational coding specialization).
56
+ - **Abstract Structural Reasoning & Syntax Grounding** from [**Qwen3.8-Distill**](https://huggingface.co/empero-ai/Qwen3.8-9B-Distill) (Distilled frontier chain-of-thought representations).
57
+
58
+ > [!IMPORTANT]
59
+ > The result is a lean, blisteringly fast 9B pure-text causal engine with a native **256k context window** that runs comfortably on consumer GPUs.
60
+
61
+ ---
62
+
63
+ ### Contents
64
+
65
+ - [Architectural Specifications](#architectural-specifications)
66
+ - [Composition & Donor Weighting](#composition--donor-weighting)
67
+ - [Merge Methodology & Mathematical Formulation](#merge-methodology--mathematical-formulation)
68
+ - [Layer-Stratified Component Policies](#layer-stratified-component-policies)
69
+ - [Agentic Chat Template & Operational Directives](#agentic-chat-template--operational-directives)
70
+ - [Recommended Generation Parameters](#recommended-generation-parameters)
71
+ - [How to Use](#how-to-use)
72
+ - [Citation & References](#citation--references)
73
+
74
+ ---
75
+
76
+ ## Architectural Specifications
77
+
78
+ | Parameter | Specification |
79
+ | :--- | :---: |
80
+ | **Total Parameters** | 8.8B (Pure Text Backbone) |
81
+ | **Architecture Type** | Hybrid Recurrent-Attention Causal LM (`qwen3_5_text`) |
82
+ | **Hidden Dimension** (*d*<sub>model</sub>) | 4096 |
83
+ | **Intermediate Dimension** (*d*<sub>mlp</sub>) | 12288 (SwiGLU) |
84
+ | **Decoder Layers** | 32 |
85
+ | **Attention Layout** | 8 Blocks × (3 Gated DeltaNet Linear Layers : 1 Gated Softmax Layer) |
86
+ | **Full Attention Layers** | Layers 3, 7, 11, 15, 19, 23, 27, 31 |
87
+ | **Linear Attention Configuration** | 16 Key Heads / 32 Value Heads (*d*<sub>k</sub> = *d*<sub>v</sub> = 128) |
88
+ | **Full Attention Configuration** | 16 Query Heads / 4 Key-Value Heads (GQA, *d*<sub>h</sub> = 256) |
89
+ | **Rotary Position Embedding (RoPE)** | 1D Partial RoPE (θ = 10⁷, Factor = 0.25 → 64 dimensions) |
90
+ | **Context Window Length** | 262,144 tokens (256k) |
91
+ | **Native Precision** | `bfloat16` |
92
+ | **Vocabulary Size** | 248,320 (Padded for Fill-In-The-Middle and Tool Tokens) |
93
+
94
+ ---
95
+
96
+ ## Composition & Donor Weighting
97
+
98
+ The foundational weights of [Qwen/Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B) serve as the shared topological base (*W*₀). Five specialized donor checkpoints provide non-overlapping task vectors mapped across normalized layer depth *u* ∈ [0, 1]:
99
+
100
+ | Model | Primary Focus | Depth Target |
101
+ | :--- | :--- | :---: |
102
+ | [Qwen/Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B) | Base pre-trained manifold and state-space anchors | Global (*W*₀) |
103
+ | [empero-ai/Qwen3.8-9B-Distill](https://huggingface.co/empero-ai/Qwen3.8-9B-Distill) | Abstract token synthesis, reasoning structure, syntax | Lower & Mid Decoders |
104
+ | [Jackrong/Qwopus3.5-9B-Coder](https://huggingface.co/Jackrong/Qwopus3.5-9B-Coder) | Typing discipline, algorithm design, functional purity | Mid Decoders (Bell Curve) |
105
+ | [ornith-ai/Ornith-1.5-9B](https://huggingface.co/ornith-ai/Ornith-1.5-9B) | Circuit-breaker recovery, environment feedback integration | Upper-Mid Decoders |
106
+ | [OrionLLM/OxCoder-9B](https://huggingface.co/OrionLLM/OxCoder-9B) | Systems engineering, runtime bug localization, CLI tooling | Deep Layers (Ascending Ramp) |
107
+ | [XiaomiMiMo/MiMo-V2.6-Distill-Qwen-9B](https://huggingface.co/XiaomiMiMo/MiMo-V2.6-Distill-Qwen-9B) | SWE-bench multi-step planning, long-context tool invocation | Broad Central Decoders |
108
+
109
+ ---
110
+
111
+ ## Merge Methodology & Mathematical Formulation
112
+
113
+ The merge was executed using the **GeoDELLA-Coder** pipeline, which solves weight interference through dynamic task-correlation de-biasing, row-wise sign consensus, sub-tensor GQA disentanglement, and power-iteration spectral norm stabilization.
114
+
115
+ ### 1. Task Vector Formulation
116
+
117
+ For each donor checkpoint *k* ∈ {1, ..., 5}, the parameter update delta τ<sub>*k*</sub> is computed relative to the base anchor *W*₀:
118
+
119
+ $$
120
+ \tau_k = D_k - W_0, \quad k \in \{\text{Qwen3.8}, \text{Qwopus}, \text{Ornith}, \text{OxCoder}, \text{MiMo}\}
121
+ $$
122
+
123
+ ### 2. Hybrid-Aware Continuous Depth Modulation
124
+
125
+ Task vector mixing coefficients are continuously modulated over normalized depth *u* = *l* / (*L* - 1), where *l* ∈ [0, 31] and *L* = 32:
126
+
127
+ $$
128
+ u_{\text{qwen38}}(u) = 0.15 + 0.35 \cos^2\left(\frac{\pi}{2} u\right) + 0.15 \sin^2(\pi u)
129
+ $$
130
+
131
+ $$
132
+ u_{\text{qwopus}}(u) = 0.05 + 0.35 \sin^2(\pi u)
133
+ $$
134
+
135
+ $$
136
+ u_{\text{ornith}}(u) = 0.05 + 0.35 \sin^2\left(\frac{\pi}{2} u\right)
137
+ $$
138
+
139
+ $$
140
+ u_{\text{oxcoder}}(u) = 0.05 + 0.25 \sin^2\left(\frac{\pi}{2} u\right)
141
+ $$
142
+
143
+ $$
144
+ u_{\text{mimo}}(u) = 0.05 + 0.15 \sin(\pi u)
145
+ $$
146
+
147
+ The initial coefficients are normalized to form a partition of unity across all layers:
148
+
149
+ $$
150
+ w_k(l) = \frac{u_k(u)}{\sum_{j=1}^5 u_j(u)}, \quad \sum_{k=1}^5 w_k(l) = 1.0
151
+ $$
152
+
153
+ ### 3. Dynamic Gram-Matrix Task De-Biasing
154
+
155
+ Fine-tuned models frequently share underlying distillation datasets, leading to collinearity that can drown out specialized task vectors. To correct for this over-representation, the empirical Gram correlation matrix *G* ∈ ℝ<sup>*K* × *K*</sup> is evaluated per tensor:
156
+
157
+ $$
158
+ G_{ij} = \frac{|\langle \text{vec}(\tau_i), \text{vec}(\tau_j) \rangle|}{\|\tau_i\|_2 \|\tau_j\|_2}
159
+ $$
160
+
161
+ A uniqueness coefficient *U*<sub>*k*</sub> is derived from the inverse column sum of task vector correlations:
162
+
163
+ $$
164
+ U_k = \frac{1}{\sum_{j=1}^K G_{kj}}
165
+ $$
166
+
167
+ The dynamic weights are then re-balanced and normalized:
168
+
169
+ $$
170
+ \tilde{w}_k = \frac{w_k U_k}{\sum_{j=1}^K w_j U_j}
171
+ $$
172
+
173
+ This prevents dataset overlap from suppressing distinct algorithmic representations.
174
+
175
+ ### 4. Asymmetric GQA Disentangled QKV Slicing
176
+
177
+ Qwen 3.5 9B features asymmetric head ratios in both its linear attention and full attention layers. Standard fused tensor merging causes cross-head pollution by treating routing projections identically to memory projections.
178
+
179
+ Fused projection tensors are sliced into their functional sub-matrices prior to merging:
180
+ - **Gated DeltaNet Layers (8192 × *d*<sub>model</sub>):** Sliced into Query (2048), Key (2048), and Value (4096).
181
+ - **Gated Attention Layers (6144 × *d*<sub>model</sub>):** Sliced into Query (4096), Key (1024), and Value (1024).
182
+
183
+ Query and Key slices are processed with a conservative retention density (ρ = 0.95) to preserve sharp context routing. Value matrices are processed with adaptive MLP density (ρ = 0.70) to maximize conceptual synthesis. The components are then re-concatenated along the head dimension.
184
+
185
+ ### 5. Neuron-Coherent Row Gating
186
+
187
+ To eliminate destructive interference in Feed-Forward Networks (MLPs), task vectors are gated at the single-neuron (row) level:
188
+
189
+ $$
190
+ \bar{\tau} = \frac{1}{K} \sum_{k=1}^K \tau_k
191
+ $$
192
+
193
+ For each row *r* of donor delta τ<sub>*k*</sub>, the directional alignment with the consensus mean is evaluated:
194
+
195
+ $$
196
+ \cos \theta_{k, r} = \frac{\langle \tau_{k, r}, \bar{\tau}_r \rangle}{\|\tau_{k, r}\|_2 \|\bar{\tau}_r\|_2 + \epsilon}
197
+ $$
198
+
199
+ Rows exhibiting severe directional opposition (cos θ<sub>*k*, *r*</sub> < -0.10) are masked out:
200
+
201
+ $$
202
+ \hat{\tau}_{k, r} = \tau_{k, r} \cdot \mathbb{I}\left(\cos \theta_{k, r} \ge -0.10\right)
203
+ $$
204
+
205
+ This eliminates opposing gradient vectors that produce incoherent syntax generation.
206
+
207
+ ### 6. Heavy-Tailed DELLA Adaptive Rescaling
208
+
209
+ Surviving parameters undergo non-linear magnitude-based sampling. Using parameter rank indices *R*<sub>*k*, *ij*</sub> ∈ [0, 1] sorted by absolute magnitude, a Pareto-style retention probability *p*<sub>*k*, *ij*</sub> is established:
210
+
211
+ $$
212
+ p_{k, ij} = p_{\min} + (p_{\max} - p_{\min}) \cdot \sqrt{R_{k, ij}}
213
+ $$
214
+
215
+ Parameters are sampled via a Bernoulli trial and rescaled by their inverse survival probability:
216
+
217
+ $$
218
+ M_{k, ij} \sim \text{Bernoulli}(p_{k, ij})
219
+ $$
220
+
221
+ $$
222
+ \tilde{\tau}_{k, ij} = \frac{\hat{\tau}_{k, ij} \odot M_{k, ij}}{p_{k, ij}}
223
+ $$
224
+
225
+ ### 7. Coordinate-Wise Sign Consensus & Model Stock Scaling
226
+
227
+ Directional consensus is determined via weighted sign agreement:
228
+
229
+ $$
230
+ \Gamma = \operatorname{sgn}\left(\sum_{k=1}^K \tilde{w}_k \tilde{\tau}_k\right)
231
+ $$
232
+
233
+ $$
234
+ A_k = \mathbb{I}\left(\operatorname{sgn}(\tilde{\tau}_k) = \Gamma\right) \odot \mathbb{I}\left(\tilde{\tau}_k \neq 0\right)
235
+ $$
236
+
237
+ $$
238
+ \Delta_{\text{consensus}} = \frac{\sum_{k=1}^K \tilde{\tau}_k \odot A_k}{\sum_{k=1}^K A_k + \epsilon}
239
+ $$
240
+
241
+ The aggregated delta is projected onto the non-linear manifold using the Model Stock analytic scaling factor *t*<sup>*</sup>:
242
+
243
+ $$
244
+ \bar{\rho} = \frac{2}{K(K-1)} \sum_{i < j} \frac{\langle \text{vec}(\tau_i), \text{vec}(\tau_j) \rangle}{\|\tau_i\|_2 \|\tau_j\|_2}
245
+ $$
246
+
247
+ $$
248
+ t^* = \frac{K \bar{\rho}}{1 + (K - 1)\bar{\rho}}
249
+ $$
250
+
251
+ $$
252
+ \Delta_{\text{final}} = t^* \cdot \Delta_{\text{consensus}}
253
+ $$
254
+
255
+ ### 8. Spectral Norm & Attention Entropy Anchoring
256
+
257
+ Attention projection matrices (*W*<sub>attn</sub>) are vulnerable to spectral explosion during merges, which contracts attention entropy and leads to repetitive generation loops.
258
+
259
+ The dominant singular value σ(*W*) is calculated via a three-iteration deterministic power iteration:
260
+
261
+ $$
262
+ v^{(t+1)} = \frac{W^T u^{(t)}}{\|W^T u^{(t)}\|_2}, \quad u^{(t+1)} = \frac{W v^{(t+1)}}{\|W v^{(t+1)}\|_2}
263
+ $$
264
+
265
+ $$
266
+ \sigma(W) \approx {u^{(3)}}^T W v^{(3)}
267
+ $$
268
+
269
+ If the merged spectral radius grows more than 5% relative to the base model, it is scaled down:
270
+
271
+ $$
272
+ W_{\text{final}} = \begin{cases} W_{\text{merged}} \cdot \left(\frac{1.05 \cdot \sigma(W_0)}{\sigma(W_{\text{merged}})}\right) & \text{if } \sigma(W_{\text{merged}}) > 1.05 \cdot \sigma(W_0) \\ W_{\text{merged}} & \text{otherwise} \end{cases}
273
+ $$
274
+
275
+ ---
276
+
277
+ ## Layer-Stratified Component Policies
278
+
279
+ | Parameter Class | Target Identifiers | Applied Policy | Density (ρ) | Mathematical Constraints |
280
+ | :--- | :--- | :---: | :---: | :--- |
281
+ | **Embeddings & LM Head** | `embed_tokens`, `lm_head` | Low-Memory Streaming Blend | 1.0 | Convex iterative accumulation; vocab dimension aligned to 248,320. |
282
+ | **Linear State-Space Projections** | `linear_attn.in_proj_qkv` | Asymmetric GQA DELLA | 0.95 (QK) / 0.70 (V) | Sub-tensor slicing; separate routing and associative memory passes. |
283
+ | **Self-Attention Projections** | `self_attn.qkv_proj`, `o_proj` | Asymmetric GQA + Spectral Anchor | 0.95 (QK) / 0.70 (V) | Power-iteration clipping prevents σ > 1.05 σ₀. |
284
+ | **Feed-Forward Blocks** | `mlp.gate_proj`, `up_proj`, `down_proj` | Neuron-Gated HG-DELLA | 0.50 – 0.70 | Row-wise cosine filtering (cos θ ≥ -0.10); sign consensus. |
285
+ | **Recurrent Gates & Normalization** | `A_log`, `norm`, `conv1d` | Convex Parameter Blend | 1.0 | Preservation of *A*<sub>log</sub> ≤ 0 to guarantee BIBO stability. |
286
+
287
+ ---
288
+
289
+ ## Agentic Chat Template & Operational Directives
290
+
291
+ This model uses the [Improved Chat Template for Qwen 3.x by Olivia Rossi](https://huggingface.co/OliviaRossi/Improved-Chat-Template-for-Qwen-3.x) to support multi-tier Chain-of-Thought (CoT) reasoning, dual-format agentic tool execution, automatic error-recovery heuristics, and strict token-waste elimination.
292
+
293
+ ---
294
+
295
+ ## Recommended Generation Parameters
296
+
297
+ For deterministic software engineering and complex reasoning benchmarks:
298
+
299
+ | Parameter | Recommended Value | Description |
300
+ | :--- | :---: | :--- |
301
+ | **Temperature** | `0.6` | Balances strict syntactic validity with algorithmic path exploration. |
302
+ | **Top-P** | `0.95` | Eliminates low-probability token tails while preserving alternative logic paths. |
303
+ | **Top-K** | `20` | Restricts token candidate pools to prevent architectural syntax drift. |
304
+ | **Min-P** | `0.0` (Off) | Disabled in favor of explicit Top-K / Top-P governance. |
305
+ | **Repetition Penalty** | `1.0` (Off) | Disabled to prevent syntax degradation in repetitive code patterns (indentation, braces). |
306
+ | **Presence Penalty** | `0.0` | Prevents naming mutations across long-context symbol resolution. |
307
+
308
+ ---
309
+
310
+ ## Citation & References
311
+
312
+ - [Qwen/Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B)
313
+ - [XiaomiMiMo/MiMo-V2.6-Distill-Qwen-9B](https://huggingface.co/XiaomiMiMo/MiMo-V2.6-Distill-Qwen-9B)
314
+ - [ornith-ai/Ornith-1.5-9B](https://huggingface.co/ornith-ai/Ornith-1.5-9B)
315
+ - [Jackrong/Qwopus3.5-9B-Coder](https://huggingface.co/Jackrong/Qwopus3.5-9B-Coder)
316
+ - [OrionLLM/OxCoder-9B](https://huggingface.co/OrionLLM/OxCoder-9B)
317
+ - [empero-ai/Qwen3.8-9B-Distill](https://huggingface.co/empero-ai/Qwen3.8-9B-Distill)
318
+ - [Improved Chat Template for Qwen 3.x](https://huggingface.co/OliviaRossi/Improved-Chat-Template-for-Qwen-3.x)
319
+
320
+ ```bibtex
321
+ @inproceedings{yadav2023ties,
322
+ title={Resolving Interference When Merging Models},
323
+ author={Yadav, Prateek and Tam, Derek and Choshen, Leshem and Raffel, Colin and Bansal, Mohit},
324
+ booktitle={Advances in Neural Information Processing Systems (NeurIPS)},
325
+ volume={36},
326
+ pages={7093--7115},
327
+ year={2023}
328
+ }
329
+
330
+ @article{deep2024della,
331
+ title={DELLA-Merging: Reducing Interference in Model Merging through Magnitude-Based Sampling},
332
+ author={Deep, Pala Tej and Bhardwaj, Rishabh and Poria, Soujanya},
333
+ journal={arXiv preprint arXiv:2406.11617},
334
+ year={2024}
335
+ }
336
+
337
+ @article{jang2024modelstock,
338
+ title={Model Stock: All We Need Is just a Few Fine-Tuned Models},
339
+ author={Jang, Dong-Hwan and Yoon, Sang-Doo and Song, Gyeong-Moon},
340
+ journal={arXiv preprint arXiv:2403.19522},
341
+ year={2024}
342
+ }
343
+ ```