Imagine receiving a tissue biopsy from a patient with a rare thoracic tumor. The pathologist examines it under the microscope and provides a diagnosis, but the same slide, when reviewed by a colleague at another institution, might come back with a classification different from the original.

For thymic epithelial tumors (TETs), this is not an exception. It happens all the time, with diagnostic reclassification occurring in up to 57% of cases when a second expert opinion is sought.1,2
TETs, which include thymomas and thymic carcinomas, are rare tumors of the anterior mediastinum, arising from the thymus gland. They affect 0.23 to 0.30 people per 100,000 annually in the US.3
Despite their rarity, getting the diagnosis right carries real stakes: The treatment of thymic carcinoma—the most aggressive form—differs substantially from that of thymomas, including the use of targeted therapies and immune checkpoint inhibitors not typically used for less aggressive subtypes.4 A misclassification is not just a number on a pathology report; it can mean the wrong treatment for the patient.
The World Health Organization (WHO) classifies TETs into six subtypes: Type A, AB, B1, B2, B3, and thymic carcinoma.5 Each subtype is defined by subtle differences in the ratio of epithelial cells to lymphocytes, the degree of cellular atypia, and the preservation of normal thymic architecture. These distinctions can be difficult to discern, particularly at the boundaries between subtypes such as B1 and B2, or between B3 thymoma and thymic carcinoma.
The rarity of the disease makes everything harder. Most pathologists encounter only a handful of TET cases throughout their careers. Specialized expertise is concentrated in a small number of reference centers worldwide, and in many clinical settings, particularly outside major academic medical centers, access to that expertise simply is not available. A patient in a community hospital, or in a low- or middle-income country, may receive a diagnosis from a pathologist who has never seen a thymic tumor before.

Deep learning models have the potential to make things easier. Rather than replacing pathologists, these systems act as a second pair of eyes: A computational assistant that can analyze microscopic tissue images and suggest a classification, with a level of consistency that human reviewers—working under time pressure and with limited exposure to rare tumors—cannot always match.
Our group recently developed and validated a deep learning model specifically designed to classify all six WHO subtypes of TETs using only routine hematoxylin-eosin (H&E) stained slides, the standard preparation used in pathology labs around the world, requiring no special additional staining.6 The model was trained on whole-slide images from The Cancer Genome Atlas, a large publicly available dataset, and validated on 112 independent consecutive cases from the University of Chicago.
The model worked. In a clinically meaningful three-group classification, grouping tumors into type A/AB, type B1/B2/B3, and thymic carcinoma—categories that broadly correspond to different treatment strategies—the model achieved 91.1% accuracy. Perhaps most importantly, it correctly identified every case of thymic carcinoma, with 100% sensitivity, meaning it can properly identify the most aggressive subtype, allowing for appropriate treatment.
When asked to classify all six individual WHO subtypes, accuracy dropped somewhat to 77.7%, reflecting the complexity of distinguishing, for example, B1 from B2 thymoma. But here is the key insight: 60% of the errors the model made were between subtypes within the same treatment group. In other words, when the model was wrong, it was usually wrong in a way that would not change the treatment.
The system uses a technique called attention-based multiple instance learning, built on top of a large vision transformer model (H-optimus-0) pre-trained on more than 500,000 pathology slides. In practice, each slide is broken into thousands of small image tiles. The model examines every tile, assigns a probability score for each subtype, and then combines those scores, weighted by which tiles it “pays attention” to, into a final classification.
Crucially, the model can show its work. It generates visual heatmaps that highlight which regions of the slide drove the prediction, giving pathologists the ability to inspect the model’s reasoning, agree or disagree, and incorporate it into their own decision-making. That transparency matters for clinical trust.
What was impressive was not how accurate the model was, but how easy it was to use. The pipeline runs on standard laptop hardware, requiring only seconds to a few minutes per slide. The model builds on an open-source platform (Slideflow),7 and the code is publicly available, making this approach potentially accessible to institutions worldwide.
This matters because the burden of TET misdiagnosis falls disproportionately on patients in settings where thoracic pathology expertise is unavailable. A community oncologist in a resource-limited setting, faced with a challenging mediastinal tumor, could use this tool to get a second opinion, not from a consultant who may be unavailable, but from an algorithm that has been trained on expert-labeled cases from one of the world’s leading cancer genomics databases.
We want to be clear about what this tool is not. It is not a replacement for expert pathological review. It will not classify rare variants like micronodular thymoma or mixed tumors, which are absent from its training data. It has not yet been validated across multiple scanning platforms or in large prospective cohorts.
These are real gaps, and they will take time and larger multiple-institution studies to close. But the ambition here goes beyond better classification. Deep learning models have the potential to be useful throughout a patient’s care journey, from the first biopsy to treatment decisions and follow-up. We are not there yet, but this is a start.
References
- 1. Galli G, Trama A, Abate-Daga L, Brambilla M, Garassino MC, Fabbri A. Accuracy of pathologic diagnosis for thymic epithelial tumors: a brief report from an Italian reference Center. Lung Cancer. 2020 Aug;146:66-69. doi: 10.1016/j.lungcan.2020.05.007. Epub 2020 May 27. PMID: 32516667.
- 2. Molina TJ, Bluthgen MV, Chalabreysse L, de Montpréville VT, de Muret A, Dubois R, Hofman V, Lantuejoul S, le Naoures C, Mansuet-Lupo A, Parrens M, Piton N, Rouquette I, Secq V, Girard N, Marx A, Besse B. Impact of expert pathologic review of thymic epithelial tumours on diagnosis and management in a real-life setting: A RYTHMIC study. Eur J Cancer. 2021 Jan;143:158-167. doi: 10.1016/j.ejca.2020.11.011. Epub 2020 Dec 11. PMID: 33316754.
- 3. Hsu CH, Chan JK, Yin CH, Lee CC, Chern CU, Liao CI. Trends in the incidence of thymoma, thymic carcinoma, and thymic neuroendocrine tumor in the United States. PLoS One. 2019 Dec 31;14(12):e0227197. doi: 10.1371/journal.pone.0227197. PMID: 31891634; PMCID: PMC6938371.
- 4. Girard N, Ruffini E, Marx A, Faivre-Finn C, Peters S; ESMO Guidelines Committee. Thymic epithelial tumours: ESMO Clinical Practice Guidelines for diagnosis, treatment and follow-up. Ann Oncol. 2015 Sep;26 Suppl 5:v40-55. doi: 10.1093/annonc/mdv277. PMID: 26314779.
- 5. Marx A, Chan JKC, Chalabreysse L, Dacic S, Detterbeck F, French CA, Hornick JL, Inagaki H, Jain D, Lazar AJ, Marino M, Marom EM, Moreira AL, Nicholson AG, Noguchi M, Nonaka D, Papotti MG, Porubsky S, Sholl LM, Tateyama H, Thomas de Montpréville V, Travis WD, Rajan A, Roden AC, Ströbel P. The 2021 WHO Classification of Tumors of the Thymus and Mediastinum: What Is New in Thymic Epithelial, Germ Cell, and Mesenchymal Tumors? J Thorac Oncol. 2022 Feb;17(2):200-213. doi: 10.1016/j.jtho.2021.10.010. Epub 2021 Oct 22. PMID: 34695605.
- 6. Sacco, M.*, Pietroluongo*, E., Di Lello, A., Marino, M., McGeough, A., Esposito, A., Sharma, R., Husain, A. N., Arif, Q., Elsebaie, M. A., Pearson, A. T., Dolezal, J. M., & Garassino, M. C. (2026). Deep learning discriminates thymic epithelial tumors’ histological subtypes using digital pathology. Annals of oncology: official journal of the European Society for Medical Oncology, 37(4), 481–489.
- 7. Dolezal JM, Kochanny S, Dyer E, Ramesh S, Srisuwananukorn A, Sacco M, Howard FM, Li A, Mohan P, Pearson AT. Slideflow: deep learning for digital histopathology with real-time whole-slide visualization. BMC Bioinformatics. 2024 Mar 27;25(1):134. doi: 10.1186/s12859-024-05758-x. PMID: 38539070; PMCID: PMC10967068.
