Automated identification of keratinocyte cancers in pathology reports using large language models

Marloes Helder, Catherine M. Olsen, Nirmala Pandeya, Huanwei Wang, David C. Whiteman, Maciej Trzaskowski, Matthew H. Law

Abstract

Keratinocyte cancers (KCs) are the most prevalent cancers in white-skinned individuals, yet remain underrepresented in cancer registries because reporting requirements differ greatly across jurisdictions. Manual extraction of KC subtypes from medical reports is labor-intensive and time-consuming, particularly as reports often document multiple co-excised skin lesions. Artificial intelligence offers automated solutions for disease phenotyping from unstructured clinical text. 

Introduction

Keratinocyte cancers (KCs) are the most common cancers in predominantly white-skinned populations, with an estimated 69% of Australians having at least one excision for KC in their lifetime [1,2]. KCs account for the second-highest cancer-related costs in Australia, placing a substantial burden on the healthcare system, particularly among vulnerable groups like organ transplant recipients [3–5]. 

Methods

Ethics statement

All pathology data used in this analysis were derived from cohorts and collections that recruited participant with written informed consent. QSkin study ethical approval and oversight was provided by the QIMR Berghofer Human Research Ethics Committee (P1309, P2034, P3434). Further information about the QSkin cohort can be found in the cohort profile [21]. STAR cohort study participants provided written informed consent. 

Results

To evaluate how well the LLaMA model was learning across diagnosis, lesion site, and combined classification tasks, we first examined the training and validation loss curves (Fig 2 and S1 Fig). Training was conducted using 80% of the dataset (n = 20,943), while validation was performed on a further 10% (n = 2,618). The last 10% was held out to evaluate the model’s final performance (Table 1). The longest report in our dataset contained 4,317 tokens, which is far below the maximum context window of the model (32,000 tokens per record).

Discussion

Keratinocyte cancers represent the most common cancers in white-skinned populations, yet their true disease burden remains difficult to quantify due to differences in reporting practices and the unstructured nature of pathology reports. Manual extraction of KC diagnoses from medical reports is labor-intensive. Thus, although KCs result in substantial morbidity and treatment costs, reliable and up-to-date incidence statistics for these cancers are lacking [7].

Conclusion

Acknowledgments

The guarantor of this work is Marloes Helder.

Citation: Helder M, Olsen CM, Pandeya N, Wang H, Whiteman DC, Trzaskowski M, et al. (2026) Automated identification of keratinocyte cancers in pathology reports using large language models. PLOS Digit Health 5(7): e0001547. https://doi.org/10.1371/journal.pdig.0001547

Editor: Laura Sbaffi, The University of Sheffield, UNITED KINGDOM OF GREAT BRITAIN AND NORTHERN IRELAND

Received: April 28, 2026; Accepted: June 18, 2026; Published: July 9, 2026

Copyright: © 2026 Helder et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.

Data Availability: As the fine-tuned QSkin-llama-3.1-8b model weights were derived from personal information, these will be made available to researchers upon request and execution of a data use agreement. Requests should be directed to the QIMR Berghofer Research Integrity Office via rio@qimrb.edu.au. The base LLaMA-3.1-8B-Instruct model is publicly available from Meta (meta-llama/Llama-3.1-8B-Instruct ? Hugging Face). The training and inference code used in this study is available at MarloesHelderQIMRB/Pathologyreports_Extraction/ and is adapted from the code used in (Saluja et al., 2025). Data access contact information: Institution: QIMR Berghofer Medical Research Institute Contact: Research Integrity Office Email: rio@qimrb.edu.au.

Funding: MH is supported by the QIMRB international PhD scholarship and the QUT HDR Tuition Fee Sponsorship. DCW is supported by an Investigator Grant [2026567] from the National Health and Medical Research Council of Australia (NHMRC). HW was supported by an NHMRC Partnership grant [2030931]; an NHMRC Investigator grant [2034568]; Tour de Cure [RSP-271-2024] and philanthropic donations from The Great Priory of Queensland, Hand Hearts Pockets, and Brian and Merle Dwyer. This research was conducted with the support of the Australian Skin and Skin Cancer Research Centre through the ASSC Early Career Researcher Grant. The QSkin Study is supported by a Clinical Trials and Cohort Grant [APP1185416] from the National Health and Medical Research Council of Australia (NHMRC). The STAR Study was supported by a Program Grant from the National Health and Medical Research Council of Australia (no. 552429). The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.

Competing interests: I have read the journal’s policy and the authors of this manuscript have the following competing interests: DCW, CMO, NP receive consultancy funding from Medison Pharma for unrelated skin cancer research.