MI-MIDI 2: From Observation to Control with Sparse Autoencoders in Text-to-MIDI Generation
Organizations: Institute of Computer Science, Warsaw University of Technology, Warsaw, Poland
Abstract
Sparse autoencoders (SAEs) can expose features of a generative model without predefined labels, but in language models the evidence used to interpret these features has proven an unreliable guide to which of them steer the output. Whether interpretations of SAE features predict control in music generators has not, to our knowledge, been tested. We develop an end-to-end protocol for discovering and evaluating SAE features in text-to-MIDI generation and apply it to text2midi and MIDI-LLM. The protocol characterizes features through correlations with musical metrics, shared instrument programs, and automated descriptions, each with its own control: note-density adjustment, matched inactive excerpts, and permutation calibration. It then tests candidates by intervention, measured directly in the generated MIDI against unmodified generation and a matched random direction, ranks them in screens, and confirms selected features on new prompts. Evidence that survives these controls points to features that steer the output. Descriptions exceed permutation controls for instrumentation, and a feature whose description names a synth-lead program introduces that program in a prespecified confirmation and in a replication on disjoint prompts and reappears in independently trained dictionaries. Features selected by density-adjusted correlations show a small positive shift of their target metric as a family, whereas features selected by raw correlations show none. An atlas provides MIDI, piano-roll, and audio examples for every feature of the targeted screen.
Figures & tables
| Model | Layer | Features | FVU | Dead (%) | Frequent (%) | Retained |
|---|---|---|---|---|---|---|
| text2midi | 2 | 6144 | 0.0311 | 2.18 | 53.22 | 2369 |
| text2midi | 8 | 6144 | 0.0747 | 0.63 | 55.79 | 2143 |
| text2midi | 13 | 6144 | 0.1750 | 0.42 | 63.17 | 1746 |
| text2midi | 16 | 6144 | 0.1568 | 0.16 | 61.12 | 2082 |
| MIDI-LLM | 2 | 8192 | 0.2493 | 2.42 | 22.66 | 3742 |
| MIDI-LLM | 7 | 8192 | 0.3672 | 0.31 | 21.02 | 4422 |
| Model | Layer | Eligible | Raw | Adj. | Raw | Adj. | Kept (%) |
|---|---|---|---|---|---|---|---|
| text2midi | 2 | 5092 | 3295 | 1146 | 1715 | 149 | 8.7 |
| text2midi | 8 | 4724 | 3321 | 1356 | 1773 | 221 | 12.5 |
| text2midi | 13 | 4854 | 3469 | 1358 | 1954 | 199 | 10.2 |
| text2midi | 16 | 5208 | 3565 | 1396 | 1730 | 150 | 8.7 |
| MIDI-LLM | 2 | 4057 | 1773 | 534 | 527 | 38 | 7.2 |
| Feature | Description | Recognition |
|---|---|---|
| text2midi L13 f3340 | Synth-lead (Lead 2 sawtooth) / electronic-patch instrumentation | 4/4 |
| MIDI-LLM L7 f499 | Solo acoustic-piano melody | 4/4 |
| MIDI-LLM L2 f5880 | Short, detached notes with thin overlap | 4/4 |
| MIDI-LLM L2 f1732 | Dense, drum-heavy texture with chromatic/out-of-scale notes | 4/4 |
| MIDI-LLM L2 f793 | Wide, harmonically static chord hits with weak tonal clarity | 4/4 |
| Pool | Selection | Features | Hypotheses | Evaluation |
|---|---|---|---|---|
| MusPy | The strongest discovery/validation association for each metric and model. | 15 | 24 | The metric changes in the direction predicted by its correlation. |
| MIDI programs | The program is frequent in active examples and absent from matched inactive examples. | 27 | 27 | The target program occurs; note and duration shares describe its contribution. |
| Descriptions | The description identifies all four active test excerpts; twelve cards pass the audit. | 48 | 48 | Blinded ratings measure agreement with the fixed description. |
| Study | Prompts | Baseline | Feature | Random | Lift (pp) [95% CI] | |
|---|---|---|---|---|---|---|
| Confirmation | 20 | 2 | 14 | 1 | 65 [45, 85] | 0.000122 |
| Replication | 10 | 0 | 6 | 0 | 60 [30, 90] | 0.015625 |
| Hypothesis source | Endpoint | Hyp. | Prompts | Test | Family-level result |
|---|---|---|---|---|---|
| Synth-lead feature, confirmation | Program presence | 1 | 20 | Prespecified; passes all four criteria | |
| Synth-lead feature, replication | Program presence | 1 | 10 | Disjoint prompts and seed | |
| Density-adjusted correlation, 21 SAEs | MusPy metric | 42 | 8 | – | SD vs. baseline; SD vs. random |
| Program frequency | Program presence | 27 | 10 | – | Absent programs introduced for 6 of 10 features (random: 1) |
| Strongest raw metric correlation | MusPy metric | 24 | 10 | – | SD vs. random |
| Description, audit-passing | Blinded LLM rating | 12 | 5 | Synth-lead feature rated highest; pooled interval includes 0 |
| Family (hypotheses, SAEs) | Target | Feature random | Positive | Feature baseline | Random baseline |
|---|---|---|---|---|---|
| Density-adjusted (42, 21 SAEs) | 22/42 | ||||
| 27/42 | |||||
| Raw correlation (24, 7 SAEs) | 9/24 | ||||
| 15/24 | |||||
| 8/24 |
Appendix figures & tables20 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | Layer | EF | FVU | Dead (%) | Frequent (%) | Retained | |
|---|---|---|---|---|---|---|---|
| text2midi | 2 | 4 | 32 | 0.0370 | 0.65 | 80.57 | 496 |
| text2midi | 2 | 8 | 32 | 0.0316 | 1.56 | 55.76 | 2174 |
| text2midi | 13 | 4 | 32 | 0.2038 | 0.13 | 83.98 | 288 |
| text2midi | 13 | 8 | 32 | 0.1885 | 0.13 | 67.04 | 1489 |
| MIDI-LLM | 12 | 4 | 32 | 0.3693 | 0.43 | 18.88 | 4968 |
| MIDI-LLM | 12 | 32 | 32 | 0.3923 | 83.72 | 1.84 | 2822 |
| Model and layer | Recovery (%) | ||
|---|---|---|---|
| text2midi L13 | 0.0324 [0.0203, 0.0443] | 4.1488 [4.0473, 4.2532] | 99.22 [98.94, 99.51] |
| MIDI-LLM L12 | 0.0852 [0.0569, 0.1159] | 1.9234 [1.7918, 2.0575] | 95.57 [93.95, 97.09] |
| Metric | Definition |
|---|---|
| Pitch entropy | Shannon entropy of the MIDI-pitch distribution. |
| Pitch-class entropy | Shannon entropy after reducing pitch modulo twelve. |
| Pitch count | Number of distinct MIDI pitches. |
| Pitch-class count | Number of distinct pitch classes. |
| Pitch range | Difference between the highest and lowest pitched notes. |
| Polyphony | Average number of simultaneous pitches over nonempty time steps. |
| Model | Layer | Eligible | D,V selected | Test | D,V selected | Test | D,V selected | Test |
|---|---|---|---|---|---|---|---|---|
| text2midi | 2 | 2252 | 963/2252 (42.8%) | 755/963 | 137/2252 (6.1%) | 111/137 | 8/2252 (0.4%) | 6/8 |
| text2midi | 8 | 1963 | 992/1963 (50.5%) | 820/992 | 193/1963 (9.8%) | 150/193 | 13/1963 (0.7%) | 8/13 |
| text2midi | 13 | 1652 | 745/1652 (45.1%) | 608/745 | 126/1652 (7.6%) | 97/126 | 7/1652 (0.4%) | 6/7 |
| text2midi | 16 | 2008 | 949/2008 (47.3%) | 765/949 | 140/2008 (7.0%) | 107/140 | 9/2008 (0.4%) | 4/9 |
| MIDI-LLM | 2 | 2393 | 734/2393 (30.7%) | 543/734 | 32/2393 (1.3%) | 23/32 | 3/2393 (0.1%) | 3/3 |
| text2midi | MIDI-LLM | |||||
|---|---|---|---|---|---|---|
| Metric | ||||||
| Pitch entropy | 2093 | 102 | 0 | 1297 | 78 | 8 |
| Pitch-class entropy | 834 | 10 | 0 | 443 | 10 | 1 |
| Pitch count | 3100 | 439 | 29 | 2454 | 272 | 30 |
| Pitch-class count | 1731 | 79 | 0 | 1216 | 57 | 2 |
| Pitch range | 1969 | 115 | 7 | 1232 | 79 | 11 |
| text2midi | MIDI-LLM | |||||
|---|---|---|---|---|---|---|
| Metric | Feature | Feature | ||||
| Pitch entropy | L8 f1015 | 0.279 | +0.258 | L14 f893 | 0.418 | +0.387 |
| Pitch-class entropy | L8 f5166 | 0.231 | +0.211 | L14 f893 | 0.321 | +0.302 |
| Pitch count | L8 f2187 | 0.372 | +0.295 | L14 f893 | 0.486 | +0.435 |
| Pitch-class count | L8 f5166 | 0.286 | +0.259 | L14 f893 | 0.389 | +0.363 |
| Pitch range | L2 f4317 | 0.402 | +0.387 | L7 f6043 | 0.488 | +0.437 |
| Model | Dictionary | Eligible | Raw | Adj. | Raw | Adj. | Raw | Adj. |
|---|---|---|---|---|---|---|---|---|
| text2midi | L2 EF4 k32 (historical) | 2426 | 1790 | 680 | 1144 | 118 | 403 | 18 |
| text2midi | L2 EF8 k32 (historical) | 5041 | 3316 | 1093 | 1713 | 151 | 480 | 24 |
| text2midi | L8 EF8 k32 (historical) | 4510 | 3283 | 1343 | 1840 | 234 | 692 | 40 |
| text2midi | L13 EF4 k32 (historical) | 2032 | 1727 | 743 | 1175 | 135 | 506 | 28 |
| text2midi | L13 EF8 k32 (historical) | 4763 | 3571 | 1365 | 2024 | 217 | 684 | 41 |
| Group | Cards | [95% CI] | Difference to calibration [95% CI] | |
|---|---|---|---|---|
| All real features | 786 | 48 (11.2) | ||
| Instrumentation | 72 | 21 (1.0) | ||
| Rhythm and timing | 37 | 1 (0.5) | ||
| Percussion | 81 | 5 (1.2) | ||
| Pitch and register | 29 | 2 (0.4) | ||
| Harmony and tonality | 225 | 11 (3.2) |
| Screen | Hypotheses | Max. prompts | Smallest possible | Smallest observed |
|---|---|---|---|---|
| Program presence | 27 | 10 | 0.000977 | 1.000 |
| Raw-correlation metric | 24 | 10 | 0.000977 | 0.727 |
| Density-adjusted metric | 42 | 8 | 0.003906 | 0.246 |
| Family | Target | Re-estimated scale | Retained | Dictionary |
|---|---|---|---|---|
| Density-adjusted (42, 21 SAEs) | 19,945/20,000 | |||
| Density-adjusted (42, 21 SAEs) | 19,937/20,000 | |||
| Raw correlation (24, 7 SAEs) | 12,117/20,000 | |||
| Raw correlation (24, 7 SAEs) | 10,991/20,000 | |||
| Raw correlation (24, 7 SAEs) | 4,849/20,000 |
| Model | Feature | Metric | Pairs | Oriented difference | ||
|---|---|---|---|---|---|---|
| MIDI-LLM | L2 f5050 | Drum grid (duple) | 5 | -0.019 | 0.6250 | 0.948 |
| MIDI-LLM | L2 f5050 | Drum consistency | 5 | -0.019 | 0.6250 | 0.948 |
| MIDI-LLM | L2 f6981 | Drum grid (triple) | 2 | +0.042 | 0.5000 | 0.948 |
| MIDI-LLM | L7 f6043 | Pitch range | 9 | -2.111 | 0.6250 | 0.948 |
| MIDI-LLM | L7 f6043 | Polyphony | 9 | -0.260 | 0.7695 | 0.948 |
| MIDI-LLM | L7 f6633 | Scale consistency | 9 | +0.036 | 0.1309 | 0.785 |
| Model | Feature | Program | Baseline | Feature | Random | ||
|---|---|---|---|---|---|---|---|
| MIDI-LLM | L2 f920 | 28 | 0 | 0 | 0 | 1.0000 | 1.000 |
| MIDI-LLM | L2 f5165 | 49 | 0 | 0 | 0 | 1.0000 | 1.000 |
| MIDI-LLM | L7 f499 | 0 | 8 | 7 | 8 | 1.0000 | 1.000 |
| MIDI-LLM | L7 f6424 | 24 | 0 | 2 | 0 | 0.2500 | 1.000 |
| text2midi | L2 f571 | 1 | 7 | 7 | 6 | 0.5000 | 1.000 |
| text2midi | L2 f896 | 30 | 2 | 2 | 0 | 0.2500 | 1.000 |
| Feature | Metric | Feature baseline | Feature random | ||
|---|---|---|---|---|---|
| L8 f1015 | Pitch entropy | 0.271 [-0.102, 0.661] | 0.418 [0.078, 0.783] | 0.0303 | 0.727 |
| L13 f3827 | Polyphony rate | -0.003 [-0.123, 0.112] | 0.132 [-0.004, 0.282] | 0.0684 | 0.750 |
| L8 f5166 | Pitch-class count | 0.100 [-1.000, 1.200] | 1.100 [0.000, 2.400] | 0.0938 | 0.750 |
| Model | Dictionary | Feature | Metric | Pairs | Oriented difference [95% CI] | ||
|---|---|---|---|---|---|---|---|
| text2midi | L2 EF4 k32 (historical) | f1247 | Pitch range | 8 | 0.5000 | 0.778 | |
| text2midi | L2 EF4 k32 (historical) | f1596 | Polyphony | 8 | 0.9453 | 0.984 | |
| text2midi | L2 EF8 k32 (historical) | f3526 | Pitch range | 8 | 0.4922 | 0.778 | |
| text2midi | L2 EF8 k32 (historical) | f5056 | Polyphony | 8 | 0.0117 | 0.246 | |
| text2midi | L2 EF8 k32 (final) | f1712 | Pitch range | 8 | 0.4844 | 0.778 | |
| text2midi | L2 EF8 k32 (final) | f2208 | Polyphony | 8 | 0.5469 | 0.792 |
| Model | Condition | Notes | Relative norm (%) | Re-encoded firing (%) |
|---|---|---|---|---|
| text2midi | Feature | 107.4 5.8 | 21.4 16.2 | 55.84 42.88 |
| text2midi | Random | 108.7 5.6 | 21.4 16.3 | 0.29 0.60 |
| text2midi | Ablation | 105.4 1.1 | 0.0 0.1 | 0.02 0.05 |
| MIDI-LLM | Feature | 255.4 0.5 | 12.9 10.8 | 35.89 40.07 |
| MIDI-LLM | Random | 255.5 0.4 | 13.4 12.3 | 0.07 0.18 |
| MIDI-LLM | Ablation | 255.6 0.0 | 0.0 0.0 | 0.00 0.01 |
| Subset | Features | Correct choices | Rating difference [95% CI] | |
|---|---|---|---|---|
| Audit-passing subset | 12 | 4/8 | 0.167 [-0.300, 0.700] | 0.3125 |
| All descriptions | 48 | 16/34 | 0.108 [-0.112, 0.338] | 0.1885 |
| Audit-passing, without synth lead | 11 | 3/7 | -0.036 [-0.400, 0.291] | 0.6133 |
| Feature | Description | Favored | Flags | |
|---|---|---|---|---|
| text2midi L13 f3340 | Synth-lead (Lead 2 sawtooth) / electronic-patch instrumentation | 5/5 | None | |
| text2midi L2 f552 | Dense, near-continuous drum/percussion texture | 4/5 | T, S | |
| text2midi L2 f4021 | Rich, multi-timbral instrumentation (many melodic instruments) | 4/5 | T, S | |
| text2midi L16 f4606 | Sparse texture with recurring timpani-type low percussion | 3/5 | S | |
| MIDI-LLM L2 f6671 | Prominent, continuous drum-kit layer relative to melodic notes | 3/5 | T, S, N | |
| MIDI-LLM L12 f3013 | Slow harmonic rhythm with long sustained notes over a static backdrop | 4/5 | N |
Mechanistic Interpretability
Mechanistic interpretability studies how neural networks implement behaviors through internal features, circuits, and causal information flow.
See all 388 papers