Skip to content

tencent-ailab/SongGeneration

Repository files navigation

SongGeneration

Demo  |  Paper  |  Hugging Face  |  Space Demo

This repository is the official repository for “LeVo: High-Quality Song Generation with Multi-Preference Alignment” (NeurIPS 2025). In this repository, we provide the SongGeneration model, inference scripts,pretrained checkpoints, and some music generation tools.

News and Updates

  • 2025.10.16 🔥: Our Demo webpage now supports full-length song generation (up to 4m30s)! 🎶 Experience end-to-end music generation with vocals and accompaniment — try it out now!
  • 2025.10.15 🔥: We have updated the codebase to improve inference speed and generation quality, and adapted it to the latest model version. Please update to the newest code to ensure the best performance and user experience.
  • 2025.10.14 🔥: We have released the large model (SongGeneration-large).
  • 2025.10.13 🔥: We have released the full time model (SongGeneration-base-full) and evaluation performance.
  • 2025.10.12 🔥: We have released the english enhanced model (SongGeneration-base-new).
  • 2025.09.23 🔥: We have released the Data Processing Pipeline, which is capable of analyzing the structure and lyrics of entire songs and providing precise timestamps without the need for additional source separation. On the human-annotated test set SSLD-200, the model’s performance outperforms mainstream models including Gemini-2.5, Seed-ASR, and Qwen3-ASR.
  • 2025.07.25 🔥: SongGeneration can now run with as little as 10GB of GPU memory.
  • 2025.07.18 🔥: SongGeneration now supports generation of pure music, pure vocals, and dual-track (vocals + accompaniment separately) outputs.
  • 2025.06.16 🔥: We have released the SongGeneration series.

TODOs📋

  • Release SongGeneration-v1.5 (trained on a larger multilingual dataset, supports more languages, and integrates a Reward Model with Reinforcement Learning to enhance musicality and lyric alignment)
  • Release finetuning scripts.
  • Release Music Codec and VAE.
  • Release large model.
  • Release full time model.
  • Release English enhanced model.
  • Release data processing pipeline.
  • Update Low memory usage model.
  • Support single vocal/bgm track generation.

Model Versions

Model Max Length Language GPU Menmory RFT(A100) Download Link
SongGeneration-base 2m30s zh 10G/16G 1.26 Huggingface
SongGeneration-base-new 2m30s zh, en 10G/16G 1.26 Huggingface
SongGeneration-base-full 4m30s zh, en 12G/18G 1.30 Huggingface
SongGeneration-large 4m30s zh, en 22G/28G 1.51 Huggingface
SongGeneration-v1.5-small 2m zh, en, es, ja, etc. - - Coming soon
SongGeneration-v1.5-base 4m30s zh, en, es, ja, etc. - - Coming soon
SongGeneration-v1.5-large 4m30s zh, en, es, ja, etc. - - Coming soon

💡 Notes:

  • GPU Memory — “X / Y” means X: no prompt audio; Y: with prompt audio.
  • RFT — Real Forward Time (pure inference, excluding model loading).

Overview

We develop the SongGeneration model. It is an LM-based framework consisting of LeLM and a music codec. LeLM is capable of parallelly modeling two types of tokens: mixed tokens, which represent the combined audio of vocals and accompaniment to achieve vocal-instrument harmony, and dual-track tokens, which separately encode vocals and accompaniment for high-quality song generation. The music codec reconstructs the dual-track tokens into highfidelity music audio. SongGeneration significantly improves over the open-source music generation models and performs competitively with current state-of-the-art industry systems. For more details, please refer to our paper.

img

Installation

Start from scratch

You can install the necessary dependencies using the requirements.txt file with Python>=3.8.12 and CUDA>=11.8:

pip install -r requirements.txt
pip install -r requirements_nodeps.txt --no-deps

(Optional) Then install flash attention from git. For example, if you're using Python 3.10 and CUDA 12.0

pip install https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp310-cp310-linux_x86_64.whl

Start with docker

docker pull juhayna/song-generation-levo:hf0613
docker run -it --gpus all --network=host juhayna/song-generation-levo:hf0613 /bin/bash

Other deploy examples

Inference

To ensure the model runs correctly, please download all the required folders from the original source at Hugging Face.

  • Download ckpt and third_party folder from Hugging Face or Hugging Face, and move them into the root directory of the project. You can also download models using hugging face-cli.

    huggingface-cli download lglg666/SongGeneration-Runtime --local-dir ./runtime
    mv runtime/ckpt ckpt
    mv runtime/third_party third_party
    
  • Download the specific model checkpoint and save it to your specified checkpoint directory: ckpt_path (We provide multiple versions of model checkpoints. Please select the most suitable version based on your needs and download the corresponding file. Also, ensure the folder name matches the model version name.) Your can also download models using hugging face-cli.

    # download SongGeneration-base
    huggingface-cli download lglg666/SongGeneration-base --local-dir ./songgeneration_base
    # download SongGeneration-base-new
    huggingface-cli download lglg666/SongGeneration-base-new --local-dir ./songgeneration_base_new
    # download SongGeneration-base-full
    huggingface-cli download lglg666/SongGeneration-base-full --local-dir ./songgeneration_base_full
    # download SongGeneration-large
    huggingface-cli download lglg666/SongGeneration-large --local-dir ./songgeneration_large
    

Once everything is set up, you can run the inference script using the following command:

sh generate.sh ckpt_path lyrics.jsonl output_path
  • You may provides sample inputs in JSON Lines (.jsonl) format. Each line represents an individual song generation request. The model expects each input to contain the following fields:

    • idx: A unique identifier for the output song. It will be used as the name of the generated audio file.

    • gt_lyric:The lyrics to be used in generation. It must follow the format of [Structure] Text, where Structure defines the musical section (e.g., [Verse], [Chorus]). See Input Guide.

    • descriptions : (Optional) You may customize the text prompt to guide the model’s generation. This can include attributes like gender, timbre, genre, emotion, instrument, and BPM. See Input Guide.

    • prompt_audio_path: (Optional) Path to a 10-second reference audio file. If provided, the model will generate a new song in a similar style to the given reference.

    • auto_prompt_audio_type: (Optional) Used only if prompt_audio_path is not provided. This allows the model to automatically select a reference audio from a predefined library based on a given style. Supported values include:

      • 'Pop', 'R&B', 'Dance', 'Jazz', 'Folk', 'Rock','Chinese Style', 'Chinese Tradition', 'Metal', 'Reggae', 'Chinese Opera', 'Auto'.
    • Note: If certain optional fields are not required, they can be omitted.

  • Outputs of the loader output_path:

    • audio: generated audio files
    • jsonl: output jsonls
  • An example command may look like:

    sh generate.sh songgeneration_base sample/lyrics.jsonl sample/output

If you encounter out-of-memory (OOM) issues, you can manually enable low-memory inference mode using the --low_mem flag. For example:

sh generate.sh ckpt_path lyrics.jsonl output_path --low_mem

If your GPU device does not support Flash Attention or your environment does not have Flash Attention installed, you can disable it by adding the --not_use_flash_attn flag. For example:

sh generate.sh ckpt_path lyrics.jsonl output_path --not_use_flash_attn

By default, the model generates songs with both vocals and accompaniment. If you want to generate pure music, pure vocals, or separated vocal and accompaniment tracks, please use the following flags:

  • --bgm  Generate pure music
  • --vocal Generate vocal-only (a cappella)
  • --separate Generate separated vocal and accompaniment tracks

For example:

sh generate.sh ckpt_path lyrics.jsonl output_path --separate

Input Guide

An example input file can be found in sample/lyrics.jsonl

🎵 Lyrics Input Format

The gt_lyric field defines the lyrics and structure of the song. It consists of multiple musical section, each starting with a structure label. The model uses these labels to guide the musical and lyrical progression of the generated song.

📌 Structure Labels

  • The following segments should not contain lyrics (they are purely instrumental):

    • [intro-short], [intro-medium], [inst-short], [inst-medium], [outro-short], [outro-medium]
    • short indicates a segment of approximately 0–10 seconds
    • medium indicates a segment of approximately 10–20 seconds
    • We find that [inst] label is less stable, so we recommend that you do not use it.
  • The following segments require lyrics:

    • [verse], [chorus], [bridge]

🧾 Lyrics Formatting Rules

  • Each section is separated by ;

  • Within lyrical segments ([verse], [chorus], [bridge]), lyrics must be written in complete sentences and separated by a period (.)

  • A complete lyric string may look like:

    [intro-short] ; [verse] These faded memories of us. I can't erase the tears you cried before. Unchained this heart to find its way. My peace won't beg you to stay ; [bridge] If ever your truth still remains. Turn around and see. Life rearranged its games. All these lessons in mistakes. Even years may never erase ; [inst-short] ; [chorus] Like a fool begs for supper. I find myself waiting for her. Only to find the broken pieces of my heart. That was needed for my soul to love again ; [outro-short]
    
  • More examples can be found in sample/test_en_input.jsonl and sample/test_zh_input.jsonl.

📝 Description Input Format

The descriptions field allows you to control various musical attributes of the generated song. It can describe up to six musical dimensions: Gender (e.g., male, female), Timbre (e.g., dark, bright, soft), Genre (e.g., pop, jazz, rock), Emotion (e.g., sad, energetic, romantic), Instrument (e.g., piano, drums, guitar), BPM (e.g., the bpm is 120).

  • All six dimensions are optional — you can specify any subset of them.

  • The order of dimensions is flexible.

  • Use commas (,) to separate different attributes.

  • Although the model supports open vocabulary, we recommend using predefined tags for more stable and reliable performance. A list of commonly supported tags for each dimension is available in the sample/description/ folder.

  • Here are a few valid descriptions inputs:

    - female, dark, pop, sad, piano and drums.
    - male, piano, jazz.
    - male, dark, the bpm is 110.
    

🎧Prompt Audio Usage Notes

  • The input audio file can be longer than 10 seconds, but only the first 10 seconds will be used.
  • For best musicality and structure, it is recommended to use the chorus section of a song as the prompt audio.
  • You can use this field to influence genre, instrumentation, rhythm, and voice

⚠️ Important Considerations

  • Avoid providing both prompt_audio_path and descriptions at the same time. If both are present, and they convey conflicting information, the model may struggle to follow instructions accurately, resulting in degraded generation quality.
  • If prompt_audio_path is not provided, you can instead use auto_prompt_audio_type for automatic reference selection.

Gradio UI

You can start up the UI with the following command:

sh tools/gradio/run.sh ckpt_path

Evaluation Performance

Chinese

Model Open-Source PER↓ Audiobox Aesthetics ↑ SongEval ↑
CECUPCPQ COHMUSMEMCLANAT
Suno 21.6% 7.657.865.948.35 4.414.344.444.384.26
Mureka 7.2% 7.717.836.398.44 4.013.853.733.873.75
Haimian 11.8% 7.567.855.898.27 3.693.433.513.523.34
ACE-Step 37.1% 7.377.526.267.85 3.683.453.543.483.38
Diffrhythm-v1,2 8.78% 6.917.455.457.99 2.932.602.702.712.60
YUE 14.9% 7.297.536.197.96 3.683.433.493.493.42
SongGeneration-base 7.2% 7.787.906.038.42 3.963.803.853.743.71
SongGeneration-base-new 5.7% 7.827.946.078.43 4.073.923.983.933.86
SongGeneration-base-full 8.4% 7.817.946.078.41 4.023.883.943.873.80
SongGeneration-large 5.1% 7.827.956.098.46 4.083.944.003.943.87

English

Model Open-Source PER↓ Audiobox Aesthetics ↑ SongEval ↑
CECUPCPQ COHMUSMEMCLANAT
Suno 15.6% 7.647.855.848.19 4.494.354.474.354.23
Mureka 12.6% 7.717.936.468.39 4.063.883.903.903.73
Haimian 26.6% 7.858.015.288.44 3.833.683.713.613.45
ACE-Step 32.1% 7.197.376.167.57 3.593.343.433.363.27
Diffrhythm-v1.2 17.8% 7.027.585.967.81 3.513.123.323.213.08
YUE 27.3% 7.047.225.897.67 3.583.243.423.373.30
SongGeneration-base - ---- -----
SongGeneration-base-new 16.2% 7.787.976.038.37 4.053.903.993.913.79
SongGeneration-base-full 20.1% 7.767.985.968.39 4.023.873.973.863.74
SongGeneration-large 14.9% 7.858.056.178.46 4.083.944.033.933.82

Notes

  1. The evaluation results of SongGeneration are based on 200 generated songs, including 100 using descriptions and 100 using auto_prompt_audio_type=Auto. We also provide 40 English and 40 Chinese example inputs in sample/test_en_input.jsonl and sample/test_zh_input.jsonl for reference.
  2. Since the model attempts to clone the timbre and musical style of the given prompt audio, the choice of prompt audio can significantly affect generation performance, and may lead to fluctuations in the evaluation metrics.
  3. The format of the input lyrics has a strong impact on generation quality. If the output quality appears suboptimal, please check whether your lyrics format is correct. You can find more examples of properly formatted inputs in sample/test_en_input.jsonl and sample/test_zh_input.jsonl.

Citation

@article{lei2025levo,
  title={LeVo: High-Quality Song Generation with Multi-Preference Alignment},
  author={Lei, Shun and Xu, Yaoxun and Lin, Zhiwei and Zhang, Huaicheng and Tan, Wei and Chen, Hangting and Yu, Jianwei and Zhang, Yixuan and Yang, Chenyu and Zhu, Haina and Wang, Shuai and Wu, Zhiyong and Yu, Dong},
  journal={arXiv preprint arXiv:2506.07520},
  year={2025}
}

License

The code and weights in this repository is released in the LICENSE file.

Contact

Use WeChat or QQ to scan blow QR code.

About

The official code repository for LeVo: High-Quality Song Generation with Multi-Preference Alignment

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages