Text Generation
Transformers
Safetensors
Chinese
English
llama
tool-calling
function-calling
agent
chinese
minicpm
long-conversation
conversational
text-generation-inference
Instructions to use whcl412/FinchAI-Rune3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use whcl412/FinchAI-Rune3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="whcl412/FinchAI-Rune3") 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("whcl412/FinchAI-Rune3") model = AutoModelForCausalLM.from_pretrained("whcl412/FinchAI-Rune3", 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 whcl412/FinchAI-Rune3 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "whcl412/FinchAI-Rune3" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "whcl412/FinchAI-Rune3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/whcl412/FinchAI-Rune3
- SGLang
How to use whcl412/FinchAI-Rune3 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 "whcl412/FinchAI-Rune3" \ --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": "whcl412/FinchAI-Rune3", "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 "whcl412/FinchAI-Rune3" \ --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": "whcl412/FinchAI-Rune3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use whcl412/FinchAI-Rune3 with Docker Model Runner:
docker model run hf.co/whcl412/FinchAI-Rune3
File size: 5,592 Bytes
da610df | 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 | ---
license: apache-2.0
base_model: openbmb/MiniCPM5-2B
library_name: transformers
pipeline_tag: text-generation
language:
- zh
- en
tags:
- tool-calling
- function-calling
- agent
- chinese
- minicpm
- long-conversation
---
# FinchAI-Rune3
> 底座 [MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B) · 1163 条数据 LoRA 微调
> 对比上一版 Preview:**连续 8 轮不再复述**、事实错误修正、底座换代
**精度:f16(bfloat16 完整权重,未量化)**
## 这一版改了什么
上一版(Rune3-Preview,基于 Qwen3.5-2B)在真实使用中暴露三个问题:
连续 6 轮后开始绕圈、概念混淆(把防穿透的布隆过滤器塞进雪崩解法)、
以及事实说反("逐行读文件内存随行数增长")。
这一版换了 MiniCPM5-2B 作底座(2026-11 更新,2.52B,中文优化),
补了超长对话数据,续训一轮。
## 实测对比(同题同问法)

| 项目 | Rune3-Preview | **FinchAI-Rune3** |
|---|---|---|
| 连续 8 轮复述次数 | 1 处 | **0 处** |
| 雪崩/穿透辨析 | 全对 | 定义对,解法混 1 处 |
| 逐行读文件内存 | 答错 | **答对** |
| 底座 | Qwen3.5-2B(1.88B) | MiniCPM5-2B(2.52B) |
| 训练数据 | 1134 条 | 1163 条 |
### 连续 8 轮实测(服务防扫描场景)
| 轮 | 用户 | 回复要点 |
|---|---|---|
| 1 | 服务老是被扫,怎么做基础防护 | 分三层:网络/应用/数据库 |
| 2 | 限流具体怎么配 | 按接口和用户类型,热点 1000 QPS |
| 3 | 那如果是恶意 IP 呢 | 白名单放行,超出的丢包并记日志 |
| 4 | 封 IP 会误伤吗 | 看是否多个请求都异常,单个不算 |
| 5 | 怎么判断是不是误伤 | 同一 IP 5 分钟内的请求数和失败率 |
| 6 | 有办法自动解封吗 | 连续 10 次失败、间隔 5 分钟才恢复 |
| 7 | 那监控看什么指标 | 失败率、请求延迟、异常 IP 占比,重点看漏报率 |
| 8 | 行,先这样 | 收尾 |
**轮 5 和轮 7 给了不同维度**——上一版这两轮输出的是同一套三个指标。
### 身份
```
你叫什么名字 → FinchAI-Rune3。
你是第几代 → Rune3。
```
### 工具调用
```
<function name="list_files"><param name="path">/var/log/nginx</param></function>
```
实测链路:思考 → 调 `list_files` → 返回结果 → 判断 → 回答。
## 快速开始
```bash
pip install "transformers>=5.20" torch accelerate
```
```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "whcl412/FinchAI-Rune3"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id, dtype=torch.bfloat16, device_map="auto").eval()
msgs = [{"role": "system",
"content": "你是 FinchAI-Rune3,一个跑在本地的助手。回答简洁直接。\n思考过程必须用中文写。"},
{"role": "user", "content": "你好"}]
text = tok.apply_chat_template(msgs, tokenize=False,
add_generation_prompt=True,
enable_thinking=True) # ★ 必须加
ids = tok(text, return_tensors="pt", add_special_tokens=False).to(model.device)
out = model.generate(**ids, max_new_tokens=256, do_sample=True, temperature=0.3,
top_p=0.9, repetition_penalty=1.05,
pad_token_id=tok.pad_token_id or tok.eos_token_id)
print(tok.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=False))
```
### 两个必踩的坑
**1. `enable_thinking=True` 必须传**
不传的话模板会把空思考块 `<think></think>` 直接闭合在 prompt 里,模型从闭合之后接着写,
输出变成「思考 + `</think>` + 正文」重复一遍。
**2. 解码要用 `skip_special_tokens=False`**
`<function` 和 `<param` 在 MiniCPM5 词表里是专用 token(id 18/20),
用 `skip_special_tokens=True` 会把它们过滤掉,工具调用看起来就是坏的:
```
实际输出:<function name="list_files"><param name="path">/x</param></function>
被过滤后: name="list_files"> name="path">/x
```
## 训练
- LoRA r=8 / alpha=16,可训练 12.56M(0.50%)
- 两段:145 步(lr 5e-5)+ 55 步续训(lr 3e-5)
- 训练窗口 1024 token(16G 内存下 1280 就会把系统顶满)
- 数据 1163 条,其中 29 条是 7 段超长对话切出的片段
### 数据构成
| 类别 | 条数 | 占比 |
|---|---|---|
| multiturn | 257 | 22.1% |
| code | 200 | 17.2% |
| notool | 195 | 16.8% |
| chat | 195 | 16.8% |
| call | 103 | 8.9% |
| ask | 74 | 6.4% |
| identity | 73 | 6.3% |
| refuse | 66 | 5.7% |
## 已知问题
1. **雪崩解法里还混着布隆过滤器** —— 那是防穿透的,定义能分对,但讲解法时还是会串
2. **代码生成会断** —— 让它写完整函数时,容易在中间停下(尤其输出长度受限时)
3. **思考与正文偶尔脱节** —— 思考里说"给个对比表",正文没给
4. **训练窗口只有 1024 token** —— 底座支持 128K,但 16G 内存训练时最多到 1536,
超出的样本会被截断
5. **`causal_conv1d` / `flash-linear-attention` 在 MPS 无实现**,推理走参考实现
## 许可
底座 MiniCPM5-2B 为 Apache 2.0,本模型同样适用。
## 相关
- 底座:[openbmb/MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B)
- 上一版:[whcl412/FinchAI-Rune3-Preview](https://huggingface.co/whcl412/FinchAI-Rune3-Preview)
- 更早:[whcl412/FinchAI-Rune2-Luna](https://huggingface.co/whcl412/FinchAI-Rune2-Luna)
|