Instructions to use USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B") model = AutoModelForCausalLM.from_pretrained("USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B
- SGLang
How to use USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B with Docker Model Runner:
docker model run hf.co/USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B
Download README.md from USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B: direct link, hf CLI and curl.
- Browser
- Download file 3.85 kB
-
https://huggingface.co/USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B/resolve/main/README.md
- Command line
-
hf download hf://USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B/README.md
-
curl -L -o README.md https://huggingface.co/USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B/resolve/main/README.md
language:
- zh
- en
license: cc-by-nc-sa-4.0
library_name: transformers
pipeline_tag: text-generation
base_model: Qwen/Qwen3-8B
tags:
- financial
- chinese
- qwen3
- lora
- knowledge-extraction
datasets:
- USTC-KnowledgeComputingLab/FinLLM-EvalSets
FinLLM-V2-Qwen3-8B
金融领域大模型 V2.0。以 Qwen3-8B 为基座,同时承担两类任务:金融选择题问答与知识抽取(输出结构化 JSON)。
本仓库提供的是** 完整权重**,可直接用 transformers 加载,不需要额外适配器。
模型信息
| 项目 | 设定 |
|---|---|
| 基座 | Qwen3-8B |
| 参数量 | 8.19B(16,381,470,720 字节,bf16) |
| 架构 | Qwen3ForCausalLM(hidden 4096,36 层) |
| 精度 | bfloat16 |
| 训练方式 | LoRA(r=16,α=32,作用于 7 个投影层)后合并 |
| 可训练参数 | 约 0.53% |
| 训练轮数 | 2 epoch(按验证损失选第 2 轮) |
| 学习率 | 1e-4 |
| 序列长度 | 4096 |
| 批大小 | 单卡 4,梯度累积 4 |
训练数据为三类混合:知识抽取指令数据(四元组 JSON)、金融概念选择题、专项补强题。混合的目的是在学习抽取格式的同时不损失选择题能力。
两个任务
选择题
验证集、5-shot、贪心解码、max_new_tokens=16:
| 基准 | 题数 | 结果 |
|---|---|---|
| C-Eval 金融 4 科 | 186 | 132/186 = 70.97% |
| FinEval 金融学术知识 | 1,151 | 857/1,151 = 74.46% |
C-Eval 4 科明细:大学经济学 65.45%、工商管理 81.82%、注册会计师 71.43%、税务师 69.39%。
H100 + torch 2.8 上复测结果与上述完全一致(132/186、857/1,151,逐科零偏差)。
知识抽取
从金融文本中抽取「主体 / 指标 / 时间 / 数值」四元组,输出 JSON。测试集 2,500 条,字段级评测:
| 指标 | 结果 |
|---|---|
| 精确率 | 7,754/7,987 = 97.08% |
| 召回率 | 7,754/8,182 = 94.77% |
| F1 | 95.91% |
分字段:主体 82.4%、指标 96.5%、时间 99.2%、数值 96.5%(主体是已知弱项,抽取粒度偏粗)。
使用方法
必须关闭思考模式。 Qwen3 默认开启 thinking,在本项目的评测口径下会因输出预算被截断而拿不到答案:
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "USTC-KnowledgeComputingLab/FinLLM-V2-Qwen3-8B"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="bfloat16", device_map="cuda")
msgs = [{"role": "user", "content": "你好"}]
text = tok.apply_chat_template(msgs, tokenize=False,
add_generation_prompt=True,
enable_thinking=False)
需要 transformers >= 4.51,低于此版本会报架构不识别。
已知限制
- 未做人类偏好对齐
- 知识抽取偶发不按 JSON 格式输出(实测约 1.7%),直接给出数值字符串,下游解析需要容错
- 长文本中的同名多主体场景,主体归属可能判错
- 金融数值、日期可能出错,需回原文核对
许可证
本模型以 CC BY-NC-SA 4.0(署名—非商业性使用—相同方式共享 4.0 国际)发布。
- 署名:使用时请注明模型来源与本项目名称,并附仓库链接
- 非商业:不得用于商业目的。商业授权请联系项目组
- 相同方式共享:基于本模型的衍生作品须以相同许可发布
基座 Qwen3-8B 本身采用 Apache-2.0,其许可条款不因本发布而改变。本仓库的微调权重采用 CC BY-NC-SA 4.0,与训练、评测所用基准数据的许可保持一致。
评测所用的 C-Eval、FinEval 数据遵循各自原始许可,引用时请注明原始基准与论文。