This repository contains source code for our manuscript: "Large language model (LLM) based natural language processing (NLP) improves detection of overall and recurrent venous thromboembolism (VTE) in patients with cancer"
- Python 3.9
- For LLM model, we used Claude Sonnet 4.5 through AWS Bedrock api.
- To run the pipeline, download the VTE-BERT models at this link, and install Transformers 4.55.0
To reduce the number of input tokens, we used this preprocessing:

For more detail visit this repo: https://github.com/Ang-Li-Lab/NLPMed-Engine
-
VTE-LLM process:
-
VTE-BERT + VTE-LLM process: VTE-BERT plays as a screening tool that filters out patients without evidence of VTE at the note level, reducing the number of patients requiring VTE-LLM inference.
VTE-LLM on distinct level results at Harris Health System:
| Classified \ Actual | Positive | Negative | Metric |
|---|---|---|---|
| Positive | 245 (TP) | 14 (FP) | PPV = 95% |
| Negative | 16 (FN) | 192 (TN) | NPV = 92% |
| Metric | Sensitivity = 94% | Specificity = 93% | 467 events |
VTE-BERT+VTE-LLM on distinct level results at Harris Health System:
| Classified \ Actual | Positive | Negative | Metric |
|---|---|---|---|
| Positive | 239 (TP) | 12 (FP) | PPV = 95% |
| Negative | 22 (FN) | 199 (TN) | NPV = 90% |
| Metric | Sensitivity = 92% | Specificity = 94% | 472 events |
For more results including external validations, incident and recurrent VTE detection metrics, please refer to our full paper.
We provided some examples how to run the pipeline, the direct LLM, and post processing in notebooks/example_pipeline.ipynb
Please cite our work when using the code, methodology, or results in publications, presentations:
@article{pham2026vte,
title={Large language model (LLM) based natural language processing (NLP) improves detection of overall and recurrent venous thromboembolism (VTE) in patients with cancer},
author={Dang Pham*, Aidan Boyne*, Jennifer La, D. Siamack Ayandeh, Barbara Lam, Mrinal Ranjan, Juan Bueno, Emma Kitchel, Melkon Harutunian, Gongliang Zhang, Nathanael Fillmore, Omid Jafari, Ang Li},
journal={...},
publisher={...},
year={...},
doi={...}
}