通过稀疏激活机制动态分配隐藏维度,提升Transformer模型效率。
Mixture of Hidden-Dimensions Transformer
- 引入共享与专用子维度,按需激活关键特征
- 参数减少50%时性能仍高1.7%,3倍扩参下性能提升3.7%
- 适合追求高效训练与推理的NLP模型部署场景
Transformer模型在扩大隐藏维度时面临计算与内存开销激增的问题,且均匀扩展难以突出每令牌的关键特征。研究发现,训练后的Transformer仅使用少量隐藏维度,呈现持续激活的“激活流”模式:部分子维度在多个连续令牌间共享激活,另一些则专属于特定令牌。为此提出MoHD(Mixture of Hidden Dimensions),采用共享子维度处理通用特征,并通过路由机制动态激活专用子维度。为缓解稀疏性带来的信息损失,设计了激活缩放与分组融合机制以保留激活流。该方法在几乎不增加计算或参数的情况下扩展隐藏维度,实现高效训练与推理。在10个NLP任务上的评估表明,MoHD在参数效率和任务性能上均优于原始Transformer:激活参数减少50%时性能提升1.7%,参数扩大3倍但激活成本不变时性能提升3.7%。
原文摘要 · Abstract (English)
Transformer models encounter challenges in scaling hidden dimensions efficiently, as uniformly increasing them inflates computational and memory costs while failing to emphasize the most relevant features for each token. For further understanding, we study hidden dimension sparsity and observe that trained Transformers utilize only a small fraction of token dimensions, revealing an "activation flow" pattern. Notably, there are shared sub-dimensions with sustained activation across multiple consecutive tokens and specialized sub-dimensions uniquely activated for each token. To better model token-relevant sub-dimensions, we propose MoHD (Mixture of Hidden Dimensions), a sparse conditional activation architecture. Particularly, MoHD employs shared sub-dimensions for common token features and a routing mechanism to dynamically activate specialized sub-dimensions. To mitigate potential information loss from sparsity, we design activation scaling and group fusion mechanisms to preserve activation flow. In this way, MoHD expands hidden dimensions with negligible increases in computation or parameters, efficient training and inference while maintaining performance. Evaluations across 10 NLP tasks show that MoHD surpasses Vanilla Transformers in parameter efficiency and task performance. It achieves 1.7% higher performance with 50% fewer activation parameters and 3.7% higher performance with a 3x parameter expansion at constant activation cost. MOHD offers a new perspective for scaling the model, showcasing the potential of hidden dimension sparsity to boost efficiency
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。