<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Solomon Owusu-Ansah</title>
    <description>The latest articles on DEV Community by Solomon Owusu-Ansah (@oasolomon).</description>
    <link>https://dev.to/oasolomon</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1720617%2Fa7211cfe-72b5-4c12-a2d1-8230ceccf210.jpg</url>
      <title>DEV Community: Solomon Owusu-Ansah</title>
      <link>https://dev.to/oasolomon</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/oasolomon"/>
    <language>en</language>
    <item>
      <title>Your AI Is Confidently Wrong — and It Can't Even Tell</title>
      <dc:creator>Solomon Owusu-Ansah</dc:creator>
      <pubDate>Fri, 20 Nov 2026 19:16:32 +0000</pubDate>
      <link>https://dev.to/oasolomon/your-ai-is-confidently-wrong-and-it-cant-even-tell-2igc</link>
      <guid>https://dev.to/oasolomon/your-ai-is-confidently-wrong-and-it-cant-even-tell-2igc</guid>
      <description>&lt;p&gt;Train a model to tell cats from dogs. Show it thousands of photos until it gets nearly every one right. Then show it a car.&lt;/p&gt;

&lt;p&gt;It will not hesitate. It will not say "that's not an animal." It will say &lt;strong&gt;"dog, 92% confident"&lt;/strong&gt; — and it will be wrong with a straight face.&lt;/p&gt;

&lt;p&gt;That is not a bug in one model. It is how classifiers work.&lt;/p&gt;

&lt;h2&gt;
  
  
  The forced choice
&lt;/h2&gt;

&lt;p&gt;A normal classifier has no way to say "I don't know." Its final layer, the softmax, turns its raw scores into probabilities that always add up to 1. So whatever you show it — a car, a handwritten digit, a medical scan it was never trained on — it &lt;em&gt;must&lt;/em&gt; hand the win to one of the classes it knows.&lt;/p&gt;

&lt;p&gt;The confidence number it prints looks like self-awareness. It isn't. It only says which known class the input resembles most, not whether the input belongs to any known class at all. Researchers have known this since at least 2017, when Hendrycks and Gimpel showed that a model's top softmax probability is a weak guard against unfamiliar inputs — but it was the first guard anyone had, and it is still the baseline everything else is compared against.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9m4y7xyrfggm9682ld6h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9m4y7xyrfggm9682ld6h.png" alt="Diagram: a car goes into a dog classifier — the softmax must split 100% between cat and dog, so it answers &amp;quot;dog, 92% confident&amp;quot;" width="799" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  So what is OOD detection?
&lt;/h2&gt;

&lt;p&gt;OOD stands for &lt;strong&gt;out-of-distribution&lt;/strong&gt;: data that comes from outside whatever the model was trained on. OOD detection is the guard you bolt on next to the classifier. It does two things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;It scores every input for strangeness.&lt;/strong&gt; A high score means "this looks familiar." A low score means "this looks strange."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It draws a line — a threshold.&lt;/strong&gt; Score below the line, and the system flags the input instead of trusting the prediction.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That is the whole idea. Everything else in the field is a debate about what the score should be, and where the line should go.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsydhcmnalr9bnlvag1og.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsydhcmnalr9bnlvag1og.png" alt="Infographic: in-distribution (a dog), near-OOD (a wolf — looks like a dog but isn't), and far-OOD (a handwritten digit)" width="800" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Near vs far: the case that actually matters
&lt;/h2&gt;

&lt;p&gt;Not all strange inputs are equally strange.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Far-OOD&lt;/strong&gt; is obvious: a handwritten digit shown to a dog classifier. The features look nothing like the training data, so almost any score catches it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Near-OOD&lt;/strong&gt; is the hard one: a wolf shown to a dog classifier. It shares fur, ears, a snout — most of the features overlap. The model is at its most confident exactly where it should be most careful.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Far-OOD is a solved-ish problem. Near-OOD is where the field still struggles, and it is the case that shows up in real deployments — a new disease variant, a road sign in a different country, a product photo taken in different light.&lt;/p&gt;

&lt;h2&gt;
  
  
  The scores, in plain English
&lt;/h2&gt;

&lt;p&gt;If you read OOD papers, four families of scores come up again and again:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;MSP — maximum softmax probability.&lt;/strong&gt; Just take the model's top confidence. Simple, free, and the baseline from Hendrycks and Gimpel (2017). Weak, but everything is measured against it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Energy.&lt;/strong&gt; Built from the model's raw logits instead of the normalised probabilities (Liu et al., 2020). It separates familiar from strange more cleanly than MSP, and costs nothing extra to compute.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feature distance.&lt;/strong&gt; Ignore the final answer and look at where the input lands inside the network. How far is it from the training examples — measured with a Mahalanobis distance, or by its nearest neighbours (kNN)? If it sits far from everything the model has seen, flag it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ViM — virtual-logit matching.&lt;/strong&gt; Part feature distance, part residual: it measures the part of the input's features that the classifier's own directions can't explain (Wang et al., 2022). The unexplained leftover is the signal.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmkrl0aco49xa4so5jpui.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmkrl0aco49xa4so5jpui.png" alt="Figure 1 from Liu et al., &amp;quot;Energy-Based Out-of-Distribution Detection&amp;quot; (NeurIPS 2020): the network's output goes through an energy function, and the energy score separates familiar from strange inputs around a threshold" width="800" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv6mw8voxv6lokwnignm3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv6mw8voxv6lokwnignm3.png" alt="Diagram: ViM splits a feature into the part training explains (principal space) and the leftover residual — the residual, scaled, becomes a virtual &amp;quot;OOD&amp;quot; logit" width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;None of these retrains the model. They all read a frozen model and ask, in different ways, &lt;em&gt;does this input belong here?&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you know if a score is any good?
&lt;/h2&gt;

&lt;p&gt;Two numbers do most of the work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AUROC&lt;/strong&gt; — how well the score separates familiar inputs from strange ones. 50% means it is guessing; 100% means perfect separation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FPR95&lt;/strong&gt; — when you catch 95% of the strange inputs, what fraction of normal inputs do you wrongly flag? Lower is better. This is the number that hurts in practice, because every false flag is a real input you refused to answer.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxo7g94szqx2i5qlbj496.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxo7g94szqx2i5qlbj496.png" alt="Infographic: two score distributions — familiar inputs score high, strange inputs score low — with a threshold line between them" width="799" height="284"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it matters
&lt;/h2&gt;

&lt;p&gt;A wrong answer is not always a harmless answer. A medical model that confidently misreads a scan from a new hospital, a self-driving system that confidently misreads an unfamiliar road sign, a moderation filter that confidently passes something it has never seen — in all of these, the cost of a confident mistake is far higher than the cost of saying "not sure, ask a human."&lt;/p&gt;

&lt;p&gt;OOD detection is not about making models smarter. It is about making them honest.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it doesn't solve — yet
&lt;/h2&gt;

&lt;p&gt;Being honest about the limits is part of understanding the idea:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Near-OOD is still hard.&lt;/strong&gt; The best scores separate far-OOD almost perfectly and near-OOD only partially.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The threshold needs real data to set.&lt;/strong&gt; Pick it on the wrong data and you either flag everything or nothing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No single score wins everywhere.&lt;/strong&gt; A score that is best on one dataset and model can be mediocre on another. That is why the field benchmarks so many of them side by side.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>machinelearning</category>
      <category>ai</category>
      <category>deeplearning</category>
    </item>
  </channel>
</rss>
