Intended use
- Extract PARHAF entity types from French clinical reports (XML tagging).
- Predict roles (
Patient, Carer, Hospital, Other) when applicable.
- Research / benchmarking of clinical de-identification — not a medical device.
Training data
Table with columns: Split, Source, Docs| Split | Source | Docs |
|---|
| Train | PARHAF_v1 + synth_v2 | 504 |
| Dev (eval) | PARHAF_v1 | 101 |
- PARHAF_v1: manually reviewed annotations (titles, ages-as-dates, FAMILY_STATUS, PSI, dates, CITY, etc.).
- synth_v2: same synthetic CRH corpus as v1, with
FAMILY_STATUS re-labeled via Mistral to include kin (spouse, parents, children, …), aligned with the PARHAF_v1 definition.
Training setup
Table with columns: Hyperparameter, Value| Hyperparameter | Value |
|---|
| Base model | unsloth/Qwen2.5-7B-Instruct |
| Method | LoRA (Unsloth / TRL SFT), r=16, alpha=16 |
| Format | XML, English system prompt |
| Roles | yes (--with-roles) |
| Entity types | full (PARHAF ∪ AP-HP overlap, incl. FAMILY_STATUS) |
| Context |
ft_config.json:
{ "with_roles": true, "format": "xml", "prompt_lang": "en", "schema": "parhaf", "entity_types": "full", "context_mode": "chunk", "chunk_size": 1500, "overlap": 300}
Evaluation (PARHAF_v1 /dev, offset, post-filtered)
Table with columns: Metric, F1| Metric | F1 |
|---|
| Entity (with label) | 0.881 |
| Entity (without label) | 0.882 |
| Char BIO (with label) | 0.924 |
| Role end-to-end | 0.971 |
| Role on matched entity spans | 0.999 |
Selected per-label entity F1: FIRST_NAME 0.995, LAST_NAME 0.958, IDENTIFYING_DATE 0.940, FAMILY_STATUS 0.622, PATIENT_SOCIAL_IDENTITY 0.629.
Cross-eval on AP-HP (aphp2 test) not included in this card yet.
Entity labels
FIRST_NAME, LAST_NAME, IDENTIFYING_DATE, PATIENT_BIRTHDATE, PATIENT_SOCIAL_IDENTITY, FAMILY_STATUS, CITY, COUNTRY, ADDRESS, ZIP, MAIL, CODEIDENTIFIANT, PHONE_NUMBER, PATIENT_NATIONALITY, UNIDENTIFYING_DATE, URL (+ AP-HP overlap extras when present in mix).
FAMILY_STATUS covers marital status and identifying kin/household mentions (spouse, parents, children, siblings, etc.).
Load
from peft import PeftModelfrom transformers import AutoModelForCausalLM, AutoTokenizer base = "unsloth/Qwen2.5-7B-Instruct"adapter = "niamaelkhbir/qwen2.5-7b-parhaf-v1-synth-v2-xml-en-roles" # after push tok = AutoTokenizer.from_pretrained(adapter)model = AutoModelForCausalLM.from_pretrained(base, device_map="auto", torch_dtype="auto")model = PeftModel.from_pretrained(model, adapter)
niamaelkhbir/qwen2.5-7b-parhaf-v1-xml-en — PARHAF_v1 only (no synth, no roles)
niamaelkhbir/qwen2.5-7b-parhaf-xml-en-chunk — earlier PARHAF (pre-cleanup)
Framework versions
- PEFT 0.19.1
- TRL 0.24.0
- Transformers 5.5.0
- PyTorch 2.10.0
- Unsloth
Citation
If you use this adapter, please cite the PARHAF / CU1 clinical NER work and:
@misc{vonwerra2022trl, title = {{TRL: Transformer Reinforcement Learning}}, author = {Leandro von Werra and others}, year = 2020, howpublished = {\\url{https://github.com/huggingface/trl}}}