Attention-based Transformers have demonstrated strong adaptability across a wide range of tasks and have become the backbone of modern Large Language Models (LLMs). However, their underlying mechanisms remain open for further exploration. The energy-based perspective has long provided a valuable principle for understanding neural computation. In this paper, we revisit the principle of energy as a lens to understand attention-based Transformer models. We present a unified energy-based framework which is composed of three key components: the local energy $E_i$, the global energy $F$, and the employed optimization algorithms. We show that different attention forms including unnormalized linear attention, gated linear attention and standard softmax attention can be induced by choosing their corresponding recipes within this framework. Building on this framework, we propose energy-based modifications of attention structures. Inspired by classical gradient descent (GD) algorithms, we extend the original attention formulation based on standard GD to the momentum-based GD, Nesterov Accelerated Gradient (NAG), and Newton's method, each inducing a corresponding new attention structure. Our experiments provide preliminary support for the potential of the energy-based framework for designing attention mechanisms.
PipeOptim: Ensuring Effective 1F1B Schedule with Optimizer-Dependent Weight Prediction
College of Computer Science and Technology, Taiyuan University of Technology(太原理工大学计算机科学与技术学院);School of Computer, National University of Defense Technology(国防科技大学计算机学院);School of Computer and Information Technology, Shanxi University(山西大学计算机与信息技术学院)
On Mesa-Optimization in Autoregressively Trained Transformers: Emergence and Capability
Gaoling School of Artificial Intelligence, Renmin University of China(中国人民大学高瓴人工智能学院);RIKEN AIP(理化学研究所人工智能项目);School of Software, Shandong University(山东大学软件学院);Dept. of Comp. Sci. & Tech., BNRist Center, THU-Bosch ML Center, Tsinghua University(清华大学计算机科学与技术系、BNRist中心、THU-Bosch机器学习中心)
Momentum Stiefel Optimizer, with Applications to Suitably-Orthogonal Attention, and Optimal Transport
Georgia Institute of Technology(佐治亚理工学院)
Stiefel流形上的优化问题,即,满足正交性约束的(不一定是正方形的)矩阵的最小化函数已经被广泛研究。然而,提出了一种新的方法的基础上,第一次,精心设计的连续和离散动态之间的相互作用。它导致了一个基于梯度的优化器,具有内在的附加动量。该方法精确地保持了流形结构,但不需要额外的操作来保持变化的(余)切空间中的动量,因此具有较低的计算成本和令人满意的精度。它的推广自适应学习率也证明。在实际任务中观察到显著的性能。例如,我们发现,当使用我们的优化器时,对从头开始训练的视觉Transformer [Dosovitskiy et al. 2022]的注意力头部设置正交约束可以显著提高其性能,并且每个头部最好在其自身内正交,但不一定与其他头部正交。该优化器还使投影鲁棒Wasserstein距离[Paty & Cuturi 2019; Lin et al. 2020]的有用概念对于高维度最优传输更加有效。
Full-Stack FP4: Stable LLM Pretraining with Quantized Projections, Optimizers, and Attention
Institute of Automation, Chinese Academy of Sciences(中国科学院自动化研究所);Sichuan University(四川大学);Beijing Zhongguancun Academy(北京中关村科学院);Zhejiang University(浙江大学);Beijing Key Laboratory of Brain-Inspired General Intelligence Large Model(北京脑科学与类脑研究中心通用人工智能大模型北京市重点实验室);Key Laboratory of Brain Cognition and Brain-inspired Intelligence Technology(脑认知与脑机智能技术重点实验室)