Skip to content

[Proposal] Add MVP Support For 1-2 Models Per-Modality #710

Description

@4gatepylon

Is this out of scope? I hope not, would be nice to have a one-stop shop for interpretability tooling.

Proposal

It should be easy to get the most bare-bones interpretability research off the ground for models that are not just transformer language models. Obviously, transformer lens should not have to support every model ever out there, but I think it would be cool to support just 1-2 very popular models per-modality.

  • TTS: It should include Whisper (I just started working on this today: https://github.com/4gatepylon/WhisperLens)
  • Vision: It should be possible to use a ResNet with hookpoints in it (I know this is not a transformer, but I think it is worthwhile to have the ability) and 1-2 basic ViTs like from https://github.com/soniajoseph/ViT-Prisma.
    • Support a basic VAE
    • Support a basic GAN (idk much about flow-based models so I cannot say much there)
  • Music Generation: probably 1 transformer model
  • Probably include 1-2 versions of Mamba

Not sure what I think about diffusion.

The scope of this is simple

  1. Be able to hook into basically a prototypical model for any modality
  2. Be able to have easy functionality to get step-wise computation when you are doing some iterative model

With these two features it's easy to train SAEs on top etc... (even if it isn't optimally efficient).

Motivation

There are resources out there for this stuff, but it is a little scattered and often there isn't a nice tutorial to just "get SAEs for my music gen model" for example.

Pitch

This is not that hard. All it entails is:

  1. Models properly extend HookedRootModule and have HookPoints]
  2. Tests that make sure this works
  3. Some sort of tutorial ipynb to do basic steering or train an SAE on a layer
  4. (BONUS) A single not-bad trained SAE and steering example per-modality (this may leak into SAE Lens or be out of scope)

It might be possible to get some code-gen or AI to generate basic versions of this?

It has benefits:

  1. Help us work through the generalization steps that are necessary eventually if we ever want to have a one-stop tool-shop for interpretability tooling, while NOT requiring us to tackle actually unclear questions like "how do I do attention table visualization for sound?"
  2. Speeds people up.

There's a lot of little questions that come up all the time like:

  • Do we see induction heads or similar mechanisms in music or TTS?
  • Can I do linear steering in xyz modality?
  • Can SAEs disentangle VAE latents (i.e. is there a vector direction decomposition where each direction gives me more or less of an interpretable singlefeature?
  • Can I optimize xyz continuous modality's inputs to maximize a feature direction for an SAE and get more interpretable inputs than for neurons?
  • Can I find the same interpretable feature if I trained with xyz method instead of abc method?

These should be as easy as run_with_hooks on a model that works out of the box + call some function on your activations. These things could take like a couple hours and not be bug prone instead of twice that and be somewhat finnicky.

Alternatives

The current paradigm is that you spend the first few ours of a project on getting hook-points and SAEs integrated. It's not the end of the world. You can also use pytorch hooks, but we use transformer lens for a reason.

Checklist

  • I have checked that there is no similar issue in the repo (required)

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity-highVery complicated changes for people to address who are quite familiar with the codediscussionNo action needed yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions