Text Generation
Transformers
Safetensors
PEFT
English
medical
ner
entity-recognition
relation-extraction
grpo
qwen3
lora
conversational
Instructions to use xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO", device_map="auto") - PEFT
How to use xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO
- SGLang
How to use xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO 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 "xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO" \ --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": "xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO", "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 "xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO" \ --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": "xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO with Docker Model Runner:
docker model run hf.co/xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO
How to use from
vLLMUse Docker
docker model run hf.co/xingqiang/Medical-NER-Qwen-0.6B_COT-GRPOQuick Links
Medical-NER-Qwen-0.6B-GRPO
Model Description
This is a medical NER model fine-tuned with GRPO (Group Relative Policy Optimization) on Qwen3-0.6B, specialized for medical entity recognition and relationship extraction.
Model Details
- Base Model: unsloth/Qwen3-0.6B
- Fine-tuning Method: GRPO + LoRA
- Domain: Medical Literature Analysis
- Tasks: Entity Recognition (Bacteria, Disease, Evidence), Relationship Extraction
- Language: English
Entity Categories
- Bacteria: Microorganisms, viruses, pathogens, infectious agents
- Disease: Medical conditions, symptoms, syndromes, pathological states
- Evidence: Research findings, clinical observations, experimental results
Relationship Types
- is_a: Taxonomic or hierarchical relationships
- biomarker_for: Biomarker relationships
- correlated_with: Statistical correlations
- has_relationship: General associations
Usage
from unsloth import FastLanguageModel
from vllm import SamplingParams
# Load model
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO",
max_seq_length=4096,
load_in_4bit=False,
fast_inference=True,
)
# Prepare input
literature = """
Hepatitis C virus (HCV) is a major cause of chronic liver disease.
Studies show that HCV infection leads to cirrhosis in 20% of patients.
"""
messages = [
{"role": "system", "content": "You are a medical NER expert..."},
{"role": "user", "content": literature},
]
prompt = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=False
)
# Generate
output = model.fast_generate(
prompt,
sampling_params=SamplingParams(temperature=0.7, max_tokens=1024),
)[0].outputs[0].text
print(output)
Training Details
- Training Method: GRPO (Group Relative Policy Optimization)
- LoRA Rank: 32
- Max Sequence Length: 4096
- Reward Functions: Format matching, JSON validity, Entity accuracy
- Dataset: Medical literature with entity and relationship annotations
Output Format
{
"entities": [
{"text": "Hepatitis C virus", "label": "Bacteria"},
{"text": "chronic liver disease", "label": "Disease"}
],
"relations": [
{
"subject": "Hepatitis C virus",
"relation": "has_relationship",
"object": "chronic liver disease"
}
]
}
Citation
If you use this model, please cite:
@misc{medical-ner-qwen-grpo,
title={Medical NER with GRPO},
author={chen,xingqiang},
year={2025},
publisher={HuggingFace},
url={https://huggingface.co/xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO}
}
Install from pip and serve model
# Install vLLM from pip: pip install vllm# Start the vLLM server: vllm serve "xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO"# Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xingqiang/Medical-NER-Qwen-0.6B_COT-GRPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'