§2 关于归纳偏置
2. About Inductive Biases
The no-free-lunch theorem for machine learning basically says that some set of preferences (or inductive bias) over the space of all functions is necessary to obtain generalization, that there is no completely general-purpose learning algorithm, that any learning algorithm will generalize better on some distributions and worse on others.
机器学习的免费午餐定理(no-free-lunch theorem)基本上是说:要在所有函数的空间中实现泛化,必须对函数空间施加某种偏好(即归纳偏置);不存在完全通用的学习算法;任何学习算法都会在某些分布上泛化得更好、在另一些分布上更差。
Typically, given a particular dataset and loss function, there are many possible solutions (e.g. parameter assignments) to the learning problem that exhibit equally "good" performance on the training points. Given a finite training set, the only way to generalize to new input configurations is then to rely on some assumptions or preferences about the solution we are looking for.
通常,给定一个数据集和损失函数,学习问题存在许多同样「好」的候选解(如参数配置)。给定有限的训练集,要泛化到新的输入配置,唯一的方法就是依赖对所求解的某些假设或偏好。
An important question for AI research aiming at human-level performance then is to identify inductive biases that are most relevant to the human perspective on the world around us. Inductive biases, broadly speaking, encourage the learning algorithm to prioritise solutions with certain properties.
因此,对以人类水平为目标的人工智能研究来说,一个重要问题是:识别出与我们周围世界的人类视角最相关的归纳偏置。宽泛地说,归纳偏置鼓励学习算法优先选择具有某些属性的解。
Table 1 lists some of the inductive biases already used in various neural networks, and the corresponding properties. Although they are often expressed in terms of a neural architecture, they can also be about how the networks are trained, e.g., unsupervised pre-training, self-supervised learning and semi-supervised training, which all have to do with the input distribution P(X) being informative about future tasks P(Y|X).
表 1 列出了各类神经网络中已经使用的一些归纳偏置及其对应的属性。尽管它们通常以神经架构的形式表达,但也可能与网络的训练方式有关——例如无监督预训练、自监督学习和半监督训练,这些都关乎「输入分布 P(X) 对未来任务 P(Y|X) 具有信息量」这一点。
表 1 · 深度学习当前归纳偏置举例(含架构相关与训练框架相关)
| 归纳偏置 | 对应属性 |
| 分布式表征 | 输入被映射为特征模式 |
| 卷积 | 群等变性(通常在空间上) |
| 深层架构 | 复杂函数 = 简单函数的复合 |
| 图神经网络 | 对实体与关系的等变性 |
| 循环网络 | 对时间的等变性 |
| 软注意力 | 对排列的等变性 |
| 自监督预训练 | P(X) 对 P(Y|X) 具有信息量 |
表 2 · 本文提出的额外归纳偏置
Table 2: Proposed additional inductive biases for deep learning
本文提出的六项新增归纳偏置(表 2 摘要)——第 3 章逐一展开
| 归纳偏置 | 核心思想 |
| 高层变量扮演因果角色 | 学习潜在实体/属性的表征 |
| 分布变化源于因果干预 | 分布变化来源在恰当语义空间中是稀疏且局部的 |
| 知识是通用的、定义在抽象变量之上 | 把知识分解为抽象变量与可复用函数 |
| 依赖稀疏性 | 学到的函数只作用于稀疏的变量集合(如类型化编程语言中的参数) |
| 短因果链 | 用于学习或推理的因果链被分解为时间上彼此很远但很短的短因果链 |
| 上下文依赖处理(目标、自上而下影响、自下而上竞争) | 在计算层级每一层动态结合自上而下上下文与自下而上感官信号 |
从归纳偏置到算法
From Inductive Biases to Algorithms
There are many ways to encode such biases—e.g. explicit regularisation objectives, architectural constraints, parameter sharing, implicit effects of the choice of the optimization method, self-supervised learning or self-supervised pre-training, invariance or equivariance to known transformations, or choices of prior distributions in a Bayesian model.
编码这类偏置有许多方式——例如显式的正则化目标、架构约束、参数共享、优化方法选择的隐式效应、自监督学习或自监督预训练、对已知变换的不变性或等变性,或在贝叶斯模型中对先验分布的选择。
For example, one can build translation invariance of a neural network output by replacing matrix multiplication by convolutions and pooling, or by averaging the network predictions over transformations of the input (feature averaging), or by training on a dataset augmented with these transformations (data augmentation).
例如,可以通过用卷积和池化替换矩阵乘法、对输入的变换做网络预测的平均(特征平均),或用这些变换扩充数据集来训练(数据增强),从而构建神经网络输出的平移不变性。
Whereas some inductive biases can easily be encoded into the learning algorithm (e.g. with convolutions), the preference over functions is sometimes implicit and not intended by the designer of the learning system, and it is sometimes not obvious how to turn an inductive bias into a machine learning method, this conversion often being the core contribution of machine learning papers.
虽然有些归纳偏置可以轻易编码进学习算法(如卷积),但对函数的偏好有时是隐式的、并非系统设计者有意为之;而且如何把一项归纳偏置转化为机器学习方法有时并不明显——这种转化往往正是机器学习论文的核心贡献。
把归纳偏置视为数据
Inductive Biases as Data
We can think of inductive biases or priors and built-in structure as "training data in disguise", and one can compensate lack of sufficiently powerful priors by more data.
我们可以把归纳偏置、先验与内置结构看作「伪装的训练数据」,并可用更多数据来补偿先验不够强的不足。
Interestingly, different inductive biases may be equivalent to more or less data (even possibly exponentially more data): we suspect that inductive biases based on a form of compositionality (like distributed representations, depth and attention) can potentially also provide a larger advantage (to the extent that they apply well to the function to be learned).
有趣的是,不同的归纳偏置可能等价于多少不等的额外数据(甚至可能是指数级更多的数据):我们怀疑,基于某种组合性(如分布式表征、深度与注意力)的归纳偏置,同样可能提供更大的优势(只要它们很好地适用于待学函数)。
In general, priors can be imperfect and this shows most with large datasets. Even for good priors, the advantage of inductive biases may be smaller on very large datasets, which suggests that transfer settings (where only few examples are available for the new distribution) are interesting to evaluate the advantage of inductive biases and of their implementation.
一般而言,先验可能不完美,这一点在大型数据集上最明显。即便是好的先验,在非常大的数据集上,归纳偏置的优势也可能变小——这提示:迁移场景(新分布只有少量样本可用)才是评估归纳偏置及其实现优势的有趣场所。
能动性、序列决策与非平稳数据流
Agency, Sequential Decision Making and Non-Stationary Data Streams
The classical framework for machine learning is based on the assumption of identically and independently distributed data (i.i.d.), i.e test data has the same distribution as the training data. This is a very important assumption, because if we did not have that assumption, then we would not be able to say anything about generalization to new examples from the same distribution. Unfortunately, this assumption is too strong, and reality is not like this, especially for agents taking decisions one at a time in an environment from which they also get observations.
经典机器学习框架建立在独立同分布(i.i.d.)假设之上,即测试数据与训练数据分布相同。这是一个非常重要的假设——因为没有它,我们就无法对来自同一分布的新样本说什么泛化性。可惜这个假设过强,现实并非如此,尤其对在环境中逐个决策、同时从环境获取观测的智能体而言。
The distribution of observations seen by an agent may change for many reasons: the agent acts (intervenes) in the environment, other agents intervene in the environment, or simply our agent is learning and exploring, visiting different parts of the state-space as it does so, discovering new parts of it along the way, thus experiencing non-stationarities along the way.
智能体观测到的分布可能因许多原因而改变:智能体在环境中行动(干预)、其他智能体在环境中干预,或仅仅因为我们的智能体在学习与探索——它在过程中访问状态空间的不同区域、发现新的部分,从而一路上经历非平稳性。
Although sequential decision-making is ubiquitous in real life, there are scenarios where thinking about these non-stationarities may seem unnecessary (like object recognition in static images). However, if we want to build learning systems which are robust to changes in distribution, it may be necessary to train them in settings where the distribution changes!
尽管序列决策在真实生活中无处不在,但有些场景(如静态图像目标识别)下考虑这些非平稳性似乎没有必要。然而,如果我们想构建对分布变化鲁棒的学习系统,就必须在分布会变化的设置中训练它们!
And then of course there are applications of machine learning where the data is sequential and non-stationary (like historical records of anything) or even more so, where the learner is also an agent or is an agent interacting with other agents (like in robotics, autonomous driving or dialogue systems).
当然,还有一些机器学习应用的数据本身就是序列化、非平稳的(比如任何事物的历史记录),更极端的是学习者也身为智能体、或作为智能体与其他智能体交互(如机器人、自动驾驶或对话系统)。
That means we may need to go away from large curated datasets typical of supervised learning frameworks and instead construct non-stationary controllable environments as the training grounds and benchmarks for our learners. This complicates the task of evaluating and comparing learning algorithms but is necessary and we believe, feasible.
这意味着我们可能需要离开监督学习框架典型的大规模精选数据集,转而构建非平稳、可控的环境作为学习者的训练场与基准。这使评估和比较学习算法变得复杂,但却是必要的——而且我们相信是可行的。
迁移学习与持续学习
Transfer Learning and Continual Learning
Instead of a fixed data distribution and searching for an inductive bias which works well with this distribution, we are thus interested in transfer learning and continual learning scenarios, with a potentially infinite stream of tasks, and where the learner must extract information from past experiences and tasks to improve its learning speed (i.e., sample complexity, which is different from asymptotic performance which is currently the standard) on future and yet unseen tasks.
我们不追求「固定数据分布 + 寻找在该分布上表现好的归纳偏置」,而是对迁移学习与持续学习场景感兴趣:任务流可能是无限的,学习者必须从过去的经验与任务中提取信息,以提升在未来未见任务上的学习速度(即样本复杂度——这与目前作为标准的渐近性能不同)。
Suppose the learner faces a sequence of tasks, A, B, C and then we want the learner to perform well on a new task D. Short of any assumptions it is nearly impossible to expect the learner to perform well on D. However if there is some shared structure, between the transfer task (i.e task D) and source tasks (i.e tasks A, B and C), then it is possible to generalize or transfer knowledge from the source task to the target task.
假设学习者面对任务序列 A、B、C,然后我们要求它在新任务 D 上表现良好。若没有任何假设,几乎不可能指望它在 D 上表现良好。但如果在迁移任务(任务 D)与源任务(任务 A、B、C)之间存在某种共享结构,就有可能把知识从源任务泛化或迁移到目标任务。
Hence, if we want to talk meaningfully about knowledge transfer, it is important to talk about the assumptions on the kind of data distribution that the learner is going to face, i.e., (a) what they may have in common, what is stable and stationary across the environments experienced and (b) how they differ or how changes occur from one to the next in case we consider a sequential decision-making scenario.
因此,要真正有意义地谈论知识迁移,就必须谈论学习者将要面对的数据分布的假设,即:(a) 它们可能有什么共同之处、在所经历的环境中什么是稳定不变的;(b) 在序列决策场景中,它们如何彼此不同、变化如何发生。
This division should be reminiscent of the work on meta-learning, which we can understand as dividing learning into slow learning (of stable and stationary aspects of the world) and fast learning (of task-specific aspects of the world). This involves two time scales of learning, with an outer loop for meta-learning of meta-parameters and an inner loop for regular learning of regular parameters.
这种划分应该让人联想到元学习(meta-learning)工作:我们可以把它理解为把学习分为「慢学习」(学习世界稳定、不变的方面)与「快学习」(学习世界特定于任务的方面)。这涉及两个时间尺度的学习:外层循环做元参数的元学习,内层循环做常规参数的常规学习。
In fact we could have more than two time scales: think about the outer loop of evolution, the slightly faster loop of cultural learning which is somewhat stable across generations, the faster learning of individual humans, the even faster learning of specific tasks and new environments within a lifetime, and the even faster inner loops of motor control and planning which adapt policies to the specifics of an immediate objective like reaching for a fruit.
实际上我们可能拥有不止两个时间尺度:想想进化的外层循环、跨代较为稳定的文化学习(略快的循环)、个体人类更快的学习、一生中学习特定任务与新环境的更快学习,以及适应即时目标(如伸手摘果)策略的运动控制与规划的更快内层循环。
Ideally, we want to build an understanding of the world which shifts as much of the learning to the slower and more stable parts so that the inner learning loops can succeed faster, requiring less data for adaptation.
理想情况下,我们希望构建一种对世界的理解,把尽可能多的学习移到更慢、更稳定的部分,使内层学习循环能更快成功、适应所需数据更少。
系统性泛化与分布外泛化
Systematic Generalization and Out-of-Distribution Generalization
In this paper, we focus on the objective of out-of-distribution (OOD) generalization, i.e., generalizing outside of the specific distribution(s) from which training observations were drawn. A more general way to conceive of OOD generalization is with the concept of sample complexity in the face of new tasks or changed distributions. One extreme is zero-shot OOD generalization while the more general case, often studied in meta-learning setups, involves k-shot generalization (from k examples of the new distribution).
本文聚焦于分布外(OOD)泛化这一目标,即在训练观测所来自的特定分布之外进行泛化。更一般地理解 OOD 泛化,可以用面对新任务或变化分布时的样本复杂度概念:一端是零样本 OOD 泛化,而更一般的情形——常在元学习设置中研究——涉及 k-shot 泛化(来自新分布的 k 个样本)。
Whereas the notions of OOD generalization and OOD sample complexity tell us what we want to achieve (and hint at how we might measure it) they say nothing about how to achieve it. This is where the notion of systematic generalization becomes interesting.
OOD 泛化与 OOD 样本复杂度这两个概念告诉我们想要达成什么(并提示如何度量),却没说如何达成。这正是系统性泛化(systematic generalization)概念变得有趣的地方。
Systematic generalization is a phenomenon which was first studied in linguistics because it is a core property of language: the meaning for a novel composition of existing concepts (e.g. words) can be derived systematically from the meaning of the composed concepts.
系统性泛化是一种首先在语言学中被研究的现象,因为它是语言的核心属性:现有概念(如词语)的新组合,其含义可以从被组合概念的含义中系统性地推导出来。
This very clearly exists in language, but humans benefit from it in other settings, e.g., understanding a new object by combining properties of different parts which compose it. Systematic generalization even makes it possible to generalize to new combinations that have zero probability under the training distribution: it is not just that they did not occur in the training data, but that even if we had seen an infinite amount of training data from our training distribution, we would not have any sample showing this particular combination.
这一点在语言中非常明显,但人类在其他场景中也从中受益——例如通过组合构成一个物体的不同部件的属性来理解一个新物体。系统性泛化甚至使泛化到在训练分布下概率为零的新组合成为可能:这不仅因为它们未在训练数据中出现,而是即使我们从训练分布看到了无限量的训练数据,也不会有任何样本展示这种特定组合。
For example, when you read a science fiction scenario for the first time, that scenario could be impossible in your life, or even in the aggregate experiences of billions of humans living today, but you can still imagine it and make sense of it (e.g., predict the end of the scenario from the beginning).
例如,当你第一次读到某个科幻场景时,那个场景在你的生活中、甚至在当今数十亿人类的总体经验中都可能不可能发生,但你仍能想象它并理解它(比如从开头预测结尾)。
Empirical studies of systematic generalization were performed by (Bahdanau et al., 2018, 2019), where particular forms of combinations of linguistic concepts were present in the training distribution but not in the test distribution, and current methods take a hit in performance, whereas humans would be able to answer such questions easily.
Bahdanau 等人对系统性泛化做了实证研究:某些特定形式的语言概念组合在训练分布中存在、在测试分布中却不存在;当前方法性能大受打击,而人类能轻松回答这类问题。
Humans use inductive biases providing forms of compositionality, making it possible to generalize from a finite set of combinations to a larger set of combinations of concepts. Deep learning already benefits from a form of compositional advantage with distributed representations, which are at the heart of why neural networks work so well.
人类利用提供某种组合性的归纳偏置,使得从有限组合集合泛化到更大的概念组合集合成为可能。深度学习已经从分布式表征的组合优势中获益——这正是神经网络为何如此好用的核心。
There are theoretical arguments about why distributed representations can bring a potentially exponential advantage, if this matches properties of the underlying data distribution. Another advantageous form of compositionality in deep nets arises from the depth itself, i.e., the composition of functions, with provable up to exponential advantages under the appropriate assumptions.
有理论论证说明:如果分布式表征匹配底层数据分布的性质,它能带来潜在指数级优势。深度网络中的另一种有利组合性来自深度本身——即函数的复合——在适当假设下可证明带来多达指数级的优势。
However, a form of compositionality that we propose here and should be better incorporated in deep learning is the form called systematicity defined by linguists, and more recently systematic generalization in machine learning papers.
然而,我们在此提出、并应更好纳入深度学习的一种组合性,是语言学家定义的系统性(systematicity)——近年机器学习论文中称之为系统性泛化。
Current deep learning methods tend to overfit the training distribution. This would not be visible by looking at a test set from the same distribution as the training set, so we need to change our ways of evaluating the success of learning because we would like our learning agents to generalize in a systematic way, out-of-distribution.
当前深度学习方法倾向于过拟合训练分布。这一点从与训练集同分布的测试集上是看不出来的,所以我们需要改变评估学习成功的方式——因为我们希望学习智能体以系统性的方式、在分布之外进行泛化。
This only makes sense if the new environment has enough shared components or structure with previously seen environments, which corresponds to certain assumptions on distributional changes, bringing back the need for appropriate inductive biases, about distributions (e.g., shared components) as well as about how they change (e.g., via agents' interventions).
只有在新环境与先前见过的环境拥有足够共享成分或结构时,这才有意义——这对应于对分布变化的某些假设,从而再次引出对适当归纳偏置的需求:既要有关于分布(如共享成分)的偏置,也要有关于分布如何变化(如通过智能体干预)的偏置。