Relative Rewards for Typed Extraction Decisions
Gaussian perturbations generate alternative typed extraction decisions. Leave-one-out rewards then supply a score-function training gradient alongside label-based supervision.
Read the paper ↗What it is
- Perturbed decisions The model independently jitters a candidate’s type scores several times. Each jittered score vector chooses a type or chooses no extraction.
- Relative reward Correct types receive positive reward, wrong types negative reward, and no extraction zero. Each sample is compared with the other samples for that candidate.
- Learning from the comparison Training makes better-than-peer score samples more likely and worse-than-peer samples less likely. This signal supplements ordinary training on annotated answers.
Why it matters
Small score changes can turn a correct extraction into a wrong type or false positive. Comparing independently sampled alternatives gives training a decision-level signal without a separate model to predict rewards.
The short version is that training tries several nearby versions of the model’s scores and checks which extraction decisions they produce. Better outcomes become more likely, alongside ordinary learning from labels. The important detail is how that comparison reaches the model: not by differentiating through the winning class, but by changing the likelihood of the sampled scores.
-
Competing decisions: Consider the span “Paris,” with choices city, person, and no extraction. If city is its annotated type, a small score change could produce a correct city prediction, an incorrect person prediction, or no extraction. The same setup applies to a span pair choosing a relation type.
-
Decision-level feedback: The city decision receives positive reward, person negative reward, and no extraction zero. Labels still provide the supervised target; rewards additionally distinguish the consequences of sampled choices.
-
A reference without a critic: Each sample is compared with the other samples for that same candidate. No separate model is needed to predict the reference reward. I like the locality of this comparison: “Paris” is judged against its own alternatives, not an unrelated candidate’s difficulty.
Why Score Perturbations Create Competing Decisions
Imagine repeatedly nudging the city, person, and no-extraction scores, then recording the winner. Each attempt needs fresh random nudges; copying one noisy vector several times would only repeat the same experiment. The noise has standard deviation , meaning this knob controls the size of the score changes. It is applied once, not twice.
These nudges are Gaussian: they cluster around the current scores, with independent changes across classes and samples. The highest perturbed score determines the decision. This is not sampling a class from the usual normalized class probabilities. So how do we judge one attempt against another?
Why the Leave-One-Out Baseline Is Relative
For “Paris,” suppose the sampled decisions are city, person, and no extraction. Their rewards are positive, negative, and zero. For each attempt, average the rewards of all the other attempts, then subtract that average from its own reward. This difference is its advantage: better or worse than its peers.
Zero reward does not mean zero advantage. No extraction can be better than wrong types or worse than correct ones. And if every attempt earns the same reward, every advantage is zero. The comparison needs differing outcomes to contribute a signal. But a winning-class operation is not differentiable—how can any of this train the scores?
Why Likelihood and Reward Stay in One Objective
The useful trick is to treat each sampled score vector as a fixed observation, then ask how likely it is under the model’s current Gaussian distribution. A positive advantage tells gradient descent to increase that likelihood; a negative advantage tells it to decrease it. This is a score-function gradient, not a gradient through the discrete winner.
The “fixed observation” part matters. If the sample moves with the model while we differentiate its likelihood, the intended gradient cancels. The implementation therefore stops gradients through both the sample and its advantage.
Likelihood supervision remains alongside this reward term. It can still teach the annotated answer when all sampled rewards happen to tie. The remaining question is practical: do the chosen noise scale and reward weight produce useful alternatives without overwhelming that supervised signal?
Read the deep dive
Why People Wanted It
A typed extraction model chooses among queried types and a null class meaning no extraction. For a span such as “Paris,” nearby score settings might select the correct city type, an incorrect person type, or null. A span pair makes the analogous choice among relation types and no relation.
Likelihood supervision teaches annotated choices. The additional goal here is to strengthen correct decisions against alternatives the model can also produce. So the real question is not just how to score the gold label: how can the consequences of nearby discrete decisions supply a training gradient without a separate critic?
The Core Move
Independently perturb a candidate’s scores, reward the resulting decisions relative to their peers, and use a score-function gradient to make higher-reward score samples more likely.
Let be candidate ’s logits, including null. Draw independent samples with fixed noise scale :
Thus the sampled score vector has distribution . The noise scale is applied once: standard-normal noise multiplied by , not noise already scaled by multiplied again.
Why Score Perturbations Create Competing Decisions
Here is the part that gets technical: the stochastic object is the entire Gaussian score vector, while the extracted class is a deterministic function of that vector.
Write the class set as , where means null and contains the queried types included in the training decision. Types with unknown annotation status are excluded. Candidates ignored because their missing labels are ambiguous must also be excluded from the loss.
For “Paris,” independently perturbing the city, person, and null logits can move the winner across class boundaries. Sampling a categorical distribution from normalized logits would be a different mechanism. Likewise, generating one noise vector and expanding it along a sample dimension would repeat a decision rather than generate independent alternatives.
Given the candidate’s gold class set , assign the decision reward
The null case takes precedence even when . A false-positive type on such a candidate receives negative reward; choosing null receives zero. How can these rewards become a useful comparison rather than isolated scores?
Why the Leave-One-Out Baseline Is Relative
Now the version for readers who want more of the machinery: each sample’s baseline excludes that sample, so it depends on independent peer draws rather than on its own sampled score vector.
Define
For sampled decisions city, person, and null on a gold-city candidate, the rewards are . Their advantages are respectively . These are consequences of the reward rule, not empirical performance measurements.
An advantage is relative, not an additional label. Null can have positive advantage when its peers choose wrong types, or negative advantage when they choose correct types. If every reward agrees, all advantages vanish.
Conditional on the current logits, the peer baseline is independent of sample . Subtracting it does not change the expected score-function gradient because the expected gradient of a normalized distribution’s log density is zero. It supplies a baseline without a learned critic. But neither a reward nor an argmax provides an ordinary differentiable path—where does the actual gradient enter?
Why Likelihood and Reward Stay in One Objective
Here is the final technical step: differentiate the Gaussian log density of each fixed sampled vector, not the discrete winning class and not the path used to generate that vector.
A per-candidate surrogate for minimizing negative expected reward is
Here means keep the value but block differentiation through its computation. For fixed , the Gaussian score is
Consequently,
Under gradient descent, a positive advantage pulls the mean logits toward that sampled vector; a negative advantage pushes them away. This changes the distribution of future decisions without differentiating through argmax. Leaving the sample attached would instead make constant with respect to the mean, cancelling the intended gradient.
Supervised learning remains present. With the normalized class distribution, its candidate loss is
This allows multiple gold types while each sampled decision still selects one class. Let be the candidate’s supervision weight, with null candidates down-weighted. The combined head loss is
Entity and relation losses use this construction, with their respective null weights, and combine as . Likelihood can still contribute when sampled rewards tie. What does this look like with the sampling and gradient boundaries made explicit?
Minimal Causal Code
This is one optimizer update for one extraction head and one instance. model(features) returns logits shaped [C, M]; class zero is null. gold_mask has the same shape and marks all supervised gold classes, including null for null candidates. Unknown type columns and ignored candidates have already been removed. weights contains the supervision weights. Relation and entity head losses can be combined before the same backward pass.
import torch
assert samples > 1 and sigma > 0
optimizer.zero_grad()
logits = model(features) # [C, M]
assert gold_mask.shape == logits.shape
assert gold_mask.dtype == torch.bool
assert gold_mask.any(dim=-1).all()
assert weights.sum() > 0
# Supervision: total probability of all gold classes.
log_p = logits.log_softmax(dim=-1)
label_loss = -torch.logsumexp(
log_p.masked_fill(~gold_mask, -torch.inf), dim=-1
) # [C]
policy = torch.distributions.Normal(logits, sigma)
reward_rows, log_density_rows = [], []
for k in range(samples):
# Fresh independent noise for every sample, candidate, and class.
# Keep the observation fixed when differentiating its log density.
with torch.no_grad():
score_sample = logits + sigma * torch.randn_like(logits)
decision = score_sample.argmax(dim=-1) # [C]
is_gold = gold_mask.gather(
dim=1, index=decision[:, None]
).squeeze(1) # [C]
reward = torch.where(
decision == 0,
torch.zeros_like(decision, dtype=logits.dtype),
torch.where(is_gold, 1.0, -1.0),
)
# Gaussian vector log density, NOT categorical class log probability.
log_density = policy.log_prob(score_sample.detach()).sum(dim=-1)
reward_rows.append(reward)
log_density_rows.append(log_density)
rewards = torch.stack(reward_rows) # [S, C]
log_densities = torch.stack(log_density_rows)
baselines = (rewards.sum(dim=0, keepdim=True) - rewards) / (samples - 1)
advantages = (rewards - baselines).detach()
reward_loss = -(advantages * log_densities).mean(dim=0) # [C]
loss = (weights * (label_loss + rho * reward_loss)).sum() / weights.sum()
loss.backward()
optimizer.step() # Update the score-producing model.
The gather operates separately for each candidate: each row looks up its own sampled class. Fresh noise inside the loop prevents accidental reuse across samples. The detached observations and advantages leave the intended gradient through the Gaussian mean logits into the model.
What You Gain, and What You Lose
You gain a decision-level training signal that distinguishes correct types, incorrect types, and no extraction. The samples themselves provide the reference reward, without a separate critic. Likelihood supervision continues to anchor training to annotated answers.
You pay for repeated sampling and an additional noisy gradient estimate. The perturbation scale controls which alternatives are explored, while the reward weight controls their influence alongside supervision. Identical sampled rewards contribute no relative-reward gradient, even when every sampled decision is wrong.
Null’s zero reward is not a guarantee of neutral training pressure: its advantage depends on its peers. Nor does this objective resolve unknown annotations or replace decoding thresholds and calibration. It supplements supervised extraction rather than making the same objective simply faster or automatically calibrated.
Draw independent Gaussian score samples, compare each decision’s reward with its peers, and use detached advantages to weight Gaussian score-function gradients alongside likelihood supervision.