# Narration script: core-foundations Generated by `slides/narration.py` from the speaker notes in `core-foundations.qmd`. Do not edit this file; edit the notes and run the script again. Slide numbers match the deck. Slide 1 is the title slide and has no narration. If a synthetic voice reads this script, say so at the start of the recording. Total: 5191 words, about 35 minutes of speech, plus about 22 minutes of pauses for the activities: about 57 minutes on your own. ## 2. Three rules for every session *129 words, about 52 s of speech* Welcome. This session takes about sixty minutes live, or about the same on your own with the pauses. You will try several things in a browser as we go, and nothing needs installing. Three rules apply in every session of this course. No patient information goes into any chatbot, including the one your school gives you, unless your hospital's privacy office has approved that tool in writing. A claim you have not checked is not a fact yet. And you sign the note, whatever helped you write it. The second rule follows from how these systems are built, and by the end of today you should be able to say why in one sentence. The first rule follows from something simpler: whoever runs the tool receives what you type. ## 3. What you will be able to do *187 words, about 75 s of speech* Here is what you will be able to do by the end. Say how AI, machine learning, deep learning, and generative AI fit inside each other. Say what the eGFR was learned from: its inputs, its output, the people it was fit to, and what fitting it meant. Sort any model with two questions. Explain why a model's score on cases it has already seen tells you nothing, and what the three sets are for. Say in one sentence why a chatbot can give you a citation that does not exist. And ask a chatbot to check its own facts and citations, and say what that check does not catch. The session is a talk in three parts, with short things to try in your browser as we go. First the eGFR, and how any model learns from data. Then the chatbot, which is the same idea with words. Then back to the clinic. You need only a browser. Nothing needs installing, and you do not need an account. If you only want what to do on the wards, the practical slides are 21, 33 and 36. ## 4. Four words, each inside the one before *208 words, about 83 s of speech* Yesterday's talk was the history: how we got from rules written by hand to the chatbots of today. Here are four words from that history, and how they fit together. If you missed yesterday, nothing today depends on it. Artificial intelligence is the largest circle. It means a computer doing a task that seems to need judgment, by any method. MYCIN, from the 1970s, advised on antibiotics with rules that experts wrote by hand. Machine learning is inside it. The rules are not written by hand. They are learned from data. The eGFR equation on every chemistry panel is an example. A statistician would call it a regression. The line between statistics and machine learning is blurry, and for this course a model learned from data counts. Deep learning is inside machine learning. It uses a neural network: many layers of simple units, each passing numbers to the next. Models that read images, such as chest X-rays, are usually built this way. Generative AI is inside deep learning. These models write new text or make new images. A chatbot is the example you know. Today we start in the second circle, with the eGFR, and end in the smallest, with the chatbot. The same loop is under both. ## 5. The number nobody measured *10 words, about 4 s of speech* Now to a clinic, and a model you already use. ## 6. Pre-op clinic, surgery sub-internship *109 words, about 44 s of speech* Pre-operative clinic, on your surgery sub-internship. A sixty-two-year-old woman is being worked up for a laparoscopic cholecystectomy. Her basic metabolic panel is back, and one line is flagged low: an eGFR of fifty-seven, where the lab's reference is above sixty. The attending asks whether her kidneys are all right for the contrast CT the surgeon wants. You answer the way everyone answers. eGFR fifty-seven, stage three a, mildly reduced, probably fine with hydration. The attending nods, and that is the whole conversation. You will have it several hundred times in intern year. The panel on the slide is made up for this course. It is not a real patient. ## 7. Where does the 57 come from? *48 words, about 19 s of speech, then 1 min paused* Before I go on, commit to an answer. Where does the fifty-seven come from? Did a machine measure it in her blood? Was it measured from a timed urine collection? Or did an equation calculate it from three other numbers? **[Pause, about 1 min.]** Pause here, pick one, then press the button. ## 8. Nobody measured her GFR *78 words, about 31 s of speech* Nobody measured her glomerular filtration rate. Measuring it means infusing a marker that the kidney filters and does nothing else with, such as iohexol, and timing how fast it clears. That takes hours, and it is rarely done in routine care. The fifty-seven was computed from three things the lab did have: her creatinine, her age, and her sex. Something turned those three numbers into a kidney function, and you trusted it enough to clear her for contrast. ## 9. Where did the equation come from? *115 words, about 46 s of speech* So where did that equation come from? Not from the physiology of nephrons. It was learned from data. A few thousand people did have their GFR measured. Their creatinine, age, and sex were given to a computer with one instruction: find the formula that best predicts the measured number. The eGFR is a model. It is the model you already trust most, and you have probably never asked what it was trained on. Remember this patient. She weighs forty-five kilograms and has lost a good deal of muscle over a year of illness. We will come back to her at the end. Nobody has told her that a model had a part in the fifty-seven. ## 10. Fit the curve yourself *220 words, about 88 s of speech, then 2 min paused* Here is fitting, done by hand. Each dot is one made-up person: creatinine across, measured GFR up. The thick curve is a simple equation with two numbers in it, a and b. Those two numbers are the dials. The number a sets how high the curve sits: it is the GFR the curve gives at a creatinine of one. The number b sets how fast GFR falls as creatinine rises. Each thin line is a miss: how far one person's measured GFR is from the curve. The number beside the sliders is the average miss. **[Pause, about 2 min.]** Move the two sliders and make the average miss as small as you can. Then press "Show the best fit". Fitting means a computer turns these dials until the error is as small as it can get. Here the computer tries every setting the sliders allow and keeps the best one. Real fitting uses faster methods, with the same goal. The real eGFR equation has a few more numbers in it, and it was fit to eight thousand two hundred fifty-four people whose GFR was measured, not to forty made-up dots. A chatbot is the same idea with billions of numbers. The data on this slide are made up, and the curve is simpler than the real equation. Its numbers are not the real eGFR's. ## 11. The loop every model comes from *20 words, about 8 s of speech* The next fifteen minutes give you five words and two questions. They will sort every model you meet in residency. ## 12. What the equation connects *155 words, about 62 s of speech* Here is what the equation connects. On the left is what the lab can measure: creatinine, age, and sex. On the right is what you actually want to know: the measured GFR, which is rarely done in routine care. The equation joins the two, and it was built from eight thousand two hundred fifty-four specific people. Look at the grey box at the bottom. Muscle mass, diet, and some drugs change creatinine without changing GFR. Anything in that box changes the result, and the equation cannot tell. A number you use in place of the one you want, because the one you want is hard to get, is called a proxy. Here the eGFR, calculated from three lab values, stands in for the measured GFR. One of this course's recurring lessons is that proxies fail: the stand-in and the real thing can come apart, and they come apart for some patients more than for others. ## 13. Five words for the rest of the course *164 words, about 66 s of speech* The eGFR story contains every word you need for the rest of the course. Predictors are the inputs: creatinine, age, and sex. The response is the thing being predicted: the measured GFR. The training set is the eight thousand two hundred fifty-four adults whose numbers were used to fit the equation. They came from ten studies and were mostly research participants. About a third were Black. The test set is the four thousand fifty people from twelve other studies that the equation was checked on afterwards, and had never seen. And the model is the equation itself, once it has been fit. The letter f stands for function, which just means a rule that turns inputs into an output. Fit means that a computer tried numbers in the equation until its predictions were as close to the measured values as they could get. For the eGFR, the model is a handful of numbers. For a chatbot, it is billions. The role is the same. ## 14. One equation, three generations *204 words, about 82 s of speech* Here is the history of one equation, rebuilt from the numbers in the papers. Read the last column as a pattern, not as nephrology. MDRD was fit to one thousand and seventy people who already had kidney disease, and tested on five hundred fifty-eight more. In healthy people it gave values that were too low, and healthy people were labelled as diseased. The 2009 equation was more accurate at higher GFR, and it included a term that adjusted the result for Black race. Even with that term, the 2021 study found it overestimated measured GFR in Black adults. An overestimate makes kidney disease look milder than it is. The 2021 refit removed race, and it is still a few points off in both directions. A version that adds cystatin C, a second blood marker that does not depend on muscle, is more accurate. Every row says the same thing. The model was fit to these people, and here is what happened to people unlike them. The training population is part of the model, as much as the equation is. Why the race term was there, and who was harmed by it, is the subject of the bias and equity session later in the course. ## 15. The loop, drawn once *84 words, about 34 s of speech* Every model in this course, from the eGFR to the chatbot, was built by this same loop. Turn the raw material into predictors. Collect the truth for each case. Learn a function that predicts the truth from the predictors. Then apply it to a new case whose truth you do not have. The eGFR, a sepsis alert in the EHR, and a chatbot differ only in what goes in these boxes. Keep this picture. We will fill it with words in half an hour. ## 16. Two questions sort any model *159 words, about 64 s of speech* Two questions sort any model in about ten seconds. First: does the training data contain the answer? For the eGFR, yes. Someone measured every one of those GFRs. That is supervised learning. If there is no answer column, only patterns to find, it is unsupervised learning. Second, and only for a supervised model: does it give a category or a number? The eGFR gives a number, so it is a regression. A model that says chronic kidney disease yes or no would be a classification. An unsupervised tool that sorts cases into groups is not a classification, because nobody told it what the groups were. The difference matters for how you judge it. 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 who is worked up for nothing. ## 17. Try it: sort four models *112 words, about 45 s of speech, then 2 min paused* Now you try. Sort these four models with the two questions. The eGFR. A sepsis alert in the EHR. A tool that groups ten thousand tumor expression profiles into clusters, with no diagnoses attached. And a chatbot predicting the next word. **[Pause, about 2 min.]** Pause here, pick an answer for each row, then press check. The last one is the surprise. A chatbot is trained with an answer for every case, and nobody had to label anything, because the next word is already sitting in the text. Many textbooks call this self-supervised learning, because the labels come from the text itself. That is why these models could be trained on so much of the internet. ## 18. Cases it has already seen prove nothing *196 words, about 78 s of speech* Here is the mistake the eGFR researchers avoided, and the mistake many vendor slides make. Suppose you fit a formula to eight thousand people, and then you report how well it predicts those same eight thousand people. You have measured how well the formula memorized them, not how well it will work on the next patient. A flexible enough model can fit its training data perfectly and still be useless. That is why a separate test set is the least you should accept. Fit on one set of cases, and report performance on a different set the model never saw. When someone gives you one number and does not say which set it came from, you do not have a number yet. The usual rule uses three sets. The training set is used to fit the model. The validation set is used to choose between models, for example between a simpler one and a more flexible one. The test set is kept aside and used once, at the end. If the test set is used to choose, it becomes a second validation set, and its number is optimistic too. The next slide shows why this matters. ## 19. Too simple, too flexible *183 words, about 73 s of speech, then 2 min paused* Move the slider and watch. The filled dots are the cases the model learns from. The hollow dots were held back for testing. The dashed line is the real pattern, which the model never gets to see. Under the charts, the two numbers are the error on each set. At the far left the model is too simple. It is a flat or straight line through a curve, and it is wrong everywhere, on both sets. Statisticians call that kind of error bias, in a technical sense that has nothing to do with the social meaning. Slide all the way right and the model becomes very flexible. It bends through every filled dot, and its training error drops to zero. Now look at the chart on the right. The test error climbs off the chart. The model has learned the random scatter in these twelve cases along with the real pattern. That error is called variance. If you were only ever shown the training error, you would pick the worst model. **[Pause, about 2 min.]** Pause here and move the slider from one end to the other. ## 20. Simple models are easier to check *200 words, about 80 s of speech* The slider showed one trade-off. Here is a second one that comes with it. The eGFR equation is a handful of numbers. You can read each one and check it against what you know. Higher creatinine gives a lower eGFR, older age gives a lower eGFR, and you could work it out by hand. A few thousand people were enough to fit it. The cost is that it can only follow the shape its equation allows. A neural network has thousands to billions of numbers. It can fit patterns no short equation can, such as what a pneumothorax looks like on a film, or how a sentence goes on. But nobody can read those numbers one by one, so it is harder to explain why it gave a particular answer. And it needs far more data, or it fits the noise, as the slider showed at the far right. A model is called interpretable when a person can read why it gave its answer. Neither kind is better in general. For a lab value, a simple model you can check is often the right choice. Images and language need the flexible kind, and then the test set matters even more. ## 21. You saw this sepsis model yesterday *188 words, about 75 s of speech* You saw this model yesterday. Here is why it belongs in today's talk: it is the same failure as the slider, in the clinic. One EHR vendor's sepsis model, the Epic Sepsis Model, was in use at hundreds of US hospitals in 2021. One academic center tested it on thirty-eight thousand four hundred fifty-five of its own hospitalizations. A test on patients from a different setting than the ones the model was built on is called external validation. The area under the curve was zero point six three, where zero point five is no better than chance. Of every hundred patients who had sepsis, the model missed sixty-seven. And since it alerted on eighteen of every hundred admissions, when only about seven had sepsis, most alerts were for patients who did not. The study does not show why. A common reason is that the patients a model meets in use differ from the patients it was built on. The name for that is dataset shift. For the wards: no alert does not mean no sepsis. And if you silence an alert, you should be able to say why. ## 22. The published number is the optimistic one *84 words, about 34 s of speech* That gives you another of the course's recurring lessons: the published number is the optimistic one. A model's performance on the cases it was built from is usually the best it will look. On new patients, especially from another hospital, it is usually lower. So ask three things of any model. What was it trained on? What was it tested on, and by whom? If the cases it was tested on are the cases it was trained on, you have not learned anything yet. ## 23. From tables to words *22 words, about 9 s of speech* Now the chatbot. It is the same loop, with a different table. Seeing that is the main point of the second half. ## 24. A language model is the same loop, with a different table *108 words, about 43 s of speech* Take any sentence from the internet. The patient was started on empiric vancomycin. Now turn it into a table, the same kind of table as the eGFR. The predictors are the words so far. The truth is the very next word. "The" is followed by "patient". "The patient" is followed by "was". And so on, until "the patient was started on empiric" is followed by "vancomycin". Nobody had to label anything, because the next word is already in the text. Every sentence ever written becomes training cases with no labelling work. That is why these models could be trained on a very large fraction of the written internet. ## 25. The model reads tokens, not words *111 words, about 44 s of speech, then 1 min paused* The model does not actually read words. It reads tokens, which are words or pieces of words. The box on this slide runs a real tokenizer in your browser, the one used by OpenAI's GPT-4o models. Nothing you type leaves your computer. Look at how it splits the sentence. Common words like "on" and "and" are one token each. "Vancomycin" is broken into four pieces, and "piperacillin-tazobactam" into many more. Drug names cost more tokens than everyday words. **[Pause, about 1 min.]** Type a made-up sentence of your own and watch it split. Never use one about a real patient. Each token is then turned into a list of numbers. That is the next slide. ## 26. Words become numbers *90 words, about 36 s of speech* To be used in the loop, each token is turned into a list of numbers, called an embedding. The numbers are chosen so that tokens used in similar sentences get similar numbers. This picture is illustrative. The points were placed by hand to show the idea. Vancomycin ends up near linezolid, because they appear in the same kinds of sentences. Both are far from Tuesday. The real lists have hundreds or thousands of numbers, not two. This is the "raw material to predictors" box of the loop, done for words. ## 27. Predict, pick, repeat *188 words, about 75 s of speech, then 2 min paused* Here is the whole of what the model does at each step. Given the words so far, it produces a probability for every possible next word. Then one word is picked, at random but weighted by those probabilities. It is added to the end, and the process runs again. **[Pause, about 2 min.]** Press "pick the next word" until the sentence ends, then start over and do it again. You will get a different sentence each time. Every one of them is smooth, plausible clinical prose, and none of them was checked against anything. The probabilities here are made up for this slide. The slider is called temperature. It is a setting in these models, though most chat apps do not show it. Turn it down and the most likely word wins almost every time. Turn it up and less likely words get picked more often. That is one reason the same question can get a different answer each time you ask it. A real model does this with a vocabulary of roughly a hundred thousand tokens, looking back over thousands of tokens, using a function with billions of numbers in it. ## 28. Watch: inside the model (8 min) *115 words, about 46 s of speech, then 8 min paused* This eight-minute video by 3Blue1Brown shows the same process from the inside, with no math beyond what is drawn on screen. Watch for three things. Early on, the whole system produces a probability for every possible next word, then picks one and repeats. That is the slide you just played with. Then the part where the model is trained on huge amounts of text. And then the second stage, where people rate its answers, which is our next slide. **[Pause, about 8 min.]** Pause here and watch the video. Captions are on YouTube, and a transcript is linked under the video. If you want the longer version, the chapter points you to the twenty-seven-minute video in the same series. ## 29. A second training stage shapes the answers *127 words, about 51 s of speech* There is a second training stage, and it shapes how the answers sound. After the next-word training, people are paid to compare pairs of answers and say which one they prefer. The model is then adjusted toward the preferred kind. The literature calls this reinforcement learning from human feedback. Newer models add other kinds of training on top, but this step is the one that made chat assistants possible. This step is what turns a text-completer into an assistant that answers your question, in paragraphs, politely. It also means the model has been trained toward answers people rate well, which is not the same as answers that are true. It can reward answers that sound confident and complete, because a cautious, incomplete answer can lose those comparisons. ## 30. Nothing in this process checks whether a claim is true *142 words, about 57 s of speech* Now the main sentence of the session. 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. It produces the most plausible next token, given the tokens so far and given what people rated well. A real citation and a made-up one are both plausible ways to continue the words "the original paper was". The model is not lying, and it is not broken. It is doing what it was built to do, and what it was built to do has no truth step in it. The model itself has no checking step. But today's chatbots can add one around the model, if you ask: a web search, or a second pass over their own answer. That is the slide after next. ## 31. What that looks like when it reaches you *161 words, about 64 s of speech* Here is what that can look like when it reaches you. This exchange is made up for the course, but it is the kind of thing these tools produce. Read it as a clinician and it looks fine. The structure is right. The names are real people who have written about this score. The journal exists. But is the original publication the one named? Are the percentages from that paper, or a later one, or nowhere? Do the cutoffs match what MDCalc shows? The citation is the easiest part to check. The paper named is real, but it is a 2013 study that tested the score in more patients. The score was first described in 2008, in a different journal. Nothing in predicting the next word looks up a date, so both are plausible answers to "the original publication". The cutoffs and the advice to discharge are the parts that matter most for a patient, and you check those on MDCalc. ## 32. What this does and does not mean *129 words, about 52 s of speech* This does not mean the answer is usually wrong. On common, well-documented questions these models are often right, because the most plausible continuation of a well-documented fact is often the fact. How often, and on which kinds of question, is what the critical appraisal session measures. 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 are someone who distrusts these tools, that is partly justified, and this is the part: they can be wrong in a confident voice. Checking every claim is a skill, not a weakness. Keep it. What is out of date is the idea that they are useless. They are useful when you check them. ## 33. Ask it to check *283 words, about 113 s of speech* Here is the most useful habit from today. The model itself has no checking step, but today's chatbots can add one, and you can ask for it. Add a line like this to your question, or send it after the answer: check each fact and citation using web search, give me a link and a short quote from the source, and mark anything you could not find. ChatGPT Edu and Copilot can both search the web. This works, and the evidence says so. In a 2026 study, chatbot versions with web search turned on gave more accurate references than the same chatbots without it. In another study, a model that wrote questions to check its own first draft, answered them separately, and then rewrote the answer made fewer false claims. It does not make the answer perfect. In a 2025 study of medical questions, even with web search about three in ten statements were not supported by the source the chatbot cited. The link was real; it just did not say what the answer said. And it checks only what it can reach. It can check the published literature. In most setups it cannot see the patient's chart, so it cannot check anything about your patient: the dose against her weight, the history against the notes, the lab against last week's. Tools that check against the chart are coming, but for now that check is yours. So let the chatbot do the first check. It turns a made-up citation into a link you can open in ten seconds. Then open the link yourself for anything that goes in a note or an order. Try it on the HEART question from two slides ago. ## 34. What this changes for you *7 words, about 3 s of speech* Last few minutes. Back to the clinic. ## 35. Back to the pre-op clinic *233 words, about 93 s of speech, then 2 min paused* Go back to the clinic. The sixty-two-year-old woman is still on the schedule. She weighs forty-five kilograms and has lost muscle over a year of illness. Creatinine comes from muscle. Her creatinine of one point one is a normal number for a normal amount of muscle, and she does not have a normal amount of muscle. So the same creatinine probably means a lower true GFR than the fifty-seven the equation returned. That is the grey box from the diagram, changing the predictor without changing the truth. Name her model's predictors, response, and training population. And what do you now say to the attending about the number on the panel? **[Pause, about 2 min.]** Pause here and answer out loud or in writing. Here is one good answer. "The fifty-seven 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." Whether it changes the contrast decision depends on how close her true value could be to your department's threshold. It matters more for a drug dosed by kidney function. The training population was eight thousand two hundred fifty-four adult research participants. Nothing in the equation knows how much muscle she has. Notice also that nobody told her a model had a part in her care. Whether someone should have is a question for the patient communication session. ## 36. On the wards *179 words, about 72 s of speech* Here is what this means on the wards tomorrow. When an alert fires, or stays quiet, remember the sepsis model. No alert does not mean no sepsis. If you silence one, you should be able to say why. When a chatbot gives you a fact or a citation, ask it to check with web search and give you links. Then open the source before it goes in a note or an order. When a tool has drafted your note or message, read all of it before you sign. You are responsible for what it says. What to document when a tool helped depends on your site's policy, and the ethics and regulation session covers it. And patient information goes into no chatbot, unless your hospital's privacy office has approved that tool in writing. If you tell a co-intern one sentence, make it this one. Ask it to check, with links, and open the source before it goes in the chart. It sounds just as sure when it is wrong, so the link is what you trust, not the tone. ## 37. The standing question *112 words, about 45 s of speech, then 2 min paused* Every session ends on the same question. What does this change about how you will practice? Write your answer down before you close this deck. It is not optional, and one word is not an answer. **[Pause, about 2 min.]** Pause here and write it. Then one more. The next time a chatbot gives you a citation with a first author, a journal, and a year, what will you do in the next two minutes because of it? For example: ask it to check the citation with web search and give you the link, then open the link. Thursday: we open ChatGPT Edu together and use it to set up your own learning goals and journal. ## 38. Summary *193 words, about 77 s of speech* To sum up. AI contains machine learning, which contains deep learning, which contains generative AI. The eGFR is a model learned from data, with predictors, a response, and a population it was fit to. Fitting chose its numbers to make the error as small as possible. Every learned model has those three parts, and you can ask for them. Supervised learning 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. It is not evidence. Ask for the test set, and who ran it. A language model predicts the next token, picks one, and repeats, and 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. So ask it to check, with web search and links, and open the source for anything that goes in the chart. It cannot check facts about your patient, because in most setups it cannot see the chart. That check is still yours. The fifty-seven on the panel came from somewhere. So does everything else. ## 39. Further exploration *138 words, about 55 s of speech* For students who want more, four things to follow by interest. Try: the TensorFlow Playground exercise. Each link opens the site already set up, with the same noisy spiral and only one dot in five used for training. Press play, pause at about five hundred epochs, and compare training loss with test loss. One run gave: step one, both near 0.5; step two, training near 0.09 and test near 0.27; step three, training near 0.1 but test near 0.55. That is overfitting: training loss makes steps two and three look alike, but on new dots step three is the worst. Do not press regenerate, which changes the data. Watch: 3Blue1Brown's longer video on the inside of the model, and Andrej Karpathy's one-hour talk on how chatbots are trained. Read: a two-page paper on dataset shift, written for clinicians. ## 40. References *0 words, about 0 s of speech* *(no narration)*