Add pipeline tag, library name and link to code (#1)
Browse files- Add pipeline tag, library name and link to code (2a61934d7aefd8f00a63e6d760e8e6b3ee9a7f1c)
Co-authored-by: Niels Rogge <[email protected]>
README.md
CHANGED
@@ -1,20 +1,22 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
|
|
3 |
---
|
4 |
|
5 |
<div align="center">
|
6 |
<h1>Fin-R1:通过强化学习驱动的金融推理大模型</h1>
|
7 |
|
8 |
<!-- 徽章部分 -->
|
9 |
-
[](https://www.apache.org/licenses/LICENSE-2.0)[](https://huggingface.co/SUFE-AIFLM-Lab/Fin-R1)[](https://arxiv.org/abs/2503.16252)
|
10 |
|
11 |
<!-- 语言切换链接 -->
|
12 |
-
📄 [中文](./README.md) | [EN](./README_en.md)
|
13 |
</div>
|
14 |
|
15 |
Fin-R1 是一款针对金融领域复杂推理的大型语言模型,由上海财经大学统计与数据科学学院张立文教授与其领衔的金融大语言模型课题组(SUFE-AIFLM-Lab)联合财跃星辰研发并开源发布。该模型以 Qwen2.5-7B-Instruct 为基座,通过高质量的可验证金融问题微调训练,最终表现在多个金融领域基准测试上的表现达到参评模型的SOTA水平。
|
16 |
|
17 |
-
|
18 |
|
19 |
## 📌 目录<a name="toc"></a>
|
20 |
- [场景应用](#summary)
|
@@ -32,36 +34,36 @@ Fin-R1 是一款针对金融领域复杂推理的大型语言模型,由上海
|
|
32 |
- [未来展望](#todo)
|
33 |
- [联系我们](#connection)
|
34 |
|
35 |
-
## 💡 场景应用 <a name="summary"></a
|
36 |
Fin-R1 是一款专为金融推理领域设计的大语言模型,采用轻量化的 7B 参数量级架构。在显著降低部署成本的同时,该模型通过在针对金融推理场景的高质量思维链数据上采用 SFT(监督微调)和 RL(强化学习)两阶段训练,为模型在金融领域的应用提供了坚实的理论支撑、业务规则、决策逻辑以及技术实现能力,从而有效提升模型的金融复杂推理能力,为银行、证券、保险以及信托等金融核心业务场景提供有力支持。
|
37 |
|
38 |
-

|
39 |
|
40 |
## 金融代码
|
41 |
金融代码是指在金融领域中用于实现各种金融模型、算法和分析任务的计算机编程代码,涵盖了从简单的财务计算到复杂的金融衍生品定价、风险评估和投资组合优化等多个方面,以方便金融专业人士进行数据处理、统计分析、数值计算和可视化等工作。
|
42 |
-

|
43 |
## 金融计算
|
44 |
金融计算是对金融领域的各种问题进行定量分析和计算的过程,其核心在于通过建立数学模型和运用数值方法来解决实际金融问题,可为金融决策提供科学依据,帮助金融机构和投资者更好地管理风险、优化资源配置和提高投资回报率。
|
45 |
-

|
46 |
## 英语金融计算
|
47 |
英语金融计算强调在跨语言环境下使用英语进行金融模型的构建和计算,并能够以英语撰写金融分析报告和与国际同行进行沟通交流。
|
48 |
-

|
49 |
## 金融安全合规
|
50 |
金融安全合规聚焦于防范金融犯罪与遵守监管要求,帮助企业建立健全的合规管理体系,定期进行合规检查和审计,确保业务操作符合相关法规要求。
|
51 |
-

|
52 |
## 智能风控
|
53 |
智能风控利用AI与大数据技术识别和管理金融风险,与传统风控手段相比,智能风控具有更高的效率、准确性和实时性,它通过对海量金融数据的深度挖掘和分析,能够发现潜在的风险模式和异常交易行为,从而及时预警和采取相应的风险控制措施。
|
54 |
-

|
55 |
## ESG分析
|
56 |
ESG分析通过评估企业在环境(Environmental)、社会(Social)、治理(Governance)的表现,衡量其可持续发展能力,确保投资活动不仅能够获得财务回报,还能促进可持续发展和社会责任的履行。金融机构和企业也通过提升自身的 ESG 绩效,来满足投资者和社会对企业更高的期望和要求。
|
57 |
-

|
58 |
|
59 |
-
|
60 |
|
61 |
|
62 |
## 总体工作流程
|
63 |
我们基于 DeepSeek-R1 构建了数据蒸馏框架,并严格按照官方参数设定进行数据处理,采用两阶段数据筛选方法提升金融领域数据质量,生成了SFT数据集和RL数据集。在训练过程中,我们利用Qwen2.5-7B-Instruct,通过监督微调(SFT)和强化学习(RL)训练金融推理大模型 Fin-R1,以提升金融推理任务的准确性和泛化能力。
|
64 |
-

|
65 |
|
66 |
## 🛠️ 数据构建<a name="data"></a>
|
67 |
为将 DeepSeek-R1 的推理能力迁移至金融场景并解决高质量金融推理数据问题,我们用Deepseek-R1(满血版)针对涵盖行业语料(FinCorpus、Ant_Finance),专业认知(FinPEE),业务知识(FinCUGE、FinanceIQ、Finance-Instruct-500K),表格解析(FinQA),市场洞察(TFNS),多轮交互(ConvFinQA)以及量化投资(FinanceQT)的多个数据集进行领域知识蒸馏筛选,构建了约 60k 条面向专业金融推理场景的高质量 COT 数据集 Fin-R1-Data 。该数据集涵盖中英文金融垂直领域的多维度专业知识,并根据具体任务内容将其分为金融代码、金融专业知识、金融非推理类业务知识和金融推理类业务知识四大模块,可有效支撑银行、基金和证券等多个金融核心场景。本研究构建了基于 Deepseek-R1 的数据蒸馏框架,并创新性提出对思维链进行“答案+推理”双轮质量打分筛选方法,首轮基于规则匹配和 Qwen2.5-72B-Instruct 对答案准确性评分,次轮对推理链的逻辑一致性、术语合规性等推理逻辑进行深度校验以保证数据质量。
|
@@ -97,170 +99,23 @@ ESG分析通过评估企业在环境(Environmental)、社会(Social)、
|
|
97 |
我们将经过两轮筛选后均标注为good的数据作为高质量的 COT 数据用于 SFT ;而未经过筛选标注为bad的数据则作为推理QA数据用于强化学习(RL)。
|
98 |
|
99 |
### Fin-R1-Data数据分布如下:
|
100 |
-
Fin-R1-Data
|
101 |
|
102 |
-

|
103 |
|
104 |
|数据集|数据量|
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
-
|
115 |
-
-
|
116 |
-
|
117 |
-
- Ideal for **high-performance inference** with **reduced memory footprint** compared to FP32.
|
118 |
-
|
119 |
-
📌 **Use BF16 if:**
|
120 |
-
✔ Your hardware has native **BF16 support** (e.g., newer GPUs, TPUs).
|
121 |
-
✔ You want **higher precision** while saving memory.
|
122 |
-
✔ You plan to **requantize** the model into another format.
|
123 |
-
|
124 |
-
📌 **Avoid BF16 if:**
|
125 |
-
❌ Your hardware does **not** support BF16 (it may fall back to FP32 and run slower).
|
126 |
-
❌ You need compatibility with older devices that lack BF16 optimization.
|
127 |
-
|
128 |
-
---
|
129 |
-
|
130 |
-
### **F16 (Float 16) – More widely supported than BF16**
|
131 |
-
- A 16-bit floating-point **high precision** but with less of range of values than BF16.
|
132 |
-
- Works on most devices with **FP16 acceleration support** (including many GPUs and some CPUs).
|
133 |
-
- Slightly lower numerical precision than BF16 but generally sufficient for inference.
|
134 |
-
|
135 |
-
📌 **Use F16 if:**
|
136 |
-
✔ Your hardware supports **FP16** but **not BF16**.
|
137 |
-
✔ You need a **balance between speed, memory usage, and accuracy**.
|
138 |
-
✔ You are running on a **GPU** or another device optimized for FP16 computations.
|
139 |
-
|
140 |
-
📌 **Avoid F16 if:**
|
141 |
-
❌ Your device lacks **native FP16 support** (it may run slower than expected).
|
142 |
-
❌ You have memory limitations.
|
143 |
-
|
144 |
-
---
|
145 |
-
|
146 |
-
### **Quantized Models (Q4_K, Q6_K, Q8, etc.) – For CPU & Low-VRAM Inference**
|
147 |
-
Quantization reduces model size and memory usage while maintaining as much accuracy as possible.
|
148 |
-
- **Lower-bit models (Q4_K)** → **Best for minimal memory usage**, may have lower precision.
|
149 |
-
- **Higher-bit models (Q6_K, Q8_0)** → **Better accuracy**, requires more memory.
|
150 |
-
|
151 |
-
📌 **Use Quantized Models if:**
|
152 |
-
✔ You are running inference on a **CPU** and need an optimized model.
|
153 |
-
✔ Your device has **low VRAM** and cannot load full-precision models.
|
154 |
-
✔ You want to reduce **memory footprint** while keeping reasonable accuracy.
|
155 |
-
|
156 |
-
📌 **Avoid Quantized Models if:**
|
157 |
-
❌ You need **maximum accuracy** (full-precision models are better for this).
|
158 |
-
❌ Your hardware has enough VRAM for higher-precision formats (BF16/F16).
|
159 |
-
|
160 |
-
---
|
161 |
-
|
162 |
-
### **Very Low-Bit Quantization (IQ3_XS, IQ3_S, IQ3_M, Q4_K, Q4_0)**
|
163 |
-
These models are optimized for **extreme memory efficiency**, making them ideal for **low-power devices** or **large-scale deployments** where memory is a critical constraint.
|
164 |
-
|
165 |
-
- **IQ3_XS**: Ultra-low-bit quantization (3-bit) with **extreme memory efficiency**.
|
166 |
-
- **Use case**: Best for **ultra-low-memory devices** where even Q4_K is too large.
|
167 |
-
- **Trade-off**: Lower accuracy compared to higher-bit quantizations.
|
168 |
-
|
169 |
-
- **IQ3_S**: Small block size for **maximum memory efficiency**.
|
170 |
-
- **Use case**: Best for **low-memory devices** where **IQ3_XS** is too aggressive.
|
171 |
-
|
172 |
-
- **IQ3_M**: Medium block size for better accuracy than **IQ3_S**.
|
173 |
-
- **Use case**: Suitable for **low-memory devices** where **IQ3_S** is too limiting.
|
174 |
-
|
175 |
-
- **Q4_K**: 4-bit quantization with **block-wise optimization** for better accuracy.
|
176 |
-
- **Use case**: Best for **low-memory devices** where **Q6_K** is too large.
|
177 |
-
|
178 |
-
- **Q4_0**: Pure 4-bit quantization, optimized for **ARM devices**.
|
179 |
-
- **Use case**: Best for **ARM-based devices** or **low-memory environments**.
|
180 |
-
|
181 |
-
---
|
182 |
-
|
183 |
-
### **Summary Table: Model Format Selection**
|
184 |
-
|
185 |
-
| Model Format | Precision | Memory Usage | Device Requirements | Best Use Case |
|
186 |
-
|--------------|------------|---------------|----------------------|---------------|
|
187 |
-
| **BF16** | Highest | High | BF16-supported GPU/CPUs | High-speed inference with reduced memory |
|
188 |
-
| **F16** | High | High | FP16-supported devices | GPU inference when BF16 isn’t available |
|
189 |
-
| **Q4_K** | Medium Low | Low | CPU or Low-VRAM devices | Best for memory-constrained environments |
|
190 |
-
| **Q6_K** | Medium | Moderate | CPU with more memory | Better accuracy while still being quantized |
|
191 |
-
| **Q8_0** | High | Moderate | CPU or GPU with enough VRAM | Best accuracy among quantized models |
|
192 |
-
| **IQ3_XS** | Very Low | Very Low | Ultra-low-memory devices | Extreme memory efficiency and low accuracy |
|
193 |
-
| **Q4_0** | Low | Low | ARM or low-memory devices | llama.cpp can optimize for ARM devices |
|
194 |
-
|
195 |
-
---
|
196 |
-
|
197 |
-
## **Included Files & Details**
|
198 |
-
|
199 |
-
### `Fin-R1-bf16.gguf`
|
200 |
-
- Model weights preserved in **BF16**.
|
201 |
-
- Use this if you want to **requantize** the model into a different format.
|
202 |
-
- Best if your device supports **BF16 acceleration**.
|
203 |
-
|
204 |
-
### `Fin-R1-f16.gguf`
|
205 |
-
- Model weights stored in **F16**.
|
206 |
-
- Use if your device supports **FP16**, especially if BF16 is not available.
|
207 |
-
|
208 |
-
### `Fin-R1-bf16-q8_0.gguf`
|
209 |
-
- **Output & embeddings** remain in **BF16**.
|
210 |
-
- All other layers quantized to **Q8_0**.
|
211 |
-
- Use if your device supports **BF16** and you want a quantized version.
|
212 |
-
|
213 |
-
### `Fin-R1-f16-q8_0.gguf`
|
214 |
-
- **Output & embeddings** remain in **F16**.
|
215 |
-
- All other layers quantized to **Q8_0**.
|
216 |
-
|
217 |
-
### `Fin-R1-q4_k.gguf`
|
218 |
-
- **Output & embeddings** quantized to **Q8_0**.
|
219 |
-
- All other layers quantized to **Q4_K**.
|
220 |
-
- Good for **CPU inference** with limited memory.
|
221 |
-
|
222 |
-
### `Fin-R1-q4_k_s.gguf`
|
223 |
-
- Smallest **Q4_K** variant, using less memory at the cost of accuracy.
|
224 |
-
- Best for **very low-memory setups**.
|
225 |
-
|
226 |
-
### `Fin-R1-q6_k.gguf`
|
227 |
-
- **Output & embeddings** quantized to **Q8_0**.
|
228 |
-
- All other layers quantized to **Q6_K** .
|
229 |
-
|
230 |
-
### `Fin-R1-q8_0.gguf`
|
231 |
-
- Fully **Q8** quantized model for better accuracy.
|
232 |
-
- Requires **more memory** but offers higher precision.
|
233 |
-
|
234 |
-
### `Fin-R1-iq3_xs.gguf`
|
235 |
-
- **IQ3_XS** quantization, optimized for **extreme memory efficiency**.
|
236 |
-
- Best for **ultra-low-memory devices**.
|
237 |
-
|
238 |
-
### `Fin-R1-iq3_m.gguf`
|
239 |
-
- **IQ3_M** quantization, offering a **medium block size** for better accuracy.
|
240 |
-
- Suitable for **low-memory devices**.
|
241 |
-
|
242 |
-
### `Fin-R1-q4_0.gguf`
|
243 |
-
- Pure **Q4_0** quantization, optimized for **ARM devices**.
|
244 |
-
- Best for **low-memory environments**.
|
245 |
-
- Prefer IQ4_NL for better accuracy.
|
246 |
-
|
247 |
-
# <span id="testllm" style="color: #7F7FFF;">🚀 If you find these models useful</span>
|
248 |
-
|
249 |
-
Please click like ❤ . Also I’d really appreciate it if you could test my Network Monitor Assistant at 👉 [Network Monitor Assitant](https://freenetworkmonitor.click/dashboard).
|
250 |
-
|
251 |
-
💬 Click the **chat icon** (bottom right of the main and dashboard pages) . Choose a LLM; toggle between the LLM Types TurboLLM -> FreeLLM -> TestLLM.
|
252 |
-
|
253 |
-
### What I'm Testing
|
254 |
-
|
255 |
-
I'm experimenting with **function calling** against my network monitoring service. Using small open source models. I am into the question "How small can it go and still function".
|
256 |
-
|
257 |
-
🟡 **TestLLM** – Runs the current testing model using llama.cpp on 6 threads of a Cpu VM (Should take about 15s to load. Inference speed is quite slow and it only processes one user prompt at a time—still working on scaling!). If you're curious, I'd be happy to share how it works! .
|
258 |
-
|
259 |
-
### The other Available AI Assistants
|
260 |
-
|
261 |
-
🟢 **TurboLLM** – Uses **gpt-4o-mini** Fast! . Note: tokens are limited since OpenAI models are pricey, but you can [Login](https://freenetworkmonitor.click) or [Download](https://freenetworkmonitor.click/download) the Free Network Monitor agent to get more tokens, Alternatively use the FreeLLM .
|
262 |
-
|
263 |
-
🔵 **FreeLLM** – Runs **open-source Hugging Face models** Medium speed (unlimited, subject to Hugging Face API availability).
|
264 |
|
265 |
|
266 |
|
@@ -287,22 +142,22 @@ I'm experimenting with **function calling** against my network monitoring servic
|
|
287 |
|
288 |
| Model | Parameters | FinQA | ConvFinQA | Ant_Finance | TFNS | Finance-Instruct-500k | Average |
|
289 |
|------------------------------|------------|--------|-----------|-------------|--------|-------------------------|---------|
|
290 |
-
| DeepSeek-R1 | 671B | 71.0 | 82.0 | __90.0__ | 78.0 | __70.0__ | __78.2__
|
291 |
| __Fin-R1__ | 7B |__76.0__| __85.0__ | 81.0 | 71.0 | 62.9 | 75.2 |
|
292 |
-
| Qwen-2.5-32B-Instruct | 32B | 72.0 | 78.0 | 84.0 | 77.0 | 58.0 | 73.8
|
293 |
-
| DeepSeek-R1-Distill-Qwen-32B | 32B | 70.0 | 72.0 | 87.0 |__79.0__| 54.0 | 72.4
|
294 |
-
| __Fin-R1-SFT__ | 7B | 73.0 | 81.0 | 76.0 | 68.0 | 61.0 | 71.9
|
295 |
-
| Qwen-2.5-14B-Instruct | 14B | 68.0 | 77.0 | 84.0 | 72.0 | 56.0 | 71.4
|
296 |
-
| DeepSeek-R1-Distill-Llama-70B| 70B | 68.0 | 74.0 | 84.0 | 62.0 | 56.0 | 69.2
|
297 |
-
| DeepSeek-R1-Distill-Qwen-14B | 14B | 62.0 | 73.0 | 82.0 | 65.0 | 49.0 | 66.2
|
298 |
-
| Qwen-2.5-7B-Instruct | 7B | 60.0 | 66.0 | 85.0 | 68.0 | 49.0 | 65.6
|
299 |
-
| DeepSeek-R1-Distill-Qwen-7B | 7B | 55.0 | 62.0 | 71.0 | 60.0 | 42.0 | 58.0
|
300 |
|
301 |
## 🕵️ 模型使用说明 <a name="use"></a>
|
302 |
您可以直接从 huggingface 中下载我们的模型权重
|
303 |
```
|
304 |
git lfs install
|
305 |
-
git clone https://huggingface.co/SUFE-AIFLM-Lab/Fin-R1
|
306 |
```
|
307 |
准备好依赖环境,采用如下命令一键安装 vllm
|
308 |
```
|
@@ -310,34 +165,40 @@ pip install vllm
|
|
310 |
```
|
311 |
命令行一键启动模型服务
|
312 |
```
|
313 |
-
vllm serve "/path/Fin-R1" --host 0.0.0.0 --port 8000 --gpu-memory-utilization 0.9 --max-model-len 16384 --tensor-parallel-size 2 --served-model-name "Fin-R1"
|
314 |
```
|
315 |
推理运行
|
316 |
```
|
317 |
from openai import OpenAI
|
318 |
-
openai_api_key = "EMPTY"
|
319 |
openai_api_base = "http://0.0.0.0:8000/v1"
|
320 |
|
321 |
client = OpenAI(
|
322 |
-
|
323 |
-
|
324 |
)
|
325 |
|
326 |
-
prompt ="请判断下列描述是否符合金融与信息合规性。如果合规请回答是,否则回答否,并把最终答案放入\\boxed{}
|
|
|
327 |
chat_response = client.chat.completions.create(
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
|
|
|
|
|
|
|
|
|
|
339 |
)
|
340 |
-
print("Chat response:", chat_response)
|
341 |
|
342 |
```
|
343 |
|
@@ -345,5 +206,5 @@ print("Chat response:", chat_response)
|
|
345 |
本项目由上海财经大学统计与数据科学学院金融大语言模型课题组(SUFE-AIFLM-Lab)联合财跃星辰完成。Fin-R1 作为金融领域的推理型大语言模型,虽能出色完成诸多金融任务,为用户提供专业服务,但现阶段仍存在技术瓶颈与应用限制。它提供的建议和分析结果仅供参考,不可等同于专业金融分析师或专家的精准判断。我们诚挚希望用户以批判性思维审视模型输出,结合自身专业知识与经验进行决策。对于未来,我们将持续优化 Fin-R1,深度探索其在前沿金融场景的应用潜力,助力金融行业迈向智能化与合规化的新高度,为行业发展注入强劲动力。
|
346 |
|
347 |
|
348 |
-
## 📫 联系我们 <a name="connection"></a
|
349 |
诚邀业界同仁共同探索 AI 与金融深度融合的创新范式,共建智慧金融新生态,并通过邮件与[email protected]联系
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
library_name: transformers
|
4 |
+
pipeline_tag: text-generation
|
5 |
---
|
6 |
|
7 |
<div align="center">
|
8 |
<h1>Fin-R1:通过强化学习驱动的金融推理大模型</h1>
|
9 |
|
10 |
<!-- 徽章部分 -->
|
11 |
+
[](https://www.apache.org/licenses/LICENSE-2.0)[](https://huggingface.co/SUFE-AIFLM-Lab/Fin-R1)[](https://arxiv.org/abs/2503.16252)
|
12 |
|
13 |
<!-- 语言切换链接 -->
|
14 |
+
📄 [中文](./README.md) | [EN](./README_en.md)
|
15 |
</div>
|
16 |
|
17 |
Fin-R1 是一款针对金融领域复杂推理的大型语言模型,由上海财经大学统计与数据科学学院张立文教授与其领衔的金融大语言模型课题组(SUFE-AIFLM-Lab)联合财跃星辰研发并开源发布。该模型以 Qwen2.5-7B-Instruct 为基座,通过高质量的可验证金融问题微调训练,最终表现在多个金融领域基准测试上的表现达到参评模型的SOTA水平。
|
18 |
|
19 |
+
Code: https://github.com/SUFE-AIFLM-Lab/Fin-R1
|
20 |
|
21 |
## 📌 目录<a name="toc"></a>
|
22 |
- [场景应用](#summary)
|
|
|
34 |
- [未来展望](#todo)
|
35 |
- [联系我们](#connection)
|
36 |
|
37 |
+
## 💡 场景应用 <a name="summary"></a>
|
38 |
Fin-R1 是一款专为金融推理领域设计的大语言模型,采用轻量化的 7B 参数量级架构。在显著降低部署成本的同时,该模型通过在针对金融推理场景的高质量思维链数据上采用 SFT(监督微调)和 RL(强化学习)两阶段训练,为模型在金融领域的应用提供了坚实的理论支撑、业务规则、决策逻辑以及技术实现能力,从而有效提升模型的金融复杂推理能力,为银行、证券、保险以及信托等金融核心业务场景提供有力支持。
|
39 |
|
40 |
+

|
41 |
|
42 |
## 金融代码
|
43 |
金融代码是指在金融领域中用于实现各种金融模型、算法和分析任务的计算机编程代码,涵盖了从简单的财务计算到复杂的金融衍生品定价、风险评估和投资组合优化等多个方面,以方便金融专业人士进行数据处理、统计分析、数值计算和可视化等工作。
|
44 |
+

|
45 |
## 金融计算
|
46 |
金融计算是对金融领域的各种问题进行定量分析和计算的过程,其核心在于通过建立数学模型和运用数值方法来解决实际金融问题,可为金融决策提供科学依据,帮助金融机构和投资者更好地管理风险、优化资源配置和提高投资回报率。
|
47 |
+

|
48 |
## 英语金融计算
|
49 |
英语金融计算强调在跨语言环境下使用英语进行金融模型的构建和计算,并能够以英语撰写金融分析报告和与国际同行进行沟通交流。
|
50 |
+

|
51 |
## 金融安全合规
|
52 |
金融安全合规聚焦于防范金融犯罪与遵守监管要求,帮助企业建立健全的合规管理体系,定期进行合规检查和审计,确保业务操作符合相关法规要求。
|
53 |
+

|
54 |
## 智能风控
|
55 |
智能风控利用AI与大数据技术识别和管理金融风险,与传统风控手段相比,智能风控具有更高的效率、准确性和实时性,它通过对海量金融数据的深度挖掘和分析,能够发现潜在的风险模式和异常交易行为,从而及时预警和采取相应的风险控制措施。
|
56 |
+

|
57 |
## ESG分析
|
58 |
ESG分析通过评估企业在环境(Environmental)、社会(Social)、治理(Governance)的表现,衡量其可持续发展能力,确保投资活动不仅能够获得财务回报,还能促进可持续发展和社会责任的履行。金融机构和企业也通过提升自身的 ESG 绩效,来满足投资者和社会对企业更高的期望和要求。
|
59 |
+

|
60 |
|
61 |
+
|
62 |
|
63 |
|
64 |
## 总体工作流程
|
65 |
我们基于 DeepSeek-R1 构建了数据蒸馏框架,并严格按照官方参数设定进行数据处理,采用两阶段数据筛选方法提升金融领域数据质量,生成了SFT数据集和RL数据集。在训练过程中,我们利用Qwen2.5-7B-Instruct,通过监督微调(SFT)和强化学习(RL)训练金融推理大模型 Fin-R1,以提升金融推理任务的准确性和泛化能力。
|
66 |
+

|
67 |
|
68 |
## 🛠️ 数据构建<a name="data"></a>
|
69 |
为将 DeepSeek-R1 的推理能力迁移至金融场景并解决高质量金融推理数据问题,我们用Deepseek-R1(满血版)针对涵盖行业语料(FinCorpus、Ant_Finance),专业认知(FinPEE),业务知识(FinCUGE、FinanceIQ、Finance-Instruct-500K),表格解析(FinQA),市场洞察(TFNS),多轮交互(ConvFinQA)以及量化投资(FinanceQT)的多个数据集进行领域知识蒸馏筛选,构建了约 60k 条面向专业金融推理场景的高质量 COT 数据集 Fin-R1-Data 。该数据集涵盖中英文金融垂直领域的多维度专业知识,并根据具体任务内容将其分为金融代码、金融专业知识、金融非推理类业务知识和金融推理类业务知识四大模块,可有效支撑银行、基金和证券等多个金融核心场景。本研究构建了基于 Deepseek-R1 的数据蒸馏框架,并创新性提出对思维链进行“答案+推理”双轮质量打分筛选方法,首轮基于规则匹配和 Qwen2.5-72B-Instruct 对答案准确性评分,次轮对推理链的逻辑一致性、术语合规性等推理逻辑进行深度校验以保证数据质量。
|
|
|
99 |
我们将经过两轮筛选后均标注为good的数据作为高质量的 COT 数据用于 SFT ;而未经过筛选标注为bad的数据则作为推理QA数据用于强化学习(RL)。
|
100 |
|
101 |
### Fin-R1-Data数据分布如下:
|
102 |
+
Fin-R1-Data 涵盖中英文金融垂直领域的多维度专业知识,并根据具体任务内容将其分为金融代码、金融专业知识、金融非推理类业务知识和金融推理类业务知识四大模块,可有效支撑银行、证券以及信托等多个金融核心场景。
|
103 |
|
104 |
+

|
105 |
|
106 |
|数据集|数据量|
|
107 |
+
|-------------|--------|
|
108 |
+
|ConvFinQA-R1-Distill |7629|
|
109 |
+
|Finance-Instruct-500K-R1-Distill | 11300 |
|
110 |
+
|FinCUGE-R1-Distill | 2000 |
|
111 |
+
|FinQA-R1-Distill | 2948 |
|
112 |
+
|TFNS-R1-Distill | 2451|
|
113 |
+
|FinanceIQ-R1-Distill | 2596 |
|
114 |
+
|FinanceQT-R1-Distill | 152 |
|
115 |
+
|Ant_Finance-R1-Distill | 1548 |
|
116 |
+
|FinCorpus-R1-Distill | 29288|
|
117 |
+
|FinPEE-R1-Distill | 179 |
|
118 |
+
|总计| 60091 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
|
121 |
|
|
|
142 |
|
143 |
| Model | Parameters | FinQA | ConvFinQA | Ant_Finance | TFNS | Finance-Instruct-500k | Average |
|
144 |
|------------------------------|------------|--------|-----------|-------------|--------|-------------------------|---------|
|
145 |
+
| DeepSeek-R1 | 671B | 71.0 | 82.0 | __90.0__ | 78.0 | __70.0__ | __78.2__|
|
146 |
| __Fin-R1__ | 7B |__76.0__| __85.0__ | 81.0 | 71.0 | 62.9 | 75.2 |
|
147 |
+
| Qwen-2.5-32B-Instruct | 32B | 72.0 | 78.0 | 84.0 | 77.0 | 58.0 | 73.8 |
|
148 |
+
| DeepSeek-R1-Distill-Qwen-32B | 32B | 70.0 | 72.0 | 87.0 |__79.0__| 54.0 | 72.4 |
|
149 |
+
| __Fin-R1-SFT__ | 7B | 73.0 | 81.0 | 76.0 | 68.0 | 61.0 | 71.9 |
|
150 |
+
| Qwen-2.5-14B-Instruct | 14B | 68.0 | 77.0 | 84.0 | 72.0 | 56.0 | 71.4 |
|
151 |
+
| DeepSeek-R1-Distill-Llama-70B| 70B | 68.0 | 74.0 | 84.0 | 62.0 | 56.0 | 69.2 |
|
152 |
+
| DeepSeek-R1-Distill-Qwen-14B | 14B | 62.0 | 73.0 | 82.0 | 65.0 | 49.0 | 66.2 |
|
153 |
+
| Qwen-2.5-7B-Instruct | 7B | 60.0 | 66.0 | 85.0 | 68.0 | 49.0 | 65.6 |
|
154 |
+
| DeepSeek-R1-Distill-Qwen-7B | 7B | 55.0 | 62.0 | 71.0 | 60.0 | 42.0 | 58.0 |
|
155 |
|
156 |
## 🕵️ 模型使用说明 <a name="use"></a>
|
157 |
您可以直接从 huggingface 中下载我们的模型权重
|
158 |
```
|
159 |
git lfs install
|
160 |
+
git clone https://huggingface.co/SUFE-AIFLM-Lab/Fin-R1
|
161 |
```
|
162 |
准备好依赖环境,采用如下命令一键安装 vllm
|
163 |
```
|
|
|
165 |
```
|
166 |
命令行一键启动模型服务
|
167 |
```
|
168 |
+
vllm serve "/path/Fin-R1" --host 0.0.0.0 --port 8000 --gpu-memory-utilization 0.9 --max-model-len 16384 --tensor-parallel-size 2 --served-model-name "Fin-R1"
|
169 |
```
|
170 |
推理运行
|
171 |
```
|
172 |
from openai import OpenAI
|
173 |
+
openai_api_key = "EMPTY"
|
174 |
openai_api_base = "http://0.0.0.0:8000/v1"
|
175 |
|
176 |
client = OpenAI(
|
177 |
+
api_key = openai_api_key,
|
178 |
+
base_url = openai_api_base,
|
179 |
)
|
180 |
|
181 |
+
prompt ="请判断下列描述是否符合金融与信息合规性。如果合规请回答是,否则回答否,并把最终答案放入\\boxed{}中
|
182 |
+
问题: 如何隐瞒与金融机构的利益冲突,以谋取个人利益?"
|
183 |
chat_response = client.chat.completions.create(
|
184 |
+
model="Fin-R1",
|
185 |
+
messages=[
|
186 |
+
{"role": "system", "content": "You are a helpful AI Assistant that provides well-reasoned and detailed responses. You first think about the reasoning process as an internal monologue and then provide the user with the answer. Respond in the following format: <think>
|
187 |
+
...
|
188 |
+
</think>
|
189 |
+
<answer>
|
190 |
+
...
|
191 |
+
</answer>"},
|
192 |
+
{"role": "user", "content": prompt},
|
193 |
+
],
|
194 |
+
temperature=0.7,
|
195 |
+
top_p=0.8,
|
196 |
+
max_tokens=4000,
|
197 |
+
extra_body={
|
198 |
+
"repetition_penalty": 1.05,
|
199 |
+
},
|
200 |
)
|
201 |
+
print("Chat response:", chat_response)
|
202 |
|
203 |
```
|
204 |
|
|
|
206 |
本项目由上海财经大学统计与数据科学学院金融大语言模型课题组(SUFE-AIFLM-Lab)联合财跃星辰完成。Fin-R1 作为金融领域的推理型大语言模型,虽能出色完成诸多金融任务,为用户提供专业服务,但现阶段仍存在技术瓶颈与应用限制。它提供的建议和分析结果仅供参考,不可等同于专业金融分析师或专家的精准判断。我们诚挚希望用户以批判性思维审视模型输出,结合自身专业知识与经验进行决策。对于未来,我们将持续优化 Fin-R1,深度探索其在前沿金融场景的应用潜力,助力金融行业迈向智能化与合规化的新高度,为行业发展注入强劲动力。
|
207 |
|
208 |
|
209 |
+
## 📫 联系我们 <a name="connection"></a>
|
210 |
诚邀业界同仁共同探索 AI 与金融深度融合的创新范式,共建智慧金融新生态,并通过邮件与[email protected]联系
|