peal.sparse_dictionaries.batch_topk

BatchTopK sparse autoencoder as a PEAL sparse dictionary.

Sparse dictionaries decompose a generator’s semantic latent (or a classifier’s feature space) into interpretable directions that adaptors such as DiDAE edit along. This module wraps PEAL’s own BatchTopK network from peal.sparse_dictionaries.batch_topk_network behind the SparseDictionary interface: it centres activations with a stored mean mu, trains with train_batch_topk_saes or a local loop with TensorBoard logging, and saves/loads the encoder/decoder weights as a plain torch checkpoint.

Classes

BatchTopKSAE

Sparse dictionary backed by the vendored BatchTopK SAE.

BatchTopKSAEConfig

Config of BatchTopKSAE.