Deep learning prediction of pathological complete response in breast cancer using Mamba architecture Authors: Wenchuan Zhang, Shuwan Zhang, Fengling Li, Yuanyuan Zhao, Jing Fu, Xiuli Xiao, Ting Yin, Qingjie Lv, Yuhao Yi, Hong Bu Published: 2026 ABSTRACT Deep learning is capable of efficiently predicting the therapeutic efficacy of neoadjuvant chemotherapy (NAC) in breast cancer. However, current methods predominantly rely on convolutional neural networks or transformer architectures and are often validated in small patient cohorts. We developed a Mamba-based deep learning model for predicting chemotherapy efficacy using needle biopsy (MCEN) from 1646 patients with breast cancer across five tertiary hospitals, aiming to predict pathological complete response following NAC. We randomly divided 1023 biopsy samples from one hospital into training and validation sets at an 8:2 ratio and used the remaining four hospitals as external test sets to evaluate the model’s performance and robustness. In the training and validation sets, the MCEN achieved areas under the receiver operating characteristic curve (AUROCs) of 0.923 and 0.78, respectively. For the four external test sets, the MCEN achieved AUROCs ranging from 0.761– to 0.809. Incorporating clinicopathological information improved the MCEN model’s predictive performance, achieving AUROCs of 0.937 and 0.811 in the training and validation sets, respectively, and ranging from 0.773– to 0.84 in the external test sets. Our study demonstrates the potential of the MCEN as a valuable tool in clinical decision-making. Introduction Breast cancer is the most common malignancy among women worldwide, and treatment strategy has a major influence on patient outcomes. Neoadjuvant chemotherapy (NAC) is widely used to reduce tumor burden, increase the likelihood of breast-conserving surgery, and evaluate sensitivity to systemic therapy, with the ultimate aim of achieving pathological complete response (pCR). Patients who achieve pCR generally have more favorable prognoses, whereas non-responders may experience overtreatment, delayed surgery, and potential local or systemic progression1. Pathological complete response, defined as the absence of residual invasive cancer in both the breast and regional lymph nodes after NAC, is therefore a key prognostic indicator of treatment efficacy, underscoring the need for reliable pre-treatment prediction tools to inform individualized decision-making2. Several biomarkers and models have been proposed to predict pCR in breast cancer, including stromal tumor-infiltrating lymphocytes (TILs), gene expression signatures, imaging-based radiomics, and molecular subtypes. High TIL levels on hematoxylin and eosin (H&E)–stained slides are associated with increased pCR rates in triple-negative and HER2-positive breast cancer3, and a qRT-PCR-based four-gene score has shown high sensitivity for predicting response to platinum-based NAC in triple-negative disease4. Quantitative assessments of tumor microenvironment features (e.g., mitotic activity, TILs) on H&E images and intrinsic molecular subtypes such as HER2-enriched further contribute to response prediction5,6. However, these approaches suffer from limited reproducibility across subtypes, reliance on specialized assays or expert assessment, and incomplete capture of the complex spatial heterogeneity and cellular interactions within tumors, which constrains the precision of pCR prediction. Artificial intelligence (AI) has shown promise for non-invasive prediction of treatment response across multiple tumor types. Convolutional neural network (CNN)–based models using MRI or CT have achieved encouraging performance in predicting pCR in rectal, esophageal, and breast cancer, supporting their potential role in risk stratification and treatment tailoring7–16. In parallel, computational pathology has enabled automated analysis of whole slide images (WSIs) for tasks such as tissue classification, tumor origin prediction, and lymph node metastasis assessment17–21. WSIs contain rich morphological and microenvironmental information, and several CNN-based models have been developed to predict pCR or related outcomes from pre-treatment biopsy slides22–25. Nonetheless, conventional CNNs primarily rely on local convolutional operations and struggle to model long-range contextual relationships, which are critical for representing the spatial heterogeneity of the tumor ecosystem26,27. Self-attention mechanisms and transformer-based architectures partially address this limitation by dynamically weighting different regions and capturing global dependencies across gigapixel WSIs, thereby revealing complex spatial patterns associated with treatment response28–33. However, their quadratic computational and memory complexity with respect to sequence length imposes substantial hardware burdens and limits scalability in real-world pathology workflows. Recently, the Mamba deep learning framework—a selective state space model—has emerged as a promising alternative for long-sequence modeling, achieving linear complexity while maintaining global receptive fields34. Sequence Reordering Mamba (SRMamba) has demonstrated strong performance in computational pathology tasks such as survival prognosis and tumor subtype classification35, but its potential for predicting therapeutic response, particularly pCR after NAC in breast cancer, remains underexplored. In this multicenter study, we developed a Mamba-based online re-embedding model using WSI-derived features integrated with clinicopathologic information to predict pCR in patients with breast cancer undergoing NAC. Our aim was to build a robust, scalable, and interpretable computational pathology tool that can support individualized neoadjuvant treatment decisions and improve precision in breast cancer management. An overview of the proposed MCEN deep learning workflow and study design is illustrated in Fig. 1.Fig. 1Overview of the MCEN deep learning model prediction workflow for whole-slide image analysis.A Preprocessing steps. B Feature extraction and prediction workflow. Overview of the MCEN deep learning model prediction workflow for whole-slide image analysis. A Preprocessing steps. B Feature extraction and prediction workflow. Results Characteristics of the study population The study included 1646 eligible patients from five independent institutions: West China Hospital (WC cohort, n = 1023), Shengjing Hospital (SJ cohort, n = 306), Shanxi Cancer Hospital (SXC cohort, n = 187), Sichuan Provincial People’s Hospital (SCPP cohort, n = 80), and the Affiliated Hospital of Southwest Medical University (ASWMU cohort, n = 50). In the WC cohort, patients were randomly split into a training set (n = 819) and a validation set (n = 204). The pCR rates were consistent between the training and validation sets (27.5% for both). The detailed baseline clinical and pathological characteristics are summarized in Table 1. To address missing data in the WC and SCPP cohorts (menopausal status, cT stage, and Ki-67 index), a random forest imputation method was applied. Imputed values are denoted in italics in Supplementary Data 1. Significant heterogeneity was observed across the cohorts (Supplementary Table 1), reflecting real-world variations in patient populations.Table 1Baseline demographic and clinicopathological characteristics of the study populationParameter (%)OverallWC training cohortWC validation cohortExternal test cohortsn = 1646n = 819n = 204SJ, n = 306SXC, n = 187SCPP, n = 80ASWMU, n = 50Age<50806 (49.0)438 (53.5)112 (54.9)129 (42.2)68 (36.4)32 (40)27 (54.0)≥50840 (51.0)381 (46.5)92 (45.1)177 (57.8)119 (63.6)48 (60)23 (46.0)Menopausal statusPremenopausal705 (42.8)328 (40.0)77 (37.7)148 (48.4)89 (47.6)35 (43.8)28 (56.0)Postmenopausal748 (45.5)343 (41.9)82 (40.2)158 (51.6)98 (52.4)45 (56.2)22 (44.0)Unknown193 (11.7)148 (18.1)45 (22.1)0 (0.0)0 (0.0)0 (0.0)0 (0.0)cTT1–T21029 (62.5)413 (50.4)96 (47.1)285 (93.1)154 (82.4)50 (62.5)31 (62.0)T3–T4547 (33.2)348 (42.5)96 (47.1)21 (6.9)33 (17.6)30 (37.5)19 (38.0)Unknown70 (4.3)58 (7.1)12 (5.9)0 (0.0)0 (0.0)0 (0.0)0 (0.0)cNN0–N11078 (65.5)469 (57.3)125 (61.3)259 (84.6)119 (63.6)62 (77.5)44 (88.0)N2–N3568 (34.5)350 (42.7)79 (38.7)47 (15.4)68 (36.4)18 (22.5)6 (12.0)ER statusNegative627 (38.1)328 (40.0)90 (44.1)103 (33.7)51 (27.3)30 (37.5)25 (50.0)Positive1019 (61.9)491 (60.0)114 (55.9)203 (66.3)136 (72.7)50 (62.5)25 (50.0)PR statusNegative620 (37.7)325 (39.7)83 (40.7)88 (28.8)75 (40.1)30 (37.5)19 (38.0)Positive1026 (62.3)494 (60.3)121 (59.3)218 (71.2)112 (59.9)50 (62.5)31 (62.0)HER2 statusNegative1147 (69.7)541 (66.1)136 (66.7)221 (72.2)172 (92.0)50 (62.5)27 (54.0)Positive499 (30.3)278 (33.9)68 (33.3)85 (27.8)15 (8)30 (37.5)23 (46.0)SubtypesHR+/HER2−883 (53.7)415 (50.7)102 (50.0)182 (59.5)129 (69.0)40 (50.0)15 (30.0)HR+/HER2+286 (17.4)147 (17.9)36 (17.6)58 (19.0)8 (4.3)19 (23.8)18 (36.0)HR−/HER2+213 (12.9)131 (16.0)32 (15.7)27 (8.8)7 (3.7)11 (13.8)5 (10.0)HR−/HER2−264 (16.0)126 (15.4)34 (16.7)39 (12.7)43 (23.0)10 (12.5)12 (24.0)Ki-67 index<20%302 (18.4)139 (17.0)34 (16.7)93 (30.4)12 (6.4)16 (20)8 (16.0)≥20%1340 (81.4)680 (83.0)170 (83.3)213 (69.6)175 (93.6)60 (75)42 (84.0)Unknown4 (0.2)0 (0.0)0 (0.0)0 (0.0)0 (0.0)4 (5)0 (0.0)Data are presented as No. (%) unless otherwise specified.WC West China Hospital cohort, SJ Shengjing Hospital cohort, SXC Shanxi Cancer Hospital cohort, SCPP Sichuan Provincial People’s Hospital cohort, ASWMU Affiliated Hospital of Southwest Medical University cohort, cT clinical T stage, cN clinical N stage, ER estrogen receptor, PR progesterone receptor, HER2 human epidermal growth factor receptor 2. Table 1Baseline demographic and clinicopathological characteristics of the study populationParameter (%)OverallWC training cohortWC validation cohortExternal test cohortsn = 1646n = 819n = 204SJ, n = 306SXC, n = 187SCPP, n = 80ASWMU, n = 50Age<50806 (49.0)438 (53.5)112 (54.9)129 (42.2)68 (36.4)32 (40)27 (54.0)≥50840 (51.0)381 (46.5)92 (45.1)177 (57.8)119 (63.6)48 (60)23 (46.0)Menopausal statusPremenopausal705 (42.8)328 (40.0)77 (37.7)148 (48.4)89 (47.6)35 (43.8)28 (56.0)Postmenopausal748 (45.5)343 (41.9)82 (40.2)158 (51.6)98 (52.4)45 (56.2)22 (44.0)Unknown193 (11.7)148 (18.1)45 (22.1)0 (0.0)0 (0.0)0 (0.0)0 (0.0)cTT1–T21029 (62.5)413 (50.4)96 (47.1)285 (93.1)154 (82.4)50 (62.5)31 (62.0)T3–T4547 (33.2)348 (42.5)96 (47.1)21 (6.9)33 (17.6)30 (37.5)19 (38.0)Unknown70 (4.3)58 (7.1)12 (5.9)0 (0.0)0 (0.0)0 (0.0)0 (0.0)cNN0–N11078 (65.5)469 (57.3)125 (61.3)259 (84.6)119 (63.6)62 (77.5)44 (88.0)N2–N3568 (34.5)350 (42.7)79 (38.7)47 (15.4)68 (36.4)18 (22.5)6 (12.0)ER statusNegative627 (38.1)328 (40.0)90 (44.1)103 (33.7)51 (27.3)30 (37.5)25 (50.0)Positive1019 (61.9)491 (60.0)114 (55.9)203 (66.3)136 (72.7)50 (62.5)25 (50.0)PR statusNegative620 (37.7)325 (39.7)83 (40.7)88 (28.8)75 (40.1)30 (37.5)19 (38.0)Positive1026 (62.3)494 (60.3)121 (59.3)218 (71.2)112 (59.9)50 (62.5)31 (62.0)HER2 statusNegative1147 (69.7)541 (66.1)136 (66.7)221 (72.2)172 (92.0)50 (62.5)27 (54.0)Positive499 (30.3)278 (33.9)68 (33.3)85 (27.8)15 (8)30 (37.5)23 (46.0)SubtypesHR+/HER2−883 (53.7)415 (50.7)102 (50.0)182 (59.5)129 (69.0)40 (50.0)15 (30.0)HR+/HER2+286 (17.4)147 (17.9)36 (17.6)58 (19.0)8 (4.3)19 (23.8)18 (36.0)HR−/HER2+213 (12.9)131 (16.0)32 (15.7)27 (8.8)7 (3.7)11 (13.8)5 (10.0)HR−/HER2−264 (16.0)126 (15.4)34 (16.7)39 (12.7)43 (23.0)10 (12.5)12 (24.0)Ki-67 index<20%302 (18.4)139 (17.0)34 (16.7)93 (30.4)12 (6.4)16 (20)8 (16.0)≥20%1340 (81.4)680 (83.0)170 (83.3)213 (69.6)175 (93.6)60 (75)42 (84.0)Unknown4 (0.2)0 (0.0)0 (0.0)0 (0.0)0 (0.0)4 (5)0 (0.0)Data are presented as No. (%) unless otherwise specified.WC West China Hospital cohort, SJ Shengjing Hospital cohort, SXC Shanxi Cancer Hospital cohort, SCPP Sichuan Provincial People’s Hospital cohort, ASWMU Affiliated Hospital of Southwest Medical University cohort, cT clinical T stage, cN clinical N stage, ER estrogen receptor, PR progesterone receptor, HER2 human epidermal growth factor receptor 2. Baseline demographic and clinicopathological characteristics of the study population Data are presented as No. (%) unless otherwise specified. WC West China Hospital cohort, SJ Shengjing Hospital cohort, SXC Shanxi Cancer Hospital cohort, SCPP Sichuan Provincial People’s Hospital cohort, ASWMU Affiliated Hospital of Southwest Medical University cohort, cT clinical T stage, cN clinical N stage, ER estrogen receptor, PR progesterone receptor, HER2 human epidermal growth factor receptor 2. We evaluated the association between baseline characteristics and pCR status across different cohorts (Supplementary Data 1). Conventional clinicopathological features showed variable predictive value. ER, PR, and HER2 status, as well as molecular subtypes, were significantly associated with pCR in the large cohorts (WC and SJ). However, these associations were inconsistent in smaller validation cohorts; for instance, HER2 status showed no significant difference in the SXC and ASWMU cohorts. Clinical T stage differed significantly only in the WC training cohort, while nodal status (cN) was significant only in the SJ cohort. Significant differences in the Ki-67 index were observed in the WC training, SJ, and SCPP cohorts, but not in the WC validation or ASWMU cohorts. In contrast to the variability observed in conventional clinical features, the MCEN score demonstrated robust and consistent discriminative ability across all cohorts. The MCEN score was significantly higher in the pCR group compared to the non-pCR group in every dataset (all P < 0.05). Specifically, in the WC training cohort, the mean MCEN score was 0.771 for pCR vs. 0.212 for non-pCR. This trend was strictly maintained in all external validation cohorts, including SJ, SXC, SCPP, and ASWMU. Furthermore, the MCEN score exhibited a larger dynamic range between responders and non-responders compared to other clinical variables, underscoring its potential as a stable and generalizable biomarker for predicting NAC response. Performance of the MCEN model in predicting outcomes In the model development and selection process, we used the AUROC as the primary evaluation metric to assess the performance of the MCEN model. To enhance model stability, we conducted 5-fold cross-validation in the West China cohort. The dataset was divided into five folds using stratified random sampling to maintain consistent class distribution across folds. During this process, the MCEN model achieved AUROCs ranging from 0.814– to 0.929 across the five training folds, with a mean of 0.9 and a standard deviation of 0.044 (Fig. 2A). These results reflect the model’s performance on the training subsets during cross-validation in the West China cohort. To select the final model parameters, we evaluated the performance of each fold’s trained model on its corresponding validation fold by AUROC. The AUROCs across the five validation folds ranged from 0.719– to 0.78, with a mean of 0.746 and a standard deviation of 0.02 (Fig. 2B). Notably, the fourth fold achieved the highest AUROC of 0.78 on its validation subset. We retained the model parameters from the fourth fold as the final MCEN model parameters because it performed best among the five folds. The final model based on these parameters achieved an AUROC of 0.923 on the fourth fold’s training portion of the West China cohort and 0.78 on its corresponding validation fold. Subsequently, we evaluated the selected model parameters in four external test cohorts, obtaining AUROCs of 0.761 (SJ cohort, Fig. 2C), 0.809 (SXC cohort, Fig. 2D), 0.767 (SCPP cohort, Fig. 2E), and 0.8 (ASWMU cohort, Fig. 2F). These results demonstrate the generalizability of the parameters selected from the fourth fold across independent datasets. To evaluate the impact of stain normalization, we compared model performance with and without this preprocessing step under identical hyperparameters. The results demonstrated that stain normalization enhanced model stability across cross-validation folds. Consequently, the model from the fourth fold, which achieved the highest AUROC in the validation set, was selected as the final model for subsequent analyses due to its superior performance (Supplementary Table 2).Fig. 2Evaluation of the MCEN model across different cohorts, which presents the AUROCs and confusion matrices.A Results from 5-fold cross-validation in the West China training cohort. B–F Performance in the validation and external test cohorts. Evaluation of the MCEN model across different cohorts, which presents the AUROCs and confusion matrices. A Results from 5-fold cross-validation in the West China training cohort. B–F Performance in the validation and external test cohorts. Comprehensive performance comparisons of feature extractors and multiple instance learning models Through rigorous performance evaluation in the WC validation cohort, we found that among the four pretrained pathological feature extractors, the CONCH vision–language encoder achieved the highest AUROC (0.780, 95% CI 0.710–0.849). Notably, CONCH significantly outperformed the ViT-S/16 encoder (0.677, 95% CI 0.585–0.757; absolute difference 0.103, p = 0.012). Although the AUROC differences between CONCH and CTransPath or Phikon did not reach statistical significance, CONCH yielded a slightly narrower confidence interval than the similarly performing Phikon encoder, suggesting that it can provide more stable and reliable features for downstream tasks (Supplementary Table 3). Based on the CONCH feature extractor, we further evaluated the performance of different MIL methods. Experimental results showed that our proposed method MCEN outperformed existing SOTA methods (including ABMIL, CLAM, TransMIL, and baseline MeanPooling and MaxPooling methods) (Supplementary Table 4). However, most differences were not statistically significant, indicating that the observed improvements should be regarded as indicative trends rather than definitive evidence. In terms of computational efficiency, we conducted a comprehensive assessment of the number of trainable parameters, floating-point operations, and inference time for all models. Notably, the MCEN model reduced inference time by 23.1% compared to TransMIL while maintaining comparable accuracy, demonstrating an ideal balance between high precision and inference efficiency (Supplementary Table 5). To validate the effectiveness of the proposed modules, we also conducted ablation studies based on the CONCH feature extractor using the internal validation cohort (WC validation cohort). Three scanning strategies were compared to guide model selection. Among them, our MCEN model achieved the best performance on the validation set (Supplementary Table 6). Interpretability of the MCEN model Self-attention mechanisms were extensively utilized in this study, enabling the model to focus on specific regions. We ranked patches from highest to lowest prediction scores and summarized critical insights for pathologists. The MCEN model focused primarily on regions with fibrosis or abundant fibroblasts (Fig. 3B, C) and clean fat tissue surrounding the tumor (Fig. 3D) when predicting non-pCR. Intratumoral tumor-infiltrating lymphocytes (Fig. 3A) received high scores from the MCEN model, which is consistent with studies suggesting that high collagen content24 and intratumoral lymphocytes36 might indicate a lack of significant response to NAC. However, the impact of clean fat tissue surrounding the tumor on treatment efficacy requires further investigation. In predicting pCR, the model highlighted high nuclear grade (Fig. 4A, B, D)37, abundant stromal tumor-infiltrating lymphocytes (Fig. 4A, D)38, rich microvasculature (Fig. 4B)39, and tumor or lymphocyte invasion of adipose tissue (Fig. 4C). These attention scores differed significantly from non-pCR predictions, aligning with observations of high nuclear grade, abundant stromal lymphocytes, and rich microvasculature. The significance of microvasculature and adipose tissue invasion warrants further evidence. We also analyzed model mispredictions and omissions, which may be due to the presence of both positive and negative patches within some slides, insufficient representation in needle biopsy samples (Supplementary Fig. 1C, 2A–D), or rich histological information causing model interference (Supplementary Fig. 1A, B, D).Fig. 3Interpretability of the MCEN model in predicting non-pCR.A High-scoring regions with intratumoral tumor-infiltrating lymphocytes, which are associated with a lack of significant response to neoadjuvant chemotherapy. B–C Regions with fibrosis or abundant fibroblasts, which were given high scores by the MCEN model when predicting nonpathological complete response. D Clean fat tissue surrounding the tumor, which was also highly scored by the MCEN model.Fig. 4Key histopathological features highlighted by the MCEN model for pCR.A High nuclear grade and abundant stromal tumor-infiltrating lymphocytes, which are significant predictors of pCR, are indicated in the tiles. B The presence of high nuclear grade and rich microvasculature are also highlighted as key features associated with pCR. C Tumor or lymphocyte invasion into adipose tissue is noted; further investigation is needed to determine its significance in pCR prediction. D A composite view showing high nuclear grade and abundant stromal tumor-infiltrating lymphocytes, reinforcing their importance in predicting pCR. Interpretability of the MCEN model in predicting non-pCR. A High-scoring regions with intratumoral tumor-infiltrating lymphocytes, which are associated with a lack of significant response to neoadjuvant chemotherapy. B–C Regions with fibrosis or abundant fibroblasts, which were given high scores by the MCEN model when predicting nonpathological complete response. D Clean fat tissue surrounding the tumor, which was also highly scored by the MCEN model. Key histopathological features highlighted by the MCEN model for pCR. A High nuclear grade and abundant stromal tumor-infiltrating lymphocytes, which are significant predictors of pCR, are indicated in the tiles. B The presence of high nuclear grade and rich microvasculature are also highlighted as key features associated with pCR. C Tumor or lymphocyte invasion into adipose tissue is noted; further investigation is needed to determine its significance in pCR prediction. D A composite view showing high nuclear grade and abundant stromal tumor-infiltrating lymphocytes, reinforcing their importance in predicting pCR. Application of the MCEN model with clinicopathological information To assess the predictive impact of key factors across different datasets, we conducted univariate logistic regression analyses on the training, validation, and test sets. Although menopausal status, clinical T stage, ER, PR, HER2 status, molecular subtype, Ki67 index, and MCEN score were generally associated with outcomes (p < 0.05), some variations were observed across datasets. Specifically, in the ASWMU cohort, only molecular subtype and MCEN score were significantly associated with outcomes (Supplementary Data 2). These differences may reflect dataset-specific characteristics, such as variations in sample composition or patient demographics. Nevertheless, as is widely recognized1,23, the seven key variables showing significant differences in the training set, in addition to the MCEN score, provide important insights into patient outcomes in clinical practice. Given that molecular subtype is derived from ER, PR, and HER2 status, we included menopausal status, clinical T stage, molecular subtype, Ki67, and MCEN score in our machine learning models to minimize multicollinearity among variables (Supplementary Fig. 3). Detailed information for each group is provided in Supplementary Table 7. Multivariate logistic regression analysis further revealed that molecular subtype and MCEN score were independent predictors (Table 2). Compared with the MCEN deep learning model, the logistic regression model incorporating clinicopathological information improved the AUROCs by 0.4%, 3.6%, 0.8% (SJ cohort), 2.1% (SXC cohort), 2.1% (SCPP cohort), and 3.1% (ASWMU cohort) in the training, validation, and test sets, respectively (Fig. 5A). The logistic regression formula is as follows:1\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{array}{c}{logits}=-4.23+0.12\times {Menopausal}\,{status}-0.04\times {cT}+1.11\times {Subtypes}1+\\ 1.17\times {Subtypes}2+0.65\times {Subtypes}3-0.22\times {Ki}67+5.53\times {MCEN}\,{score}\,\end{array}$$\end{document}logits=−4.23+0.12×Menopausalstatus−0.04×cT+1.11×Subtypes1+1.17×Subtypes2+0.65×Subtypes3−0.22×Ki67+5.53×MCENscoreFig. 5Performance comparison of 5 machine learning models incorporating clinicopathological information (CPI).Comparison of AUROCs between models incorporating CPI and the MCEN score across the training, validation, and test sets from the SJ, SXC, SCPP, and ASWMU cohorts: A the logistic regression (LR) model, B the K-nearest neighbors (KNN) model, C the support vector machine (SVM) model, D the random forest (RF) model, and (E) the extreme gradient boosting (XGBoost) model. SHAP analysis indicates the importance of features in both the RF (F) and XGBoost (G) models, with the MCEN score being the most significant in both models.Table 2Logistic regression analysis of the training cohortVariableUnivariate analysisMultivariate analysisORLower 95%CIUpper 95%CIP valueORLower 95%CIUpper 95%CIP valueAge<50Ref.≥501.2580.9251.7110.143Menopausal statusPremenopausalRef.Postmenopausal1.5941.1722.1730.0031.1290.7141.7830.603cTT1–T2Ref.T3–T40.6920.5050.9440.0210.9620.6041.5340.871cNN0–N1Ref.N2–N31.0210.7481.3920.893ER statusNegativeRef.Positive0.2140.1530.2963.19E-20PR statusNegativeRef.Positive0.2900.2100.3982.85E-14HER2 statusNegativeRef.Positive5.9294.2658.2989.27E-26SubtypesHR+/HER2−Ref.HR+/HER2+8.7765.54814.0875.36E-203.0441.6555.6373.59E-04HR−/HER2+12.8808.03121.0171.77E-253.2271.7066.1483.31E-04HR−/HER2−5.3233.2508.7753.69E-111.9060.9943.6550.052Ki-67 index<20%Ref.≥20%1.7981.1552.8920.0120.8050.4001.6360.546MCEN score386.076185.150860.8182.41E-52251.554115.979581.7132.50E-41OR odds ratio, cT clinical T stage, cN clinical N stage, ER estrogen receptor, PR progesterone receptor, HER2 human epidermal growth factor receptor 2, Ref. reference. Performance comparison of 5 machine learning models incorporating clinicopathological information (CPI). Comparison of AUROCs between models incorporating CPI and the MCEN score across the training, validation, and test sets from the SJ, SXC, SCPP, and ASWMU cohorts: A the logistic regression (LR) model, B the K-nearest neighbors (KNN) model, C the support vector machine (SVM) model, D the random forest (RF) model, and (E) the extreme gradient boosting (XGBoost) model. SHAP analysis indicates the importance of features in both the RF (F) and XGBoost (G) models, with the MCEN score being the most significant in both models. Table 2Logistic regression analysis of the training cohortVariableUnivariate analysisMultivariate analysisORLower 95%CIUpper 95%CIP valueORLower 95%CIUpper 95%CIP valueAge<50Ref.≥501.2580.9251.7110.143Menopausal statusPremenopausalRef.Postmenopausal1.5941.1722.1730.0031.1290.7141.7830.603cTT1–T2Ref.T3–T40.6920.5050.9440.0210.9620.6041.5340.871cNN0–N1Ref.N2–N31.0210.7481.3920.893ER statusNegativeRef.Positive0.2140.1530.2963.19E-20PR statusNegativeRef.Positive0.2900.2100.3982.85E-14HER2 statusNegativeRef.Positive5.9294.2658.2989.27E-26SubtypesHR+/HER2−Ref.HR+/HER2+8.7765.54814.0875.36E-203.0441.6555.6373.59E-04HR−/HER2+12.8808.03121.0171.77E-253.2271.7066.1483.31E-04HR−/HER2−5.3233.2508.7753.69E-111.9060.9943.6550.052Ki-67 index<20%Ref.≥20%1.7981.1552.8920.0120.8050.4001.6360.546MCEN score386.076185.150860.8182.41E-52251.554115.979581.7132.50E-41OR odds ratio, cT clinical T stage, cN clinical N stage, ER estrogen receptor, PR progesterone receptor, HER2 human epidermal growth factor receptor 2, Ref. reference. Logistic regression analysis of the training cohort OR odds ratio, cT clinical T stage, cN clinical N stage, ER estrogen receptor, PR progesterone receptor, HER2 human epidermal growth factor receptor 2, Ref. reference. Next, we also evaluated the performance of four additional machine learning models to determine their AUROC scores across various datasets. Specifically, the KNN model achieved an AUROC of 0.952 on the training set, indicating a strong initial fit. However, the AUROC values decreased by 8.1%, 7.9%, 1.2% and 10.9% in SJ, SXC, SCPP and ASWMU cohorts, respectively (Fig. 5B). The SVM model, which aims to find an optimal hyperplane to maximize the margin between classes, showed AUROC decreases ranging from 2.1– to 24.5% across all cohorts (Fig. 5C). The RF model, which achieves classification by constructing multiple decision trees, demonstrated slight decreases of 0.3%, 1.9%, and 0.9% in the SJ, SXC, and ASWMU cohorts, respectively (Fig. 5D). SHAP analysis revealed that the MCEN score was the most influential feature for the RF model, followed by the molecular subtype (Fig. 5F). The XGBoost model, an ensemble algorithm based on the gradient boosting framework, showed notable improvements across all six cohorts. The AUROC values increased by 1.2%, 0.5%, 2.7%, and 4% in SJ, SXC, SCPP, and ASWMU cohorts, respectively (Fig. 5E). Additionally, SHAP analysis highlighted the MCEN score as the most critical feature in the XGBoost model, followed by molecular subtype, with Ki67 showing less importance (Fig. 5G). Overall, the performances of the LR and XGBoost models were superior to those of the KNN, SVM and RF models. Among them, XGBoost achieved the most favorable balance between discrimination and generalization, with consistent AUROC gains across all external cohorts. Together with SHAP-based feature attribution, which facilitates transparent visualization of feature contributions, the XGBoost framework provides both strong predictive performance and clinically interpretable insights. Therefore, we selected XGBoost as the preferred model for integrating clinicopathological information into predictive analytics. Furthermore, to evaluate the incremental value of the image-based MCEN model, we compared a multivariable XGBoost model trained using only clinicopathological features with a counterpart that combined clinicopathological variables with image-derived features from the MCEN framework. After incorporating the MCEN model, AUROC performance improved by 15.0%, 8.0%, 4.5%, 6.0%, 0.2%, and 8.5% in the training, validation, SJ, SXC, SCPP, and ASWMU cohorts, respectively (Fig. 5A and Supplementary Fig. 4). These improvements highlight the complementary role of histopathological image features. Notably, we established a threshold of 0.497 based on the maximum Youden index to classify the MCEN score into high and low MCEN response categories, subsequently evaluating the predictive efficacy of combining this binary MCEN response with clinicopathological information. We observed that machine learning models using the binary MCEN response were generally less effective in predicting outcomes than those using the continuous MCEN score. For example, while the KNN (Supplementary Fig. 5B) and SVM (Supplementary Fig. 5C) models showed slightly better performance using the binary MCEN response compared to the continuous score, the LR (Supplementary Fig. 5A), RF (Supplementary Fig. 5D), and XGBoost (Supplementary Fig. 5E) models consistently performed better when using the continuous MCEN score. Among these, the XGBoost model achieved the best overall performance with the continuous MCEN score, with AUROC values higher by 5.8%, 4.6%, 1.9%, and 4.5% than those of the XGBoost model using the binary MCEN response in the SJ, SXC, SCPP, and ASWMU cohorts, respectively (comparison based on Fig. 5E and Supplementary Fig. 5E). Furthermore, to comprehensively assess the clinical utility and reliability of our predictive models beyond discriminative accuracy, we evaluated calibration curves and performed DCA. The calibration curves indicated that the combined MCEN + CPI (XGBoost) model (Supplementary Fig. 6C) achieved the best agreement between predicted probabilities and observed pCR proportions across cohorts, outperforming both the CPI-only (Supplementary Fig. 6A) and MCEN-only models (Supplementary Fig. 6B). DCA further corroborated the clinical value of the combined model, which provided the highest net benefit compared to the ‘treat all’, ‘treat none’, and single-modality strategies. Specifically, the combined model exhibited superior net benefit across broad threshold probability ranges: 0–100% in the training cohort (Supplementary Fig. 7A), 20–80% in the WC validation, SJ, and SXC cohorts (Supplementary Fig. 7B–D), and 20–60% in the SCPP and XNYK cohorts (Supplementary Fig. 7E–F). To further demonstrate the case-level interpretability of the XGBoost model, we generated local explanation visualizations (SHAP waterfall and force plots) for four representative patients (Supplementary Fig. 8). In the true positive cases (Supplementary Fig. 8A, B), a high MCEN score acted as the primary positive driver, either dominating the prediction independently or synergizing with favorable clinical features, such as molecular subtype, to yield a high probability of pCR. Conversely, in the true negative cases (Supplementary Fig. 8C, D), a critically low MCEN score strongly pulled the prediction toward non-pCR. Notably, in patient TN2 (Supplementary Fig. 8D), the visualizations illustrate the model’s clinical robustness: despite a favorable molecular subtype positively pushing the probability upward, the dominant negative impact of the low MCEN score correctly overrode this clinical feature, resulting in an accurate prediction of non-pCR. These local explanations highlight the transparency of the combined model and the critical, independent predictive value of MCEN score in individualized risk assessment. Subgroup performance of the MCEN + CPI (XGBoost) model across clinical subtypes To evaluate the robustness of the MCEN score–based model across different clinical subtypes, we constructed MCEN + CPI (XGBoost) models and performed subgroup ROC analyses in the training, validation, and four external cohorts (Supplementary Fig. 9). The subgroups included cT1–2 vs cT3–4, Ki-67 < 20% vs ≥20%, pre- vs postmenopausal status, and four molecular subtypes (HR + /HER2–, HR + /HER2 + , HR–/HER2 + , and HR–/HER2–). Overall, the MCEN + CPI (XGBoost) model retained good discrimination across most subgroups, with validation and external AUCs generally between 0.75 and 0.90. Relatively lower AUCs were observed in the HR–/HER2+ and HR–/HER2– subgroups in some external cohorts, likely reflecting the smaller sample sizes in these groups. Prognostic value of the MCEN score in a multivariate cox model Given the close association between treatment response after neoadjuvant therapy and long-term clinical outcomes, we evaluated the prognostic value of the MCEN model in the West China cohort. As a baseline, we first constructed a Cox proportional hazards model using only clinicopathological variables, including menopausal status, clinical T stage, molecular subtype, and the Ki67 index (Supplementary Fig. 10A, B). Multivariate analysis revealed that postmenopausal status, triple-negative subtype, high Ki67 index, and advanced T stage were all significantly associated with worse prognosis, confirming their roles as established risk factors. We then incorporated the MCEN score into the Cox model to assess its added prognostic value (Fig. 6A, B). Importantly, the same clinicopathological variables remained significant in the multivariate model, indicating that the inclusion of image-derived features did not confound the effects of traditional clinical predictors. Notably, higher MCEN scores were associated with improved prognosis and increased likelihood of treatment response. The Cox model integrating the MCEN score had a C index of 0.711 in the validation cohort (Fig. 6C), which was slightly better than the baseline model by 0.8% (Supplementary Fig. 10C). Furthermore, time-dependent AUROCs at 3, 5, and 7 years improved by 1.7%, 0.5%, and 2.2%, respectively, in the validation cohort (Fig. 6D and Supplementary Fig. 10D), demonstrating that the MCEN model provides complementary prognostic information beyond standard clinicopathological features.Fig. 6Prognostic value of the MCEN score in a multivariate Cox proportional hazards model based on the West China cohort.A Forest plot summarizing hazard ratios (HRs) and 95% confidence intervals (CIs) for variables in the multivariate Cox model, including menopausal status, clinical T stage, molecular subtype, Ki67 index, and MCEN score. B Nomogram for predicting 3-, 5-, and 7-year survival probabilities based on menopausal status, clinical T stage, molecular subtype, Ki67 index, and MCEN score. C C-index scores of the constructed Cox model in the training and validation sets, indicating strong predictive performance. D Time-dependent AUROC curves of the model at 3, 5, and 7 years in the validation cohort, demonstrating robust prognostic ability. Prognostic value of the MCEN score in a multivariate Cox proportional hazards model based on the West China cohort. A Forest plot summarizing hazard ratios (HRs) and 95% confidence intervals (CIs) for variables in the multivariate Cox model, including menopausal status, clinical T stage, molecular subtype, Ki67 index, and MCEN score. B Nomogram for predicting 3-, 5-, and 7-year survival probabilities based on menopausal status, clinical T stage, molecular subtype, Ki67 index, and MCEN score. C C-index scores of the constructed Cox model in the training and validation sets, indicating strong predictive performance. D Time-dependent AUROC curves of the model at 3, 5, and 7 years in the validation cohort, demonstrating robust prognostic ability. Discussion In this multicenter study, we developed and validated MCEN, a Mamba-based deep learning framework designed to predict pCR in patients with IBC-NST of the breast using pre-treatment needle biopsy specimens. Leveraging a large cohort of 1646 patients across five tertiary hospitals, MCEN demonstrated robust discriminative performance, achieving AUROCs of 0.923 in the derivation cohort and maintaining a range of 0.761–0.809 across four independent external test cohorts. These results indicate that MCEN possesses strong generalizability across heterogeneous clinical settings, overcoming a common hurdle in AI model deployment. Furthermore, the integration of MCEN scores with standard clinicopathological variables yielded the highest predictive accuracy (AUROC up to 0.840 in external validation), confirming that deep histological representations and established clinical factors offer complementary information, thereby enhancing the precision of NAC response prediction. Previous studies have explored multiple strategies for predicting pCR in breast cancer patients receiving NAC, including traditional clinicopathological models3, radiomics-based approaches40, and genomic signatures4. Conventional clinicopathological models, such as TIL-based correlation analyses, also have shown that patients with high TIL levels may achieve pCR rates of 45–50%3. However, their manual assessment is subject to significant inter-observer variability and fails to capture the full complexity of the tumor microenvironment. While deep learning that attempts utilizing Convolutional Neural Networks have reported AUROCs in the range of 0.67–0.74 for pCR prediction24,41, struggling to model global spatial relationships essential for characterizing tumor architecture. In addition, numerous prior studies have relied on labor-intensive, pixel-level or region-of-interest annotations by expert pathologists, which restricts both dataset size and model generalization42–44. Moreover, most existing models have been developed using single-center or relatively small cohorts23,35, increasing the risk of data distribution bias and limiting robustness in real-world, multi-institutional settings. Our study addresses critical limitations in both traditional pathological assessment and conventional computational pathology. First, unlike CNNs, which are limited by local receptive fields, and Transformers, which suffer from quadratic computational complexity, MCEN leverages a Mamba-based architecture tailored for histopathological feature aggregation. This design enables the efficient modeling of complex spatial and contextual relationships within the tumor and its microenvironment that are often missed by prior traditional methods. Second, to overcome the infeasibility of pixel-level annotation, we adopted a multiple-instance learning paradigm. Crucially, distinct from traditional MIL approaches that depend on offline, pre-extracted features which often lack domain specificity, MCEN integrates an online feature re-embedding module. This end-to-end design allows the model to adaptively refine instance-level representations, thereby improving its discriminative ability. The consistent performance across five independent cohorts demonstrates that MCEN retains strong predictive ability despite inter-cohort variability. Importantly, the integration of MCEN scores with clinicopathological variables further improved pCR prediction accuracy, supporting a complementary role between deep histological representations and established clinical factors. This finding aligns with previous studies suggesting that hybrid models incorporating both biomarker-driven and clinicopathological information can significantly enhance predictive power23,40. A critical barrier to the clinical adoption of AI is the “black box” nature of deep learning. Our interpretability analysis demonstrates that MCEN’s decision-making process is biologically plausible28. For non-pCR cases, MCEN preferentially attended to areas enriched with fibrosis24, clean adipose tissue, and intratumoral TILs36. In contrast, for pCR cases, it emphasized regions with high nuclear grade37, abundant stromal TILs45, and rich microvasculature39. These findings are broadly consistent with existing pathological literature on NAC response, lending support to the model’s underlying rationale. While the role of adipocytes in the TME is recognized, the observed association between clean fat tissue surrounding the tumor and treatment efficacy is less well documented and warrants further biological investigation, suggesting that MCEN may not only verify existing knowledge but also uncover novel biomarkers. Furthermore, it is important to note that the prominence and predictive value of these pathological patterns inherently vary across molecular subtypes. For instance, abundant stromal TILs and high nuclear grade are strongly associated with higher pCR rates primarily in triple-negative and HER2-positive breast cancers, whereas hormone receptor-positive tumors generally exhibit lower TIL infiltration and distinct stromal responses. Because the MCEN model was trained across a diverse, pan-subtype cohort, its self-attention mechanism implicitly captures the distinct morphological correlates of these molecular subtypes. The model dynamically weights features such as TILs and fibrosis depending on the broader spatial context of the whole-slide image. Future studies focusing on subtype-specific spatial attention analyses are warranted to further dissect these intricate, subtype-dependent tumor-stroma interactions and their precise roles in chemoresistance. Despite its strengths, this study has several limitations. First, as a retrospective analysis, it is inherently susceptible to selection and information biases. Although MCEN was evaluated across multiple independent external cohorts, differences in data sources and clinical practice patterns between centers may still have influenced the observed performance. We implemented early stopping (based on validation AUROC, with a patience of 30 epochs) and dropout regularization (rate 0.25) to mitigate overfitting; however, variations in patient demographics, clinical characteristics, histopathological processing, staining protocols, and data acquisition workflows across institutions are likely to affect model behavior. Global and pairwise chi-square tests (Supplementary Table 1) confirmed statistically significant differences in several key baseline characteristics, highlighting the real-world heterogeneity that any clinically deployable model must accommodate. To improve data homogeneity and model stability during training, we applied strict exclusion criteria, omitting patients with bilateral, multifocal, or rare histologic subtypes (such as invasive lobular, mucinous, or tubular carcinomas), nonstandard NAC regimens, incomplete clinical information, or poor-quality biopsy slides. Given that these special subtypes exhibit distinct tumor biology and stromal architectures compared to IBC-NST, including them with limited sample sizes could introduce significant morphological heterogeneity and noise, potentially destabilizing the training process. Therefore, we prioritized optimizing the model for the predominant IBC-NST population. While these criteria were necessary to control for confounders and ensure consistent input quality, they may limit immediate applicability to more complex or atypical clinical scenarios. Future work should therefore extend and recalibrate MCEN in broader patient populations and routine clinical workflows. Second, although stain normalization was applied to reduce inter-laboratory histological variation, residual technical heterogeneity remains a concern. Further standardization of tissue processing, staining, and scanning protocols, as well as prospective harmonization strategies, will be important for maximizing cross-site robustness. Third, while the present study included multiple independent institutions, prospective validation in larger, multi-national cohorts and pragmatic clinical trials is needed to confirm the model’s utility, assess its impact on clinical decision-making, and evaluate cost-effectiveness. Finally, although MCEN was specifically optimized and validated using needle biopsy specimens from IBC-NST, its generalizability to other specimen types (e.g., surgical resections) or other tumor entities remains to be determined. This study highlights the potential of the MCEN model, which is based on the Mamba deep learning framework, in predicting pCR in patients with breast cancer who undergo NAC and serves as a valuable decision-support tool in breast cancer treatment. Future research should concentrate on enhancing the model’s generalizability, further validating its clinical benefits, and exploring how to better integrate these advanced analytical tools more effectively into routine clinical practice. Additionally, the integration of multimodal data, including imaging, genomics, and clinical information, can enable the construction of more comprehensive and accurate predictive models, offering personalized treatment plans for patients with breast cancer. Furthermore, ongoing research should focus on enhancing and validating the interpretability of the model and leveraging these insights to optimize treatment strategies. Overall, the MCEN model has potential as a valuable clinical decision-support tool. Methods Study design and population This retrospective study included 1023 patients treated with NAC at West China Hospital (WC) from April 2010 to November 2023. The inclusion criteria were as follows: (1) age ≥18 years; (2) histologically confirmed primary invasive breast carcinoma of no special type (IBC-NST) via needle biopsy before NAC; (3) no distant metastasis; (4) receipt of ≥4 cycles of anthracycline, taxane, or anthracycline-taxane-based NAC with or without anti-HER-2 targeted therapy (the neoadjuvant chemotherapy regimens are listed in Supplementary Table 8); and (5) confirmation of pCR status through Miller‒Payne (MP) grading after surgery. The exclusion criteria were as follows: (1) missing or poor-quality biopsy slides; (2) history of other malignancies or prior treatments; (3) nonstandard or incomplete NAC regimens; (4) lack of complete pre-NAC clinicopathological data; (5) bilateral, multifocal, or special histologic subtypes of breast cancer; and (6) missing pathological response information. This retrospective study was conducted in accordance with the Declaration of Helsinki. Ethical approval was obtained from the Ethics Committee of West China Hospital of Sichuan University (Approval No. 2023 No. 2365). Furthermore, the study protocol was approved by the ethics committees of the four other participating hospitals: Shengjing Hospital of China Medical University (SJ), Shanxi Cancer Hospital (SXC), Sichuan Provincial People’s Hospital (SCPP), and Affiliated Hospital of Southwest Medical University (ASWMU). The requirement for written informed consent was waived by all participating ethics committees due to the retrospective nature of the study and the use of anonymized patient data. Pathological evaluation and data collection Histological sections from preoperative needle biopsies were collected from Shanxi Cancer Hospital, Sichuan Provincial People’s Hospital, and the Affiliated Hospital of Southwest Medical University and sent to West China Hospital for standardized processing and H&E staining. The samples from Shengjing Hospital were fixed in 3.7% neutral formalin, embedded in paraffin, sectioned at 4–5 µm, and stained using an automated system (VENTANA HE600, Roche). The digital slides were scanned at 40× magnification using a Hamamatsu NanoZoomer-XR C12002 and a Motic EasyScan 60. For each patient, a single representative WSI was selected based on its ability to support the most accurate pathological diagnosis. The selection was made by experienced pathologists, prioritizing the slide that, after immunohistochemistry (IHC), could best determine the molecular subtype of breast cancer. Factors considered included tissue quality (WSIs with artifacts such as folds, poor staining, or tissue damage were excluded) and the presence of sufficient viable tumor cells (typically at least 100 tumor cellularity) for molecular classification46. IHC was used to evaluate estrogen receptor (ER), progesterone receptor (PR), and HER2 status and the Ki67 index. ER/PR positivity was defined as nuclear staining in ≥1% of tumor cells46. HER2 status was defined as positive with IHC 3+ or fluorescence in situ hybridization (FISH) amplification and negative with IHC 0/1+ or no FISH amplification47. The Ki67 index was categorized as low ( ≤ 20%) or high (>20%)48. The clinical data collected included patient age at diagnosis, tumor size, lymph node status, and menstrual status. For downstream labeling, pathologists assessed NAC-treated breast cancer specimens using MP grading, with MP 1–4 defined as non-pCR and pCR as the absence of residual invasive cancer in the breast and regional lymph nodes (ypT0/Tis ypN0)49. Missing clinical data in the West China and SCPP cohorts were imputed using the mice package (v3.16.0) in R, applying a random forest-based multiple imputation method (method = “rf”). Five imputations were performed with a fixed random seed (500), and the final completed dataset was obtained using the complete() function. This non-parametric approach effectively handles nonlinear relationships and mixed data types. Image processing and MCEN model construction Following traditional multiple instance learning (MIL) methods30,50, our improved workflow for deep learning prediction includes three steps: (1) data preprocessing (Fig. 1A), (2) feature extraction using the CONCH model, and (3) online re-embedding with a transformer-based module and Mamba aggregation to generate final predictions from WSI patches (Fig. 1B). In the preprocessing step, we employed the CLAM toolbox50 to perform automated segmentation of tissue regions in H&E-stained WSIs. Each WSI was first downsampled (at a level of 4) and converted from RGB to the HSV color space. To smooth edges and reduce noise, median blurring (filter threshold = 11) was applied to the saturation channel before thresholding (segmentation threshold = 15) to generate a binary tissue mask. This was followed by morphological closing (kernel size = 2) to fill small gaps and remove artifacts. The contours of detected tissue regions were filtered based on a minimum area threshold of 1, using a four-point connectivity check to ensure robust segmentation. Instead of using Otsu’s method, threshold values were empirically determined based on an analysis of 200 breast cancer biopsy WSIs, optimizing for a tissue detection sensitivity above 95% while maintaining the background false detection rate below 5%. And the segmentation strategy was validated on an independent set of 100 WSIs. After rigorous background removal to exclude non-informative blank patches, WSIs X were tiled into nonoverlapping patches of 448 × 448 pixels at 20 × magnification, which can be represented as \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$X=\{{x}_{i}{\}}_{i=1}^{I}\,$$\end{document}X={xi}i=1I. The numbers of patches and WSIs are detailed in Supplementary Fig. 11. To mitigate the impact of staining variability on model generalization, we performed stain augmentation on patches and applied Macenko stain normalization51, using Supplementary Fig. 12 as the target image. This target image was obtained from the primary center (West China Hospital cohort). It was selected due to its well-balanced hematoxylin and eosin staining, where nuclei exhibit clear and consistent hematoxylin staining with well-defined contrast, while the cytoplasm and extracellular matrix show uniform eosin staining without excessive background variation. These characteristics ensure robust stain normalization and alignment with clinical H&E staining standards46. We utilized only the vision encoder of the CONCH model for feature extraction, generating 512-dimensional features from each tile52. The model architecture is based on the CoCa vision-language foundation model53, consisting of an image encoder, a text encoder, and a multimodal text decoder. The backbone consists of a standard vision transformer architecture with 12 transformer layers and 12 attention heads. This model maximizes the alignment of over 1.17 million image-text pairs, demonstrating its utility in various clinically relevant downstream tasks52. Despite aggregating discriminative features from pretrained models, we employed an online re-embedding regional transformer to fine-tune these features for the challenging task. The fine-tuning utilized involves regional multihead self-attention (R-MSA) and cross-region multihead self-attention (CR-MSA). R-MSA divides the bag into 8×8 regions, conducting self-attention within each region to highlight local features. Cross-region attention establishes correlations between these regions29,54,55. The fine-tuned embeddings are connected to a bidirectional Mamba MIL framework for linear complexity modeling, utilizing positional embeddings for visual sequence tagging and compressing visual representations with a bidirectional state space model34,35,56. Specifically, this process can be formulated as2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\hat{Y}{\mathscr{\leftarrow }}{\mathcal{M}}\left(X\right){\rm{:= }}S\left({\mathcal{A}}\left(R\left({\mathcal{F}}\left(X\right)\right)\right)\right)$$\end{document}Yˆ←MX≔SARFXwhere F(·) represents CONCH feature extraction, R(·) represents online re-embedding of useful features, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathcal{A}}\left(\cdot \right)$$\end{document}A· represents the mapping function based on Mamba feature aggregation and S(·) represents bag prediction. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\hat{Y}{\mathscr{\leftarrow }}{\mathcal{M}}{\mathscr{(}}X)$$\end{document}Yˆ←M(X) represents the MIL model \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathcal{M}}\left(\cdot \right)$$\end{document}M· for predicting the bag labels \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\hat{Y}$$\end{document}Yˆ of all instances. The online re-embedding R(·) is defined as follows:3\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$R:= {\rm{CR}}-{\rm{MSA}}\left({\rm{Norm}}\left({\rm{R}}-{\rm{MSA}}\left({\rm{Norm}}\left(H\right)\right)+H\right)\right)+{\rm{R}}-{\rm{MSA}}({\rm{Norm}}({\rm{H}}))+H$$\end{document}R:=CR−MSANormR−MSANormH+H+R−MSA(Norm(H))+H , where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$H=\{{h}_{i}{\}}_{i=1}^{I}{\mathscr{:= }}{\mathcal{F}}{\mathscr{(}}X)\in {{\rm{{\mathbb{R}}}}}^{I\times 512}$$\end{document}H={hi}i=1I≔F(X)∈ℝI×512 represents the CONCH instance features. Norm (·) denotes a normalization layer. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathcal{A}}\left(\cdot \right)$$\end{document}A· is defined as follows:4\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathcal{A}}{\mathscr{:= }}{SSM}\left({Conv}1d\left({Norm}\left(R\right)\right)\right)+R$$\end{document}A≔SSMConv1dNormR+R , where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${SSM}\left({Conv}1d\left({Norm}\left(R\right)\right)\right)$$\end{document}SSMConv1dNormR represents the vision Mamba block, where Conv1d(·) is the 1-D convolution. SSM(·) is the state space model. S(·) can be defined as follows:5\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$S{\rm{:= }}{Linear}\left({Softmax}\left({\mathcal{A}}\right)\right)$$\end{document}S≔LinearSoftmaxA \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${Softmax}(x)=\frac{{e}^{{x}_{i}}}{\mathop{\sum }\limits_{i}\,{e}^{{x}_{i}}}$$\end{document}Softmax(x)=exi∑iexi is the normalized exponential function. Linear represents a fully connected layer. The final output of the MCEN model is a continuous probability value ranging from 0 to 1, hereafter formally referred to as the MCEN score. The MCEN score represents the predicted likelihood of an individual patient achieving pCR following neoadjuvant chemotherapy. For interpretation, a score closer to 1 indicates a higher probability of achieving pCR, whereas a score closer to 0 suggests a higher probability of non-pCR. Feature extraction and multiple instance learning framework We established a robust experimental framework involving a comprehensive comparison of feature extractors and MIL methods, which formed the foundation of our predictive modeling approach. These components were carefully selected to address the challenges of medical imaging analysis, particularly in handling WSIs and predicting treatment responses across diverse cohorts. We evaluated three distinct feature extractors, all pretrained on pathological datasets, to extract meaningful representations from tiles: (1) ViT-Small (ViT-S/16), a vision transformer framework pretrained using the DINO self-supervised learning method57. This model employs a small-scale transformer architecture with 16 × 16 patch size to capture global contextual features from histopathological images. (2) CTransPath, a hybrid model combining CNNs and Swin Transformer architectures26. This approach integrates local feature extraction capabilities of CNNs with the long-range dependency modeling of transformers, making it suitable for complex pathological patterns. (3) Phikon is a pathology foundation model built on a ViT-based architecture using the iBOT framework and pretrained in a self-supervised manner with masked image modeling on over 40 million pan-cancer histopathological images. This domain-specific transformer backbone produces rich feature representations optimized for downstream computational pathology tasks58. Additionally, we incorporated the CONCH vision-language encoder, a pretrained model integrating visual and linguistic modalities, to explore its potential in enhancing generalization across datasets. Each feature extractor was implemented under identical experimental conditions, including input preprocessing steps (e.g., tiling of WSIs into patches, normalization), to ensure fair comparison. Following feature extraction, we employed a MIL framework to aggregate patch-level features into slide-level predictions, given the weakly supervised nature of our task. We compared several state-of-the-art MIL methods alongside our proposed approach: (1) ABMIL (Attention-Based MIL), this method implements an attention mechanism to weigh the importance of individual instances within a bag59, enabling interpretable predictions by focusing on key regions of the WSI. (2) CLAM (Clustering-Constrained Attention MIL), a framework that enhances WSI classification through cluster-constrained loss and single- or multi-branch attention mechanisms50, designed to improve discriminative power and robustness. (3) TransMIL, this approach integrates transformer networks into the MIL paradigm31, leveraging self-attention to update inter-instance embeddings and capture long-range dependencies across patches. (4) MeanPooling and MaxPooling, baseline MIL aggregation strategies50 that compute the average or maximum feature values across instances, respectively, providing simple yet effective benchmarks for comparison. For each method, we standardized the input features and optimized the models using consistent hyperparameters (learning rate, batch size) to ensure comparability. Building on the CONCH feature extractor, we developed the MCEN model, incorporating an online feature extraction module and a novel scanning strategy to enhance predictive performance. To systematically evaluate this module, we compared three scanning approaches: (1) Single-Direction Scanning (Mamba)60, a unidirectional scanning method that processes features sequentially in a single pass. (2) Bidirectional Scanning (BiMamba)34, a bidirectional approach that captures contextual information from both directions, potentially improving feature representation. (3) SRMamba35, an advanced scanning strategy designed to optimize efficiency and generalization by selectively refining feature updates. These three scanning schemes were evaluated under identical training and validation protocols to quantify their impact on predictive performance. Experimental setup and implementation details We trained the MCEN model using 5-fold cross-validation on the West China cohort, employing the validation set to determine the best model and assess its feasibility and generalizability on the four external test sets. The MCEN model training utilized the Adam optimizer61 with a weight decay of 1e-5 and a learning rate of 2e-4 for a maximum of 200 epochs. To prevent overfitting, we implemented early stopping with a patience of 30 epochs based on the validation AUROC. Importantly, to prevent premature termination during the initial feature-learning phase, early stopping was only permitted after epoch 130. This threshold was determined empirically based on preliminary pilot experiments, which indicated that the model required approximately 100 to 120 epochs to stabilize the validation AUROC and learn robust representations under the weakly supervised multiple instance learning framework. The batch size was set to 1 to accommodate the varying number of tiles per WSI, which led to variable input sequence lengths. All WSIs were processed on a system running Ubuntu 20.04.1, which was equipped with multicore central processing units and eight NVIDIA 4090 graphics processing units. The models and algorithms were implemented in Python 3.8.18. Integration of the MCEN model with clinicopathological information Combining MCEN model scores with clinicopathological information, we compared five machine learning models: linear logistic regression (LR), k-nearest neighbors (KNN), extreme gradient boosting (XGBoost), random forest (RF), and support vector machine (SVM). Statistical analysis Clinical feature distributions across cohorts were compared using Pearson’s chi-square test, or Fisher’s exact test. The primary metric for classification performance was the AUROC with 95% confidence intervals, implemented in the pROC R package (v.1.18.5). Statistical comparisons of AUROC values between different model variants were conducted using the DeLong test. We reported the average and standard deviation of model performance across a 5-fold cross-validation for each training, validation, and testing experiment. Single-factor logistic regression was used to assess conventional predictors, MCEN response and MCEN scores, followed by multifactor logistic regression and other machine learning algorithms. The Mann‒Whitney U test was used to compare the pCR score distributions between different outcomes when the data did not follow a normal distribution (Shapiro‒Wilk test p < 0.05). Statistical analyses were two-sided, with p < 0.05 indicating significance, and were conducted in R (v.4.3.2). To evaluate the clinical utility and probability estimation accuracy of the models, we performed decision curve analysis (DCA) to calculate the clinical net benefit across different threshold probabilities. Additionally, calibration curves were plotted to visually compare the predicted probabilities with the actual observed outcomes. Supplementary information Supplementary information Supplementary Data 1 Supplementary Data 2 Supplementary information Supplementary Data 1 Supplementary Data 2