Abstract
Online platforms face a persistent challenge in managing toxic behavior. While traditional moderation tools often rely on punitive measures like flagging or deletion, they fail to guide users toward more constructive communication. This paper introduces CAE-T5, an unsupervised transformer-based model that automatically suggests civil rephrasings for toxic comments. By leveraging self-supervised learning, the model learns to neutralize toxicity while preserving the original message's meaning without requiring expensive, human-annotated parallel datasets.
Introduction
The primary obstacle in training models for text style transfer—specifically from toxic to civil—is the lack of "parallel datasets" containing pairs of toxic sentences and their exact civil equivalents. Collecting such data is prohibitively expensive and slow. CAE-T5 addresses this by performing unsupervised text style transfer, utilizing non-parallel data (separate corpora of toxic and civil comments) to learn the transformation.
Methodology
CAE-T5 (Conditional Auto-Encoder Text-to-Text Transfer Transformer) is built upon the pre-trained T5 architecture. It employs two primary self-supervised training objectives to learn without parallel examples:
- Denoising Auto-Encoder (DAE) Loss: The model is trained to reconstruct original sentences from intentionally corrupted versions (e.g., with masked words). This ensures the generation of fluent, natural language.
- Cycle-Consistency (CC) Loss: To preserve meaning, the model performs a "round trip": it translates a toxic sentence into a civil one, then attempts to translate it back to the original toxic form. Failure to reconstruct the original meaning results in a penalty, forcing the model to keep the core message intact while only altering the toxicity attribute.
Control codes (e.g., toxic: or civil:) are used to direct the decoder toward the target style during generation.
Experimental Setup
The model was evaluated using two primary datasets:
- Civil Comments: A dataset of ~2 million public comments from news sites, processed into sentence-level pairs for training.
- Yelp Review Dataset: A standard benchmark for style transfer (positive vs. negative sentiment) used to compare CAE-T5 against existing state-of-the-art systems.
Key Insights and Qualitative Analysis
A significant finding is the power of pre-training; starting with T5's broad language knowledge allows CAE-T5 to handle complex nuances better than previous RNN-based models. The researchers observed that the model successfully separates semantic meaning from the toxicity attribute.
One notable example is the model's rephrasing of "dubya was a moron" to "dubya was a republican." While not a literal synonym, the model identified "republican" as a non-offensive category for the subject within its training context, demonstrating a sophisticated understanding of social and political descriptors.
Key Results
CAE-T5 demonstrated superior performance over previous unsupervised models on the Civil Comments dataset across several automated metrics:
- Fluency: It achieved a lower Perplexity (PPL), indicating more human-like text generation.
- Content Preservation: It maintained a higher Sentence Similarity (SIM) score compared to baselines.
- Robustness: Using the Geometric Mean (GM) of all metrics, CAE-T5 proved to be the most stable model, balancing civility with semantic accuracy.
In human evaluations, CAE-T5's rephrasings were rated as successful (fluent, civil, and content-preserving) 13% of the time. While seemingly low, this is more than double the success rate of the next best baseline (6%).
Limitations and Future Work
Despite its success, CAE-T5 exhibits several failure modes:
- Hallucination: The model occasionally adds details not present in the source text.
- Position Reversal: It may accidentally flip the author's intent (e.g., turning criticism into praise) to achieve civility.
- Semantic Drift: Meaning preservation remains difficult for longer, more complex sentences.
Future research will explore Non-Autoregressive (NAR) generation for increased speed and more robust attribute classifiers to mitigate the introduction of unintended biases during the detoxification process.
Summary updated