Study design and participants
This retrospective cohort study was conducted across 7 neurosurgical centers in 5 countries. The study protocol was approved by the institutional review board at each participating center: West China Hospital, Sichuan University (IRB No. 2024 − 0847); North Sichuan Medical College (IRB No. 2024-NS-086); All India Institute of Medical Sciences, Delhi (IRB No. AIIMS/IEC/2024/721); Chongqing Medical University (IRB No. CQMU-2024-112); Xi’an Children’s Hospital (IRB No. XACH-IRB-2024-033); St. Petersburg State University (IRB No. SPBU-EC-2024-018); Hospital Israelita Albert Einstein, Sao Paulo (IRB No. HIAE-CAAE-2024-089) in January 2018 in accordance to the Declaration of Helsinki and Committee on Publication Ethics (COPE) guidelines. Informed consent was waived due to the retrospective nature of the study.
We followed the TRIPOD-AI and PROBAST-AI guidelines for prediction model studies using artificial intelligence14,15. Enrollment characteristics by participating center are provided in Supplementary Table S1. Patients who underwent complex brain tumor surgery (craniotomy for glioma or skull base tumor with expected operative duration > 3 h) between January 2018 and December 2024 were screened. Inclusion criteria were: age > = 18 years; histopathologically confirmed WHO grade II-IV glioma or skull base tumor (classified per WHO CNS5 criteria16; preoperative contrast-enhanced MRI; complete laboratory panel within 72 h preoperatively; and intraoperative anesthesia monitoring data. Exclusion criteria were: missing > 20% of required data elements; previous craniotomy in the same region; concomitant malignancy; emergency surgery for acute hemorrhage or herniation; or 24-hour operative mortality.
Validation strategy: independent multi-center validation
Important clarification on validation design: We employed independent multi-center validation rather than strict temporal validation. The 6 earlier-recruiting centers (n = 8,300) formed the derivation cohort, and 2 later-enrolling centers (n = 6,700) formed the validation cohort. However, because both derivation and validation centers collected data during overlapping calendar periods (July 2022 – December 2024), this does not constitute true temporal validation that would protect against temporal dataset shift. The validation centers were geographically and institutionally independent and were not represented in the training data, which protects against center-specific overfitting but not against temporal confounding. We recommend interpreting these results as independent multi-center validation with partial temporal separation.
Quantitative assessment of temporal dataset shift. To formally characterize the potential for temporal shift, we computed Maximum Mean Discrepancy (MMD) between feature distributions across calendar years (2018–2024) within the derivation cohort. MMD values were small for imaging features (MMD = 0.03) and biochemical markers (MMD = 0.05), but larger for intraoperative physiological patterns (MMD = 0.12), suggesting that anesthesia protocols and monitoring practices evolved modestly during the study period. We additionally fitted a year-indicator logistic regression model and found no significant trend in complication rates (OR per year = 0.98, 95% CI: 0.94–1.02, p = 0.31), suggesting that temporal shift in outcome distribution was minimal during the observation window. Nevertheless, we caution that our validation design does not protect against sudden practice changes (e.g., introduction of a new anesthetic agent, adoption of intraoperative MRI, or changes in blood transfusion thresholds) that may occur after model deployment. A dedicated temporal validation study using pre-post implementation designs is planned for 2025–2026.
Data collection and missing data handling
Data were extracted from electronic health records, PACS, and anesthesia information management systems. A standardized protocol was implemented with regular quality audits. For variables with < 5% missing data (most laboratory values, demographic variables), we used multiple imputation by chained equations (MICE) with 20 imputations17. For variables with 5–20% missing data (primarily advanced coagulation parameters and some intraoperative time-series segments), we used iterative imputation with predictive mean matching. Patients with > 20% missing data were excluded. We performed a complete-case sensitivity analysis to assess the impact of imputation on model performance.
Feature extraction and preprocessingMRI acquisition and harmonization
MRI data were acquired across seven centers using scanners from three vendors: Siemens (MAGNETOM Prisma 3 T, Skyra 3 T, Verio 3 T; n = 4 centers), GE (Discovery MR750 3 T, Signa Premier 3 T; n = 2 centers), and Philips (Ingenia 3 T; n = 1 center). All centers employed 3 T field strength. The standard acquisition protocol included: (a) 3D T1-weighted MPRAGE (TR 2300ms, TE 2.3ms, TI 900ms, flip angle 8°, voxel size 1.0 × 1.0 × 1.0 mm³); (b) post-contrast 3D T1-weighted MPRAGE following intravenous gadolinium administration (0.1 mmol/kg Gd-DTPA); (c) 3D T2-weighted SPACE (TR 3200ms, TE 409ms, voxel size 1.0 × 1.0 × 1.0 mm³); (d) 2D FLAIR (TR 9000ms, TE 81ms, TI 2500ms, slice thickness 3 mm); and (e) diffusion-weighted imaging (b = 0, 1000 s/mm²). Prior to feature extraction, scanner-specific bias was assessed using ComBat harmonization on a phantom validation dataset (n = 30 phantoms scanned at each center). Center-specific signal intensity distributions were normalized using the N4 bias field correction and z-score standardization per sequence to minimize inter-scanner variability. Sequence parameters were harmonized to the Siemens Prisma standard where deviations exceeded 10%.
Imaging features
Preoperative MRI sequences (T1, T1-contrast, T2, FLAIR, DWI) underwent standardized preprocessing: N4 bias field correction, rigid registration to MNI152 template (1 mm isotropic), brain extraction using BET, and intensity normalization using z-score standardization per sequence. Tumor segmentation was performed using a validated 3D U-Net with manual expert correction. Extracted features included: tumor volume (cm³), maximal diameter, midline shift (mm), presence of midline structure invasion (defined as displacement > = 5 mm or infiltration of the falx, third ventricle, corpus callosum, or brainstem), peritumoral edema volume (graded 0–4), enhancement pattern, necrosis proportion, and proximity to major vessels. These features were extracted using PyRadiomics18.
All multimodal data preprocessing, feature extraction, radiomic computation, and model training were performed using the Deepwise MetAI medical artificial intelligence analysis platform (version v1.0.1, Deepwise Medical Technology Co., Ltd., Beijing, China). This software is a Class-III software as a medical device (SaMD) registered with the China National Medical Products Administration (NMPA). The official URL for the software is https://www.deepwise.com/smartimage?id=1. The platform provides integrated modules for DICOM import, automated MRI segmentation, radiomic feature extraction, time-series physiological signal processing, and machine learning model development.
Intraoperative physiological parameters
Continuous monitoring data (MAP, BIS, heart rate, SpO₂) recorded at 1-minute intervals were extracted. Time-series quality control excluded segments with > 10% artifact. We extracted: operative duration (hours), estimated blood loss (mL), fluid balance, urine output, transfusion units, lowest MAP, MAP coefficient of variation, lowest BIS, BIS coefficient of variation, time-weighted average BIS, duration of hypotension (MAP < 65 mmHg for > 5 min), and duration of burst suppression (BIS < 15 for > 3 min). Time-series data were padded or truncated to a fixed sequence length of 480 (8 h), with zero-padding for shorter operations.
Biochemical indicators
Preoperative and postoperative (within 24 h) laboratory values were collected: hemoglobin (g/L), platelet count (x10⁹/L), white blood cell count (x10⁹/L), INR, aPTT (seconds), albumin (g/L), creatinine (µmol/L), sodium (mmol/L), C-reactive protein (mg/L), and procalcitonin (ng/mL). The postoperative hemoglobin nadir was recorded as the lowest value within 24 h post-surgery. Continuous variables were standardized using center-specific z-scores to account for inter-laboratory variability.
Outcome definition
The primary outcome was occurrence of any major postoperative complication within 30 days, defined as Clavien-Dindo grade II or higher19. Complications were independently adjudicated by two clinicians blinded to model predictions, with disagreements resolved by a third reviewer. Specific complications included: cerebral edema requiring osmotherapy or reoperation; intracranial hemorrhage confirmed by CT; surgical site infection (superficial incisional, deep incisional, or organ/space); postoperative seizure requiring antiepileptic initiation; delayed awakening (> 24 h); and other (pulmonary embolism, DVT, hydrocephalus requiring CSF diversion, unplanned reoperation).
Prediction timepoint and variable timing
The model generates predictions at two clinically relevant timepoints. The preoperative model uses only imaging features and preoperative biochemical markers available before surgical incision (T-0 h), enabling risk stratification at surgical scheduling. The full multimodal model additionally incorporates intraoperative physiological time-series and postoperative hemoglobin nadir (lowest value within 24 h post-surgery), and therefore generates predictions at 24 h postoperatively. We explicitly acknowledge that including postoperative variables (particularly hemoglobin nadir) limits the model’s utility for preoperative decision-making. The primary intended application is retrospective quality assessment and identification of modifiable risk factors, not real-time preoperative prediction. For prospective clinical deployment, a preoperative-only model variant (imaging + preoperative biochemistry) achieves AUC 0.84 in validation, which may be more appropriate for surgical scheduling decisions. The postoperative hemoglobin nadir is included as a modifiable risk factor target rather than a preoperative predictor, and its identification through SHAP analysis supports postoperative monitoring protocols rather than preoperative risk estimation.
Model architecture
We developed a multi-modal Transformer with three modality-specific encoders and a cross-modal fusion module (Fig. 1). The overall architecture follows an encoder-fusion-decoder design. Each modality-specific encoder processes raw input data into a compact feature representation: the imaging encoder processes 3D MRI volumes (128 × 128 × 128 voxels, 4 channels) through a ResNet-50 backbone with squeeze-and-excitation blocks, outputting a 512-dimensional feature vector; the physiological encoder processes 480-time-point multivariate monitoring data (MAP, BIS, HR, SpO2) through a 2-layer bidirectional LSTM with attention, outputting a 256-dimensional vector; and the biochemical encoder processes 18 structured laboratory variables through a 2-layer MLP, outputting a 128-dimensional vector. These three vectors (512 + 256 + 128 = 896 dimensions) are projected to a common 512-dimensional space, concatenated with modality-type embeddings, and fed into a 6-layer Transformer encoder with 8 attention heads. The cross-attention mechanism in the Transformer allows imaging features to attend to physiological patterns and biochemical markers, enabling the model to learn cross-modal interactions (e.g., how midline invasion modulates the effect of hypotension duration). A 2-layer classification head (512 -> 64 -> 1, sigmoid) produces the final complication probability. The complete architecture contains approximately 28.5 million trainable parameters.
Fig. 1
Study flowchart showing patient selection, cohort allocation, and model development pipeline. The derivation cohort (n = 8,300) from 6 centres was used for 5-fold stratified cross-validation. The validation cohort (n = 6,700) from 2 independent centres was used for independent multi-centre validation.
Spatial Imaging Encoder.A 3D CNN backbone (modified ResNet-50 with squeeze-and-excitation blocks20 extracted hierarchical features from preprocessed MRI volumes (input: 128 × 128 × 128 voxels, 4 channels for T1c, T2, FLAIR, DWI). Four residual blocks produced a 512-dimensional imaging feature vector. Batch normalization and dropout (p = 0.2) were applied after each block.
Temporal Physiological Encoder.A 2-layer bidirectional LSTM (128 hidden units each direction, dropout 0.3) processed the 480 × 4 time-series matrix (MAP, BIS, HR, SpO₂). A scaled dot-product attention mechanism was applied over LSTM outputs to weight time points by clinical importance, producing a 256-dimensional physiological feature vector. Positional encoding used learnable sinusoidal embeddings at 5-minute intervals.
Biochemical Encoder.Structured laboratory variables (n = 18 features) were encoded through a 2-layer MLP (256 -> 128 units, GELU activation, layer normalization, dropout 0.2), producing a 128-dimensional biochemical feature vector. Categorical variables (transfusion status, sex) were embedded into 8-dimensional vectors.
The three modality-specific feature vectors (512 + 256 + 128 = 896 dimensions) were projected to a common 512-dimensional space through linear projections and concatenated with modality-type embeddings. This combined representation was fed into a 6-layer Transformer encoder with 8 attention heads, 512 hidden dimensions, 2048 feed-forward dimension, pre-normalization, and dropout 0.1. The Transformer employed learned sinusoidal positional encodings to differentiate modality sequence positions. The cross-attention mechanism allowed imaging features to attend to physiological patterns and biochemical markers. A 2-layer classification head (512 -> 64 -> 1, sigmoid) produced the complication probability.
Model training
Patients from 6 centers (n = 8,300) formed the derivation cohort; 2 independent centers (n = 6,700) constituted the validation cohort. Within derivation, 5-fold stratified cross-validation preserved center distribution across folds. Training used AdamW (lr = 1e-4, weight decay = 0.01), cosine annealing schedule with 10-epoch warm-up, batch size 32, and binary cross-entropy loss with inverse-frequency class weighting. Training ran for maximum 150 epochs with early stopping (patience = 20 epochs on validation AUC). Gradient clipping (max norm = 1.0) was applied. Experiments used PyTorch 2.1 on 4xNVIDIA A100 (80GB) GPUs. The complete software environment was as follows: Python 3.10.12; PyTorch 2.1.0 with CUDA 12.1; torchvision 0.16.0; torchaudio 2.1.0; MONAI 1.3.0 (for 3D U-Net segmentation); SimpleITK 2.3.0 (for N4 bias correction and image registration); NiBabel 5.1.0; PyRadiomics 3.1.0 (for feature extraction); scikit-learn 1.3.2; XGBoost 2.0.2; scikit-optimize 0.9.0; SHAP 0.42.1; scipy 1.11.4; pandas 2.0.3; numpy 1.24.3; matplotlib 3.7.2; seaborn 0.12.2. Image preprocessing utilized FSL 6.0.6 (BET brain extraction) and ANTs 2.5.0 (MNI152 registration). Statistical analyses were performed using R 4.3.1 with packages: pROC 1.18.5, rms 6.7.1, mice 3.16.0, and logistf 1.26. All experiments were conducted on a Ubuntu 22.04 LTS server.
Comparator models included: (1) logistic regression with LASSO feature selection (10-fold CV, optimal lambda); (2) XGBoost on clinical data only; (3) Random forest on clinical data only; (4) single-modality Transformer variants. Additionally, we compared against a baseline clinical risk score derived from ASA grade, tumor grade, and estimated operative duration. We explicitly acknowledge that this clinical risk score does not represent the full judgment of an experienced neurosurgeon, which would require a prospective design not feasible in this retrospective study.
Dataset shift and robustness analysis
We assessed dataset shift between centers using Maximum Mean Discrepancy (MMD) on feature distributions and performed subgroup analysis by center, country, and ethnicity. Center-specific calibration was evaluated to identify systematic over- or under-prediction at individual sites. We applied batch normalization center-adaptation during inference.
Statistical analysis and model evaluation
Discrimination was assessed using AUC with 95% CIs via the DeLong test21. Calibration was evaluated using calibration plots, Brier score, Expected Calibration Error (ECE), Maximum Calibration Error (MCE), and Hosmer-Lemeshow test (10 bins)22. The Brier score was reported both absolutely and as the Brier Skill Score (BSS):

Equation (1). Brier Skill Score formula. A BSS of 0 indicates no improvement over the null model; 1 indicates perfect prediction.
A BSS of 0 indicates no improvement over the null model; 1 indicates perfect prediction. Values between 0 and 1 indicate the proportion of reducible error captured by the model. Clinical utility was assessed via decision curve analysis23. Model interpretability was analyzed using SHAP24 with KernelExplainer. SHAP interaction values were computed to identify pairwise feature interactions using TreeSHAP interaction decomposition, which separates the marginal contribution of each feature from the pure interaction effect25. Temporal attention visualization was performed by extracting cross-attention weights from the final Transformer layer and aggregating them across attention heads, producing a heatmap of attention intensity across the 480 time-point physiological matrix. Multivariable logistic regression with Firth’s bias correction calculated odds ratios. For the hemoglobin threshold identified in SHAP dependence plots, we performed 1,000 bootstrap resamples to assess threshold stability.