Update README.md
Browse files
README.md
CHANGED
|
@@ -3,197 +3,155 @@ library_name: transformers
|
|
| 3 |
tags: []
|
| 4 |
---
|
| 5 |
|
| 6 |
-
#
|
| 7 |
|
| 8 |
-
|
| 9 |
|
|
|
|
|
|
|
| 10 |
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
-
- **Model type:** [More Information Needed]
|
| 24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
-
- **License:** [More Information Needed]
|
| 26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
|
| 28 |
-
|
|
|
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
- **Repository:** [More Information Needed]
|
| 33 |
-
- **Paper [optional]:** [More Information Needed]
|
| 34 |
-
- **Demo [optional]:** [More Information Needed]
|
| 35 |
|
| 36 |
-
## Uses
|
| 37 |
|
| 38 |
-
|
| 39 |
|
| 40 |
-
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
###
|
| 47 |
|
| 48 |
-
|
| 49 |
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
|
| 53 |
|
| 54 |
-
|
| 55 |
|
| 56 |
-
|
| 57 |
|
| 58 |
-
|
| 59 |
|
| 60 |
-
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
| 63 |
|
| 64 |
-
### Recommendations
|
| 65 |
|
| 66 |
-
|
|
|
|
|
|
|
| 67 |
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
-
Use the code below to get started with the model.
|
| 73 |
|
| 74 |
-
|
| 75 |
|
| 76 |
-
|
|
|
|
|
|
|
| 77 |
|
| 78 |
-
|
| 79 |
|
| 80 |
-
|
| 81 |
|
| 82 |
-
[More Information Needed]
|
| 83 |
|
| 84 |
-
|
|
|
|
| 85 |
|
| 86 |
-
|
| 87 |
|
| 88 |
-
|
|
|
|
|
|
|
| 89 |
|
| 90 |
-
|
| 91 |
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
-
|
| 94 |
|
| 95 |
-
-
|
|
|
|
|
|
|
| 96 |
|
| 97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 100 |
|
| 101 |
-
|
| 102 |
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 112 |
-
|
| 113 |
-
[More Information Needed]
|
| 114 |
-
|
| 115 |
-
#### Factors
|
| 116 |
-
|
| 117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
-
|
| 119 |
-
[More Information Needed]
|
| 120 |
-
|
| 121 |
-
#### Metrics
|
| 122 |
-
|
| 123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
-
|
| 125 |
-
[More Information Needed]
|
| 126 |
-
|
| 127 |
-
### Results
|
| 128 |
-
|
| 129 |
-
[More Information Needed]
|
| 130 |
-
|
| 131 |
-
#### Summary
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
## Model Examination [optional]
|
| 136 |
-
|
| 137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
-
|
| 139 |
-
[More Information Needed]
|
| 140 |
-
|
| 141 |
-
## Environmental Impact
|
| 142 |
-
|
| 143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
-
|
| 145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
-
|
| 147 |
-
- **Hardware Type:** [More Information Needed]
|
| 148 |
-
- **Hours used:** [More Information Needed]
|
| 149 |
-
- **Cloud Provider:** [More Information Needed]
|
| 150 |
-
- **Compute Region:** [More Information Needed]
|
| 151 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
-
|
| 153 |
-
## Technical Specifications [optional]
|
| 154 |
-
|
| 155 |
-
### Model Architecture and Objective
|
| 156 |
-
|
| 157 |
-
[More Information Needed]
|
| 158 |
-
|
| 159 |
-
### Compute Infrastructure
|
| 160 |
-
|
| 161 |
-
[More Information Needed]
|
| 162 |
-
|
| 163 |
-
#### Hardware
|
| 164 |
-
|
| 165 |
-
[More Information Needed]
|
| 166 |
-
|
| 167 |
-
#### Software
|
| 168 |
-
|
| 169 |
-
[More Information Needed]
|
| 170 |
-
|
| 171 |
-
## Citation [optional]
|
| 172 |
-
|
| 173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
-
|
| 175 |
-
**BibTeX:**
|
| 176 |
-
|
| 177 |
-
[More Information Needed]
|
| 178 |
-
|
| 179 |
-
**APA:**
|
| 180 |
-
|
| 181 |
-
[More Information Needed]
|
| 182 |
-
|
| 183 |
-
## Glossary [optional]
|
| 184 |
-
|
| 185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
-
|
| 187 |
-
[More Information Needed]
|
| 188 |
-
|
| 189 |
-
## More Information [optional]
|
| 190 |
-
|
| 191 |
-
[More Information Needed]
|
| 192 |
-
|
| 193 |
-
## Model Card Authors [optional]
|
| 194 |
-
|
| 195 |
-
[More Information Needed]
|
| 196 |
-
|
| 197 |
-
## Model Card Contact
|
| 198 |
-
|
| 199 |
-
[More Information Needed]
|
|
|
|
| 3 |
tags: []
|
| 4 |
---
|
| 5 |
|
| 6 |
+
# II-Medical-7B-Preview
|
| 7 |
|
| 8 |
+
## I. Model Overview
|
| 9 |
|
| 10 |
+
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.
|
| 11 |
+
## II. Training Methodology
|
| 12 |
|
| 13 |
+
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.
|
| 14 |
|
| 15 |
+
For SFT stage we using the hyperparameters:
|
| 16 |
|
| 17 |
+
- Max Length: 16378.
|
| 18 |
+
- Batch Size: 128.
|
| 19 |
+
- Learning-Rate: 5e-5.
|
| 20 |
+
- Number Of Epoch: 4.
|
| 21 |
|
| 22 |
+
For RL stage we setup training with:
|
| 23 |
|
| 24 |
+
- Max prompt length: 2048 tokens.
|
| 25 |
+
- Max response length: 12288 tokens.
|
| 26 |
+
- Overlong buffer: Enabled, 4096 tokens, penalty factor 1.0.
|
| 27 |
+
- Clip ratios: Low 0.2, High 0.28.
|
| 28 |
+
- Batch sizes: Train prompt 512, Generation prompt 1536, Mini-batch 32.
|
| 29 |
+
- Responses per prompt: 16.
|
| 30 |
+
- Temperature: 1.0, Top-p: 1.0, Top-k: -1 (vLLM rollout).
|
| 31 |
+
- Learning rate: 1e-6, Warmup steps: 10, Weight decay: 0.1.
|
| 32 |
+
- Loss aggregation: Token-mean.
|
| 33 |
+
- Gradient clipping: 1.0.
|
| 34 |
+
- Entropy coefficient: 0.
|
| 35 |
|
| 36 |
+
## III. Evaluation Results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
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
|
| 39 |
+
Journal of Medicine, 4 Options and 5 Options splits from the MedBullets platform and MedXpertQA.
|
| 40 |
|
| 41 |
+
| Model | MedMC | MedQA | PubMed | MMLU-P | GPQA | Lancet | MedB-4 | MedB-5 | MedX | NEJM | Avg |
|
| 42 |
+
|--------------------------|-------|-------|--------|--------|------|--------|--------|--------|------|-------|-------|
|
| 43 |
+
| QWQ 32B | 69.73 | 87.03 | 88.5 | 79.86 | 69.17| 71.3 | 72.07 | 69.01 |24.98 |75.12 | 70.68 |
|
| 44 |
+
| 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 |
|
| 45 |
+
| 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 |
|
| 46 |
+
| Med-reason | 61.67 | 71.87 | 77.4 | 64.1 | 50.51| 59.7 | 60.06 | 54.22 |22.87 |66.8 | 59.92 |
|
| 47 |
+
| M1 | 62.54 | 75.81 | 75.80 | 65.86 | 53.08| 62.62 | 63.64 | 59.74 |19.59 |64.34 | 60.3 |
|
| 48 |
+
| 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 |
|
| 49 |
+
| 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** |
|
| 50 |
|
|
|
|
|
|
|
|
|
|
| 51 |
|
|
|
|
| 52 |
|
| 53 |
+
## IV. Dataset Curation
|
| 54 |
|
| 55 |
+
The training dataset comprises 581,204 samples from the following sources:
|
| 56 |
|
| 57 |
+
### 1. Public Medical Reasoning Datasets (103,031 samples)
|
| 58 |
+
- General Medical Reasoning: 40,544 samples
|
| 59 |
+
- Medical-R1-Distill-Data: 22,000 samples
|
| 60 |
+
- Medical-R1-Distill-Data-Chinese: 17,000 samples
|
| 61 |
+
- UCSC-VLAA/m23k-tokenized: 23,487 samples
|
| 62 |
|
| 63 |
+
### 2. Synthetic Medical QA Data with QwQ Data (225,700 samples)
|
| 64 |
+
Generated from established medical datasets:
|
| 65 |
+
- MedMcQA (from openlifescienceai/medmcqa): 183,000 samples
|
| 66 |
+
- MedQA: 10,000 samples
|
| 67 |
+
- MedReason: 32,700 samples
|
| 68 |
|
| 69 |
+
### 3. Curated Medical R1 Traces (338,055 samples)
|
| 70 |
|
| 71 |
+
First we gather all the public R1 traces from:
|
| 72 |
|
| 73 |
+
- PrimeIntellect/SYNTHETIC-1
|
| 74 |
+
- GeneralReasoning/GeneralThought-430K
|
| 75 |
+
- a-m-team/AM-DeepSeek-R1-Distilled-1.4M
|
| 76 |
+
- open-thoughts/OpenThoughts2-1M
|
| 77 |
+
- nvidia/Llama-Nemotron-Post-Training-Dataset: Science subset only
|
| 78 |
+
- Other resources: cognitivecomputations/dolphin-r1, ServiceNow-AI/R1-Distill-SFT,...
|
| 79 |
|
| 80 |
+
All R1 reasoning traces were processed through a domain-specific pipeline as follows:
|
| 81 |
|
| 82 |
+
1. Embedding Generation: Prompts are embedded using sentence-transformers/all-MiniLM-L6-v2.
|
| 83 |
|
| 84 |
+
2. Clustering: Perform K-means clustering with 50,000 clusters.
|
| 85 |
|
| 86 |
+
3. Domain Classification:
|
| 87 |
|
| 88 |
+
- For each cluster, select the 10 prompts nearest to the cluster center.
|
| 89 |
+
- Classify the domain of each selected prompt using Qwen2.5-32b-Instruct.
|
| 90 |
+
- Assign the cluster's domain based on majority voting among the classified prompts.
|
| 91 |
|
| 92 |
+
4. Domain Filtering: Keep only clusters labeled as Medical or Biology for the final dataset.
|
| 93 |
|
|
|
|
| 94 |
|
| 95 |
+
### 4. Supplementary Math Dataset
|
| 96 |
+
- Added 15,000 samples of reasoning traces from light-r1
|
| 97 |
+
- Purpose: Enhance general reasoning capabilities of the model
|
| 98 |
|
| 99 |
+
### Preprocessing Data
|
| 100 |
+
1. Filtering for Complete Generation
|
| 101 |
+
- Retained only traces with complete generation outputs
|
| 102 |
+
- Removed incomplete or truncated samples
|
| 103 |
|
| 104 |
+
2. Length-based Filtering
|
| 105 |
+
- Minimum threshold: Keep only the prompt with more than three words.
|
| 106 |
+
- Maximum threshold: Keep only the traces with less than 7,143 words.
|
| 107 |
+
- Wait Token Filter: Removed traces with has more than 47 occurrences of "Wait" (97th percentile threshold).
|
| 108 |
|
|
|
|
| 109 |
|
| 110 |
+
### Data Decontamination
|
| 111 |
|
| 112 |
+
We using two step decontamination:
|
| 113 |
+
1. Following open-r1 project: We decontaminate a dataset using 10-grams with the evaluation datasets.
|
| 114 |
+
2. After that, we using the fuzzy decontamination from `s1k` method with threshold 90%.
|
| 115 |
|
| 116 |
+
**Our pipeline is carefully decontaminated with the evaluation datasets.**
|
| 117 |
|
| 118 |
+
Finally, we open sources our dataset at [Our Medical Reasoning SFT dataset](https://huggingface.co/datasets/Intelligent-Internet/II-Medical-Reasoning-SFT-V0).
|
| 119 |
|
|
|
|
| 120 |
|
| 121 |
+
## V. How To Use
|
| 122 |
+
Our model can be utilized in the same manner as Qwen or Deepseek-R1-Distill models.
|
| 123 |
|
| 124 |
+
For instance, you can easily start a service using [vLLM](https://github.com/vllm-project/vllm):
|
| 125 |
|
| 126 |
+
```bash
|
| 127 |
+
vllm serve Intelligent-Internet/II-Medical-7B-Preview
|
| 128 |
+
```
|
| 129 |
|
| 130 |
+
You can also easily start a service using [SGLang](https://github.com/sgl-project/sglang):
|
| 131 |
|
| 132 |
+
```bash
|
| 133 |
+
python -m sglang.launch_server --model Intelligent-Internet/II-Medical-7B-Preview
|
| 134 |
+
```
|
| 135 |
|
| 136 |
+
## VI. Usage Guidelines
|
| 137 |
|
| 138 |
+
- Recommended Sampling Parameters: temperature = 0.6, top_p = 0.9
|
| 139 |
+
- 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{}.").
|
| 140 |
+
## VII. Limitations and Considerations
|
| 141 |
|
| 142 |
+
- Dataset may contain inherent biases from source materials
|
| 143 |
+
- Medical knowledge requires regular updates
|
| 144 |
+
- Classification accuracy depends on embedding model and clustering parameters
|
| 145 |
+
- Math reasoning traces may introduce domain-mixing effects
|
| 146 |
+
- Please note that **It’s not suitable for medical use.**
|
| 147 |
|
|
|
|
| 148 |
|
| 149 |
+
## VII. Citation
|
| 150 |
|
| 151 |
+
```bib
|
| 152 |
+
@misc{2025II-Medical-7B-Preview,
|
| 153 |
+
title={II-Medical-7B-Preview: Medical Reasoning Model},
|
| 154 |
+
author={Intelligent Internet},
|
| 155 |
+
year={2025}
|
| 156 |
+
}
|
| 157 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|