arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2611.20331cs.LGcs.AIcs.AR
收藏

LENS:用可学习归一化状态替换Transformer中的LayerNorm和Softmax

LENS: Replacing LayerNorm and Softmax in Transformers with Learnable Normalization States

Ruhr-University Bochum(鲁尔大学波鸿分校)

Yuhao Liu, Salim Ullah, Akash Kumar

AI总结:

本研究提出LENS框架,将Transformer的LayerNorm和Softmax转化为硬件友好的可学习归一化状态,在ViT和Pythia模型等任务中匹配或接近基线性能,为资源受限加速器的Transformer架构探索提供基础。

摘要:

LayerNorm和注意力机制中的Softmax是Transformer的关键操作,但它们无法高效映射到硬件上的通用矩阵乘法(GEMM)计算。因此,现代硬件加速器设计(如ASIC/FPGA上的NPU)需要消耗大量硬件资源或芯片面积来实现其专用算术单元。基于LayerNorm、Softmax及其替代方法的前期研究,我们提出LENS(可学习归一化状态)框架,该框架通过从相关方法中抽象出通用结构,将LayerNorm重新表述为小型MLP,并将该方法扩展到Softmax,从而将Transformer中的更多计算转移到GEMM,形成硬件友好的架构。我们在图像分类(使用Vision Transformer,ViT)和自回归语言建模(使用Pythia模型)上评估LENS,包括在WikiText和LAMBADA上的泛化测试。在这些任务中,LENS在多种视觉设置中达到或超过基线性能,在其余视觉和语言实验中保留了大部分基线性能。这些发现可能表明,手动设计的归一化和注意力函数并非LayerNorm和Softmax的唯一替代选择,LENS也为探索面向资源受限加速器的Transformer架构提供了基础。

英文摘要:

LayerNorm and attention Softmax are critical operations in Transformers. However, they cannot be efficiently mapped to General Matrix Multiplication (GEMM) computations on hardware. Therefore, modern hardware accelerator designs, such as NPUs on ASIC/FPGA, consume a large amount of hardware resources or chip area to implement their specific arithmetic units. Building on previous work about LayerNorm, Softmax, and their alternatives, we introduce Learnable Normalization States (LENS), a framework that reformulates LayerNorm as tiny MLPs by abstracting a common structure from related methods and extends this method to Softmax, which moves more of the computation in Transformers to GEMM as a hardware-friendly architecture. We evaluate LENS on image classification with Vision Transformers (ViT) and autoregressive language modeling with Pythia models, including generalization tests on WikiText and LAMBADA. Across these tasks, LENS matches or exceeds baseline performance in several vision settings and retains most of the baseline performance in the remaining vision and language experiments. These findings may suggest that hand-designed normalization and attention functions are not the only choice as alternatives to LayerNorm and Softmax. LENS also provides a basis for exploring Transformer architectures for resource-limited accelerators.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑