Uniform Sparsity-Distortion Adapter
Implementation & benchmark of arXiv:2607.26261 — The Code Distortion Problem
Source paper: The Code Distortion Problem arXiv:2607.26261 ⓘ · analyzed Aug 31, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Train a linear adapter between two representation spaces so that it preserves not only feature values but also the relative sparsity of sampled directions in the source representation subspace. Penalize the logarithmic spread between the largest and smallest support-size expansion ratios, preventing the adapter from making some directions dense while collapsing others. This is useful for transferring sparse features between checkpoints, aligning sparse autoencoders, or inserting a pruning-compatible adapter into a frozen network.
Formulas
Mathematical statement
The paper defines, for linear codes \(\mathcal C_1,\mathcal C_2\subseteq\mathbb F_q^n\) and a linear map \(T\) satisfying \(T(\mathcal C_1)=\mathcal C_2\), the distortion \(\mathcal D_T(\mathcal C_1,\mathcal C_2)=\left(\max_{x\in\mathcal C_1\setminus\{0\}}\frac{\|Tx\|_0}{\|x\|_0}\right)\big/\left(\min_{x\in\mathcal C_1\setminus\{0\}}\frac{\|Tx\|_0}{\|x\|_0}\right)\). Here \(\|x\|_0\) is the number of nonzero coordinates, the maximum is the largest sparsity expansion factor, the minimum is the smallest factor, and \(\mathcal D_T\ge 1\) measures non-uniformity of sparsity distortion. For real neural features, replace the discontinuous support count by \(s_\tau(z)=\sum_i(1-e^{-z_i^2/\tau^2})\), where \(\tau>0\) is a temperature. Given source directions \(u_j\) and adapter \(T\), define \(r_j=\frac{s_\tau(Tu_j)+\epsilon}{s_\tau(u_j)+\epsilon}\), with \(\epsilon>0\) preventing division by zero, and minimize the differentiable surrogate \(L_{\mathrm{dist}}=\log(\max_j r_j+\epsilon)-\log(\min_j r_j+\epsilon)\). This is the soft analogue of the paper's max/min ratio and is zero when all sampled directions undergo the same support scaling.
Implementation notes
Integrate the regularizer into a linear representation adapter, sparse-autoencoder dictionary map, or the first linear layer after a frozen encoder. Let the source feature tensor be \(U\in\mathbb R^{B\times d}\), let \(T\in\mathbb R^{d'\times d}\) be the trainable adapter, and let \(V\) be target features if feature matching is available. First normalize sampled directions \(u_j\) to unit \(\ell_2\) norm. Use minibatch activation vectors, individual examples, feature basis vectors, and random linear combinations of activation vectors so that the constraint is not tied to one observed basis. Compute soft supports using \(s_\tau(z)=\sum_i(1-\exp(-z_i^2/\tau^2))\), then compute ratios \(r_j=(s_\tau(Tu_j)+\epsilon)/(s_\tau(u_j)+\epsilon)\). Add the range loss \(L_{\mathrm{dist}}=\log(\max r_j+\epsilon)-\log(\min r_j+\epsilon)\) to the task or feature-matching loss. Use log-sum-exp soft extrema during early training if hard max/min produces unstable gradients. Initialize \(T\) as identity for equal widths or an orthogonal rectangular map for unequal widths. Anneal \(\tau\) from approximately 0.2 to 0.03 times the median absolute activation. The exact mathematics supplies the max/min distortion criterion; sampled directions and soft support values are empirical approximations. The first experiment should align two 256-dimensional sparse-autoencoder representations on CIFAR-10 or a small Transformer residual stream. Compare MSE-only, MSE plus L1 sparsity, and MSE plus this distortion loss. Measure task accuracy, activation density after a fixed threshold, the variance and max/min range of per-direction sparsity ratios, and pruning accuracy. Success is equal accuracy at lower activation density, improved transfer accuracy at fixed density, or a substantially smaller sparsity-ratio range without increasing training FLOPs materially.
Verification
This idea has not been verified yet.
Verification happens in two stages: Stage 1 — a mechanism check on a toy system confirms the claimed mathematical phenomenon reproduces; Stage 2 — a benchmark implements the idea on a real (small) neural network task and compares it against a tuned baseline over 8 paired seeds with a permutation test.
Artifacts
Artifacts unavailable.