Modeling Structural Topic Transitions for Automatic Lyrics Generation

Kento Watanabe, Yuichiroh Matsubayashi, Kentaro Inui, Masataka GotoPACLIC 2014

Introduction

While modern AI systems can generate rhyming couplets with ease, capturing the cohesive narrative "flow" of a complete song remains a significant hurdle. Most existing automatic lyrics generation models prioritize local constraints, such as rhythmic meter or rhyme schemes. However, a song is more than just a sequence of well-timed sentences; it possesses a macro-structure that guides the listener through a thematic journey. In Japanese pop music, for instance, specific patterns dictate how topics transition between verses, bridges, and choruses. This paper addresses the challenge of modeling these global structural transitions to ensure thematic consistency across an entire track.

The Challenge of Narrative Flow

A common failure of current NLP models in creative writing is the lack of a logical "storyline." A model might generate a poetic line about a sunset, only to follow it immediately with a jarringly unrelated line about a skyscraper. To bridge this gap, the authors propose modeling the structural topic transitions that provide lyrics with their cohesive feel.

In Japanese lyrics, this structure is often defined by the relationship between "Scene" (descriptive imagery) and "Sentiment" (emotional expression). Furthermore, Japanese lyrics are strictly governed by "mora"—phonetic time units—rather than the word stress patterns common in English.

Methodology

The researchers developed a system that integrates these structural and rhythmic constraints. The overall workflow involves taking incomplete lyrics and a target mora length as input to generate a complete, contextually appropriate line.

The overall workflow of the lyrics generation model, taking incomplete lyrics and mora constraints as input to produce a complete line.

The authors proposed three distinct modeling approaches:

  1. Tri-gram Model with Mora Restrictions: A baseline language model that predicts the next word based on the previous two, strictly constrained by the melody's required mora count.
  2. Bi-gram + Line Content Model: An HMM-based approach where hidden states represent topics, modeling transitions from one line to the next.
  3. Bi-gram + Verse Content Model: A higher-level HMM that models topic transitions between larger structural units, such as moving from a descriptive verse to an emotional chorus.

Modeling Topic Transitions

The "Content Model" approach treats the sequence of topics in a song as a path through hidden states. By utilizing the Viterbi algorithm, the system estimates the most likely topic for an unwritten line based on the preceding context. This allows the model to distinguish between different narrative roles, such as setting a scene versus expressing a sentiment.

An example of how lines in a song are categorized into 'Scene' or 'Sentiment' to maintain narrative structure.

Dataset and Training

The models were trained on a comprehensive dataset of 24,000 Japanese popular song lyrics, spanning genres from traditional Enka ballads to 1970s pop. The dataset was split into 20,000 songs for training, with 2,000 each for development and testing. To maintain computational efficiency, the vocabulary was limited to the top 5,000 most frequent words.

Key Insights

The study revealed a fundamental trade-off between local fluency and global consistency. While n-gram models are excellent at making individual lines sound natural, they are often "blind" to the overall theme. In contrast, the HMM-based models are superior at selecting words that align with the song's narrative arc.

Qualitative analysis of the HMM hidden states showed that the model naturally clustered topics into recognizable categories. Some states captured genre-specific imagery (e.g., the "harbor" and "sake" motifs of Enka), while others identified functional roles like "Memory" or "Scene."

Results and Evaluation

The models were evaluated using two primary metrics:

  • Log Probability: The Tri-gram model achieved the highest score (-28.28), indicating its strength in predicting exact word sequences.
  • Fill-in-the-blanks Test: This task required the model to identify the original line of a song from a pair of options (one original, one random). In this test of thematic understanding, the Verse Content Model significantly outperformed the Tri-gram model (57.91% vs. 50.80% accuracy).

These results suggest that while n-gram models may be better "writers" of individual sentences, HMM-based models act as better "editors," understanding the underlying topic structure of the song.

Conclusion

This research demonstrates that modeling structural topic transitions is crucial for generating cohesive lyrics. By incorporating mora constraints and HMM-based topic modeling, the system moves beyond simple rhyming to capture the narrative essence of Japanese pop music. Future work may involve adapting these models to stress-timed languages like English and integrating richer musical information, such as chord progressions and rhythm patterns, to further enhance emotional resonance.

Summary updated

BibTeX
@inproceedings{watanabe2014modeling,
  author = {Kento Watanabe and Yuichiroh Matsubayashi and Kentaro Inui and Masataka Goto},
  title = {{Modeling Structural Topic Transitions for Automatic Lyrics Generation}},
  booktitle = {PACLIC},
  year = {2014},
}
Figure