Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# 🧠 AlphaMed
|
| 6 |
+
|
| 7 |
+
This is the official model checkpoint for the paper:
|
| 8 |
+
**[AlphaMed: Incentivizing Medical Reasoning with minimalist Rule-Based RL](https://www.arxiv.org/abs/2505.17952)**
|
| 9 |
+
AlphaMed is a medical large language model trained **without supervised fine-tuning on chain-of-thought (CoT) data**,
|
| 10 |
+
relying solely on reinforcement learning to elicit step-by-step reasoning in complex medical tasks.
|
| 11 |
+
|
| 12 |
+
## 🚀 Usage
|
| 13 |
+
|
| 14 |
+
To use the model, format your input prompt as:
|
| 15 |
+
|
| 16 |
+
> **Question:** [your medical question here]
|
| 17 |
+
> **Please reason step by step, and put the final answer in \boxed{}**
|
| 18 |
+
|
| 19 |
+
### 🔬 Example
|
| 20 |
+
|
| 21 |
+
```python
|
| 22 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
|
| 23 |
+
|
| 24 |
+
# Load model and tokenizer
|
| 25 |
+
model_id = "che111/AlphaMed-3B-instruct-rl" # Replace with actual repo path
|
| 26 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 27 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 28 |
+
|
| 29 |
+
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
| 30 |
+
|
| 31 |
+
# Format question
|
| 32 |
+
prompt = (
|
| 33 |
+
"Question: A 45-year-old patient presents with chest pain radiating to the left arm and elevated troponin levels. "
|
| 34 |
+
"What is the most likely diagnosis?\n"
|
| 35 |
+
"Please reason step by step, and put the final answer in \\boxed{}"
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
# Generate output
|
| 39 |
+
max_new_tokens=8196
|
| 40 |
+
output = pipe(prompt, max_new_tokens=max_new_tokens, do_sample=False)[0]["generated_text"]
|
| 41 |
+
print(output)
|