Abstract
While Large Language Models (LLMs) demonstrate impressive capabilities in text generation, we find that their ability has yet to be generalized to music, humanity's creative language. We introduce ChatMusician, an open-source LLM that integrates intrinsic musical abilities. It is based on continual pre-training and finetuning LLaMA2 on a text-compatible music representation, ABC notation, and the music is treated as a second language. ChatMusician can understand and generate music with a pure text tokenizer without any external multi-modal neural structures or tokenizers. Interestingly, endowing musical abilities does not harm language abilities, even achieving a slightly higher MMLU score. Our model is capable of composing well-structured, full-length music, conditioned on texts, chords, melodies, motifs, musical forms, etc, surpassing GPT-4 baseline. On our meticulously curated college-level music understanding benchmark, MusicTheoryBench, ChatMusician surpasses LLaMA2 and GPT-3.5 on zero-shot setting by a noticeable margin. Our work reveals that LLMs can be an excellent compressor for music, but there remains significant territory to be conquered. We release our 4B token music-language corpora MusicPile, the collected MusicTheoryBench, code, model and demo in GitHub.
Introduction
While LLMs like GPT-4 are masters of prose and code, they are surprisingly tone-deaf. When it comes to music, most models struggle with long-term structural dependencies—such as a melody returning to a theme—and complex contrapuntal logic. Furthermore, many existing "AI music" tools require specialized neural structures or audio encoders that separate the music from the model's core linguistic reasoning.
The authors of ChatMusician argue that the intricacies of musical composition—harmonies, rhythms, and forms—are inadequately represented in current LLMs. They set out to prove that a standard LLM can develop "intrinsic" musical abilities if music is represented in a way that is compatible with how the model learns language.
Methods
The researchers developed ChatMusician by taking a pre-trained LLaMA2-7B model and subjecting it to a two-stage process: continual pre-training and supervised fine-tuning.
The "secret sauce" is the choice of ABC notation. Unlike MIDI (which can be very long and verbose) or raw audio (which is computationally expensive), ABC notation is a score-oriented, plain-text representation. It is highly compressed and human-readable, making it ideal for a text-based tokenizer.
The training pipeline didn't just focus on music scores. To prevent "catastrophic forgetting" (where the model loses its ability to speak English), the authors mixed music data with general text, mathematics, and code. This hybrid approach allows the model to "reason" about music using the same logic it uses for math or programming.
Datasets and Benchmarks
The authors introduced two major resources to the community:
- MusicPile (4B tokens): A massive, curated corpus for pre-training. It includes general text, music-related Wikipedia articles, 2 million YouTube metadata summaries, and a vast collection of symbolic music scores (including the "Irishman" and "KernScores" datasets).
- MusicTheoryBench: A new, college-level benchmark consisting of 372 multiple-choice questions. It covers 30 topics ranging from basic intervals and triads to complex orchestration and 20th-century techniques.
Key Insights: Music as a Second Language
The model treats ABC notation symbols just like words. This allows it to understand musical structure (like repetition and motifs) without needing a specialized "music encoder."
ABC notation is significantly more efficient for LLMs than MIDI, using roughly 38% fewer tokens to represent the same musical information. This helps the model handle longer, more coherent compositions. Interestingly, teaching the model music did not degrade its language skills; ChatMusician-Base achieved a slightly higher MMLU score than the original LLaMA2-7B, suggesting that LLMs are naturally suited for the mathematical patterns found in music.
Key Results
ChatMusician demonstrates a clear lead over general-purpose models in the musical domain:
- Music Reasoning: On the zero-shot MusicTheoryBench, ChatMusician-Base scored 40.2%, outperforming GPT-3.5 (31.2%) and LLaMA2 (33.3%). While GPT-4 still leads in pure knowledge, ChatMusician surpassed GPT-4 in the "Reasoning" subset of the benchmark.
- Structural Consistency: In qualitative tests, listeners preferred ChatMusician’s compositions over GPT-4’s in 76% of cases. The model is particularly good at "repetition," detecting and generating repeat signs at a rate of 76%, compared to GPT-3.5's 32.2%.
- Controllability: The model can generate music based on specific constraints, such as "write a melody in G minor with a hornpipe rhythm," with a 99.6% success rate in producing valid, parseable ABC notation.
Limitations and Future Work
Despite its prowess, ChatMusician has a few limitations. Because a large portion of the symbolic music data came from Irish folk music, the model has a strong tendency to compose in that style. Like all LLMs, it can occasionally "hallucinate" musical facts or produce malformed notation when given highly open-ended prompts. The authors also acknowledge potential plagiarism risks, suggesting that future work should include robust music plagiarism detection and more diverse training data.
Summary updated