arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2406.01283cs.CLcs.AI
收藏

聚焦核心:通过剪枝Token压缩实现文档分类的高效注意力机制

Focus on the Core: Efficient Attention via Pruned Token Compression for Document Classification

Chung-Ang University(中央大学)

Jungmin Yun, Mihyeon Kim, Youngbin Kim

AI总结:

针对BERT自注意力机制计算成本高的问题,提出整合token剪枝与token合并策略,利用模糊逻辑降低误剪枝风险,在提升文档分类性能的同时显著降低内存开销并实现加速。

摘要:

基于Transformer的模型在众多NLP任务中取得了主导性能。尽管取得了显著成功,但诸如BERT的预训练Transformer模型仍受计算成本高昂的自注意力机制困扰,该机制会与所有token进行交互,包括对分类性能不利的token。为克服这些挑战,我们提出整合两种策略:token剪枝和token合并。token剪枝在逐层传递过程中,消除注意力机制键值中重要性较低的token。此外,我们采用模糊逻辑来处理不确定性,并缓解因每个token重要性分布不均而产生的潜在误剪枝风险。另一方面,token合并将输入序列压缩为更小规模,以进一步压缩模型。通过整合这两种方法,我们不仅提升了模型性能,还降低了计算需求。在多个数据集上的实验表明,相比基线模型表现出更优性能,尤其是相较现有BERT模型取得最佳改进,准确率提升+5%p,F1分数提升+5.6%p。此外,内存开销降至0.61x,并实现了1.64x的加速。

英文摘要:

Transformer-based models have achieved dominant performance in numerous NLP tasks. Despite their remarkable successes, pre-trained transformers such as BERT suffer from a computationally expensive self-attention mechanism that interacts with all tokens, including the ones unfavorable to classification performance. To overcome these challenges, we propose integrating two strategies: token pruning and token combining. Token pruning eliminates less important tokens in the attention mechanism's key and value as they pass through the layers. Additionally, we adopt fuzzy logic to handle uncertainty and alleviate potential mispruning risks arising from an imbalanced distribution of each token's importance. Token combining, on the other hand, condenses input sequences into smaller sizes in order to further compress the model. By integrating these two approaches, we not only improve the model's performance but also reduce its computational demands. Experiments with various datasets demonstrate superior performance compared to baseline models, especially with the best improvement over the existing BERT model, achieving +5%p in accuracy and +5.6%p in F1 score. Additionally, memory cost is reduced to 0.61x, and a speedup of 1.64x is achieved.

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

↑