Conditional Rap Lyrics Generation with Controlled Thematic Coherence using Fine-tuned Transformer Models
Abstract
Rap lyric generation is a specialized task that demands both thematic consistency and stylistic creativity. Traditional language models often struggle to generate coherent rap lyrics that align with specific themes. This paper addresses this challenge by proposing a conditional text generation approach based on a fine-tuned BART transformer model, guided by explicit thematic control tokens. Through a method of data collection, thematic annotation, and model fine-tuning, the paper explores how controlled generation can enhance the quality of rap lyrics. The study constructs a multi-label rap dataset by scraping and annotating lyrics with twelve common themes such as love, street, and storytelling. The model leverages both content word extraction and theme-specific prompts to generate context-aware lyrics. Experimental evaluation, including both qualitative review and quantitative classification using F1 scores, shows strong performance: validation F1 (micro: 0.992, macro: 0.980) and test F1 (micro: 0.96, macro: 0.86). The paper finds that thematic prompting significantly improves coherence and controllability in generated lyrics, offering new insights into the application of transformers in stylized conditional text generation tasks.
References
- Bradley A. (2017). Book of Rhymes: The Poetics of Hip Hop. Basic Civitas Books.
- Mayer R., Neumeyer D., et al. (2008). Popular Music and Society, 31(4): 443-460.
- Potash P., Romanov A., Rumshisky A (2015). Ghostwriter: Using an LSTM for Automatic Rap Lyric Generation. In: Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing (EMNLP).
- Malmi E., Takala P., Toivonen H. (2016). DopeLearning: A Computational Approach to Rap Lyrics Generation. In: Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing (EMNLP).
- Dathathri S., Madotto A., Lan W., et al. (2020). Plug and Play Language Models: A Simple Approach to Controlled Text Generation. In: International Conference on Learning Representations (ICLR), .
- Nikolov N. I., Malmi E., Northcutt C. G., Parisi L. (2020). Rapformer: Conditional Rap Lyrics Generation with Denoising Autoencoders. In: Proceedings of the 13th International Conference on Natural Language Generation.
- Lewis M., Liu Y., Goyal N., et al. (2020). BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension. In: Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics (ACL).
- Vaswani A., Shazeer N., Parmar N., et al. (2017). Attention Is All You Need. In: Advances in Neural Information Processing Systems (NeurIPS).
- Wolf, T., Debut, L., Sanh, V., Chaumond, J., ... & Rush, A. M. (2020). Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 conference on empirical methods in natural language processing: system demonstrations(pp. 38-45).