Abstract
Textual style transfer, such as converting informal speech to formal language, typically requires large parallel datasets that are difficult to obtain for specific domains. This paper presents a novel approach to perform formality style transfer in domains where no parallel training data exists. By leveraging a small auxiliary labeled dataset to identify stylistic markers in a large unlabeled corpus and masking them with Part-of-Speech (POS) tags, we generate synthetic parallel pairs. This method enables the training of high-quality, domain-specific style transfer models for noisy, user-generated text.
Introduction
The primary challenge in textual style transfer is the scarcity of parallel datasets—collections of sentences paired with their direct equivalents in another style. Existing datasets, like the Yahoo Formality Dataset, are often domain-specific. Models trained on such data perform poorly when applied to "noisy" environments like TV show scripts or chat logs due to significant differences in vocabulary and structure. To address this "domain mismatch," we propose a method to leverage vast amounts of unlabeled text available in target domains to bridge the gap.
Methodology
Our approach involves a multi-step pipeline designed to create a synthetic parallel dataset from any unlabeled corpus.
The process consists of five key stages:
- Style Classification: A simple Logistic Regression classifier is trained on an auxiliary labeled dataset (e.g., Yahoo Formality) to distinguish between formal and informal text.
- In-Domain Labeling: This classifier is applied to the unlabeled target corpus (e.g., Seinfeld scripts) to partition it into formal and informal subsets.
- Identifying Stylistic Markers: Classifier weights are used to identify words that strongly indicate style (e.g., "dude" vs. "furthermore").
- POS Masking: Stylistic markers in the target corpus are replaced with their corresponding POS tags (e.g., "How's it going,
NAME?" becomes "How's it going,NOUN?"), creating style-agnostic "source" sentences. - Seq2Seq Training: A Sequence-to-Sequence (Seq2Seq) model is trained to translate these masked sentences back into their original stylistic forms.
During inference, to transfer an informal sentence to a formal style, the model masks the informal markers and fills the blanks with formal alternatives learned from the target domain.
Experimental Setup
We evaluated our method using several diverse datasets:
- Yahoo Formality Dataset: Served as the auxiliary labeled dataset.
- TV-Shows Datasets: Scripts from Friends, Futurama, Seinfeld, Southpark, and Stargate SG-1, totaling 420k sentences.
- Slate Star Codex (SSC): A dataset of 3.2 million sentences from a formal online philosophy forum.
- Baseline: An OpenNMT Seq2Seq model trained exclusively on the Yahoo dataset.
The core innovation is using POS tags as a latent shared representation, preserving sentence structure while stripping stylistic "tint."
Results
Performance was measured using human evaluation on a 1–5 scale for formality and suitability (fluency/context).
Key findings include:
- Significant Style Shift: On TV show scripts, the model achieved an average formality increase of ~1.5 points. In the reverse direction, scores decreased by ~2.2 points.
- Outperforming Baselines: On the "All TV-Shows" dataset, our method outperformed the out-of-the-box baseline by 1.4 points in absolute formality change while significantly improving suitability.
- Domain Sensitivity: Training on even small amounts of in-domain synthetic data often yielded better results than using large amounts of out-of-domain data. For larger datasets like SSC, the model maintained high fluency while achieving a nearly 1-point shift in formality.
Discussion and Limitations
While effective, the method has limitations. For very small datasets (e.g., Futurama), fluency suffered, as seen in the drop in suitability scores. Additionally, the pipeline's success is heavily dependent on the initial classifier's accuracy in identifying stylistic markers. Future work will explore more sophisticated word selection models and apply this framework to other style transfer tasks beyond formality.
Conclusion
By using POS masking to create synthetic parallel data, we demonstrate that it is possible to train effective style transfer models for noisy, domain-specific text without pre-existing parallel corpora. This modular approach provides a scalable solution for real-world applications where labeled data is scarce.
Summary updated