Text Generation
Transformers
Safetensors
English
medical
radiology
eurorad
differential-diagnosis
chain-of-thought
lora
gpt-oss
clinical-reasoning
conversational
Eval Results (legacy)
Instructions to use alhusains/gpt-oss-20b-ddx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use alhusains/gpt-oss-20b-ddx with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="alhusains/gpt-oss-20b-ddx") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("alhusains/gpt-oss-20b-ddx", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use alhusains/gpt-oss-20b-ddx with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "alhusains/gpt-oss-20b-ddx" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "alhusains/gpt-oss-20b-ddx", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/alhusains/gpt-oss-20b-ddx
- SGLang
How to use alhusains/gpt-oss-20b-ddx 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 "alhusains/gpt-oss-20b-ddx" \ --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": "alhusains/gpt-oss-20b-ddx", "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 "alhusains/gpt-oss-20b-ddx" \ --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": "alhusains/gpt-oss-20b-ddx", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use alhusains/gpt-oss-20b-ddx with Docker Model Runner:
docker model run hf.co/alhusains/gpt-oss-20b-ddx
File size: 2,976 Bytes
e5fbf62 8aa6e92 e5fbf62 8aa6e92 e5fbf62 8aa6e92 e5fbf62 e5456f1 8aa6e92 e5fbf62 e5456f1 e5fbf62 e5456f1 e5fbf62 e5456f1 e5fbf62 c805f3f e5fbf62 e5456f1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | ---
language: en
license: apache-2.0
base_model: openai/gpt-oss-20b
tags:
- medical
- radiology
- eurorad
- differential-diagnosis
- chain-of-thought
- lora
- gpt-oss
- clinical-reasoning
library_name: transformers
pipeline_tag: text-generation
datasets:
- eurorad
widget:
- text: >
A 45-year-old woman presents with acute chest pain radiating to the left
arm. CT angiography shows a filling defect in the LAD. Provide a structured
differential diagnosis and the most likely diagnosis.
example_title: Radiology differential diagnosis
model-index:
- name: gpt-oss-20b-ddx
results:
- task:
type: text-generation
name: Radiology differential diagnosis
dataset:
type: eurorad
name: Eurorad radiology cases
metrics:
- type: accuracy
value: 0.862
name: exact-match accuracy
---
# **GPT-OSS-20B – Differential Diagnosis Radiology Reasoning**
This repository provides a **LoRA adapter** fine-tuned on radiology cases from the **Eurorad** dataset to enhance differential diagnosis and structured medical reasoning. The adapter attaches to the base model **`openai/gpt-oss-20b`**, enabling stronger radiology-focused performance while remaining lightweight and deployable on a single GPU.
**Highlights**
- Improved **differential diagnosis accuracy** on Eurorad cases (exact match boost from 78.6% → **86.2%**)
- Trained with **structured chain-of-thought** derived from gpt-oss-120b
- Works with **Unsloth**, **PEFT**, and **Transformers**
---
## **Quick Start**
### 🔹 Load with PEFT + Transformers
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
BASE = "openai/gpt-oss-20b"
ADAPTER = "alhusains/gpt-oss-20b-eurorad-lora"
tokenizer = AutoTokenizer.from_pretrained(BASE)
base = AutoModelForCausalLM.from_pretrained(BASE, device_map="auto")
model = PeftModel.from_pretrained(base, ADAPTER)
model.eval()
prompt = "Provide a differential diagnosis for multiple bilateral lung nodules."
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=300)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```
---
## **Training Summary**
- **Dataset:** Eurorad radiology case reports (clinical history + imaging findings)
- **Supervision:** Structured chain-of-thought reasoning generated by gpt-oss-120b
- **Objective:** Enhance differential diagnosis and structured medical reasoning
- **Method:** LoRA fine-tuning
- Rank: 32
- Alpha: 64
- Applied to attention, MLP layers, and MoE experts
- **Sequence length:** 4096 tokens
- **Framework:** Unsloth + PEFT (4-bit training)
- **Precision:** bfloat16 mixed precision
- **Training schedule:** 3 epochs, AdamW, LR = 1e-4 with cosine decay and warmup
- **Result:** Improved exact-match diagnostic accuracy on Eurorad cases (base 78.6% → fine-tuned **86.2%**) |