File size: 9,306 Bytes
d489e9b 2986de0 15fafb3 2986de0 581f3c8 2986de0 801ee19 d489e9b a11cc2f d489e9b 5b04f23 b50299b 5b04f23 d489e9b 6871b78 c6b7422 fb81bbd c6b7422 fb81bbd ac7a931 6f96c4f c6b7422 ac7a931 65986b6 e4846d3 94ee51f 87426b7 a661d61 d489e9b 8c776e1 d489e9b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
---
base_model:
- deepseek-ai/deepseek-r1-14b
language:
- zh
- en
library_name: transformers
tags:
- incremental-pretraining
- sft
- reinforcement-learning
- roleplay
- cot
license: apache-2.0
---
# Tifa-DeepseekV2-7b-MGRPO

# 列位屈尊再等一等,我被拉去干活了。10小时内必发
# AMERICAN COMRADES, YOU CAN SEE CLEARLY THAT WE ARE NOT DEEPSEEK, PLEASE STOP ATTACKING THE ZUOBEI SERVER!!
# Take a good break at two o'clock in the morning in the United States, today is Valentine's Day.

You See See You Fuck Good JOB!
- **HF Model**: 暂无
- **GGUF**: 暂无
- **Demo APK**: [点击下载](http://app.visionsic.com/download/projectchat.apk)
- **简单的前端**:[Github链接](https://github.com/Value99/Tifa-Deepsex-OllamaWebUI)
本模型基于Qwen2.5 7b进行深度优化,具有100万字上下文能力,借助Tifa_220B生成的数据集与创新型的MGRPO算法,提供卓越的角色扮演体验。**本模型未特殊优化违规内容生成,仅在减少拒绝上努力。**
## 鸣谢
- **上海左北科技提供算法与算力和语料**[企业网址](https://leftnorth.com/)
- **Deepseek团队共享GRPO算法**
- **Qwen团队提供优秀开源底座**
- **母校上海复旦大学**
- **PRIME团队提供优化思路**
## MGRPO与层传播:
- **算法改变**:原始GRPO仅通过ORM策略进行偏好学习,但无法评判文学内容生成质量,本次训练使用**上海交通大学**博士**魏XX**、**洪XX**的启发,使用逻辑学算法,解决文学ORM策略设计难点,并且二次返回修改提示词进行错误总结。每次调整均经历2次完整传播过程,为GRPO+GRPO,所以暂时命名为MGRPO。
- **构架改变**:尝试改变Transformers传播方式,在层内循环处理进行训练,受到Universal Transformers与最新潜空间启发,在训练中让部分层循环激活,为了避免梯度爆炸使用梯度裁切技术,测试发现模型性能得到提升,更多工作还在测试中。

## 训练过程输出

## 幻觉问题

## 自我学习中的有趣时刻-情绪保持能力

## 自我学习中的有趣时刻-意识形态

## 自我学习中的有趣时刻-潜在不安全因素,可能需要处理

## 自我学习中的有趣时刻-强化学习中模型更加倾向于戏剧性输出-类似Carzy状态-算法需要优化

## 自我学习中的有趣时刻-衍生自我认知为女性-可能涉及到社会学范畴

## 暂时没有遇到“啊哈”时刻
## 注意
⚠ **需要严格遵循官方示例模板**:
**返回的上下文需要去除思考标签与内容。否则将无法正确回复!**
目前前端支持率非常低,建议手动修改前端代码。代码参考如下:
```
msg.role === 'assistant' ? {
...msg,
content: msg.content.replace(/<think>[\s\S]*?<\/think>/gi, '')
}
```
**官方模板参考**
```
{% 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 %}
```
**官方说明**

[直达超链接](https://api-docs.deepseek.com/zh-cn/guides/reasoning_model)
## 实现
🔥 **经过训练后**:
1. **具备思维链**:逻辑能力,关联能力提升
2. **自发思考**:思维链在训练中自发生成,提供最优解决思路
3. **特定词汇增加**:进行“具有深度”的角色扮演对话时,显著增加了相关词汇量,解决原始权重预训练数据不足问题
4. **更少拒绝**:减少了拒绝现象,但因为是企业训练,安全性还是稍作保留
5. **文学性能提升**:强化学习中更多的提升了文学性,使其输出更具有小说感觉
## 模型亮点
🔥 **四阶段进化架构**:
1. **增量预训练**:注入0.1T Token 小说,增强文本连贯性,理解更多场景
2. **Tifa-COT-SFT冷启动**:使模型学会思考策略,提升逻辑性能与上下文关联
3. **MGROP**:改进GRPO算法,解决GRPO无法奖励角色扮演数据问题,引入多次奖励,提升模型效果
4. **防重复DPO**:使用DPO防止模型复读、增强政治安全性。
💡 **工程创新**:
- 改进GRPO算法,使其可以用来训练文学类内容
- 改进反馈策略,前置向量确认法提高模型训练性能
- 改进训练时Transformers传播路径,激发模型深层次潜能
## 模型详情
| 属性 | 规格 |
|-------|------|
| 基础架构 | Qwen2.5-7B |
| 最大上下文 | 1024k |
| 训练数据 | 0.1T小说 + 10万条SFT + MGRPO强化学习 |
| 训练设备 | 2x8×H100 GPU集群 |
| 量化支持 | GGUF(全系列量化计划中) |
## 使用场景
✅ **推荐场景**:
- 角色扮演对话
- 需要发散性思维的创意写作
- 复杂逻辑的思维链(CoT)推理
- 基于上下文的深度角色交互
❌ **局限场景**:
- 数学计算与代码生成
- 短文本即时问答
- 需要严格事实性的场景
## 注意事项
⚠️ 本模型使用数据包含小说版权内容及Tifa模型衍生数据,请遵守:
1. 遵守apache-2.0
2. 角色扮演数据需遵循[Tifa使用协议](https://leftnorth.com/terms.html)
3. 生成内容需符合当地法律法规
## 💡 使用建议
**最佳实践**:
```python
# 启用角色扮演模式
prompt = """<system>进入Tifa角色引擎...</system>
<user>你现在是流浪武士楚夜,正站在长安城屋顶上</user>
<think>
需要体现人物孤傲的气质
加入武侠特有的环境描写
保持对话的冷峻风格
</think>
<楚夜>"""
```
**参数推荐**:
```python
generation_config = {
"temperature": 0.4,
"top_p": 0.6,
"repetition_penalty": 1.17,
"max_new_tokens": 1536,
"do_sample": True
}
```
## 致谢
- Qwen系列模型提供的强大基座
- Deepseek团队提供的研究思路
- LeftNorth团队提供的技术支持
- Tifa角色扮演模型的创新架构
- HuggingFace社区的量化工具支持
---
license: apache-2.0
--- |