Inference on large language models (LLMs) can be expensive in terms of the compute and memory costs involved, especially when long sequence lengths are used. In particular, the self-attention mechanism used in LLM inference contributes significantly to these costs, which has sparked an interest in approximating the self-attention computation to reduce such costs. In this work, we propose to approximate self-attention by focusing on the dimensionality of key vectors computed in the attention block. Our analysis reveals that key vectors lie in a significantly lower-dimensional space, consistently across several datasets and models. Exploiting this observation, we propose Loki, a novel sparse attention method that ranks and selects tokens in the KV-cache based on attention scores computed in low-dimensional space. Our evaluations show that Loki is able to speed up the attention computation due to reduced data movement (load/store) and compute costs while maintaining the efficacy of the models better than other popular approximation methods.
One-Prompt Strikes Back: Sparse Mixture of Experts for Prompt-based Continual Learning
Trivita AI;The University of Texas at Austin(德克萨斯大学奥斯汀分校);Northeastern University(东北大学);Hanoi University of Science and Technology(河内科学技术大学);Rutgers University(罗格斯大学)
TradingMoE: Routing the Right Experts in Evolving Markets
University of Science and Technology of China(中国科学技术大学);The Chinese University of Hong Kong(香港中文大学);The University of Tokyo(东京大学);Singapore Management University(新加坡管理大学)
PQ-HSA: Reusing Product-Quantized Scores for Hybrid Sparse-Approximate Attention
The Hong Kong University of Science and Technology(香港科技大学);Huawei Technologies Ltd.(华为技术有限公司);Sun Yat-sen University(中山大学);Nanyang Technological University(南洋理工大学)
School of Electronic Engineering, Xidian University(西安电子科技大学电子工程学院);Stony Brook University(石溪大学);TUM(慕尼黑工业大学);MIT(麻省理工学院);Amazon AGI SF Lab(亚马逊AGI旧金山实验室)
A Mathematical Theory of Top-$k$ Sparse Attention via Total Variation Distance
Theory Laboratory, Central Research Institute, 2012 Laboratory, Huawei Technologies Co., Ltd.(华为技术有限公司理论实验室、中央研究院、2012实验室);National Technical University of Athens(希腊国家技术大学);Trustworthy Technology and Engineering Laboratory, Heisenberg Research Center, 2012 Laboratory, Huawei Technologies Co., Ltd.(华为技术有限公司可信技术与工程实验室、海森堡研究中心、2012实验室)