ALIGNING LANGUAGE MODELS FOR LYRIC-TO-MELODY GENERATION WITH RULE-BASED MUSICAL CONSTRAINTS

Hao Meng Siyuan Zheng Shuran Zhou Qiangqiang Wang Yang Song
Zuoyebang Education Technology, Beijing, China {menghao05, zhengsiyuan02, zhoushuran, wangqiangqiang, songyang}@zuoyebang.com
Overall framework of the proposed method

The overall framework of our proposed method: SFT, rule-based preference data generation, then sequential DPO and KTO alignment.

Abstract

Large Language Models (LLMs) show promise in lyric-to-melody generation, but models trained with Supervised Fine-Tuning (SFT) often produce musically implausible melodies with issues like poor rhythm and unsuitable vocal ranges, a phenomenon we term "musical hallucination". To address this, we propose a novel alignment framework that instills musical knowledge without human annotation. We define rule-based musical constraints to automatically generate a preference dataset from an SFT model's outputs. The model is then aligned through a sequential process, first using Direct Preference Optimization (DPO) on paired preference data, followed by Kahneman-Tversky Optimization (KTO) on unpaired negative samples. Experimental results demonstrate that our aligned model significantly reduces rule violations and outperforms strong baselines in both objective and subjective evaluations, generating melodies with substantially improved musicality and coherence.

Keywords

Lyric-to-melody generation, large language models, preference alignment, musical constraints, direct preference optimization

Audio Demos

Case 1: nothing left look don't get me wrong i know

Four different models/pipelines for lyric-to-melody + singing voice synthesis.

Ground Truth (Human Reference)

Original / human-sung version for comparison

Step-Audio

(Step-by-step audio generation baseline)

ReLyMe (Improved TeleMelody)

(RelyMe model for melody generation)

SongComposer

(Song composition pipeline)

Ours (Proposed)

(Aligned with rule-based musical constraints)

Case 2: 是让我笑到最后

Four different models/pipelines for lyric-to-melody + singing voice synthesis.

Ground Truth (Human Reference)

Original / human-sung version for comparison

Step-Audio

(Step-by-step audio generation baseline)

ReLyMe (Improved TeleMelody)

(RelyMe model for melody generation)

SongComposer

(Song composition pipeline)

Ours (Proposed)

(Aligned with rule-based musical constraints)

All generated from the same lyrics without cherry-picking.
Listen with headphones for best experience. WAV format for highest fidelity.