Voice-Level Counterfactual Baselines for Reinforcement Learning in Polyphonic Music

When a model writes four-part harmony, each of the four voices (soprano, alto, tenor, bass) behaves like a separate player, but the critic hears only one combined score. Fine-tuning such a model with reinforcement learning against a non-differentiable judge of the whole piece hits a familiar problem. A bad chorale might be bad because of one clumsy tenor phrase, yet every note in every voice gets the same blame. We propose to give each voice its own learning signal without training a value network. For a sampled chorale, we hold three voices fixed, redraw one phrase of the fourth voice several times from the model itself, and re-score each version. The gap between the real phrase's score and the average score of its redraws becomes that voice's advantage, meaning how much better than expected that choice was.

This combines two ideas that have so far lived apart. From cooperative multi-agent reinforcement learning it takes the counterfactual "what if only this agent had acted differently" baseline of Counterfactual Multi-Agent (COMA) Policy Gradients. From language-model alignment it takes the critic-free, sample-based baseline of Back to Basics: Revisiting REINFORCE-Style Optimization for Learning from Human Feedback in LLMs. It works in polyphonic music, a setting where generating voices that can be resampled one at a time is already standard practice, as in DeepBach: a Steerable Model for Bach Chorales Generation. The bet is that this per-voice signal reduces gradient noise more per unit of compute than simply drawing more whole chorales.

Core Claim

Our central claim concerns black-box rewards on a multi-voice piece that do not split into per-voice terms. Examples are a stylistic grading function, a parallel-fifths penalty, or a compression-based coherence score. For such rewards, a Monte Carlo counterfactual baseline computed per voice and per phrase gives a policy gradient that is unbiased under a stated sampling condition. At an equal budget of reward evaluations, it has lower variance than sequence-level leave-one-out baselines. We expect this to show up as faster, more stable fine-tuning of a chorale generator, and as resistance to the "lazy voice" failure, where one part stops improving because the others carry the score.

Here is the condition. We use a generator that writes the chorale phrase by phrase. Within a phrase, the lower voices are sampled in parallel, each conditioned only on the shared history $h_m$: all earlier phrases plus the given soprano. Let $R$ be the global reward, $u^a_m$ voice $a$'s notes in phrase $m$, and $u^{-a}_m$ the other voices' notes in that phrase. The advantage is

$$A^a_m = R(\tau) - \frac{1}{k}\sum_{j=1}^{k} R\big(\tau[u^a_m \leftarrow \tilde u^{a,j}_m,\ \text{later phrases regenerated}]\big),$$

where each replacement $\tilde u^{a,j}_m$ is drawn fresh from $\pi_a(\cdot \mid h_m)$. The baseline depends only on $h_m$ and $u^{-a}_m$, which are independent of voice $a$'s choice given $h_m$. This is the same argument that makes COMA's baseline unbiased, except that the expectation is estimated by sampling rather than by a learned critic. We also test a cheap variant that keeps later phrases frozen instead of regenerating them. That variant is biased, because later phrases were conditioned on the original $u^a_m$. We measure how large the bias is rather than assume it away.

Where the Pieces Come From

The multi-agent framing fixes the estimator. COMA subtracts a counterfactual baseline from a centralized learned critic $Q(s,\mathbf{u})$. That critic is the source of the scalability problems and training lag the research file notes. Local Advantage Networks for Cooperative Multi-Agent Reinforcement Learning and LIIR: Learning Individual Intrinsic Reward in Multi-Agent Reinforcement Learning likewise rely on a learned centralized value function or meta-learned intrinsic rewards. We keep COMA's counterfactual logic, drop the critic, and accept extra reward evaluations as the price.

All learning is Local is motivating evidence. It shows that teammates' actions can swamp an individual's reward signal: the global reward ranged from −10 to 250 when the true maximum was 20. Its Kalman-filter remedy assumes additive background noise, and harmonic interactions between voices are not additive.

The variance-reduction direction supplies the baseline. RLOO's leave-one-out mean over $k$ completions is unbiased and tracks the current policy. The file also identifies its limit: it treats a whole completion as one bandit action, and gains plateau between $k=2$ and $k=4$. Our proposal spends the extra samples differently, on targeted single-voice resamples instead of more whole pieces.

The music direction supplies both the setting and the evidence of need. DeepBach shows that per-voice conditional models of chorales are practical, but it trains only by supervised pseudolikelihood. RL-Duet shows that reinforcement learning escapes the maximum-likelihood "boringness trap", the collapse in pitch variety per bar. It does so with an actor-critic learner, generalized advantage estimation, and only one machine voice, so cross-voice credit never arises. MusicRL uses single-trajectory REINFORCE on audio and has no notion of separate voices.

The incomputability direction acts as a constraint on reward design, not as the main mechanism. The ideal measure of a chorale's structural coherence would be algorithmic. One example is how much shorter the voices are to describe jointly than separately, an algorithmic mutual information. That quantity is uncomputable, and every computable stand-in is a black box that does not split per voice. Bridging Kolmogorov Complexity and Deep Learning shows that even principled description-length objectives fail under gradient training, reaching 60.4% out-of-distribution parity accuracy against 100% for a hand-built network. That is a reason to treat such scores as rewards to be queried, not losses to be differentiated. Our estimator needs only queries. We therefore test it on two reward families: a stylistic grade adapted from Bach or Mock?, and a compression-based coherence term. For the latter, we take a frozen Bach-trained model's codelength of each voice given the others and of later phrases given earlier ones. This term targets the missing long-range structure noted for DeepBach and multitrack VAEs. Compression rewards are known to favor repetition, so this term always enters alongside the style grade, and we monitor pitch count per bar.

Research Program

We first pretrain a phrase-parallel harmonization model on the DeepBach corpus: 389 chorales, expanded by transposition to 2,503. Given a soprano, the model generates alto, tenor and bass. Phrase boundaries come from fermatas. The model is in effect DeepBach's per-voice architecture restricted so that, within a phrase, voices condition only on the shared history. This keeps exact log-probabilities and the independence needed for an unbiased baseline. We check that this restriction costs little likelihood relative to an unrestricted interleaved model, since a large loss would undercut the premise.

We then fine-tune with KL-regularized policy gradients, holding fixed the KL coefficient, number of prompts, and total reward evaluations per update. Only the advantage estimator changes. To keep cost bounded, each rollout draws a random subset of (voice, phrase) pairs for counterfactual resampling rather than all of them.

Alongside training curves, we directly measure the variance and signal-to-noise ratio of each voice's gradient. We also run a controlled synthetic check. There, the reward is a known sum of per-voice terms plus a known pairwise interaction term, so the true per-voice contribution is available, and we report how well each estimator's advantages correlate with it.

Baselines

The naive reference is the pretrained harmonization model with no reinforcement learning, sampled as usual. It shows whether any fine-tuning helps and anchors the boringness diagnostics. The second naive reference is plain REINFORCE with a running-mean baseline, the estimator family behind MusicRL.

The strongest critic-free competitor is sequence-level RLOO from Back to Basics. It draws $k$ full harmonizations per soprano and uses the leave-one-out mean. It is the strongest because it is unbiased, needs no critic, and is the method our proposal most directly claims to beat. We run it at the same budget of reward evaluations and generated tokens as our method, raising $k$ to whatever count that budget allows, and tune both with the same hyperparameter-search budget. No reported result for RLOO on Bach chorales was found on Lacuna. On TL;DR and Anthropic HH, the file reports only relative findings: RLOO with $k=4$ beat PPO, and $k=2$ matched RAFT with $k=4$. It gives no absolute numbers.

The strongest critic-based competitor is a COMA-style learner with a centralized critic over the three lower voices. We also include an RL-Duet-style actor-critic with generalized advantage estimation, given equal parameter count and wall-clock budget. For the two-voice duet setting, RL-Duet reports that 58.42% of 125 listeners preferred it over its maximum-likelihood baseline, on its split of 327 training chorales and 460 test duet pairs. We will reproduce that split as a sanity check on our estimator with a single machine voice. Since our method reduces to RLOO when there is one agent, matching RL-Duet there is the bar, not beating it.

Two ablations isolate the key ingredient. The first, a random-voice placebo, replaces the targeted counterfactual with resamples of a randomly chosen voice whose advantage is then credited to every voice. This separates the effect of per-voice attribution from the effect of extra reward queries. The second compares frozen-future against regenerated-future counterfactuals to measure the bias introduced by the cheap variant.

Our method beats sequence-level RLOO if, at matched budget and across five seeds, three things hold together. It reaches a given reward level in measurably fewer updates. It shows lower per-voice gradient variance. And it achieves a better held-out style grade without lower pitch diversity.

Why not just…?

Why not just raise $k$ in sequence-level RLOO? This is the most serious threat. If the reward is close to additive across voices, extra whole-piece samples may reduce variance as well as targeted resamples do. The file reports that RLOO gains plateau between $k=2$ and $k=4$, which suggests whole-piece samples have diminishing returns, but that was observed in text, not music. The matched-budget comparison settles this directly. The synthetic reward with a tunable interaction term predicts where each estimator should win: as the interaction weight goes to zero, the two should converge. If they do not separate on the real chorale rewards either, we will report that per-voice credit is unnecessary for this domain.

Why not just train a centralized critic, as COMA or RL-Duet do? A critic makes counterfactuals free at evaluation time. However, it must learn a joint function over three voices, each with its own pitch-and-hold vocabulary, and the COMA paper itself flags scaling and lag in large joint action spaces. The COMA and RL-Duet-style baselines are run at matched compute. Our prediction is specific: the critic-based estimators will lag most when the reward changes character, as in the switch from style grade to compression reward, because the critic must re-learn while sample-based baselines adapt immediately.

Why not just give each voice its own hand-designed reward? Per-voice rewards, such as RL-Duet's horizontal melodic view, capture melody within a line. The faults that matter most in chorales are vertical: parallel fifths, voice crossing, and doubled leading tones. These belong to pairs of voices, not to any single one. Independent per-voice rewards either ignore these faults or must assign them arbitrarily. We include an independent-learners baseline with factored rewards and expect it to win on melodic smoothness but lose on the parallel-motion counts from the Bach or Mock features.

Why not just skip training and do best-of-n or rejection sampling against the reward at generation time? Best-of-n is a strong, honest competitor whenever generation-time compute is cheap. We compare against best-of-n at matched total reward evaluations, counting training cost amortized over test chorales. If best-of-n matches the fine-tuned model's quality, the contribution narrows to training efficiency, and we will say so.

Proposed Experiments

The main experiment is soprano-conditioned harmonization on the DeepBach chorale corpus with transposition, using a held-out set of sopranos. We report reward curves, per-voice gradient variance, the adapted Bach or Mock grade, and parallel-fifth and octave rates. We also report pitch count per bar, the boringness signal identified by RL-Duet.

The external yardstick is the grading function itself. It separated real Bach from machine chorales with 92.6% paired accuracy, against 86.7% for human experts. A model whose outputs push this discriminator's accuracy toward chance has closed real stylistic distance. Re-scoring an existing system is a natural first check, since DeepBach was judged to be Bach around 50% of the time in its 1,272-participant listening test. We will run a smaller listening test of the same "Bach or computer" form between our method and the best baseline.

The decisive checks are four. On the synthetic interaction reward, our advantages should track the true per-voice contributions better than RLOO's shared advantage, and this gap should grow with the interaction weight. In a lazy-voice test, we freeze the tenor at its pretrained policy and check whether the alto and bass still improve. Under a shared advantage, the frozen voice's noise should leak into their gradients. Under counterfactual credit, it should not. In the bias check, the frozen-future and regenerated-future estimators should reach similar final quality. If they do not, only the more expensive unbiased variant is defensible. Finally, every result is repeated under the compression-based coherence reward, to confirm that the estimator's benefit holds for the uncomputable-in-principle, non-additive rewards that motivate it, and does not depend on the hand-crafted style grade.