The architecture behind every model on this chart was described in a single 2017 paper. Almost nothing about the core idea has changed since.
What changed is scale, and then — once scale stopped paying for itself — training method: instruction tuning, human feedback, reasoning, and more than one kind of input.
The model we take apart in the next hour is GPT-2, from 2019. It is small, weak, and completely inspectable — which is exactly why it is the right thing to look inside.
This is the headline your colleagues have read. It is also true.
Every clinical note today is synthetic — ten discharge summaries written for this session. No PHI, no real records, no credentialed corpora. The “guideline” sources are deliberately fictional.
Every figure in these slides came out of a real model run. Nothing is illustrative. You can reproduce all of it from the notebook.
A language model is a machine that, given some text, produces a probability distribution over what comes next.
Everything else — the fluency, the apparent reasoning, the citations, the confident wrong answers — falls out of that one fact and the machinery that implements it.
For the next hour we take that machinery apart, in order.
Byte-pair encoding earns a single token for sequences the training corpus saw often. Web text is full of the. It contains very little t(9;22)(q34;q11).
A blood film, a trephine, a flow plot, a karyogram — all of it can go in. But every one is converted into tokens too. An image costs hundreds to thousands of them, competing for the same limited space as your text.
“Multimodal” does not mean it reads a slide the way a haematopathologist does. It means the image joins the same queue as the words.
Fifty haematology terms, projected to two dimensions. Switch the encoder and watch the points move.
It does not know they are the same disease. It has mostly seen “AML” as an acronym for other things.
Build patient-similarity search on the default encoder from any vector-database tutorial, and every note that abbreviates drops out of your results — silently, with no error.
The encoder accepts 256 tokens. Our notes average 527. It read the first half of every note and raised no error — no exception, no warning, just quietly worse results.
Ceiling is 9/10 — our one CMML has no same-cluster neighbour. Chance is about 1.3/10.
Chunking fixes the truncation and recovers the general model. It does nothing for the biomedical one, which was barely truncating.
Clinical retrieval stays hard. Every note here mentions marrow, blasts, counts, cycles. Topical similarity is not clinical similarity.
Rows attend to columns. The lower-triangular shape is not decoration — GPT-2 is causal, so a token can only look backwards. That is what makes left-to-right generation possible.
Some head does carry a link from the negated noun back to the negation. Attention can represent it. Attention is not the bottleneck.
A sentence embedding averages all those token vectors into one. The 0.98 similarity was not a failure of attention — it was a failure of what we did after attention.
Most of what people describe as a model being “creative” or “unreliable” is a sampler setting, not a property of the model.
temperature = 0 — you want the same answer every time, and you want to be able to say why you got it.
temperature > 0 — variation is the point.
Temperature reshapes the distribution. top-p truncates its tail — which is what actually stops the model reaching into the tens of thousands of tokens sitting at near-zero probability.
top-k keeps a fixed count regardless of confidence; top-p adapts — few tokens when the model is sure, many when it is not.
Treatment-free remission ... minimum of 5 years ... MR4.0 for at least 2 years. Source: European LeukemiaNet 2020 recommendations, Section 6.4. PMID: 32127639 Grade B recommendation based on the EURO-SKI and STIM2 trials.
Section number, grade and PMID: generated the same way as every other token.
There is no “I am now citing” mode inside the model. A citation is text, and text is what it produces.
It is not lying. It has no notion of a claim that could be false.
The fabrication is not rare, not flagged, and not distinguishable from a real citation by reading it. You have to check.
Chronic phase throughout; any history of accelerated phase makes the patient ineligible [S01]. TKI therapy for a minimum of 5 years [S01]. MR4.0 maintained for at least 2 years [S01]. Monthly transcripts for 6 months [S02]. The provided sources do not contain a PubMed ID, so I cannot supply one.
The model did not become more truthful. We changed the task from recall a fact to read this and report what it says — which is a task it is genuinely good at.
Asked for a PMID that is not in the sources, it now says so instead of inventing one.
And Act 2 showed you exactly how fragile that retrieval step is.
Real notes are personal data under GDPR. Sending them to a public API endpoint is a transfer. The Heidelberg lab endpoint used in the notebook is a local deployment — that is the reason it exists.
MIMIC and n2c2 require a signed data use agreement. So does your institution's data. “It was on Hugging Face” is not a licence.
An AI system informing clinical decisions is likely high-risk. That classification brings obligations on data governance, logging, human oversight and post-market monitoring — regardless of how good the demo looked.