When Valid Decisions Are Not Enough: Evaluating Structural Constraints in Knowledge-Guided Generative Systems
Authors: Josef Pavlíček, Petra Pavlíčková, Martin Molhanec
Organizations: Department of Software Engineering, Faculty of Information Technology, Czech Technical University in Prague, Czech Republic · Faculty of Electrical Engineering, Czech Technical University in Prague, Prague 6, Czech Republic
Knowledge-guided generative systems use explicit domain constraints to improve decision consistency and alignment with human-created solutions. However, locally valid decisions do not necessarily preserve contextual relationships in human decision-making. This paper examines when structural constraints improve or degrade agreement with human reference solutions. We introduce HARMONIX, an experimental framework using automated musical harmonization as a controlled testbed for knowledge-guided decision-making. Four configurations share the same Viterbi-based optimization mechanism: a baseline, repetition constraints, functional constraints, and their combination. Experiments cover 19,745 records and 143,634 motif pairs across training and validation partitions. Combined constraints improve reference root-interval agreement by approximately five percentage points in stable structural contexts but reduce it by nearly nine percentage points in contexts involving transposition tracking. These opposing effects are consistent across both partitions, while overall exact chord agreement changes only marginally. Contexts are identified retrospectively using reference annotations; no adaptive constraint-selection mechanism is evaluated. The findings demonstrate that interpretable constraints can introduce systematic context-specific failures concealed by aggregate accuracy metrics. They highlight the need to evaluate relationships between decisions and the contextual applicability of constraints in knowledge-guided generative systems.
Figures & tables
Figure 1: Architecture of the HARMONIX experimental framework. Four structural configurations share the same iterative optimization procedure. Human reference harmonizations are used only during post-generation evaluation.
Configuration
λR
λF
Baseline
0
0
R
0.12
0
F
0
0.06
RF
0.12
0.06
Table 1: Experimental configurations of HARMONIX.
TRAIN
VALID
Configuration
Agreement
Δ (pp)
Agreement
Δ (pp)
B (baseline)
18.3225
–
18.9664
–
R (repetition)
18.4104
+0.0879
19.0713
+0.1049
F (functional)
18.3231
+0.0006
19.0301
+0.0636
RF (combined)
18.3812
+0.0587
19.0347
+0.0683
Table 2: Mean exact chord agreement across records (%) and changes relative to baseline B (percentage points, pp).
Context
R
F
RF
Untransposed, same root
+4.78
+3.87
+5.08
Untransposed, changed root
-1.44
-0.73
-1.52
Transposed, tracking
-8.08
-1.59
-8.80
Transposed, non-tracking
+3.95
+0.74
+4.13
Table 3: TRAIN: change in reference root-interval agreement relative to B (percentage points).
Context
R
F
RF
Untransposed, same root
+4.91
+3.88
+5.00
Untransposed, changed root
-0.95
-0.45
-0.99
Transposed, tracking
-8.93
-2.44
-8.93
Transposed, non-tracking
+3.46
+1.11
+4.18
Table 4: VALID: change in reference root-interval agreement relative to B (percentage points).
This paper presents the design and evaluation of a maintainable hybrid generative architecture for automated music harmony generation from melody. The proposed system combines quantum-inspired candidate exploration over overlapping melodic contexts with explicit rule-based optimization to balance generative flexibility and structural control. The architecture is evaluated using explicit and reproducible metrics covering structural coherence, functional agreement, harmonic similarity, and robustness. The results show that the proposed approach produces harmonizations that preserve tonal structure and cadential behavior while allowing multiple valid harmonic realizations. Furthermore, the optimization layer improves structural coherence, stability, and predictability without requiring a training corpus. The study demonstrates that transparent and controllable hybrid generative systems can be systematically designed and evaluated within the context of Information Systems Development.
Josef Pavlicek
Czech Technical University in Prague / Faculty of Information technology / Department of Software Engineering Prague/ Czech Republic
Automatic melody harmonization is often evaluated through individual compositions or data-driven corpus models. This study examines whether an explainable harmonic decision model developed for individual songs can be applied to independently collected human annotations without changing its rules. We evaluate a frozen Explainable Melody Harmonizer (EMH) on selected HookTheory excerpts containing aligned melody and chord annotations. EMH generates chord sequences from melody alone using explicit criteria for melodic compatibility, harmonic function, persistence, cadence, meter-aware segmentation, and Viterbi-like optimization. Human chords are withheld during generation and used only for post-hoc comparison. Nineteen excerpts yielded 439 evaluable harmonic segments. Exact chord agreement reached 20.50%, chord-root agreement 31.66%, and harmonic-function agreement 47.62%, with functions assessed relative to the key inferred by EMH. Decision-level analysis identified 203 segments (46.24%) where the human chord lay outside the model's candidate vocabulary and 146 (33.26%) where it was available but not selected. These findings distinguish representational limitations from differences in chord selection without treating the human reference as the only musically valid solution. The study demonstrates a reproducible, interpretable approach to corpus-based evaluation of harmonic decision-making.
Josef Pavlíček, Martin Pelikán
Faculty of Economics and Management, Czech University of Life Sciences in Prague, Prague 6, 165 00 Praha-Suchdol, Czech Republic
Language models can now generate symbolic music from natural-language instructions. However, existing models still struggle to satisfy multiple explicit musical constraints simultaneously. To systematically evaluate this capability, we introduce MusicConstraintBench, a benchmark of 2180 items spanning eight families of programmatically verifiable constraints. On this benchmark, Llama-3.1-70B satisfies 0.630 of single-constraint items but only 0.044 of four-constraint ones. To address this challenge, we propose MusicRLVR, which trains a language model with group relative policy optimisation (GRPO) on verifier rewards alone, needing no human annotation, reward model or music-domain supervised fine-tuning. MusicRLVR incorporates (1) a hard validation gate that rejects malformed scores, (2) graded per-family credit that, unlike a binary reward, separates partially correct outputs, and (3) an all-satisfied bonus for meeting every constraint at once. Extensive experiments show that, after 300 GRPO updates, MusicRLVR raises Qwen3-4B-Instruct-2507 from 0.160 to 0.807 on mixed constraints, outperforming Llama-3.1-70B, and generalises to unseen property combinations, out-of-range parameters and more constraints than any training prompt. The recipe transfers to Qwen3-8B, and neither trained model loses significant accuracy on general benchmarks.
Haoyue Liu, Xiaoying Tang
School of Science and Engineering, The Chinese University of Hong Kong, Shenzhen 518172, China · Shenzhen Future Network of Intelligence Institute (FNii-Shenzhen)