Repository logo
 

LLM-based reconstruction of longitudinal clinical trajectories in chronic liver disease

Accepted version
Peer-reviewed

Change log

Abstract

Liver cancer primarily develops in patients with chronic liver disease (CLD), yet most cases are diagnosed at advanced stages with poor prognosis. While CLD surveillance generates extensive longitudinal data, its free-text nature hinders large-scale research. To address this, we developed a scalable framework using open-source LLMs with constrained decoding to process unstructured text across radiology, pathology, and transplant assessment domains. A calibration set comprising 507 reports from 30 patients was manually annotated to benchmark four LLMs against a regu- lar expression baseline across 70 tasks. Llama-3.3-70B performed best, exceeding 90% accuracy on 59/70 tasks, outperforming Llama-3.1-8B (a smaller variant), OpenBioLLM-70B (a medically fine-tuned model), and DeepSeek-R1-8B. Constrained decoding achieved >99.9% format adher- ence, far surpassing unconstrained prompting (87.4%). Applied to the full cohort, the pipeline analysed 22,493 reports to generate a patient-level database of 29,225 datapoints (35 variables, 835 patients) without manual annotation. Further analysis confirmed known liver cancer risk factors (male sex, viral hepatitis, smoking, diabetes), and allowed for reconstruction of individ- ualised disease timelines. This work provides a scalable blueprint for transforming real-world clinical free-text into structured formats and personalised patient trajectories. Future applica- tions have the potential to accelerate data-driven research into early cancer detection within complex pre-cancerous diseases like CLD.

Description

Keywords

Journal Title

npj Precision Oncology

Conference Name

Journal ISSN

2397-768X
2397-768X

Volume Title

Publisher

Nature Portfolio

Publisher DOI

Publisher URL

Rights and licensing

Except where otherwised noted, this item's license is described as Attribution 4.0 International
Sponsorship
MRC (MR/X00970X/1)
Cancer Research UK (DRCPFA-Jun22\100001)
H.P. was supported by AstraZeneca UK Limited and the NIHR BioResource (G127831). M.H. was supported by a CRUK Programme Foundation Award (DRCPFA-Jun22/100001) and an MRC research grant (MR/X00970X/1). M.C.O. was supported by the Joseph Mitchell Cancer Research Fund, the Academy of Medical Sciences (G117526) and NIHR (NIHR206092).