SegFormer: A Topic Segmentation Model with Controllable Range of Attention

Haitao Bai, Pinghui Wang, Ruofei Zhang, Zhou SuAAAI 2023

Abstract

Topic segmentation is the process of automatically dividing a long document into topically coherent sections. This paper introduces SegFormer, a novel framework designed to address the challenges of homogeneous representations and noise interference in long-form text analysis. By utilizing unidirectional attention, a controllable context aggregator, and an iterative prediction strategy, SegFormer achieves significant performance improvements over existing state-of-the-art models.

Introduction

Topic segmentation is a fundamental task for downstream applications such as document summarization and information retrieval. Despite the success of Transformer-based models, two major hurdles remain:

  1. Homogeneous Representations: Standard bidirectional Transformers (like BERT) often produce "smooth" sentence embeddings that obscure sharp semantic shifts necessary for boundary detection.
  2. Noise Interference: In long documents, recurring topics can distract models, leading to missed boundaries due to distant but similar content.

SegFormer addresses these by being "position-aware" and explicitly managing the range of attention to focus on local semantic shifts.

Methodology

The SegFormer architecture consists of three primary components designed to refine document representation and boundary prediction.

Sentence Contextualization Encoder (SCE)

To avoid the smoothing effect of bidirectional attention, SegFormer employs two unidirectional Transformer blocks (forward and backward). This ensures that sentence embeddings are heavily influenced by their immediate neighbors and specific positions, preserving the heterogeneity required to identify topic transitions.

Controllable Context Aggregator

This module aggregates local context while minimizing noise from distant segments. A topic classification loss is introduced to guide the aggregator, forcing it to focus on information relevant to the current topic. This effectively "trains" the attention mechanism to stay within appropriate bounds.

The overall architecture of SegFormer, featuring the SCE and Context Aggregator.

Iterative Prediction Algorithm

SegFormer utilizes a progressive "easy-to-hard" search strategy. It first identifies the most distinct boundaries and then uses these as anchors to find more subtle transitions in a subsequent pass.

The iterative prediction algorithm showing the two-step process for boundary detection.

Experimental Evaluation

The researchers evaluated SegFormer across a wide variety of contexts:

  • WIKI-SECTION: A large-scale benchmark covering Cities and Diseases in English and German.
  • Domain Transfer: WIKI-50, Cities, Elements, and Clinical Books were used to test generalization.
  • Real-World Application: A Chinese Advertisements dataset aimed at separating marketing content from essays.

Results and Discussion

SegFormer demonstrated a 7.5% relative improvement in average performance on the WIKI-SECTION dataset compared to the previous best model, Transformer². Key insights include:

  • Directionality: Unidirectional blocks are superior for segmentation as they preserve representation heterogeneity.
  • Topic Supervision: Using topic classification as a secondary task effectively regularizes the attention mechanism.
  • Generalization: The model showed consistent improvements across different languages and domains, proving robust in real-world "noisy" scenarios like advertisement segmentation.

Conclusion

SegFormer introduces a controllable attention mechanism and iterative inference to significantly advance topic segmentation. While it faces challenges with radical topic shifts in specialized domains like chemistry, its position-aware approach offers a powerful solution for long-form document analysis. Future work will focus on improving computational efficiency and exploring stricter attention constraints for extremely long texts.

Summary updated

BibTeX
@inproceedings{bai2023segformer,
  author = {Haitao Bai and Pinghui Wang and Ruofei Zhang and Zhou Su},
  title = {{SegFormer: A Topic Segmentation Model with Controllable Range of Attention}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.1609/aaai.v37i11.26477},
}
Figure