Papers › Moonbeam: A MIDI Foundation Model Using Both Absolute and Relative Music Attributes

Moonbeam: A MIDI Foundation Model Using Both Absolute and Relative Music Attributes

21 May 2025arXiv:2505.15559archive 2025-07-28

Zixun Guo, Simon Dixon

Moonbeam is a transformer-based foundation model for symbolic music, pretrained on a large and diverse collection of MIDI data totaling 81.6K hours of music and 18 billion tokens. Moonbeam incorporates music-domain inductive biases by capturing both absolute and relative musical attributes through the introduction of a novel domain-knowledge-inspired tokenization method and Multidimensional Relative Attention (MRA), which captures relative music information without additional trainable parameters. Leveraging the pretrained Moonbeam, we propose 2 finetuning architectures with full anticipatory capabilities, targeting 2 categories of downstream tasks: symbolic music understanding and conditional music generation (including music infilling). Our model outperforms other large-scale pretrained music models in most cases in terms of accuracy and F1 score across 3 downstream music classification tasks on 4 datasets. Moreover, our finetuned conditional music generation model outperforms a strong transformer baseline with a REMI-like tokenizer. We open-source the code, pretrained model, and generated samples on Github.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2505.15559")

Code

Syntology Ran 3 of 11 code samples harvested from 1 repository linked to this paper; 8 have no recorded run. Of those that ran: 1 ran · violated contract; 1 ran · fixture could not drive it; 1 ran with no contract checked.

By repository: community (archive-listed): 11 samples from 1 repository, 3 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

guozixunnicolas/Moonbeam-MIDI-Foundation-Model mentioned on GitHubjaxApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

11 samples harvested; 3 ran; 0 honoured the contract we drafted; 8 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · violated contract
1ran · fixture could not drive it
1ran
8unverified

Licence: 0 of the 11 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from guozixunnicolas/Moonbeam-MIDI-Foundation-Model. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

load_peft_model guozixunnicolas/Moonbeam-MIDI-Foundation-Model/src/llama_recipes/inference/model_utils.py community (archive-listed) ran Apache-2.0 (permissive) · 6d5ba8546b6aad2c · report
precompute_freqs_cis guozixunnicolas/Moonbeam-MIDI-Foundation-Model/generation/llama/model.py community (archive-listed) ran · violated contract Apache-2.0 (permissive) · e93cc5b705c2eb3b · report
reshape_for_broadcast guozixunnicolas/Moonbeam-MIDI-Foundation-Model/generation/llama/model.py community (archive-listed) ran · fixture could not drive it fingerprinted Apache-2.0 (permissive) · 70bf6ebaafd266c4 · report
apply_rotary_emb guozixunnicolas/Moonbeam-MIDI-Foundation-Model/generation/llama/model.py community (archive-listed) unverified Apache-2.0 (permissive) · 88092eec78599288 · report
chunk_compounds guozixunnicolas/Moonbeam-MIDI-Foundation-Model/data_preprocess.py community (archive-listed) unverified Apache-2.0 (permissive) · 52bd5b31564b07c7 · report
find_midi_files guozixunnicolas/Moonbeam-MIDI-Foundation-Model/data_preprocess.py community (archive-listed) unverified Apache-2.0 (permissive) · 112a9c1d444c983e · report
find_midi_files_from_file guozixunnicolas/Moonbeam-MIDI-Foundation-Model/data_preprocess.py community (archive-listed) unverified Apache-2.0 (permissive) · 0636ff953de85b98 · report
load_llama_from_config guozixunnicolas/Moonbeam-MIDI-Foundation-Model/src/llama_recipes/inference/model_utils.py community (archive-listed) unverified Apache-2.0 (permissive) · 43a4e8a8adcfda2d · report
load_model guozixunnicolas/Moonbeam-MIDI-Foundation-Model/src/llama_recipes/inference/model_utils.py community (archive-listed) unverified Apache-2.0 (permissive) · 6533a38ad979d2b6 · report
load_model_checkpoint_ddp guozixunnicolas/Moonbeam-MIDI-Foundation-Model/src/llama_recipes/model_checkpointing/checkpoint_handler.py community (archive-listed) unverified Apache-2.0 (permissive) · 07d4dbd7f1854c92 · report
load_sharded_model_single_gpu guozixunnicolas/Moonbeam-MIDI-Foundation-Model/src/llama_recipes/model_checkpointing/checkpoint_handler.py community (archive-listed) unverified Apache-2.0 (permissive) · abd14de7398ccffe · report

Tasks

Music ClassificationMusic Generation

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

AttentionSoftmax

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections