danielcherubini commited on
Commit
774bfaa
·
verified ·
1 Parent(s): 42962aa

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +184 -186
README.md CHANGED
@@ -1,211 +1,209 @@
1
  ---
2
- license: apache-2.0
3
  base_model: Qwen/Qwen3.5-9B
4
- tags:
5
- - qwen3.5
6
- - code
7
- - tool-calling
8
- - lora
9
- - sft
10
- - dpo
11
- - unsloth
12
- - reasoning
13
- - chain-of-thought
14
- datasets:
15
- - nohurry/Opus-4.6-Reasoning-3000x-filtered
16
- - Roman1111111/claude-opus-4.6-10000x
17
- - TeichAI/claude-4.5-opus-high-reasoning-250x
18
- - Jackrong/Qwen3.5-reasoning-700x
19
- - togethercomputer/CoderForge-Preview
20
- - TIGER-Lab/AceCode-V2-122K
21
- language:
22
- - en
23
  pipeline_tag: text-generation
 
 
 
 
 
 
24
  ---
25
 
26
- # Qwen3.5-DeltaCoder-9B
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
- > Reliable tool-calling for agentic coding LoRA fine-tune of Qwen3.5-9B
29
- > **v1.1-DPO released** — DPO alignment improves code correctness and self-verification.
30
- > If you downloaded before March 28, 2026, please re-pull to get v1.1-DPO.
31
 
32
- [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
33
- [![Base Model](https://img.shields.io/badge/Base-Qwen3.5--9B-purple)](https://huggingface.co/Qwen/Qwen3.5-9B)
34
- [![HuggingFace](https://img.shields.io/badge/HuggingFace-GGUF-yellow)](https://huggingface.co/danielcherubini/Qwen3.5-DeltaCoder-9B-GGUF)
35
- [![LoRA](https://img.shields.io/badge/HuggingFace-LoRA-orange)](https://huggingface.co/danielcherubini/Qwen3.5-DeltaCoder-9B)
36
 
37
- Small language models can reason about code, but they struggle to **call tools reliably**. DeltaCoder takes a strong reasoning base and teaches it to produce correctly-formatted JSON tool calls — the kind that coding agents like [OpenCode](https://github.com/opencode-ai/opencode), [Pi](https://github.com/badlogic/pi-mono), and [Cline](https://github.com/cline/cline) depend on.
38
 
39
- v1.1-DPO adds **Direct Preference Optimization** to further improve code correctness the model now self-corrects its own bugs rather than submitting wrong answers.
40
 
41
- ## Downloads
42
 
43
- | Format | Link | Size |
44
- |--------|------|------|
45
- | GGUF Q4_K_M (recommended) | [HuggingFace](https://huggingface.co/danielcherubini/Qwen3.5-DeltaCoder-9B-GGUF) | ~5.5 GB |
46
- | GGUF Q5_K_M | [HuggingFace](https://huggingface.co/danielcherubini/Qwen3.5-DeltaCoder-9B-GGUF) | ~6.5 GB |
47
- | GGUF BF16 | [HuggingFace](https://huggingface.co/danielcherubini/Qwen3.5-DeltaCoder-9B-GGUF) | ~17.9 GB |
48
- | DPO LoRA adapter | [HuggingFace](https://huggingface.co/danielcherubini/Qwen3.5-DeltaCoder-9B) | ~700 MB |
49
 
50
- ## The Problem
51
 
52
- [Jackrong's Qwen3.5-9B reasoning distill](https://huggingface.co/Jackrong/Qwen3.5-9B-Claude-4.6-Opus-Reasoning-Distilled-v2) scores **53.7% on HumanEval** — best-in-class at 9B. But when used as a coding agent, it frequently produces malformed JSON tool calls:
53
 
54
- ```
55
- tool=edit, error=JSON Parse error: Property name must be a string literal
56
- tool=bash, error=JSON Parse error: Expected '}'
57
- ```
58
 
59
- **DeltaCoder fixes this**, and v1.1-DPO further improves code correctness through preference learning.
60
 
61
- ## What's New in v1.1-DPO
62
 
63
- - **Self-correcting behavior** detects and fixes its own bugs during agentic tasks
64
- - **Improved code correctness** — trained on 4,519 preference pairs from AceCode-V2-122K
65
- - **Two-stage merge** v1 SFT tool-calling improvements + DPO code quality improvements combined
66
- - **13 GGUF quants** — from Q2_K to BF16, covering all VRAM configurations
 
67
 
68
  ## Training Details
69
 
70
- ### v1 — SFT (Tool-Call Reliability)
71
-
72
- | Parameter | Value |
73
- |-----------|-------|
74
- | Base model | Qwen3.5-9B (hybrid GDN architecture) |
75
- | Method | LoRA (r=64, alpha=32) |
76
- | Dataset | [CoderForge-Preview](https://huggingface.co/datasets/togethercomputer/CoderForge-Preview) `filtered_reward1` (50K subset) |
77
- | Sequence length | 4096 |
78
- | Effective batch size | 16 |
79
- | Learning rate | 1e-4 (cosine) |
80
- | Epochs | 1 |
81
- | Hardware | NVIDIA H200 140GB (Vast.ai) |
82
- | Training time | ~10 hours |
83
- | Final loss | ~0.94 |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
- ### v1.1 DPO (Code Correctness)
86
 
87
- | Parameter | Value |
88
- |-----------|-------|
89
- | Method | DPO (Direct Preference Optimization) |
90
- | Dataset | [AceCode-V2-122K](https://huggingface.co/datasets/TIGER-Lab/AceCode-V2-122K) — 4,519 preference pairs |
91
- | Pair generation | 10K problems × 8 samples, keep if ≥1 pass AND ≥1 fail (45% keep rate) |
92
- | Beta | 0.1 |
93
- | Loss type | sigmoid |
94
- | Learning rate | 5e-6 (cosine) |
95
- | Effective batch size | 16 |
96
- | Hardware | NVIDIA H100 80GB (Vast.ai) |
97
- | Training time | ~3.7 hours |
98
- | Final loss | 0.538 |
99
- | Rewards/margins (final) | ~1.0 |
100
- | Rewards/accuracies (final) | ~80% |
101
-
102
- ### LoRA Target Modules
103
-
104
- All major weight matrices adapted across the hybrid architecture:
105
-
106
- - **Full Attention** (8/32 layers): `q_proj`, `k_proj`, `v_proj`, `o_proj`
107
- - **Gated Delta Net** (24/32 layers): `in_proj_qkv`, `in_proj_z`, `in_proj_b`, `in_proj_a`, `out_proj`
108
- - **MLP** (all 32 layers): `gate_proj`, `up_proj`, `down_proj`
109
-
110
- ## Usage
111
-
112
- ### Ollama
113
-
114
- ```bash
115
- ollama create deltacoder -f Modelfile
116
- ```
117
-
118
- ### llama.cpp / ik_llama.cpp
119
-
120
- ```bash
121
- ./llama-server -m DeltaCoder-9B-v1.1-DPO-Q5_K_M.gguf -ngl 999 -c 131072 -ctk f16 -ctv q4_0 -fa 1 --jinja
122
- ```
123
-
124
- ### With PEFT (Python)
125
-
126
- ```python
127
- from transformers import AutoModelForCausalLM, AutoTokenizer
128
- from peft import PeftModel
129
- import torch
130
-
131
- base = AutoModelForCausalLM.from_pretrained(
132
- "Jackrong/Qwen3.5-9B-Claude-4.6-Opus-Reasoning-Distilled-v2",
133
- torch_dtype=torch.bfloat16,
134
- trust_remote_code=True,
135
- )
136
- model = PeftModel.from_pretrained(base, "danielcherubini/Qwen3.5-DeltaCoder-9B")
137
- tokenizer = AutoTokenizer.from_pretrained("danielcherubini/Qwen3.5-DeltaCoder-9B")
138
- ```
139
-
140
- ## Benchmarks
141
-
142
- | Model | HumanEval | HumanEval+ | Terminal-Bench Easy |
143
- |-------|-----------|------------|-------------------|
144
- | Jackrong Qwen3.5-9B-v2 (base) | 53.7% | — | — |
145
- | DeltaCoder-9B v1 (temp=0.6) | 50.6% | 49.4% | 2/4 (50%) |
146
- | **DeltaCoder-9B v1.1-DPO** (temp=0.6) | TBD | TBD | 2/4 (50%)* |
147
-
148
- *v1.1-DPO timed out on 2 tasks that v1 answered incorrectly — behavioral improvement confirmed, re-evaluating with extended timeout.
149
-
150
- ## Recommended Sampling Settings
151
-
152
- | Parameter | Value |
153
- |-----------|-------|
154
- | temperature | 0.6 |
155
- | top_k | 20 |
156
- | top_p | 0.95 |
157
- | min_p | 0.0 |
158
- | presence_penalty | 0.0 |
159
- | repeat_penalty | 1.0 |
160
-
161
- > [!WARNING]
162
- > **Do not use temperature below 0.5** — low temperatures cause deterministic looping in multi-turn agentic use.
163
-
164
- ### KV Cache Quantization
165
-
166
- | Context Length | KV Cache | VRAM (Q4_K_M) | Generation Speed |
167
- |---------------|----------|---------------|-----------------|
168
- | 102,400 | f16/q4_0 | ~8.5 GB | ~111 tok/s |
169
- | 131,072 | f16/q4_0 | ~9.1 GB | ~110 tok/s |
170
-
171
- ## Key Findings
172
-
173
- > [!NOTE]
174
- > **Qwen3.5 is a VLM** — Unsloth treats it as a vision model. For text-only DPO training, use standard HuggingFace + PEFT + TRL directly (no Unsloth DPOTrainer).
175
-
176
- > [!WARNING]
177
- > **Do not use `flash_attention_2` with sample packing on Qwen3.5** — training loss goes to 0. Use `attn_implementation="eager"` instead.
178
-
179
- - Qwen3.5 uses **Gated Delta Networks** — include `in_proj_qkv`, `in_proj_z`, `in_proj_b`, `in_proj_a`, `out_proj` in LoRA target modules or 75% of attention layers are untrained
180
- - DPO pairs generated on-policy using `Qwen/Qwen3.5-9B` base with vLLM async inference (32 concurrent requests)
181
- - Keep rate of 45.2% from 10K AceCode problems (4,519 pairs used for training)
182
-
183
- ## Project Structure
184
-
185
- ```
186
- scripts/
187
- train_unsloth.py # v1 SFT training
188
- train_dpo.py # v1.1 DPO training (HF + PEFT + TRL)
189
- generate_dpo_pairs.py # Async on-policy pair generation
190
- merge_and_export_dpo.py # Two-stage merge + GGUF export
191
- ```
192
-
193
- ## Status
194
 
195
- - [x] v1 SFT fine-tune (CoderForge, H200, ~10hrs)
196
- - [x] GGUF export (all quants Q2_K → BF16)
197
- - [x] HumanEval benchmarking (50.6% / 49.4%)
198
- - [x] Terminal-Bench evaluation (2/4 easy tasks)
199
- - [x] DPO pair generation (4,519 pairs from AceCode-V2-122K)
200
- - [x] v1.1-DPO training (H100, ~3.7hrs)
201
- - [x] v1.1-DPO GGUF export + HuggingFace release
202
- - [ ] v1.1-DPO HumanEval benchmarking
203
- - [ ] v1.1-DPO Terminal-Bench extended timeout evaluation
204
 
205
- ## Acknowledgements
 
206
 
207
- - [Unsloth](https://unsloth.ai) for Qwen3.5 SFT training support
208
- - [Together AI](https://together.ai) for the CoderForge dataset
209
- - [TIGER Lab](https://huggingface.co/TIGER-Lab) for AceCode-V2-122K
210
- - [Jackrong](https://huggingface.co/Jackrong) for the reasoning distillation
211
- - [Qwen](https://huggingface.co/Qwen) for the base model
 
1
  ---
 
2
  base_model: Qwen/Qwen3.5-9B
3
+ library_name: peft
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  pipeline_tag: text-generation
5
+ tags:
6
+ - base_model:adapter:Qwen/Qwen3.5-9B
7
+ - dpo
8
+ - lora
9
+ - transformers
10
+ - trl
11
  ---
12
 
13
+ # Model Card for Model ID
14
+
15
+ <!-- Provide a quick summary of what the model is/does. -->
16
+
17
+
18
+
19
+ ## Model Details
20
+
21
+ ### Model Description
22
+
23
+ <!-- Provide a longer summary of what this model is. -->
24
+
25
+
26
+
27
+ - **Developed by:** [More Information Needed]
28
+ - **Funded by [optional]:** [More Information Needed]
29
+ - **Shared by [optional]:** [More Information Needed]
30
+ - **Model type:** [More Information Needed]
31
+ - **Language(s) (NLP):** [More Information Needed]
32
+ - **License:** [More Information Needed]
33
+ - **Finetuned from model [optional]:** [More Information Needed]
34
+
35
+ ### Model Sources [optional]
36
+
37
+ <!-- Provide the basic links for the model. -->
38
+
39
+ - **Repository:** [More Information Needed]
40
+ - **Paper [optional]:** [More Information Needed]
41
+ - **Demo [optional]:** [More Information Needed]
42
+
43
+ ## Uses
44
+
45
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
46
+
47
+ ### Direct Use
48
+
49
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
50
+
51
+ [More Information Needed]
52
+
53
+ ### Downstream Use [optional]
54
 
55
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
 
 
56
 
57
+ [More Information Needed]
 
 
 
58
 
59
+ ### Out-of-Scope Use
60
 
61
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
62
 
63
+ [More Information Needed]
64
 
65
+ ## Bias, Risks, and Limitations
 
 
 
 
 
66
 
67
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
68
 
69
+ [More Information Needed]
70
 
71
+ ### Recommendations
 
 
 
72
 
73
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
74
 
75
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
76
 
77
+ ## How to Get Started with the Model
78
+
79
+ Use the code below to get started with the model.
80
+
81
+ [More Information Needed]
82
 
83
  ## Training Details
84
 
85
+ ### Training Data
86
+
87
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
88
+
89
+ [More Information Needed]
90
+
91
+ ### Training Procedure
92
+
93
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
94
+
95
+ #### Preprocessing [optional]
96
+
97
+ [More Information Needed]
98
+
99
+
100
+ #### Training Hyperparameters
101
+
102
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
103
+
104
+ #### Speeds, Sizes, Times [optional]
105
+
106
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
107
+
108
+ [More Information Needed]
109
+
110
+ ## Evaluation
111
+
112
+ <!-- This section describes the evaluation protocols and provides the results. -->
113
+
114
+ ### Testing Data, Factors & Metrics
115
+
116
+ #### Testing Data
117
+
118
+ <!-- This should link to a Dataset Card if possible. -->
119
+
120
+ [More Information Needed]
121
+
122
+ #### Factors
123
+
124
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
125
+
126
+ [More Information Needed]
127
+
128
+ #### Metrics
129
+
130
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
131
+
132
+ [More Information Needed]
133
+
134
+ ### Results
135
+
136
+ [More Information Needed]
137
+
138
+ #### Summary
139
+
140
+
141
+
142
+ ## Model Examination [optional]
143
+
144
+ <!-- Relevant interpretability work for the model goes here -->
145
+
146
+ [More Information Needed]
147
+
148
+ ## Environmental Impact
149
+
150
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
151
+
152
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
153
+
154
+ - **Hardware Type:** [More Information Needed]
155
+ - **Hours used:** [More Information Needed]
156
+ - **Cloud Provider:** [More Information Needed]
157
+ - **Compute Region:** [More Information Needed]
158
+ - **Carbon Emitted:** [More Information Needed]
159
+
160
+ ## Technical Specifications [optional]
161
+
162
+ ### Model Architecture and Objective
163
+
164
+ [More Information Needed]
165
+
166
+ ### Compute Infrastructure
167
+
168
+ [More Information Needed]
169
+
170
+ #### Hardware
171
+
172
+ [More Information Needed]
173
+
174
+ #### Software
175
+
176
+ [More Information Needed]
177
+
178
+ ## Citation [optional]
179
+
180
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
181
+
182
+ **BibTeX:**
183
+
184
+ [More Information Needed]
185
+
186
+ **APA:**
187
+
188
+ [More Information Needed]
189
+
190
+ ## Glossary [optional]
191
+
192
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
193
+
194
+ [More Information Needed]
195
+
196
+ ## More Information [optional]
197
+
198
+ [More Information Needed]
199
 
200
+ ## Model Card Authors [optional]
201
 
202
+ [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
 
204
+ ## Model Card Contact
 
 
 
 
 
 
 
 
205
 
206
+ [More Information Needed]
207
+ ### Framework versions
208
 
209
+ - PEFT 0.18.1