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

语言模型需要归纳偏置来进行归纳计数

Language Models Need Inductive Biases to Count Inductively

Carnegie Mellon University(卡内基梅隆大学)

Yingshan Chang, Yonatan Bisk

AI总结:

本文研究了语言模型的归纳计数能力,发现传统RNN能轻松实现归纳计数,而Transformer和现代RNN因架构设计需依赖位置嵌入或丧失循环特性而表现不佳。

摘要:

计数是泛化的一个基本例子,无论是通过定义自然数的 Peano 公理这一数学视角,还是从儿童学习计数的认知科学文献来看,都是如此。这两种情况都支持这样一个论点:学习计数意味着学习无限地计数。虽然很少有论文试图将 Transformer 的“推理”提炼为最简单的计数情况,但文献中确实存在对长度泛化的研究。在 NLP 的“短训练,长测试”范式中,长度指的是训练句子的长度。在形式语言识别中,长度指的是输入序列的长度,或者下推自动机产生的最大栈大小。在一般问题解决中,长度指的是演绎推理链中的跳数或递归深度。对于所有情况,计数对任务成功至关重要。而且至关重要的是,归纳地泛化计数对于在 OOD 实例上取得成功是核心。这项工作提供了训练语言模型进行计数的广泛实证结果。我们实验了从 RNNs、Transformers、State-Space Models 到 RWKV 的各种架构。我们提出了精心设计的任务格式、辅助任务和位置嵌入,以避免 OOD 位置和 OOD 词汇在泛化方面的限制。我们发现,虽然传统 RNNs 轻松实现了归纳计数,但 Transformers 必须依赖位置嵌入才能在域外进行计数。由于计数是关于 Transformers 表达能力的许多论证的基础,我们的发现呼吁社区重新审视形式化表征中定义的原始函数的应用范围。最后,现代 RNNs 在归纳泛化计数方面也很大程度上表现不如传统 RNNs。我们讨论了使现代 RNNs 能够进行并行训练的设计选择如何导致它们失去循环特性的优势。

英文摘要:

Counting is a fundamental example of generalization, whether viewed through the mathematical lens of Peano's axioms defining the natural numbers or the cognitive science literature for children learning to count. The argument holds for both cases that learning to count means learning to count infinitely. While few papers have tried to distill transformer "reasoning" to the simplest case of counting, investigating length generalization does occur throughout the literature. In the "train short, test long" paradigm of NLP, length refers to the training sentence length. In formal language recognition, length refers to the input sequence length, or the maximum stack size induced by a pushdown automata. In general problem solving, length refers to the number of hops in a deductive reasoning chain or the recursion depth. For all cases, counting is central to task success. And crucially, generalizing counting inductively is central to success on OOD instances. This work provides extensive empirical results on training language models to count. We experiment with architectures ranging from RNNs, Transformers, State-Space Models and RWKV. We present carefully-designed task formats, auxiliary tasks and positional embeddings to avoid limitations in generalization with OOD-position and OOD-vocabulary. We find that while traditional RNNs trivially achieve inductive counting, Transformers have to rely on positional embeddings to count out-of-domain. As counting is the basis for many arguments concerning the expressivity of Transformers, our finding calls for the community to reexamine the application scope of primitive functions defined in formal characterizations. Finally, modern RNNs also largely underperform traditional RNNs in generalizing counting inductively. We discuss how design choices that enable parallelized training of modern RNNs cause them to lose merits of a recurrent nature.

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

↑