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

关注事实:量化注意力层的知识容量

Paying Attention to Facts: Quantifying the Knowledge Capacity of Attention Layers

Liang Ze Wong

AI总结:

本文用三阶张量秩量化单层注意力 Transformer 的事实记忆容量,揭示注意力权重与事实回忆的关系,并提出不增参数即可提升层容量的方法。

摘要:

本文从线性代数视角研究仅含单层注意力的 Transformer(即注意力层)记忆数据库中事实的能力。我们为每个数据库关联一个三阶张量,提出以该张量的秩作为数据库规模的度量,并根据数据库性质给出秩的界。我们还定义了与注意力层对应的三阶张量,并在玩具模型和随机数据库数据集上实证展示了其秩与数据库秩之间的关系。通过强调值-输出权重和查询-键权重所起的作用,以及 argmax 和 softmax 对秩的影响,我们的结果揭示了 Transformer 事实回忆中的“加性模式”,同时提出了一种在不增加参数数量的情况下提高层容量的方法。

英文摘要:

In this paper, we investigate the ability of single-layer attention-only transformers (i.e. attention layers) to memorize facts contained in databases from a linear-algebraic perspective. We associate with each database a 3-tensor, propose the rank of this tensor as a measure of the size of the database, and provide bounds on the rank in terms of properties of the database. We also define a 3-tensor corresponding to an attention layer, and empirically demonstrate the relationship between its rank and database rank on a dataset of toy models and random databases. By highlighting the roles played by the value-output and query-key weights, and the effects of argmax and softmax on rank, our results shed light on the `additive motif' of factual recall in transformers, while also suggesting a way of increasing layer capacity without increasing the number of parameters.

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

↑