SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2411.02335 · 2024

Sparsing Law: Towards Large Language Models with Greater Activation Sparsity

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 5 functions out of this paper's own repositories and ran 1 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
thunlp/SparsingLaw canonical 1 of 5
FunctionStatusWhere it lives
rotate_half Ran thunlp/SparsingLaw/src/model/modeling_minicpm.py
code served (permissive licence) · get_code("b99eea6376d1e212")
apply_rotary_pos_emb Not yet run thunlp/SparsingLaw/src/model/modeling_minicpm.py
code served (permissive licence) · get_code("272ad502078803a5")
prune_fat Not yet run thunlp/SparsingLaw/src/model_utils.py
code served (permissive licence) · get_code("167d6900988ed3a7")
prune_topk Not yet run thunlp/SparsingLaw/src/model_utils.py
code served (permissive licence) · get_code("9417cd3e73ae3442")
rms_layernorm Not yet run thunlp/SparsingLaw/src/model/modeling_minicpm.py
code served (permissive licence) · get_code("0c79a89a44329f57")

Repositories linked to this paper

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

Abstract

Activation sparsity denotes the existence of substantial weakly-contributed elements within activation outputs that can be eliminated, benefiting many important applications concerned with large language models (LLMs). Although promoting greater activation sparsity within LLMs deserves deep studies, existing works lack comprehensive and quantitative research on the correlation between activation sparsity and potentially influential factors. In this paper, we present a comprehensive study on the quantitative scaling properties and influential factors of the activation sparsity within decoder-only Transformer-based LLMs. Specifically, we propose PPL-$p\%$ sparsity, a precise and performance-aware activation sparsity metric that is applicable to any activation function. Through extensive experiments, we find several important phenomena. Firstly, different activation functions exhibit comparable performance but opposite training-time sparsity trends. The activation ratio (i.e., $1-\mathrm{sparsity\ ratio}$) evolves as a convergent increasing power-law and decreasing logspace power-law with the amount of training data for SiLU-activated and ReLU-activated LLMs, respectively. These demonstrate that ReLU is more efficient as the activation function than SiLU and can leverage more training data to improve activation sparsity. Secondly, the activation ratio linearly increases with the width-depth ratio below a certain bottleneck point, indicating the potential advantage of a deeper architecture at a fixed parameter scale. Finally, at similar width-depth ratios, we surprisingly find that the limit value of activation sparsity varies weakly with the parameter scale, i.e., the activation patterns within LLMs are insensitive to the parameter scale. These empirical laws towards LLMs with greater activation sparsity have important implications for making LLMs more efficient and interpretable.

For agents

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

get_harvested_code_for_paper("2411.02335")
get_code_for_paper("2411.02335")
have("2411.02335")

Connect an agent — have() is free.