杏核(Xinghe)是一款专注中医的推理型语言模型。v1.2 由 Xinghe-TCM 在开源基座模型上,使用自建的《黄帝内经》高质量指令数据集微调而成。它扎根经文与临床,先在 <think> 中完成辨证推理,再给出平实、可落地的调养判断与方向。
与通用大模型不同,杏核不追求“无所不答”,而是把中医辨证这件事做扎实:说人话、有依据、守边界——只给临床可用的判断与调养方向,不开具体处方与剂量,也不做现代医学诊断。
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_id = "zsyjsld/Xinghe1.2-9B" # v1.2 仓库
4tokenizer = AutoTokenizer.from_pretrained(model_id)
5model = AutoModelForCausalLM.from_pretrained(
6 model_id, torch_dtype="auto", device_map="auto"
7)
8
9system = ("你是杏核(Xinghe),由 Xinghe-TCM 开发的中医助手,当前版本 1.2。"
10 "你精研《黄帝内经》,答问扎根经文与临床,语言平实,只给临床可用的判断与调养方向;"
11 "不开具体处方与剂量,不做现代医学诊断。")
12messages = [
13 {"role": "system", "content": system}, # 可省略;留空亦能正常工作
14 {"role": "user", "content": "什么是治未病?"},
15]
16text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
17inputs = tokenizer(text, return_tensors="pt").to(model.device)
18outputs = model.generate(**inputs, max_new_tokens=1024, temperature=0.7)
19print(tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
1from modelscope import AutoModelForCausalLM, AutoTokenizer
2
3model_id = "zsyjsld/Xinghe1.2-9B" # v1.2 仓库
4tokenizer = AutoTokenizer.from_pretrained(model_id)
5model = AutoModelForCausalLM.from_pretrained(
6 model_id, torch_dtype="auto", device_map="auto"
7)
8# 生成用法与上方 Transformers 示例一致
基于三层评测方案(
Notion 评测规范),在 RTX 3090 上对 Xinghe 1.2-9B 的各量化版本进行了完整评测(评测集共 76 条,涵盖理论辨析、经文解读、概念对比、临床案例、纠错反例五大题型及多种临床陷阱)。
-
v1(Xinghe1-9B):首个开源版本。
-
v1.2(Xinghe1.2-9B,本版本):训练数据从 v1 的 400 余条扩充至 2009 条(领域 1820 + 身份 189),数据质量全面提升(全量红线复检硬性违规 0、输出统一中文双引号、去除机械感破折号、优化分段可读性);新增身份数据并对"空 / 替换 system prompt"做鲁棒化,模型整体输出质量显著提升。
1@misc{xinghe2026,
2 title = {Xinghe: A Huangdi Neijing-grounded Traditional Chinese Medicine Reasoning Model},
3 author = {Xinghe-TCM},
4 year = {2026},
5 howpublished = {\url{https://huggingface.co/zsyjsld/Xinghe1.2-9B}, \url{https://modelscope.cn/models/zsyjsld/Xinghe1.2-9B}}
6}