Reasoning-Medical0.1-27B(Qwen3.5-27B 医疗微调版本,声称超越 MedGemma)
摘要
EpistemeAI 发布了 Reasoning-Medical0.1-27B,这是 Qwen3.5-27B 的医疗推理微调版本,声称通过在精心策划的 10 万条记录数据集上引入链式思维推理,在多项医疗基准测试中超越了 MedGemma。
暂无内容
查看缓存全文
缓存时间: 2026/07/09 11:40
EpistemeAI/Reasoning-Medical0.1-27B · Hugging Face 来源:https://huggingface.co/EpistemeAI/Reasoning-Medical0.1-27B ## https://huggingface.co/EpistemeAI/Reasoning-Medical0.1-27B#introduction介绍 该 EpistemeAI/Reasoning-Medical0.1-27B 专为专业医学、医学遗传学、大学生物学/医学及临床知识中的高级医学推理而设计。该模型在包含 100,000 条记录的大规模数据集上进行了微调,该数据集通过混合多种公开的医学推理数据集并融入思维链推理精心构建,以改善医学相关问题的逐步推理能力。训练采用 GRPO 训练器配合 Unsloth 优化方法实现高效微调。主要目标是提供一个全面且多样化的数据集,用于训练语言模型在医学问答和推理任务中的能力。由于该模型在医学推理方面表现出色,如需下载模型请先获得许可。 > 安全须知: 本模型仅用于良性医学和科学推理。严禁用于生物或化学武器开发、病原体增强、毒素生产、有害合成或任何可能造成伤害的活动。所有生物医学、生物学、化学或实验室相关输出均需经过专家评审,并遵守适用的法律、伦理、生物安全、生物安保及化学安全标准。 ## https://huggingface.co/EpistemeAI/Reasoning-Medical0.1-27B#model-overview模型概述 - 类型:因果语言模型,带视觉编码器 - 训练阶段:预训练及后训练 - 语言模型 - 参数量:27B - 隐层维度:5120 - 词元嵌入:248320(填充后) - 层数:64 - 隐层布局:16 × (3 × (门控DeltaNet → FFN) → 1 × (门控注意力 → FFN)) - 门控DeltaNet: - 线性注意力头数:V 为48,QK 为16 - 头维度:128 - 门控注意力: - 注意力头数:Q 为24,KV 为4 - 头维度:256 - 旋转位置嵌入维度:64 - 前馈网络: - 中间维度:17408 - LM 输出:248320(填充后) - MTP:多步训练 - 上下文长度:原生 262,144,可扩展至 1,010,000 个词元。 ## https://huggingface.co/EpistemeAI/Reasoning-Medical0.1-27B#commercial-access商业访问 Reasoning-Medical0.1-27B 可用于: - 医学教育应用 - 研究辅助工具 - 生物技术/制药文献分析 - 私有医学推理部署 - 模型基准测试与安全评估 如需 API 访问、私有部署或商业许可,请联系:[email protected] ## https://huggingface.co/EpistemeAI/Reasoning-Medical0.1-27B#benchmark基准测试 任务|版本|过滤|n-shot|指标|方向|Reasoning Medical0.1 27B|Reasoning Medical 27B|MedGemma 1 27B —|—|—|—|—|—|—|—|—|— MMLU-Pro 生物学|3.1|custom-extract|2|exact_match|↑|0.93|0.85|— MMLU-ProX 生物学|0|custom-extract|2|exact_match|↑|0.968|0.80|— MedQA|YAML|none|2|acc|↑|0.969|0.9|0.853 ### https://huggingface.co/EpistemeAI/Reasoning-Medical0.1-27B#installation安装 开始使用前,请安装必要的依赖以配置环境: !pip install --upgrade "transformers>=5.2.0" ### https://huggingface.co/EpistemeAI/Reasoning-Medical0.1-27B#using-reasoning-medical-27b-via-the-chat-completions-api通过聊天补全 API 使用 Reasoning Medical 27B 聊天补全 API 可通过标准 HTTP 请求或 OpenAI SDK 访问。此处展示使用 OpenAI Python SDK 的示例。开始前,请确保已安装并配置好 API 密钥和 API 基础 URL,例如: pip install -U openai # 相应设置以下环境变量 export OPENAI_BASE_URL="http://localhost:8000/v1" export OPENAI_API_KEY="EMPTY" > 我们建议对生成使用以下采样参数组合 - 通用任务的思考模式:temperature=1.0, top_p=0.95, top_k=20, min_p=0.0, presence_penalty=0.0, repetition_penalty=1.0 - 精确编码任务(如 Web 开发)的思考模式:temperature=0.6, top_p=0.95, top_k=20, min_p=0.0, presence_penalty=0.0, repetition_penalty=1.0 - 指令(或非思考)模式:temperature=0.7, top_p=0.80, top_k=20, min_p=0.0, presence_penalty=1.5, repetition_penalty=1.0 请注意,采样参数的支持因推理框架而异。 > 我们的模型默认以思考模式运行,在生成最终回答前会生成以\n...\n\n 标识的思考内容。如需禁用思考内容并直接获得回答,请参考此处的示例(https://huggingface.co/EpistemeAI/Reasoning-Medical0.1-27B#instruct-or-non-thinking-mode)。 #### https://huggingface.co/EpistemeAI/Reasoning-Medical0.1-27B#text-only-input纯文本输入 from openai import OpenAI # 通过环境变量配置 client = OpenAI() messages = [ {"role": "user", "content": "慢性尿道梗阻由于良性柱状增生可导致肾实质发生以下哪种变化"}, ] chat_response = client.chat.completions.create( model="EpistemeAI/Reasoning-Medical0.1-27B", messages=messages, max_tokens=81920, temperature=1.0, top_p=0.95, presence_penalty=0.0, extra_body={ "top_k": 20, }, ) print("聊天响应:", chat_response) #### https://huggingface.co/EpistemeAI/Reasoning-Medical0.1-27B#image-input图像输入 from openai import OpenAI # 通过环境变量配置 client = OpenAI() messages = [ { "role": "user", "content": [ { "type": "image_url", "image_url": { "url": "https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.5/demo/CI_Demo/mathv-1327.jpg" } }, { "type": "text", "text": "图示四个圆的圆心位于正方形的四个角。两个大圆彼此相切,同时也与两个小圆相切。小圆半径需要乘以什么因子才能得到大圆的半径?\n选项:\n(A) $\\frac{2}{9}$\n(B) $\\sqrt{5}$\n(C) $0.8 \\cdot \\pi$\n(D) 2.5\n(E) $1+\\sqrt{2}$" } ] } ] chat_response = client.chat.completions.create( model="EpistemeAI/Reasoning-Medical0.1-27B", messages=messages, max_tokens=81920, temperature=1.0, top_p=0.95, presence_penalty=0.0, extra_body={ "top_k": 20, }, ) print("聊天响应:", chat_response) #### https://huggingface.co/EpistemeAI/Reasoning-Medical0.1-27B#video-input视频输入 from openai import OpenAI # 通过环境变量配置 client = OpenAI() messages = [ { "role": "user", "content": [ { "type": "video_url", "video_url": { "url": "https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.5/demo/video/N1cdUjctpG8.mp4" } }, { "type": "text", "text": "墓室主室的壁龛中发现了多少件瓷瓶?" } ] } ] # 当 vLLM 启动时使用 `--media-io-kwargs '{"video": {"num_frames": -1}}'`, # 可以通过 `extra_body`(例如设置 `fps`)配置视频帧采样。 # 此特性目前仅在 vLLM 中支持。 # # 默认情况下,`fps=2` 且 `do_sample_frames=True`。 # 当 `do_sample_frames=True` 时,你可以自定义 `fps` 值来设置所需的视频采样率。 chat_response = client.chat.completions.create( model="EpistemeAI/Reasoning-Medical0.1-27B", messages=messages, max_tokens=81920, temperature=1.0, top_p=0.95, presence_penalty=0.0, extra_body={ "top_k": 20, "mm_processor_kwargs": {"fps": 2, "do_sample_frames": True}, }, ) print("聊天响应:", chat_response) #### https://huggingface.co/EpistemeAI/Reasoning-Medical0.1-27B#instruct-or-non-thinking-mode指令(或非思考)模式 > 我们的模型官方不支持 Reasoning Medical 27B 的软切换,即 /think 和 /nothink。我们的模型默认会在回答前进行思考。你可以通过配置 API 参数直接获得模型的回答而不经过思考。例如: from openai import OpenAI # 通过环境变量配置 client = OpenAI() messages = [ { "role": "user", "content": [ { "type": "image_url", "image_url": { "url": "https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.6/demo/RealWorld/RealWorld-04.png" } }, { "type": "text", "text": "这是哪里?" } ] } ] chat_response = client.chat.completions.create( model="EpistemeAI/Reasoning-Medical0.1-27B", messages=messages, max_tokens=32768, temperature=0.7, top_p=0.8, presence_penalty=1.5, extra_body={ "top_k": 20, "chat_template_kwargs": {"enable_thinking": False}, }, ) print("聊天响应:", chat_response) > 如果你使用的是阿里云模型服务平台 API,除了更改 model,请使用 "enable_thinking": False 代替 "chat_template_kwargs": {"enable_thinking": False}。 #### https://huggingface.co/EpistemeAI/Reasoning-Medical0.1-27B#preserve-thinking保留思考 默认情况下,仅保留处理最新用户消息时生成的思考块,形成常见的交错思考模式。Reasoning Medical 27B 经过额外训练,可以保留并利用历史消息中的思考痕迹。你可以通过设置 preserve_thinking 选项来启用此行为: from openai import OpenAI # 通过环境变量配置 client = OpenAI() messages = [...] chat_response = client.chat.completions.create( model="EpistemeAI/Reasoning-Medical0.1-27B", messages=messages, max_tokens=32768, temperature=0.6, top_p=0.95, presence_penalty=0.0, extra_body={ "top_k": 20, "chat_template_kwargs": {"preserve_thinking": True}, }, ) print("聊天响应:", chat_response) > 如果你使用的是阿里云模型服务平台 API,除了更改 model,请使用 "preserve_thinking": True 代替 "chat_template_kwargs": {"preserve_thinking": False}。 该能力在智能体场景中尤为有益,保持完整的推理上下文可以增强决策一致性,并且在许多情况下通过减少冗余推理来降低总体词元消耗。此外,它还可以改善 KV 缓存利用率,在思考和非思考模式下优化推理效率。 ## https://huggingface.co/EpistemeAI/Reasoning-Medical0.1-27B#agentic-usage智能体使用 我们的模型在工具调用方面表现出色。 ### https://huggingface.co/EpistemeAI/Reasoning-Medical0.1-27B#qwen-agentQwen-Agent 我们建议使用 Qwen-Agent(https://github.com/QwenLM/Qwen-Agent)快速构建基于 Qwen3.6 的智能体应用。要定义可用工具,你可以使用 MCP 配置文件、使用 Qwen-Agent 的内置工具,或自行集成其他工具。 import os from qwen_agent.agents import Assistant # 定义 LLM # 使用阿里云模型服务平台 llm_cfg = { # 使用 DashScope 提供的 OpenAI 兼容模型服务: 'model': 'EpistemeAI/Reasoning-Medical0.1-27B', 'model_type': 'qwenvl_oai', 'model_server': 'https://dashscope.aliyuncs.com/compatible-mode/v1', 'api_key': os.getenv('DASHSCOPE_API_KEY'), 'generate_cfg': { 'use_raw_api': True, # 使用 Dash Scope OAI API 时,通过此方式传递是否启用思考模式的参数 'extra_body': { 'enable_thinking': True, 'preserve_thinking': True, }, }, } # 使用 OpenAI 兼容的 API 端点。 # 部署框架的功能,并让 Qwen-Agent 自动处理相关操作。 # # llm_cfg = { # # 使用你通过 vLLM/SGLang 自己部署的、兼容 OpenAI API 的模型服务: # 'model': 'EpistemeAI/Reasoning-Medical0.1-27B', # 'model_type': 'qwenvl_oai', # 'model_server': 'http://localhost:8000/v1', # api_base # 'api_key': 'EMPTY', # # 'generate_cfg': { # 'use_raw_api': True, # # 使用 vLLM/SGLang OAI API 时,通过此方式传递是否启用思考模式的参数 # 'extra_body': { # 'chat_template_kwargs': {'enable_thinking': True, 'preserve_thinking': True} # }, # }, # } # 定义工具 tools = [ {'mcpServers': { # 你可以指定 MCP 配置文件 "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/xxxx/Desktop"] } } } ] # 定义智能体 bot = Assistant(llm=llm_cfg, function_list=tools) # 流式生成 messages = [{'role': 'user', 'content': '帮我整理桌面。'}] for responses in bot.run(messages=messages): pass print(responses) # 流式生成 messages = [{'role': 'user', 'content': '开发一个狗狗网站并保存到桌面'}] for responses in bot.run(messages=messages): pass print(responses) ## https://huggingface.co/EpistemeAI/Reasoning-Medical0.1-27B#processing-ultra-long-texts处理超长文本 Reasoning Medical 27B 原生支持最长 262,144 个词元的上下文长度。对于总长度(包括输入和输出)超过此限制的长程任务,我们建议使用 RoPE 扩展技术(如 YaRN)来有效处理长文本。YaRN 目前被多个推理框架支持,例如 transformers、vllm、ktransformers 和 sglang。通常,对于支持的框架,有两种启用 YaRN 的方法: - 修改模型配置文件:在 config.json 文件中,更改 text_config 中的 rope_parameters 字段为: { "mrope_interleaved": true, "mrope_section": [ 11, 11, 10 ], "rope_type": "yarn", "rope_theta": 10000000, "partial_rotary_factor": 0.25, "factor": 4.0, "original_max_position_embeddings": 262144, } - 传递命令行参数:对于 vllm,可以使用 VLLM_ALLOW_LONG_MAX_MODEL_LEN=1 vllm serve ... --hf-overrides '{"text_config": {"rope_parameters": {"mrope_interleaved": true, "mrope_section": [11, 11, 10], "rope_type": "yarn", "rope_theta": 10000000, "partial_rotary_factor": 0.25, "factor": 4.0, "original_max_position_embeddings": 262144}}}' --max-model-len 1010000 对于 sglang 和 ktransformers,可以使用 SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1 python -m sglang.launch_server ... --json-model-override-args '{"text_config": {"rope_parameters": {"mrope_interleaved": true, "mrope_section": [11, 11, 10], "rope_type": "yarn", "rope_theta": 10000000, "partial_rotary_factor": 0.25, "factor": 4.0, "original_max_position_embeddings": 262144}}}' --context-length 1010000 > 所有主流开源框架都实现了静态 YaRN,这意味着缩放因子不随输入长度变化,可能影响短文本的性能。 我们建议仅在需要处理长上下文时才修改 rope_parameters 配置。同时建议根据需要修改 factor。例如,如果你的应用典型上下文长度为 524,288 个词元,最好将 factor 设置为 2.0。 ## https://huggingface.co/EpistemeAI/Reasoning-Medical0.1-27B#best-practices最佳实践 为获得最佳性能,我们建议以下设置: 1. 采样参数: - 我们建议根据模式和任务类型使用以下采样参数组合: - 通用任务的思考模式:temperature=1.0、top_p=0.95、top_k=20、min_p=0.0、presence_penalty=0.0、repetition_penalty=1.0 - 精确编码任务(例如 Web 开发)的思考模式:temperature=0.6、top_p=0.95、top_k=20、min_p=0.0、presence_penalty=0.0、repetition_penalty=1.0 - 指令(或非思考)模式:temperature=0.7、top_p=0.80、top_k=20、min_p=0.0、presence_penalty=1.5、repetition_penalty=1.0 - 对于支持的框架,你可以将 presence_penalty 参数调整到 0 到 2 之间,以减少无限重复。但使用较高的值有时会导致语言混合和模型性能略微下降。 2. 足够的输出长度:对于大多数查询,我们建议输出长度为 32,768 个词元。对于高度复杂问题的基准测试(如数学和编程竞赛中的问题),我们建议将最大输出长度设置为 81,920 个词元。这一预
相似文章
Mia-AiLab/Qwable-3.6-27b
Mia-AiLab 发布了 Qwable-3.6-27b,这是一个基于清理后的推理和指令数据集对 Qwen3.6-27B 进行全参数微调的检查点,针对编程、技术辅助和结构化回复进行了优化。
empero-ai/Qwythos-9B-Claude-Mythos-5-1M
Empero AI 发布了 Qwythos-9B,这是一个经过微调的推理模型,具有100万令牌的上下文和无审查能力,在基准测试中相比于其基础模型 Qwen3.5-9B 有显著提升。
让LLMs相互评判:用于医学问答的多智能体同行评审推理
本文介绍了一种多智能体同行评审推理方法,其中多个LLM独立生成思维链推理,然后相互评估输出以选择最佳答案。该方法在医学问答基准测试中优于单模型推理和多数投票。
Qwen3.7 Max在Artificial Analysis评测中得分,27B/35B等待室
Qwen3.7 Max在Artificial Analysis基准测试中排名第五,与GPT-5.4持平,并超越了刚发布的Gemini 3.5 Flash,而Qwen3.6 27B则明显落后。
MedGemma:我们最强大的开源健康AI开发模型
Google DeepMind 发布了 MedGemma 27B Multimodal 和 MedSigLIP,扩充了其开源 Health AI Developer Foundations,加入了用于医学文本和影像任务的高性能、保护隐私的模型。