Text Segmentation by Cross Segment Attention

Michal Lukasik, Boris Dadachev, Kishore Papineni, Gonçalo Simões

Abstract

Text segmentation is a fundamental task in natural language processing, essential for downstream applications like summarization and information retrieval. This paper presents a novel approach to text segmentation by replacing traditional recurrent neural networks with Transformer-based architectures. We demonstrate that a simple model focusing on local cross-segment attention can outperform complex hierarchical models. Furthermore, we show that knowledge distillation can effectively compress these models for production environments without significant performance loss, achieving state-of-the-art results across multiple benchmarks.

Introduction

Text segmentation is the process of dividing a continuous stream of text into meaningful, logically coherent units. This task is critical at multiple scales: document segmentation, which involves breaking long articles into sections or paragraphs, and discourse segmentation, which breaks sentences into "Elementary Discourse Units" (EDUs)—the smallest building blocks of a logical argument.

Accurate segmentation serves as a bottleneck for many downstream tasks. If a system cannot identify where one topic ends and another begins, performance in information retrieval, text summarization, and legal document analysis inevitably suffers. While previous methods relied on recurrent neural networks (RNNs) or manual feature engineering, they often struggled with long-range dependencies and failed to fully leverage the power of modern contextual embeddings like BERT.

Methodology

The researchers propose and compare three distinct Transformer-based architectures to address the segmentation problem:

  1. Cross-segment BERT: This "minimalist" approach treats segmentation as a binary classification task. Instead of processing the entire document, it takes a fixed window of text to the left and right of a potential boundary and feeds it into a BERT model to decide if a break exists.
  2. BERT+Bi-LSTM: This hybrid model encodes each sentence individually using BERT and then passes those representations into a Bi-directional LSTM to capture the sequential flow of the entire document.
  3. Hierarchical BERT: A fully Transformer-based approach where one BERT model encodes individual sentences, and a second Transformer layer (the "document encoder") processes the resulting sequence of sentence embeddings.
Proposed Transformer-based architectures for text segmentation: (a) Cross-Segment BERT, (b) BERT+Bi-LSTM, and (c) Hierarchical BERT.

To bridge the gap between high-performance research models and real-world production needs, the authors utilized Knowledge Distillation. This process involved training small "student" models (as small as 5 million parameters) to mimic the behavior of the massive 336M parameter "teacher" models, allowing for low-latency deployment in applications like Google Docs.

Datasets and Evaluation

The models were evaluated on three distinct benchmarks to test their versatility:

  • Wiki-727K: A massive dataset of 727,000 Wikipedia articles used for document-level section boundary prediction.
  • Choi: A synthetic dataset consisting of 700 documents created by concatenating random snippets of news articles.
  • RST-DT (Rhetorical Structure Theory Discourse Treebank): The gold standard for discourse segmentation, consisting of Wall Street Journal articles annotated for fine-grained EDUs.

Key Insights and Results

Local Context is King

One of the most surprising findings was that Cross-segment BERT—which only observes a local window—performed competitively with, and sometimes better than, hierarchical models that process the entire document. This suggests that the primary signals for a topic change are concentrated at the boundary itself.

The Necessity of "Look-Ahead"

Performance drops significantly if the model lacks "trailing context" (the text following a potential break). Segmentation is not merely about identifying the end of a topic; it requires observing that a new topic has commenced.

Quantitative Performance

The proposed models established new state-of-the-art (SOTA) benchmarks across all datasets:

  • Wiki-727K: Achieved an F1 score of 66.5, a significant improvement over the previous SOTA of 57.7.
  • RST-DT: Reached an F1 of 95.2, nearing the human-level performance ceiling of 98.5.
  • Choi Dataset: Reduced the error margin by 79%, effectively solving the benchmark with a $P_k$ error score of nearly zero (0.07).

Conclusion

By shifting from RNNs to Transformer-based architectures, this research has significantly advanced the state of text segmentation. The success of the Cross-segment BERT model highlights the importance of local context and look-ahead capabilities. Furthermore, the application of knowledge distillation demonstrates that these powerful models can be compressed by up to 60x while retaining most of their performance, making them viable for large-scale, real-world applications. Future work will focus on addressing the quadratic complexity of Transformers for extremely long documents and improving handling of label noise in human-annotated data.

Summary updated

BibTeX
@inproceedings{lukasik2020text,
  author = {Michal Lukasik and Boris Dadachev and Kishore Papineni and Gonçalo Simões},
  title = {{Text Segmentation by Cross Segment Attention}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2020},
  doi = {10.18653/v1/2020.emnlp-main.380},
}
Figure