Automated Detection of Dosing Errors in Clinical Trial Narratives: A Multi-Modal Feature Engineering Approach with LightGBM
Organizations: Qatar University Doha, Qatar
Abstract
Clinical trials require strict adherence to medication protocols, yet dosing errors remain a persistent challenge affecting patient safety and trial integrity. We present an automated system for detecting dosing errors in unstructured clinical trial narratives using gradient boosting with comprehensive multi-modal feature engineering. Our approach combines 3,451 features spanning traditional NLP (TF-IDF, character n-grams), dense semantic embeddings (all-MiniLM-L6v2), domain-specific medical patterns, and transformer-based scores (BiomedBERT, DeBERTa-v3), used to train a LightGBM model. Features are extracted from nine complementary text fields (median 5,400 characters per sample) ensuring complete coverage across all 42,112 clinical trial narratives. On the CT-DEB benchmark dataset with severe class imbalance (4.9% positive rate), we achieve 0.8725 test ROC-AUC through 5-fold ensemble averaging (cross-validation: 0.8833 + 0.0091 AUC). Systematic ablation studies reveal that removing sentence embeddings causes the largest performance degradation (2.39%), demonstrating their critical role despite contributing only 37.07% of total feature importance. Feature efficiency analysis demonstrates that selecting the top 500-1000 features yields optimal performance (0.886-0.887 AUC), outperforming the full 3,451-feature set (0.879 AUC) through effective noise reduction. Our findings highlight the importance of feature selection as a regularization technique and demonstrate that sparse lexical features remain complementary to dense representations for specialized clinical text classification under severe class imbalance.
Figures & tables
| Split | Total | Negative | Positive |
| Training | 29,478 | 28,126 (95.4%) | 1,352 (4.6%) |
| Validation | 6,316 | 6,031 (95.5%) | 285 (4.5%) |
| Test | 6,318 | 6,008 (95.1%) | 310 (4.9%) |
| Total | 42,112 | 40,165 | 1,947 |
| Category | Dims | Description |
| Medical Patterns | 43 | Rule-based features for dose changes, adverse events, text statistics |
| Word TF-IDF | 2,000 | Unigram features with sublinear TF scaling, L2 normalization, max_features=2,000, min_df=2, max_df=0.8 |
| Char N-grams | 1,000 | Character sequences (n=3–7), top-1,000 |
| Sentence Embeddings | 386 | all-MiniLM-L6-v2 dense semantics |
| Transformer Scores | 2 | BiomedBERT & DeBERTa probabilities |
| Category | # | Features & Description |
| Dose Units | 5 | Binary indicators for dose measurement units: has_mg_dose (milligrams), has_ml_dose (milliliters), has_mcg_dose (micrograms), has_iu_dose (international units), has_unit_dose (generic units) |
| Dose Calculations | 2 | has_weight_based (mg/kg, mcg/kg dosing), has_bsa_based (body surface area dosing: mg/m²) |
| Routes | 6 | Administration route flags: has_iv (intravenous), has_oral (oral), has_sc (subcutaneous), has_im (intramuscular), has_topical (topical), has_inhaled (inhaled) |
| Frequencies | 5 | Dosing schedule indicators: has_qd (once daily), has_bid (twice daily), has_tid (three times daily), has_qid (four times daily), has_prn (as needed) |
| Dose Concepts | 6 | Management patterns: has_max_dose (maximum limits), has_titration (escalation), has_loading_dose , has_maintenance , has_adjustment , has_contraindication |
| Special Populations | 5 | Population-specific considerations: has_pediatric , has_geriatric , has_pregnancy , has_renal (renal impairment), has_hepatic (hepatic dysfunction) |
| Parameter | Search Space | Value | Description |
| Learning Parameters | |||
| n_estimators | — | 4,000 | Number of boosting rounds |
| learning_rate | 0.0054 | Step size shrinkage, sampled on a logarithmic scale | |
| Tree Structure | |||
| num_leaves | 118 | Max leaves per tree | |
| max_depth | 9 | Maximum tree depth | |
| Metric | Score | Note |
| ROC-AUC | 0.8725 | Ensemble prediction (Test Dataset) |
| F1-Score | 0.2951 | Binary F1 |
| Precision | 0.3389 | Of flagged cases |
| Recall (Sensitivity) | 0.2613 | Of actual errors |
| Balanced Accuracy | 0.6175 | Equal class weight |
| Specificity | 0.9737 | Of error-free cases |
| Category | Features | Total (%) | Avg Gain | Std |
| Word/Char Features | 3,020 | 62.38 | 30.40 | ±1.2 |
| Sentence Embeddings | 386 | 37.07 | 141.37 | ±8.5 |
| Medical Patterns | 43 | 0.49 | 16.84 | ±0.8 |
| Transformer Scores | 2 | 0.06 | 43.90 | ±2.1 |
| Configuration | Features | Mean AUC | Std | % |
| All Features | 3,451 | 0.8794 | ±0.0091 | – |
| w/o Sentence Embeddings | 3,065 | 0.8584 | ±0.0105 | +2.39% |
| w/o Word/Char Features | 431 | 0.8772 | ±0.0087 | +0.25% |
| w/o Transformer Scores | 3,449 | 0.8827 | ±0.0083 | -0.38% |
| w/o Medical Patterns | 3,408 | 0.8827 | ±0.0068 | -0.38% |
| K Features | Mean AUC | Std | % Baseline |
| 3,451 (All) | 0.8794 | ±0.0091 | 100.00% |
| 3,000 | 0.8827 | ±0.0085 | 100.38% |
| 2,000 | 0.8837 | ±0.0084 | 100.49% |
| 1,000 | 0.8867 | ±0.0091 | 100.83% |
| 500 | 0.8862 | ±0.0100 | 100.78% |
| 200 | 0.8835 | ±0.0101 | 100.47% |