Recalibrating a Typed-Decision Model in an Afternoon: A Hands-On Recipe for Laya's Confidence Scores

Mohammed Nayeem Khan, Aliyas Ahmad MisriarXiv 2026

TL;DR

This paper introduces a practical, 130-line numpy recipe to recalibrate confidence scores for "typed-decision" models like Laya. The authors reveal the "pooling trap"—where global calibration metrics hide massive per-bucket errors—and demonstrate that simple per-bucket temperature scaling can drastically improve decision-making reliability with as few as 10 labeled examples.

What Problem Does This Paper Address?

Machine learning models often provide a "confidence score" alongside their predictions. In production, we use these scores to decide whether to trust the model's answer or escalate to a human. However, these scores are frequently "uncalibrated"—a model might claim 95% confidence but only be right 70% of the time.

The authors focus on "typed-decision" models, which handle various tasks (classification, scoring, yes/no) with different numbers of options. They identify a critical issue called the pooling trap: when you measure calibration across all tasks at once, a bucket of over-confident predictions can cancel out a bucket of under-confident ones. This makes the model look better calibrated than it actually is, leading to silent failures in production decision gates.

Methods

The paper provides a "hands-on recipe" consisting of five steps:

  1. Measure: Calculate reliability plots and Expected Calibration Error (ECE) both globally and per-bucket.
  2. Diagnose: Identify which buckets are over- or under-confident compared to a "chance floor" (the noise level expected from finite samples).
  3. Fit: Apply calibration maps. The primary method is per-bucket temperature scaling, which adjusts the "sharpness" of the probability distribution using a single parameter. They also compare this to more complex methods like Platt scaling, histogram binning, and isotonic regression.
  4. Validate: Use cross-fitting (fitting on some folds, testing on others) to ensure the calibration generalizes.
  5. Deploy: Set thresholds for abstention based on target error rates or cost models.
Figure 1. The five-step recipe. Each step produces a concrete artefact that the next step consumes; if step 4 fails, return to step 3 (another

Datasets

The study uses a pool of 1,065 synthetic items across seven diverse evaluation sets, including sentiment analysis, hardware triage, and multilingual tasks. Because these are synthetic, the "ground truth" labels were generated by one LLM (Qwen3.8-27B) and cross-verified by another (Gemma4-31b). The recipe was tested across 33 different model checkpoints to ensure its broad applicability.

Key Insights and Ideas

  • The Pooling Trap is Real: A global ECE of 0.073 looked acceptable, but the "bucket-macro" ECE was nearly double at 0.143. For instance, questions with 11+ options were wildly over-confident (+0.22 gap), while those with 3-5 options were under-confident (-0.05).
  • Temperature Scaling is Data-Efficient: You don't need thousands of labels. Temperature scaling reaches near-optimal performance with just 10 labeled items per bucket.
  • Separation over Sophistication: Most of the performance gain in production gates comes from simply treating different buckets separately. A per-bucket cut-off on uncalibrated scores often performs nearly as well as a single cut-off on calibrated scores.
  • Beware of Runtime Clamps: The authors found that Laya's runtime environment clamps stored temperatures (e.g., between 0.5 and 5.0). If your calibration math doesn't account for these boundaries, your "fix" might not work as intended in production.

Key Results

  • Calibration Improvement: Per-bucket temperature scaling slashed the macro-ECE from 0.143 down to 0.073.
  • Massive Coverage Gains: Imagine you want a maximum 10% error rate. Using the original global confidence scores, you could only safely answer 6.9% of incoming queries. After per-bucket recalibration, that number jumps to 46.3%—a nearly 7x increase in automated throughput for the same risk level.
  • Method Comparison: While temperature scaling is best for small data, Platt scaling overtakes it once you have more than ~40 labeled items per bucket, offering even lower calibration error.
Figure 4. Reliability diagrams of the base checkpoint, pooled (left) and per bucket. Bars: accuracy in each confidence bin; red ticks: the gap

Limitations and Future Work

The authors acknowledge several caveats:

  • Synthetic Labels: The "accuracy" measured is actually agreement with an LLM teacher. Real-world performance may differ if human labels are noisier or follow different patterns.
  • Top-Label Only: The recipe only calibrates the probability of the most likely option, not the entire probability vector.
  • Distribution Shift: Calibration is a property of the data it was fitted on. The paper shows that significant text perturbations (like all-caps or heavy typos) can degrade calibration, requiring a refit.

Future work could involve extending this to full-distribution calibration or exploring how these per-bucket techniques apply to larger, autoregressive LLMs.

Summary updated

Abstract

A typed-decision model such as Laya reads a text and a list of options that the caller defines, for example ticket categories, and returns a probability for each option. Code around it compares the top probability with a threshold to answer, abstain or escalate to a person. Earlier work reports, for a Turkish model, that temperature scaling can raise held-out calibration error (ECE). This tutorial gives a five-step recipe (measure, diagnose, fit, validate, deploy) in 130 lines of numpy with standard methods, none new. On 1,065 synthetic, LLM-labelled items the released Laya checkpoint has a pooled ECE of 0.073 but a bucket-macro ECE of 0.143 (0.127-0.184), the mean over buckets (questions grouped by type and option count): the 12-option bucket is over-confident by +0.22, the three-to-five-option bucket under-confident by 0.05, and they cancel. One global temperature makes pooled ECE worse (0.173); a cross-fitted temperature per bucket brings macro-ECE to 0.073 (0.078 over 10 fold assignments) and reaches 0.089 with 10 labelled items per bucket, but holding out one of seven evaluation sets gives 0.099. After the refit, a gate aimed at 10% error answers 46.3% of items (10.5% wrong) against 6.9% on the published confidences, but one cut-off per bucket on the published confidences answers 45.4%, so most of the gain comes from separating buckets. Confidence-only maps (Platt, histogram, isotonic) need 20 or more labelled items per bucket to approach the temperature; with 320 per bucket the lowest macro-ECE belongs to Platt. In these files the retrained checkpoints store no per-bucket table and the stored 12-option value 0.1006 is clamped to 0.5 at runtime; the refit helps 31 of 33 checkpoints on random folds and 21 with a set held out. Fit and test share one generator and LLM labels, so these are findings about these checkpoints and this data.
BibTeX
@misc{khan2026recalibrating,
  author = {Mohammed Nayeem Khan and Aliyas Ahmad Misri},
  title = {{Recalibrating a Typed-Decision Model in an Afternoon: A Hands-On Recipe for Laya's Confidence Scores}},
  year = {2026},
  eprint = {2611.16499},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.16499},
}
Figure