# Incorporating Structure and Chord Constraints in Symbolic Transformer-based Melodic Harmonization

arXiv: https://arxiv.org/abs/2512.07627 · HTML: https://mlsanity.com/paper/2512.07627/

## Key facts

- Cited by 2 papers in the map (data through 14 Oct 2026).
- Builds on 23 of its 41 references that are in the map.
- First posted on arXiv 8 Dec 2025.

## Builds on (most cited first, 23 of 23)

- [Attention Is All You Need](https://mlsanity.com/paper/1706.03762/) (2017)
- [BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension](https://mlsanity.com/paper/1910.13461/) (2019)
- [Lexically Constrained Decoding for Sequence Generation Using Grid Beam Search](https://mlsanity.com/paper/1704.07138/) (2017)
- [Fast Lexically Constrained Decoding with Dynamic Beam Allocation for Neural Machine Translation](https://mlsanity.com/paper/1804.06609/) (2018)
- [COLD Decoding: Energy-based Constrained Text Generation with Langevin Dynamics](https://mlsanity.com/paper/2202.11705/) (2022)
- [NeuroLogic A*esque Decoding: Constrained Text Generation with Lookahead Heuristics](https://mlsanity.com/paper/2112.08726/) (2021)
- [Enabling Language Models to Fill in the Blanks](https://mlsanity.com/paper/2005.05339/) (2020)
- [Gradient-Based Constrained Sampling from Language Models](https://mlsanity.com/paper/2205.12558/) (2022)
- [Controllable Text Generation for Large Language Models: A Survey](https://mlsanity.com/paper/2408.12599/) (2024)
- [Learning Interpretable Representation for Controllable Polyphonic Music Generation](https://mlsanity.com/paper/2008.07122/) (2020)
- [Parallel Refinements for Lexically Constrained Text Generation with BART](https://mlsanity.com/paper/2109.12487/) (2021)
- [Automatic Melody Harmonization with Triad Chords: A Comparative Study](https://mlsanity.com/paper/2001.02360/) (2020)
- [Directed Beam Search: Plug-and-Play Lexically Constrained Language Generation](https://mlsanity.com/paper/2012.15416/) (2020)
- [MelodyT5: A Unified Score-to-Score Transformer for Symbolic Music Processing](https://mlsanity.com/paper/2407.02277/) (2024)
- [SurpriseNet: Melody Harmonization Conditioning on User-controlled Surprise Contours](https://mlsanity.com/paper/2108.00378/) (2021)
- [Chord Generation from Symbolic Melody Using BLSTM Networks](https://mlsanity.com/paper/1712.01011/) (2017)
- [Melody Harmonization Using Orderless NADE, Chord Balancing, and Blocked Gibbs Sampling](https://mlsanity.com/paper/2010.13468/) (2020)
- [Generating Chord Progression from Melody with Flexible Harmonic Rhythm and Controllable Harmonic Density](https://mlsanity.com/paper/2112.11122/) (2021)
- [Emotion-Driven Melody Harmonization via Melodic Variation and Functional Representation](https://mlsanity.com/paper/2407.20176/) (2024)
- [ENCONTER: Entity Constrained Progressive Sequence Generation via Insertion-based Transformer](https://mlsanity.com/paper/2103.09548/) (2021)
- [Choir Transformer: Generating Polyphonic Music with Relative Attention on Transformer](https://mlsanity.com/paper/2308.02531/) (2023)
- [Emotion-Conditioned Melody Harmonization with Hierarchical Variational Autoencoder](https://mlsanity.com/paper/2306.03718/) (2023)
- [Steer-by-prior Editing of Symbolic Music Loops](https://mlsanity.com/paper/2408.02434/) (2024)

## Built on by (most cited first, 2 of 2)

- [LK Jam: System Architecture and Implementation of a Real-Time Human-AI Interactive Music Generation System using Role-Aware GRU](https://mlsanity.com/paper/2606.21018/) (2026)
- [Which Constraints Are Missing? Ask the Verifier: Graded Rewards for Constraint-Following Music Generation](https://mlsanity.com/paper/2609.23665/) (2026)

## Abstract (arXiv)

Transformer architectures offer significant advantages regarding the generation of symbolic music; their capabilities for incorporating user preferences toward what they generate is being studied under many aspects. This paper studies the inclusion of predefined chord constraints in melodic harmonization, i.e., where a desired chord at a specific location is provided along with the melody as inputs and the autoregressive transformer model needs to incorporate the chord in the harmonization that it generates. The peculiarities of involving such constraints is discussed and an algorithm is proposed for tackling this task. This algorithm is called B* and it combines aspects of beam search and A* along with backtracking to force pretrained transformers to satisfy the chord constraints, at the correct onset position within the correct bar. The algorithm is brute-force and has exponential complexity in the worst case; however, this paper is a first attempt to highlight the difficulties of the problem and proposes an algorithm that offers many possibilities for improvements since it accommodates the involvement of heuristics.
