Text Generation
Transformers
Safetensors
English
Chinese
qwen3_5_text
Merge
ties
della
model-stock
geodella
qwen
qwen3.5
causal-lm
deltanet
linear-attention
agentic
reasoning
code
swe-bench
conversational
Instructions to use pragmaticcs/PentaCoder-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pragmaticcs/PentaCoder-9B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="pragmaticcs/PentaCoder-9B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("pragmaticcs/PentaCoder-9B") model = AutoModelForCausalLM.from_pretrained("pragmaticcs/PentaCoder-9B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use pragmaticcs/PentaCoder-9B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "pragmaticcs/PentaCoder-9B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pragmaticcs/PentaCoder-9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/pragmaticcs/PentaCoder-9B
- SGLang
How to use pragmaticcs/PentaCoder-9B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "pragmaticcs/PentaCoder-9B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pragmaticcs/PentaCoder-9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "pragmaticcs/PentaCoder-9B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pragmaticcs/PentaCoder-9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use pragmaticcs/PentaCoder-9B with Docker Model Runner:
docker model run hf.co/pragmaticcs/PentaCoder-9B
Update README.md
Browse files
README.md
CHANGED
|
@@ -33,6 +33,10 @@ model_type: qwen3_5_text
|
|
| 33 |
|
| 34 |
<div align="center">
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
[](https://opensource.org/licenses/Apache-2.0)
|
| 37 |
[](https://github.com/huggingface/transformers)
|
| 38 |
[](#merge-methodology--mathematical-formulation)
|
|
@@ -54,6 +58,7 @@ Most sub-10B coding models fail in realistic agentic environments due to a commo
|
|
| 54 |
|
| 55 |
> [!IMPORTANT]
|
| 56 |
> The result is a lean, blisteringly fast 9B pure-text causal engine with a native **256k context window** that runs comfortably on consumer GPUs.
|
|
|
|
| 57 |
---
|
| 58 |
|
| 59 |
### Contents
|
|
@@ -75,14 +80,14 @@ Most sub-10B coding models fail in realistic agentic environments due to a commo
|
|
| 75 |
| :--- | :---: |
|
| 76 |
| **Total Parameters** | 8.8B (Pure Text Backbone) |
|
| 77 |
| **Architecture Type** | Hybrid Recurrent-Attention Causal LM (`qwen3_5_text`) |
|
| 78 |
-
| **Hidden Dimension** (
|
| 79 |
-
| **Intermediate Dimension** (
|
| 80 |
| **Decoder Layers** | 32 |
|
| 81 |
-
| **Attention Layout** | 8 Blocks
|
| 82 |
| **Full Attention Layers** | Layers 3, 7, 11, 15, 19, 23, 27, 31 |
|
| 83 |
-
| **Linear Attention Configuration** | 16 Key Heads / 32 Value Heads (
|
| 84 |
-
| **Full Attention Configuration** | 16 Query Heads / 4 Key-Value Heads (GQA,
|
| 85 |
-
| **Rotary Position Embedding (RoPE)** | 1D Partial RoPE (
|
| 86 |
| **Context Window Length** | 262,144 tokens (256k) |
|
| 87 |
| **Native Precision** | `bfloat16` |
|
| 88 |
| **Vocabulary Size** | 248,320 (Padded for Fill-In-The-Middle and Tool Tokens) |
|
|
@@ -91,11 +96,11 @@ Most sub-10B coding models fail in realistic agentic environments due to a commo
|
|
| 91 |
|
| 92 |
## Composition & Donor Weighting
|
| 93 |
|
| 94 |
-
The foundational weights of [Qwen/Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B) serve as the shared topological base (
|
| 95 |
|
| 96 |
| Model | Primary Focus | Depth Target |
|
| 97 |
| :--- | :--- | :---: |
|
| 98 |
-
| [Qwen/Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B) | Base pre-trained manifold and state-space anchors | Global (
|
| 99 |
| [empero-ai/Qwen3.8-9B-Distill](https://huggingface.co/empero-ai/Qwen3.8-9B-Distill) | Abstract token synthesis, reasoning structure, syntax | Lower & Mid Decoders |
|
| 100 |
| [Jackrong/Qwopus3.5-9B-Coder](https://huggingface.co/Jackrong/Qwopus3.5-9B-Coder) | Typing discipline, algorithm design, functional purity | Mid Decoders (Bell Curve) |
|
| 101 |
| [ornith-ai/Ornith-1.5-9B](https://huggingface.co/ornith-ai/Ornith-1.5-9B) | Circuit-breaker recovery, environment feedback integration | Upper-Mid Decoders |
|
|
@@ -110,41 +115,61 @@ The merge was executed using the **GeoDELLA-Coder** pipeline, which solves weigh
|
|
| 110 |
|
| 111 |
### 1. Task Vector Formulation
|
| 112 |
|
| 113 |
-
For each donor checkpoint
|
| 114 |
|
| 115 |
-
$$
|
|
|
|
|
|
|
| 116 |
|
| 117 |
### 2. Hybrid-Aware Continuous Depth Modulation
|
| 118 |
|
| 119 |
-
Task vector mixing coefficients are continuously modulated over normalized depth
|
| 120 |
|
| 121 |
-
$$
|
|
|
|
|
|
|
| 122 |
|
| 123 |
-
$$
|
|
|
|
|
|
|
| 124 |
|
| 125 |
-
$$
|
|
|
|
|
|
|
| 126 |
|
| 127 |
-
$$
|
|
|
|
|
|
|
| 128 |
|
| 129 |
-
$$
|
|
|
|
|
|
|
| 130 |
|
| 131 |
-
The initial coefficients are normalized to form a partition of unity:
|
| 132 |
|
| 133 |
-
$$
|
|
|
|
|
|
|
| 134 |
|
| 135 |
### 3. Dynamic Gram-Matrix Task De-Biasing
|
| 136 |
|
| 137 |
-
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
|
| 138 |
|
| 139 |
-
$$
|
|
|
|
|
|
|
| 140 |
|
| 141 |
-
A uniqueness coefficient
|
| 142 |
|
| 143 |
-
$$
|
|
|
|
|
|
|
| 144 |
|
| 145 |
The dynamic weights are then re-balanced and normalized:
|
| 146 |
|
| 147 |
-
$$
|
|
|
|
|
|
|
| 148 |
|
| 149 |
This prevents dataset overlap from suppressing distinct algorithmic representations.
|
| 150 |
|
|
@@ -153,82 +178,112 @@ This prevents dataset overlap from suppressing distinct algorithmic representati
|
|
| 153 |
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.
|
| 154 |
|
| 155 |
Fused projection tensors are sliced into their functional sub-matrices prior to merging:
|
| 156 |
-
- **Gated DeltaNet Layers (
|
| 157 |
-
- **Gated Attention Layers (
|
| 158 |
|
| 159 |
-
Query and Key slices are processed with a conservative retention density (
|
| 160 |
|
| 161 |
### 5. Neuron-Coherent Row Gating
|
| 162 |
|
| 163 |
To eliminate destructive interference in Feed-Forward Networks (MLPs), task vectors are gated at the single-neuron (row) level:
|
| 164 |
|
| 165 |
-
$$
|
|
|
|
|
|
|
| 166 |
|
| 167 |
-
For each row
|
| 168 |
|
| 169 |
-
$$
|
|
|
|
|
|
|
| 170 |
|
| 171 |
-
Rows exhibiting severe directional opposition (
|
| 172 |
|
| 173 |
-
$$
|
|
|
|
|
|
|
| 174 |
|
| 175 |
This eliminates opposing gradient vectors that produce incoherent syntax generation.
|
| 176 |
|
| 177 |
### 6. Heavy-Tailed DELLA Adaptive Rescaling
|
| 178 |
|
| 179 |
-
Surviving parameters undergo non-linear magnitude-based sampling. Using parameter rank indices
|
| 180 |
|
| 181 |
-
$$
|
|
|
|
|
|
|
| 182 |
|
| 183 |
Parameters are sampled via a Bernoulli trial and rescaled by their inverse survival probability:
|
| 184 |
|
| 185 |
-
$$
|
|
|
|
|
|
|
| 186 |
|
| 187 |
-
$$
|
|
|
|
|
|
|
| 188 |
|
| 189 |
### 7. Coordinate-Wise Sign Consensus & Model Stock Scaling
|
| 190 |
|
| 191 |
Directional consensus is determined via weighted sign agreement:
|
| 192 |
|
| 193 |
-
$$
|
|
|
|
|
|
|
| 194 |
|
| 195 |
-
$$
|
|
|
|
|
|
|
| 196 |
|
| 197 |
-
$$
|
|
|
|
|
|
|
| 198 |
|
| 199 |
-
The aggregated delta is projected onto the non-linear manifold using the Model Stock analytic scaling factor
|
| 200 |
|
| 201 |
-
$$
|
|
|
|
|
|
|
| 202 |
|
| 203 |
-
$$
|
|
|
|
|
|
|
| 204 |
|
| 205 |
-
$$
|
|
|
|
|
|
|
| 206 |
|
| 207 |
### 8. Spectral Norm & Attention Entropy Anchoring
|
| 208 |
|
| 209 |
-
Attention projection matrices (
|
| 210 |
|
| 211 |
-
The dominant singular value
|
| 212 |
|
| 213 |
-
$$
|
|
|
|
|
|
|
| 214 |
|
| 215 |
-
$$
|
|
|
|
|
|
|
| 216 |
|
| 217 |
If the merged spectral radius grows more than 5% relative to the base model, it is scaled down:
|
| 218 |
|
| 219 |
-
$$
|
|
|
|
|
|
|
| 220 |
|
| 221 |
---
|
| 222 |
|
| 223 |
## Layer-Stratified Component Policies
|
| 224 |
|
| 225 |
-
| Parameter Class | Target Identifiers | Applied Policy | Density (
|
| 226 |
| :--- | :--- | :---: | :---: | :--- |
|
| 227 |
| **Embeddings & LM Head** | `embed_tokens`, `lm_head` | Low-Memory Streaming Blend | 1.0 | Convex iterative accumulation; vocab dimension aligned to 248,320. |
|
| 228 |
| **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. |
|
| 229 |
-
| **Self-Attention Projections** | `self_attn.qkv_proj`, `o_proj` | Asymmetric GQA + Spectral Anchor | 0.95 (QK) / 0.70 (V) | Power-iteration clipping prevents
|
| 230 |
-
| **Feed-Forward Blocks** | `mlp.gate_proj`, `up_proj`, `down_proj` | Neuron-Gated HG-DELLA | 0.50 – 0.70 | Row-wise cosine filtering (
|
| 231 |
-
| **Recurrent Gates & Normalization** | `A_log`, `norm`, `conv1d` | Convex Parameter Blend | 1.0 | Preservation of
|
| 232 |
|
| 233 |
---
|
| 234 |
|
|
|
|
| 33 |
|
| 34 |
<div align="center">
|
| 35 |
|
| 36 |
+
# PentaCoder-9B
|
| 37 |
+
|
| 38 |
+
**Frontier-Calibrated 9B Hybrid Gated DeltaNet Causal Engine for Autonomous Software Engineering**
|
| 39 |
+
|
| 40 |
[](https://opensource.org/licenses/Apache-2.0)
|
| 41 |
[](https://github.com/huggingface/transformers)
|
| 42 |
[](#merge-methodology--mathematical-formulation)
|
|
|
|
| 58 |
|
| 59 |
> [!IMPORTANT]
|
| 60 |
> The result is a lean, blisteringly fast 9B pure-text causal engine with a native **256k context window** that runs comfortably on consumer GPUs.
|
| 61 |
+
|
| 62 |
---
|
| 63 |
|
| 64 |
### Contents
|
|
|
|
| 80 |
| :--- | :---: |
|
| 81 |
| **Total Parameters** | 8.8B (Pure Text Backbone) |
|
| 82 |
| **Architecture Type** | Hybrid Recurrent-Attention Causal LM (`qwen3_5_text`) |
|
| 83 |
+
| **Hidden Dimension** (*d*<sub>model</sub>) | 4096 |
|
| 84 |
+
| **Intermediate Dimension** (*d*<sub>mlp</sub>) | 12288 (SwiGLU) |
|
| 85 |
| **Decoder Layers** | 32 |
|
| 86 |
+
| **Attention Layout** | 8 Blocks × (3 Gated DeltaNet Linear Layers : 1 Gated Softmax Layer) |
|
| 87 |
| **Full Attention Layers** | Layers 3, 7, 11, 15, 19, 23, 27, 31 |
|
| 88 |
+
| **Linear Attention Configuration** | 16 Key Heads / 32 Value Heads (*d*<sub>k</sub> = *d*<sub>v</sub> = 128) |
|
| 89 |
+
| **Full Attention Configuration** | 16 Query Heads / 4 Key-Value Heads (GQA, *d*<sub>h</sub> = 256) |
|
| 90 |
+
| **Rotary Position Embedding (RoPE)** | 1D Partial RoPE (θ = 10⁷, Factor = 0.25 → 64 dimensions) |
|
| 91 |
| **Context Window Length** | 262,144 tokens (256k) |
|
| 92 |
| **Native Precision** | `bfloat16` |
|
| 93 |
| **Vocabulary Size** | 248,320 (Padded for Fill-In-The-Middle and Tool Tokens) |
|
|
|
|
| 96 |
|
| 97 |
## Composition & Donor Weighting
|
| 98 |
|
| 99 |
+
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]:
|
| 100 |
|
| 101 |
| Model | Primary Focus | Depth Target |
|
| 102 |
| :--- | :--- | :---: |
|
| 103 |
+
| [Qwen/Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B) | Base pre-trained manifold and state-space anchors | Global (*W*₀) |
|
| 104 |
| [empero-ai/Qwen3.8-9B-Distill](https://huggingface.co/empero-ai/Qwen3.8-9B-Distill) | Abstract token synthesis, reasoning structure, syntax | Lower & Mid Decoders |
|
| 105 |
| [Jackrong/Qwopus3.5-9B-Coder](https://huggingface.co/Jackrong/Qwopus3.5-9B-Coder) | Typing discipline, algorithm design, functional purity | Mid Decoders (Bell Curve) |
|
| 106 |
| [ornith-ai/Ornith-1.5-9B](https://huggingface.co/ornith-ai/Ornith-1.5-9B) | Circuit-breaker recovery, environment feedback integration | Upper-Mid Decoders |
|
|
|
|
| 115 |
|
| 116 |
### 1. Task Vector Formulation
|
| 117 |
|
| 118 |
+
For each donor checkpoint *k* ∈ {1, ..., 5}, the parameter update delta τ<sub>*k*</sub> is computed relative to the base anchor *W*₀:
|
| 119 |
|
| 120 |
+
$$
|
| 121 |
+
\tau_k = D_k - W_0, \quad k \in \{\text{Qwen3.8}, \text{Qwopus}, \text{Ornith}, \text{OxCoder}, \text{MiMo}\}
|
| 122 |
+
$$
|
| 123 |
|
| 124 |
### 2. Hybrid-Aware Continuous Depth Modulation
|
| 125 |
|
| 126 |
+
Task vector mixing coefficients are continuously modulated over normalized depth *u* = *l* / (*L* - 1), where *l* ∈ [0, 31] and *L* = 32:
|
| 127 |
|
| 128 |
+
$$
|
| 129 |
+
u_{\text{qwen38}}(u) = 0.15 + 0.35 \cos^2\left(\frac{\pi}{2} u\right) + 0.15 \sin^2(\pi u)
|
| 130 |
+
$$
|
| 131 |
|
| 132 |
+
$$
|
| 133 |
+
u_{\text{qwopus}}(u) = 0.05 + 0.35 \sin^2(\pi u)
|
| 134 |
+
$$
|
| 135 |
|
| 136 |
+
$$
|
| 137 |
+
u_{\text{ornith}}(u) = 0.05 + 0.35 \sin^2\left(\frac{\pi}{2} u\right)
|
| 138 |
+
$$
|
| 139 |
|
| 140 |
+
$$
|
| 141 |
+
u_{\text{oxcoder}}(u) = 0.05 + 0.25 \sin^2\left(\frac{\pi}{2} u\right)
|
| 142 |
+
$$
|
| 143 |
|
| 144 |
+
$$
|
| 145 |
+
u_{\text{mimo}}(u) = 0.05 + 0.15 \sin(\pi u)
|
| 146 |
+
$$
|
| 147 |
|
| 148 |
+
The initial coefficients are normalized to form a partition of unity across all layers:
|
| 149 |
|
| 150 |
+
$$
|
| 151 |
+
w_k(l) = \frac{u_k(u)}{\sum_{j=1}^5 u_j(u)}, \quad \sum_{k=1}^5 w_k(l) = 1.0
|
| 152 |
+
$$
|
| 153 |
|
| 154 |
### 3. Dynamic Gram-Matrix Task De-Biasing
|
| 155 |
|
| 156 |
+
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:
|
| 157 |
|
| 158 |
+
$$
|
| 159 |
+
G_{ij} = \frac{|\langle \text{vec}(\tau_i), \text{vec}(\tau_j) \rangle|}{\|\tau_i\|_2 \|\tau_j\|_2}
|
| 160 |
+
$$
|
| 161 |
|
| 162 |
+
A uniqueness coefficient *U*<sub>*k*</sub> is derived from the inverse column sum of task vector correlations:
|
| 163 |
|
| 164 |
+
$$
|
| 165 |
+
U_k = \frac{1}{\sum_{j=1}^K G_{kj}}
|
| 166 |
+
$$
|
| 167 |
|
| 168 |
The dynamic weights are then re-balanced and normalized:
|
| 169 |
|
| 170 |
+
$$
|
| 171 |
+
\tilde{w}_k = \frac{w_k U_k}{\sum_{j=1}^K w_j U_j}
|
| 172 |
+
$$
|
| 173 |
|
| 174 |
This prevents dataset overlap from suppressing distinct algorithmic representations.
|
| 175 |
|
|
|
|
| 178 |
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.
|
| 179 |
|
| 180 |
Fused projection tensors are sliced into their functional sub-matrices prior to merging:
|
| 181 |
+
- **Gated DeltaNet Layers (8192 × *d*<sub>model</sub>):** Sliced into Query (2048), Key (2048), and Value (4096).
|
| 182 |
+
- **Gated Attention Layers (6144 × *d*<sub>model</sub>):** Sliced into Query (4096), Key (1024), and Value (1024).
|
| 183 |
|
| 184 |
+
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.
|
| 185 |
|
| 186 |
### 5. Neuron-Coherent Row Gating
|
| 187 |
|
| 188 |
To eliminate destructive interference in Feed-Forward Networks (MLPs), task vectors are gated at the single-neuron (row) level:
|
| 189 |
|
| 190 |
+
$$
|
| 191 |
+
\bar{\tau} = \frac{1}{K} \sum_{k=1}^K \tau_k
|
| 192 |
+
$$
|
| 193 |
|
| 194 |
+
For each row *r* of donor delta τ<sub>*k*</sub>, the directional alignment with the consensus mean is evaluated:
|
| 195 |
|
| 196 |
+
$$
|
| 197 |
+
\cos \theta_{k, r} = \frac{\langle \tau_{k, r}, \bar{\tau}_r \rangle}{\|\tau_{k, r}\|_2 \|\bar{\tau}_r\|_2 + \epsilon}
|
| 198 |
+
$$
|
| 199 |
|
| 200 |
+
Rows exhibiting severe directional opposition (cos θ<sub>*k*, *r*</sub> < -0.10) are masked out:
|
| 201 |
|
| 202 |
+
$$
|
| 203 |
+
\hat{\tau}_{k, r} = \tau_{k, r} \cdot \mathbb{I}\left(\cos \theta_{k, r} \ge -0.10\right)
|
| 204 |
+
$$
|
| 205 |
|
| 206 |
This eliminates opposing gradient vectors that produce incoherent syntax generation.
|
| 207 |
|
| 208 |
### 6. Heavy-Tailed DELLA Adaptive Rescaling
|
| 209 |
|
| 210 |
+
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:
|
| 211 |
|
| 212 |
+
$$
|
| 213 |
+
p_{k, ij} = p_{\min} + (p_{\max} - p_{\min}) \cdot \sqrt{R_{k, ij}}
|
| 214 |
+
$$
|
| 215 |
|
| 216 |
Parameters are sampled via a Bernoulli trial and rescaled by their inverse survival probability:
|
| 217 |
|
| 218 |
+
$$
|
| 219 |
+
M_{k, ij} \sim \text{Bernoulli}(p_{k, ij})
|
| 220 |
+
$$
|
| 221 |
|
| 222 |
+
$$
|
| 223 |
+
\tilde{\tau}_{k, ij} = \frac{\hat{\tau}_{k, ij} \odot M_{k, ij}}{p_{k, ij}}
|
| 224 |
+
$$
|
| 225 |
|
| 226 |
### 7. Coordinate-Wise Sign Consensus & Model Stock Scaling
|
| 227 |
|
| 228 |
Directional consensus is determined via weighted sign agreement:
|
| 229 |
|
| 230 |
+
$$
|
| 231 |
+
\Gamma = \operatorname{sgn}\left(\sum_{k=1}^K \tilde{w}_k \tilde{\tau}_k\right)
|
| 232 |
+
$$
|
| 233 |
|
| 234 |
+
$$
|
| 235 |
+
A_k = \mathbb{I}\left(\operatorname{sgn}(\tilde{\tau}_k) = \Gamma\right) \odot \mathbb{I}\left(\tilde{\tau}_k \neq 0\right)
|
| 236 |
+
$$
|
| 237 |
|
| 238 |
+
$$
|
| 239 |
+
\Delta_{\text{consensus}} = \frac{\sum_{k=1}^K \tilde{\tau}_k \odot A_k}{\sum_{k=1}^K A_k + \epsilon}
|
| 240 |
+
$$
|
| 241 |
|
| 242 |
+
The aggregated delta is projected onto the non-linear manifold using the Model Stock analytic scaling factor *t*<sup>*</sup>:
|
| 243 |
|
| 244 |
+
$$
|
| 245 |
+
\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}
|
| 246 |
+
$$
|
| 247 |
|
| 248 |
+
$$
|
| 249 |
+
t^* = \frac{K \bar{\rho}}{1 + (K - 1)\bar{\rho}}
|
| 250 |
+
$$
|
| 251 |
|
| 252 |
+
$$
|
| 253 |
+
\Delta_{\text{final}} = t^* \cdot \Delta_{\text{consensus}}
|
| 254 |
+
$$
|
| 255 |
|
| 256 |
### 8. Spectral Norm & Attention Entropy Anchoring
|
| 257 |
|
| 258 |
+
Attention projection matrices (*W*<sub>attn</sub>) are vulnerable to spectral explosion during merges, which contracts attention entropy and leads to repetitive generation loops.
|
| 259 |
|
| 260 |
+
The dominant singular value σ(*W*) is calculated via a three-iteration deterministic power iteration:
|
| 261 |
|
| 262 |
+
$$
|
| 263 |
+
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}
|
| 264 |
+
$$
|
| 265 |
|
| 266 |
+
$$
|
| 267 |
+
\sigma(W) \approx {u^{(3)}}^T W v^{(3)}
|
| 268 |
+
$$
|
| 269 |
|
| 270 |
If the merged spectral radius grows more than 5% relative to the base model, it is scaled down:
|
| 271 |
|
| 272 |
+
$$
|
| 273 |
+
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}
|
| 274 |
+
$$
|
| 275 |
|
| 276 |
---
|
| 277 |
|
| 278 |
## Layer-Stratified Component Policies
|
| 279 |
|
| 280 |
+
| Parameter Class | Target Identifiers | Applied Policy | Density (ρ) | Mathematical Constraints |
|
| 281 |
| :--- | :--- | :---: | :---: | :--- |
|
| 282 |
| **Embeddings & LM Head** | `embed_tokens`, `lm_head` | Low-Memory Streaming Blend | 1.0 | Convex iterative accumulation; vocab dimension aligned to 248,320. |
|
| 283 |
| **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. |
|
| 284 |
+
| **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 σ₀. |
|
| 285 |
+
| **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. |
|
| 286 |
+
| **Recurrent Gates & Normalization** | `A_log`, `norm`, `conv1d` | Convex Parameter Blend | 1.0 | Preservation of *A*<sub>log</sub> ≤ 0 to guarantee BIBO stability. |
|
| 287 |
|
| 288 |
---
|
| 289 |
|