Back to directory

TransformerLens

A library for mechanistic interpretability of GPT-style language models that exposes a model's internal activations so they can be cached, edited, removed or replaced while the model runs.

Visit website (opens in a new tab)transformerlensorg.github.io
TransformerLens

TransformerLens is a library for mechanistic interpretability of GPT-style language models, aiming to help researchers take a trained model and reverse engineer the algorithms it learned during training from its weights. It can load more than 15,000 open-source language models across more than 140 architecture families and exposes their internal activations to the user.

Its TransformerBridge class, the recommended way to load a model, preserves raw Hugging Face weights so logits and activations match Hugging Face's own implementation by default, with a compatibility mode available for numeric parity with the library's older HookedTransformer API, which was removed as a loading path in TransformerLens 4.0. Gated model families such as Llama, Mistral and Gemma require a Hugging Face access token.

It installs as a Python package and is licensed under MIT.

More in Libraries

See all 292
  • OpenDecision

    deepanwadhwa.github.io

    An open-source Python package that answers typed questions about application state or documents using a local natural-language-inference model, returning structured choice, score, yes/no or evidence-relation values instead of free text.

  • TradeCanvas

    bonguynvan.github.io

    A zero-dependency canvas charting engine for building TradingView-style trading charts in JavaScript, with 66 technical indicators, 24 drawing tools, 17 chart types, and real-time streaming.

  • 3d retro graphics

    3d-retro.com

    A free, CC0-licensed library of copy-paste retro 3D and demoscene graphics effects, such as plasma, raytracing, and voxel terrain, runnable as WebGL 1 or plain 2D canvas.