arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2303.07585cs.CL
收藏

基于注意值的输入长度缩短和文本生成

Input-length-shortening and text generation via attention values

The University of Auckland(奥克兰大学)

Neşet Özkan Tan, Alex Yuxuan Peng, Joshua Bensemann, Qiming Bao, Tim Hartill, Mark Gahegan, Michael Witbrock

摘要:

识别对任务性能影响更大的单词是自然语言处理中的一个挑战。Transformers模型最近通过结合分配更多注意力的注意力机制(即,相关性)得分比其他一些词。由于注意力机制的高计算成本,Transformer模型通常具有由硬件约束引起的输入长度限制。这种限制适用于许多Transformers,包括众所周知的Transformer(BERT)模型的双向编码器表示。在本文中,我们研究了BERT的注意力分配机制,主要集中在两个问题:(1)如何利用注意力来减少输入长度?(2)如何将注意力用作条件文本生成的控制机制?我们在文本分类任务的背景下研究了这些问题。我们发现,与后面的层相比,BERT的早期层为文本分类任务分配了更多的关键注意力分数。我们证明了第一层的注意力总和可以用于过滤给定序列中的令牌,大大减少了输入长度,同时保持了良好的测试精度。我们还应用了过滤,它使用计算效率高的语义相似性算法,并发现保留约6%的原始序列足以获得86.5%的准确性。最后,我们证明了我们可以以稳定的方式生成数据,并且根据BERT的第一层,仅使用一小部分(10%)具有高注意力分数的标记,就可以与原始数据区分开来。

英文摘要:

Identifying words that impact a task's performance more than others is a challenge in natural language processing. Transformers models have recently addressed this issue by incorporating an attention mechanism that assigns greater attention (i.e., relevance) scores to some words than others. Because of the attention mechanism's high computational cost, transformer models usually have an input-length limitation caused by hardware constraints. This limitation applies to many transformers, including the well-known bidirectional encoder representations of the transformer (BERT) model. In this paper, we examined BERT's attention assignment mechanism, focusing on two questions: (1) How can attention be employed to reduce input length? (2) How can attention be used as a control mechanism for conditional text generation? We investigated these questions in the context of a text classification task. We discovered that BERT's early layers assign more critical attention scores for text classification tasks compared to later layers. We demonstrated that the first layer's attention sums could be used to filter tokens in a given sequence, considerably decreasing the input length while maintaining good test accuracy. We also applied filtering, which uses a compute-efficient semantic similarities algorithm, and discovered that retaining approximately 6\% of the original sequence is sufficient to obtain 86.5\% accuracy. Finally, we showed that we could generate data in a stable manner and indistinguishable from the original one by only using a small percentage (10\%) of the tokens with high attention scores according to BERT's first layer.

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

↑