AttenWalker: Unsupervised Long-Document Question Answering via Attention-based Graph Walking

Yuxiang Nie, Heyan Huang, Wei Wei, Xian-Ling Mao

Introduction

Modern Question Answering (QA) systems typically rely on massive datasets of human-annotated question-answer pairs. However, for long documents such as scientific papers or books, creating these pairs is prohibitively expensive and time-consuming. While Unsupervised QA (UQA) has emerged as a solution for short text snippets, it struggles with the Unsupervised Long-document Question Answering (ULQA) task. Traditional UQA methods often fail to connect disparate facts—for instance, a premise on page 1 and a conclusion on page 20—limiting their ability to capture the "big picture."

To address this, we present AttenWalker, an unsupervised framework designed to generate high-quality QA pairs by leveraging the internal attention mechanisms of pre-trained models to discover long-range dependencies.

Methodology

AttenWalker operates through a pipeline of three primary modules, followed by a specialized training strategy to refine its performance.

The AttenWalker framework overview, illustrating the Span Collector, Span Linker, and Answer Aggregator modules.

1. Span Collector

Rather than selecting random words, the Span Collector utilizes constituent parsing and a T5 model's reconstruction loss. It identifies "informative" spans—segments of text that are difficult to predict from context and are thus likely to contain unique, salient information.

2. Span Linker

This module serves as the core innovation. It treats the attention weights of a pre-trained Longformer (LED) model as a graph. Using a Max-Pooling technique to determine link strength between spans, it performs an Attention-based Graph Walk (via Depth First Search) to identify clusters of semantically interrelated spans, even when they are separated by thousands of tokens.

3. Answer Aggregator and Question Generation

Once a cluster of related spans is identified, a BART model aggregates them into a coherent, natural-sounding answer. Subsequently, a standard question generation (QG) module creates a corresponding question based on this synthesized answer and its original context.

The Two-Pass Training Scheme

A critical insight of this work is that global attention in pre-trained models can initially be noisy. AttenWalker employs a two-pass scheme to mitigate this. In the first pass, the model generates a "noisy" dataset using local attention. By fine-tuning the LED model on this initial data, its global reasoning capabilities are sharpened. In the second pass, the fine-tuned model generates significantly higher-quality, long-range QA pairs.

Comparison of attention weights between Pass One (pre-trained) and Pass Two (fine-tuned), showing improved focus on relevant long-range spans.

Key Results and Insights

AttenWalker was evaluated on two challenging benchmarks: Qasper (scientific papers) and NarrativeQA (books and movie scripts). The results demonstrate a significant lead over previous unsupervised methods:

  • Superior Performance: On Qasper, AttenWalker achieved an Overall F1 of 15.72, nearly doubling the performance of the previous best baseline, MQA-QG (9.85).
  • Long-Range Discovery: By using the </s> token as a "bridge" and max-pooling for span links, the model successfully discovered hidden relationships across document structures.
  • Few-Shot Utility: When limited human-labeled data (10–100 examples) is available, AttenWalker provides a much stronger starting point than standard pre-trained models, serving as an effective data augmentation tool.

Limitations and Future Work

While effective, AttenWalker faces computational challenges due to the complexity of searching through all Transformer layers and heads to build the span graph. Future research may focus on "pre-selecting" specific layers or attention heads known to specialize in long-range semantic linking to optimize efficiency and further reduce noise in the graph-walking process.

Summary updated

BibTeX
@inproceedings{nie2023attenwalker,
  author = {Yuxiang Nie and Heyan Huang and Wei Wei and Xian-Ling Mao},
  title = {{AttenWalker: Unsupervised Long-Document Question Answering via Attention-based Graph Walking}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.findings-acl.862},
}
Figure