Abstract
MaskBeat is a non-autoregressive transformer model designed to generate high-quality, loopable drum patterns. Traditional autoregressive (AR) models often struggle with the global consistency required for percussion, leading to "temporal drift" and a loss of rhythmic "pocket." MaskBeat addresses these challenges by treating drum generation as a masked token prediction problem, utilizing bidirectional attention and iterative refinement. By incorporating specialized musical loss functions—Instrument Dependency Loss and Groove Loss—the model ensures both rhythmic coherence and adherence to musical conventions. Experimental results demonstrate that MaskBeat significantly outperforms AR baselines in beat strength and pattern consistency.
Introduction
Drums serve as the foundational "heartbeat" of a musical track, requiring strict global consistency and complex, simultaneous relationships between instruments. Most current AI music generation relies on autoregressive transformers, which predict music sequentially. While effective for melody, this approach often fails for drums because it lacks the bidirectional context necessary to maintain a consistent groove over time. Furthermore, sequential models are difficult to edit; changing a single early hit can invalidate the entire subsequent sequence.
Methods
MaskBeat is built upon the MaskGIT architecture, shifting from sequential "next-hit" prediction to a "masked token prediction" paradigm. The model views an entire 2-bar (32-step) grid simultaneously and iteratively fills in missing components.
Architectural Innovations
The model employs a Dual Embedding strategy, using a learned vector for the mask token and a linear projection for the 9-dimensional drum timesteps. To distinguish between beat positions within a loop, a Fixed Timing Signal (a repeating sine/cosine pattern) is integrated. During training, the model uses Alternating Masking, switching between masking entire timesteps to learn the overall groove and masking individual instruments to learn fine-grained dependencies.
Specialized Musical Losses
To move beyond simple pattern matching, the authors introduced three specialized loss functions:
- Instrument Dependency Loss (DL): Penalizes unmusical combinations (e.g., simultaneous open and closed hi-hats) and encourages standard conventions like backbeat snares.
- Groove Loss (GL): Encourages emphasis on musically significant beat positions and maintains consistency between measures.
- Focal Loss (FL): Addresses the sparsity of drum grids by down-weighting easy-to-predict silent cells, forcing the model to focus on active hits.
Datasets
The model was trained on a curated dataset of 30,000 professional drum loops. This includes 18,000 loops from Groove Monkee (covering diverse genres like rock, jazz, and funk) and 12,000 tracks extracted from the Lakh MIDI dataset. Preprocessing involved "swing-preserving quantization" to maintain human feel while aligning to a 16th-note grid. Autocorrelation was used to identify the most repetitive, "loopable" 2-bar segments, ensuring the training data consisted of high-quality loops rather than transitional fills.
Results
MaskBeat was evaluated against an Autoregressive baseline and standard MaskGIT implementations using three primary metrics: Beat Strength, Pattern Repetition, and Instrument Balance.
As shown in the results table, MaskBeat achieved a Beat Strength of 0.847, significantly higher than the AR baseline (0.723), indicating superior adherence to musical meter. It also excelled in Pattern Repetition (0.692), proving its ability to maintain a consistent groove across measures. Ablation studies confirmed that the custom Groove Loss (GL) and Dependency Loss (DL) provided measurable performance gains over the base architecture. Furthermore, Intersection-over-Union (IoU) tests confirmed the model's novelty, with a median similarity to the training set of only 0.31, suggesting it generates original patterns rather than memorizing data.
Conclusion and Future Work
MaskBeat demonstrates that bidirectional context is essential for high-quality drum generation. By encoding human drumming constraints directly into the loss function and utilizing iterative refinement, the model provides a powerful tool for both generation and interactive editing. Future work will focus on incorporating variable velocity for more expressive performances, extending the model to support variable loop lengths, and expanding the instrument palette beyond the standard 9-piece kit.
Summary updated