ningpy/redflag-detection-V4.2
0238
Redflag Detection V4.2 (V20g, strict 59-rule spec compliance)
Fine-tuned from Qwen2.5-7B-Instruct for medical red-flag extraction. Strict compliance with 2026-08 Medical Advisory "Red Flad_New" spec (59 rules).
V4.2 vs V4.1
V4.1 (V20d) included 6 "extension" rules (Row 60-65) and 7 symptoms not in the official 59-rule spec (testicular_torsion, pyelonephritis, PID, angle-closure glaucoma, cauda equina, PPH). These were removed in V4.2 to comply with Medical Advisory scope.
- Closed symptom set: 96 → 89 items (dropped 7 orphaned)
- Rule engine: 65 → 59 rules
- Prompt v11 (was v10)
- Training data: sanitized (dropped 81 samples of orphan-only cases + 160 orphan symptom mentions from labels) + 31 negative reinforcement samples
- Fix:
is_maleschema hallucination remains 0
Performance (val 269, strict)
Clinical-fair (SUSPECTED = TP for recall)
- Precision: 0.771
- Recall: 0.865
- F1: 0.815
Notes
- Orphan symptom residual: 7/269 model outputs mention removed symptoms. Engine ignores them (0 flag impact). Downstream systems can safely strip them or ignore.
- V4.2 covers exactly what's in the official spec. Coverage gaps for testicular torsion, angle-closure glaucoma, cauda equina, PPH require Medical Advisory spec expansion (see git history commit b61a4e9/cd5b628 for the extension logic that was removed).
Usage
python3 -m vllm.entrypoints.openai.api_server \
--model ningpy/redflag-detection-V4.2 \
--served-model-name redflag \
--dtype float16Pair with the 59-rule V20 engine (redflag_scripts/v20/rule_engine_v20.py).
Training
- 3766 samples (V20f 3735 + patch20e_neg 31)
- LoRA r=32 alpha=64, 7 target projections
- 3 epochs @ 2e-5, seq len 1900, 8×V100 DDP
