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
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
[](https://opensource.org/licenses/Apache-2.0)
|
| 37 |
+
[](https://github.com/huggingface/transformers)
|
| 38 |
+
[](#merge-methodology--mathematical-formulation)
|
| 39 |
+
[](#architectural-specifications)
|
| 40 |
+
[-EB5757?style=for-the-badge)](#architectural-specifications)
|
| 41 |
+
[](#architectural-specifications)
|
| 42 |
+
|
| 43 |
+
</div>
|
| 44 |
+
|
| 45 |
+
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.
|
| 46 |
+
|
| 47 |
+
**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:
|
| 48 |
+
|
| 49 |
+
- **Algorithmic Correctness & Architectural Decomposition** from [**Qwopus3.5-Coder**](https://huggingface.co/Jackrong/Qwopus3.5-9B-Coder) (Claude 3.5 Opus distillation trajectories).
|
| 50 |
+
- **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).
|
| 51 |
+
- **Terminal Execution Discipline & Error-Recovery Heuristics** from [**Ornith-1.5**](https://huggingface.co/ornith-ai/Ornith-1.5-9B) (Reinforcement learning for anti-looping).
|
| 52 |
+
- **Low-Level Systems Implementation & Runtime Robustness** from [**OxCoder**](https://huggingface.co/OrionLLM/OxCoder-9B) (Deep API, CLI, and operational coding specialization).
|
| 53 |
+
- **Abstract Structural Reasoning & Syntax Grounding** from [**Qwen3.8-Distill**](https://huggingface.co/empero-ai/Qwen3.8-9B-Distill) (Distilled frontier chain-of-thought representations).
|
| 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
|
| 60 |
+
|
| 61 |
+
- [Architectural Specifications](#architectural-specifications)
|
| 62 |
+
- [Composition & Donor Weighting](#composition--donor-weighting)
|
| 63 |
+
- [Merge Methodology & Mathematical Formulation](#merge-methodology--mathematical-formulation)
|
| 64 |
+
- [Layer-Stratified Component Policies](#layer-stratified-component-policies)
|
| 65 |
+
- [Agentic Chat Template & Operational Directives](#agentic-chat-template--operational-directives)
|
| 66 |
+
- [Recommended Generation Parameters](#recommended-generation-parameters)
|
| 67 |
+
- [How to Use](#how-to-use)
|
| 68 |
+
- [Citation & References](#citation--references)
|
| 69 |
+
|
| 70 |
+
---
|
| 71 |
+
|
| 72 |
+
## Architectural Specifications
|
| 73 |
+
|
| 74 |
+
| Parameter | Specification |
|
| 75 |
+
| :--- | :---: |
|
| 76 |
+
| **Total Parameters** | 8.8B (Pure Text Backbone) |
|
| 77 |
+
| **Architecture Type** | Hybrid Recurrent-Attention Causal LM (`qwen3_5_text`) |
|
| 78 |
+
| **Hidden Dimension** ($d_{\text{model}}$) | 4096 |
|
| 79 |
+
| **Intermediate Dimension** ($d_{\text{mlp}}$) | 12288 (SwiGLU) |
|
| 80 |
+
| **Decoder Layers** | 32 |
|
| 81 |
+
| **Attention Layout** | 8 Blocks $\times$ (3 Gated DeltaNet Linear Layers : 1 Gated Softmax Layer) |
|
| 82 |
+
| **Full Attention Layers** | Layers 3, 7, 11, 15, 19, 23, 27, 31 |
|
| 83 |
+
| **Linear Attention Configuration** | 16 Key Heads / 32 Value Heads ($d_k = d_v = 128$) |
|
| 84 |
+
| **Full Attention Configuration** | 16 Query Heads / 4 Key-Value Heads (GQA, $d_h = 256$) |
|
| 85 |
+
| **Rotary Position Embedding (RoPE)** | 1D Partial RoPE ($\theta = 10^7$, Partial Factor = 0.25 $\rightarrow$ 64 dimensions) |
|
| 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) |
|
| 89 |
+
|
| 90 |
+
---
|
| 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 ($W_0$). Five specialized donor checkpoints provide non-overlapping task vectors mapped across normalized layer depth $u \in [0, 1]$:
|
| 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 ($W_0$) |
|
| 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 |
|
| 102 |
+
| [OrionLLM/OxCoder-9B](https://huggingface.co/OrionLLM/OxCoder-9B) | Systems engineering, runtime bug localization, CLI tooling | Deep Layers (Ascending Ramp) |
|
| 103 |
+
| [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 |
|
| 104 |
+
|
| 105 |
+
---
|
| 106 |
+
|
| 107 |
+
## Merge Methodology & Mathematical Formulation
|
| 108 |
+
|
| 109 |
+
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.
|
| 110 |
+
|
| 111 |
+
### 1. Task Vector Formulation
|
| 112 |
+
|
| 113 |
+
For each donor checkpoint $k \in \{1, \dots, 5\}$, the parameter update delta $\tau_k$ is computed relative to the base anchor $W_0$:
|
| 114 |
+
|
| 115 |
+
$$\tau_k = D_k - W_0, \quad k \in \{\text{Qwen3.8}, \text{Qwopus}, \text{Ornith}, \text{OxCoder}, \text{MiMo}\}$$
|
| 116 |
+
|
| 117 |
+
### 2. Hybrid-Aware Continuous Depth Modulation
|
| 118 |
+
|
| 119 |
+
Task vector mixing coefficients are continuously modulated over normalized depth $u = \frac{l}{L-1}$, where $l \in [0, 31]$ and $L = 32$:
|
| 120 |
+
|
| 121 |
+
$$u_{\text{qwen38}}(u) = 0.15 + 0.35 \cos^2\left(\frac{\pi}{2} u\right) + 0.15 \sin^2(\pi u)$$
|
| 122 |
+
|
| 123 |
+
$$u_{\text{qwopus}}(u) = 0.05 + 0.35 \sin^2(\pi u)$$
|
| 124 |
+
|
| 125 |
+
$$u_{\text{ornith}}(u) = 0.05 + 0.35 \sin^2\left(\frac{\pi}{2} u\right)$$
|
| 126 |
+
|
| 127 |
+
$$u_{\text{oxcoder}}(u) = 0.05 + 0.25 \sin^2\left(\frac{\pi}{2} u\right)$$
|
| 128 |
+
|
| 129 |
+
$$u_{\text{mimo}}(u) = 0.05 + 0.15 \sin(\pi u)$$
|
| 130 |
+
|
| 131 |
+
The initial coefficients are normalized to form a partition of unity:
|
| 132 |
+
|
| 133 |
+
$$w_k(l) = \frac{u_k(u)}{\sum_{j=1}^5 u_j(u)}, \quad \sum_{k=1}^5 w_k(l) = 1.0$$
|
| 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 $G \in \mathbb{R}^{K \times K}$ is evaluated per tensor:
|
| 138 |
+
|
| 139 |
+
$$G_{ij} = \frac{|\langle \text{vec}(\tau_i), \text{vec}(\tau_j) \rangle|}{\|\tau_i\|_2 \|\tau_j\|_2}$$
|
| 140 |
+
|
| 141 |
+
A uniqueness coefficient $U_k$ is derived from the inverse column sum of task vector correlations:
|
| 142 |
+
|
| 143 |
+
$$U_k = \frac{1}{\sum_{j=1}^K G_{kj}}$$
|
| 144 |
+
|
| 145 |
+
The dynamic weights are then re-balanced and normalized:
|
| 146 |
+
|
| 147 |
+
$$\tilde{w}_k = \frac{w_k U_k}{\sum_{j=1}^K w_j U_j}$$
|
| 148 |
+
|
| 149 |
+
This prevents dataset overlap from suppressing distinct algorithmic representations.
|
| 150 |
+
|
| 151 |
+
### 4. Asymmetric GQA Disentangled QKV Slicing
|
| 152 |
+
|
| 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 ($8192 \times d_{\text{model}}$):** Sliced into Query ($2048$), Key ($2048$), and Value ($4096$).
|
| 157 |
+
- **Gated Attention Layers ($6144 \times d_{\text{model}}$):** Sliced into Query ($4096$), Key ($1024$), and Value ($1024$).
|
| 158 |
+
|
| 159 |
+
Query and Key slices are processed with a conservative retention density ($\rho = 0.95$) to preserve sharp context routing. Value matrices are processed with adaptive MLP density ($\rho = 0.70$) to maximize conceptual synthesis. The components are then re-concatenated along the head dimension.
|
| 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 |
+
$$\bar{\tau} = \frac{1}{K} \sum_{k=1}^K \tau_k$$
|
| 166 |
+
|
| 167 |
+
For each row $r$ of donor delta $\tau_k$, the directional alignment with the consensus mean is evaluated:
|
| 168 |
+
|
| 169 |
+
$$\cos \theta_{k, r} = \frac{\langle \tau_{k, r}, \bar{\tau}_r \rangle}{\|\tau_{k, r}\|_2 \|\bar{\tau}_r\|_2 + \epsilon}$$
|
| 170 |
+
|
| 171 |
+
Rows exhibiting severe directional opposition ($\cos \theta_{k, r} < -0.10$) are masked out:
|
| 172 |
+
|
| 173 |
+
$$\hat{\tau}_{k, r} = \tau_{k, r} \cdot \mathbb{I}\left(\cos \theta_{k, r} \ge -0.10\right)$$
|
| 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 $R_{k, ij} \in [0, 1]$ sorted by absolute magnitude, a Pareto-style retention probability $p_{k, ij}$ is established:
|
| 180 |
+
|
| 181 |
+
$$p_{k, ij} = p_{\min} + (p_{\max} - p_{\min}) \cdot \sqrt{R_{k, ij}}$$
|
| 182 |
+
|
| 183 |
+
Parameters are sampled via a Bernoulli trial and rescaled by their inverse survival probability:
|
| 184 |
+
|
| 185 |
+
$$M_{k, ij} \sim \text{Bernoulli}(p_{k, ij})$$
|
| 186 |
+
|
| 187 |
+
$$\tilde{\tau}_{k, ij} = \frac{\hat{\tau}_{k, ij} \odot M_{k, ij}}{p_{k, ij}}$$
|
| 188 |
+
|
| 189 |
+
### 7. Coordinate-Wise Sign Consensus & Model Stock Scaling
|
| 190 |
+
|
| 191 |
+
Directional consensus is determined via weighted sign agreement:
|
| 192 |
+
|
| 193 |
+
$$\Gamma = \operatorname{sgn}\left(\sum_{k=1}^K \tilde{w}_k \tilde{\tau}_k\right)$$
|
| 194 |
+
|
| 195 |
+
$$A_k = \mathbb{I}\left(\operatorname{sgn}(\tilde{\tau}_k) = \Gamma\right) \odot \mathbb{I}\left(\tilde{\tau}_k \neq 0\right)$$
|
| 196 |
+
|
| 197 |
+
$$\Delta_{\text{consensus}} = \frac{\sum_{k=1}^K \tilde{\tau}_k \odot A_k}{\sum_{k=1}^K A_k + \epsilon}$$
|
| 198 |
+
|
| 199 |
+
The aggregated delta is projected onto the non-linear manifold using the Model Stock analytic scaling factor $t^*$:
|
| 200 |
+
|
| 201 |
+
$$\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}$$
|
| 202 |
+
|
| 203 |
+
$$t^* = \frac{K \bar{\rho}}{1 + (K - 1)\bar{\rho}}$$
|
| 204 |
+
|
| 205 |
+
$$\Delta_{\text{final}} = t^* \cdot \Delta_{\text{consensus}}$$
|
| 206 |
+
|
| 207 |
+
### 8. Spectral Norm & Attention Entropy Anchoring
|
| 208 |
+
|
| 209 |
+
Attention projection matrices ($W_{\text{attn}}$) are vulnerable to spectral explosion during merges, which contracts attention entropy and leads to repetitive generation loops.
|
| 210 |
+
|
| 211 |
+
The dominant singular value $\sigma(W)$ is calculated via a three-iteration deterministic power iteration:
|
| 212 |
+
|
| 213 |
+
$$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}$$
|
| 214 |
+
|
| 215 |
+
$$\sigma(W) \approx {u^{(3)}}^T W v^{(3)}$$
|
| 216 |
+
|
| 217 |
+
If the merged spectral radius grows more than 5% relative to the base model, it is scaled down:
|
| 218 |
+
|
| 219 |
+
$$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}$$
|
| 220 |
+
|
| 221 |
+
---
|
| 222 |
+
|
| 223 |
+
## Layer-Stratified Component Policies
|
| 224 |
+
|
| 225 |
+
| Parameter Class | Target Identifiers | Applied Policy | Density ($\rho$) | Mathematical Constraints |
|
| 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 $\sigma > 1.05 \sigma_0$. |
|
| 230 |
+
| **Feed-Forward Blocks** | `mlp.gate_proj`, `up_proj`, `down_proj` | Neuron-Gated HG-DELLA | 0.50 – 0.70 | Row-wise cosine filtering ($\cos \theta \ge -0.10$); sign consensus. |
|
| 231 |
+
| **Recurrent Gates & Normalization** | `A_log`, `norm`, `conv1d` | Convex Parameter Blend | 1.0 | Preservation of $A_{\text{log}} \le 0$ to guarantee BIBO stability. |
|
| 232 |
+
|
| 233 |
+
---
|
| 234 |
+
|
| 235 |
+
## Agentic Chat Template & Operational Directives
|
| 236 |
+
|
| 237 |
+
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.
|
| 238 |
+
|
| 239 |
+
---
|
| 240 |
+
|
| 241 |
+
## Recommended Generation Parameters
|
| 242 |
+
|
| 243 |
+
For deterministic software engineering and complex reasoning benchmarks:
|
| 244 |
+
|
| 245 |
+
| Parameter | Recommended Value | Description |
|
| 246 |
+
| :--- | :---: | :--- |
|
| 247 |
+
| **Temperature** | `0.6` | Balances strict syntactic validity with algorithmic path exploration. |
|
| 248 |
+
| **Top-P** | `0.95` | Eliminates low-probability token tails while preserving alternative logic paths. |
|
| 249 |
+
| **Top-K** | `20` | Restricts token candidate pools to prevent architectural syntax drift. |
|
| 250 |
+
| **Min-P** | `0.0` (Off) | Disabled in favor of explicit Top-K / Top-P governance. |
|
| 251 |
+
| **Repetition Penalty** | `1.0` (Off) | Disabled to prevent syntax degradation in repetitive code patterns (indentation, braces). |
|
| 252 |
+
| **Presence Penalty** | `0.0` | Prevents naming mutations across long-context symbol resolution. |
|
| 253 |
+
|
| 254 |
+
---
|
| 255 |
+
|
| 256 |
+
## How to Use
|
| 257 |
+
|
| 258 |
+
### Serving via vLLM
|
| 259 |
+
|
| 260 |
+
```bash
|
| 261 |
+
vllm serve pragmaticcs/PentaCoder \
|
| 262 |
+
--dtype bfloat16 \
|
| 263 |
+
--max-model-len 65536 \
|
| 264 |
+
--gpu-memory-utilization 0.95 \
|
| 265 |
+
--enable-prefix-caching \
|
| 266 |
+
--enable-auto-tool-choice \
|
| 267 |
+
--tool-call-parser qwen3_coder \
|
| 268 |
+
--enable-reasoning \
|
| 269 |
+
--reasoning-parser qwen3
|
| 270 |
+
```
|
| 271 |
+
|
| 272 |
+
### Inference via Transformers
|
| 273 |
+
|
| 274 |
+
```python
|
| 275 |
+
import torch
|
| 276 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 277 |
+
|
| 278 |
+
model_id = "pragmaticcs/PentaCoder-9B"
|
| 279 |
+
|
| 280 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 281 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 282 |
+
model_id, torch_dtype=torch.bfloat16, device_map="auto"
|
| 283 |
+
)
|
| 284 |
+
|
| 285 |
+
messages = [
|
| 286 |
+
{
|
| 287 |
+
"role": "system",
|
| 288 |
+
"content": "You are an expert systems engineer. Reason step by step and output clean, robust implementations.",
|
| 289 |
+
},
|
| 290 |
+
{
|
| 291 |
+
"role": "user",
|
| 292 |
+
"content": "Write an asynchronous connection pool in Python for TCP sockets with active health-checking, backpressure control, and graceful shutdown handling.",
|
| 293 |
+
},
|
| 294 |
+
]
|
| 295 |
+
|
| 296 |
+
inputs = tokenizer.apply_chat_template(
|
| 297 |
+
messages, add_generation_prompt=True, enable_thinking=True, return_tensors="pt"
|
| 298 |
+
).to(model.device)
|
| 299 |
+
|
| 300 |
+
outputs = model.generate(
|
| 301 |
+
inputs,
|
| 302 |
+
max_new_tokens=4096,
|
| 303 |
+
temperature=0.6,
|
| 304 |
+
top_p=0.95,
|
| 305 |
+
top_k=20,
|
| 306 |
+
do_sample=True,
|
| 307 |
+
)
|
| 308 |
+
|
| 309 |
+
response = tokenizer.decode(outputs[0][inputs.shape[-1] :], skip_special_tokens=True)
|
| 310 |
+
print(response)
|
| 311 |
+
```
|
| 312 |
+
|
| 313 |
+
---
|
| 314 |
+
|
| 315 |
+
## Citation & References
|
| 316 |
+
|
| 317 |
+
- [Qwen/Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B)
|
| 318 |
+
- [XiaomiMiMo/MiMo-V2.6-Distill-Qwen-9B](https://huggingface.co/XiaomiMiMo/MiMo-V2.6-Distill-Qwen-9B)
|
| 319 |
+
- [ornith-ai/Ornith-1.5-9B](https://huggingface.co/ornith-ai/Ornith-1.5-9B)
|
| 320 |
+
- [Jackrong/Qwopus3.5-9B-Coder](https://huggingface.co/Jackrong/Qwopus3.5-9B-Coder)
|
| 321 |
+
- [OrionLLM/OxCoder-9B](https://huggingface.co/OrionLLM/OxCoder-9B)
|
| 322 |
+
- [empero-ai/Qwen3.8-9B-Distill](https://huggingface.co/empero-ai/Qwen3.8-9B-Distill)
|
| 323 |
+
- [Improved Chat Template for Qwen 3.x](https://huggingface.co/OliviaRossi/Improved-Chat-Template-for-Qwen-3.x)
|
| 324 |
+
|
| 325 |
+
```bibtex
|
| 326 |
+
@inproceedings{yadav2023ties,
|
| 327 |
+
title={Resolving Interference When Merging Models},
|
| 328 |
+
author={Yadav, Prateek and Tam, Derek and Choshen, Leshem and Raffel, Colin and Bansal, Mohit},
|
| 329 |
+
booktitle={Advances in Neural Information Processing Systems (NeurIPS)},
|
| 330 |
+
volume={36},
|
| 331 |
+
pages={7093--7115},
|
| 332 |
+
year={2023}
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
@article{deep2024della,
|
| 336 |
+
title={DELLA-Merging: Reducing Interference in Model Merging through Magnitude-Based Sampling},
|
| 337 |
+
author={Deep, Pala Tej and Bhardwaj, Rishabh and Poria, Soujanya},
|
| 338 |
+
journal={arXiv preprint arXiv:2406.11617},
|
| 339 |
+
year={2024}
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
@article{jang2024modelstock,
|
| 343 |
+
title={Model Stock: All We Need Is just a Few Fine-Tuned Models},
|
| 344 |
+
author={Jang, Dong-Hwan and Yoon, Sang-Doo and Song, Gyeong-Moon},
|
| 345 |
+
journal={arXiv preprint arXiv:2403.19522},
|
| 346 |
+
year={2024}
|
| 347 |
+
}
|
| 348 |
+
```
|