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
# 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]:]))BrainMed-8B-SFT
Full-parameter supervised fine-tune of FreedomIntelligence/HuatuoGPT-o1-8B, a model already
medically adapted by SFT and reinforcement learning, on
Williamsanderson/MedReason-MedO1-Reasoning-46K,
a union of MedReason and medical-o1-reasoning-SFT traces.
Research artefact only. Not a medical device, not clinically validated, not for decisions about any real person. This checkpoint scores below its own base on the historical six-task mean (see Evaluation).
- Parameters: 8,030,261,248 (8.03B), full weights, not an adapter
- Precision: BF16
- Recipe (reported): lr 5e-6, effective batch 128, 3 epochs, cosine schedule with 5% warmup, weight decay 0.1, DeepSpeed ZeRO-3
- Checkpoint: end of epoch 3 (optimizer step 1041, validation loss 0.7557). This is not the lowest-validation-loss checkpoint: epoch 2 had the lower validation loss (0.727) but a lower benchmark mean (55.91%).
Output format
The model is trained to reason inside <think>...</think> and answer inside
<answer>...</answer>, under this system prompt:
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>.
Evaluation (historical, descriptive)
Same harness for base and fine-tune: greedy decoding, strict answer prompt, historical
max(head, tail) aggregate extraction with option-text and fuzzy fallbacks.
| Benchmark | n (rows) | HuatuoGPT-o1-8B (measured) | BrainMed-8B-SFT | Difference (points) |
|---|---|---|---|---|
| MedBullets op4 | 308 | 59.09 | 58.77 | -0.32 |
| MedBullets op5 | 308 | 55.19 | 56.82 | +1.63 |
| MedMCQA (val) | 4183 | 63.30 | 61.20 | -2.10 |
| MedQA 4 options | 1273 | 77.93 | 72.11 | -5.82 |
| MedXpertQA | 1449 | 17.05 | 18.08 | +1.03 |
| PubMedQA | 1000 | 80.20 | 77.10 | -3.10 |
| Macro6 | 58.79 | 57.35 | -1.45 |
Rows are not independent cases (MedBullets op4/op5 share questions). Checkpoints were compared on these same tasks; no independent test set was held out. No confidence intervals are available because per-question predictions are not published here. The measured base is +2.89 points above its published values on average under this harness, so these numbers must not be ranked against scores transcribed from other papers.
A plausible, untested explanation for the regression: medical-o1 is part of the base model's own training pipeline, and this run applies further SFT after the base's RL stage. No controlled ablation has established the cause.
Full results, every archived run and limitations: BrainHealthAI/BrainMed-8B — results/REPORT.md.
Data integrity
Training rows: 44,351. Rows overlapping the evaluation benchmarks were kept (upstream setting). The overlap was measured and is declared below.
| Benchmark | items | overlapping training rows |
|---|---|---|
| hle_med | 103 | 30 (29.13%) |
| medbullets_op4 | 308 | 35 (11.36%) |
| medbullets_op5 | 308 | 35 (11.36%) |
| medqa_4opt | 1273 | 1 (0.08%) |
| medqa_5opt | 1273 | 1 (0.08%) |
| medxpertqa | 1449 | 15 (1.04%) |
| mmlu_pro_medical | 1535 | 340 (22.15%) |
The "clean" score in the evaluation files excludes flagged items. It does not undo training exposure, unknown base-model exposure or selection on these tasks, and is not an unbiased estimate. This overlap originates upstream: the MedReason corpus derives reasoning traces from MMLU-medical, MedXpertQA and Humanity's Last Exam.
Answer-format alignment was applied to 17,083 rows (38.52%): a canonical The answer is X. was
appended where the letter was unambiguously recoverable from options already present in the
question. This is a formatting transformation, not physician validation of the traces.
Intended use
Research on medical-model adaptation and evaluation methodology only. Not for clinical use, decision support in care, or any decision about a real person.
Citation
@software{brainmed8b2026,
title = {BrainMed-8B: medical reasoning adaptation and evaluation pipeline},
author = {BrainResearch},
year = {2026},
url = {https://github.com/BrainHealthAI/BrainMed-8B}
}
@misc{wu2025medreason,
title={MedReason: Eliciting Factual Medical Reasoning Steps in LLMs via Knowledge Graphs},
author={Wu, Juncheng and others}, year={2025}, eprint={2504.00993}, archivePrefix={arXiv}
}
- Downloads last month
- 12
Model tree for BrainHealthAI/BrainMed-8B-SFT
Base model
meta-llama/Llama-3.1-8B
# 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)