Coreference Resolution › Candidate Generation and Search Cost
Language AI HandbookAll chapters Let us be concrete about why this task is expensive, because the arithmetic explains most architectural choices in the literature.
A resolver cannot score every possible pair of spans in a long document. The number of spans grows linearly with document length once a maximum width is fixed, but the number of span pairs grows quadratically. That quadratic is the central engineering constraint. Every pruning trick in the literature is a way of avoiding a part of it, and every pruning trick introduces a new way to lose the correct answer before the expensive scorer ever sees it.
Enumerating Spans
Take a document of tokens. Set to the smaller of the proposed positive width cap and . The number of contiguous spans of width at most , before any other restrictions, is
For and this is spans. For it is . The count is linear in document length once is fixed, which is the reassuring part. The width cap excludes any mention longer than tokens. A long outer name can fall outside the cap while a shorter name nested inside it remains a candidate.
A span of width can start at any of positions. Summing over widths gives the total. Wider spans have fewer possible starts, which accounts for the subtraction term. For a fixed cap , doubling a long document roughly doubles the number of spans before pruning.
The Antecedent Search
For exhaustive scoring, order the candidates and allow each mention to consider every earlier one. Each distinct pair supplies one candidate, with the earlier mention as a possible antecedent of the later mention.
With , there are about candidate links. A simple scorer can concatenate two span vectors and their elementwise product. At 1,000 entries per span vector, the concatenated pair feature has 3,000 entries, so materializing the complete pair tensor would store about floats before scoring. Streaming or limiting candidate links avoids materializing that tensor.
When an implementation materializes a feature vector for every pair, the allocation scales with the number of pairs times the feature dimension. That tensor can exceed the size of the encoder activations.
Coarse-to-Fine Pruning
Lee et al. (2017) prune both spans and antecedents. Lee et al. (2018) select antecedents with a cheaper bilinear score before applying the higher-cost scorer. The following fixed budgets illustrate the two-stage design.
- Span pruning. Score the width-limited spans and keep at most for the example. The fixed cap here is 250. Lee et al. (2017) set the cap proportional to document length and also suppress crossing spans.
- Antecedent pruning. For each retained span, run a cheap scorer over preceding spans and keep at most candidate antecedents. Lee et al. (2017) instead use a proximity cap of 250 earlier spans, and Lee et al. (2018) use the learned coarse scorer.
- Fine scoring. Run the expensive scorer only on the surviving pairs.
With retained spans in order, the number of non-null fine scores is at most . A coarse scorer that looks at all retained pairs can still evaluate pairs. At , the maximum number of pairs in either pass is 31,125. With both caps fixed, neither pass grows once the span cap is reached. The number of width-limited spans proposed before pruning still grows as .
The two-stage design is a bet that a cheap scorer can preserve the right candidates often enough for the expensive scorer to do useful work. A long-distance pronoun with a weak lexical match may be pruned by the cheap scorer precisely because the cheap scorer lacks the context that makes the link plausible.
What Pruning Costs You
Pruning is not free, and the cost is not visible in the final number.
For an eligible gold anaphor, measure whether any earlier gold antecedent survives pruning. The resulting candidate recall bounds direct correct-antecedent selection from those candidates. If every gold antecedent is missing, the marginal objective can use as its training target. With a fixed null logit, that loss pushes down the surviving nongold logits.
At inference, pruning can remove every gold antecedent for a mention. An antecedent scorer restricted to those candidates can then choose a wrong earlier link or the null option. Checking candidate recall helps isolate that search error. Error analysis that does not separate the two will spend time tuning the scorer to fix a problem that lives in the candidate generator.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!