Topological Sort for Sentence Ordering

Shrimai Prabhumoye, Ruslan Salakhutdinov, Alan W. Black

Introduction

Sentence ordering—the task of arranging a set of scrambled sentences into a coherent paragraph—is a cornerstone of natural language processing (NLP). It is essential for downstream applications such as multi-document summarization, concept-to-text generation, and automated essay scoring. Traditionally, researchers have approached this as a sequence prediction problem, often utilizing complex deep learning architectures like Pointer Networks to decode the sequence step-by-step. However, these methods suffer from high computational complexity ($N!$ permutations) and error propagation, where a single mistake early in the sequence can derail the entire output.

Researchers from Carnegie Mellon University have proposed a paradigm shift: reframing sentence ordering from a sequence prediction problem into a constraint-solving one. Their model, B-TSort, utilizes a BERT-based classifier to predict pairwise relative orders and then applies a topological sort to assemble the final narrative.

Methodology

The core innovation lies in simplifying the search space from factorial to polynomial complexity.

Constraint Learning

Instead of predicting the entire sequence at once, the model learns to predict the relative order of sentence pairs ($s_i, s_j$).

  • B-TSort: Leverages a pre-trained BERT model. Given BERT's pre-training on "Next Sentence Prediction," it is inherently suited for identifying logical flow between sentences.
  • L-TSort: A baseline using LSTMs to demonstrate that the performance gains are due to the task framing, not just the power of BERT.

Topological Sort

Once all pairwise constraints (e.g., "Sentence A precedes Sentence B") are predicted, they are represented as directed edges in a graph. A standard Topological Sort algorithm then finds a linear ordering that satisfies these constraints. This approach reduces the search space to $O(N^2)$, which can be further optimized to $O(N \log N)$ using sorting algorithms like Merge Sort.

Experimental Setup

The models were evaluated across four diverse datasets:

  • Scientific Abstracts: NIPS, NSF, and AAN datasets, which feature dense, logically structured text.
  • SIND (Sequential Image Narrative Dataset): Conversational captions from visual stories, typically five sentences long.

Results and Discussion

B-TSort significantly outperformed previous state-of-the-art methods, such as the All-Pairs Ordering Network (AON).

Quantitative Performance

On the NIPS dataset, B-TSort achieved a Perfect Match Ratio (PMR) of 32.59%, nearly doubling the 16.25% achieved by AON. It also reached a Kendall Tau ($\tau$) of 0.81, indicating a high correlation with human-ordered text.

Performance comparison on NIPS abstracts and SIND captions showing B-TSort's significant improvements over baselines.

Human Evaluation

Qualitative assessments mirrored the quantitative gains. In head-to-head comparisons, human judges preferred B-TSort's ordering 10% more often than the previous top-performing neural model (B-AON).

Human preference study results comparing B-TSort against B-AON and the original 'Gold' human ordering.

Scalability and Robustness

A key advantage of the pairwise approach is its robustness to document length. While sequence-to-sequence models often struggle with long paragraphs due to memory constraints and error accumulation, B-TSort remains stable. For documents exceeding 10 sentences, the performance gap between B-TSort and traditional models widened, proving the scalability of the constraint-solving framework.

Conclusion

By treating sentence ordering as a constraint-satisfaction problem solved via topological sort, the authors have provided a more efficient and accurate alternative to traditional sequence prediction. While the current model makes pairwise decisions without global context, future work aims to incorporate paragraph-level representations to capture even more nuanced coherence cues.

Summary updated

BibTeX
@inproceedings{prabhumoye2020topological,
  author = {Shrimai Prabhumoye and Ruslan Salakhutdinov and Alan W. Black},
  title = {{Topological Sort for Sentence Ordering}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2020},
  doi = {10.18653/v1/2020.acl-main.248},
}
Figure