Skip to content

[Proposal] Linear Artificial Tomography (LAT) scans #1957

Description

@Allan0820

Summary

Add a utility for running LAT scans on HookedTransformer models. A scan finds a concept direction at each layer and projects activations onto it, producing a layer-by-token readout of where the concept is represented. TransformerLens has the hooks for this, but no standard implementation.

Motivation

LAT is a common tool in representation engineering, and each project currently reimplements it. I used it to study emotion-associated directions in Qwen3-0.6B, where alignment rose in later layers. Interpreting that result required controls for norm growth and anisotropy that a shared implementation could provide by default. I already have the code written, would have to just be ported to the repository.

Proposed functionality

Direction extraction: Build per-layer concept vectors from contrastive or stimulus-based prompt sets, with PCA or difference-of-means options.
Scanning: Run run_with_cache over input text and project resid_pre / resid_post onto the vectors, returning a layer × token score tensor.
Baselines: Built-in random-direction and norm-matched controls, plus optional centering or whitening from neutral-prompt statistics.
Visualization: Layer-wise alignment curves and token-level heatmaps.
Interventions: Optional steering or ablation along extracted vectors for causal checks.

Example usage


python
scan = lat_scan(model, concept_prompts, neutral_prompts, layers="all")
scores = scan.project(text)
scan.plot(baseline="random")

The API is only a sketch, and I’m open to whatever fits the library’s conventions.

Example of the image generated:

Image

Activity

  1. changed the title [-]Feature request: Linear Artificial Tomography (LAT) scans[/-] [+][Proposal] Linear Artificial Tomography (LAT) scans[/+] on Oct 30, 2026
  2. Allan0820 commented on Oct 30, 2026

    @Allan0820
    Author

    @jlarson4 @neelnanda-io: interested in your thoughts on this!

  3. jlarson4 commented on Oct 30, 2026

    @jlarson4
    Collaborator

    Hi @Allan0820! I appreciate you putting this proposal together. A couple items on how this fits with our roadmap going forward. First and foremost, HookedTransformer has been deprecated (v3) and removed (v4), so any existing implementation would need to be rewritten to work with our new TransformerBridge system. Additionally, we have plans in the future for a generic set of these functionalities that are not tied specifically to a lat_scan method. We do not typically include visualization tools in the core of TransformerLens, so once those methods are in place, we'd ideally build this as a demo notebook, rather than as an explicit method or module within the repository.

    I'll mark this as parked for now, and come back to it once we've finished overhauling our analysis tools functionalities. Thank you again for your interest in TransformerLens!

  4. added
    enhancement
    seen_by_maintainers
    TransformerBridge
    on Oct 30, 2026
  5. added theissue type on Oct 30, 2026
  6. Allan0820 commented on Oct 30, 2026

    @Allan0820
    Author

    Hey @jlarson4, thanks for the detailed feedback!

    Just to clarify, I had initially implemented the LAT Scans directly in PyTorch. I adapted the implementation to use HookedTransformer primarily to make it fit more naturally into the existing TransformerLens ecosystem, rather than because the implementation inherently depended on it. So adapting it to TransformerBridge or a more generic analysis interface shouldn't be an issue.

    I also already have a notebook that I originally put together for @neelnanda-io's MATS submission: [LAT Scans Notebook](https://colab.research.google.com/drive/1jakU_dGTI2CYRbsWOaxf18pmktrGezfZ?usp=sharing). It provides a look at the underlying PyTorch implementation. The current focus is more on the mechanics of LAT than its applications, but it can certainly be adapted into a demonstration notebook as you suggested.

    Thanks again for taking the time to review this! Also happy to help in the overhaul efforts, please do let me know, would be more than happy to contribute!

  7. hunar2006 commented on Dec 1, 2026

    @hunar2006

    I would use this for probing guard models on residual stream activations, so a vote of interest from me. Happy to help test a demo notebook once the generic direction tooling lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    TransformerBridgeenhancementseen_by_maintainers

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions