An English coreference model that scores links between tokens in a context and tokens in a following text chunk. It uses DistilBERT with a bilinear affinity head. The output is a context-token × chunk-token matrix of link probabilities; an optional decoder converts these scores into span relations.
Code can be found at github: https://github.com/mhaugestad/cross-boundary-coref
With the cross_boundary_coref package installed from the accompanying source:
from cross_boundary_coref import AffinityModel, RectangleDecoder, plot_affinity
model = AffinityModel.from_pretrained("mhaugestad/cross-boundary-coref")
result = model.predict_affinity("Marie Curie discovered radium.", "She later won a Nobel Prize.")
print(result.affinity.shape)
=> (9,7)
print(type(result.affinity))
=> <class 'numpy.ndarray'>
print(RectangleDecoder().decode(result))
=> [
RelationRectangle(
context=TokenSpan(start=0, end=4),
chunk=TokenSpan(start=0, end=1),
confidence=0.9988625347614288,
component_size=4
)
]
plot_affinity(result)
model.resolve_chunk(context="Marie Curie discovered radium.", chunk="She later won a Nobel Prize.")
=> She[Marie Curie] later won a Nobel Prize.
Test-set results show exact relation F1 / median latency per example (ms). All systems were evaluated on the same examples using pair-based scoring and one predicted antecedent per anaphor.
| Model | GAP (1,524) | LitBank (601) | OntoNotes (8,055) |
|---|---|---|---|
| Cross-boundary coreference | 0.4431 / 17.3 | 0.2272 / 17.6 | 0.3651 / 16.7 |
| F-coref | 0.3869 / 27.4 | 0.2591 / 28.7 | 0.4680 / 25.9 |
| LingMess | 0.4188 / 592.6 | 0.2718 / 595.4 | 0.4876 / 595.9 |
Latency was measured on an Apple M1 with 16 GB RAM, batch size 1 and float32 precision. Neural models used MPS; heuristics used CPU. Times include tokenization and post-processing, but exclude loading and one warm-up example. These are not standard end-to-end coreference benchmark scores.
The model was trained on a mixture of rule-based, synthetic, annotated, GAP, LitBank, and OntoNotes data. It may make incorrect links or miss links, and long inputs are truncated to the tokenizer's maximum length. OntoNotes evaluation includes two examples with text also present in training. GAP document overlap is unknown, and other training sources have not been fully audited for overlap.