NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

ReLyMe: Improving Lyric-to-Melody Generation by Incorporating Lyric-Melody Relationships

Chen Zhang, LuChin Chang, Songruoyao Wu, Xu Tan, Tao Qin, Tie-Yan Liu, Kejun Zhang · DOI

TL;DR

ReLyMe (Relationships between Lyrics and Melodies) is a decoding-time framework that injects music theory principles into neural lyric-to-melody generation. By applying "soft constraints" related to linguistic tones, rhythmic stress, and structural repetition, it ensures that AI-generated music sounds harmonious and respects the natural flow of the lyrics.

The Challenge of Lyric-Melody Alignment

While deep learning has revolutionized automatic music composition, neural models often struggle with the "strict but subtle" rules that govern how lyrics and melodies interact. In tonal languages like Mandarin, a melody moving in the opposite direction of a word's linguistic tone can change its meaning—for instance, "place" might sound like "enemy." In English, placing an auxiliary word like "the" on a heavy musical downbeat feels unnatural.

Existing end-to-end models often produce melodies that are musically interesting but "dissonant" with their lyrics because they fail to capture these domain-specific constraints. ReLyMe bridges this gap by incorporating music theory directly into the generation process without requiring massive new datasets or complex retraining.

The ReLyMe Framework: Constrained Decoding

The core of ReLyMe is Constrained Decoding. Instead of altering the training phase, the researchers modify how the model selects the next note during inference. They introduce a reward term ($R_{cons}$) to the model's standard probability score, built upon three pillars:

Overview of the various linguistic and musical constraints integrated into the ReLyMe framework, including pitch contour, repetition, and rhythmic positioning.

1. Tone Rewards

  • Pitch Shape: Ensures that if a single syllable spans multiple notes, the pitch flow matches the linguistic tone (e.g., a rising tone in Mandarin paired with rising notes).
  • Pitch Transition: Evaluates the harmony between adjacent syllables based on linguistic research. This is often quantified using a transition quality matrix.
  • Pitch Contour: Matches the overall sentence intonation, such as a rising melody for a question.
A pitch transition quality matrix used to evaluate the harmony between adjacent tones, ranging from 'excellent' to 'bad' based on semitone intervals.

2. Rhythm Rewards

  • Strong/Weak Positions: Aligns stressed syllables or keywords with musical downbeats while placing auxiliary words on weak beats.
  • Pause Positions: Prevents "broken phrases" by ensuring musical rests or long notes do not interrupt a word.

3. Structure Rewards

  • Ensures that if lyrics follow a repetitive structure (like a chorus), the generated melody reflects that repetition through similar pitch flows.

These are implemented as "soft constraints," allowing the model to deviate if the melodic logic is strong enough, which prevents the output from sounding robotic.

Datasets and Evaluation

ReLyMe was evaluated using two state-of-the-art baselines: TeleMelody (a multi-stage system) and SongMASS (an end-to-end system). The researchers used a test set of 100 English songs and 100 Chinese songs entirely unseen during training to assess generalization.

Key Insights

  • Domain Knowledge as a Shortcut: Explicitly informing the model about "good" musical patterns is more data-efficient than waiting for a transformer to learn nuances from raw data.
  • The "Soft" Constraint Balance: "Hard" constraints (forcing rules 100% of the time) actually degrade musical quality. The "soft" reward approach balances music theory with learned creative patterns.
  • Improved Intelligibility: By aligning pitch and rhythm with linguistic patterns, AI-generated songs became significantly easier for human listeners to understand.

Results

The authors utilized both objective and subjective metrics:

  • Objective Improvements: In Chinese song generation, the "tone transition" harmony score improved from 0.45 to 0.61 when ReLyMe was added to TeleMelody.
  • Subjective Preference: Human evaluators with music backgrounds consistently rated ReLyMe-enhanced melodies higher in coherence and overall quality.
  • Cross-Architecture Success: The method proved effective for both multi-stage pipelines and end-to-end neural networks, demonstrating that constrained decoding is a flexible "plug-and-play" solution.

Limitations and Future Work

Current tone constraints are heavily optimized for Mandarin. Future work aims to define specific rules for other non-tonal languages and explore Melody-to-Lyric generation. Additionally, expanding constraints to multi-instrument arrangements or polyphonic textures remains an open challenge.

Summary updated

BibTeX
@inproceedings{zhang2022relyme,
  author = {Chen Zhang and LuChin Chang and Songruoyao Wu and Xu Tan and Tao Qin and Tie-Yan Liu and Kejun Zhang},
  title = {{ReLyMe: Improving Lyric-to-Melody Generation by Incorporating Lyric-Melody Relationships}},
  booktitle = {ACM Multimedia},
  year = {2022},
  doi = {10.1145/3503161.3548357},
}
Figure