Which Voice Was Wrong? Per-Voice Counterfactual Credit for Tuning Music Generators on Few Judgments

When a listener or an automatic judge rates a four-part chorale or a three-track pop arrangement, the rating is one number for the whole piece. A generator fine-tuned on that number cannot tell whether the bass line, the inner voice, or the melody earned the praise or caused the clash. This matters most when judgments are scarce, which in symbolic music they usually are. Clean scores are limited, structural and harmonic annotation is expensive, and human ratings cost far more than either. We propose to treat each voice of a multi-track generator as a cooperating agent. A learned critic that sees the whole score then asks, for every note: had this voice chosen differently here, with every other note held fixed, how much better or worse would the piece have scored? Subtracting that counterfactual average from the observed score gives each voice its own learning signal from the same single rating.

The central bet is about label efficiency. Per-voice counterfactual credit should extract more improvement from each scarce piece-level judgment than the standard practice of applying one global advantage to every token. It should also stop a failure we expect from global-reward fine-tuning, in which accompaniment or inner voices collapse into safe, static material while one voice carries the piece. Both claims can be tested on the Bach chorale corpus and POP909 with fixed judgment budgets. We can also check directly whether the critic blames the right voice when we know which voice was wrong.

Core Claim

The mechanism is borrowed from cooperative multi-agent reinforcement learning (RL), where several agents share one team reward. Counterfactual Multi-Agent (COMA) Policy Gradients gives each agent an advantage computed by a centralized critic. The critic's value for the joint action is compared against a baseline that averages over that agent's own alternative actions while the other agents' actions stay fixed. Musical voices fit this setup unusually well. At each time step a voice picks from a small vocabulary of about 60 pitches plus "hold" and "rest". The marginalization that is expensive in large action spaces is therefore one softmax-weighted sum over a vector the critic can output in a single pass. For voice $a$ at step $t$, with $x$ the full generated score, $x_{t}^{a}$ the token actually chosen, and $x^{\setminus(t,a)}$ every other token in the piece,

$$A_{t}^{a} = Q\big(x^{\setminus(t,a)}, x_{t}^{a}\big) - \sum_{v} \pi^{a}\big(v \mid h_{t}^{a}\big)\, Q\big(x^{\setminus(t,a)}, v\big).$$

Here $Q$ is the critic's predicted piece-level score, $v$ ranges over voice $a$'s vocabulary, and $\pi^{a}(\cdot \mid h_{t}^{a})$ is the generator's probability for voice $a$ given the history it conditioned on. The policy gradient for each token is weighted by $A_{t}^{a}$ instead of a single advantage shared by the whole piece.

The critic sees the whole piece, including future notes of other voices. The counterfactual is therefore a hindsight question: did this note help, given everything else that was actually written? We think that is the right question for attributing a cadence or a parallel fifth.

The critic's shape echoes DeepBach, which models chorales as a dependency network. In DeepBach each voice's note is predicted from bidirectional temporal context and simultaneous context in the other voices. We reuse that "predict this slot from everything around it" architecture. Its output head scores the piece under every alternative token in place of a pitch distribution. To keep the critic trainable from a few thousand ratings, we initialize it from a bidirectional masked model pretrained without labels on symbolic corpora and train only light adapters, as described in the Research Program. Two lines of prior work motivate that choice. One Fits All (FPT) found that a mostly frozen pretrained backbone resists overfitting in 5–10% few-shot time-series regimes. The label-efficiency results for ECG (Self-supervised representation learning from 12-lead ECG data) and radiographs (Masked Record Modeling) found that pretraining aligned with the signal's own structure is what makes small labeled heads work.

Relation to Prior Work

The nearest work splits into three groups, and none does what we propose.

ComposerX already casts composition as multiple agents (melody, harmony, instrument, reviewer) built on GPT-4. It is training-free, and its reviewer gives text critique. No weights are updated and no quantitative attribution is made. Its authors also report out-of-range notes and poor inter-voice alignment, which are exactly the failures that per-voice credit should target.

MuseBarControl uses a "counterfactual loss" in a different sense. It falsifies the conditioning chord and penalizes a single model whose likelihood does not drop. That is a regularizer on control tokens. It does not decompose a global reward across voices.

Generating High-quality Symbolic Music Using Fine-grained Discriminators splits feedback into fixed melody and rhythm discriminators. The split is designed by hand and runs along musical dimensions, not along voices, and it is not counterfactual.

Among credit-assignment methods, LIIR learns per-agent intrinsic rewards through meta-gradients. That would be costly over hundreds of note steps. Local Advantage Networks avoid the restrictive monotonic value mixing used by QMIX, which suggests a voice should be allowed to "sacrifice", for example by holding a pedal note so that another voice can resolve. We adopt COMA's estimator because the action space is small. We include a LAN-style per-voice dueling head only as a secondary variant. Shapley-based reallocation (Stable and Efficient Shapley Value-Based Reward Reallocation) would need a score for partial ensembles, and "the piece with the alto removed" is not a natural object to rate. On Blame Attribution for Accountable Multi-Agent Sequential Decision Making also warns that exact Shapley attribution can destabilize incentives under uncertainty. We therefore do not pursue it.

Two papers constrain the design. Efficient Fine-Grained Guidance argues that out-of-key errors decay very slowly with data and removes them by projection at sampling time. Hard constraints that can be checked by rule are therefore better handled by projection than by RL, and we do not claim otherwise. Our target is judgments that rules cannot express. MuPT shows that a monolithic model with bar-synchronized multi-track tokens works at 33.6B tokens. That is the opposite of our data regime, but it is also the representation we use for POP909.

Research Program

The generator is a standard autoregressive multi-track model on a 16th-note grid, using DeepBach's hold symbol. Inside each time step the voices emit in a fixed order: bass, tenor, alto, soprano for chorales, and piano, bridge, melody for POP909. Each voice has its own output head. This choice is deliberate. The generator is identical to an ordinary single-agent model, so the "agents" are voice heads and the only thing that changes between our method and single-agent RL fine-tuning is the advantage estimator. Holding later voices fixed while varying an earlier one is slightly off-policy, as in COMA, and we measure its effect in an ablation that randomizes the within-step order.

We pretrain the generator by maximum likelihood on transposed Bach chorales and on POP909, with LMD-matched MIDI as extra unlabeled pretraining data for the critic backbone. Fine-tuning then runs under a strict judgment budget $N$ of piece-level scores, swept over 250, 1,000, 4,000 and 16,000. The critic is trained by regressing the head of the token actually generated onto the observed score. Generalization to alternative tokens comes only from the pretrained backbone, and whether that generalization is good enough is the main empirical risk.

We use three kinds of judge.

The first is a composite rule judge whose per-voice decomposition we know but hide from the learner. For chorales it counts parallel fifths and octaves, voice crossings, range violations, and unresolved leading tones. For POP909 it measures each track's chord-tone agreement with the dataset's annotated chords. Every term is summed into one scalar.

The second is a learned style discriminator trained to separate real from generated pieces. It has no known decomposition and stands in for aesthetic judgment.

The third is a small human panel with a fixed rating budget, used only for the final comparison.

Baselines

The naive reference point is the maximum-likelihood generator with no fine-tuning. Every method must beat it on judge score without losing the musical statistics used by the fine-grained discriminator paper: pitch-class entropy, scale consistency, and groove consistency.

The strongest competitor is single-agent policy-gradient fine-tuning. It uses PPO-style clipped updates on the same generator, the same sampled pieces, the same $N$ judgments, and the same tuning budget, with a learned scalar value baseline shared by all tokens. Every method gets an equal hyperparameter search of 20 configurations. This is how one would ordinarily RL-tune a music model. I found no reported result on Lacuna for RL fine-tuning of symbolic music generators against a piece-level judge. We will establish this baseline ourselves, and beating it means a higher judge score at equal $N$, or equal score with at least 2x fewer judgments, across three seeds.

The ablation that isolates our key ingredient keeps the same pretrained critic but replaces the per-voice counterfactual baseline with the critic's average over the whole joint distribution. That gives one global advantage per piece position, with no marginalization over a single voice. If this matches our method, the gain came from a better critic, not from credit assignment.

A third baseline is best-of-n filtering followed by supervised fine-tuning on the highest-rated pieces, using the same $N$.

A fourth spends judgments directly on attribution. It resamples a single voice in a bar and re-queries the judge, which gives a Monte-Carlo difference reward. It is compared at equal total judge queries.

For the rule judge we also report reference points from the literature, measured under their own protocols. MuseBarControl reports 78.33% bar-level chord accuracy on POP909, against 65.27% for standard bar-level fine-tuning. Fine-Grained Guidance reports 0.0% out-of-key notes and 0.485 direct chord accuracy. We expect projection to win on those rule-checkable metrics, and that is not the comparison our claim rests on.

Why not just…?

Why not just fine-tune the whole generator with ordinary single-agent RL? This is the real threat. With three or four voices, the variance that a global advantage adds may be small enough that per-voice credit buys nothing. The experiment settles it directly, because the two methods differ only in the advantage estimator. We will report judgment-efficiency curves and a lazy-voice measure: per-voice pitch entropy and note density relative to the corpus. Our specific prediction is that global-advantage training reduces inner-voice or accompaniment activity as reward rises, and per-voice credit does not. If neither prediction holds, the idea fails.

Why not just encode the constraints as rules and project, as FGG and MeloForm do? For anything a rule can check, projection is better. FGG reaches 0.0% out-of-key notes with no learning at all. The rule judge is in this proposal only because its known decomposition lets us score attribution. The claim concerns the style discriminator and human judgments. MeloForm needed a neural stage on top of its expert skeleton for exactly these qualities.

Why not just prompt LLM agents, as ComposerX does? ComposerX cannot learn from ratings, and its reported range and alignment errors are the voice-level failures we target. We will include it in the human-panel comparison on chorale and pop prompts. Its quoted cost is about $0.80 per song, which makes that comparison affordable.

Why not just filter the best samples and fine-tune on them? Best-of-n filtering is cheap and stable, and at small $N$ it may win. It discards everything learned from low-rated pieces, and it cannot assign blame inside a piece. The equal-budget comparison will show where, if anywhere, it crosses over with our method.

Decisive Checks

The first and cheapest check comes before any policy training. We take real chorales, inject a fault such as parallel fifths or a range violation into one known voice in one bar, and ask whether the critic's per-voice counterfactual advantage ranks the faulty voice-bar as most blamed. We report this attribution accuracy (AUROC) as a function of $N$. If the critic cannot locate faults at $N=1{,}000$, its counterfactual baselines are noise and the method should fail. We would then stop, or move to a larger pretrained backbone.

The second check compares judgment-efficiency curves for our method, single-agent PPO, and the global-advantage ablation under the rule judge and the style judge. We report median judgments to reach 90% of the best final score.

The third check is the lazy-voice measure described above.

The fourth is a blind human comparison at a fixed rating budget against the maximum-likelihood model, PPO, and ComposerX. DeepBach's roughly 50% Bach-indistinguishability gives a rough ceiling for chorales.

As a small check on generality, we run the fault-attribution test on multivariate ETT series. A channel-specific distortion is injected and a scalar quality score serves as the judge. This asks whether per-channel counterfactual credit transfers to time-series generators that are rated as a whole. We treat it only as a feasibility probe.