Skip to main content
Overcomplete logo

PyLint Tox Pypi Pepy

Overcomplete is a compact research library in Pytorch designed to study (Overcomplete)-Dictionary learning methods to extract concepts from large Vision models. In addition, this repository also introduces various visualization methods, attribution and metrics. However, Overcomplete emphasizes experimentation.

🚀 Getting Started with Overcomplete

Overcomplete requires Python 3.8 or newer and several dependencies, including Numpy. It supports both only Torch. Installation is straightforward with Pypi:

pip install overcomplete

With Overcomplete installed, you can dive into an optimisation based dictionary learning method to extract visual features or use the latest SAEs variant. The API is designed to be intuitive, requiring only a few hyperparameters to get started.

Example usage:

import torch
from torch.utils.data import DataLoader, TensorDataset
from overcomplete.sae import TopKSAE, train_sae

Activations = torch.randn(N, d)
sae = TopKSAE(d, nb_concepts=16_000, top_k=10, device='cuda')

dataloader = DataLoader(TensorDataset(Activations), batch_size=1024)
optimizer = torch.optim.Adam(sae.parameters(), lr=5e-4)

def criterion(x, x_hat, pre_codes, codes, dictionary):
  mse = (x - x_hat).square().mean()
  return mse

logs = train_sae(sae, dataloader, criterion, optimizer,
                 nb_epochs=20, device='cuda')

🧪 Notebooks

  • Getting started: Open
  • TopK, BatchTopK, JumpReLU, Vanilla SAE: Open
  • Stable Dictionary with Archetypal-SAE: Coming soon
  • Advanced metrics to study the solution of SAE: Open
  • The visualization module: Open
  • NMF, ConvexNMF and Semi-NMF: Open
  • Modern Feature visualization to visualize concepts: Coming soon

👏 Credits

Kempner Logo

This work has been made possible in part by the generous support provided by the Kempner Institute at Harvard University. The institute, established through a gift from the Chan Zuckerberg Initiative Foundation, is dedicated to advancing research in natural and artificial intelligence. The resources and commitment of the Kempner Institute have been instrumental in the development and completion of this project.

Additional Resources

For a complete LLM implementation of the SAE, we strongly recommend exploring the following resources. The Sparsify library by EleutherAI provides a comprehensive toolset for implementing the SAE. The original TopK implementation is available through OpenAI's Sparse Autoencoder. Additionally, SAE Lens is an excellent resource, especially if you are interested in using the SAE-vis. Finally, closer to our work, for those interested in the vision domain, ViT-Prisma is an excellent mechanistic interpretability library for Vision Transformers (ViTs) that supports activation caching and SAE training.

Related Publications

The Overcomplete framework has contributed to the following research publications.

@article{fel2025archetypal,
  title     = {Archetypal SAE: Adaptive and Stable Dictionary Learning for Concept Extraction in Large Vision Models},
  author    = {Fel, Thomas and Lubana, Ekdeep Singh and Prince, Jacob S. and Kowal, Matthew and Boutin, Victor and Papadimitriou, Isabel and Wang, Binxu and Wattenberg, Martin and Ba, Demba and Konkle, Talia},
  journal   = {arXiv preprint arXiv:2502.12892},
  year      = {2025},
  url       = {https://arxiv.org/abs/2502.12892}
}
@article{thasarathan2025universal,
  title     = {Universal Sparse Autoencoders: Interpretable Cross-Model Concept Alignment},
  author    = {Thasarathan, Harrish and Forsyth, Julian and Fel, Thomas and Kowal, Matthew and Derpanis, Konstantinos},
  journal   = {arXiv preprint arXiv:2502.03714},
  year      = {2025},
  url       = {https://arxiv.org/abs/2502.03714}
}

@article{hindupur2025projecting,
  title     = {Projecting Assumptions: The Duality Between Sparse Autoencoders and Concept Geometry},
  author    = {Hindupur, Sai Sumedh R. and Lubana, Ekdeep Singh and Fel, Thomas and Ba, Demba},
  journal   = {arXiv preprint arXiv:2503.01822},
  year      = {2025},
  url       = {https://arxiv.org/abs/2503.01822}
}

Authors

Metadata

Release files for Overcomplete 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Overcomplete 0.3.0
File Size Uploaded
overcomplete-0.3.0.tar.gz 47.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Overcomplete 0.3.0
File Interpreter ABI Platform
overcomplete-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 114.9 kB

Release files / overcomplete-0.3.0.tar.gz

Download URL overcomplete-0.3.0.tar.gz
Size 47.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bf2a38939c73d6a6c9fc8c0cc311bf77ef87148c8380dc1563582fd5ed90f293
BLAKE2b-256 checksum
How to use checksums
002d1a8b2e39f8f204a8f8376545a2fbd8a5647243e22e34bc7f215348e4cc79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.14.0 Linux/6.8.0-1041-azure

Release files / overcomplete-0.3.0-py3-none-any.whl

Download URL overcomplete-0.3.0-py3-none-any.whl
Size 67.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4291a8fbfb3b6df9bbde927fb92a304bd8b7ba94523dd5ae617d861f139784fb
BLAKE2b-256 checksum
How to use checksums
4eb1ded311a1b889dcc0b77be65eaaa3f2f402242529b70ad036b31808dd542c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.14.0 Linux/6.8.0-1041-azure

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page