Update README.md
Browse files
README.md
CHANGED
@@ -53,10 +53,31 @@ You See See You Fuck Good JOB!
|
|
53 |
- 训练中...
|
54 |
|
55 |
|
|
|
56 |
## 训练效果
|
57 |
|
58 |

|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
## MGRPO与层传播:
|
61 |
- **算法改变**:原始GRPO仅通过ORM策略进行偏好学习,但无法评判文学内容生成质量,本次训练使用**上海交通大学**博士**魏XX**、**洪XX**的启发,使用逻辑学算法,解决文学ORM策略设计难点,并且二次返回修改提示词进行错误总结。每次调整均经历2次完整传播过程,为GRPO+GRPO,所以暂时命名为MGRPO。
|
62 |
- **构架改变**:尝试改变Transformers传播方式,在层内循环处理进行训练,受到Universal Transformers与最新潜空间启发,在训练中让部分层循环激活,为了避免梯度爆炸使用梯度裁切技术,测试发现模型性能得到提升,更多工作还在测试中。
|
@@ -113,45 +134,6 @@ You See See You Fuck Good JOB!
|
|
113 |
|
114 |
## 暂时没有遇到“啊哈”时刻
|
115 |
|
116 |
-
## 注意
|
117 |
-
⚠ **需要严格遵循官方示例模板**:
|
118 |
-
**返回的上下文需要去除思考标签与内容。否则将无法正确回复!**
|
119 |
-
目前前端支持率非常低,建议手动修改前端代码。代码参考如下:
|
120 |
-
```
|
121 |
-
msg.role === 'assistant' ? {
|
122 |
-
...msg,
|
123 |
-
content: msg.content.replace(/<think>[\s\S]*?<\/think>/gi, '')
|
124 |
-
}
|
125 |
-
```
|
126 |
-
**官方模板参考**
|
127 |
-
```
|
128 |
-
{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% set ns = namespace(is_first=false, is_tool=false, is_output_first=true, system_prompt='') %}{%- for message in messages %}{%- if message['role'] == 'system' %}{% set ns.system_prompt = message['content'] %}{%- endif %}{%- endfor %}{{bos_token}}{{ns.system_prompt}}{%- for message in messages %}{%- if message['role'] == 'user' %}{%- set ns.is_tool = false -%}{{'<|User|>' + message['content']}}{%- endif %}{%- if message['role'] == 'assistant' and message['content'] is none %}{%- set ns.is_tool = false -%}{%- for tool in message['tool_calls']%}{%- if not ns.is_first %}{{'<|Assistant|><|tool▁calls▁begin|><|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\\n' + '```json' + '\\n' + tool['function']['arguments'] + '\\n' + '```' + '<|tool▁call▁end|>'}}{%- set ns.is_first = true -%}{%- else %}{{'\\n' + '<|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\\n' + '```json' + '\\n' + tool['function']['arguments'] + '\\n' + '```' + '<|tool▁call▁end|>'}}{{'<|tool▁calls▁end|><|end▁of▁sentence|>'}}{%- endif %}{%- endfor %}{%- endif %}{%- if message['role'] == 'assistant' and message['content'] is not none %}{%- if ns.is_tool %}{{'<|tool▁outputs▁end|>' + message['content'] + '<|end▁of▁sentence|>'}}{%- set ns.is_tool = false -%}{%- else %}{% set content = message['content'] %}{% if '</think>' in content %}{% set content = content.split('</think>')[-1] %}{% endif %}{{'<|Assistant|>' + content + '<|end▁of▁sentence|>'}}{%- endif %}{%- endif %}{%- if message['role'] == 'tool' %}{%- set ns.is_tool = true -%}{%- if ns.is_output_first %}{{'<|tool▁outputs▁begin|><|tool▁output▁begin|>' + message['content'] + '<|tool▁output▁end|>'}}{%- set ns.is_output_first = false %}{%- else %}{{'\\n<|tool▁output▁begin|>' + message['content'] + '<|tool▁output▁end|>'}}{%- endif %}{%- endif %}{%- endfor -%}{% if ns.is_tool %}{{'<|tool▁outputs▁end|>'}}{% endif %}{% if add_generation_prompt and not ns.is_tool %}{{'<|Assistant|>'}}{% endif %}
|
129 |
-
```
|
130 |
-
**官方说明**
|
131 |
-
|
132 |
-

|
133 |
-
|
134 |
-
[直达超链接](https://api-docs.deepseek.com/zh-cn/guides/reasoning_model)
|
135 |
-
|
136 |
-
## 实现
|
137 |
-
🔥 **经过训练后**:
|
138 |
-
1. **具备思维链**:逻辑能力,关联能力提升
|
139 |
-
2. **自发思考**:思维链在训练中自发生成,提供最优解决思路
|
140 |
-
3. **特定词汇增加**:进行“具有深度”的角色扮演对话时,显著增加了相关词汇量,解决原始权重预训练数据不足问题
|
141 |
-
4. **更少拒绝**:减少了拒绝现象,但因为是企业训练,安全性还是稍作保留
|
142 |
-
5. **文学性能提升**:强化学习中更多的提升了文学性,使其输出更具有小说感觉
|
143 |
-
|
144 |
-
## 模型亮点
|
145 |
-
🔥 **四阶段进化架构**:
|
146 |
-
1. **增量预训练**:注入0.1T Token 小说,增强文本连贯性,理解更多场景
|
147 |
-
2. **Tifa-COT-SFT冷启动**:使模型学会思考策略,提升逻辑性能与上下文关联
|
148 |
-
3. **MGROP**:改进GRPO算法,解决GRPO无法奖励角色扮演数据问题,引入多次奖励,提升模型效果
|
149 |
-
4. **防重复DPO**:使用DPO防止模型复读、增强政治安全性。
|
150 |
-
|
151 |
-
💡 **工程创新**:
|
152 |
-
- 改进GRPO算法,使其可以用来训练文学类内容
|
153 |
-
- 改进反馈策略,前置向量确认法提高模型训练性能
|
154 |
-
- 改进训练时Transformers传播路径,激发模型深层次潜能
|
155 |
|
156 |
## 模型详情
|
157 |
| 属性 | 规格 |
|
@@ -175,6 +157,28 @@ content: msg.content.replace(/<think>[\s\S]*?<\/think>/gi, '')
|
|
175 |
- 短文本即时问答
|
176 |
- 需要严格事实性的场景
|
177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
## 注意事项
|
179 |
⚠️ 本模型使用数据包含小说版权内容及Tifa模型衍生数据,请遵守:
|
180 |
1. 遵守apache-2.0
|
@@ -186,22 +190,22 @@ content: msg.content.replace(/<think>[\s\S]*?<\/think>/gi, '')
|
|
186 |
**最佳实践**:
|
187 |
```python
|
188 |
# 启用角色扮演模式
|
189 |
-
prompt = """
|
190 |
-
<user
|
191 |
<think>
|
192 |
需要体现人物孤傲的气质
|
193 |
加入武侠特有的环境描写
|
194 |
保持对话的冷峻风格
|
195 |
</think>
|
196 |
-
|
197 |
```
|
198 |
|
199 |
**参数推荐**:
|
200 |
```python
|
201 |
generation_config = {
|
202 |
-
"temperature": 0.
|
203 |
"top_p": 0.6,
|
204 |
-
"repetition_penalty": 1.
|
205 |
"max_new_tokens": 1536,
|
206 |
"do_sample": True
|
207 |
}
|
|
|
53 |
- 训练中...
|
54 |
|
55 |
|
56 |
+
|
57 |
## 训练效果
|
58 |
|
59 |

|
60 |
|
61 |
+
## 实现
|
62 |
+
🔥 **经过训练后**:
|
63 |
+
1. **具备思维链**:逻辑能力,关联能力提升
|
64 |
+
2. **自发思考**:思维链在训练中自发生成,提供最优解决思路
|
65 |
+
3. **特定词汇增加**:进行“具有深度”的角色扮演对话时,显著增加了相关词汇量,解决原始权重预训练数据不足问题
|
66 |
+
4. **更少拒绝**:减少了拒绝现象,但因为是企业训练,安全性还是稍作保留
|
67 |
+
5. **文学性能提升**:强化学习中更多的提升了文学性,使其输出更具有小说感觉
|
68 |
+
|
69 |
+
## 模型亮点
|
70 |
+
🔥 **四阶段进化架构**:
|
71 |
+
1. **增量预训练**:注入0.1T Token 小说,增强文本连贯性,理解更多场景
|
72 |
+
2. **Tifa-COT-SFT冷启动**:使模型学会思考策略,提升逻辑性能与上下文关联
|
73 |
+
3. **MGROP**:改进GRPO算法,解决GRPO无法奖励角色扮演数据问题,引入多次奖励,提升模型效果
|
74 |
+
4. **防重复DPO**:使用DPO防止模型复读、增强政治安全性。
|
75 |
+
|
76 |
+
💡 **工程创新**:
|
77 |
+
- 改进GRPO算法,使其可以用来训练文学类内容
|
78 |
+
- 改进反馈策略,前置向量确认法提高模型训练性能
|
79 |
+
- 改进训练时Transformers传播路径,激发模型深层次潜能
|
80 |
+
|
81 |
## MGRPO与层传播:
|
82 |
- **算法改变**:原始GRPO仅通过ORM策略进行偏好学习,但无法评判文学内容生成质量,本次训练使用**上海交通大学**博士**魏XX**、**洪XX**的启发,使用逻辑学算法,解决文学ORM策略设计难点,并且二次返回修改提示词进行错误总结。每次调整均经历2次完整传播过程,为GRPO+GRPO,所以暂时命名为MGRPO。
|
83 |
- **构架改变**:尝试改变Transformers传播方式,在层内循环处理进行训练,受到Universal Transformers与最新潜空间启发,在训练中让部分层循环激活,为了避免梯度爆炸使用梯度裁切技术,测试发现模型性能得到提升,更多工作还在测试中。
|
|
|
134 |
|
135 |
## 暂时没有遇到“啊哈”时刻
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
## 模型详情
|
139 |
| 属性 | 规格 |
|
|
|
157 |
- 短文本即时问答
|
158 |
- 需要严格事实性的场景
|
159 |
|
160 |
+
|
161 |
+
## 注意
|
162 |
+
⚠ **需要严格遵循官方示例模板**:
|
163 |
+
**返回的上下文需要去除思考标签与内容。否则将无法正确回复!**
|
164 |
+
目前前端支持率非常低,建议手动修改前端代码。代码参考如下:
|
165 |
+
```
|
166 |
+
msg.role === 'assistant' ? {
|
167 |
+
...msg,
|
168 |
+
content: msg.content.replace(/<think>[\s\S]*?<\/think>/gi, '')
|
169 |
+
}
|
170 |
+
```
|
171 |
+
**官方模板参考**
|
172 |
+
```
|
173 |
+
{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% set ns = namespace(is_first=false, is_tool=false, is_output_first=true, system_prompt='') %}{%- for message in messages %}{%- if message['role'] == 'system' %}{% set ns.system_prompt = message['content'] %}{%- endif %}{%- endfor %}{{bos_token}}{{ns.system_prompt}}{%- for message in messages %}{%- if message['role'] == 'user' %}{%- set ns.is_tool = false -%}{{'<|User|>' + message['content']}}{%- endif %}{%- if message['role'] == 'assistant' and message['content'] is none %}{%- set ns.is_tool = false -%}{%- for tool in message['tool_calls']%}{%- if not ns.is_first %}{{'<|Assistant|><|tool▁calls▁begin|><|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\\n' + '```json' + '\\n' + tool['function']['arguments'] + '\\n' + '```' + '<|tool▁call▁end|>'}}{%- set ns.is_first = true -%}{%- else %}{{'\\n' + '<|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\\n' + '```json' + '\\n' + tool['function']['arguments'] + '\\n' + '```' + '<|tool▁call▁end|>'}}{{'<|tool▁calls▁end|><|end▁of▁sentence|>'}}{%- endif %}{%- endfor %}{%- endif %}{%- if message['role'] == 'assistant' and message['content'] is not none %}{%- if ns.is_tool %}{{'<|tool▁outputs▁end|>' + message['content'] + '<|end▁of▁sentence|>'}}{%- set ns.is_tool = false -%}{%- else %}{% set content = message['content'] %}{% if '</think>' in content %}{% set content = content.split('</think>')[-1] %}{% endif %}{{'<|Assistant|>' + content + '<|end▁of▁sentence|>'}}{%- endif %}{%- endif %}{%- if message['role'] == 'tool' %}{%- set ns.is_tool = true -%}{%- if ns.is_output_first %}{{'<|tool▁outputs▁begin|><|tool▁output▁begin|>' + message['content'] + '<|tool▁output▁end|>'}}{%- set ns.is_output_first = false %}{%- else %}{{'\\n<|tool▁output▁begin|>' + message['content'] + '<|tool▁output▁end|>'}}{%- endif %}{%- endif %}{%- endfor -%}{% if ns.is_tool %}{{'<|tool▁outputs▁end|>'}}{% endif %}{% if add_generation_prompt and not ns.is_tool %}{{'<|Assistant|>'}}{% endif %}
|
174 |
+
```
|
175 |
+
**官方说明**
|
176 |
+
|
177 |
+

|
178 |
+
|
179 |
+
[直达超链接](https://api-docs.deepseek.com/zh-cn/guides/reasoning_model)
|
180 |
+
|
181 |
+
|
182 |
## 注意事项
|
183 |
⚠️ 本模型使用数据包含小说版权内容及Tifa模型衍生数据,请遵守:
|
184 |
1. 遵守apache-2.0
|
|
|
190 |
**最佳实践**:
|
191 |
```python
|
192 |
# 启用角色扮演模式
|
193 |
+
prompt = """你是一个小女孩/你是一个XX角色...
|
194 |
+
<user>我走进门,看到你冲上来迎接我</user>
|
195 |
<think>
|
196 |
需要体现人物孤傲的气质
|
197 |
加入武侠特有的环境描写
|
198 |
保持对话的冷峻风格
|
199 |
</think>
|
200 |
+
我看到XX进门..."""
|
201 |
```
|
202 |
|
203 |
**参数推荐**:
|
204 |
```python
|
205 |
generation_config = {
|
206 |
+
"temperature": 0.75,
|
207 |
"top_p": 0.6,
|
208 |
+
"repetition_penalty": 1.08,
|
209 |
"max_new_tokens": 1536,
|
210 |
"do_sample": True
|
211 |
}
|