Instructions to use openmed-community/AFM-4.5B-OpenMed-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openmed-community/AFM-4.5B-OpenMed-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="openmed-community/AFM-4.5B-OpenMed-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("openmed-community/AFM-4.5B-OpenMed-GGUF", dtype="auto") - llama-cpp-python
How to use openmed-community/AFM-4.5B-OpenMed-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="openmed-community/AFM-4.5B-OpenMed-GGUF", filename="AFM-4.5B-OpenMed-q2_k.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use openmed-community/AFM-4.5B-OpenMed-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf openmed-community/AFM-4.5B-OpenMed-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf openmed-community/AFM-4.5B-OpenMed-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf openmed-community/AFM-4.5B-OpenMed-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf openmed-community/AFM-4.5B-OpenMed-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf openmed-community/AFM-4.5B-OpenMed-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf openmed-community/AFM-4.5B-OpenMed-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf openmed-community/AFM-4.5B-OpenMed-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf openmed-community/AFM-4.5B-OpenMed-GGUF:Q4_K_M
Use Docker
docker model run hf.co/openmed-community/AFM-4.5B-OpenMed-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use openmed-community/AFM-4.5B-OpenMed-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openmed-community/AFM-4.5B-OpenMed-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openmed-community/AFM-4.5B-OpenMed-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/openmed-community/AFM-4.5B-OpenMed-GGUF:Q4_K_M
- SGLang
How to use openmed-community/AFM-4.5B-OpenMed-GGUF 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 "openmed-community/AFM-4.5B-OpenMed-GGUF" \ --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": "openmed-community/AFM-4.5B-OpenMed-GGUF", "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 "openmed-community/AFM-4.5B-OpenMed-GGUF" \ --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": "openmed-community/AFM-4.5B-OpenMed-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use openmed-community/AFM-4.5B-OpenMed-GGUF with Ollama:
ollama run hf.co/openmed-community/AFM-4.5B-OpenMed-GGUF:Q4_K_M
- Unsloth Studio
How to use openmed-community/AFM-4.5B-OpenMed-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for openmed-community/AFM-4.5B-OpenMed-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for openmed-community/AFM-4.5B-OpenMed-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for openmed-community/AFM-4.5B-OpenMed-GGUF to start chatting
- Docker Model Runner
How to use openmed-community/AFM-4.5B-OpenMed-GGUF with Docker Model Runner:
docker model run hf.co/openmed-community/AFM-4.5B-OpenMed-GGUF:Q4_K_M
- Lemonade
How to use openmed-community/AFM-4.5B-OpenMed-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull openmed-community/AFM-4.5B-OpenMed-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.AFM-4.5B-OpenMed-GGUF-Q4_K_M
List all available models
lemonade list
AFM-4.5B-OpenMed-GGUF
Lightweight medical finetune on top of Arceeโs AFM-4.5B for education and research use. Trained with a simple 3-stage recipe (SFT โ DPO โ GRPO-CoT) and finalized via Arcee Fusion weight merging (MergeKit).
More information about our methodology will be available in a forthcoming blog post.
All experiments were performed on AMD MI300x GPUs, with computing credits generously provided by Hot AISLE.
โ ๏ธ Medical safety
This model is not a clinician. It can hallucinate and should not be used for diagnosis or treatment. Always involve qualified medical professionals.
TL;DR
- Base:
arcee-ai/AFM-4.5Bโ Arceeโs 4.5B instruction model intended for cloud-to-edge deployment. - Training (high level):
- SFT proprietary synthetic medical datasets + tool-calling (search) traces
- DPO using MedMCQA-derived preferences (multiple-choice signal)
- GRPO for chain-of-thought enrichment, using MedReason verifiable rewards; short rationales encouraged, final answer checked.
- Model merge: Arcee Fusion (MergeKit) for selective, importance-aware parameter fusion.
- Eval (EleutherAI harness; authorโs settings, bs=64)
- MMLU: 61.10 (vs 55.53 base)
- MMLU-Pro: 33.44 (vs 32.61 base) โ harder 10-choice variant.
- IFEVAL: 63.55 (vs 63.67 base) โ verifiable instruction following.
Note: Arceeโs internal evals may use different harnesses; avoid cross-harness comparisons.
Whatโs inside
Specialization steps
Domain SFT (medical + tools)
Instruction-style synthetic medical Q&A + conversions; supervised search/tool-use traces to teach function-calling patterns compatible with chat templates.Preference alignment โ DPO
Uses MedMCQA correctness as a proxy preference signal to bias toward concise, clinically reasonable options.Reasoning enrichment โ GRPO (CoT)
Group Relative Policy Optimization without a critic; groups of sampled solutions are scored by verifiable rewards (answer correctness + light format checks). Trained with MedReason QA signal.Finalization โ Arcee Fusion (MergeKit)
Selective weight fusion to preserve gains while limiting over-averaging; configured viamerge_method: arcee_fusion.
Intended use & limitations
Intended: Medical SLM's research, tool-augmented retrieval demos.
Out of scope: Unsupervised patient care, generating prescriptions, and time-critical guideline decisions.
Evaluation
Author-run with the EleutherAI
lm-evaluation-harness; seeds, prompts, and templates affect absolute scores.
| Benchmark | AFM-4.5B-OpenMed | AFM-4.5B (same harness) |
|---|---|---|
| MMLU | 61.10 | 55.53 |
| MMLU-Pro | 33.44 | 32.61 |
| IFEVAL | 63.55 | 63.67 |
- MMLU-Pro increases difficulty (10 options; more reasoning-heavy); small deltas are still meaningful.
- IFEVAL checks verifiable constraints (length, keyword counts, format, etc.).
| mmlu | AFM-4.5B-OpenMed | AFM-4.5B |
|---|---|---|
| other | ||
| clinical_knowledge | 67.55 | 65.66 |
| college_medicine | 64.74 | 54.34 |
| professional_medicine | 63.97 | 59.56 |
| virology | 49.4 | 48.19 |
| stem | ||
| anatomy | 62.96 | 56.3 |
| college_biology | 78.47 | 65.97 |
| college_chemistry | 44.00 | 37.00 |
| high_school_biology | 79.03 | 71.29 |
| high_school_chemistry | 53.2 | 43.84 |
| groups | ||
| humanities | 56.13 | 50.46 |
| other | 68.97 | 63.47 |
| social sciences | 73.25 | 68.61 |
| stem | 48.91 | 42.53 |
Reproduce (example commands)
# MMLU classic
lm_eval --model hf \
--model_args pretrained=openmed-community/AFM-4.5B-OpenMed,parallelize=True,dtype=bfloat16,trust_remote_code=True \
--task mmlu \
--batch_size=64 \
--apply_chat_template \
--output_path=results \
--fewshot_as_multiturn
# MMLU-Pro (10-choice)
lm_eval --model hf \
--model_args pretrained=openmed-community/AFM-4.5B-OpenMed,parallelize=True,dtype=bfloat16,trust_remote_code=True \
--tasks leaderboard_mmlu_pro \
--batch_size=64 \
--apply_chat_template \
--output_path=results \
--fewshot_as_multiturn
# IFEVAL (verifiable instruction following)
lm_eval --model hf \
--model_args pretrained=openmed-community/AFM-4.5B-OpenMed,parallelize=True,dtype=bfloat16,trust_remote_code=True \
--tasks leaderboard_ifeval \
--batch_size=64 \
--apply_chat_template \
--output_path=results \
--fewshot_as_multiturn
Quickstart (Transformers)
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "openmed-community/AFM-4.5B-OpenMed"
tok = AutoTokenizer.from_pretrained(model_id, use_fast=True)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
messages = [
{"role": "system", "content": "You are a careful medical assistant. Cite sources and warn this is not medical advice."},
{"role": "user", "content": "Briefly: cellulitis vs erysipelas differences?"}
]
prompt = tok.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
inputs = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=256, do_sample=False)
print(tok.decode(out[0], skip_special_tokens=True))
Data & training notes
- SFT data: Proprietary synthetic medical data + search traces.
- DPO signal: Preferences derived from MedMCQA multiple-choice correctness.
- GRPO reward: Answer-checking + format verifiers; MedReason used to shape faithful, short CoT.
- No known PHI; please open an issue if you spot any.
Compatibility & licenses
- Base model: AFM-4.5B (Arcee). Refer to the base card/blog for architecture and usage details. License for AFM releases is Apache 2.0;
- Merging: MergeKit with Arcee Fusion; see repo/blog for configuration.
Additional note
We also provide a non-merged openmed-community/AFM-4.5B-OpenMed-RL-CoT checkpoint after step 3 (GRPO). In our harness, it shows better CoT behavior but a significant drop on IFEVAL. Consider it if you want maximum reasoning verbosity, then apply your own MergeKit recipe.
- Downloads last month
- 43
2-bit
4-bit
8-bit