NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

UZH OnPoint at Swisstext-2021: Sentence End and Punctuation Prediction in NLG Text Through Ensembling of Different Transformers (short paper)

Andrianos Michail, Silvan Wehrli, Terézia BuckováSwissText 2021

Abstract

This paper presents the UZH OnPoint system developed for the SwissText 2021 shared task on sentence end and punctuation prediction. The task involves restoring punctuation in machine-generated or transcribed text across four languages: English, German, French, and Italian. Our approach treats the problem as a token classification task, utilizing an ensemble of diverse Transformer architectures, including Electra, XLNet, and Longformer. To handle long documents and class imbalance, we employ sliding window inference and weighted loss functions. Our ensemble system achieved high F1 scores, reaching up to 0.96 for sentence-end detection and 0.81 for full punctuation restoration, demonstrating the effectiveness of combining models with different training objectives.

Introduction

Natural Language Generation (NLG) and Automatic Speech Recognition (ASR) systems often produce raw text lacking punctuation. This "wall-of-text" output is difficult for humans to parse and can lead to semantic ambiguity. The SwissText 2021 shared task challenged participants to develop robust systems for punctuation restoration across multiple European languages. Key challenges included processing extremely long documents (up to 100,000 tokens), handling multilingual data, and addressing severe class imbalance, where the "no punctuation" label significantly outweighs actual punctuation marks.

Methods

We framed punctuation restoration as a token classification problem. Rather than relying on a single model, we developed an ensemble strategy to leverage the strengths of various Transformer architectures.

Ensemble Composition

For each language, we selected a "dream team" of models. Electra served as the primary single-model performer due to its efficient discriminator-based pre-training. Longformer was integrated to specifically address long-range dependencies in documents exceeding the standard 512-token limit. Additionally, XLM-RoBERTa provided multilingual context, while models like BERT, MPNet, and XLNet added architectural diversity.

Inference and Training Techniques

To process long documents, we implemented a sliding window approach with a 40-token overlap. Predictions from the edges of windows were discarded to ensure each token's classification was based on sufficient surrounding context. Final predictions were determined via majority voting. In cases of ties, the system defaulted to the less frequent punctuation mark to improve recall for rare classes. Furthermore, for non-English languages, we applied weighted loss functions during training to penalize misclassifications of infrequent marks like colons and hyphens.

Data and Class Imbalance

The primary dataset was the Europarl Parallel Corpus. A significant hurdle was the distribution of labels. As shown in Figure 1, the "0" label (no punctuation) is orders of magnitude more frequent than any specific punctuation mark, which can bias models toward predicting no punctuation.

Distribution of punctuation marks in the training and development sets, highlighting the severe class imbalance.

Key Results

Our ensemble approach consistently outperformed individual base models across both subtasks.

Subtask 1: Sentence End Detection

The system achieved exceptional performance in identifying sentence boundaries. F1 scores reached 0.94 for English, 0.96 for German, and 0.93 for both French and Italian. The ensemble's superiority over individual models is detailed in Figure 2.

F1 scores for Subtask 1 (Sentence End Detection) across different languages and models, showing the performance boost from ensembling.

Subtask 2: Full Punctuation Prediction

Predicting the full range of punctuation (commas, colons, etc.) proved more challenging due to stylistic variability. Nevertheless, the ensemble achieved strong macro F1 scores between 0.76 and 0.81. While performance dropped on the "Surprise" TED dataset (e.g., English F1 fell from 0.94 to 0.80), the models still maintained respectable accuracy, proving the ensemble's robustness.

Discussion and Conclusion

The results underscore that architectural diversity in ensembles—combining models with different training objectives—is more effective than ensembling identical architectures. While the sliding window technique successfully handled long documents, punctuation remains a subjective task, particularly for internal sentence marks. Future work will explore more sophisticated ensembling methods, such as stacking, and investigate ways to better model the stylistic nuances of human punctuation.

Summary updated

BibTeX
@inproceedings{michail2021uzh,
  author = {Andrianos Michail and Silvan Wehrli and Terézia Bucková},
  title = {{UZH OnPoint at Swisstext-2021: Sentence End and Punctuation Prediction in NLG Text Through Ensembling of Different Transformers (short paper)}},
  booktitle = {SwissText},
  year = {2021},
}
Figure