Code & Cure
Decoding health in the age of AI
Hosted by an AI researcher and a medical doctor, this podcast unpacks how artificial intelligence and emerging technologies are transforming how we understand, measure, and care for our bodies and minds.
Each episode unpacks a real-world topic to ask not just what’s new, but what’s true—and what’s at stake as healthcare becomes increasingly data-driven.
If you're curious about how health tech really works—and what it means for your body, your choices, and your future—this podcast is for you.
We’re here to explore ideas—not to diagnose or treat. This podcast doesn’t provide medical advice.
Code & Cure
#56 - How Deep Learning Finds Hidden Clues In A Standard EKG
Use Left/Right to seek, Home/End to jump to start or end. Hold shift to jump forward or backward.
Sudden cardiac death is the nightmare scenario: someone feels fine, then a lethal arrhythmia hits without warning. The problem is not a lack of tests, it is that our best screening tools still miss too many people. We talk through how clinicians use left ventricular ejection fraction to estimate risk and decide who might need an implantable cardioverter defibrillator, then confront the uncomfortable truth that EF creates false positives and false negatives when the underlying causes are more diverse than one number can capture.
From there, we shift to the ECG as an underused goldmine. We break down how modern deep learning models for ECG interpretation can learn subtle waveform patterns across large datasets, including registries that link ECGs to death certificates to identify sudden cardiac death outcomes. Because the event is rare, we discuss a multitask, multi-head approach that learns related targets at the same time to make the most of available labels, then tests whether the signal generalizes beyond the original training population.
The most exciting moment is where AI stops being an automation tool and becomes a discovery instrument. We unpack “generative morphing,” where a variational autoencoder generates realistic heartbeats and a predictor nudges them step by step toward higher risk, creating a movie that shows exactly what changes. That approach recovers known ECG risk features and proposes a new biomarker: a slurred terminal downstroke of the QRS complex in lead aVL, with a hypothesis that it reflects disorganized conduction that could set the stage for sudden arrhythmia even when EF is normal.
References:
An ECG biomarker for sudden cardiac death discovered with deep learning
Obermeyer et al.
Nature (2026)
Credits:
Theme music: Nowhere Land, Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 4.0
https://creativecommons.org/licenses/by/4.0/
Old Tests, New Breakthroughs
SPEAKER_00Sometimes the biggest breakthroughs don't come from new tests. They come from looking at old tests in entirely new ways. And that is exactly what happened with this deep learning discovered EKG biomarker.
Why Sudden Cardiac Death Is Hard
SPEAKER_02Hello and welcome back to Code and Cure, the podcast where we discuss decoding health in the age of AI. And my name is Vasant Sarathi. I'm a AI researcher and cognitive scientist, and I'm here with Laura Hagopian.
SPEAKER_00I'm an emergency medicine physician. And today we're talking about sudden cardiac death. Scary. I know it is scary. It's one of those things where you're like, oh, someone was fine one moment and then suddenly they're dead. Right. And the the cause of that is cardiovascular, right? And there are lots of things that can do that. But one of the ways that we could try to figure that out right now is who's at risk for this, right? Who might go on to have a sudden cardiac death, a sudden arrhythmia, um, you know, potentially a sudden heart attack, etc. Who's at risk for that?
Ejection Fraction And Defibrillator Decisions
SPEAKER_00And one of the main markers we look at clinically is what's called the left ventricular ejection fraction.
SPEAKER_01Okay. Complicated.
SPEAKER_00Or the EF. Yeah.
SPEAKER_01Yeah. Okay. EF.
SPEAKER_00EF. And it's complicated words, but the concept isn't that complicated, which is, hey, like, how well is your heart pumping, the left ventricle of your heart pumping? How well is it squeezing on each beat? You want most of the blood to be squeezed out of it, right? And if it's it usually squeezes around 55 to 70%. When it's low, it means your heart muscle is weak. And so that can happen for a variety of reasons, like maybe a heart attack or whatever. Um and usually when it gets low enough, we might say, hey, we want to put a defibrillator in you because we're worried that you're going to develop an arrhythmia and suddenly die. And we want an a defibrillator to shock you out of it.
SPEAKER_02So just so that I understand, the the mechanism by which potentially this can play out is a certain cardiac death can play out, is by the heart muscles being so weak that they don't pump as as well, or they don't arrhythmia in my head is just simply a mistimed heartbeat, right? In some level.
SPEAKER_00I mean, it's like oftentimes these arrhythmias are things if if they devolve into something like ventricular tachycardia, ventricular fibrillation, you want you want the person to be shocked out of it, right? Because if they stay in that rhythm, they're going, they're they're gonna potentially die.
SPEAKER_02Okay. Okay. So it's getting into the wrong rhythms, uh, that that's the problem.
SPEAKER_00And the defibrillator will shock you out of it.
SPEAKER_02Okay. But if muscles are weak, then the defibrillator is not gonna be enough, right? At some level, because it's if it's if your muscles are weak, then they're weak. Then how does I guess the part that I'm not understanding fully is how does the defibrillator help you get out of that space?
SPEAKER_00Well, the defibrillator shocks you back into a normal rhythm.
SPEAKER_02Okay.
SPEAKER_00But I guess I think maybe your question, I'm gonna I'm gonna put this in, I'm gonna put this into uh as if you were asking this, but like the the question becomes like, hey, why why does having a low ejection fraction predispose you to having sudden cardiac death and an arrhythmia? Um and and the reason there's a there's a number of reasons why, like you could have um scar tissue, like after a heart attack. And so the electrical signals can't travel through that part of the heart very well. Yep. Uh your heart could be kind of like stretched, it can be enlarged, which makes it like less kind of stable when the the electric electricity is kind of moving through it. You could have uh changes inside the heart cells themselves, you could have differing responses to stress hormones like adrenaline, or you could have other triggers like electrolyte problems, um, dehydration, etc. And so when you have this weaker heart, it's it can be predisposed to you know going into these arrhythmias for all of these reasons. Right. But one of the things I think is important to point out is that having a low ejection fraction is one of the markers that we use to say, hey, this person could be at risk for sudden cardiac death. But there's other stuff out
What Clinicians Scan For On EKG
SPEAKER_00there. And um, for instance, if someone came in to me and said, hey, I fainted, or hey, I almost fainted, um, depending on what the situation is, there's lots of causes of that, right? Yeah. But from a cardiovascular standpoint, I'm gonna be looking for certain things on an EKG that I get. EKG being like when they put all the leads on your chest and they get that print out. And I'm gonna be saying, hey, like, is this person having a heart attack? Is this person in an arrhythmia? Is their heart going too slow? Is it too fast? Is it coming from the ventricle and it should be coming from the atrium? Whatever. But there are also certain like named patterns that we look for.
SPEAKER_01Okay.
SPEAKER_00That are like named after people who discovered them. So like there is the Brugata pattern. I don't have to go into a ton of detail about this.
SPEAKER_02And Brugata was But the the chart, the waveform looks a particular way. Exactly.
SPEAKER_00And so you have to like, hey, in the Brugata pattern, there might be uh an you know an elevation in one part of the EKG that's not normally there. Um, or if you, you know, there's other ones that are named after people, Wolf Parkinson, White, or there are certain ones where the uh the middle part of the heart is kind of bigger than it should be. And so you look for signals on the EKG to be like, hey, what is what's causing this? And a lot of this research came from people recognizing patterns, like, oh, hey, this whole population in this one area, this whole family seems to have a lot of sudden cardiac death. We don't know why. Let's go and review them together. And then they'll discover, hey, there's this cardiac biomarker that we should be looking for on EKGs to try to understand who these people are and what's going wrong. Because it's not just how the heart is squeezing. It might be like, how are the sodium and calcium channels working? Um, and sometimes we don't, or is there an accessory pathway where the signal is traveling where it shouldn't be traveling? Or is there, yeah, is there like um hypertrophy of one section of the heart? So it's not like we say sudden cardiac death as it's a as if it's a uniform disease, but it's not. There's lots of different things that can cause it.
Why Ejection Fraction Misses Risk
SPEAKER_00And having a low ejection fraction is one of those things because the heart's not squeezing well, but there could be lots of other things that could cause it.
SPEAKER_02Yeah, and that makes sense because in this paper they talk a lot about how the ejection fraction is uh the most common technique to identify or to predict um sudden cardiac death. Um, but there's a bunch of false negatives and false positives from it. Um, and that explains it, right? Because it is just one thing off of many possibilities, right? That that's why it only captures a certain amount of it. And even the ones that it captures, there's it's not quite great at that either.
SPEAKER_00Right. But then you're talking about life and death. So you're like, oh, well, maybe we should put a defibrillator in this person, right? If you're worried, but you can't put a defibrillator in everyone. That would be crazy. And so then it's like, well, who can we actually save people's lives? And can we figure out who are the people that would most benefit from having a defibrillator implanted?
Using Neural Nets For EKG Patterns
SPEAKER_00And maybe it's not just people who have a low ejection fraction.
SPEAKER_02Yeah. And what it also seems like is potentially the EKG or ECG has the information encoded in it in some form of pattern or something that might exist. And finding those patterns historically has been kind of painstaking. And the hope is that some human discovers the great pattern and then is able to perform experiments to test their hypothesis. That slow painstaking process is something they're saying now. Hey, we have neural nets. Can they, who are great at pattern matching, a pattern matching? Right, exactly. Can they be used on um ECGs to be able to identify uh potentially useful patterns? And so that's kind of where this paper was was stuck its its starting point was. Uh but the challenge is you just don't have as much ECG data that map to certain cardiac death well enough. And that's one of the biggest challenges that have, you know, that there's been some other studies and other people have looked at ECGs before for this purpose. But the, you know, but but the issue is one of one of the issues is one of data. We don't have enough data for it to be able to do this. And so, you know, they did some clever tricks, we will talk about later, um, to be able to use the data that they have, but they also got more data from different sources. Um, but one of the data sources was basically you have ECG signals, but you also have uh death certificates of people, which just which oftentimes will tell you what, you know, whether they died of sudden cardiac death or something like that, right? And the timing of that death as well. So they'll tell you some useful information potentially that are labels for that data. So that that's kind of one source of data that that they have identified.
SPEAKER_00And they did this with data from Sweden, and I think it's uh a little bit more robust for this exact purpose than some of the US data. They did pull data from the US and I think Taiwan as well to see like how it generalized. But when they first did the study and trained, it was on the Swedish data where they said, hey, let's link EKG waveforms to death certificates and try to figure out, hey, what are the patterns here? And is there anything else that we can recognize or realize from
Data Linking EKGs To Death Records
SPEAKER_00this?
SPEAKER_02So one of the cool things they did with the with the way they trained the model is first of all, but using deep learning on ECGs is is has been done extensively and is well studied. And there are uh deep learning models that are suitable for that. I mean, you typically think of uh variations on convolutional neural nets, and these are types of neural nets that have been used for images where you know you can detect things in images, and it kind of um is a deep learning system in which um it learns progressively more and more interesting structure that that's present um in an input. And it's often used um in images, like I said, where you identify like a cat by finding its you know edges and then finding its you know ears or whatever. But um those kinds of techniques have also been applied for ECGs, and um, there is a familiar architecture that's called ResNet that's used extensively. Now the challenge again is one of data. And one of the things they did was instead of having a model that just predicts yes or no, the person died cardiac death, uh, and take put in all the data and figure out and train a model on that, they instead chose to do what's called a multitask or a multi-head uh model, in which there is a core model,
Multitask Modeling To Beat Rarity
SPEAKER_02but there's also a piece of it that is um tuned for only certain populations and only tuned for certain specific tasks. So like there's one piece of it that is meant to predict current sudden cardiac death across everyone. But there's another piece of it that um predicts only among patients who died within a year and tries to get at that. So you're able to use that same patient data for multiple purposes. Oh, interesting. And multiple times, but for predicting different things about it. Uh, there's another piece of it that uh is focused on only patients who had the um ejection fraction ultrasound, um, and was your ejection fraction reduced by a certain percent? So, like, so they're you know, they're able to take the same core model and the same sets of data, but like run it through the system in multiple times, multiple ways to kind of maximize how much they can get out of it. And and by doing so, they are able to really, really kind of squeeze out um all of the value um from this. And one of the challenges also is that sudden cardiac death is pretty rare, anyways. So you can't just rely on that. So you have to find different ways of getting at the same information. Um, so I you know, I think that that that was one very clever thing that they did with their with their system to train a model to do that.
SPEAKER_00Yeah, that's really interesting.
SPEAKER_02Yeah, so I, you know, and and of course, that's just one piece of it, right?
Interpretability And The Search For Why
SPEAKER_02Ultimately, uh the I I think the very interesting part of this paper really comes down to identifying that biomarker. Because yes, you can train a model to predict uh to do a good job predicting, and that has value, as we just talked about. Um, but you can just sort of the best you can do with existing interpretability methods is to see what it sees, but not really get at why. Right. And that's really challenging. And for that, they use some really cool techniques um in in deep learning and in interpretability to get at that.
SPEAKER_00And from a clinical standpoint, this is the kind of stuff that I want to know. Like what if it's finding a new biomarker? I want to know about that so I can look for that on an EKG. So that someone comes in saying, Hey, I I fainted or I almost fainted, and and it's a cardiac arrhythmia as the cause, you know, that that's on the same spectrum as sudden cardiac death. And so I want to know, hey, like what are the electrical signals that I'm seeing in the EKG? What should I be looking for? What does the impulse look like? Um, because there are certain ones that I know to look for just because they've been written up in the literature. But if there's something new that's been discovered, hey, I want to know what it is so I can look for it too. And I want to know, like, why? Why is it happening? Why is it there? What does it signal, et cetera? So I'm this part was very curious to me about how they made this generative model to produce kind of arbitrary EKG waveforms and make it look riskier over time to identify, hey, what can we interpret this? Can we understand this? So tell tell me more
Generative Morphing Turns EKG Into Movie
SPEAKER_00about that.
SPEAKER_02Yeah, so that's a technique called generative morphing, and it's again an old technique, but applied in the healthcare context, which I think is really cool. And and what they're trying to do is um figure out which patterns in the ECG or EKG are actually at at you know, the sort of the cause, so to speak, of the high-risk um cases. And part of the problem there is um, well, the first test step that you'd want to do there is in the generative model, is they literally built a generative model of um and an ECG. So like a normal ECG. Like basically the generative model would predict the next, would would generate the waveform for each heartbeat. So every click, it would generate a new heartbeat waveform, right? And you want that to be realistic. So they use what's called a autoencoder, a variational autoencoder, which basically is able to recreate and learn how to create new, fresh, clean heartbeats within heartbeat constraints, right? You don't want it to just like create random waveforms, but you want to make sure that whatever heart uh beat it creates, it generates. This is like you know, an image generation module models where they generate brand new images of things. Right. Um, and so it you can think about it in that context as well. So it's a little bit different in its setup. But the idea is hey, can I just generate synthetic um made-up artificial heartbeats essentially? Okay, yeah. Um, and so they did that as a first step. And what they then did was to use the predictive model that we just talked about before as a way to inform the generative model about how risky that heartbeat that it generated was is. So basically the the generative model generates a heartbeat, and then the prediction model says, hey, this is uh this is not a risky heartbeat. And that information is fed back into the generative model to nudge it in a in some direction that makes it slightly more risky. And the predictive model tells you which direction to go in. And that it basically what happens is then goes back to the generative model, and then it makes the heartbeat slightly more risky in whatever whatever direction that the predictive model has told you. And in doing so, by nudging it slightly and doing it several thousand times, what you get is like a movie. So you start with a regular heartbeat, and then each time step that heartbeat gets morphed or changed slowly to become worse and worse and worse and to look more like one that would be predicted as being risky. Does that make sense?
SPEAKER_00Yeah, that totally makes sense.
SPEAKER_02Yeah, so so basically what you get in the end of this is the ability to have these heartbeats that at the end of it look like the heartbeats that the predictive model would identify as being a bad, uh, bad EKG. But in doing so, you have now a full movie, right? You see exactly which part changed. And I think that's where the discovery happened is that look, it is this piece that really was modified, and that provided some uh a new biomarker.
SPEAKER_00And so, well, what's interesting is not only did it provide a new biomarker, it found stuff that we already knew. So there's some stuff in there that's not surprising. It's like, hey, the high-risk morph has some like electrical activity that's going more towards the left side that's deviating towards the left axis. You don't really have to know what that means, but but that's stuff that we already knew. It's interesting, but it's not like surprising that they found that. Or there's um poor another thing on the EKG that when they they morph it to high risk, it has poor R-wave progression. And that's something um that again that we know is it correlates with maybe ischemic heart disease. So details aside, like they found things that we already knew could correlate with possible sudden cardiac death by morphing the EKG, but they did find something that was new.
A New Lead aVL Biomarker
SPEAKER_00There was one new piece that they found that's just like it's different. It's something that no one had identified before. It's something that no one had re reported before. And it's specifically in one lead, lead AVL, um, and it's this sort of it's part of this R wave. So maybe I should back up and like explain what explain what a QRS complex is. Yes, please.
SPEAKER_02Um I'm assuming it's a part of it's a part of the heartbeat in the waveform, right?
SPEAKER_00Yeah. So like we said, the EKG has like the electrical signals of the heartbeat.
SPEAKER_02Yes.
SPEAKER_00And there's a P wave, a QRS complex, and a T wave. So let's focus on this QRX, QRS complex. And that is this um usually a tall, sharp spike where and it signals the spreading of the electricity through the lower chambers of the heart, the ventricles of the heart, which are the the ones that pump, pump the blood out. Okay. Um, and so that's what that piece signals. And in one of the leads, there's a bunch of leads on the EKG, but in one of the leads, there the the sort of terminal aspect, the last part of that ER wave is sort of slurred. Um, and in the normal version, um that isn't there.
SPEAKER_02Oh, interesting.
SPEAKER_00And so it it looks much different because in the normal version, it kind of goes up and then it comes down and then it comes back to baseline. In this high risk version, it goes up and then it doesn't go all the way down and it takes longer. It's sort of slurred to come back down to baseline, but it never goes below the baseline.
SPEAKER_01Yeah, yeah, yeah, yeah.
SPEAKER_00And so it's interesting because it's it's new, it's something that's different, it's something that no one had discovered before. And, you know, my question is always like, well, why? Why does this, why is this associated with sudden cardiac
Why The Slur Might Matter
SPEAKER_00death? Can we understand that? And, you know, the question, the the answer is maybe. Maybe we can need more research. This is a starting point. Yes. But the the hypothesis in this article that we read is like, hey, this sort of slurred downstroke of this QRS complex in this one specific lead AVL is is probably showing that the electricity there in the heart is not organized. It's disorganized. And over and over time, especially as the electricity is going through the heart, it's getting more disorganized, it's getting worse, and that could make you prone to an arrhythmia that causes sudden cardiac death.
SPEAKER_02Interesting. Wow. So I, you know, that's at the core of this is the discovery of that new biomarker, which I think is the most exciting part of this paper.
SPEAKER_00For sure. And then of course the question is like, well, why is it only there? Why is it only in that one spot in the EKG? And they had some ideas about that in the paper too, because we think, oh, you know, it's the location of that lead is kind of on the left side, the base of the heart. And that's where we're concerned that the conduction issue is happening, that it's not spreading the electricity as well as it should be, which is making it more prone to it arrhythmia. These are these are hypotheses, but it's always nice to have an explanation behind, hey, why is this happening? Why are we seeing this abnormality? Why should we be looking out for it? And what can we do about it? And of course, the answer to that last question is hey, do these people need defibrillators implanted in to prevent sudden cardiac death? And these may be people who have a normal ejection fraction because not everyone who has sudden cardiac death has a low ejection fraction. Maybe there's some new abnormality, some new genetic thing, some new variant that's been discovered here. And I think more research needs to be done to sort of suss that out. But I think it's very interesting that all of this data came together to find something new that we did not know about before.
SPEAKER_02Yeah, yeah,
AI As Discovery Tool In Cardiology
SPEAKER_02no, exactly. And I think that the that's the piece of this paper that's most exciting for me is we've talked a lot in this podcast about AI being used as an automation tool in many cases. But here it's a little bit more of a discovery instrument, right? It's telling you about a brand new testable hypothesis that that you didn't have before. And it's a different almost like a slightly different use case and potentially very powerful use case uh for people to go around with, right? You you know you didn't know this pattern existed, so it's almost like they're telling you about some novel pattern that may be relevant here. Um I think that the obviously that there's a near-term benefit right away, which is the fact that you can now do better prediction, but you have the longer term, which is potentially finding new um mechanisms that cause sudden cardiac death.
SPEAKER_00Absolutely. And then being able to intervene on patients who have this finding on their EKG, yeah, and say, hey, like this person, you know, let's figure out if they qualify for a defibrillator because we're worried that their risk of sudden cardiac death is high.
SPEAKER_01Yeah, yeah, exactly.
SPEAKER_00And that's a big intervention on people who are high risk, right? Yeah. This is less like this is literally an example of how AI could be life saving. This it's really cool. All right.
Final Takeaways And Goodbye
SPEAKER_00Well, thank you for joining us, and we will see you next time on Code and Cure. Bye for now.