Syllable-level lyrics generation from melody exploiting character-level language model

Zhe Zhang, Karol Lasocki, Yi Yu, Atsuhiro Takasu

TL;DR

Generating lyrics that match a melody note-for-note requires syllable-level alignment, but small paired datasets often cause sequence models to produce incoherent gibberish. Because standard language models (LMs) use subword tokenization rather than syllables, this paper adapts a tokenization-free, character-level LM (Google's CANINE) to re-rank syllable candidates during beam search. The resulting system noticeably improves lyric coherence and grammaticality without requiring an expensive, custom syllable-level LM trained from scratch.

What Problem Does This Paper Address?

Generating song lyrics conditioned on symbolic melody requires strict alignment: typically, each musical note corresponds to an individual syllable. However, this task faces two major hurdles:

  1. Data scarcity: Publicly available paired melody-lyrics datasets are small (often ~10,000 short sequences), causing standard seq2seq models to produce ungrammatical, nonsensical lyrics (e.g., "you gotta o in what the you used to life").
  2. Tokenization mismatch: Off-the-shelf pre-trained language models (like GPT or BERT) rely on subword/word-piece tokenizers. Because English words have variable syllable counts, standard subword vocabularies cannot easily enforce a one-syllable-per-note constraint, and dedicated syllable-level pre-trained models do not exist.

Methods

The authors propose a hybrid generation-and-reranking framework:

  • Melody-Encoder Syllable-Decoder: A baseline Transformer processes 20-note symbolic melody representations and generates candidate syllable sequences step by step.
  • Character-Level Language Model (CANINE): Because CANINE operates directly on raw characters without a subword tokenizer, it can process arbitrary syllable strings and learn inter-syllable transitions. The authors fine-tune CANINE on a Next Sentence Prediction (NSP) task: given a partial lyric sequence $l$, predict the probability $P(s \mid l)$ that syllable candidate $s$ naturally follows $l$.
  • Spacing and Robustness Training: In syllable-split text, space placement denotes word boundaries (e.g., _call vs call). The authors constructed negative NSP samples with corrupted spacing and randomized syllable swaps to teach CANINE how syllables assemble into valid English words.
  • Beam Search Re-ranking: At each decoding step $t$, cumulative probabilities from the Transformer ($M$) and CANINE ($L$) are linearly combined: $$C_{i,j}^t = \lambda_m M_{i,j}^t + \lambda_l L_{i,j}^t + C_{i,j}^{t-1}$$ The authors heavily weight the language model ($\lambda_l = 0.75$, $\lambda_m = 0.25$) to steer generation toward fluent English.
Melody Notes ──► [ Transformer Encoder-Decoder ] ──► Candidate Syllables (Top-N)
                                                               │
Previous Lyrics ──► [ Fine-Tuned Character LM (CANINE) ] ────► Cumulative Re-Ranking ──► Next Syllable

Datasets

  • Yu et al. (2021) Dataset: Contains approximately 10,000 paired lyrics–melody sequences, each simplified to 20 musical notes and 20 corresponding syllables.
  • Fine-Tuning Dataset (Newly constructed): Built from the lyric half of the Yu et al. dataset. By slicing every syllable transition and synthesizing negative examples (distractors from the same song, corrupted spaces, and perturbed preceding tokens), the authors generated an imbalanced fine-tuning dataset of over 2 million NSP examples.

Key Insights and Ideas

  • Character models sidestep tokenization traps: Tokenization-free encoders like CANINE are well-suited for non-standard linguistic units (like syllables) because they can score arbitrary character sequences without vocabulary surgery or out-of-vocabulary errors.
  • Word boundary learning: Teaching the character LM where whitespace belongs allows it to implicitly perform both word boundary prediction (compound words vs. new words) and language modeling simultaneously.
  • Pitfalls of standard metrics: Creative generation exposes the limitations of overlap metrics like BLEU and ROUGE. While baseline models scored slightly higher on BLEU by copying training-set n-grams, human listeners and LLM evaluators strongly preferred the fine-tuned LM's outputs because they were grammatically sound and contextually meaningful.

Key Results

  • Objective Metrics: On the validation set, the proposed model achieved slightly lower BLEU-4 (0.0308 vs. 0.0374) and ROUGE-L (0.1186 vs. 0.1248) than the pure Transformer baseline, but maintained similar BERTScore F1 (0.968 vs. 0.967), reflecting that the model generates diverse, novel phrasing rather than strict reference overlap.
  • ChatGPT Evaluation (1–10 scale): When evaluated by GPT-3 across naturality, correctness, coherence, originality, and poetic value, the proposed model scored 6.4 overall (vs. 4.4 for the baseline Transformer and 5.4 for ground-truth lyrics).
  • Human Subjective Evaluation: An 11-participant listening study evaluated synthesized audio. The proposed model outperformed the baseline Transformer across natural language correctness/coherence, creativity/poetic value, rhythmic fit, and atmosphere fit.

Limitations and Future Work

  • Decoding Latency: Querying a character-level model for every beam candidate at each generation step noticeably slows down the search procedure.
  • Pipelined vs. End-to-End: The architecture relies on post-hoc re-ranking rather than joint, end-to-end training of the generator and language model.
  • Dataset Scope: Melodies are restricted to fixed 20-note snippets from a relatively small dataset (~10k pairs), limiting lyrical and musical diversity.
  • Text-Only LLM Evaluation: ChatGPT was prompted solely on the generated text; it did not evaluate whether the generated lyrics suited the emotional valence or rhythm of the symbolic MIDI melody.

Summary updated

BibTeX
@inproceedings{zhang2024syllable,
  author = {Zhe Zhang and Karol Lasocki and Yi Yu and Atsuhiro Takasu},
  title = {{Syllable-level lyrics generation from melody exploiting character-level language model}},
  booktitle = {EACL},
  year = {2024},
}
Figure