Inclusive Counterfactual Generation: Leveraging LLMs in Identifying Online Hate | SpringerLink
Skip to main content

Inclusive Counterfactual Generation: Leveraging LLMs in Identifying Online Hate

  • Conference paper
  • First Online:
Web Engineering (ICWE 2024)

Abstract

Counterfactually augmented data has recently been proposed as a successful solution for socially situated NLP tasks such as hate speech detection. The chief component within the existing counterfactual data augmentation pipeline, however, involves manually flipping labels and making minimal content edits to training data. In a hate speech context, these forms of editing have been shown to still retain offensive hate speech content. Inspired by the recent success of large language models (LLMs), especially the development of ChatGPT, which have demonstrated improved language comprehension abilities, we propose an inclusivity-oriented approach to automatically generate counterfactually augmented data using LLMs. We show that hate speech detection models trained with LLM-produced counterfactually augmented data can outperform both state-of-the-art and human-based methods.

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

Access this chapter

Subscribe and save

Springer+ Basic
¥17,985 /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
JPY 3498
Price includes VAT (Japan)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
JPY 12583
Price includes VAT (Japan)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
JPY 10581
Price includes VAT (Japan)
  • 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://openai.com/blog/chatgpt.

  2. 2.

    Note that on account of being a special-purpose, manually curated dataset for the task of hate speech detection there are higher than normal percentages of hate speech texts.

  3. 3.

    https://huggingface.co/uw-hai/polyjuice.

  4. 4.

    We used the lexicons from https://github.com/peterkwells/uk-attitudes-to-offensive-language-and-gestures-data/.

  5. 5.

    We used the lexicons from https://github.com/surge-ai/profanity.

  6. 6.

    With generations = 5, population_size = 40.

  7. 7.

    With max_epochs = 5, batch_size = 32 (except for the third Experiment, we use 10), learning_rate = 1e−5.

  8. 8.

    For BERT, each fold’s original test set was divided into 50%-50% validation and test set.

  9. 9.

    A qualitative analysis of the data revealed coverage of a vast range of issues from gays in Islam to Republicans to Catholicism. In fact, the dataset diversity is highest for tweets belonging to domain “Religion”.

References

  1. Atanasova, P., Simonsen, J.G., Lioma, C., Augenstein, I.: Fact checking with insufficient evidence. Trans. Assoc. Comput. Linguist. 10, 746–763 (2022)

    Article  Google Scholar 

  2. Badjatiya, P., Gupta, S., Gupta, M., Varma, V.: Deep learning for hate speech detection in tweets. In: Proceedings of the 26th International Conference on World Wide Web Companion, pp. 759–760 (2017)

    Google Scholar 

  3. Bail, C.A.: Can generative AI improve social science? (2023)

    Google Scholar 

  4. Basile, V., et al.: Semeval-2019 task 5: multilingual detection of hate speech against immigrants and women in twitter. In: Proceedings of the 13th International Workshop on Semantic Evaluation, pp. 54–63 (2019)

    Google Scholar 

  5. Belinkov, Y., Poliak, A., Shieber, S.M., Van Durme, B., Rush, A.M.: Don’t take the premise for granted: mitigating artifacts in natural language inference. arXiv preprint arXiv:1907.04380 (2019)

  6. Bender, E.M., Gebru, T., McMillan-Major, A., Shmitchell, S.: On the dangers of stochastic parrots: can language models be too big?. In: Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency, pp. 610–623 (2021)

    Google Scholar 

  7. Brown, T., et al.: Language models are few-shot learners. Adv. Neural. Inf. Process. Syst. 33, 1877–1901 (2020)

    Google Scholar 

  8. Caton, S., Haas, C.: Fairness in machine learning: a survey. ACM Comput. Surv. (2023)

    Google Scholar 

  9. Clark, D.M.: Drag them: a brief etymology of so-called “cancel culture". Commun. Pub. 5(3–4), 88–92 (2020)

    Article  Google Scholar 

  10. Davani, A.M., Díaz, M., Prabhakaran, V.: Dealing with disagreements: looking beyond the majority vote in subjective annotations. Trans. Assoc. Comput. Linguist. 10, 92–110 (2022)

    Article  Google Scholar 

  11. Davidson, T., Warmsley, D., Macy, M., Weber, I.: Automated hate speech detection and the problem of offensive language. In: Proceedings of the International AAAI Conference on Web and Social Media, vol. 11, pp. 512–515 (2017)

    Google Scholar 

  12. Dillion, D., Tandon, N., Gu, Y., Gray, K.: Can AI language models replace human participants? Trends Cogn. Sci. (2023)

    Google Scholar 

  13. Feng, S.Y., et al.: A survey of data augmentation approaches for NLP. In: Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pp. 968–988 (2021)

    Google Scholar 

  14. Gardner, M., et al.: Evaluating models’ local decision boundaries via contrast sets. arXiv preprint arXiv:2004.02709 (2020)

  15. Garg, T., Masud, S., Suresh, T., Chakraborty, T.: Handling bias in toxic speech detection: a survey. ACM Comput. Surv. 55(13s), 1–32 (2023)

    Article  Google Scholar 

  16. Gibson, A.: Free speech and safe spaces: how moderation policies shape online discussion spaces. Soc. Media+ Soc. 5(1), 2056305119832588 (2019)

    Google Scholar 

  17. Howard, P., Singer, G., Lal, V., Choi, Y., Swayamdipta, S.: Neurocounterfactuals: beyond minimal-edit counterfactuals for richer data augmentation. In: Findings of the Association for Computational Linguistics: EMNLP 2022, pp. 5056–5072 (2022)

    Google Scholar 

  18. Jahan, M.S., Oussalah, M.: A systematic review of hate speech automatic detection using natural language processing. Neurocomputing, 126232 (2023)

    Google Scholar 

  19. Kaushik, D., Hovy, E., Lipton, Z.: Learning the difference that makes a difference with counterfactually-augmented data. In: International Conference on Learning Representations (2019)

    Google Scholar 

  20. Kenton, J.D.M.W.C., Toutanova, L.K.: Bert: pre-training of deep bidirectional transformers for language understanding. In: Proceedings of NAACL-HLT, vol. 1, p. 2 (2019)

    Google Scholar 

  21. Kumar, A., Tan, C., Sharma, A.: Probing classifiers are unreliable for concept removal and detection. arXiv preprint arXiv:2207.04153 (2022)

  22. Le, T.T., Fu, W., Moore, J.H.: Scaling tree-based automated machine learning to biomedical big data with a feature set selector. Bioinformatics 36(1), 250–256 (2020)

    Article  Google Scholar 

  23. Le Bras, R., et al.: Adversarial filters of dataset biases. In: Proceedings of the 37th International Conference on Machine Learning, pp. 1078–1088 (2020)

    Google Scholar 

  24. Madiega, T.A.: Artificial intelligence act. European Parliamentary Research Service, European Parliament (2021)

    Google Scholar 

  25. Min, B., et al.: Recent advances in natural language processing via large pre-trained language models: a survey. arXiv preprint arXiv:2111.01243 (2021)

  26. Motoki, F., Neto, V.P., Rodrigues, V.: More human than human: measuring ChatGPT political bias. Public Choice, pp. 1–21 (2023)

    Google Scholar 

  27. Ouyang, L., et al.: Training language models to follow instructions with human feedback. Adv. Neural. Inf. Process. Syst. 35, 27730–27744 (2022)

    Google Scholar 

  28. Pearl, J.: Causal and counterfactual inference. the handbook of rationality (2019)

    Google Scholar 

  29. Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., Sutskever, I., et al.: Language models are unsupervised multitask learners. OpenAI Blog 1(8), 9 (2019)

    Google Scholar 

  30. Ramponi, A., Tonelli, S.: Features or spurious artifacts? data-centric baselines for fair and robust hate speech detection. In: Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 3027–3040. Association for Computational Linguistics (2022)

    Google Scholar 

  31. Ranasinghe, T., Zampieri, M., Hettiarachchi, H.: Brums at HASOC 2019: deep learning models for multilingual hate speech and offensive language identification. In: FIRE (working notes), pp. 199–207 (2019)

    Google Scholar 

  32. Ray, P.P.: ChatGPT: a comprehensive review on background, applications, key challenges, bias, ethics, limitations and future scope. Internet Things and Cyber-Phys. Syst. (2023)

    Google Scholar 

  33. Ross, A., Wu, T., Peng, H., Peters, M.E., Gardner, M.: Tailor: generating and perturbing text with semantic controls. In: Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 3194–3213 (2022)

    Google Scholar 

  34. Samory, M., Sen, I., Kohne, J., Flöck, F., Wagner, C.: “call me sexist, but...”: revisiting sexism detection using psychological scales and adversarial samples. In: Proceedings of the International AAAI Conference on Web and Social Media, vol. 15, pp. 573–584 (2021)

    Google Scholar 

  35. Sarwar, S.M., Murdock, V.: Unsupervised domain adaptation for hate speech detection using a data augmentation approach. In: Proceedings of the International AAAI Conference on Web and Social Media, vol. 16, pp. 852–862 (2022)

    Google Scholar 

  36. Schlangen, D.: Targeting the benchmark: on methodology in current natural language processing research. In: Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 2: Short Papers), pp. 670–674 (2021)

    Google Scholar 

  37. Sen, I., Assenmacher, D., Samory, M., Augenstein, I., van der Aalst, W., Wagne, C.: People make better edits: measuring the efficacy of LLM-generated counterfactually augmented data for harmful language detection. arXiv preprint arXiv:2311.01270 (2023)

  38. Sen, I., Samory, M., Flöck, F., Wagner, C., Augenstein, I.: How does counterfactually augmented data impact models for social computing constructs? arXiv preprint arXiv:2109.07022 (2021)

  39. Sen, I., Samory, M., Wagner, C., Augenstein, I.: Counterfactually augmented data and unintended bias: the case of sexism and hate speech detection. In: Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 4716–4726 (2022)

    Google Scholar 

  40. Toraman, C., Şahinuç, F., Yilmaz, E.: Large-scale hate speech detection with cross-domain transfer. In: Proceedings of the Thirteenth Language Resources and Evaluation Conference, pp. 2215–2225. European Language Resources Association, Marseille, France (2022)

    Google Scholar 

  41. Vidgen, B., Thrush, T., Waseem, Z., Kiela, D.: Learning from the worst: dynamically generated datasets to improve online hate detection. arXiv preprint arXiv:2012.15761 (2020)

  42. Wu, T., Ribeiro, M.T., Heer, J., Weld, D.S.: Polyjuice: generating counterfactuals for explaining, evaluating, and improving models. In: Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 6707–6723 (2021)

    Google Scholar 

Download references

Acknowledgments

This publication has emanated from research conducted with the financial support of Science Foundation Ireland under grant no. 13/RC/2106_P2 at the ADAPT SFI Research Centre at Technological University Dublin.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Arjumand Younus .

Editor information

Editors and Affiliations

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

Qureshi, M.A., Younus, A., Caton, S. (2024). Inclusive Counterfactual Generation: Leveraging LLMs in Identifying Online Hate. In: Stefanidis, K., Systä, K., Matera, M., Heil, S., Kondylakis, H., Quintarelli, E. (eds) Web Engineering. ICWE 2024. Lecture Notes in Computer Science, vol 14629. Springer, Cham. https://doi.org/10.1007/978-3-031-62362-2_3

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-62362-2_3

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-62361-5

  • Online ISBN: 978-3-031-62362-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics