Text Generation
Transformers
Safetensors
English
llama
medical
clinical-reasoning
chain-of-thought
sft
research
conversational
text-generation-inference
Instructions to use BrainHealthAI/BrainMed-8B-SFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BrainHealthAI/BrainMed-8B-SFT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="BrainHealthAI/BrainMed-8B-SFT") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("BrainHealthAI/BrainMed-8B-SFT") model = AutoModelForCausalLM.from_pretrained("BrainHealthAI/BrainMed-8B-SFT", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use BrainHealthAI/BrainMed-8B-SFT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "BrainHealthAI/BrainMed-8B-SFT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BrainHealthAI/BrainMed-8B-SFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/BrainHealthAI/BrainMed-8B-SFT
- SGLang
How to use BrainHealthAI/BrainMed-8B-SFT with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "BrainHealthAI/BrainMed-8B-SFT" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BrainHealthAI/BrainMed-8B-SFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "BrainHealthAI/BrainMed-8B-SFT" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BrainHealthAI/BrainMed-8B-SFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use BrainHealthAI/BrainMed-8B-SFT with Docker Model Runner:
docker model run hf.co/BrainHealthAI/BrainMed-8B-SFT
Align model card with archived evidence and research limitations
#1
by mounimzad - opened
README.md
CHANGED
|
@@ -8,21 +8,29 @@ tags:
|
|
| 8 |
- clinical-reasoning
|
| 9 |
- chain-of-thought
|
| 10 |
- sft
|
|
|
|
| 11 |
language:
|
| 12 |
- en
|
| 13 |
---
|
| 14 |
|
| 15 |
# BrainMed-8B-SFT
|
| 16 |
|
| 17 |
-
Full-parameter supervised fine-tune of `FreedomIntelligence/HuatuoGPT-o1-8B`
|
| 18 |
-
|
| 19 |
-
|
|
|
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
- **Precision:** BF16
|
| 23 |
-
- **Recipe:**
|
| 24 |
-
|
| 25 |
-
- **
|
|
|
|
|
|
|
| 26 |
|
| 27 |
## Output format
|
| 28 |
|
|
@@ -33,28 +41,38 @@ The model is trained to reason inside `<think>...</think>` and answer inside
|
|
| 33 |
You are a medical reasoning assistant. Work through the clinical problem step by step inside <think>...</think>, grounding every step in established medical knowledge, then give the final, complete answer inside <answer>...</answer>.
|
| 34 |
```
|
| 35 |
|
| 36 |
-
## Evaluation
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
| medbullets_op4 | 308 | 58.77 |
|
| 41 |
-
| medbullets_op5 | 308 | 56.82 |
|
| 42 |
-
| medmcqa_val | 4183 | 61.2 |
|
| 43 |
-
| medqa_4opt | 1273 | 72.11 |
|
| 44 |
-
| medxpertqa | 1449 | 18.08 |
|
| 45 |
-
| pubmedqa_test | 1000 | 77.1 |
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
|
| 53 |
-
|
|
|
|
| 54 |
|
| 55 |
-
|
| 56 |
|
| 57 |
-
Rows overlapping the evaluation benchmarks were **kept**
|
|
|
|
| 58 |
|
| 59 |
| Benchmark | items | overlapping training rows |
|
| 60 |
|---|---|---|
|
|
@@ -66,18 +84,29 @@ Rows overlapping the evaluation benchmarks were **kept**, matching the upstream
|
|
| 66 |
| medxpertqa | 1449 | 15 (1.04%) |
|
| 67 |
| mmlu_pro_medical | 1535 | 340 (22.15%) |
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
|
|
|
| 72 |
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
## Intended use
|
| 75 |
|
| 76 |
-
Research
|
|
|
|
| 77 |
|
| 78 |
## Citation
|
| 79 |
|
| 80 |
```bibtex
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
@misc{wu2025medreason,
|
| 82 |
title={MedReason: Eliciting Factual Medical Reasoning Steps in LLMs via Knowledge Graphs},
|
| 83 |
author={Wu, Juncheng and others}, year={2025}, eprint={2504.00993}, archivePrefix={arXiv}
|
|
|
|
| 8 |
- clinical-reasoning
|
| 9 |
- chain-of-thought
|
| 10 |
- sft
|
| 11 |
+
- research
|
| 12 |
language:
|
| 13 |
- en
|
| 14 |
---
|
| 15 |
|
| 16 |
# BrainMed-8B-SFT
|
| 17 |
|
| 18 |
+
Full-parameter supervised fine-tune of `FreedomIntelligence/HuatuoGPT-o1-8B`, a model already
|
| 19 |
+
medically adapted by SFT and reinforcement learning, on
|
| 20 |
+
[`Williamsanderson/MedReason-MedO1-Reasoning-46K`](https://huggingface.co/datasets/Williamsanderson/MedReason-MedO1-Reasoning-46K),
|
| 21 |
+
a union of MedReason and medical-o1-reasoning-SFT traces.
|
| 22 |
|
| 23 |
+
> **Research artefact only.** Not a medical device, not clinically validated, not for decisions
|
| 24 |
+
> about any real person. This checkpoint scores **below its own base** on the historical
|
| 25 |
+
> six-task mean (see Evaluation).
|
| 26 |
+
|
| 27 |
+
- **Parameters:** 8,030,261,248 (8.03B), full weights, not an adapter
|
| 28 |
- **Precision:** BF16
|
| 29 |
+
- **Recipe (reported):** lr 5e-6, effective batch 128, 3 epochs, cosine schedule with 5% warmup,
|
| 30 |
+
weight decay 0.1, DeepSpeed ZeRO-3
|
| 31 |
+
- **Checkpoint:** end of epoch 3 (optimizer step 1041, validation loss 0.7557). This is **not**
|
| 32 |
+
the lowest-validation-loss checkpoint: epoch 2 had the lower validation loss (0.727) but a
|
| 33 |
+
lower benchmark mean (55.91%).
|
| 34 |
|
| 35 |
## Output format
|
| 36 |
|
|
|
|
| 41 |
You are a medical reasoning assistant. Work through the clinical problem step by step inside <think>...</think>, grounding every step in established medical knowledge, then give the final, complete answer inside <answer>...</answer>.
|
| 42 |
```
|
| 43 |
|
| 44 |
+
## Evaluation (historical, descriptive)
|
| 45 |
|
| 46 |
+
Same harness for base and fine-tune: greedy decoding, strict answer prompt, historical
|
| 47 |
+
`max(head, tail)` aggregate extraction with option-text and fuzzy fallbacks.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
+
| Benchmark | n (rows) | HuatuoGPT-o1-8B (measured) | BrainMed-8B-SFT | Difference (points) |
|
| 50 |
+
|---|---|---|---|---|
|
| 51 |
+
| MedBullets op4 | 308 | 59.09 | 58.77 | -0.32 |
|
| 52 |
+
| MedBullets op5 | 308 | 55.19 | 56.82 | +1.63 |
|
| 53 |
+
| MedMCQA (val) | 4183 | 63.30 | 61.20 | -2.10 |
|
| 54 |
+
| MedQA 4 options | 1273 | 77.93 | 72.11 | -5.82 |
|
| 55 |
+
| MedXpertQA | 1449 | 17.05 | 18.08 | +1.03 |
|
| 56 |
+
| PubMedQA | 1000 | 80.20 | 77.10 | -3.10 |
|
| 57 |
+
| **Macro6** | | **58.79** | **57.35** | **-1.45** |
|
| 58 |
|
| 59 |
+
Rows are not independent cases (MedBullets op4/op5 share questions). Checkpoints were compared
|
| 60 |
+
on these same tasks; no independent test set was held out. No confidence intervals are
|
| 61 |
+
available because per-question predictions are not published here. The measured base is
|
| 62 |
+
+2.89 points above its published values on average under this harness, so these numbers must
|
| 63 |
+
not be ranked against scores transcribed from other papers.
|
| 64 |
|
| 65 |
+
A plausible, untested explanation for the regression: medical-o1 is part of the base model's
|
| 66 |
+
own training pipeline, and this run applies further SFT after the base's RL stage. No
|
| 67 |
+
controlled ablation has established the cause.
|
| 68 |
|
| 69 |
+
Full results, every archived run and limitations:
|
| 70 |
+
[BrainHealthAI/BrainMed-8B — results/REPORT.md](https://github.com/BrainHealthAI/BrainMed-8B/blob/main/results/REPORT.md).
|
| 71 |
|
| 72 |
+
## Data integrity
|
| 73 |
|
| 74 |
+
Training rows: **44,351**. Rows overlapping the evaluation benchmarks were **kept** (upstream
|
| 75 |
+
setting). The overlap was measured and is declared below.
|
| 76 |
|
| 77 |
| Benchmark | items | overlapping training rows |
|
| 78 |
|---|---|---|
|
|
|
|
| 84 |
| medxpertqa | 1449 | 15 (1.04%) |
|
| 85 |
| mmlu_pro_medical | 1535 | 340 (22.15%) |
|
| 86 |
|
| 87 |
+
The "clean" score in the evaluation files excludes flagged items. It does **not** undo training
|
| 88 |
+
exposure, unknown base-model exposure or selection on these tasks, and is not an unbiased
|
| 89 |
+
estimate. This overlap originates upstream: the MedReason corpus derives reasoning traces from
|
| 90 |
+
MMLU-medical, MedXpertQA and Humanity's Last Exam.
|
| 91 |
|
| 92 |
+
Answer-format alignment was applied to 17,083 rows (38.52%): a canonical `The answer is X.` was
|
| 93 |
+
appended where the letter was unambiguously recoverable from options already present in the
|
| 94 |
+
question. This is a formatting transformation, not physician validation of the traces.
|
| 95 |
|
| 96 |
## Intended use
|
| 97 |
|
| 98 |
+
Research on medical-model adaptation and evaluation methodology only. Not for clinical use,
|
| 99 |
+
decision support in care, or any decision about a real person.
|
| 100 |
|
| 101 |
## Citation
|
| 102 |
|
| 103 |
```bibtex
|
| 104 |
+
@software{brainmed8b2026,
|
| 105 |
+
title = {BrainMed-8B: medical reasoning adaptation and evaluation pipeline},
|
| 106 |
+
author = {BrainResearch},
|
| 107 |
+
year = {2026},
|
| 108 |
+
url = {https://github.com/BrainHealthAI/BrainMed-8B}
|
| 109 |
+
}
|
| 110 |
@misc{wu2025medreason,
|
| 111 |
title={MedReason: Eliciting Factual Medical Reasoning Steps in LLMs via Knowledge Graphs},
|
| 112 |
author={Wu, Juncheng and others}, year={2025}, eprint={2504.00993}, archivePrefix={arXiv}
|