模型概述
模型特點
模型能力
使用案例
🚀 ArindamSingh/gemma-3-1b-it-medical-o1-reasoning-finetune-16bit
本項目基於unsloth/gemma-3-1b-it
模型進行微調,專門針對醫學推理場景進行優化,能夠為醫學教育、研究等領域提供支持。
🚀 快速開始
from transformers import pipeline
msg = "What is type 2 diabetes?"
pipe = pipeline("text-generation", model="ArindamSingh/gemma-3-1b-it-medical-o1-reasoning-finetune-16bit")
messages = [
{"role": "user", "content": msg},
]
pipe(messages)
✨ 主要特性
- Chain-of-Thought answers:藉助Medical-O1數據集,能夠提供逐步推理的答案。
- Unsloth加速:在單張A100上,使用Unsloth加速的LoRA將訓練時間縮短了約40%。
- Merged weights:無需額外的適配器步驟,可直接替代Gemma模型。
- Tiny footprint:下載大小小於2GB,可在4GB顯存或CPU上通過GGUF/HF庫運行。
📦 安裝指南
文檔未提供安裝步驟,故跳過此章節。
💻 使用示例
基礎用法
from transformers import pipeline
msg = "What is type 2 diabetes?"
pipe = pipeline("text-generation", model="ArindamSingh/gemma-3-1b-it-medical-o1-reasoning-finetune-16bit")
messages = [
{"role": "user", "content": msg},
]
pipe(messages)
高級用法
文檔未提供高級用法代碼示例,故跳過此部分。
📚 詳細文檔
1. 模型卡片快照
屬性 | 詳情 |
---|---|
基礎模型 | google/gemma-3-1b-it |
參數數量 | 10億(完整)– LoRA秩8適配器合併 |
精度 | 16位 (fp16 ) |
領域 | 臨床與生物醫學推理 |
微調框架 | FreedomIntelligence Medical-O1 Reasoning (20 k Q-CoT-A) + Unsloth LoRA |
訓練方法 | 監督式CoT SFT → LoRA合併與量化 |
最後更新時間 | 查看HF頁面 |
許可證 | Apache-2.0 |
2. 與基礎Gemma-3 1B-IT模型對比
- Chain-of-Thought answers:得益於Medical-O1數據集,能夠提供逐步推理的答案。
- Unsloth加速:在單張A100上,使用Unsloth加速的LoRA將訓練時間縮短了約40%。
- Merged weights:無需額外的適配器步驟,可直接替代Gemma模型。
- Tiny footprint:下載大小小於2GB,可在4GB顯存或CPU上通過GGUF/HF庫運行。
3. 預期用途
✔️ 預期用途 | ❌ 謹慎使用/超出範圍 |
---|---|
醫學教育、PubMed分類、編碼建議(ICD、SNOMED)、研究構思 | 自動診斷、緊急分診、任何需要監管批准的決策 |
4. 微調概述
項目 | 設置 |
---|---|
數據集 | FreedomIntelligence/medical-o1-reasoning-SFT (19 704行) |
提示格式 | 問題 + 複雜的思維鏈 → 響應 |
庫 | Unsloth 0.6 + 8位 paged_adamw |
LoRA配置 | r = 8, α = 32, 丟棄率 = 0.05 (q/k/v/o & MLP投影) |
硬件 | 2 × T4-16 GB (flash-attn 2) |
訓練 | 3個週期 - 學習率 = 2e-5 餘弦 - 批次 = 1 × 4 梯度累積 |
運行時間 | 約4小時 (Unsloth對比普通PEFT約6.5小時) |
5. 評估亮點*
任務(開發子集) | 指標 | 基礎Gemma-1B-IT | 本模型 |
---|---|---|---|
PubMedQA | QA-F1 | 46% | 57% |
*100個問題樣本,貪心解碼;腳本位於eval/
目錄。
6. 侷限性與偏差
- 可能會虛構引用或使用過時的指南。
- 數據集以英語為主,對兒科/罕見疾病的覆蓋有限。
- 非醫療設備,使用時需有人為監督。
7. 負責任的AI清單
- [x] 臨床使用前進行人工審核
- [x] 聲明“非醫療建議”
8. 引用
@misc{singh2025gemma1bmed,
title = {Gemma-3 1B Medical-O1: Compact Chain-of-Thought Clinical LLM},
author = {Arindam Singh},
year = {2025},
url = {https://huggingface.co/ArindamSingh/gemma-3-1b-it-medical-o1-reasoning-finetune-16bit}
}
9. 致謝
感謝Google DeepMind(Gemma)、FreedomIntelligence(Medical-O1數據集)、Unsloth團隊、Kaggle、Google Colab和Hugging Face提供的開放生態系統。
10. 示例輸出
[{'generated_text': [{'role': 'user', 'content': 'What is type 2 diabetes?'}, {'role': 'assistant', 'content': "Okay, let's break down type 2 diabetes. It's a complex condition, but here's a comprehensive explanation:\n\nWhat is Type 2 Diabetes?\n\nType 2 diabetes is a chronic metabolic disorder in which the body doesn't use insulin properly. Insulin is a hormone produced by the pancreas that helps glucose (sugar) from food get into your cells to be used for energy. When insulin resistance develops, the pancreas has to work harder to produce more insulin to compensate, and eventually, it can't keep up with the demand.\n\nHere's a more detailed breakdown:\n\n1. It's Not About Insulin Resistance (Initially): The key difference between type 1 and type 2 diabetes is how the body handles insulin.\n * Type 1 Diabetes: This is an autoimmune condition where the body's immune system attacks and destroys the insulin-producing cells (beta cells) in the pancreas. People with type 1 diabetes require insulin injections or pump to survive.\n * Type 2 Diabetes: This is a process where the body becomes resistant to insulin, and the pancreas initially tries to compensate by producing more insulin. Over time, the pancreas can't keep up, and blood sugar levels rise.\n\n2. How it Develops:\n * Lifestyle Factors: Type 2 diabetes often develops gradually, often as a result of a combination of:\n * Genetics: A family history of diabetes increases your risk.\n * Diet: A diet high in processed foods, sugary drinks, and unhealthy fats can contribute.\n * Lack of Exercise: Being physically inactive increases your risk.\n * Obesity: Excess weight, particularly around the abdomen, is strongly linked to insulin resistance.\n * Pancreatic Dysfunction: As the pancreas struggles to produce enough insulin, it can gradually lose its ability to do so effectively.\n\n3. Symptoms: Many people with type 2 diabetes have no noticeable symptoms for months or even years. However, as the condition progresses, symptoms can develop:\n * Frequent Urination: The kidneys try to get rid of excess sugar in the urine.\n * Excessive Thirst: Due to the body’s attempt to regulate fluid balance.\n * Increased Hunger: The body isn't using glucose effectively.\n * Fatigue: Lack of energy.\n * Blurred Vision: High blood sugar can affect the lens of the eye.\n * Slow-Healing Sores: High blood sugar can impair wound healing.\n * Frequent Infections: High blood sugar can weaken the immune system.\n\n4. Complications (if not managed): If left untreated, type 2 diabetes can lead to serious health problems:\n * Cardiovascular Disease: Heart disease, stroke.\n * Neuropathy: Nerve damage, causing pain, numbness, and tingling (especially in the hands and feet).\n * Nephropathy: Kidney disease.\n * Retinopathy: Eye damage.\n * Foot Problems: Poor circulation and nerve damage can lead to infections and ulcers.\n\nDiagnosis:\n\n* Blood Tests: A fasting blood glucose test is the primary test. A random blood glucose test can also be done.\n* A1C Test: This tests your average blood sugar level over the past 2-3 months.\n\nTreatment:\n\n* Lifestyle Changes: Diet and exercise are crucial.\n* Metformin: A common medication that helps lower blood sugar.\n* Other Medications: Oral medications, insulin injections, or a combination of these may be needed.\n* Regular Monitoring: Blood sugar levels need to be monitored regularly to adjust treatment as needed.\n\nImportant Note: This information is for general knowledge and informational purposes only, and does not constitute medical advice. It is essential to consult with a qualified healthcare professional for any health concerns or before making any decisions related to your health or treatment.\n\nResources:\n\n* American Diabetes Association: https://www.diabetes.org/\n* Centers for Disease Control and Prevention (CDC) - Diabetes: https://www.cdc.gov/diabetes/index.html\n\n---\n\nDisclaimer: I am an AI Chatbot and not a medical professional. This information is intended for general knowledge and informational purposes only, and does not constitute medical advice. It is essential to consult with a qualified healthcare professional for any health concerns or before making any decisions related to your health or treatment.\n\nTo help me give you even more tailored information, could you tell me:\n\n* Are you interested in learning more about a specific aspect of type 2 diabetes (e.g., treatment options, prevention, symptoms)?"}]}]
🔧 技術細節
文檔未提供技術實現細節,故跳過此章節。
📄 許可證
本項目使用Apache-2.0許可證。



