<script data-pm-proxy="intercept"></script><?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Joakim’s Substack]]></title><description><![CDATA[I research automated medical coding and explainable AI. I write about what interests me, usually about my research.]]></description><link>https://joakimedin.substack.com</link><image><url>https://substackcdn.com/image/fetch/$s_!FbSg!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F224a6e23-592c-44e7-91c5-f16e954f7b54_1280x1280.png</url><title>Joakim’s Substack</title><link>https://joakimedin.substack.com</link></image><generator>Substack</generator><lastBuildDate>Sat, 05 Sep 2026 01:48:46 GMT</lastBuildDate><atom:link href="/__u/joakimedin.substack.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Joakim Edin]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[joakimedin@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[joakimedin@substack.com]]></itunes:email><itunes:name><![CDATA[Joakim Edin]]></itunes:name></itunes:owner><itunes:author><![CDATA[Joakim Edin]]></itunes:author><googleplay:owner><![CDATA[joakimedin@substack.com]]></googleplay:owner><googleplay:email><![CDATA[joakimedin@substack.com]]></googleplay:email><googleplay:author><![CDATA[Joakim Edin]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Why ICD-10 is terrible for medical research]]></title><description><![CDATA[A classification system designed for billing, not science.]]></description><link>https://joakimedin.substack.com/p/why-icd-10-is-terrible-for-medical</link><guid isPermaLink="false">https://joakimedin.substack.com/p/why-icd-10-is-terrible-for-medical</guid><dc:creator><![CDATA[Joakim Edin]]></dc:creator><pubDate>Tue, 28 Jul 2026 12:42:43 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/e7ff1258-b063-411c-896a-2710c6873c5d_2848x1504.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Suicide is amongst the leading causes of premature death; in 2010, it was the fifth leading cause of death in young women and the sixth in young men.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a> Restricting the means of committing suicide is among the most effective methods in preventing them. </p><p>To restrict the means of committing suicide, we must know how they are committed. The most common suicide method varies across countries. Firearms account for 46% of all suicides in the US. In East Asia, suffocation from helium or carbon monoxide produced by charcoal burning is common.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a> </p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>Unfortunately, national-level data on the suicide methods are limited. Only 76 of the 194 WHO Member States report data on methods of suicide in the WHO mortality database. Consequently, how 72% of global suicides were committed is unclear.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-3" href="#footnote-3" target="_self">3</a> </p><p>A systematic review estimated that around 30% of global suicides are due to pesticide self-poisoning, most of which occur in low-income countries.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-4" href="#footnote-4" target="_self">4</a> If true, pesticide poisoning is among the most common methods of suicide. However, because of the lack of data from each country, it is difficult to implement policies to prevent these types of suicide. </p><p>If this data is so important, why are we lacking it?</p><p>There are several reasons:</p><ol><li><p>Suicide is taboo, so it is often deliberately not registered. </p></li><li><p>You cannot always be certain whether someone died from an accident or a suicide. It can also be difficult to distinguish a suicide attempt from self-harm.</p></li><li><p>Many countries do not have the resources to collect the data.</p></li><li><p>Many methods of suicide do not exist in the International Classification of Diseases (ICD-10). Imagine having to select the cause of death from a drop-down menu, but the option you need is missing. You cannot register suicide by helium or carbon monoxide poisoning, so you are forced to code something nonspecific, such as <strong>X67:</strong> <em>Intentional self-poisoning by and exposure to other gases and vapors.</em></p></li></ol><p>In this blog post, I will focus on the last issue: how the flaws of ICD-10 damages research. But, before we start bashing ICD-10, let us travel back in time to its origin.</p><h1>The International Classification of Diseases</h1><p>In 1837, William Farr, England&#8217;s first medical statistician, faced a fundamental problem: how do you count instances of tuberculosis when it is recorded under various names, such as&nbsp;<em>consumption</em>,&nbsp;<em>phthisis</em>, and&nbsp;<em>lung disease</em>? The same disease was frequently recorded under multiple different names, while identical terms were applied to entirely different conditions. This lack of standardization made it nearly impossible to track disease patterns, compare mortality data across regions, or conduct meaningful statistical analysis of public health trends.</p><p>Farr developed a classification system that standardized disease terminology across medical institutions. His system organized diseases by medical categories and incorporated synonyms and local terms that captured the various regional names used for the same conditions. This systematic approach enabled consistent recording and comparison of disease data across hospitals and geographic areas. </p><p>Using his new system, Farr showed <span>that after age 35, mortality among miners was much higher than average. From his data, Farr concluded that pulmonary diseases were the main cause of the high mortality. Nothing was done to improve the miners' condition &#8212; it was just interesting knowing why they died.</span></p><h2>John Snow (no, not him)</h2><p>Farr and many other scientists at that time believed in the <em><strong>miasma theory</strong></em>. They believed that diseases such as cholera and the bubonic plague were caused by bad air. Farr had even found a correlation in his data between cholera instances and the altitude at which people lived. </p><p>John Snow, an English physician, discounted this theory. <span>By talking to local residents, he identified the source of a cholera outbreak as the public water pump on Broad Street. While his evidence was persuasive enough for the local council to disable the well pump by removing its handle, it was not enough to disprove the </span><em><span>miasma theory</span></em><span>. </span></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!aFce!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12819ecb-9271-4657-a2fb-ce57081f23b3_1920x1801.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!aFce!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12819ecb-9271-4657-a2fb-ce57081f23b3_1920x1801.jpeg 424w, /__u/substackcdn.com/image/fetch/$s_!aFce!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12819ecb-9271-4657-a2fb-ce57081f23b3_1920x1801.jpeg 848w, /__u/substackcdn.com/image/fetch/$s_!aFce!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12819ecb-9271-4657-a2fb-ce57081f23b3_1920x1801.jpeg 1272w, /__u/substackcdn.com/image/fetch/$s_!aFce!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12819ecb-9271-4657-a2fb-ce57081f23b3_1920x1801.jpeg 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!aFce!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12819ecb-9271-4657-a2fb-ce57081f23b3_1920x1801.jpeg" width="1456" height="1366" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/12819ecb-9271-4657-a2fb-ce57081f23b3_1920x1801.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1366,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!aFce!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12819ecb-9271-4657-a2fb-ce57081f23b3_1920x1801.jpeg 424w, /__u/substackcdn.com/image/fetch/$s_!aFce!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12819ecb-9271-4657-a2fb-ce57081f23b3_1920x1801.jpeg 848w, /__u/substackcdn.com/image/fetch/$s_!aFce!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12819ecb-9271-4657-a2fb-ce57081f23b3_1920x1801.jpeg 1272w, /__u/substackcdn.com/image/fetch/$s_!aFce!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12819ecb-9271-4657-a2fb-ce57081f23b3_1920x1801.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">A map created by John Snow showing Cholera incidences clustering in certain areas. Source: https://commons.wikimedia.org/w/index.php?curid=2278605</figcaption></figure></div><p><span>A few years later, using Farr&#8217;s system, Snow showed that homes supplied by the </span><a href="https://en.wikipedia.org/wiki/Southwark_and_Vauxhall_Waterworks_Company">Southwark and Vauxhall Waterworks Company</a><span> had a cholera rate fourteen times that of those supplied by </span><a href="https://en.wikipedia.org/wiki/Lambeth_Waterworks_Company">Lambeth Waterworks Company</a><span>. The former obtained water from sewage-polluted sections of the </span>Thames<span>, while the latter obtained water from cleaner upriver sections. This evidence persuaded Farr and other researchers to believe that water was the source of Cholera.</span></p><h2>Farr&#8217;s system today</h2><p>William Farr's classification of diseases is widely regarded as the forerunner of the modern International Classification of Diseases (ICD). The newest version is ICD-11, but almost every nation still uses ICD-10. ICD&#8217;s original purpose was statistical: to record causes of death consistently so that patterns in mortality could be studied. That research-driven aim has faded in ICD-10. While ICD-10 still supports research, particularly mortality statistics, its design increasingly serves billing<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-5" href="#footnote-5" target="_self">5</a>. The system is no longer built solely to capture accurate health data; it is shaped by the need to price clinical encounters, and this shift has several unfortunate consequences.</p><h1>The problems with ICD-10</h1><h2>Dumb rules</h2><p>Several ICD-10 guidelines<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-6" href="#footnote-6" target="_self">6</a> introduce systematic gaps and biases into data used for medical research. In inpatient care, you must code all conditions that are uncertain or suspected. This means that if a patient is labeled with an ICD-10 code representing an infection, you do not know whether the patient actually had that infection or whether it was a hypothesis that was later ruled out. I suspect that worldwide healthcare statistics (e.g., how many people worldwide suffer from influenza type A annually) have included suspected or uncertain cases in their numbers. To make it more complicated, uncertain cases are not coded in outpatient cases.</p><p>This rule exists to justify a physician's treatment of an unestablished diagnosis. The insurance company must know why the treatment was necessary (I.e., antibiotics before having established a bacterial infection).<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-7" href="#footnote-7" target="_self">7</a></p><p>Including an uncertain diagnosis would be great if it was somehow indicated that it was uncertain. Many electronic health records (EHRs) store ICD-10 codes this way. However, many EHRs do not and a worldwide comparison of research data becomes difficult if we must account for the different ways each EHR stores ICD-10 codes.</p><p>Another dumb rule is when to code symptoms. In the American modification, you should not code symptoms that are integral to one of the established diagnoses. So, you should not code <em>R50.9: Fever, unspecified </em>if the patient has influenza, but you should if they do not have any conditions that typically cause fever. In the International version of ICD-10, you should only code symptoms that affect patient care. Many symptoms will not affect patient care, despite the knowledge of their presence being valuable to medical research. The unreliability of symptom codes means you cannot use ICD-10 codes to research symptom prevalence across conditions. That is a shame. Such information could provide us with the probability of a patient having disease A given symptoms X, Y, and Z, which could help us improve evidence-based medicine. Why not code all symptoms and let algorithms determine whether they affect the encounter cost?</p><p>Similarly, secondary conditions should be coded only if they affect patient care. This is sometimes a subjective decision. Did the patient's obesity affect patient care during the MRI scan or during the blood test?<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-8" href="#footnote-8" target="_self">8</a> Did the patient&#8217;s epilepsy affect the physician&#8217;s decision-making? This rule means that patients have conditions that do not get coded. Yes, many of these conditions are coded in previous encounters, but it is not guaranteed. I doubt that clinicians checks that a condition has been coded in previous encounters before they decide not to code it. Also, researchers may not have access to data from previous encounters. This means that you cannot trust the co-occurrences of diseases in health data. Does obesity cause diabetes, or does obesity more often affect the care for patients with diabetes?<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-9" href="#footnote-9" target="_self">9</a> </p><p>In ICD-10&#8217;s defense, some of these rules were probably introduced to save clinicians&#8217; time. Coding every symptom and condition takes time, and certain rules may be introduced to code only the most essential. However, hopefully, with the rise of AI for medical coding, it may be possible to code everything using less time. </p><h2>ICD 10 is too limited</h2><p>ICD-10 comprises +14,000 codes. That may sound like a lot, but there are actually too few codes. ICD-10 does not cover suicide from helium or charcoal burning. Many rare diseases and manifestations are forgotten.</p><p>The lack of codes would have been less of an issue if ICD-10 was designed better. ICD-10 represents every possible manifestation of a disease with a single code, rather than combining them. Every manifestation of a disease has its own unique code; for example, <em>M84.375P:</em> <em>Stress fracture, left foot, subsequent encounter for fracture with malunion. </em>In other code systems, such as ICD-11 and SNOMED CT, you combine codes. You combine the code for stress fracture with a code for the left foot, and a code for a subsequent encounter. This means that you can express more with less.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-10" href="#footnote-10" target="_self">10</a></p><h2>Each country uses its own modification</h2><p>As a consequence of ICD-10&#8217;s limited expressiveness, each nation has developed its own modification to suit its needs. This makes sharing health data across borders more difficult. While the international version of ICD-10 organizes the codes into a five-level hierarchy, the American modification expands it to seven levels and +70 000 codes. The Danish modification uses extension codes to encode information such as laterality. The German modification introduces codes with an exclamation mark that are used only optionally with a primary diagnosis. In addition, each modification adds and removes codes and has different rules for what to code and when. Chaos.</p><h2>The ICD 10 hierarchy</h2><p>As mentioned, the ICD-10 codes are organized in a hierarchy. At the top of the hierarchy are the chapters such as infections, neoplasms, and blood diseases. Moving down the hierarchy, the conditions become more specific. At the bottom of the hierarchy are the codes, which are the specific manifestations of conditions.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!fWeS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe07ae4d0-4772-4455-8373-3ac87205e34b_1749x1772.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!fWeS!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe07ae4d0-4772-4455-8373-3ac87205e34b_1749x1772.png 424w, /__u/substackcdn.com/image/fetch/$s_!fWeS!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe07ae4d0-4772-4455-8373-3ac87205e34b_1749x1772.png 848w, /__u/substackcdn.com/image/fetch/$s_!fWeS!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe07ae4d0-4772-4455-8373-3ac87205e34b_1749x1772.png 1272w, /__u/substackcdn.com/image/fetch/$s_!fWeS!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe07ae4d0-4772-4455-8373-3ac87205e34b_1749x1772.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!fWeS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe07ae4d0-4772-4455-8373-3ac87205e34b_1749x1772.png" width="1456" height="1475" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e07ae4d0-4772-4455-8373-3ac87205e34b_1749x1772.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1475,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:479328,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://joakimedin.substack.com/i/197475629?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe07ae4d0-4772-4455-8373-3ac87205e34b_1749x1772.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!fWeS!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe07ae4d0-4772-4455-8373-3ac87205e34b_1749x1772.png 424w, /__u/substackcdn.com/image/fetch/$s_!fWeS!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe07ae4d0-4772-4455-8373-3ac87205e34b_1749x1772.png 848w, /__u/substackcdn.com/image/fetch/$s_!fWeS!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe07ae4d0-4772-4455-8373-3ac87205e34b_1749x1772.png 1272w, /__u/substackcdn.com/image/fetch/$s_!fWeS!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe07ae4d0-4772-4455-8373-3ac87205e34b_1749x1772.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Unfortunately, medicine is too complex to be expressed in a single hierarchy. <span>Which chapter should &#8220;Sepsis following a procedure&#8221; be in? </span><em><strong>Certain infectious and parasitic diseases</strong> </em><span>or</span><em> <strong>Injury, poisoning and certain other consequences of external causes</strong>? </em><span>Both are valid, and a single hierarchy cannot reflect that.</span></p><p><span>If you are researching sepsis, you must locate all sepsis-related codes. You cannot rely on the hierarchy for that. Sepsis is in one chapter if the patient is pregnant, another if the patient is newborn, and another if the sepsis is caused by a procedure. What is the point of a hierarchy if you cannot rely on it?</span></p><p><span>In other systems such as SNOMED CT and ICD-11, each code is in multiple hierarchies. You can find the same code multiple places. In SNOMED CT, &#8220;Sepsis following a procedure&#8221; is both a member of &#8220;Sepsis&#8221; and &#8220;Disorder following clinical procedure&#8221;. If you need all sepsis variants, you simply retrieve the codes with &#8220;Sepsis&#8221; as the parent node.</span></p><h1>Will ICD-11 solve the issues?</h1><p>ICD-11 replaced ICD-10 in 2022; however, almost no nation has adopted it yet. It solves many of the issues with ICD-10. It introduces extension codes, meaning most manifestations of conditions can be coded by combining codes. Each code can be part of multiple hierarchies, making it easier than in ICD-10 to find all codes related to a condition. It comprises more codes overall and now includes most rare diseases. It is an excellent upgrade.</p><p>The rules for coding have improved in ICD-11. All coexisting conditions should be coded, rather than only those that affect patient care.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-11" href="#footnote-11" target="_self">11</a> </p><p>That said, ICD-11 still has complex rules for when something should be coded. When a diagnosis is unconfirmed, one must instead code the symptoms, abnormal findings, or problems. Same for ruled-out conditions. The ICD-11<strong> </strong>reference (2.23.5.4)<strong> </strong>states:</p><blockquote><p>The health care practitioner should document as main condition a &#8220;ruled out&#8221; condition when the episode of care involves a person who presents some symptoms or evidence of an abnormal condition which requires study, but who, after examination and observation, show no need for further treatment, follow-up or other medical care.</p></blockquote><p>Also, conditions related to an earlier episode that have no bearing on the current episode should not be coded. </p><p>Why not code all symptoms, abnormal findings, problems, and diagnosis, and add an &#8220;unconfirmed,&#8221; &#8220;ruled-out,&#8221; or &#8220;past condition&#8221; extension code to the diagnosis when appropriate? Why exclude such conditions when the ICD-11 can precisely express them with extension codes? I am a strong opponent of rules that add complexity, subjectivity, and ambiguity.</p><h1>The perfect system</h1><p>ICD-11 is a substantial improvement over ICD-10, but its rules for excluding codes remain a problem.</p><p>In my view, ICD-11 would be close to a perfect system if every condition were coded, with extension codes added to express context such as uncertainty, temporality, and negation. Using this information, algorithms could automatically estimate the cost of an encounter (e.g., by filtering past or negated conditions). We would then have codes valuable for both research and billing.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-12" href="#footnote-12" target="_self">12</a> We would have a system that would ensure that hospitals are reimbursed while properly record suicide methods, so that we can prevent them.</p><p>Coding this way would take more time. However, I believe AI-assisted medical coding will make such comprehensiveness possible without adding to that time. Rather than replacing medical coders, I hope AI will allow them to code more comprehensively.</p><h1>Wrapping up</h1><p>Healthcare systems are diverse and complex, so some of my points here are probably inaccurate or mistaken. If you spot one, feel free to leave a comment; I always appreciate counter-arguments and constructive criticism. </p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>https://pubmed.ncbi.nlm.nih.gov/23245604/</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>https://journals.plos.org/plosmedicine/article?id=10.1371/journal.pmed.1001622</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-3" href="#footnote-anchor-3" class="footnote-number" contenteditable="false" target="_self">3</a><div class="footnote-content"><p>https://www.who.int/publications/i/item/9789241564779</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-4" href="#footnote-anchor-4" class="footnote-number" contenteditable="false" target="_self">4</a><div class="footnote-content"><p>https://link.springer.com/article/10.1186/1471-2458-7-357</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-5" href="#footnote-anchor-5" class="footnote-number" contenteditable="false" target="_self">5</a><div class="footnote-content"><p>ICD-10 is also designed for case-mix, patient safety and quality metrics. </p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-6" href="#footnote-anchor-6" class="footnote-number" contenteditable="false" target="_self">6</a><div class="footnote-content"><p>This rule is in the WHO ICD-10 and ICD-10-CM guidelines. I haven&#8217;t checked the other national modifications of ICD-10.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-7" href="#footnote-anchor-7" class="footnote-number" contenteditable="false" target="_self">7</a><div class="footnote-content"><p>https://pmc.ncbi.nlm.nih.gov/articles/PMC11430383/</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-8" href="#footnote-anchor-8" class="footnote-number" contenteditable="false" target="_self">8</a><div class="footnote-content"><p>The guidelines for which secondary diagnoses to code vary across countries. Conditions such as hypertension, diabetes, and obesity should always be coded in the UK. In the US, these should be coded in inpatient cases, but not necessarily in outpatient.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-9" href="#footnote-anchor-9" class="footnote-number" contenteditable="false" target="_self">9</a><div class="footnote-content"><p> There is strong evidence that obesity is a risk factor for diabetes; this is just an example</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-10" href="#footnote-anchor-10" class="footnote-number" contenteditable="false" target="_self">10</a><div class="footnote-content"><p>SNOMED CT and ICD-11 comprise more codes than ICD-10. The point still stands. You can express more with fewer codes if you can combine them.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-11" href="#footnote-anchor-11" class="footnote-number" contenteditable="false" target="_self">11</a><div class="footnote-content"><p>The rules for coding other coexisting conditions are stated in 2.23.4.3 in <a href="https://icdcdn.who.int/icd11referenceguide/en/html/index.html#main-condition">the ICD-11 reference guide</a>, </p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-12" href="#footnote-anchor-12" class="footnote-number" contenteditable="false" target="_self">12</a><div class="footnote-content"><p>Either ICD-11 or SNOMED CT can be the backbone of this &#8220;perfect coding system.&#8221;</p></div></div>]]></content:encoded></item><item><title><![CDATA[Can we eradicate yellow fever?]]></title><description><![CDATA[V&#243;mito Negro]]></description><link>https://joakimedin.substack.com/p/can-we-eradicate-yellow-fever</link><guid isPermaLink="false">https://joakimedin.substack.com/p/can-we-eradicate-yellow-fever</guid><dc:creator><![CDATA[Joakim Edin]]></dc:creator><pubDate>Sat, 07 Mar 2026 00:59:03 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!OTp9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19b8dd9-fa97-45c8-a825-2c606b55037c_682x500.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>After three days of fever, Jacques was feeling better. In 1802, he was among 33,000 soldiers sent by Napoleon to reoccupy Haiti and reinstitute slavery after a successful slave rebellion. However, the freed slaves had brought with them a secret weapon from West Africa; so secret, in fact, that they were not aware of it themselves.</p><p>The fever was back, and this time accompanied by a deep pain behind his eyes, as though two thumbs were squeezing them out from the inside of his skull. His skin took on a yellowish cast. Then came the vomiting. It was dark, almost black, like wet coffee grounds. The Spanish called the disease <em>V&#243;mito Negro. </em>Soon, he was bleeding from his nose and eyes. He lost consciousness, and then he died. In that, Jacques was fortunate. Other men had to be strapped to their cots, frantic and struggling against nothing, fully awake until the end.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>Of the 33,000 soldiers Napoleon sent to Haiti, fewer than 4,000 came home.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a> </p><p>Napoleon had dreamed of an American empire, and that dream rested on Haiti, the most profitable colony in the Caribbean. In 1803, the year after the loss of Haiti, he sold 828,000 square miles of North American territory to the United States in the Louisiana Purchase. For fifteen million dollars, the young nation doubled in size. Many historians attribute this historical event to yellow fever.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!OTp9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19b8dd9-fa97-45c8-a825-2c606b55037c_682x500.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!OTp9!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19b8dd9-fa97-45c8-a825-2c606b55037c_682x500.jpeg 424w, /__u/substackcdn.com/image/fetch/$s_!OTp9!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19b8dd9-fa97-45c8-a825-2c606b55037c_682x500.jpeg 848w, /__u/substackcdn.com/image/fetch/$s_!OTp9!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19b8dd9-fa97-45c8-a825-2c606b55037c_682x500.jpeg 1272w, /__u/substackcdn.com/image/fetch/$s_!OTp9!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19b8dd9-fa97-45c8-a825-2c606b55037c_682x500.jpeg 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!OTp9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19b8dd9-fa97-45c8-a825-2c606b55037c_682x500.jpeg" width="682" height="500" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a19b8dd9-fa97-45c8-a825-2c606b55037c_682x500.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:500,&quot;width&quot;:682,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;History of Yellow Fever in the U.S.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="History of Yellow Fever in the U.S." title="History of Yellow Fever in the U.S." srcset="/__u/substackcdn.com/image/fetch/$s_!OTp9!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19b8dd9-fa97-45c8-a825-2c606b55037c_682x500.jpeg 424w, /__u/substackcdn.com/image/fetch/$s_!OTp9!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19b8dd9-fa97-45c8-a825-2c606b55037c_682x500.jpeg 848w, /__u/substackcdn.com/image/fetch/$s_!OTp9!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19b8dd9-fa97-45c8-a825-2c606b55037c_682x500.jpeg 1272w, /__u/substackcdn.com/image/fetch/$s_!OTp9!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa19b8dd9-fa97-45c8-a825-2c606b55037c_682x500.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: Wikimedia.org.</figcaption></figure></div><p>Yellow fever is a terrifying disease. While most people experience only influenza-like symptoms &#8212; headache, chills, fever &#8212; 15% move on to the second phase after a brief, deceptive recovery. The liver begins to fail, staining the skin and eyes a deep yellow. Then the bleeding starts. Blood seeps from the nose, the eyes, and the gums.  Inside the stomach, internal bleeding produces a dark, viscous vomit the color of coffee grounds. The kidneys follow the liver into failure. In the final hours, patients become delirious and frantic until they lose consciousness. Half of those who reach the second stage do not survive.</p><p>The disease is caused by a virus transmitted by the same mosquitoes that spread dengue fever, chikungunya, and Zika virus. There is no cure, but a vaccine exists. A single dose provides lifelong immunity. Despite this, yellow fever kills an estimated 78,000 people in Africa every year.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a></p><p>So if the vaccine gives lifelong immunity, why haven&#8217;t we eradicated yellow fever the way we did with smallpox? To answer that question, we must travel to S&#227;o Paulo.</p><p>In 2016, no one in Brazil&#8217;s cities had contracted yellow fever in almost 80 years. Most people assumed it was gone. But yellow fever had never truly disappeared. It had simply retreated into the jungle, circulating quietly among monkeys and forest mosquitoes, beyond the reach of vaccination campaigns. Then, without warning, it moved. The first sign was the deaths of 501 monkeys. Within weeks, the virus had spread to the humans of S&#227;o Paulo, killing 578 people. Many more would have died were it not for the swift vaccination campaign.</p><p>This is what makes yellow fever so difficult to eradicate. Monkeys.</p><h2>Strategies for eradicating yellow fever</h2><p>I wouldn&#8217;t be an engineer in tech if I didn&#8217;t try to find solutions to problems I have no competence in. I will therefore discuss strategies for eradicating the disease.</p><h3>Vaccinating humans</h3><p>The most obvious solution is to vaccinate humans. We only need one vaccination, and then we are almost certainly safe for life. However, there are three challenges.</p><ol><li><p>Delivering vaccines to everyone is difficult, particularly in developing countries and war zones, and a growing number of people refuse vaccination altogether.</p></li><li><p>Eradication is effectively impossible. Unlike smallpox, which infected only humans, yellow fever persists in wild monkey populations in the jungles of Africa and South America. Even if every human on earth were vaccinated today, the virus would survive. The moment vaccination rates dropped, it would return.</p></li><li><p>The vaccine itself carries a very small risk. Roughly 3 people per million develop a serious yellow fever-like illness from the vaccine, and about 4 in 10 of those cases are fatal. You are more likely to be struck by lightning. But when you vaccinate billions of people, it will cost lives.</p></li></ol><h3>Targeting mosquitoes</h3><p>Yellow fever can only be transmitted by certain species of mosquitoes. In cities, the culprit is <em>Aedes aegypti</em>, a small dark mosquito native to West Africa that was carried around the world by the slave trade. It is the same species responsible for dengue fever, chikungunya, and Zika virus. Eliminating it seems like an obvious solution.</p><p>But even if <em>Aedes aegypti</em> were wiped out entirely, yellow fever would not disappear. In the jungle, separate species of <em>Haemagogus</em> and <em>Sabethes</em> mosquitoes keep the virus circulating among monkeys. People who enter jungle areas could still be infected. What elimination would prevent is the urban chain reaction &#8212; the process by which a single jungle infection becomes a city-wide epidemic. As a bonus, it would also eliminate dengue fever, chikungunya, and the Zika virus. The question is how to do it and whether the ecological cost is worth it.</p><ol><li><p><strong>Remove breeding grounds:</strong> <em>Aedes aegypti</em> breeds in still water: flower pots, old tires, buckets, bird baths, even a bottle cap left in the rain. Eliminating standing water can drastically reduce the adult mosquito population. It is one of the oldest and most widely used control strategies, requires no technology, and costs almost nothing. The problem is that eliminating all or even most standing water is nearly impossible, especially in dense cities with poor infrastructure.</p></li><li><p><strong>Gene editing:</strong> A British biotechnology company,&nbsp;<a href="https://en.wikipedia.org/wiki/Oxitec">Oxitec,</a> has developed genetically modified male <em>Aedes aegypti</em> mosquitoes whose female offspring die before reaching maturity. Only males survive to continue the cycle. Since male mosquitoes do not bite, releasing them poses no risk to humans, but over successive generations, the absence of females collapses the local population. Field trials in Brazil reduced <em>Aedes aegypti</em> populations by up to 96%. The catch is that the effect is not permanent. Genetically modified males must be reintroduced continuously, as the population recovers once releases stop. </p></li><li><p><strong>Mosquito nets: </strong>Sleeping under insecticide-treated nets prevents mosquitoes from biting during the night. It is a cheap, widely used, and effective measure. However, <em>Aedes aegypti</em> is primarily a daytime biter, feeding just after sunrise and around sunset. Mosquito nets offer limited protection against a mosquito that strikes while you are awake.</p></li><li><p><strong>Insecticides:</strong> Before the DDT campaign in the 1940s, between one and six million Americans contracted malaria annually. Within a few years, DDT spraying had eradicated malaria from Europe and the United States. In fact, Aedes aegypti used to live in Southern Europe, but was eradicated in this campaign, even though it was not the main target. Can we do the same in Africa and South America<em>? </em>DDT proved catastrophic for the broader environment: it killed other insects (such as bees), accumulated in the food chain, thinned the eggshells of predatory birds, and persisted in soil and water for decades. Furthermore, the mosquitoes evolved resistance to the toxin, much like bacteria become antibiotic-resistant. DDT was banned for agricultural use worldwide in 2004.</p><p></p></li></ol><h3>Vaccinating monkeys</h3><p>Vaccinating humans and eliminating <em>Aedes aegypti</em> mosquitoes will severely reduce the spread of yellow fever, but not eradicate it. To eradicate it, we must remove it from the monkeys. The current approach is laborious and expensive. First, you shoot a monkey with a tranquilizer dart. You must catch it with a net to prevent it from dying from the fall. While ensuring the monkey is breathing properly, you vaccinate it, tag it to prevent vaccinating the same animal twice, and then release it. <a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC9507961/">One study</a> estimated these costs at around 200 USD per monkey. Yet even at that price, vaccinating the thousands of monkeys near urban areas may be more cost-effective than vaccinating the millions of humans living in the cities. Monkeys also tend to be less susceptible to conspiracy theories about vaccines altering their DNA.</p><p>However, to truly eradicate yellow fever, we must also vaccinate the monkeys living in the forests far from humans. This will be more expensive. Here are some potential solutions:</p><ol><li><p><strong>Vaccine darts:</strong> It would be substantially cheaper if we could vaccinate monkeys with darts without tranquilising them first. This technology would need to be developed. We would also need a way to track which monkeys have already been vaccinated, perhaps through monkey facial recognition. One could even create an app that offers bounties to people who successfully vaccinate an unvaccinated monkey.</p></li><li><p><strong>Oral vaccines:</strong> In Europe, rabies in foxes is controlled using oral vaccines hidden in food. This would be a far simpler approach. But the yellow fever vaccine cannot survive the low PH in the stomach, so new delivery technology would need to be developed first. This is expensive, and we do not want to distract biotech companies from humanity&#8217;s true challenges: hair loss and erectile dysfunction.</p></li><li><p><strong>A vaccine trap:</strong> It may be possible to construct a trap that automatically injects a vaccine into an animal. But vaccines must be kept cold, require mixing before injection, and the trap must attract only monkeys while tracking which individuals have already been treated. These problems may simply be too hard to solve within a reasonable budget.</p></li><li><p><strong>Drones:</strong> Okay, this idea is a little stupid. But imagine a swarm of drones targeting monkeys in the forest canopy. They would use facial recognition to identify unvaccinated individuals and shoot vaccine darts at them. The monkeys will almost certainly flee when they hear the loud hum of approaching drones, and we face all the same challenges as with the dart approach, plus several new ones. This idea will probably not work.</p></li></ol><p>Of all the approaches discussed in this piece, I think a combination of vaccinating humans, reducing mosquito populations, and developing an oral vaccine is the most promising path toward eradicating yellow fever. </p><p>Fortunately, the world is not relying on my drone swarm idea. The WHO&#8217;s <a href="https://www.who.int/initiatives/eye-strategy">Eliminate Yellow Fever Epidemics initiative</a>, launched in 2017, aims to end yellow fever epidemics by 2026 and has committed to protecting over a billion people. Progress has been real. But the deadline is approaching, and the disease is not retreating. Yellow fever cases have resurged in several countries in Latin America in 2024 and 2025, including in areas previously unaffected. To make matters worse, on his first day in office, Trump signed an order to withdraw the US from the WHO, removing roughly 18% of its funding overnight. Beyond being a dick move, it may prove to be a self-defeating one. As the planet warms, <em>Aedes aegypti</em> is moving north, and the US is directly in its path.<br><br>We have a vaccine. We have strategies. And yet tens of thousands of people will die of a preventable disease this year. Most of us will never hear about it.</p><p>Wouldn&#8217;t it be great if people stopped puking black vomit?</p><p></p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>The Yellow fever epidemic in 1802: https://pubmed.ncbi.nlm.nih.gov/23169407/</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>In 2013, there were 78,000 (95% CI 19,000&#8211;180,000) deaths by yellow fever in Africa: https://pmc.ncbi.nlm.nih.gov/articles/PMC4011853/</p><p></p></div></div>]]></content:encoded></item><item><title><![CDATA[The neuroscience of artificial neural networks]]></title><description><![CDATA[An introduction to circuit discovery]]></description><link>https://joakimedin.substack.com/p/the-neuroscience-of-artificial-neural</link><guid isPermaLink="false">https://joakimedin.substack.com/p/the-neuroscience-of-artificial-neural</guid><dc:creator><![CDATA[Joakim Edin]]></dc:creator><pubDate>Fri, 12 Dec 2025 09:41:13 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!-RQx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e25c540-8380-4158-a2ba-671d9a6abb2f_811x952.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!-RQx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e25c540-8380-4158-a2ba-671d9a6abb2f_811x952.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!-RQx!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e25c540-8380-4158-a2ba-671d9a6abb2f_811x952.jpeg 424w, /__u/substackcdn.com/image/fetch/$s_!-RQx!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e25c540-8380-4158-a2ba-671d9a6abb2f_811x952.jpeg 848w, /__u/substackcdn.com/image/fetch/$s_!-RQx!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e25c540-8380-4158-a2ba-671d9a6abb2f_811x952.jpeg 1272w, /__u/substackcdn.com/image/fetch/$s_!-RQx!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e25c540-8380-4158-a2ba-671d9a6abb2f_811x952.jpeg 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!-RQx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e25c540-8380-4158-a2ba-671d9a6abb2f_811x952.jpeg" width="434" height="509.45499383477187" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2e25c540-8380-4158-a2ba-671d9a6abb2f_811x952.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:952,&quot;width&quot;:811,&quot;resizeWidth&quot;:434,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;undefined&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="undefined" title="undefined" srcset="/__u/substackcdn.com/image/fetch/$s_!-RQx!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e25c540-8380-4158-a2ba-671d9a6abb2f_811x952.jpeg 424w, /__u/substackcdn.com/image/fetch/$s_!-RQx!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e25c540-8380-4158-a2ba-671d9a6abb2f_811x952.jpeg 848w, /__u/substackcdn.com/image/fetch/$s_!-RQx!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e25c540-8380-4158-a2ba-671d9a6abb2f_811x952.jpeg 1272w, /__u/substackcdn.com/image/fetch/$s_!-RQx!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e25c540-8380-4158-a2ba-671d9a6abb2f_811x952.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><strong>Phineas Gage with his iron rod.</strong> Source: <em>Photograph by Jack and Beverly Wilgus of daguerreotype originally from their collection, and now in the Warren Anatomical Museum, Center for the History of Medicine, Francis A. Countway Library of Medicine, Harvard Medical School.Enlarged using Waifu2x and retouched by Joe Haythornthwaite (see notes on talk page). - Own work, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=64865123</em></figcaption></figure></div><p>In 1843, <strong>Phineas Gage</strong> was using an iron rod to pack explosive powder into a hole. It wasn&#8217;t a hobby of his; he was working on a railway construction project. Suddenly, the powder detonated, driving the iron rod up through his head and exiting his skull before landing 25 meters away from him. Miraculously, Gage survived, but the rod had destroyed much of his frontal lobe. Before the accident, Gage was a capable and shrewd businessman with a well-balanced mind. After his recovery period, his new personality became apparent. He had become vulgar, impatient, and fitful. He was &#8220;no longer Gage,&#8221; according to his acquaintances. He was able to keep neither friends nor jobs and died alone 12 years after his accident.</p><p>Gage&#8217;s story served as one of the first sources of evidence that the frontal lobe is involved in personality. Because of his and others&#8217; tragic stories, we now know that the frontal cortex contributes to higher-order functions such as&nbsp;reasoning, language, and&nbsp;social cognition. Similarly, from patients with damage to the hippocampal regions, we understand how we form memories, and from patients with strokes affecting Broca&#8217;s and Wernicke&#8217;s areas, how we process language.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!iXkN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7eeb51-1df9-4dd9-b74f-e7e51b67a42b_300x300.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!iXkN!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7eeb51-1df9-4dd9-b74f-e7e51b67a42b_300x300.gif 424w, /__u/substackcdn.com/image/fetch/$s_!iXkN!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7eeb51-1df9-4dd9-b74f-e7e51b67a42b_300x300.gif 848w, /__u/substackcdn.com/image/fetch/$s_!iXkN!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7eeb51-1df9-4dd9-b74f-e7e51b67a42b_300x300.gif 1272w, /__u/substackcdn.com/image/fetch/$s_!iXkN!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7eeb51-1df9-4dd9-b74f-e7e51b67a42b_300x300.gif 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!iXkN!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7eeb51-1df9-4dd9-b74f-e7e51b67a42b_300x300.gif" width="320" height="320" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3e7eeb51-1df9-4dd9-b74f-e7e51b67a42b_300x300.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:300,&quot;width&quot;:300,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;A diagram of Gage's skull&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A diagram of Gage's skull" title="A diagram of Gage's skull" srcset="/__u/substackcdn.com/image/fetch/$s_!iXkN!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7eeb51-1df9-4dd9-b74f-e7e51b67a42b_300x300.gif 424w, /__u/substackcdn.com/image/fetch/$s_!iXkN!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7eeb51-1df9-4dd9-b74f-e7e51b67a42b_300x300.gif 848w, /__u/substackcdn.com/image/fetch/$s_!iXkN!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7eeb51-1df9-4dd9-b74f-e7e51b67a42b_300x300.gif 1272w, /__u/substackcdn.com/image/fetch/$s_!iXkN!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e7eeb51-1df9-4dd9-b74f-e7e51b67a42b_300x300.gif 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><strong>Visualization of how the iron rod pierced Phineas Gage&#8217;s skull and brain.</strong> <em>Source: The data is generated by Database Center for Life Science(DBCLS)[3]. - Ratiu P, Talos IF, Haker S, Lieberman D, Everett P. The tale of Phineas Gage, digitally remastered. J Neurotrauma. 2004 May;21(5):637-43. PMID: 15165371 [1]Polygon data is from BodyParts3D[2]., CC BY-SA 2.1 jp, https://commons.wikimedia.org/w/index.php?curid=44466338</em></figcaption></figure></div><p>Similar to how neuroscientists aim to understand the mechanisms of the brain&#8217;s neural network, AI interpretability researchers seek to understand the mechanisms of artificial neural networks. While there are many differences between biological and artificial neural networks, we can employ similar techniques to understand both. When working with artificial neural networks, we can systematically damage, manipulate, and restore any groups of neurons we choose, then observe the results instantly&#8212;luxuries unavailable when studying living brains. These advantages make artificial neural networks a promising testbed for understanding intelligence, yet leveraging them effectively remains an open challenge.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h1>Circuit discovery</h1><p>One emerging approach is <strong>circuit discovery</strong>, which involves identifying the artificial neurons that contribute to specific behaviors. Think of an artificial neural network as a graph, where each <strong>node</strong> is an artificial neuron and each <strong>edge</strong> is a synapse (a connection where one neuron can send signals to another)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a> . A <strong>circuit</strong> is a sub-graph that is sufficient for a task. In other words, if we remove all the nodes and edges that are not in the circuit, the model can still perform the task. The goal of circuit discovery is to identify the circuit for a specific task. For example, when studying how models do arithmetic, researchers might ask: when given the input <em>34 + 28 =</em>, which artificial neurons contribute to the model&#8217;s output: <em>62</em>? After identifying the circuit, researchers can study how the neurons communicate with each other to solve the task. Circuit discovery is the first step in understanding the inner mechanisms of artificial neural networks.</p><p>So how do researchers actually find these circuits? Most circuit discovery work has focused on large language models (LLMs). Most LLMs comprise billions of parameters, which means billions of edges in our graph. To simplify the circuit discovery task, we often group the neurons into components and define an edge as the communication from one component to another. In large language models, natural components in which to group neurons are attention heads and feed-forward layers. </p><p>The traditional approach to finding circuits is hypothesis-driven and manual. A researcher might observe that a model successfully performs arithmetic (say, computing <em>34 + 28 = 62</em>) and form a hypothesis about which components might be responsible. To test this hypothesis, they ablate (disable) those specific components and observe whether the model can still correctly solve arithmetic problems. If the model&#8217;s accuracy drops significantly, those components are likely part of the circuit. If not, the researcher refines their hypothesis and tests different components.</p><p>This iterative process&#8212;hypothesize, ablate, observe, refine&#8212;can take weeks or months for a single circuit. It&#8217;s painstaking detective work that requires both technical expertise and creativity. What if we could do this automatically?</p><h1>Automated circuit discovery</h1><p>The <a href="https://arxiv.org/pdf/2304.14997">first </a><strong><a href="https://arxiv.org/pdf/2304.14997">automated circuit discovery method</a></strong> uses a brute-force approach to identify circuits. It sequentially measures the importance of each edge in the graph. To measure an edge&#8217;s importance, the model is run with that edge ablated (disabled), and the edge&#8217;s importance is determined as the resulting change in the model&#8217;s output. For our arithmetic example, if disabling an edge causes <em>34 + 28</em> to produce an incorrect answer, that edge is part of the arithmetic circuit. If ablating the edge causes a negligible change in the model&#8217;s output, the edge is deemed unimportant and excluded from the circuit. This process is repeated for every edge in the network, resulting in a complete circuit.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!WJBv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e93219-3c3d-4567-91cf-28cc45fb3628_1612x558.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!WJBv!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e93219-3c3d-4567-91cf-28cc45fb3628_1612x558.png 424w, /__u/substackcdn.com/image/fetch/$s_!WJBv!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e93219-3c3d-4567-91cf-28cc45fb3628_1612x558.png 848w, /__u/substackcdn.com/image/fetch/$s_!WJBv!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e93219-3c3d-4567-91cf-28cc45fb3628_1612x558.png 1272w, /__u/substackcdn.com/image/fetch/$s_!WJBv!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e93219-3c3d-4567-91cf-28cc45fb3628_1612x558.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!WJBv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e93219-3c3d-4567-91cf-28cc45fb3628_1612x558.png" width="1456" height="504" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/12e93219-3c3d-4567-91cf-28cc45fb3628_1612x558.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:504,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:78164,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://joakimedin.substack.com/i/175785404?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e93219-3c3d-4567-91cf-28cc45fb3628_1612x558.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!WJBv!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e93219-3c3d-4567-91cf-28cc45fb3628_1612x558.png 424w, /__u/substackcdn.com/image/fetch/$s_!WJBv!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e93219-3c3d-4567-91cf-28cc45fb3628_1612x558.png 848w, /__u/substackcdn.com/image/fetch/$s_!WJBv!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e93219-3c3d-4567-91cf-28cc45fb3628_1612x558.png 1272w, /__u/substackcdn.com/image/fetch/$s_!WJBv!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F12e93219-3c3d-4567-91cf-28cc45fb3628_1612x558.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><strong>An illustration of the steps in the first automated circuit discovery method.</strong> Source: https://arxiv.org/pdf/2304.14997</figcaption></figure></div><p></p><p>This brute-force approach is slow. In GPT-2 Small (120 M parameters), there are hundreds of thousands of edges, meaning the approach requires running the model hundreds of thousands of times (forward passes). For larger models with millions or billions of edges, this method becomes prohibitively slow. To enable circuit discovery for larger models, researchers are developing new, faster methods.</p><h2>Gradient-based methods</h2><p><strong><a href="https://arxiv.org/abs/2310.10348">Edge attribution patching (EAP)</a></strong> is a fast approach for automated circuit discovery. Instead of sequentially ablating edges and measuring the resulting change in the output, EAP computes the importance of all edges simultaneously using gradients. So how can gradients estimate the importance of edges?</p><p>Imagine wiggling each edge by a tiny amount (infinitesimally small) and measuring how much the output wiggles in response. The gradient tells us exactly this: the rate at which output changes as we apply an infinitesimally small change to each edge. Through back-propagation, we can compute these gradients for all edges simultaneously in a single pass&#8212;far faster than testing edges one by one.</p><p>The speed-up comes at the cost of accuracy. As I argued in my blog post &#8220;<a href="/__u/joakimedin.substack.com/p/gradients-are-not-explanations">Gradients are not explanations</a>&#8221;, in non-linear neural networks, applying an infinitesimally small change to a component is different from applying a large change. Furthermore, changing two components separately is not necessarily equivalent to changing them simultaneously. This is because neural networks are full of interactions: components that behave differently depending on what else is active or inactive in the network. One such interaction that is known to occur in LLMs is <strong>self-repair</strong>.</p><h2>Self-repair</h2><p>Imagine if the human brain contained a region that functioned as a personality backup. If something were to happen to the frontal lobe, this region would take over its function, leaving our personality unchanged. In this scenario, Phineas Gage would have kept his personality after the accident, and the frontal lobe&#8217;s role in our personalities would have remained a hidden mystery. Unfortunately, in artificial neural networks, such backup regions exist and constitute a significant challenge to automated circuit discovery.  </p><p>There are several mechanisms in artificial neural networks that cause self-repair. <strong><a href="https://arxiv.org/pdf/2307.15771">The Hydra effect</a> </strong>is when ablating one attention head causes another attention head to increase its signal, thereby compensating for the ablation. Self-repair can also be caused by <strong><a href="https://arxiv.org/pdf/2402.15390">LayerNorm normalization</a></strong>. When you add two similar embeddings and then normalize them by their standard deviation, you get roughly the same magnitude as if you had normalized just one embedding alone. In other words, LayerNorm automatically rescales its inputs to maintain a consistent magnitude. So removing one input causes the normalization to adjust, reducing the impact of the ablation and hiding the removed component&#8217;s contribution.</p><p>We recently discovered a <a href="https://arxiv.org/abs/2505.17630">new self-repair mechanism occurring in attention heads</a>. Two conditions must be met for self-repair in the attention head to occur:</p><ol><li><p>There must be two or more large attention weights in an attention vector.</p></li><li><p>All the value vectors must be similar (as in Key, Query, and Value) at the positions with large attention weights.</p></li></ol><p>When both conditions are satisfied, ablating a single attention score has minimal effect on the output because the softmax activation function compensates by increasing the weights at the other positions. The figure below illustrates this mechanism for an attention head with three input embeddings and an embedding size of one.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!aUOm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2283791-0e62-4dbe-b2b5-3fc57ccbc677_2481x1182.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!aUOm!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2283791-0e62-4dbe-b2b5-3fc57ccbc677_2481x1182.png 424w, /__u/substackcdn.com/image/fetch/$s_!aUOm!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2283791-0e62-4dbe-b2b5-3fc57ccbc677_2481x1182.png 848w, /__u/substackcdn.com/image/fetch/$s_!aUOm!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2283791-0e62-4dbe-b2b5-3fc57ccbc677_2481x1182.png 1272w, /__u/substackcdn.com/image/fetch/$s_!aUOm!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2283791-0e62-4dbe-b2b5-3fc57ccbc677_2481x1182.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!aUOm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2283791-0e62-4dbe-b2b5-3fc57ccbc677_2481x1182.png" width="1456" height="694" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f2283791-0e62-4dbe-b2b5-3fc57ccbc677_2481x1182.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:694,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:229358,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://joakimedin.substack.com/i/175785404?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2283791-0e62-4dbe-b2b5-3fc57ccbc677_2481x1182.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!aUOm!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2283791-0e62-4dbe-b2b5-3fc57ccbc677_2481x1182.png 424w, /__u/substackcdn.com/image/fetch/$s_!aUOm!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2283791-0e62-4dbe-b2b5-3fc57ccbc677_2481x1182.png 848w, /__u/substackcdn.com/image/fetch/$s_!aUOm!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2283791-0e62-4dbe-b2b5-3fc57ccbc677_2481x1182.png 1272w, /__u/substackcdn.com/image/fetch/$s_!aUOm!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff2283791-0e62-4dbe-b2b5-3fc57ccbc677_2481x1182.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><strong>Self-repair in attention heads.</strong> <strong>Ablating one attention score doesn&#8217;t change the output, but ablating two attention scores does. </strong></figcaption></figure></div><p>These self-repair mechanisms deceive automated circuit discovery methods&#8212;both ablation-based and gradient-based. All these methods assume that each component is independent. But as we just learned, this is not the case. When self-repair occurs, the circuit discovery methods will underestimate the importance of components. When self-repair occurs in attention heads, the gradients of the attention scores will be zero, despite their importance.</p><h1>How can we improve gradient-based circuit discovery methods?</h1><p>In our paper, <strong><a href="https://arxiv.org/abs/2505.17630">GIM: Improved Interpretability for Large Language Models</a>, </strong>we modified the computation of gradients (backpropagation) to deal with self-repair. As you will see later in the blog post, this worked remarkably well! Our method currently tops the leadboard for the <a href="https://arxiv.org/abs/2504.13151">Mechanistic Interpretability Benchmark</a>. So how did we do it?  We implemented three modifications:</p><ol><li><p><strong>Temperature-adjusted Softmax Gradients (TSG): </strong>This modification aims at handling self-repair in attention heads.</p></li><li><p><strong>Layernorm freeze: </strong>This modification aims to handle self-repair in LayerNorm normalization.</p></li><li><p><strong>Grad norm: </strong>This aims at normalizing the gradients. Without it, the two modifications above did not work.</p></li></ol><h2>Temperature-adjusted Softmax Gradients</h2><p>TSG modifies backpropagation through attention to address the attention self-repair problem. The motivation behind TSG is well explained through the &#8220;firing squad&#8221; analogy: two soldiers fire at a prisoner, and we want to measure the causal importance of each soldier for the prisoner&#8217;s death. If we measure this by separately preventing each soldier from firing, we would incorrectly conclude that both are innocent, since either shot alone is fatal. To measure their true responsibility, we must simultaneously prevent both shooters from firing.</p><p>Attention self-repair exhibits similar OR-gate behavior to the firing squad example. The gradient of the output with respect to the attention scores measures the effect of perturbing each attention score separately. Instead, we designed TSG to approximate the impact of perturbing multiple attention scores simultaneously. We developed TSG empirically by evaluating which techniques led to the fastest and most accurate approximation of jointly ablating multiple attention scores, while also producing faithful explanations. </p><p>So how does it work? Each time we back-propagate through the softmax activation, we recompute the softmax with a temperature larger than 1. We then back-propagate as usual. That&#8217;s it.</p><p>It is a bit of a hack, and there are probably better approaches out there, but it worked pretty well. In the figure below, we compare ablating two attention scores simultaneously with a) ablating each attention score separately, b) gradients, and c) TSG. As you can see, TSG better approximates ablating both attention scores simultaneously.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!_W-b!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca26907e-ff46-4509-a871-b596bc3bfbc5_1482x436.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!_W-b!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca26907e-ff46-4509-a871-b596bc3bfbc5_1482x436.png 424w, /__u/substackcdn.com/image/fetch/$s_!_W-b!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca26907e-ff46-4509-a871-b596bc3bfbc5_1482x436.png 848w, /__u/substackcdn.com/image/fetch/$s_!_W-b!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca26907e-ff46-4509-a871-b596bc3bfbc5_1482x436.png 1272w, /__u/substackcdn.com/image/fetch/$s_!_W-b!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca26907e-ff46-4509-a871-b596bc3bfbc5_1482x436.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!_W-b!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca26907e-ff46-4509-a871-b596bc3bfbc5_1482x436.png" width="1456" height="428" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ca26907e-ff46-4509-a871-b596bc3bfbc5_1482x436.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:428,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:112410,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://joakimedin.substack.com/i/175785404?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca26907e-ff46-4509-a871-b596bc3bfbc5_1482x436.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!_W-b!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca26907e-ff46-4509-a871-b596bc3bfbc5_1482x436.png 424w, /__u/substackcdn.com/image/fetch/$s_!_W-b!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca26907e-ff46-4509-a871-b596bc3bfbc5_1482x436.png 848w, /__u/substackcdn.com/image/fetch/$s_!_W-b!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca26907e-ff46-4509-a871-b596bc3bfbc5_1482x436.png 1272w, /__u/substackcdn.com/image/fetch/$s_!_W-b!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca26907e-ff46-4509-a871-b596bc3bfbc5_1482x436.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>Layernorm freeze</h2><p>As previously mentioned, LayerNorm normalization can cause self-repair. The fix here is simple, and others have suggested it before us: don&#8217;t backpropagate through the normalization factor. In pytorch, your detach the gradient of the normalization factor during the forward pass:</p><pre><code> y = x / std.detach()</code></pre><h2>Grad norm</h2><p>The final modification, Grad norm, was crucial for the two other modifications to work. The implementation is simple. When two variables are multiplied (A*V, Q*K, or MLPgate*MLPin), we divide the gradient by 2. I initially believed I had discovered this method, but my heart sank when I found that <a href="https://proceedings.mlr.press/v235/achtibat24a.html">another paper from 2024</a> had already proposed it. Anyway, I think that the 2024 paper doesn&#8217;t provide a strong intuition for this work, so here is my attempt at explaining it:</p><p>When multiplying two variables, you must use the product rule to compute the gradient. Let&#8217;s look at an example. In the attention mechanism, we have the query (Q) and key (K).</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;Q = X W_Q, K = X W_K, &quot;,&quot;id&quot;:&quot;ZGZFYWANBO&quot;}" data-component-name="LatexBlockToDOM"></div><p>Where X is the input embeddings, and W_Q and W_K are weight matrices. We compute the attention matrix by multiplying the query and the key.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;A = QK^T&quot;,&quot;id&quot;:&quot;YLAGSKEBAK&quot;}" data-component-name="LatexBlockToDOM"></div><p>Using the product rule, we compute the derivative of the attention matrix given the input as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\frac{\\partial A}{\\partial X} = \\frac{\\partial Q}{\\partial X}K^T + Q\\frac{\\partial K^T}{\\partial X} = W_QK^T+QW_K^T&quot;,&quot;id&quot;:&quot;VHQWJSBOFK&quot;}" data-component-name="LatexBlockToDOM"></div><p>Let&#8217;s say we have an embedding size of 1, and that our variables have the following values:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;X = 3, W_Q=4, W_K=5&quot;,&quot;id&quot;:&quot;PRTTTZIRYB&quot;}" data-component-name="LatexBlockToDOM"></div><p>Using these values, we get:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;Q = 3\\cdot4 =12, K=3\\cdot5=15&quot;,&quot;id&quot;:&quot;JUKROTFBLR&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;A = 12*15 = 180&quot;,&quot;id&quot;:&quot;SKFYAIQMBH&quot;}" data-component-name="LatexBlockToDOM"></div><p>Which gives us:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\frac{\\partial A}{\\partial X}  = W_QK^T+QW_K^T = 4*15 + 12*5 = 60 + 60 = 120&quot;,&quot;id&quot;:&quot;NTIQJVWTDO&quot;}" data-component-name="LatexBlockToDOM"></div><p>When computing EAP (the gradient-based circuit discovery method), we estimate a variable's importance by multiplying it by its gradient<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a>. This gives us:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;X\\cdot \\frac{\\partial A}{\\partial X} = 3 \\cdot 120 = 360&quot;,&quot;id&quot;:&quot;ZVLCESABKJ&quot;}" data-component-name="LatexBlockToDOM"></div><p>Do you see the issue? If we were to change X from 3 to 0, the output would change from 180 to 0. Yet, EAP estimates that the change would be 360. The gradient is doubled because of the product rule. This is why we divide by 2.</p><p>Here is another way to understand why gradients overestimate the importance of variables multiplied together. First-order gradients estimate the impact of varying a single variable while holding the others constant. When two variables are multiplied, varying one changes the product, but the gradient computation assumes the other variable remains fixed. However, when both variables depend on the same underlying parameter (X in our example), changing that parameter varies both variables simultaneously. The gradient captures each variable&#8217;s contribution separately through the product rule, effectively counting the impact twice. This is why multiplied variables systematically overestimate importance by a factor of 2, and why dividing by 2 corrects for this double-counting artifact.</p><p>However, in our example, we looked at embeddings with only one dimension. When we have embeddings with more dimensions, it becomes more complex. </p><h1>Gradient Interaction Modifications</h1><p>We named the combination of all three modifications as <strong>Gradient Interaction Modifications (GIM). </strong>We evaluated GIM on the circuit discovery track in the&nbsp;<a href="https://arxiv.org/abs/2504.13151">Mechanistic Interpretability Benchmark</a>, where it currently <a href="https://huggingface.co/spaces/mib-bench/leaderboard">sits at the top of the public leaderboard!</a> </p><p>The mechanistic interpretability benchmark uses two metrics: <strong>circuit performance ratios (CPR) </strong>and <strong>circuit-model distance (CMD).</strong> In essence, these metrics measure how well we can maintain the model&#8217;s task-specific behavior while removing edges deemed unimportant by the circuit discovery method. For CPR, higher is better, while for CMD, lower is better. Check out <a href="https://arxiv.org/abs/2504.13151">the paper</a> if you want a deeper understanding of these metrics.</p><p>Below, we compare GIM with other circuit discovery methods. <a href="https://arxiv.org/abs/2304.14997">EActP</a> is the first circuit discovery method that ablates edges sequentially to estimate their importance. <a href="https://arxiv.org/abs/2310.10348">EAP</a> is the edge attribution patching method, which uses gradients to estimate the importance of all edges simultaneously. <a href="https://arxiv.org/abs/2403.17806">EAP-IG</a> is similar to EAP, but uses integrated gradients. NAP uses gradients to estimate the importance of nodes instead of edges. The two other methods, <a href="https://aclanthology.org/2024.emnlp-main.965.pdf">IFR (Information Flow Routes) </a>and <a href="https://proceedings.neurips.cc/paper_files/paper/2024/file/c55e6792923cc16fd6ed5c3f672420a5-Paper-Conference.pdf">UGS (Uniform Gradient Sampling)</a>, are two approaches that I&#8217;m not covering in this blog post.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!sT8e!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F302b2e8a-a1c8-4626-aac9-cbcc64e51bad_1478x640.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!sT8e!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F302b2e8a-a1c8-4626-aac9-cbcc64e51bad_1478x640.png 424w, /__u/substackcdn.com/image/fetch/$s_!sT8e!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F302b2e8a-a1c8-4626-aac9-cbcc64e51bad_1478x640.png 848w, /__u/substackcdn.com/image/fetch/$s_!sT8e!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F302b2e8a-a1c8-4626-aac9-cbcc64e51bad_1478x640.png 1272w, /__u/substackcdn.com/image/fetch/$s_!sT8e!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F302b2e8a-a1c8-4626-aac9-cbcc64e51bad_1478x640.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!sT8e!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F302b2e8a-a1c8-4626-aac9-cbcc64e51bad_1478x640.png" width="1456" height="630" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/302b2e8a-a1c8-4626-aac9-cbcc64e51bad_1478x640.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:630,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:183645,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://joakimedin.substack.com/i/175785404?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F302b2e8a-a1c8-4626-aac9-cbcc64e51bad_1478x640.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!sT8e!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F302b2e8a-a1c8-4626-aac9-cbcc64e51bad_1478x640.png 424w, /__u/substackcdn.com/image/fetch/$s_!sT8e!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F302b2e8a-a1c8-4626-aac9-cbcc64e51bad_1478x640.png 848w, /__u/substackcdn.com/image/fetch/$s_!sT8e!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F302b2e8a-a1c8-4626-aac9-cbcc64e51bad_1478x640.png 1272w, /__u/substackcdn.com/image/fetch/$s_!sT8e!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F302b2e8a-a1c8-4626-aac9-cbcc64e51bad_1478x640.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!TJJf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4403d1f5-67b8-4b09-baf4-e08dd7c2e261_1526x678.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!TJJf!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4403d1f5-67b8-4b09-baf4-e08dd7c2e261_1526x678.png 424w, /__u/substackcdn.com/image/fetch/$s_!TJJf!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4403d1f5-67b8-4b09-baf4-e08dd7c2e261_1526x678.png 848w, /__u/substackcdn.com/image/fetch/$s_!TJJf!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4403d1f5-67b8-4b09-baf4-e08dd7c2e261_1526x678.png 1272w, /__u/substackcdn.com/image/fetch/$s_!TJJf!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4403d1f5-67b8-4b09-baf4-e08dd7c2e261_1526x678.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!TJJf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4403d1f5-67b8-4b09-baf4-e08dd7c2e261_1526x678.png" width="1456" height="647" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4403d1f5-67b8-4b09-baf4-e08dd7c2e261_1526x678.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:647,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:185867,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://joakimedin.substack.com/i/175785404?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4403d1f5-67b8-4b09-baf4-e08dd7c2e261_1526x678.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!TJJf!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4403d1f5-67b8-4b09-baf4-e08dd7c2e261_1526x678.png 424w, /__u/substackcdn.com/image/fetch/$s_!TJJf!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4403d1f5-67b8-4b09-baf4-e08dd7c2e261_1526x678.png 848w, /__u/substackcdn.com/image/fetch/$s_!TJJf!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4403d1f5-67b8-4b09-baf4-e08dd7c2e261_1526x678.png 1272w, /__u/substackcdn.com/image/fetch/$s_!TJJf!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4403d1f5-67b8-4b09-baf4-e08dd7c2e261_1526x678.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>GIM achieves substantially better CPR scores than other approaches while achieving similar CMD scores to EAP-IG. Since CMD ignores the sign of attribution scores (using high-magnitude scoring) while CPR preserves it (using high-value scoring), this difference suggests that GIM excels specifically at correctly determining whether edges contribute positively or negatively to the output.</p><p>We released a <a href="https://pypi.org/project/gim-explain/">Python package</a> that you can easily use for most transformer-based language models. </p><h1>Wrapping up</h1><p>Phineas Gage&#8217;s accident gave us crucial insights into the frontal lobe, but came at a terrible human cost. With artificial neural networks, we can conduct the equivalent of thousands of Phineas Gage experiments every hour&#8212;systematically disabling components, observing changes, and mapping the circuits responsible for specific behaviors. Methods like GIM are making these experiments more accurate by accounting for the backup systems that would have kept Gage&#8217;s accident a mystery. As circuit discovery continues to improve, we&#8217;re building the tools to finally understand the mechanisms of intelligence&#8212;artificial and perhaps eventually biological.</p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>There is a common misconception that the number of parameters in a model refers to the number of artificial neurons in a model. It actually refers to the number of synapses, i.e., the number of connections between neurons. </p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>EAP actually computes the gradient by the variable minus the counterfactual variable. However, for simplicity, I use a counterfactual variable of 0 in my example.</p></div></div>]]></content:encoded></item><item><title><![CDATA[Why class priors are model shortcuts]]></title><description><![CDATA[The hidden cheat code]]></description><link>https://joakimedin.substack.com/p/why-class-priors-are-model-shortcuts</link><guid isPermaLink="false">https://joakimedin.substack.com/p/why-class-priors-are-model-shortcuts</guid><dc:creator><![CDATA[Joakim Edin]]></dc:creator><pubDate>Wed, 03 Dec 2025 17:03:32 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!5SAs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c3bfdc-2a7d-45ea-954f-55f12f7e9b19_730x732.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In 2018, researchers evaluated a machine learning model trained to detect pneumonia in chest X-rays. Unlike previous studies, they tested the model on images from hospitals that were not included in the training data.</p><p>One would assume that X-rays are universal; if a model can diagnose pneumonia in one hospital, it should be able to do so in another. But the model failed spectacularly.</p><p>It turned out the model had learned to identify specific hospital systems with near-perfect accuracy by detecting a hospital-specific metal token placed in the corner of the images. It combined this &#8220;token detection&#8221; with the hospital&#8217;s specific pneumonia prevalence rate to make a guess. It achieved high accuracy without learning much about pneumonia. When images from new hospitals lacked these tokens, the model struggled.</p><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!5SAs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c3bfdc-2a7d-45ea-954f-55f12f7e9b19_730x732.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!5SAs!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c3bfdc-2a7d-45ea-954f-55f12f7e9b19_730x732.png 424w, /__u/substackcdn.com/image/fetch/$s_!5SAs!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c3bfdc-2a7d-45ea-954f-55f12f7e9b19_730x732.png 848w, /__u/substackcdn.com/image/fetch/$s_!5SAs!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c3bfdc-2a7d-45ea-954f-55f12f7e9b19_730x732.png 1272w, /__u/substackcdn.com/image/fetch/$s_!5SAs!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c3bfdc-2a7d-45ea-954f-55f12f7e9b19_730x732.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!5SAs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c3bfdc-2a7d-45ea-954f-55f12f7e9b19_730x732.png" width="730" height="732" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/99c3bfdc-2a7d-45ea-954f-55f12f7e9b19_730x732.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:732,&quot;width&quot;:730,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:545202,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://joakimedin.substack.com/i/180596940?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c3bfdc-2a7d-45ea-954f-55f12f7e9b19_730x732.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!5SAs!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c3bfdc-2a7d-45ea-954f-55f12f7e9b19_730x732.png 424w, /__u/substackcdn.com/image/fetch/$s_!5SAs!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c3bfdc-2a7d-45ea-954f-55f12f7e9b19_730x732.png 848w, /__u/substackcdn.com/image/fetch/$s_!5SAs!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c3bfdc-2a7d-45ea-954f-55f12f7e9b19_730x732.png 1272w, /__u/substackcdn.com/image/fetch/$s_!5SAs!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c3bfdc-2a7d-45ea-954f-55f12f7e9b19_730x732.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">A machine-learning model detecting pneumonia based on X-ray images learned to rely on a hospital-specific metal token in the images to recognize the hospitals. The model would rely on that hospitals prevalence of pneumonia to predict the disease. Source: https://journals.plos.org/plosmedicine/article?id=10.1371/journal.pmed.1002683#pmed-1002683-t002</figcaption></figure></div><h3></h3><p>This is the textbook definition of <strong>shortcut learning</strong>.</p><p>In machine learning, a shortcut is a decision rule that performs well on in-domain data but fails to transfer to out-of-domain data. The model finds a cheat code: a feature that happens to correlate with the label in the training set but has no causal link to the object itself.</p><p>For instance, a model might learn that &#8220;sand&#8221; equals &#8220;camel.&#8221; Consequently, if it sees a cow on a beach, it predicts &#8220;camel&#8221; &#8212; not because it recognizes the animal, but because it relies on the sandy background as a proxy for the class.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h2>The hidden shortcut: Class priors</h2><p>The cow example relies on a spurious correlation with the environment. But there is an even simpler, more pervasive shortcut that doesn&#8217;t rely on the background pixels at all, but rather on the raw statistics of the label itself: <strong>The class prior</strong>.</p><p>In most datasets, we have <em>class imbalance</em>: one class is far more frequent than another.</p><p>If 90% of the patients in a training dataset have a certain disease, the model is heavily incentivized to predict that disease to minimize its error rate. This is what I call the <strong>class prior</strong>.</p><p>While deep learning models don&#8217;t explicitly calculate probabilities like a Bayesian statistician, they effectively approximate the same logic. During training, the model learns to optimize the relationship between what it sees and what it expects:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{Posterior} \\propto \\text{Likelihood} \\times \\text{Prior}&quot;,&quot;id&quot;:&quot;IBJVVYRPCX&quot;}" data-component-name="LatexBlockToDOM"></div><h2>The Bayesian breakdown</h2><p>To understand why this breaks models, we need to understand the three components of that equation:</p><ol><li><p><strong>Likelihood (evidence):</strong> This is the visual information. It asks: <em>&#8220;Given that this patient definitely has pneumonia, what is the probability that their X-ray looks like this?&#8221;</em> Ideally, this is what we want our model to learn&#8212;spotting lung shadows.</p></li><li><p><strong>Prior (class prevalence):</strong> This is the context. It asks: <em>&#8220;Before looking at any X-rays, how common is pneumonia?&#8221;</em> The model will learn the prior based on the training data. If the data is from an infectious disease ward, the prior probability of an infection is high. If the data is from a grocery store, the prior is low. </p></li><li><p><strong>Posterior (prediction):</strong> This is the final answer. It combines the likelihood and the prior probability to determine: <em>&#8220;Given this X-ray, what is the probability the patient has pneumonia?&#8221;</em></p></li></ol><p>The model learns to weigh the <strong>Likelihood</strong> against the <strong>Prior</strong>. If the prior is overwhelming (e.g., 90% prevalence), the model learns a massive bias term for that class. Even if the visual evidence (Likelihood) is ambiguous, this learned bias dominates the calculation, forcing the final prediction (Posterior) toward the majority class. This is why researchers often try to balance the classes when training models.</p><h2>Priors are weak features</h2><p>From a robust machine learning perspective, class priors are just shortcuts in disguise.</p><p>We can think of the prior as a &#8220;feature&#8221; the model uses to make decisions. But unlike causal features, the prior is a <strong>weak feature</strong> because it is not intrinsic to the subject; it is a property of the environment.</p><ul><li><p><strong>Intrinsic feature (strong):</strong> &#8220;Fluid in the lungs.&#8221; This is a strong predictor of pneumonia regardless of where the patient is located.</p></li><li><p><strong>Environmental feature (weak):</strong> &#8220;Being in a dataset where 90% of people are sick.&#8221; This is a weak feature that is specific only to the training environment.</p></li></ul><p>The danger of treating the prior as a feature becomes obvious when we swap domains. This is where the shortcut breaks.</p><p>Consider a model trained in a <strong>Specialist Hospital</strong> (Training Domain) and deployed to a <strong>General Practitioner&#8217;s (GP) Office</strong> (Deployment Domain).</p><ol><li><p><strong>Training (high prior):</strong> In the specialist hospital, the disease is common (e.g., 50% prevalence). The model learns a large bias term for this class.</p></li><li><p><strong>Deployment (low prior):</strong> At the GP&#8217;s office, the disease is rare (e.g., 1% prevalence).</p></li></ol><p>When the model is deployed at the GP&#8217;s office, it carries that large bias term with it. It sees a healthy patient with vague symptoms (low likelihood), but when it multiplies that evidence by its massive internal prior, the result is a false positive.</p><p>The model applies the hospital's statistics to the population of a local clinic. By relying on the prior, the model becomes brittle and fails the moment the environment changes. We want our models to be causal reasoners: predicting a class only when there is evidence in the input, not guessing based on prevalences.</p><h2>Should we decouple the prior?</h2><p>Dismissing priors entirely is too hasty. Input data is often noisy, incomplete, or ambiguous. In these situations, the &#8220;likelihood&#8221; signal is weak. If a radiologist sees a blurry shadow that could be a tumor or a glitch, ignoring the base rate might lead to worse performance if the prior is well calibrated</p><p>Perhaps, we want the model to output the likelihood independent of the priors. If we train models to output the pure likelihood (the strength of the visual evidence), we gain control. We can then manually inject the appropriate prior for the specific deployment environment.</p><p>If the model is in a GP office, we multiply the likelihood by a low prior. If it is in a specialist ward, we multiply by a high prior. By decoupling the evidence from the prevalence, we turn a brittle shortcut into a flexible tool.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Code Like Humans ]]></title><description><![CDATA[A new framework for automated medical coding]]></description><link>https://joakimedin.substack.com/p/code-like-humans</link><guid isPermaLink="false">https://joakimedin.substack.com/p/code-like-humans</guid><dc:creator><![CDATA[Joakim Edin]]></dc:creator><pubDate>Mon, 22 Sep 2025 08:11:25 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/45150233-5f67-4059-8527-f26de28891bf_384x260.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>At Corti, we&#8217;re actively working on new ideas for automated medical coding.</p><p>Automated medical coding models predict medical codes from clinical notes. These codes are alphanumeric representations of diagnoses or procedures used for documentation, billing, and statistics.</p><p>Progress in automated medical coding has stagnated. There has been virtually no innovation since the introduction of label-wise attention in 2018 &#8212; only variations of the same ideas. It is time for something new.</p><p>This is a bold claim, but we believe our new framework, Code Like Humans (CLH), is what the field desperately needs. <a href="https://arxiv.org/abs/2509.05378">Our paper presenting the framework</a> was recently accepted for EMNLP 2025 findings. In this post, we will cover how it works and what comes next. However, to motivate our framework, we will first explain why existing approaches fail and how professional medical coders assign codes.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p><h1>Why current approaches fail</h1><p>Current state-of-the-art medical coding models require large datasets of clinical notes annotated with medical codes. In effect, these models memorize codes present in the training data. This approach has several limitations:</p><ol><li><p>Acquiring clinical notes annotated with medical codes is challenging. Most health care providers are unable or unwilling to share such valuable private data.</p></li><li><p>A code must appear frequently for models to predict it reliably. Thus, models are unable to predict codes that do not occur in the training data and struggle with rare codes. In MIMIC-IV, only 6,000 out of the 70,000 ICD-10-CM codes appear in the training data.</p></li><li><p>Coding systems, such as ICD-10-CM and CPT, are updated annually. Adapting the models to predict the new versions requires re-annotating the datasets and re-training the models.</p></li><li><p>Models trained on codes from one department or specialty may not generalize well to another.</p></li></ol><p>Several studies address these challenges by training models to use external resources describing the codes rather than memorizing them. External resources include the code hierarchies, code descriptions, code synonyms, and code co-occurrences. Although using external resources is a logical solution to the problem, previous studies on ICD coding have misused the resources and neglected essential resources such as the alphabetic index and the official guidelines (see <a href="/__u/joakimedin.substack.com/p/a-critical-look-at-trending-ideas">this blog post</a> for a more detailed criticism of these approaches).</p><p>Recent studies also explore large language models (without fine-tuning) for code extraction, data augmentation for rare codes, and few-shot learning. Most show poor results, except for those that deviously evaluate on artificially generated data, despite real-world data being publicly available.</p><p>The greatest weakness of current approaches is that they overlook how humans assign medical codes. Here is how humans do it.</p><h1>How humans assign medical codes</h1><p>Many coding systems are used in healthcare, but we will focus on ICD-10: the International Classification of Diseases, 10th Revision, which is the primary coding system used for documenting diagnoses in most countries worldwide.</p><h2>Understanding ICD-10 Code Structure</h2><p>ICD-10 codes follow an alphanumeric format that reflects a hierarchy. Each code begins with a letter (A-Z) followed by two digits, creating three-character categories (e.g., J44: Other chronic obstructive pulmonary disease). Codes can be extended with a decimal point and additional characters, up to two in the international version and up to four in the American modification, ICD-10-CM.</p><p>The hierarchy is structured as follows:</p><ul><li><p><strong>ICD Chapters</strong>: The initial letter groups codes into 22 broad chapters covering different body systems or types of conditions (e.g., Chapter 10, "Diseases of the respiratory system," uses codes J00-J99)</p></li><li><p><strong>Categories</strong>: Three characters representing general condition types within each chapter (e.g., J44: Chronic obstructive pulmonary disease)</p></li><li><p><strong>Subcategories</strong>: Four characters (four to six in ICD-10-CM) providing additional information (e.g., J44.0 = COPD with acute lower respiratory infection)</p></li><li><p><strong>Codes</strong>: Leaf nodes in the ICD hierarchy. Can have between three and five characters (or up to seven in ICD-10-CM). A category is a code if it has no child nodes.</p></li></ul><p>With approximately 14,000 codes in the international ICD-10 (and about 70,000 in the American ICD-10-CM modification), navigating this vast classification system requires systematic tools and resources.</p><h2>The Three Essential Coding Resources</h2><p>For ICD coding, human medical coders rely on three resources to navigate this extensive hierarchy:</p><p>The<strong> tabular list</strong> contains the hierarchy. It further contains instructional notes that specify when to exclude or add supplementary codes. For example, at code I50.9 (Heart failure, unspecified), the tabular list includes the instruction "code first," directing coders to also assign a code for the underlying condition that caused the heart failure, such as hypertension.</p><p>The <strong>alphabetic index</strong> serves as the entry point into the hierarchy, with an extensive cross-reference of medical terms, conditions, and synonyms that direct coders to the appropriate categories, subcategories, or codes in the tabular list. Rather than searching through thousands of codes sequentially, coders can quickly jump to the relevant part of the hierarchy.</p><p>The <strong>guidelines</strong> provide rules for code selection within the hierarchy. The guidelines include general coding principles that apply across all chapters, plus chapter-specific instructions that address unique coding considerations for different body systems and condition types.</p><h2>The Coding Process</h2><p>Medical coding is translation, converting the messy language of clinical practice into ICD-10's rigid hierarchy. The process mirrors how we naturally move from general to specific, uncertainty to precision.</p><h3>Step 1: Extract signal from noise</h3><p>The medical record contains everything. First, one must extract what matters for coding. Identify the conditions that influenced care delivered in the current admission. Everything else is noise.</p><h3>Step 2: Navigate the alphabetic index</h3><p>For each identified condition, look up the main term (usually the condition's noun) in the alphabetic index. Each main term has modifier terms, which you must use to specify the condition further. The final term points one to a code or sub-category. The alphabetic index suggests codes but gives no final answers. It's like a search engine.</p><h3>Step 3: Verify each code in the tabular list</h3><p>Use the tabular list to verify the code suggested by the alphabetic index or to traverse down the hierarchy when a sub-category is suggested. As mentioned, the tabular list also provides instructional notes that offer more information for selecting the appropriate codes and when to add or exclude codes.</p><h3>Step 4: Verify the final list</h3><p>While the two previous steps have focused on each condition separately, this step considers the entire list of code candidates identified so far. Using the instructional notes and guidelines, remove codes that should not be reported together. For example, mutually exclusive ones or a symptom code when a definitive diagnosis is coded. Then sequence the codes.</p><h1>Code like humans</h1><p>The idea behind Code Like Humans is simple. We designed four agents following the steps above, as shown in the figure:</p><ol><li><p><strong>Evidence extractor.</strong> Identifies codeable conditions in clinical notes.</p></li><li><p><strong>Index navigator.</strong> Iterating through each codeable condition, the agent locates the term in the alphabetical index. The output is a list of candidate codes.</p></li><li><p><strong>Tabular validator</strong>. Verifies and refines the candidate codes from the <strong>Index navigator </strong>by using the tabular list and chapter-specific guidelines.</p></li><li><p><strong>Code reconciler. </strong>Considers all the code candidates identified by the <strong>Tabular validator. </strong>Using the guidelines and instructional notes, it removes codes and sequences the final list.</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!NAYN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e80d2a6-ad2e-4499-b7eb-de58282ac195_1148x940.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!NAYN!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e80d2a6-ad2e-4499-b7eb-de58282ac195_1148x940.png 424w, /__u/substackcdn.com/image/fetch/$s_!NAYN!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e80d2a6-ad2e-4499-b7eb-de58282ac195_1148x940.png 848w, /__u/substackcdn.com/image/fetch/$s_!NAYN!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e80d2a6-ad2e-4499-b7eb-de58282ac195_1148x940.png 1272w, /__u/substackcdn.com/image/fetch/$s_!NAYN!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e80d2a6-ad2e-4499-b7eb-de58282ac195_1148x940.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!NAYN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e80d2a6-ad2e-4499-b7eb-de58282ac195_1148x940.png" width="1148" height="940" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0e80d2a6-ad2e-4499-b7eb-de58282ac195_1148x940.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:940,&quot;width&quot;:1148,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!NAYN!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e80d2a6-ad2e-4499-b7eb-de58282ac195_1148x940.png 424w, /__u/substackcdn.com/image/fetch/$s_!NAYN!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e80d2a6-ad2e-4499-b7eb-de58282ac195_1148x940.png 848w, /__u/substackcdn.com/image/fetch/$s_!NAYN!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e80d2a6-ad2e-4499-b7eb-de58282ac195_1148x940.png 1272w, /__u/substackcdn.com/image/fetch/$s_!NAYN!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e80d2a6-ad2e-4499-b7eb-de58282ac195_1148x940.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Our implementation was primitive; it was intended as a proof-of-concept. Our agents were large language models without any fine-tuning. The agents don&#8217;t need to be large language models. For instance, the index navigator can be a search engine.</p><h1>Results</h1><p>We compared Code Like Humans with PLM-ICD, a state-of-the-art model trained on clinical notes annotated with ICD-10 codes (MIMIC-IV). We evaluated the methods on MDACE, which consists of 300 clinical notes from MIMIC reannotated by professional medical coders.</p><p>Despite not being fine-tuned for the task, Code Like Humans achieved a higher F1 macro score than PLM-ICD (28% vs 25%). However, PLM-ICD achieved a superior F1 micro score (48% vs 43%). These results suggest that Code Like Humans is better at predicting rare codes, while PLM-ICD is better at predicting frequent codes. So which is better?</p><p>We trained and evaluated PLM-ICD on data from the same department. As a result, the codes that were frequent in the training data were also frequent in the test data. This gave PLM-ICD an unfair advantage. If we had tested on a different department in a different specialty, other codes would have been frequent, which would remove PLM-ICD&#8217;s advantage.</p><p>On the other hand, PLM-ICD is only trained on discharge summaries, while we evaluated the methods on all clinical note types. This was a disadvantage for PLM-ICD; however, it is something it ideally should be capable of handling.</p><h1>Next steps</h1><p>Whether this version of Code Like Humans is superior to PLM-ICD is inconsequential; what matters is its potential. PLM-ICD trained on MIMIC can only predict the 6,000 codes that appear in the training set; Code Like Humans can predict all 70,000 ICD-10-CM codes. PLM-ICD must be retrained to support a new ICD-10 version; Code Like Humans simply needs access to the latest guidelines, tabular list, and alphabetic index. PLM-ICD sucks at predicting rare codes; our basic implementation of Code Like Humans sucks less.</p><p>There are many low-hanging fruit for the proceeding studies. Each agent can be evaluated independently:</p><ol><li><p><strong>Evidence extractor: </strong>Compare the output with human-annotated evidence spans from MDACE or <a href="https://aclanthology.org/2025.acl-long.1489/">Douglas et al. (2025)</a>.</p></li><li><p><strong>Index navigator: </strong>Compare the output with ground-truth terms. One can find the ground-truth terms by back-tracing from the annotated ICD-10 codes. To control the input of the agent, provide it with ground truth evidence that spans from MDACE.</p></li><li><p><strong>Tabular validator</strong>: Provide the agent with a set of candidate codes/sub-categories, where the human-annotated code from MDACE is among them.</p></li><li><p><strong>Code reconciler: </strong>Provide the agent with a list of codes where some of them are incorrect. Measure how well the model performs in removing incorrect codes from the list. You can also measure how well the agent orders the list. We did not do the latter in the paper.</p></li></ol><p>Since each agent can be evaluated individually, one study can focus on improving one agent. The field can work in parallel on different agents, and by combining the improved agents, we may collectively achieve a new state-of-the-art method. If you are interested in joining this effort, check out the error analysis of each agent in the paper. We show, for instance, that the evidence extractor struggles in identifying codeable terms that are not related to diseases, such as smoking habits and instructions about resuscitation.</p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[An introduction to SNOMED CT]]></title><description><![CDATA[Soon to be mandatory in all EU hospitals]]></description><link>https://joakimedin.substack.com/p/an-introduction-to-snomed-ct</link><guid isPermaLink="false">https://joakimedin.substack.com/p/an-introduction-to-snomed-ct</guid><dc:creator><![CDATA[Joakim Edin]]></dc:creator><pubDate>Wed, 03 Sep 2025 11:23:57 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/ad1c6b83-cc2b-40e5-a8bb-a7c1ca210a8e_1456x1048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A rumour is spreading: the EU will soon announce that SNOMED CT will be mandatory in all hospitals by 2028. If this rumour is true, this will be a significant change for European health care. Since I only have experience with ICD-10, I decided to read up on SNOMED CT. Here is what I learned.</p><h2>Why is ICD-10 insufficient?</h2><p>ICD-10 lacks expressiveness. ICD-10 &#8220;only&#8221; comprises 14,000 codes. Although this may sound like a lot, it is insufficient to document all clinical scenarios, which has consequences for monitoring and policy making. For example:</p><ul><li><p>Using helium to commit suicide has become more frequent in the past decades<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a>. However, there is no ICD-10 code for this specific suicide method. Consequently, implementing policies to prevent this form of suicide and monitoring their effectiveness is difficult. </p></li><li><p>Respiratory acidosis,  lactic acidosis, and metabolic acidosis all have the ICD-10 code: E87.2 Acidosis. The lack of specificity hinders research and finding ideal participants for clinical trials.</p></li></ul><p>Due to the lack of expressiveness of ICD-10, most countries have designed national modifications. The American modification, ICD-10-CM, comprises 70,000 codes, encompassing conditions such as being struck by a turtle and burns resulting from water-skis on fire. Yet, it does not include enough conditions (for example, the variations of acidosis above). Furthermore, national modifications are undesirable because comparing data across countries becomes challenging. We want everyone to use the same system!</p><p>Moreover, ICD-10&#8217;s single enormous tree-like hierarchy is awkward. Which chapter should &#8220;Sepsis following a procedure&#8221; be in? <em>A00&#8211;B99 Certain infectious and parasitic diseases </em>or<em> S00&#8211;T98 Injury, poisoning and certain other consequences of external causes? </em>Both are valid, and a single hierarchy cannot reflect that. </p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h2>SNOMED CT</h2><p>SNOMED CT is a clinical terminology that comprises 350,000+ concepts structured in multiple hierarchies. In nerdy language, SNOMED CT is a graph, where each concept is a node, and the nodes are connected with different types of one-directional edges. Each concept has a unique identifier, a preferred name, and a list of synonyms.</p><p>The power of SNOMED CT lies in its ability to represent clinical concepts with incredible granularity. Where ICD-10 gives you "E87.2 Acidosis," SNOMED CT offers distinct concepts for respiratory acidosis (12326000), lactic acidosis (91273001), and metabolic acidosis (59455009). This specificity enables precise documentation, better clinical decision support, and more targeted research. </p><p>SNOMED CT's graph structure solves the hierarchy problem. Take "Sepsis due to and following procedure" (122041110001119105) as an example. We can see how SNOMED CT represents this complex concept through different types of relationships with other concepts (notice that concepts are not necessarily diseases):</p><ul><li><p><strong>Is a</strong>: Organ dysfunction syndrome (capturing the systemic nature) <em>238147009</em></p></li><li><p><strong>Due to</strong>: Infectious disease (the underlying cause) <em>40733004</em></p></li><li><p><strong>Due to/After</strong>: Procedure (the temporal and causal relationship) <em>71388002</em></p></li><li><p><strong>Finding site</strong>: Body organ structure <em>113343008</em></p></li><li><p><strong>Associated morphology</strong>: Inflammatory morphology <em>409774005</em></p></li><li><p><strong>Pathological process</strong>: Dysregulated host response <em>769256002</em></p></li></ul><p>This graph structure elegantly captures what ICD-10 struggles to categorize: &#8220;sepsis due to and following procedure&#8221; is simultaneously an infection, a procedural complication, and an organ dysfunction syndrome. The graph structure allows each relationship to be explicitly defined rather than forcing the concept into a single hierarchy.</p><p>The system also supports post-coordination, meaning clinicians can combine existing concepts to create new, more specific descriptions on the fly<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a>. For instance, you can represent suicide using helium by combining the two concepts: &#8220;Suicide (event) <em>44301001&#8221;</em> <strong>due to</strong> &#8220;Helium (substance) <em>90317004.</em>&#8220;  With post-coordination, you can precisely describe conditions without pre-existing codes for every possible combination. SNOMED CT uses a specific grammar for post-coordination. An overview of this grammar is shown in the figure below. You can read more about this grammar <a href="https://confluence.ihtsdotools.org/display/DOCSTART/7.+SNOMED+CT+Expressions">here</a>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!xmWY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25b9d201-807f-4ffc-97ae-e7ceab27fc7c_2454x1114.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!xmWY!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25b9d201-807f-4ffc-97ae-e7ceab27fc7c_2454x1114.png 424w, /__u/substackcdn.com/image/fetch/$s_!xmWY!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25b9d201-807f-4ffc-97ae-e7ceab27fc7c_2454x1114.png 848w, /__u/substackcdn.com/image/fetch/$s_!xmWY!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25b9d201-807f-4ffc-97ae-e7ceab27fc7c_2454x1114.png 1272w, /__u/substackcdn.com/image/fetch/$s_!xmWY!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25b9d201-807f-4ffc-97ae-e7ceab27fc7c_2454x1114.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!xmWY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25b9d201-807f-4ffc-97ae-e7ceab27fc7c_2454x1114.png" width="725" height="329.13804945054943" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/25b9d201-807f-4ffc-97ae-e7ceab27fc7c_2454x1114.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:661,&quot;width&quot;:1456,&quot;resizeWidth&quot;:725,&quot;bytes&quot;:462634,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://joakimedin.substack.com/i/172563422?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25b9d201-807f-4ffc-97ae-e7ceab27fc7c_2454x1114.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!xmWY!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25b9d201-807f-4ffc-97ae-e7ceab27fc7c_2454x1114.png 424w, /__u/substackcdn.com/image/fetch/$s_!xmWY!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25b9d201-807f-4ffc-97ae-e7ceab27fc7c_2454x1114.png 848w, /__u/substackcdn.com/image/fetch/$s_!xmWY!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25b9d201-807f-4ffc-97ae-e7ceab27fc7c_2454x1114.png 1272w, /__u/substackcdn.com/image/fetch/$s_!xmWY!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25b9d201-807f-4ffc-97ae-e7ceab27fc7c_2454x1114.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Here is an example of how to use the grammar to represent a family history of a particular disease.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!I0fz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c508c42-8f96-4d53-afe2-711b25eb24d6_2138x582.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!I0fz!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c508c42-8f96-4d53-afe2-711b25eb24d6_2138x582.png 424w, /__u/substackcdn.com/image/fetch/$s_!I0fz!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c508c42-8f96-4d53-afe2-711b25eb24d6_2138x582.png 848w, /__u/substackcdn.com/image/fetch/$s_!I0fz!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c508c42-8f96-4d53-afe2-711b25eb24d6_2138x582.png 1272w, /__u/substackcdn.com/image/fetch/$s_!I0fz!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c508c42-8f96-4d53-afe2-711b25eb24d6_2138x582.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!I0fz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c508c42-8f96-4d53-afe2-711b25eb24d6_2138x582.png" width="1456" height="396" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3c508c42-8f96-4d53-afe2-711b25eb24d6_2138x582.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:396,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:217018,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://joakimedin.substack.com/i/172563422?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c508c42-8f96-4d53-afe2-711b25eb24d6_2138x582.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!I0fz!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c508c42-8f96-4d53-afe2-711b25eb24d6_2138x582.png 424w, /__u/substackcdn.com/image/fetch/$s_!I0fz!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c508c42-8f96-4d53-afe2-711b25eb24d6_2138x582.png 848w, /__u/substackcdn.com/image/fetch/$s_!I0fz!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c508c42-8f96-4d53-afe2-711b25eb24d6_2138x582.png 1272w, /__u/substackcdn.com/image/fetch/$s_!I0fz!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c508c42-8f96-4d53-afe2-711b25eb24d6_2138x582.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>A really cool feature of SNOMED CT is that you can generate specific queries using the different attributes (read relationship). So if you have electronic health records annotated with SNOMED CT, you get a powerful search engine. Below are two examples of queries.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!404c!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee74aba-4740-40a3-990c-908a9f9fdaae_1874x1170.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!404c!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee74aba-4740-40a3-990c-908a9f9fdaae_1874x1170.png 424w, /__u/substackcdn.com/image/fetch/$s_!404c!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee74aba-4740-40a3-990c-908a9f9fdaae_1874x1170.png 848w, /__u/substackcdn.com/image/fetch/$s_!404c!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee74aba-4740-40a3-990c-908a9f9fdaae_1874x1170.png 1272w, /__u/substackcdn.com/image/fetch/$s_!404c!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee74aba-4740-40a3-990c-908a9f9fdaae_1874x1170.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!404c!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee74aba-4740-40a3-990c-908a9f9fdaae_1874x1170.png" width="1456" height="909" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fee74aba-4740-40a3-990c-908a9f9fdaae_1874x1170.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:909,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:401756,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://joakimedin.substack.com/i/172563422?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee74aba-4740-40a3-990c-908a9f9fdaae_1874x1170.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!404c!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee74aba-4740-40a3-990c-908a9f9fdaae_1874x1170.png 424w, /__u/substackcdn.com/image/fetch/$s_!404c!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee74aba-4740-40a3-990c-908a9f9fdaae_1874x1170.png 848w, /__u/substackcdn.com/image/fetch/$s_!404c!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee74aba-4740-40a3-990c-908a9f9fdaae_1874x1170.png 1272w, /__u/substackcdn.com/image/fetch/$s_!404c!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffee74aba-4740-40a3-990c-908a9f9fdaae_1874x1170.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!-Tqe!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5620114-bee9-430b-a15f-be3b68814073_1894x1236.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!-Tqe!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5620114-bee9-430b-a15f-be3b68814073_1894x1236.png 424w, /__u/substackcdn.com/image/fetch/$s_!-Tqe!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5620114-bee9-430b-a15f-be3b68814073_1894x1236.png 848w, /__u/substackcdn.com/image/fetch/$s_!-Tqe!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5620114-bee9-430b-a15f-be3b68814073_1894x1236.png 1272w, /__u/substackcdn.com/image/fetch/$s_!-Tqe!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5620114-bee9-430b-a15f-be3b68814073_1894x1236.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!-Tqe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5620114-bee9-430b-a15f-be3b68814073_1894x1236.png" width="1456" height="950" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c5620114-bee9-430b-a15f-be3b68814073_1894x1236.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:950,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:421224,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://joakimedin.substack.com/i/172563422?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5620114-bee9-430b-a15f-be3b68814073_1894x1236.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!-Tqe!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5620114-bee9-430b-a15f-be3b68814073_1894x1236.png 424w, /__u/substackcdn.com/image/fetch/$s_!-Tqe!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5620114-bee9-430b-a15f-be3b68814073_1894x1236.png 848w, /__u/substackcdn.com/image/fetch/$s_!-Tqe!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5620114-bee9-430b-a15f-be3b68814073_1894x1236.png 1272w, /__u/substackcdn.com/image/fetch/$s_!-Tqe!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc5620114-bee9-430b-a15f-be3b68814073_1894x1236.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><h2>We still need ICD-10</h2><p>Despite SNOMED CT's superiority for clinical documentation, ICD-10 isn't going anywhere. Here's why:</p><p><strong>Billing and reimbursement</strong>: Healthcare payment systems worldwide are built on ICD-10. Insurance companies, government programs, and hospital finance departments have decades of infrastructure designed around these codes. Rebuilding these systems would be monumentally expensive and disruptive.</p><p><strong>Statistical reporting</strong>: WHO requires ICD-10 for international health statistics. Mortality reports, disease surveillance, and epidemiological studies all depend on ICD-10's standardized, albeit limited, classification system.</p><p><strong>The learning curve</strong>: ICD-10's 14,000 codes are already challenging for many clinicians to master. SNOMED CT's 350,000+ concepts represent a steep learning curve that many healthcare systems aren't prepared to climb.</p><h2>The path forward: Mapping, not replacing</h2><p>The future isn't about choosing between SNOMED CT and ICD-10; it's about using them together. SNOMED CT can capture the clinical detail at the point of care, while automated mapping tools translate these detailed concepts into ICD-10 codes for billing and reporting. However, I&#8217;m uncertain of the accuracy of existing automated mapping tools.</p><p>If the EU mandate rumours are true, we're looking at a dual-system future: SNOMED CT for clinical documentation and decision support, ICD-10 for administrative functions. The challenge will be building robust mapping tools and training healthcare workers to navigate both systems effectively. These challenges may be alleviated by using machine-learning models to predict SNOMED CT codes. However, this may prove difficult to develop as most countries do not have clinical notes annotated with SNOMED CT codes available. There exist NLP approaches for predicting SNOMED CT, but they rely on old NLP techniques, so I&#8217;m unsure whether they are sufficiently accurate. Another possibility is using large language models. Perhaps it is possible to develop a multi-agent approach that leverages the structure and information in SNOMED CT to select the appropriate concepts, even without fine-tuning.</p><p>The transition won't be easy or cheap. Still, the potential benefits of better clinical documentation, improved patient safety, enhanced research capabilities, and eventually, true interoperability across European healthcare systems might make implementing SNOMED CT worth the effort. </p><p></p><h3>Resources to learn more</h3><ul><li><p>The <a href="https://confluence.ihtsdotools.org/display/DOCSTART/1.+Introduction">SNOMED CT starter guide</a> is a great resource for learning about SNOMED CT. Things are clearly explained with a lot of figures.</p></li><li><p>You can play around with SNOMED CT in <a href="https://browser.ihtsdotools.org/?perspective=full&amp;conceptId1=12204111000119105&amp;edition=MAIN/SNOMEDCT-DERIVATIVES/2025-01-01&amp;release=&amp;languages=en">this browser</a>.</p></li><li><p>You can learn more about the differences between SNOMED CT and ICD-10 in this excellent<a href="https://www.nlm.nih.gov/research/umls/mapping_projects/SNOMED_ICD10_KWFung.pptx"> PowerPoint presentation</a></p></li></ul><p></p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>https://www.who.int/publications/i/item/9789241564779</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>https://confluence.ihtsdotools.org/display/DOCSTART/7.+SNOMED+CT+Expressions</p><p></p></div></div>]]></content:encoded></item><item><title><![CDATA[Large language models think that 3.11 > 3.9 because of the Bible]]></title><description><![CDATA[Large language models struggle with comparing numbers with decimals.]]></description><link>https://joakimedin.substack.com/p/large-language-models-think-that</link><guid isPermaLink="false">https://joakimedin.substack.com/p/large-language-models-think-that</guid><dc:creator><![CDATA[Joakim Edin]]></dc:creator><pubDate>Fri, 25 Oct 2024 10:45:55 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/c56bab6c-6d36-4e08-a1c9-b2a7d047b428_1024x1024.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Large language models struggle with comparing numbers with decimals. Here are a few examples:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!eZMy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa694ad47-ed9d-4bba-8bde-b21e2c6f064b_1236x415.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!eZMy!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa694ad47-ed9d-4bba-8bde-b21e2c6f064b_1236x415.png 424w, /__u/substackcdn.com/image/fetch/$s_!eZMy!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa694ad47-ed9d-4bba-8bde-b21e2c6f064b_1236x415.png 848w, /__u/substackcdn.com/image/fetch/$s_!eZMy!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa694ad47-ed9d-4bba-8bde-b21e2c6f064b_1236x415.png 1272w, /__u/substackcdn.com/image/fetch/$s_!eZMy!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa694ad47-ed9d-4bba-8bde-b21e2c6f064b_1236x415.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!eZMy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa694ad47-ed9d-4bba-8bde-b21e2c6f064b_1236x415.png" width="596" height="200.11326860841424" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a694ad47-ed9d-4bba-8bde-b21e2c6f064b_1236x415.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:415,&quot;width&quot;:1236,&quot;resizeWidth&quot;:596,&quot;bytes&quot;:49045,&quot;alt&quot;:&quot;image&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="image" title="image" srcset="/__u/substackcdn.com/image/fetch/$s_!eZMy!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa694ad47-ed9d-4bba-8bde-b21e2c6f064b_1236x415.png 424w, /__u/substackcdn.com/image/fetch/$s_!eZMy!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa694ad47-ed9d-4bba-8bde-b21e2c6f064b_1236x415.png 848w, /__u/substackcdn.com/image/fetch/$s_!eZMy!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa694ad47-ed9d-4bba-8bde-b21e2c6f064b_1236x415.png 1272w, /__u/substackcdn.com/image/fetch/$s_!eZMy!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa694ad47-ed9d-4bba-8bde-b21e2c6f064b_1236x415.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!ID34!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77ceab04-f5f3-46fb-a5a7-8bf75e96fe14_1652x1010.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!ID34!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77ceab04-f5f3-46fb-a5a7-8bf75e96fe14_1652x1010.png 424w, /__u/substackcdn.com/image/fetch/$s_!ID34!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77ceab04-f5f3-46fb-a5a7-8bf75e96fe14_1652x1010.png 848w, /__u/substackcdn.com/image/fetch/$s_!ID34!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77ceab04-f5f3-46fb-a5a7-8bf75e96fe14_1652x1010.png 1272w, /__u/substackcdn.com/image/fetch/$s_!ID34!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77ceab04-f5f3-46fb-a5a7-8bf75e96fe14_1652x1010.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!ID34!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77ceab04-f5f3-46fb-a5a7-8bf75e96fe14_1652x1010.png" width="596" height="364.3131868131868" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/77ceab04-f5f3-46fb-a5a7-8bf75e96fe14_1652x1010.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:890,&quot;width&quot;:1456,&quot;resizeWidth&quot;:596,&quot;bytes&quot;:131034,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!ID34!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77ceab04-f5f3-46fb-a5a7-8bf75e96fe14_1652x1010.png 424w, /__u/substackcdn.com/image/fetch/$s_!ID34!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77ceab04-f5f3-46fb-a5a7-8bf75e96fe14_1652x1010.png 848w, /__u/substackcdn.com/image/fetch/$s_!ID34!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77ceab04-f5f3-46fb-a5a7-8bf75e96fe14_1652x1010.png 1272w, /__u/substackcdn.com/image/fetch/$s_!ID34!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77ceab04-f5f3-46fb-a5a7-8bf75e96fe14_1652x1010.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><a href="https://transluce.org/">Transluce</a>, a non-profit start-up, recently released a <a href="https://monitor.transluce.org/dashboard/chat">really cool demo</a> to investigate and change unwanted behaviors of large language models. In the demo, they dive into why a large language model (Llama-3.1 8B Instruct) struggles with comparing numbers.<br><br>They demonstrate that neurons representing biblical verses and calendar dates activate when comparing 9.9 with 9.11. In these two settings, 9.11 is indeed bigger than 9.9. They then suppress the neurons representing biblical verses and calendar dates, and the model correctly answers that 9.9 is bigger than 9.11. I encourage you to check out <a href="https://monitor.transluce.org/dashboard/chat">the demo</a>!</p><p>There are still improvements to be made. In the demo, they only investigate neurons. However, in most cases, a <a href="https://transformer-circuits.pub/2022/toy_model/index.html">feature is represented by multiple neurons</a>, not one. If they considered the directions in representation space instead of neurons, they might have detected more features, such as software package versions. That being said, extracting features represented by multiple neurons is an unsolved researched problem, so it&#8217;s understandable that they started with individual neurons. </p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Has Apple proven that large language models are incapable of logical reasoning?]]></title><description><![CDATA[I don't think so.]]></description><link>https://joakimedin.substack.com/p/has-apple-proven-that-large-language</link><guid isPermaLink="false">https://joakimedin.substack.com/p/has-apple-proven-that-large-language</guid><dc:creator><![CDATA[Joakim Edin]]></dc:creator><pubDate>Sun, 20 Oct 2024 15:22:22 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!i-Se!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93abf2fd-2572-4f22-8d40-bd76b1e93eaa_1634x1334.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Apple researchers recently published <a href="https://arxiv.org/abs/2410.05229">GSM-Symbolic: Understanding the Limitations of Mathematical Reasoning in Large Language Models</a>, which they claim provides evidence that large language models (LLM) can&#8217;t perform logical reasoning. </p><blockquote><p>We hypothesize that this decline is because current LLMs cannot perform genuine logical reasoning; they replicate reasoning steps from their training data. Adding a single clause that seems relevant to the question causes significant performance drops (up to 65%) across all state-of-the-art models, even though the clause doesn't contribute to the reasoning chain needed for the final answer.</p></blockquote><p>While I find their findings interesting, they failed to consider alternative hypotheses. Instead of showing that LLMs can&#8217;t reason, they may have shown that their logical reasoning is sometimes flawed. </p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>So, what were their findings, and why do I disagree with their conclusions?</p><h1>GSM-symbolic</h1><p>GSM8K is a popular benchmark for evaluating LLMs&#8217; mathematical reasoning capabilities. The dataset comprises 8000 grade-school math questions and answers. However, many researchers fear that LLMs are trained on GSM8K, meaning that we have shown the math students the exam questions and answers before the exam. </p><p>Mirzadeh et al. (the Apple researchers) evaluate what happens if you make small changes to the GSM8K questions. They create question-answer templates that allow them to change the variables in the questions effortlessly. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!i-Se!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93abf2fd-2572-4f22-8d40-bd76b1e93eaa_1634x1334.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!i-Se!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93abf2fd-2572-4f22-8d40-bd76b1e93eaa_1634x1334.png 424w, /__u/substackcdn.com/image/fetch/$s_!i-Se!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93abf2fd-2572-4f22-8d40-bd76b1e93eaa_1634x1334.png 848w, /__u/substackcdn.com/image/fetch/$s_!i-Se!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93abf2fd-2572-4f22-8d40-bd76b1e93eaa_1634x1334.png 1272w, /__u/substackcdn.com/image/fetch/$s_!i-Se!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93abf2fd-2572-4f22-8d40-bd76b1e93eaa_1634x1334.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!i-Se!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93abf2fd-2572-4f22-8d40-bd76b1e93eaa_1634x1334.png" width="584" height="476.9065934065934" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/93abf2fd-2572-4f22-8d40-bd76b1e93eaa_1634x1334.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1189,&quot;width&quot;:1456,&quot;resizeWidth&quot;:584,&quot;bytes&quot;:469501,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!i-Se!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93abf2fd-2572-4f22-8d40-bd76b1e93eaa_1634x1334.png 424w, /__u/substackcdn.com/image/fetch/$s_!i-Se!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93abf2fd-2572-4f22-8d40-bd76b1e93eaa_1634x1334.png 848w, /__u/substackcdn.com/image/fetch/$s_!i-Se!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93abf2fd-2572-4f22-8d40-bd76b1e93eaa_1634x1334.png 1272w, /__u/substackcdn.com/image/fetch/$s_!i-Se!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93abf2fd-2572-4f22-8d40-bd76b1e93eaa_1634x1334.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><h2>LLMs are sensitive to meaningless changes.</h2><p>Below are the results when the names (e.g., Sophie, Jack, etc.) and numbers are varied. Each of the six plots shows the result for a specific LLM. The dotted black vertical line indicates an LLM&#8217;s performance on the original GSM8K benchmark.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!a4et!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f1bc133-7f5a-47ad-8a44-d16d2d4fbed9_1958x940.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!a4et!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f1bc133-7f5a-47ad-8a44-d16d2d4fbed9_1958x940.jpeg 424w, /__u/substackcdn.com/image/fetch/$s_!a4et!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f1bc133-7f5a-47ad-8a44-d16d2d4fbed9_1958x940.jpeg 848w, /__u/substackcdn.com/image/fetch/$s_!a4et!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f1bc133-7f5a-47ad-8a44-d16d2d4fbed9_1958x940.jpeg 1272w, /__u/substackcdn.com/image/fetch/$s_!a4et!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f1bc133-7f5a-47ad-8a44-d16d2d4fbed9_1958x940.jpeg 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!a4et!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f1bc133-7f5a-47ad-8a44-d16d2d4fbed9_1958x940.jpeg" width="1456" height="699" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3f1bc133-7f5a-47ad-8a44-d16d2d4fbed9_1958x940.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:699,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Image" title="Image" srcset="/__u/substackcdn.com/image/fetch/$s_!a4et!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f1bc133-7f5a-47ad-8a44-d16d2d4fbed9_1958x940.jpeg 424w, /__u/substackcdn.com/image/fetch/$s_!a4et!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f1bc133-7f5a-47ad-8a44-d16d2d4fbed9_1958x940.jpeg 848w, /__u/substackcdn.com/image/fetch/$s_!a4et!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f1bc133-7f5a-47ad-8a44-d16d2d4fbed9_1958x940.jpeg 1272w, /__u/substackcdn.com/image/fetch/$s_!a4et!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f1bc133-7f5a-47ad-8a44-d16d2d4fbed9_1958x940.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Changing the names impacts the performance, and changing the numbers changes it even more. Changing the names of the characters in a math question should naturally not affect the answer. But, is being affected by irrelevant changes evidence that the models are incapable of reason?</p><p>It could, but it could also indicate that their logical reasoning is flawed. For example, LLMs are known for preferring frequent tokens over in-frequent. If any of the names or numbers in the template are more common, that may impact the performance. Also, how each model tokenized the numbers may impact the performance. Is it stupid? Yes. Does it mean no reasoning? No. </p><h2>LLMs are worse at harder questions.</h2><p>Next, they evaluated the effect of changing the questions&#8217; difficulty. They created three additional templates with increasing difficulty: M1, P1, and P2. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!wd7h!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa517e8f1-6473-4117-bafc-eb5f77c2aa10_1608x766.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!wd7h!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa517e8f1-6473-4117-bafc-eb5f77c2aa10_1608x766.png 424w, /__u/substackcdn.com/image/fetch/$s_!wd7h!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa517e8f1-6473-4117-bafc-eb5f77c2aa10_1608x766.png 848w, /__u/substackcdn.com/image/fetch/$s_!wd7h!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa517e8f1-6473-4117-bafc-eb5f77c2aa10_1608x766.png 1272w, /__u/substackcdn.com/image/fetch/$s_!wd7h!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa517e8f1-6473-4117-bafc-eb5f77c2aa10_1608x766.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!wd7h!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa517e8f1-6473-4117-bafc-eb5f77c2aa10_1608x766.png" width="1456" height="694" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a517e8f1-6473-4117-bafc-eb5f77c2aa10_1608x766.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:694,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:263966,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!wd7h!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa517e8f1-6473-4117-bafc-eb5f77c2aa10_1608x766.png 424w, /__u/substackcdn.com/image/fetch/$s_!wd7h!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa517e8f1-6473-4117-bafc-eb5f77c2aa10_1608x766.png 848w, /__u/substackcdn.com/image/fetch/$s_!wd7h!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa517e8f1-6473-4117-bafc-eb5f77c2aa10_1608x766.png 1272w, /__u/substackcdn.com/image/fetch/$s_!wd7h!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa517e8f1-6473-4117-bafc-eb5f77c2aa10_1608x766.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!YM3g!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9ce3152-1817-4128-a80f-ed190fc91a63_1612x974.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!YM3g!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9ce3152-1817-4128-a80f-ed190fc91a63_1612x974.png 424w, /__u/substackcdn.com/image/fetch/$s_!YM3g!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9ce3152-1817-4128-a80f-ed190fc91a63_1612x974.png 848w, /__u/substackcdn.com/image/fetch/$s_!YM3g!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9ce3152-1817-4128-a80f-ed190fc91a63_1612x974.png 1272w, /__u/substackcdn.com/image/fetch/$s_!YM3g!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9ce3152-1817-4128-a80f-ed190fc91a63_1612x974.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!YM3g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9ce3152-1817-4128-a80f-ed190fc91a63_1612x974.png" width="1456" height="880" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f9ce3152-1817-4128-a80f-ed190fc91a63_1612x974.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:880,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:407280,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!YM3g!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9ce3152-1817-4128-a80f-ed190fc91a63_1612x974.png 424w, /__u/substackcdn.com/image/fetch/$s_!YM3g!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9ce3152-1817-4128-a80f-ed190fc91a63_1612x974.png 848w, /__u/substackcdn.com/image/fetch/$s_!YM3g!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9ce3152-1817-4128-a80f-ed190fc91a63_1612x974.png 1272w, /__u/substackcdn.com/image/fetch/$s_!YM3g!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff9ce3152-1817-4128-a80f-ed190fc91a63_1612x974.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>They found that as the difficulty increases, the performance decreases, and the variance increases. Again, is this proof that LLMs can&#8217;t reason? Nope. You can perform logical reasoning but struggle with difficult questions. Also, the more tokens you have to output to answer a question, the more probable are errors. It&#8217;s quite simple. The more times you try to predict sometimes, the more likely you are to make a mistake.</p><h2>Trick-questions trick LLMs</h2><p>They create a template to test how inserting &#8220;irrelevant&#8221; sentences affects LLMs. In the example below, they add, &#8220;but five of them were a bit smaller than average,&#8221; which the LLMs infer that the kiwis should be subtracted.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!uudC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e115567-dec1-4c98-9d61-527f9acc6bb6_1618x1052.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!uudC!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e115567-dec1-4c98-9d61-527f9acc6bb6_1618x1052.png 424w, /__u/substackcdn.com/image/fetch/$s_!uudC!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e115567-dec1-4c98-9d61-527f9acc6bb6_1618x1052.png 848w, /__u/substackcdn.com/image/fetch/$s_!uudC!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e115567-dec1-4c98-9d61-527f9acc6bb6_1618x1052.png 1272w, /__u/substackcdn.com/image/fetch/$s_!uudC!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e115567-dec1-4c98-9d61-527f9acc6bb6_1618x1052.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!uudC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e115567-dec1-4c98-9d61-527f9acc6bb6_1618x1052.png" width="700" height="455.28846153846155" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6e115567-dec1-4c98-9d61-527f9acc6bb6_1618x1052.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:947,&quot;width&quot;:1456,&quot;resizeWidth&quot;:700,&quot;bytes&quot;:332202,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!uudC!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e115567-dec1-4c98-9d61-527f9acc6bb6_1618x1052.png 424w, /__u/substackcdn.com/image/fetch/$s_!uudC!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e115567-dec1-4c98-9d61-527f9acc6bb6_1618x1052.png 848w, /__u/substackcdn.com/image/fetch/$s_!uudC!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e115567-dec1-4c98-9d61-527f9acc6bb6_1618x1052.png 1272w, /__u/substackcdn.com/image/fetch/$s_!uudC!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e115567-dec1-4c98-9d61-527f9acc6bb6_1618x1052.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!bCaU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9b2dca-9774-4b60-9222-2437fcc196f7_638x924.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!bCaU!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9b2dca-9774-4b60-9222-2437fcc196f7_638x924.png 424w, /__u/substackcdn.com/image/fetch/$s_!bCaU!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9b2dca-9774-4b60-9222-2437fcc196f7_638x924.png 848w, /__u/substackcdn.com/image/fetch/$s_!bCaU!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9b2dca-9774-4b60-9222-2437fcc196f7_638x924.png 1272w, /__u/substackcdn.com/image/fetch/$s_!bCaU!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9b2dca-9774-4b60-9222-2437fcc196f7_638x924.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!bCaU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9b2dca-9774-4b60-9222-2437fcc196f7_638x924.png" width="310" height="448.9655172413793" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9e9b2dca-9774-4b60-9222-2437fcc196f7_638x924.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:924,&quot;width&quot;:638,&quot;resizeWidth&quot;:310,&quot;bytes&quot;:131506,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!bCaU!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9b2dca-9774-4b60-9222-2437fcc196f7_638x924.png 424w, /__u/substackcdn.com/image/fetch/$s_!bCaU!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9b2dca-9774-4b60-9222-2437fcc196f7_638x924.png 848w, /__u/substackcdn.com/image/fetch/$s_!bCaU!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9b2dca-9774-4b60-9222-2437fcc196f7_638x924.png 1272w, /__u/substackcdn.com/image/fetch/$s_!bCaU!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e9b2dca-9774-4b60-9222-2437fcc196f7_638x924.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The figure above depicts the performance drop when inserting these irrelevant sentences. Mirzadeh et al. claim this is evidence of a lack of logical reasoning. </p><p>I completely disagree. LLMs are trained on a vast amount of text. Most of this text is not produced by mathematicians. Most people are not as precise as mathematicians. They will often imply things despite not stating them explicitly. Understanding imperfectly formulated questions is the desired LLM behavior; otherwise, LLMs will misunderstand too many questions posed by non-mathematicians. </p><p>So, no, this is not evidence that LLMs can&#8217;t reason. They are just trained to infer information from imprecise questions.</p><h2>Summary</h2><p>While the experiments in this paper were excellent, they failed to consider alternative hypotheses in analyzing their findings. It seems they had decided on their conclusion beforehand, i.e., confirmation bias. Don&#8217;t get me wrong. Their hypothesis could be correct. I just wish they did a better job considering other explanations. </p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[An Unsupervised Approach to Achieve Supervised-Level Explainability in Healthcare Records]]></title><description><![CDATA[A deep dive into our EMNLP 2024 paper]]></description><link>https://joakimedin.substack.com/p/an-unsupervised-approach-to-achieve</link><guid isPermaLink="false">https://joakimedin.substack.com/p/an-unsupervised-approach-to-achieve</guid><dc:creator><![CDATA[Joakim Edin]]></dc:creator><pubDate>Wed, 02 Oct 2024 07:48:35 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/117e9d67-7344-47c7-8eb8-41248344ca3d_160x112.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Our paper, "<a href="https://arxiv.org/pdf/2406.08958">An Unsupervised Approach to Achieve Supervised-Level Explainability in Healthcare Records</a>," was recently accepted to the main conference of EMNLP 2024. </p><p>This blog post will explore the paper's core ideas and findings. Specifically, we'll examine how we developed a new method for generating explanations for automated medical coding models that rival supervised approaches' performance&#8212;without requiring expensive annotations.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h1>The Power of Explanations</h1><p>Explainability is crucial for making automated medical coding useful in the real world. Consider the following example:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!CmTa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2693cb3-01bf-4590-99b2-9c9331194b72_1388x1026.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!CmTa!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2693cb3-01bf-4590-99b2-9c9331194b72_1388x1026.png 424w, /__u/substackcdn.com/image/fetch/$s_!CmTa!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2693cb3-01bf-4590-99b2-9c9331194b72_1388x1026.png 848w, /__u/substackcdn.com/image/fetch/$s_!CmTa!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2693cb3-01bf-4590-99b2-9c9331194b72_1388x1026.png 1272w, /__u/substackcdn.com/image/fetch/$s_!CmTa!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2693cb3-01bf-4590-99b2-9c9331194b72_1388x1026.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!CmTa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2693cb3-01bf-4590-99b2-9c9331194b72_1388x1026.png" width="1388" height="1026" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c2693cb3-01bf-4590-99b2-9c9331194b72_1388x1026.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1026,&quot;width&quot;:1388,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!CmTa!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2693cb3-01bf-4590-99b2-9c9331194b72_1388x1026.png 424w, /__u/substackcdn.com/image/fetch/$s_!CmTa!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2693cb3-01bf-4590-99b2-9c9331194b72_1388x1026.png 848w, /__u/substackcdn.com/image/fetch/$s_!CmTa!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2693cb3-01bf-4590-99b2-9c9331194b72_1388x1026.png 1272w, /__u/substackcdn.com/image/fetch/$s_!CmTa!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2693cb3-01bf-4590-99b2-9c9331194b72_1388x1026.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Validating these codes is time-consuming, even for this relatively simple example. You must locate the evidence of each medical code and then verify if that evidence is sufficient. Imagine when the clinical note comprises thousands of words!</p><p>Now, look how much easier it becomes with explanations:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!o2A_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d128d64-750e-415d-813f-a776e597165b_1408x1036.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!o2A_!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d128d64-750e-415d-813f-a776e597165b_1408x1036.png 424w, /__u/substackcdn.com/image/fetch/$s_!o2A_!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d128d64-750e-415d-813f-a776e597165b_1408x1036.png 848w, /__u/substackcdn.com/image/fetch/$s_!o2A_!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d128d64-750e-415d-813f-a776e597165b_1408x1036.png 1272w, /__u/substackcdn.com/image/fetch/$s_!o2A_!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d128d64-750e-415d-813f-a776e597165b_1408x1036.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!o2A_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d128d64-750e-415d-813f-a776e597165b_1408x1036.png" width="1408" height="1036" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9d128d64-750e-415d-813f-a776e597165b_1408x1036.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1036,&quot;width&quot;:1408,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!o2A_!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d128d64-750e-415d-813f-a776e597165b_1408x1036.png 424w, /__u/substackcdn.com/image/fetch/$s_!o2A_!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d128d64-750e-415d-813f-a776e597165b_1408x1036.png 848w, /__u/substackcdn.com/image/fetch/$s_!o2A_!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d128d64-750e-415d-813f-a776e597165b_1408x1036.png 1272w, /__u/substackcdn.com/image/fetch/$s_!o2A_!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d128d64-750e-415d-813f-a776e597165b_1408x1036.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>You can hover your mouse over the code, and it will show you the evidence&#8212;much faster! Not only can it help us validate errors faster, but it can also be an excellent tool for debugging the model.</p><h2>Unexpected Model Behavior</h2><p>For example, in one case, our model predicted the code Z72.51: High-risk heterosexual behavior for a patient involved in a motorcycle accident. This was surprising because Z72.51 represents irresponsible sexual behavior, and there was no mention of sexual activity in the text. The explanation showed that the model predicted the code because the patient rode a motorcycle. The model had learned some incorrect correlation between motorcyclists and irresponsible sex!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!QQyX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F255932bc-69a7-417a-b452-32d4979c2f0a_1415x482.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!QQyX!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F255932bc-69a7-417a-b452-32d4979c2f0a_1415x482.png 424w, /__u/substackcdn.com/image/fetch/$s_!QQyX!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F255932bc-69a7-417a-b452-32d4979c2f0a_1415x482.png 848w, /__u/substackcdn.com/image/fetch/$s_!QQyX!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F255932bc-69a7-417a-b452-32d4979c2f0a_1415x482.png 1272w, /__u/substackcdn.com/image/fetch/$s_!QQyX!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F255932bc-69a7-417a-b452-32d4979c2f0a_1415x482.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!QQyX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F255932bc-69a7-417a-b452-32d4979c2f0a_1415x482.png" width="1415" height="482" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/255932bc-69a7-417a-b452-32d4979c2f0a_1415x482.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:482,&quot;width&quot;:1415,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!QQyX!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F255932bc-69a7-417a-b452-32d4979c2f0a_1415x482.png 424w, /__u/substackcdn.com/image/fetch/$s_!QQyX!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F255932bc-69a7-417a-b452-32d4979c2f0a_1415x482.png 848w, /__u/substackcdn.com/image/fetch/$s_!QQyX!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F255932bc-69a7-417a-b452-32d4979c2f0a_1415x482.png 1272w, /__u/substackcdn.com/image/fetch/$s_!QQyX!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F255932bc-69a7-417a-b452-32d4979c2f0a_1415x482.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Explanations are obviously helpful; however, producing high-quality explanations is a challenging, unsolved problem.</p><h2>The State of Explainable Medical Coding</h2><p>Multiple studies propose explanation methods for automated medical coding models. Most of them use the attention weights from the final layer as the explanation. <a href="https://aclanthology.org/2023.acl-long.416/">A study from 3M</a> provides the state-of-the-art explanation method. They hired medical coders to annotate medical codes and the relevant evidence in the clinical notes. When training their automated medical coding model, they also trained the attention weights to focus on the annotated evidence spans, improving the attention weights&#8217; explainability.</p><p>However, evidence-span annotations are expensive. We once were offered to buy a dataset comprising 12,000 examples annotated with medical codes and evidence spans. It cost $420,000. We would need such a dataset for each code system and language&#8212;not scalable! </p><h2>Our Approach: Explanations Without Expensive Annotations</h2><p>The beauty of medical coding is that almost every medical document in the world is annotated with medical codes because they are required for statistics and billing. Consequently, most hospitals have datasets that can be used to train automated medical coding models. Therefore, we asked the question: Can we produce high-quality explanations only using medical documents and codes, i.e., no evidence-span annotations?</p><p>Spoiler alert&#8212;yes, we can. In <a href="https://arxiv.org/abs/2406.08958">our EMNLP paper</a>, we demonstrated that we could produce explanations of similar quality as 3M but without using evidence span annotations. We achieved this feat with two contributions:</p><ol><li><p>We improved the explanation method.</p></li><li><p>We improved the model's robustness.</p></li></ol><p>Let's dive into the details!</p><h2>Model Architecture: PLM-CA</h2><p>To understand our experiments, it's helpful to know the model architecture we used. We employed a variant of PLM-ICD, which we named PLM-CA. Here's a simplified overview of its architecture:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!GF2b!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb520d145-7d1d-41a3-a3c6-5564c7b5df16_705x769.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!GF2b!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb520d145-7d1d-41a3-a3c6-5564c7b5df16_705x769.png 424w, /__u/substackcdn.com/image/fetch/$s_!GF2b!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb520d145-7d1d-41a3-a3c6-5564c7b5df16_705x769.png 848w, /__u/substackcdn.com/image/fetch/$s_!GF2b!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb520d145-7d1d-41a3-a3c6-5564c7b5df16_705x769.png 1272w, /__u/substackcdn.com/image/fetch/$s_!GF2b!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb520d145-7d1d-41a3-a3c6-5564c7b5df16_705x769.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!GF2b!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb520d145-7d1d-41a3-a3c6-5564c7b5df16_705x769.png" width="345" height="376.3191489361702" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b520d145-7d1d-41a3-a3c6-5564c7b5df16_705x769.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:769,&quot;width&quot;:705,&quot;resizeWidth&quot;:345,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!GF2b!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb520d145-7d1d-41a3-a3c6-5564c7b5df16_705x769.png 424w, /__u/substackcdn.com/image/fetch/$s_!GF2b!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb520d145-7d1d-41a3-a3c6-5564c7b5df16_705x769.png 848w, /__u/substackcdn.com/image/fetch/$s_!GF2b!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb520d145-7d1d-41a3-a3c6-5564c7b5df16_705x769.png 1272w, /__u/substackcdn.com/image/fetch/$s_!GF2b!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb520d145-7d1d-41a3-a3c6-5564c7b5df16_705x769.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Components:</strong></p><ul><li><p>Input: Clinical text (e.g., "Patient has heart failure") and potential medical codes</p></li><li><p>RoBERTa Encoder: Transforms words into rich vector representations</p></li><li><p>Cross-attention: Compares medical codes with word meanings</p></li><li><p>Output: Probability scores for each medical code</p></li></ul><p><strong>How It Works:</strong></p><ol><li><p>Text Encoding: The clinical text is fed into RoBERTa, which encodes each word (token) into a vector that captures its meaning and context.</p></li><li><p>Label Representation: Each potential medical code (label) also gets its own vector representation.</p></li><li><p>Cross-attention Magic: This is where the real matching happens. The cross-attention layer compares each medical code with every word in the text.</p></li><li><p>Final Prediction: A linear layer takes each updated code representation and calculates a probability score.</p></li></ol><p>Now that we understand the model architecture let's move on to how we improved the explanations.</p><h2>Improved Explanation Method: AttInGrad</h2><p>We aimed to improve the explanation method. Since previous studies only evaluated attention-based explanation methods, we tested other approaches, such as gradient-based and perturbation-based methods. Surprisingly, these methods produced worse explanations than attention.</p><p>We noticed that the errors from attention-based and gradient-based methods rarely overlapped. By multiplying the feature attribution scores, we created a new method called AttInGrad, which significantly improved the explanations.</p><p>So, how much better is it, exactly? We evaluated plausibility, which is how convincing the explanations are for humans. We estimated plausibility by comparing the predicted important words with the annotated evidence spans. These are the F1 scores:</p><ul><li><p>InputXGrad (gradient-based method): 31.6%</p></li><li><p>Attention: 36.5%</p></li><li><p>AttInGrad: 41.5%</p></li></ul><p>Quite an improvement! AttInGrad also improved the faithfulness of the explanations, i.e., it more accurately reflected the model&#8217;s inner workings.</p><p>I will explain why AttInGrad improved the results later. </p><h2>Enhancing Model Robustness</h2><p>An explanation can be entirely faithful&#8212;accurately reflecting the model's internal mechanisms&#8212;yet still be difficult or impossible for humans to understand. If the model's underlying processes are flawed, a faithful explanation of those processes will inherit those flaws, making it challenging to understand or interpret correctly. For instance, if our model thinks that a person has irresponsible sex because he rides a motorcycle, our explanation will look weird, no matter how accurate it is. </p><p>Adversarial examples reveal flaws in a model&#8217;s inner mechanisms. Basically, you can add invisible noise to the input that tricks machine-learning models. For example, you can fool an image classifier into thinking an image of a cow is an image of an airplane. There is a paper called "<a href="https://arxiv.org/abs/1905.02175">Adversarial Examples Are Not Bugs, They Are Features</a>" which shows that image classifiers learn to use tiny pixel changes as features. Consequently, faithful explanations for such sensitive models look weird, and they should! If a tiny change to a pixel changes the output, the explanation should highlight it as important. The issue isn't the explanation method; it is the model!</p><p>Several papers show that we can make explanations more plausible by training the models to be robust against adversarial examples. The results from the paper <a href="https://arxiv.org/pdf/1805.12152">Robustness May Be at Odds with Accuracy</a> by Tsipras et al. are particularly striking. The top row shows the image, the second row shows the explanation from a standard model, and the last two rows show explanations produced by two different adversarially robust models. They all use the same explanation method, yet the difference is striking.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!CzR_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!CzR_!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png 424w, /__u/substackcdn.com/image/fetch/$s_!CzR_!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png 848w, /__u/substackcdn.com/image/fetch/$s_!CzR_!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png 1272w, /__u/substackcdn.com/image/fetch/$s_!CzR_!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!CzR_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png" width="476" height="584.894280762565" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1418,&quot;width&quot;:1154,&quot;resizeWidth&quot;:476,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!CzR_!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png 424w, /__u/substackcdn.com/image/fetch/$s_!CzR_!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png 848w, /__u/substackcdn.com/image/fetch/$s_!CzR_!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png 1272w, /__u/substackcdn.com/image/fetch/$s_!CzR_!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We evaluated whether improving our medical coding model's robustness towards adversarial examples also improved the plausibility of explanations. This has been demonstrated in image classification studies but not in text classification.</p><p>We tested three adversarial training approaches and found that token masking was most effective. Token masking identifies the least important tokens during training and replaces them with a &lt;mask&gt; token, teaching the model not to rely on irrelevant tokens.</p><p>Token masking improved the plausibility of most explanation methods:</p><ul><li><p>InputXGrad (gradient-based method): 31.6% &#8594; 33.1%</p></li><li><p>Attention: 36.5% &#8594; 37.0%</p></li><li><p>AttInGrad: 41.5% &#8594; 41.9%</p></li></ul><p><a href="/__u/joakimedin.substack.com/p/the-interplay-between-models-and">In my previous blog post</a>, I explain the relationship between the model and the explanation method in more depth.</p><h2>Combining the Improvements</h2><p>By combining our improved explanation method (AttInGrad) with the enhanced model robustness (using token masking), we produced explanations with plausibility similar to that of the supervised state-of-the-art method but without requiring expensive annotations.</p><p>Here's how our approach compares to other methods:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!i5fN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3188273-47d2-4685-917b-6ef9eed071b8_1152x864.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!i5fN!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3188273-47d2-4685-917b-6ef9eed071b8_1152x864.png 424w, /__u/substackcdn.com/image/fetch/$s_!i5fN!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3188273-47d2-4685-917b-6ef9eed071b8_1152x864.png 848w, /__u/substackcdn.com/image/fetch/$s_!i5fN!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3188273-47d2-4685-917b-6ef9eed071b8_1152x864.png 1272w, /__u/substackcdn.com/image/fetch/$s_!i5fN!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3188273-47d2-4685-917b-6ef9eed071b8_1152x864.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!i5fN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3188273-47d2-4685-917b-6ef9eed071b8_1152x864.png" width="484" height="363" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a3188273-47d2-4685-917b-6ef9eed071b8_1152x864.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:864,&quot;width&quot;:1152,&quot;resizeWidth&quot;:484,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!i5fN!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3188273-47d2-4685-917b-6ef9eed071b8_1152x864.png 424w, /__u/substackcdn.com/image/fetch/$s_!i5fN!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3188273-47d2-4685-917b-6ef9eed071b8_1152x864.png 848w, /__u/substackcdn.com/image/fetch/$s_!i5fN!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3188273-47d2-4685-917b-6ef9eed071b8_1152x864.png 1272w, /__u/substackcdn.com/image/fetch/$s_!i5fN!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3188273-47d2-4685-917b-6ef9eed071b8_1152x864.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>As you can see, our unsupervised method (AttInGrad+TM) performs comparably to the supervised state-of-the-art method from 3M (Attention+Bs), while significantly outperforming previous unsupervised approaches (Attention+Bu).</p><h1>Unmasking the Mystery: Why AttInGrad Outperforms Attention</h1><p>While both AttInGrad and Attention produced better explanations than other methods, they showed a much higher variance in their results across different runs of the model training. This means that training the same model multiple times with different random starting points could lead to very different explanations, even if the model's accuracy remained consistent<strong>.</strong></p><p>Upon closer examination, we discovered that Attention often highlighted "special tokens" as highly important for its predictions. These special tokens include things like punctuation marks, spaces, and artifacts from the text encoding process. These tokens don't carry significant meaning for humans trying to understand the reasoning behind a medical code assignment. In fact, we showed that special tokens accounted for only 5.8% of the tokens within the human-annotated evidence spans<strong>.</strong></p><p>This reliance on special tokens by Attention explains the high inter-seed variance. The figure below shows the relationship between the proportion of special tokens among the top five most important tokens and the F1 score (representing plausibility). Each point on the plot represents the average statistic for a single run of the model training.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!73jg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff067ee55-9666-41b6-9c83-9284e2783ed7_1152x864.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!73jg!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff067ee55-9666-41b6-9c83-9284e2783ed7_1152x864.png 424w, /__u/substackcdn.com/image/fetch/$s_!73jg!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff067ee55-9666-41b6-9c83-9284e2783ed7_1152x864.png 848w, /__u/substackcdn.com/image/fetch/$s_!73jg!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff067ee55-9666-41b6-9c83-9284e2783ed7_1152x864.png 1272w, /__u/substackcdn.com/image/fetch/$s_!73jg!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff067ee55-9666-41b6-9c83-9284e2783ed7_1152x864.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!73jg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff067ee55-9666-41b6-9c83-9284e2783ed7_1152x864.png" width="466" height="349.5" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f067ee55-9666-41b6-9c83-9284e2783ed7_1152x864.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:864,&quot;width&quot;:1152,&quot;resizeWidth&quot;:466,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!73jg!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff067ee55-9666-41b6-9c83-9284e2783ed7_1152x864.png 424w, /__u/substackcdn.com/image/fetch/$s_!73jg!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff067ee55-9666-41b6-9c83-9284e2783ed7_1152x864.png 848w, /__u/substackcdn.com/image/fetch/$s_!73jg!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff067ee55-9666-41b6-9c83-9284e2783ed7_1152x864.png 1272w, /__u/substackcdn.com/image/fetch/$s_!73jg!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff067ee55-9666-41b6-9c83-9284e2783ed7_1152x864.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>For both Attention and AttInGrad, there is a strong negative correlation between the proportion of special tokens and both F1 score and Comprehensiveness. This means that as the explanations rely more heavily on special tokens, their quality decreases.</p><p>InputXGrad, in contrast to Attention, demonstrates much lower variance across runs and focuses more consistently on meaningful words. By incorporating InputXGrad, AttInGrad benefits from this more stable behavior and reduces the influence of these misleading special tokens. AttInGrad is essentially using InputXGrad to reduce its reliance on special tokens, thereby improving its performance.</p><h1>Findings after the paper submission</h1><p>It&#8217;s been 3.5 months since we submitted the paper. Since then, we have learned a lot. Here are our main realizations:</p><ol><li><p>Gradient-based methods are terrible. I cover this <a href="/__u/joakimedin.substack.com/p/gradients-are-not-explanations?r=3modbm">in this blog post</a>.</p></li><li><p>Cross-attention (also called label-wise attention) was key to the good performance of Attention and AttInGrad. We later found that these methods produced poor explanations for architectures with multi-head attention and skip connections in the final layer. I will discuss this in a later blog post. </p></li><li><p><a href="https://aclanthology.org/2023.acl-long.149/">DecompX</a> achieved impressive results in <a href="https://arxiv.org/abs/2408.08137">our recent paper</a> on the sentiment classification class. I evaluated it for automated medical coding and found it to perform similarly to Attention. </p></li></ol><h2>Conclusion</h2><p>Our research demonstrates that it's possible to produce high-quality explanations for automated medical coding without relying on expensive annotated datasets. By improving both the explanation method and the model's robustness, we've taken a significant step toward making automated medical coding more transparent and trustworthy.</p><p>I will present the paper at EMNLP 2024 in Miami; I hope to see you there!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[The Interplay Between Models and Explanation Methods]]></title><description><![CDATA[Don't always blame the explanation method]]></description><link>https://joakimedin.substack.com/p/the-interplay-between-models-and</link><guid isPermaLink="false">https://joakimedin.substack.com/p/the-interplay-between-models-and</guid><dc:creator><![CDATA[Joakim Edin]]></dc:creator><pubDate>Mon, 16 Sep 2024 10:54:45 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!S8To!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c18cf4e-07e8-4799-915e-e83859be4962_1200x803.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Explanation methods in machine learning are designed to demystify the decision-making processes of complex models, particularly deep neural networks. These methods provide interpretable insights into why a model makes certain predictions, highlighting the features or patterns it deems most important. By making the model's internal mechanisms more transparent, explanation methods serve two crucial purposes: they enable researchers to identify and address potential flaws in the model, and they help build trust among end-users by making the model's decisions more understandable.</p><p>Traditionally, the focus has been on refining explanation methods to improve the quality of the explanations. However, the model being explained is a critical and often overlooked factor in this equation. The interplay between the model and the explanation method significantly impacts the resulting explanations, yet this relationship remains largely unexplored.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>In this blog post, we delve into this relationship, examining how a model's characteristics influence the effectiveness of explanation methods and, consequently, the quality and accuracy of the insights we can derive from them. Before we examine how the model influences the quality of an explanation, we must define what makes an explanation good.</p><h2>What makes an explanation good?</h2><p>Usually, researchers use two key criteria:</p><ol><li><p><strong>Plausibility</strong>: The explanations must be understandable and convincing to humans.</p></li><li><p><strong>Faithfulness</strong>: The explanations must accurately reflect the model's internal mechanisms. Essentially, the explanation shouldn't be misleading.</p></li></ol><p>An explanation must be faithful; otherwise, it will be misleading. An explanation must be plausible; otherwise, it will be useless to show humans. Therefore, we want explanations to be both faithful and plausible. Makes sense? Great! Let's explore how the model can influence each of these criteria.</p><h1>How the model impacts plausibility</h1><p>An explanation can be entirely faithful&#8212;accurately reflecting the model's internal mechanisms&#8212;yet still be difficult or impossible for humans to understand. This disconnect can occur for two main reasons:</p><ol><li><p><strong>Flawed Internal Mechanisms</strong>: If the model's underlying processes are flawed, a faithful explanation of those processes will inherit those flaws, making it challenging to understand or interpret correctly.</p></li><li><p><strong>Excessive Complexity</strong>: Even if the model's internal mechanisms are sound, they may be so complex that a faithful explanation becomes too intricate for easy human comprehension.</p></li></ol><p>This phenomenon isn't unique to machine learning. In academic research, we often encounter papers that are difficult to understand, not only because of poor writing but also because the underlying concepts are either flawed or exceedingly complex. The same principle applies to explanations of machine learning models. Here are some examples of how a model's internal mechanisms can impact plausibility.</p><h3>Shortcut learning</h3><p>Machine learning models often use shortcuts. It's like students who learn how to do well on the exam instead of understanding the subject. For example, an image classifier can classify a cow by only looking at the green background&#8212;it fails to predict a cow on a beach. A faithful explanation would highlight the background, not the cow. This explanation would confuse users without the background (&#129315;) information that machine learning models learn such shortcuts. To learn more about shortcut learning in deep neural networks, check out the paper <a href="https://arxiv.org/pdf/2004.07780">Shortcut Learning in Deep Neural Networks</a> by Geirhos et al. It is one of my favorite papers!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!S8To!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c18cf4e-07e8-4799-915e-e83859be4962_1200x803.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!S8To!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c18cf4e-07e8-4799-915e-e83859be4962_1200x803.jpeg 424w, /__u/substackcdn.com/image/fetch/$s_!S8To!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c18cf4e-07e8-4799-915e-e83859be4962_1200x803.jpeg 848w, /__u/substackcdn.com/image/fetch/$s_!S8To!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c18cf4e-07e8-4799-915e-e83859be4962_1200x803.jpeg 1272w, /__u/substackcdn.com/image/fetch/$s_!S8To!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c18cf4e-07e8-4799-915e-e83859be4962_1200x803.jpeg 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!S8To!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c18cf4e-07e8-4799-915e-e83859be4962_1200x803.jpeg" width="384" height="256.96" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7c18cf4e-07e8-4799-915e-e83859be4962_1200x803.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:803,&quot;width&quot;:1200,&quot;resizeWidth&quot;:384,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Cattle - Wikipedia&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Cattle - Wikipedia" title="Cattle - Wikipedia" srcset="/__u/substackcdn.com/image/fetch/$s_!S8To!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c18cf4e-07e8-4799-915e-e83859be4962_1200x803.jpeg 424w, /__u/substackcdn.com/image/fetch/$s_!S8To!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c18cf4e-07e8-4799-915e-e83859be4962_1200x803.jpeg 848w, /__u/substackcdn.com/image/fetch/$s_!S8To!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c18cf4e-07e8-4799-915e-e83859be4962_1200x803.jpeg 1272w, /__u/substackcdn.com/image/fetch/$s_!S8To!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c18cf4e-07e8-4799-915e-e83859be4962_1200x803.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Adversarial examples</h3><p>Image classifiers that are sensitive to adversarial examples also produce less plausible explanations. Basically, you can add invisible noise to images that trick the models into thinking an image of a cow is an image of an airplane. Weird, right? There is a paper called "<a href="https://arxiv.org/abs/1905.02175">Adversarial Examples Are Not Bugs, They Are Features</a>" which shows that the models learn to use tiny pixel changes as features. Consequently, faithful explanations for such sensitive models look weird, and they should! If a tiny change to a pixel changes the output, the explanation should highlight it as important. The issue isn't the explanation method; it is the model!</p><p>So, can we improve plausibility by improving the model?</p><h3>Improving plausibility</h3><p> Several papers show that we can make explanations more plausible by training the models to be robust against adversarial examples. The results from the paper <a href="https://arxiv.org/pdf/1805.12152">Robustness May Be at Odds with Accuracy</a> by Tsipras et al. are particularly striking. The top row shows the image, the second row shows the explanation from a standard model, and the last two rows show explanations produced by two different adversarially robust models. They all use the same explanation method, yet the difference is striking.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!CzR_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!CzR_!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png 424w, /__u/substackcdn.com/image/fetch/$s_!CzR_!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png 848w, /__u/substackcdn.com/image/fetch/$s_!CzR_!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png 1272w, /__u/substackcdn.com/image/fetch/$s_!CzR_!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!CzR_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png" width="460" height="565.2339688041594" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1418,&quot;width&quot;:1154,&quot;resizeWidth&quot;:460,&quot;bytes&quot;:2980830,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!CzR_!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png 424w, /__u/substackcdn.com/image/fetch/$s_!CzR_!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png 848w, /__u/substackcdn.com/image/fetch/$s_!CzR_!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png 1272w, /__u/substackcdn.com/image/fetch/$s_!CzR_!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0fa82f2a-2572-4410-9dfd-372d680b1522_1154x1418.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In our paper, <a href="https://arxiv.org/abs/2406.08958">An Unsupervised Approach to Achieve Supervised-Level Explainability in Healthcare Records</a><strong>, </strong>we showed that the same is true for text classifiers. However, the improvements were less drastic than those for image classification. I think it is because image classifiers are more sensitive to adversarial examples than text classifiers. </p><p>Making models robust towards adversarial examples is relatively straightforward, but how do we prevent the cow classifier from relying on the background? This is far more difficult and unsolved at the current moment. Preventing models from relying on spuriously correlated features is one of the main objectives of causal machine learning. The paper <a href="https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00511/113490/Causal-Inference-in-Natural-Language-Processing">Causal Inference in Natural Language Processing: Estimation, Prediction, Interpretation and Beyond</a> by Feder et al. introduces the topic well.</p><h1>How the model impacts faithfulness</h1><p>Some models cause certain explanation methods to produce less faithful explanations than other models. Our paper, <a href="https://arxiv.org/abs/2408.08137">Normalized AOPC: Fixing Misleading Faithfulness Metrics for Feature Attribution Explainabilit</a>y, showed that BERT trained on Yelp produced far more truthful explanations than RoBERTa trained on IMDB when using the same explanation method. Why does that happen?</p><p>Explanation methods make assumptions about the models' internal mechanisms. For instance, most explanation methods assume feature independence (a quite severe assumption). Faithfulness measures how accurately the methods' assumed mechanisms reflect the model's actual mechanisms. If an explanation method assumes feature independence, but the model relies on feature interactions, the explanations will be less faithful.</p><h2>Improving faithfulness</h2><p>There are two approaches to improving faithfulness:</p><ol><li><p>Train the model to fit the explanation method's assumptions better. For example, train the model to not rely on feature interactions.</p></li><li><p>Develop explanation methods that make fewer assumptions. For example, develop explanation methods that don't assume feature independence.</p></li></ol><p>Multiple studies have tried the first approach. However, we demonstrated in <a href="https://arxiv.org/abs/2408.08137">Normalized AOPC: Fixing Misleading Faithfulness Metrics for Feature Attribution Explainabilit</a>y that the evaluation metric they used can&#8217;t be compared across different models, which all of them did. Therefore, the conclusions of these studies may be misguided. Furthermore, most of them use gradient-based explanation methods, which I argued are not explanations in <a href="/__u/joakimedin.substack.com/publish/posts/detail/148104869">my previous blog post</a>.</p><p>Even if you could train the model to produce a more faithful explanation, I'm skeptical about whether it is the best approach. I think we should try to improve the explanation methods before we limit the models' internal processes. For a starter, we should not assume feature independence&#8212;feature interactions are the whole point of using attention.</p><h1>Wrapping up</h1><p>Models can impact the explanations' plausibility or faithfulness in different ways. They can improve plausibility by relying on features and patterns that align with human intuition and domain knowledge. Models can improve faithfulness by aligning more closely with the assumptions made by explanation methods, though this approach has its limitations.</p><p>However, I believe we should divide the responsibilities between the model and explanation methods:</p><ol><li><p>The model's responsibility is to learn meaningful and robust features that generalize well, which often leads to more interpretable decision-making processes.</p></li><li><p>The explanation methods' responsibility is to accurately reflect the model's internal mechanisms, regardless of their complexity.</p></li></ol><p>This division of responsibilities allows us to optimize both aspects without unnecessarily constraining either the model's performance or the explanation's accuracy.</p><p>I hope you enjoyed this blog post. I would love to hear if you disagree or have interesting insights on this topic. See you next time!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Gradients are not explanations]]></title><description><![CDATA[Gradient-based explanation methods are often perceived as the gold standard in machine learning interpretability.]]></description><link>https://joakimedin.substack.com/p/gradients-are-not-explanations</link><guid isPermaLink="false">https://joakimedin.substack.com/p/gradients-are-not-explanations</guid><dc:creator><![CDATA[Joakim Edin]]></dc:creator><pubDate>Wed, 04 Sep 2024 08:55:16 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!LOLf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48d51dc-7490-4b94-8125-a236c4b51b61_1356x756.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Gradient-based explanation methods are often perceived as the gold standard in machine learning interpretability. The authors of &#8220;<a href="https://aclanthology.org/N19-1357/#:~:text=In%20this%20work%20we%20perform,that%20they%20largely%20do%20not.">Attention is not Explanation</a>&#8221; used input gradients as the ground truth. They argued that attention isn't an explanation because it correlates poorly with gradients. <a href="https://aclanthology.org/2020.blackboxnlp-1.14/">This paper from Google Research</a> argued that there are no compelling reasons to use attention when we can use gradient-based explanations. </p><p>However, my recent research has led me to question this assumption. In <a href="https://arxiv.org/abs/2406.08958">An Unsupervised Approach to Achieve Supervised-Level Explainability in Healthcare Records</a>, we compared a wide range of explanation methods. To my surprise, gradient-based explanation methods produced the worst explanations&#8212;even worse than attention. In this blog post, I will try to explain why. </p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>By the end, I hope to convince you that gradient-based explanation methods, such as InputXGradients and Integrated Gradients, are far from being a gold standard&#8212;they barely qualify as a rusty iron standard. Let's dive in!</p><h1>Gradient-based explanations 101</h1><p>Gradient-based explanation methods produce explanations using the output gradients with respect to the input features. For deep neural networks, they are typically calculated using backpropagation. While gradients can be challenging to grasp intuitively, especially in the context of deep neural networks, I find the following explanation helpful:</p><blockquote><p>Think of the output gradient with respect to an input feature as how much the output wiggles if you slightly wiggle that input feature. We're talking about an infinitesimally small input wiggling&#8212;so small it's almost undetectable.</p></blockquote><p>These methods measure the importance of each input feature by calculating how much the output changes when each feature is wiggled separately. This results in a score per feature representing its importance to the output, a form of explanation known as feature attribution.</p><p>Let's look at a concrete example to better understand how gradient-based explanations work. Consider the following linear model:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;f_1(x)=0.1x_1+0.5x_2+0.2x_3+0.2x_4 &quot;,&quot;id&quot;:&quot;QOMHCBGXZS&quot;}" data-component-name="LatexBlockToDOM"></div><p>For this model, we calculate the input gradient as follows:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;(\\frac{\\delta f_1(x)}{\\delta x_1},\\frac{\\delta f_1(x)}{\\delta x_2}, \\frac{\\delta f_1(x)}{\\delta x_3},\\frac{\\delta f_1(x)}{\\delta x_4}) = (0.1, 0.5, 0.2, 0.2)&quot;,&quot;id&quot;:&quot;BNSETQHXCP&quot;}" data-component-name="LatexBlockToDOM"></div><p>As you can see, the input gradients of a linear model are simply its weights. At first glance, this might seem like a good estimation of each feature's contribution. However, there's a significant issue: this explanation is unaffected by the actual input values.</p><p>For instance, given an input (0.3, 0, 0.6, 0.1), the contribution of the second feature should be 0, not 0.5. This is where a method called InputXGradient comes in. It addresses this limitation by multiplying the input and the input gradients:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;(\\frac{\\delta f_1(x)}{\\delta x_1}x_1,\\frac{\\delta f_1(x)}{\\delta x_2}x_2, \\frac{\\delta f_1(x)}{\\delta x_3}x_3,\\frac{\\delta f_1(x)}{\\delta x_4}x_4) = (0.1x_1, 0.5x_2, 0.2x_3, 0.2x_4)&quot;,&quot;id&quot;:&quot;YSUGKYNMJH&quot;}" data-component-name="LatexBlockToDOM"></div><p>Using our example input (0.3, 0, 0.6, 0.1), we get (0.03, 0.00, 0.12, 0.02). This explanation more accurately reflects each feature's contribution to the output, taking into account both the model's weights and the specific input values.</p><p>This example demonstrates how gradient-based methods attempt to provide meaningful explanations for model predictions. However, as we'll explore in the next section, these methods have significant weaknesses that limit their effectiveness as explanatory tools.</p><h1>Their weaknesses</h1><h2>Non-linear functions</h2><p>Above, I showed you that InputXGradient works well for linear models. However, deep neural networks are rarely linear; that&#8217;s the whole point of using them. Unfortunately, gradient-based explanation methods often fail when dealing with non-linearity. Let's look at a simple demonstration.</p><p>Take the following model:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;f_2(x) = 0.01 \\cdot x_1 + 20.0 \\cdot \\sigma(x_2) &quot;,&quot;id&quot;:&quot;LXYWDKYVOY&quot;}" data-component-name="LatexBlockToDOM"></div><p>This model takes two input features. It uses a sigmoid function (&#963;) that takes the second feature as input. A sigmoid function is a non-linear function and looks like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!LOLf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48d51dc-7490-4b94-8125-a236c4b51b61_1356x756.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!LOLf!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48d51dc-7490-4b94-8125-a236c4b51b61_1356x756.png 424w, /__u/substackcdn.com/image/fetch/$s_!LOLf!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48d51dc-7490-4b94-8125-a236c4b51b61_1356x756.png 848w, /__u/substackcdn.com/image/fetch/$s_!LOLf!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48d51dc-7490-4b94-8125-a236c4b51b61_1356x756.png 1272w, /__u/substackcdn.com/image/fetch/$s_!LOLf!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48d51dc-7490-4b94-8125-a236c4b51b61_1356x756.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!LOLf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48d51dc-7490-4b94-8125-a236c4b51b61_1356x756.png" width="620" height="345.6637168141593" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f48d51dc-7490-4b94-8125-a236c4b51b61_1356x756.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:756,&quot;width&quot;:1356,&quot;resizeWidth&quot;:620,&quot;bytes&quot;:67918,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!LOLf!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48d51dc-7490-4b94-8125-a236c4b51b61_1356x756.png 424w, /__u/substackcdn.com/image/fetch/$s_!LOLf!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48d51dc-7490-4b94-8125-a236c4b51b61_1356x756.png 848w, /__u/substackcdn.com/image/fetch/$s_!LOLf!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48d51dc-7490-4b94-8125-a236c4b51b61_1356x756.png 1272w, /__u/substackcdn.com/image/fetch/$s_!LOLf!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff48d51dc-7490-4b94-8125-a236c4b51b61_1356x756.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now, let&#8217;s say we provide the model with input (10, 10). We then get the following output:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;f_2(10,10) = 0.01 \\cdot 10 +  20.0 \\cdot \\sigma(10) = \\textcolor{blue}{0.1} + \\textcolor{blue}{20.0} = 20.1&quot;,&quot;id&quot;:&quot;WZGDVWMNPQ&quot;}" data-component-name="LatexBlockToDOM"></div><p>In blue, you can see the contributions from each feature. You can clearly see that the second feature is far more influential than the first. So, which features are important according to InputXGrad?</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;(0.01 \\cdot x_1, 20.0 \\cdot \\sigma'(x_2) \\cdot x_2) =(0.01 \\cdot 10, 20.0 \\cdot \\sigma'(10) \\cdot 10) = (0.1, 0.009)  &quot;,&quot;id&quot;:&quot;UBTIJPEXPD&quot;}" data-component-name="LatexBlockToDOM"></div><p>According to InputXGrad, the second feature is unimportant, which is clearly wrong. So why does this happen? If you look at the plot for large values, wiggling the input of a sigmoid function has little impact on the output&#8212;the line is flat.</p><p>This example illustrates how gradient-based explanation methods struggle with non-linearities, which are fundamental to the activation functions in deep neural networks. However, while basic gradient methods struggle with non-linearity, more advanced techniques have been developed to address this issue. One such method is Integrated Gradients. Let's explore how it works.</p><h3>How Integrated Gradients deals with non-linearity</h3><p>Integrated Gradients requires the user to define a baseline value representing an uninformative input. In image classification, this can be an all-black image or an image of white noise. Mask tokens are commonly used in text classification. </p><p>Imagine a straight line between the input and the baseline value. Integrated Gradients takes small steps along this line. At each step, it calculates the gradients. It then averages the gradients across all steps. Finally, it multiplies this average by the difference between the input and baseline values. </p><p>Let&#8217;s consider the previous example. We use a baseline value of (0,0) and a step size of 50. Imagine a straight line between (0,0) and (10,10). We take 50 steps along this line and calculate the gradient at each step. We average the gradients and get (0.01, 0.98). We then multiply it with the input minus the baseline values.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;((10,10)-(0,0)) \\cdot (0.01, 0.98) = (0.1, 9.8)&quot;,&quot;id&quot;:&quot;LUGYCRCKSM&quot;}" data-component-name="LatexBlockToDOM"></div><p>So (0.1, 9.8) is our final explanation. This is much better! It correctly identifies that the second feature is more important than the first, aligning with our intuitive understanding of the model.</p><p>It is currently unclear to me whether Integrated Gradients solves the non-linearity issue and exactly why. I can see that it works for toy examples, but I am unsure how it works for real data. In my two explainability papers, Integrated Gradients perform similarly to InputXGradients, which could suggest it doesn&#8217;t solve the issue in all scenarios.</p><p>Even if Integrated Gradients solves the non-linearity problem, it's important to note that they don't solve all the problems associated with gradient-based explanations. There are still other issues to consider, which we'll explore in the next section.</p><h2>What does wiggling the input even mean?</h2><p>While it's easy to imagine wiggling input features in our simple numerical examples, the concept becomes much more complex and abstract for real-world tasks, especially in text classification. </p><h3>The weirdness of word gradients</h3><p>Consider an email spam classification task. The model takes an email as input and outputs a score representing the probability of the email being spam. In this context, what does wiggling the input mean? How do we wiggle words?</p><p>Most text classification models represent each word or sub-word as a vector. You can think of these vectors as points in a high-dimensional space. For example:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!n88q!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F96eeed9a-8f9c-4ae8-9256-ed4d5b5a22aa_797x726.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!n88q!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F96eeed9a-8f9c-4ae8-9256-ed4d5b5a22aa_797x726.png 424w, /__u/substackcdn.com/image/fetch/$s_!n88q!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F96eeed9a-8f9c-4ae8-9256-ed4d5b5a22aa_797x726.png 848w, /__u/substackcdn.com/image/fetch/$s_!n88q!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F96eeed9a-8f9c-4ae8-9256-ed4d5b5a22aa_797x726.png 1272w, /__u/substackcdn.com/image/fetch/$s_!n88q!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F96eeed9a-8f9c-4ae8-9256-ed4d5b5a22aa_797x726.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!n88q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F96eeed9a-8f9c-4ae8-9256-ed4d5b5a22aa_797x726.png" width="524" height="477.31994981179423" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/96eeed9a-8f9c-4ae8-9256-ed4d5b5a22aa_797x726.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:726,&quot;width&quot;:797,&quot;resizeWidth&quot;:524,&quot;bytes&quot;:34353,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!n88q!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F96eeed9a-8f9c-4ae8-9256-ed4d5b5a22aa_797x726.png 424w, /__u/substackcdn.com/image/fetch/$s_!n88q!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F96eeed9a-8f9c-4ae8-9256-ed4d5b5a22aa_797x726.png 848w, /__u/substackcdn.com/image/fetch/$s_!n88q!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F96eeed9a-8f9c-4ae8-9256-ed4d5b5a22aa_797x726.png 1272w, /__u/substackcdn.com/image/fetch/$s_!n88q!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F96eeed9a-8f9c-4ae8-9256-ed4d5b5a22aa_797x726.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>When we calculate gradients for these word vectors, we get a vector per word, not just a single number. This gradient vector points in the direction of maximum impact on the output, and its size indicates the magnitude of that impact. Researchers typically use this size to estimate a word's importance.</p><p>But here's where things get weird:</p><ol><li><p><strong>Interpretation Challenges</strong>: How do we make sense of directions in this word space? What does it mean to move a word towards "computer" or away from "fruit"?</p></li><li><p><strong>Semantic Discontinuity</strong>: Small changes in this continuous space might lead to nonsensical "words.&#8221; What meaning does the midpoint between "computer" and "fruit" have?</p></li></ol><p>These issues reveal a fundamental mismatch: We're using continuous mathematics to explain discrete, semantic concepts. The result? Gradient-based explanations often lack clear linguistic meaning. </p><p>Let&#8217;s be clear: they accurately measure how tiny changes to the input change the output; I just don&#8217;t think it&#8217;s aligned with how people interpret the explanations.</p><h3>Can Integrated Gradients save the day?</h3><p>Spoiler alert: No, they can't. Let's see why.</p><p>Consider this visualization:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!3li0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0378af7-8059-48be-b45f-ace350c81020_816x753.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!3li0!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0378af7-8059-48be-b45f-ace350c81020_816x753.png 424w, /__u/substackcdn.com/image/fetch/$s_!3li0!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0378af7-8059-48be-b45f-ace350c81020_816x753.png 848w, /__u/substackcdn.com/image/fetch/$s_!3li0!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0378af7-8059-48be-b45f-ace350c81020_816x753.png 1272w, /__u/substackcdn.com/image/fetch/$s_!3li0!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0378af7-8059-48be-b45f-ace350c81020_816x753.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!3li0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0378af7-8059-48be-b45f-ace350c81020_816x753.png" width="494" height="455.8602941176471" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f0378af7-8059-48be-b45f-ace350c81020_816x753.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:753,&quot;width&quot;:816,&quot;resizeWidth&quot;:494,&quot;bytes&quot;:38272,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!3li0!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0378af7-8059-48be-b45f-ace350c81020_816x753.png 424w, /__u/substackcdn.com/image/fetch/$s_!3li0!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0378af7-8059-48be-b45f-ace350c81020_816x753.png 848w, /__u/substackcdn.com/image/fetch/$s_!3li0!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0378af7-8059-48be-b45f-ace350c81020_816x753.png 1272w, /__u/substackcdn.com/image/fetch/$s_!3li0!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0378af7-8059-48be-b45f-ace350c81020_816x753.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>This simplified 2D space shows words as points, with the red line representing the path between a baseline (&lt;mask&gt;) and the word "cat" in Integrated Gradients.</p><p>This method introduces new problems:</p><ol><li><p><strong>Meaningless Intermediates</strong>: The path between &lt;mask&gt; and "cat" passes through non-existent words. What do these points mean?</p></li><li><p><strong>Arbitrary Baselines</strong>: Why choose &lt;mask&gt; as the baseline? How would using "animal" or "dog" change our explanation?</p><p></p></li></ol><div><hr></div><h3>Edit</h3><p><em>I&#8217;ve realized that passing through nonsensical representations may not be an issue. However, I&#8217;ve found another issue with integrated gradients that causes it to struggle with architectures such as transformers. I haven&#8217;t decided whether to publish my new findings as a blog post or paper.</em></p><h1>Wrapping up</h1><p>Throughout this discussion, we've focused on two primary weaknesses of gradient-based explanation methods:</p><ol><li><p><strong>Struggle with Non-linearity</strong>: Basic gradient methods often fail when dealing with non-linear functions, which are ubiquitous in modern machine learning models. </p></li><li><p><strong>Difficult to interpret:</strong> In the realm of text classification, gradients - whether basic or integrated - prove to be unintuitive and challenging to interpret. I don&#8217;t think &#8220;how much the output wiggles when wiggling an input feature&#8221; is how most people interpret an explanation.</p></li></ol><p>While we focused primarily on text classification, these interpretability issues likely extend to other domains as well. Even in image classification, where gradients might seem more intuitive, the fundamental challenge of translating mathematical operations into human-understandable explanations persists. For example, what does it mean if the output changes because a pixel becomes slightly darker?</p><p>So, what are the alternatives to gradient-based methods? I think for inputs with few features, perturbation-based explanation methods, such as LIME or SHAP, are excellent choices. Attention sometimes works well, and sometimes don&#8217;t. It depends on your model. If you use transformers, transformer-specific explanation methods, such as <a href="https://aclanthology.org/2023.acl-long.149.pdf">DecompX</a> or <a href="https://arxiv.org/abs/2205.11631">ALTI</a>, are good choices. I&#8217;ve found DecompX to work better than ALTI. However, DecompX uses a lot of memory for long inputs, so that may be a deal-breaker. I&#8217;m currently working on a way to fix this, so hopefully, I will have a good explanation method in a short time!</p><p>I&#8217;ll wrap up here. Do you agree with my points or think I&#8217;m off base? I&#8217;d love to hear your thoughts!</p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[A Critical Look at Trending Ideas in Automated Medical Coding Studies]]></title><description><![CDATA[Three wide-spread ideas in automated medical coding and their weaknesses]]></description><link>https://joakimedin.substack.com/p/a-critical-look-at-trending-ideas</link><guid isPermaLink="false">https://joakimedin.substack.com/p/a-critical-look-at-trending-ideas</guid><dc:creator><![CDATA[Joakim Edin]]></dc:creator><pubDate>Sat, 24 Aug 2024 15:00:59 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8fe82c1-df74-4b31-ac77-aa1be9a77f9f_2092x2092.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hi there! I've been chewing on some ideas about automated medical coding research and want to share them with you. Each year, we see dozens of new papers proposing variations on the same three ideas:</p><ol><li><p>Leveraging relationships between symptoms, medications, and diseases to predict medical codes more accurately.</p></li><li><p>Using medical code co-occurrences to improve prediction accuracy.</p></li><li><p>Exploiting the ICD hierarchy to teach models about code similarities and differences.</p></li></ol><p>These ideas might sound reasonable at first glance&#8212;I certainly thought so until recently. But I've come to realize they have some weaknesses. Let me break it down for you, but first, here is a quick primer on medical coding for those new to the field.</p><h1>Medical coding 101</h1><p>After you&#8217;ve been discharged from a hospital or seen your physician, someone (physician, secretary, or professional medical coder) must sift through your medical documentation and assign a set of medical codes. These medical codes are machine-readable identifiers for diagnoses or procedures used for documentation, statistics, and (importantly) billing. </p><p>Getting these codes right is crucial, especially for healthcare providers who rely on insurance reimbursements. If a code is assigned but not backed up by the documentation, the insurance company won't pay. On the flip side, if codes are missing, the insurance company will happily underpay. </p><p>WHO created ICD-10, a medical code system comprising ~14,000 diagnosis codes. The American healthcare system didn&#8217;t think there were enough codes, so they created an American version called ICD-10-CM, which comprises more than 70,000 diagnosis codes. We now have codes for such vital medical conditions as&nbsp;<em><a href="https://www.icd10data.com/ICD10CM/Codes/V00-Y99/W50-W64/W59-/W59.22">W59.22</a>: Struck by a turtle</em>&nbsp;and&nbsp;<em><a href="https://www.icd10data.com/ICD10CM/Codes/V00-Y99/V90-V94/V91-/V91.07">V91.07</a>: Burn due to water skis on fire</em>. </p><p>For procedures, American hospitals typically use two systems: ICD-10-PCS (70,000+ codes) for inpatient care and CPT (11,000+ codes) for outpatient. There are other code systems too, but these are the major players.</p><p>If you're new to this field, you absolutely must read the <a href="https://www.cms.gov/files/document/fy-2024-icd-10-cm-coding-guidelines-updated-02/01/2024.pdf">ICD-10-CM coding guidelines</a> (at least the first 20 pages) and the <a href="https://www.cms.gov/Medicare/Coding/ICD10/Downloads/2020-ICD-10-PCS-Guidelines.pdf">ICD-10-PCS guidelines</a>. They are crucial for understanding the problem we are trying to solve.</p><p>Two key takeaways from these guidelines:</p><ol><li><p>Use both the <a href="https://ftp.cdc.gov/pub/Health_Statistics/NCHS/Publications/ICD10CM/2025/icd10cm-table-index-2025.zip">Alphabetic Index and the Tabular List</a>. The Alphabetic Index maps terms to codes or subcategories, while the Tabular List is the tree structure most people associate with ICD.</p></li><li><p>Code only diagnoses explicitly described in the medical documentation.</p></li></ol><p>Let's dive a bit deeper into how medical coders actually use the Alphabetic Index and Tabular List. When assigning codes, a medical coder doesn't just jump straight to the Tabular List (the tree structure we all think of when we picture ICD codes). Instead, they start with the Alphabetic Index.</p><p>Here's the process:</p><ol><li><p>The coder looks up a term (let's say "sepsis") in the Alphabetic Index.</p></li><li><p>They navigate through the index to find the type of sepsis that best matches the condition described in the medical documentation.</p></li><li><p>This leads them to either a specific code or a subcategory in the Tabular List.</p></li><li><p>The coder then goes to that section of the Tabular List, where they'll find more detailed instructions to help them pinpoint the exact right code.</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!1OMr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75797de9-278c-44f9-a4d5-a0686470d396_948x876.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!1OMr!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75797de9-278c-44f9-a4d5-a0686470d396_948x876.png 424w, /__u/substackcdn.com/image/fetch/$s_!1OMr!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75797de9-278c-44f9-a4d5-a0686470d396_948x876.png 848w, /__u/substackcdn.com/image/fetch/$s_!1OMr!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75797de9-278c-44f9-a4d5-a0686470d396_948x876.png 1272w, /__u/substackcdn.com/image/fetch/$s_!1OMr!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75797de9-278c-44f9-a4d5-a0686470d396_948x876.png 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!1OMr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75797de9-278c-44f9-a4d5-a0686470d396_948x876.png" width="480" height="443.54430379746833" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/75797de9-278c-44f9-a4d5-a0686470d396_948x876.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:876,&quot;width&quot;:948,&quot;resizeWidth&quot;:480,&quot;bytes&quot;:152765,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!1OMr!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75797de9-278c-44f9-a4d5-a0686470d396_948x876.png 424w, /__u/substackcdn.com/image/fetch/$s_!1OMr!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75797de9-278c-44f9-a4d5-a0686470d396_948x876.png 848w, /__u/substackcdn.com/image/fetch/$s_!1OMr!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75797de9-278c-44f9-a4d5-a0686470d396_948x876.png 1272w, /__u/substackcdn.com/image/fetch/$s_!1OMr!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75797de9-278c-44f9-a4d5-a0686470d396_948x876.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">A screen shot of a small part of the Alphabetic Index. </figcaption></figure></div><p>This two-step process is crucial because it helps ensure accuracy and consistency in code assignment. It's also why simply relying on the hierarchy in the Tabular List for understanding code relationships can be misleading&#8212;but more on that later.</p><p>Now, let's dive into why I think the three popular research ideas above are problematic.</p><h1>The good, the bad, the ugly</h1><h2>1. The ICD hierarchy: not as helpful as you might think</h2><p>Many studies use the Tabular List (the ICD tree) to teach models about code similarities. The assumption is that codes close to each other in the tree are similar, while distant codes are different.</p><p>Here's the problem: the Tabular List isn't always structured based on code similarity. Take sepsis, for example. Most sepsis codes are in the A-chapter, but for newborns, you use the P36 category. And if a procedure caused the sepsis? That's T81.44. Same condition, different circumstances, but a model trained on the Tabular List would think they're completely unrelated.</p><p>That said, this idea might work better if we use both the Alphabetic Index and the Tabular List together, as the guidelines instruct. There's a great study waiting to be done here (hint, hint)!</p><h2>2. Medical coding <s>&#8800;</s> diagnosing</h2><p>Some studies try to leverage relationships between medical codes, symptoms, medications, and conditions to infer codes. But here's the thing: medical coding isn't diagnosing; it's documenting established diagnoses and procedures. Coders are prohibited from assigning codes for conditions not mentioned in the documentation.</p><p>So what's the harm? Well, models that infer codes not explicitly mentioned are less useful in real life:</p><ul><li><p>For medical coders, these models will suggest codes they are prohibited from assigning, which is just annoying.</p></li><li><p>For physicians, these models might encourage assigning codes without proper documentation, leading to incomplete records and potential insurance denials. </p></li></ul><p>Don't get me wrong&#8212;a separate model for inferring diagnoses could be super helpful. Combined with a solid medical coding model, it could flag diagnoses the physician forgot to document. But a medical coding model shouldn't try to be a diagnostic tool at the same time.</p><h2>3. Why relying on code co-occurrences falls short</h2><p>Many studies propose using medical code co-occurrences for automated coding. The logic goes: if code A often co-occurs with code B, we can infer code A when we're sure about code B. Also, if two codes never co-occur, we should avoid predicting both.</p><p>This approach has three major issues:</p><ol><li><p>Again, we shouldn't be inferring codes. The guidelines are clear: diagnoses must be explicitly mentioned.</p></li><li><p>There are over 70,000 diagnosis codes, and most are rare. In MIMIC-IV (a popular dataset), more than 50% of code co-occurrences in the validation set never appear in the training set.</p></li><li><p>Code co-occurrences vary between hospitals and specialties. Relying on them will result in overfitted models that don't generalize well.</p></li></ol><h1>Why do these flawed ideas persist?</h1><p>You might be wondering why these problematic approaches keep popping up. Well, they do seem to cause small performance improvements on popular benchmark datasets like MIMIC-III and MIMIC-IV. But here's the issue: I think we're seeing these improvements because of noisy annotations in these datasets.</p><p>Many clinical notes in these datasets are annotated with codes that aren't actually mentioned in the text. Sometimes the relevant text was removed during anonymization (like the social history in MIMIC-IV), or the information is simply elsewhere. When the mention of a diagnosis is missing but the code is still there, models that infer codes from other factors will score better. But this isn't because they're actually better&#8212;it's because of flawed evaluation.</p><p>For example, smoking habits are often mentioned in the social history section of discharge summaries. In MIMIC-IV, this section is removed. A model that infers smoking status from other conditions (like hypertension or COPD) will perform better on such a dataset. But on a clean dataset, this model would produce more false positives when guessing about smoking habits that aren't explicitly mentioned.</p><h2>Wrapping Up</h2><p>So, there you have it&#8212;my thoughts on why some popular approaches in automated medical coding research might be leading us down the wrong path. What do you think? Do you agree with my arguments, or do you see things differently? Let's start a conversation and push our field in a more productive direction!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://joakimedin.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Joakim&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[No, Medical Error is Not the Third Biggest Killer in the United States.]]></title><description><![CDATA[John Oliver stated that medical error is the third leading cause of death in the US. In this blog post, we dig into why it is not true.]]></description><link>https://joakimedin.substack.com/p/no-medical-error-is-not-the-third-biggest-killer-in-the-united-states-9c33648fbb9b</link><guid isPermaLink="false">https://joakimedin.substack.com/p/no-medical-error-is-not-the-third-biggest-killer-in-the-united-states-9c33648fbb9b</guid><dc:creator><![CDATA[Joakim Edin]]></dc:creator><pubDate>Sun, 17 Mar 2024 19:14:02 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/f85b56ee-3ab8-4d04-898c-b06a27253af9_800x450.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="/__u/substackcdn.com/image/fetch/$s_!NpK7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b9184ac-f8c5-4e00-8b9c-13d5a769d82c_800x450.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="/__u/substackcdn.com/image/fetch/$s_!NpK7!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b9184ac-f8c5-4e00-8b9c-13d5a769d82c_800x450.jpeg 424w, /__u/substackcdn.com/image/fetch/$s_!NpK7!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b9184ac-f8c5-4e00-8b9c-13d5a769d82c_800x450.jpeg 848w, /__u/substackcdn.com/image/fetch/$s_!NpK7!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b9184ac-f8c5-4e00-8b9c-13d5a769d82c_800x450.jpeg 1272w, /__u/substackcdn.com/image/fetch/$s_!NpK7!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_webp, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b9184ac-f8c5-4e00-8b9c-13d5a769d82c_800x450.jpeg 1456w" sizes="100vw"><img src="/__u/substackcdn.com/image/fetch/$s_!NpK7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b9184ac-f8c5-4e00-8b9c-13d5a769d82c_800x450.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1b9184ac-f8c5-4e00-8b9c-13d5a769d82c_800x450.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="/__u/substackcdn.com/image/fetch/$s_!NpK7!, /__u/joakimedin.substack.com/w_424, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b9184ac-f8c5-4e00-8b9c-13d5a769d82c_800x450.jpeg 424w, /__u/substackcdn.com/image/fetch/$s_!NpK7!, /__u/joakimedin.substack.com/w_848, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b9184ac-f8c5-4e00-8b9c-13d5a769d82c_800x450.jpeg 848w, /__u/substackcdn.com/image/fetch/$s_!NpK7!, /__u/joakimedin.substack.com/w_1272, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b9184ac-f8c5-4e00-8b9c-13d5a769d82c_800x450.jpeg 1272w, /__u/substackcdn.com/image/fetch/$s_!NpK7!, /__u/joakimedin.substack.com/w_1456, /__u/joakimedin.substack.com/c_limit, /__u/joakimedin.substack.com/f_auto, /__u/joakimedin.substack.com/q_auto:good, /__u/joakimedin.substack.com/fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b9184ac-f8c5-4e00-8b9c-13d5a769d82c_800x450.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><p>John Oliver started the <a href="https://youtu.be/jVIYbgVks7E?si=UkTTZ0CdgjQaUr7q&amp;t=76">latest episode</a> of Last Week Tonight with John Oliver with the following quote:</p><blockquote><p>A 2016 analysis included that more than 250,000 deaths per year are due to medical error in the US, making it the third leading cause of death.</p></blockquote><p>Medical errors are common and do cause a lot of pain and deaths. Pointing out the problem can help us make healthcare better. However, the 2016 analysis John Oliver refers to contains heavily inflated numbers, which has had negative consequences. In <a href="https://twitter.com/NRATV/status/1139622032008605696">this video</a>, the National Rifle Association uses the claim to argue that medical errors kill 500 times more people than guns. Supporters of alternative medicine use the claim to paint a picture of how dangerous conventional medicine is: &#8220;more Americans are killed in U.S. hospitals every six months than died in the entire Vietnam War.&#8221;</p><p>The 2016 analysis is called <a href="https://www.bmj.com/content/353/bmj.i2139">Medical error&#8202;&#8212;&#8202;the third leading cause of death in the US</a>. The authors estimate that medical errors cause 251,454 hospital deaths a year in the US, making it the third biggest killer behind cancer and heart disease. The article is published in a prestigious medical peer-reviewed journal (BMJ) and has over 4,000 citations. That is more citations than most researchers accumulate during their entire careers. It is understandable that people would use the claim from a paper with such impressive credentials. I have myself done so. However, the article has received <a href="https://www.mcgill.ca/oss/article/critical-thinking-health/medical-error-not-third-leading-cause-death">heavy criticism</a>, and as you will learn in this blog post, rightfully so.</p><p><a href="https://qualitysafety.bmj.com/content/26/5/423#ref-17">Kaveh G. Shojania and Mary Dixon-Woods</a> pointed out that there are 700,000 annual hospital deaths in the US. If medical errors cause 250,000 hospital deaths, that would mean that errors cause 1 out of 3 hospital deaths. This is far from estimates in <a href="https://www.bmj.com/content/351/bmj.h3239?ijkey=19a62f8ca5411f86602f69eb6f824f82bb408110&amp;keytype2=tf_ipsecsha">other studies</a> in the 1%&#8211;4% range. How can the estimates be so different?</p><h4>Not everyone has kidney&nbsp;failure.</h4><p>The authors of the 2016 analysis estimated that 0.71% of hospital admissions result in a lethal medical error by averaging the estimates of four studies. They multiplied the estimate by the total number of hospital admissions in the US (35,416,020), which resulted in 251,454 hospital deaths.</p><p>Three of the studies were small, each reporting fewer than 14 deaths. The patients in the studies were often very sick. For instance, <a href="https://oig.hhs.gov/oei/reports/OEI-06-09-00090.pdf">one of the studies </a>was conducted on Medicare patients who were 65 years or older, with disabilities or end-stage renal disease. The authors of the paper counted the number of medical errors that they believed contributed to their deaths, and the 2016 analysis used this number to estimate the number of deaths in the entire population. Not everyone has end-stage renal failure; one out of ten hospital admissions are patients giving birth. A medical error is more likely to be fatal if you are already dying. You cannot extrapolate death statistics on a small group of dying patients to the entire population. How can we even know that the medical error killed the patient if they would have died anyway?</p><h4>Correlation is Not Causation.</h4><p>The studies included in the 2016 analysis reported the number of deaths following a medical error. The 2016 analysis assumed that if a death followed a medical error, the medical error caused the death. However, an event followed by another event doesn&#8217;t necessarily mean that the first one caused the second. The sun doesn&#8217;t rise because the rooster crowed, the prisoner wasn&#8217;t executed because he had his last meal, and the Make-A-Wish Foundation doesn&#8217;t kill children. Most medical errors result in minor consequences. A patient can develop a rash because the physician prescribed the wrong medication and then die of another cause (e.g., kidney failure). The studies used in the 2016 analysis did not analyze whether the patients who died after medical errors were killed by it. Given the flaws of the 2016 analysis, does it mean you cannot trust John Oliver?</p><h4>Who&#8217;s to&nbsp;blame?</h4><p>We cannot blame people for referring to the 2016 analysis. Everyone cannot be expected to fact-check every peer-reviewed article they quote, especially if they are not researchers. It is the author&#8217;s responsibility to be thorough in their analyses and the journals&#8217; responsibility to reject and retract weak articles. If we can&#8217;t trust peer-reviewed articles, what can we trust? I&#8217;m not the <a href="https://www.mcgill.ca/oss/article/critical-thinking-health/medical-error-not-third-leading-cause-death">first to point out</a><em><strong><a href="https://www.mcgill.ca/oss/article/critical-thinking-health/medical-error-not-third-leading-cause-death"> </a></strong></em><a href="https://www.mcgill.ca/oss/article/critical-thinking-health/medical-error-not-third-leading-cause-death">the flaws in the 2016 analysis</a>, and yet, despite the criticism and negative consequences, the authors and BMJ have not retracted the article.</p><h4>Does this mean that medical error is not an&nbsp;issue?</h4><p>Medical error is a significant issue despite not being the third leading cause of death. Other studies estimate that errors cause 1&#8211;4% of all hospital deaths. That&#8217;s still a lot of lives. Eliminating medical errors would prevent thousands of deaths annually, both inside and outside the hospitals, and reduce unnecessary suffering. Reporting and preventing medical errors is essential, but that doesn't mean we should overestimate its consequences.</p>]]></content:encoded></item></channel></rss>