Encoder-Decoder Framework for Interactive Free Verses with Generation with Controllable High-Quality Rhyming

Tommaso Pasini, Alejo López-Ávila, Husam Quteineh, Gerasimos Lampouras, Jinhua Du, Yubing Wang, Ze Li, Yusen SunarXiv 2024 · DOI

Abstract

Generating lyrics with consistent rhyming is a significant challenge for standard left-to-right (LTR) language models. We present "Last Word First" (LWF), a novel fine-tuning strategy that prepends a line's rhyming word to its beginning. This allows pretrained models to commit to a rhyme before generating the preceding content. Our framework, utilizing an Encoder-Decoder architecture, achieves up to 94.13% rhyming precision while maintaining high text fluency across 13 languages, significantly outperforming models trained from scratch or using reverse language modeling.

Introduction

The core challenge in automated poetry or lyric generation is the rhyme constraint. Standard models generate text from left to right. If a line must rhyme with a specific word (e.g., "heart"), the model must plan the entire sentence to ensure it ends with a phonetically compatible word like "start." While some researchers have attempted Reverse Language Modeling (RTL)—generating lines from right to left—this approach prevents the use of powerful standard pretrained models like T5 or GPT, which are trained LTR. Consequently, RTL models often produce less coherent or "robotic" text.

Methods: The Last Word First (LWF) Strategy

To bridge the gap between rhyming constraints and pretrained LTR knowledge, we propose the Last Word First (LWF) strategy. Instead of reversing the entire sentence, we extract the final rhyming word and place it at the beginning of the sequence as a prompt.

The LWF framework uses an encoder-decoder architecture where the rhyming word is prepended to the line content.

As shown in Figure 1, the framework utilizes an Encoder-Decoder architecture (specifically T5 and mT5). The encoder processes metadata—including artist, title, genre, and the desired rhyme schema (e.g., A A B C D D A)—while the decoder generates text in the LWF format. For example, a line intended to be "So, so you think you can tell" is formatted as A: tell <sep> So, so you think you can tell. During inference, the model is constrained to use specific rhyming words at the <sep> position to satisfy the user's requested schema.

Datasets

Our study utilizes two primary datasets:

  1. English Genius Dataset: Comprising 564,000 song snippets from Genius.com, enriched with metadata and automatically induced rhyme schemas.
  2. Multilingual Wasabi Dataset: A collection of 2.6 million examples covering 13 languages, representing one of the first major attempts to scale controllable rhyming generation beyond English and Chinese.

Key Results and Performance

The LWF approach demonstrates that fine-tuning a pretrained model is vastly superior to training a rhyming model from scratch. Pretrained models retain a superior grasp of metaphor, emotion, and syntax while learning the new structural constraint.

Performance metrics for various T5 model configurations, highlighting the high rhyming precision (R.P) of LWF models.

As detailed in Figure 4, the LWF models achieved a Rhyming Precision (RP) of up to 94.13% when utilizing sampling and reranking (S+R) techniques. Furthermore, human evaluations indicated that lyrics generated by the LWF-pretrained model were rated significantly higher for meaningfulness than those from scratch-trained models. In blind tests, human annotators mistook LWF-generated lyrics for human-written ones 57% of the time.

Discussion and Future Work

While the LWF strategy is highly effective for English, average rhyming precision across all 13 languages was lower (~41%), suggesting that phonetic structures vary significantly across language families (e.g., the model struggled more with Finnish than with Romance languages). Additionally, while the current system focuses on end rhymes, future iterations could explore internal rhymes and more complex rhythmic meters (prosody). Finally, we implemented a custom copyright metric to ensure the models generate novel content rather than merely memorizing the training data, confirming that the framework produces original creative output.

Summary updated

BibTeX
@misc{pasini2024encoder,
  author = {Tommaso Pasini and Alejo López-Ávila and Husam Quteineh and Gerasimos Lampouras and Jinhua Du and Yubing Wang and Ze Li and Yusen Sun},
  title = {{Encoder-Decoder Framework for Interactive Free Verses with Generation with Controllable High-Quality Rhyming}},
  year = {2024},
  eprint = {2405.05176},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.05176},
}
Figure