Introduction
While Transformer-based models have demonstrated remarkable success in generating locally coherent musical snippets, they frequently struggle to maintain a central motif across a full-length composition. In standard autoregressive generation, models often succumb to "exposure bias," where small errors accumulate over time, leading to either monotonous repetition or a total loss of structural integrity. This paper introduces Yin-Yang, a three-part neural framework designed to bridge the gap between local note-level coherence and global thematic development. By combining music theory-inspired transformations with a generator-refiner-selector architecture, Yin-Yang produces music that is both structured and creatively diverse.
The Challenge of Global Form
In AI music generation, "local coherence"—the logical flow from one note to the next—is largely considered a solved problem. However, achieving "global form" (e.g., an ABACA rondo structure) remains an open challenge. Standard models generate music note-by-note without an explicit plan for thematic return or development. Consequently, long-form outputs often exhibit two failure modes: they either get trapped in endless loops or wander into chaotic, structureless noise. The Yin-Yang framework addresses this by explicitly modeling how a musical idea, or motif, can be transformed and developed over time without losing its original identity.
The Yin-Yang Framework
To move beyond simple autoregression, the authors decompose the generation process into three distinct transformer-based modules:
- Phrase Generator (PG): An autoregressive encoder-decoder model that generates initial musical phrases based on the stylistic characteristics of the training data.
- Phrase Refiner (PR): The core innovation of the framework. The PR is trained using a self-supervised "corruption-refinement" strategy. During training, it learns to reconstruct a clean phrase from a version that has been intentionally corrupted (e.g., masked notes or shuffled pitches). During inference, the system applies classic Western music theory transformations—such as retrograde (playing the motif backward), inversion (flipping intervals), or fragmentation—to a motif. The PR then "refines" these rigid transformations so they fit naturally within the current musical context.
- Phrase Selector (PS): An encoder-only model that acts as a quality filter. It evaluates a pool of candidate phrases and selects the one that best maintains consistency and homogeneity within a specific musical section.
Methodology and Evaluation
The framework was trained and evaluated on three monophonic folk song datasets: MTC-FS-INST 2.0, MTC-ANN-2.0.1, and the ESSEN Folksong Collections. These datasets were chosen because folk songs typically feature clear, concise motifs. By using these as a foundation, the authors aimed to prove that Yin-Yang could extrapolate and develop ideas into sequences that exceed the complexity of the training data.
Rethinking Metrics
The authors argue that standard metrics for musical structure, such as compression ratios, are easily manipulated; a model that repeats a single bar indefinitely would achieve a perfect score despite being musically uninteresting. To provide a more nuanced evaluation, they introduce the Structural Derivation (SD) metric. SD measures how smoothly a piece evolves from its initial motif. This is paired with the Vendi score, which measures diversity, to ensure the model is developing the motif rather than merely repeating it.
Key Results
Yin-Yang (YY) was compared against two state-of-the-art baselines: the Music Transformer (MT) and the Compound Word Transformer (CP).
- Objective Performance: The CP baseline was found to be overly chaotic (low SD of 0.48, high Vendi of 2.02), while the MT baseline was overly repetitive (high SD of 0.67, low Vendi of 1.54). Yin-Yang successfully occupied the middle ground, balancing thematic adherence with creative variation (SD of 0.63, Vendi of 1.79).
- Subjective Listening Tests: In a Mean Opinion Score (MOS) test involving 22 participants, Yin-Yang significantly outperformed the baselines. It achieved a score of 3.52 for Coherence (compared to 2.73 for MT) and 3.59 for Structureness (compared to 2.71 for MT).
- Ablation Studies: Removing the Phrase Selector (YYA) led to lower subjective scores, confirming that the selector is vital for maintaining thematic homogeneity within sections.
Conclusion and Future Work
The Yin-Yang framework demonstrates that bridging symbolic music theory rules with neural refinement allows for more interpretable and structured music generation. While currently limited to monophonic melodies, the framework provides a robust foundation for future work. The authors plan to extend this approach to polyphonic music and explore conditioning the models on higher-level concepts such as musical tension, chord progressions, and pitch contours to provide even greater user controllability.
Summary updated