NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Document-level Entity-based Extraction as Template Generation

Kung-Hsiang Huang, Sam Tang, Nanyun Peng

Abstract

Document-level entity-based extraction (EE) requires identifying entities and their complex relationships across entire documents. Traditional extractive methods, which rely on tagging spans, often fail to capture long-range dependencies and suffer from computational inefficiency when handling N-ary relations. This paper introduces TEMPGEN, a generative framework that reformulates EE as a template generation task. By leveraging a sequence-to-sequence architecture (BART) and a novel TOPK COPY mechanism, TEMPGEN effectively captures inter-entity dependencies and utilizes label semantics. Experimental results on the MUC-4 and SCIREX datasets demonstrate that TEMPGEN achieves new state-of-the-art performance while providing significant inference speedups—up to 39x faster for complex relation extraction.

Introduction

Information extraction from documents is a foundational task in natural language processing. Unlike sentence-level extraction, document-level Entity-based Extraction (EE) must navigate long-range dependencies where related entities are separated by hundreds of tokens. Traditional extractive models typically treat this as a sequence labeling or span prediction task. However, these models face three primary challenges: they struggle to connect distant entities, they ignore the semantic meaning of role labels (e.g., "Victim" vs. "Target"), and they face a "computational explosion" when evaluating all possible combinations for N-ary relations.

Methodology

The proposed framework, TEMPGEN, shifts the paradigm from extraction to generation. Instead of tagging the source text, the model generates a structured template string that explicitly defines roles and their corresponding fillers.

Overview of the TEMPGEN framework illustrating the transition from source text to structured template generation for MUC-4 and SCIREX examples.

The core of TEMPGEN is a BART-based sequence-to-sequence model. By generating the output autoregressively, the model naturally maintains a state of previously extracted information, allowing it to capture dependencies between entities. To improve the accuracy of extracting specific terms from the source text, the authors introduced the TOPK COPY mechanism. Unlike standard copy mechanisms that average attention across all heads—including noisy or irrelevant ones—TOPK COPY ranks attention heads and utilizes only the top-K (specifically $k=10$) most relevant heads to calculate the copy distribution. This denoising step is critical for maintaining high precision in long documents.

Datasets and Experimental Setup

The model was evaluated on two distinct benchmarks:

  1. MUC-4: A classic dataset for Role-filler Entity Extraction (REE) involving news reports about terrorist events.
  2. SCIREX: A challenging dataset of long scientific articles (averaging 5,700 tokens) requiring the extraction of complex binary and 4-ary relations (e.g., linking a Method, Metric, Dataset, and Task together).

Results and Discussion

TEMPGEN established new state-of-the-art (SOTA) benchmarks across all tested categories:

  • MUC-4 (REE): Achieved a 3.26% F1 improvement over the previous best model, GRIT.
  • SCIREX: Showed a 4.8% F1 gain for binary relations and a 2.7% gain for 4-ary relations.
  • Efficiency: Most notably, TEMPGEN was 39 times faster than the previous SOTA (SCIREX-P) during inference for 4-ary relations, as it bypasses the need to check every possible entity combination.

The success of TEMPGEN highlights the benefits of generative modeling for structured extraction. By "writing out" label names like "Weapon" or "Metric," the model leverages the pre-trained semantic knowledge of these terms to better locate relevant information. Furthermore, the TOPK COPY mechanism demonstrates that selective attention is more effective for extraction than global attention averaging.

Conclusion and Future Work

TEMPGEN demonstrates that document-level entity extraction is highly amenable to a generative approach. While the current implementation is limited by the 1,024-token context window of BART—meaning it may miss information in the latter portions of very long documents like those in SCIREX—the framework's efficiency and accuracy make it a robust solution for complex extraction tasks. Future work may involve extending positional embeddings to allow the generative framework to process much longer documents without truncation.

Summary updated

BibTeX
@inproceedings{huang2021document,
  author = {Kung-Hsiang Huang and Sam Tang and Nanyun Peng},
  title = {{Document-level Entity-based Extraction as Template Generation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2021},
  doi = {10.18653/v1/2021.emnlp-main.426},
}
Figure