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-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={Your Name},
  year={2024},
  publisher={HuggingFace},
  url={https://huggingface.co/xingqiang/Medical-NER-Qwen-0.6B-GRPO}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for xingqiang/Medical-NER-Qwen-0.6B-GRPO

Finetuned
Qwen/Qwen3-0.6B
Finetuned
unsloth/Qwen3-0.6B
Adapter
(21)
this model