How these systems work

From the eGFR on a chemistry panel to the next word

AI in Medicine · Week 1 · AIM-1 and AIM-2 · 60 minutes live, about 60 minutes on your own

Three rules for every session

  1. No patient information in any chatbot, including your school’s, unless your hospital’s privacy office has approved that tool in writing.
  2. Check it before it counts. A claim you have not checked is not a fact yet.
  3. You sign the note. Whatever helped write it, you are responsible for it.

Rule 2 follows from how these systems are built, and today you will see why. Rule 1 follows from who receives what you type.

What you will be able to do

By the end of this session you can

  1. Say how AI, machine learning, deep learning, and generative AI fit inside each other.
  2. Say what the eGFR was learned from: its inputs, its output, the people it was fit to, and what fitting it meant.
  3. Sort any model with two questions.
  4. Explain why a model’s score on cases it has already seen tells you nothing, and what the three sets are for.
  5. Say in one sentence why a chatbot can give you a citation that does not exist.
  6. Ask a chatbot to check its own facts and citations, and say what that check does not catch.

The hour

Block Minutes
Start 5
The eGFR, and how models learn 26
From tables to words 17
Back to the clinic 9
Questions 3

You need: a browser. Nothing to install, and no account. You will try things on the slides as we go.

Click outside a slider or answer box before using the arrow keys. The narration is also available as text.

Four words, each inside the one before

Four nested circles. The largest is artificial intelligence: a computer doing a task that seems to need judgment, such as MYCIN in the 1970s, whose rules were written by hand. Inside it is machine learning: the rules are learned from data, such as the eGFR equation. Inside that is deep learning: machine learning with many layers, a neural network, such as a model that reads chest X-rays. The smallest is generative AI: deep learning that writes new text or makes images, such as a chatbot.

Each is one kind of the one around it. Yesterday we saw how we got here. Today: how the models inside these circles are made.

Part 1 The number nobody measured

Pre-op clinic, surgery sub-internship

A 62-year-old woman is booked for a laparoscopic cholecystectomy. Her basic metabolic panel is back.

The attending asks: are her kidneys all right for the contrast CT?

You say: “eGFR 57, stage 3a, mildly reduced. Probably fine with hydration.”

Basic metabolic panel · collected 07:12
Sodium 139 136–145
Potassium 4.1 3.5–5.1
Creatinine 1.10 0.50–1.10
eGFR (CKD-EPI 2021) 57 L >60
Units: mmol/L; creatinine mg/dL; eGFR mL/min/1.73 m². Illustrative panel, made up for this course. Not a real patient.

Where does the 57 come from?

Nobody measured her GFR

  • Measuring GFR means infusing a marker the kidney filters and does nothing else with, such as iohexol, and timing how fast it clears.
  • That takes hours. It is rarely done in routine care.
  • The 57 was computed from creatinine, age, and sex.

Something turned three numbers into a kidney function.
You trusted it enough to clear her for contrast.

Where did the equation come from?

Not from physiology.
It was learned from data.

A few thousand people did have their GFR measured. A computer was given their creatinine, age, and sex, and one instruction: find the formula that best predicts the measured number.

The eGFR is a model. Remember her: 45 kg, and a year of muscle loss.

Fit the curve yourself

Illustrative data, not the CKD-EPI data. A simpler curve than the real eGFR.

GFR = a × creatinine−b

a: the GFR when creatinine is 1.0. b: how fast GFR falls as creatinine rises.

Fitting means a computer turns these dials until the error is as small as it can get.

● one made-up person · thin line: how far the curve misses them · thick line: the curve your dials make. Generated in your browser.

Part 1, continued The loop every model comes from

What the equation connects

Diagram. Age, sex, and creatinine, the three things the lab has, feed an equation learned from 8,254 people whose GFR was measured. The equation outputs the eGFR on your panel, which stands in for measured GFR, rarely done in routine care. A grey box, muscle mass, diet, and drugs that block secretion, changes creatinine without changing GFR.

Redrawn from the description of the CKD-EPI 2021 development (Inker et al., 2021).

A proxy is a number you use in place of the one you want, because the one you want is hard to get. Here the eGFR, calculated from three lab values, stands in for measured GFR.

Five words for the rest of the course

Word Meaning In the eGFR
Predictors the inputs creatinine, age, sex
Response what is being predicted measured GFR
Training set the cases used to fit the equation 8,254 adults in 10 studies, mostly research participants; 31.5% Black
Test set cases held back to check it afterwards 4,050 people in 12 other studies
Model the equation once fit eGFR = f(creatinine, age, sex)

f stands for function: a rule that turns inputs into an output. Fit means a computer tried numbers in the equation until its predictions were as close to the measured values as they could get (Inker et al., 2021).

One equation, three generations

Equation Learned from Where it failed, and for whom
MDRD, 1999 1,070 patients who already had kidney disease (558 more held back to test it) Values too low at higher GFR, so healthy people were labelled as diseased (Levey et al., 1999; Levey et al., 2009)
CKD-EPI, 2009 8,254 people in 10 studies Included a race term. Even with it, the equation overestimated measured GFR in Black adults (median 3.7 mL/min/1.73 m²). An overestimate makes kidney disease look milder than it is (Inker et al., 2021)
CKD-EPI, 2021 the same 8,254, refit without race Now a few mL/min too low in Black adults and too high in others. A version that adds cystatin C, a second blood marker that does not depend on muscle, is more accurate (Delgado et al., 2021; Inker et al., 2021)

The training population is part of the model,
as much as the equation is.

The loop, drawn once

Diagram. Raw material such as labs, images, notes, or text becomes predictors. The truth for each case, such as measured GFR, sepsis yes or no, or the next word, joins them in a learning step that finds f so that truth is approximately f of predictors. The result is a model. A new case with unknown truth goes through the model to give a prediction.

The loop every learned model comes from. The symbol ≈ means “approximately equal to”.

The eGFR, a sepsis alert, and a chatbot all come from this loop. Only the contents of the boxes differ.

Two questions sort any model

Question If yes If no
Does the training data contain the answer? Supervised Unsupervised
If supervised: does the model give a category? Classification Regression (a number)

A regression is wrong by an amount. A classification is wrong by a kind: a miss or a false alarm. A miss costs the patient who was missed. A false alarm costs the staff who answer it, and the patient worked up for nothing.

Try it: sort four models

Cases it has already seen prove nothing

Fit a formula to 8,254 people, then report how well it predicts those same people, and you have measured how well it memorized them.

A separate test set is the least you should accept.
A number with no test set is not a number yet.

The usual rule is three sets: a training set to fit the model, a validation set to choose between models, and a test set, used once, at the end.

Too simple, too flexible

● cases the model learns from · ○ cases held back for testing · dashed: the real pattern, which the model never sees. Made-up data, generated in your browser. Bias: the error of a model that is too simple. Variance: the error of a model that is too flexible.

Simple models are easier to check

Simple: the eGFR equation

  • A handful of numbers. You can read each one.
  • You can check them against what you know: higher creatinine, lower eGFR.
  • A few thousand people were enough to fit it.
  • It can only follow the shape its equation allows.

Flexible: a neural network

  • Thousands to billions of numbers. Nobody reads them one by one.
  • It can fit complex patterns: an image, a sentence.
  • It is harder to explain why it gave one answer.
  • It needs much more data, or it fits the noise, as on the last slide.

More flexible: more patterns it can fit,
less you can explain, more data it needs.

A model is interpretable when a person can read why it gave its answer.

You saw this sepsis model yesterday

Here is why it belongs in today’s talk: it is the same failure, on new patients. A vendor sepsis model, in use at hundreds of US hospitals in 2021, was tested at one academic center on 38,455 hospitalizations (2018 to 2019), by people who had not built it (Wong et al., 2021).

  • About 7 in 100 admissions had sepsis.
  • Area under the curve 0.63 (0.5 is chance; 1.0 is perfect).
  • It missed 67% of patients with sepsis.
  • It alerted on 18% of all admissions, so most alerts were for patients without sepsis.

Two grids of 100 squares. Left: of 100 patients who had sepsis, 33 got an alert and 67 did not. Right: of 100 admissions of any kind, 18 set off an alert.

Redrawn from the numbers reported by Wong et al. (2021).

A test on patients from a different setting than the ones the model was built on is called external validation. No alert does not mean no sepsis.

The published number is the optimistic one

A model’s performance on the cases it was built from is usually the optimistic number.

Ask what it was trained on.
Ask what it was tested on, and by whom.
If those are the same, you have learned nothing yet.

Part 2 From tables to words

A language model is the same loop, with a different table

the patient was started on empiric vancomycin

Predictors: the words so far Truth: the next word
the patient
the patient was
the patient was started
the patient was started on
the patient was started on empiric
the patient was started on empiric vancomycin

Nobody labels anything. Every sentence ever written is already a table like this.

The model reads tokens, not words

A token is a word or a piece of a word.

The real tokenizer used by OpenAI’s GPT-4o models (o200k_base), from the open-source gpt-tokenizer library. It runs in your browser: nothing you type leaves your computer. Other models split text differently.

Words become numbers

Illustrative scatter. Four antibiotics sit together at upper left, three loop diuretics together at upper right, and three days of the week together at the bottom, far from both drug groups.

Illustrative: positions placed by hand to show the idea, not computed from a model.

Each token becomes a list of numbers called an embedding. Tokens used in similar sentences get similar numbers.

Predict, pick, repeat

Temperature is a setting: how willing the model is to pick less likely words. Whole words are used here instead of tokens, to keep it readable.

Watch: inside the model (8 min)

3Blue1Brown, Large Language Models explained briefly, 20 November 2024, 7 min 58 s, on YouTube with captions. Transcript at 3blue1brown.com/lessons/mini-llm.

A second training stage shapes the answers

  • People are paid to compare pairs of answers and say which they prefer.
  • The model is adjusted toward the preferred kind. The literature calls this reinforcement learning from human feedback (Thirunavukarasu et al., 2023).
  • This is what turns a text-completer into an assistant that answers your question in paragraphs.

It is trained toward answers people rate well.
That is not the same as answers that are true.

Nothing in this process checks whether a claim is true

At no step does the model itself look anything up, consult a database, or compare a statement to the world.

A real citation and a made-up one are both plausible ways to continue “the original paper was”.

The model itself has no checking step. Today’s chatbots can add one around it, if you ask: a web search, or a second pass over their own answer. More on that in a moment.

What that looks like when it reaches you

Made-up exchange, not a real chatbot’s output. Do not use it as a source for the HEART score.
What are the exact point values and cutoffs for the HEART score, and what is the original publication?
The HEART score assigns 0–2 points each for History, ECG, Age, Risk factors, and Troponin, for a total of 0–10. Patients scoring 0–3 are low risk (about 1.7% risk of a major adverse cardiac event at 6 weeks) and can be discharged; 4–6 is intermediate (about 12–17%); 7–10 is high risk (about 50–65%) and warrants early invasive management.

Original publication: Backus BE, Six AJ, Kelder JC, et al. “A prospective validation of the HEART score for chest pain patients at the emergency department.” Int J Cardiol. 2013;168(3):2153–2158.

The paper named is real: a 2013 study that tested the score (Backus et al., 2013). The score was first described in 2008, in a different journal (Six et al., 2008).

What this does and does not mean

  • It does not mean the answer is usually wrong. On common, well-documented questions, the most plausible continuation is often the fact.
  • It means the error rate is not zero, and the tone does not change when the answer is wrong.
  • A made-up citation reads exactly like a real one.

If you distrust these tools, that is partly justified: they can be wrong in a confident voice. Checking every claim is a skill. Keep it.

Ask it to check

Add this to your question, or send it after the answer

Check each fact and citation
in your answer using web search.

For each one, give a link
(PubMed or the DOI) and a short
quote from the source that
supports it.

Mark anything you could not find.
  • Search helps. Versions with web search gave more accurate references than without (Pastucha et al., 2026).
  • A second pass helps. A model that checked its own draft made fewer false claims (Dhuliawala et al., 2024).
  • Neither makes it perfect. With web search, about 3 in 10 statements were not supported by the source cited (Wu et al., 2025).
  • It cannot check your patient. In most setups the chatbot cannot see the chart. Facts about the patient are still yours to check.

Let it check the literature. Open the link yourself before it goes in a note.

Part 3 What this changes for you

Back to the pre-op clinic

  • She weighs 45 kg and has lost muscle over a year of illness.
  • Creatinine comes from muscle.
  • Her creatinine of 1.10 is a normal number for a normal amount of muscle. She does not have a normal amount of muscle.
  • So her true GFR is probably lower than 57.

Name her model’s predictors, response, and training population.

What do you now say to the attending?

“The 57 is estimated from her creatinine. With her low muscle mass it probably overstates her kidney function. If the decision depends on it, I would ask for a cystatin C-based eGFR.”

It matters most for a renally dosed drug, or if her true value could be near your radiology department’s contrast threshold. A national task force recommends wider use of cystatin C, especially to confirm the estimate (Delgado et al., 2021).

Nobody told her a model was involved. Whether someone should have is a question for the patient communication session.

On the wards

  • An alert fires, or stays quiet. No alert does not mean no sepsis. If you silence one, be able to say why.
  • A chatbot gives you a fact or a citation. Ask it to check with web search and give links. Open the source before it goes in a note or an order.
  • A tool drafted your note or message. Read all of it before you sign. You are responsible for what it says.
  • Patient information. Not in any chatbot, unless your hospital’s privacy office has approved that tool in writing.
  • Documentation. What to record when a tool helped depends on your site’s policy. Ask your supervisor.

Ask it to check, with links.
Open the source before it goes in the chart.

The standing question

What does this change about how you’ll practice?

Write it down before you close this deck. Then one more: the next time a chatbot gives you a citation, what will you do in the next two minutes? For example: ask it to check with web search, then open the link.

Thursday: we open ChatGPT Edu together and use it to set up your own learning goals and journal.

Summary

  • AI contains machine learning, which contains deep learning, which contains generative AI.
  • The eGFR is a model learned from data: creatinine, age, and sex in; a stand-in for measured GFR out; 8,254 adults as the population it was fit to. Fitting chose its numbers to make the error as small as possible.
  • Supervised has the answer in the training data; unsupervised does not. Classification gives a category; regression gives a number.
  • A score on the training data describes the fit. Ask for the test set, and who ran it.
  • A language model predicts the next token, picks one, and repeats. People then tune it toward answers they rate well.
  • Nothing in that process checks whether a claim is true. You check it, and you sign it.
  • Ask it to check with web search and give links, then open the source. It cannot check your patient; that is still yours.

Further exploration

Try: overfitting you can see

TensorFlow Playground, 10 minutes, no account. Open step 1 (too simple), step 2 (in between) and step 3 (too flexible). At about 500 epochs, compare training loss with test loss.

Watch: inside a language model

3Blue1Brown, Transformers, the tech behind LLMs (first titled But what is a GPT?), April 2024, 27 minutes. A visual tour of the inside of the model, including attention.

Watch: how chatbots are built

Andrej Karpathy, Intro to Large Language Models, November 2023, 1 hour. How chatbots are trained, step by step.

Read: when the patients change

The clinician and dataset shift in AI, NEJM, 2021. Why models fail on new kinds of patients.

References

Backus, B. E., Six, A. J., Kelder, J. C., Bosschaert, M. A. R., Mast, E. G., Mosterd, A., Veldkamp, R. F., Wardeh, A. J., Tio, R., Braam, R., Monnink, S. H. J., Tooren, R. van, Mast, T. P., Akker, F. van den, Cramer, M. J. M., Poldervaart, J. M., Hoes, A. W., & Doevendans, P. A. (2013). A prospective validation of the HEART score for chest pain patients at the emergency department. International Journal of Cardiology, 168(3), 2153–2158. https://doi.org/10.1016/j.ijcard.2013.01.255
Delgado, C., Baweja, M., Crews, D. C., Eneanya, N. D., Gadegbeku, C. A., Inker, L. A., Mendu, M. L., Miller, W. G., Moxey-Mims, M. M., Roberts, G. V., St Peter, W. L., Warfield, C., & Powe, N. R. (2021). A Unifying Approach for GFR Estimation: Recommendations of the NKF-ASN Task Force on Reassessing the Inclusion of Race in Diagnosing Kidney Disease. American Journal of Kidney Diseases : The Official Journal of the National Kidney Foundation, 79(2), 268–288.e1. https://doi.org/10.1053/j.ajkd.2021.08.003
Dhuliawala, S., Komeili, M., Xu, J., Raileanu, R., Li, X., Celikyilmaz, A., & Weston, J. (2024). Chain-of-verification Reduces Hallucination in Large Language Models. Findings of the Association for Computational Linguistics ACL 2024, 3563–3578. https://doi.org/10.18653/v1/2024.findings-acl.212
Finlayson, S. G., Subbaswamy, A., Singh, K., Bowers, J., Kupke, A., Zittrain, J., Kohane, I. S., & Saria, S. (2021). The Clinician and Dataset Shift in Artificial Intelligence. The New England Journal of Medicine, 385(3), 283–286. https://doi.org/10.1056/nejmc2104626
Inker, L. A., Eneanya, N. D., Coresh, J., Tighiouart, H., Wang, D., Sang, Y., Crews, D. C., Doria, A., Estrella, M. M., Froissart, M., Grams, M. E., Greene, T., Grubb, A., Gudnason, V., Gutiérrez, O. M., Kalil, R., Karger, A. B., Mauer, M., Navis, G., … Levey, A. S. and. (2021). New Creatinine- and Cystatin C-Based Equations to Estimate GFR without Race. The New England Journal of Medicine, 385(19), 1737–1749. https://doi.org/10.1056/nejmoa2102953
Levey, A. S., Bosch, J. P., Lewis, J. B., Greene, T., Rogers, N., & Roth, D. (1999). A more accurate method to estimate glomerular filtration rate from serum creatinine: A new prediction equation. Modification of Diet in Renal Disease Study Group. Annals of Internal Medicine, 130(6), 461–470. https://doi.org/10.7326/0003-4819-130-6-199903160-00002
Levey, A. S., Stevens, L. A., Schmid, C. H., Zhang, Y. L., Castro, A. F., Feldman, H. I., Kusek, J. W., Eggers, P., Van Lente, F., Greene, T., & Coresh, J. and. (2009). A new equation to estimate glomerular filtration rate. Annals of Internal Medicine, 150(9), 604–612. https://doi.org/10.7326/0003-4819-150-9-200905050-00006
Pastucha, M., Skarżyński, H., Kochanek, K., & Jedrzejczak, W. W. (2026). Reference Accuracy in Large Language Model Chatbots: A Metric for Inherent Misinformation? Medical Science Monitor : International Medical Journal of Experimental and Clinical Research, 32, e950916. https://doi.org/10.12659/msm.950916
Six, A. J., Backus, B. E., & Kelder, J. C. (2008). Chest pain in the emergency room: Value of the HEART score. Netherlands Heart Journal : Monthly Journal of the Netherlands Society of Cardiology and the Netherlands Heart Foundation, 16(6), 191–196. https://doi.org/10.1007/bf03086144
Thirunavukarasu, A. J., Ting, D. S. J., Elangovan, K., Gutierrez, L., Tan, T. F., & Ting, D. S. W. (2023). Large language models in medicine. Nature Medicine, 29(8), 1930–1940. https://doi.org/10.1038/s41591-023-02448-8
Wong, A., Otles, E., Donnelly, J. P., Krumm, A., McCullough, J., DeTroyer-Cooley, O., Pestrue, J., Phillips, M., Konye, J., Penoza, C., Ghous, M., & Singh, K. (2021). External Validation of a Widely Implemented Proprietary Sepsis Prediction Model in Hospitalized Patients. JAMA Internal Medicine, 181(8), 1065–1070. https://doi.org/10.1001/jamainternmed.2021.2626
Wu, K., Wu, E., Wei, K., Zhang, A., Casasola, A., Nguyen, T., Riantawan, S., Shi, P., Ho, D., & Zou, J. (2025). An automated framework for assessing how well LLMs cite relevant medical references. Nature Communications, 16(1), 3615. https://doi.org/10.1038/s41467-025-58551-6