Skip to main content

RAG and Few-Shot Prompting in Emotional Text Generation

  • Conference paper
  • First Online:
Speech and Computer (SPECOM 2024)

Abstract

This scientific article describes a modification of the Retrieval Augmented Generation (RAG) method aimed at increasing the emotional content of model responses without supervised fine-tuning. In this model, RAG is not used to expand text generation beyond language knowledge but serves as a key tool for forming prompts based on several examples during a dialogue. The retrieval block of the model finds texts with suitable emotional contexts, which are later used to create prompts. This approach allows the model to generate responses rich in emotions that correspond to the context without the need for strict tuning. An investigation of this kind is being conducted for the first time for Russian-speaking dialogue agents. The developed approach enables enhancing emotional expressiveness and the quality of responses. Applying this method has shown a significant improvement in SSA values by 44% compared to baseline models trained on a dataset with emotional annotations, as well as a 25% enhancement in automatic evaluation based on a classifier.

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

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

References

  1. Firdaus, M., Chauhan, H., Ekbal, A., Bhattacharyya, P.: EmoSen: generating sentiment and emotion controlled responses in a multimodal dialogue system. IEEE Trans. Affect. Comput. 13(3), 1555–1566 (2022). https://doi.org/10.1109/TAFFC.2020.3015491

    Article  Google Scholar 

  2. Huang, C., Zaiane, O.R., Trabelsi, A., Dziri, N.: Automatic dialogue generation with expressed emotions. In: North American Chapter of the Association for Computational Linguistics (2018). https://api.semanticscholar.org/CorpusID:13788863

  3. Lewis, P., et al.: Retrieval-augmented generation for knowledge-intensive NLP tasks. In: Proceedings of the 34th International Conference on Neural Information Processing Systems. NIPS ’20, Curran Associates Inc., Red Hook, NY, USA (2020)

    Google Scholar 

  4. Li, Y., Wu, B.: Emotional dialogue generation with generative adversarial networks. In: 2020 IEEE 4th Information Technology, Networking, Electronic and Automation Control Conference (ITNEC). vol. 1, pp. 868–873 (2020).https://doi.org/10.1109/ITNEC48623.2020.9084678

  5. Posokhov, P., Apanasovich, K., Matveeva, A., Makhnytkina, O., Matveev, A.: Personalizing dialogue agents for Russian: retrieve and refine. In: 2022 31st Conference of Open Innovations Association (FRUCT), pp. 245–252 (2022).https://doi.org/10.23919/FRUCT54823.2022.9770895

  6. Posokhov, P., Matveeva, A., Makhnytkina, O., Matveev, A., Matveev, Y.: Personalizing retrieval-based dialogue agents. In: Prasanna, S.R.M., Karpov, A., Samudravijaya, K., Agrawal, S.S. (eds.) Speech and Computer. SPECOM 2022. LNCS(), vol. 13721, pp. 554–566. Springer, Cham (2022). https://doi.org/10.1007/978-3-031-20980-2_47

  7. Rogers, A., Romanov, A., Rumshisky, A., Volkova, S., Gronas, M., Gribov, A.: RuSentiment: an enriched sentiment analysis dataset for social media in Russian. In: Bender, E.M., Derczynski, L., Isabelle, P. (eds.) Proceedings of the 27th International Conference on Computational Linguistics, pp. 755–763. Association for Computational Linguistics, Santa Fe, New Mexico, USA (2018). https://aclanthology.org/C18-1064

  8. Shin, J., Xu, P., Madotto, A., Fung, P.: Generating empathetic responses by looking ahead the user’s sentiment. In: ICASSP 2020 - 2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 7989–7993 (202https://doi.org/10.1109/ICASSP40776.2020.9054379

  9. Song, Z., Zheng, X., Liu, L., Xu, M., Huang, X.: Generating responses with a specific emotion in dialog. In: Korhonen, A., Traum, D., Màrquez, L. (eds.) Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 3685–3695. Association for Computational Linguistics, Florence, Italy (2019). https://doi.org/10.18653/v1/P19-1359, https://aclanthology.org/P19-1359

  10. Sun, X., Peng, X., Ding, S.: Emotional human-machine conversation generation based on long short-term memory. Cogn. Comput. 10(3), 389397 (2017). https://doi.org/10.1007/s12559-017-9539-4

  11. Zhang, A., Wu, S., Zhang, X., Chen, S., Shu, Y., Feng, Z.: EmoEM: emotional expression in a multi-turn dialogue model. In: 2020 IEEE 32nd International Conference on Tools with Artificial Intelligence (ICTAI), pp. 496–501 (2020). https://doi.org/10.1109/ICTAI50040.2020.00083

  12. Zhang, J., Chen, Q., Lu, J., Wang, X., Liu, L., Feng, Y.: Emotional expression by artificial intelligence chatbots to improve customer satisfaction: Underlying mechanism and boundary conditions. Tourism Manag. 100, 104835 (2024). https://doi.org/10.1016/j.tourman.2023.104835, https://www.sciencedirect.com/science/article/pii/S0261517723001176

  13. Zhao, W., Zhao, Y., Lu, X., Wang, S., Tong, Y., Qin, B.: Is ChatGPT equipped with emotional dialogue capabilities? (2023). https://arxiv.org/abs/2304.09582

Download references

Acknowledgements

The research was financially supported by the Russian Science Foundations (project 22-11-00128).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Olesia Makhnytkina .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2025 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

Vologina, E., Matveeva, A., Makhnytkina, O., Matveev, Y., Burambayeva, N. (2025). RAG and Few-Shot Prompting in Emotional Text Generation. In: Karpov, A., Delić, V. (eds) Speech and Computer. SPECOM 2024. Lecture Notes in Computer Science(), vol 15300. Springer, Cham. https://doi.org/10.1007/978-3-031-78014-1_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-78014-1_4

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-78013-4

  • Online ISBN: 978-3-031-78014-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics