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 |
+
II-Medical-7B-Preview is a medical reasoning model trained on a comprehensive dataset of medical knowledge. The model is designed to enhance AI capabilities in medical reasoning.
|
| 6 |
+
## II. Training Methodology
|
| 7 |
+
|
| 8 |
+
We collected and generated a comprehensive set of reasoning datasets for the medical domain and performed SFT fine-tuning on the Qwen/Qwen2.5-7B-Instruct model. Following this, we further optimized the SFT model by training DAPO on a hard-reasoning dataset to boost performance.
|
| 9 |
+
|
| 10 |
+
For SFT stage we using the hyperparameters:
|
| 11 |
+
|
| 12 |
+
- Max Length: 16378.
|
| 13 |
+
- Batch Size: 128.
|
| 14 |
+
- Learning-Rate: 5e-5.
|
| 15 |
+
- Number Of Epoch: 4.
|
| 16 |
+
|
| 17 |
+
For RL stage we setup training with:
|
| 18 |
+
|
| 19 |
+
- Max prompt length: 2048 tokens.
|
| 20 |
+
- Max response length: 12288 tokens.
|
| 21 |
+
- Overlong buffer: Enabled, 4096 tokens, penalty factor 1.0.
|
| 22 |
+
- Clip ratios: Low 0.2, High 0.28.
|
| 23 |
+
- Batch sizes: Train prompt 512, Generation prompt 1536, Mini-batch 32.
|
| 24 |
+
- Responses per prompt: 16.
|
| 25 |
+
- Temperature: 1.0, Top-p: 1.0, Top-k: -1 (vLLM rollout).
|
| 26 |
+
- Learning rate: 1e-6, Warmup steps: 10, Weight decay: 0.1.
|
| 27 |
+
- Loss aggregation: Token-mean.
|
| 28 |
+
- Gradient clipping: 1.0.
|
| 29 |
+
- Entropy coefficient: 0.
|
| 30 |
+
|
| 31 |
+
## III. Evaluation Results
|
| 32 |
+
|
| 33 |
+
We evaluate on ten medical QA benchmarks include MedMCQA, MedQA, PubMedQA, medical related questions from MMLU-Pro and GPQA, small QA sets from Lancet and the New England
|
| 34 |
+
Journal of Medicine, 4 Options and 5 Options splits from the MedBullets platform and MedXpertQA.
|
| 35 |
+
|
| 36 |
+
| Model | MedMC | MedQA | PubMed | MMLU-P | GPQA | Lancet | MedB-4 | MedB-5 | MedX | NEJM | Avg |
|
| 37 |
+
|--------------------------|-------|-------|--------|--------|------|--------|--------|--------|------|-------|-------|
|
| 38 |
+
| QWQ 32B | 69.73 | 87.03 | 88.5 | 79.86 | 69.17| 71.3 | 72.07 | 69.01 |24.98 |75.12 | 70.68 |
|
| 39 |
+
| Qwen2.5-7B-IT | 56.56 | 61.51 | 71.3 | 61.17 | 42.56| 61.17 | 46.75 | 40.58 |13.26 |59.04 | 51.39 |
|
| 40 |
+
| HuatuoGPT-o1-8B | 63.97 | 74.78 | **80.10** | 63.71 | 55.38| 64.32 | 58.44 | 51.95 |15.79 |64.84 | 59.32 |
|
| 41 |
+
| Med-reason | 61.67 | 71.87 | 77.4 | 64.1 | 50.51| 59.7 | 60.06 | 54.22 |22.87 |66.8 | 59.92 |
|
| 42 |
+
| M1 | 62.54 | 75.81 | 75.80 | 65.86 | 53.08| 62.62 | 63.64 | 59.74 |19.59 |64.34 | 60.3 |
|
| 43 |
+
| II-Medical-7B-Preview-Wo-RL | 69.13 | 84.05 | 77.5 | 73.49 | 55.12| **67.71** | 69.48 | 64.28 |19.51 |**70.64** | 65.1 |
|
| 44 |
+
| II-Medical-7B-Preview-RL | **69.42** | **85.15** | 77.9 | **77.26** | **55.90**| **65.29** | **72.72** | **68.50** |**22.97** |68.66 | **66.4** |
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
## IV. Dataset Curation
|
| 49 |
+
|
| 50 |
+
The training dataset comprises 581,204 samples from the following sources:
|
| 51 |
+
|
| 52 |
+
### 1. Public Medical Reasoning Datasets (103,031 samples)
|
| 53 |
+
- General Medical Reasoning: 40,544 samples
|
| 54 |
+
- Medical-R1-Distill-Data: 22,000 samples
|
| 55 |
+
- Medical-R1-Distill-Data-Chinese: 17,000 samples
|
| 56 |
+
- UCSC-VLAA/m23k-tokenized: 23,487 samples
|
| 57 |
+
|
| 58 |
+
### 2. Synthetic Medical QA Data with QwQ Data (225,700 samples)
|
| 59 |
+
Generated from established medical datasets:
|
| 60 |
+
- MedMcQA (from openlifescienceai/medmcqa): 183,000 samples
|
| 61 |
+
- MedQA: 10,000 samples
|
| 62 |
+
- MedReason: 32,700 samples
|
| 63 |
+
|
| 64 |
+
### 3. Curated Medical R1 Traces (338,055 samples)
|
| 65 |
+
|
| 66 |
+
First we gather all the public R1 traces from:
|
| 67 |
+
|
| 68 |
+
- PrimeIntellect/SYNTHETIC-1
|
| 69 |
+
- GeneralReasoning/GeneralThought-430K
|
| 70 |
+
- a-m-team/AM-DeepSeek-R1-Distilled-1.4M
|
| 71 |
+
- open-thoughts/OpenThoughts2-1M
|
| 72 |
+
- nvidia/Llama-Nemotron-Post-Training-Dataset: Science subset only
|
| 73 |
+
- Other resources: cognitivecomputations/dolphin-r1, ServiceNow-AI/R1-Distill-SFT,...
|
| 74 |
+
|
| 75 |
+
All R1 reasoning traces were processed through a domain-specific pipeline as follows:
|
| 76 |
+
|
| 77 |
+
1. Embedding Generation: Prompts are embedded using sentence-transformers/all-MiniLM-L6-v2.
|
| 78 |
+
|
| 79 |
+
2. Clustering: Perform K-means clustering with 50,000 clusters.
|
| 80 |
+
|
| 81 |
+
3. Domain Classification:
|
| 82 |
+
|
| 83 |
+
- For each cluster, select the 10 prompts nearest to the cluster center.
|
| 84 |
+
- Classify the domain of each selected prompt using Qwen2.5-32b-Instruct.
|
| 85 |
+
- Assign the cluster's domain based on majority voting among the classified prompts.
|
| 86 |
+
|
| 87 |
+
4. Domain Filtering: Keep only clusters labeled as Medical or Biology for the final dataset.
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
### 4. Supplementary Math Dataset
|
| 91 |
+
- Added 15,000 samples of reasoning traces from light-r1
|
| 92 |
+
- Purpose: Enhance general reasoning capabilities of the model
|
| 93 |
+
|
| 94 |
+
### Preprocessing Data
|
| 95 |
+
1. Filtering for Complete Generation
|
| 96 |
+
- Retained only traces with complete generation outputs
|
| 97 |
+
- Removed incomplete or truncated samples
|
| 98 |
+
|
| 99 |
+
2. Length-based Filtering
|
| 100 |
+
- Minimum threshold: Keep only the prompt with more than three words.
|
| 101 |
+
- Maximum threshold: Keep only the traces with less than 7,143 words.
|
| 102 |
+
- Wait Token Filter: Removed traces with has more than 47 occurrences of "Wait" (97th percentile threshold).
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
### Data Decontamination
|
| 106 |
+
|
| 107 |
+
We using two step decontamination:
|
| 108 |
+
1. Following open-r1 project: We decontaminate a dataset using 10-grams with the evaluation datasets.
|
| 109 |
+
2. After that, we using the fuzzy decontamination from `s1k` method with threshold 90%.
|
| 110 |
+
|
| 111 |
+
**Our pipeline is carefully decontaminated with the evaluation datasets.**
|
| 112 |
+
|
| 113 |
+
Finally, we open sources our dataset at [Our Medical Reasoning SFT dataset](https://huggingface.co/datasets/Intelligent-Internet/II-Medical-Reasoning-SFT-V0).
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
## V. How To Use
|
| 117 |
+
Our model can be utilized in the same manner as Qwen or Deepseek-R1-Distill models.
|
| 118 |
+
|
| 119 |
+
For instance, you can easily start a service using [vLLM](https://github.com/vllm-project/vllm):
|
| 120 |
+
|
| 121 |
+
```bash
|
| 122 |
+
vllm serve Intelligent-Internet/II-Medical-7B-Preview
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
You can also easily start a service using [SGLang](https://github.com/sgl-project/sglang):
|
| 126 |
+
|
| 127 |
+
```bash
|
| 128 |
+
python -m sglang.launch_server --model Intelligent-Internet/II-Medical-7B-Preview
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
## VI. Usage Guidelines
|
| 132 |
+
|
| 133 |
+
- Recommended Sampling Parameters: temperature = 0.6, top_p = 0.9
|
| 134 |
+
- When using, explicitly request step-by-step reasoning and format the final answer within \boxed{} (e.g., "Please reason step-by-step, and put your final answer within \boxed{}.").
|
| 135 |
+
## VII. Limitations and Considerations
|
| 136 |
+
|
| 137 |
+
- Dataset may contain inherent biases from source materials
|
| 138 |
+
- Medical knowledge requires regular updates
|
| 139 |
+
- Classification accuracy depends on embedding model and clustering parameters
|
| 140 |
+
- Math reasoning traces may introduce domain-mixing effects
|
| 141 |
+
- Please note that **It’s not suitable for medical use.**
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
## VII. Citation
|
| 145 |
+
|
| 146 |
+
```bib
|
| 147 |
+
@misc{2025II-Medical-7B-Preview,
|
| 148 |
+
title={II-Medical-7B-Preview: Medical Reasoning Model},
|
| 149 |
+
author={Intelligent Internet},
|
| 150 |
+
year={2025}
|
| 151 |
+
}
|
| 152 |
+
```
|