LENS: Replacing LayerNorm and Softmax in Transformers with Learnable Normalization States
Abstract
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.
Create a lesson
Metadata
- Categories
- cs.LG, cs.AI, cs.AR
- Comments
- Source code is available at: https://github.com/liuyh-Horizon/LENS
Related papers
EPI-SST: Renewal-Structured State-Space Transformers for Epidemic Forecasting
Shared title terminologycs.LGYiyun Chen, Zewen Liu, Shengpu Tang et al.
Symmetry Fingerprinting with Geometric Learnable Invariants Transformers
Shared title terminologycs.LGBart M. N. Smets, Gijs Bellaard, Pieter Wils
Learning Compact State Abstractions for LLM Agents
Shared title terminologycs.LGYaswanth Chittepu, Raghavendra Addanki, Anup Rao et al.
Tokenization and Architecture Jointly Allocate Component Roles in Time Series Transformers
Shared title terminologycs.LGMingyu Kim, Doguk Kim
Boundary Representation-Driven Graph Transformer Modeling for Machining Operation Sequencing
Shared title terminologycs.LGFatemeh Elhambakhsh, Gaurav Ameta, Aditi Roy et al.
SwiftLoop: Selective Refinement for Adaptive Implicit Reasoning in Looped Transformers
Shared title terminologycs.LGTianyi Zhao, Ke Wan, Chen Chen