Urgent.News

the world's headlines, one feed

Tech

Confidence Scores in Structured Extraction

Adding confidence: number to a schema is the most popular non-solution in extraction. You will get a number. It will be 0.95. It will be 0.95 when the model is right and when it is wrong, and it will be 0.95 on a blank page. The confidence field is a token sequence The model does have an internal quantity that behaves like a probability — the distribution over the next token. A confidence field…

Confidence scores in structured extraction are a widely accepted yet flawed approach. Regardless of whether the model is right or wrong, the confidence score remains static at 0.95, even when presented with an empty page. This number is not a true indication of the model's belief but rather a token sequence generated based on the distribution of probabilities it was trained on, resulting in high, round, and reassuring values.

Three key aspects reveal the uselessness of confidence fields:

1. Clustering: Histogramming the values often reveals clustering around 0.9, 0.95, and 0.99, indicating the capture of a style rather than genuine belief.

2. Mean score comparison: When the mean score on correctly known records closely matches that on incorrectly known records, the confidence field carries no information.

3. Position sensitivity: Moving the confidence field's position in the output alters the numbers, suggesting a lack of true belief.

The literature provides insight into the nature of confidence scores. Kadavath et al.'s study on Language Models (Mostly) Know What They Know (arXiv:2207.05221, Anthropic, 2022) found that large models can be reasonably calibrated on multiple-choice questions when the probability is derived from the token distribution. However, when asked to evaluate the probability that their own answer is true, the signal is real.

The elicitation method significantly impacts calibration. OpenAI's GPT-4 technical report showed that a pre-trained model is well-calibrated on MMLU, while a post-RLHF model shows reduced calibration.

The models accessed through APIs are post-training ones, and neither result validates trusting a self-reported number in an extraction schema. Instead, three alternative signals are recommended:

1. Token logprobs: Setting logprobs provides the log-probability of each emitted token, particularly useful for fields constrained to an enum. This method ranks the top two labels' margin more informatively than the top probability alone. For free-text fields, using the mean per-token logprob or the minimum across tokens is advised.

2. Self-consistency: Sampling the same extraction multiple times at non-zero temperature and measuring per-field agreement offers an interpretable method without needing logprobs.

3. Verification: Requiring a verbatim source quote and checking its appearance in the input, sum of line items, and date within the contract period provides the strongest and cheapest signals.

When using a trusted score, it should not be surfaced to users for interpretation, as they cannot comprehend its meaning. Instead, use it internally for three purposes:

1. Routing: Re-running the extraction on a larger model below a confidence threshold, determined by calibration tables and the cost of mistakes.

2. Confidence threshold adjustment: If the score fails to meet expectations, lowering the threshold can help.

3. Calibration testing: Do not assume the score is calibrated; test it using a few hundred verified records, comparing the mean score in each bucket to the actual accuracy in that bucket. This expected calibration error helps identify overconfidence or wrong predictions in a specific bucket, enabling adjustments.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written; read the original for the full account.

Read the original at dev.to →

More in Tech

Can You Trust a Model’s Stated Reasoning?

A chain of thought looks like an explanation, and that resemblance is doing a lot of unearned work. The published tests ask a narrower and more answerable question: if you change what actually drove…

  • Chain of thought can be correct yet unfaithful to actual reasoning.
  • Biased training data can alter model predictions independently of explanation.
  • Faithfulness varies by task and isn't guaranteed by model scaling.