<?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[Cristobal Santana]]></title><description><![CDATA[Modern ML is full of weird, beautiful, and poorly understood phenomena. I write about them — the architectures behind them, the data that produces them, and the papers trying to explain them. Physicist by training, AI engineer by trade.]]></description><link>https://cristobalsantana.substack.com</link><image><url>https://substackcdn.com/image/fetch/$s_!0ofa!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff7b37d25-e2fb-4370-bee6-83263c62570e_2607x2607.jpeg</url><title>Cristobal Santana</title><link>https://cristobalsantana.substack.com</link></image><generator>Substack</generator><lastBuildDate>Mon, 22 Jun 2026 07:36:38 GMT</lastBuildDate><atom:link href="https://cristobalsantana.substack.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Cristobal Santana]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[cristobalsantana@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[cristobalsantana@substack.com]]></itunes:email><itunes:name><![CDATA[Cristobal Santana]]></itunes:name></itunes:owner><itunes:author><![CDATA[Cristobal Santana]]></itunes:author><googleplay:owner><![CDATA[cristobalsantana@substack.com]]></googleplay:owner><googleplay:email><![CDATA[cristobalsantana@substack.com]]></googleplay:email><googleplay:author><![CDATA[Cristobal Santana]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[The Reversal Curse: Why LLMs Know Tom Cruise’s Mother But Not Her Son]]></title><description><![CDATA[The same fact, looked at from the other end, becomes invisible to the model.]]></description><link>https://cristobalsantana.substack.com/p/the-reversal-curse-why-llms-know</link><guid isPermaLink="false">https://cristobalsantana.substack.com/p/the-reversal-curse-why-llms-know</guid><dc:creator><![CDATA[Cristobal Santana]]></dc:creator><pubDate>Tue, 16 Jun 2026 12:31:34 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/6fbe3817-acc3-4222-9e0c-aeaaa8f78acb_1448x1086.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When a person learns that Tom Cruise&#8217;s mother is Mary Lee Pfeiffer, something automatic happens in the background. We don&#8217;t just store the fact in one direction, from the son to the mother. We get the reverse for free: we now also know that Mary Lee Pfeiffer&#8217;s son is Tom Cruise. It&#8217;s the same fact, looked at from the other end, and we don&#8217;t learn the two ends separately. They&#8217;re one fact with two entrances.</p><p>In classical statistics, this symmetry is built into the math. A correlation between two variables is the same whether you call one of them X or Y. A joint distribution of two things, written P(A, B), doesn&#8217;t have a direction. From that single object you can compute the chance of A given B, or the chance of B given A, and any system that knows one should be able to recover the other. The relationship is symmetric by construction.</p><p>Large language models are different, and that&#8217;s the surprising part. A language model is the system behind tools like ChatGPT: it&#8217;s trained on huge amounts of text to predict what comes next. The architecture these models use, the transformer, has no built-in sense of &#8220;forward&#8221; or &#8220;backward,&#8221; so on paper it could reason in both directions equally well. And yet, when you train one the standard way, by having it predict the next token (a token is a chunk of text, roughly a word or part of a word) given the tokens before it, something strange happens. The model learns a relationship in one direction and almost completely fails to retrieve the same relationship from the other. It will tell you who Tom Cruise&#8217;s mother is. It will not reliably tell you who Mary Lee Pfeiffer&#8217;s son is. The fact is the same. The model just can&#8217;t reach it from the other side.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Heqg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4112423-04d6-49d6-8cc4-dba4acb2495f_800x400.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Heqg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4112423-04d6-49d6-8cc4-dba4acb2495f_800x400.gif 424w, https://substackcdn.com/image/fetch/$s_!Heqg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4112423-04d6-49d6-8cc4-dba4acb2495f_800x400.gif 848w, https://substackcdn.com/image/fetch/$s_!Heqg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4112423-04d6-49d6-8cc4-dba4acb2495f_800x400.gif 1272w, https://substackcdn.com/image/fetch/$s_!Heqg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4112423-04d6-49d6-8cc4-dba4acb2495f_800x400.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Heqg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4112423-04d6-49d6-8cc4-dba4acb2495f_800x400.gif" width="800" height="400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d4112423-04d6-49d6-8cc4-dba4acb2495f_800x400.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:400,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:575903,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://cristobalsantana.substack.com/i/196354486?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4112423-04d6-49d6-8cc4-dba4acb2495f_800x400.gif&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Heqg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4112423-04d6-49d6-8cc4-dba4acb2495f_800x400.gif 424w, https://substackcdn.com/image/fetch/$s_!Heqg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4112423-04d6-49d6-8cc4-dba4acb2495f_800x400.gif 848w, https://substackcdn.com/image/fetch/$s_!Heqg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4112423-04d6-49d6-8cc4-dba4acb2495f_800x400.gif 1272w, https://substackcdn.com/image/fetch/$s_!Heqg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4112423-04d6-49d6-8cc4-dba4acb2495f_800x400.gif 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 role="img" 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><title></title><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">Forward, the fact flows: A is B. Backward, the same fact hits a wall: B is A?</figcaption></figure></div><p>In 2023, Berglund and colleagues named and carefully demonstrated this, and called it the Reversal Curse. They ran two experiments. In the first, they built a set of made-up facts in the form &#8220;name is description,&#8221; like &#8220;Daphne Barrington is the director of the film A Journey Through Time,&#8221; trained models on them, and tested both directions. Given the name, the model could recover the description. Given the description, it collapsed to near-random guessing. In the second experiment, they used real celebrity-parent pairs and asked GPT-4 questions both ways. Asked who a celebrity&#8217;s parent was, it answered correctly about 79% of the time. Asked the reverse, who a given parent&#8217;s child was, it dropped to 33%. The model knew both names. It just couldn&#8217;t travel from one to the other.</p><p>Two things made this finding hard to ignore. The first is that it showed up in every model they tested: GPT-3, GPT-4, Llama, and a range of smaller open models, so it wasn&#8217;t a quirk of one system. The second is that a separate team at Anthropic, working at the same time and without knowledge of the first group, hit the same wall from a different angle. Grosse and colleagues (2023) were studying which training examples most influence what a model predicts, using influence functions, a technique from classical statistics that estimates how a model&#8217;s behavior would change if you removed a specific training example. They found, almost in passing, that when a model answered a question phrased in one direction, the training examples that mattered were the ones phrased that same way. Examples phrased in reverse had almost no effect. Two papers, written independently, describing the same thing: to the model, the forward and reverse versions of a fact are nearly separate facts.</p><p>That rules out the easy explanations. This isn&#8217;t a problem with one architecture, one dataset, or one company&#8217;s training pipeline. It&#8217;s a property of how these models, trained to predict the next token, store and retrieve what they know. Three years later, it&#8217;s still one of the cleanest demonstrations of a gap that&#8217;s easy to forget: predicting the next token well is not the same thing as understanding a fact. This post is about that finding, why it happens, what people have tried to do about it, and why the most promising recent direction suggests the problem belongs to one specific way of training models rather than to language models in general.</p><h2>Why the Reversal Happens</h2><p>The main explanation is mechanical, and once you see it, it&#8217;s almost obvious.</p><p>These models are trained to predict the next token given everything before it. When the training text says &#8220;Tom Cruise&#8217;s mother is Mary Lee Pfeiffer,&#8221; the training process teaches the model to predict &#8220;Mary Lee Pfeiffer&#8221; after seeing &#8220;Tom Cruise&#8217;s mother is.&#8221; That update is directional. It strengthens the path from the prefix to the answer. It does nothing, by itself, for the opposite path, from &#8220;Mary Lee Pfeiffer&#8217;s son is&#8221; to &#8220;Tom Cruise.&#8221; Those are two different starting points leading to two different answers, and the training only ever asked the model to learn one of them.</p><p>For the model to get the reverse direction, one of two things would have to happen. Either it sees the reverse phrasing somewhere in training, or it figures out the reverse on its own from the forward version.</p><p>The first option is what saves us most of the time. Most facts on the internet are written in many different ways, and famous people have their relationships described from every angle. So for Tom Cruise, the reverse is probably stated somewhere too. The reversal curse shows up most clearly when a relationship appears in only one direction in the data: less-famous people, facts freshly added during fine-tuning (a short extra round of training that adds specific new facts to an already-trained model), or synthetic data made for a narrow purpose.</p><p>The second option, that the model could work out the reverse on its own, asks for something the training never rewards. Predicting the next token doesn&#8217;t teach a model that &#8220;X is Y&#8217;s mother&#8221; implies &#8220;Y is X&#8217;s child.&#8221; That logical equivalence is a fact about the world, not about sequences of text, and the model is only ever trained on sequences of text. The symmetry is invisible to what the model is optimizing for.</p><p>More recent work has sharpened this picture. Lv and colleagues (2024) showed that the reversal curse comes specifically from the next-token training objective and how it shapes the model&#8217;s internal representations. Wang and Sun (2025) argued the problem is structural: the way the model represents the two entities in &#8220;A is B&#8221; gets tangled together in a way that doesn&#8217;t allow a clean flip. Kitouni and colleagues (2024) widened the lens and called it the Factorization Curse, the broader point that what a model is trained to predict determines what kinds of generalizations it can and can&#8217;t make. The reversal curse is one case of that larger pattern.</p><p>The bottom line is that the failure isn&#8217;t a bug. It&#8217;s a direct consequence of training a model to predict the next token rather than to model the underlying facts. The model is doing exactly what it was trained to do. We just trained it to do something slightly different from what we actually wanted.</p><h2>Three Years Later: Where Things Stand in 2026</h2><p>The reversal curse hasn&#8217;t gone away, but the conversation around it has matured in two directions.</p><p>The first is a set of fixes that work by changing how the training data is presented. Reverse training (Golovneva et al., 2024) takes each training example and adds a reversed version, doubling the data and forcing the model to see both directions. Semantic-aware permutation training (Guo et al., 2024) does something similar but smarter, generating reworded versions that change the order in which entities and their attributes appear. These methods shrink the gap, sometimes closing it almost entirely on test sets, but they&#8217;re expensive to apply at the scale of full pretraining, and they don&#8217;t fully carry over to facts that weren&#8217;t part of the augmentation. They treat the symptom, not the cause.</p><p>The second direction is more interesting, and in my view more important. A growing body of work suggests the reversal curse is specific to autoregressive models, the kind that generate text strictly left to right, one token after another. It may not be a limitation of transformers in general, or of language models as a class. Masked diffusion models are a different approach: instead of generating left to right, they fill in tokens in any order, revealing them gradually. These models seem to handle reverse questions far better. LLaDA, an 8-billion-parameter masked diffusion model released in 2025 (Nie et al., 2025), is the clearest case. When a follow-up study put it head to head with autoregressive models on the same parent-child and person-description datasets used to demonstrate the curse  (trained in one direction only), LLaDA held up in the reverse direction while Llama-3.1 and Qwen-2.5 collapsed to near-random, in some splits answering almost no reverse questions (Shin et al., 2026).</p><p>That&#8217;s a genuinely surprising result. It suggests the reversal curse isn&#8217;t a deep limit of neural networks or of transformers. It&#8217;s a consequence of the left-to-right training objective. Change the objective, and the curse weakens. A model trained to predict tokens at any position, given any other tokens, seems to store relationships in a way that survives being flipped, presumably because it was never locked into a single direction in the first place.</p><p>Whether these models can scale up to compete with the best left-to-right models across every task is still being worked out. But for the narrow question of representing knowledge in both directions, they look like a better answer at the root than any patch you can bolt onto a left-to-right model.</p><p>The honest summary is this. Three years in, we understand much better why the reversal curse exists, we have a few methods that reduce it, and we have at least one kind of model that seems to avoid it from the start. What we don&#8217;t have is a frontier left-to-right model that has actually solved it. The curse is still present in every major LLM you can use today.</p><h2>What This Costs in Practice</h2><p>It helps to make the cost concrete. Picture a mid-sized company that sells industrial parts and decides to put an assistant on top of its product catalog. The catalog is full of relationships: this pump is compatible with that controller, this part replaces that older one, this component requires that adapter. The team feeds all of it to the model, tests it, and ships.</p><p>In the demo, everything looks fine. Ask &#8220;what controller is compatible with pump X?&#8221; and the assistant answers correctly, because the catalog was written that way, from the pump to the controller. Then a customer asks the question from the other side: &#8220;I have controller Y, which pumps work with it?&#8221; The relationship is the same one, and it&#8217;s sitting right there in the catalog. But the model was only ever trained on the forward phrasing, so it answers with a plausible, confident, wrong list. The customer orders the wrong part. Support gets a complaint. And nobody on the team can reproduce the problem easily, because their tests asked questions in the forward direction, the same direction the data was written in.</p><p>That&#8217;s the shape of the damage. It isn&#8217;t a crash or an obvious error. It&#8217;s a silent gap that passes every forward-looking test and only shows up when a real user approaches the fact from the other end. For a company, that means wrong answers reaching customers, confident enough that no one flags them, in exactly the cases the team never thought to check. The cost isn&#8217;t the technology failing loudly. It&#8217;s the technology failing quietly, in a direction the team assumed was covered.</p><h2>Mitigation Strategies</h2><p>You can&#8217;t fully fix the reversal curse from outside the model, because it isn&#8217;t a behavior problem, it&#8217;s a missing-knowledge problem. The model doesn&#8217;t have the fact accessible in the reverse direction, and no amount of wrapping makes it retrieve something it never learned that way. But you can design the system around the model so that it doesn&#8217;t depend on a direction the model is weak at. The goal isn&#8217;t to repair the model. It&#8217;s to build a system that doesn&#8217;t need the model to do the thing it can&#8217;t.</p><p>The most reliable strategy is to not ask the model for the reverse direction at all. If your application needs reverse lookup, given a controller, find compatible pumps, don&#8217;t rely on the model&#8217;s memory for it. Put the relationships in a database or a structured index that stores them symmetrically, and let that handle the reverse query. The model is great at language and reasoning over what&#8217;s in front of it. It&#8217;s unreliable at recalling a relationship backward from its weights. So hand the backward lookup to a tool that holds the fact in both directions, and use the model for what it&#8217;s actually good at.</p><p>A close second is to store relationships in both directions from the start. If you control the data the model sees, which you usually do in a retrieval system (a setup that finds relevant text for each question and places it in the prompt before the model answers, also known as retrieval-augmented generation, or RAG), you can write each relationship twice, once in each direction, so that when the system pulls context for a query, the reverse form is already there. This connects to something the original paper noted: when the fact is present in the context, the model can use the relationship fine. The curse only shows up when the model has to recall it from memory. So the cheap, robust move is to make sure the relevant fact is in the context in the direction the question needs, rather than hoping the model can flip it on its own.</p><p>A third strategy is to enrich the query before it reaches the model. A small step in the system can take the incoming question, fetch the relevant fact from a reliable source, and place it in the prompt in the direction the model needs. The model then answers from context, not from its weak reverse memory. This is just the previous idea applied at query time instead of at indexing time.</p><p>And underneath all of these is the one habit that costs almost nothing: test both directions explicitly. The reversal curse is dangerous mostly because it&#8217;s invisible to forward-only testing. If your application has any reverse-lookup component, write tests that ask the question from the other side, and you&#8217;ll catch the gap before a customer does. None of this removes the curse. It just keeps the curse from reaching anyone who depends on your system.</p><h2>A Pattern Bigger Than Reversal</h2><p>What I find most interesting about the reversal curse isn&#8217;t the specific failure on celebrity-parent pairs. It&#8217;s what that failure says about two things that get treated as the same and aren&#8217;t: predicting the next token well, and modeling the underlying facts of the world.</p><p>The next-token objective, applied to enough text at enough scale, produces models that are extraordinarily good at one thing: continuing text in plausible ways. When the training data contains enough phrasings of a fact, the model can answer questions about it from many angles, and that looks like understanding. But the moment you ask a question whose phrasing wasn&#8217;t in the training data, even one whose answer is logically equivalent to something the model clearly knows, the gaps become visible. The model was never taught to derive new facts from logical equivalences. It was taught to continue text. Those are different skills, and we keep being surprised when they come apart.</p><p>That, I think, is the real lesson. These models aren&#8217;t building internal maps of the world the way people do, where a fact sits as a relationship you can approach from any side. They&#8217;re building dense statistical models of text, and the shape of those models reflects the direction in which the text was written. When the data is symmetric, as it is for famous people described from every angle, the model looks symmetric. When the data runs in one direction, as it almost always does for less-discussed entities, new facts, or specialized fields, the model inherits that one-directionality.</p><p>For anyone building on top of LLMs, the takeaway is uncomfortable but useful. Don&#8217;t assume the model knows a fact in both directions just because it knows it in one. The asymmetry is real, it&#8217;s persistent, and it&#8217;s silent. Those last three words are what make it dangerous, and they&#8217;re why the fix is almost never a bigger model. It&#8217;s designing the system so it never has to depend on a direction the model was never taught.</p><div><hr></div><h2>References</h2><p><strong>Foundations</strong></p><p>Berglund, L., Tong, M., Kaufmann, M., Balesni, M., Stickland, A. C., Korbak, T., &amp; Evans, O. (2023). The Reversal Curse: LLMs trained on &#8220;A is B&#8221; fail to learn &#8220;B is A&#8221;. ICLR 2024. arXiv:2309.12288 - <a href="https://arxiv.org/abs/2309.12288">https://arxiv.org/abs/2309.12288</a></p><p><strong>Independent confirmation</strong></p><p>Grosse, R., et al. (2023). Studying Large Language Model Generalization with Influence Functions. Anthropic. arXiv:2308.03296 - <a href="https://arxiv.org/abs/2308.03296">https://arxiv.org/abs/2308.03296</a></p><p><strong>Mechanisms and analysis</strong></p><p>Lv, A., et al. (2024). An Analysis and Mitigation of the Reversal Curse. EMNLP 2024. arXiv:2311.07468 - <a href="https://arxiv.org/abs/2311.07468">https://arxiv.org/abs/2311.07468</a></p><p>Kitouni, O., et al. (2024). The Factorization Curse: Which Tokens You Predict Underlie the Reversal Curse and More. arXiv:2406.05183 - <a href="https://arxiv.org/abs/2406.05183">https://arxiv.org/abs/2406.05183</a></p><p>Wang, B., &amp; Sun, H. (2025). Is the Reversal Curse a Binding Problem? Uncovering Limitations of Transformers from a Basic Generalization Failure. arXiv:2504.01928 - <a href="https://arxiv.org/abs/2504.01928">https://arxiv.org/abs/2504.01928</a></p><p><strong>Mitigations</strong></p><p>Golovneva, O., Allen-Zhu, Z., Weston, J., &amp; Sukhbaatar, S. (2024). Reverse Training to Nurse the Reversal Curse. arXiv:2403.13799 - <a href="https://arxiv.org/abs/2403.13799">https://arxiv.org/abs/2403.13799</a></p><p>Guo, Q., et al. (2024). Mitigating Reversal Curse in Large Language Models via Semantic-aware Permutation Training. arXiv:2403.00758 - <a href="https://arxiv.org/abs/2403.00758">https://arxiv.org/abs/2403.00758</a></p><p><strong>Recent updates (2025-2026)</strong></p><p>Nie, S., et al. (2025). LLaDA: Large Language Diffusion Models. arXiv:2502.09992 - <a href="https://arxiv.org/abs/2502.09992">https://arxiv.org/abs/2502.09992</a></p><p>Shin, S., Kim, B., Lee, K., Jeon, M., &amp; No, A. (2026). Understanding the Reversal Curse Mitigation in Masked Diffusion Models through Attention and Training Dynamics. arXiv:2602.02133 - <a href="https://arxiv.org/abs/2602.02133">https://arxiv.org/abs/2602.02133</a></p>]]></content:encoded></item><item><title><![CDATA[Lost in the Middle: Why LLMs Forget What They Just Read]]></title><description><![CDATA[Modern LLMs can read enormous contexts. They just don't read the middle.]]></description><link>https://cristobalsantana.substack.com/p/lost-in-the-middle-why-llms-forget</link><guid isPermaLink="false">https://cristobalsantana.substack.com/p/lost-in-the-middle-why-llms-forget</guid><dc:creator><![CDATA[Cristobal Santana]]></dc:creator><pubDate>Tue, 02 Jun 2026 11:03:46 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/806b03a7-ba9d-4e6d-8fd2-31338faa8e9b_1404x694.png" 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="https://substackcdn.com/image/fetch/$s_!E6Bh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3961cb83-80fa-4a8a-b662-4ae8b700a6bc_1019x845.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!E6Bh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3961cb83-80fa-4a8a-b662-4ae8b700a6bc_1019x845.png 424w, https://substackcdn.com/image/fetch/$s_!E6Bh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3961cb83-80fa-4a8a-b662-4ae8b700a6bc_1019x845.png 848w, https://substackcdn.com/image/fetch/$s_!E6Bh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3961cb83-80fa-4a8a-b662-4ae8b700a6bc_1019x845.png 1272w, https://substackcdn.com/image/fetch/$s_!E6Bh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3961cb83-80fa-4a8a-b662-4ae8b700a6bc_1019x845.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!E6Bh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3961cb83-80fa-4a8a-b662-4ae8b700a6bc_1019x845.png" width="1019" height="845" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3961cb83-80fa-4a8a-b662-4ae8b700a6bc_1019x845.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:845,&quot;width&quot;:1019,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:304034,&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://cristobalsantana.substack.com/i/196272982?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17f0a1d4-1e16-4488-a885-754cf744919a_1118x960.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!E6Bh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3961cb83-80fa-4a8a-b662-4ae8b700a6bc_1019x845.png 424w, https://substackcdn.com/image/fetch/$s_!E6Bh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3961cb83-80fa-4a8a-b662-4ae8b700a6bc_1019x845.png 848w, https://substackcdn.com/image/fetch/$s_!E6Bh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3961cb83-80fa-4a8a-b662-4ae8b700a6bc_1019x845.png 1272w, https://substackcdn.com/image/fetch/$s_!E6Bh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3961cb83-80fa-4a8a-b662-4ae8b700a6bc_1019x845.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 role="img" 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><title></title><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><h3>The Problem</h3><p>If you have ever built a RAG system, where the model retrieves relevant documents and uses them to answer a question, you have probably felt this without naming it. You retrieve twenty chunks, the relevant one is in there somewhere, the model has it in context, and it still answers as if it never saw it. So you add more context to be safe, and somehow the answer gets worse. This is not a retrieval bug, and you cannot fix it by switching to a model with a bigger context window. It is the model not reading its own middle.</p><p>This matters more than it sounds. A system that silently ignores part of its input is a system that fails in ways you cannot see in a demo. It works when you test it with three documents and the answer is in the first one. It breaks in production when the answer happens to land in document eleven of twenty, and now you have a support ticket, a user who does not trust the output, and an engineer trying to reproduce a bug that depends on the position of a document nobody thought to track.</p><p>There is an old finding in cognitive psychology that fits this almost perfectly. Murdock described the serial position effect in 1962: people recall the first and last items in a list far better than the items in between. Human memory is U-shaped. We remember the beginning, we remember the conclusion, and the middle turns into a vague impression. Modern machine learning was supposed to be different. The transformer was sold partly on its ability to attend equally to every position in the input. The attention mechanism, in principle, lets each token reach across the entire context with equal ease. Everything is, mathematically, the same distance away. That is the implicit promise of long-context models: feed it a long document and it will actually use it.</p><p>In 2023, Liu and colleagues at Stanford and Berkeley showed that this assumption is wrong. Their paper, Lost in the Middle: How Language Models Use Long Contexts, showed that current LLMs behave a lot like the human U-shape. Information at the beginning and end of the context gets used. Information in the middle, even when it is the exact answer to the question being asked, often gets ignored. The model can read it. It just does not pull from it the way it pulls from the edges. This post is about why that happens, what it costs you if you are building real systems on top of LLMs, and why it is still an open problem in 2026.</p><h3>What&#8217;s Actually Happening</h3><p>The experiment Liu et al. designed is clean enough that you can picture it right away. The model receives a question plus several documents, exactly one of which contains the answer. The other documents are real but irrelevant, distractors pulled from the same corpus. The key move is that they change the position of the answer-bearing document within the context, from the first slot to the last, keeping everything else the same. Same question, same documents, same model. Only the position of the answer changes.</p><p>If a model really used its context evenly, accuracy should be flat across positions. Instead they found a clear U-shape: high accuracy when the relevant document sits at the start or the end, and a clear drop when it sits in the middle. The model is not using its middle.</p><p>What made this land was that it was not a quirk of one model. They tested open-source and proprietary models alike (GPT-3.5-Turbo, Claude, MPT, Longchat variants) and the U-shape showed up in every one, with different severity. Models with longer context windows did not escape it. If anything, the drop got worse as the context grew. This is what made the finding important for anyone deploying these systems: it was not a bug in one architecture you could swap out, it was a property of how transformer-based models, as a class, process long inputs. Later replications across newer models have confirmed that while the size of the effect can be reduced, the U-shape stays. The middle of the context is still, in 2026, a partial blind spot for most LLMs.</p><div class="image-gallery-embed" data-attrs="{&quot;gallery&quot;:{&quot;images&quot;:[{&quot;type&quot;:&quot;image/gif&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/12f24a33-9fc8-4ed3-985a-bc153e459459_860x360.gif&quot;}],&quot;caption&quot;:&quot;As the context grows, the model pays less attention to the middle. The edges stay sharp.&quot;,&quot;alt&quot;:&quot;Animation showing a context window growing from one paragraph to three. As it grows, the orange bars representing the model's attention fade in the middle while staying sharp at the first and last tokens.&quot;,&quot;staticGalleryImage&quot;:{&quot;type&quot;:&quot;image/gif&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/12f24a33-9fc8-4ed3-985a-bc153e459459_860x360.gif&quot;}},&quot;isEditorNode&quot;:true}"></div><p></p><h3>Why the Middle Disappears</h3><p>Three explanations have been proposed, and the honest answer is that the field has not fully settled which one matters most. They probably stack on top of each other. You do not need to master the math to make good decisions here, but the intuition is worth having, because it tells you why no prompt trick makes the problem go away.</p><p>The first is about the data these models were trained on. In typical text, important information sits at the beginning (introductions, headlines, opening paragraphs) and at the end (conclusions, key takeaways). The middle tends to be supporting or transitional. A model trained to predict the next token in this kind of text learns, without anyone telling it to, that the edges matter more than the middle. This bias is not written anywhere explicit. The model picks it up on its own, from billions of examples.</p><p>The second is about how attention itself behaves. Xiao and colleagues (2023) found a phenomenon called attention sinks: the first tokens of a sequence get a large share of attention from every later token, no matter what they actually say. This appears to be a side effect of how attention works: the model assigns each token a set of attention scores that are forced to sum to one, so the weight always has to go somewhere. Even when nothing in the context deserves attention, the model has to put its weight somewhere, and it tends to dump that extra weight on the first few positions. Early tokens become anchors that dominate the processing, and tokens deep in the middle get pushed out.</p><p>The third is about positional encoding, the mechanism that tells the model where each token sits. Different schemes for doing this (RoPE, ALiBi, learned embeddings, all different ways of encoding position) behave differently with long contexts. Press et al. (2022) showed that some encodings handle lengths beyond their training range well and others fall apart. When a model runs on contexts longer than it saw during training, the middle is the region that suffers most, because those are exactly the positions it never had to deal with.</p><p>For anyone building on top of these models, the mechanism matters less than the result. The bias is real, it is baked in during training, and you cannot prompt your way out of it. You have to design around it. That is a product decision, not a tuning problem.</p><h3>Where We Are in 2026</h3><p>It is worth stopping on what &#8220;long context&#8221; even means anymore, because the numbers have moved several times, and the marketing has moved faster than the reality. When Liu et al. published in 2023, long context meant 8k to 32k tokens. By early 2026 those numbers look small: GPT-5.4 ships with 128k, Claude Opus 4.6 with 200k, Gemini 3.1 Pro advertises 2 million, Llama 4 Scout claims 10 million. The ceiling has grown by two orders of magnitude in three years. You might expect the Lost in the Middle problem to have quietly disappeared with all that room to spare. It has not.</p><p>The most useful way to think about this, especially if you are paying for tokens, is the gap between advertised and effective context length. Hsieh and colleagues (2024) built RULER, a benchmark that stress-tests long-context performance with multi-needle retrieval and multi-hop tasks. Their headline finding: of the models claiming 32k or more, only about half could actually handle 32k well, and almost all dropped below a usable level well before their advertised length. As of 2026, the rule of thumb across independent benchmarks is that effective capacity is roughly 60-70% of the advertised maximum. In plain terms: the 1M-token window you are paying for gives you maybe 600k to 700k tokens of context you can actually trust. The rest is capacity on the spec sheet that does not show up in the output.</p><p>There has been real progress, to be fair. The latest generation has put a lot of work into long-context post-training and the results are visible. On the multi-needle MRCR v2 benchmark at 1M tokens, Claude Opus 4.6 reportedly reaches around 76%, compared to about 18.5% for Claude Sonnet 4.5 on the same test, a roughly fourfold jump in a single generation. That is not small. It suggests the U-shape is something that scaling and targeted training can reduce. But reduce is the right word: no current model gives you flat accuracy across positions. The drop is smaller, but it is still there.</p><p>A more uncomfortable result came in late 2025, when Du and colleagues showed that context length alone hurts performance even when retrieval is perfect. Even when the relevant information is clearly available and the model has provably read it, more surrounding context still makes the answer worse. Stuffing the context window is not a free lunch, and &#8220;just put everything in the prompt&#8221; is not a strategy.</p><p>So what do you actually do about it if you are shipping something today? A few things, in rough order of how much they help:</p><p><strong>Reorder.</strong> Put your highest-relevance chunks at the start and end of the context, not sorted top-to-bottom by similarity score, and let the middle hold the low-confidence material. This costs you nothing and it measurably helps.</p><p><strong>Re-rank with position in mind.</strong> When you fetch documents and pass them to the model, sort for edge placement, not just raw similarity. The order you pass things in matters more than people first realized.</p><p><strong>Test at production length.</strong> This is the one most teams skip. Check it with multi-needle retrieval at your real context size, not at the advertised maximum and not with toy inputs. A model with a 1M window that only uses the first and last 50k tokens will pass every demo and fail in production, and you will not know until a customer finds the gap for you.</p><p><strong>Consider training-side fixes if you control the model.</strong> Work like IN&#178;-training (An et al., 2024) trains models on answers placed all across the context, including the middle, and it helps. But none of these removes the U-shape, and most teams buying an API do not have this option anyway.</p><p>The realistic stance is to assume the middle is unreliable until proven otherwise, and to build that assumption into your architecture from the start instead of finding out after launch.</p><h3>A Pattern Bigger Than Long Context</h3><p>What I find most interesting about Lost in the Middle is not specific to long contexts. It is a clean example of a bigger pattern, and one worth keeping in mind if you make decisions about these systems: the way training shapes behavior in ways you cannot see from the architecture alone.</p><p>The transformer does not, on paper, prefer the edges of its input. The attention mechanism is symmetric in a precise mathematical sense. And yet, after training on text where important information lives at the edges, the model behaves as if it had a built-in bias. The bias is real, you can measure it, and it is consistent across models. It just does not live in the architecture. It lives in the interaction between the architecture and the data. The model you bought is not the model the spec sheet describes. It is that model, plus the hidden priors of its training data, plus behaviors nobody put there on purpose.</p><p>This is a pattern you see again and again in modern ML, and it has a direct consequence for how you work with these systems. The capability advertised on a model card is the ceiling, not the floor. Lost in the Middle is easy to see because the failure is easy to show: change one position, watch accuracy drop. Most data-driven biases are much harder to spot, and you never notice them until something specific breaks in front of a user.</p><p>The teams that win with these systems are not the ones with access to the biggest models. They are the ones who assume the model has limits the vendor did not advertise, test under conditions that match production, and design around the gaps early. Do not trust the model to read evenly. Do not assume that &#8220;in the context&#8221; means &#8220;available to the model.&#8221; The model is doing what it was trained to do, not what its spec sheet suggests it could do, and the difference is your problem to manage, not the vendor&#8217;s.</p><p>If this kind of thing is what you like to think about, I write about one of these phenomena every couple of weeks. Next up: the Reversal Curse, why a model that knows &#8220;A is B&#8221; often fails to know &#8220;B is A,&#8221; and what that means if you are building anything that relies on an LLM reasoning over structured facts.</p><h3>References</h3><p><strong>Foundations</strong></p><p>Liu, N. F., Lin, K., Hewitt, J., Paranjape, A., Bevilacqua, M., Petroni, F., &amp; Liang, P. (2023). Lost in the Middle: How Language Models Use Long Contexts. Transactions of the Association for Computational Linguistics. arXiv:2307.03172 - <a href="https://arxiv.org/abs/2307.03172">https://arxiv.org/abs/2307.03172</a></p><p><strong>Mechanisms</strong></p><p>Xiao, G., Tian, Y., Chen, B., Han, S., &amp; Lewis, M. (2023). Efficient Streaming Language Models with Attention Sinks. arXiv:2309.17453 - <a href="https://arxiv.org/abs/2309.17453">https://arxiv.org/abs/2309.17453</a></p><p>Press, O., Smith, N. A., &amp; Lewis, M. (2022). Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation (ALiBi). ICLR 2022. arXiv:2108.12409 - <a href="https://arxiv.org/abs/2108.12409">https://arxiv.org/abs/2108.12409</a></p><p><strong>Mitigations and benchmarks</strong></p><p>An, S., Ma, Z., Lin, Z., Zheng, N., Lou, J. G., &amp; Chen, W. (2024). Make Your LLM Fully Utilize the Context. arXiv:2404.16811 - <a href="https://arxiv.org/abs/2404.16811">https://arxiv.org/abs/2404.16811</a></p><p>Hsieh, C. P., Sun, S., Kriman, S., Acharya, S., Rekesh, D., Jia, F., Zhang, Y., &amp; Ginsburg, B. (2024). RULER: What&#8217;s the Real Context Size of Your Long-Context Language Models? arXiv:2404.06654 - <a href="https://arxiv.org/abs/2404.06654">https://arxiv.org/abs/2404.06654</a></p><p><strong>Recent updates</strong></p><p>Du, Y., et al. (2025). Context Length Alone Hurts LLM Performance Despite Perfect Retrieval. arXiv:2510.05381 - <a href="https://arxiv.org/abs/2510.05381">https://arxiv.org/abs/2510.05381</a></p><p>Salvatore, N., et al. (2025). Lost in the Middle: An Emergent Property from Information Retrieval Demands in LLMs. arXiv:2510.10276 - <a href="https://arxiv.org/abs/2510.10276">https://arxiv.org/abs/2510.10276</a></p><p><strong>Cognitive background</strong></p><p>Murdock, B. B. (1962). The Serial Position Effect of Free Recall. Journal of Experimental Psychology, 64(5), 482-488. - <a href="https://doi.org/10.1037/h0045106">https://doi.org/10.1037/h0045106</a></p>]]></content:encoded></item><item><title><![CDATA[The PINN Loss Function: Where Physics and Optimization Collide]]></title><description><![CDATA[Physics-Informed Neural Networks promise to solve PDEs with deep learning. The loss function is where the elegance lives &#8212; and where the pain begins.]]></description><link>https://cristobalsantana.substack.com/p/the-pinn-loss-function-where-physics</link><guid isPermaLink="false">https://cristobalsantana.substack.com/p/the-pinn-loss-function-where-physics</guid><dc:creator><![CDATA[Cristobal Santana]]></dc:creator><pubDate>Fri, 01 May 2026 05:13:54 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/2a18e286-2adc-4794-a611-3fe763d4a981_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In classical statistics, you usually start from a hypothesis about the function that generates your data. You assume a linear relationship, or a Gaussian distribution, or a logistic shape, and you spend most of your effort estimating a small set of parameters that make that assumed shape fit the observations as well as possible. The function is, in a sense, <em>known up to a few numbers</em>. The model is what you brought to the problem; the data tells you how to tune it.</p><p>Modern machine learning works differently, and the difference is more philosophical than people usually admit. When we train a deep neural network, we don&#8217;t have a hypothesis about the function. We have a flexible family of functions &#8212; the architecture &#8212; that is rich enough to approximate almost anything, and we let the data drag the parameters toward whatever shape minimizes a loss. The true function that maps inputs to outputs is unknown, possibly unknowable, and we never write it down. What we have instead are metrics. Train loss. Validation accuracy. Held-out error. We iterate, and the metrics tell us whether the function we&#8217;re approximating <em>behaves</em> like the unknown one, on the inputs we happen to have. The model is a black box that we trust because it agrees with reality where we can check.</p><p>This is a remarkable thing, and also a fragile one. Most of the failure modes in modern ML &#8212; distribution shift, spurious correlations, hallucinations, weird emergent behaviors &#8212; are direct consequences of this setup. We never know whether the function we learned matches the unknown one <em>outside</em> the points where we measured. We only know it agrees on the points we tested.</p><p>Physics-Informed Neural Networks are interesting precisely because they break this pattern. We still don&#8217;t know the function we&#8217;re trying to learn &#8212; the solution of a partial differential equation can be wildly complicated and is exactly what we want the network to discover. But we do know something the standard ML setup never has: an <em>equation that the unknown function must satisfy</em>. The PDE itself is a strong, exact, mathematically derived constraint on the shape of the solution. It tells us, at every point in space and time, what relationship must hold among the function&#8217;s values and its derivatives. This is information we usually don&#8217;t have in machine learning, and it&#8217;s enormously valuable. In principle, it should let the network converge faster, generalize better, and stay faithful to physical reality even in regions of the input space where we have no data at all.</p><p>When Raissi, Perdikaris, and Karniadakis published their original PINN papers in 2017, this is exactly what they exploited. Take a neural network. Add the governing equation as part of the loss. Let backpropagation discover a function that is simultaneously consistent with your data and with the laws of physics. No mesh. No finite differences. No discretization headaches. Just a loss function and an optimizer.</p><p>For someone trained as a physicist, this was seductive. Solving partial differential equations is what physicists spend years learning to do &#8212; by hand, with elaborate numerical schemes, with decades of accumulated craft. The PINN promise was that you could replace much of that machinery with a few hundred lines of PyTorch.</p><p>Eight years and thousands of papers later, the picture is more honest. PINNs work &#8212; sometimes spectacularly &#8212; and they also fail in ways that the field is still trying to understand. Most of those failures trace back to one place: the loss function.</p><p>This post is about why a deceptively simple loss function turns out to be one of the hardest objects to optimize in modern machine learning, and what we&#8217;ve learned about it.</p><h2>The Idea in One Paragraph</h2><p>A PINN is a neural network that takes coordinates (a position in space, a moment in time) and outputs the value of some physical field at that point &#8212; temperature, pressure, displacement, whatever the PDE describes. What makes it &#8220;physics-informed&#8221; is that the network is trained not just to fit observed data, but to satisfy the PDE itself at a cloud of <em>collocation points</em> sprinkled across the domain. Because automatic differentiation gives us exact derivatives of the network&#8217;s output with respect to its inputs, we can plug the network directly into the differential operator, compute how much it violates the equation, and minimize that violation. That&#8217;s the whole trick. The rest is engineering.</p><h2>The Loss Has Several Voices</h2><p>The loss function a PINN minimizes is not one thing. It&#8217;s a sum of distinct objectives, each pulling the network in its own direction.</p><p>Before unpacking each piece, it&#8217;s worth pausing on one observation. The data loss term is exactly the loss any standard supervised model uses: a discrepancy between predictions and observations, typically measured with the squared L&#178; norm &#8212; the p=2 case of the general L^p family that powers nearly every loss function in modern machine learning:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{L}_{d}^{(p)}(\\theta) = \\frac{1}{N_d} \\sum{i=1}^{N_d} \\left| u_\\theta(x_i, t_i) - y_i \\right|^p&quot;,&quot;id&quot;:&quot;KAHJKPYSCY&quot;}" data-component-name="LatexBlockToDOM"></div><p></p><p>In practice, we set p=2 &#8212; the squared error you&#8217;ve seen in every regression problem since your first stats course:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{L}_{d}(\\theta) = \\frac{1}{N_d} \\sum{i=1}^{N_d} \\left| u_\\theta(x_i, t_i) - y_i \\right|^2&quot;,&quot;id&quot;:&quot;DCKJXZGRWG&quot;}" data-component-name="LatexBlockToDOM"></div><p></p><p>In that sense, a PINN trained only on the data term would be just a regular regression model. What makes it physics-informed is everything else: the additional terms that don&#8217;t compare predictions to data, but to the equation itself.</p><p>The full loss looks like this:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathcal{L}(\\theta) = \\lambda_{r}, \\mathcal{L}_{r}(\\theta) + \\lambda_{b}, \\mathcal{L}_{b}(\\theta) + \\lambda_{i}, \\mathcal{L}_{i}(\\theta) + \\lambda_{d}, \\mathcal{L}_{d}(\\theta)&quot;,&quot;id&quot;:&quot;URBWVPQVMJ&quot;}" data-component-name="LatexBlockToDOM"></div><p></p><p>Reading right to left, those terms ask the network to: match observed data, match the initial state of the system, respect the boundaries of the domain, and satisfy the PDE everywhere in between. The lambdas are scalar weights that decide how much each voice gets to speak.</p><p>They look innocent. They are not.</p><h2>A Choir That Doesn&#8217;t Agree</h2><p>The clean way to describe the problem is <em>multi-objective optimization disguised as single-objective optimization</em>. We hand the optimizer one number to minimize, but inside that number live four objectives with different units, different scales, and different geometric properties.</p><p>The vivid way to describe it is a choir where every singer is trying to hit a different note at a different volume, and the conductor &#8212; the optimizer &#8212; keeps walking toward whoever is loudest.</p><p>If the residual loss produces gradients orders of magnitude larger than the boundary loss, the optimizer effectively ignores the boundaries. The network learns to satisfy the PDE almost everywhere &#8212; including, sometimes, by collapsing into trivial solutions like &#8220;everything is zero,&#8221; which satisfies many PDEs perfectly. Conversely, if the boundary loss dominates, you get a network that fits the boundary beautifully and disrespects the physics in the interior.</p><p>This isn&#8217;t speculation. Wang, Teng, and Perdikaris (2021) showed both empirically and theoretically that during training, the gradients from different loss components become severely imbalanced. They called it a <em>gradient pathology</em>. The optimizer ends up being steered by whichever loss has the loudest gradient, regardless of which loss matters most for solving the problem.</p><p>For a physicist this should feel familiar. It&#8217;s the same disease as a stiff system of differential equations: the dynamics are dominated by whichever component has the fastest timescale, even when the slow components carry most of the physics.</p><h2>Why Boundaries Win and Physics Loses</h2><p>A year later, Wang, Yu, and Perdikaris (2022) gave a sharper diagnosis using Neural Tangent Kernel theory &#8212; a tool that lets us analyze very wide neural networks as if they were linear models, where convergence rates become eigenvalues of a matrix.</p><p>Their finding is uncomfortably specific: the PDE residual term is associated with much smaller eigenvalues than the boundary and initial-condition terms. In plain language, the network learns to fit boundaries quickly and the interior physics slowly. By the time the residual loss starts converging meaningfully, the optimizer has already settled into a region of parameter space shaped almost entirely by the boundary.</p><p>This is why PINNs frequently produce solutions that look correct on the boundary and are visibly wrong in the interior. It&#8217;s also why &#8220;just train it longer&#8221; so often fails to fix the problem. The geometry of the loss landscape was set in the first thousand steps.</p><h2>Failure Is Not an Edge Case</h2><p>Krishnapriyan and collaborators (NeurIPS 2021) made the failure even more concrete. They studied PINNs on benchmark problems &#8212; including the convection equation, about as simple a PDE as exists &#8212; and showed that as the convection coefficient grows, PINNs systematically fail to converge to the correct solution. The loss landscape becomes increasingly ill-conditioned, and the optimizer gets trapped in solutions that are smooth, look reasonable, and are physically meaningless.</p><p>The lesson is uncomfortable: PINN failure isn&#8217;t an exotic edge case that shows up only in adversarial test problems. It happens on textbook equations, with reasonable hyperparameters, in ways you wouldn&#8217;t catch by looking at training curves. The training loss converges. The model is still wrong.</p><h2>What People Are Doing About It</h2><p>Most modern PINN research is, in one form or another, an attempt to fix the loss function. Four directions are worth knowing about:</p><p><strong>Adaptive loss weighting.</strong> Stop treating the lambdas as fixed hyperparameters. Update them online based on the gradient norms of each term, so no single voice in the choir can dominate. McClenny and Braga-Neto (2023) took this further with <em>self-adaptive PINNs</em>, where the weights themselves become trainable parameters in a min-max game: the network minimizes the loss, the weights maximize it, and the equilibrium concentrates effort where the network is failing most.</p><p><strong>Causal training.</strong> Time-dependent PDEs have a built-in causal structure: the solution at time <em>t</em> depends on the solution at earlier times. Standard PINNs ignore this and train at all collocation points simultaneously, which is a bit like learning the ending of a story before reading the beginning. <em>Causal PINNs</em> re-weight the loss so that the network is forced to converge in time order, fitting early times before late times become consistent.</p><p><strong>Curriculum and domain decomposition.</strong> Train on easier subproblems first &#8212; smaller domains, smoother coefficients, gentler regimes &#8212; and expand the difficulty gradually. Or split the domain into pieces and let local PINNs collaborate. The XPINN and cPINN families follow this route.</p><p><strong>Architectural fixes.</strong> Bake the boundary conditions directly into the network architecture so that the boundary loss is zero by construction. Use Fourier features to fight the network&#8217;s natural preference for low-frequency solutions. Use second-order optimizers like L-BFGS, which handle ill-conditioned landscapes better than Adam ever will.</p><p>None of these is a silver bullet. Each helps on some problems and hurts on others. The honest summary of the field today is that PINN training remains an active research problem, not a solved one.</p><h2>A Pattern Bigger Than PINNs</h2><p>What I find most interesting about all of this isn&#8217;t specific to physics-informed networks. The same pathology appears anywhere we compose a loss function from multiple terms with different physical meanings.</p><p>Auxiliary losses in self-supervised learning. KL divergence terms in variational autoencoders. Value and policy losses in actor-critic reinforcement learning. Reconstruction plus regularization in almost everything. Every time we sum two objectives with a single weight in front, we&#8217;re recreating the PINN choir, and we&#8217;re handing the optimizer the right to follow whichever voice is loudest. &#8220;Loudness&#8221; rarely correlates with importance.</p><p>The PINN literature has pushed harder than most subfields on understanding this, partly because the failure mode is visually obvious. When your network claims to have solved a partial differential equation and you plot the result, the lie is right there on the screen. In domains where the loss is the only signal you ever look at, the same pathologies are quietly degrading models all the time. We just don&#8217;t notice them as easily.</p><p>This is the part that feels most &#8220;physics&#8221; to me. The PINN loss function is a small, transparent example of a much more general principle: when you ask one optimizer to balance multiple objectives by adding them up, you&#8217;re betting that the gradients will respect the same hierarchy of importance that you do. They almost never do.</p><p>The classical statistician brought a hypothesis and let the data tune it. The deep learning researcher brings a flexible architecture and lets the data shape it. The PINN researcher brings the equation itself, and discovers that even with that much extra structure, the optimizer still finds ways to disappoint. There&#8217;s a lesson in there about how much of modern ML&#8217;s behavior is decided not by the problem, not by the data, not even by the model &#8212; but by the geometry of the loss we choose to minimize.</p><p>Physics-informed neural networks remain a beautiful idea. The loss function is what makes them work, and what makes them fail. Understanding it is the difference between using PINNs as a black box and using them as a tool whose limits you can anticipate.</p><h2>Where PINNs Are Actually Used</h2><p>The literature on PINN applications is vast and growing. A non-exhaustive map of where they&#8217;ve shown promise, with a representative reference for each domain:</p><ul><li><p><strong>Fluid dynamics.</strong> Navier-Stokes for incompressible flow, turbulence modeling, weather and climate sub-models. <em>Cai et al., 2021 &#8212; comprehensive review of PINNs for fluid mechanics.</em></p></li><li><p><strong>Solid mechanics.</strong> Stress and strain analysis, fracture propagation, elasticity problems with complex geometries. <em>Haghighat et al., 2021 &#8212; PINN framework for solid mechanics and elasticity.</em></p></li><li><p><strong>Heat transfer.</strong> Conduction, convection, and radiation problems where boundary conditions are messy or partially known. <em>Cai et al., 2021 &#8212; PINNs for heat transfer problems.</em></p></li><li><p><strong>Electromagnetism.</strong> Maxwell&#8217;s equations in heterogeneous media, antenna design, photonics. <em>Chen et al., 2020 &#8212; PINNs for inverse problems in nano-optics and metamaterials.</em></p></li><li><p><strong>Inverse problems.</strong> Recovering physical parameters &#8212; diffusion coefficients, source terms, material properties &#8212; from sparse observations. Often the most compelling use case, since traditional solvers struggle here. <em>Raissi, Perdikaris, &amp; Karniadakis, 2019 &#8212; original paper covers both forward and inverse formulations.</em></p></li><li><p><strong>Subsurface and reservoir modeling.</strong> Oil and gas flow, groundwater contamination, CO&#8322; sequestration. <em>Tartakovsky et al., 2020 &#8212; PINNs for subsurface flow and transport.</em></p></li><li><p><strong>Biomedical modeling.</strong> Cardiovascular hemodynamics, blood pressure estimation from sparse measurements, cardiac electrophysiology. <em>Sahli Costabal et al., 2020 &#8212; PINNs for cardiac activation mapping; Kissas et al., 2020 &#8212; PINNs for cardiovascular flow.</em></p></li><li><p><strong>Quantum mechanics.</strong> Solving Schr&#246;dinger&#8217;s equation for systems where traditional grid methods become intractable. <em>Pfau et al., 2020 &#8212; FermiNet, a deep learning approach to many-electron Schr&#246;dinger equation; Han, Jentzen, &amp; E, 2018 &#8212; deep learning for high-dimensional PDEs.</em></p></li><li><p><strong>Finance.</strong> Black-Scholes and related option pricing PDEs, especially in high dimensions where grid-based methods suffer the curse of dimensionality. <em>Dhiman &amp; Hu, 2023 &#8212; PINNs for European and American option pricing.</em></p></li><li><p><strong>Climate and environmental modeling.</strong> Pollutant dispersion, atmospheric dynamics, ocean currents. <em>Kashinath et al., 2021 &#8212; physics-informed ML for weather and climate modeling.</em></p></li></ul><p>The common thread across these domains: PINNs shine when the physics is well-understood but the data is sparse, the geometry is complex, or the problem is high-dimensional enough to make classical solvers expensive. They struggle exactly where the loss landscape becomes pathological &#8212; stiff regimes, sharp gradients, multi-scale dynamics. Knowing which side of that line your problem sits on is half the battle.</p><div><hr></div><h2>References</h2><p><strong>Foundations</strong></p><ul><li><p>Raissi, M., Perdikaris, P., &amp; Karniadakis, G. E. (2019). <em>Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations.</em> Journal of Computational Physics, 378, 686&#8211;707. arXiv:1711.10561 &#8212; <a href="https://arxiv.org/abs/1711.10561">https://arxiv.org/abs/1711.10561</a></p></li></ul><p><strong>Training pathologies</strong></p><ul><li><p>Wang, S., Teng, Y., &amp; Perdikaris, P. (2021). <em>Understanding and mitigating gradient flow pathologies in physics-informed neural networks.</em> SIAM Journal on Scientific Computing. arXiv:2001.04536 &#8212; <a href="https://arxiv.org/abs/2001.04536">https://arxiv.org/abs/2001.04536</a></p></li><li><p>Wang, S., Yu, X., &amp; Perdikaris, P. (2022). <em>When and why PINNs fail to train: A neural tangent kernel perspective.</em> Journal of Computational Physics. arXiv:2007.14527 &#8212; <a href="https://arxiv.org/abs/2007.14527">https://arxiv.org/abs/2007.14527</a></p></li><li><p>Krishnapriyan, A. S., Gholami, A., Zhe, S., Kirby, R. M., &amp; Mahoney, M. W. (2021). <em>Characterizing possible failure modes in physics-informed neural networks.</em> NeurIPS 2021. arXiv:2109.01050 &#8212; <a href="https://arxiv.org/abs/2109.01050">https://arxiv.org/abs/2109.01050</a></p></li></ul><p><strong>Adaptive methods and fixes</strong></p><ul><li><p>McClenny, L. D., &amp; Braga-Neto, U. M. (2023). <em>Self-adaptive physics-informed neural networks.</em> Journal of Computational Physics. arXiv:2009.04544 &#8212; <a href="https://arxiv.org/abs/2009.04544">https://arxiv.org/abs/2009.04544</a></p></li><li><p>Wang, S., Sankaran, S., &amp; Perdikaris, P. (2024). <em>Respecting causality is all you need for training physics-informed neural networks.</em> arXiv:2203.07404 &#8212; <a href="https://arxiv.org/abs/2203.07404">https://arxiv.org/abs/2203.07404</a></p></li></ul><p><strong>Comprehensive overview</strong></p><ul><li><p>Cuomo, S., Di Cola, V. S., Giampaolo, F., et al. (2022). <em>Scientific Machine Learning Through Physics-Informed Neural Networks: Where we are and What&#8217;s Next.</em> Journal of Scientific Computing. arXiv:2201.05624 &#8212; <a href="https://arxiv.org/abs/2201.05624">https://arxiv.org/abs/2201.05624</a></p></li></ul><p><strong>Applications by domain</strong></p><ul><li><p>Cai, S., Mao, Z., Wang, Z., Yin, M., &amp; Karniadakis, G. E. (2021). <em>Physics-informed neural networks (PINNs) for fluid mechanics: A review.</em> Acta Mechanica Sinica. arXiv:2105.09506 &#8212; <a href="https://arxiv.org/abs/2105.09506">https://arxiv.org/abs/2105.09506</a></p></li><li><p>Haghighat, E., Raissi, M., Moure, A., Gomez, H., &amp; Juanes, R. (2021). <em>A physics-informed deep learning framework for inversion and surrogate modeling in solid mechanics.</em> Computer Methods in Applied Mechanics and Engineering. arXiv:2003.02751 &#8212; <a href="https://arxiv.org/abs/2003.02751">https://arxiv.org/abs/2003.02751</a></p></li><li><p>Chen, Y., Lu, L., Karniadakis, G. E., &amp; Dal Negro, L. (2020). <em>Physics-informed neural networks for inverse problems in nano-optics and metamaterials.</em> Optics Express, 28(8), 11618&#8211;11633. &#8212; <a href="https://doi.org/10.1364/OE.384875">https://doi.org/10.1364/OE.384875</a></p></li><li><p>Tartakovsky, A. M., Marrero, C. O., Perdikaris, P., Tartakovsky, G. D., &amp; Barajas-Solano, D. (2020). <em>Physics-informed deep neural networks for learning parameters and constitutive relationships in subsurface flow problems.</em> Water Resources Research. arXiv:1912.02968 &#8212; <a href="https://arxiv.org/abs/1912.02968">https://arxiv.org/abs/1912.02968</a></p></li><li><p>Sahli Costabal, F., Yang, Y., Perdikaris, P., Hurtado, D. E., &amp; Kuhl, E. (2020). <em>Physics-informed neural networks for cardiac activation mapping.</em> Frontiers in Physics. &#8212; <a href="https://doi.org/10.3389/fphy.2020.00042">https://doi.org/10.3389/fphy.2020.00042</a></p></li><li><p>Kissas, G., Yang, Y., Hwuang, E., Witschey, W. R., Detre, J. A., &amp; Perdikaris, P. (2020). <em>Machine learning in cardiovascular flows modeling: Predicting arterial blood pressure from non-invasive 4D flow MRI data using physics-informed neural networks.</em> Computer Methods in Applied Mechanics and Engineering. &#8212; <a href="https://doi.org/10.1016/j.cma.2019.112623">https://doi.org/10.1016/j.cma.2019.112623</a></p></li><li><p>Pfau, D., Spencer, J. S., Matthews, A. G. de G., &amp; Foulkes, W. M. C. (2020). <em>Ab initio solution of the many-electron Schr&#246;dinger equation with deep neural networks.</em> Physical Review Research. arXiv:1909.02487 &#8212; <a href="https://arxiv.org/abs/1909.02487">https://arxiv.org/abs/1909.02487</a></p></li><li><p>Han, J., Jentzen, A., &amp; E, W. (2018). <em>Solving high-dimensional partial differential equations using deep learning.</em> Proceedings of the National Academy of Sciences, 115(34), 8505&#8211;8510. &#8212; <a href="https://doi.org/10.1073/pnas.1718942115">https://doi.org/10.1073/pnas.1718942115</a></p></li><li><p>Dhiman, A., &amp; Hu, Y. (2023). <em>Physics Informed Neural Network for Option Pricing.</em> arXiv:2312.06711 &#8212; <a href="https://arxiv.org/abs/2312.06711">https://arxiv.org/abs/2312.06711</a></p></li><li><p>Kashinath, K., et al. (2021). <em>Physics-informed machine learning: case studies for weather and climate modelling.</em> Philosophical Transactions of the Royal Society A. &#8212; <a href="https://doi.org/10.1098/rsta.2020.0093">https://doi.org/10.1098/rsta.2020.0093</a></p></li></ul>]]></content:encoded></item></channel></rss>