Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to main content

Controllable Story Generation Based on Perplexity Minimization

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

Abstract

Large-scale pre-trained language models have demonstrated impressive results in producing human-like texts. However, controlling the text generation process remains a challenge for researchers. Controllable text generation consists of generating sentences that satisfy desired constraints (e.g., sentiment, topic, or keywords). Recent studies that control the decoding stage of a language model have proved the high efficiency of this approach for control of generated texts. This approach, in contrast to the fine-tuning of pre-trained language models, requires much less computing resources. In this work, we propose and investigate a method that controls the process of language generation using perplexity minimization. The method is designed to create stories from a sequence of guide phrases that form a storyline and is based on the search for sequences of tokens that reduce text perplexity when generation is directed towards the guide phrase. First, we generate several arbitrary small sequences of tokens from the language model vocabulary. Then we choose the most probable subsequence - the one, the probability of following the guide phrase after which is the biggest. The proposed method induces the model to shift the content of the generated text to the guide phrase. Experiments on the Russian-language corpus of fairy tales with storylines have shown the high efficiency of the proposed method for creating stories corresponding to the user-specified storyline.

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/icecreamz/MaxProb.

  2. 2.

    https://nukadeti.ru.

  3. 3.

    https://github.com/JRC1995/TextRank-Keyword-Extraction.

  4. 4.

    https://github.com/igor-shevchenko/rutermextract.

  5. 5.

    https://github.com/MaartenGr/KeyBERT.

  6. 6.

    https://huggingface.co/sberbank-ai/rugpt3large_based_on_gpt2.

  7. 7.

    https://huggingface.co/IlyaGusev/llama_13b_ru_turbo_alpaca_lora.

  8. 8.

    https://huggingface.co/datasets/IlyaGusev/ru_turbo_alpaca.

  9. 9.

    https://huggingface.co/IlyaGusev/saiga_13b_lora.

  10. 10.

    https://huggingface.co/datasets/IlyaGusev/ru_turbo_saiga.

  11. 11.

    https://huggingface.co/blog/constrained-beam-search.

  12. 12.

    https://huggingface.co/sberbank-ai/rugpt3medium_based_on_gpt2.

  13. 13.

    https://github.com/GEM-benchmark/GEM-metrics.

References

  1. Amidei, J., Piwek, P., Willis, A.: Agreement is overrated: a plea for correlation to assess human evaluation reliability. In: Proceedings of the 12th International Conference on Natural Language Generation, pp. 344–354 (2019)

    Google Scholar 

  2. Brown, T.B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., et al.: Language models are few-shot learners. Adv. Neural. Inf. Process. Syst. 33, 1877–1901 (2020)

    Google Scholar 

  3. Campos, R., et al.: YAKE! Keyword extraction from single documents using multiple local features. Inf. Sci. J. 509, 257–289 (2020)

    Article  Google Scholar 

  4. Cavazza, M., Pizzi, D.: Narratology for interactive storytelling: a critical introduction. In: Göbel, S., Malkewitz, R., Iurgel, I. (eds.) TIDSE 2006. LNCS, vol. 4326, pp. 72–83. Springer, Heidelberg (2006). https://doi.org/10.1007/11944577_7

    Chapter  Google Scholar 

  5. Dathathri, S., et al.: Plug and play language models: a simple approach to controlled text generation. arXiv preprint arXiv:1912.02164 (2020)

  6. Fan, A., Lewis, M., Dauphin, Y.: Hierarchical neural story generation. arXiv preprint arXiv:1805.04833 (2018)

  7. Hejazi, H.D., Khamees, A.A., Alshurideh, M., Salloum, S.A.: Arabic text generation: deep learning for poetry synthesis. In: Hassanien, A.-E., Chang, K.-C., Mincong, T. (eds.) AMLTA 2021. AISC, vol. 1339, pp. 104–116. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-69717-4_11

    Chapter  Google Scholar 

  8. Keskar, N.S., McCann, B., Varshney, L., Xiong, C., Socher, R.: CTRL - a conditional transformer language model for controllable generation. arXiv preprint arXiv:1909.05858 (2019)

  9. Korobov, M.: Morphological analyzer and generator for Russian and Ukrainian languages. In: Khachay, M.Y., Konstantinova, N., Panchenko, A., Ignatov, D.I., Labunets, V.G. (eds.) AIST 2015. CCIS, vol. 542, pp. 320–332. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-26123-2_31

    Chapter  Google Scholar 

  10. Lester, B., Al-Rfou, R., Constant, N.: The power of scale for parameter-efficient prompt tuning. In: Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp. 3045–3059 (2021)

    Google Scholar 

  11. Li, Y., Li, K., Ning, H., Xia, X., Guo, Y., Wei, C., Cui, J., Wang, B.: Towards an online empathetic chatbot with emotion causes. In: Proceedings 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 2041–2045 (2021)

    Google Scholar 

  12. Li, X.L., Liang, P.: Prefix-tuning: optimizing continuous prompts for generation. In: Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, pp. 4582–4597 (2021)

    Google Scholar 

  13. Meister, C., Vieira, T., Cotterell, R.: If beam search is the answer, what was the question? In: Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, pp. 2173–2185 (2020)

    Google Scholar 

  14. Mirowski, P., Mathewson, K.W., Pittman, J., Evans, R.: Co-writing screenplays and theatre scripts with language models: an evaluation by industry professionals. arXiv preprint arXiv:2209.14958 (2022)

  15. Pascual, D., Egressy, B., Meister, C., Cotterell, R., Wattenhofer, R.: A plug-and-play method for controlled text generation. In: Findings of the Association for Computational Linguistics, pp. 3973–3997 (2021)

    Google Scholar 

  16. Prabhumoye, S., Black, A.W., Salakhutdinov, R.: Exploring controllable text generation techniques. In: Proceedings of the 28th International Conference on Computational Linguistics, pp. 1–14 (2020)

    Google Scholar 

  17. Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., Sutskever, I.: Language models are unsupervised multitask learners. In: OpenAI Blog, vol. 1, no. 8 (2019)

    Google Scholar 

  18. Rosenthal, J.A.: Qualitative descriptors of strength of association and effect size. J. Soc. Serv. Res. 21(4), 37–59 (1996)

    Article  Google Scholar 

  19. Škrlj, B., Repar, A., Pollak, S.: RaKUn: rank-based keyword extraction via unsupervised learning and meta vertex aggregation. In: Martín-Vide, C., Purver, M., Pollak, S. (eds.) SLSP 2019. LNCS (LNAI), vol. 11816, pp. 311–323. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-31372-2_26

    Chapter  Google Scholar 

  20. Touvron, H., et al.: LLaMA: open and efficient foundation language models. arXiv preprint arXiv:2302.13971 (2023)

  21. Vaswani, A., et al.: Attention is all you need. In: Proceedings of the 31st Conference on Neural Information Processing Systems (NeurIPS), vol. 30, pp. 6000–6010 (2017)

    Google Scholar 

  22. Vychegzhanin, S., Kotelnikov, E.: Collocation2Text: controllable text generation from guide phrases in Russian. In: Computational Linguistics and Intellectual Technologies: Proceedings of the International Conference “Dialogue-2022”, vol. 21, pp. 564–576 (2022)

    Google Scholar 

  23. Welleck, S., Kulikov, I., Roller, S., Dinan, E., Cho, K., Weston, J.: Neural text generation with unlikelihood training. In: Proceedings of the 8th International Conference on Learning Representations, pp. 1–18 (2020)

    Google Scholar 

  24. Wiseman, S., Shieber, S., Rush, A.: Challenges in data-to-document generation. In: Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 2253–2263 (2017)

    Google Scholar 

  25. Yang, K., Tian, Y., Peng, N., Klein, D.: Re3: generating longer stories with recursive reprompting and revision. In: Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing (EMNLP 2022), pp. 4393–4479 (2022)

    Google Scholar 

  26. Yao, L., Peng, N., Weischedel, R., Knight, K., Zhao, D., Yan, R.: Plan-and-write: towards better automatic storytelling. In: Proceedings of the AAAI Conference on Artificial Intelligence, vol. 33, no. 01, pp. 7378–7385 (2019)

    Google Scholar 

  27. Yuan, A., Coenen, A., Reif, E., Ippolito, D.: Wordcraft: story writing with large language models. In: 27th International Conference on Intelligent User Interfaces, pp. 841–852 (2022)

    Google Scholar 

  28. Zehtab-Salmasi, A., Feizi-Derakhshi, M.R., Balafar, M.A.: FRAKE: fusional real-time automatic keyword extraction. arXiv preprint arXiv:2104.04830 (2021)

  29. Zhang, H., Song, H., Li, S., Zhou, M., Song, D.: A survey of controllable text generation using transformer-based pre-trained language models. arXiv preprint arXiv:2201.05337 (2022)

  30. Zhang, Y., Wang, G., Li, C., Gan, Z., Brockett, C., Dolan, B.: POINTER: constrained progressive text generation via insertion-based generative pre-training. In: Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 8649–8670 (2020)

    Google Scholar 

  31. Zhu, Y., et al.: Texygen: a benchmarking platform for text generation models. In: The 41st International ACM SIGIR Conference on Research & Development in Information Retrieval, pp. 1097–1100 (2018)

    Google Scholar 

Download references

Acknowledgments

This work was supported by Russian Science Foundation, project № 23-21-00330, https://rscf.ru/en/project/23-21-00330/.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Sergey Vychegzhanin .

Editor information

Editors and Affiliations

Appendices

Appendix A

(See Figs. 4 and 5).

Fig. 4.
figure 4

Distribution of the number of plot phrases.

Fig. 5.
figure 5

Number of sentences in fairy tales.

Appendix B

The first column of Table 2 contains the number of phrases in the plot, the second - the number of fairy tales with such a number of phrases, the third - the share of the total number of fairy tales in the training corpus. The fifth and sixth columns contain statistics on the number of tokens received using the ruGPT-3 Large and LLaMA tokenizer in tales of training corpus, depending on the number of plot phrases.

Table 2. Distribution of the number of phrases in the plot.

Appendix C

Table 3 contains statistical characteristics of generated texts: avg length - the average length of texts (in words); vocab size - the number of different words; distinct-n - the ratio of distinct n-grams over the total number of n-grams.

Table 3. Statistical characteristics of generated texts.

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

Vychegzhanin, S., Kotelnikova, A., Sergeev, A., Kotelnikov, E. (2024). Controllable Story Generation Based on Perplexity Minimization. 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_11

Download citation

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

  • 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