Dissecting AI
From the paper: Calibrated Typed Decisions for Entity, Relation, and Event Extraction

Calibrated Null-Probability Decoding

Typed extraction needs a threshold that respects overlapping labels and confidence distorted by down-weighted negatives; separate the any-type decision from type selection, then correct and calibrate the null score.

Read the paper ↗
The short version

What it is

  • Two-stage decision First decide whether a candidate belongs to any requested type; only then choose its most likely type.
  • Null-score correction If training gives null examples less weight, add a correction to the null score so its confidence is less biased.
  • Calibration Fit probability sharpness and the extraction cutoff on held-out calibration data, rather than treating one cutoff as universal.

Why it matters

Overlapping labels can split evidence across several plausible types, and down-weighted null examples can distort confidence. Separating the accept/reject decision from type selection handles the first problem; correcting and calibrating the null score addresses the second.

Before we get into the mechanics, here is the short version: the extractor should ask whether a span or relation belongs to any requested type before deciding which type it is. Then it can correct the model’s null confidence if training gave null examples less weight, and tune the probability scale and cutoff on calibration data. That matters when labels overlap and when a score is being used as a confidence, not just a ranking.

  1. Overlapping labels: the canonical example is a span that could be both a broad entity type and one of its finer subtypes. Evidence may be shared between those labels, so the strongest individual label can look weak even though the span is a plausible match. The analogy is a vote split between two compatible descriptions; unlike a literal vote, these probabilities are constrained by the model’s class distribution.

  2. A distorted null score: training can put less loss weight on null candidates. Think of a notebook where you deliberately record fewer “nothing here” cases: the model can learn to report too little null confidence. This is analogous to down-sampling negatives, though the correction here is applied to the null logit rather than to the input data.

  3. Two calibration knobs: temperature adjusts how sharp or cautious the probabilities are; the threshold controls how much evidence is needed to emit a candidate. They do different jobs, so fitting one does not automatically settle the other.

So why not threshold the probability of the chosen type? For the broad-plus-fine span, the model’s evidence can be split across both types. The useful question is whether the span belongs to any queried type, so the gate uses the total non-null probability, 1−p(0)1-p(0). In words, subtract the null probability from one to get the mass assigned to all requested types. If it clears the cutoff, the extractor picks the most likely type. That is the key separation: acceptance first, label second. What if the null score is already biased before that gate is applied?

The next move is a prior correction. In mechanism terms, it raises the null score to compensate for null examples having less influence on the training loss; it does not reshuffle the non-null labels. If null candidates had loss weight ω\omega, add log⁡(1/ω)\log(1/\omega) to the null logit before temperature scaling. In words, a smaller null weight calls for a larger adjustment to the null score. At a fixed temperature this leaves relative odds among the types unchanged, and the correction itself needs no extra data. But correcting a score is not the same as choosing a good operating point, so what should be tuned afterward?

Temperature and threshold are fitted separately. The temperature changes probability sharpness; the threshold decides when total non-null probability is enough to extract. For entities, temperature is selected by multi-class Brier score and the threshold by F1 on calibration splits from training sources. For relations, the described setup keeps temperature at one and fits the threshold on REBEL with gold entities; event predictions reuse entity and relation calibration parameters. I like the conceptual separation here: one knob is about confidence scale, the other about decisions. The reported average expected calibration error drops after correction and refitting, while average F1 changes little—but is that enough to promise every candidate stays the same? No: calibration improves the reported confidence estimates, not a guarantee of identical decisions across all datasets.

Read the deep dive

Why People Wanted It

A typed extractor has two different questions to answer: does this candidate belong to any requested type, and, if so, which type fits best? A single threshold on the winning type’s probability confuses those questions. If a schema contains overlapping labels—a broad type and a more specific one, for example—the model can spread its evidence across both. Neither individual probability need be large even when the total evidence for a non-null label is.

There is a second problem: training can deliberately give null candidates less loss weight. That can make the model’s reported null odds too low, so its confidence no longer matches its decisions. The real question is how to recover a usable accept/reject confidence without changing which non-null type wins.

The Core Move

First threshold the probability of belonging to any non-null type; only after accepting a candidate, choose its most likely type. Correct the null logit for its training weight, then fit a temperature and decision threshold on calibration data.

For candidate cc, let pc(m)p_c(m) be its probability for type mm, including the null class 00. The decision is

1−pc(0)≥τ⇒m^=arg⁡max⁡m∈Kpc(m).1-p_c(0)\geq\tau\quad\Rightarrow\quad \hat m=\arg\max_{m\in\mathcal K}p_c(m).

The threshold asks whether any queried type applies; the argmax selects the type.

Quiz
A candidate has evidence shared across a broad type and a fine-grained type, so neither type alone has a high probability. What should the extraction gate examine?
The sum of all non-null type probabilities, 1 minus the null probability.
The null logit alone, without converting it to a probability.
Only the probability of the single most likely type.

Why the Total Non-Null Probability Is the Right Gate

Here is the part that gets technical: the gate is about total non-null mass, not the confidence of the label that happens to win. Suppose a span plausibly matches both a broad and a fine-grained type. Its probability can be divided between those types, while their combined mass still supports extracting the span. Thresholding only the maximum type probability can reject it for that reason.

The rule uses 1−pc(0)1-p_c(0) as the gate and then uses arg⁡max⁡m∈Kpc(m)\arg\max_{m\in\mathcal K}p_c(m) for the label. In words: test the probability of any queried type first, and let the most probable type break the tie only for candidates that pass. The same decision structure applies to relation candidates; overlapping spans are allowed.

This separates acceptance from classification, but what if the null probability itself has been distorted during training?

Why Down-Weighting Null Candidates Miscalibrates Their Score

Now the version for readers who want more of the machinery: reducing the loss weight of null candidates changes the balance the model learns between null and typed outcomes. The resulting null odds are reported too low, as can happen when negatives are down-sampled. This is a confidence problem, not a reason to reorder the non-null types.

If null candidates receive weight ω\omega, correct the null logit z0z_0 by adding log⁡(1/ω)\log(1/\omega) before temperature scaling:

z0′=z0+log⁡(1/ω).z'_0=z_0+\log(1/\omega).

This raises the null score to compensate for its reduced training-loss weight. Since the same adjustment is made to the null class and does not alter the relative odds among types, the ranking of candidate types is unchanged at a fixed temperature. The correction needs no additional data. But corrected scores still need a decision scale and a cutoff—how should those be chosen?

Why Temperature and Threshold Need Separate Calibration

Here is the deeper calibration detail: temperature changes the sharpness of the class probabilities, while the extraction threshold controls how much non-null probability is enough to emit a candidate. For entities, fit temperature by minimizing multi-class Brier score and choose the threshold to maximize F1 on calibration splits from the training sources. For relations, use temperature T=1T=1 and fit the threshold on REBEL with gold entities. Event predictions reuse entity and relation calibration parameters.

The order matters: add the null correction before dividing logits by temperature. Refit the temperature and threshold after applying the correction. In the reported calibration comparison, average expected calibration error fell from 0.33 to 0.23 for entities, 0.25 to 0.09 for relations, and 0.51 to 0.39 for event arguments, with little change in F1. Those averages show the intended tradeoff: improve confidence estimates while keeping extraction accuracy similar, not guarantee identical predictions everywhere.

Minimal Causal Code

This deliberately exposes the order of operations. logits has null in column zero and one column per queried type.

import math
import torch


def decode(logits, null_weight, temperature, threshold):
    # Restore null score before temperature scaling.
    corrected = logits.clone()
    corrected[..., 0] += math.log(1.0 / null_weight)

    # Calibrate probability sharpness.
    probabilities = torch.softmax(corrected / temperature, dim=-1)

    # Decide whether any queried type applies.
    non_null_probability = 1.0 - probabilities[..., 0]
    accepted = non_null_probability >= threshold

    # Select a type only among candidates that passed the gate.
    predicted_type = probabilities[..., 1:].argmax(dim=-1) + 1
    return accepted, predicted_type

What You Gain, and What You Lose

You gain a decision rule that does not penalize a candidate merely because its non-null evidence is split across overlapping types. The null correction addresses the confidence bias introduced by down-weighting null candidates, and temperature plus threshold fitting makes the gate a calibrated operating point.

You do not get a universal threshold: the temperature and cutoff are fitted using calibration data, and the reported setup uses different fitting choices for entities and relations. The null correction preserves relative type odds at a fixed temperature, but refitting temperature and threshold can change confidence-based acceptance. Calibration improves confidence estimates with little change in average F1 in the reported results; it is not a promise that every dataset or candidate is unchanged.

Quiz
What does adding the null-logit prior correction accomplish at a fixed temperature?
It replaces the need to fit a decision threshold.
It raises the null score to compensate for its reduced training-loss weight, without changing relative type odds.
It raises every type score equally and changes which non-null type ranks first.
Core Takeaway

Ask whether any type applies before asking which type wins—and repair the null score before calibrating confidence.