<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Amey Muke</title>
    <description>The latest articles on DEV Community by Amey Muke (@perfect7613).</description>
    <link>https://dev.to/perfect7613</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3916625%2F2f655531-f7a0-4aaf-b8fb-63436131ba96.png</url>
      <title>DEV Community: Amey Muke</title>
      <link>https://dev.to/perfect7613</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/perfect7613"/>
    <language>en</language>
    <item>
      <title>Testing Long-Horizon Coherence in MusicGen: A Real-Data Mech Interp Pipeline</title>
      <dc:creator>Amey Muke</dc:creator>
      <pubDate>Wed, 06 May 2026 20:01:10 +0000</pubDate>
      <link>https://dev.to/perfect7613/testing-long-horizon-coherence-in-musicgen-a-real-data-mech-interp-pipeline-3end</link>
      <guid>https://dev.to/perfect7613/testing-long-horizon-coherence-in-musicgen-a-real-data-mech-interp-pipeline-3end</guid>
      <description>&lt;h1&gt;
  
  
  Testing Long-Horizon Coherence in MusicGen: A Real-Data Mech Interp Pipeline
&lt;/h1&gt;

&lt;p&gt;I have been working on a mechanistic interpretability experiment for music generation models.&lt;/p&gt;

&lt;p&gt;The big motivating question is simple:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do autoregressive music models have internal features that track long-horizon musical structure, or are they mostly stitching together locally plausible audio?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;More concretely, I want to test whether a model like MusicGen has residual-stream or sparse-autoencoder features that say something like: "this motif should come back later," "this tension should resolve," or "this section is setting up a later recurrence."&lt;/p&gt;

&lt;p&gt;That sounds exciting, but let me be clear upfront:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This post does not claim that I found foresight circuits.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What I have so far is a real-data pipeline, a benchmark slice, cached activations, recurrence proposals, and a set of artifacts that make the next causal experiments possible. That is still useful, because getting from "cool idea" to "falsifiable experiment with real data" is most of the work in mechanistic interpretability.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/perfect7613/Musicgen-exp" rel="noopener noreferrer"&gt;https://github.com/perfect7613/Musicgen-exp&lt;/a&gt;&lt;br&gt;&lt;br&gt;
Artifacts: &lt;a href="https://huggingface.co/datasets/Perfect7613/musicgen-exp-runpod-results" rel="noopener noreferrer"&gt;https://huggingface.co/datasets/Perfect7613/musicgen-exp-runpod-results&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why music is an interesting domain for mechanistic interpretability
&lt;/h2&gt;

&lt;p&gt;Most mechanistic interpretability work focuses on language models, but music has a property that makes it very attractive for long-horizon experiments: structure is audible.&lt;/p&gt;

&lt;p&gt;A listener can hear when a motif returns. A listener can hear when a build-up resolves. A listener can hear when a piece feels planned versus when it feels like a sequence of locally okay but globally drifting fragments.&lt;/p&gt;

&lt;p&gt;This makes music a good place to ask questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does the model represent motifs internally?&lt;/li&gt;
&lt;li&gt;Can we find features that predict motif recurrence many seconds later?&lt;/li&gt;
&lt;li&gt;Are those features causal, or merely correlated with local audio patterns?&lt;/li&gt;
&lt;li&gt;Can steering those features improve global coherence without destroying local audio quality?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The hard part is not asking the question. The hard part is making the experiment strict enough that a positive result actually means something.&lt;/p&gt;

&lt;h2&gt;
  
  
  The hypothesis
&lt;/h2&gt;

&lt;p&gt;The strongest version of the hypothesis is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MusicGen contains internal features that causally influence long-horizon musical structure.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For example, suppose a motif appears early in a generated clip. If the model has some internal feature that helps preserve or recall that motif later, then ablating that feature should selectively disrupt future recurrence while leaving local fluency mostly intact.&lt;/p&gt;

&lt;p&gt;That would be a much stronger claim than "the model generated something that sounded coherent."&lt;/p&gt;

&lt;p&gt;A weaker and more honest version is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Some residual-stream features may predict future musical events better than simple controls.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That is the version I am trying to test first.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I actually ran
&lt;/h2&gt;

&lt;p&gt;The current run used &lt;code&gt;facebook/musicgen-small&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I considered newer models, including latent diffusion music models, but for classic mechanistic interpretability I wanted a transformer-like autoregressive setup where residual streams, hooks, sparse autoencoders, activation patching, and causal interventions are more natural.&lt;/p&gt;

&lt;p&gt;So the current experiment uses MusicGen through the &lt;code&gt;PapayaResearch/musicdiscovery&lt;/code&gt; tooling, which is based on the Singh et al. MusicGen SAE work.&lt;/p&gt;

&lt;p&gt;The run did the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Verified a real MTG-Jamendo low-audio shard against SHA256 checksums.&lt;/li&gt;
&lt;li&gt;Unpacked and verified 202 MP3 files against official track hashes.&lt;/li&gt;
&lt;li&gt;Built a 100-track benchmark manifest using real audio only.&lt;/li&gt;
&lt;li&gt;Loaded MusicGen-small through the &lt;code&gt;HookedMusicGen&lt;/code&gt; wrapper.&lt;/li&gt;
&lt;li&gt;Cached residual-stream activations across 100 tracks and five hook points.&lt;/li&gt;
&lt;li&gt;Extracted chroma features from the real audio.&lt;/li&gt;
&lt;li&gt;Generated automatic motif-recurrence proposals using audio feature similarity.&lt;/li&gt;
&lt;li&gt;Mirrored relevant published SAE checkpoint metadata for follow-up experiments.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;No fake data was used for the benchmark artifacts.&lt;/p&gt;

&lt;h2&gt;
  
  
  What artifacts exist now
&lt;/h2&gt;

&lt;p&gt;The artifact release contains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;500 residual activation tensors across 100 tracks.&lt;/li&gt;
&lt;li&gt;100 chroma feature artifacts.&lt;/li&gt;
&lt;li&gt;A 100-track benchmark manifest.&lt;/li&gt;
&lt;li&gt;98 automatic recurrence proposal rows.&lt;/li&gt;
&lt;li&gt;2 logged recurrence-processing failures.&lt;/li&gt;
&lt;li&gt;Run logs and summary files.&lt;/li&gt;
&lt;li&gt;Published SAE checkpoint configuration references.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The GitHub repo contains the code and lightweight metadata. The heavier run artifacts are on Hugging Face.&lt;/p&gt;

&lt;p&gt;This split is intentional. GitHub should stay readable and reviewable. Hugging Face is a better home for larger experiment dumps.&lt;/p&gt;

&lt;h2&gt;
  
  
  The key caveat: this is not a result yet
&lt;/h2&gt;

&lt;p&gt;The most important caveat is that the residual hooks captured in the first run do not perfectly match the available published SAE checkpoints.&lt;/p&gt;

&lt;p&gt;The current residual activation run captured hooks like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;hook_layers.2&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hook_layers.6&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hook_layers.12&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hook_layers.18&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hook_layers.22&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The published SAE checkpoints I wanted to use are for nearby but different hooks, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;hook_layers.1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hook_layers.5&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hook_layers.11&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hook_layers.17&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That means I should not mix these activations and SAE checkpoints and pretend the SAE analysis is valid.&lt;/p&gt;

&lt;p&gt;This is exactly the kind of thing that would be easy to hide in a flashy blog post, but it matters. The honest next step is to rerun activation extraction on checkpoint-aligned hooks before making SAE-level claims.&lt;/p&gt;

&lt;h2&gt;
  
  
  Another caveat: recurrence labels are proposals, not ground truth
&lt;/h2&gt;

&lt;p&gt;The recurrence proposals are generated automatically from chroma / audio similarity features.&lt;/p&gt;

&lt;p&gt;That is useful for building a review queue, but it is not the same as a clean human-verified label set.&lt;/p&gt;

&lt;p&gt;A serious version of this experiment needs manually verified labels for questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Did the motif actually recur?&lt;/li&gt;
&lt;li&gt;Was the recurrence musically meaningful?&lt;/li&gt;
&lt;li&gt;Was the similarity just a repeated texture or instrument pattern?&lt;/li&gt;
&lt;li&gt;Did the recurrence happen at a long enough horizon to count as global structure?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without that step, a probe could accidentally learn shallow correlations.&lt;/p&gt;

&lt;h2&gt;
  
  
  What would count as real evidence?
&lt;/h2&gt;

&lt;p&gt;I would count a candidate feature as long-horizon/coherence-relevant only if it passes several tests.&lt;/p&gt;

&lt;p&gt;First, it should predict future recurrence better than controls. The controls should include things like track identity, position, local chroma, local energy, and source-level artifacts.&lt;/p&gt;

&lt;p&gt;Second, the effect should be stronger at long horizons than at short horizons. If a feature only predicts what happens one or two seconds later, that is more likely to be local continuity than global planning.&lt;/p&gt;

&lt;p&gt;Third, it should be causal. Ablating or scaling the feature should change future recurrence in a targeted way.&lt;/p&gt;

&lt;p&gt;Fourth, it should not merely make the audio worse. If a feature ablation destroys audio quality everywhere, that is not evidence of a clean global-coherence feature.&lt;/p&gt;

&lt;p&gt;Fifth, the examples should be auditable. People should be able to listen to before/after clips and judge whether the metric is tracking something musically real.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I still think this is worth doing
&lt;/h2&gt;

&lt;p&gt;Even though the current run is not a final result, it makes the project much more concrete.&lt;/p&gt;

&lt;p&gt;Before this run, the project was an idea:&lt;/p&gt;

&lt;p&gt;"Maybe MusicGen has foresight-like features."&lt;/p&gt;

&lt;p&gt;After this run, the project is a pipeline:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;real audio in,&lt;/li&gt;
&lt;li&gt;verified manifest,&lt;/li&gt;
&lt;li&gt;model activations out,&lt;/li&gt;
&lt;li&gt;recurrence proposals generated,&lt;/li&gt;
&lt;li&gt;artifacts published,&lt;/li&gt;
&lt;li&gt;caveats documented,&lt;/li&gt;
&lt;li&gt;next causal tests defined.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is a big difference.&lt;/p&gt;

&lt;p&gt;In mechanistic interpretability, it is easy to jump straight to beautiful feature dashboards and impressive-sounding claims. I am trying to move slower: first make sure the data is real, the labels are inspectable, the hooks are aligned, and the negative result would also be publishable.&lt;/p&gt;

&lt;p&gt;The important thing is that the SAE and causal parts are downstream of correctly aligned activations and better labels. They are not done yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I need to do next
&lt;/h2&gt;

&lt;p&gt;The next proper slice is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Rerun activation extraction on hooks aligned to the published SAE checkpoints.&lt;/li&gt;
&lt;li&gt;Encode those activations with the correct SAEs.&lt;/li&gt;
&lt;li&gt;Manually verify a subset of recurrence proposals.&lt;/li&gt;
&lt;li&gt;Train future-event probes with strong controls.&lt;/li&gt;
&lt;li&gt;Run feature ablations and scaling interventions.&lt;/li&gt;
&lt;li&gt;Compare long-horizon effects against local audio degradation.&lt;/li&gt;
&lt;li&gt;Publish the result whether it is positive or null.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A positive result would be interesting because it would suggest that music models contain causally meaningful long-horizon structure features.&lt;/p&gt;

&lt;p&gt;A null result would also be useful because it would constrain what we should expect from current autoregressive music models and from SAE-based discovery in this domain.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I am not claiming
&lt;/h2&gt;

&lt;p&gt;I am not claiming that MusicGen plans like a human composer.&lt;/p&gt;

&lt;p&gt;I am not claiming that I found a "motif neuron."&lt;/p&gt;

&lt;p&gt;I am not claiming that the current recurrence proposals are clean ground truth.&lt;/p&gt;

&lt;p&gt;I am not claiming that the SAE analysis is complete.&lt;/p&gt;

&lt;p&gt;I am claiming that there is now a real-data, reproducible starting point for testing the question seriously.&lt;/p&gt;

&lt;p&gt;That is enough for this stage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;p&gt;GitHub repo: &lt;a href="https://github.com/perfect7613/Musicgen-exp" rel="noopener noreferrer"&gt;https://github.com/perfect7613/Musicgen-exp&lt;/a&gt;&lt;br&gt;&lt;br&gt;
Experiment artifacts: &lt;a href="https://huggingface.co/datasets/Perfect7613/musicgen-exp-runpod-results" rel="noopener noreferrer"&gt;https://huggingface.co/datasets/Perfect7613/musicgen-exp-runpod-results&lt;/a&gt;&lt;br&gt;&lt;br&gt;
MusicGen SAE reference repo: &lt;a href="https://github.com/PapayaResearch/musicdiscovery" rel="noopener noreferrer"&gt;https://github.com/PapayaResearch/musicdiscovery&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Feedback I would genuinely value
&lt;/h2&gt;

&lt;p&gt;If you work on mechanistic interpretability, audio ML, or music information retrieval, I would especially appreciate feedback on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;better motif-recurrence metrics,&lt;/li&gt;
&lt;li&gt;stronger controls for future-event probes,&lt;/li&gt;
&lt;li&gt;cleaner causal intervention designs,&lt;/li&gt;
&lt;li&gt;whether MusicGen-small is too weak for this question,&lt;/li&gt;
&lt;li&gt;how to avoid overclaiming while still making the result legible.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is not to make the project sound more impressive than it is. The goal is to make the experiment hard to fool.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>music</category>
      <category>research</category>
    </item>
  </channel>
</rss>
