CLAUDE LABJP
SANDBOX — Claude Code adds a sandbox.credentials setting that blocks sandboxed commands from reading credential files and secret environment variablesMODEL — Org-configured model restrictions now apply across the model picker, --model, /model, and ANTHROPIC_MODELAGENTS — Sessions that edit, merge, comment on, or push to an existing PR now link to that PR in the claude agents viewFIX — Fixed --json-schema silently producing unstructured output on an invalid schema, plus messages lost at the --max-turns limitRECAP — Claude adds a monthly recap and focus settings in beta, with break reminders, quiet hours, and work insightsOPUS — Claude Opus 4.7 is now generally available with stronger long-running coding tasks and higher-resolution visionSANDBOX — Claude Code adds a sandbox.credentials setting that blocks sandboxed commands from reading credential files and secret environment variablesMODEL — Org-configured model restrictions now apply across the model picker, --model, /model, and ANTHROPIC_MODELAGENTS — Sessions that edit, merge, comment on, or push to an existing PR now link to that PR in the claude agents viewFIX — Fixed --json-schema silently producing unstructured output on an invalid schema, plus messages lost at the --max-turns limitRECAP — Claude adds a monthly recap and focus settings in beta, with break reminders, quiet hours, and work insightsOPUS — Claude Opus 4.7 is now generally available with stronger long-running coding tasks and higher-resolution vision
Articles/API & SDK
API & SDK/2026-07-10Advanced

Don't Trust the Confidence Score: Per-Class Calibration and Abstain Routing for Vision Classification

Overall accuracy looked fine while individual categories quietly collapsed. Here is how I calibrated Claude Vision's self-reported confidence per class and routed abstentions to a human queue.

Claude API110Vision2ClassificationEvaluationIndie Dev19

Premium Article

I was staring at a spreadsheet of classification results when I stopped scrolling. Overall agreement read 92.3%. But when I filtered down to the "animal" category alone, it was 71% — and the model had returned confidence values around 0.9 on most of that wrong 29%.

Confidently wrong. That turned out to be the worst failure mode of all.

For the wallpaper app I run as an indie developer, newly added images are sorted into 30 categories by Claude Vision. I wrote about the initial setup in automating wallpaper category classification with the Claude Vision API. What emerged after months of actually running it was this pattern: the aggregate looks healthy while a handful of classes rot underneath.

This article is the cleanup. It covers calibrating confidence per class and routing everything below the line into a human review queue.

"Confidence: 0.9" Is Not a Probability

Let's get the premise straight. When you ask for structured output containing confidence: 0.92, that number is not a probability. It is a plausible-looking number the model generated as text.

NameWhat it actually isUsable as a probability?
Self-reported confidenceA number the model wrote as a stringNot as-is
Logprob-derived probabilityToken generation probabilityApproximately, after calibration
Calibrated scoreMapped to empirical accuracy on a validation setYes

That does not make it useless. Self-reported confidence is usually meaningful as an ordering. A prediction at 0.95 is more likely correct than one at 0.65. What fails is the reading "0.9 means 90% correct."

So trust only the ordering, and measure from a validation set where the line has to be drawn to hit your precision target. That is what calibration means in practice.

Is 400 Images Enough?

I relabeled 412 images by hand. The eight most frequent of the 30 categories account for just over half of them; tail categories like "retro" and "minimal" have only five to nine each.

Which raised an honest question: can a threshold learned from six images mean anything?

My answer is that it can, but you have to change how you pick it. For thin classes, fine-grained optimization just overfits the validation set. So I split the classes into two tiers by support.

TierValidation imagesHow the threshold is chosenCategories
Thick20 or moreSearched individually11
ThinFewer than 20Share one conservative threshold (0.93)19

Thin classes are poor candidates for auto-acceptance anyway. Give them a conservative shared line and send the rest to a human. That is enough.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Self-reported confidence used with a single global threshold silently breaks your smallest classes
How to search for the lowest threshold that still meets a precision target, per class, with working code
Routing abstentions into a prioritized human queue, and catching calibration drift week over week
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

API & SDK2026-05-15
Automating Wallpaper Classification with Claude Vision API — Real Lessons from a 50M Download App
A firsthand account of automating wallpaper category classification using Claude Vision API in production. Honest results on accuracy, costs, and pitfalls encountered.
API & SDK2026-05-12
I Ran 1,000 App Store Reviews Through Claude API — Here's What My Data Was Hiding
Lessons from 10+ years of indie app development and 50M+ downloads: how to use Claude API to batch-analyze App Store reviews, auto-generate improvement priorities, and fix the blind spots human reading creates.
API & SDK2026-04-26
Building a Hard-to-Cancel Micro-SaaS with the Claude API — Six Implementation Patterns to Stabilize $1,000/Month
Hitting $1,000/month with a Claude-powered micro-SaaS is one challenge. Holding it for three months running is a much harder one. Here are six implementation patterns — with working Stripe and Cloudflare Workers code — that took my churn from above 10% to under 5%.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →