llmdbg: Debug LLMs — Step, Inspect, Intervene, and Plot
Debug an LLM one token and one layer at a time.
Set breakpoints. Step through attention and MLP blocks. Inspect internal
vectors. Remove components and see what changes.

Main features
- Step through an LLM forward pass in VS Code.
- Inspect the residual stream at each stage.
- View attention channels and MLP neurons.
- Use Logit Lens, J-Lens, R-Lens, and ICA Lens.
- See vector magnitude and direction.
- Remove an active component and continue the run.
- Save each intervention as a reproducible experiment log.
- Plot model vectors with Matplotlib.
Get started
- Install llmdbg.
- Open a project folder in VS Code.
- Press Ctrl+P.
- Type >llmdbg: Create Starter Files and press Enter.
- Open a generated
.llmdbg.py example.
- Press F5.
- Set a breakpoint. Use F10 to step.
- Open Lens from the debug toolbar.
The first run may take a few minutes. llmdbg creates a private Python runtime.
It also downloads the selected model. It does not change your project's Python
environment.
llmdbg selects the compute backend automatically. It supports NVIDIA CUDA on
Windows and Linux. It supports MPS on Apple Silicon. CPU is the fallback.
If setup fails, run llmdbg: Show Runtime Diagnostics.
Lenses and interventions
The Lens page follows the model's execution order. It shows the residual input,
attention update, mid-residual state, MLP update, and residual output.
ICA Lens shows the strongest independent components. Right-click an active ICA
component, attention channel, or MLP neuron. Choose Intervention: Remove.
llmdbg sets it to zero and recomputes the current state. You can then continue
the forward pass.
Each intervention creates a note in the project's .logs folder. The note
records the model, prompt, location, change, and result.
Supported models
| Model |
Debugging |
ICA Lens |
| GPT-2 Small |
✓ |
✓ |
| Qwen3.5 0.8B |
✓ |
— |
| Qwen3.5 2B Base |
✓ |
✓ |
| Qwen3.5 2B Chat |
✓ |
✓ |
| Qwen3.5 9B |
✓ |
✓ |
| Qwen3.5 27B |
✓ |
— |
J-Lens and R-Lens are available when an artifact exists for the selected model.
The official J++ Lens is available for Qwen3.5 9B.
Lens files are downloaded on first use and cached locally.
Residual-to-Vocabulary Lens sources
The llmdbg.jLensSource, llmdbg.rLensSource, and llmdbg.jppLensSource
settings expose the standard J-Lens, R-Lens, and J++ Lens artifact repositories
as ordinary editable text fields. Each source may be a Hugging Face repository
URL or a local folder containing the same index.json, manifests, and artifact
layout.
Run llmdbg: Manage Custom Residual-to-Vocabulary Lenses to add, edit,
enable, disable, or remove other compatible lenses. Official J++ and the
Post-only Neuronpedia J and J++ Lenses are included as custom Lenses by default, so they
can be managed in exactly the same way as any user-added Lens. The Lens
selector only shows entries available for the
active model. Logit Lens is built in, and ICA Lens remains separately
configured and displayed.
Methods
ICA bases:
Links
MIT License.