EchoAtt: Attend, Copy, then Adjust for More Efficient Large Language Models

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Rajabzadeh, Hossein, Jafari, Aref, Sharma, Aman, Jami, Benyamin, Kwon, Hyock Ju, Ghodsi, Ali, Chen, Boxing, Rezagholizadeh, Mehdi
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915575134945280
author Rajabzadeh, Hossein
Jafari, Aref
Sharma, Aman
Jami, Benyamin
Kwon, Hyock Ju
Ghodsi, Ali
Chen, Boxing
Rezagholizadeh, Mehdi
author_facet Rajabzadeh, Hossein
Jafari, Aref
Sharma, Aman
Jami, Benyamin
Kwon, Hyock Ju
Ghodsi, Ali
Chen, Boxing
Rezagholizadeh, Mehdi
contents Large Language Models (LLMs), with their increasing depth and number of parameters, have demonstrated outstanding performance across a variety of natural language processing tasks. However, this growth in scale leads to increased computational demands, particularly during inference and fine-tuning. To address these challenges, we introduce EchoAtt, a novel framework aimed at optimizing transformer-based models by analyzing and leveraging the similarity of attention patterns across layers. Our analysis reveals that many inner layers in LLMs, especially larger ones, exhibit highly similar attention matrices. By exploiting this similarity, EchoAtt enables the sharing of attention matrices in less critical layers, significantly reducing computational requirements without compromising performance. We incorporate this approach within a knowledge distillation setup, where a pre-trained teacher model guides the training of a smaller student model. The student model selectively shares attention matrices in layers with high similarity while inheriting key parameters from the teacher. Our best results with TinyLLaMA-1.1B demonstrate that EchoAtt improves inference speed by 15\%, training speed by 25\%, and reduces the number of parameters by approximately 4\%, all while improving zero-shot performance. These findings highlight the potential of attention matrix sharing to enhance the efficiency of LLMs, making them more practical for real-time and resource-limited applications.
format Preprint
id arxiv_https___arxiv_org_abs_2409_14595
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle EchoAtt: Attend, Copy, then Adjust for More Efficient Large Language Models
Rajabzadeh, Hossein
Jafari, Aref
Sharma, Aman
Jami, Benyamin
Kwon, Hyock Ju
Ghodsi, Ali
Chen, Boxing
Rezagholizadeh, Mehdi
Computation and Language
Machine Learning
Large Language Models (LLMs), with their increasing depth and number of parameters, have demonstrated outstanding performance across a variety of natural language processing tasks. However, this growth in scale leads to increased computational demands, particularly during inference and fine-tuning. To address these challenges, we introduce EchoAtt, a novel framework aimed at optimizing transformer-based models by analyzing and leveraging the similarity of attention patterns across layers. Our analysis reveals that many inner layers in LLMs, especially larger ones, exhibit highly similar attention matrices. By exploiting this similarity, EchoAtt enables the sharing of attention matrices in less critical layers, significantly reducing computational requirements without compromising performance. We incorporate this approach within a knowledge distillation setup, where a pre-trained teacher model guides the training of a smaller student model. The student model selectively shares attention matrices in layers with high similarity while inheriting key parameters from the teacher. Our best results with TinyLLaMA-1.1B demonstrate that EchoAtt improves inference speed by 15\%, training speed by 25\%, and reduces the number of parameters by approximately 4\%, all while improving zero-shot performance. These findings highlight the potential of attention matrix sharing to enhance the efficiency of LLMs, making them more practical for real-time and resource-limited applications.
title EchoAtt: Attend, Copy, then Adjust for More Efficient Large Language Models
topic Computation and Language
Machine Learning
url https://arxiv.org/abs/2409.14595