Document Structure in Long Document Transformers

Jan Buchmann, Max Eichler, Jan-Micha Bodensohn, Ilia Kuznetsov, Iryna Gurevych

Abstract

Jan Buchmann, Max Eichler, Jan-Micha Bodensohn, Ilia Kuznetsov, Iryna Gurevych. Proceedings of the 18th Conference of the European Chapter of the Association for Computational Linguistics (Volume 1: Long Papers).

2024.

Introduction

While long-document Transformers are typically fed "flat" text, they benefit significantly from understanding the hierarchical structure—sections, paragraphs, and titles—of a document. This research introduces a novel probing suite to measure "structural awareness" and demonstrates that explicitly infusing structural information into models like LED and LongT5 can boost performance on complex downstream tasks by up to 6.8 F1 points.

Overview of the structure infusion and probing pipeline, showing how documents are mapped to hierarchical trees for Transformer processing.

The Challenge of Linearized Text

Most Transformer models process documents as a linear sequence of tokens. However, human-authored documents are inherently hierarchical. This structure serves as a vital roadmap for navigation and mental modeling. A major gap exists in NLP: it is unclear if long-document Transformers implicitly learn this structure during pre-training, and there is no standardized way to "teach" it to them. Without this understanding, models struggle with tasks requiring global document navigation, such as locating specific evidence in lengthy scientific papers.

Methodology: Formalizing and Infusing Structure

The researchers propose a three-step framework to address these challenges:

1. Intertextual Graphs (ITG)

Documents are represented as ordered graphs where nodes are text elements (e.g., paragraphs) and edges represent hierarchical (parent-child) or sequential relationships. This formalization allows for precise mapping of document components.

The Intertextual Graph (ITG) structure defines node types and hierarchical depths, which are used for both probing and infusion.

2. Probing for Structural Awareness

A suite of seven probing tasks tests if a model's internal representations encode a node's position in the hierarchy. Tasks include identifying node types, tree depth, and relational properties like sibling status.

3. Structure Infusion

The "Structure Infusion Kit" employs two main techniques:

  • Special Tokens (tok): Prepending markers like <Ti> (title) or <Pa> (paragraph) to the text.
  • Structural Embeddings (emb): Adding learned position embeddings representing node type or tree depth to the input layer.

Experimental Setup

The framework was evaluated using several key datasets:

  • F1000Research: Used to instantiate the probing suite.
  • QASPER: Question Answering on Scientific Papers, requiring answer generation and evidence selection.
  • Evidence Inference: Clinical trial reports requiring evidence-based classification.

Key Insights

  • Implicit Knowledge: "Vanilla" models pick up some structural cues from linearized text, performing better than random baselines, though significant room for improvement remains.
  • Contextual Importance: Models identify a node's role more accurately when given surrounding document context ("Vanilla" setting) versus seeing the node in isolation ("Atomic" setting).
  • Correlation with Performance: Success on "Ancestor" and "Parent Predecessor" probes correlates significantly with downstream task performance.
  • Synergy in Infusion: Combining special tokens and structural embeddings often yields the best results, providing multiple "pathways" for document navigation.

Results

Explicitly infusing structure pushed probing accuracy for "Tree Depth" and "Node Type" to nearly 100%. On downstream tasks:

  • QASPER: LED model answer generation improved by 5.58 F1 points, and evidence selection by 14.04 F1 points.
  • Evidence Inference: LongT5 classification improved by 6.84 F1 points.

These gains were achieved by modifying only the input layer, ensuring high transferability across architectures.

Limitations and Future Work

The study focused on English-language scientific and clinical documents using encoder-decoder models. Future research should investigate "messier" formats (web pages), other languages, and the benefits for massive decoder-only LLMs with large context windows. Additionally, the sequence length overhead from special tokens remains a consideration for extremely long documents.

Summary updated

BibTeX
@inproceedings{buchmann2024document,
  author = {Jan Buchmann and Max Eichler and Jan-Micha Bodensohn and Ilia Kuznetsov and Iryna Gurevych},
  title = {{Document Structure in Long Document Transformers}},
  booktitle = {EACL},
  year = {2024},
  url = {https://openreview.net/forum?id=by9LprWXSOr},
}
Figure