Coreference Resolution: Linking Pronouns to Entities
What You'll Learn
- 1Form coreference as clustering of mentions into entities
- 2Score candidate antecedents and marginalize to a cluster
- 3Compute B3 and the averaged CoNLL F1 from per metric numbers
- 4Diagnose when a coreference error versus an entity error hurt the task
Coreference resolution groups every mention that refers to the same entity, so the reader learns that she in sentence two and the engineer in sentence five are one person. Downstream tasks depend on it: summarization must pick one name, question answering must follow pronouns across sentences, and event extraction must attach arguments the authors never repeated. This lesson builds the span based model that scores antecedents, then the three metrics that make or break a leaderboard claim.
Mentions and Clusters
A mention is a noun phrase or pronoun that can stand for an entity, and the output of the system is a partition of mentions into clusters:
Single link chains break long documents, so modern systems predict clusters directly or merge mention pairs greedily with a learned scorer. Mention detection itself is a span classification problem: candidate spans up to a fixed width are scored, and the top spans become antecedent candidates.
End-to-End Span Models
Lee et al. (2017) removed gold mentions from the pipeline and scored every candidate span and antecedent pair in one model. A span representation concatenates its boundary states, a width embedding, and an attention over the span's inner tokens:
Given a mention , the model scores all earlier antecedents plus a null option that starts a new cluster:
Marginalizing those conditionals gives the probability that a mention belongs to an antecedent's cluster, and training uses the log of the marginal over all gold antecedents:
| Metric | Scores | Sensitive to | Role |
|---|---|---|---|
| MUC | links between mention pairs | singleton clusters | rewards long chains |
| B3 | per mention cluster overlap | boundary mistakes | balanced precision and recall |
| CEAF_e | best cluster alignment | cluster count | symmetric comparison |
| CoNLL F1 | mean of the three | none by design | shared task standard |
Evaluation
No single metric is right. MUC walks chains of links, so it cannot penalize spurious singleton mentions, while B3 scores each mention against its predicted and gold cluster and reacts to every merge. CEAF_e finds the best one-to-one mapping between predicted and gold clusters and scores that alignment, and the CoNLL number is simply the average of the three:
Benchmarks set different difficulty. OntoNotes provides gold clusters over news, web, and conversational speech and defines the standard test, ACE 2005 adds broadcast and newswire with entity and event structure, and the WinoGrande set holds 44,390 pronoun problems built with adversarial filtering so surface heuristics fail, following the 285 problem Winograd Schema Challenge.
Worked Examples
Worked Code
"""Span scores, antecedent softmax, and cluster marginalization."""
import torch
import torch.nn.functional as F
def antecedent_probs(pair_scores, null_score):
logits = torch.tensor(list(pair_scores) + [null_score], dtype=torch.float)
return F.softmax(logits, dim=-1)
probs = antecedent_probs([3.0, 2.0], -1.0)
print("link probabilities", probs.round(3).tolist())
print("most likely antecedent", int(probs[:-1].argmax().item()))
"""B3 and CoNLL F1 over predicted and gold clusters."""
def b3(pred, gold):
scores = []
for mention in [m for cluster in gold for m in cluster]:
pc = next(c for c in pred if mention in c)
gc = next(c for c in gold if mention in c)
overlap = len(set(pc) & set(gc))
precision = overlap / len(pc)
recall = overlap / len(gc)
scores.append(2 * precision * recall / (precision + recall)
if precision + recall else 0.0)
return sum(scores) / len(scores)
def conll(muc, b3f1, ceaf):
return round((muc + b3f1 + ceaf) / 3, 2)
pred = [["a", "b", "d"], ["c"], ["e"]]
gold = [["a", "b", "c"], ["d"], ["e"]]
print("B3", round(b3(pred, gold), 3), "CoNLL", conll(78.4, 81.2, 76.5))
Real-World Applications
- Summarization - A model that cannot merge aliases repeats the same person under three names in one paragraph.
- Question answering - Pronoun questions fail when the reader cannot chain she back two sentences to the right entity.
- Event extraction - Arguments are often pronouns, so coreference decides who did what.
- Compliance review - Contract analysis links defined terms to later pronouns to trace obligations.
đĄReport all three metrics
Common Mistakes
Quoting CoNLL F1 without components
Fix: Publish MUC, B3, and CEAF_e separately, since over merging and under merging move them differently.
Evaluating with gold mentions only
Fix: Report the end to end setting too, because mention detection errors disappear under gold mentions.
Tuning thresholds on the test documents
Fix: Select the antecedent threshold on dev documents, since cluster sizes shift it quickly.
Best Practices
- Score both the gold mention and the end to end settings
- Keep mention width and max antecedents fixed across comparisons
- Inspect cluster errors on long documents, where chains break most often
Key Takeaways
- End to end models score spans and antecedents jointly, with a null option that opens a new cluster
- Marginalizing antecedent conditionals gives the cluster membership probability used in training
- MUC ignores singletons, B3 scores per mention, and CEAF_e aligns clusters, so CoNLL averages all three
- Coreference sits under summarization, QA, and events, so its errors multiply downstream
Frequently Asked Questions
Why average three metrics instead of picking one?
Because each is blind somewhere. MUC cannot see singletons, B3 cannot see cluster ordering, CEAF_e depends on the matching, and the average keeps a system from gaming the blind spot.
How does the null option matter?
It is how a mention starts a new cluster. If null mass is always tiny, the model over merges, which inflates MUC while dragging CEAF_e and B3 precision down.
Is coreference solved?
On OntoNotes news text with gold mentions, scores are high. On conversational speech, multiple speakers, and implicit mentions, error rates stay large enough to hurt downstream tasks.
Interview Questions
Q1: Explain how an end-to-end coreference model avoids gold mentions.
It enumerates every span up to a width limit, scores each as a mention, scores all earlier antecedents plus a null option, and marginalizes to cluster probabilities, so detection and linking are trained jointly.
Q2: Your CoNLL F1 rose but B3 precision fell. What happened?
You are probably over merging, which extends chains that MUC rewards while B3 precision drops because predicted clusters grew to include wrong mentions.