ningpy/redflag-detection-V4.1
0271
Redflag Detection V4.1 (V20d, 65 rules)
Fine-tuned from Qwen2.5-7B-Instruct for medical red-flag extraction. Aligned with 2026-08 "Red Flad_New" spec, extended with 6 additional critical rules missing from the original spec.
What's new in V4.1 vs V4.0
- Fixed `is_male` hallucination (0/269 val cases; V4.0 had schema gap where
sexwas in prompt but 0 training samples used it) - 6 new critical rules covering previously uncovered surgical/OB emergencies:
- V20-60 testicular_torsion (sex=male defensive gate)
- V20-61 pyelonephritis (painful_urination + fever + severe)
- V20-62 severepid (fouldischarge + fever + severe)
- V20-63 eye_emergency (angle-closure glaucoma / sudden vision loss; any age)
- V20-64 caudaequina (newincontinence + severe_weakness; any adult age)
- V20-65 postpartum_hemorrhage (sex=female defensive gate)
- Defensive sex gates on Row 34-39 (pregnancy) — blocks conflict only, not required
- Pediatric age fallback — Row 40-46 accept
is_child/is_babyboolean whenage_bandabsent - 50 new training samples covering sex extraction from "Patient Info: Age X, Male/Female" blocks (EN/中文/BM)
Performance (val 269, strict)
Performance (clinical-fair, SUSPECTED = TP for recall)
- Precision: 0.753
- Recall: 0.853
- F1: 0.800
Usage
python3 -m vllm.entrypoints.openai.api_server \
--model ningpy/redflag-detection-V4.1 \
--served-model-name redflag \
--dtype float16Requires V20e rule engine (65 compiled rules with sex_gate + age fallback).
Training
- 3816 samples (V20c 3766 + patch20d 50 sex-field samples)
- LoRA r=32 alpha=64, 7 target projections
- 3 epochs @ 2e-5, seq len 1900, 8×V100 DDP
