Sparse Semantic Dimension as a Generalization Certificate for LLMs
Dibyanayan Bandyopadhyay, Asif Ekbal
TL;DR
This work tackles the Generalization Paradox of large language models by proposing Sparse Semantic Dimension (SSD), a data-dependent complexity measure derived from sparse representations learned by a Sparse Autoencoder (SAE) over model activations. Treating the LLM and SAE as frozen oracles, it derives a high-probability generalization bound that scales with the active feature pool size $P$ rather than the parameter count, enabling non-vacuous certificates on real models like GPT-2 Small and Gemma-2B. Empirically, larger models exhibit sharper, more compressible semantic dictionaries, requiring fewer calibration samples to certify generalization, and the framework provides a practical safety monitor via a “feature explosion” signal under out-of-distribution inputs. The approach links interpretability and compression to formal guarantees, offering runtime indicators (per-input sparsity) for epistemic uncertainty and paving the way for layer-wise and dynamic extensions of SSD-based certifiable generalization.
Abstract
Standard statistical learning theory predicts that Large Language Models (LLMs) should overfit because their parameter counts vastly exceed the number of training tokens. Yet, in practice, they generalize robustly. We propose that the effective capacity controlling generalization lies in the geometry of the model's internal representations: while the parameter space is high-dimensional, the activation states lie on a low-dimensional, sparse manifold. To formalize this, we introduce the Sparse Semantic Dimension (SSD), a complexity measure derived from the active feature vocabulary of a Sparse Autoencoder (SAE) trained on the model's layers. Treating the LLM and SAE as frozen oracles, we utilize this framework to attribute the model's generalization capabilities to the sparsity of the dictionary rather than the total parameter count. Empirically, we validate this framework on GPT-2 Small and Gemma-2B, demonstrating that our bound provides non-vacuous certificates at realistic sample sizes. Crucially, we uncover a counter-intuitive "feature sharpness" scaling law: despite being an order of magnitude larger, Gemma-2B requires significantly fewer calibration samples to identify its active manifold compared to GPT-2, suggesting that larger models learn more compressible, distinct semantic structures. Finally, we show that this framework functions as a reliable safety monitor: out-of-distribution inputs trigger a measurable "feature explosion" (a sharp spike in active features), effectively signaling epistemic uncertainty through learned feature violation. Code is available at: https://github.com/newcodevelop/sparse-semantic-dimension.
