Text Style Transfer (TST) aims to modify the stylistic attributes of a sentence—such as sentiment or formality—while preserving its core semantic content. While existing methods often treat style transfer as a monolithic transformation, a recent study presented at ACL 2023 by researchers from the University of Science and Technology of China and BUPT suggests that this approach is insufficient. They introduce Contrastive Transfer Pattern Mining (CTPM), a novel framework that identifies and leverages latent "transfer patterns" to improve rewriting quality.
The Challenge: Latent Transfer Patterns
Standard TST models typically learn a single mapping between styles (e.g., Negative to Positive). However, different sentences require different linguistic operations. For example, converting "The food was terrible" to "The food was great" involves a simple adjective swap, whereas "I didn't like the service" requires removing a negation to become "I liked the service."
These specific maneuvers are "transfer patterns." Because these patterns are not explicitly labeled in training data, models often produce ambiguous representations that fail to balance style accuracy with content preservation. CTPM addresses this by treating these patterns as latent variables to be discovered during training.
The CTPM Framework
The CTPM approach consists of two primary components designed to organize the latent space of sentence representations:
- Adaptive Clustering Module: This module automatically groups sentences within the same style into $k$ clusters. Using BERT-based embeddings and an entropy-based clustering algorithm, the model discovers a latent taxonomy of how styles are expressed and transformed.
- Contrastive Learning Module: To sharpen these discovered categories, the framework employs two types of contrastive loss:
- Intra-style Contrastive Loss: Pulls sentences sharing the same latent transfer pattern closer together.
- Inter-style Contrastive Loss: Pushes sentences with different styles further apart in the embedding space.
One of the key advantages of CTPM is its "plug-and-play" nature. It serves as an auxiliary training objective that can be integrated into various existing TST architectures, such as the Style Transformer.
Experimental Results
The researchers evaluated CTPM on the Yelp and IMDb review datasets, focusing on sentiment transfer. The results demonstrated significant improvements across multiple metrics:
- Style Accuracy (S-ACC): Adding CTPM to the Style Transformer baseline led to an increase of 3.7 points on Yelp and 7.6 points on IMDb.
- Content Preservation: Unlike many methods where style accuracy gains come at the expense of meaning, CTPM improved content preservation (measured by Self-BLEU) by 2.4 points on the Yelp dataset.
- Representation Quality: Visualization of the latent space confirms that CTPM successfully organizes sentences into distinct, meaningful clusters.
Analysis of the hyperparameter $k$ (the number of clusters) revealed that the model's performance is sensitive to the granularity of the discovered patterns, with optimal results typically found between 4 and 6 clusters for the tested datasets.
Conclusion
CTPM shifts the focus of Text Style Transfer from simple style-to-style mapping to a more nuanced understanding of latent linguistic patterns. By providing explicit supervision for these hidden patterns through clustering and contrastive learning, the framework enables more precise and content-aware text rewriting. Future work may explore the application of CTPM to multi-attribute transfer and improve the interpretability of the discovered latent clusters.
Paper Citation: Jingxuan Han, Quan Wang, Licheng Zhang, Weidong Chen, Yan Song, and Zhendong Mao.
- Text Style Transfer with Contrastive Transfer Pattern Mining. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 7914–7927.
Summary updated