Eliciting Medical Reasoning with Knowledge-enhanced Data Synthesis: A Semi-Supervised Reinforcement Learning Approach
Paper • 2604.11547 • Published • 5
How to use tdlhl/MedSSR-Qwen3-8B-Base with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="tdlhl/MedSSR-Qwen3-8B-Base")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("tdlhl/MedSSR-Qwen3-8B-Base")
model = AutoModelForCausalLM.from_pretrained("tdlhl/MedSSR-Qwen3-8B-Base", 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=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use tdlhl/MedSSR-Qwen3-8B-Base with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "tdlhl/MedSSR-Qwen3-8B-Base"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "tdlhl/MedSSR-Qwen3-8B-Base",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/tdlhl/MedSSR-Qwen3-8B-Base
How to use tdlhl/MedSSR-Qwen3-8B-Base with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "tdlhl/MedSSR-Qwen3-8B-Base" \
--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": "tdlhl/MedSSR-Qwen3-8B-Base",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "tdlhl/MedSSR-Qwen3-8B-Base" \
--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": "tdlhl/MedSSR-Qwen3-8B-Base",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use tdlhl/MedSSR-Qwen3-8B-Base with Docker Model Runner:
docker model run hf.co/tdlhl/MedSSR-Qwen3-8B-Base
This is the model for our ACL 2026 Findings paper, "Eliciting Medical Reasoning with Knowledge-enhanced Data Synthesis: A Semi-Supervised Reinforcement Learning Approach". MedSSR-Qwen3-8B-Base is a medical reasoning-focused LLM built from Qwen/Qwen3-8B-Base.
Qwen/Qwen3-8B-BaseMedSSR-Qwen3-8B-Baseimport torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "tdlhl/MedSSR-Qwen3-8B-Base"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
)
messages = [
{
"role": "user",
"content": (
"A 67-year-old man develops crushing substernal chest pain for 40 minutes. "
"ECG shows ST-segment elevation in leads II, III, and aVF. "
"Which coronary artery is most likely occluded?
"
"A. Left anterior descending artery
"
"B. Left circumflex artery
"
"C. Right coronary artery
"
"D. Posterior descending artery"
),
}
]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=1024,
temperature=0.6,
top_p=0.95,
)
new_tokens = outputs[0][inputs["input_ids"].shape[-1]:]
print(tokenizer.decode(new_tokens, skip_special_tokens=True))
from vllm import LLM, SamplingParams
llm = LLM(
model="tdlhl/MedSSR-Qwen3-8B-Base",
trust_remote_code=True,
)
sampling = SamplingParams(
temperature=0.6,
top_p=0.95,
max_tokens=1024,
)
prompt = (
"A 24-year-old woman presents with fatigue, weight gain, constipation, and cold intolerance. "
"Which of the following laboratory findings is most consistent with primary hypothyroidism?
"
"A. Low TSH, low free T4
"
"B. High TSH, low free T4
"
"C. High TSH, high free T4
"
"D. Low TSH, high free T4"
)
outputs = llm.generate([prompt], sampling_params=sampling)
print(outputs[0].outputs[0].text)
For evaluation settings similar to our paper, we follow the recommended setting of Qwen:
temperature=0.6
top_p=0.95
top_k=20
max_tokens=2048
If you find our model useful, please cite our paper:
@article{li2025eliciting,
title={Eliciting Medical Reasoning with Knowledge-enhanced Data Synthesis: A Semi-Supervised Reinforcement Learning Approach},
author={Haolin Li, Shuyang Jiang, Ruipeng Zhang, Jiangchao Yao, Ya Zhang, Yanfeng Wang},
journal={arXiv preprint arXiv:2604.11547},
year={2026}
}