Introduction
In the field of Symbolic Music Understanding (SMU), researchers have frequently adapted Natural Language Processing (NLP) techniques, specifically BERT’s Masked Language Modeling (MLM). Standard MLM randomly masks tokens and tasks the model with predicting them. However, this paper argues that random masking is fundamentally flawed for music.
Some musical elements are "context-free," meaning they cannot be logically inferred from surrounding notes (e.g., the initial note of a piece). When forced to predict these, a model often "cheats" by learning the statistical biases of the training set—such as a specific composer's stylistic quirks—rather than the underlying musical logic. This leads to overfitting and poor generalization. Adversarial-MidiBERT addresses this by introducing a strategy to identify and ignore these context-free tokens during training.
Methodology
Octuple Representation and Architecture
The model utilizes the "Octuple" data format, where each note is represented by eight distinct attributes: Time Signature (TS), Tempo (BPM), Bar, Position (POS), Instrument, Pitch, Duration, and Velocity. These are embedded into a single sequence for the BERT backbone.
Adversarial Pre-training
To solve the random masking issue, the authors propose an adversarial system consisting of two competing networks:
- The Masker: Learns to identify tokens that are difficult to recover (context-free).
- The Recoverer (Backbone): A BERT-based model that attempts to predict masked tokens.
After initial training, the context-free tokens identified by the Masker are "frozen" and excluded from being masked. This forces the Recoverer to focus exclusively on learning "context-dependent" musical relationships—the patterns that can be logically deduced from the score.
Mask Fine-tuning
To bridge the gap between pre-training (where [MASK] tokens are present) and downstream tasks (where they are usually absent), the authors continue to randomly mask a small percentage of tokens during fine-tuning. This acts as a form of regularization, maintaining the model's contextual inference capabilities during task-specific adaptation.
Results and Evaluation
Adversarial-MidiBERT was evaluated against existing models like MidiBERT, MusicBERT, and PianoBART across several datasets, including Pianist8 (Composer Classification), EMOPIA (Emotion Recognition), and POP909 (Melody Extraction).
As shown in the results, the model achieved significant breakthroughs in sequence-level tasks:
- Composer Classification: Reached 97.92% accuracy, a substantial improvement over the ~86-88% seen in previous models.
- Emotion Recognition: Achieved 79.46% accuracy, outperforming the previous state-of-the-art (PianoBART) by over 6%.
- Token-Level Tasks: While it performed excellently in Melody Extraction (92.68%), it slightly trailed PianoBART in Velocity Prediction. This is likely due to PianoBART’s auto-regressive decoder structure, which is naturally suited for predicting specific token attributes like velocity.
Conclusion
Adversarial-MidiBERT demonstrates that by intelligently selecting which tokens to mask, models can be forced to learn structural musical logic rather than dataset biases. While the model is computationally intensive—requiring significant GPU memory—its superior performance in sequence-level classification tasks sets a new benchmark for symbolic music understanding. Future work may explore applying this adversarial masking approach to music generation and broader NLP tasks to mitigate social biases in text models.
Summary updated