Skip to main content

10  A Primer on Foundational AI Models

10.1 What is artificial intelligence

If you ask people to define artificial intelligence (AI), you’re likely to get as many different answers as there are people. This is understandable, as the term itself is quite complex. For one, there’s nothing inherently “artificial” about the kind of intelligence we’re discussing. When a machine exhibits intelligence, the fact that it comes from a machine rather than a biological entity doesn’t make it any less real. The term “intelligence” is also tricky, even when applied to humans. Generally, when we talk about AI, we mean the ability of machines to perform tasks that we’d typically think require human intelligence.

But even this definition has its limits. Take a calculator, for example. It can perform operations far beyond what most humans can do (unless you’re someone who can easily multiply 295,425,376 by 692,968,124 - though even then, you’d probably be much slower). Yet, we don’t consider a calculator to be AI.

The term “artificial intelligence” goes back to the 1950s. In the summer of 1956, a group of leading computer scientists gathered for the “Dartmouth Summer Research Project on Artificial Intelligence.” Their goal was to explore the concept of thinking machines. This was a time of great technological optimism. The first electronic computer had been built just a decade earlier, and the transistor - a key invention that would drive the computer age - was beginning to be used in commercial products. Later that year, it would even win the Nobel Prize in Physics. The Dartmouth summer research proposal included this statement:

“[…] every aspect of learning or any other feature of intelligence can in principle be so precisely described that a machine can be made to simulate it. An attempt will be made to find how to make machines use language, form abstractions and concepts, solve kinds of problems now reserved for humans, and improve themselves. We think that a significant advance can be made in one or more of these problems if a carefully selected group of scientists work on it together for a summer.”

This text is striking for a few reasons. First, it shows a clear belief that if a human can do something intelligent, a machine can be made to do it too. Second, it emphasizes areas like language and abstractions, particularly the kinds of problems that, at the time, only humans could solve. In other words, AI was meant to address challenges that machines hadn’t yet tackled. (A modern take on this is the joke that AI is what doesn’t work yet - once something works, it’s no longer called AI.) Lastly, the idea that major progress could be made in just one summer seems overly optimistic now, but it reflects the spirit of the time.

Indeed, tasks like language comprehension or image recognition - things we humans do with relative ease - eluded computers for many decades after the 1956 workshop. Over the years, various approaches have been tried, each showing promise but ultimately falling short of fully solving these challenges. Sometimes, the gap between early excitement and eventual disappointment was so large that the term “AI winter” was coined. This period was marked by such pessimism about intelligent computers that it became nearly impossible to get support for AI research, causing many researchers to steer clear of the term altogether.

All of this started to change drastically in the early 2010s.

Three developments came together. First, the internet had produced data on a scale that nobody had seen before - billions of images, and trillions of words. Second, graphics cards, originally built to render video games, turned out to be extremely good at the kind of calculations needed to train artificial neural networks. And third, artificial neural networks themselves - an idea almost as old as the Dartmouth workshop (Rosenblatt 1958) - finally showed what they could do when given enough data and computing power.

10.2 Deep learning

An artificial neural network is loosely inspired by the brain. It consists of layers of simple units, or artificial neurons, each of which receives numbers from the units in the previous layer, multiplies them by weights, adds them up, and passes the result on to the next layer. The first layer receives the input - for example the pixels of an image - and the last layer produces the output, for example the probability that the image shows a mosquito. Learning means adjusting the weights, step by step, so that the output of the network gets closer to the correct answer for many training examples. A method to do this efficiently, called backpropagation, became popular in the 1980s (Rumelhart et al. 1986), but for a long time, networks with many layers - so-called deep networks - were notoriously hard to train, and they were not clearly better than other approaches.

The breakthrough came in 2012, in an annual competition in which algorithms had to recognize objects in images from ImageNet, a database of over a million images. A deep neural network called AlexNet made only 15.3% errors (with five guesses allowed per image), compared to 26.2% for the second-best entry (Krizhevsky et al. 2012). In a field used to incremental improvements, this was a sensation. Within a few years, deep learning - as the training of neural networks with many layers came to be called - dominated image recognition, speech recognition, and many other areas. We’ve already encountered some of its applications in this book, for example apps that recognize mosquitoes (Pataki et al. 2021) or food (Mohanty et al. 2022) in photos taken by participants. In 2024, the field was recognized at the highest level: the Nobel Prize in Physics went to John Hopfield and Geoffrey Hinton for their foundational work on machine learning with artificial neural networks1, and half of the Nobel Prize in Chemistry went to Demis Hassabis and John Jumper for AlphaFold, an AI system that predicts the three-dimensional structure of proteins (Jumper et al. 2021)2. Just like the transistor in 1956, AI had made it to Stockholm.

10.3 Language and the transformer

Language, however, remained difficult. Images consist of pixels, and pixels are numbers - but how do you turn words into numbers in a way that captures what they mean? An important step was the realization that words can be represented as long lists of numbers, so-called embeddings, which can be learned from the contexts in which words appear (Mikolov et al. 2013). Words that appear in similar contexts, such as influenza and flu, end up with similar embeddings.

The decisive step came in 2017, when researchers at Google introduced a new architecture for neural networks, called the transformer (Vaswani et al. 2017). At its heart is a mechanism called attention, which lets the network weigh, for every word in a text, how relevant every other word is to its meaning. In the sentence “The vaccine worked because it induced antibodies”, attention allows the network to figure out that “it” refers to the vaccine. Transformers turned out to be very good at learning from large amounts of text, and they could be trained efficiently on many graphics cards in parallel. In Chapter 8, we’ve already seen one of the first transformer models, BERT (Devlin et al. 2018), adapted to classify tweets about COVID-19 (Müller et al. 2023).

10.4 Foundation models

Around the same time, researchers at OpenAI began training transformers on a deceptively simple task: given a piece of text, predict the next word. Their first such model, GPT (Radford et al. 2018) - short for generative pre-trained transformer - was followed by GPT-2 in 2019 (Radford et al. 2019) and GPT-3 in 2020 (Brown et al. 2020). GPT-3 had 175 billion parameters (the weights we discussed above), and it could do something remarkable: perform tasks that it had never been explicitly trained for, such as translating text, answering questions, or writing code, simply by being shown a few examples. It also turned out that the performance of such models improves predictably with more data, more parameters, and more computation (Kaplan et al. 2020), which set off a race to train ever larger models (Figure 10.1).

Figure 10.1: Computation used to train notable AI models, by publication date (log scale). Each step on the vertical axis is a thousandfold increase. Models mentioned in this chapter are labeled. Data: Epoch AI.

In 2021, a group of researchers at Stanford University coined the term foundation models for this new class of models: models trained on broad data at scale that can be adapted to a wide range of tasks (Bommasani et al. 2021). The name captures both their promise and their risk. They serve as the foundation for many different applications - but any flaw in the foundation is inherited by everything built on top of it.

Predicting the next word, however, is not the same as being helpful. A model trained on text from the internet will happily continue a question with more questions, or produce text that is offensive or simply wrong. The missing ingredient was a second phase of training, in which models were fine-tuned on examples of good answers, and on human judgments about which of two answers is better - a technique called reinforcement learning from human feedback (Ouyang et al. 2022). The effect was striking: people preferred the answers of a fine-tuned model with 1.3 billion parameters over those of the original GPT-3, which was more than 100 times larger.

On November 30, 2022, OpenAI released a chat interface to such a fine-tuned model, called ChatGPT3. According to an analyst estimate, it reached 100 million users within two months, making it the fastest-growing consumer application in history at the time4. As I mentioned in the preface, ChatGPT unleashed developments that many had thought were years or even decades away. Models became multimodal, able to process images as well as text (OpenAI 2023), and later audio and video. In 2024, so-called reasoning models appeared, which are trained to work through a problem step by step before answering, leading to large improvements in mathematics, science, and programming5; a few months later, an openly available reasoning model showed that such capabilities were not limited to a few companies (Guo et al. 2025). And increasingly, models act as agents: instead of just answering a question, they use tools - searching the web, running code, reading and writing files - to complete tasks that require many steps. By the time you read this, all of this will have advanced further, which is why this chapter focuses on principles rather than on specific models.

10.5 How a language model works

Let’s take a closer look at what a large language model, or LLM, actually does. At its core, it does one thing: given a text, it calculates, for every word it knows, the probability that this word comes next. (Strictly speaking, models work with tokens, which can be words or parts of words, but we can ignore this detail here.) It then picks a word, adds it to the text, and repeats the process, word by word, until the answer is complete. Figure 10.2 lets you watch this process. Note that the model doesn’t simply pick the most likely word. Instead, it draws a word at random according to the probabilities, and a parameter called temperature determines how adventurous it is: at low temperatures, it almost always picks the most likely word, whereas at high temperatures, even unlikely words get picked from time to time. This is why you can ask the same question twice and get two different answers.

Figure 10.2: How a language model writes, one word at a time. At each step, the model calculates a probability for each candidate word, draws one at random according to these probabilities, adds it to the text, and repeats until the sentence is complete. The temperature controls how evenly the probabilities are spread. The probabilities shown are made up for illustration.

Predicting the next word sounds trivial, but it isn’t. To predict the next word in a medical textbook, a scientific article, or a news report about an outbreak, a model has to capture an enormous amount of knowledge about the world, and about how arguments are structured. Whether this amounts to understanding is still debated - but from a practical point of view, the capabilities are hard to deny. For example, on questions in the style of the US medical licensing exam, one of Google’s language models reached an accuracy of 67.6% in 2022 (Singhal et al. 2023), and a medically fine-tuned successor reached 86.5%, approaching the level of medical experts (Singhal et al. 2025).

The same mechanism also explains the main weakness of language models. They are trained to produce plausible text, not true text. When a model doesn’t know something, it may produce an answer that sounds right but isn’t - a phenomenon called hallucination. References are a classic example. In a 2023 study, 55% of the scientific references produced by GPT-3.5 were fabricated, compared to 18% for its successor GPT-4 (Walters and Wilder 2023). Newer models hallucinate less, and they can be connected to external sources, for example by first retrieving relevant documents and then answering based on them (an approach called retrieval-augmented generation). But the problem has not gone away, and in epidemiology, as in any field where accuracy matters, the output of a language model has to be checked.

Language models are not the only foundation models. The same recipe - train a large model on broad data, then adapt it to specific tasks - works for images, for genomes, for electronic health records, and for sensor data. For example, researchers at Apple trained a foundation model on optical pulse and electrocardiogram signals recorded by the Apple Watches of about 141,000 participants in the Apple Heart and Movement Study (Abbaspourazad et al. 2024), which we encountered in Chapter 9.

10.6 Foundation models in epidemiology

Throughout this book, we’ve encountered several ways in which foundation models are beginning to change epidemiology. Let’s bring them together, and look at what else is emerging. Recent reviews provide a good overview, both for public health in general (Panteli et al. 2025) and for the modeling of infectious disease epidemics in particular (Kraemer et al. 2025).

Text

The most obvious application is the analysis of text. In digital public health surveillance, language models can classify social media posts without any task-specific training data - although for now, models fine-tuned on carefully labeled data still perform better, and the best results come from combining the two (Guo et al. 2024). In our own work, we compared different ways of classifying the stance of tweets about vaccination. Few-shot prompting of GPT-4 - giving the model a handful of labeled examples - worked best, while most alternatives did no better than labeling every tweet as neutral, and crowd workers, a traditional source of labels, struggled in particular to recognize negative posts (Espinosa and Salathé 2024). Because performance varies strongly between tasks and models, with no single model being best everywhere, we also developed an open-source tool to benchmark language models on public health tasks (Espinosa et al. 2025). Ironically, language models make the analysis of text more powerful just as access to social media data is shrinking (Salathé and Mohanty 2025), as we’ve seen with the end of free research access to Twitter in Chapter 8.

Language models are just as useful for text that never leaves the health system. For example, a fine-tuned language model identified adverse social determinants of health, such as problems with housing or transportation, in the clinical notes of 93.8% of affected patients, compared to 2.0% identified through diagnostic codes (Guevara et al. 2024). Event-based surveillance systems, which scan news and other online sources for signs of outbreaks, increasingly use language models to sift through, summarize, and translate reports, as we’ve seen with BEACON and WHO’s EIOS in Chapter 8 - although published evaluations of how well they work in practice are still scarce. In clinical research, a language model that screened health records for patients eligible for a heart failure trial nearly doubled enrollment in a randomized trial (Unlu et al. 2025). And researchers are testing whether language models can help with systematic reviews, where thousands of titles and abstracts have to be screened: in one study, GPT-4 screened them more than ten times faster than humans, but initially missed a quarter of the relevant studies (Oami et al. 2024).

Modeling and forecasting

Foundation models are also starting to enter epidemiological modeling, the topic of Chapter 5 and Chapter 6. One approach is to train a model not on real data, but on a very large number of simulated epidemics from mechanistic models like the ones we’ve built in those chapters. In a retrospective comparison, such a model forecast the early COVID-19 pandemic in the US more accurately than every model submitted to the US COVID-19 Forecast Hub at the time (Dudley et al. 2026). Researchers have proposed going further, with foundation models for epidemics that learn the transmission dynamics of many pathogens and can then be adapted to a new outbreak with little data - which would be particularly valuable where surveillance data are scarce (Lau et al. 2026). At the same time, a major review of AI for modeling infectious disease epidemics cautioned that AI models often explain their predictions poorly and transfer poorly to new settings, that they don’t always beat simpler mechanistic models, and that they should be held to standards of calibration and explainability (Kraemer et al. 2025).

Health records, genomes, images, and sensors

Beyond text and time series, foundation models are being trained on entire health trajectories. A GPT-style model trained on the health records of 400,000 participants in the UK Biobank learned to predict the risk of more than 1,000 diseases, and its predictions held up when it was applied, without any changes, to 1.9 million people in Denmark (Shmatko et al. 2025). Similarly, language models trained on protein sequences rather than words have been used to rank the fitness of SARS-CoV-2 variants, anticipating which ones were likely to spread (Ito et al. 2025). As we’ve seen, foundation models for images make it possible to recognize disease vectors or food in photos taken by participants, and foundation models trained on sensor data could make the digital biomarkers we discussed in Chapter 9 more powerful. Some researchers envision a generalist medical AI that brings all of these data types together in a single model (Moor et al. 2023).

The daily work of epidemiologists

Perhaps the most immediate impact, however, is on the daily work of epidemiologists. Language models are very good at writing code, which means that analyses, simulations, and visualizations that used to require substantial programming skills are now within reach of many more people. In one study, machine learning models that ChatGPT built from clinical study data performed comparably to the models built by the original researchers (Tayebi Arasteh et al. 2024). The models we built in Chapter 5 can be written - and explained - by a language model in seconds. Agents can go a step further, downloading data, running analyses, and producing figures with little human intervention. But when an AI agent was asked to carry out complete clinical data analyses, its statistical plans were reliable, while its code contained systematic errors, and some of its written summaries contained clinically meaningful mistakes (Wu et al. 2026). This is enormously empowering, but it also shifts the burden from doing the analysis to checking it. An analysis that runs without errors is not necessarily correct, and the ability to judge whether a result makes sense - in other words, epidemiological expertise - becomes more important, not less.

10.7 Promise and evidence

If this chapter sounds enthusiastic, that’s because the developments are genuinely remarkable. But we should hold AI to the same standards as any other intervention in health. Performance on benchmarks, such as exam questions, is not the same as improving outcomes in practice. A systematic review of 519 studies evaluating language models in health care found that only 5% used real patient data, and almost half tested exam-style medical knowledge (Bedi et al. 2025), prompting some researchers to argue that it is time to retire the medical exam as a benchmark (Raji et al. 2025). How people use the models matters as much as the models themselves: in a randomized study with nearly 1,300 members of the public, language models on their own identified the medical condition behind a scenario in 95% of cases, but participants who used the same models identified it in fewer than 35% of cases, no better than a control group without AI (Bean et al. 2026). Recall the hierarchy of evidence from Chapter 3: a model that answers exam questions well is the equivalent of a promising result in the laboratory, not of a successful randomized controlled trial. Randomized trials of AI tools in health are still relatively few, and as we’ve seen in Chapter 9, there is not yet a single one showing that language models improve the retention of participants in studies.

Several other issues deserve attention. Models learn from data that contain biases, and they can reproduce or amplify them. Using cloud-based models with sensitive health data raises privacy questions, which is one reason why openly available models that can run on local computers are attractive for health applications. Models change frequently, which makes analyses hard to reproduce - a variant of the concept drift problem we discussed in Chapter 8. And when an AI-assisted decision turns out to be wrong, it is not always clear who is responsible. And the most capable models are trained by a handful of large technology companies, which raises questions of access and equity (Kraemer et al. 2025). We’ll return to several of these questions in Chapter 11.

In 1956, a group of scientists believed that a summer would be enough to make significant progress toward machines that use language, form abstractions, and solve problems reserved for humans. They were wrong about the timeline. Seventy years later, it seems they may not have been wrong about the destination.


  1. https://www.nobelprize.org/prizes/physics/2024/summary/↩︎

  2. https://www.nobelprize.org/prizes/chemistry/2024/summary/↩︎

  3. https://openai.com/index/chatgpt/↩︎

  4. https://www.theguardian.com/technology/2023/feb/02/chatgpt-100-million-users-open-ai-fastest-growing-app↩︎

  5. https://openai.com/index/learning-to-reason-with-llms/↩︎