Foundation Models and Large Language Models in Clinical Research
What GPT, Med-PaLM, and similar models are, how they differ from purpose-built clinical models, and where they fit (and don't fit) in clinical workflows.
Until about 2020, a medical AI model did one job. You trained a network to grade diabetic retinopathy and it graded diabetic retinopathy. A second task meant a second dataset and a second model.
Foundation models work differently. One very large model is trained once on a broad collection of data and then, later, adapted to specific tasks. The large language models (LLMs) behind ChatGPT are the best-known examples. There are two reasonable questions to ask about foundation models: can I use one in my study, and does this make purpose-built models obsolete? The answers are "for some things" and "no".
What a foundation model is
The term comes from a 2021 report by a group at Stanford. It describes a model with three properties.
It is trained on a large, broad dataset: a substantial part of the public internet, or millions of images from many sources.
It is trained by self-supervision, so nobody had to label that data. The model learns by predicting hidden parts of its input (see 1.2 Supervised, Unsupervised, and Self-Supervised Learning).
It can be adapted to tasks it was not specifically trained for, either by fine-tuning it on a small labeled set or simply by giving it instructions.
Almost all foundation models are transformers (see 1.3 Common AI Architectures in Medicine).
Large language models
An LLM is a transformer trained on text to predict the next word. That is the entire training objective. A model that does it well enough over enough text ends up able to summarize, translate, answer questions, write code, and ask lonely people about their day, because predicting the next word of a discharge summary requires some model of what discharge summaries say.
The general-purpose ones are the GPT models from OpenAI, Claude from Anthropic, Gemini from Google and Llama from Meta. There are also medical versions. Google's Med-PaLM was tuned for medical question answering and reached a passing score on US medical licensing exam-style questions. Earlier and much smaller models such as BioBERT and ClinicalBERT were trained on biomedical papers and clinical notes and are still used for narrow text tasks.
You instruct an LLM in plain language, called a prompt. Because of that, a clinician can get useful output from one in an afternoon with no training data and no engineer, which was never true of a CNN.
All is not honeycakes and butterflies, of course. Three properties cause most of the trouble.
LLMs produce fluent text whether or not it is true: truth isn't what they're trained for, they're trained to find a reasonable next word. They will invent a reference, a dose or a lab value in the same confident register as a correct one. This is called hallucination. It follows from how the model works, and it has become less frequent in newer models without going away.
They are not deterministic. Ask the same question twice and you can get two different answers. Various techniques can reduce this but it cannot be eliminated.
They change. A commercial model you reach through a website or an API is updated or retired by its vendor on the vendor's schedule. The model you validated in March may not be the one answering in September.
Foundation models for images
The same recipe has been applied to images. Vision-language models learn from images paired with text. CLIP, released by OpenAI in 2021, was trained on hundreds of millions of image-caption pairs from the web and can classify an image into categories it was never explicitly trained on, given only the category names. Medical versions have been trained on figures and captions from the biomedical literature and on radiographs paired with their reports.
Segmentation foundation models take a click or a box as a prompt and outline the object under it. Meta's Segment Anything Model (SAM) appeared in 2023, and MedSAM adapted it to medical images. They are useful for speeding up annotation: the model proposes an outline and the annotator corrects it.
Domain-specific models have been pretrained on large collections of one kind of image, such as pathology slides, retinal photographs or chest radiographs. A research group fine-tunes one of these on its own labeled cases and typically needs far fewer of them than it would starting from scratch.
That last use is where foundation models most often help a clinical imaging project. The model is a starting point, and you still train and validate a model of your own on top of it.
How they differ from a purpose-built model
| Purpose-built model | Foundation model | |
|---|---|---|
| Trained for | One task | No single task |
| Output | A fixed label, number or mask | Often free text, or whatever the prompt asks for |
| Same input, same output? | Yes | Not necessarily, for LLMs |
| Who controls the version | You | Often the vendor |
| Evaluation | Standard diagnostic accuracy study | Much harder for free-text output |
| Where the data goes | Usually your own servers | Often to the vendor's, unless you host it yourself |
I would like to draw your attention (ahem) to the Evaluation row. If a model outputs "pneumothorax: yes", you compare it to the reference standard and compute sensitivity. If it outputs a paragraph, someone has to decide what counts as correct, how to score an answer that is mostly right, and how to weigh an invented detail. Those questions don't have settled answers yet.
Passing an exam the way Med-PaLM did is weak evidence of clinical usefulness. Licensing exam questions are often tidy, just-so stories with one right answer. Clinical work involves incomplete information, deciding what to ask next, and knowing when not to answer.
Where they fit in research
These uses are reasonable now, provided a person checks the output:
- Pulling structured variables out of free text, such as extracting ejection fraction, tumor stage or smoking status from reports to build a research dataset. Validate it the way you would validate any abstraction method: have a clinician review a random sample and report the error rate.
- Producing first-pass labels from radiology or pathology reports for a training set. These are weak labels and do not belong in a test set (see 1.2).
- Pre-annotating images so that annotators correct outlines and don't have to draw them.
- Serving as the pretrained base for a model you fine-tune and validate yourself.
- Helping with code, literature search and drafting. Check every reference it gives you against the source, obviously. (Hopefully obviously.)
Where they don't fit
Do not use a general-purpose LLM to make or suggest a diagnosis or treatment for a patient without validating it for that use. Software that does so is a medical device and is regulated as one, however it was built (see 6.1 When Does Your AI Algorithm Become a Medical Device?).
Do not paste identifiable patient information into a public chatbot. Unless your institution has an agreement with the vendor that covers protected health information, you are disclosing it to a third party (see 2.7 De-Identification, Privacy, and Regulatory Compliance for Research Data).
Do not use one where the same input has to give the same output every time, or where you must be able to say exactly which version produced a result, unless you host a fixed version yourself.
And do not use one where a simpler tool does the job. To predict readmission from twenty variables, use logistic regression or gradient boosting.
If you use one in a study
Record the exact model name and version, the dates you ran it, the full prompt and all the settings. Without these nobody can reproduce your work, including you.
Prefer a model whose version you can pin. Open-weight models that you run on your own hardware cannot change underneath you, and the data never leaves the building.
Treat the prompt as part of the method. Fix it before you look at the test set. Adjusting a prompt until the test results improve is the same error as tuning any other model on its test data (see 3.2 Training, Validation, and Test Sets).
Measure errors on your own data, with your own patients' reports or images. Published benchmark scores do not transfer.
Keep in mind that a model trained on the public internet may already have seen any public dataset or exam you test it on, which inflates its score.
Purpose-built models are not obsolete
For a defined task with a clear output and enough labeled data, a model trained for that task is still the practical choice. It is smaller, cheaper to run, deterministic, under your control, and can be evaluated with methods regulators already understand.
What foundation models change is the starting point. In the future fewer projects will train from scratch, and more will fine-tune a pretrained model on a few hundred cases.
Key takeaways
- A foundation model is a large model trained by self-supervision on broad data and then adapted to many tasks. Large language models are foundation models for text.
- LLMs are instructed in plain language, which makes them easy to try. They also invent facts, can give different answers to the same question, and change when the vendor updates them.
- Imaging foundation models are most useful to researchers as a pretrained base for fine-tuning and as a tool for speeding up annotation.
- Free-text output is much harder to evaluate than a label, and exam performance says little about clinical usefulness.
- Reasonable research uses are data extraction, first-pass labeling, pre-annotation and fine-tuning, each with human checking and a measured error rate.
- Do not use an unvalidated general-purpose model for diagnosis or treatment, and do not send identifiable patient data to a public service.
- In a study, record the model version, dates, prompt and settings, and fix the prompt before touching the test set.
What to read next
- 1.5 Matching the Problem to the Approach: deciding whether your question needs a foundation model at all
- 1.6 What AI Cannot Do: Limitations and Common Misconceptions: the failure modes these models share with all AI
- 3.3 Transfer Learning: Standing on the Shoulders of Large Models: how fine-tuning works
- 2.7 De-Identification, Privacy, and Regulatory Compliance for Research Data: what you may send to an outside service
- 7.5 Transparency and Reproducibility: what to record so the work can be repeated
This article is part of the AI in Clinical Research Knowledge Base.