BatchTopK
Implementation of the BatchTopK activation function for training sparse autoencoders (SAEs)
Install / Use
/learn @bartbussmann/BatchTopKREADME
BatchTopK Sparse Autoencoders
BatchTopK is a novel approach to Sparse Autoencoders (SAEs) that offers an alternative to TopK SAEs as introduced by OpenAI. This repository contains the implementation and experiments for BatchTopK SAEs, as described in our preliminary findings.
What is the BatchTopK activation function?
BatchTopK modifies the TopK activation in SAEs in the following way:
- Instead of applying TopK to each sample independently, it flattens all feature activations across the batch.
- It then takes the top (K * batch_size) activations.
- Finally, it reshapes the result back to the original batch shape.
Usage
git clone https://github.com/bartbussmann/BatchTopK.git
cd BatchTopK
pip install transformer_lens
python main.py
Acknowledgments
The training code is heavily inspired and basically a stripped-down version of SAELens. Thanks to the SAELens team for their foundational work in this area!
Related Skills
YC-Killer
2.7kA library of enterprise-grade AI agents designed to democratize artificial intelligence and provide free, open-source alternatives to overvalued Y Combinator startups. If you are excited about democratizing AI access & AI agents, please star ⭐️ this repository and use the link in the readme to join our open source AI research team.
groundhog
398Groundhog's primary purpose is to teach people how Cursor and all these other coding agents work under the hood. If you understand how these coding assistants work from first principles, then you can drive these tools harder (or perhaps make your own!).
isf-agent
a repo for an agent that helps researchers apply for isf funding
last30days-skill
17.6kAI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
