Skip to main content

Paraphrasers and Classifiers: Controllable Text Generation for Text Style Transfer

  • Conference paper
  • First Online:
Analysis of Images, Social Networks and Texts (AIST 2023)

Abstract

Text style transfer (TST) is an NLP task with a long history and a broad range of applications. Recently, it has seen success with the use of large pretrained language models (LMs). However, the size of contemporary LMs often makes fine-tuning for downstream tasks infeasible. For this reason, methods of controllable text generation (CTG) which do not aim at fine-tuning the original LM have received attention for solving TST tasks. In this work, we contribute to this line of research and adapt an existing CTG method, CAIF, for TST. The original CAIF is based on reweighting the logits of the generative LM according to a free-form style attribute classifier. To allow its use for TST, we replace the standard LM with a model capable of paraphrasing, making corresponding changes. We refer to the resulting unsupervised method as ParaCAIF. We illustrate its applicability by experimenting with detoxification, a relatively new yet practical TST subtask. We work with detoxification in two languages: Russian and English. For both languages, ParaCAIF significantly reduces the toxicity of the generated paraphrases as compared to plain paraphrasers. To the best of our knowledge, it is the first work that adapts a CTG method for Russian detoxification. For English, ParaCAIF outperforms an analogous adapted CTG method, ParaGeDi, in terms of style transfer accuracy. Although the overall performance of ParaCAIF remains lower than that of supervised approaches, it has a broader range of application, as it does not require parallel data which are not readily available for many TST tasks.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 59.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 74.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    https://github.com/BunnyNoBugs/ParaCAIF.

  2. 2.

    https://huggingface.co/sberbank-ai/ruT5-base.

  3. 3.

    https://sberbank-ai.github.io/ru-prompts.

  4. 4.

    https://github.com/sberbank-ai/ru-gpts.

  5. 5.

    https://huggingface.co/BunnyNoBugs/rubert-tiny2-russe-toxicity.

  6. 6.

    http://paraphraser.ru/download.

  7. 7.

    https://wortschatz.uni-leipzig.de/en/download/Russian.

  8. 8.

    https://huggingface.co/s-nlp/roberta_toxicity_classifier_v1.

References

  1. Belchikov, A.: Russian language toxic comments (2019). https://www.kaggle.com/datasets/blackmoon/russian-language-toxic-comments

  2. Bender, E.M., Gebru, T., McMillan-Major, A., Shmitchell, S.: On the dangers of stochastic parrots: can language models be too big? In: FAccT 2021 (2021). https://doi.org/10.1145/3442188.3445922

  3. Dale, D.: (2021). https://habr.com/ru/post/564916/

  4. Dale, D.: (2021). https://habr.com/ru/post/562064/

  5. Dale, D., et al.: Text Detoxification Using Large Pre-trained Neural Models (2021). https://aclanthology.org/2021.emnlp-main.629

  6. Dathathri, S., et al.: Plug and Play Language Models: A Simple Approach to Controlled Text Generation (2020). https://openreview.net/forum?id=H1edEyBKDS

  7. Dementieva, D., et al.: Methods for Detoxification of Texts for the Russian Language (2021). https://arxiv.org/abs/2105.09052

  8. Dementieva, D., et al.: RUSSE-2022: findings of the first Russian detoxification task based on parallel corpora (2022)

    Google Scholar 

  9. Deng, Y., et al.: Residual Energy-Based Models for Text Generation (2020). https://openreview.net/forum?id=B1l4SgHKDH

  10. Feng, F., Yang, Y., Cer, D., Arivazhagan, N., Wang, W.: Language-agnostic BERT sentence embedding (2020)

    Google Scholar 

  11. Fenogenova, A.: Russian Paraphrasers: Paraphrase with Transformers (2021). https://aclanthology.org/2021.bsnlp-1.2

  12. Hallinan, S., Liu, A., Choi, Y., Sap, M.: Detoxifying Text with MaRCo: Controllable Revision with Experts and Anti-Experts (2022). https://arxiv.org/abs/2212.10543

  13. Jigsaw: Toxic Comment Classification Challenge (2018). https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge

  14. Jigsaw: Jigsaw Unintended Bias in Toxicity Classification (2019). https://www.kaggle.com/c/jigsaw-unintended-bias-in-toxicity-classification

  15. Jigsaw: Jigsaw Multilingual Toxic Comment Classification (2020). https://www.kaggle.com/c/jigsaw-multilingual-toxic-comment-classification

  16. Jin, D., Jin, Z., Hu, Z., Vechtomova, O., Mihalcea, R.: Deep Learning for Text Style Transfer: A Survey (1) (2022). https://aclanthology.org/2022.cl-1.6

  17. John, V., Mou, L., Bahuleyan, H., Vechtomova, O.: Disentangled Representation Learning for Non-Parallel Text Style Transfer (2019). https://www.aclweb.org/anthology/P19-1041.pdf

  18. Konodyuk, N., Tikhonova, M.: Continuous prompt tuning for Russian: how to learn prompts efficiently with RuGPT3? In: Burnaev, E., et al. (eds.) AIST 2021. CCIS, vol. 1573, pp. 30–40. Springer, Cham (2022). https://doi.org/10.1007/978-3-031-15168-2_3

    Chapter  Google Scholar 

  19. Krause, B., et al.: GeDi: Generative Discriminator Guided Sequence Generation (2021). https://aclanthology.org/2021.findings-emnlp.424

  20. Krishna, K., Wieting, J., Iyyer, M.: Reformulating Unsupervised Style Transfer as Paraphrase Generation (2020). https://aclanthology.org/2020.emnlp-main.55

  21. Kuratov, Y., Arkhipov, M.: Adaptation of deep bidirectional multilingual transformers for Russian language (2019)

    Google Scholar 

  22. Laugier, L., Pavlopoulos, J., Sorensen, J., Dixon, L.: Civil Rephrases Of Toxic Texts With Self-Supervised Transformers (2021). https://doi.org/10.18653/v1/2021.eacl-main.124

  23. Liu, A., et al.: DExperts: Decoding-Time Controlled Text Generation with Experts and Anti-Experts (2021). https://arxiv.org/abs/2105.03023

  24. Liu, Y., et al.: RoBERTa: A Robustly Optimized BERT Pretraining Approach (2019). https://arxiv.org/abs/1907.11692

  25. Mueller, J., Gifford, D.K., Jaakkola, T.S.: Sequence to better sequence: continuous revision of combinatorial structures. In: Proceedings of Machine Learning Research (2017). https://proceedings.mlr.press/v70/mueller17a.html

  26. Prabhumoye, S., Black, A.W., Salakhutdinov, R.: Exploring Controllable Text Generation Techniques (2020). https://aclanthology.org/2020.coling-main.1

  27. Raffel, C., et al.: Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer (2019). https://arxiv.org/abs/1910.10683

  28. Reimers, N., Gurevych, I.: Making monolingual sentence embeddings multilingual using knowledge distillation (2020)

    Google Scholar 

  29. Rubtsova, Y.: Avtomaticheskoye postroyeniye i analiz korpusa korotkikh tekstov (postov mikroblogov) dlya zadachi razrabotki i trenirovki tonovogo klassifikatora. inzheneriya znaniy i tekhnologii semanticheskogo veba (2012)

    Google Scholar 

  30. Nogueira dos Santos, C., Melnyk, I., Padhi, I.: Fighting Offensive Language on Social Media with Unsupervised Text Style Transfer (2018). https://aclanthology.org/P18-2031

  31. Semiletov, A.: Toxic Russian comments (2020). https://www.kaggle.com/datasets/alexandersemiletov/toxic-russian-comments

  32. Shen, T., Lei, T., Barzilay, R., Jaakkola, T.: Style transfer from non-parallel text by cross-alignment (2017)

    Google Scholar 

  33. Sitdikov, A., Balagansky, N., Gavrilov, D., Markov, A.: Classifiers are Better Experts for Controllable Text Generation (2022). https://arxiv.org/abs/2205.07276

  34. Thakur, N., Reimers, N., Daxenberger, J., Gurevych, I.: Augmented SBERT: data augmentation method for improving bi-encoders for pairwise sentence scoring tasks (2020)

    Google Scholar 

  35. Warstadt, A., Singh, A., Bowman, S.R.: Neural Network Acceptability Judgments (2019). https://aclanthology.org/Q19-1040

  36. Weng, L.: Controllable Neural Text Generation (2021). https://lilianweng.github.io/posts/2021-01-02-controllable-text-generation/

  37. Wieting, J., Berg-Kirkpatrick, T., Gimpel, K., Neubig, G.: Beyond BLEU: Training Neural Machine Translation with Semantic Similarity (2019). https://aclanthology.org/P19-1427

  38. Wieting, J., Gimpel, K.: ParaNMT-50M: Pushing the Limits of Paraphrastic Sentence Embeddings with Millions of Machine Translations (2018). https://aclanthology.org/P18-1042

  39. Wu, X., Zhang, T., Zang, L., Han, J., Hu, S.: “Mask and Infill”: Applying Masked Language Model to Sentiment Transfer (2019). https://arxiv.org/pdf/1908.08039

  40. Xue, L., et al.: mT5: A Massively Multilingual Pre-trained Text-to-Text Transformer (2021). https://aclanthology.org/2021.naacl-main.41

  41. Zhang, H., Song, H., Li, S., Zhou, M., Song, D.: A Survey of Controllable Text Generation using Transformer-based Pre-trained Language Models (2022). https://arxiv.org/abs/2201.05337

  42. Zhao, J.J., Kim, Y., Zhang, K., Rush, A.M., LeCun, Y.: Adversarially regularized autoencoders. In: Proceedings of Machine Learning Research (2018). https://proceedings.mlr.press/v80/zhao18b.html

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Evgeny Orlov .

Editor information

Editors and Affiliations

Appendices

A ParaCAIF vs. Reranking

Table 4 displays the comparison results of ParaCAIF model and plain paraphraser with added reranking procedure..

Table 4. Detoxification metrics evaluated on RUSSE Detox development subset, averaged across 10 candidates for each source sentence. The differences between models in all metrics are statistically significant with \(p < 0.01\), based on a two-sample t-test.

B ParaCAIF Russian Detoxification Examples

Tables 5 and 6 demonstrate examples of sentences from RUSSE Detox detoxified by ParaCAIF ruT5 with different \(\alpha \) values. We observe that \(\alpha = -5\) tends to delete all strong obscene words, while a less strict \(\alpha \) of \(-1\) allows some direct toxicity (e.g., блин ‘damn it’).

Table 5. Examples of sentences from RUSSE Detox detoxified by ParaCAIF ruT5 with \(\alpha = -5\).
Table 6. Examples of sentences from RUSSE Detox detoxified by ParaCAIF ruT5 with \(\alpha = -1\).

Rights and permissions

Reprints and permissions

Copyright information

© 2024 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Orlov, E., Apishev, M. (2024). Paraphrasers and Classifiers: Controllable Text Generation for Text Style Transfer. In: Ignatov, D.I., et al. Analysis of Images, Social Networks and Texts. AIST 2023. Lecture Notes in Computer Science, vol 14486. Springer, Cham. https://doi.org/10.1007/978-3-031-54534-4_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-54534-4_7

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-54533-7

  • Online ISBN: 978-3-031-54534-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy