TL;DR
Single-encoder transformers trained to harmonize melodies often ignore the melody entirely, opting instead for the "easier" task of predicting chords from surrounding chords. This paper introduces a Full-to-Full (FF) training curriculum that keeps harmony tokens completely masked during early training phases, forcing the model to prioritize melody-to-harmony relationships. This simple shift dramatically improves harmonization quality and adaptability, especially when generating accompaniments for out-of-domain musical styles like jazz.
What Problem Does This Paper Address?
Melodic harmonization—generating a sequence of chords to accompany a given melody—is a fundamental task in computational music generation. Recently, researchers have adopted single-encoder transformer architectures (similar to BERT) for this task. In these models, the melody is fed into the first half of the encoder, and the harmony tokens are placed in the second half, where they are iteratively unmasked and predicted.
Ideally, the model should use cross-attention (looking at the melody to choose a chord) alongside self-attention (looking at surrounding chords for progression structure).
However, the authors discovered a major flaw in current diffusion-inspired training methods (like random masking or midpoint doubling): they introduce partially visible harmony context too early in training. Because chord-to-chord transitions are much more direct and easier for the network to learn than abstract melody-to-chord relationships, the model takes a cognitive "shortcut." It learns to rely almost exclusively on self-attention, leaving the cross-attention pathways weak and underutilized. As a result, when faced with unique or unfamiliar melodies, the model fails to adapt its harmony to the actual notes being played.
Methods
To break this shortcut behavior, the authors propose the Full-to-Full (FF) training curriculum.
Instead of randomly varying the amount of masked harmony throughout all of training, the FF curriculum strictly controls the masking schedule based on the training epoch:
- Early Training: The harmony sequence is kept 100% masked. The model is forced to predict chords using only the melody, establishing strong, foundational cross-attention pathways.
- Late Training: The curriculum progressively unmasks more of the harmony sequence using a polynomial schedule (with an exponent of 5, allocating roughly the first half of training to the fully masked regime). This gradually introduces the model to self-attention mechanics for fine-grained reconstruction.
Additionally, the authors experimented with structural representations, opting to intertwine metric information directly into the token sequences using special <bar> tokens rather than providing time signatures as an external conditioning vector. They also evaluated different temporal quantizations (quarter-note vs. sixteenth-note) and melody representations.
Datasets
The models were trained and evaluated across three distinct datasets:
- HookTheory Dataset: A large collection of pop/rock music (15,440 MIDI pieces). This served as the primary training set and the benchmark for in-domain evaluation.
- Curated Jazz Standards: A newly curated evaluation dataset consisting of 650 jazz lead sheets. This served as a challenging out-of-domain test bed to see if the models could generalize their harmonization skills to a completely different genre.
- Synthetic Diagnostic Dataset: An artificial dataset of 1,000 training and 100 test pieces where chords were strictly determined by the melody note with zero chord-to-chord correlation, used specifically to isolate and visualize cross-attention behavior.
Key Insights and Ideas
- The "Shortcut" Visualized: Using their synthetic dataset, the authors visualized the attention maps of prior training methods. As shown below, standard methods completely missed the diagonal cross-attention pattern required to map melody to harmony, whereas the FF curriculum captured it perfectly.
- Less is More in Representation: Counterintuitively, simpler representations yielded better results for the FF curriculum. Quarter-note quantization outperformed sixteenth-note quantization, and pitch-class only (chroma) piano rolls generally beat full-range pitch representations.
- Structural Integration Matters: Embedding bar-line markers directly into the melody matrix and harmony token stream provided better structural coherence than treating time signatures as global metadata.
Key Results
The authors evaluated the models using a comprehensive suite of music-theoretic metrics measuring chord progression entropy, melody-harmony alignment (consonance), and rhythmic coherence.
- In-Domain Success: On the HookTheory test set, the FF curriculum outperformed the Midpoint Doubling (MD) and Random 10% (R10%) baselines across nearly all metrics.
- Out-of-Domain Dominance: The true power of the FF curriculum was revealed in the jazz evaluation. Because jazz utilizes a much wider and more complex vocabulary of chords than pop music, models relying purely on memorized chord patterns failed. The FF-trained models, thanks to their robust melody conditioning, achieved substantially lower mean absolute errors in Chord Histogram Entropy (CHE) and Chord Coverage (CC), proving they could successfully adapt their harmonic choices to novel melodic cues.
- Inference Flexibility: The FF curriculum remained highly effective even when paired with faster, more efficient inference-time unmasking strategies (like
uMDanduR10%), which require significantly fewer model calls than standard sequential decoding.
Limitations and Future Work
While the FF curriculum proves highly effective, the authors note several areas for improvement:
- Minimal Architecture: The study intentionally used a basic single-encoder transformer to isolate the effects of the curriculum. Future work will test this method on richer, more expressive model architectures.
- Hyperparameter Tuning: The polynomial masking schedule (specifically the exponent of 5) was chosen empirically but not exhaustively optimized.
- Perceptual Evaluation: The paper relies entirely on objective, quantitative musical metrics. The authors acknowledge the need for qualitative listening studies to validate how human listeners perceive the quality of the generated harmonies.
Summary updated