SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2604.14925 · 2026

Improving Sparse Autoencoder with Dynamic Attention

Hui Huang, Dongsheng Wang, Dawei Su, Jinsen Zhang

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 9 functions out of this paper's own repositories and ran 8 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.

RepositoryRoleRan
qyj-bkjx/Sparsemax-SAE canonical 8 of 9
FunctionStatusWhere it lives
calculate_entropy Ran qyj-bkjx/Sparsemax-SAE/analysis/utils.py
code served (permissive licence) · get_code("c0113839c1642005")
compute_sae_statistics Ran qyj-bkjx/Sparsemax-SAE/tasks/compute_sae_feature_data.py
code served (permissive licence) · get_code("be6de4d697ccdf33")
get_new_top_k Ran qyj-bkjx/Sparsemax-SAE/tasks/compute_sae_feature_data.py
code served (permissive licence) · get_code("c01b37959def9a7a")
get_scheduler Ran qyj-bkjx/Sparsemax-SAE/src/sae_training/utils.py
code served (permissive licence) · get_code("4a7cb61e02537776")
initialize_storage_tensors Ran qyj-bkjx/Sparsemax-SAE/tasks/compute_sae_feature_data.py
code served (permissive licence) · get_code("4ac47bf25991d79d")
jumprelu Ran qyj-bkjx/Sparsemax-SAE/src/sae_training/sparse_autoencoder.py
code served (permissive licence) · get_code("95064e15c301021f")
rectangle Ran qyj-bkjx/Sparsemax-SAE/src/sae_training/sparse_autoencoder.py
code served (permissive licence) · get_code("ab8a7e7ab1adad5a")
step Ran qyj-bkjx/Sparsemax-SAE/src/sae_training/sparse_autoencoder.py
code served (permissive licence) · get_code("06d421a8db58516e")
load_stats Not yet run qyj-bkjx/Sparsemax-SAE/analysis/utils.py
code served (permissive licence) · get_code("daa2ff5af7df15ac")

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Recently, sparse autoencoders (SAEs) have emerged as a promising technique for interpreting activations in foundation models by disentangling features into a sparse set of concepts. However, identifying the optimal level of sparsity for each neuron remains challenging in practice: excessive sparsity might lead to poor reconstruction, whereas insufficient sparsity harms interpretability. While existing activation functions such as ReLU and TopK provide certain sparsity guarantees, they typically require additional sparsity regularization or cherry-picked hyperparameters. We show in this paper that adaptive sparse attention mechanisms using sparsemax can bridge this trade-off, due to their ability to determine the number of concepts in a datadependent manner. Specifically, we first explore a new class of SAEs based on the cross-attention architecture with the latent features as queries and the learnable dictionary as the key and value matrices. To encourage sparse pattern learning, we employ a sparsemax-based attention strategy that automatically infers a sparse set of concepts according to the complexity of each neuron, resulting in a more flexible and efficient activation function. Through comprehensive evaluation and visualization, we show that our approach successfully achieves lower reconstruction loss while producing high-quality concepts. Moreover, the sparsity level automatically determined by our approach can serve as tuning guidance to improve existing SAEs. The code is available https://github.com/qyj-bkjx/Sparsemax-SAE.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2604.14925")
get_code_for_paper("2604.14925")
have("2604.14925")

Connect an agent — have() is free.