Coreference Resolution › Candidate Generation and Search Cost

Michael BrenndoerferNovember 17, 20265 min read
Language AI HandbookAll chapters
Part 9 of 67Coreference, Discourse, Pragmatics, and Dialogue
Chapter 56Coreference Resolution › Candidate Generation and Search Cost
Reading section 4 of 14 · Candidate Generation and Search Cost · 5 minSection 4 of 14 · 5 min

Section 4 of 14 · 5 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

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 TT tokens. Set WW to the smaller of the proposed positive width cap and TT. The number of contiguous spans of width at most WW, before any other restrictions, is

Nspans(T,W)=∑w=1W(T−w+1)=WT−W(W−1)2.N_{\text{spans}}(T, W) = \sum_{w=1}^{W} (T - w + 1) = WT - \frac{W(W-1)}{2}.

For T=35T = 35 and W=10W = 10 this is 350−45=305350 - 45 = 305 spans. For T=1000T = 1000 it is 9,9559{,}955. The count is linear in document length once WW is fixed, which is the reassuring part. The width cap excludes any mention longer than WW tokens. A long outer name can fall outside the cap while a shorter name nested inside it remains a candidate.

A span of width ww can start at any of T−w+1T - w + 1 positions. Summing over widths gives the total. Wider spans have fewer possible starts, which accounts for the subtraction term. For a fixed cap WW, doubling a long document roughly doubles the number of spans before pruning.

For exhaustive scoring, order the MM 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.

(M2)=M(M−1)2.\binom{M}{2} = \frac{M(M-1)}{2}.

With M=9,955M = 9{,}955, there are about 4.95×1074.95 \times 10^7 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 [gm;ga;gm∘ga][\mathbf{g}_m; \mathbf{g}_a; \mathbf{g}_m \circ \mathbf{g}_a] has 3,000 entries, so materializing the complete pair tensor would store about 4.95×107×3,000≈1.49×10114.95 \times 10^7 \times 3{,}000 \approx 1.49 \times 10^{11} 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 Mmax⁡M_{\max} 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 KK 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 (m,a)(m, a) pairs.

With mm retained spans in order, the number of non-null fine scores is at most ∑i=0m−1min⁡(i,K)\sum_{i=0}^{m-1}\min(i,K). A coarse scorer that looks at all retained pairs can still evaluate m(m−1)/2m(m-1)/2 pairs. At Mmax⁡=K=250M_{\max}=K=250, 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 O(WT)O(WT).

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 ϵ\epsilon 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!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy