モデル概要
モデル特徴
モデル能力
使用事例
🚀 ArindamSingh/gemma-3-1b-it-medical-o1-reasoning-finetune-16bit
このgemma-3-1b-it-medical-o1-reasoning-finetune-16bitモデルは、医療データセット、特に医療推論に関するGemma3のファインチューニングモデルがインターネット上に存在しなかったため、独自にUnslothとHuggingfaceのTRLライブラリを用いて訓練されました。
- 開発者: ArindamSingh
- ライセンス: apache-2.0
- ファインチューニング元のモデル : unsloth/gemma-3-1b-it
🚀 クイックスタート
このコード例では、transformers
ライブラリを使用して、gemma-3-1b-it-medical-o1-reasoning-finetune-16bit
モデルを使ってテキスト生成を行う方法を示しています。
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)
✨ 主な機能
- 思考連鎖型の回答:Medical-O1データセットにより、ステップバイステップの論理付けを伴った回答が可能です。
- Unslothによる高速化:UnslothによるLoRAの高速化により、単一のA100でのトレーニング時間を約40%短縮できます。
- 統合された重み:アダプターのステップが不要で、Gemmaの代わりにそのまま使用できます。
- 小さなサイズ:2GB未満のダウンロードサイズで、4GB以下のVRAMまたはCPUでもGGUF/HFライブラリを通じて実行可能です。
📦 インストール
このREADMEには具体的なインストール手順が記載されていないため、このセクションは省略されます。
📚 ドキュメント
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との比較
- 思考連鎖型の回答:Medical-O1データセットにより、ステップバイステップの論理付けを伴った回答が可能です。
- Unslothによる高速化:UnslothによるLoRAの高速化により、単一のA100でのトレーニング時間を約40%短縮できます。
- 統合された重み:アダプターのステップが不要で、Gemmaの代わりにそのまま使用できます。
- 小さなサイズ:2GB未満のダウンロードサイズで、4GB以下のVRAMまたは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-16GB (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. Responsible-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ライセンスの下で提供されています。



