Dat1710 commited on
Commit
b2ce9eb
·
verified ·
1 Parent(s): 60cfc76

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +172 -135
README.md CHANGED
@@ -1,199 +1,236 @@
1
  ---
2
  library_name: transformers
3
- tags: []
 
 
 
 
 
 
 
 
 
 
 
 
4
  ---
5
 
6
- # Model Card for Model ID
7
 
8
- <!-- Provide a quick summary of what the model is/does. -->
 
 
 
 
 
 
9
 
 
10
 
 
11
 
12
- ## Model Details
13
-
14
- ### Model Description
15
-
16
- <!-- Provide a longer summary of what this model is. -->
17
-
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
-
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
-
28
- ### Model Sources [optional]
29
-
30
- <!-- Provide the basic links for the model. -->
31
-
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
-
36
- ## Uses
37
-
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
-
40
- ### Direct Use
41
-
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
-
44
- [More Information Needed]
45
-
46
- ### Downstream Use [optional]
47
-
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
-
50
- [More Information Needed]
51
-
52
- ### Out-of-Scope Use
53
-
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
-
56
- [More Information Needed]
57
-
58
- ## Bias, Risks, and Limitations
59
-
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
-
62
- [More Information Needed]
63
-
64
- ### Recommendations
65
-
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
-
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
-
70
- ## How to Get Started with the Model
71
-
72
- Use the code below to get started with the model.
73
-
74
- [More Information Needed]
75
-
76
- ## Training Details
77
-
78
- ### Training Data
79
-
80
- <!-- 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. -->
81
-
82
- [More Information Needed]
83
-
84
- ### Training Procedure
85
-
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
 
88
- #### Preprocessing [optional]
89
 
90
- [More Information Needed]
91
 
 
 
92
 
93
- #### Training Hyperparameters
94
 
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
 
 
 
 
96
 
97
- #### Speeds, Sizes, Times [optional]
98
 
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
 
101
- [More Information Needed]
102
 
103
- ## Evaluation
104
 
105
- <!-- This section describes the evaluation protocols and provides the results. -->
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
- ### Testing Data, Factors & Metrics
108
 
109
- #### Testing Data
110
 
111
- <!-- This should link to a Dataset Card if possible. -->
112
 
113
- [More Information Needed]
 
 
 
 
114
 
115
- #### Factors
116
 
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
 
 
 
118
 
119
- [More Information Needed]
120
 
121
- #### Metrics
 
 
 
 
122
 
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
 
125
- [More Information Needed]
126
 
127
- ### Results
128
 
129
- [More Information Needed]
 
130
 
131
- #### Summary
132
 
 
 
 
 
 
 
133
 
 
 
134
 
135
- ## Model Examination [optional]
 
 
 
136
 
137
- <!-- Relevant interpretability work for the model goes here -->
 
 
 
 
138
 
139
- [More Information Needed]
140
 
141
- ## Environmental Impact
 
 
 
 
 
142
 
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
 
 
 
144
 
145
- 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).
 
 
146
 
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
 
153
- ## Technical Specifications [optional]
 
 
 
 
 
154
 
155
- ### Model Architecture and Objective
156
 
157
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
 
159
- ### Compute Infrastructure
160
 
161
- [More Information Needed]
162
 
163
- #### Hardware
164
 
165
- [More Information Needed]
166
 
167
- #### Software
168
 
169
- [More Information Needed]
 
 
 
 
170
 
171
- ## Citation [optional]
172
 
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
 
175
- **BibTeX:**
176
 
177
- [More Information Needed]
178
 
179
- **APA:**
180
 
181
- [More Information Needed]
 
 
 
182
 
183
- ## Glossary [optional]
184
 
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
 
187
- [More Information Needed]
188
 
189
- ## More Information [optional]
 
 
 
 
 
 
 
 
 
190
 
191
- [More Information Needed]
192
 
193
- ## Model Card Authors [optional]
194
 
195
- [More Information Needed]
196
 
197
- ## Model Card Contact
198
 
199
- [More Information Needed]
 
1
  ---
2
  library_name: transformers
3
+ tags:
4
+ - math
5
+ - reasoning
6
+ - reinforcement-learning
7
+ - qwen2
8
+ - mathematics
9
+ - chain-of-thought
10
+ license: apache-2.0
11
+ language:
12
+ - en
13
+ - zh
14
+ base_model: Qwen/Qwen2.5-Math-1.5B-Instruct
15
+ pipeline_tag: text-generation
16
  ---
17
 
18
+ # Nexus-1.5B
19
 
20
+ <p align="center">
21
+ <img src="https://img.shields.io/badge/Base%20Model-Qwen2.5--Math--1.5B--Instruct-orange" />
22
+ <img src="https://img.shields.io/badge/Parameters-1.54B-blue" />
23
+ <img src="https://img.shields.io/badge/Method-LPRO-green" />
24
+ <img src="https://img.shields.io/badge/MATH--500-80.2-red" />
25
+ <img src="https://img.shields.io/badge/GSM8K-85.2-red" />
26
+ </p>
27
 
28
+ **Nexus-1.5B** is a 1.54-billion-parameter mathematical reasoning model developed by [Neuriton](https://neuriton.ai), trained via **Length-Penalized Reward Optimization (LPRO)** — a novel reinforcement learning alignment method that improves both accuracy and response conciseness simultaneously.
29
 
30
+ Built on top of `Qwen2.5-Math-1.5B-Instruct`, Nexus-1.5B achieves **80.2 on MATH-500** and **85.2 on GSM8K** (CoT), surpassing its base model by **+4.4 points** on MATH-500 while reducing average response length by **14%**.
31
 
32
+ ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
+ ## What is LPRO?
35
 
36
+ Standard GRPO (Group Relative Policy Optimization) suffers from two key problems:
37
 
38
+ 1. **Length bias** — short responses receive disproportionately large gradient signals, implicitly penalizing long correct derivations.
39
+ 2. **Entropy collapse** — symmetric probability-ratio clipping causes the policy to converge to a narrow set of solution patterns, limiting further improvement.
40
 
41
+ **LPRO** fixes both with three targeted modifications:
42
 
43
+ | Component | What it does |
44
+ |---|---|
45
+ | **Asymmetric clipping** | Decouples the lower and upper clip bounds (`ε_low=0.20`, `ε_high=0.28`) to preserve policy entropy |
46
+ | **Token-level normalization** | Replaces per-response weight `1/G` with global weight `1/Σ|oᵢ|` to produce an unbiased gradient estimate |
47
+ | **Length-penalized advantage** | Adds a group-standardized length penalty: `Aᵢ = (rᵢ - μᵣ)/(σᵣ + ε) - λ·(Lᵢ - μ_L)/(σ_L + ε)` |
48
 
49
+ The final objective is:
50
 
51
+ $$\mathcal{J}_{\text{LPRO}}(\theta) = \mathbb{E}\left[\frac{1}{\sum_{i=1}^{G}|o_i|} \sum_{i=1}^{G}\sum_{t=1}^{|o_i|} \min\!\left(r_{i,t}(\theta)\,\hat{A}_{i,t},\ \text{clip}_{\text{asym}}(r_{i,t}(\theta))\,\hat{A}_{i,t}\right)\right]$$
52
 
53
+ ---
54
 
55
+ ## Model Details
56
 
57
+ | Property | Value |
58
+ |---|---|
59
+ | **Base model** | `Qwen/Qwen2.5-Math-1.5B-Instruct` |
60
+ | **Parameters** | 1.54B |
61
+ | **Architecture** | Transformer Decoder (28 layers, GQA, RoPE, SwiGLU, RMSNorm) |
62
+ | **Context length** | 8,192 tokens |
63
+ | **Vocabulary size** | 128,256 |
64
+ | **Training method** | LPRO (RL fine-tuning, no distillation) |
65
+ | **Training data** | 100 difficulty-filtered problems from MATH-500 |
66
+ | **Group size G** | 4 |
67
+ | **Length penalty λ** | 0.10 |
68
+ | **Learning rate** | 1e-6 |
69
+ | **PPO epochs/iter** | 4 |
70
 
71
+ ---
72
 
73
+ ## Benchmark Results
74
 
75
+ ### Chain-of-Thought (CoT)
76
 
77
+ | Model | GSM8K | MATH-500 | MMLU-STEM | CMATH | GaoKao Cloze | GaoKao QA |
78
+ |---|---|---|---|---|---|---|
79
+ | Qwen2-Math-1.5B-Instruct | 84.2 | 69.4 | 54.9 | 79.6 | 59.7 | 50.7 |
80
+ | Qwen2.5-Math-1.5B-Instruct | 84.8 | 75.8 | 57.5 | 83.0 | 65.5 | 54.1 |
81
+ | **Nexus-1.5B** | **85.2** | **80.2** | **60.3** | **83.5** | **67.2** | **56.9** |
82
 
83
+ ### Tool-Integrated Reasoning (TIR)
84
 
85
+ | Model | MATH-500 | Minerva Math | GaoKao 2023 EN | Olympiad Bench | College Math |
86
+ |---|---|---|---|---|---|
87
+ | Qwen2.5-Math-1.5B-Instruct | 80.0 | 34.0 | 68.0 | 49.0 | 54.0 |
88
+ | **Nexus-1.5B** | **84.0** | **40.0** | **74.0** | **56.0** | **57.0** |
89
 
90
+ ### Ablation: Effect of Length Penalty (λ)
91
 
92
+ | λ | MATH-500 Acc. | Avg. Response Length |
93
+ |---|---|---|
94
+ | 0.0 (GRPO baseline) | 77.4 | 312 tokens |
95
+ | **0.1 (Nexus-1.5B)** | **80.2** | **268 tokens** |
96
+ | 0.3 (over-penalized) | 78.0 | 201 tokens |
97
 
98
+ > **Key insight:** At λ=0.1, accuracy and conciseness improve simultaneously. The length penalty acts as a de-noising regularizer — discouraging redundant steps rather than suppressing genuinely long derivations.
99
 
100
+ ---
101
 
102
+ ## How to Use
103
 
104
+ ```python
105
+ from transformers import AutoModelForCausalLM, AutoTokenizer
106
 
107
+ model_name = "Dat1710/nexus-1.5b"
108
 
109
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
110
+ model = AutoModelForCausalLM.from_pretrained(
111
+ model_name,
112
+ torch_dtype="auto",
113
+ device_map="auto"
114
+ )
115
 
116
+ # Chain-of-Thought prompt
117
+ system_prompt = "Please reason step by step, and put your final answer within \\boxed{}."
118
 
119
+ messages = [
120
+ {"role": "system", "content": system_prompt},
121
+ {"role": "user", "content": "Find all functions f: ℝ⁺ → ℝ⁺ such that for each x ∈ ℝ⁺, there is exactly one y ∈ ℝ⁺ satisfying xf(y) + yf(x) ≤ 2."}
122
+ ]
123
 
124
+ text = tokenizer.apply_chat_template(
125
+ messages,
126
+ tokenize=False,
127
+ add_generation_prompt=True
128
+ )
129
 
130
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
131
 
132
+ generated_ids = model.generate(
133
+ **model_inputs,
134
+ max_new_tokens=2048,
135
+ temperature=0.7,
136
+ do_sample=True,
137
+ )
138
 
139
+ generated_ids = [
140
+ output_ids[len(input_ids):]
141
+ for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
142
+ ]
143
 
144
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
145
+ print(response)
146
+ ```
147
 
148
+ ### Tool-Integrated Reasoning (TIR)
 
 
 
 
149
 
150
+ ```python
151
+ system_prompt = (
152
+ "Please integrate natural language reasoning with programs to solve the problem above, "
153
+ "and put your final answer within \\boxed{}."
154
+ )
155
+ ```
156
 
157
+ ---
158
 
159
+ ## Evaluation Prompt Format
160
+
161
+ **CoT (8-shot for GSM8K, 4-shot for MATH-500):**
162
+ ```
163
+ <|im_start|>system
164
+ Please reason step by step, and put your final answer within \boxed{}.<|im_end|>
165
+ <|im_start|>user
166
+ {problem}<|im_end|>
167
+ <|im_start|>assistant
168
+ ```
169
+
170
+ **TIR (zero-shot):**
171
+ ```
172
+ <|im_start|>system
173
+ Please integrate natural language reasoning with programs to solve the problem above,
174
+ and put your final answer within \boxed{}.<|im_end|>
175
+ <|im_start|>user
176
+ {problem}<|im_end|>
177
+ <|im_start|>assistant
178
+ ```
179
 
180
+ ---
181
 
182
+ ## Training Details
183
 
184
+ ### Data Curation
185
 
186
+ Training problems are sourced from **MATH-500** and filtered by difficulty using a learnable-zone criterion: a problem is retained if, among 8 sampled solutions from the base model, **between 2 and 5 are correct**. This yields 100 training problems that provide meaningful gradient signal — neither trivially easy nor intractably hard.
187
 
188
+ ### Training Procedure
189
 
190
+ 1. **Group sampling:** For each prompt, sample G=4 responses from the current policy.
191
+ 2. **Reward computation:** Rule-based binary reward (correctness via symbolic answer matching) + small format bonus (α=0.1) for well-formed `\boxed{}` output.
192
+ 3. **Advantage computation:** Compute length-penalized group z-score advantages.
193
+ 4. **Policy update:** Maximize LPRO objective for 4 epochs per iteration.
194
+ 5. **Iterate:** Set old policy ← new policy and repeat.
195
 
196
+ ### Reward Function
197
 
198
+ $$r_i = \mathbf{1}[\hat{a}(o_i) = a^*] + 0.1 \cdot \mathbf{1}[\text{format}(o_i)]$$
199
 
200
+ where $\hat{a}(o_i)$ is the extracted answer from the last `\boxed{}` expression, verified via symbolic equivalence.
201
 
202
+ ---
203
 
204
+ ## Limitations
205
 
206
+ - **Scale:** Nexus-1.5B operates at 1.54B parameters. Hard olympiad problems (e.g., AIME) remain challenging for models at this scale.
207
+ - **Language:** Primarily optimized for English and Chinese mathematical text. Performance on other languages is not evaluated.
208
+ - **Domain:** Designed for mathematical reasoning. General language understanding or instruction-following tasks are outside the model's training distribution.
209
+ - **TIR dependency:** Tool-integrated reasoning requires a sandboxed Python interpreter at inference time.
210
 
211
+ ---
212
 
213
+ ## Citation
214
 
215
+ If you use Nexus-1.5B in your research, please cite:
216
 
217
+ ```bibtex
218
+ @techreport{neuriton2026nexus,
219
+ title = {Nexus-1.5B: Length-Penalized Reward Optimization for Robust Mathematical Reasoning},
220
+ author = {Neuriton Team},
221
+ institution = {Neuriton},
222
+ year = {2026},
223
+ month = {Summer},
224
+ note = {Technical Report}
225
+ }
226
+ ```
227
 
228
+ ---
229
 
230
+ ## Acknowledgements
231
 
232
+ We thank the Qwen Team at Alibaba Group for open-sourcing the Qwen2.5-Math model family, and the authors of DAPO for the asymmetric clipping insight that is central to LPRO.
233
 
234
+ ---
235
 
236
+ *Developed by [Neuriton](https://neuriton.ai) · Summer 2026*