SurgeryLSTM: Attention-Based BiLSTM for LOS
- SurgeryLSTM is a masked, attention-based bidirectional LSTM that models the temporal dynamics of preoperative EHR data to predict length of stay.
- It uses a sliding window and masking technique to convert variable-length patient histories into fixed-length sequences, enhancing data alignment and leakage prevention.
- Empirical results show SurgeryLSTM outperforms conventional models like XGBoost by achieving higher predictive accuracy and offering interpretable attention weights.
Searching arXiv for recent and foundational papers on SurgeryLSTM and related surgical LNN/LSTM models. SurgeryLSTM denotes, in the narrow and paper-specific sense, the masked bidirectional long short-term memory model with attention proposed for predicting hospital length of stay after elective spine surgery from structured perioperative electronic health records (Cho et al., 15 Jul 2025). In broader surgical-AI usage, the term also evokes a family of LSTM-centered sequence models used for surgical activity recognition, workflow analysis, duration estimation, tool-use inference, and early procedure understanding across kinematics, laparoscopic video, open-surgery video, and EHR streams (DiPietro et al., 2016, Yengera et al., 2018). The named model is therefore both a specific architecture and a late instance of a longer methodological lineage in which surgery is represented as a temporally ordered process rather than as a static classification problem.
1. Terminological scope and historical position
The only paper in the supplied corpus whose title explicitly contains “SurgeryLSTM” is “SurgeryLSTM: A Time-Aware Neural Model for Accurate and Explainable Length of Stay Prediction After Spine Surgery” (Cho et al., 15 Jul 2025). That model addresses elective spine surgery and predicts postoperative length of stay, not surgical phase, tool, or gesture labels.
At the same time, LSTM-based surgical sequence modeling predates that paper by several years. An early example is recurrent recognition of surgical activities from da Vinci robot kinematics, where forward LSTM was used for online recognition and bidirectional LSTM for offline recognition of gestures and maneuvers (DiPietro et al., 2016). In laparoscopic workflow analysis, CNN-LSTM pipelines became standard for phase recognition, including end-to-end self-supervised pre-training via remaining surgery duration prediction (Yengera et al., 2018) and teacher/student training under scarce manual annotations (Yu et al., 2018). This broader context suggests that “SurgeryLSTM” is best read as a model name embedded in an established LSTM-based surgical sequence-analysis tradition rather than as an isolated architectural invention.
2. Clinical objective, cohort, and target variable
In its specific 2025 usage, SurgeryLSTM is a model for predicting length of stay after elective spine surgery using preoperative structured EHR data (Cho et al., 15 Jul 2025). The clinical motivation is operational as well as prognostic: length of stay affects bed availability, staffing, discharge planning, postoperative rehabilitation coordination, and cost control.
The study is a retrospective observational analysis using EHR data from the University of California Irvine Health / UCI Medical Center over 2018–2023. Patients were included if they were age 18 or older, underwent spine surgery, had one of a specified set of CPT codes, and were admitted through planned surgery; patients admitted via the emergency department or outside the study period were excluded. After applying these criteria, 2,077 patients were included. The target variable was LOS in days, defined from surgery date to discharge date (Cho et al., 15 Jul 2025).
The LOS distribution was right-skewed. Most patients were discharged within the first few postoperative days: 21% on day 1, 17% on day 3, and 12% on day 5. Beyond 10 days, the count dropped markedly, and fewer than 3% remained hospitalized beyond two weeks. For visualization, LOS was limited to 0–20 days, which covered 2,056 of 2,077 patients; LOS days were treated as outliers for the visualization. The manuscript also alternates between LOS as a continuous outcome and LOS “categories” or “classes.” Because the reported evaluation uses MAE, MSE, RMSE, and , the main experiments appear regression-oriented. This suggests a residual ambiguity between modeling language and final evaluation protocol rather than a purely categorical formulation (Cho et al., 15 Jul 2025).
3. Sequence construction, masking, and attention-based BiLSTM formulation
SurgeryLSTM treats the patient’s preoperative course as a time-ordered sequence rather than a static feature bundle (Cho et al., 15 Jul 2025). The EHR data included demographics, diagnosis information via ICD-10 codes, surgical details including surgery dates and surgery codes, laboratory data including lab test type, test date, and test value, and admission and discharge data. Through clinically guided feature selection, the authors selected the 50 most frequently ordered lab tests based on diagnostic relevance and correlation patterns and, with input from two surgeons, finalized 647 features. These included demographics, diagnosis codes, surgery codes, admission/discharge-related variables, and lab results.
The preprocessing pipeline is designed around temporal alignment and leakage prevention. Diagnosis and surgery codes were standardized using ICD-10 and CPT classifications; categorical variables were one-hot encoded; gender was binary encoded as $0 =$ male and $1 =$ female; lab results were categorized into high, low, and normal; and continuous variables such as age were scaled with Robust Scaler to reduce outlier influence. All postsurgical information was excluded to avoid data leakage. Temporal variables were normalized relative to the surgery date so that different patients’ timelines were aligned chronologically. Missing lab values were imputed with the mean if the majority reference range for a lab indicated “Normal,” and otherwise with the median; lab types with 100% missingness were removed (Cho et al., 15 Jul 2025).
The temporal representation uses fixed-length sequences built from variable-length histories. Timestamps such as lab result dates were transformed into relative differences from the surgery date, data were sorted by patient ID and time, and for LSTM models the time difference was included as a time-step identifier. Because patients had different numbers of recorded preoperative events, the authors used a sliding window approach to construct fixed-length sequences, zero-padding for shorter sequences, and a masking layer so padded positions would be ignored during training. The sequence length was set to 14 days, chosen based on the 75th percentile of patient record lengths. The paper gives the window as
with overlapping sequences generated with stride 1 when more than 14 recorded events were available (Cho et al., 15 Jul 2025).
Architecturally, SurgeryLSTM is a masked BiLSTM with attention. The paper does not print explicit equations in the body text. A standard formulation consistent with the description is:
For bidirectional encoding,
and
If 0 denotes the mask for real versus padded steps, then masked hidden states may be written as
1
A standard attention formulation consistent with the paper description is
2
3
The “time-aware” aspect is explicitly not a specialized time-decay LSTM or irregular-time recurrent formulation; it is operationalized through temporal ordering and relative time-to-surgery encoding rather than a custom time gate (Cho et al., 15 Jul 2025).
4. Empirical performance and explainability
The empirical comparison in the SurgeryLSTM paper includes linear regression, random forest, support vector machine, XGBoost, a masked BiLSTM without attention, and SurgeryLSTM itself (Cho et al., 15 Jul 2025).
| Model | MAE / MSE / RMSE | 4 |
|---|---|---|
| Linear Regression | 2.68 / 21.99 / 4.69 | 0.55 |
| Random Forest | 2.69 / 19.64 / 4.43 | 0.60 |
| Support Vector Machine | 1.07 / 18.45 / 4.30 | 0.63 |
| XGBoost | 1.63 / 7.59 / 2.75 | 0.85 |
| Masked BiLSTM without attention | 2.73 / 23.73 / 4.87 | 0.52 |
| SurgeryLSTM | 1.48 / 7.21 / 2.69 | 0.86 |
SurgeryLSTM achieved the highest predictive accuracy, with 5, slightly outperforming XGBoost at 6. The comparison with masked BiLSTM without attention is especially consequential: bidirectionality and masking alone were not sufficient, whereas the attention-equipped model produced the best reported result. The paper does not report formal statistical significance testing, confidence intervals, repeated-run variability, or external validation, so the margin over XGBoost is reported descriptively rather than inferentially (Cho et al., 15 Jul 2025).
Interpretability is addressed through two distinct mechanisms. First, SurgeryLSTM’s attention weights provide time-step-level explanation by indicating which temporal segments of the preoperative sequence were weighted most strongly when predicting LOS. The reported pattern is that attention weights generally peak near the surgery date, while earlier preoperative steps still retain nonzero weight. This suggests that immediate perioperative status is especially informative, but longer-range history also contributes. Second, SHAP was applied not to SurgeryLSTM itself, but to the XGBoost baseline. The SHAP summary plot highlighted the top 20 predictors of LOS, including bone disorder, chronic kidney disease, lumbar fusion, lumbar decompression, anterior spinal fusion / anterior fusion, additional spinal fusion, spinal instrumentation, cervical decompression, lumbar laminectomy, obesity, cancer metastasis, multiple myeloma, vitreous disorder, skin abscess, fatigue, BMI, age, ethnicity, race, sex, and zip code regions. The paper specifically states that bone disorder, chronic kidney disease, and lumbar fusion were among the most impactful predictors (Cho et al., 15 Jul 2025).
5. Relation to the broader SurgeryLSTM-style literature
Long before the named LOS model, LSTMs were used to map surgical time series into clinically structured outputs. In robotic surgery, recurrent models were applied to da Vinci kinematics for joint segmentation and classification of low-level gestures and higher-level maneuvers, with bidirectional LSTM slightly exceeding the previous best LC-SC-CRF on JIGSAWS and substantially improving maneuver recognition on MISTIC-SL (DiPietro et al., 2016). In laparoscopic phase recognition, end-to-end CNN-LSTM training over full surgeries outperformed a frozen-CNN plus LSTM pipeline, and self-supervised pre-training via remaining surgery duration prediction reduced the need for manual annotations (Yengera et al., 2018). A related teacher/student formulation used a CNN-biLSTM-CRF teacher to generate synthetic labels and train an online CNN-LSTM student under low-label conditions (Yu et al., 2018).
The same design pattern also appears in duration and workflow prediction. A CNN-LSTM regressor for remaining surgery duration was improved by an unsupervised temporal video segmentation auxiliary task and by a corridor-based regression loss, yielding 7 min MAE in the best reported configuration (Rivoir et al., 2020). Long-term context aggregation was later added to an LSTM backbone through a sufficient statistics model, improving phase recognition especially on shorter, more ambiguous phases in MGH100 (Ban et al., 2020). In multitask video understanding, a ResNet-50 plus Bi-LSTM architecture jointly identified tools and phases and introduced a joint distribution loss over tool-phase co-occurrence, reporting tool average precision 8 and phase average precision 9 on Cholec80 (Mondal et al., 2019).
Other task variants extend the same recurrent logic into distinct surgical settings. Short 10-second video shots were classified into laparoscopic phases using CNN features, elapsed time, and an LSTM, with ResNet101 + saliency + elapsed time + LSTM reaching 86% accuracy (Loukas, 2018). Cross-surgery transfer work evaluated bidirectional LSTM baselines and proposed TSAN as a stronger hybrid temporal model for workflow-step recognition across cholecystectomy, right hemicolectomy, sleeve gastrectomy, and appendectomy (Neimark et al., 2021). Open-surgery analysis used high-frequency and low-frequency LSTMs over multi-camera detector outputs to recover global tool-in-hand state under occlusion, with the final multi-camera classifier reaching accuracy $0 =$0 and weighted F1 $0 =$1 (Basiev et al., 2021). Early surgery-type recognition from laparoscopic video likewise used a CNN+LSTM pipeline and introduced a “Future-State Predicting LSTM,” reporting average accuracy of 75% after observing only the first 10 minutes of a surgery on Laparo425 (Kannan et al., 2018). Collectively, these works show that the named SurgeryLSTM paper is unusual mainly in modality and endpoint—structured perioperative EHR and LOS—rather than in its reliance on recurrent temporal abstraction.
6. Limitations, ambiguities, and common confusions
The named SurgeryLSTM study has several explicit limitations (Cho et al., 15 Jul 2025). The cohort comes from one institution, so generalizability is uncertain. No external test set is reported, and the authors explicitly note that multi-institutional validation is needed. Important model details are missing, including exact final hyperparameter values, optimizer, hidden size, attention dimension, activation details in dense layers, the exact train/validation/test decomposition, and whether LOS was modeled strictly as regression or partly discretized into classes. The manuscript also alternates between LOS as a continuous outcome and LOS categories or classes, and it describes sequence targets as $0 =$2, which sounds like next-step forecasting even though the clinical task is overall postoperative LOS prediction. This suggests a degree of unresolved methodological ambiguity in the sequential formulation.
There are also fairness and deployment concerns. Race, ethnicity, sex, and zip code were included as predictors. The paper acknowledges mixed demographic effects but does not conduct fairness audits. Missingness, coding variation, and documentation inconsistency remain concerns even after imputation and masking. Because formal significance tests are absent, the reported edge over XGBoost should be read as an observed comparison rather than a stability claim (Cho et al., 15 Jul 2025).
A separate naming confusion arises with “Surgery” and “SurgeryV2.” Those methods address representation alignment in model merging-based multitask learning, use ViT and BERT backbones, and do not present any model called SurgeryLSTM or any LSTM-based architecture (Yang et al., 2024). Within surgical AI, “SurgeryLSTM” therefore refers most precisely to the 2025 masked attention-based BiLSTM for LOS prediction, while more informal use points to the broader recurrent family of surgical sequence models spanning kinematics, video, and EHR. Future directions proposed for the named model include multi-institutional validation, integration of structured EHR with unstructured clinical notes, incorporation of natural language embeddings, real-time inference capability for operational deployment, integration into hospital dashboards, and use of LLMs combined with structured data to improve risk assessment and interpretability (Cho et al., 15 Jul 2025).