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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- zh
|
| 5 |
+
tags:
|
| 6 |
+
- medical
|
| 7 |
+
- perioperative
|
| 8 |
+
- complications
|
| 9 |
+
- lora
|
| 10 |
+
- adapter
|
| 11 |
+
- clinical-ai
|
| 12 |
+
datasets:
|
| 13 |
+
- perioperative-complications
|
| 14 |
+
pipeline_tag: text-classification
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# PeriComp: Perioperative Complication Detection LoRA Adaptors
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
*Figure: Performance comparison of fine-tuned models across different sizes*
|
| 21 |
+
|
| 22 |
+
## π©Ί Model Overview
|
| 23 |
+
|
| 24 |
+
**PeriComp** is a collection of specialized LoRA (Low-Rank Adaptation) adaptors designed for **perioperative complication detection** from clinical narratives. These adaptors enhance smaller open-source language models to achieve expert-level performance in identifying and grading 22 distinct perioperative complications based on European Perioperative Clinical Outcome (EPCO) definitions.
|
| 25 |
+
|
| 26 |
+
### π― Key Features
|
| 27 |
+
|
| 28 |
+
- **Expert-level Performance**: Matches or exceeds human clinician accuracy
|
| 29 |
+
- **Multi-scale Detection**: Simultaneous identification and severity grading (mild/moderate/severe)
|
| 30 |
+
- **Comprehensive Coverage**: 22 distinct perioperative complications
|
| 31 |
+
- **Resource Efficient**: Optimized for deployment on standard clinical infrastructure
|
| 32 |
+
- **Privacy Preserving**: Fully deployable on-premises without data transmission
|
| 33 |
+
|
| 34 |
+
## π Model Collection
|
| 35 |
+
|
| 36 |
+
This collection includes five optimized LoRA adaptors:
|
| 37 |
+
|
| 38 |
+
| Model | Base Model | Parameters | F1 Score | Use Case |
|
| 39 |
+
|-------|------------|------------|----------|----------|
|
| 40 |
+
| **PeriComp-4B** | Qwen3-4B | 4B | 0.55 | Resource-constrained environments |
|
| 41 |
+
| **PeriComp-8B** | Qwen3-8B | 8B | 0.61 | Balanced performance/efficiency |
|
| 42 |
+
| **PeriComp-14B** | Qwen3-14B | 14B | 0.65 | High-performance deployment |
|
| 43 |
+
| **PeriComp-32B** | Qwen3-32B | 32B | 0.68 | Maximum accuracy requirements |
|
| 44 |
+
| **PeriComp-QwQ-32B** | QwQ-32B | 32B | 0.70 | Reasoning-enhanced performance |
|
| 45 |
+
|
| 46 |
+
## π¬ Research Background
|
| 47 |
+
|
| 48 |
+
Perioperative complications affect millions of patients globally, with traditional manual detection suffering from:
|
| 49 |
+
- **27% under-reporting rate** in clinical registries
|
| 50 |
+
- **High variability** in expert performance across institutions
|
| 51 |
+
- **Cognitive load limitations** with complex documentation
|
| 52 |
+
|
| 53 |
+
Our research demonstrates that targeted task decomposition combined with LoRA fine-tuning enables smaller models to achieve expert-level diagnostic capabilities while maintaining practical deployability.
|
| 54 |
+
|
| 55 |
+

|
| 56 |
+
*Figure: Strict performance evaluation requiring exact complication type and severity matching*
|
| 57 |
+
|
| 58 |
+
## π Quick Start
|
| 59 |
+
|
| 60 |
+
### Installation
|
| 61 |
+
|
| 62 |
+
```bash
|
| 63 |
+
pip install transformers peft torch
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
### Basic Usage
|
| 67 |
+
|
| 68 |
+
```python
|
| 69 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 70 |
+
from peft import PeftModel
|
| 71 |
+
|
| 72 |
+
# Load base model and tokenizer
|
| 73 |
+
model_name = "Qwen/Qwen3-8B"
|
| 74 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 75 |
+
base_model = AutoModelForCausalLM.from_pretrained(model_name)
|
| 76 |
+
|
| 77 |
+
# Load PeriComp adaptor
|
| 78 |
+
adaptor_name = "your-username/Qwen3-8B-PeriComp"
|
| 79 |
+
model = PeftModel.from_pretrained(base_model, adaptor_name)
|
| 80 |
+
|
| 81 |
+
# Prepare clinical input
|
| 82 |
+
clinical_text = '''
|
| 83 |
+
Patient Demographics: 65-year-old male
|
| 84 |
+
Procedure: Laparoscopic cholecystectomy
|
| 85 |
+
Postoperative Course: POD#2 - Patient reports abdominal pain,
|
| 86 |
+
fever 38.5Β°C, elevated WBC count 15,000/ΞΌL...
|
| 87 |
+
'''
|
| 88 |
+
|
| 89 |
+
# Generate complication assessment
|
| 90 |
+
inputs = tokenizer(clinical_text, return_tensors="pt")
|
| 91 |
+
outputs = model.generate(**inputs, max_new_tokens=512)
|
| 92 |
+
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
### Targeted Strategy Usage
|
| 96 |
+
|
| 97 |
+
For optimal performance with smaller models, use our targeted strategy:
|
| 98 |
+
|
| 99 |
+
```python
|
| 100 |
+
# Define complications to assess
|
| 101 |
+
complications = [
|
| 102 |
+
"acute_kidney_injury",
|
| 103 |
+
"surgical_site_infection",
|
| 104 |
+
"paralytic_ileus",
|
| 105 |
+
# ... other complications
|
| 106 |
+
]
|
| 107 |
+
|
| 108 |
+
# Assess each complication individually
|
| 109 |
+
results = {}
|
| 110 |
+
for complication in complications:
|
| 111 |
+
prompt = f"Assess for {complication}: {clinical_text}"
|
| 112 |
+
# ... inference code
|
| 113 |
+
results[complication] = assessment
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
## π Performance Metrics
|
| 117 |
+
|
| 118 |
+
### Validation Results (Micro-averaged F1 Scores)
|
| 119 |
+
|
| 120 |
+
- **Center 1 (Primary)**: Complex tertiary care cases
|
| 121 |
+
- **Center 2 (External)**: Community hospital validation
|
| 122 |
+
|
| 123 |
+
| Model | Center 1 F1 | Center 2 F1 | Human Expert F1 |
|
| 124 |
+
|-------|-------------|-------------|-----------------|
|
| 125 |
+
| PeriComp-4B | 0.55 | 0.52 | 0.526 |
|
| 126 |
+
| PeriComp-8B | 0.61 | 0.58 | 0.526 |
|
| 127 |
+
| PeriComp-14B | 0.65 | 0.62 | 0.526 |
|
| 128 |
+
| PeriComp-32B | 0.68 | 0.65 | 0.526 |
|
| 129 |
+
| PeriComp-QwQ-32B | 0.70 | 0.67 | 0.526 |
|
| 130 |
+
|
| 131 |
+
### Key Advantages
|
| 132 |
+
|
| 133 |
+
β
**Consistent Performance**: No degradation with document complexity
|
| 134 |
+
β
**24/7 Availability**: Continuous monitoring capability
|
| 135 |
+
β
**Standardized Assessment**: Eliminates inter-observer variability
|
| 136 |
+
β
**Comprehensive Detection**: All 22 EPCO-defined complications
|
| 137 |
+
β
**Privacy Compliant**: On-premises deployment option
|
| 138 |
+
|
| 139 |
+
## π§ Technical Details
|
| 140 |
+
|
| 141 |
+
### Training Methodology
|
| 142 |
+
|
| 143 |
+
- **Base Architecture**: Qwen3 series and QwQ-32B
|
| 144 |
+
- **Fine-tuning Method**: LoRA (Low-Rank Adaptation)
|
| 145 |
+
- **Training Data**: 146 complex surgical cases
|
| 146 |
+
- **Validation**: Dual-center external validation (52 cases)
|
| 147 |
+
- **Task Strategy**: Targeted decomposition approach
|
| 148 |
+
|
| 149 |
+
### LoRA Configuration
|
| 150 |
+
|
| 151 |
+
```python
|
| 152 |
+
lora_config = {
|
| 153 |
+
"lora_rank": 16,
|
| 154 |
+
"lora_alpha": 32,
|
| 155 |
+
"learning_rate": 1e-4,
|
| 156 |
+
"target_modules": ["q_proj", "k_proj", "v_proj", "o_proj"]
|
| 157 |
+
}
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
## π Supported Complications
|
| 161 |
+
|
| 162 |
+
The models detect and grade 22 perioperative complications:
|
| 163 |
+
|
| 164 |
+
1. **Cardiovascular**: Myocardial injury, cardiac arrhythmias
|
| 165 |
+
2. **Respiratory**: Pneumonia, respiratory failure
|
| 166 |
+
3. **Renal**: Acute kidney injury
|
| 167 |
+
4. **Gastrointestinal**: Paralytic ileus, anastomotic leakage
|
| 168 |
+
5. **Infectious**: Surgical site infections, sepsis
|
| 169 |
+
6. **Neurological**: Delirium, stroke
|
| 170 |
+
7. **Hematological**: Bleeding, thromboembolism
|
| 171 |
+
8. **And more...**
|
| 172 |
+
|
| 173 |
+
Each complication is graded as:
|
| 174 |
+
- **Mild**: Minor intervention required
|
| 175 |
+
- **Moderate**: Significant medical management
|
| 176 |
+
- **Severe**: Life-threatening, intensive intervention
|
| 177 |
+
|
| 178 |
+
## π₯ Clinical Applications
|
| 179 |
+
|
| 180 |
+
### Primary Use Cases
|
| 181 |
+
|
| 182 |
+
- **Automated Screening**: Continuous 24/7 complication monitoring
|
| 183 |
+
- **Quality Assurance**: Systematic complication registry validation
|
| 184 |
+
- **Clinical Decision Support**: "Second opinion" for complex cases
|
| 185 |
+
- **Research**: Standardized outcome assessment for clinical studies
|
| 186 |
+
|
| 187 |
+
### Deployment Scenarios
|
| 188 |
+
|
| 189 |
+
- **Resource-limited Settings**: Use PeriComp-4B/8B models
|
| 190 |
+
- **Standard Clinical Environment**: PeriComp-14B recommended
|
| 191 |
+
- **High-accuracy Requirements**: PeriComp-32B for maximum performance
|
| 192 |
+
- **Reasoning-enhanced Tasks**: PeriComp-QwQ-32B for complex diagnostic reasoning
|
| 193 |
+
|
| 194 |
+
## β οΈ Important Considerations
|
| 195 |
+
|
| 196 |
+
### Clinical Validation Required
|
| 197 |
+
|
| 198 |
+
β οΈ **These models are research tools and require clinical validation before use in patient care**
|
| 199 |
+
|
| 200 |
+
### Limitations
|
| 201 |
+
|
| 202 |
+
- Training on Chinese medical records (generalizability considerations)
|
| 203 |
+
- Performance depends on documentation quality and completeness
|
| 204 |
+
- Not a replacement for clinical judgment
|
| 205 |
+
|
| 206 |
+
### Best Practices
|
| 207 |
+
|
| 208 |
+
- Use as **screening tool** with clinical oversight
|
| 209 |
+
- Validate outputs against clinical judgment
|
| 210 |
+
- Consider local adaptation for specific institutional practices
|
| 211 |
+
|
| 212 |
+
## π Citation
|
| 213 |
+
|
| 214 |
+
If you use PeriComp in your research, please cite:
|
| 215 |
+
|
| 216 |
+
```bibtex
|
| 217 |
+
@article{pericomp2025,
|
| 218 |
+
title={Enhancing Local Language Models for Perioperative Complication Detection: A Targeted Strategy with LoRa Fine-tuning},
|
| 219 |
+
author={[Authors]},
|
| 220 |
+
journal={[Journal]},
|
| 221 |
+
year={2025}
|
| 222 |
+
}
|
| 223 |
+
```
|
| 224 |
+
|
| 225 |
+
## π§ Contact & Support
|
| 226 |
+
|
| 227 |
+
For questions, issues, or collaboration opportunities:
|
| 228 |
+
|
| 229 |
+
- **Research Team**: Department of Anesthesiology, First Affiliated Hospital of Sun Yat-sen University, Guangzhou, China
|
| 230 |
+
- **Technical Issues**: gaoshw5@mail.sysus.edu.cn
|
| 231 |
+
- **Clinical Applications**: Perioperative Complications Detection
|
| 232 |
+
|
| 233 |
+
## π License
|
| 234 |
+
|
| 235 |
+
This work is licensed under Apache License 2.0. See LICENSE for details.
|
| 236 |
+
|
| 237 |
+
---
|
| 238 |
+
|
| 239 |
+
*PeriComp: Advancing perioperative patient safety through AI-powered complication detection*
|