Quantization files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +4 -0
- README.md +366 -3
- cal_data.safetensors +3 -0
- hidden_states.safetensors +3 -0
- job_new.json +0 -0
- measurement.json +0 -0
- out_tensor/lm_head.safetensors +3 -0
- out_tensor/model.layers.0.mlp.down_proj.safetensors +3 -0
- out_tensor/model.layers.0.mlp.gate_proj.safetensors +3 -0
- out_tensor/model.layers.0.mlp.up_proj.safetensors +3 -0
- out_tensor/model.layers.0.self_attn.k_proj.safetensors +3 -0
- out_tensor/model.layers.0.self_attn.o_proj.safetensors +3 -0
- out_tensor/model.layers.0.self_attn.q_proj.safetensors +3 -0
- out_tensor/model.layers.0.self_attn.v_proj.safetensors +3 -0
- out_tensor/model.layers.1.mlp.down_proj.safetensors +3 -0
- out_tensor/model.layers.1.mlp.gate_proj.safetensors +3 -0
- out_tensor/model.layers.1.mlp.up_proj.safetensors +3 -0
- out_tensor/model.layers.1.self_attn.k_proj.safetensors +3 -0
- out_tensor/model.layers.1.self_attn.o_proj.safetensors +3 -0
- out_tensor/model.layers.1.self_attn.q_proj.safetensors +3 -0
- out_tensor/model.layers.1.self_attn.v_proj.safetensors +3 -0
- out_tensor/model.layers.10.mlp.down_proj.safetensors +3 -0
- out_tensor/model.layers.10.mlp.gate_proj.safetensors +3 -0
- out_tensor/model.layers.10.mlp.up_proj.safetensors +3 -0
- out_tensor/model.layers.10.self_attn.k_proj.safetensors +3 -0
- out_tensor/model.layers.10.self_attn.o_proj.safetensors +3 -0
- out_tensor/model.layers.10.self_attn.q_proj.safetensors +3 -0
- out_tensor/model.layers.10.self_attn.v_proj.safetensors +3 -0
- out_tensor/model.layers.11.mlp.down_proj.safetensors +3 -0
- out_tensor/model.layers.11.mlp.gate_proj.safetensors +3 -0
- out_tensor/model.layers.11.mlp.up_proj.safetensors +3 -0
- out_tensor/model.layers.11.self_attn.k_proj.safetensors +3 -0
- out_tensor/model.layers.11.self_attn.o_proj.safetensors +3 -0
- out_tensor/model.layers.11.self_attn.q_proj.safetensors +3 -0
- out_tensor/model.layers.11.self_attn.v_proj.safetensors +3 -0
- out_tensor/model.layers.12.mlp.down_proj.safetensors +3 -0
- out_tensor/model.layers.12.mlp.gate_proj.safetensors +3 -0
- out_tensor/model.layers.12.mlp.up_proj.safetensors +3 -0
- out_tensor/model.layers.12.self_attn.k_proj.safetensors +3 -0
- out_tensor/model.layers.12.self_attn.o_proj.safetensors +3 -0
- out_tensor/model.layers.12.self_attn.q_proj.safetensors +3 -0
- out_tensor/model.layers.12.self_attn.v_proj.safetensors +3 -0
- out_tensor/model.layers.13.mlp.down_proj.safetensors +3 -0
- out_tensor/model.layers.13.mlp.gate_proj.safetensors +3 -0
- out_tensor/model.layers.13.mlp.up_proj.safetensors +3 -0
- out_tensor/model.layers.13.self_attn.k_proj.safetensors +3 -0
- out_tensor/model.layers.13.self_attn.o_proj.safetensors +3 -0
- out_tensor/model.layers.13.self_attn.q_proj.safetensors +3 -0
- out_tensor/model.layers.13.self_attn.v_proj.safetensors +3 -0
- out_tensor/model.layers.14.mlp.down_proj.safetensors +3 -0
.gitattributes
CHANGED
@@ -34,3 +34,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
37 |
+
assets/fig1.png filter=lfs diff=lfs merge=lfs -text
|
38 |
+
assets/fig2.png filter=lfs diff=lfs merge=lfs -text
|
39 |
+
assets/fig3.png filter=lfs diff=lfs merge=lfs -text
|
40 |
+
assets/tab4.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,3 +1,366 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
base_model:
|
4 |
+
- Tongyi-Zhiwen/QwenLong-L1-32B
|
5 |
+
tags:
|
6 |
+
- long-context
|
7 |
+
- large-reasoning-model
|
8 |
+
pipeline_tag: text-generation
|
9 |
+
library_name: exllamav2
|
10 |
+
---
|
11 |
+
|
12 |
+
## Quantization
|
13 |
+
|
14 |
+
```
|
15 |
+
python ./exllamav2/convert.py \
|
16 |
+
-i /models/Tongyi-Zhiwen/QwenLong-L1-32B \
|
17 |
+
-o /models/Tongyi-Zhiwen/QwenLong-L1-32B-4.25bpw \
|
18 |
+
-cf /models/Tongyi-Zhiwen/QwenLong-L1-32B-4.25bpw \
|
19 |
+
-b 4.25 -hb 8 -ss 0
|
20 |
+
```
|
21 |
+
|
22 |
+
---
|
23 |
+
|
24 |
+
# QwenLong-L1: Towards Long-Context Large Reasoning Models with Reinforcement Learning
|
25 |
+
|
26 |
+
<p align="center" width="100%">
|
27 |
+
</p>
|
28 |
+
|
29 |
+
<div id="top" align="center">
|
30 |
+
|
31 |
+
---
|
32 |
+
|
33 |
+
[](https://opensource.org/licenses/Apache-2.0)
|
34 |
+
[](https://arxiv.org/abs/2505.17667)
|
35 |
+
[](https://github.com/Tongyi-Zhiwen/QwenLong-L1)
|
36 |
+
[](https://modelscope.cn/models/iic/QwenLong-L1-32B)
|
37 |
+
[](https://huggingface.co/Tongyi-Zhiwen/QwenLong-L1-32B)
|
38 |
+
|
39 |
+
<!-- **Authors:** -->
|
40 |
+
|
41 |
+
_**Fanqi Wan, Weizhou Shen, Shengyi Liao, Yingcheng Shi, Chenliang Li,**_
|
42 |
+
|
43 |
+
_**Ziyi Yang, Ji Zhang, Fei Huang, Jingren Zhou, Ming Yan**_
|
44 |
+
|
45 |
+
<!-- **Affiliations:** -->
|
46 |
+
|
47 |
+
_Tongyi Lab, Alibaba Group_
|
48 |
+
|
49 |
+
<p align="center">
|
50 |
+
<img src="./assets/fig1.png" width="100%"> <br>
|
51 |
+
</p>
|
52 |
+
|
53 |
+
</div>
|
54 |
+
|
55 |
+
## 🎉 News
|
56 |
+
|
57 |
+
- **May 28, 2025:** 🔥 We release [🤗 QwenLong-L1-32B-AWQ](https://huggingface.co/Tongyi-Zhiwen/QwenLong-L1-32B-AWQ), which has undergone AWQ int4 quantization using the ms-swift framework.
|
58 |
+
|
59 |
+
- **May 26, 2025:** 🔥 We release [🤗 QwenLong-L1-32B](https://huggingface.co/Tongyi-Zhiwen/QwenLong-L1-32B), which is the first long-context LRM trained with reinforcement learning for long-context reasoning. Experiments on seven long-context DocQA benchmarks demonstrate that **QwenLong-L1-32B outperforms flagship LRMs like OpenAI-o3-mini and Qwen3-235B-A22B, achieving performance on par with Claude-3.7-Sonnet-Thinking**, demonstrating leading performance among state-of-the-art LRMs.
|
60 |
+
|
61 |
+
- **May 26, 2025:** 🔥 We release [🤗 DocQA-RL-1.6K](https://huggingface.co/datasets/Tongyi-Zhiwen/DocQA-RL-1.6K), which is a specialized RL training dataset comprising 1.6K document question answering (DocQA) problems spanning mathematical, logical, and multi-hop reasoning domains.
|
62 |
+
|
63 |
+
## 📚 Introduction
|
64 |
+
|
65 |
+
In this work, we propose QwenLong-L1, a novel reinforcement learning (RL) framework designed to facilitate the transition of LRMs from short-context proficiency to robust long-context generalization. In our preliminary experiments, we illustrate the differences between the training dynamics of short-context and long-context reasoning RL.
|
66 |
+
|
67 |
+
<p align="center">
|
68 |
+
<img src="./assets/fig2.png" width="100%"> <br>
|
69 |
+
</p>
|
70 |
+
|
71 |
+
Our framework enhances short-context LRMs through progressive context scaling during RL training. The framework comprises three core components: a warm-up supervised fine-tuning (SFT) phase to initialize a robust policy, a curriculum-guided RL phase that facilitates stable adaptation from short to long contexts, and a difficulty-aware retrospective sampling mechanism that adjusts training complexity across stages to incentivize policy exploration. Leveraging recent RL algorithms, including GRPO and DAPO, our framework integrates hybrid reward functions combining rule-based and model-based binary outcome rewards to balance precision and recall. Through strategic utilization of group relative advantages during policy optimization, it guides LRMs to learn effective reasoning patterns essential for robust long-context grounding and superior reasoning capabilities.
|
72 |
+
|
73 |
+
<p align="center">
|
74 |
+
<img src="./assets/fig3.png" width="100%"> <br>
|
75 |
+
</p>
|
76 |
+
|
77 |
+
## 🎯 Model Release
|
78 |
+
|
79 |
+
We release [🤗 QwenLong-L1-32B](https://huggingface.co/Tongyi-Zhiwen/QwenLong-L1-32B), which is the first long-context LRM trained with reinforcement learniing for long-context reasoning. Experiments on seven long-context DocQA benchmarks demonstrate that **QwenLong-L1-32B outperforms flagship LRMs like OpenAI-o3-mini and Qwen3-235B-A22B, achieving performance on par with Claude-3.7-Sonnet-Thinking**, demonstrating leading performance among state-of-the-art LRMs.
|
80 |
+
|
81 |
+
Here are the evaluation results.
|
82 |
+
|
83 |
+
<p align="center">
|
84 |
+
<img src="./assets/tab4.png" width="100%"> <br>
|
85 |
+
</p>
|
86 |
+
|
87 |
+
## 🛠️ Requirements
|
88 |
+
|
89 |
+
```bash
|
90 |
+
# Create the conda environment
|
91 |
+
conda create -n qwenlongl1 python==3.10
|
92 |
+
conda activate qwenlongl1
|
93 |
+
|
94 |
+
# Install requirements
|
95 |
+
pip3 install -r requirements.txt
|
96 |
+
|
97 |
+
# Install verl
|
98 |
+
cd verl
|
99 |
+
pip3 install -e .
|
100 |
+
|
101 |
+
# Install vLLM
|
102 |
+
pip3 install vllm==0.7.3
|
103 |
+
|
104 |
+
# Install flash-attn
|
105 |
+
pip3 install flash-attn --no-build-isolation
|
106 |
+
```
|
107 |
+
|
108 |
+
## 🚀 Quick Start
|
109 |
+
|
110 |
+
Here's how you can run the model using the 🤗 Transformers:
|
111 |
+
|
112 |
+
```python
|
113 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
114 |
+
|
115 |
+
model_name = "Tongyi-Zhiwen/QwenLong-L1-32B"
|
116 |
+
|
117 |
+
# load the tokenizer and the model
|
118 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
119 |
+
model = AutoModelForCausalLM.from_pretrained(
|
120 |
+
model_name,
|
121 |
+
torch_dtype="auto",
|
122 |
+
device_map="auto"
|
123 |
+
)
|
124 |
+
|
125 |
+
# prepare the model input
|
126 |
+
template = """Please read the following text and answer the question below.
|
127 |
+
|
128 |
+
<text>
|
129 |
+
$DOC$
|
130 |
+
</text>
|
131 |
+
|
132 |
+
$Q$
|
133 |
+
|
134 |
+
Format your response as follows: "Therefore, the answer is (insert answer here)"."""
|
135 |
+
context = "<YOUR_CONTEXT_HERE>"
|
136 |
+
question = "<YOUR_QUESTION_HERE>"
|
137 |
+
prompt = template.replace('$DOC$', context.strip()).replace('$Q$', question.strip())
|
138 |
+
messages = [
|
139 |
+
# {"role": "system", "content": "You are QwenLong-L1, created by Alibaba Tongyi Lab. You are a helpful assistant."}, # Use system prompt to define identity when needed.
|
140 |
+
{"role": "user", "content": prompt}
|
141 |
+
]
|
142 |
+
text = tokenizer.apply_chat_template(
|
143 |
+
messages,
|
144 |
+
tokenize=False,
|
145 |
+
add_generation_prompt=True
|
146 |
+
)
|
147 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
148 |
+
|
149 |
+
# conduct text completion
|
150 |
+
generated_ids = model.generate(
|
151 |
+
**model_inputs,
|
152 |
+
max_new_tokens=10000,
|
153 |
+
temperature=0.7,
|
154 |
+
top_p=0.95
|
155 |
+
)
|
156 |
+
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
|
157 |
+
|
158 |
+
# parsing thinking content
|
159 |
+
try:
|
160 |
+
# rindex finding 151649 (</think>)
|
161 |
+
index = len(output_ids) - output_ids[::-1].index(151649)
|
162 |
+
except ValueError:
|
163 |
+
index = 0
|
164 |
+
|
165 |
+
thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
|
166 |
+
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")
|
167 |
+
|
168 |
+
print("thinking content:", thinking_content)
|
169 |
+
print("content:", content)
|
170 |
+
```
|
171 |
+
|
172 |
+
## ♾️ Processing Long Documents
|
173 |
+
|
174 |
+
For input where the total length (including both input and output) significantly exceeds 32,768 tokens, we recommend using RoPE scaling techniques to handle long texts effectively. We have validated the model's performance on context lengths of up to 131,072 tokens using the [YaRN](https://arxiv.org/abs/2309.00071) method.
|
175 |
+
|
176 |
+
YaRN is currently supported by several inference frameworks, e.g., `transformers` and `llama.cpp` for local use, `vllm` and `sglang` for deployment. In general, there are two approaches to enabling YaRN for supported frameworks:
|
177 |
+
|
178 |
+
- Modifying the model files:
|
179 |
+
In the `config.json` file, add the `rope_scaling` fields:
|
180 |
+
```json
|
181 |
+
{
|
182 |
+
...,
|
183 |
+
"rope_scaling": {
|
184 |
+
"rope_type": "yarn",
|
185 |
+
"factor": 4.0,
|
186 |
+
"original_max_position_embeddings": 32768
|
187 |
+
}
|
188 |
+
}
|
189 |
+
```
|
190 |
+
For `llama.cpp`, you need to regenerate the GGUF file after the modification.
|
191 |
+
- Passing command line arguments:
|
192 |
+
|
193 |
+
For `vllm`, you can use
|
194 |
+
`shell
|
195 |
+
vllm serve ... --rope-scaling '{"rope_type":"yarn","factor":4.0,"original_max_position_embeddings":32768}' --max-model-len 131072
|
196 |
+
`
|
197 |
+
For `sglang`, you can use
|
198 |
+
`shell
|
199 |
+
python -m sglang.launch_server ... --json-model-override-args '{"rope_scaling":{"rope_type":"yarn","factor":4.0,"original_max_position_embeddings":32768}}'
|
200 |
+
`
|
201 |
+
For `llama-server` from `llama.cpp`, you can use
|
202 |
+
`shell
|
203 |
+
llama-server ... --rope-scaling yarn --rope-scale 4 --yarn-orig-ctx 32768
|
204 |
+
`
|
205 |
+
|
206 |
+
> [!IMPORTANT]
|
207 |
+
> If you encounter the following warning
|
208 |
+
>
|
209 |
+
> ```
|
210 |
+
> Unrecognized keys in `rope_scaling` for 'rope_type'='yarn': {'original_max_position_embeddings'}
|
211 |
+
> ```
|
212 |
+
>
|
213 |
+
> please upgrade `transformers>=4.51.0`.
|
214 |
+
|
215 |
+
> [!NOTE]
|
216 |
+
> All the notable open-source frameworks implement static YaRN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts.**
|
217 |
+
> We advise adding the `rope_scaling` configuration only when processing long contexts is required.
|
218 |
+
> It is also recommended to modify the `factor` as needed. For example, if the typical context length for your application is 65,536 tokens, it would be better to set `factor` as 2.0.
|
219 |
+
|
220 |
+
> [!NOTE]
|
221 |
+
> If the average context length does not exceed 32,768 tokens, we do not recommend enabling YaRN in this scenario, as it may potentially degrade model performance.
|
222 |
+
|
223 |
+
## 🗂️ Dataset
|
224 |
+
|
225 |
+
To construct a challenging RL dataset for verifiable long-context reasoning, we develop [🤗 DocQA-RL-1.6K](https://huggingface.co/datasets/Tongyi-Zhiwen/DocQA-RL-1.6K), which comprises 1.6K DocQA problems across three reasoning domains:
|
226 |
+
|
227 |
+
(1) Mathematical Reasoning: We use 600 problems from the DocMath dataset, requiring numerical reasoning across long and specialized documents such as financial reports. For DocMath, we sample 75% items from each subset from its valid split for training and 25% for evaluation;
|
228 |
+
|
229 |
+
(2) Logical Reasoning: We employ DeepSeek-R1 to synthesize 600 multi-choice questions requiring logic analysis of real-world documents spanning legal, financial, insurance, and production domains from our curated collection;
|
230 |
+
|
231 |
+
(3) Multi-Hop Reasoning: We sample 200 examples from MultiHopRAG and 200 examples from Musique, emphasizing cross-document reasoning.
|
232 |
+
|
233 |
+
Please download and put the following datasets in `./datasets/` for training and evaluation.
|
234 |
+
|
235 |
+
RL training data: [🤗 DocQA-RL-1.6K](https://huggingface.co/datasets/Tongyi-Zhiwen/DocQA-RL-1.6K).
|
236 |
+
|
237 |
+
Evaluation data: [🤗 docmath](https://huggingface.co/datasets/Tongyi-Zhiwen/docmath), [🤗 frames](https://huggingface.co/datasets/Tongyi-Zhiwen/frames), [🤗 longbench](https://huggingface.co/datasets/Tongyi-Zhiwen/longbench).
|
238 |
+
|
239 |
+
## 💻 Training
|
240 |
+
|
241 |
+
We provide the basic demo training code for single stage RL traininig with DAPO.
|
242 |
+
|
243 |
+
First, we should start a local verifier.
|
244 |
+
|
245 |
+
```bash
|
246 |
+
export CUDA_VISIBLE_DEVICES=0
|
247 |
+
|
248 |
+
vllm serve "Qwen/Qwen2.5-1.5B-Instruct" \
|
249 |
+
--host 0.0.0.0 \
|
250 |
+
--port 23547
|
251 |
+
```
|
252 |
+
|
253 |
+
Then, we start RL training with 4 nodes.
|
254 |
+
|
255 |
+
```bash
|
256 |
+
export PROJ_DIR="<YOUR_PROJ_DIR_HERE>"
|
257 |
+
export MASTER_IP="<YOUR_MASTER_IP_HERE>" # ray master ip
|
258 |
+
export NNODES=4 # total GPU nodes
|
259 |
+
export NODE_RANK=${RANK} # rank of current node
|
260 |
+
export PORT=6382
|
261 |
+
export WANDB_API_KEY="<YOUR_WANDB_API_KEY_HERE>"
|
262 |
+
export WANDB_PROJECT="QwenLong-L1"
|
263 |
+
export LLM_JUDGE=Y # 'Y': LLM JUDGE, 'N': RULE BASED
|
264 |
+
export VLLM_ATTENTION_BACKEND=FLASH_ATTN
|
265 |
+
# verifier
|
266 |
+
export VERIFIER_PATH="Qwen/Qwen2.5-1.5B-Instruct"
|
267 |
+
export VERIFIER_HOST="<YOUR_VERIFIER_HOST_HERE>"
|
268 |
+
export VERIFIER_PORT="23547"
|
269 |
+
|
270 |
+
ray_start_retry() {
|
271 |
+
while true; do
|
272 |
+
ray start --address="${MASTER_IP}:${PORT}"
|
273 |
+
if [ $? -eq 0 ]; then
|
274 |
+
break
|
275 |
+
fi
|
276 |
+
echo "Failed to connect to master, retrying in 5 seconds..."
|
277 |
+
sleep 5
|
278 |
+
done
|
279 |
+
}
|
280 |
+
|
281 |
+
check_ray_status() {
|
282 |
+
until ray status >/dev/null 2>&1; do
|
283 |
+
echo "Waiting for Ray cluster to be ready..."
|
284 |
+
sleep 5
|
285 |
+
done
|
286 |
+
}
|
287 |
+
|
288 |
+
if [ "$RANK" == "0" ]; then
|
289 |
+
echo "Starting HEAD node..."
|
290 |
+
ray start --head --port=${PORT}
|
291 |
+
|
292 |
+
check_ray_status
|
293 |
+
echo "Ray head node started successfully"
|
294 |
+
|
295 |
+
else
|
296 |
+
echo "Starting WORKER node..."
|
297 |
+
ray_start_retry
|
298 |
+
|
299 |
+
check_ray_status
|
300 |
+
echo "Successfully joined Ray cluster"
|
301 |
+
fi
|
302 |
+
|
303 |
+
if [ "$RANK" == "0" ]; then
|
304 |
+
bash ${PROJ_DIR}/scripts/rl_4nodes_dapo.sh 2>&1 | tee ${PROJ_DIR}/logs/rl_log_$(date +%Y%m%d_%H%M%S).txt &
|
305 |
+
else
|
306 |
+
sleep 30d
|
307 |
+
fi
|
308 |
+
|
309 |
+
wait
|
310 |
+
```
|
311 |
+
|
312 |
+
## 📊 Evaluation
|
313 |
+
|
314 |
+
We conduct evaluation on seven long-context DocQA benchmarks, including multi-hop reasoning benchmarks such as 2WikiMultihopQA, HotpotQA, Musique, NarrativeQA, Qasper, and Frames as well as mathematical reasoning benchmarks like DocMath. We report the maximum of exact match and LLM-judged accuracy as the final score, aligned with the reward function in our RL training process. We use DeepSeek-V3 as the judge model with a temperature of 0.0 to provide a reliable evaluation.
|
315 |
+
|
316 |
+
```bash
|
317 |
+
# Step 1. Serve the model for evaluation
|
318 |
+
export CUDA_VISIBLE_DEVICES="0,1,2,3,4,5,6,7"
|
319 |
+
MODEL_NAME="QwenLong-L1-32B"
|
320 |
+
MODEL_PATH="Tongyi-Zhiwen/QwenLong-L1-32B"
|
321 |
+
|
322 |
+
vllm serve ${MODEL_PATH} \
|
323 |
+
--port 23547 \
|
324 |
+
--api-key "token-abc123" \
|
325 |
+
--tensor-parallel-size 8 \
|
326 |
+
--gpu-memory-utilization 0.95 \
|
327 |
+
--max_model_len 131072 \
|
328 |
+
--trust-remote-code
|
329 |
+
|
330 |
+
# Step 2. Generate model responses for each dataset
|
331 |
+
export SERVE_HOST="<YOUR_SERVE_HOST_HERE>" # e.g., 127.0.0.1
|
332 |
+
export SERVE_PORT="23547"
|
333 |
+
PROJ_DIR="<YOUR_PROJ_DIR_HERE>"
|
334 |
+
DATA="<YOUR_DATA_HERE>" # e.g., docmath, frames, 2wikimqa, hotpotqa, musique, narrativeqa, pasper
|
335 |
+
python ${PROJ_DIR}/eval/${DATA}.py \
|
336 |
+
--save_dir "${PROJ_DIR}/eval/results/${DATA}" \
|
337 |
+
--save_file "${MODEL_NAME}" \
|
338 |
+
--model "${MODEL_PATH}" \
|
339 |
+
--tokenizer "${MODEL_PATH}" \
|
340 |
+
--n_proc 16 \
|
341 |
+
--api "openai"
|
342 |
+
|
343 |
+
# Step 3. Verify model responses for each dataset
|
344 |
+
export VERIFIER_API="<YOUR_API_KEY_HERE>"
|
345 |
+
export VERIFIER_URL="https://api.deepseek.com/v1"
|
346 |
+
PROJ_DIR="<YOUR_PROJ_DIR_HERE>"
|
347 |
+
DATA="<YOUR_DATA_HERE>" # e.g., docmath, frames, 2wikimqa, hotpotqa, musique, narrativeqa, pasper
|
348 |
+
python ${PROJ_DIR}/eval/${DATA}_verify.py \
|
349 |
+
--save_dir "${PROJ_DIR}/results/${DATA}" \
|
350 |
+
--save_file "${MODEL_NAME}" \
|
351 |
+
--judge_model "deepseek-chat" \
|
352 |
+
--batch_size 20
|
353 |
+
```
|
354 |
+
|
355 |
+
## 📝 Citation
|
356 |
+
|
357 |
+
If you find this work is relevant with your research or applications, please feel free to cite our work!
|
358 |
+
|
359 |
+
```
|
360 |
+
@article{wan2025qwenlongl1,
|
361 |
+
title={QwenLong-L1: : Towards Long-Context Large Reasoning Models with Reinforcement Learning},
|
362 |
+
author={Fanqi Wan, Weizhou Shen, Shengyi Liao, Yingcheng Shi, Chenliang Li, Ziyi Yang, Ji Zhang, Fei Huang, Jingren Zhou, Ming Yan},
|
363 |
+
journal={arXiv preprint arXiv:2505.17667},
|
364 |
+
year={2025}
|
365 |
+
}
|
366 |
+
```
|
cal_data.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c25140ed462b6fa95addb15202ae3886f521ae95a97343e014153aae06833224
|
3 |
+
size 1884248
|
hidden_states.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9158ce20525e3f8a4685d5700d60fc25a614d174c10e8359000a3db8a4a4cdb6
|
3 |
+
size 2411734936
|
job_new.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
measurement.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
out_tensor/lm_head.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ca51ac2f9e441b8571146edb9587aaabd46ad8c3709d1e72a9af3284a3479a6f
|
3 |
+
size 781630120
|
out_tensor/model.layers.0.mlp.down_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ac0d00b7f86152060667db5c0f9de8152bcd7da2fb2c5bc0297161835d0f031f
|
3 |
+
size 95286880
|
out_tensor/model.layers.0.mlp.gate_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:79152a883864cd4ce7d17912fae42a684e46fdfa6698f29e9cbd830f8b96f108
|
3 |
+
size 92476888
|
out_tensor/model.layers.0.mlp.up_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2f6eb5f5380e16de9842c6d1bc31de41b7dc4d15ce75673426396acac17ad869
|
3 |
+
size 95131088
|
out_tensor/model.layers.0.self_attn.k_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f75662c07a65665a8f19fe310895ff11f18b186ca851d102e26b8d5ed18328e9
|
3 |
+
size 5286768
|
out_tensor/model.layers.0.self_attn.o_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:71271eca9307c32d3c05336f0d25021489842a08e44a1bb300c4067a21419546
|
3 |
+
size 26338064
|
out_tensor/model.layers.0.self_attn.q_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:789202dbd5ee8f14a7bc1dcc9ef8bbe97fb041d563c388e08e6701d71c1b8177
|
3 |
+
size 26348408
|
out_tensor/model.layers.0.self_attn.v_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fca68f5dc42c2a5866530c591cca48eb158b6b51109e2be979941332d92c4450
|
3 |
+
size 5286768
|
out_tensor/model.layers.1.mlp.down_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c21769bdaa23b4534eb0865fe972991fa4214f84dcdb06a33865e886587eeb5b
|
3 |
+
size 61699680
|
out_tensor/model.layers.1.mlp.gate_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:26532cddf35d7e8e4256eb8236d061f4e7c043ee47bc2dca21469234f279b248
|
3 |
+
size 57087448
|
out_tensor/model.layers.1.mlp.up_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2a822dca45e6134075ad84c3456f698d9629bd00d34fb30af183357a208c60fb
|
3 |
+
size 59741648
|
out_tensor/model.layers.1.self_attn.k_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:857d307651ad9da71102fa49db0523c5b315a5a3219bd0e386eef7f4deef2d68
|
3 |
+
size 2751584
|
out_tensor/model.layers.1.self_attn.o_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:624971c04db4ea50bb8554f5e731434af6345b5a825737dc85f47077cddacefb
|
3 |
+
size 13661184
|
out_tensor/model.layers.1.self_attn.q_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:edf931b973dcf8d5a3f200816f1d05be59277a3fa1654d917c0b66cda5935f8a
|
3 |
+
size 13671528
|
out_tensor/model.layers.1.self_attn.v_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:68d66bf6fdd9a3cc7d74407ea862ac0cb0ebf551b3a8473ea234f39b6342f0f7
|
3 |
+
size 2793032
|
out_tensor/model.layers.10.mlp.down_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:13403978932f94a9ad3447bdf9571f5405ffdab62fbfc79b0d2eab8a21c7e979
|
3 |
+
size 75133430
|
out_tensor/model.layers.10.mlp.gate_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5f046b0438f1a11411fabe8b62a217b8534186bbefcba37e05853681b2088a7a
|
3 |
+
size 57087456
|
out_tensor/model.layers.10.mlp.up_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1150e6ab211b539df9a2fba678b0557e1666901a6ee13c98f1a26faec98bb547
|
3 |
+
size 59741656
|
out_tensor/model.layers.10.self_attn.k_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5ffc438d9da8a794124fa6f28a00854a74f4aca2cdf14af4f58fdc90acd7e940
|
3 |
+
size 2751592
|
out_tensor/model.layers.10.self_attn.o_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cdf7faf3f1a31edb50bd5556f0858d3de3fad36a6e37a76ca675797ec8b8e4c0
|
3 |
+
size 13661192
|
out_tensor/model.layers.10.self_attn.q_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f2ba7c997cd6f120ea07910b5ce6c8dc714eb5b1c1dc92be15bf15b4f3e3111b
|
3 |
+
size 13671536
|
out_tensor/model.layers.10.self_attn.v_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:376739c1cfc7fd193690d2afa48136822ddd4e722af3b93d62a8c575d2259249
|
3 |
+
size 2793040
|
out_tensor/model.layers.11.mlp.down_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3707afb66af5652dea8051e5e3df3e4468cae3f10a52405a5c7e30500455ba56
|
3 |
+
size 61699680
|
out_tensor/model.layers.11.mlp.gate_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:de3db5830c1916cc11223c9c0351501478e0fed52849d5a7dd0b7b8ef2e0f667
|
3 |
+
size 57087456
|
out_tensor/model.layers.11.mlp.up_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9f236c2ba9e1eed5b5f66b544bc6c6d383537ac7260f3911c517b0afb0bed103
|
3 |
+
size 59741656
|
out_tensor/model.layers.11.self_attn.k_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9362dd76f2ddf26748f44b99521540f93ecebff3ca6c53153eccabdd7eba4a65
|
3 |
+
size 2665336
|
out_tensor/model.layers.11.self_attn.o_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6bbd14ffb500534a7198ecfd0af27b59f3f3dc4f29f7837cc2c01f8211e33bd3
|
3 |
+
size 13230872
|
out_tensor/model.layers.11.self_attn.q_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:976387b6b028c914acf55d112f73fea95ad30a471c409a98390a8a478be19af3
|
3 |
+
size 13241216
|
out_tensor/model.layers.11.self_attn.v_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3ccbf8f5a070d7267cd1a96bf3acd641ae1136a7de9606d698ee936c58fbb9ce
|
3 |
+
size 2686056
|
out_tensor/model.layers.12.mlp.down_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:41901538427d28a1cda4c959599377b6693fd674c1d25bfad9e5bc95778a554e
|
3 |
+
size 61699680
|
out_tensor/model.layers.12.mlp.gate_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:db3b5a930e3489edac93c299fa0136a35ee25ff0284af6117b3f356de0722632
|
3 |
+
size 57087456
|
out_tensor/model.layers.12.mlp.up_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b35a7e15873a64e22335fefcc3bd3917d13f950d36755b6bd6e1698b056454ce
|
3 |
+
size 59741656
|
out_tensor/model.layers.12.self_attn.k_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:943fab4ffac0ef5163c7d2249685839d9eef5da2553d7ddbce5be358d941649b
|
3 |
+
size 3386232
|
out_tensor/model.layers.12.self_attn.o_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e4c3533bb7db694e5c85a00c815b2a796b02c2c9717c6782df9373bc051d55b8
|
3 |
+
size 16835352
|
out_tensor/model.layers.12.self_attn.q_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0a90649975ad83fc1d7d250aa88249b0d688b6ab0c964eacd3f42d586597a76a
|
3 |
+
size 16845696
|
out_tensor/model.layers.12.self_attn.v_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2fe04620811feb6518c1f3d25c1dd787c0c621be84b6ac9b34350441f0fea75b
|
3 |
+
size 3976056
|
out_tensor/model.layers.13.mlp.down_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0001754e0719fead4867d5f76342d28090c192caffe62e70a438e7e371006871
|
3 |
+
size 60142070
|
out_tensor/model.layers.13.mlp.gate_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d66c96c040211fd2a59df972424f572692a1f932b43fc99b6077ff5b3371ecf0
|
3 |
+
size 55427848
|
out_tensor/model.layers.13.mlp.up_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9b3c5b59ee2e8170ab875b155ae91fc2d7718ce197e9948b9ec5c30a94a45c77
|
3 |
+
size 58082048
|
out_tensor/model.layers.13.self_attn.k_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f5e4da862ef4c0551ba3da22129e5a3eb2beafa844b97667ac080069a28afc77
|
3 |
+
size 2075512
|
out_tensor/model.layers.13.self_attn.o_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:836ac3612bbc26635fdd383a4f7fbbcd779e5fb6646168a83f56716e6e6b484b
|
3 |
+
size 10281752
|
out_tensor/model.layers.13.self_attn.q_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e66907c587c7068c521e819f71cb91e8950e27625f9b92a33c99a1f373947dff
|
3 |
+
size 10292096
|
out_tensor/model.layers.13.self_attn.v_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:75e20e7375865bcbe01a2dc35309392d2bbad5bd97e3c784333fd1d7691c5a06
|
3 |
+
size 2096232
|
out_tensor/model.layers.14.mlp.down_proj.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5a939c4f1ea0ad883c66f8ac131daf41ec0347e3626d591394fd3de045034be5
|
3 |
+
size 76935670
|