Manas Karrasledg3r
Work / Article

Nov 08, 2026

4 min read

Piano to flute, one weight edit

I tried weight-space programming on Google’s Magenta RealTime 2. The same piano request produced flute after changing one matrix, without backpropagation.

Try the interactive demoHear the before and after. Explore the actual weights.

I’ve always been curious about music models, partly because they bring together my interest in music and my full-time work in AI. With RagaXonic, I worked on a three-layer LSTM for polyphonic MIDI, exploring Hindustani and Western musical ideas.

Then I read Sparks of Weight-Space Programming. An LLM reasons about a network and writes changes into its weights, without gradient descent. The experiments include using Python and feedback from running the model. I wondered what that would look like with music.

The goal I settled on: keep asking for piano, but make the saved model produce flute.

An editorial illustration of piano keys and a silver flute connected by small grids of blue and rose squares.
Generated illustration. The diagram below shows the actual edit.

Same request, different instrument

Here’s a selected example from Google’s Magenta RealTime 2. Both versions received this exact prompt:

A solo honky-tonk piano plays a fast boogie-woogie, only piano.

Original weights: piano
Edited weights: flute

Same seed and generation settings, with playback levels matched. These are recorded outputs, not live browser generation. At one point during development, my feedback was simply “it’s a flute.” Earlier pairs had both sounded like piano, or sounded worse without making a convincing switch.

GPT-6 Astra designed and implemented the main edit using Python and encoded examples. I set the goal, listened to the comparisons and steered the experiments: a human-guided WSP workflow.

Where the change lives

Magenta encodes a prompt or reference recording as numbers describing its style. An adapter maps those numbers into a signal the generator can use. That’s the target.

  1. Text or reference audioThe same input before and after
  2. Frozen style encoderStyle tokens → codebook lookup → 768-number vector
  3. Style adapter · W → W′768 × 1,024 weights. This is the only tensor replaced.
  4. Music generator + audio decoderNewly generated music
The style-conditioning path, simplified. Reference audio guides new music; this does not replace an instrument in a recording note for note.

Piano and flute examples give a direction, d, that shifts the conditioning toward flute. A second vector, g, controls how strongly it applies. Piano examples should activate it; other instruments should mostly leave it alone.

The gate uses 432 text encodings and nine synthetic audio references. Python solves the constraints directly, without backpropagation or optimizer steps, then writes a rank-one update:

W′ = W + α g d⊤

The strength, α = 1.4, was chosen through listening comparisons. Ordinary inference uses the replacement matrix; its multiplication includes the control signal, without an extra instruction or activation hook.

That changes 786,432 values, or 0.032% of the full checkpoint. Magenta already knows how to generate flute. The edit redirects when it uses that ability. The method explains the calculation; Unified Concept Editing is related prior work on closed-form edits.

What I checked

I checked the saved model as well as the sound. The verification records show:

CheckResult
Compare checkpointsOne matrix changed; the other 617 tensors are identical.
Recalculate from saved encoder tokensThe patch hash matches exactly.
Reload in a fresh processOne development clip reproduced byte for byte on the tested runtime.

I heard the switch on solo prompts, a real piano reference and a jazz trio where bass and drums were still audible. Piano-and-guitar could stay piano-and-guitar. A piano-and-strings reference was stranger: a negative gate response made the edit run backwards and add piano.

There’s an obvious baseline: just ask the original model for flute.

A solo flute plays a fast boogie-woogie, only flute.

Original weights, flute prompt

Two blind quality comparisons split one preference each. I was the only listener, so this doesn’t establish a quality advantage over prompting. What I can show is an audible behavior change stored in the weights, and the inputs where it fails.

I want to try making the edit more selective when several instruments play together. Explore the interactive demo, or get the patch, code, calibration tokens and evaluation notes to reproduce it.

How the edit works: an interactive walkthrough from basic weights to the full equations.

About me

Pinned document

Résumé / Nov 2026

Manas Karra · AI EngineerOpen PDF Download

LLM systems & AI platforms

AI Engineer at Deriv, based in Dubai.

Selected projects
verd · magenta-wsp
Education
B.E. Computer Science
BITS Pilani, 2025

Open the one-page PDF for the complete résumé.