Text Generation
Transformers
Safetensors
English
apertus
medical
clinical
healthcare
meditron
fully-open
medical-llm
conversational
Instructions to use EPFLiGHT/Apertus-8B-MeditronFO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use EPFLiGHT/Apertus-8B-MeditronFO with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="EPFLiGHT/Apertus-8B-MeditronFO") 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("EPFLiGHT/Apertus-8B-MeditronFO") model = AutoModelForCausalLM.from_pretrained("EPFLiGHT/Apertus-8B-MeditronFO", 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 EPFLiGHT/Apertus-8B-MeditronFO with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "EPFLiGHT/Apertus-8B-MeditronFO" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EPFLiGHT/Apertus-8B-MeditronFO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/EPFLiGHT/Apertus-8B-MeditronFO
- SGLang
How to use EPFLiGHT/Apertus-8B-MeditronFO 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 "EPFLiGHT/Apertus-8B-MeditronFO" \ --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": "EPFLiGHT/Apertus-8B-MeditronFO", "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 "EPFLiGHT/Apertus-8B-MeditronFO" \ --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": "EPFLiGHT/Apertus-8B-MeditronFO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use EPFLiGHT/Apertus-8B-MeditronFO with Docker Model Runner:
docker model run hf.co/EPFLiGHT/Apertus-8B-MeditronFO
Model card: ICLR results, training recipe and figure
Browse files- .gitattributes +1 -0
- README.md +18 -18
- assets/healthbench_size.png +3 -0
.gitattributes
CHANGED
|
@@ -34,3 +34,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
assets/healthbench_size.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -40,30 +40,30 @@ datasets:
|
|
| 40 |
</p>
|
| 41 |
|
| 42 |
> [!Note]
|
| 43 |
-
> We're introducing Apertus-8B-MeditronFO, our small fully open medical specialist LLM, medical specialization of [Apertus-8B-Instruct](https://huggingface.co/swiss-ai/Apertus-
|
| 44 |
|
| 45 |
|
| 46 |
- **Part of the Fully Open Meditron family:** End to end fully open clinical LLMs
|
| 47 |
-
- **
|
| 48 |
-
- **
|
| 49 |
-
- **
|
| 50 |
|
| 51 |
<div align="center">
|
| 52 |
-
<img src=https://
|
| 53 |
</div>
|
| 54 |
|
| 55 |
## Benchmark
|
| 56 |
|
| 57 |
-
Accuracy (%) on
|
| 58 |
|
| 59 |
| Benchmark | Apertus-8B-Instruct | **Apertus-8B-MeditronFO** | Δ |
|
| 60 |
|---|---:|---:|---:|
|
| 61 |
-
| MedMCQA |
|
| 62 |
-
| MedQA |
|
| 63 |
-
| PubMedQA |
|
| 64 |
-
| MedXpertQA | 11.
|
| 65 |
-
| HealthBench
|
| 66 |
-
| **Average** |
|
| 67 |
|
| 68 |
## Usage
|
| 69 |
|
|
@@ -97,15 +97,15 @@ print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_
|
|
| 97 |
## Training
|
| 98 |
|
| 99 |
- **Base model:** [Apertus-8B-Instruct](https://huggingface.co/swiss-ai/Apertus-8B-Instruct-2509)
|
| 100 |
-
- **Corpus:** [Fully Open Meditron](https://huggingface.co/datasets/EPFLiGHT/fully-open-meditron)
|
| 101 |
-
- **
|
| 102 |
-
- **
|
| 103 |
-
- **
|
| 104 |
|
| 105 |
-
Full hyperparameters are in
|
| 106 |
|
| 107 |
## Compute & footprint
|
| 108 |
-
The training was done on
|
| 109 |
Our trainings have a carbon neutral footprint as the CSCS data center is carbon neutral ([CSCS energy efficiency](https://ethz.ch/en/news-and-events/eth-news/news/2022/11/at-cscs-energy-efficiency-is-a-key-priority-even-at-high-performance.html)).
|
| 110 |
|
| 111 |
## Limitations & intended use
|
|
|
|
| 40 |
</p>
|
| 41 |
|
| 42 |
> [!Note]
|
| 43 |
+
> We're introducing Apertus-8B-MeditronFO, our small fully open medical specialist LLM, medical specialization of [Apertus-8B-Instruct](https://huggingface.co/swiss-ai/Apertus-8B-Instruct-2509) on the [Fully Open Meditron Corpus](https://huggingface.co/datasets/EPFLiGHT/fully-open-meditron). This model is part of the **Fully Open Meditron** family — the first end-to-end auditable pipeline for clinical LLMs, with open weights, open data, open training recipe, and clinician-vetted corpus construction.
|
| 44 |
|
| 45 |
|
| 46 |
- **Part of the Fully Open Meditron family:** End to end fully open clinical LLMs
|
| 47 |
+
- **Best medical accuracy among small fully open medical LLMs:** 48.26% on the five-benchmark average, against 42.39% for Apertus-8B-Instruct
|
| 48 |
+
- **Preferred over Apertus-8B-Instruct in 74.2% of comparisons** on AutoMOOVE, the clinician-validated LLM-judge evaluation (three-judge majority, 516 clinician-written vignettes)
|
| 49 |
+
- **Largest HealthBench gain in the MeditronFO family:** +16.1 points over its base (26.0 → 42.1)
|
| 50 |
|
| 51 |
<div align="center">
|
| 52 |
+
<img src=https://huggingface.co/EPFLiGHT/Apertus-8B-MeditronFO/resolve/main/assets/healthbench_size.png width="100%"/>
|
| 53 |
</div>
|
| 54 |
|
| 55 |
## Benchmark
|
| 56 |
|
| 57 |
+
Accuracy (%) on four multiple-choice medical benchmarks (greedy decoding) and score (%) on HealthBench (all 5,000 conversations, Gemma-4-31B grader). See the paper for the full evaluation details, confidence intervals and the AutoMOOVE results.
|
| 58 |
|
| 59 |
| Benchmark | Apertus-8B-Instruct | **Apertus-8B-MeditronFO** | Δ |
|
| 60 |
|---|---:|---:|---:|
|
| 61 |
+
| MedMCQA | 47.8 | **52.0** | +4.2 |
|
| 62 |
+
| MedQA | 52.1 | **60.7** | +8.6 |
|
| 63 |
+
| PubMedQA | 74.3 | **71.4** | −2.9 |
|
| 64 |
+
| MedXpertQA | 11.8 | **15.1** | +3.3 |
|
| 65 |
+
| HealthBench | 26.0 | **42.1** | +16.1 |
|
| 66 |
+
| **Average (5)** | 42.39 | **48.26** | +5.87 |
|
| 67 |
|
| 68 |
## Usage
|
| 69 |
|
|
|
|
| 97 |
## Training
|
| 98 |
|
| 99 |
- **Base model:** [Apertus-8B-Instruct](https://huggingface.co/swiss-ai/Apertus-8B-Instruct-2509)
|
| 100 |
+
- **Corpus:** [Fully Open Meditron](https://huggingface.co/datasets/EPFLiGHT/fully-open-meditron), 533,888 examples: Curated QA (195.5k, seven public medical QA datasets), Synthetic Curated QA (184.5k), Guidelines QA (129.8k, generated from 14,192 clinical practice guidelines) and Synthetic vignettes (24.0k, modelled on clinician-written MOOVE vignettes). Every answer is written by gpt-oss-120b with rejection sampling (pass@8; multiple-choice answers must match the gold label), with generation prompts co-authored by four clinicians
|
| 101 |
+
- **Decontamination:** two-stage n-gram decontamination against all evaluation benchmarks and the AutoMOOVE test set (4,197 rows removed)
|
| 102 |
+
- **Recipe:** 1 epoch, learning rate 1e-5 with cosine decay and 10% warmup, effective batch 64 sequences of 8,192 packed tokens, AdamW, seed 42
|
| 103 |
+
- **Framework:** Axolotl with DeepSpeed ZeRO-3, bf16
|
| 104 |
|
| 105 |
+
Full hyperparameters are in the training appendix of the paper.
|
| 106 |
|
| 107 |
## Compute & footprint
|
| 108 |
+
The training was done on 2 nodes of 4 NVIDIA GH200 GPUs for 51 min (7 GPU-hours) on the Alps supercomputer of the CSCS Swiss National Supercomputing Centre.
|
| 109 |
Our trainings have a carbon neutral footprint as the CSCS data center is carbon neutral ([CSCS energy efficiency](https://ethz.ch/en/news-and-events/eth-news/news/2022/11/at-cscs-energy-efficiency-is-a-key-priority-even-at-high-performance.html)).
|
| 110 |
|
| 111 |
## Limitations & intended use
|
assets/healthbench_size.png
ADDED
|
Git LFS Details
|