Datasets:
Add files using upload-large-folder tool
Browse files- md/dev/0U0C2pXfTZl/0U0C2pXfTZl.md +467 -0
- md/dev/1PL1NIMMrw/1PL1NIMMrw.md +549 -0
- md/dev/6UtOXn1LwNE/6UtOXn1LwNE.md +422 -0
- md/dev/9t-j3xDm7_Q/9t-j3xDm7_Q.md +290 -0
- md/dev/GAUwreODU5L/GAUwreODU5L.md +290 -0
- md/dev/J8P7g_mDpno/J8P7g_mDpno.md +415 -0
- md/dev/JtBRnrlOEFN/JtBRnrlOEFN.md +465 -0
- md/dev/MCVfX7HgPO/MCVfX7HgPO.md +485 -0
- md/dev/MG3YN3z1J4M/MG3YN3z1J4M.md +329 -0
- md/dev/TiZYrQ-mPup/TiZYrQ-mPup.md +335 -0
- md/dev/UERcQuXlwy/UERcQuXlwy.md +390 -0
- md/dev/UhEJz3wgLnG/UhEJz3wgLnG.md +428 -0
- md/dev/V88BafmH9Pj/V88BafmH9Pj.md +301 -0
- md/dev/_xwr8gOBeV1/_xwr8gOBeV1.md +0 -0
- md/dev/cx5ViLfcVq/cx5ViLfcVq.md +577 -0
- md/dev/dFbKQaRk15w/dFbKQaRk15w.md +0 -0
- md/dev/krI-ahhgN2/krI-ahhgN2.md +0 -0
- md/dev/l0zLcLGdcL/l0zLcLGdcL.md +389 -0
- md/dev/nJfylDvgzlq/nJfylDvgzlq.md +334 -0
- md/dev/xENf4QUL4LW/xENf4QUL4LW.md +0 -0
md/dev/0U0C2pXfTZl/0U0C2pXfTZl.md
ADDED
|
@@ -0,0 +1,467 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SLASH: EMBRACING PROBABILISTIC CIRCUITS INTO NEURAL ANSWER SET PROGRAMMING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
The goal of combining the robustness of neural networks and the expressivity of symbolic methods has rekindled the interest in Neuro-Symbolic AI. Recent advancements in Neuro-Symbolic AI often consider specifically-tailored architectures consisting of disjoint neural and symbolic components, and thus do not exhibit desired gains that can be achieved by integrating them into a unifying framework. We introduce SLASH – a novel deep probabilistic programming language (DPPL). At its core, SLASH consists of Neural-Probabilistic Predicates (NPPs) and logical programs which are united via answer set programming. The probability estimates resulting from NPPs act as the binding element between the logical program and raw input data, thereby allowing SLASH to answer task-dependent logical queries. This allows SLASH to elegantly integrate the symbolic and neural components in a unified framework. We evaluate SLASH on the benchmark data of MNIST addition as well as novel tasks for DPPLs such as missing data prediction and set prediction with state-of-the-art performance, thereby showing the effectiveness and generality of our method.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
In recent years, Neuro-Symbolic AI approaches to learning (Hudson & Manning, 2019; d’Avila Garcez et al., 2019; Jiang & Ahn, 2020; d’Avila Garcez & Lamb, 2020), which integrates low-level perception with high-level reasoning by combining data-driven neural modules with logic-based symbolic modules, has gained traction. This combination of sub-symbolic and symbolic systems has been shown to have several advantages for various tasks such as visual question answering and reasoning (Yi et al., 2018), concept learning (Mao et al., 2019) and improved properties for explainable and revisable models (Ciravegna et al., 2020; Stammer et al., 2021).
|
| 12 |
+
|
| 13 |
+
Rather than designing specifically tailored Neuro-Symbolic architectures, where often the neural and symbolic modules are disjoint and trained independently (Yi et al., 2018; Mao et al., 2019; Stammer et al., 2021), deep probabilistic programming languages (DPPLs) provide an exciting alternative (Bingham et al., 2019; Tran et al., 2017; Manhaeve et al., 2018; Yang et al., 2020). Specifically, DPPLs integrate neural and symbolic modules via a unifying programming framework with probability estimates acting as the “glue” between separate modules allowing for reasoning over noisy, uncertain data and, importantly, joint training of the modules. Additionally, prior knowledge and biases in the form of logical rules can easily be added with DPPLs, rather than creating implicit architectural biases, thereby integrating neural networks into downstream logical reasoning tasks.
|
| 14 |
+
|
| 15 |
+
Object-centric deep learning has recently brought forth several exciting avenues of research by introducing inductive biases to neural networks to extract objects from visual scenes in an unsupervised manner (Zhang et al., 2019; Burgess et al., 2019; Engelcke et al., 2020; Greff et al., 2019; Lin et al., 2020; Locatello et al., 2020; Jiang & Ahn, 2020). We refer to Greff et al. (2020) for a detailed overview. A motivation for this specific line of investigation, which notably has been around for a longer period of time (Fodor & Pylyshyn, 1988; Marcus, 2019), is that objects occur as natural building blocks in human perception and possess advantageous properties for many cognitive tasks, such as scene understanding and reasoning. With a DPPL, these advancements can be improved by integrating the previously mentioned components into the DPPL’s programming framework and further adding constraints about objects and their properties in form of logical statements e.g. about color singularity, rather than implicitly enforcing this via one hot encodings.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: SLASH Attention illustrated for a visual reasoning task. SLASH with Neural-Probabilistic Predicates consisting of a slot attention encoder and Probabilistic Circuits (PCs) realised via EiNets. The slot encoder is shared over all NPPs. Each triangle in the figure represents a single EiNet that gives us a joint distribution at the root node. Thus, each PC learns the joint distribution over slot encodings, $z ^ { i }$ , and object attributes, $C$ , of a specific category, e.g. color attributes. Via targeted queries to the NPPs, one can obtain task-related probabilities, e.g. conditional probabilities for the task of set prediction. Given the probability estimates from the NPP(s) and a SLASH program, containing a set of facts and logical statements about the world, the probability of the truth value of a task-related query are computed via answer set programming. The entire system, including the neural and probabilistic modules, are finally trained end-to-end via a single loss function.
|
| 19 |
+
|
| 20 |
+
We propose SLASH – a novel DPPL that, similar to the punctuation symbol, can be used to efficiently combine several paradigms into one. Specifically, SLASH represents a scalable programming language that seamlessly integrates probabilistic logical programming with neural representations and tractable probabilistic estimations. Fig. 1 shows an example instantiation of SLASH, termed SLASH Attention, for object-centric set prediction. SLASH consists of several key building blocks. Firstly, it makes use of Neural-Probabilistic Predicates (NPPs) for probability estimation. NPPs consist of neural and/or probabilistic circuit (PC) modules and act as a unifying term, encompassing the neural predicates of DeepProbLog and NeurASP, as well as purely probabilistic predicates. In this work, we introduce a much more powerful “flavor” of NPPs that consist jointly of neural and PC modules, taking advantage of the power of neural computations together with true density estimation of PCs. Depending on the underlying task one can thus ask a range of queries to the NPP, e.g. sample an unknown, desired variable, but also query for conditional class probabilities. Example NPPs consisting of a slot attention encoder and several PCs are depicted in Fig. 1 for the task of set prediction. The slot encoder is shared across all NPPs, whereas the PC of each NPP models a separate category of attributes. In this way, each NPP models the joint distribution over slot encodings and object attribute values, such as the color of an object. By querying the NPP, one can obtain task-related probability estimations, such as the conditional attribute probability.
|
| 21 |
+
|
| 22 |
+
The second component of SLASH is the logical program, which consists of a set of facts and logical statements defining the state of the world of the underlying task. For example, one can define the rules for when an object possesses a specific set of attributes (cf. Fig. 1). Thirdly, an ASP module is used to combine the first two components. Given a logical query about the input data, the logical program and the probability estimates obtained from the NPP(s), the ASP module produces a probability estimate about the truth value of the query, stating, e.g., how likely it is for a specific object in an image to be a large, dark red triangle. In contrast to query evaluation in Prolog (Colmerauer & Roussel, 1993; Clocksin & Mellish, 1981) which may lead to an infinite loop, many modern answer set solvers use Conflict-Driven-Clause-Learning (CDPL) which, in principle, always terminates.
|
| 23 |
+
|
| 24 |
+
Training in SLASH is performed efficiently in a batch-wise and end-to-end fashion, by integrating the parameters of all modules, neural and probabilistic, into a single loss term. SLASH thus allows a simple, fast and effective integration of sub-symbolic and symbolic computations. In our experiments, we investigate the advantages of SLASH in comparison to SOTA DPPLs on the benchmark task of MNIST-Addition (Manhaeve et al., 2018). We hereby show SLASH’s increased scalability regarding computation time, as well as SLASH’s ability to handle incomplete data via true probabilistic density modelling. Next, we show that SLASH Attention provides superior results for set prediction in terms of accuracy and generalization abilities compared to a baseline slot attention encoder. With our experiments, we thus show that SLASH is a realization of “one system – two approaches” (Bengio, 2019), that can successfully be used for performing various tasks and on a variety of data types.
|
| 25 |
+
|
| 26 |
+
We make the following contributions: (1) We introduce neural-probabilistic predicates, efficiently integrating answer set programming with probabilistic inference via our novel DPPL, SLASH. (2) We successfully train neural, probabilistic and logic modules within SLASH for complex data structures end-to-end via a simple, single loss term. (3) We show that SLASH provides various advantages across a variety of tasks and data sets compared to state-of-the-art DPPLs and neural models.
|
| 27 |
+
|
| 28 |
+
# 2 NEURO-SYMBOLIC LOGIC PROGRAMMING
|
| 29 |
+
|
| 30 |
+
Neuro-Symbolic AI can be divided into two lines of research, depending on the starting point. Both, however, have the same final goal: to combine low-level perception with logical constraints and reasoning.
|
| 31 |
+
|
| 32 |
+
A key motivation of Neuro-Symbolic AI (d’Avila Garcez et al., 2009; Mao et al., 2019; Hudson & Manning, 2019; d’Avila Garcez et al., 2019; Jiang & Ahn, 2020; d’Avila Garcez & Lamb, 2020) is to combine the advantages of symbolic and neural representations into a joint system. This is often done in a hybrid approach where a neural network acts as a perception module that interfaces with a symbolic reasoning system, e.g. (Mao et al., 2019; Yi et al., 2018). The goal of such an approach is to mitigate the issues of one type of representation by the other, e.g. using the power of symbolic reasoning systems to handle the generalizability issues of neural networks and on the other hand handle the difficulty of noisy data for symbolic systems via neural networks. Recent work has also shown the advantage of Neuro-Symbolic approaches for explaining and revising incorrect decisions (Ciravegna et al., 2020; Stammer et al., 2021). Many of these previous works, however, train the sub-symbolic and symbolic modules separately.
|
| 33 |
+
|
| 34 |
+
Deep Probabilistic Programming Languages (DPPLs) are programming languages that combine deep neural networks with probabilistic models and allow a user to express a probabilistic model via a logical program. Similar to Neuro-Symbolic architectures, DPPLs thereby unite the advantages of different paradigms. DPPLs are related to earlier works such as Markov Logic Networks (MLNs) (Richardson & Domingos, 2006). Thereby, the binding link is the Weighted Model Counting (WMC) introduced in $\mathrm { L P ^ { M L N } }$ (Lee & Wang, 2016). Several DPPLs have been proposed by now, among which are Pyro (Bingham et al., 2019), Edward (Tran et al., 2017), DeepProbLog (Manhaeve et al., 2018), and NeurASP (Yang et al., 2020).
|
| 35 |
+
|
| 36 |
+
To resolve the scalability issues of DeepProbLog, which use Sentential Decision Diagrams (SDDs) (Darwiche, 2011) as the underlying data structure to evaluate queries, NeurASP (Yang et al., 2020), offers a solution by utilizing Answer Set Programming (ASP) (Dimopoulos et al., 1997; Soininen & Niemelä, 1999; Marek & Truszczynski, 1999; Calimeri et al., 2020). In this way, NeurASP changes the paradigm from query evaluation to model generation, i.e. instead of constructing an SDD or similar knowledge representation system, NeurASP generates a set of all possible solutions (one model per solution) and estimates the probability for the truth value of each of these solutions. Of those DPPLs that handle learning in a relational, probabilistic setting and in an end-to-end fashion, all of these are limited to estimating only conditional class probabilities.
|
| 37 |
+
|
| 38 |
+
# 3 THE SLASH FRAMEWORK
|
| 39 |
+
|
| 40 |
+
In this section, we introduce our novel DPPL, SLASH. Before we dive into the details of this, it is necessary to first introduce Neural-Probabilistic Predicates, for which we require an understanding of Probabilistic Circuits. Finally, we will present the learning paradigm of SLASH.
|
| 41 |
+
|
| 42 |
+
The term probabilistic circuit (PC) (Choi et al., 2020) represents a unifying framework that encompasses all computational graphs which encode probability distributions and guarantee tractable probabilistic modelling. These include Sum-Product Networks (SPNs) (Poon & Domingos, 2011) which are deep mixture models represented via a rooted directed acyclic graphs with a recursively defined structure.
|
| 43 |
+
|
| 44 |
+

|
| 45 |
+
|
| 46 |
+
(a) NPPs come in various flavors depending on the data and underlying task.
|
| 47 |
+
|
| 48 |
+

|
| 49 |
+
(b) Minimal SLASH program and query for set prediction.
|
| 50 |
+
Figure 2: (a) Depending on the data set and underlying task, SLASH requires a suitable NeuralProbabilistic Predicate (NPP) that computes query-dependent probability estimates. An NPP can be composed of neural and probabilistic modules, or (depicted via slash symbol) only one of these two. (b) A minimal SLASH program and query for the set prediction task, here only showing the NPP that models the color category per object. For the full program, we refer to the Appendix.
|
| 51 |
+
|
| 52 |
+
# 3.1 NEURAL-PROBABILISTIC PREDICATES
|
| 53 |
+
|
| 54 |
+
Previous DPPLs, DeepProbLog (Manhaeve et al., 2018) and NeurASP (Yang et al., 2020), introduced the Neural Predicate as an annotated-disjunction or as a propositional atom, respectively, to acquire conditional class probabilities, $P ( C | X )$ , via the softmax function at the output of an arbitrary DNN. As mentioned in the introduction, this approach has certain limitations concerning inference capabilities. To resolve this issue, we introduce Neural-Probabilisitic Predicates (NPPs).
|
| 55 |
+
|
| 56 |
+
Formally, we denote with
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
n p p \left( h ( x ) , [ v _ { 1 } , . . . , v _ { n } ] \right)
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
a Neural-Probabilistic Predicate $h$ . Thereby, (i) npp is a reserved word to label an NPP, (ii) $h$ a symbolic name of either a PC, NN or a joint of a PC and NN (cf. Fig. 2a), e.g., color_attr is the name of an NPP of Fig. 2b. Additionally, (iii) $x$ denotes a “term” and (iv) $v _ { 1 } , \ldots , v _ { n }$ are placeholders for each of the $n$ possible outcomes of $h$ . For example, the placeholders for color_attr are the color attributes of an object (Red, Blue, Green, etc.).
|
| 63 |
+
|
| 64 |
+
An NPP abbreviates an arithmetic literal of the form $c = v$ with $c \in \{ h ( x ) \}$ and $v \in \{ v _ { 1 } , \ldots , v _ { n } \}$ . Furthermore, we denote with $\Pi ^ { n p p }$ a set of NPPs of the form stated in (Eq. 1) and $r ^ { n p p }$ the set of all rules $c = v$ of one NPP, which denotes the possible outcomes, obtained from an NPP in $\Pi ^ { n p p }$ , e.g. $r ^ { c o l o r \_ a t t r } = \{ c = R e d , c = B l u e , c = G r \bar { e } e n , . . . \}$ for the example depicted in Fig. 2b.
|
| 65 |
+
|
| 66 |
+
Rules of the form $n p p ( h ( x ) , [ v _ { 1 } , \ldots , v _ { n } ] ) B o d y$ are used as an abbreviation for application to multiple entities, e.g. multiple slots for the task of set prediction (cf. Fig. 2b). Hereby, Body of the rule is identified by $\top$ (tautology, true) or $\perp$ (contradiction, false) during grounding. Rules of the form $H e a d \gets B o d y$ with $r ^ { n p p }$ appearing in Head are prohibited for $\Pi ^ { n p p }$ .
|
| 67 |
+
|
| 68 |
+
In this work, we largely make use of NPPs that contain probabilistic circuits (specifically SPNs) which allow for tractable density estimation and modelling of joint probabilities. In this way, it is possible to answer a much richer set of probabilistic queries, i.e. $P ( X , C )$ , $P ( X | C )$ and $P ( \bar { C } | X )$ .
|
| 69 |
+
|
| 70 |
+
In addition to this, we introduce the arguably more interesting type of NPP that combines a neural module with a PC. Hereby, the neural module learns to map the raw input data into an optimal latent representation, e.g. object-based slot representations. The PC, in turn, learns to model the joint distribution of these latent variables and produces the final probability estimates. This type of NPP nicely combines the representational power of neural networks with the advantages of PCs in probability estimation and query flexibility.
|
| 71 |
+
|
| 72 |
+
For making the different probabilistic queries distinguishable in a SLASH program, we introduce the following notation. We denote a given variable with $^ +$ and the query variable with −. E.g., within the running example of set prediction $\cdot e f .$ Fig. 1 and 2b), with the query color_attr $\cdot ( + X , - C )$ one is asking for $P ( C | X )$ . Similarly, with color_attr $( - X , + C )$ one is asking for $P ( X | C )$ and, finally, with color_attr $( - X , - C )$ for $P ( X , C )$ .
|
| 73 |
+
|
| 74 |
+
To summarize, an NPP can consist of neural and/or probabilistic modules and produces querydependent probability estimates. Due to the flexibility of its definition, the term NPP contains the predicates of previous works (Manhaeve et al., 2018; Yang et al., 2020), but also more interesting predicates discussed above. The specific “flavor” of an NPP should be chosen depending on what type of probability estimation is required (cf. Fig 2a). Lastly, NPPs have the unified loss function of the negative log-likelihood:
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
L _ { N P P } : = - \log L H ( x , \hat { x } ) = \sum _ { i = 1 } ^ { n } L H ( x _ { i } , \hat { x } _ { i } ) = - \sum _ { i = 1 } ^ { n } x _ { i } \cdot \log ( P _ { \xi } ^ { ( X , C ) } ( x _ { i } ) ) = - \sum _ { i = 1 } ^ { n } \log ( P _ { \xi } ^ { ( X , C ) } )
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
whereby we are assuming the data to be i.i.d., ground truth $x _ { i }$ to be the all-ones vector, $\xi$ to be the parameters of the NPP and $P _ { \xi } ^ { ( X , C ) }$ are the predictions ${ \hat { x } } _ { i }$ obtained from the PC encoded in the NPP.
|
| 81 |
+
|
| 82 |
+
# 3.2 THE SLASH LANGUAGE AND SEMANTICS
|
| 83 |
+
|
| 84 |
+
Fig. 1 presents an illustration of SLASH, exemplified for the task of set prediction, with all of its key components. Having introduced the NPPs previously, which produce probability estimates, we now continue in the pipeline on how to use these probability estimates for answering logical queries. We begin by formally defining a SLASH program.
|
| 85 |
+
|
| 86 |
+
Definition 1. A SLASH program Π is the union of $\Pi ^ { a s p }$ , $\Pi ^ { n p p }$ . Therewith, $\Pi ^ { a s p }$ is the set of propositional rules (standard rules from ASP-Core-2 (Calimeri et al., 2020)), and $\Pi ^ { n p p }$ is a set of Neural-Probabilistic Predicates of the form stated in Eq. 1.
|
| 87 |
+
|
| 88 |
+
Fig. 2b depicts a minimal SLASH program for the task of set prediction, exemplifying a set of propositional rules and neural predicates. Similar to NeurASP, SLASH requires ASP and as such adopts its syntax to most part. We therefore now address integrating our NPPs into an ASP compatible form to obtain the success probability for the logical query given all possible solutions. Thus, we define SLASH’s semantics. For SLASH to translate the program $\Pi$ to the ASP-solver’s compatible form, the rules (Eq. 1) will be rewritten to the set of rules:
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
1 \{ h ( x ) = v _ { 1 } ; \ldots ; h ( x ) = v _ { n } \} 1
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
The ASP-solver should understand this as “Pick exactly one rule from the set”. After the translation is done, we can ask an ASP-solver for the solutions for $\Pi$ . We denote a set of ASP constraints in the $\mathrm { f o r m } \gets B o d y$ , as queries $Q$ (annotation). and each of the solutions with respect to $Q$ as a potential solution, $I$ , (referred to as stable model in ASP). With $I | _ { r ^ { n _ { P } p } }$ we denote the projection of the $I$ onto $r ^ { n p p }$ , $N u m ( I | _ { r ^ { n p p } } , \Pi ) \ -$ – the number of the possible solutions of the program $\Pi$ agreeing with $I | _ { r ^ { n p p } }$ on $r ^ { n p p }$ . Because we aim to calculate the success probability of the query $Q$ , we formalize the probability of a potential solution $I$ beforehand.
|
| 95 |
+
|
| 96 |
+
Definition 2. We specify the probability of the potential solution, $I$ , for the program $\Pi$ as the product of the probabilities of all atoms $c = v$ in $I | _ { r ^ { n p p } }$ divided by the number of potential solutions of $\Pi$ agreeing with I|rnpp on rnpp:
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
P _ { \Pi } ( I ) = \left\{ \begin{array} { l l } { \frac { \prod _ { c = v \in { I \vert _ { r } n p p } } P _ { \Pi } ( c = v ) } { N u m ( I \vert _ { r ^ { n p p } } , \Pi ) } , } & { i f I i s a p o t e n t i a l s o l u t i o n o f \Pi , } \\ { 0 , } & { o t h e r w i s e . } \end{array} \right.
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
Therefore, the probability of a query can be defined as follows.
|
| 103 |
+
|
| 104 |
+
Definition 3. The probability of the query $Q$ given the set of possible solutions $I$ is defined as
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
P _ { \Pi } ( Q ) : = \sum _ { I \ v { = } Q } P _ { \Pi } ( I ) .
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
Thereby, $I \models Q$ reads as $^ { * } I$ satisfies $Q$ ”. The probability of the set of queries $\mathbf { Q } = \{ Q _ { 1 } , \ldots , Q _ { l } \}$ is defined as the product of the probability of each. I.e.
|
| 111 |
+
|
| 112 |
+
$$
|
| 113 |
+
P _ { \Pi } \left( \mathbf { Q } \right) : = \prod _ { Q _ { i } \in \mathbf { Q } } P _ { \Pi } ( Q _ { i } ) = \prod _ { Q _ { i } \in \mathbf { Q } } \sum _ { I \ v { | } = Q } P _ { \Pi } ( I ) .
|
| 114 |
+
$$
|
| 115 |
+
|
| 116 |
+
# 3.3 PARAMETER LEARNING IN SLASH
|
| 117 |
+
|
| 118 |
+
We denote with $\Pi ( \pmb \theta )$ the SLASH program under consideration, thereby $\pmb \theta$ is the set of the parameters associated with Π. Further, making the i.i.d. assumption of the query set $\mathbf { Q }$ , we follow Manhaeve et al. (2018) and Skryagin et al. (2020), and use the learning from entailment setting. That is, the training examples are logical queries that are known to be true in the SLASH program $\Pi ( \theta )$ . The goal is now to learn the parameters $\pmb \theta$ of the SLASH program $\Pi ( \pmb \theta )$ so that the observed queries are most likely.
|
| 119 |
+
|
| 120 |
+
To this end, we employ the negative log-likelihood and the cross-entropy of the observed queries $P _ { \mathrm { { I I } } ( \theta ) } ( Q _ { i } )$ and their predicted probability value $P ^ { ( X _ { \mathbf { Q } } , C ) } ( x _ { Q _ { i } } )$ , assuming the NPPs are fixed: $L _ { E N T } : =$
|
| 121 |
+
|
| 122 |
+
$$
|
| 123 |
+
- \log L H \left( \log ( P _ { \Pi ( \theta ) } ( \mathbf { Q } ) ) , P ^ { ( X _ { \mathbf { Q } } , C ) } ( x _ { \mathbf { Q } } ) \right) = - \sum _ { j = 1 } ^ { m } \log ( P _ { \Pi ( \theta ) } ( Q _ { i j } ) ) \cdot \log \left( P ^ { ( X _ { \mathbf { Q } } , C ) } ( x _ { Q _ { i j } } ) \right) .
|
| 124 |
+
$$
|
| 125 |
+
|
| 126 |
+
This loss function aims at maximizing the estimated success probability. We remark that the defined loss function is true regardless of the NPP’s form (NN with Softmax, PC or PC jointly with NN). The only difference will be the second term, i.e. $P ^ { ( C | X _ { \mathbf { Q } } ) } ( x _ { \mathbf { Q } } )$ or $P ^ { ( X _ { \mathbf { Q } } | C ) } ( x _ { \mathbf { Q } } ) )$ depending on the NPP and task. Furthermore, we assume that for the set of queries $\mathbf { Q }$ holds
|
| 127 |
+
|
| 128 |
+
$$
|
| 129 |
+
P _ { \Pi ( \pmb \theta ) } ( Q ) > 0 \quad \forall Q \in { \bf Q } .
|
| 130 |
+
$$
|
| 131 |
+
|
| 132 |
+
In accordance with the semantics, we seek to reward the right solutions $v = c$ and penalize wrong ones $v \neq c$ . Referring to the probabilities in $r ^ { n p p }$ (the set of logical rules denoting NPPs, see Def. 2) as $\mathbf { p }$ , one can compute their gradients w.r.t. $\pmb { \theta }$ via backpropagation as
|
| 133 |
+
|
| 134 |
+
$$
|
| 135 |
+
\sum _ { Q \in { \bf Q } } \frac { \partial \log \left( P _ { \Pi ( \pmb \theta ) } ( Q ) \right) } { \partial \pmb \theta } = \sum _ { Q \in { \bf Q } } \frac { \partial \log \left( P _ { \Pi ( \pmb \theta ) } ( Q ) \right) } { \partial { \bf p } } \times \frac { \partial { \bf p } } { \partial \pmb \theta } .
|
| 136 |
+
$$
|
| 137 |
+
|
| 138 |
+
The term $\textstyle { \frac { \partial \mathbf { p } } { \partial \theta } }$ can now be computed as usual via backward propagation through the NPPs (see Eq. 13 in the appendix for details). By letting $p$ to be the label of the probability of an atom $c = v$ in $r ^ { n p p }$ and denoting $P _ { \Pi ( \pmb { \theta } ) } ( c = v )$ , the term $\frac { \partial \log \left( P _ { \mathrm { I I } ( \pmb { \theta } ) } ( Q ) \right) } { \partial \mathbf { p } }$ follows from NeurASP (Yang et al., 2020) as
|
| 139 |
+
|
| 140 |
+
$$
|
| 141 |
+
\frac { \partial \log \left( P _ { \Pi ( \theta ) } ( Q ) \right) } { \partial \mathbf { p } } = \frac { I \underset { I : I \mid = Q } { \sum } \frac { P _ { \Pi ( \theta ) } ( I ) } { P _ { \Pi ( \theta ) } ( c = v ) } - \underset { I : I , v ^ { \prime } \mid = Q } { \sum } \frac { P _ { \Pi ( \theta ) } ( I ) } { P _ { \Pi ( \theta ) } ( c = v ^ { \prime } ) } } { \underset { I : I \mid = Q } { \sum } P _ { \Pi ( \theta ) } ( I ) } .
|
| 142 |
+
$$
|
| 143 |
+
|
| 144 |
+
This is sensible. For instance, if a query to be true is not likely to be entailed, the gradient is positive. Putting everything together, the final loss function is
|
| 145 |
+
|
| 146 |
+
$$
|
| 147 |
+
{ \cal L } _ { S L A S H } = { \cal L } _ { N P P } + { \cal L } _ { E N T }
|
| 148 |
+
$$
|
| 149 |
+
|
| 150 |
+
and we perform training using coordinate descent, i.e., we train the NPPs, the train the program with fixed NPPs, train the NPPs with the program fixed, and so on.
|
| 151 |
+
|
| 152 |
+
In hindsight, rather than requiring a novel loss function for each individual task and data set, with SLASH, it is possible to simply incorporate the specific requirements into the logic program. The training loss, however, remains the same. We refer to the Appendix A for further details, including the derivation of the total loss gradient.
|
| 153 |
+
|
| 154 |
+
# 4 EMPIRICAL RESULTS
|
| 155 |
+
|
| 156 |
+
The advantage of SLASH lies in the efficient integration of neural, probabilistic and symbolic computations. To emphasize this, we conduct a variety of experimental evaluations.
|
| 157 |
+
|
| 158 |
+
Experimental Details. We use two benchmark data sets, namely MNIST (LeCun et al., 1998b) for the task of MNIST-Addition and a variant of the ShapeWorld data set (Kuhnle & Copestake, 2017) for
|
| 159 |
+
|
| 160 |
+
Table 1: MNIST Addition Results. Test accuracy corresponds to the percentage of correctly classified test images. (a) Test accuracies in percent for the MNIST Addition task with various DPPLs, including SLASH with an NPP that models the joint probabilities (SLASH (PC)) and one that models only conditional probabilities (SLASH (DNN)). (b) Test accuracies in percent for the MNIST Addition task with missing data, comparing DeepProbLog with SLASH (PC). The amount of missing data was varied between $50 \%$ and $9 7 \%$ of the pixels per image.
|
| 161 |
+
|
| 162 |
+
(a) Baseline MNIST Addition.
|
| 163 |
+
|
| 164 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Test Acc. (%)</td></tr><tr><td rowspan=1 colspan=1>DeepProbLog</td><td rowspan=1 colspan=1>98.49±0.18</td></tr><tr><td rowspan=1 colspan=1>NeurASP</td><td rowspan=1 colspan=1>98.21 ± 0.30</td></tr><tr><td rowspan=1 colspan=1>SLASH (PC)</td><td rowspan=1 colspan=1>95.39 ± 0.29</td></tr><tr><td rowspan=1 colspan=1>SLASH (DNN)</td><td rowspan=1 colspan=1>98.74±0.21</td></tr></table>
|
| 165 |
+
|
| 166 |
+
(b) Missing data MNIST Addition.
|
| 167 |
+
|
| 168 |
+
<table><tr><td rowspan=1 colspan=2>DeepProbLog</td><td rowspan=1 colspan=1>SLASH (PC)</td></tr><tr><td rowspan=1 colspan=1>50%</td><td rowspan=1 colspan=1>97.73 ± 0.12</td><td rowspan=1 colspan=1>97.67±0.12</td></tr><tr><td rowspan=1 colspan=1>80%</td><td rowspan=1 colspan=1>76.07 ± 18.38</td><td rowspan=1 colspan=1>96.72士0.05</td></tr><tr><td rowspan=1 colspan=1>90%</td><td rowspan=1 colspan=1>69.15 ± 29.15</td><td rowspan=1 colspan=1>94.85士0.38</td></tr><tr><td rowspan=1 colspan=1>97%</td><td rowspan=1 colspan=1>32.46 ± 22.48</td><td rowspan=1 colspan=1>82.57士4.66</td></tr></table>
|
| 169 |
+
|
| 170 |
+
object-centric set prediction. For all experiments we present the average and the standard deviation over five runs with different random seeds for parameter initialization.
|
| 171 |
+
|
| 172 |
+
For ShapeWorld experiments, we generate a data set we refer to as ShapeWorld4. Images of ShapeWorld4 contain between one and four objects, with each object consisting of four attributes: a color (red, blue, green, gray, brown, magenta, cyan or yellow), a shade (bright, or dark), a shape (circle, triangle or square) and a size (small or big). Thus, each object can be created from 84 different combinations of attributes. Fig. 1 depicts an example image.
|
| 173 |
+
|
| 174 |
+
We measure performance via classification accuracies in the MNIST-Addition task. In our ShapeWorld4 experiments, we present the average precision. We refer to appendix B for the SLASH programs and queries of each experiment, and appendix C for a detailed description of hyperparameters and further details.
|
| 175 |
+
|
| 176 |
+
Evaluation 1: SLASH outperforms SOTA DPPLs in MNIST-Addition. The task of MNISTAddition (Manhaeve et al., 2018) is to predict the sum of two MNIST digits, presented only as raw images. During test time, however, a model should classify the images directly. Thus, although a model does not receive explicit information about the depicted digits, it must learn to identify digits via indirect feedback on the sum prediction.
|
| 177 |
+
|
| 178 |
+
We compare the test accuracy after convergence between the three DPPLs: DeepProbLog (Manhaeve et al., 2018), NeurASP (Yang et al., 2020) and SLASH, using a probabilistic circuit (PC) or a deep neural network (DNN) as NPP. Notably, the DNN used in SLASH (DNN) is the LeNet5 model (LeCun et al., 1998a) of DeepProbLog and NeurASP. We note that when using the PC as NPP, we have also extracted conditional class probabilities $P ( C | X )$ , by marginalizing the class variables $C$ to acquire the normalization constant $P ( X )$ from the joint $P ( X , C )$ , and calculating $P ( X | C )$ .
|
| 179 |
+
|
| 180 |
+
The results can be seen in Tab. 1a. We observe that training SLASH with a DNN NPP produces SOTA accuracies compared to DeepProbLog and NeurASP, confirming that SLASH’s batch-wise loss computation leads to improved performances. We further observe that the test accuracy of SLASH with a PC NPP is slightly below the other DPPLs, however we argue that this may be since a PC, in comparison to a DNN, is learning a true mixture density rather than just conditional probabilities. The advantages of doing so will be investigated in the next experiments. Note that, optimal architecture search for PCs, e.g. for computer vision, is an open research question.These evaluations show SLASH’s advantages on the benchmark MNIST-Addition task. Additional benefits will be made clear in the following experiments.
|
| 181 |
+
|
| 182 |
+
Evaluation 2: Handling Missing Data with SLASH. SLASH offers the advantage of its flexibility to use various kinds of NPPs. Thus, in comparison to previous DPPLs, one can easily integrate NPPs into SLASH that perform joint probability estimation. For this evaluation, we consider the task of MNIST-Addition with missing data. We trained SLASH (PC) and DeepProbLog with the MNIST-Addition task with images in which a percentage of pixels per image has been removed. It is important to mention here that whereas DeepProbLog handles the missing data simply as background pixels, SLASH (PC) specifically models the missing data as uncertain data by marginalizing the denoted pixels at inference time. We use DeepProbLog here representative of DPPLs without true density estimation.
|
| 183 |
+
|
| 184 |
+
(a) ShapeWorld4 and ShapeWorld4 CoGenT Test Avg.Precision
|
| 185 |
+
Figure 3: ShapeWorld4 Experiments. (a) Converged test average precision scores for the set prediction task with ShapeWorld4 (top) and ShapeWorld4 CoGenT (bottom). (b) Test average precision scores for set prediction with ShapeWorld4 over the training epochs. In these experiments we compared a baseline slot encoder versus SLASH Attention with slot attention and PC-based NPPs. For the CoGenT experiments, a model is trained on one training set and tested on two separate test conditions. The Condition A test set contains attribute compositions which were also seen during training. The Condition B test set contains attribute compositions which were not seen during training, e.g. yellow circles were not present in the training set, but present in Condition B test set.
|
| 186 |
+
|
| 187 |
+
<table><tr><td></td><td>Slot Att.</td><td>SLASH Att.</td></tr><tr><td>Test Set</td><td>ShapeWorld4 90.24 ± 0.93</td><td>95.58 ± 0.61</td></tr><tr><td></td><td>CoGenT</td><td></td></tr><tr><td>Test Cond. A</td><td>90.37 ± 2.19</td><td>96.85 ± 0.43</td></tr><tr><td>Test Cond.B</td><td>27.15 ± 2.36</td><td>40.58 ± 1.99</td></tr></table>
|
| 188 |
+
|
| 189 |
+

|
| 190 |
+
(b) Test Avg.Precision over Training Epochs
|
| 191 |
+
|
| 192 |
+
The results can be seen in Tab. 1b for $5 0 \%$ , $8 0 \%$ , $9 0 \%$ and $9 7 \%$ missing pixels per image. We observe that at $5 0 \%$ , DeepProbLog and SLASH produce almost equal accuracies. With $8 0 \%$ percent missing pixels, there is a substantial difference in the ability of the two DPPLs to correctly classify images, with SLASH being very stable. By further increasing the percentage of missing pixels, this difference becomes even more substantial with SLASH still reaching a $8 2 \%$ test accuracy even when $9 7 \%$ of the pixels per image are missing, whereas DeepProbLog degrades to an average of $3 2 \%$ test accuracy. We further note that SLASH, in comparison to DeepProbLog, produces largely reduced standard deviations over runs.
|
| 193 |
+
|
| 194 |
+
Thus, by utilizing the power of true density estimation SLASH, with an appropriate NPP, can produce more robust results in comparison to other DPPLs. Further, we refer to Appendix D, which contains results of additional experiments where training is performed with the full MNIST data set whereas only the test set entails different rates of missing pixels.
|
| 195 |
+
|
| 196 |
+
Evaluation 3: Improved Concept Learning via SLASH. We show that SLASH can be very effective for the complex task of set prediction, which previous DPPLs have not tackled. We revert to the ShapeWorld4 data set for this setting. For set prediction, a model is trained to predict the discrete attributes of a set of objects in an image (cf. Fig. 1 for an example ShapeWorld4 image). The difficulty for the model lies therein that it must match an unordered set of corresponding attributes (with varying number of entities over samples) with its internal representations of the image.
|
| 197 |
+
|
| 198 |
+
The slot attention module introduced by Locatello et al. (2020) allows for an attractive object-centric approach to this task. Specifically, this module represents a pluggable, differentiable module that can be easily added to any architecture and, through a competitive softmax-based attention mechanism, can enforce the binding of specific parts of a latent representation into permutation-invariant, taskspecific vectors, called slots.
|
| 199 |
+
|
| 200 |
+
In our experiments, we wish to show that by adding logical constraints to the training setting, one can improve the overall performances and generalization properties of such a model. For this, we train SLASH with NPPs as depicted in Fig. 1 consisting of a shared slot encoder and separate PCs, each modelling the mixture of latent slot variables and the attributes of one category, e.g. color. For ShapeWorld4, we thereby have altogether four NPPs. SLASH is trained via queries of the kind exemplified in Fig. 7 in the Appendix. We refer to this configuration as SLASH Attention.
|
| 201 |
+
|
| 202 |
+
We compare SLASH Attention to a baseline slot attention encoder using an MLP and Hungarian loss for predicting the object properties from the slot encodings as in Locatello et al. (2020). The results of these experiments can be found in Fig. 3a (top). We observe that the average precision after convergence on the held-out test set with SLASH Attention is greatly improved to that of the baseline model. Additionally, in Fig. 3b we observe that SLASH Attention reaches the average precision value of the baseline model in much fewer number of epochs. Thus, we can summarize that adding logical knowledge in the training procedure via SLASH can greatly improve the capabilities of a neural module for set prediction.
|
| 203 |
+
|
| 204 |
+
Evaluation 4: Improved Compositional Generalization with SLASH. To test the hypothesis that SLASH Attention possesses improved generalization properties in comparison to the baseline model, we ran experiments on a variant of ShapeWorld4 similar to the CLEVR Compositional Generalization Test (CoGenT) (Johnson et al., 2017). The goal of CoGenT is to investigate a model’s ability to handle novel combinations of attributes that were not seen during training.
|
| 205 |
+
|
| 206 |
+
For this purpose, we established two conditions within a ShapeWorld4 CoGenT data set: Condition (A) – the training and test data set contains squares with the colors gray, blue, brown, or yellow, triangles with the colors red, green, magenta, or cyan and circles of all colors. Condition (B) – the training set is as in Condition (A). However, the test set contains squares with the colors red, green, magenta, or cyan, triangles with the colors gray, blue, brown, or yellow and circles of all colors. The goal is to investigate how well a model can generalize that, e.g., also squares can have the color red, although never having seen evidence for this during training.
|
| 207 |
+
|
| 208 |
+
The resulting average precision test scores are presented in Fig. 3a (bottom). We observe that, even though the SLASH Program used for this experiment was not explicitly written to handle composition generalization, SLASH Attention shows greatly improved generalization capabilities. This can be seen in the approx. $1 3 \%$ higher average precision scores on the Condition (B) test set in comparison to the baseline model. Importantly, this trend still holds even when subtracting the higher precision scores observed in Condition (A).
|
| 209 |
+
|
| 210 |
+
To summarize our findings from the experiments on set prediction: we observe that adding prior knowledge in the form of logical constraints via SLASH can greatly improve a neural module in terms of performance and generalizability. On a side note: training neural networks for novel tasks, often involves defining explicit loss functions, e.g. Hungarian loss for set prediction. In contrast with SLASH, no matter the choice of NPP and underlying task, the training loss remains the same. Task-related requirements simply need to be added as lines of code to the SLASH program. This additionally highlights SLASH’s versatility and flexibility.
|
| 211 |
+
|
| 212 |
+
Summary of all Empirical Results. All empirical results together demonstrate that the flexibility of SLASH is highly beneficial and can easily outperform state-of-the-art: one can freely combine what is required to solve the underlying task — (deep) neural networks, PCs, and logic. Particularly, the results indicate the potential of integrating PCs via SLASH into DPPLs.
|
| 213 |
+
|
| 214 |
+
# 5 CONCLUSION AND FUTURE WORK
|
| 215 |
+
|
| 216 |
+
We introduce SLASH, a novel DPPL that integrates neural computations with tractable probability estimates and logical statements. The key ingredient of SLASH to achieve this are Neural-Probabilistic Predicates (NPPs) that can be flexibly constructed out of neural and/or probabilistic circuit modules based on the data and underlying task. With these NPPs, one can produce task-specific probability estimates. The details and additional prior knowledge of a task are neatly encompassed within a SLASH program with only few lines of code. Finally, via Answer Set Programming and Weighted Model Counting, the logical SLASH program and probability estimates from the NPPs are combined to estimate the truth value of a task-specific query. Our experiments show the power and efficiency of SLASH, improving upon previous DPPLs in the benchmark MNIST-Addition task in terms of performance, efficiency and robustness. Importantly, by integrating a SOTA slot attention encoder into NPPs and adding few logical constraints, SLASH demonstrates improved performances and generalizability in comparison to the pure slot encoder for the task of object-centric set prediction; a setting no DPPL has tackled yet. This shows the great potential of DPPLs to elegantly combine logical reasoning with neural computations and uncertainty estimates.
|
| 217 |
+
|
| 218 |
+
Interesting avenues for future work include benchmarking SLASH on additional data types and tasks. One should explore unsupervised and weakly supervised learning using logic with SLASH and investigate how far logical constraints can help unsupervised object discovery. In direct alignment with our work, one should also investigate image generation via the beneficial feature of PCs to generate random samples. Actually, it should be possible to generate images that encapsulate logical knowledge bases. This is important to move from data-rich to knowledge-rich AI.
|
| 219 |
+
|
| 220 |
+
# ETHICS STATEMENT
|
| 221 |
+
|
| 222 |
+
With our work, we have shown that one can add prior knowledge and logical constraints to the training of learning systems. We postulate that SLASH can therefore additionally be used to identify and remove biases or undesirable behavior, by adding constraints within the SLASH program. We observe that this feature, however, also has the potential danger to be used in the opposite way, e.g. explicitly adding bias and discriminatory factors to a system. To the best of our knowledge, our study does not raise any ethical, privacy or conflict of interest concerns.
|
| 223 |
+
|
| 224 |
+
# REPRODUCIBILITY STATEMENT
|
| 225 |
+
|
| 226 |
+
An official, curated GitHub repository will be made public with the final version, containing the code of SLASH, as well as scripts to reproduce the experiments and generate data sets. In addition to this, architectural details and hyperparameters are included in the appendix. Preliminary code will be uploaded upon submission. Lastly, details on the evaluation metrics and relevant data sets are given in the main text as well as appendix.
|
| 227 |
+
|
| 228 |
+
# REFERENCES
|
| 229 |
+
|
| 230 |
+
Yoshua Bengio. From System 1 Deep Learning to System 2 Deep Learning. Invited talk NeurIPS, 2019. URL https://www.youtube.com/watch?v $=$ T3sxeTgT4qc.
|
| 231 |
+
|
| 232 |
+
Eli Bingham, Jonathan P. Chen, Martin Jankowiak, Fritz Obermeyer, Neeraj Pradhan, Theofanis Karaletsos, Rohit Singh, Paul A. Szerlip, Paul Horsfall, and Noah D. Goodman. Pyro: Deep universal probabilistic programming. Journal of Machine Learning Research, pp. 28:1–28:6, 2019.
|
| 233 |
+
|
| 234 |
+
Christopher P. Burgess, Loïc Matthey, Nicholas Watters, Rishabh Kabra, Irina Higgins, Matthew Botvinick, and Alexander Lerchner. Monet: Unsupervised scene decomposition and representation. CoRR, 2019.
|
| 235 |
+
|
| 236 |
+
Francesco Calimeri, Wolfgang Faber, Martin Gebser, Giovambattista Ianni, Roland Kaminski, Thomas Krennwallner, Nicola Leone, Marco Maratea, Francesco Ricca, and Torsten Schaub. Asp-core-2 input language format. Theory and Practice of Logic Programming, pp. 294–309, 2020.
|
| 237 |
+
|
| 238 |
+
YooJung Choi, Antonio Vergari, and Guy Van den Broeck. Probabilistic circuits: A unifying framework for tractable probabilistic models. Technical report, Technical report, 2020.
|
| 239 |
+
|
| 240 |
+
Gabriele Ciravegna, Francesco Giannini, Marco Gori, Marco Maggini, and Stefano Melacci. Humandriven FOL explanations of deep learning. In IJCAI, pp. 2234–2240, 2020.
|
| 241 |
+
|
| 242 |
+
W. F. Clocksin and Chris Mellish. Programming in Prolog. 1981.
|
| 243 |
+
|
| 244 |
+
Alain Colmerauer and Philippe Roussel. The birth of prolog. In HOPL-II, pp. 37–52, 1993.
|
| 245 |
+
|
| 246 |
+
Adnan Darwiche. SDD: A new canonical representation of propositional knowledge bases. In IJCAI, pp. 819–826, 2011.
|
| 247 |
+
|
| 248 |
+
Artur d’Avila Garcez and Luís C. Lamb. Neurosymbolic AI: the 3rd wave. CoRR, 2020.
|
| 249 |
+
|
| 250 |
+
Artur S. d’Avila Garcez, Luís C. Lamb, and Dov M. Gabbay. Neural-Symbolic Cognitive Reasoning. Cognitive Technologies. 2009.
|
| 251 |
+
|
| 252 |
+
Artur S. d’Avila Garcez, Marco Gori, Luís C. Lamb, Luciano Serafini, Michael Spranger, and Son N. Tran. Neural-symbolic computing: An effective methodology for principled integration of machine learning and reasoning. FLAP, pp. 611–632, 2019.
|
| 253 |
+
|
| 254 |
+
Yannis Dimopoulos, Bernhard Nebel, and Jana Koehler. Encoding planning problems in nonmonotonic logic programs. In ECP, Lecture Notes in Computer Science, pp. 169–181, 1997.
|
| 255 |
+
|
| 256 |
+
Martin Engelcke, Adam R. Kosiorek, Oiwi Parker Jones, and Ingmar Posner. GENESIS: generative scene inference and sampling with object-centric latent representations. In ICLR, 2020.
|
| 257 |
+
|
| 258 |
+
Jerry A Fodor and Zenon W Pylyshyn. Connectionism and cognitive architecture: A critical analysis. Cognition, pp. 3–71, 1988.
|
| 259 |
+
|
| 260 |
+
Klaus Greff, Raphaël Lopez Kaufman, Rishabh Kabra, Nick Watters, Christopher Burgess, Daniel Zoran, Loic Matthey, Matthew Botvinick, and Alexander Lerchner. Multi-object representation learning with iterative variational inference. In ICML, pp. 2424–2433, 2019.
|
| 261 |
+
|
| 262 |
+
Klaus Greff, Sjoerd van Steenkiste, and Jürgen Schmidhuber. On the binding problem in artificial neural networks. CoRR, 2020.
|
| 263 |
+
|
| 264 |
+
Drew A. Hudson and Christopher D. Manning. Learning by abstraction: The neural state machine. In NeurIPS, pp. 5901–5914, 2019.
|
| 265 |
+
|
| 266 |
+
Jindong Jiang and Sungjin Ahn. Generative neurosymbolic machines. In NeurIPS, 2020.
|
| 267 |
+
|
| 268 |
+
Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Li Fei-Fei, C. Lawrence Zitnick, and Ross B. Girshick. CLEVR: A diagnostic dataset for compositional language and elementary visual reasoning. In CVPR, pp. 1988–1997, 2017.
|
| 269 |
+
|
| 270 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR 2015, 2015.
|
| 271 |
+
|
| 272 |
+
Alexander Kuhnle and Ann A. Copestake. Shapeworld - A new test methodology for multimodal language understanding. CoRR, 2017.
|
| 273 |
+
|
| 274 |
+
Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. pp. 2278–2324, 1998a.
|
| 275 |
+
|
| 276 |
+
Yann LeCun, Corinna Cortes, and Christopher J.C. Burges. THE MNIST DATABASE of handwritten digits, 1998b. URL http://yann.lecun.com/exdb/mnist/.
|
| 277 |
+
|
| 278 |
+
Joohyung Lee and Yi Wang. Weighted rules under the stable model semantics. In KR, pp. 145–154, 2016.
|
| 279 |
+
|
| 280 |
+
Zhixuan Lin, Yi-Fu Wu, Skand Vishwanath Peri, Weihao Sun, Gautam Singh, Fei Deng, Jindong Jiang, and Sungjin Ahn. SPACE: unsupervised object-oriented scene representation via spatial attention and decomposition. In ICLR, 2020.
|
| 281 |
+
|
| 282 |
+
Francesco Locatello, Dirk Weissenborn, Thomas Unterthiner, Aravindh Mahendran, Georg Heigold, Jakob Uszkoreit, Alexey Dosovitskiy, and Thomas Kipf. Object-centric learning with slot attention. In NeurIPS, 2020.
|
| 283 |
+
|
| 284 |
+
Robin Manhaeve, Sebastijan Dumancic, Angelika Kimmig, Thomas Demeester, and Luc De Raedt. Deepproblog: Neural probabilistic logic programming. pp. 3753–3763, 2018.
|
| 285 |
+
|
| 286 |
+
Jiayuan Mao, Chuang Gan, Pushmeet Kohli, Joshua B. Tenenbaum, and Jiajun Wu. The neurosymbolic concept learner: Interpreting scenes, words, and sentences from natural supervision. In ICLR, 2019.
|
| 287 |
+
|
| 288 |
+
Gary F Marcus. The algebraic mind: Integrating connectionism and cognitive science. 2019.
|
| 289 |
+
|
| 290 |
+
Victor W. Marek and Miroslaw Truszczynski. Stable models and an alternative logic programming paradigm. In The Logic Programming Paradigm - A 25-Year Perspective, Artificial Intelligence, pp. 375–398. 1999.
|
| 291 |
+
|
| 292 |
+
Robert Peharz, Steven Lang, Antonio Vergari, Karl Stelzner, Alejandro Molina, Martin Trapp, Guy Van den Broeck, Kristian Kersting, and Zoubin Ghahramani. Einsum networks: Fast and scalable learning of tractable probabilistic circuits. In ICML, pp. 7563–7574, 2020.
|
| 293 |
+
|
| 294 |
+
Hoifung Poon and Pedro M. Domingos. Sum-product networks: A new deep architecture. In UAI, pp. 337–346, 2011.
|
| 295 |
+
|
| 296 |
+
Matthew Richardson and Pedro M. Domingos. Markov logic networks. Machine Learning, pp. 107–136, 2006.
|
| 297 |
+
|
| 298 |
+
Arseny Skryagin, Karl Stelzner, Alejandro Molina, Fabrizio Ventola, and Kristian Kersting. Splog: Sum-product logic. In ProbProg, 2020.
|
| 299 |
+
|
| 300 |
+
Timo Soininen and Ilkka Niemelä. Developing a declarative rule language for applications in product configuration. In PADL, Lecture Notes in Computer Science, pp. 305–319, 1999.
|
| 301 |
+
|
| 302 |
+
Wolfgang Stammer, Patrick Schramowski, and Kristian Kersting. Right for the right concept: Revising neuro-symbolic concepts by interacting with their explanations. In CVPR, pp. 3619–3629, 2021.
|
| 303 |
+
|
| 304 |
+
Dustin Tran, Matthew D. Hoffman, Rif A. Saurous, Eugene Brevdo, Kevin Murphy, and David M. Blei. Deep probabilistic programming. In ICLR, 2017.
|
| 305 |
+
|
| 306 |
+
Zhun Yang, Adam Ishay, and Joohyung Lee. NeurASP: Embracing neural networks into answer set programming. In IJCAI, pp. 1755–1762, 2020.
|
| 307 |
+
|
| 308 |
+
Kexin Yi, Jiajun Wu, Chuang Gan, Antonio Torralba, Pushmeet Kohli, and Josh Tenenbaum. Neuralsymbolic VQA: disentangling reasoning from vision and language understanding. In NeurIPS, pp. 1039–1050, 2018.
|
| 309 |
+
|
| 310 |
+
Yan Zhang, Jonathon S. Hare, and Adam Prügel-Bennett. Deep set prediction networks. In NeurIPS, pp. 3207–3217, 2019.
|
| 311 |
+
|
| 312 |
+
# A APPENDIX A – DETAILS ON PARAMETER LEARNING
|
| 313 |
+
|
| 314 |
+
In the Appendix, we want to discuss details on parameter learning in SLASH. Since we use coordinate descent for training SLASH we present the derivative of each component of the loss function defined in equation 10 since while optimization, one component has to be kept fixed.
|
| 315 |
+
|
| 316 |
+
We start with the gradient of the NPP loss function $L _ { N P P }$ i.e. the negative log-likelihood, defined in equation 2
|
| 317 |
+
|
| 318 |
+
$$
|
| 319 |
+
\begin{array} { c } { { \displaystyle { \frac { \partial } { \partial \xi } } L _ { N P P } = { \frac { \partial } { \partial x _ { Q _ { i } } } \cdot \frac { \partial x _ { Q _ { i } } } { \partial \xi } } L _ { N P P } = { \frac { \partial x _ { Q _ { i } } } { \partial \xi } } \left( - { \sum _ { i = 1 } ^ { n } } { \frac { \partial } { \partial x _ { Q _ { i } } } \log \left( P _ { \xi } ^ { ( X _ { \mathbf { Q } } , C ) } ( x _ { Q _ { i } } ) \right) } \right) } } \\ { { \displaystyle { = \frac { \partial x _ { Q _ { i } } } { \partial \xi } } \left( - { \sum _ { i = 1 } ^ { n } } { \frac { 1 } { \left( P _ { \xi } ^ { ( X _ { \mathbf { Q } } , C ) } ( x _ { Q _ { i } } ) \right) } } \frac { \partial } { \partial x _ { Q _ { i } } } \left( P _ { \xi } ^ { ( X _ { \mathbf { Q } } , C ) } ( x _ { Q _ { i } } ) \right) \right) } } \end{array}
|
| 320 |
+
$$
|
| 321 |
+
|
| 322 |
+
Here, we remark tha t ∂xQi∂ξ will be carried out by back-propagation and the expression after it is the initial gradient.
|
| 323 |
+
|
| 324 |
+
Next, we derive the gradient of the logical entailment loss function $\mathit { L } _ { \mathit { E N T } }$ , as defined in equation 7. One estimates the gradient as follows
|
| 325 |
+
|
| 326 |
+
$$
|
| 327 |
+
\frac { 1 } { n } \frac { \partial } { \partial p } L _ { E N T } \ge - \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { \partial \log ( P _ { \Pi ( \theta ) } ( Q _ { i } ) ) } { \partial p } \cdot \log \bigl ( P ^ { ( X _ { \mathbf { Q } } , C ) } ( x _ { Q _ { i } } ) \bigr ) ,
|
| 328 |
+
$$
|
| 329 |
+
|
| 330 |
+
whereby
|
| 331 |
+
|
| 332 |
+
• $X _ { \mathbf { Q } }$ is the set of random variables associated with the set of the queries $\mathbf { Q }$ ,
|
| 333 |
+
• $x _ { Q _ { i } }$ is a training sample, a realization of the set of random variables $X _ { \mathbf { Q } }$ associated with the particular query $Q _ { i }$ ,
|
| 334 |
+
• $P ^ { ( X _ { \mathbf { Q } } , C ) } ( x _ { Q _ { i } } )$ is the probability of the realization $x _ { Q _ { i } }$ estimated by the NPP modelling the joint over the set $X _ { \mathbf { Q } }$ and $C$ – the set of classes (the domain of the NPP),
|
| 335 |
+
• $\log ( P _ { \Pi ( \theta ) } ( Q _ { i } ) )$ – the probability of the query $Q _ { i }$ under the program $\Pi ( \theta )$ calculated by SLASH (for the reference see the equation (5)),
|
| 336 |
+
• and ∂ log(PΠ(θ)(Qi)) is the gradient as defined in Eq.9.
|
| 337 |
+
|
| 338 |
+
We begin with the definition of the cross-entropy for two vectors $y _ { i }$ and $\hat { y } _ { i }$ :
|
| 339 |
+
|
| 340 |
+
$$
|
| 341 |
+
H ( y _ { i } , \hat { y } _ { i } ) : = \sum _ { j = 1 } ^ { m } y _ { i j } \cdot \log \left( \frac { 1 } { \hat { y } _ { i j } } \right) = \sum _ { j = 1 } ^ { m } \left( y _ { i j } \cdot \underbrace { \log ( 1 ) } _ { = 0 } - y _ { i j } \cdot \log ( \hat { y } _ { i j } ) \right) = - \sum _ { j = 1 } ^ { m } y _ { i j } \cdot \log ( \hat { y } _ { i j } ) .
|
| 342 |
+
$$
|
| 343 |
+
|
| 344 |
+
Hereafter we substitute
|
| 345 |
+
|
| 346 |
+
$$
|
| 347 |
+
y _ { i } = \log ( P _ { \Pi ( \theta ) } ( Q _ { i } ) ) \qquad \mathrm { ~ a n d ~ } \qquad \hat { y } _ { i } = P ^ { ( X _ { \mathbf { Q } } , C ) } ( x _ { Q _ { i } } )
|
| 348 |
+
$$
|
| 349 |
+
|
| 350 |
+
and obtain
|
| 351 |
+
|
| 352 |
+
$$
|
| 353 |
+
\bar { \cal I } ( y _ { i } , \hat { y } _ { i } ) = \cal H \left( \log ( P _ { \Pi ( \theta ) } ( Q _ { i } ) ) , P ^ { ( X _ { \mathbf { Q } } , { \cal C } ) } ( x _ { Q _ { i } } ) \right) = - \sum _ { j = 1 } ^ { m } \log ( P _ { \Pi ( \theta ) } ( Q _ { i j } ) ) \cdot \log \Big ( P ^ { ( X _ { \mathbf { Q } } , { \cal C } ) } ( x _ { Q _ { i j } } ) \Big ) .
|
| 354 |
+
$$
|
| 355 |
+
|
| 356 |
+
We remark that $m$ represent the number of classes defined in the domain of an NPP. Now, we differentiate the equation (11) with the respect to $p$ depicted as in Eq. 9 to be the label of the probability of an atom $c = v$ in $r ^ { n p p }$ , denoting $P _ { \Pi ( \pmb { \theta } ) } ( c = v )$ . Since differentiation is linear, the product rule is applicable directly:
|
| 357 |
+
|
| 358 |
+
$$
|
| 359 |
+
\begin{array} { c } { \displaystyle \frac { \partial } { \partial p } H \left( y _ { i } , \hat { y } _ { i } \right) = - \sum _ { j = 1 } ^ { m } \left[ \frac { \partial \log \left( P _ { \Pi ( \theta ) } ( Q _ { i j } ) \right) } { \partial p } \cdot \log \left( P ^ { ( X _ { \mathbf { Q } } , C ) } ( x _ { Q _ { i j } } ) \right) \right. } \\ { \displaystyle \left. + \log ( P _ { \Pi ( \theta ) } ( Q _ { i j } ) ) \cdot \frac { \partial \log \left( P ^ { ( X _ { \mathbf { Q } } , C ) } ( x _ { Q _ { i j } } ) \right) } { \partial p } \right] . } \end{array}
|
| 360 |
+
$$
|
| 361 |
+
|
| 362 |
+
We do not wish to consider the latter term of $\begin{array} { r } { \log ( P _ { \mathrm { { I I } } ( \theta ) } ( Q _ { i } ) ) \cdot \frac { \partial \log \left( P ^ { ( X _ { \mathbf { Q } } , C ) } ( x _ { Q _ { i } } ) \right) } { \partial p } } \end{array}$ because it represents the rescaling and to keep the first since SLASH procure $\frac { \partial \log ( P _ { \Pi ( \theta ) } ( Q _ { i } ) ) } { \partial p }$ following Eq. 9. To achieve this, we estimate equation from above downwards as
|
| 363 |
+
|
| 364 |
+
$$
|
| 365 |
+
\frac { \partial } { \partial p } H \left( y _ { i } , \hat { y } _ { i } \right) \geq - \sum _ { j = 1 } ^ { m } \frac { \partial \log ( P _ { \Pi ( \theta ) } ( Q _ { i j } ) ) } { \partial p } \cdot \log \left( P ^ { ( X _ { \mathbf { Q } } , C ) } ( x _ { Q _ { i j } } ) \right) .
|
| 366 |
+
$$
|
| 367 |
+
|
| 368 |
+
Furthermore, let us recall that under i.i.d assumption we obtain from the definition of likelihood
|
| 369 |
+
|
| 370 |
+
$$
|
| 371 |
+
L H ( y , \hat { y } ) = \prod _ { i = 1 } ^ { n } L H ( y _ { i } , \hat { y } _ { i } ) ,
|
| 372 |
+
$$
|
| 373 |
+
|
| 374 |
+
and following the negative likelihood coupled with the knowledge that the log-likelihood of $y _ { i }$ is the log of a particular entry of $\hat { y } _ { i }$
|
| 375 |
+
|
| 376 |
+
$$
|
| 377 |
+
\begin{array} { c } { { { \cal L } _ { E N T } = - \displaystyle \log { \cal L } H ( y , \hat { y } ) = - \sum _ { i = 1 } ^ { n } \log { \cal L } H ( y _ { i } , \hat { y } _ { i } ) = - \sum _ { i = 1 } ^ { n } \sum _ { j = 1 } ^ { m } y _ { i j } \cdot \log ( \hat { y } _ { i j } ) = } } \\ { { \displaystyle \sum _ { i = 1 } ^ { n } \left[ - \sum _ { j = 1 } ^ { m } y _ { i j } \cdot \log ( \hat { y } _ { i j } ) \right] = \sum _ { i = 1 } ^ { n } H ( y _ { i } , \hat { y } _ { i } ) . } } \end{array}
|
| 378 |
+
$$
|
| 379 |
+
|
| 380 |
+
Finally, we obtain the following estimate applying inequality (12)
|
| 381 |
+
|
| 382 |
+
$$
|
| 383 |
+
\frac { 1 } { n } \frac { \partial } { \partial p } L _ { E N T } = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { \partial } { \partial p } H ( y _ { i } , \hat { y } _ { i } ) \geq - \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { \partial \log \left( P _ { \mathrm { { I I } } ( \theta ) } ( Q _ { i } ) \right) } { \partial p } \cdot \log \left( P ^ { ( X _ { \mathbf { Q } } , C ) } ( x _ { Q _ { i } } ) \right)
|
| 384 |
+
$$
|
| 385 |
+
|
| 386 |
+
Also, we note that the mathematical transformations listed above hold for any type of NPP and the task dependent queries (NN with Softmax, PC or PC jointly with NN). The only difference will be the second term, i.e., $\log ( P ^ { ( C | X _ { \mathbf { Q } } ) } ( x _ { Q _ { i j } } ) )$ or $\log ( P ^ { ( \bar { X } _ { \mathbf { Q } } | C ) } \bar { ( x _ { Q _ { i j } } ) } )$ depending on the NPP and task. The NPP in a form of a single PC modeling the joint over $X _ { \mathbf { Q } }$ and $C$ was depicted to be the example. With that, the derivation of gradients for both loss functions 2 and 7 is complete, and the training is carried out by coordinated descent.
|
| 387 |
+
|
| 388 |
+
Backpropagation for joint NN and PC NPPs: If within the SLASH program, $\Pi ( \pmb \theta )$ , the NPP forwards the data tensor through a NN first, i.e., the NPP models a joint over the NN’s output variables by a PC, then we rewrite (8) to
|
| 389 |
+
|
| 390 |
+
$$
|
| 391 |
+
\sum _ { i = 1 } ^ { n } { \frac { \partial \log \left( P _ { \Pi ( \theta ) } ( Q _ { i } ) \right) } { \partial \theta } } = \sum _ { i = 1 } ^ { n } { \frac { \partial \log \left( P _ { \Pi ( \theta ) } ( Q _ { i } ) \right) } { \partial \mathbf { p } } } \times { \frac { \partial \mathbf { p } } { \partial \theta } } \times { \frac { \partial \theta } { \partial \gamma } } .
|
| 392 |
+
$$
|
| 393 |
+
|
| 394 |
+
Thereby, $\gamma$ is the set of the NN’s parameters and $\frac { \partial \pmb { \theta } } { \partial \gamma }$ is computed by the backward propagation through the NN.
|
| 395 |
+
|
| 396 |
+
# B APPENDIX B – SLASH PROGRAMS
|
| 397 |
+
|
| 398 |
+
Here, the interested reader will find the SLASH programs which we compiled for our experiments. Figure 4 presents the one for the MNIST Addition task, Figure 6 – for the set prediction task with slot attention encoder and the subsequent CoGenT test. Note the use of the $" + "$ and “-” notation for indicating whether a random variable is given or being queried for.
|
| 399 |
+
|
| 400 |
+
# Define images img(i1). img(i2). 3 # Define Neural-Probabilistic Predicate 4 npp(digit(X), [0,1,2,3,4,5,6,7,8,9]) :- img(X). 5 # Define the addition of digits given two images and the resulting sum 6 addition(A, B, N) :- digit $\mathrm { \Omega } + \tt { A }$ , -N1), digit( $+ \mathtt { B }$ , -N2), $\mathrm { ~ N ~ } = \mathrm { ~ N ~ 1 ~ } + \mathrm { ~ N ~ 2 ~ }$ .
|
| 401 |
+
|
| 402 |
+
# Is 7 the sum of the digits in img1 and img2? 2 :- addition(image_id1, image_id2, 7)
|
| 403 |
+
|
| 404 |
+

|
| 405 |
+
Figure 4: SLASH Program for MNIST addition. The same program was used for the training with missing data.
|
| 406 |
+
Figure 5: Example SLASH Query for MNIST addition. The same type of query was used for the training with missing data
|
| 407 |
+
Figure 6: SLASH Program for ShapeWorld4. The same program was used for the CoGenT experiments.
|
| 408 |
+
|
| 409 |
+
# Does object o1 have the attributes red, circle, bright, small? :- has_attributes(o1, red, circle, bright, small)
|
| 410 |
+
|
| 411 |
+
Figure 7: Example SLASH Query for ShapeWorld4 experiments. In other words, this query corresponds to asking SLASH: “Is object 1 a small, bright red circle?”.
|
| 412 |
+
|
| 413 |
+
# C APPENDIX C – EXPERIMENTAL DETAILS
|
| 414 |
+
|
| 415 |
+
# C.1 SHAPEWORLD4 GENERATION
|
| 416 |
+
|
| 417 |
+
The ShapeWorld4 and ShapeWorld4 CoGenT data sets were generated using the original scripts of (Kuhnle & Copestake, 2017) (https://github.com/AlexKuhnle/ShapeWorld). The exact scripts will be added together with the SLASH source code.
|
| 418 |
+
|
| 419 |
+
# C.2 AVERAGE PRECISION COMPUTATION (SHAPEWORLD4)
|
| 420 |
+
|
| 421 |
+
For the baseline slot encoder experiments on ShapeWorld4 we measured the average precision score as in Locatello et al. (2020). In comparison to the baseline slot encoder, when applying SLASH Attention, however, we handled the case of a slot not containing an object, e.g. only background variables, differently. Whereas Locatello et al. (2020) add an additional binary identifier to the multi-label ground truth vectors, we have added a background (bg) attribute to each category (cf. Fig. 6). A slot is thus considered to be empty (i.e. not containing an object) if each NPP returns the maximal conditional probability for the $b g$ attribute.
|
| 422 |
+
|
| 423 |
+
As the ShapeWorld4 prediction task only included discrete object properties both for Slot Attention as well as for SLASH Attention the distance threshold for the average precision computation was infinity (thus corresponding to no threshold).
|
| 424 |
+
|
| 425 |
+
# C.3 MODEL DETAILS
|
| 426 |
+
|
| 427 |
+
For those experiments using NPPs with PC we have used Einsum Networks (EiNets) for implementing the probabilistic circuits. EiNets are a novel implementation design for SPNs introduced by Peharz et al. (2020) that minimize the issue of computational costs that initial SPNs had suffered. This is accomplished by combining several arithmetic operations via a single monolithic einsum-operation.
|
| 428 |
+
|
| 429 |
+
For all experiments, the ADAM optimizer (Kingma & Ba, 2015) with $\beta 1 = 0 . 9$ and $\beta 2 = 0 . 9 9 9$ $\epsilon = 1 e - 8$ and no weight decay was used.
|
| 430 |
+
|
| 431 |
+
MNIST-Addition Experiments For the MNIST-Addition experiments, we ran the DeepProbLog and NeurASP programs with their original configurations, as stated in (Manhaeve et al., 2018) and (Yang et al., 2020), respectively. For the SLASH MNIST-Addition experiments, we have used the same neural module as in DeepProbLog and NeurASP, when training SLASH with the neural NPP (SLASH (DNN)) represented in Tab. 2. When using a PC NPP (SLASH (PC)) we have used an EiNet with the Poon-Domingos (PD) structure (Poon & Domingos, 2011) and normal distribution for the leafs. The formal hyperparameters for the EiNet are depicted in Tab. 3.
|
| 432 |
+
|
| 433 |
+
The learning rate and batch size for the DNN were 0.005 and 100, for DeepProbLog, NeurASP and SLASH (DNN). For the EiNet, these were 0.01 and 100.
|
| 434 |
+
|
| 435 |
+
Table 2: Neural module – LeNet5 for MNIST-Addition experiments.
|
| 436 |
+
|
| 437 |
+
<table><tr><td>Type</td><td>Size/Channels</td><td>Activation</td><td>Comment</td></tr><tr><td>Encoder</td><td>-</td><td>二</td><td>-</td></tr><tr><td>Conv 5 x 5</td><td>1x28x28</td><td>1</td><td>stride 1</td></tr><tr><td>MaxPool2d</td><td>6x24x24</td><td>ReLU</td><td>kernel size 2, stride 2</td></tr><tr><td>Conv 5 x 5</td><td>6x12x12</td><td>1</td><td>stride 1</td></tr><tr><td>MaxPool2d</td><td>16x8x8</td><td>ReLU</td><td>kernel size 2,stride 2</td></tr><tr><td>Classifier</td><td>1</td><td>-</td><td>-</td></tr><tr><td>MLP</td><td>16x4x4,120</td><td>ReLU</td><td>-</td></tr><tr><td>MLP</td><td>120,84</td><td>ReLU</td><td>-</td></tr><tr><td>MLP</td><td>84,10</td><td>1</td><td>Softmax</td></tr></table>
|
| 438 |
+
|
| 439 |
+
ShapeWorld4 Experiments For the baseline slot attention experiments with the ShapeWorld4 data set we have used the architecture presented in Tab. 4. For further details on this, we refer to the original work of Locatello et al. (2020). The slot encoder had a number of 4 slots and 3 attention iterations over all experiments.
|
| 440 |
+
|
| 441 |
+
Table 3: Probabilistic Circuit module – EiNet for MNIST-Addition experiments.
|
| 442 |
+
|
| 443 |
+
<table><tr><td>Variables</td><td>Width</td><td>Height</td><td>Number of Pieces</td><td>Class count</td></tr><tr><td>784</td><td>28</td><td>28</td><td>[4,7,28]</td><td>10</td></tr></table>
|
| 444 |
+
|
| 445 |
+
Table 4: Baseline slot encoder for ShapeWorld4 experiments.
|
| 446 |
+
|
| 447 |
+
<table><tr><td>Type</td><td>Size/Channels</td><td>Activation</td><td>Comment</td></tr><tr><td>Conv 5 x 5</td><td>32</td><td>ReLU</td><td>stride 1</td></tr><tr><td>Conv 5 x 5</td><td>32</td><td>ReLU</td><td>stride 1</td></tr><tr><td>Conv 5 x 5</td><td>32</td><td>ReLU</td><td>stride 1</td></tr><tr><td>Conv 5 x 5</td><td>32</td><td>ReLU</td><td>stride 1</td></tr><tr><td>Position Embedding</td><td>1</td><td>二</td><td>-</td></tr><tr><td>Flatten</td><td>axis: [0, 1,2 x 3]</td><td>-</td><td>flatten x, y pos.</td></tr><tr><td>Layer Norm</td><td>二</td><td>-</td><td>二</td></tr><tr><td>MLP (per location)</td><td>32</td><td>ReLU</td><td>二</td></tr><tr><td>MLP (per location)</td><td>32</td><td>-</td><td>二</td></tr><tr><td>SlotAttentionModule</td><td>32</td><td>ReLU</td><td>二</td></tr><tr><td>MLP</td><td>32</td><td>ReLU</td><td></td></tr><tr><td>MLP</td><td>16</td><td>Sigmoid</td><td>二 1</td></tr></table>
|
| 448 |
+
|
| 449 |
+
For the SLASH Attention experiments with ShapeWorld4 we have used the same slot encoder as in Tab. 4, however, we replaced the final MLPs with 4 individual EiNets with Poon-Domingos structure (Poon & Domingos, 2011). Their hyperparameters are represented in Tab. 5.
|
| 450 |
+
|
| 451 |
+
Table 5: Probabilistic Circuit module – EiNet for ShapeWorld4 experiments.
|
| 452 |
+
|
| 453 |
+
<table><tr><td>EiNet</td><td>Variables</td><td>Width</td><td>Height</td><td>Number ofPieces</td><td>Class count</td></tr><tr><td>Color</td><td>32</td><td>8</td><td>4</td><td>[4]</td><td>9</td></tr><tr><td>Shape</td><td>32</td><td>8</td><td>4</td><td>[4]</td><td>4</td></tr><tr><td>Shade</td><td>32</td><td>8</td><td>4</td><td>[4]</td><td>3</td></tr><tr><td>Size</td><td>32</td><td>8</td><td>4</td><td>[4]</td><td>3</td></tr></table>
|
| 454 |
+
|
| 455 |
+
The learning rate and batch size for SLASH Attention were 0.01 and 512, for ShapeWorld4 and ShapeWorld4 CoGenT. The learning rate for the baseline slot encoder were 0.0004 and 512.
|
| 456 |
+
|
| 457 |
+
# D APPENDIX D - ADDITIONAL RESULTS ON MNIST ADDITION
|
| 458 |
+
|
| 459 |
+
Table 6: Additional MNIST Addition Results. Test accuracy corresponds to the percentage of correctly classified test images. Both models (DeepProbLog and SLASH (PC)) were trained on the full MNIST data, but tested on images with missing pixels. Test accuracies are presented in percent. The amount of missing data was varied between $50 \%$ and $9 7 \%$ of the pixels per image.
|
| 460 |
+
|
| 461 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>DeepProbLog</td><td rowspan=1 colspan=1>SLASH (PC)</td></tr><tr><td rowspan=1 colspan=1>50%</td><td rowspan=1 colspan=1>79.94 ± 7.2</td><td rowspan=1 colspan=1>72.2 ± 12.15</td></tr><tr><td rowspan=1 colspan=1>80%</td><td rowspan=1 colspan=1>31.6± 6.08</td><td rowspan=1 colspan=1>44.2± 8.23</td></tr><tr><td rowspan=1 colspan=1>90%</td><td rowspan=1 colspan=1>16.94 ± 1.76</td><td rowspan=1 colspan=1>29.6± 5.77</td></tr><tr><td rowspan=1 colspan=1>97%</td><td rowspan=1 colspan=1>12.33 ± 0.47</td><td rowspan=1 colspan=1>17.6 ± 2.97</td></tr></table>
|
| 462 |
+
|
| 463 |
+
In addition to the setting considered in Evaluation 2, we adjusted the settings for the MNIST Addition task with missing data into the following way.
|
| 464 |
+
|
| 465 |
+
Training was performed with the full MNIST data set, however the test data set contained different rates of missing pixels. Whereas using an NPP with a PC allows, among other things, to compute marginalization “out of the box” without requiring an update to the architecture or a retraining, this is not so trivial for purely neural-based predicates as in DeepProbLog. Thus, we allowed SLASH (PC) to marginalize over the missing pixels, where this was not directly possible for DeepProbLog.
|
| 466 |
+
|
| 467 |
+
The results can be seen in Tab. 6 for $5 0 \%$ , $8 0 \%$ , $9 0 \%$ and $9 7 \%$ of missing pixels per image in the test set. We observe that at $5 0 \%$ , DeepProbLog outperforms SLASH by a small margin. For all other rates, we observe that SLASH (PC) reaches significantly higher test accuracies than DeepProbLog. However, we remark that in this setting, SLASH produces larger standard deviations in comparison to DeepProbLog. These results indicate that the conclusions, drawn in the main part of our work, remain true also in this setting of handling missing data.
|
md/dev/1PL1NIMMrw/1PL1NIMMrw.md
ADDED
|
@@ -0,0 +1,549 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SELF-CONSISTENCY IMPROVES CHAIN OF THOUGHT REASONING IN LANGUAGE MODELS
|
| 2 |
+
|
| 3 |
+
Xuezhi Wang†‡, Jason Wei†, Dale Schuurmans†, Quoc Le†, Ed H. Chi†, Sharan Narang†, Aakanksha Chowdhery†, Denny Zhou†§
|
| 4 |
+
|
| 5 |
+
†Google Research, Brain Team ‡xuezhiw@google.com, §dennyzhou@google.com
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Chain-of-thought prompting combined with pre-trained large language models has achieved encouraging results on complex reasoning tasks. In this paper, we propose a new decoding strategy, self-consistency, to replace the naive greedy decoding used in chain-of-thought prompting. It first samples a diverse set of reasoning paths instead of only taking the greedy one, and then selects the most consistent answer by marginalizing out the sampled reasoning paths. Self-consistency leverages the intuition that a complex reasoning problem typically admits multiple different ways of thinking leading to its unique correct answer. Our extensive empirical evaluation shows that self-consistency boosts the performance of chain-of-thought prompting with a striking margin on a range of popular arithmetic and commonsense reasoning benchmarks, including GSM8K $( + 1 7 . 9 \% )$ , SVAMP $( + 1 1 . 0 \% )$ , AQuA $( + 1 2 . 2 \% )$ , StrategyQA $( + 6 . 4 \% )$ and ARC-challenge $( + 3 . 9 \% )$ .
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Although language models have demonstrated remarkable success across a range of NLP tasks, their ability to demonstrate reasoning is often seen as a limitation, which cannot be overcome solely by increasing model scale (Rae et al., 2021; BIG-bench collaboration, 2021, inter alia). In an effort to address this shortcoming, Wei et al. (2022) have proposed chain-of-thought prompting, where a language model is prompted to generate a series of short sentences that mimic the reasoning process a person might employ in solving a task. For example, given the question “If there are 3 cars in the parking lot and 2 more cars arrive, how many cars are in the parking lot?”, instead of directly responding with “5”, a language model would be prompted to respond with the entire chain-of-thought: “There are 3 cars in the parking lot already. 2 more arrive. Now there are $3 +$ $2 = 5$ cars. The answer is 5.”. It has been observed that chain-of-thought prompting significantly improves model performance across a variety of multi-step reasoning tasks (Wei et al., 2022).
|
| 14 |
+
|
| 15 |
+
In this paper, we introduce a novel decoding strategy called self-consistency to replace the greedy decoding strategy used in chain-of-thought prompting (Wei et al., 2022), that further improves language models’ reasoning performance by a significant margin. Self-consistency leverages the intuition that complex reasoning tasks typically admit multiple reasoning paths that reach a correct answer (Stanovich & West, 2000). The more that deliberate thinking and analysis is required for a problem (Evans, 2010), the greater the diversity of reasoning paths that can recover the answer.
|
| 16 |
+
|
| 17 |
+
Figure 1 illustrates the self-consistency method with an example. We first prompt the language model with chain-of-thought prompting, then instead of greedily decoding the optimal reasoning path, we propose a “sample-and-marginalize” decoding procedure: we first sample from the language model’s decoder to generate a diverse set of reasoning paths; each reasoning path might lead to a different final answer, so we determine the optimal answer by marginalizing out the sampled reasoning paths to find the most consistent answer in the final answer set. Such an approach is analogous to the human experience that if multiple different ways of thinking lead to the same answer, one has greater confidence that the final answer is correct. Compared to other decoding methods, self-consistency avoids the repetitiveness and local-optimality that plague greedy decoding, while mitigating the stochasticity of a single sampled generation.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: The self-consistency method contains three steps: (1) prompt a language model using chain-of-thought (CoT) prompting; (2) replace the “greedy decode” in CoT prompting by sampling from the language model’s decoder to generate a diverse set of reasoning paths; and (3) marginalize out the reasoning paths and aggregate by choosing the most consistent answer in the final answer set.
|
| 21 |
+
|
| 22 |
+
Self-consistency is far simpler than prior approaches that either train an additional verifier (Cobbe et al., 2021) or train a re-ranker given additional human annotations to improve generation quality (Thoppilan et al., 2022). Instead, self-consistency is entirely unsupervised, works off-the-shelf with pre-trained language models, requires no additional human annotation, and avoids any additional training, auxiliary models or fine-tuning. Self-consistency also differs from a typical ensemble approach where multiple models are trained and the outputs from each model are aggregated, it acts more like a “self-ensemble” that works on top of a single language model.
|
| 23 |
+
|
| 24 |
+
We evaluate self-consistency on a wide range of arithmetic and commonsense reasoning tasks over four language models with varying scales: the public UL2-20B (Tay et al., 2022) and GPT-3-175B (Brown et al., 2020), and two densely-activated decoder-only language models: LaMDA-137B (Thoppilan et al., 2022) and PaLM-540B (Chowdhery et al., 2022). On all four language models, self-consistency improves over chain-of-thought prompting by a striking margin across all tasks. In particular, when used with PaLM-540B or GPT-3, self-consistency achieves new state-of-the-art levels of performance across arithmetic reasoning tasks, including GSM8K (Cobbe et al., 2021) $( + 1 7 . 9 \%$ absolute accuracy gains), SVAMP (Patel et al., 2021) $( + 1 1 . 0 \% )$ , AQuA (Ling et al., 2017) $( + 1 2 . 2 \% )$ , and across commonsense reasoning tasks such as StrategyQA (Geva et al., 2021) $( + 6 . 4 \% )$ and ARCchallenge (Clark et al., 2018) $( + 3 . 9 \% )$ . In additional experiments, we show self-consistency can robustly boost performance on NLP tasks where adding a chain-of-thought might hurt performance compared to standard prompting (Ye & Durrett, 2022). We also show self-consistency significantly outperforms sample-and-rank, beam search, ensemble-based approaches, and is robust to sampling strategies and imperfect prompts.
|
| 25 |
+
|
| 26 |
+
# 2 SELF-CONSISTENCY OVER DIVERSE REASONING PATHS
|
| 27 |
+
|
| 28 |
+
A salient aspect of humanity is that people think differently. It is natural to suppose that in tasks requiring deliberate thinking, there are likely several ways to attack the problem. We propose that such a process can be simulated in language models via sampling from the language model’s decoder. For instance, as shown in Figure 1, a model can generate several plausible responses to a math question that all arrive at the same correct answer (Outputs 1 and 3). Since language models are not perfect reasoners, the model might also produce an incorrect reasoning path or make a mistake in one of the reasoning steps (e.g., in Output 2), but such solutions are less likely to arrive at the same answer. That is, we hypothesize that correct reasoning processes, even if they are diverse, tend to have greater agreement in their final answer than incorrect processes.
|
| 29 |
+
|
| 30 |
+
We leverage this intuition by proposing the following self-consistency method. First, a language model is prompted with a set of manually written chain-of-thought exemplars (Wei et al., 2022). Next, we sample a set of candidate outputs from the language model’s decoder, generating a diverse set of candidate reasoning paths. Self-consistency is compatible with most existing sampling algorithms, including temperature sampling (Ackley et al., 1985; Ficler & Goldberg, 2017), top- $k$ sampling (Fan et al., 2018; Holtzman et al., 2018; Radford et al., 2019), and nucleus sampling (Holtzman et al., 2020). Finally, we aggregate the answers by marginalizing out the sampled reasoning paths and choosing the answer that is the most consistent among the generated answers.
|
| 31 |
+
|
| 32 |
+
<table><tr><td></td><td>GSM8K</td><td>MultiArith</td><td>AQuA</td><td>SVAMP</td><td>CSQA</td><td>ARC-c</td></tr><tr><td>Greedy decode</td><td>56.5</td><td>94.7</td><td>35.8</td><td>79.0</td><td>79.0</td><td>85.2</td></tr><tr><td>Weighted avg (unnormalized)</td><td>56.3±0.0</td><td>90.5±0.0</td><td>35.8±0.0</td><td>73.0±0.0</td><td>74.8±0.0</td><td>82.3 ±0.0</td></tr><tr><td>Weighted avg (normalized)</td><td>22.1 ± 0.0</td><td>59.7 ± 0.0</td><td>15.7 ± 0.0</td><td>40.5± 0.0</td><td>52.1±0.0</td><td>51.7 ± 0.0</td></tr><tr><td>Weighted sum (unnormalized)</td><td>59.9 ± 0.0</td><td>92.2 ± 0.0</td><td>38.2 ± 0.0</td><td>76.2 ± 0.0</td><td>76.2 ± 0.0</td><td>83.5± 0.0</td></tr><tr><td>Weighted sum (normalized)</td><td>74.1 ± 0.0</td><td>99.3 ± 0.0</td><td>48.0± 0.0</td><td>86.8± 0.0</td><td>80.7± 0.0</td><td>88.7 ±0.0</td></tr><tr><td>Unweighted sum (majority vote)</td><td>)74.4 ±0.1</td><td>99.3 ± 0.0</td><td>48.3 ± 0.5</td><td>86.6 ± 0.1</td><td>80.7 ± 0.1</td><td>88.7 ± 0.1</td></tr></table>
|
| 33 |
+
|
| 34 |
+
Table 1: Accuracy comparison of different answer aggregation strategies on PaLM-540B.
|
| 35 |
+
|
| 36 |
+
In more detail, assume the generated answers ${ \bf a } _ { i }$ are from a fixed answer set, $\mathbf { a } _ { i } \in \mathbb { A }$ , where $i = 1 , \ldots , m$ indexes the $m$ candidate outputs sampled from the decoder. Given a prompt and a question, self-consistency introduces an additional latent variable $\mathbf { r } _ { i }$ , which is a sequence of tokens representing the reasoning path in the $i$ -th output, then couples the generation of $( \mathbf { r } _ { i } , \mathbf { a } _ { i } )$ where $\mathbf { r } _ { i } \mathbf { a } _ { i }$ , i.e., generating a reasoning path $\mathbf { r } _ { i }$ is optional and only used to reach the final answer ${ \bf a } _ { i }$ . As an example, consider Output 3 from Figure 1: the first few sentences “She eats 3 for breakfast ... So she has $9 e g g s * \mathbb { S } 2 = \mathbb { S } I \mathbb { S } .$ ” constitutes $\mathbf { r } _ { i }$ , while the answer 18 from the last sentence, “The answer is $\$ 18$ , is parsed as ${ \bf a } _ { i }$ .1 After sampling multiple $\left( \mathbf { r } _ { i } , \mathbf { a } _ { i } \right)$ from the model’s decoder, self-consistency applies a marginalization over $\mathbf { r } _ { i }$ by taking a majority vote over ${ \bf a } _ { i }$ , i.e., arg maxa $\begin{array} { r } { \sum _ { i = 1 } ^ { m } \mathbb { 1 } ( \mathbf { a } _ { i } = a ) } \end{array}$ or as we defined as the most “consistent” answer among the final answer set.
|
| 37 |
+
|
| 38 |
+
In Table 1, we show the test accuracy over a set of reasoning tasks by using different answer aggregation strategies. In addition to majority vote, one can also weight each $( \mathbf { r } _ { i } , \mathbf { a } _ { i } )$ by $P ( \mathbf { r } _ { i } , \mathbf { a } _ { i } \mid$ prompt, question) when aggregating the answers. Note to compute $P ( \mathbf { r } _ { i } , \mathbf { a } _ { i } \mid$ prompt, question), we can either take the unnormalized probability of the model generating $( \mathbf { r } _ { i } , \mathbf { a } _ { i } )$ given (prompt, question), or we can normalize the conditional probability by the output length (Brown et al., 2020), i.e.,
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
\begin{array} { r } { P ( \mathbf { r } _ { i } , \mathbf { a } _ { i } \mid \mathrm { p r o m p t } , \mathbf { q u e s t i o n } ) = \exp ^ { \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \log P ( t _ { k } | \mathrm { p r o m p t } , \mathbf { q u e s t i o n } , t _ { 1 } , \dots , t _ { k - 1 } ) } , } \end{array}
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
where $\log { P ( t _ { k } \ | }$ prompt, question, $t _ { 1 } , \ldots , t _ { k - 1 } )$ ) is the log probability of generating the $k$ -th token $t _ { k }$ in $\left( \mathbf { r } _ { i } , \mathbf { a } _ { i } \right)$ conditioned on the previous tokens, and $K$ is the total number of tokens in $( \mathbf { r } _ { i } , \mathbf { a } _ { i } )$ . In Table 1, we show that taking the “unweighted sum”, i.e., taking a majority vote directly over ${ \bf a } _ { i }$ yields a very similar accuracy as aggregating using the “normalized weighted sum”. We took a closer look at the model’s output probabilities and found this is because for each $( \mathbf { r } _ { i } , \mathbf { a } _ { i } )$ , the normalized conditional probabilities $P ( \mathbf { r } _ { i } , \mathbf { a } _ { i } \mid$ prompt, question) are quite close to each other, i.e., the language model regards those generations as “similarly likely”.2 Additionally, when aggregating the answers, the results in Table 1 show that the “normalized” weighted sum (i.e., Equation 1) yields a much higher accuracy compared to its unnormalized counterpart. For completeness, in Table 1 we also report the results by taking a “weighted average”, i.e., each $a$ gets a score of its weighted sum divided by $\Sigma _ { i = 1 } ^ { m } \mathbb { 1 } ( \mathbf { a } _ { i } = \bar { a } )$ , which results in a much worse performance.
|
| 45 |
+
|
| 46 |
+
Self-consistency explores an interesting space between open-ended text generation and optimal text generation with a fixed answer. Reasoning tasks typically have fixed answers, which is why researchers have generally considered greedy decoding approaches (Radford et al., 2019; Wei et al., 2022; Chowdhery et al., 2022). However, we have found that even when the desired answer is fixed, introducing diversity in the reasoning processes can be highly beneficial; therefore we leverage sampling, as commonly used for open-ended text generation (Radford et al., 2019; Brown et al., 2020; Thoppilan et al., 2022), to achieve this goal. One should note that self-consistency can be applied only to problems where the final answer is from a fixed answer set, but in principle this approach can be extended to open-text generation problems if a good metric of consistency can be defined between multiple generations, e.g., whether two answers agree or contradict each other.
|
| 47 |
+
|
| 48 |
+
# 3 EXPERIMENTS
|
| 49 |
+
|
| 50 |
+
We conducted a series of experiments to compare the proposed self-consistency method with existing approaches on a range of reasoning benchmarks. We find that self-consistency robustly improves reasoning accuracy for every language model considered, spanning a wide range of model scales.
|
| 51 |
+
|
| 52 |
+
# 3.1 EXPERIMENT SETUP
|
| 53 |
+
|
| 54 |
+
Tasks and datasets. We evaluate self-consistency on the following reasoning benchmarks.3 • Arithmetic reasoning. For these tasks, we used the Math Word Problem Repository (KoncelKedziorski et al., 2016), including AddSub (Hosseini et al., 2014), MultiArith (Roy & Roth, 2015), and ASDiv (Miao et al., 2020). We also included AQUA-RAT (Ling et al., 2017), a recently published benchmark of grade-school-math problems (GSM8K; Cobbe et al., 2021), and a challenge dataset over math word problems (SVAMP; Patel et al., 2021). • Commonsense reasoning. For these tasks, we used CommonsenseQA (Talmor et al., 2019), StrategyQA (Geva et al., 2021), and the AI2 Reasoning Challenge (ARC) (Clark et al., 2018). • Symbolic Reasoning. We evaluate two symbolic reasoning tasks: last letter concatenation (e.g., the input is “Elon Musk” and the output should be “nk”), and Coinflip (e.g., a coin is heads-up, after a few flips is the coin still heads-up?) from Wei et al. (2022).
|
| 55 |
+
|
| 56 |
+
Language models and prompts. We evaluate self-consistency over four transformer-based language models with varying scales:
|
| 57 |
+
|
| 58 |
+
• UL2 (Tay et al., 2022) is an encoder-decoder model trained on a mixture of denoisers with 20- billion parameters. UL2 is completely open-sourced4 and has similar or better performance than GPT-3 on zero-shot SuperGLUE, with only 20B parameters and thus is more compute-friendly; • GPT-3 (Brown et al., 2020) with 175-billion parameters. We use two public engines code-davinci001 and code-davinci-002 from the Codex series (Chen et al., 2021) to aid reproducibility;5 • LaMDA-137B (Thoppilan et al., 2022) is a dense left-to-right, decoder-only language model with 137-billion parameters, pre-trained on a mixture of web documents, dialog data and Wikipedia; • PaLM-540B (Chowdhery et al., 2022) is a dense left-to-right, decoder-only language model with 540-billion parameters, pre-trained on a high quality corpus of 780 billion tokens with filtered webpages, books, Wikipedia, news articles, source code, and social media conversations.
|
| 59 |
+
|
| 60 |
+
We perform all experiments in the few-shot setting, without training or fine-tuning the language models. For a fair comparison we use the same prompts as in Wei et al. (2022): for all arithmetic reasoning tasks we use the same set of 8 manually written exemplars; for each commonsense reasoning task, 4-7 exemplars are randomly chosen from the training set with manually composed chain-of-thought prompts.6 Full details on the prompts used are given in Appendix A.3.
|
| 61 |
+
|
| 62 |
+
Sampling scheme. To sample diverse reasoning paths, we followed similar settings to those suggested in Radford et al. (2019); Holtzman et al. (2020) for open-text generation. In particular, for UL2-20B and LaMDA-137B we applied temperature sampling with $T = 0 . 5$ and truncated at the top- $k$ $k = 4 0$ ) tokens with the highest probability, for PaLM-540B we applied $T = 0 . 7 , k = 4 0$ , and for GPT-3 we use $T = 0 . 7$ without top- $k$ truncation. We provide an ablation study in Section 3.5 to show that self-consistency is generally robust to sampling strategies and parameters.
|
| 63 |
+
|
| 64 |
+
# 3.2 MAIN RESULTS
|
| 65 |
+
|
| 66 |
+
We report the results of self-consistency averaged over 10 runs, where we sampled 40 outputs independently from the decoder in each run. The baseline we compare to is chain-of-thought prompting with greedy decoding (Wei et al., 2022), referred to as CoT-prompting, which has been previously used for decoding in large language models (Chowdhery et al., 2022).
|
| 67 |
+
|
| 68 |
+
Arithmetic Reasoning The results are shown in Table 2.7 Self-consistency improves the arithmetic reasoning performance over all four language models significantly over chain-of-thought prompting. More surprisingly, the gains become more significant when the language model’s scale increases, e.g., we see $+ 3 \% { - } 6 \%$ absolute accuracy improvement over UL2-20B but $+ 9 \% - 2 3 \%$ for LaMDA137B and GPT-3. For larger models that already achieve high accuracy on most tasks (e.g., GPT-3 and PaLM-540B), self-consistency still contributes significant additional gains with $+ 1 2 \% - 1 8 \%$ absolute accuracy on tasks like AQuA and GSM8K, and $+ 7 \% - 1 1 \%$ on SVAMP and ASDiv. With self-consistency, we achieve new state-of-the-art results on almost all tasks: despite the fact that selfconsistency is unsupervised and task-agnostic, these results compare favorably to existing approaches that require task-specific training, or fine-tuning with thousands of examples (e.g., on GSM8K).
|
| 69 |
+
|
| 70 |
+
Table 2: Arithmetic reasoning accuracy by self-consistency compared to chain-of-thought prompting (Wei et al., 2022). The previous SoTA baselines are obtained from: a: Relevance and LCA operation classifier (Roy & Roth, 2015), b: Lan et al. (2021), c: Amini et al. (2019), d: Pi et al. (2022), e: GPT-3 175B finetuned with $7 . 5 \mathrm { k }$ examples (Cobbe et al., 2021), $g$ : GPT-3 175B finetuned plus an additional 175B verifier (Cobbe et al., 2021). The best performance for each task is shown in bold.
|
| 71 |
+
|
| 72 |
+
<table><tr><td></td><td>Method</td><td>AddSub</td><td>MultiArith</td><td>ASDiv</td><td>AQuA</td><td>SVAMP</td><td>GSM8K</td></tr><tr><td></td><td>Previous SoTA</td><td>94.9a</td><td>60.5a</td><td>75.36</td><td>37.9c</td><td>57.4d</td><td>35e / 55g</td></tr><tr><td>UL2-20B</td><td>CoT-prompting Self-consistency</td><td>18.2 24.8 (+6.6)</td><td>10.7 15.0 (+4.3)</td><td>16.9 21.5 (+4.6)</td><td>23.6 26.9 (+3.3)</td><td>12.6 19.4 (+6.8)</td><td>4.1 7.3 (+3.2)</td></tr><tr><td>LaMDA-137B</td><td>CoT-prompting Self-consistency</td><td>52.9 63.5 (+10.6)</td><td>51.8 75.7 (+23.9)</td><td>49.0 58.2 (+9.2)</td><td>17.7 26.8 (+9.1)</td><td>38.9 53.3 (+14.4)</td><td>17.1 27.7 (+10.6)</td></tr><tr><td>PaLM-540B</td><td>CoT-prompting Self-consistency</td><td>91.9 93.7 (+1.8)</td><td>94.7 99.3 (+4.6)</td><td>74.0 81.9 (+7.9)</td><td>35.8 48.3 (+12.5)</td><td>79.0 86.6 (+7.6)</td><td>56.5 74.4 (+17.9)</td></tr><tr><td>GPT-3 Code-davinci-001</td><td>CoT-prompting Self-consistency</td><td>57.2 67.8 (+10.6)</td><td>59.5 82.7 (+23.2)</td><td>52.7 61.9 (+9.2)</td><td>18.9 25.6 (+6.7)</td><td>39.8 54.5 (+14.7)</td><td>14.6 23.4 (+8.8)</td></tr><tr><td>GPT-3 Code-davinci-002</td><td>CoT-prompting Self-consistency</td><td>89.4 91.6 (+2.2)</td><td>96.2 100.0 (+3.8)</td><td>80.1 87.8 (+7.6)</td><td>39.8 52.0 (+12.2)</td><td>75.8 86.8 (+11.0)</td><td>60.1 78.0 (+17.9)</td></tr></table>
|
| 73 |
+
|
| 74 |
+
<table><tr><td></td><td>Method</td><td>CSQA</td><td>StrategyQA</td><td>ARC-e</td><td>ARC-c</td><td>Letter (4)</td><td>Coinflip (4)</td></tr><tr><td></td><td>Previous SoTA</td><td>91.2a</td><td>73.96</td><td>86.4℃</td><td>75.0℃</td><td>N/A</td><td>N/A</td></tr><tr><td>UL2-20B</td><td>CoT-prompting Self-consistency</td><td>51.4 55.7 (+4.3)</td><td>53.3 54.9 (+1.6)</td><td>61.6 69.8 (+8.2)</td><td>42.9 49.5 (+6.8)</td><td>0.0 0.0 (+0.0)</td><td>50.4 50.5 (+0.1)</td></tr><tr><td>LaMDA-137B</td><td>CoT-prompting Self-consistency</td><td>57.9 63.1 (+5.2)</td><td>65.4 67.8 (+2.4)</td><td>75.3 79.3 (+4.0)</td><td>55.1 59.8 (+4.7)</td><td>8.2 8.2 (+0.0)</td><td>72.4 73.5 (+1.1)</td></tr><tr><td>PaLM-540B</td><td>CoT-prompting Self-consistency</td><td>79.0 80.7 (+1.7)</td><td>75.3 81.6 (+6.3)</td><td>95.3 96.4 (+1.1)</td><td>85.2 88.7 (+3.5)</td><td>65.8 70.8 (+5.0)</td><td>88.2 91.2 (+3.0)</td></tr><tr><td>GPT-3 Code-davinci-001</td><td>CoT-prompting Self-consistency</td><td>46.6 54.9 (+8.3)</td><td>56.7 61.7 (+5.0)</td><td>63.1 72.1 (+9.0)</td><td>43.1</td><td>7.8 10.0 (+2.2)</td><td>71.4 75.9 (+4.5)</td></tr><tr><td>GPT-3</td><td>CoT-prompting</td><td>79.0</td><td>73.4</td><td>94.0</td><td>53.7 (+10.6) 83.6</td><td>70.4</td><td>99.0</td></tr></table>
|
| 75 |
+
|
| 76 |
+
Table 3: Commonsense and symbolic reasoning accuracy by self-consistency compared to chainof-thought prompting (Wei et al., 2022). The previous SoTA baselines are obtained from: $a$ : DeBERTaV3-large $^ +$ KEAR ( $\mathrm { { X u } }$ et al., 2021b), $b$ : Chowdhery et al. (2022), c: UnifiedQA-FT (Khashabi et al., 2020). The best performance for each task is shown in bold.
|
| 77 |
+
|
| 78 |
+
Commonsense and Symbolic Reasoning Table 3 shows the results on commonsense and symbolic reasoning tasks. Similarly, self-consistency yields large gains across all four language models, and obtained SoTA results on 5 out of 6 tasks. For symbolic reasoning, we test the out-of-distribution (OOD) setting where the input prompt contains examples of 2-letters or 2-flips but we test examples of 4-letters and 4-flips (this setting is more challenging as PaLM-540B or GPT-3 can already achieve perfect in-distribution accuracy). In this challenging OOD setting, the gain of self-consistency is still quite significant compared to CoT-prompting with sufficient model sizes.
|
| 79 |
+
|
| 80 |
+
To show the effect of the number of sampled reasoning paths, we plot the accuracy (mean and standard deviation over 10 runs) with respect to varying numbers of sampled paths (1, 5, 10, 20, 40) in Figure 2. The results show that sampling a higher number (e.g., 40) of reasoning paths leads to a consistently better performance, further emphasizing the importance of introducing diversity in the reasoning paths. In Table 4, we show self-consistency yields a richer set of reasoning paths compared to greedy decoding with a few example questions from two tasks.
|
| 81 |
+
|
| 82 |
+

|
| 83 |
+
Figure 2: Self-consistency (blue) significantly improves accuracy over CoT-prompting with greedy decoding (orange) across arithmetic and commonsense reasoning tasks, over LaMDA-137B. Sampling a higher number of diverse reasoning paths consistently improves reasoning accuracy.
|
| 84 |
+
|
| 85 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>GSM8K StrategyQA</td></tr><tr><td rowspan=1 colspan=1>Question</td><td rowspan=1 colspan=1>Henry made two stops during his 6O-mile bike trip.Hefirst stopped after 20miles.His second stop was15 milesbefore the end of the trip.How many milesdid he travel between his first and second stops?</td><td rowspan=1 colspan=1>Yes or no:IsAlbany,Georgia the most populousUSAlbany?</td></tr><tr><td rowspan=1 colspan=1>GreedyDecode</td><td rowspan=1 colspan=1>He traveled 6O miles in total.He stopped after 20 miles,so he traveled 60 -20= 40 miles between the first and second stops. The answer is 40.</td><td rowspan=1 colspan=1>Albany, Georgia is the most populous US Al-bany. Thus,the answer is yes.</td></tr><tr><td rowspan=1 colspan=1>SampledPath 1</td><td rowspan=1 colspan=1>Henry travelled a total of 6O miles.His first stop was 2O miles in,and hissecond stop was 15 miles before the end. So between his first and second stopshe travelled 60 -20-15=25 miles. The answer is 25.</td><td rowspan=1 colspan=1>The most populous US Albany is Albany, NewYork.Thus,Albany,Georgia is not the mostpopulous US Albany. So the answer is no.</td></tr><tr><td rowspan=1 colspan=1>SampledPath 2</td><td rowspan=1 colspan=1>He made two stops during a 6O-mile trip. The first was 2O miles into the trip.The second was 15 miles before the end of the trip. This means the second stopWas 60 -15=45 miles into the trip. Since he made the stops in order,the second stop must have been 45 -20 = 25 miles after the first stop.The answer is 25.</td><td rowspan=1 colspan=1>Albany,Georgia has a population of about 88,000. Albany, New York has a population ofabout 95,Ooo. Thus,Albany, Georgia is not themost populous US Albany. So the answer is no.</td></tr></table>
|
| 86 |
+
|
| 87 |
+
Table 4: Examples where self-consistency helps repair the errors over greedy decode, on PaLM-540B. Two sampled reasoning paths that are consistent with the ground truth are shown.
|
| 88 |
+
|
| 89 |
+
# 3.3 SELF-CONSISTENCY HELPS WHEN CHAIN-OF-THOUGHT HURTS PERFORMANCE
|
| 90 |
+
|
| 91 |
+
Ye & Durrett (2022) show that sometimes chain-of-thought prompting could hurt performance compared to standard prompting in few-shot in-context learning. Here we perform a study using self-consistency to see if it can help fill in the gap, over a set of common NLP tasks, including (1) Closed-Book Question Answering: BoolQ (Clark et al., 2019), HotpotQA (Yang et al., 2018), and (2) Natural Language Inference: e-SNLI (Camburu et al., 2018), ANLI (Nie et al., 2020) and RTE (Dagan et al., 2005; Bar-Haim et al., 2006; Giampiccolo et al., 2007; Bentivogli et al., 2009).
|
| 92 |
+
|
| 93 |
+
The results over PaLM-540B are shown in Table 5. For some tasks (e.g., ANLI-R1, e-SNLI, RTE), adding chain-of-thought does hurt performance compared to standard prompting (Brown et al., 2020), but self-consistency is able to robustly boost the performance and outperform standard prompting, making it a reliable way to add rationales in few-shot in-context learning for common NLP tasks.
|
| 94 |
+
|
| 95 |
+
<table><tr><td></td><td>ANLIR1/R2/R3</td><td>e-SNLI</td><td>RTE</td><td>BoolQ</td><td>HotpotQA (EM/F1)</td></tr><tr><td>Standard-prompting (no-rationale)</td><td>69.1 / 55.8 / 55.8</td><td>85.8</td><td>84.8</td><td>71.3</td><td>27.1/36.8</td></tr><tr><td>CoT-prompting (Wei et al.,2022)</td><td>68.8 / 58.9 / 60.6</td><td>81.0</td><td>79.1</td><td>74.2</td><td>28.9/39.8</td></tr><tr><td>Self-consistency</td><td>78.5 / 64.5 / 63.4</td><td>88.4</td><td>86.3</td><td>78.4</td><td>33.8 / 44.6</td></tr></table>
|
| 96 |
+
|
| 97 |
+
Table 5: Compare Standard/CoT prompting with self-consistency on common NLP tasks.
|
| 98 |
+
|
| 99 |
+
# 3.4 COMPARE TO OTHER EXISTING APPROACHES
|
| 100 |
+
|
| 101 |
+
We conduct a set of additional studies and show that self-consistency significantly outperforms existing methods including sample-and-rank, beam search, and ensemble-based approaches.
|
| 102 |
+
|
| 103 |
+
Comparison to Sample-and-Rank One commonly used approach to improve generation quality is sample-and-rank, where multiple sequences are sampled from the decoder and then ranked according to each sequence’s log probability (Adiwardana et al., 2020). We compare self-consistency with sample-and-rank on GPT-3 code-davinci-001, by sampling the same number of sequences from the decoder as self-consistency and taking the final answer from the top-ranked sequence. The results are shown in Figure 3. While sample-and-rank does improve the accuracy with additionally sampled sequences and ranking, the gain is much smaller compared to self-consistency.
|
| 104 |
+
|
| 105 |
+

|
| 106 |
+
Figure 3: Self-consistency significantly outperforms sample-and-rank with the same # of samples.
|
| 107 |
+
|
| 108 |
+
Comparison to Beam Search In Table 6, we compare self-consistency with beam search decoding on the UL2-20B model. For a fair comparison we report the accuracy under the same number of beams and reasoning paths. On both tasks self-consistency outperforms beam search significantly. Note self-consistency can also adopt beam search to decode each reasoning path (results are shown as “Self-consistency using beam search”), but its performance is worse compared to self-consistency with sampling. The reason is that beam search yields a lower diversity in the outputs (Li & Jurafsky, 2016), while in self-consistency the diversity of the reasoning paths is the key to a better performance.
|
| 109 |
+
|
| 110 |
+
<table><tr><td></td><td>Beam size / Self-consistency paths</td><td>1</td><td>5</td><td>10</td><td>20</td><td>40</td></tr><tr><td rowspan="2">AQuA</td><td>Beam search decoding (top beam)</td><td>23.6 23.6</td><td>19.3 19.8 ± 0.3</td><td>16.1</td><td>15.0</td><td>10.2</td></tr><tr><td>Self-consistency using beam search Self-consistency using sampling</td><td>19.7 ± 2.5</td><td>24.9 ± 2.6</td><td>21.2 ±0.7 25.3 ± 1.8</td><td>24.6 ± 0.4 26.7 ± 1.0</td><td>24.2 ±0.5 26.9 ± 0.5</td></tr><tr><td rowspan="2">MultiArith</td><td></td><td>10.7</td><td>12.0</td><td>11.3</td><td></td><td></td></tr><tr><td>Beam search decoding (top beam)</td><td></td><td></td><td></td><td>11.0</td><td>10.5</td></tr><tr><td rowspan="2"></td><td>Self-consistency using beam search</td><td>10.7</td><td>11.8 ± 0.0</td><td>11.4 ± 0.1</td><td>12.3 ± 0.1</td><td>10.8 ±0.1</td></tr><tr><td>Self-consistency using sampling</td><td>9.5 ± 1.2</td><td>11.3 ± 1.2</td><td>12.3 ± 0.8</td><td>13.7 ± 0.9</td><td>14.7 ± 0.3</td></tr></table>
|
| 111 |
+
|
| 112 |
+
Table 6: Compare self-consistency with beam search decoding on the UL2-20B model.
|
| 113 |
+
|
| 114 |
+
Comparison to Ensemble-based Approaches We further compare self-consistency to ensemblebased methods for few-shot learning. In particular, we consider ensembling by: (1) prompt order permutation: we randomly permute the exemplars in the prompt 40 times to mitigate model’s sensitivity to prompt order (Zhao et al., 2021; Lu et al., 2021); and (2) multiple sets of prompts (Gao et al., 2021): we manually write 3 different sets of prompts. We took majority vote of the answers from greedy decoding in both approaches as an ensemble. Table 7 shows that compared to self-consistency, existing ensemble-based approaches achieve a much smaller gain.8 In addition, note that self-consistency is different from a typical model-ensemble approach, where multiple models are trained and their outputs are aggregated. Self-consistency acts more like a “self-ensemble” on top of a single language model. We additionally show the results of ensembling multiple models in Appendix A.1.3 where the model-ensembles perform much worse compared to self-consistency.
|
| 115 |
+
|
| 116 |
+
<table><tr><td></td><td>GSM8K</td><td>MultiArith</td><td>SVAMP</td><td>ARC-e</td><td>ARC-c</td></tr><tr><td>CoT (Wei et al., 2022)</td><td>17.1</td><td>51.8</td><td>38.9</td><td>75.3</td><td>55.1</td></tr><tr><td>Ensemble (3 sets of prompts)</td><td>18.6 ± 0.5</td><td>57.1 ± 0.7</td><td>42.1 ± 0.6</td><td>76.6 ± 0.1</td><td>57.0± 0.2</td></tr><tr><td>Ensemble (40 prompt permutations)</td><td>19.2 ± 0.1</td><td>60.9 ± 0.2</td><td>42.7 ± 0.1</td><td>76.9 ± 0.1</td><td>57.0 ±0.1</td></tr><tr><td>Self-Consistency (4O sampled paths)</td><td>27.7 ± 0.2</td><td>75.7 ± 0.3</td><td>53.3 ± 0.2</td><td>79.3 ± 0.3</td><td>59.8 ± 0.2</td></tr></table>
|
| 117 |
+
|
| 118 |
+
Table 7: Self-consistency outperforms prompt-order and multi-prompt ensembles on LaMDA-137B.
|
| 119 |
+
|
| 120 |
+
8Self-consistency is compatible with both ensemble approaches and we show the results in Appendix A.1.4.
|
| 121 |
+
|
| 122 |
+
# 3.5 ADDITIONAL STUDIES
|
| 123 |
+
|
| 124 |
+
We conducted a number of additional experiments to analyze different aspects of the self-consistency method, including its robustness to sampling strategies and parameters, and how it works with imperfect prompts and non-natural-language reasoning paths.
|
| 125 |
+
|
| 126 |
+
Self-Consistency is Robust to Sampling Strategies and Scaling We show self-consistency is robust to sampling strategies and parameters, by varying $T$ in temperature sampling (Ackley et al., 1985; Ficler & Goldberg, 2017), $k$ in top- $k$ sampling (Fan et al., 2018; Holtzman et al., 2018; Radford et al., 2019), and $p$ in nucleus sampling (Holtzman et al., 2020), over PaLM-540B in Figure 4 (left). Figure 4 (right) shows that self-consistency robustly improves performance across all scales for the LaMDA-137B model series. The gain is relatively lower for smaller models due to certain abilities (e.g., arithmetic) only emerge when the model reaches a sufficient scale (Brown et al., 2020).
|
| 127 |
+
|
| 128 |
+

|
| 129 |
+
Figure 4: GSM8K accuracy. (Left) Self-consistency is robust to various sampling strategies and parameters. (Right) Self-consistency improves performance across language model scales.
|
| 130 |
+
|
| 131 |
+
Self-Consistency Improves Robustness to Imperfect Prompts For few-shot learning with manually constructed prompts, human annotators sometimes make minor mistakes when creating the prompts. We further study if self-consistency can help improve a language model’s robustness to imperfect prompts.9 We show the results in Table 8: while imperfect prompts decrease accuracy with greedy decoding $1 7 . 1 1 4 . 9$ ), self-consistency can fill in the gaps and robustly improve the results.
|
| 132 |
+
|
| 133 |
+
Additionally, we found that the consistency (in terms of $\%$ of decodes agreeing with the final aggregated answer) is highly correlated with accuracy (Figure 5, over GSM8K). This suggests that one can use self-consistency to provide an uncertainty estimate of the model in its generated solutions. In other words, one can use low consistency as an indicator that the model has low confidence; i.e., self-consistency confers some ability for the model to “know when it doesn’t know”.
|
| 134 |
+
|
| 135 |
+
<table><tr><td rowspan="3">LaMDA-137B</td><td>Prompt with correct chain-of-thought</td><td>17.1</td></tr><tr><td>Prompt with imperfect chain-of-thought + Self-consistency (40 paths)</td><td>14.9 23.4</td></tr><tr><td>Prompt with equations + Self-consistency (40 paths)</td><td>5.0 6.5</td></tr><tr><td rowspan="2">PaLM-540B</td><td>Zero-shot CoT (Kojima et al., 2022)</td><td>43.0</td></tr><tr><td>+ Self-consistency (40 paths)</td><td>69.2</td></tr></table>
|
| 136 |
+
|
| 137 |
+
Table 8: Self-consistency works under imperfect prompts, equation prompts and zero-shot chain-of-thought for GSM8K.
|
| 138 |
+
|
| 139 |
+

|
| 140 |
+
Figure 5: The consistency is correlated with model’s accuracy.
|
| 141 |
+
|
| 142 |
+
Self-Consistency Works for Non-Natural-Language Reasoning Paths and Zero-shot CoT We also tested the generality of the self-consistency concept to alternative forms of intermediate reasoning like equations (e.g., from “There are 3 cars in the parking lot already. 2 more arrive. Now there are $3 + 2 = 5$ cars.” to $" 3 + 2 = 5 "$ ). The results are shown in Table 8 (“Prompt with equations”): self-consistency still improves accuracy by generating intermediate equations; however, compared to generating natural language reasoning paths, the gain is smaller since the equations are much shorter and less opportunity remains for generating diversity in the decoding process. In addition, we tested self-consistency with zero-shot chain-of-thought (Kojima et al., 2022) and show that self-consistency works for zero-shot CoT as well and improves the results significantly $( + 2 6 . 2 \% )$ in Table 8.
|
| 143 |
+
|
| 144 |
+
# 4 RELATED WORK
|
| 145 |
+
|
| 146 |
+
Reasoning in language models. Language models are known to struggle in Type 2 tasks, such as arithmetic, logical and commonsense reasoning (Evans, 2010). Previous work has primarily focused on specialized approaches for improving reasoning (Andor et al., 2019; Ran et al., 2019; Geva et al., 2020; Pi˛ekos et al., 2021). Compared to prior work, self-consistency is applicable to a wide range of reasoning tasks without any additional supervision or fine-tuning, while still substantially improving the performance of the chain-of-thought prompting approach proposed in Wei et al. (2022).
|
| 147 |
+
|
| 148 |
+
Sampling and re-ranking in language models. Multiple decoding strategies for language models have been proposed in the literature, e.g., temperature sampling (Ackley et al., 1985; Ficler & Goldberg, 2017), top- $k$ sampling (Fan et al., 2018; Holtzman et al., 2018; Radford et al., 2019), nucleus sampling (Holtzman et al., 2020), minimum Bayes risk decoding (Eikema & Aziz, 2020; Shi et al., 2022), and typical decoding (Meister et al., 2022). Other work has sought to explicitly promote diversity in the decoding process (Batra et al., 2012; Li et al., 2016; Vijayakumar et al., 2018).
|
| 149 |
+
|
| 150 |
+
Re-ranking is another common approach to improve generation quality in language models (Adiwardana et al., 2020; Shen et al., 2021). Thoppilan et al. (2022) collect additional human annotations to train a re-ranker for response filtering. Cobbe et al. (2021) train a “verifier” to re-rank generated solutions, which substantially improves the solve rate on math tasks compared to just fine-tuning the language model. Elazar et al. (2021) improve the consistency of factual knowledge extraction by extending pre-training with an additional consistency loss. All these methods require either training an additional re-ranker or collecting additional human annotation, while self-consistency requires no additional training, fine-tuning, nor extra data collection.
|
| 151 |
+
|
| 152 |
+
Extract reasoning paths. Some previous work has considered task-specific approaches for identifying reasoning paths, such as constructing semantic graphs (Xu et al., 2021a), learning an RNN to retrieve reasoning paths over the Wikipedia graph (Asai et al., 2020), fine-tuning with human annotated reasoning paths on math problems (Cobbe et al., 2021), or training an extractor with heuristic-based pseudo reasoning paths (Chen et al., 2019). More recently, the importance of diversity in the reasoning processes has been noticed, but only leveraged via task-specific training, either through an additional QA model over extracted reasoning paths (Chen et al., 2019), or by the introduction of latent variables in a commonsense knowledge graph (Yu et al., 2022). Compared to these approaches, self-consistency is far simpler and requires no additional training. The approach we propose simply couples the generation of reasoning paths and a final answer by sampling from the decoder, using aggregation to recover the most consistent answer without additional modules.
|
| 153 |
+
|
| 154 |
+
Consistency in language models. Some prior work has shown that language models can suffer from inconsistency in conversation (Adiwardana et al., 2020), explanation generation (Camburu et al., 2020), and factual knowledge extraction (Elazar et al., 2021). Welleck et al. (2020) use “consistency” to refer to generating an infinite-length sequence in recurrent language models. Nye et al. (2021) improve the logical consistency of samples from a System 1 model by adding a System 2-inspired logical reasoning module. In this paper we focus on a slightly different notion of “consistency”, i.e., utilizing answer consistency among diverse reasoning paths to improve accuracy.
|
| 155 |
+
|
| 156 |
+
# 5 CONCLUSION AND DISCUSSION
|
| 157 |
+
|
| 158 |
+
We introduced a simple yet effective method called self-consistency, and observed that it significantly improves accuracy in a range of arithmetic and commonsense reasoning tasks, across four large language models with varying scales. Beyond accuracy gains, self-consistency is also useful for collecting rationales when performing reasoning tasks with language models, and for providing uncertainty estimates and improved calibration of language model outputs.
|
| 159 |
+
|
| 160 |
+
One limitation of self-consistency is that it incurs more computation cost. In practice people can try a small number of paths (e.g., 5 or 10) as a starting point to realize most of the gains while not incurring too much cost, as in most cases the performance saturates quickly (Figure 2). As part of future work, one could use self-consistency to generate better supervised data to fine-tune the model, such that the model can give more accurate predictions in a single inference run after fine-tuning. In addition, we observed that language models can sometimes generate incorrect or nonsensical reasoning paths (e.g., the StrategyQA example in Table 4, the two population numbers are not exactly correct), and further work is needed to better ground models’ rationale generations.
|
| 161 |
+
|
| 162 |
+
# REPRODUCIBILITY STATEMENT
|
| 163 |
+
|
| 164 |
+
In experiments, we included four different language models with varying scales. Two of them are public models: UL2 is a completely open-sourced model with model checkpoints available at https:// github.com/google-research/google-research/tree/master/ul2; GPT-3 is also a public model with public API available at https://openai.com/api/. For GPT-3, we have included two public engines (“code-davinci-001” and “code-davinci-002”) to further aid reproducibility, as Codex is currently free so anyone can reproduce the results. In addition, as our results make use of LaMDA-137B and PaLM-540B that are not publicly available, we provide the exact input prompts for all tasks in Appendix A.3 (and note that we do not perform any finetuning and only apply prompting to off-the-shelf language models).
|
| 165 |
+
|
| 166 |
+
# ETHICS STATEMENT
|
| 167 |
+
|
| 168 |
+
As we stated in the discussion, language models can sometimes generate nonsensical or non-factual reasoning paths, so one should use language models’ outputs with extra caution. We deal with reasoning tasks mostly and the generated rationales are only used for inspecting how a model reaches its answer. One could potentially use the generated rationales to further check why the model makes certain mistakes or whether the model contains any biases when performing a certain task. For language model in real-world use, further work is needed to better ground models’ predictions and improve model’s factuality and safety, to ensure the models do not cause harms to users.
|
| 169 |
+
|
| 170 |
+
# REFERENCES
|
| 171 |
+
|
| 172 |
+
David H. Ackley, Geoffrey E. Hinton, and Terrence J. Sejnowski. A learning algorithm for boltzmann machines. Cognitive Science, 9(1):147–169, 1985. ISSN 0364-0213. URL https://www. sciencedirect.com/science/article/pii/S0364021385800124.
|
| 173 |
+
|
| 174 |
+
Daniel Adiwardana, Minh-Thang Luong, David R. So, Jamie Hall, Noah Fiedel, Romal Thoppilan, Zi Yang, Apoorv Kulshreshtha, Gaurav Nemade, Yifeng Lu, and Quoc V. Le. Towards a human-like open-domain chatbot, 2020.
|
| 175 |
+
|
| 176 |
+
Aida Amini, Saadia Gabriel, Shanchuan Lin, Rik Koncel-Kedziorski, Yejin Choi, and Hannaneh Hajishirzi. MathQA: Towards interpretable math word problem solving with operation-based formalisms. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 2357–2367. Association for Computational Linguistics, June 2019. URL https://aclanthology.org/N19-1245.
|
| 177 |
+
|
| 178 |
+
Daniel Andor, Luheng He, Kenton Lee, and Emily Pitler. Giving BERT a calculator: Finding operations and arguments with reading comprehension. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), 2019. URL https://aclanthology. org/D19-1609.
|
| 179 |
+
|
| 180 |
+
Akari Asai, Kazuma Hashimoto, Hannaneh Hajishirzi, Richard Socher, and Caiming Xiong. Learning to retrieve reasoning paths over wikipedia graph for question answering. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum? id $=$ SJgVHkrYDH.
|
| 181 |
+
|
| 182 |
+
Roy Bar-Haim, Ido Dagan, Bill Dolan, Lisa Ferro, Danilo Giampiccolo, Bernardo Magnini, and Idan Szpektor. The second pascal recognising textual entailment challenge. In Proceedings of the second PASCAL challenges workshop on recognising textual entailment, 2006.
|
| 183 |
+
|
| 184 |
+
Dhruv Batra, Payman Yadollahpour, Abner Guzman-Rivera, and Gregory Shakhnarovich. Diverse m-best solutions in markov random fields. In Proceedings of the 12th European Conference on Computer Vision - Volume Part V, ECCV’12, pp. 1–16, Berlin, Heidelberg, 2012. Springer-Verlag. ISBN 9783642337147. URL https://doi.org/10.1007/978-3-642-33715-4_1.
|
| 185 |
+
|
| 186 |
+
Luisa Bentivogli, Peter Clark, Ido Dagan, and Danilo Giampiccolo. The fifth pascal recognizing textual entailment challenge. In TAC, 2009.
|
| 187 |
+
|
| 188 |
+
BIG-bench collaboration. Beyond the imitation game: Measuring and extrapolating the capabilities of language models. In preparation, 2021. URL https://github.com/google/ BIG-bench/.
|
| 189 |
+
|
| 190 |
+
Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In Advances in Neural Information Processing Systems, 2020. URL https://proceedings.neurips.cc/paper/2020/ file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf.
|
| 191 |
+
|
| 192 |
+
Oana-Maria Camburu, Tim Rocktäschel, Thomas Lukasiewicz, and Phil Blunsom. esnli: Natural language inference with natural language explanations. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 9539–9549. Curran Associates, Inc., 2018. URL http://papers.nips.cc/paper/ 8163-e-snli-natural-language-inference-with-natural-language-explanations. pdf.
|
| 193 |
+
|
| 194 |
+
Oana-Maria Camburu, Brendan Shillingford, Pasquale Minervini, Thomas Lukasiewicz, and Phil Blunsom. Make up your mind! adversarial generation of inconsistent natural language explanations. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 4157–4165, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020. acl-main.382. URL https://aclanthology.org/2020.acl-main.382.
|
| 195 |
+
|
| 196 |
+
Jifan Chen, Shih-Ting Lin, and Greg Durrett. Multi-hop question answering via reasoning chains. CoRR, abs/1910.02610, 2019. URL http://arxiv.org/abs/1910.02610.
|
| 197 |
+
|
| 198 |
+
Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021.
|
| 199 |
+
|
| 200 |
+
Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh, Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek Rao, Parker Barnes, Yi Tay, Noam Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Ben Hutchinson, Reiner Pope, James Bradbury, Jacob Austin, Michael Isard, Guy Gur-Ari, Pengcheng Yin, Toju Duke, Anselm Levskaya, Sanjay Ghemawat, Sunipa Dev, Henryk Michalewski, Xavier Garcia, Vedant Misra, Kevin Robinson, Liam Fedus, Denny Zhou, Daphne Ippolito, David Luan, Hyeontaek Lim, Barret Zoph, Alexander Spiridonov, Ryan Sepassi, David Dohan, Shivani Agrawal, Mark Omernick, Andrew M. Dai, Thanumalayan Sankaranarayana Pillai, Marie Pellat, Aitor Lewkowycz, Erica Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee, Zongwei Zhou, Xuezhi Wang, Brennan Saeta, Mark Diaz, Orhan Firat, Michele Catasta, Jason Wei, Kathy Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. Palm: Scaling language modeling with pathways, 2022. URL https://arxiv.org/abs/2204.02311.
|
| 201 |
+
|
| 202 |
+
Christopher Clark, Kenton Lee, Ming-Wei Chang, Tom Kwiatkowski, Michael Collins, and Kristina Toutanova. Boolq: Exploring the surprising difficulty of natural yes/no questions. In NAACL, 2019.
|
| 203 |
+
|
| 204 |
+
Peter Clark, Isaac Cowhey, Oren Etzioni, Tushar Khot, Ashish Sabharwal, Carissa Schoenick, and Oyvind Tafjord. Think you have solved question answering? try arc, the ai2 reasoning challenge. ArXiv, abs/1803.05457, 2018.
|
| 205 |
+
|
| 206 |
+
Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems, 2021.
|
| 207 |
+
|
| 208 |
+
Ido Dagan, Oren Glickman, and Bernardo Magnini. The pascal recognising textual entailment challenge. In Machine Learning Challenges Workshop, pp. 177–190. Springer, 2005.
|
| 209 |
+
|
| 210 |
+
Bryan Eikema and Wilker Aziz. Is MAP decoding all you need? the inadequacy of the mode in neural machine translation. In Proceedings of the 28th International Conference on Computational Linguistics, pp. 4506–4520, Barcelona, Spain (Online), December 2020. International Committee on Computational Linguistics. URL https://aclanthology.org/2020.coling-main. 398.
|
| 211 |
+
|
| 212 |
+
Yanai Elazar, Nora Kassner, Shauli Ravfogel, Abhilasha Ravichander, Eduard Hovy, Hinrich Schütze, and Yoav Goldberg. Measuring and improving consistency in pretrained language models. Transactions of the Association for Computational Linguistics, 9:1012–1031, 2021. doi: 10.1162/tacl_a_00410. URL https://aclanthology.org/2021.tacl-1.60.
|
| 213 |
+
|
| 214 |
+
Jonathan St BT Evans. Intuition and reasoning: A dual-process perspective. Psychological Inquiry, 21(4):313–326, 2010.
|
| 215 |
+
|
| 216 |
+
Angela Fan, Mike Lewis, and Yann Dauphin. Hierarchical neural story generation. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 889–898, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1082. URL https://aclanthology.org/P18-1082.
|
| 217 |
+
|
| 218 |
+
Jessica Ficler and Yoav Goldberg. Controlling linguistic style aspects in neural language generation. In Proceedings of the Workshop on Stylistic Variation, pp. 94–104, Copenhagen, Denmark, September 2017. Association for Computational Linguistics. doi: 10.18653/v1/W17-4912. URL https: //aclanthology.org/W17-4912.
|
| 219 |
+
|
| 220 |
+
Tianyu Gao, Adam Fisch, and Danqi Chen. Making pre-trained language models better few-shot learners. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 3816–3830, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.295. URL https://aclanthology.org/2021.acl-long. 295.
|
| 221 |
+
|
| 222 |
+
Mor Geva, Ankit Gupta, and Jonathan Berant. Injecting numerical reasoning skills into language models. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, 2020. doi: 10.18653/v1/2020.acl-main.89. URL https://aclanthology.org/2020. acl-main.89.
|
| 223 |
+
|
| 224 |
+
Mor Geva, Daniel Khashabi, Elad Segal, Tushar Khot, Dan Roth, and Jonathan Berant. Did aristotle use a laptop? A question answering benchmark with implicit reasoning strategies. Transactions of the Association for Computational Linguistics, 2021. URL https://aclanthology.org/ 2021.tacl-1.21.
|
| 225 |
+
|
| 226 |
+
Danilo Giampiccolo, Bernardo Magnini, Ido Dagan, and Bill Dolan. The third pascal recognizing textual entailment challenge. In Proceedings of the ACL-PASCAL workshop on textual entailment and paraphrasing, pp. 1–9. Association for Computational Linguistics, 2007.
|
| 227 |
+
|
| 228 |
+
Ari Holtzman, Jan Buys, Maxwell Forbes, Antoine Bosselut, David Golub, and Yejin Choi. Learning to write with cooperative discriminators. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1638–1649, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1152. URL https://aclanthology.org/P18-1152.
|
| 229 |
+
|
| 230 |
+
Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. In International Conference on Learning Representations, 2020. URL https: //openreview.net/forum?id=rygGQyrFvH.
|
| 231 |
+
|
| 232 |
+
Mohammad Javad Hosseini, Hannaneh Hajishirzi, Oren Etzioni, and Nate Kushman. Learning to solve arithmetic word problems with verb categorization. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), 2014. doi: 10.3115/v1/D14-1058. URL https://aclanthology.org/D14-1058.
|
| 233 |
+
|
| 234 |
+
Daniel Khashabi, Sewon Min, Tushar Khot, Ashish Sabharwal, Oyvind Tafjord, Peter Clark, and Hannaneh Hajishirzi. UNIFIEDQA: Crossing format boundaries with a single QA system. In Findings of the Association for Computational Linguistics: EMNLP 2020, pp. 1896–1907, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.findings-emnlp.171. URL https://aclanthology.org/2020.findings-emnlp.171.
|
| 235 |
+
|
| 236 |
+
Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum?id $_ { \cdot } =$ e2TBb5y0yFf.
|
| 237 |
+
|
| 238 |
+
Rik Koncel-Kedziorski, Subhro Roy, Aida Amini, Nate Kushman, and Hannaneh Hajishirzi. MAWPS: A math word problem repository. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, 2016. doi: 10.18653/v1/N16-1136. URL https://aclanthology.org/N16-1136.
|
| 239 |
+
|
| 240 |
+
Yihuai Lan, Lei Wang, Qiyuan Zhang, Yunshi Lan, Bing Tian Dai, Yan Wang, Dongxiang Zhang, and Ee-Peng Lim. MWPToolkit: An open-source framework for deep learning-based math word problem solvers. arXiv preprint arXiv:2109.00799, 2021. URL https://arxiv.org/abs/ 2109.00799.
|
| 241 |
+
|
| 242 |
+
Jiwei Li and Dan Jurafsky. Mutual information and diverse decoding improve neural machine translation, 2016. URL https://arxiv.org/abs/1601.00372.
|
| 243 |
+
|
| 244 |
+
Jiwei Li, Will Monroe, and Dan Jurafsky. A simple, fast diverse decoding algorithm for neural generation. CoRR, abs/1611.08562, 2016. URL http://arxiv.org/abs/1611.08562.
|
| 245 |
+
|
| 246 |
+
Wang Ling, Dani Yogatama, Chris Dyer, and Phil Blunsom. Program induction by rationale generation: Learning to solve and explain algebraic word problems. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), 2017. doi: 10.18653/v1/P17-1015. URL https://aclanthology.org/P17-1015.
|
| 247 |
+
|
| 248 |
+
Yao Lu, Max Bartolo, Alastair Moore, Sebastian Riedel, and Pontus Stenetorp. Fantastically ordered prompts and where to find them: Overcoming few-shot prompt order sensitivity. ArXiv, abs/2104.08786, 2021.
|
| 249 |
+
|
| 250 |
+
Clara Meister, Tiago Pimentel, Gian Wiher, and Ryan Cotterell. Typical decoding for natural language generation. arXiv preprint arXiv:2202.00666, 2022.
|
| 251 |
+
|
| 252 |
+
Shen Yun Miao, Chao Chun Liang, and Keh Yih Su. A diverse corpus for evaluating and developing English math word problem solvers. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, 2020. URL https://aclanthology.org/2020. acl-main.92.
|
| 253 |
+
|
| 254 |
+
Yixin Nie, Adina Williams, Emily Dinan, Mohit Bansal, Jason Weston, and Douwe Kiela. Adversarial NLI: A new benchmark for natural language understanding. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics. Association for Computational Linguistics, 2020.
|
| 255 |
+
|
| 256 |
+
Maxwell Nye, Michael Henry Tessler, Joshua B. Tenenbaum, and Brenden M. Lake. Improving coherence and consistency in neural sequence models with dual-system, neuro-symbolic reasoning. In A. Beygelzimer, Y. Dauphin, P. Liang, and J. Wortman Vaughan (eds.), Advances in Neural Information Processing Systems, 2021. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ uyKk_avJ-p4.
|
| 257 |
+
|
| 258 |
+
Arkil Patel, Satwik Bhattamishra, and Navin Goyal. Are NLP models really able to solve simple math word problems? In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 2080–2094, Online, June 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.naacl-main. 168. URL https://aclanthology.org/2021.naacl-main.168.
|
| 259 |
+
|
| 260 |
+
Xinyu Pi, Qian Liu, Bei Chen, Morteza Ziyadi, Zeqi Lin, Yan Gao, Qiang Fu, Jian-Guang Lou, and Weizhu Chen. Reasoning like program executors, 2022.
|
| 261 |
+
|
| 262 |
+
Piotr Pi˛ekos, Mateusz Malinowski, and Henryk Michalewski. Measuring and improving BERT’s mathematical abilities by predicting the order of reasoning. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 2: Short Papers), 2021. doi: 10.18653/v1/2021.acl-short.49. URL https://aclanthology.org/2021.acl-short.49.
|
| 263 |
+
|
| 264 |
+
Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019.
|
| 265 |
+
|
| 266 |
+
Jack W Rae, Sebastian Borgeaud, Trevor Cai, Katie Millican, Jordan Hoffmann, Francis Song, John Aslanides, Sarah Henderson, Roman Ring, Susannah Young, et al. Scaling language models: Methods, analysis & insights from training gopher. arXiv preprint arXiv:2112.11446, 2021.
|
| 267 |
+
|
| 268 |
+
Qiu Ran, Yankai Lin, Peng Li, Jie Zhou, and Zhiyuan Liu. NumNet: Machine reading comprehension with numerical reasoning. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), 2019. doi: 10.18653/v1/D19-1251. URL https://aclanthology. org/D19-1251.
|
| 269 |
+
|
| 270 |
+
Subhro Roy and Dan Roth. Solving general arithmetic word problems. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, 2015. doi: 10.18653/v1/ D15-1202. URL https://aclanthology.org/D15-1202.
|
| 271 |
+
|
| 272 |
+
Jianhao Shen, Yichun Yin, Lin Li, Lifeng Shang, Xin Jiang, Ming Zhang, and Qun Liu. Generate & rank: A multi-task framework for math word problems. In Findings of the Association for Computational Linguistics: EMNLP 2021, pp. 2269–2279, Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. URL https://aclanthology. org/2021.findings-emnlp.195.
|
| 273 |
+
|
| 274 |
+
Freda Shi, Daniel Fried, Marjan Ghazvininejad, Luke Zettlemoyer, and Sida I. Wang. Natural language to code translation with execution. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pp. 3533–3546, Abu Dhabi, United Arab Emirates, December 2022. Association for Computational Linguistics. URL https://aclanthology. org/2022.emnlp-main.231.
|
| 275 |
+
|
| 276 |
+
Keith E Stanovich and Richard F West. Individual differences in reasoning: Implications for the rationality debate? Behavioral and brain sciences, 23(5):645–665, 2000. URL https: //pubmed.ncbi.nlm.nih.gov/11301544/.
|
| 277 |
+
|
| 278 |
+
Alon Talmor, Jonathan Herzig, Nicholas Lourie, and Jonathan Berant. CommonsenseQA: A question answering challenge targeting commonsense knowledge. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), 2019. URL https://aclanthology. org/N19-1421.
|
| 279 |
+
|
| 280 |
+
Yi Tay, Mostafa Dehghani, Vinh Q. Tran, Xavier Garcia, Jason Wei, Xuezhi Wang, Hyung Won Chung, Dara Bahri, Tal Schuster, Steven Zheng, Denny Zhou, Neil Houlsby, and Donald Metzler. Unifying language learning paradigms, 2022. URL https://arxiv.org/abs/2205.05131.
|
| 281 |
+
|
| 282 |
+
Romal Thoppilan, Daniel De Freitas, Jamie Hall, Noam Shazeer, Apoorv Kulshreshtha, Heng-Tze Cheng, Alicia Jin, Taylor Bos, Leslie Baker, Yu Du, et al. Lamda: Language models for dialog applications. arXiv preprint arXiv:2201.08239, 2022. URL https://arxiv.org/abs/ 2201.08239.
|
| 283 |
+
|
| 284 |
+
Ashwin Vijayakumar, Michael Cogswell, Ramprasaath Selvaraju, Qing Sun, Stefan Lee, David Crandall, and Dhruv Batra. Diverse beam search for improved description of complex scenes. Proceedings of the AAAI Conference on Artificial Intelligence, 32, Apr. 2018. URL https: //ojs.aaai.org/index.php/AAAI/article/view/12340.
|
| 285 |
+
|
| 286 |
+
Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed Chi, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. Conference on Neural Information Processing Systems (NeurIPS), 2022. URL https://arxiv. org/pdf/2201.11903.
|
| 287 |
+
|
| 288 |
+
Sean Welleck, Ilia Kulikov, Jaedeok Kim, Richard Yuanzhe Pang, and Kyunghyun Cho. Consistency of a recurrent language model with respect to incomplete decoding. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 5553–5568, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020. emnlp-main.448. URL https://aclanthology.org/2020.emnlp-main.448.
|
| 289 |
+
|
| 290 |
+
Weiwen Xu, Yang Deng, Huihui Zhang, Deng Cai, and Wai Lam. Exploiting reasoning chains for multi-hop science question answering. In Findings of the Association for Computational Linguistics: EMNLP 2021, pp. 1143–1156, Punta Cana, Dominican Republic, November 2021a. Association for Computational Linguistics. URL https://aclanthology.org/2021. findings-emnlp.99.
|
| 291 |
+
|
| 292 |
+
Yichong Xu, Chenguang Zhu, Shuohang Wang, Siqi Sun, Hao Cheng, Xiaodong Liu, Jianfeng Gao, Pengcheng He, Michael Zeng, and Xuedong Huang. Human parity on commonsenseqa: Augmenting self-attention with external attention, 2021b. URL https://arxiv.org/abs/ 2112.03254.
|
| 293 |
+
|
| 294 |
+
Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William Cohen, Ruslan Salakhutdinov, and Christopher D. Manning. HotpotQA: A dataset for diverse, explainable multi-hop question answering. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 2369–2380, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1259. URL https://aclanthology.org/D18-1259.
|
| 295 |
+
|
| 296 |
+
Xi Ye and Greg Durrett. The unreliability of explanations in few-shot prompting for textual reasoning. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum? id=Bct2f8fRd8S.
|
| 297 |
+
|
| 298 |
+
Wenhao Yu, Chenguang Zhu, Lianhui Qin, Zhihan Zhang, Tong Zhao, and Meng Jiang. Diversifying content generation for commonsense reasoning with mixture of knowledge graph experts. In Findings of Annual Meeting of the Association for Computational Linguistics (ACL), 2022.
|
| 299 |
+
|
| 300 |
+
Zihao Zhao, Eric Wallace, Shi Feng, Dan Klein, and Sameer Singh. Calibrate before use: Improving few-shot performance of language models. In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research. PMLR, 2021. URL https://proceedings.mlr.press/ v139/zhao21c.html.
|
| 301 |
+
|
| 302 |
+
# A APPENDIX
|
| 303 |
+
|
| 304 |
+
A.1 ADDITIONAL EXPERIMENT RESULTS
|
| 305 |
+
|
| 306 |
+
# A.1.1 ROBUSTNESS TO SAMPLING STRATEGIES AND PARAMETERS
|
| 307 |
+
|
| 308 |
+
In Figure 6 we ablate the results with respect to different sampling strategies and parameters by varying $T$ in temperature sampling and $k$ in Top- $k$ sampling, on LaMDA-137B. We show that self-consistency is robust to various sampling strategies and parameters.
|
| 309 |
+
|
| 310 |
+

|
| 311 |
+
Figure 6: GSM8K accuracy over LaMDA-137B. Self-consistency works under various sampling strategies and sampling parameters.
|
| 312 |
+
|
| 313 |
+
In Figure 7 and Figure 8, we show the results of self-consistency compared with greedy decoding a single path over LaMDA-137B and PaLM-540B, respectively. Self-consistency improves over greedy decode by a quite significant margin on both models, on top of high accuracy already achieved by scaling up model sizes.
|
| 314 |
+
|
| 315 |
+

|
| 316 |
+
Figure 7: Self-consistency (blue) significantly improves accuracy across various arithmetic and commonsense reasoning tasks, over LaMDA-137B. Sampling a higher number of diverse reasoning paths consistently improves reasoning accuracy.
|
| 317 |
+
|
| 318 |
+
We further show additional sampled reasoning paths from the LaMDA-137B model in Table 12, and sampled reasoning paths from the PaLM-540B model in Table 13. We see that the diversity in the additionally sampled reasoning paths indeed helps the model arrive at a more correct final answer after aggregation.
|
| 319 |
+
|
| 320 |
+
# A.1.2 ROBUSTNESS TO DIFFERENT SETS OF PROMPTS
|
| 321 |
+
|
| 322 |
+
In Table 9, we further show that self-consistency is quite robust to different sets of input prompts. We manually wrote 3 different sets of chain-of-thought as prompts to the model. Across all sets of prompts, self-consistency yields consistent gains over the original CoT approach.
|
| 323 |
+
|
| 324 |
+
# A.1.3 COMPARED TO MODEL ENSEMBLES
|
| 325 |
+
|
| 326 |
+
Additionally, we provide results of directly ensembling the outputs from multiple language models. The results are shown in Table 10, by greedily decoding sequences from 3 language models and taking the majority vote (averaged over 10 runs). Note this is a typical ensemble approach (averaging over the predictions over multiple models) and it achieves a performance significantly worse than self-consistency (self-consistency over PaLM-540B gets an accuracy of $7 4 . 4 \%$ ), as lower-capacity models drag down the performance of higher-capacity models. In addition, this approach is limited in two ways: 1) It requires multiple models for an ensemble which might not always be available, while self-consistency only requires one single model to “self-ensemble”; 2) If one of the models is much weaker, it can actually hurt the final performance.
|
| 327 |
+
|
| 328 |
+

|
| 329 |
+
Figure 8: Self-consistency (blue) significantly improves accuracy across various arithmetic and commonsense reasoning tasks, over PaLM-540B. Sampling a higher number of diverse reasoning paths consistently helps reasoning accuracy.
|
| 330 |
+
|
| 331 |
+
<table><tr><td></td><td>Prompt set 1 (used in the main text)丨Prompt set 2丨Prompt set 3</td><td></td><td></td></tr><tr><td>CoT (Wei et al., 2022)</td><td>56.5</td><td>54.6</td><td>54.0</td></tr><tr><td>Self-consistency</td><td>74.4 (+17.9)</td><td>72.1 (+17.5)</td><td>70.4 (+16.4)</td></tr></table>
|
| 332 |
+
|
| 333 |
+
Table 9: GSM8K accuracy over PaLM-540B. The results show robustness of self-consistency with respect to different prompts in the input.
|
| 334 |
+
|
| 335 |
+
<table><tr><td></td><td>Method</td><td>GSM8K accuracy</td></tr><tr><td>Single model</td><td>PaLM-540B,greedy/self-consistency</td><td>56.5 / 74.4</td></tr><tr><td rowspan="4">Ensemble of models</td><td>LaMDA-137B+PaLM-540B</td><td>36.9 ± 0.5</td></tr><tr><td>PaLM-540B + GPT-3 (code-davinci-001,175B)</td><td>36.6 ± 0.4</td></tr><tr><td>LaMDA-137B + GPT-3 (code-davinci-001,175B)</td><td>16.0 ± 0.8</td></tr><tr><td>LaMDA-137B +PaLM-540B + GPT-3 (code-davinci-001,175B)</td><td>33.3 ± 0.7</td></tr></table>
|
| 336 |
+
|
| 337 |
+
Table 10: Comparison of GSM8K accuracy over multiple-model ensembles.
|
| 338 |
+
|
| 339 |
+
# .1.4 COMBINING SELF-CONSISTENCY WITH OTHER ENSEMBLING STRATEGIE
|
| 340 |
+
|
| 341 |
+
Self-consistency is completely compatible with other ensemble strategies, although the gains achieved by self-consistency are significantly higher than other ensemble strategies (and can “override” the performance gains achieved by other ensemble strategies). We further performed experiments and include the results in Table 11 (for a fair comparison, we use 40 sets of prompts, or 40 prompt permutations to compare with self-consistency with 40 paths, all experiments are based on PaLM540B).
|
| 342 |
+
|
| 343 |
+
<table><tr><td></td><td>GSM8K accuracy</td></tr><tr><td>Different sets of prompts (x40)</td><td>58.9</td></tr><tr><td>Prompt-permutation (x40)</td><td>59.6</td></tr><tr><td>Self-consistency (x40)</td><td>74.4</td></tr><tr><td>Self-consistency +different sets of prompts (x40)</td><td>75.4</td></tr><tr><td>Self-consistency + prompt-permutation (x40)</td><td>73.8</td></tr></table>
|
| 344 |
+
|
| 345 |
+
Table 11: Combining self-consistency with other ensembling strategies.
|
| 346 |
+
|
| 347 |
+
# A.2 DETAILS ON RESOURCES AND INFERENCE
|
| 348 |
+
|
| 349 |
+
For all four language models we perform prompting-based inference only. For UL2 we use TPU v3 $2 \mathrm { x } 2$ configuration, 4 chips, 8 cores). For GPT-3 models the experiments are done though the public API.10 For LaMDA-137B we use TPU v3 (8x8 configuration, 64 chips, 128 cores). For PaLM-540B we use TPU v4 (4x4x12 configuration, 192 chips, 384 cores). Most inference jobs take 1 to 4 hours (over about 1,000 examples) for each task on UL2 and LaMDA-137B, and about 2 to 12 hours on PaLM-540B. Some tasks (e.g., commonsense reasoning) take longer but do not exceed 2 days for each task.
|
| 350 |
+
|
| 351 |
+
For GPT-3 models, we use $1 2 8 \mathrm { m a x }$ tokens for all methods, without frequency penalty or presence penalty. For all models, we take the generated outputs until the start of the next $\ " \mathrm { Q } : \ " $ to parse the final answers, consistent with our prompting format.
|
| 352 |
+
|
| 353 |
+
Table 12: Additional examples where self-consistency helps repair the errors over greedy decode on LaMDA-137B. Two sampled reasoning paths that are consistent with the ground truth are shown.
|
| 354 |
+
|
| 355 |
+
<table><tr><td rowspan=1 colspan=1>Question</td><td rowspan=1 colspan=1>Greedy Decode</td><td rowspan=1 colspan=1>Sampled Path 1</td><td rowspan=1 colspan=1>Sampled Path 2</td></tr><tr><td rowspan=1 colspan=1>[MultiArith] Sam had 10 socks.If he threw away3 old onesthatdidn't fitandbought 36newones,how many socks would hehave?</td><td rowspan=1 colspan=1>Sam had 1O socks.He threwaway 3 old ones that didn't fit.He bought 36 new ones.Thatmeans he has 10+36-3=41socks. The answer is 41.</td><td rowspan=1 colspan=1>Sam had 10 socks.Hethrew away 3old ones.Sonow he has 7 left. Then hebought 36 new ones.Sonow he has 7 + 36 = 43socks. The answer is 43.</td><td rowspan=1 colspan=1>He had 1O socks.He threw away3 old ones that didn't ft.Hebought 36 new ones.So in totalhe has 10-3+36=43 socks.Theanswer is 43.</td></tr><tr><td rowspan=1 colspan=1>[SVAMP] In a school there are697 girls and the rest are boys.If thereare 228 moregirls thanboys.How many boys are therein that school?</td><td rowspan=1 colspan=1>There are 697 girls and the restare boys.That means there are697+ 228 = 925 girls. Therest are boys.So the number ofboys is 925-697 = 228. Theanswer is 228.</td><td rowspan=1 colspan=1>The number of boys is thedifference between 697and 228.This is 697 - 228= 469.The answer is 469.</td><td rowspan=1 colspan=1>In the beginning there are 697girls and the rest are boys.So,thenumber of boys must be 697 - 228= 469 boys. The answer is 469.</td></tr><tr><td rowspan=1 colspan=1>[AQuA] There arelO oranges ina basket.Find the no.of ways inwhich2 oranges are chosen fromthe basket?(a)45 (b) 90 (c)120(d) 150 (e) 180</td><td rowspan=1 colspan=1>There are 1O oranges in a bas-ket.So there are 10 waysin which 2 oranges are chosenfrom the basket.</td><td rowspan=1 colspan=1>There are 1O oranges in abasket.We need to choose2 oranges from the basket.So the number of ways are10C2.So the answer is (a).</td><td rowspan=1 colspan=1>There are 1O oranges in the bas-ket.If you choose 2 oranges,youhave 10C2=45 ways of choosing2 oranges. So the answer is (a).</td></tr><tr><td rowspan=1 colspan=1>[CommonsenseQA] The manlaidon thesoft mossand lookedup at the trees,where was theman?(a) niagra falls (b) forest(c) waterfall (d) ground (e) tree</td><td rowspan=1 colspan=1>The answer must be somethingthat is soft and mossy. Of theabove choices,only ground issoft and mossy. So the answeris (d).</td><td rowspan=1 colspan=1>Theanswermustbesomewhere where mossis found.Of the abovechoices,only forests areknown for having moss.So the answer is (b).</td><td rowspan=1 colspan=1>The answer must be a place wherethe man is laying down and look-ing up at trees.Of the abovechoices,only forest isaplacewhere people lay down and lookat trees. So the answer is (b).</td></tr><tr><td rowspan=1 colspan=1>[ARC] Which of thesewill mostlikely harm a habitat?(a) plant-ing trees. (b) water pollution. (c)rainfall. (d) sunlight.</td><td rowspan=1 colspan=1>Planting trees will not harm ahabitat. So the answer is (a).</td><td rowspan=1 colspan=1>The answer is (b),waterpollution,because it willmost likely harm the habi-tat. The other answers arenot likely to harm the habi-tat.</td><td rowspan=1 colspan=1>The answeris (b), water pollution.Treesare good fora habitat, rain-fall is necessary for a habitat,andsunlight is necessary fora habitat.So the answer is (b).</td></tr><tr><td rowspan=1 colspan=1>[ARC-challenge] Which pro-cessin thecarbon cycle takes thelongest to complete? (a) emis-sion of waste.(b) respiration inanimals.(c) photosynthesis inplants.(d) formation of fossil fu-els.</td><td rowspan=1 colspan=1>The process of photosynthesisin plants takes the longest tocomplete. So the answer is (c).</td><td rowspan=1 colspan=1>The formation of fossil fu- els takes the longest timeto complete.So the an-swer is (d).</td><td rowspan=1 colspan=1>The process that takes the longesttime to complete is the forma-tion of fossil fuels,which hap-pens over millions of years. Sothe answer is (d).</td></tr></table>
|
| 356 |
+
|
| 357 |
+
Table 13: Additional examples where self-consistency helps repair the errors over greedy decode on PaLM-540B. Two sampled reasoning paths that are consistent with the ground truth are shown.
|
| 358 |
+
|
| 359 |
+
<table><tr><td rowspan=1 colspan=1>Question</td><td rowspan=1 colspan=1>Greedy Decode</td><td rowspan=1 colspan=1>Sampled Path 1</td><td rowspan=1 colspan=1>Sampled Path 2</td></tr><tr><td rowspan=1 colspan=1>[GSM8K] Kyle bought lastyear's best-selling book for$19.50. This is with a 25% dis-count from the original price.What was the original price ofthebook?</td><td rowspan=1 colspan=1>The book was sold for $19.50.This is 25% less than the origi-nal price.This means the originalprice was 100%. 25% of100%is 25%.So the original pricewas 100%- 25%= 75%.Theoriginal price was 75% of $19.50.75% of $19.50 is 75% * $19.50 =$14.625. The answer is $14.625.</td><td rowspan=1 colspan=1>The original price of the bookis $19.50.Since it was dis-counted by 25%,the originalprice was 19.50 / 0.75 = 26.The answer is 26.</td><td rowspan=1 colspan=1>Kyle bought a book that is soldfor $19.50.With a 25% discount,the original price must be higher.If we call the original price X,then the discounted price is 0.75x.Since this is $19.50,we can write0.75x = 19.50. Solving this,wefind that the original price is X =19.50 /0.75 = $26. The answer is$26.</td></tr><tr><td rowspan=1 colspan=1>[AQuA] The capacity of atank of dimensions (8 m x 6m x 2.5 m) is (a) 120 litres (b)1200 litres (c) 12000 litres (d)120000 litres (e) None of these</td><td rowspan=1 colspan=1>The volume of the tank is 8 m *6 m *2.5 m=120 m.So thecapacity of the tank is 120 m.Sothe answer is (c).</td><td rowspan=1 colspan=1>The volume of the tank is 8m* 6m* 2.5m=120m.This isequal to 120000 litres. So theanswer is (d)</td><td rowspan=1 colspan=1>The volume of the tank is 8 m *6m * 2.5 m=120 m3.One cu-bic meter contains 1Ooo litres,sothe tank contains 120 m3 *1000liters/m3 = 120,000 liters.So theanswer is (d).</td></tr><tr><td rowspan=1 colspan=1>[StrategyQA] Yesorno:Can the Great Depression betreated with Prozac?</td><td rowspan=1 colspan=1>The Great Depression was aneconomic depression.Prozac isa drug used to treat depression.Thus, the Great Depression couldbe treated with Prozac. So the an-swer is yes.</td><td rowspan=1 colspan=1>Prozac is an anti-depressantmedication. The Great Depres-sion is not a disease.Thus,Prozac cannot treat the GreatDepression. So the answer isno.</td><td rowspan=1 colspan=1>The Great Depression is a time pe-riod.Prozac is used to treat de-pression (the mental illness). Thus,the Great Depression can not betreated with Prozac.So the answeris no.</td></tr><tr><td rowspan=1 colspan=1>[ARC-easy] Which source ofenergy is nonrenewable? (a)coal.(b) sunlight.(c) water.(d) wood.</td><td rowspan=1 colspan=1>Coal,sunlight,and water areall renewable sources of energy.Wood is a nonrenewable source ofenergy.So the answer is (d).</td><td rowspan=1 colspan=1>A nonrenewable source of en-ergy is one in which the sourceis not replenished in a shortamount of time.Thus, the onlyoption that is nonrenewable iscoal. So the answer is (a).</td><td rowspan=1 colspan=1>Coal is a fossil fuel and is formedfrom dead organisms from the past.Coal cannot be produced in a shortperiod of time,so it is considereda nonrenewable source of energy.So the answer is (a).</td></tr><tr><td rowspan=1 colspan=1>[ARC-challenge] Studentsstudiedthe revolutionofEartharound the Sun.Duringwhichmonth willFlorida have themost sunlight energy avail-able?(a)March.(b)June.(c)September.(d) December.</td><td rowspan=1 colspan=1>The Earth is closest to the Sunin December, hence Florida willhave the most sunlight energyavailable in December. So the an-swer is (d).</td><td rowspan=1 colspan=1>Earth is closest to the Sun onJune 21,the summer solstice.So the answer is (b).</td><td rowspan=1 colspan=1>Florida is closer to the sun duringJune,so it will have the most sun-light energy during that month. Sothe answer is (b).</td></tr></table>
|
| 360 |
+
|
| 361 |
+
# A.3 FULL SETS OF PROMPTS
|
| 362 |
+
|
| 363 |
+
We list the full details of the prompts used for two newly-introduced datasets, AQUA-RAT (Ling et al., 2017) and AI2 Reasoning Challenge (ARC) (Clark et al., 2018), where we manually composed the example chain-of-thought in this paper, in Table 14 and Table 15, respectively.
|
| 364 |
+
|
| 365 |
+
Table 14: Few-shot exemplars for AQUA-RAT.
|
| 366 |
+
|
| 367 |
+
<table><tr><td>Q: John found that the average of 15 numbers is 40.If 10 is added to each number then the mean of the numbers is? Answer Choices: (a) 50 (b) 45 (c) 65 (d) 78 (e) 64</td></tr><tr><td>A: If 10 is added to each number, then the mean of the numbers also increases by 10.So the new mean would be 5O. The answer is (a).</td></tr><tr><td>Q: If a/b=3/4 and 8a + 5b=22,then find the value of a. Answer Choices: (a) 1/2 (b)3/2 (c)5/2 (d) 4/2 (e) 7/2</td></tr><tr><td>A: If a/b=3/4,then b=4a/3.So 8a + 5(4a/3)=22.This simplifies to 8a +20a/3 =22,which means 44a/3=22. So a is equal to 3/2. The answer is (b).</td></tr><tr><td>Q: A person is traveling at 2O km/hr and reached his destinyin 2.5 hr then find the distance?Answer Choices:</td></tr><tr><td>(a) 53 km (b) 55 km (c) 52 km (d) 60 km (e) 50 km A: The distance that the person traveled would have been 20 km/hr *2.5 hrs = 50 km. The answer is (e).</td></tr><tr><td>Q: How many keystrokes are neded to type the numbers from 1 to 50o? Answer Choices: (a)1156 (b)1392 (c) 1480 (d) 1562 (e) 1788</td></tr><tr><td>A: There are 9one-digit numbers from1 to 9.There are 90 two-digit numbers from 10 to 99.There are 401 three-digit numbers from 100 to 500.9 + 90(2) + 401(3)=1392.The answer is (b).</td></tr></table>
|
| 368 |
+
|
| 369 |
+
Q: George wants to warm his hands quickly by rubbing them. Which skin surface will produce the most heat? (a) dry palms. (b) wet palms. (c) palms covered with oil. (d) palms covered with lotion.
|
| 370 |
+
A: Dry surfaces will more likely cause more friction via rubbing than other smoother surfaces, hence dry palms will produce the most heat. The answer is (a).
|
| 371 |
+
Q: Which factor will most likely cause a person to develop a fever? (a) a leg muscle relaxing after exercise. (b) a bacterial population in the bloodstream. (c) several viral particles on the skin. (d) carbohydrates being digested in the stomach.
|
| 372 |
+
A: Option (b), bacterial population is the most likely cause for a person developing fever. The answer is (b). Q: Which change in the state of water particles causes the particles to become arranged in a fixed position? (a) boiling. (b) melting. (c) freezing. (d) evaporating.
|
| 373 |
+
A: When water is freezed, the particles are arranged in a fixed position; the particles are still moving for all other options. The answer is (c).
|
| 374 |
+
Q: When a switch is used in an electrical circuit, the switch can (a) cause the charge to build. (b) increase and decrease the voltage. (c) cause the current to change direction. (d) stop and start the flow of current. A: The function of a switch is to start and stop the flow of a current. The answer is (d).
|
| 375 |
+
|
| 376 |
+
Table 15: Few-shot exemplars for ARC easy/challenge.
|
| 377 |
+
Table 16: Few-shot exemplars for HotpotQA (closed-book setting).
|
| 378 |
+
|
| 379 |
+
<table><tr><td>Q: Which magazine was started first Arthur's Magazine or First for Women?</td></tr><tr><td>A: Arthur's Magazine started in 1844. First for Women started in 1989.So Arthur's Magazine was started first. The answer is Arthur's Magazine.</td></tr><tr><td>Q: The Oberoi family is part of a hotel company that has a head office in what city?</td></tr><tr><td>A: The Oberoi family is part of the hotel company called The Oberoi Group.The Oberoi Group has its head office in Delhi.The answeris Delhi.</td></tr><tr><td>Q: What nationality was James Henry Miller's wife?</td></tr><tr><td>A: James Henry Miller's wife is June Miller. June Miller is an American.The answer is American.</td></tr><tr><td>Q: The Dutch-Belgian television series that "House of Anubis" was based on first aired in what year?</td></tr><tr><td>A: "House of Anubis"is basedon the Dutch-Belgian television series Het Huis Anubis.Het Huis Anubis is first</td></tr></table>
|
| 380 |
+
|
| 381 |
+
As additional information, we also list the exact set of prompts used for all arithmetic reasoning tasks in Table 17, since there are multiple sets of prompts introduced in Wei et al. (2022). The prompts for CommonsenseQA and StrategyQA are the same as used in Wei et al. (2022).
|
| 382 |
+
|
| 383 |
+
We provide the exact prompts used for common NLP tasks in the following tables as well, including NLI (Table 18, Table 19, Table 20) and Closed-Book Question-Answering tasks (Table 16, Table 21).
|
| 384 |
+
|
| 385 |
+
Q: There are 15 trees in the grove. Grove workers will plant trees in the grove today. After they are done, there will be 21 trees. How many trees did the grove workers plant today?
|
| 386 |
+
A: We start with 15 trees. Later we have 21 trees. The difference must be the number of trees they planted. So, they must have planted $2 1 - 1 5 = 6$ trees. The answer is 6.
|
| 387 |
+
Q: If there are 3 cars in the parking lot and 2 more cars arrive, how many cars are in the parking lot? A: There are 3 cars in the parking lot already. 2 more arrive. Now there are $3 + 2 = 5$ cars. The answer is 5. Q: Leah had 32 chocolates and her sister had 42. If they ate 35, how many pieces do they have left in total? A: Leah had 32 chocolates and Leah’s sister had 42. That means there were originally $3 2 + 4 2 = 7 4$ chocolates. 35 have been eaten. So in total they still have $7 4 - 3 5 = 3 9$ chocolates. The answer is 39. Q: Jason had 20 lollipops. He gave Denny some lollipops. Now Jason has 12 lollipops. How many lollipops did Jason give to Denny?
|
| 388 |
+
A: Jason had 20 lollipops. Since he only has 12 now, he must have given the rest to Denny. The number of lollipops he has given to Denny must have been $2 0 - 1 2 = 8 $ lollipops. The answer is 8.
|
| 389 |
+
Q: Shawn has five toys. For Christmas, he got two toys each from his mom and dad. How many toys does he have now?
|
| 390 |
+
A: He has 5 toys. He got 2 from mom, so after that he has $5 + 2 = 7$ toys. Then he got 2 more from dad, so in total he has $7 + 2 = 9$ toys. The answer is 9.
|
| 391 |
+
Q: There were nine computers in the server room. Five more computers were installed each day, from monday to thursday. How many computers are now in the server room?
|
| 392 |
+
A: There are 4 days from monday to thursday. 5 computers were added each day. That means in total $4 ^ { * } 5 =$ 20 computers were added. There were 9 computers in the beginning, so now there are $9 + 2 0 = 2 9$ computers. The answer is 29.
|
| 393 |
+
Q: Michael had 58 golf balls. On tuesday, he lost 23 golf balls. On wednesday, he lost 2 more. How many golf balls did he have at the end of wednesday?
|
| 394 |
+
A: Michael initially had 58 balls. He lost 23 on Tuesday, so after that he has $5 8 - 2 3 = 3 5$ balls. On Wednesday he lost 2 more so now he has $3 5 - 2 = 3 3$ balls. The answer is 33.
|
| 395 |
+
Q: Olivia has $\$ 23$ . She bought five bagels for $\$ 3$ each. How much money does she have left?
|
| 396 |
+
A: She bought 5 bagels for $\$ 3$ each. This means she spent $5 * \ S 3 = \ S 1 5$ on the bagels. She had $\$ 23$ in beginning, so now she has $\$ 23-\$ 15=58$ . The answer is 8.
|
| 397 |
+
|
| 398 |
+
Premise:
|
| 399 |
+
|
| 400 |
+
"Conceptually cream skimming has two basic dimensions - product and geography."
|
| 401 |
+
|
| 402 |
+
Based on this premise, can we conclude the hypothesis "Product and geography are what make cream skimming work." is true?
|
| 403 |
+
|
| 404 |
+
OPTIONS:
|
| 405 |
+
- yes
|
| 406 |
+
- no
|
| 407 |
+
- it is not possible to tell
|
| 408 |
+
|
| 409 |
+
A: Based on "cream skimming has two basic dimensions" we can’t infer that these two dimensions are what make cream skimming work. The answer is it is not possible to tell.
|
| 410 |
+
|
| 411 |
+
Premise:
|
| 412 |
+
"One of our member will carry out your instructions minutely."
|
| 413 |
+
Based on this premise, can we conclude the hypothesis "A member of my team will execute your orders with
|
| 414 |
+
immense precision." is true?
|
| 415 |
+
OPTIONS:
|
| 416 |
+
- yes
|
| 417 |
+
- no
|
| 418 |
+
- it is not possible to tell
|
| 419 |
+
|
| 420 |
+
A: "one of" means the same as "a member of", "carry out" means the same as "execute", and "minutely" means the same as "immense precision". The answer is yes.
|
| 421 |
+
|
| 422 |
+
Premise:
|
| 423 |
+
"Fun for adults and children."
|
| 424 |
+
Based on this premise, can we conclude the hypothesis "Fun for only children." is true?
|
| 425 |
+
OPTIONS:
|
| 426 |
+
- yes
|
| 427 |
+
- no
|
| 428 |
+
- it is not possible to tell
|
| 429 |
+
|
| 430 |
+
A: "adults and children" contradicts "only children". The answer is no.
|
| 431 |
+
|
| 432 |
+
Premise:
|
| 433 |
+
"He turned and smiled at Vrenna."
|
| 434 |
+
Based on this premise, can we conclude the hypothesis "He smiled at Vrenna who was walking slowly behind
|
| 435 |
+
him with her mother." is true?
|
| 436 |
+
OPTIONS:
|
| 437 |
+
- yes
|
| 438 |
+
- no
|
| 439 |
+
- it is not possible to tell
|
| 440 |
+
|
| 441 |
+
A: the premise does not say anything about "Vrenna was walking". The answer is it is not possible to tell.
|
| 442 |
+
|
| 443 |
+
Premise:
|
| 444 |
+
"well you see that on television also"
|
| 445 |
+
Based on this premise, can we conclude the hypothesis "You can see that on television, as well." is true?
|
| 446 |
+
OPTIONS:
|
| 447 |
+
- yes
|
| 448 |
+
- no
|
| 449 |
+
- it is not possible to tell
|
| 450 |
+
|
| 451 |
+
A: "also" and "as well" mean the same thing. The answer is yes.
|
| 452 |
+
|
| 453 |
+
OPTIONS:
|
| 454 |
+
- yes
|
| 455 |
+
- no
|
| 456 |
+
- it is not possible to tell
|
| 457 |
+
|
| 458 |
+
A: "Vrenna and I both" contradicts "neither Vrenna nor myself". The answer is no.
|
| 459 |
+
|
| 460 |
+
Premise:
|
| 461 |
+
"A person on a horse jumps over a broken down airplane."
|
| 462 |
+
Based on this premise, can we conclude the hypothesis "A person is training his horse for a competition." is true? OPTIONS:
|
| 463 |
+
- yes
|
| 464 |
+
- no
|
| 465 |
+
- it is not possible to tell
|
| 466 |
+
A: The person is not necessarily training his horse. The answer is it is not possible to tell. Premise:
|
| 467 |
+
"A person on a horse jumps over a broken down airplane."
|
| 468 |
+
Based on this premise, can we conclude the hypothesis "A person is at a diner, ordering an omelette." is true? OPTIONS:
|
| 469 |
+
- yes
|
| 470 |
+
- no
|
| 471 |
+
- it is not possible to tell
|
| 472 |
+
A: One jumping horse cannot be in a diner ordering food. The answer is no. Premise:
|
| 473 |
+
"A person on a horse jumps over a broken down airplane."
|
| 474 |
+
Based on this premise, can we conclude the hypothesis "A person is outdoors, on a horse." is true? OPTIONS:
|
| 475 |
+
- yes
|
| 476 |
+
- no
|
| 477 |
+
- it is not possible to tell
|
| 478 |
+
A: A broken down airplane is outdoors. The answer is yes. Premise:
|
| 479 |
+
"Children smiling and waving at camera."
|
| 480 |
+
Based on this premise, can we conclude the hypothesis "They are smiling at their parents." is true?
|
| 481 |
+
OPTIONS:
|
| 482 |
+
- yes
|
| 483 |
+
- no
|
| 484 |
+
- it is not possible to tell
|
| 485 |
+
A: Just because they are smiling and waving at a camera does not imply their parents or anyone is anyone behind it. The answer is it is not possible to tell.
|
| 486 |
+
Premise:
|
| 487 |
+
"Children smiling and waving at camera."
|
| 488 |
+
Based on this premise, can we conclude the hypothesis "The kids are frowning." is true? OPTIONS:
|
| 489 |
+
- yes
|
| 490 |
+
- no
|
| 491 |
+
- it is not possible to tell
|
| 492 |
+
|
| 493 |
+
A: One cannot be smiling and frowning at the same time. The answer is no.
|
| 494 |
+
|
| 495 |
+
Premise:
|
| 496 |
+
"Children smiling and waving at camera."
|
| 497 |
+
Based on this premise, can we conclude the hypothesis "There are children present." is true? OPTIONS:
|
| 498 |
+
- yes
|
| 499 |
+
- no
|
| 500 |
+
- it is not possible to tell
|
| 501 |
+
A:The children must be present to see them smiling and waving. The answer is yes.
|
| 502 |
+
|
| 503 |
+
Premise:
|
| 504 |
+
|
| 505 |
+
"No Weapons of Mass Destruction Found in Iraq Yet."
|
| 506 |
+
|
| 507 |
+
Based on this premise, can we conclude the hypothesis "Weapons of Mass Destruction Found in Iraq." is true?
|
| 508 |
+
|
| 509 |
+
A: "No Weapons of Mass Destruction Found" contradicts "Weapons of Mass Destruction Found". The answer is no.
|
| 510 |
+
|
| 511 |
+
Premise:
|
| 512 |
+
|
| 513 |
+
"A place of sorrow, after Pope John Paul II died, became a place of celebration, as Roman Catholic faithful gathered in downtown Chicago to mark the installation of new Pope Benedict XVI."
|
| 514 |
+
|
| 515 |
+
Based on this premise, can we conclude the hypothesis "Pope Benedict XVI is the new leader of the Roman Catholic Church." is true?’
|
| 516 |
+
|
| 517 |
+
A: "installation of new Pope Benedict XVI." means "Pope Benedict XVI is the new leader". The answer is yes.
|
| 518 |
+
|
| 519 |
+
Premise:
|
| 520 |
+
|
| 521 |
+
"A man is due in court later charged with the murder 26 years ago of a teenager whose case was the first to be featured on BBC One’s Crimewatch. Colette Aram, 16, was walking to her boyfriend’s house in Keyworth, Nottinghamshire, on 30 October 1983 when she disappeared. Her body was later found in a field close to her home. Paul Stewart Hutchinson, 50, has been charged with murder and is due before Nottingham magistrates later."
|
| 522 |
+
|
| 523 |
+
Based on this premise, can we conclude the hypothesis "Paul Stewart Hutchinson is accused of having stabbed a girl." is true?
|
| 524 |
+
|
| 525 |
+
A: The premise does not say Paul Stewart Hutchinson "stabbed" this girl. The answer is no.
|
| 526 |
+
|
| 527 |
+
Premise:
|
| 528 |
+
|
| 529 |
+
"Herceptin was already approved to treat the sickest breast cancer patients, and the company said, Monday, it will discuss with federal regulators the possibility of prescribing the drug for more breast cancer patients." Based on this premise, can we conclude the hypothesis "Herceptin can be used to treat breast cancer." is true?
|
| 530 |
+
|
| 531 |
+
A: "Herceptin was approved to treat breast cancer" implies that "Herceptin can be used to treat breast cancer".
|
| 532 |
+
The answer is yes.
|
| 533 |
+
|
| 534 |
+
Q: does system of a down have 2 singers?
|
| 535 |
+
|
| 536 |
+
A: System of a Down currently consists of Serj Tankian, Daron Malakian, Shavo Odadjian and John Dolmayan.
|
| 537 |
+
Serj and Daron do vocals, so the band does have two singers. The answer is yes.
|
| 538 |
+
|
| 539 |
+
Q: do iran and afghanistan speak the same language?
|
| 540 |
+
|
| 541 |
+
A: Iran and Afghanistan both speak the Indo-European language Persian. The answer is yes.
|
| 542 |
+
|
| 543 |
+
Q: is a cello and a bass the same thing?
|
| 544 |
+
|
| 545 |
+
A: The cello is played sitting down with the instrument between the knees, whereas the double bass is played standing or sitting on a stool. The answer is no.
|
| 546 |
+
|
| 547 |
+
Q: can you use oyster card at epsom station?
|
| 548 |
+
|
| 549 |
+
A: Epsom railway station serves the town of Epsom in Surrey and is not in the London Oyster card zone. The answer is no.
|
md/dev/6UtOXn1LwNE/6UtOXn1LwNE.md
ADDED
|
@@ -0,0 +1,422 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Models of human preference for learning reward functions
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 The utility of reinforcement learning is limited by the alignment of reward functions
|
| 11 |
+
2 with the interests of human stakeholders. One promising method for alignment is
|
| 12 |
+
3 to learn the reward function from human-generated preferences between pairs of
|
| 13 |
+
4 trajectory segments. These human preferences are typically assumed to be informed
|
| 14 |
+
5 solely by partial return, the sum of rewards along each segment. We find this
|
| 15 |
+
6 assumption to be flawed and propose modeling preferences instead as arising from
|
| 16 |
+
7 a different statistic: each segment’s regret, a measure of a segment’s deviation from
|
| 17 |
+
8 optimal decision-making. Given infinitely many preferences generated according
|
| 18 |
+
9 to regret, we prove that we can identify a reward function equivalent to the reward
|
| 19 |
+
10 function that generated those preferences. We also prove that the previous partial
|
| 20 |
+
11 return model lacks this identifiability property without preference noise that reveals
|
| 21 |
+
12 rewards’ relative proportions, and we empirically show that our proposed regret
|
| 22 |
+
13 preference model outperforms it with finite training data in otherwise the same
|
| 23 |
+
14 setting. Additionally, our proposed regret preference model better predicts real
|
| 24 |
+
15 human preferences and also learns reward functions from these preferences that
|
| 25 |
+
16 lead to policies that are better human-aligned. Overall, this work establishes that
|
| 26 |
+
17 the choice of preference model is impactful, and our proposed regret preference
|
| 27 |
+
18 model provides an improvement upon a core assumption of recent research.
|
| 28 |
+
|
| 29 |
+
# 19 1 Introduction
|
| 30 |
+
|
| 31 |
+
20 Improvements in reinforcement learning (RL) have led to notable recent achievements [1–6],
|
| 32 |
+
21 increasing its applicability to real-world problems. Yet, like all optimization algorithms, even perfect
|
| 33 |
+
22 RL optimization is limited by the objective it optimizes. For RL, this objective is created in large
|
| 34 |
+
23 part by the reward function. Poor alignment between reward functions and the interests of human
|
| 35 |
+
24 stakeholders limits the utility of RL and may even pose catastrophic risks [7, 8].
|
| 36 |
+
25 Influential recent research has focused on reward learning from preferences over pairs of fixed-length
|
| 37 |
+
26 trajectory segments. Nearly all of this recent work assumes that human preferences arise probabilis
|
| 38 |
+
27 tically from only the sum of rewards over a segment, i.e., the segment’s partial return [9–16]. That is,
|
| 39 |
+
28 these works assume that people tend to prefer trajectory segments that yield greater rewards during the
|
| 40 |
+
29 segment. However, this preference model ignores seemingly important information about the segment’s
|
| 41 |
+
30 desirability, including the state values of the segment’s start and end states. Separately, this partial return
|
| 42 |
+
31 preference model can prefer suboptimal actions with lucky outcomes, like buying a lottery ticket.
|
| 43 |
+
32 This paper proposes an alternative preference model based on the regret of each segment, which is equiv
|
| 44 |
+
33 alent to the negated sum of an optimal policy’s advantage of each transition in the segment (Section $\left. \overline { { 2 . 2 } } \right)$ .
|
| 45 |
+
34 Figure 1 shows an intuitive example of when these two models disagree. Other classes of domains that
|
| 46 |
+
35 the models will differ on are those with constant reward until the end, including competitive games like
|
| 47 |
+
36 chess, go, and soccer as well as tasks for which the objective is to minimize time until reaching a goal.
|
| 48 |
+
37 For these two preference models, we first focus the
|
| 49 |
+
38 oretically on a normative analysis (Section 3)— i.e.,
|
| 50 |
+
39 what preference model would we want humans
|
| 51 |
+
40 to use if we could choose—proving that reward
|
| 52 |
+
41 learning on infinite, exhaustive preferences with
|
| 53 |
+
42 our proposed regret preference model identifies a
|
| 54 |
+
43 reward function with the same set of optimal poli
|
| 55 |
+
44 cies as the reward function with which the prefer
|
| 56 |
+
45 ences are generated. We also prove that the par
|
| 57 |
+
46 tial return preference model is not guaranteed to
|
| 58 |
+
47 identify such a reward function without preference
|
| 59 |
+
48 noise. We follow up with a descriptive analysis of
|
| 60 |
+
49 how well each of these proposed models align with
|
| 61 |
+
50 actual human preferences by collecting a human
|
| 62 |
+
51 labeled dataset of preferences in a rich grid world
|
| 63 |
+
52 domain (Section 4) and showing that the regret pref
|
| 64 |
+
53 erence model better predicts these human prefer
|
| 65 |
+
54 ences (Section 5). Finally, we find that the policies
|
| 66 |
+
55 ultimately created through the regret preference
|
| 67 |
+
56 model tend to outperform those from the partial
|
| 68 |
+
57 return model learning—both when assessed with
|
| 69 |
+
58 collected human preferences or when assessed with
|
| 70 |
+
59 synthetic preferences (Section 6)
|
| 71 |
+
|
| 72 |
+

|
| 73 |
+
Figure 1: Two segments of a car moving at high speed near a brick wall. Assume the right segment is optimal and the left segment is suboptimal (as defined in Sec. 2.1). The left segment has a higher sum of reward, so the partial return preference model tends to prefer it. The regret preference model instead tends to prefer the right segment because optimal segments have minimal regret. If we also assume deterministic transitions, then the regret model includes the difference in values between the start state and the end state (Eq. 3), and the right segment would tend to be preferred because it greatly improves its state values from start to end, whereas the left segment’s state values greatly worsen. We suspect our human readers will also tend to prefer the right segment.
|
| 74 |
+
|
| 75 |
+
# 60 2 Preference models for learning reward functions
|
| 76 |
+
|
| 77 |
+
61 We assume that the task environment is a Markov decision process (MDP) specified by the tuple $( S , A ,$
|
| 78 |
+
62 $T , \gamma , D _ { 0 } , r )$ . $S$ and $A$ are the sets of possible states and actions, respectively. $T$ is a transition function,
|
| 79 |
+
63 $T : S \times A \to S$ . $\gamma$ is the discount factor and $D _ { 0 }$ is the distribution of start states. Unless otherwise
|
| 80 |
+
64 stated, we assume undiscounted tasks (i.e., $\gamma = 1$ ) that have terminal states, after which only 0 reward
|
| 81 |
+
65 can be received. $r$ is a reward function, $r : S \times A \times S \mathbb { R }$ , where the reward $r _ { t }$ at time $t$ is a function of
|
| 82 |
+
66 $s _ { t } , a _ { t }$ , and $s _ { t + 1 }$ . An $\mathsf { M D P } \backslash r$ is an MDP without a reward function.
|
| 83 |
+
67 Throughout this paper, $r$ refers to the ground-truth reward function for some MDP; $\hat { r }$ refers to a learned
|
| 84 |
+
68 approximation of $r$ ; and $\tilde { r }$ refers to any reward function (including $r$ or $\hat { r }$ ). A policy $( \pi : S \times A \to [ 0 , 1 ] )$ )
|
| 85 |
+
69 specifies the probability of an action given a state. $Q _ { \tilde { r } } ^ { * }$ and $V _ { \tilde { r } } ^ { * }$ refer respectively to the state-action value
|
| 86 |
+
70 function and state value function for an optimal policy, $\pi ^ { * }$ , under $\tilde { r }$ . The optimal advantage function is
|
| 87 |
+
71 defined as $A _ { \tilde { r } } ^ { \ast } ( s , a ) \triangleq Q _ { \tilde { r } } ^ { \ast } ( s , a ) - V _ { \tilde { r } } ^ { \ast } ( s )$ . Throughout this paper, the ground-truth reward function $r$
|
| 88 |
+
72 is used to algorithmically generate preferences when they are not human-generated, is hidden during
|
| 89 |
+
73 reward learning, and is used to evaluate the performance of optimal policies under a learned $\hat { r }$ .
|
| 90 |
+
|
| 91 |
+
# 74 2.1 Reward learning from pairwise preferences
|
| 92 |
+
|
| 93 |
+
5 A reward function can be learned by minimizing the cross-entropy loss—i.e., maximizing the
|
| 94 |
+
6 likelihood—of observed human preferences, a common approach in recent literature [9–11, 14, 16].
|
| 95 |
+
77 Segments Let $\sigma$ denote a segment starting at state $s _ { \sigma , 0 }$ . Its length $| \sigma |$ is the number of transitions within
|
| 96 |
+
78 the segment. A segment includes $| \sigma | + 1$ states and $| \sigma |$ actions: $( s _ { \sigma , 0 } , a _ { \sigma , 0 } , s _ { \sigma , 1 } , a _ { \sigma , 1 } , . . . , s _ { \sigma , | \sigma | } )$ . In this
|
| 97 |
+
79 problem setting, segments lack any reward information. As shorthand, we define $\sigma _ { t } \triangleq \left( s _ { \sigma , t } , a _ { \sigma , t } , s _ { \sigma , t + 1 } \right)$ .
|
| 98 |
+
80 A segment $\sigma$ is optimal with respect to $\tilde { r }$ if, for every $i \in \{ 1 , . . . , | \sigma | { - 1 } \}$ , $Q _ { \tilde { r } } ^ { * } ( s _ { \sigma , i } , a _ { \sigma , i } ) = V _ { \tilde { r } } ^ { * } ( s _ { \sigma , i } )$ . A
|
| 99 |
+
81 segment that is not optimal is suboand the partial return of a segment 82 imis ome , de $\tilde { r }$ and a segment ted in shorthan $\sigma , \tilde { r } _ { t } \triangleq \tilde { r } \big ( s _ { \sigma , t } , a _ { \sigma , t } , s _ { \sigma , t + 1 } \big )$ ,
|
| 100 |
+
$\sigma$ $\scriptstyle \sum _ { t = 0 } ^ { | \sigma | - 1 } \gamma ^ { t } { \tilde { r } } _ { t }$ $\Sigma _ { \sigma } r$
|
| 101 |
+
83 Preference datasets Each preference over a pair of segments creates a sample $( \sigma _ { 1 } , \sigma _ { 2 } , \mu )$ in a
|
| 102 |
+
84 preference dataset $D _ { \succ }$ . Vector $\mu = \langle \mu _ { 1 } , \mu _ { 2 } \rangle$ represents the preference; specifically, if $\sigma _ { 1 }$ is preferred
|
| 103 |
+
85 over $\sigma _ { 2 }$ , denoted $\sigma _ { 1 } \succ \sigma _ { 2 }$ , $\mu = \langle 1 , 0 \rangle$ . $\mu$ is $^ { \langle 0 , 1 \rangle }$ if $\sigma _ { 1 } \prec \sigma _ { 2 }$ and is $\langle 0 . 5 , 0 . 5 \rangle$ for $\sigma _ { 1 } \sim \sigma _ { 2 }$ (no preference).
|
| 104 |
+
86 Loss function To learn a reward function from a preference dataset, $D _ { \succ }$ , a common assumption
|
| 105 |
+
87 is that these preferences were generated by a preference model $P$ that arises from an unobservable
|
| 106 |
+
88 ground-truth reward function $r$ . We approximate $r$ by minimizing cross-entropy loss to learn $\hat { r }$ :
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
\begin{array} { r l } { l o s s ( \hat { r } , D _ { \succ } ) { = } { - } { \sum _ { \alpha } { \mu _ { 1 } } { \log } P ( \sigma _ { 1 } \succ \sigma _ { 2 } | \hat { r } ) { + } \mu _ { 2 } { \log } P ( \sigma _ { 1 } { \prec } \sigma _ { 2 } | \hat { r } ) } } & { { } } \\ { ( \sigma _ { 1 } , \sigma _ { 2 } , \mu ) { \in } D _ { \succ } } & { { } } \end{array}
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+
89 This loss is under-specified until $P ( \sigma _ { 1 } \succ \sigma _ { 2 } | \hat { r } )$ is defined, which is the focus of this paper. We show that
|
| 113 |
+
90 the common model of preference probabilities is flawed and introduce an improved preference model.
|
| 114 |
+
|
| 115 |
+
Preference models A preference model determines the probability of one trajectory segment being 2 preferred over another, $P ( \sigma _ { 1 } \succ \sigma _ { 2 } | \tilde { r } )$ . Preference models could be applied to model preferences provided by humans or other systems. Preference models can also directly generate preferences, and in such cases we refer to them as preference generators.
|
| 116 |
+
|
| 117 |
+
# 2.2 Choice of preference model: partial return and regret
|
| 118 |
+
|
| 119 |
+
Partial return Recent work assumes human preferences are generated by a Boltzmann distribution over the two segments’ partial returns [9–16], expressed here as a logistic function1 :
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\begin{array} { r } { P _ { \Sigma _ { r } } ( \sigma _ { 1 } \succ \sigma _ { 2 } | \tilde { r } ) = l o g i s t i c \Big ( \Sigma _ { \sigma _ { 1 } } \tilde { r } - \Sigma _ { \sigma _ { 2 } } \tilde { r } \Big ) . } \end{array}
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
98 Regret We introduce an alternative preference model based on the regret of each transition in a
|
| 126 |
+
99 segment. We first focus on segments with deterministic transitions. For a transition $\left( { { s _ { t } } , { a _ { t } } , { s _ { t + 1 } } } \right)$ in a
|
| 127 |
+
100 deterministic segment, $r e g r e t _ { \mathrm { d } } ( \sigma _ { t } | \tilde { r } ) \stackrel { \Delta } { = } V _ { \tilde { r } } ^ { \ast } ( s _ { \sigma , t } ) - \left[ \tilde { r } _ { t } + V _ { \tilde { r } } ^ { \ast } ( s _ { \sigma , t + 1 } ) \right]$ . For a full deterministic segment,
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
r e g r e t _ { d } ( \sigma | \tilde { r } ) \triangleq \sum _ { t = 0 } ^ { | \sigma | - 1 } r e g r e t _ { d } ( \sigma _ { t } | \tilde { r } ) = V _ { \tilde { r } } ^ { * } ( s _ { \sigma , 0 } ) - \big ( \Sigma _ { \sigma } \tilde { r } + V _ { \tilde { r } } ^ { * } ( s _ { \sigma , | \sigma | } ) \big ) ,
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
102 with the right-hand expression arising from cancelling out intermediate state values. Therefore,
|
| 134 |
+
103 deterministic regret measures how much the segment reduces expected return from $V _ { \tilde { r } } ^ { * } ( s _ { \sigma , 0 } )$ . An
|
| 135 |
+
104 optimal segment, $\sigma ^ { * }$ , always has 0 regret, and a suboptimal segment, $\sigma ^ { \ast }$ , will always have positive
|
| 136 |
+
105 regret, a intuitively appealing property that also plays a role in the identifiability proof of Theorem 3.1.
|
| 137 |
+
106 Stochastic transitions, however, can result in $r e g r e t _ { d } ( \sigma ^ { * } | \hat { r } ) > r e g r e t _ { d } ( \sigma ^ { \neg * } | \tilde { r } )$ , losing the property
|
| 138 |
+
107 above. To retain it, we note that the effect on expected return of transition stochasticity from a
|
| 139 |
+
108 transition $\left( { { s _ { t } } , { a _ { t } } , { s _ { t + 1 } } } \right)$ is $\left[ \tilde { r } _ { t } + V _ { \tilde { r } } ^ { * } ( s _ { t + 1 } ) \right] - Q _ { \tilde { r } } ^ { * } ( s _ { t } , a _ { t } )$ and add this expression once per transition to
|
| 140 |
+
109 get regret $( \sigma )$ , removing the subscript $d$ that refers to determinism. The regret for a single transition
|
| 141 |
+
110 becomes $r e g r e t ( \sigma _ { t } | \tilde { r } ) = [ V _ { \tilde { r } } ^ { * } ( s _ { \sigma , t } ) - [ \tilde { r } _ { t } + V _ { \tilde { r } } ^ { * } ( s _ { \sigma , t + 1 } ) ] ] + [ [ \tilde { r } _ { t } + V _ { \tilde { r } } ^ { * } ( s _ { \sigma , t + 1 } ) ] - Q _ { \tilde { r } } ^ { * } ( s _ { \sigma , t } , a _ { \sigma , t } ) ] = 0 .$
|
| 142 |
+
111 $V _ { \tilde { r } } ^ { * } \left( s _ { \sigma , t } \right) - Q _ { \tilde { r } } ^ { * } \left( s _ { \sigma , t } , a _ { \sigma , t } \right) = - A _ { \tilde { r } } ^ { * } \left( s _ { \sigma , t } , a _ { \sigma , t } \right)$ . Regret for a full segment is
|
| 143 |
+
|
| 144 |
+
$$
|
| 145 |
+
r e g r e t ( \sigma | \tilde { r } ) = \sum _ { t = 0 } ^ { | \sigma | - 1 } r e g r e t ( \sigma _ { t } | \tilde { r } ) = \sum _ { t = 0 } ^ { | \sigma | - 1 } \left[ V _ { \tilde { r } } ^ { * } ( s _ { \sigma , t } ) - Q _ { \tilde { r } } ^ { * } ( s _ { \sigma , t } , a _ { \sigma , t } ) \right] = \sum _ { t = 0 } ^ { | \sigma | - 1 } - A _ { \tilde { r } } ^ { * } ( s _ { \sigma , t } , a _ { \sigma , t } ) .
|
| 146 |
+
$$
|
| 147 |
+
|
| 148 |
+
112 The regret preference model is the Boltzmann distribution over negated regret:
|
| 149 |
+
|
| 150 |
+
$$
|
| 151 |
+
P _ { r e g r e t } ( \sigma _ { 1 } \sim \sigma _ { 2 } | \tilde { r } ) \stackrel { \Delta } { = } l o g i s t i c \Bigl ( r e g r e t ( \sigma _ { 2 } | \tilde { r } ) - r e g r e t ( \sigma _ { 1 } | \tilde { r } ) \Bigr ) .
|
| 152 |
+
$$
|
| 153 |
+
|
| 154 |
+
113 Lastly, we note that if two segments have deterministic transitions, end in terminal states, and have the same starting state, this regret model reduces to the partial return model: 114 $P _ { r e g r e t } ( \cdot | \tilde { r } ) = P _ { \Sigma _ { r } } ( \cdot | \tilde { r } )$ .
|
| 155 |
+
|
| 156 |
+
115 Algorithms in this paper All algorithms in the body of this paper are defined simply as “minimize
|
| 157 |
+
116 Equation 1”. They differ only in how the preference probabilities are calculated. All reward function
|
| 158 |
+
117 learning via partial return uses Equation $2 .$ We use two algorithms for reward function learning
|
| 159 |
+
118 via regret. The theory in Section $3$ assumes exact measurement of regret, using Equation 5. Our
|
| 160 |
+
119 experimental results in Section 6 use Equation 6 to approximate regret. Appendix B introduces other
|
| 161 |
+
120 algorithms that use Equation 1, as well as one in Appendix $\overline { { \mathbf { B } . 2 } }$ that generalizes Equation 1.
|
| 162 |
+
|
| 163 |
+
Regret as a model for human preference $P _ { r e g r e t }$ makes at least three assumptions worth noting. First, it keeps the assumption that human preferences follow a Boltzmann distribution over some statistic, which is a common model of choice behavior in economics and psychology, where it is called the Luce-Shepard choice rule $\textcircled { 1 1 7 } , \textcircled { 1 8 } \textcircled { 1 }$ . Second, $P _ { r e g r e t }$ implicitly assumes humans can identify optimal and suboptimal segments when they see them, which will less true in domains where the human has less expertise. Lastly, $P _ { r e g r e t }$ assumes that in stochastic settings where the best outcome may only result from suboptimal decisions (e.g., buying a lottery ticket), humans instead prefer optimal decisions. We suspect humans are capable of expressing either type of preference—based on decision quality or desirability of outcomes—and can be influenced by training or the preference elicitation interface. In practice we determine that the regret model produces improvements over the partial-return model (Section 6), and its assumptions represent an opportunity for follow-up research.
|
| 164 |
+
|
| 165 |
+
Alternative methods for learning reward functions Other methods for learning reward functions include inverse reinforcement learning from demonstrations [19, 20] (discussed in Appendix B.5) and inverse reward design from trial-and-error reward design in multiple instances of a task domain [21].
|
| 166 |
+
|
| 167 |
+
# 3 Theoretical comparisons
|
| 168 |
+
|
| 169 |
+
In this section, we consider how different ways of generating preferences affect reward inference, setting aside whether humans can be influenced to give preferences in accordance with a specific preference method. In economic terms, this analysis—and all of our analyses with synthetic preferences—could be considered a normative analysis. In artificial intelligence, this analysis might be cast as a step towards defining criteria for a rational preference model.
|
| 170 |
+
|
| 171 |
+
Definition 3.1 (An identifiable preference model). For a preference model $P$ , assume an infinite dataset $D _ { \succ }$ of $\dot { n }$ -length pairs of segments is constructed by repeatedly choosing $\left( \sigma _ { 1 } , \sigma _ { 2 } \right)$ and sampling a label $\mu \sim P ( \sigma _ { 1 } \succ \sigma _ { 2 } | r )$ , using $P$ as a preference generator. Further assume that in this dataset, all possible $n$ -length segment pairs appear infinitely many times. For some $M D P \backslash r M$ , let $M _ { \tilde { r } }$ be $M$ with the reward function $\tilde { r }$ . Let $\Pi _ { \tilde { r } } ^ { * }$ be the set of optimal policies in $M _ { \tilde { r } }$ . Let reward-equivalence class R be the set of all reward functions such that if ${ \dot { r } } _ { 1 } , r _ { 2 } \in \Re$ then $\Pi _ { r _ { 1 } } ^ { * } = \Pi _ { r _ { 2 } } ^ { * }$ . Preference model $P$ is identifiable if, for any choice of $n$ and $M _ { r }$ , any $\hat { r } = a r g m i n _ { \tilde { r } , D _ { \sim } } [ l o s s ( \tilde { r } ) ] .$ —for the cross-entropy loss $( E q n . \bigtriangledown )$ with $P$ as the preference model—is in the same reward equivalence class as $r$ . I.e., $\Pi _ { r } ^ { * } { = } \Pi _ { \hat { r } } ^ { * }$ .
|
| 172 |
+
|
| 173 |
+
Theorem 3.1 $P _ { r e g r e t }$ is identifiable). Let $P _ { r e g r e t }$ be any function such that if regret $( \sigma _ { 1 } | \tilde { r } ) <$ regret $( \sigma _ { 2 } | \tilde { r } )$ , $P _ { r e g r e t } ( \sigma _ { 1 } \succ \sigma _ { 2 } | \tilde { r } ) > 0 . 5 $ , and if regret $( \sigma _ { 1 } | \tilde { r } ) = r e g r e t ( \sigma _ { 2 } | \tilde { r } )$ , $P _ { r e g r e t } ( \sigma _ { 1 } \succ \sigma _ { 2 } | \tilde { r } ) =$ 0.5. $P _ { r e g r e t }$ is identifiable.
|
| 174 |
+
|
| 175 |
+
This class of regret preference models includes but is not limited to the Boltzmann distribution of Eqn. 5 and the narrower class that Theorem $3 . 1$ focuses upon.
|
| 176 |
+
|
| 177 |
+
154 Theorem 3.2 (Noiseless $P _ { \Sigma _ { r } }$ is not identifiable). Let $P _ { \Sigma _ { r } }$ be any function such that if $\Sigma _ { \sigma _ { 1 } } \tilde { r } > \Sigma _ { \sigma _ { 2 } } \tilde { r }$ ,
|
| 178 |
+
155 $P _ { \Sigma _ { r } } ( \sigma _ { 1 } \succ \sigma _ { 2 } | \tilde { r } ) = 1 _ { \tilde { \mathbf { \Sigma } } }$ , and if $\Sigma _ { \sigma _ { 1 } } \tilde { r } { = } \Sigma _ { \sigma _ { 2 } } \tilde { r }$ , $P _ { \Sigma _ { r } } ( \sigma _ { 1 } \succ \sigma _ { 2 } | \tilde { r } ) = 0 . 5 .$ . There exists an MDP in which $P _ { \Sigma _ { r } }$ is
|
| 179 |
+
156 not identifiable.
|
| 180 |
+
157 Appendix $\mathbf { C }$ contains a proof of Theorem $\underline { { \boldsymbol { \left. 3 . 1 \right. } } }$ and two proofs by example for Theorem $\underline { { \boldsymbol { \mathfrak { B . 2 } } } } \flat$ each
|
| 181 |
+
158 focusing on a different weakness of $P _ { \Sigma _ { r } }$ .The first proof by example reveals issues when learning
|
| 182 |
+
159 reward functions with stochastic transitions with either $P _ { \Sigma _ { r } }$ or deterministic $P _ { r e g r e t _ { d } }$ . These issues
|
| 183 |
+
160 directly correspond to the need for preferences over distributions over outcomes (i.e., lotteries) to
|
| 184 |
+
161 construct a cardinal utility function (see Russell and Norvig $\mathbb { \left[ \left[ 2 2 \right] \right. }$ Ch. 16]). Note that the noiseless
|
| 185 |
+
162 version of $P _ { \Sigma _ { r } }$ in Theorem $\boxed { 3 . 2 }$ is achieved in the limit as reward values are scaled higher; equivalently,
|
| 186 |
+
163 one could include a Boltzmann temperature parameter in Equation 2 and scale it towards 0. Intuitively,
|
| 187 |
+
164 Theorem $3 . 2$ says that $P _ { \Sigma _ { r } }$ is not identifiable without the distribution over preferences providing
|
| 188 |
+
165 information about the proportions of rewards with respect to each other. In contrast, to be identifiable,
|
| 189 |
+
166 the regret preference model does not require this preference error (though it can presumably benefit
|
| 190 |
+
167 from it in certain contexts).
|
| 191 |
+
|
| 192 |
+
# 168 4 Creating a human-labeled preference dataset
|
| 193 |
+
|
| 194 |
+
9 To empirically investigate the consequences of each preference model when learning reward from 0 human preferences, we created a preference dataset labeled by human subjects via Amazon Mechanical Turk. This data collection was IRB-approved. Appendix D adds detail to the content below.
|
| 195 |
+
|
| 196 |
+
# 72 4.1 The general delivery domain
|
| 197 |
+
|
| 198 |
+
173 The delivery domain consists of a grid of cells, each of a specific road surface type. The delivery agent’s
|
| 199 |
+
174 state is its location. The agent’s action space is moving one cell in one of the four cardinal directions.
|
| 200 |
+
175 The episode can terminate either at the destination for $+ 5 0$ reward or in failure at a sheep for $- 5 0$
|
| 201 |
+
176 reward. The reward for a non-terminal transition is the sum of any reward components. Cells with a
|
| 202 |
+
177 white road surface have a $- 1$ reward component, and cells with brick surface have a $- 2$ component.
|
| 203 |
+
178 Additionally, each cell may contain a coin $( + 1 )$ or a roadblock $( - 1 )$ . Coins do not disappear and at
|
| 204 |
+
179 best cancel out the road surface cost. Actions that would move the agent into a house or beyond the
|
| 205 |
+
180 grid’s perimeter result in no motion and receive reward that includes the current cell’s surface reward
|
| 206 |
+
181 component but not any coin or roadblock components. In this work, the start state distribution, $D _ { 0 }$ , is
|
| 207 |
+
182 always uniformly random over non-terminal states. This domain was designed to permit subjects to
|
| 208 |
+
183 easily identify bad behavior yet also to be difficult for them to determine optimal behavior from most
|
| 209 |
+
184 states, which is representative of many common tasks.
|
| 210 |
+
|
| 211 |
+
# 4.1.1 The delivery task
|
| 212 |
+
|
| 213 |
+
We chose one instantiation of the delivery domain for gathering our dataset of human preferences. This specific MDP has a $1 0 \times 1 0$ grid. From every state, the highest return possible involves reaching the goal, rather than hitting a sheep or perpetually avoiding termination. Figure 2 shows this task.
|
| 214 |
+
|
| 215 |
+
# 4.2 The user interface and survey
|
| 216 |
+
|
| 217 |
+
This subsection describes the three main stages of the experimental session. A video showing the full experimental protocol can be seen at bit.ly/humanprefs.
|
| 218 |
+
|
| 219 |
+

|
| 220 |
+
Figure 2: The delivery task used to gather human preferences. The yellow van is the agent and the red inverted teardrop is the destination.
|
| 221 |
+
|
| 222 |
+
Teaching subjects about the task Subjects first view instructions describing the general domain. To avoid the jargon of “return” and “reward,” these terms are mapped to equivalent values in US dollars, and the instructions describe the goal of the task as maximizing the delivery vehicle’s financial outcome, where the reward components are specific financial impacts. This information is shared amongst interspersed interactive episodes, in which the subject controls the agent in domain maps that are each designed to teach one or two concepts. Our intention during this stage is to inform the later preferences of the subject by teaching them about the domain’s dynamics and its reward function, as well as to develop the subject’s sense of how desirable various behaviors are. At the end of this stage, the subject controls the agent for two episodes in the specific delivery task shown in Figure 2.
|
| 223 |
+
|
| 224 |
+
Preference elicitation After each subject is trained to understand the task, they indicate their preferences between 40–50 randomly-ordered pairs of segments, using the interface shown in Figure 3. The users select a preference, no preference (“same"), or “can’t tell”. In this work, we exclude responses labeled “can’t tell”, though one might alternatively try to extract information from these responses.
|
| 225 |
+
|
| 226 |
+
Users’ task comprehension Subjects then answered questions testing their understanding of the task, and we removed their data if they scored poorly. We also removed a subject’s data if they preferred colliding the vehicle into a sheep over not doing so, which we interpreted as poor task understanding or inattentiveness. This filtered dataset contains 1812 preferences from 50 subjects.
|
| 227 |
+
|
| 228 |
+
We collected human preferences in two stages, each with different methods for selecting which segment pairs to present for labeling. The second stage’s sole purpose was to improve the reward-learning performance of $P _ { \Sigma _ { r } }$ . Without second-stage data, $P _ { \Sigma _ { r } }$ compared even worse to $P _ { r e g r e t }$ than in the results described in Section $\boxed { 6 }$ (see Appendix ??). Both stages’
|
| 229 |
+
|
| 230 |
+

|
| 231 |
+
Figure 3: Interface shown to subjects during preference elicitation.
|
| 232 |
+
|
| 233 |
+
229 data are combined and used as a single dataset. These methods and their justification are described in
|
| 234 |
+
230 Appendix D.3.
|
| 235 |
+
|
| 236 |
+
# 5 Descriptive results
|
| 237 |
+
|
| 238 |
+
This section considers how well different preference models explain our dataset of human preferences.
|
| 239 |
+
|
| 240 |
+
# 5 5.1 Correlations between preferences and segment statistics
|
| 241 |
+
|
| 242 |
+
We hypothesize that the values of segments’ start and end states—which are included in $P _ { r e g r e t }$ but not in $P _ { \Sigma }$ —affect human preferences, independent of partial return. To simplify analysis, we combine the two parts of $r e g r e t _ { \mathrm { d } } ( \sigma | \boldsymbol { r } )$ that are additional to $\Sigma _ { \sigma } \tilde { r }$ and introduce the following shorthand: $\Delta _ { \sigma } V _ { \tilde { r } } \triangleq V _ { \tilde { r } } ^ { \ast } \big ( s _ { \sigma , | \sigma | } \big ) - V _ { \tilde { r } } ^ { \ast } \big ( s _ { \sigma , 0 } \big )$ Note that with an algebraic manipulation (see Appendix $\mathbf { E . 1 } )$ , $\begin{array} { r l } { r e g r e t _ { \mathrm { d } } ( \sigma _ { 2 } | \tilde { r } ) - r e g r e t _ { \mathrm { d } } ( \sigma _ { 1 } | \tilde { r } ) = } \end{array}$ $\left( \Delta _ { \sigma _ { 1 } } V _ { \tilde { r } } - \Delta _ { \sigma _ { 2 } } V _ { \tilde { r } } \right) + \left( \Sigma _ { \sigma _ { 1 } } \tilde { r } - \Sigma _ { \sigma _ { 2 } } \tilde { r } \right)$ . Therefore, on the diagonal line in Figure 4, $r e g r e t _ { \mathrm { d } } ( \sigma _ { 2 } | \boldsymbol { r } ) =$ $r e g r e t _ { \mathrm { d } } ( \sigma _ { 1 } | \boldsymbol { r } )$ , making the $P _ { r e g r e t _ { d } }$ preference model indifferent.
|
| 243 |
+
|
| 244 |
+

|
| 245 |
+
Figure 4: Proportions at which subjects preferred each segment in a pair, plotted by the difference in the segments’ changes in state values ( $\mathbf { \dot { x } }$ -axis) and partial returns (y-axis). The diagonal line shows points of preference indifference for $P _ { r e g r e t }$ . Points of indifference for $P _ { \Sigma }$ lie on the $\mathbf { X }$ -axis. The shaded gray area indicates where the two models disagree, each giving a different segment a preference probability greater than 0.5. Each circle’s area is proportional to the number of samples it describes.
|
| 246 |
+
|
| 247 |
+
The dataset of preferences is visualized in Figure $\mathbb { E }$ This plot shows how $\Delta _ { \sigma } V _ { r }$ has influence independent of partial return by focusing only on points at a chosen $y$ -axis value; if the colors along the corresponding horizontal line reddens as the $x$ -axis value increases, then $\Delta _ { \sigma } V _ { r }$ appears to have independent influence. To statistically test for independent influence of $\Delta _ { \sigma } V _ { r }$ on preferences, we consider subsets of data where $\Sigma _ { \sigma _ { 1 } } r - \Sigma _ { \sigma _ { 2 } } r$ is constant. For $\Sigma _ { \sigma _ { 1 } } r - \Sigma _ { \sigma _ { 2 } } r = - 1$ and $\Sigma _ { \sigma _ { 1 } } r - \Sigma _ { \sigma _ { 2 } } r = - 2$ , the only values with
|
| 248 |
+
|
| 249 |
+
<table><tr><td>Preference model</td><td>Loss</td></tr><tr><td>P(·)=0.5 (uninformed)</td><td>0.69</td></tr><tr><td>Pε, (partial return)</td><td>0.62</td></tr><tr><td>Pregret</td><td>0.57</td></tr></table>
|
| 250 |
+
|
| 251 |
+
Table 1: Mean cross-entropy test loss over 10-fold cross validation $( \mathrm { n } { = } 1 8 1 2 )$ from predicting human preferences. Lower is better.
|
| 252 |
+
|
| 253 |
+
more than 30 samples that also include informative samples with both negative and positive values of $r e g r e t ( \sigma _ { 1 } | r ) - r e g r e t ( \sigma _ { 2 } | r )$ , the Spearman’s rank correlations between $\Delta _ { \sigma } V _ { r }$ and the preferences are significant ( $_ { r > = 0 . 3 }$ , $p { < } 0 . 0 0 0 1$ ). This result indicates that $\Delta _ { \sigma } V _ { r }$ influences human preferences independent of partial return, validating our hypothesis that humans form preferences based on information about segments’ start states and end states, not only partial returns.
|
| 254 |
+
|
| 255 |
+
To examine how well each preference model predicts human preferences, we calculate the crossentropy loss for each model (Eqn. $^ { 1 ) }$ —i.e., the negative log likelihood—of the preferences in our dataset. Scaling reward by a constant factor does not affect the set of optimal policies. Therefore, throughout this work we ensure that our analyses of preference models are insensitive to reward scaling. To do so for this specific analysis, we conduct 10-fold cross validation to learn a reward scaling factor for each of $P _ { r e g r e t }$ and $P _ { \Sigma _ { r } }$ . Table $^ 1$ shows that the loss of $P _ { r e g r e t }$ is lower than that of $P _ { \Sigma _ { r } }$ , indicating that it is more reflective of how people actually express preferences.
|
| 256 |
+
|
| 257 |
+
# 270 6 Results from learning reward functions
|
| 258 |
+
|
| 259 |
+
Analysis of a preference model’s predictions of human preferences is informative, but such predictions are a means to the ends of learning human-aligned reward functions and policies. We now examine each preference model’s performance on these ends. In all cases, we learn a reward function $\hat { r }$ according to Eqn. 1 and apply value iteration $[ | 2 3 | ]$ to find the approximately optimal $Q _ { \hat { r } } ^ { * }$ function. For this $Q _ { \hat { r } } ^ { * }$ , we then evaluate the mean return of the maximum-entropy optimal policy—which chooses uniformly randomly among all optimal actions—with respect to the ground-truth reward function $r$ , over $D _ { 0 }$ . To compare performance across different MDPs, the mean return of a policy $\pi$ , $V _ { r } ^ { \pi }$ , is normalized to $( V _ { r } ^ { \pi } - V _ { r } ^ { \bar { U } } ) / V _ { r } ^ { * }$ , where $V _ { r } ^ { * }$ is the optimal expected return and $V _ { r } ^ { U }$ is the expected return of the uniformly random policy (both given $D _ { 0 }$ ). Normalized mean return above 0 is better than $V _ { r } ^ { U }$ . Optimal policies have a normalized mean return of 1, and we consider above 0.9 to be near optimal.
|
| 260 |
+
|
| 261 |
+
# 81 6.1 An algorithm to learn reward functions with regret $( \sigma _ { \sigma } | \hat { r } )$
|
| 262 |
+
|
| 263 |
+
Algorithm $^ 1$ is a general algorithm for learning a linear reward function according to $P _ { r e g r e t }$ . This regret-specific algorithm only changes the regret-based algorithm from Section $2 . 2$ by replacing Equation $\boxed { 5 }$ with a tractable approximation of regret, avoiding expensive repeated evaluation of $V _ { \hat { r } } ^ { * } ( \cdot )$ and $Q _ { \hat { r } } ^ { * } ( \cdot , \cdot )$ to compute $P _ { r e g r e t } ( \cdot | \hat { r } )$ during reward learning. Specifically, successor features for a set of policies are used to approximate the optimal state values and state-action values for any reward function.
|
| 264 |
+
|
| 265 |
+
Approximating $P _ { r e g r e t }$ with successor features Following the notation of Barreto et al. $\mathbb { \lVert 2 4 \rVert }$ , assume the ground-truth reward is linear with respect to a feature vector extracted by $\phi : S \times A \times S \to \mathbb { R } ^ { d }$ and a weight vector $\pmb { w _ { r } } \in \mathbb { R } ^ { d } ; \ : r ( s , a , s ^ { \prime } ) = \phi ( s , a , s ^ { \prime } ) ^ { \top } \pmb { w _ { r } }$ . During learning, ${ \pmb w } _ { \hat { \pmb r } }$ similarly expresses $\hat { r }$ as $\hat { r } ( s , a , s ^ { \prime } ) = \phi ( s , a , s ^ { \prime } ) ^ { \top } \pmb { w } _ { \hat { r } }$ .
|
| 266 |
+
|
| 267 |
+
Given a policy $\pi$ , the successor features for $^ { ( s , a ) }$ are the expectation of discounted reward features from that state-action pair when following $\pi$ $\begin{array} { r } { \because \psi _ { Q } ^ { \pi } ( s , a ) = E ^ { \pi } [ \sum _ { i = t } ^ { \infty } \gamma ^ { i - t } \phi ( s _ { t } , a _ { t } , s _ { t + 1 } ) | s _ { t } = s , a _ { t } = a ] } \end{array}$ Therefore, $Q _ { \hat { r } } ^ { \pi } ( s , a ) = \psi _ { Q } ^ { \pi } \left( s , a \right) ^ { \top } \mathbf { \boldsymbol { w } } _ { \hat { r } }$ . Additionally, state-based successor features can be calculated from the $\psi _ { Q } ^ { \pi }$ above as $\begin{array} { r } { \psi _ { v } ^ { \pi } \left( s \right) = \sum _ { a \in A } \pi ( a | s ) \psi _ { Q } ^ { \pi } \left( s , a \right) } \end{array}$ , making $V _ { \hat { r } } ^ { \pi } ( s ) = \psi _ { v } ^ { \pi } ( s ) ^ { \top } \pmb { w } _ { \hat { r } } .$ .
|
| 268 |
+
|
| 269 |
+
Given a set $\Psi _ { _ Q }$ of state-action successor feature functions and a set $\Psi _ { \scriptscriptstyle V }$ of state successor feature functions for various policies and given a reward function via ${ \pmb w } _ { \hat { r } }$ , $Q _ { \hat { r } } ^ { \pi ^ { * } } ( s , a ) { \geq } m a x _ { \psi _ { Q } \in \Psi _ { Q } } [ \psi _ { Q } ^ { \pi } ( s , a ) ^ { \top } \pmb { w } _ { \hat { r } } ]$ and $V _ { \hat { r } } ^ { \pi ^ { * } } \left( s \right) \geq m a x _ { \psi _ { \scriptstyle V } \in \Psi _ { V } } \left[ \psi _ { v } ^ { \pi } \left( s \right) ^ { \top } { \pmb w } _ { \hat { r } } \right] \left\| 2 4 \right\|$ , so we use these two maximizations as approximations of $Q _ { \hat { r } } ^ { * } ( s , a )$ and $V _ { \hat { r } } ^ { * } ( s )$ , respectively. In practice, to enable gradient-based optimization with current tools, the maximization in this expression is replaced with the softmax-weighted average, making the loss function linear. Focusing first on the approximation of $V _ { \hat { r } } ^ { * } ( s )$ , for each $\psi _ { v } \in \Psi _ { V }$ , a softmax weight is calculated for $\begin{array} { r } { \psi _ { _ { V } } ^ { \pi } ( s ) \colon s o f i m a x _ { \Psi } ( \psi _ { _ { V } } ^ { \pi } ( s ) ^ { \top } \pmb { w } _ { \hat { r } } ) \triangleq [ ( \psi _ { _ { V } } ^ { \pi } ( s ) ^ { \top } \pmb { w } _ { \hat { r } } ) ^ { 1 / T } ] / [ ( \dot { \sum } _ { \psi _ { _ { V } } ^ { \prime } \in \Psi _ { _ { V } } } \psi _ { _ { V } } ^ { \prime \pi } ( s ) ^ { \top } \pmb { w } _ { \hat { r } } ) ^ { 1 / T } ] . } \end{array}$ where temperature $T$ is a constant hyperparameter. The resulting approximation of $V _ { \widehat { r } } ^ { * } ( s )$ is therefore defined as $\begin{array} { r } { \tilde { V } _ { \hat { r } } ^ { * } ( s ) \triangleq \sum _ { \pmb { \psi } _ { V } \in \Psi _ { V } } s o f t m a x _ { \Psi _ { V } } ( \pmb { \psi } _ { V } ^ { \pi } ( s ) ^ { \top } \pmb { w } _ { \hat { r } } ) [ \pmb { \psi } _ { V } ^ { \pi } ( s ) ^ { \top } \pmb { w } _ { \hat { r } } ] } \end{array}$ . Similarly, to approxi
|
| 270 |
+
mate 305 $\begin{array} { r } { \mathcal { Q } _ { \vec { r } } ^ { * } ( s , a ) , s o f i m a x _ { \Psi _ { Q } } ( \psi _ { _ { Q } } ^ { \pi } ( s , a ) ^ { \top } \pmb { w } _ { \hat { r } } ) \triangleq [ ( \psi _ { _ { Q } } ^ { \pi } ( s , a ) ^ { \top } \pmb { w } _ { \hat { r } } ) ^ { 1 / T } ] / [ ( \sum _ { \psi _ { _ Q } ^ { \prime } \in \Psi } \psi _ { _ { Q } } ^ { \prime \pi } ( s , a ) ^ { \top } \pmb { w } _ { \hat { r } } ) ^ { 1 / T } ] } \end{array}$
|
| 271 |
+
and 306 $\begin{array} { r } { \tilde { Q } _ { \hat { r } } ^ { * } ( s , a ) \triangleq \sum _ { \psi _ { Q } \in \Psi _ { Q } } s o f t m a x _ { \Psi _ { Q } } ( \psi _ { Q } ^ { \pi } ( s , a ) ^ { \top } \pmb { w } _ { \hat { r } } ) [ \psi _ { Q } ^ { \pi } ( s , a ) ^ { \top } \pmb { w } _ { \hat { r } } ] } \end{array}$ . Consequently, from Eqns. 4
|
| 272 |
+
|
| 273 |
+
1: Input: a set of reward functions and a set of policies (where one set can be $\mathcal { D }$ )
|
| 274 |
+
2: $\Psi \emptyset$
|
| 275 |
+
3: for each reward function $r _ { S F }$ or policy $\pi _ { S F }$ in the input sets do
|
| 276 |
+
4: if $r _ { S F }$ then $\pi _ { S F } $ estimate of optimal maximum-entropy policy for $r _ { S F }$
|
| 277 |
+
5: 6: add estimate $\psi _ { Q } ^ { \pi _ { S F } }$ $\psi _ { Q } ^ { \pi _ { S F } }$ Q to $\Psi _ { _ Q }$ and n $\psi _ { V } ^ { \pi _ { S F } }$ (if not estimated already during step 4)
|
| 278 |
+
7: add $\psi _ { V } ^ { \dot { \pi } _ { S F } }$ to $\Psi _ { \scriptscriptstyle V }$
|
| 279 |
+
8: end for
|
| 280 |
+
9: repeat
|
| 281 |
+
10: optimize ${ \pmb w } _ { \hat { \pmb r } }$ by loss of Eqn. 1, calculating $\tilde { P } _ { r e g r e t } ( \sigma _ { 1 } \succ \sigma _ { 2 } | \hat { r } )$ via Eqn. $6 ,$ using $\Psi _ { _ Q }$ and $\Psi _ { \scriptscriptstyle V }$
|
| 282 |
+
11: until stopping criteria are met
|
| 283 |
+
12: return ${ \pmb w } _ { \hat { \pmb r } }$
|
| 284 |
+
|
| 285 |
+
and307 $\cdot 5 ,$ the corresponding approximation $\tilde { P } _ { r e g r e t }$ of the regret preference model is:
|
| 286 |
+
|
| 287 |
+
$$
|
| 288 |
+
\begin{array} { r } { \tilde { P } _ { r e g r e t } ( \sigma _ { 1 } \succ \sigma _ { 2 } | \hat { r } ) = l o g i s t i c \biggl ( \sum _ { t = 0 } ^ { | \sigma _ { 2 } | \cdot 1 } \left[ \tilde { V } _ { \hat { r } } ^ { * } ( s _ { \sigma _ { 2 } , t } ) - \tilde { Q } _ { \hat { r } } ^ { * } ( s _ { \sigma _ { 2 } , t } , a _ { \sigma _ { 2 } , t } ) \right] - \sum _ { t = 0 } ^ { | \sigma _ { 1 } | \cdot 1 } \left[ \tilde { V } _ { \hat { r } } ^ { * } ( s _ { \sigma _ { 1 } , t } ) - \tilde { Q } _ { \hat { r } } ^ { * } ( s _ { \sigma _ { 1 } , t } , a _ { \sigma _ { 1 } , t } ) \right] \biggr ) } \end{array}
|
| 289 |
+
$$
|
| 290 |
+
|
| 291 |
+
308 The algorithm In Algorithm $\underline { { \left. 1 , \right. } }$ lines 9–12 describe the supervised-learning optimization using
|
| 292 |
+
309 the approximation $\tilde { P } _ { r e g r e t }$ , and the prior lines create $\Psi _ { _ Q }$ and $\Psi _ { \scriptscriptstyle V }$ . Specifically, given a set of reward
|
| 293 |
+
310 functions, a corresponding set of policies is created (line 4), where each policy is an estimate of the
|
| 294 |
+
311 maximum entropy policy for a reward function. Standard policy improvement methods can be used to
|
| 295 |
+
312 create each such policy. Alternatively, some or all of the set of policies can be given as input directly,
|
| 296 |
+
313 not derived from input reward functions. For each such policy $\pi _ { S F }$ , successor feature functions $\Psi _ { Q _ { - } } ^ { \pi _ { S F } }$
|
| 297 |
+
314 and $\Psi _ { V } ^ { \pi _ { S F } }$ are estimated (line 5), which by default would be performed by a minor extension of a
|
| 298 |
+
315 standard policy evaluation algorithm as detailed by Barreto et al. $[ [ 2 4 ]$ . Note that the reward function
|
| 299 |
+
316 that is ultimately learned is not restricted to be in the input set of reward functions, which is used only
|
| 300 |
+
317 to create an approximation of regret.
|
| 301 |
+
|
| 302 |
+
The details of our instantiation of Algorithm 1 for the delivery domain can be found in Appendix F.
|
| 303 |
+
along with guidance for extending it to reward functions that might be non-linear.
|
| 304 |
+
|
| 305 |
+
# 6.2 Results from synthetic preferences
|
| 306 |
+
|
| 307 |
+
Before considering human preferences, we first ask how each preference model performs when it is correct. In other words, we investigate empirically how well the preference model could perform if humans perfectly adhered to it. Recall that the ground-truth reward function, $r$ , is used to create these preferences but is inaccessible to the reward-learning algorithms.
|
| 308 |
+
|
| 309 |
+
For these evaluations, either a stochastic or noiseless preference model acts a preference generator to create a preference dataset, and then the stochastic version of the same model is used for reward learning. For the noiseless case, the deterministic preference generator compares a segment pair’s $\Sigma _ { \sigma } r$ values for $P _ { \Sigma _ { r } }$ or their $r e g r e t ( \sigma | \boldsymbol { r } )$ values for $P _ { r e g r e t }$ . Note that through reward scaling the preference generators approach determinism in the limit, so this noiseless analysis examines minimal-entropy versions
|
| 310 |
+
|
| 311 |
+

|
| 312 |
+
Figure 5: Performance comparison over 100 randomly generated deterministic MDPs
|
| 313 |
+
|
| 314 |
+
336 of the two preference-generating models. (The opposite extreme, uniformly random preferences,
|
| 315 |
+
337 would remove all information from preferences and therefore is not examined.) In the stochastic case,
|
| 316 |
+
338 for each preference model, each segment pair is labeled by sampling from that preference generator’s
|
| 317 |
+
339 output distribution $( \operatorname { E q s } 2 \operatorname { o r } 5 )$ , using the unscaled ground-truth reward function.
|
| 318 |
+
340 We created 100 deterministic MDPs that instantiate variants of our delivery domain (see Section 4.1)
|
| 319 |
+
341 To create each MDP, we sampled from sets of possible widths, heights, and reward component values,
|
| 320 |
+
342 and the resultant grid cells were randomly populated with a destination, objects, and road surface types
|
| 321 |
+
343 (see Appendix F.2 for details). Each segment in the preference datasets for each MDP was generated
|
| 322 |
+
344 by choosing a start state and three actions, all uniformly randomly. For a set number of preferences,
|
| 323 |
+
345 each method had the same set of segment pairs in its preference dataset. Figure 5 shows the percentage
|
| 324 |
+
346 of MDPs in which each preference model results in near-optimal performance. The regret preference
|
| 325 |
+
347 model outperforms the partial return model at every dataset size, both with and without noise. By a
|
| 326 |
+
348 Wilcoxon paired signed-rank test on normalized mean returns, $p { < } 0 . 0 5$ for $86 \%$ of these comparisons
|
| 327 |
+
349 and $p { < } 0 . 0 1$ for $57 \%$ of them, as reported in Appendix F.2.
|
| 328 |
+
350 Further analyses can be found in Appendix F.2, including with stochastic transitions, with different
|
| 329 |
+
351 segment lengths, and while artificially lowering the discount factor (as is common in deep RL and
|
| 330 |
+
352 recent work on deep reward learning from preferences).
|
| 331 |
+
|
| 332 |
+
# 6.3 Results from human preferences
|
| 333 |
+
|
| 334 |
+
We randomly assign human preferences from our gathered dataset to different numbers of same-sized partitions, resulting in different training set sizes, and test each preference model on each partition. Figure 6 shows the results. With smaller training sets (20–100 partitions), the regret preference model results in nearoptimal performance more often. With larger training sets (1–10 partitions), both preference models always reach near-optimal return, but the mean return from the regret preference model is higher for all of these partitions except for 3 partitions in the 10-partition test. Applying a Wilcoxon paired signed-rank test on normalized mean return to each group with 5 or more partitions, $p { < } 0 . 0 5$ for all numbers of partitions except 100 and $p { < } 0 . 0 1$ for 20 and 50 partitions.
|
| 335 |
+
|
| 336 |
+

|
| 337 |
+
Figure 6: Performance comparison over various amounts of human preferences. Each partition has the number of preferences shown or one less.
|
| 338 |
+
|
| 339 |
+
# 7 Conclusion
|
| 340 |
+
|
| 341 |
+
Over numerous evaluations with human preferences, our proposed regret preference model $( P _ { r e g r e t } )$ shows improvements summarized below over the previous partial return preference model $( P _ { \Sigma _ { r } } )$ . When each preference model generates the preferences for its own infinite and exhaustive training set, we prove that $P _ { r e g r e t }$ identifies the set of optimal policies, whereas $P _ { \Sigma _ { r } }$ is not guaranteed to do so without preference noise that reveals the proportions of rewards with respect to each other. With finite training data of synthetic preferences, $P _ { r e g r e t }$ also empirically results in learned policies that tend to outperform those resulting from $P _ { \Sigma _ { r } }$ . This superior performance of $P _ { r e g r e t }$ is also seen with human preferences. In summary, our analyses suggest that regret preference models are more effective both descriptively with respect to human preferences and also normatively, as the model we want humans to follow if we had the choice.
|
| 342 |
+
|
| 343 |
+
378 Independent of $P _ { r e g r e t }$ , this paper also reveals that segments’ changes in state values provide informa
|
| 344 |
+
379 tion about human preferences that is not fully provided by partial return. More generally, we show that
|
| 345 |
+
380 the choice of preference model impacts the performance of learned reward functions.
|
| 346 |
+
This study motivates several new directions for research. Future work could address any of the
|
| 347 |
+
82 limitations detailed in Appendix $\mathbf { \nabla } \cdot \mathbf { A } . 1 .$ Specifically, future work could further test the general superiority
|
| 348 |
+
83 of $P _ { r e g r e t }$ or apply it to deep learning settings. Additionally, prescriptive methods could be developed
|
| 349 |
+
84 via the user interface or elsewhere to nudge humans to conform more to $P _ { r e g r e t }$ or to other normatively
|
| 350 |
+
85 appealing preference models. Lastly, subsequent efforts could seek preference models that are even
|
| 351 |
+
86 more effective with preferences from actual humans, now that this work has provided conclusive
|
| 352 |
+
7 evidence that the choice of preference model is impactful.
|
| 353 |
+
|
| 354 |
+
References
|
| 355 |
+
[1] David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
|
| 356 |
+
[2] Andrew W Senior, Richard Evans, John Jumper, James Kirkpatrick, Laurent Sifre, Tim Green, Chongli Qin, Augustin Žídek, Alexander WR Nelson, Alex Bridgland, et al. Improved protein structure prediction using potentials from deep learning. Nature, 577(7792):706–710, 2020.
|
| 357 |
+
[3] Oriol Vinyals, Igor Babuschkin, Wojciech M Czarnecki, Michaël Mathieu, Andrew Dudzik, Junyoung Chung, David H Choi, Richard Powell, Timo Ewalds, Petko Georgiev, et al. Grandmaster level in StarCraft II using multi-agent reinforcement learning. Nature, 575(7782):350–354, 2019.
|
| 358 |
+
[4] Marc G Bellemare, Salvatore Candido, Pablo Samuel Castro, Jun Gong, Marlos C Machado, Subhodeep Moitra, Sameera S Ponda, and Ziyu Wang. Autonomous navigation of stratospheric balloons using reinforcement learning. Nature, 588(7836):77–82, 2020.
|
| 359 |
+
[5] Christopher Berner, Greg Brockman, Brooke Chan, Vicki Cheung, Przemysław D˛ebiak, Christy Dennison, David Farhi, Quirin Fischer, Shariq Hashme, Chris Hesse, et al. Dota 2 with large scale deep reinforcement learning. arXiv preprint arXiv:1912.06680, 2019.
|
| 360 |
+
[6] Jonas Degrave, Federico Felici, Jonas Buchli, Michael Neunert, Brendan Tracey, Francesco Carpanese, Timo Ewalds, Roland Hafner, Abbas Abdolmaleki, Diego de Las Casas, et al. Magnetic control of tokamak plasmas through deep reinforcement learning. Nature, 602(7897):414–419, 2022.
|
| 361 |
+
[7] Dario Amodei, Chris Olah, Jacob Steinhardt, Paul Christiano, John Schulman, and Dan Mané. Concrete problems in ai safety. arXiv preprint arXiv:1606.06565, 2016.
|
| 362 |
+
[8] W Bradley Knox, Alessandro Allievi, Holger Banzhaf, Felix Schmitt, and Peter Stone. Reward (mis)design for autonomous driving. arXiv preprint arXiv:2104.13906, 2021.
|
| 363 |
+
[9] Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. In Advances in Neural Information Processing Systems (NIPS), pages 4299–4307, 2017.
|
| 364 |
+
[10] Borja Ibarz, Jan Leike, Tobias Pohlen, Geoffrey Irving, Shane Legg, and Dario Amodei. Reward learning from human preferences and demonstrations in atari. arXiv preprint arXiv:1811.06521, 2018.
|
| 365 |
+
[11] Xiaofei Wang, Kimin Lee, Kourosh Hakhamaneshi, Pieter Abbeel, and Michael Laskin. Skill preferences: Learning to extract and execute robotic skills from human feedback. In Conference on Robot Learning, pages 1259–1268. PMLR, 2022.
|
| 366 |
+
[12] Erdem Bıyık, Dylan P Losey, Malayandi Palan, Nicholas C Landolfi, Gleb Shevchuk, and Dorsa Sadigh. Learning reward functions from diverse sources of human feedback: Optimally integrating demonstrations and preferences. The International Journal of Robotics Research, page 02783649211041652, 2021.
|
| 367 |
+
[13] Dorsa Sadigh, Anca D Dragan, Shankar Sastry, and Sanjit A Seshia. Active preference-based learning of reward functions. Robotics: Science and Systems, 2017.
|
| 368 |
+
[14] Kimin Lee, Laura Smith, and Pieter Abbeel. Pebble: Feedback-efficient interactive reinforcement learning via relabeling experience and unsupervised pre-training. arXiv preprint arXiv:2106.05091, 2021.
|
| 369 |
+
[15] Kimin Lee, Laura Smith, Anca Dragan, and Pieter Abbeel. B-pref: Benchmarking preference-based reinforcement learning. arXiv preprint arXiv:2111.03026, 2021.
|
| 370 |
+
[16] Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. arXiv preprint arXiv:2203.02155, 2022.
|
| 371 |
+
[17] R Duncan Luce. Individual choice behavior: A theoretical analysis. John Wiley, 1959.
|
| 372 |
+
[18] Roger N Shepard. Stimulus and response generalization: A stochastic model relating generalization to distance in psychological space. Psychometrika, 22(4):325–345, 1957.
|
| 373 |
+
[19] A.Y. Ng and S. Russell. Algorithms for inverse reinforcement learning. In Seventeenth International Conference on Machine Learning (ICML), 2000.
|
| 374 |
+
[20] Brian D Ziebart, Andrew L Maas, J Andrew Bagnell, and Anind K Dey. Maximum entropy inverse reinforcement learning. In Twenty-third AAAI Conference on Artificial Intelligence, volume 8, pages 1433–1438, 2008.
|
| 375 |
+
[21] Dylan Hadfield-Menell, Smitha Milli, Pieter Abbeel, Stuart J Russell, and Anca Dragan. Inverse reward design. In Advances in Neural Information Processing Systems (NIPS), pages 6765–6774, 2017.
|
| 376 |
+
[22] Stuart Russell and Peter Norvig. Artificial intelligence: a modern approach. 2020.
|
| 377 |
+
[23] Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018.
|
| 378 |
+
[24] André Barreto, Will Dabney, Rémi Munos, Jonathan J Hunt, Tom Schaul, Hado Van Hasselt, and David Silver. Successor features for transfer in reinforcement learning. arXiv preprint arXiv:1606.05312, 2016.
|
| 379 |
+
[25] Riad Akrour, Marc Schoenauer, and Michele Sebag. Preference-based policy learning. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pages 12–27. Springer, 2011.
|
| 380 |
+
[26] Daniel Brown, Russell Coleman, Ravi Srinivasan, and Scott Niekum. Safe imitation learning via fast bayesian reward inference from preferences. In International Conference on Machine Learning, pages 1165–1177. PMLR, 2020.
|
| 381 |
+
[27] Pieter Abbeel and Andrew Y Ng. Apprenticeship learning via inverse reinforcement learning. In Proceedings of the twenty-first international conference on Machine learning, page 1, 2004.
|
| 382 |
+
[28] Kuno Kim, Shivam Garg, Kirankumar Shiragur, and Stefano Ermon. Reward identification in inverse reinforcement learning. In International Conference on Machine Learning, pages 5496–5505. PMLR, 2021.
|
| 383 |
+
[29] Saurabh Arora and Prashant Doshi. A survey of inverse reinforcement learning: Challenges, methods and progress. Artificial Intelligence, 297:103500, 2021.
|
| 384 |
+
[30] John Von Neumann and Oskar Morgenstern. Theory of games and economic behavior. Princeton university press, 1944.
|
| 385 |
+
[31] Yuchen Cui, Qiping Zhang, Alessandro Allievi, Peter Stone, Scott Niekum, and W Bradley Knox. The empathic framework for task learning from implicit human feedback. arXiv preprint arXiv:2009.13649, 2020.
|
| 386 |
+
[32] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems 32, pages 8024–8035. Curran Associates, Inc., 2019.
|
| 387 |
+
[33] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.
|
| 388 |
+
|
| 389 |
+
# 470 Checklist
|
| 390 |
+
|
| 391 |
+
1. For all authors...
|
| 392 |
+
|
| 393 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 394 |
+
(b) Did you describe the limitations of your work? [Yes] See Appendix A.1.
|
| 395 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Appendix A.2.
|
| 396 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 397 |
+
|
| 398 |
+
2. If you are including theoretical results...
|
| 399 |
+
|
| 400 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] Sections 3 and C include all assumptions.
|
| 401 |
+
(b) Did you include complete proofs of all theoretical results? [Yes] See Section 3 and Appendix C.
|
| 402 |
+
|
| 403 |
+
3. If you ran experiments...
|
| 404 |
+
|
| 405 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No] However, the learning code, the code for running experiments, the code and UI elements for gathering human preferences on Mechanical Turk, and the anonymized human preferences data will be opened. We are particularly excited to provide the first open dataset of human preferences over pairs of trajectory segments.
|
| 406 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Appendix F.1
|
| 407 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] Error bars do not seem applicable to our plots, which do not show the exact data that we do statistical testing on. However, statistical significance testing was reported, in Sections 5.1 and 6.2 (with a pointer to the appendix for details).
|
| 408 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Appendix F.1.
|
| 409 |
+
|
| 410 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 411 |
+
|
| 412 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] Appendix D does so for visual assets used to visualize the delivery task.
|
| 413 |
+
(b) Did you mention the license of the assets? [Yes] Appendix D mentions the license for visual assets used to visualize the delivery task.
|
| 414 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 415 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes] See Appendix D.
|
| 416 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] See Appendix D
|
| 417 |
+
|
| 418 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 419 |
+
|
| 420 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [Yes] Section 4.1.1 includes a link to a video of a full experimental session (with an author acting as the subject).
|
| 421 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [Yes] We discuss participant risks from our crowdsourced study and provide a link to the IRB approval in Appendix D.
|
| 422 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [Yes] See Appendix D.
|
md/dev/9t-j3xDm7_Q/9t-j3xDm7_Q.md
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Motion Transformer with Global Intention Localization and Local Movement Refinement
|
| 2 |
+
|
| 3 |
+
Shaoshuai Shi, Li Jiang, Dengxin Dai, Bernt Schiele Max Planck Institute for Informatics, Saarland Informatics Campus {sshi, lijiang, ddai, schiele}@mpi-inf.mpg.de
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Predicting multimodal future behavior of traffic participants is essential for robotic vehicles to make safe decisions. Existing works explore to directly predict future trajectories based on latent features or utilize dense goal candidates to identify agent’s destinations, where the former strategy converges slowly since all motion modes are derived from the same feature while the latter strategy has efficiency issue since its performance highly relies on the density of goal candidates. In this paper, we propose the Motion TRansformer (MTR) framework that models motion prediction as the joint optimization of global intention localization and local movement refinement. Instead of using goal candidates, MTR incorporates spatial intention priors by adopting a small set of learnable motion query pairs. Each motion query pair takes charge of trajectory prediction and refinement for a specific motion mode, which stabilizes the training process and facilitates better multimodal predictions. Experiments show that MTR achieves state-of-the-art performance on both the marginal and joint motion prediction challenges, ranking $\bar { 1 } ^ { s t }$ on the leaderboards of Waymo Open Motion Dataset. Code will be available at https://github.com/sshaoshuai/MTR.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Motion forecasting is a fundamental task of modern autonomous driving systems. It has been receiving increasing attention in recent years [19, 46, 29, 57, 35] as it is crucial for robotic vehicles to understand driving scenes and make safe decisions. Motion forecasting requires to predict future behaviors of traffic participants by jointly considering the observed agent states and road maps, which is challenging due to inherently multimodal behaviors of the agent and complex scene environments.
|
| 12 |
+
|
| 13 |
+
To cover all potential future behaviors of the agent, existing approaches mainly fall into two different lines: the goal-based methods and the direct-regression methods. The goal-based methods [19, 61] adopt dense goal candidates to cover all possible destinations of the agent, predicting the probability of each candidate being a real destination and then completing the full trajectory for each selected candidate. Although these goal candidates alleviate the burden of model optimization by reducing trajectory uncertainty, their density largely affects the performance of these methods: fewer candidates will decrease the performance while more candidates will greatly increase computation and memory cost. Instead of using goal candidates, the direct-regression methods [35, 47] directly predict a set of trajectories based on the encoded agent feature, covering the agent’s future behavior adaptively. Despite the flexibility in predicting a broad range of agent behaviors, they generally converge slowly as various motion modes are required to be regressed from the same agent feature without utilizing any spatial priors. They also tend to predict the most frequent modes of training data since these frequent modes dominate the optimization of the agent feature. In this paper, we present a unified framework, namely Motion TRansformer (MTR), which takes the best of both types of methods.
|
| 14 |
+
|
| 15 |
+
In our proposed MTR, we adopt a small set of novel motion query pairs to model motion prediction as the joint optimization of two tasks: The first global intention localization task aims to roughly identify agent’s intention for achieving higher efficiency, while the second local movement refinement task aims to adaptively refine each intention’s predicted trajectory for achieving better accuracy. Our approach not only stabilizes the training process without depending on dense goal candidates but also enables flexible and adaptive prediction by enabling local refinement for each motion mode.
|
| 16 |
+
|
| 17 |
+
Specifically, each motion query pair consists of two components, i.e., a static intention query and a dynamic searching query. The static intention queries are introduced for global intention localization, where we formulate them based on a small set of spatially distributed intention points. Each static intention query is the learnable positional embedding of an intention point for generating trajectory of a specific motion mode, which not only stabilizes the training process by explicitly utilizing different queries for different modes, but also eliminates the dependency on dense goal candidates by requiring each query to take charge of a large region. The dynamic searching queries are utilized for local movement refinement, where they are also initialized as the learnable embeddings of the intention points but are responsible for retrieving fine-grained local features around each intention point. For this purpose, the dynamic searching queries are dynamically updated according to the predicted trajectories, which can adaptively gather latest trajectory features from a deformable local region for iterative motion refinement. These two queries complement each other and have been empirically demonstrated their great effectiveness in predicting multimodal future motion. Besides that, we also propose a dense future prediction module. Existing works generally focus on modeling the agent interaction over past trajectories while ignoring the future trajectories’ interaction. To compensate for such information, we adopt a simple auxiliary regression head to densely predict future trajectory and velocity for each agent, which are encoded as additional future context features to benefit future motion prediction of our interested agent. The experiments show that this simple auxiliary task works well and remarkably improves the performance of multimodal motion prediction.
|
| 18 |
+
|
| 19 |
+
Our contributions are three-fold: (1) We propose a novel motion decoder network with a new concept of motion query pair, which adopts two types of queries to model motion prediction as joint optimization of global intention localization and local movement refinement. It not only stabilizes the training with mode-specific motion query pairs, but also enables adaptive motion refinement by iteratively gathering fine-grained trajectory features. (2) We present an auxiliary dense future prediction task to enable the future interactions between our interested agent and other agents. It facilitates our framework to predict more scene-compliant trajectories for the interacting agents. (3) By adopting these techniques, we propose MTR framework that explores transformer encoder-decoder structure for multimodal motion prediction. Our approach achieves state-of-the-art performance on both the marginal and joint motion prediction benchmarks of Waymo Open Motion Dataset (WOMD) [14], outperforming previous best ensemble-free approaches with $+ 8 . 4 8 \%$ mAP gains for marginal motion prediction and $+ 7 . 9 8 \%$ mAP gains for joint motion prediction. As of 19 May 2022, our approach ranks $1 ^ { s t }$ on both the marginal and joint motion prediction leaderboards of WOMD.
|
| 20 |
+
|
| 21 |
+
# 2 Related Work
|
| 22 |
+
|
| 23 |
+
Motion Prediction for Autonomous Driving. Recently, motion prediction has been extensively studied due to the growing interest in autonomous driving, and it typically takes road map and agent history states as input. To encode such scene context, early works [36, 31, 5, 12, 60, 3, 8] typically rasterize them into an image so as to be processed with convolutional neural networks (CNNs). LaneGCN [27] builds a lane graph toscalability capture map topology. VectorNet [16] is widely adopted by recent works [19, 43, 35, 47] due to its efficiency and scalability, where both road maps and agent trajectories are represented as polylines. We also adopt this vector representation, but instead of building global graph of polylines, we propose to adopt transformer encoder on local connected graph, which not only better maintains input locality structure but also is more memory-efficient to enable larger map encoding for long-term motion prediction.
|
| 24 |
+
|
| 25 |
+
Given the encoded scene context features, existing works explore various strategies to model multimodal future motion. Early works [1, 20, 39, 44, 40] propose to generate a set of trajectory samples to approximate the output distribution. Some other works [9, 21, 33, 37, 41] parameterize multimodal predictions with Gaussian Mixture Models (GMMs) to generate compact distribution. HOME series [18, 17] generate trajectories with sampling on a predicted heatmap. IntentNet [7] considers intention prediction as a classification with 8 high level actions, while [29] proposes a region-based training strategy. Goal-based methods [61, 40, 15, 30] are another kinds of models where they first estimate several goal points of the agents and then complete full trajectory for each goal.
|
| 26 |
+
|
| 27 |
+

|
| 28 |
+
Figure 1: The architecture of MTR framework. (a) indicates the dense future prediction module, which predicts a single trajectory for each agent (e.g., drawn as yellow dashed curves in the above of (a)). (b) indicates the dynamic map collection module, which collects map elements along each predicted trajectory (e.g., drawn as the shadow region along each trajectory in the above part of (b)) to provide trajectory-specific feature for motion decoder network. (c) indicates the motion decoder network, where $\kappa$ is the number of motion query pairs, $T$ is the number of future frames, $D$ is hidden feature dimension and $N$ is the number of transformer decoder layers. The predicted trajectories, motion query pairs, and query content features are the outputs from last decoder layer and will be taken as input to next decoder layer. For the first decoder layer, both two components of motion query pair are initialized as predefined intention points, the predicted trajectories are replaced with the intention points for initial map collection, and query content features are initialized as zeros.
|
| 29 |
+
|
| 30 |
+
Recently, the large-scale Waymo Open Motion Dataset (WOMD) [14] is proposed for long-term motion prediction. To address this challenge, DenseTNT [19] adopts a goal-based strategy to classify endpoint of trajectory from dense goal points. Other works directly predict the future trajectories based on the encoded agent features [35] or latent anchor embedding [47]. However, the goal-based strategy has the efficiency concern due to a large number of goal candidates, while the directregression strategy converges slowly as the predictions of various motion modes are regressed from the same agent feature. In contrast, our approach adopts a small set of learnable motion query pairs, which not only eliminate the large number of goal candidates but also alleviate the optimization burden by utilizing mode-specific motion query pairs for predicting different motion modes.
|
| 31 |
+
|
| 32 |
+
Some very recent works [45, 23, 22] also achieve top performance on WOMD by exploring Mix-andMatch block [45], a variant of MultiPath $^ { + + }$ [23] or heterogeneous graph [22]. However, they generally focus on exploring various structures for encoding scene context, while how to design a better motion decoder for multimodal motion prediction is still underexplored. In contrast, our approach focuses on addressing this challenge with a novel transformer-based motion decoder network.
|
| 33 |
+
|
| 34 |
+
Transformer. Transformer [48] has been widely applied in natural language processing [11, 2] and computer vision [13, 50, 4, 49, 58]. Our approach is inspired by DETR [4] and its follow-up works [63, 32, 56, 25, 28, 10, 59], especially DAB-DETR [28], where the object query is considered as the positional embedding of a spatial anchor box. Motivated by their great success in object detection, we introduce a novel concept of motion query pair to model multimodal motion prediction with prior intention points, where each motion query pair takes charge of predicting a specific motion mode and also enables iterative motion refinement by combining with transformer decoders.
|
| 35 |
+
|
| 36 |
+
# 3 Motion TRansformer (MTR)
|
| 37 |
+
|
| 38 |
+
We propose Motion TRansformer (MTR), which adopts a novel transformer encoder-decoder structure with iterative motion refinement for predicting multimodal future motion. The overall structure is illustrated in Figure 1. In Sec. 3.1, we introduce our encoder network for scene context modeling. In Sec. 3.2, we present motion decoder network with a novel concept of motion query pair for predicting multimodal trajectories. Finally, in Sec. 3.3, we introduce the optimization process of our framework.
|
| 39 |
+
|
| 40 |
+
# 3.1 Transformer Encoder for Scene Context Modeling
|
| 41 |
+
|
| 42 |
+
The future behaviors of the agents highly depend on the agents’ interaction and road map. To encode such scene context, existing approaches have explored various strategies by building global interacting graph [16, 19] or summarizing map features to agent-wise features [35, 47]. We argue that the locality structure is important for encoding scene context, especially for the road map. Hence, we propose a transformer encoder network with local self-attention to better maintain such structure information.
|
| 43 |
+
|
| 44 |
+
Input representation. We follow the vectorized representation [16] to organize both input trajectories and road map as polylines. For the motion prediction of a interested agent, we adopt the agent-centric strategy [61, 19, 47] that normalizes all inputs to the coordinate system centered at this agent. Then, a simple polyline encoder is adopted to encode each polyline as an input token feature for the transformer encoder. Specifically, we denote the history state of $N _ { a }$ agents as $A _ { \mathrm { i n } } \in \mathbb { N } ^ { N _ { a } \times t \times C _ { a } }$ , where $t$ is the number of history frames, $C _ { a }$ is the number of state information (e.g., location, heading angle and velocity), and we pad zeros at the positions of missing frames for trajectories that have less than $t$ frames. The road map is denoted as $M _ { \mathrm { i n } } \in \mathbb { R } ^ { N _ { m } \times n \times C _ { m } ^ { \times } }$ , where $N _ { m }$ is the number of map polylines, $n$ is the number of points in each polyline and $C _ { m }$ is the number of attributes of each point (e.g., location and road type). Both of them are encoded by a PointNet-like [38] polyline encoder as:
|
| 45 |
+
|
| 46 |
+
$$
|
| 47 |
+
A _ { \mathrm { p } } = \phi \left( \mathbf { M } \mathbf { L } \mathbf { P } ( A _ { \mathrm { i n } } ) \right) , \quad M _ { \mathrm { p } } = \phi \left( \mathbf { M } \mathbf { L } \mathbf { P } ( M _ { \mathrm { i n } } ) \right) ,
|
| 48 |
+
$$
|
| 49 |
+
|
| 50 |
+
where $\mathrm { \mathbf { M L P } ( \cdot ) }$ is a multilayer perceptron network, and $\phi$ is max-pooling to summarize each polyline features as agent features $\mathbf { \bar { A } _ { p } } \in \mathbb { R } ^ { N _ { a } \times D }$ and map features $M _ { \mathfrak { p } } \in \mathbf { \bar { R } } ^ { N _ { m } \times D }$ with feature dimension $D$
|
| 51 |
+
|
| 52 |
+
Scene context encoding with local transformer encoder. The local structure of scene context is important for motion prediction. For example, the relation of two parallel lanes is important for modelling the motion of changing lanes, but adopting attention on global connected graph equally considers relation of all lanes. In contrast, we introduce such prior knowledge to context encoder by adopting local attention, which better maintains the locality structure and are more memory-efficient. Specifically, the attention module of $j$ -th transformer encoder layer can be formulated as:
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
G ^ { j } = \mathrm { M u l t i H e a d A t t n } \left( \mathrm { q u e r y } = G ^ { j - 1 } + \mathrm { P E } _ { G ^ { j - 1 } } , { \mathrm { ~ k e y } } = \kappa ( G ^ { j - 1 } ) + \mathrm { P E } _ { \kappa ( G ^ { j - 1 } ) } , \mathrm { { ~ v a l u e } } = \kappa ( G ^ { j - 1 } ) \right) ,
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
where MultiHeadAttn $( \cdot , \cdot , \cdot )$ is the multi-head attention layer [48], $G ^ { 0 } = [ A _ { \mathrm { p } } , M _ { \mathrm { p } } ] \in \mathbb { N } ^ { ( N _ { a } + N _ { m } ) \times D }$ concatenating the features of agents and map, and $\kappa ( \cdot )$ denotes $k$ -nearest neighbor algorithm to find $k$ closest polylines for each query polyline. PE denotes sinusoidal position encoding of input tokens, where we utilize the latest position for each agent and utilize polyline center for each map polyline. Thanks to such local self-attention, our framework can encode a much larger area of scene context.
|
| 59 |
+
|
| 60 |
+
The encoder network finally generates both agent features $A _ { \mathrm { p a s t } } \in \mathbb { R } ^ { N _ { a } \times D }$ and map features $M \in$ $\mathbb { R } ^ { N _ { m } \times D }$ , which are considered as the scene context inputs of the following decoder network.
|
| 61 |
+
|
| 62 |
+
Dense future prediction for future interactions. Interactions with other agents heavily affect behaviors of our interested agent, and previous works propose to model the multi-agent interactions with hub-host based network [64], dynamic relational reasoning [26], social spatial-temporal network [55], etc. However, most existing works generally focus on learning such interactions over past trajectories while ignoring the interactions of future trajectories. Therefore, considering that the encoded features $A$ have already learned rich context information of all agents, we propose to densely predict both future trajectories and velocities of all agents by adopting a simple regression head on $A$ :
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
S _ { 1 : T } = \mathbf { M } \mathbf { L } \mathbf { P } ( A _ { \mathrm { p a s t } } ) ,
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
where $S _ { i } \in \mathbb { R } ^ { N _ { a } \times 4 }$ includes future position and velocity of each agent at time step $i$ , and $T$ is the number of future frames to be predicted. The predicted trajectories $S _ { 1 : T }$ are encoded by adopting the same polyline encoder as Eq. (1) to encode the agents’ future states as features $A _ { \mathrm { f u t u r e } } \dot { \in } \mathbb { R } ^ { \dot { N } _ { a } \times \dot { D } }$ which are then utilized to enhance the above features $A$ by using a feature concatenation and three MLP layers as $A = \mathrm { M L P } ( [ A _ { \mathrm { p a s t } } , A _ { \mathrm { f u t u r e } } ] )$ . This auxiliary task provides additional future context information to the decoder network, facilitating the model to predict more scene-compliant future trajectories for the interested agent. The experiments in Table 3 demonstrates that this simple and light-weight auxiliary task can effectively improve the performance of multimodal motion prediction.
|
| 69 |
+
|
| 70 |
+
# 3.2 Transformer Decoder with Motion Query Pair
|
| 71 |
+
|
| 72 |
+
Given the scene context features, a transformer-based motion decoder network is adopted for multimodal motion prediction, where we propose motion query pair to model motion prediction as the joint optimization of global intention localization and local movement refinement. Each motion query pair contains two types of queries, i.e., static intention query and dynamic searching query, for conducting global intention localization and local movement refinement respectively. As shown in Figure 2, our motion decoder network contains stacked transformer decoder layers for iteratively refining the predicted trajectories with motion query pairs. Next, we illustrate the detailed structure.
|
| 73 |
+
|
| 74 |
+
Global intention localization aims to localize agent’s potential motion intentions in an efficient and effective manner. We propose static intention query to narrow down the uncertainty of future trajectory by utilizing different intention queries for different motion modes. Specifically, we generate
|
| 75 |
+
|
| 76 |
+
$\kappa$ representative intention points $I \in \overline { { \mathbb { R } } } ^ { \kappa \times 2 }$ by adopting $\mathbf { k }$ -means clustering algorithm on the endpoints of ground-truth (GT) trajectories, where each intention point represents an implicit motion mode that considers both motion direction and velocity. We model each static intention query as the learnable positional embedding of the intention point as:
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
Q _ { I } = \mathbf { M L P } \left( \mathbf { P E } ( I ) \right) ,
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
where $\mathrm { P E } ( \cdot )$ is the sinusoidal position encoding, and $Q _ { I } \in \mathbb { R } ^ { K \times D }$ . Notably, each intention query takes charge of predicting trajectories for a specific motion mode, which stabilizes the training process and facilitates predicting multimodal trajectories since each motion mode has their own learnable embedding. Thanks to their learnable and adaptive properties, we only need a small number of queries (e.g., 64 queries in our setting) for efficient intention localization, instead of using densely-placed goal candidates [61, 19] to cover the destinations of the agents.
|
| 83 |
+
|
| 84 |
+

|
| 85 |
+
Figure 2: The network structure of our motion decoder network with motion query pair.
|
| 86 |
+
|
| 87 |
+
Local movement refinement aims to complement with global intention localization by iteratively gathering fine-grained trajectory features for refining the trajectories. We propose dynamic searching query to adaptively probe trajectory features for each motion mode. Each dynamic searching query is also the position embedding of a spatial point, which is initialized with its corresponding intention point but will be dynamically updated according to the predicted trajectory in each decoder layer. Specifically, given the predicted future trajectories $\bar { Y _ { 1 : T } ^ { j } } = \{ Y _ { i } ^ { j } \in \bar { \mathbb { R } } ^ { K \times 2 } \ \bar { | } \ i = 1 , \cdot \cdot \cdot , T \}$ in $j$ -th decoder layer, the dynamic searching query of $( j + 1 )$ -th decoder layer is updated as follows:
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
\begin{array} { r } { Q _ { S } ^ { j + 1 } = \mathbf { M L P } \left( \mathbf { P E } ( Y _ { T } ^ { j } ) \right) . } \end{array}
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
As shown in Figure 3, for each motion query pair, we propose a dynamic map collection module to extract fine-grained trajectory features by querying map features from a trajectory-aligned local region, which is implemented by collecting $L$ polylines whose centers are closest to the predicted trajectory. As the agent’s behavior largely depends on road maps, this local movement refinement strategy enables to continually focus on latest local context information for iterative motion refinement.
|
| 94 |
+
|
| 95 |
+
Attention module with motion query pair. In each decoder layer, static intention query is utilized to propagate information among different motion intentions, while dynamic searching query is utilized to aggregate trajectory-specific features from scene context features. Specifically, we utilize static intention query as the position embedding of self-attention module as follows:
|
| 96 |
+
|
| 97 |
+
$$
|
| 98 |
+
C _ { \mathrm { s a } } ^ { j } = \mathbf { M } \mathbf { u } \mathbf { l } \mathrm { t i } \mathbf { H } \mathrm { e a d } \mathbf { A } \mathrm { t t n } ( \mathbf { q } \mathbf { u } \mathrm { e r } \mathbf { y } = C ^ { j - 1 } + Q _ { I } , \mathbf { k } \mathbf { e y } = C ^ { j - 1 } + Q _ { I } , \mathbf { \ w a l u e } { = } Q _ { I } ) ,
|
| 99 |
+
$$
|
| 100 |
+
|
| 101 |
+
where $C ^ { j - 1 } \in \mathbb { R } ^ { K \times D }$ is query content features from $( j - 1 )$ -th decoder layer, $C ^ { 0 }$ is initialized to zeros, and $C _ { \mathrm { s a } } ^ { j } \in \mathbb { R } ^ { K \times D }$ is the updated query content. Next, we utilize dynamic searching query as query position embedding of cross attention to probe trajectory-specific features from the outputs of encoder. Inspired by [32, 28], we concatenate content features and position embedding for both query and key to decouple their contributions to the attention weights. Two cross-attention modules are adopted separately for aggregating features from both agent features $A$ and map features $M$ as:
|
| 102 |
+
|
| 103 |
+

|
| 104 |
+
Figure 3: The illustration of dynamic map collection module for iterative motion refinement.
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
\begin{array} { r l } & { C _ { A } ^ { j } = \mathbf { M } \mathbf { u } \mathbf { I } \mathrm { i } \mathrm { H e a d } \mathrm { A t t n } ( \mathbf { q } \mathbf { u e r y } { = } [ C _ { \mathrm { s a } } ^ { j } , Q _ { S } ^ { j } ] , ~ \mathbf { k e y } { = } [ A , \mathbf { P } \mathbf { E } _ { A } ] , ~ \mathrm { v a l u e } { = } A ) , } \\ & { C _ { M } ^ { j } = \mathbf { M } \mathbf { u } \mathbf { I } \mathrm { t i } \mathrm { H e a d } \mathrm { A t t n } ( \mathbf { q } \mathbf { u e r y } { = } [ C _ { \mathrm { s a } } ^ { j } , Q _ { S } ^ { j } ] , ~ \mathbf { k e y } { = } [ \alpha ( M ) , \mathbf { P } \mathbf { E } _ { \alpha ( M ) } ] , ~ \mathrm { v a l u e } { = } \alpha ( M ) ) , } \\ & { C ^ { j } = \mathbf { M } \mathbf { L } \mathbf { P } ( [ C _ { A } ^ { j } , C _ { M } ^ { j } ] ) } \end{array}
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
where $[ \cdot , \cdot ]$ indicates feature concatenation, $\alpha ( M )$ is the aforementioned dynamic map collection module to collect $L$ trajectory-aligned map features for motion refinement. Note that for simplicity, in Eq. (6) and (7), we omit the residual connection and feed-forward network in transformer layer [48].
|
| 111 |
+
|
| 112 |
+
Finally, $C ^ { j } \in \mathbb { R } ^ { K \times D }$ is the updated query content features for each motion query pair in $j$ -th layer.
|
| 113 |
+
|
| 114 |
+
Multimodal motion prediction with Gaussian Mixture Model. For each decoder layer, we append a prediction head to $\bar { C } ^ { j }$ for generating future trajectories. As the behaviors of the agents are highly multimodal, we follow [9, 47] to represent the distribution of predicted trajectories with Gaussian Mixture Model (GMM) at each time step. Specifically, for each future time step $i \in \{ 1 , \cdots , T \}$ , we predict the probability $p$ and parameters $( \mu _ { x } , \mu _ { y } , \sigma _ { x } , \sigma _ { y } , \rho )$ of each Gaussian component as follows
|
| 115 |
+
|
| 116 |
+
$$
|
| 117 |
+
Z _ { 1 : T } ^ { j } = \mathbf { M } \mathbf { L } \mathbf { P } ( C ^ { j } ) ,
|
| 118 |
+
$$
|
| 119 |
+
|
| 120 |
+
where $Z _ { i } ^ { j } \in \mathbb { R } ^ { K \times 6 }$ includes $\kappa$ Gaussian components $\mathcal { N } _ { 1 : \mathcal { K } } ( \mu _ { x } , \sigma _ { x } ; \mu _ { y } , \sigma _ { y } ; \rho )$ with probability distribution $p _ { 1 : \mathcal { K } }$ . The predicted distribution of agent’s position at time step $i$ can be formulated as:
|
| 121 |
+
|
| 122 |
+
$$
|
| 123 |
+
P _ { i } ^ { j } ( o ) = \sum _ { k = 1 } ^ { \kappa } p _ { k } \cdot \mathcal N _ { k } ( o _ { x } - \mu _ { x } , \sigma _ { x } ; o _ { y } - \mu _ { y } , \sigma _ { y } ; \rho ) .
|
| 124 |
+
$$
|
| 125 |
+
|
| 126 |
+
where $P _ { i } ^ { j } ( o )$ is the occurrence probability of the agent at spatial position $o \in \mathbb { R } ^ { 2 }$ . The predicted trajectories $Y _ { 1 : T } ^ { j }$ can be generated by simply extracting the predicted centers of Gaussian components.
|
| 127 |
+
|
| 128 |
+
# 3.3 Training Losses
|
| 129 |
+
|
| 130 |
+
Our model is trained end-to-end with two training losses. The first auxiliary loss is $L 1$ regression loss to optimize the outputs of Eq. (3). For the second Gaussian regression loss, we adopt negative loglikelihood loss according to Eq. (9) to maximum the likelihood of ground-truth trajectory. Inspired by [9, 47], we adopt a hard-assignment strategy that selects one closest motion query pair as positive Gaussian component for optimization, where the selection is implemented by calculating the distance between each intention point and the endpoint of GT trajectory. The Gaussian regression loss is adopted in each decoder layer, and the final loss is the sum of the auxiliary regression loss and all the Gaussian regression loss with equal loss weights. Please refer to appendix for more loss details.
|
| 131 |
+
|
| 132 |
+
# 4 Experiments
|
| 133 |
+
|
| 134 |
+
# 4.1 Experimental Setup
|
| 135 |
+
|
| 136 |
+
Dataset and metrics. We evaluate our approach on the large-scale Waymo Open Motion Dataset (WOMD) [14], which mines interesting interactions from real-world traffic scenes and is currently the most diverse interactive motion dataset. There are two tasks in WOMD with separate evaluation metrics: (1) The marginal motion prediction challenge that independently evaluates the predicted motion of each agent (up to 8 agents per scene). (2) The joint motion prediction challenge that needs to predict the joint future positions of 2 interacting agents for evaluation. Both of them provide 1 second of history data and aim to predict 6 marginal or joint trajectories of the agents for 8 seconds into the future. There are totally $4 8 7 k$ training scenes, and about $4 4 k$ validation scenes and $4 4 k$ testing scenes for each challenge. We utilize the official evaluation tool to calculate the evaluation metrics, where the mAP and miss rate are the most important ones as in the official leaderboard[52, 51].
|
| 137 |
+
|
| 138 |
+
Table 1: Performance comparison of marginal motion prediction on the validation and test set of Waymo Open Motion Dataset. $\dagger$ : The results are shown in italic for reference since their performance is achieved with model ensemble techniques. We only evaluate our default setting MTR on the test set by submitting to official test server due to the limitation of submission times of WOMD.
|
| 139 |
+
|
| 140 |
+
<table><tr><td></td><td>Method</td><td>Reference</td><td>minADE↓</td><td>minFDE↓</td><td>Miss Rate↓</td><td>mAP ↑</td></tr><tr><td rowspan="4">Test</td><td>MotionCNN[24] ReCoAt [62]</td><td>CVPRw2021 CVPRw2021</td><td>0.7400 0.7703</td><td>1.4936 1.6668</td><td>0.2091 0.2437</td><td>0.2136 0.2711</td></tr><tr><td>DenseTNT[19]</td><td>ICCV 2021</td><td>1.0387</td><td>1.5514</td><td>0.1573</td><td>0.3281</td></tr><tr><td>SceneTransformer [35]</td><td>ICLR 2022</td><td>0.6117</td><td>1.2116</td><td>0.1564</td><td>0.2788</td></tr><tr><td>MTR (Ours)</td><td>-</td><td>0.6050</td><td>1.2207</td><td>0.1351</td><td>0.4129</td></tr><tr><td rowspan="4">Val</td><td>MultiPath++ [47] +MTR-Advanced-ens (Ours)</td><td>ICRA 2022</td><td>0.5557</td><td>1.1577</td><td>0.1340</td><td>0.4092</td></tr><tr><td></td><td>-</td><td>0.5640</td><td>1.1344</td><td>0.1160</td><td>0.4492</td></tr><tr><td>MTR(Ours) MTR-e2e (Ours)</td><td></td><td>0.6046</td><td>1.2251</td><td>0.1366</td><td>0.4164</td></tr><tr><td></td><td>=</td><td>0.5160</td><td>1.0404</td><td>0.1234</td><td>0.3245</td></tr><tr><td></td><td>MTR-ens (Ours) +MTR-Advanced-ens (Ours)</td><td>=</td><td>0.5686 0.5597</td><td>1.1534 1.1299</td><td>0.1240 0.1167</td><td>0.4323 0.4551</td></tr></table>
|
| 141 |
+
|
| 142 |
+
Table 2: Performance comparison of joint motion prediction on the interactive validation and test set of Waymo Open Motion Dataset.
|
| 143 |
+
|
| 144 |
+
<table><tr><td></td><td>Method</td><td>Reference</td><td>minADE</td><td>minFDE↓</td><td>Miss Rate↓</td><td>mAP ↑</td></tr><tr><td rowspan="5">Test</td><td>Waymo LSTMbaseline [14] HeatIRm4[34]</td><td>ICCV2021 CVPRw2021</td><td>1.9056</td><td>5.0278</td><td>0.7750</td><td>0.0524 0.0844</td></tr><tr><td>AIR² [54]</td><td>CVPRw2021</td><td>1.4197</td><td>3.2595</td><td>0.7224</td><td></td></tr><tr><td></td><td></td><td>1.3165</td><td>2.7138</td><td>0.6230</td><td>0.0963</td></tr><tr><td>SceneTransformer [35]</td><td>ICLR 2022</td><td>0.9774</td><td>2.1892</td><td>0.4942</td><td>0.1192</td></tr><tr><td>M2I [43] MTR (Ours)</td><td>CVPR2022</td><td>1.3506 0.9181</td><td>2.8325</td><td>0.5538</td><td>0.1239</td></tr><tr><td>Val</td><td>MTR (Ours)</td><td></td><td>0.9132</td><td>2.0633 2.0536</td><td>0.4411 0.4372</td><td>0.2037 0.1992</td></tr></table>
|
| 145 |
+
|
| 146 |
+
Implementation details. For the context encoding, we stack 6 transformer encoder layers. The road map is represented as multiple polylines, where each polyline contains up to 20 points (about $1 0 m$ in WOMD). We select $N _ { m } = 7 6 8$ nearest map polylines around the interested agent. The number of neighbors in encoder’s local self-attention is set to 16. The encoder hidden feature dimension is set as $D = 2 5 6$ . For the decoder modules, we stack 6 decoder layers. $L$ is set to 128 to collect the closest map polylines from context encoder for motion refinement. By default, we utilize 64 motion query pairs where their intention points are generated by conducting $\mathbf { k }$ -means clustering algorithm on the training set. To generate 6 future trajectories for evaluation, we use non-maximum suppression (NMS) to select top 6 predictions from 64 predicted trajectories by calculating the distances between their endpoints, and the distance threshold is set as $2 . 5 m$ . Please refer to Appendix for more details.
|
| 147 |
+
|
| 148 |
+
Training details. Our model is trained in an end-to-end manner by AdamW optimizer with a learning rate of 0.0001 and batch size of 80 scenes. We train the model for 30 epochs with 8 GPUs (NVDIA RTX 8000), and the learning rate is decayed by a factor of 0.5 every 2 epochs from epoch 20. The weight decay is set as 0.01 and we do not use any data augmentation.
|
| 149 |
+
|
| 150 |
+
MTR-e2e for end-to-end motion prediction. We also propose an end-to-end variant of MTR, called MTR-e2e, where only 6 motion query pairs are adopted so as to remove NMS post processing. In the training process, instead of using static intention points for target assignment as in MTR, MTR-e2e selects positive mixture component by calculating the distances between its 6 predicted trajectories and the GT trajectory, since 6 intention points are too sparse to well cover all potential future motions.
|
| 151 |
+
|
| 152 |
+
# 4.2 Main Results
|
| 153 |
+
|
| 154 |
+
Performance comparison for marginal motion prediction. Table 1 shows our main results for marginal motion prediction, our MTR outperforms previous ensemble-free approaches [19, 35] with remarkable margins, increasing the mAP by $+ 8 . 4 8 \%$ and decreasing the miss rate from $1 5 . 6 4 \%$ to $1 3 . 5 1 \%$ . In particular, our single-model results of MTR also achieve better mAP than the latest work MultiPath $^ { 1 + + }$ [47], where it uses a novel model ensemble strategy that boosts its performance.
|
| 155 |
+
|
| 156 |
+
Table 3: Effects of different components in MTR framework. All models share the same encoder network. “latent learnable embedding” indicates using 6 latent learnable embeddings as queries of decoder network, and “iterative refinement” indicates using 6 stacked decoders for motion refinement.
|
| 157 |
+
|
| 158 |
+
<table><tr><td>Global Intention Localization</td><td>Iterative Refinement</td><td>Local Movement Dense Future Refinement</td><td>Prediction</td><td></td><td>minADE↓minFDE↓Miss Rate↓mAP ↑</td><td></td><td></td></tr><tr><td>Latent learnable embedding</td><td>×</td><td>×</td><td>×</td><td>0.6829</td><td>1.4841</td><td>0.2128</td><td>0.2633</td></tr><tr><td>Static intention query</td><td>×</td><td>×</td><td>×</td><td>0.7036</td><td>1.4651</td><td>0.1845</td><td>0.3059</td></tr><tr><td>Static intention query</td><td>√</td><td>×</td><td>×</td><td>0.6919</td><td>1.4217</td><td>0.1776</td><td>0.3171</td></tr><tr><td>Static intention query</td><td>√</td><td>√</td><td>×</td><td>0.6833</td><td>1.4059</td><td>0.1756</td><td>0.3234</td></tr><tr><td>Static intention query</td><td>√</td><td>×</td><td>√</td><td>0.6735</td><td>1.3847</td><td>0.1706</td><td>0.3284</td></tr><tr><td>Static intention query</td><td>√</td><td>√</td><td>√</td><td>0.6697</td><td>1.3712</td><td>0.1668</td><td>0.3437</td></tr></table>
|
| 159 |
+
|
| 160 |
+
Table 1 also shows the comparison of MTR variants. MTR-e2e achieves better minADE and minFDE by removing NMS post-processing, while MTR achieves better mAP since it learns explicit meaning of each motion query pair that produces more confident intention predictions. We also propose a simple model ensemble strategy to merge the predictions of MTR and MTR-e2e and utilize NMS to remove redundant predictions (denoted as MTR-ens), and it takes the best of both models and achieves much better mAP. By adopting such ensemble strategy to 7 variants of our framework (e.g., more decoder layers, different number of queries, larger hidden dimension), our advanced ensemble results (denoted as MTR-Advanced-ens) achieve best performance on the test set leaderboard.
|
| 161 |
+
|
| 162 |
+
Performance comparison for joint motion prediction. To evaluate our approach for joint motion prediction, we combine the marginal predictions of two interacting agents into joint prediction as in [6, 14, 43], where we take the top 6 joint predictions from 36 combinations of these two agents. The confidence of each combination is the product of marginal probabilities. Table 2 shows that our approach outperforms state-of-the-arts [35, 43] with large margins on all metrics. Particularly, our MTR boosts the mAP from $1 2 . 3 9 \%$ to $2 0 . 3 7 \%$ and decreases the miss rate from $4 9 . 4 2 \%$ to $4 4 . 1 1 \%$ . The remarkable performance gains demonstrate the effectiveness of MTR for predicting scene-consistent future trajectories. Besides that, we also provide some qualitative results in Figure 5 to show our predictions in complicated interacting scenarios.
|
| 163 |
+
|
| 164 |
+
As of May 19, 2022, our MTR ranks $1 ^ { s t }$ on the motion prediction leaderboard of WOMD for both two challenges [52, 51]. Our approach with more ensembled variants of MTR (i.e., MTR-Advacnedens) also won the champion of Motion Prediction Challenge in Waymo Open Dataset Challenge 2022 [53, 42]. The significant improvements manifest the effectiveness of MTR framework.
|
| 165 |
+
|
| 166 |
+
# 4.3 Ablation Study
|
| 167 |
+
|
| 168 |
+
We study the effectiveness of each component in MTR. For efficiently conducting ablation experiments, we uniformly sampled $2 0 \%$ frames (about $9 7 k$ scenes) from the WOMD training set according to their default order, and we empirically find that it has similar distribution with the full training set. All models are evaluated with marginal motion prediction metric on the validation set of WOMD.
|
| 169 |
+
|
| 170 |
+
Effects of the motion decoder network. We study the effectiveness of each component in our decoder network, including global intention localization, iterative refinement and local movement refinement. Table 3 shows that all components contributes remarkably to the final performance in terms of the official ranking metric mAP. Especially, our proposed static intention queries with intention points achieves much better mAP (i.e., $+ 4 . 2 6 \%$ ) than the latent learnable embeddings thanks to its mode-specific querying strategy, and both the iterative refinement and local movement refinement strategy continually improve the mAP from $3 0 . 5 9 \%$ to $3 2 . 3 4 \%$ by aggregating more fine-grained trajectory features for motion refinement.
|
| 171 |
+
|
| 172 |
+
Effects of dense future prediction. Table 3 shows that our proposed dense future prediction module significantly improves the quality of predicted trajectories (e.g., $+ 1 . 7 8 \%$ mAP), which verifies that future interactions of the agents’ trajectories are important for motion prediction and our proposed strategy can learn such interactions to predict more reliable trajectories.
|
| 173 |
+
|
| 174 |
+

|
| 175 |
+
Figure 4: MTR framework with different number of motion query pairs, and two different colored lines demonstrate different strategies for selecting the positive mixture component during training process.
|
| 176 |
+
|
| 177 |
+
Table 4: Effects of local self-attention in transformer encoder. “#polyline” is the number of input map polylines used for context encoding, and a large number of polylines indicate that there is a larger map context around the interested agent. “OOM” indicates running out of memory.
|
| 178 |
+
|
| 179 |
+
<table><tr><td>Attention #Polyline</td><td></td><td>minADE↓</td><td>minFDE↓</td><td>MR↓mAP↑</td><td></td></tr><tr><td>Global</td><td>256</td><td>0.683</td><td>1.4031</td><td></td><td>0.1717 0.3295</td></tr><tr><td>Global</td><td>512</td><td>0.6783</td><td>1.4018</td><td></td><td>0.1716 0.3280</td></tr><tr><td>Global</td><td>768</td><td>OOM</td><td>OOM</td><td>OOM</td><td>OOM</td></tr><tr><td>Local</td><td>256</td><td>0.6724</td><td>1.3835</td><td></td><td>0.1683 0.3372</td></tr><tr><td>Local</td><td>512</td><td>0.6707</td><td>1.3749</td><td></td><td>0.1670 0.3392</td></tr><tr><td>Local</td><td>768</td><td>0.6697</td><td>1.3712</td><td></td><td>0.1668 0.3437</td></tr><tr><td>Local</td><td>1024</td><td>0.6757</td><td>1.3782</td><td></td><td>0.1663 0.3452</td></tr></table>
|
| 180 |
+
|
| 181 |
+

|
| 182 |
+
Figure 5: Qualitative results of MTR framework on WOMD. There are two interested agents in each scene (green rectangle), where our model predicts 6 multimodal future trajectories for each of them. For other agents (blue rectangle), a single trajectory is predicted by dense future prediction module. We use gradient color to visualize the trajectory waypoints at different future time step, and trajectory confidence is visualized by setting different transparent. Abbreviation: Vehicle (V), Pedestrian $( \mathbf { P } )$ .
|
| 183 |
+
|
| 184 |
+
Effects of local attention for context encoding. Table 4 shows that by taking the same number of map polylines as input, local self-attention in transformer encoder achieves better performance than global attention (i.e., $+ 0 . 7 7 \%$ mAP for 256 polylines and $+ 1 . 1 2 \%$ mAP for 512 polylines), which verifies that the input local structure is important for motion prediction and introducing such prior knowledge with local attention can benefit the performance. More importantly, local attention is more memory-efficient and the performance keeps growing when improving the number of map polylines from 256 to 1,024, while global attention will run out of memory due to its quadratic complexity.
|
| 185 |
+
|
| 186 |
+
Effects of the number of motion query pairs with different training strategies. As mentioned before, during training process, MTR and MTR-e2e adopt two different strategies for assigning positive mixture component, where MTR depends on static intention points (denoted as $\alpha$ ) while MTR-e2e utilizes predicted trajectories (denoted as $\beta$ ). Figure 4 investigates the effects of the number of motion query pairs under these two strategies, where we have the following observations: (1) When increasing the number of motion query pairs, strategy $\alpha$ achieves much better mAP and miss rate than strategy $\beta$ . Because intention query points can ensure more stable training process since each intention query points is responsible to a specific motion mode. In contrast, strategy $\beta$ depends on unstable predictions and the positive component may randomly switch among all components, so a large number of motion query pairs are hard to be optimized with strategy $\beta$ . (2) The explicit meaning of each intention query point also illustrates the reason that strategy $\alpha$ consistently achieves much better mAP than strategy $\beta$ , since it can predict trajectories with more confident scores to benefit mAP metric. (3) From another side, when decreasing the number of motion query pairs, the miss rate of strategy $\alpha$ greatly increases, since a limit number of intention query points can not well cover all potential motions of agents. Conversely, strategy $\beta$ works well for a small number of motion query pairs since its queries are not in charge of specific region and can globally adapt to any region.
|
| 187 |
+
|
| 188 |
+
# 5 Conclusion
|
| 189 |
+
|
| 190 |
+
In this paper, we present MTR, a novel framework for multimodal motion prediction. The motion query pair is defined to model motion prediction as the joint optimization of global intention localization and local movement refinement. The global intention localization adopts a small set of learnable static intention queries to efficiently capture agent’s motion intentions, while the local movement refinement conducts iterative motion refinement by continually probing fine-grained trajectory features. The experiments on both marginal and joint motion prediction challenges of large-scale WOMD dataset show that our approach achieves state-of-the-art performance.
|
| 191 |
+
|
| 192 |
+
Limitations. The proposed framework adopts an agent-centric strategy to predict multimodal future trajectories for one interested agent, leading redundant context encoding for multiple interested agents in the same scene. Hence, how to develop a framework that can simultaneously predict multimodal motion for multiple agents is one important future work. Besides, the rule-based post-processing can result in suboptimal predictions for minADE and minFDE metrics, and how to design a better strategy to produce a required number of future trajectories (e.g., 6 trajectories) from full multimodal predictions (e.g., 64 predictions) is also worth exploring for a more robust framework.
|
| 193 |
+
|
| 194 |
+
# References
|
| 195 |
+
|
| 196 |
+
[1] Alexandre Alahi, Kratarth Goel, Vignesh Ramanathan, Alexandre Robicquet, Li Fei-Fei, and Silvio Savarese. Social lstm: Human trajectory prediction in crowded spaces. In CVPR, 2016.
|
| 197 |
+
[2] Hangbo Bao, Li Dong, and Furu Wei. Beit: Bert pre-training of image transformers. In ICLR, 2022. [3] Yuriy Biktairov, Maxim Stebelev, Irina Rudenko, Oleh Shliazhko, and Boris Yangel. Prank: motion prediction based on ranking. In NeurIPS, 2020.
|
| 198 |
+
[4] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, 2020. [5] Sergio Casas, Cole Gulino, Renjie Liao, and Raquel Urtasun. Spagnn: Spatially-aware graph neural networks for relational behavior forecasting from sensor data. In ICRA, 2020. [6] Sergio Casas, Cole Gulino, Simon Suo, Katie Luo, Renjie Liao, and Raquel Urtasun. Implicit latent variable model for scene-consistent motion forecasting. In ECCV, 2020.
|
| 199 |
+
[7] Sergio Casas, Wenjie Luo, and Raquel Urtasun. Intentnet: Learning to predict intention from raw sensor data. In CoRL, 2018.
|
| 200 |
+
[8] Sergio Casas, Abbas Sadat, and Raquel Urtasun. Mp3: A unified model to map, perceive, predict and plan. In CVPR, 2021.
|
| 201 |
+
[9] Yuning Chai, Benjamin Sapp, Mayank Bansal, and Dragomir Anguelov. Multipath: Multiple probabilistic anchor trajectory hypotheses for behavior prediction. In CoRL, 2019.
|
| 202 |
+
[10] Xuesong Chen, Shaoshuai Shi, Benjin Zhu, Ka Chun Cheung, Hang Xu, and Hongsheng Li. Mppnet: Multi-frame feature intertwining with proxy points for 3d temporal object detection. In ECCV, 2022.
|
| 203 |
+
[11] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In arXiv preprint arXiv:1810.04805, 2018.
|
| 204 |
+
[12] Nemanja Djuric, Vladan Radosavljevic, Henggang Cui, Thi Nguyen, Fang-Chieh Chou, Tsung-Han Lin, Nitin Singh, and Jeff Schneider. Uncertainty-aware short-term motion prediction of traffic actors for autonomous driving. In WACV, 2020.
|
| 205 |
+
[13] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021.
|
| 206 |
+
[14] Scott Ettinger, Shuyang Cheng, Benjamin Caine, Chenxi Liu, Hang Zhao, Sabeek Pradhan, Yuning Chai, Ben Sapp, Charles R Qi, Yin Zhou, et al. Large scale interactive motion forecasting for autonomous driving: The waymo open motion dataset. In ICCV, 2021.
|
| 207 |
+
[15] Liangji Fang, Qinhong Jiang, Jianping Shi, and Bolei Zhou. Tpnet: Trajectory proposal network for motion prediction. In CVPR, 2020.
|
| 208 |
+
[16] Jiyang Gao, Chen Sun, Hang Zhao, Yi Shen, Dragomir Anguelov, Congcong Li, and Cordelia Schmid. Vectornet: Encoding hd maps and agent dynamics from vectorized representation. In CVPR, 2020.
|
| 209 |
+
[17] Thomas Gilles, Stefano Sabatini, Dzmitry Tsishkou, Bogdan Stanciulescu, and Fabien Moutarde. Gohome: Graph-oriented heatmap output for future motion estimation. In arXiv preprint arXiv:2109.01827, 2021.
|
| 210 |
+
[18] Thomas Gilles, Stefano Sabatini, Dzmitry Tsishkou, Bogdan Stanciulescu, and Fabien Moutarde. Home: Heatmap output for future motion estimation. In ITSC, 2021.
|
| 211 |
+
[19] Junru Gu, Chen Sun, and Hang Zhao. Densetnt: End-to-end trajectory prediction from dense goal sets. In ICCV, 2021.
|
| 212 |
+
[20] Agrim Gupta, Justin Johnson, Li Fei-Fei, Silvio Savarese, and Alexandre Alahi. Social gan: Socially acceptable trajectories with generative adversarial networks. In CVPR, 2018.
|
| 213 |
+
[21] Joey Hong, Benjamin Sapp, and James Philbin. Rules of the road: Predicting driving behavior with a convolutional model of semantic interactions. In CVPR, 2019.
|
| 214 |
+
[22] Xiaosong Jia, Penghao Wu, Li Chen, Hongyang Li, Yu Liu, and Junchi Yan. Hdgt: Heterogeneous driving graph transformer for multi-agent trajectory prediction via scene encoding. In arXiv preprint arXiv:2205.09753, 2022.
|
| 215 |
+
[23] Stepan Konev. Mpa: Multipath $^ { + + }$ based architecture for motion prediction. In arXiv preprint arXiv:2206.10041, 2022.
|
| 216 |
+
[24] Stepan Konev, Kirill Brodt, and Artsiom Sanakoyeu. Motioncnn: A strong baseline for motion prediction in autonomous driving. In Workshop on Autonomous Driving, CVPR, 2021.
|
| 217 |
+
[25] Xin Lai, Jianhui Liu, Li Jiang, Liwei Wang, Hengshuang Zhao, Shu Liu, Xiaojuan Qi, and Jiaya Jia. Stratified transformer for 3d point cloud segmentation. In CVPR, 2022.
|
| 218 |
+
[26] Jiachen Li, Fan Yang, Masayoshi Tomizuka, and Chiho Choi. Evolvegraph: Multi-agent trajectory prediction with dynamic relational reasoning. In NeurIPS, 2020.
|
| 219 |
+
[27] Ming Liang, Bin Yang, Rui Hu, Yun Chen, Renjie Liao, Song Feng, and Raquel Urtasun. Learning lane graph representations for motion forecasting. In ECCV, 2020.
|
| 220 |
+
[28] Shilong Liu, Feng Li, Hao Zhang, Xiao Yang, Xianbiao Qi, Hang Su, Jun Zhu, and Lei Zhang. DAB-DETR: Dynamic anchor boxes are better queries for DETR. In ICLR, 2022.
|
| 221 |
+
[29] Yicheng Liu, Jinghuai Zhang, Liangji Fang, Qinhong Jiang, and Bolei Zhou. Multimodal motion prediction with stacked transformers. In CVPR, 2021.
|
| 222 |
+
[30] Karttikeya Mangalam, Harshayu Girase, Shreyas Agarwal, Kuan-Hui Lee, Ehsan Adeli, Jitendra Malik, and Adrien Gaidon. It is not the journey but the destination: Endpoint conditioned trajectory prediction. In ECCV, 2020.
|
| 223 |
+
[31] Francesco Marchetti, Federico Becattini, Lorenzo Seidenari, and Alberto Del Bimbo. Mantra: Memory augmented networks for multiple trajectory prediction. In CVPR, 2020.
|
| 224 |
+
[32] Depu Meng, Xiaokang Chen, Zejia Fan, Gang Zeng, Houqiang Li, Yuhui Yuan, Lei Sun, and Jingdong Wang. Conditional detr for fast training convergence. In ICCV, 2021.
|
| 225 |
+
[33] Jean Mercat, Thomas Gilles, Nicole El Zoghby, Guillaume Sandou, Dominique Beauvois, and Guillermo Pita Gil. Multi-head attention for multi-modal joint vehicle motion forecasting. In ICRA, 2020.
|
| 226 |
+
[34] Xiaoyu Mo, Zhiyu Huang, and Chen Lv. Multi-modal interactive agent trajectory prediction using heterogeneous edge-enhanced graph attention network. In Workshop on Autonomous Driving, CVPR, 2021.
|
| 227 |
+
[35] Jiquan Ngiam, Vijay Vasudevan, Benjamin Caine, Zhengdong Zhang, Hao-Tien Lewis Chiang, Jeffrey Ling, Rebecca Roelofs, Alex Bewley, Chenxi Liu, Ashish Venugopal, et al. Scene transformer: A unified architecture for predicting future trajectories of multiple agents. In ICLR, 2022.
|
| 228 |
+
[36] Seong Hyeon Park, Gyubok Lee, Jimin Seo, Manoj Bhat, Minseok Kang, Jonathan Francis, Ashwin Jadhav, Paul Pu Liang, and Louis-Philippe Morency. Diverse and admissible trajectory forecasting through multimodal context understanding. In ECCV, 2020.
|
| 229 |
+
[37] Tung Phan-Minh, Elena Corina Grigore, Freddy A Boulton, Oscar Beijbom, and Eric M Wolff. Covernet: Multimodal behavior prediction using trajectory sets. In CVPR, 2020.
|
| 230 |
+
[38] Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. In CVPR, 2017.
|
| 231 |
+
[39] Nicholas Rhinehart, Kris M Kitani, and Paul Vernaza. R2p2: A reparameterized pushforward policy for diverse, precise generative path forecasting. In ECCV, 2018.
|
| 232 |
+
[40] Nicholas Rhinehart, Rowan McAllister, Kris Kitani, and Sergey Levine. Precog: Prediction conditioned on goals in visual multi-agent settings. In ICCV, 2019.
|
| 233 |
+
[41] Tim Salzmann, Boris Ivanovic, Punarjay Chakravarty, and Marco Pavone. Trajectron $^ { + + }$ : Dynamicallyfeasible trajectory forecasting with heterogeneous data. In ECCV, 2020.
|
| 234 |
+
[42] Shaoshuai Shi, Li Jiang, Dengxin Dai, and Bernt Schiele. Mtr-a: 1st place solution for 2022 waymo open dataset challenge–motion prediction. arXiv preprint arXiv:2209.10033, 2022.
|
| 235 |
+
[43] Qiao Sun, Xin Huang, Junru Gu, Brian C Williams, and Hang Zhao. M2i: From factored marginal trajectory prediction to interactive prediction. In CVPR, 2022.
|
| 236 |
+
[44] Charlie Tang and Russ R Salakhutdinov. Multiple futures prediction. In NeurIPS, 2019.
|
| 237 |
+
[45] Xiaocheng Tang, Soheil Sadeghi Eshkevari, Haoyu Chen, Weidan Wu, Wei Qian, and Xiaoming Wang. Golfer: Trajectory prediction with masked goal conditioning mnm network. In arXiv preprint arXiv:2207.00738, 2022.
|
| 238 |
+
[46] Ekaterina Tolstaya, Reza Mahjourian, Carlton Downey, Balakrishnan Vadarajan, Benjamin Sapp, and Dragomir Anguelov. Identifying driver interactions via conditional behavior prediction. In ICRA, 2021.
|
| 239 |
+
[47] Balakrishnan Varadarajan, Ahmed Hefny, Avikalp Srivastava, Khaled S Refaat, Nigamaa Nayakanti, Andre Cornman, Kan Chen, Bertrand Douillard, Chi Pang Lam, Dragomir Anguelov, et al. Multipath $^ { + + }$ : Efficient information fusion and trajectory aggregation for behavior prediction. In ICRA, 2022.
|
| 240 |
+
[48] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, 2017.
|
| 241 |
+
[49] Jiashun Wang, Huazhe Xu, Medhini Narasimhan, and Xiaolong Wang. Multi-person 3d motion prediction with multi-range transformers. In NeurIPS, 2021.
|
| 242 |
+
[50] Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In CVPR, 2018.
|
| 243 |
+
[51] Waymo. Waymo open dataset interaction prediction challenge 2021. https://waymo.com/open/ challenges/2021/interaction-prediction/, 2021. Accessed: 2022-05-19.
|
| 244 |
+
[52] Waymo. Waymo open dataset motion prediction challenge 2021. https://waymo.com/open/ challenges/2021/motion-prediction, 2021. Accessed: 2022-05-19.
|
| 245 |
+
[53] Waymo. Waymo open dataset motion prediction challenge 2022. https://waymo.com/open/ challenges/2022/motion-prediction/, 2022. Accessed: 2022-09-21.
|
| 246 |
+
[54] David Wu and Yunnan Wu. Air2 for interaction prediction. In Workshop on Autonomous Driving, CVPR, 2021.
|
| 247 |
+
[55] Yi Xu, Dongchun Ren, Mingxia Li, Yuehai Chen, Mingyu Fan, and Huaxia Xia. Tra2tra: Trajectory-totrajectory prediction with a global social spatial-temporal attentive neural network. In RA-L, 2021.
|
| 248 |
+
[56] Zetong Yang, Li Jiang, Yanan Sun, Bernt Schiele, and Jiaya Jia. A unified query-based paradigm for point cloud understanding. In CVPR, 2022.
|
| 249 |
+
[57] Maosheng Ye, Tongyi Cao, and Qifeng Chen. Tpcn: Temporal point cloud networks for motion forecasting. In CVPR, 2021.
|
| 250 |
+
[58] Fangao Zeng, Bin Dong, Tiancai Wang, Xiangyu Zhang, and Yichen Wei. Motr: End-to-end multiple-object tracking with transformer. In arXiv preprint arXiv:2105.03247, 2021.
|
| 251 |
+
[59] Hao Zhang, Feng Li, Shilong Liu, Lei Zhang, Hang Su, Jun Zhu, Lionel M Ni, and Heung-Yeung Shum. Dino: Detr with improved denoising anchor boxes for end-to-end object detection. In arXiv preprint arXiv:2203.03605, 2022.
|
| 252 |
+
[60] Yifan Zhang, Jinghuai Zhang, Jindi Zhang, Jianping Wang, Kejie Lu, and Jeff Hong. A novel learning framework for sampling-based motion planning in autonomous driving. In AAAI, 2020.
|
| 253 |
+
[61] Hang Zhao, Jiyang Gao, Tian Lan, Chen Sun, Benjamin Sapp, Balakrishnan Varadarajan, Yue Shen, Yi Shen, Yuning Chai, Cordelia Schmid, et al. Tnt: Target-driven trajectory prediction. In CoRL, 2020.
|
| 254 |
+
[62] Chen Lv Zhiyu Huang, Xiaoyu Mo. Recoat: A deep learning framework with attention mechanism for multi-modal motion prediction. In Workshop on Autonomous Driving, CVPR, 2021.
|
| 255 |
+
[63] Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. In ICLR, 2021.
|
| 256 |
+
[64] Yanliang Zhu, Deheng Qian, Dongchun Ren, and Huaxia Xia. Starnet: Pedestrian trajectory prediction using deep neural network in star topology. In IROS, 2019.
|
| 257 |
+
|
| 258 |
+
# Checklist
|
| 259 |
+
|
| 260 |
+
1. For all authors...
|
| 261 |
+
|
| 262 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 263 |
+
(b) Did you describe the limitations of your work? [Yes] See Section 5.
|
| 264 |
+
(c) Did you discuss any potential negative societal impacts of your work? [No] Our work is only for academic research purpose.
|
| 265 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 266 |
+
|
| 267 |
+
2. If you are including theoretical results...
|
| 268 |
+
|
| 269 |
+
(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
|
| 270 |
+
|
| 271 |
+
3. If you ran experiments...
|
| 272 |
+
|
| 273 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Our implementation details are posted on Section 4.1 and the supplemental materials. The data is public dataset and our code will be available.
|
| 274 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 4.1 for training details, and the data splits of ablation experiments are mentioned in Section 4.3.
|
| 275 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We use fixed random seed.
|
| 276 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Section 4.1.
|
| 277 |
+
|
| 278 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 279 |
+
|
| 280 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] See our reference.
|
| 281 |
+
(b) Did you mention the license of the assets? [No] They are publicly available for academic use.
|
| 282 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 283 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes] They are publicly available for academic use.
|
| 284 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] We only use the public dataset.
|
| 285 |
+
|
| 286 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 287 |
+
|
| 288 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 289 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 290 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/GAUwreODU5L/GAUwreODU5L.md
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GET3D: A Generative Model of High Quality 3D Textured Shapes Learned from Images
|
| 2 |
+
|
| 3 |
+
Jun Gao1,2,3 Tianchang Shen1,2,3 Zian Wang1,2,3 Wenzheng Chen1,2,3
|
| 4 |
+
Kangxue Yin1 Daiqing Li1 Or Litany1 Zan Gojcic1 Sanja Fidler1,2,3
|
| 5 |
+
|
| 6 |
+
NVIDIA1 University of Toronto2 Vector Institute3
|
| 7 |
+
|
| 8 |
+
{jung, frshen, zianw, wenzchen, kangxuey, daiqingl, olitany, zgojcic, sfidler}@nvidia.com
|
| 9 |
+
|
| 10 |
+
# Abstract
|
| 11 |
+
|
| 12 |
+
As several industries are moving towards modeling massive 3D virtual worlds, the need for content creation tools that can scale in terms of the quantity, quality, and diversity of 3D content is becoming evident. In our work, we aim to train performant 3D generative models that synthesize textured meshes that can be directly consumed by 3D rendering engines, thus immediately usable in downstream applications. Prior works on 3D generative modeling either lack geometric details, are limited in the mesh topology they can produce, typically do not support textures, or utilize neural renderers in the synthesis process, which makes their use in common 3D software non-trivial. In this work, we introduce GET3D, a Generative model that directly generates Explicit Textured 3D meshes with complex topology, rich geometric details, and high fidelity textures. We bridge recent success in the differentiable surface modeling, differentiable rendering as well as 2D Generative Adversarial Networks to train our model from 2D image collections. GET3D is able to generate high-quality 3D textured meshes, ranging from cars, chairs, animals, motorbikes and human characters to buildings, achieving significant improvements over previous methods. Our project page: https://nv-tlabs.github.io/GET3D
|
| 13 |
+
|
| 14 |
+
# 1 Introduction
|
| 15 |
+
|
| 16 |
+
Diverse, high-quality 3D content is becoming increasingly important for several industries, including gaming, robotics, architecture, and social platforms. However, manual creation of 3D assets is very time-consuming and requires specific technical knowledge as well as artistic modeling skills. One of the main challenges is thus scale – while one can find 3D models on 3D marketplaces such as Turbosquid [4] or Sketchfab [3], creating many 3D models to, say, populate a game or a movie with a crowd of characters that all look different still takes a significant amount of artist time.
|
| 17 |
+
|
| 18 |
+
To facilitate the content creation process and make it accessible to a variety of (novice) users, generative 3D networks that can produce high-quality and diverse 3D assets have recently become an active area of research [5, 13, 38, 41, 48, 59, 62, 55, 54, 60, 21]. However, to be practically useful for current real-world applications, 3D generative models should ideally fulfill the following requirements: (a) They should have the capacity to generate shapes with detailed geometry and arbitrary topology, (b) The output should be a textured mesh, which is a primary representation used by standard graphics software packages such as Blender [14] and Maya [1], and (c) We should be able to leverage 2D images for supervision, as they are more widely available than explicit 3D shapes.
|
| 19 |
+
|
| 20 |
+
Prior work on 3D generative modeling has focused on subsets of the above requirements, but no method to date fulfills all of them (Tab. 1). For example, methods that generate 3D point clouds [5,
|
| 21 |
+
|
| 22 |
+
Table 1: Comparison with prior works. (NV: Novel view synthesis.)
|
| 23 |
+
|
| 24 |
+
<table><tr><td>Method</td><td>Application</td><td>Representation</td><td>Supervision</td><td>Textured mesh</td><td>Arbitrary topology</td></tr><tr><td>OccNet [38]</td><td>3D generation</td><td>Implicit</td><td>3D</td><td>X</td><td>√</td></tr><tr><td>PointFlow [59]</td><td>3D generation</td><td>Point cloud</td><td>3D</td><td>X</td><td>√</td></tr><tr><td>Texture3D[48]</td><td>3D generation</td><td>Mesh</td><td>2D</td><td>√</td><td>×</td></tr><tr><td>StyleNerf [23]</td><td>3D-aware NV</td><td>Neural field</td><td>2D</td><td>X</td><td>√</td></tr><tr><td>EG3D[8]</td><td>3D-aware NV</td><td>Neural field</td><td>2D</td><td>X</td><td>√</td></tr><tr><td>PiGAN[7]</td><td>3D-aware NV</td><td>Neural field</td><td>2D</td><td>X</td><td>√</td></tr><tr><td>GRAF [52]</td><td>3D-aware NV</td><td>Neural field</td><td>2D</td><td>X</td><td>√</td></tr><tr><td>Ours</td><td>3D generation</td><td>Mesh</td><td>2D</td><td>√</td><td>√</td></tr></table>
|
| 25 |
+
|
| 26 |
+
59, 62] typically do not produce textures and have to be converted to a mesh in post-processing. Methods generating voxels often lack geometric details and do not produce texture [57, 18, 25, 35]. Generative models based on neural fields [38, 13] focus on extracting geometry but disregard texture. Most of these also require explicit 3D supervision. Finally, methods that directly output textured 3D meshes [49, 48] typically require pre-defined shape templates and cannot generate shapes with complex topology and variable genus.
|
| 27 |
+
|
| 28 |
+
Recently, rapid progress in neural volume rendering [40] and 2D Generative Adversarial Networks (GANs) [31, 32, 30, 27, 47] has led to the rise of 3D-aware image synthesis [7, 52, 8, 44, 46, 23]. However, this line of work aims to synthesize multi-view consistent images using neural rendering in the synthesis process and does not guarantee that meaningful 3D shapes can be generated. While a mesh can potentially be obtained from the underlying neural field representation using the marching cube algorithm [34], extracting the corresponding texture is non-trivial.
|
| 29 |
+
|
| 30 |
+
In this work, we introduce a novel approach that aims to tackle all the requirements of a practically useful 3D generative model. Specifically, we propose GET3D, a Generative model for 3D shapes that directly outputs Explicit Textured 3D meshes with high geometric and texture detail and arbitrary mesh topology. In the heart of our approach is a generative process that utilizes a differentiable explicit surface extraction method [55] and a differentiable rendering technique [42, 33]. The former enables us to directly optimize and output textured 3D meshes with arbitrary topology, while the latter allows us to train our model with 2D images, thus leveraging powerful and mature discriminators developed for 2D image synthesis. Since our model directly generates meshes and uses a highly efficient (differentiable) graphics renderer, we can easily scale up our model to train with image resolution as high as $1 0 2 4 \times 1 0 2 4$ , allowing us to learn high-quality geometric and texture details.
|
| 31 |
+
|
| 32 |
+
We demonstrate state-of-the-art performance for unconditional 3D shape generation on multiple categories with complex geometry from ShapeNet [9], Turbosquid [4] and Renderpeople [2], such as chairs, motorbikes, cars, human characters, and buildings. With explicit mesh as output representation, GET3D is also very flexible and can easily be adapted to other tasks, including: (a) learning to generate decomposed material and view-dependent lighting effects using advanced differentiable rendering [12], without supervision, (b) text-guided 3D shape generation using CLIP [51] embedding.
|
| 33 |
+
|
| 34 |
+
# 2 Related Work
|
| 35 |
+
|
| 36 |
+
We review recent advances in 3D generative models for geometry and appearance, as well as 3D-aware generative image synthesis.
|
| 37 |
+
|
| 38 |
+
3D Generative Models In recent years, 2D generative models have achieved photorealistic quality in high-resolution image synthesis [31, 32, 30, 47, 27, 17, 15]. This progress has also inspired research in 3D content generation. Early approaches aimed to directly extend the 2D CNN generators to 3D voxel grids [57, 18, 25, 35, 56], but the high memory footprint and computational complexity of 3D convolutions hinder the generation process at high resolution. As an alternative, other works have explored point cloud [5, 59, 62, 41], implicit [38, 13], or octree [28] representations. However, these works focus mainly on generating geometry and disregard appearance. Their output representations also need to be post-processed to make them compatible with standard graphics engines.
|
| 39 |
+
|
| 40 |
+
More similar to our work, Textured3DGAN [49, 48] and DIBR [11] generate textured 3D meshes, but they formulate the generation as a deformation of a template mesh, which prevents them from generating complex topology or shapes with varying genus, which our method can do. PolyGen [43] and SurfGen [36] can produce meshes with arbitrary topology, but do not synthesize textures.
|
| 41 |
+
|
| 42 |
+

|
| 43 |
+
Figure 1: We export our generated shapes and visualize them in Blender. GET3D is able to generate diverse shapes with arbitrary topology, high quality geometry, and texture.
|
| 44 |
+
|
| 45 |
+
3D-Aware Generative Image Synthesis Inspired by the success of neural volume rendering [40] and implicit representations [38, 13], recent work started tackling the problem of 3D-aware image synthesis [7, 52, 44, 24, 23, 63, 8, 46, 53, 58]. However, neural volume rendering networks are typically slow to query, leading to long training times [7, 52], and generate images of limited resolution. GIRAFFE [44] and StyleNerf [23] improve the training and rendering efficiency by performing neural rendering at a lower resolution and then upsampling the results with a 2D CNN. However, the performance gain comes at the cost of a reduced multi-view consistency. By utilizing a dual discriminator, EG3D [8] can partially mitigate this problem. Nevertheless, extracting a textured surface from methods that are based on neural rendering is a non-trivial endeavor. In contrast, GET3D directly outputs textured 3D meshes that can be readily used in standard graphics engines.
|
| 46 |
+
|
| 47 |
+
# 3 Method
|
| 48 |
+
|
| 49 |
+
We now present our GET3D framework for synthesizing textured 3D shapes. Our generation process is split into two parts: a geometry branch, which differentiably outputs a surface mesh of arbitrary topology, and a texture branch that produces a texture field that can be queried at the surface points to produce colors. The latter can be extended to other surface properties such as for example materials (Sec. 4.3.1). During training, an efficient differentiable rasterizer is utilized to render the resulting textured mesh into 2D high-resolution images. The entire process is differentiable, allowing for adversarial training from images (with masks indicating an object of interest) by propagating the gradients from the 2D discriminator to both generator branches. Our model is illustrated in Fig. 2. In the following, we first introduce our 3D generator in Sec 3.1, before proceeding to the differentiable rendering and loss functions in Sec 3.2.
|
| 50 |
+
|
| 51 |
+
# 3.1 Generative Model of 3D Textured Meshes
|
| 52 |
+
|
| 53 |
+
We aim to learn a 3D generator $M , E = G ( \mathbf { z } )$ to map a sample from a Gaussian distribution $\mathbf { z } \in \mathcal { N } ( 0 , \mathbf { I } )$ to a mesh $M$ with texture $E$ .
|
| 54 |
+
|
| 55 |
+
Since the same geometry can have different textures, and the same texture can be applied to different geometries, we sample two random input vectors $\mathbf { z } _ { 1 } \in \mathbb { R } ^ { 5 1 2 }$ and $\mathbf { z } _ { 2 } \in \mathbb { R } ^ { 5 1 2 }$ . Following StyleGAN [31, 32, 30], we then use non-linear mapping networks $f _ { \mathrm { g e o } }$ and $f _ { \mathrm { t e x } }$ to map $\mathbf { z } _ { 1 }$ and $\mathbf { z } _ { 2 }$ to intermediate latent vectors $\mathbf { w } _ { 1 } = f _ { \mathrm { g e o } } ( \mathbf { z } _ { 1 } )$ and ${ \bf w } _ { 2 } = f _ { \mathrm { t e x } } ( { \bf z } _ { 2 } )$ which are further used to produce styles that control the generation of 3D shapes and texture, respectively. We formally introduce the generator for geometry in Sec. 3.1.1 and the texture generator in Sec. 3.1.2.
|
| 56 |
+
|
| 57 |
+

|
| 58 |
+
Figure 2: Overview of GET3D: We generate a 3D SDF and a texture field via two latent codes. We utilize DMTet [55] to extract a 3D surface mesh from the SDF, and query the texture field at surface points to get colors. We train with adversarial losses defined on 2D images. In particular, we use a rasterization-based differentiable renderer [33] to obtain RGB images and silhouettes. We utilize two 2D discriminators, each on RGB image, and silhouette, respectively, to classify whether the inputs are real or fake. The whole model is end-to-end trainable. Note that we additionally provide an improved version of our Generator in Appendix Sec. A.5 and Fig. C.
|
| 59 |
+
|
| 60 |
+
# 3.1.1 Geometry Generator
|
| 61 |
+
|
| 62 |
+
We design our geometry generator to incorporate DMTet [55], a recently proposed differentiable surface representation. DMTet represents geometry as a signed distance field (SDF) defined on a deformable tetrahedral grid [20, 22], from which the surface can be differentiably recovered through marching tetrahedra [16]. Deforming the grid by moving its vertices results in a better utilization of its resolution. By adopting DMTet for surface extraction, we can produce explicit meshes with arbitrary topology and genus. We next provide a brief summary of DMTet and refer the reader to the original paper for further details.
|
| 63 |
+
|
| 64 |
+
Let $( V _ { T } , T )$ denote the full 3D space that the object lies in, where $V _ { T }$ are the vertices in the tetrahedral grid $T$ . Each tetrahedron $T _ { k } \in T$ is defined using four vertices $\left\{ \mathbf { v } _ { a _ { k } } , \mathbf { v } _ { b _ { k } } , \mathbf { v } _ { \underline { { c } } _ { k } } , \mathbf { v } _ { d _ { k } } \right\}$ , with $k \in$ $\{ 1 , \ldots , K \}$ , where $K$ is the total number of tetrahedra, and $\mathbf { v } _ { i _ { k } } \in V _ { T } , \mathbf { v } _ { i _ { k } } \in \mathbb { R } ^ { 3 }$ . In addition to its 3D coordinates, each vertex $\mathbf { v } _ { i }$ contains the SDF value $s _ { i } \in \mathbb { R }$ and the deformation $\Delta \mathbf { v } _ { i } \in \mathbb { R } ^ { 3 }$ of the vertex from its initial canonical coordinate. This representation allows recovering the explicit mesh through differentiable marching tetrahedra [55], where SDF values in continuous space are computed by a barycentric interpolation of their value $s _ { i }$ on the deformed vertices $\mathbf { v } _ { i } ^ { \prime } = \mathbf { v } _ { i } + \Delta \mathbf { v } _ { i }$ .
|
| 65 |
+
|
| 66 |
+
Network Architecture We map $\mathbf { w } _ { 1 } \in \mathbb { R } ^ { 5 1 2 }$ to SDF values and deformations at each vertex $\mathbf { v } _ { i }$ through a series of conditional 3D convolutional and fully connected layers. Specifically, we first use 3D convolutional layers to generate a feature volume conditioned on $\mathbf { w } _ { 1 }$ . We then query the feature at each vertex $\mathbf { v } _ { i } \in V _ { T }$ using trilinear interpolation and feed it into MLPs that outputs the SDF value $s _ { i }$ and the deformation $\Delta \mathbf { v } _ { i }$ . In cases where modeling at a high-resolution is required (e.g. motorbike with thin structures in the wheels), we further use volume subdivision following [55].
|
| 67 |
+
|
| 68 |
+
Differentiable Mesh Extraction After obtaining $s _ { i }$ and $\Delta { \bf v } _ { i }$ for all the vertices, we use the differentiable marching tetrahedra algorithm to extract the explicit mesh. Marching tetrahedra determines the surface topology within each tetrahedron based on the signs of $s _ { i }$ . In particular, a mesh face is extracted when $\mathrm { s i g n } ( s _ { i } ) \neq \mathrm { s i g n } ( s _ { j } )$ , where $i , j$ denotes the indices of vertices in the edge of tetrahedron, and the vertices $\mathbf { m } _ { i , j }$ of that face are determined by a linear interpolation as $\begin{array} { r } { \mathbf { m } _ { i , j } \ = \ \frac { \mathbf { v } _ { i } ^ { \prime } s _ { j } - \mathbf { v } _ { j } ^ { \prime } s _ { i } } { s _ { j } - s _ { i } } } \end{array}$ . Note that the above equation is only evaluated when $s _ { i } \neq s _ { j }$ , thus it is differentiable, and the gradient from $\mathbf { m } _ { i , j }$ can be back-propagated into the SDF values $s _ { i }$ and deformations $\Delta { \bf v } _ { i }$ . With this representation, the shapes with arbitrary topology can easily be generated by predicting different signs of $s _ { i }$ .
|
| 69 |
+
|
| 70 |
+
# 3.1.2 Texture Generator
|
| 71 |
+
|
| 72 |
+
Directly generating a texture map consistent with the output mesh is not trivial, as the generated shape can have an arbitrary genus and topology. We thus parameterize the texture as a texture field [45].
|
| 73 |
+
|
| 74 |
+
Specifically, we model the texture field with a function $f _ { t }$ that maps the 3D location of a surface point $ { \mathbf { p } } \in \mathbb { R } ^ { 3 }$ , conditioned on the $\mathbf { w } _ { 2 }$ , to the RGB color $\mathbf { c } \in \mathbb { R } ^ { 3 }$ at that location. Since the texture field depends on geometry, we additionally condition this mapping on the geometry latent code $\mathbf { w } _ { 1 }$ , such that $\mathbf { c } = f _ { t } ( \mathbf { p } , \mathbf { w } _ { 1 } \oplus \mathbf { w } _ { 2 } )$ , where $\oplus$ denotes concatenation.
|
| 75 |
+
|
| 76 |
+
Network Architecture We represent our texture field using a tri-plane representation, which is efficient and expressive in reconstructing 3D objects [50] and generating 3D-aware images [8] . Specifically, we follow [8, 32] and use a conditional 2D convolutional neural network to map the latent code $\mathbf { w } _ { 1 } \oplus \mathbf { w } _ { 2 }$ to three axis-aligned orthogonal feature planes of size $N \times N \times ( C \times 3 )$ , where $N = 2 5 6$ denotes the spatial resolution and $C = 3 2$ the number of channels.
|
| 77 |
+
|
| 78 |
+
Given the feature planes, the feature vector $\mathbf { f } ^ { t } \in \mathbb { R } ^ { 3 2 }$ of a surface point $\mathbf { p }$ can be recovered as $\begin{array} { r } { \mathbf { f } ^ { t } = \sum _ { e } \rho ( \pi _ { e } ( \mathbf { p } ) ) } \end{array}$ , where $\pi _ { e } ( \mathbf { p } )$ is the projection of the point $\mathbf { p }$ to the feature plane $e$ and $\rho ( \cdot )$ denotes bilinear interpolation of the features. An additional fully connected layer is then used to map the aggregated feature vector $\mathbf { f } ^ { t }$ to the RGB color c. Note that, different from other works on 3D-aware image synthesis [8, 23, 7, 52] that also use a neural field representation, we only need to sample the texture field at the locations of the surface points (as opposed to dense samples along a ray). This greatly reduces the computational complexity for rendering high-resolution images and guarantees to generate multi-view consistent images by construction.
|
| 79 |
+
|
| 80 |
+
# 3.2 Differentiable Rendering and Training
|
| 81 |
+
|
| 82 |
+
In order to supervise our model during training, we draw inspiration from Nvdiffrec [42] that performs multi-view 3D object reconstruction by utilizing a differentiable renderer. Specifically, we render the extracted 3D mesh and the texture field into 2D images using a differentiable renderer [33], and supervise our network with a 2D discriminator, which tries to distinguish the image from a real object or rendered from the generated object.
|
| 83 |
+
|
| 84 |
+
Differentiable Rendering We assume that the camera distribution $\mathcal { C }$ that was used to acquire the images in the dataset is known. To render the generated shapes, we randomly sample a camera $c$ from $\mathcal { C }$ , and utilize a highly-optimized differentiable rasterizer Nvdiffrast [33] to render the 3D mesh into a 2D silhouette as well as an image where each pixel contains the coordinates of the corresponding 3D point on the mesh surface. These coordinates are further used to query the texture field to obtain the RGB values. Since we operate directly on the extracted mesh, we can render high-resolution images with high efficiency, allowing our model to be trained with image resolution as high as $1 0 2 4 \times 1 0 2 4$ .
|
| 85 |
+
|
| 86 |
+
Discriminator & Objective We train our model using an adversarial objective. We adopt the discriminator architecture from StyleGAN [31], and use the same non-saturating GAN objective with R1 regularization [37]. We empirically find that using two separate discriminators, one for RGB images and another one for silhouettes, yields better results than a single discriminator operating on both. Let $D _ { x }$ denote the discriminator, where $x$ can either be an RGB image or a silhouette. The adversarial objective is then be defined as follows:
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\begin{array} { r } { L ( D _ { x } , G ) = \mathbb { E } _ { \mathbf { z } \in N , c \in \mathcal { C } } [ g ( D _ { x } ( R ( G ( \mathbf { z } ) , c ) ) ) ] + \mathbb { E } _ { I _ { x } \in p _ { x } } [ g ( - D _ { x } ( I _ { x } ) ) + \lambda | | \nabla D _ { x } ( I _ { x } ) | | _ { 2 } ^ { 2 } ] , } \end{array}
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
where $g ( u )$ is defined as $g ( u ) = - \log ( 1 + \exp ( - u ) )$ , $p _ { x }$ is the distribution of real images, $R$ denotes rendering, and $\lambda$ is a hyperparameter. Since $R$ is differentiable, the gradients can be backpropagated from 2D images to our 3D generators.
|
| 93 |
+
|
| 94 |
+
Regularization To remove internal floating faces that are not visible in any of the views, we further regularize the geometry generator with a cross-entropy loss defined between the SDF values of the neighboring vertices [42]:
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
L _ { \mathrm { r e g } } = \sum _ { i , j \in \mathbb { S } _ { e } } H \left( \sigma ( s _ { i } ) , \mathrm { s i g n } \left( s _ { j } \right) \right) + H \left( \sigma ( s _ { j } ) , \mathrm { s i g n } \left( s _ { i } \right) \right) ,
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
where $H$ denotes binary cross-entropy loss and $\sigma$ denotes the sigmoid function. The sum in Eq. 2 is defined over the set of unique edges $\mathbb { S } _ { e }$ in the tetrahedral grid, for which $\mathrm { s i g n } ( s _ { i } ) \neq \mathrm { s i g n } ( s _ { j } )$ .
|
| 101 |
+
|
| 102 |
+
The overall loss function is then defined as:
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
L = L ( D _ { \mathrm { r g b } } , G ) + L ( D _ { \mathrm { m a s k } } , G ) + \mu L _ { \mathrm { r e g } } ,
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
where $\mu$ is a hyperparameter that controls the level of regularization.
|
| 109 |
+
|
| 110 |
+
<table><tr><td rowspan="2">Category</td><td rowspan="2">Method</td><td colspan="2">COV (%,↑)</td><td colspan="2">MMD (↓)</td><td colspan="2">FID (↓)</td></tr><tr><td>LFD</td><td>CD</td><td>LFD</td><td>CD</td><td>Ori</td><td>3D</td></tr><tr><td rowspan="9">Car</td><td>PointFlow [59]</td><td>51.91</td><td>57.16</td><td>1971</td><td>0.82</td><td>-</td><td>,</td></tr><tr><td>OccNet [38]</td><td>27.29</td><td>42.63</td><td>1717</td><td>0.61</td><td>-</td><td>,</td></tr><tr><td>Pi-GAN [7]</td><td>0.82</td><td>0.55</td><td>6626</td><td>25.54</td><td>52.82</td><td>104.29</td></tr><tr><td>GRAF [52]</td><td>1.57</td><td>1.57</td><td>6012</td><td>10.63</td><td>49.95</td><td>52.85</td></tr><tr><td>EG3D [8]</td><td>60.16</td><td>49.52</td><td>1527</td><td>0.72</td><td>15.52</td><td>21.89</td></tr><tr><td>Ours</td><td>66.78</td><td>58.39</td><td>1491</td><td>0.71</td><td>10.25</td><td>10.25</td></tr><tr><td>Ours+Subdiv.</td><td>62.48</td><td>55.93</td><td>1553</td><td>0.72</td><td>12.14</td><td>12.14</td></tr><tr><td>Ours (improved G)</td><td>59.00</td><td>47.95</td><td>1473</td><td>0.81</td><td>10.60</td><td>10.60</td></tr><tr><td>PointFlow [59]</td><td>49.58</td><td>71.87</td><td>3755</td><td>3.03</td><td>-</td><td>-</td></tr><tr><td rowspan="7">Chair</td><td>OccNet [38]</td><td>61.10</td><td>67.13</td><td>3494</td><td>3.98</td><td></td><td>1</td></tr><tr><td>Pi-GAN [7]</td><td>53.76</td><td>39.65</td><td>4092</td><td>6.65</td><td>65.70</td><td>120.53</td></tr><tr><td>GRAF [52]</td><td>50.23</td><td>39.28</td><td>4055</td><td>6.80</td><td>43.82</td><td>61.63</td></tr><tr><td>EG3D [8]</td><td>58.31</td><td>50.14</td><td>3444</td><td>4.72</td><td>38.87</td><td>46.06</td></tr><tr><td>Ours</td><td>69.08</td><td>69.91</td><td>3167</td><td>3.72</td><td>23.28</td><td>23.28</td></tr><tr><td>Ours+Subdiv.</td><td>71.59</td><td>70.84</td><td>3163</td><td>3.95</td><td>23.17</td><td>23.17</td></tr><tr><td>Ours (improved G)</td><td>71.96</td><td>71.96</td><td>3125</td><td>3.96</td><td>22.41</td><td>22.41</td></tr></table>
|
| 111 |
+
|
| 112 |
+
<table><tr><td rowspan="2">Category</td><td rowspan="2">Method</td><td colspan="2">COV (%,↑)</td><td colspan="2">MMD (↓)</td><td colspan="2">FID (↓)</td></tr><tr><td>LFD</td><td>CD</td><td>LFD</td><td>CD</td><td>Ori</td><td>3D</td></tr><tr><td rowspan="9">Mbike</td><td>PointFlow [59]</td><td>50.68</td><td>63.01</td><td>4023</td><td>1.38</td><td>-</td><td>-</td></tr><tr><td>OccNet [38]</td><td>30.14</td><td>47.95</td><td>4551</td><td>2.04</td><td>-</td><td>-</td></tr><tr><td>Pi-GAN [7]</td><td>2.74</td><td>6.85</td><td>8864</td><td>21.08</td><td>72.67</td><td>131.38</td></tr><tr><td>GRAF [52]</td><td>43.84</td><td>50.68</td><td>4528</td><td>2.40</td><td>83.20</td><td>113.39</td></tr><tr><td>EG3D [8]</td><td>38.36</td><td>34.25</td><td>4199</td><td>2.21</td><td>66.38</td><td>89.97</td></tr><tr><td>Ours</td><td>67.12</td><td>67.12</td><td>3631</td><td>1.72</td><td>65.60</td><td>65.60</td></tr><tr><td>Ours+Subdiv.</td><td>63.01</td><td>61.64</td><td>3440</td><td>1.79</td><td>54.12</td><td>54.12</td></tr><tr><td>Ours (improved G)</td><td>69.86</td><td>65.75</td><td>3393</td><td>1.79</td><td>48.90</td><td>48.90</td></tr><tr><td>PointFlow [59]</td><td>42.70</td><td>74.16</td><td>4885</td><td>1.68</td><td>-</td><td>1</td></tr><tr><td rowspan="7">Animal</td><td>OccNet[38]</td><td>56.18</td><td>75.28</td><td>4418</td><td>2.39</td><td></td><td>-</td></tr><tr><td>Pi-GAN [7]</td><td>31.46</td><td>30.34</td><td>6084</td><td>8.37</td><td>36.26</td><td>150.86</td></tr><tr><td>GRAF [52]</td><td>60.67</td><td>61.80</td><td>5083</td><td>4.81</td><td>42.07</td><td>52.48</td></tr><tr><td>EG3D [8]</td><td>74.16</td><td>58.43</td><td>4889</td><td>3.42</td><td>40.03</td><td>83.47</td></tr><tr><td>Ours</td><td>79.77</td><td>78.65</td><td>3798</td><td>2.02</td><td>28.33</td><td>28.33</td></tr><tr><td>Ours+Subdiv.</td><td>66.29</td><td>74.16</td><td>3864</td><td>2.03</td><td>28.49</td><td>28.49</td></tr><tr><td>Ours (improved G)</td><td>74.16</td><td>82.02</td><td>3767</td><td>1.97</td><td>27.18</td><td>27.18</td></tr></table>
|
| 113 |
+
|
| 114 |
+

|
| 115 |
+
Table 2: Quantitative evaluation of generation results: ↑: the higher the better, $\downarrow$ : the lower the better. The best scores are highlighted in bold. MMD-CD scores are multiplied by $1 0 ^ { 3 }$ . The results of Ours (improved $G$ ) were obtained after the review process by improving the design of the generator network architecture $G$ (see Appendix A.5 for more details).
|
| 116 |
+
Figure 3: Qualitative comparison of GET3D to the baseline methods in terms of extracted 3D geometry. GET3D is able to generate shapes with much higher geometric detail across all categories.
|
| 117 |
+
|
| 118 |
+
# 4 Experiments
|
| 119 |
+
|
| 120 |
+
We conduct extensive experiments to evaluate our model. We first compare the quality of the 3D textured meshes generated by GET3D to the existing methods using the ShapeNet [9] and Turbosquid [4] datasets. Next, we ablate our design choices in Sec. 4.2. Finally, we demonstrate the flexibility of GET3D by adapting it to downstream applications in Sec. 4.3. Additional experimental results and implementation details are provided in Appendix.
|
| 121 |
+
|
| 122 |
+
# 4.1 Experiments on Synthetic Datasets
|
| 123 |
+
|
| 124 |
+
Datasets For evaluation on ShapeNet [9], we use three categories with complex geometry – Car, Chair, and Motorbike, which contain 7497, 6778, and 337 shapes, respectively. We randomly split each category into training $( 7 0 \% )$ , validation $( 1 0 \% )$ , and test $( 2 0 \% )$ , and further remove from the test set shapes that have duplicates in the training set. To render the training data, we randomly sample camera poses from the upper hemisphere of each shape. For the Car and Chair categories, we use 24 random views, while for Motorbike we use 100 views due to less number of shapes. As models in ShapeNet only have simple textures, we also evaluate GET3D on an Animal dataset (442 shapes) collected from TurboSquid [4], where textures are more detailed and we split it into training, validation and test as defined above. Finally, to demonstrate the versatility of GET3D, we also provide qualitative results on the House dataset collected from Turbosquid (563 shapes), and Human Body dataset from Renderpeople [2] (500 shapes). We train a separate model on each category.
|
| 125 |
+
|
| 126 |
+

|
| 127 |
+
Figure 4: Qualitative comparison of GET3D to the baseline methods in terms of generated 2D images. GET3D generates sharp textures with high level of detail.
|
| 128 |
+
|
| 129 |
+

|
| 130 |
+
Figure 5: Shapes generated by GET3D rendered in Blender. GET3D generates high-quality shapes with diverse texture, high-quality geometry, and complex topology. Zoom-in for details.
|
| 131 |
+
|
| 132 |
+
Baselines We compare GET3D to two groups of works: 1) 3D generative models that rely on 3D supervision: PointFlow [59] and OccNet [38]. Note that these methods only generate geometry without texture. 2) 3D-aware image generation methods: GRAF [52], PiGAN [7], and EG3D [8].
|
| 133 |
+
|
| 134 |
+
Metrics To evaluate the quality of our synthesis, we consider both the geometry and texture of the generated shapes. For geometry, we adopt metrics from [5] and use both Chamfer Distance (CD) and Light Field Distance [10] (LFD) to compute the Coverage score and Minimum Matching Distance. For OccNet [38], GRAF [52], PiGAN [7] and EG3D [8], we use marching cubes to extract the underlying geometry. For PointFlow [59], we use Poisson surface reconstruction to convert a point cloud into a mesh when evaluating LFD. To evaluate texture quality, we adopt the FID [26] metric commonly used to evaluate image synthesis. In particular, for each category, we render the test shapes into 2D images, and also render the generated 3D shapes from each model into $5 0 \mathrm { k }$ images using the same camera distribution. We then compute FID on the two image sets. As the baselines from 3D-aware image synthesis [52, 7, 8] do not directly output textured meshes, we compute FID score in two ways: (i) we use their neural volume rendering to obtain 2D images, which we refer to as FID-Ori, and (ii) we extract the mesh from their neural field representation using marching cubes, render it, and then use the 3D location of each pixel to query the network to obtain the RGB values. We refer to this score, that is more aware of the actual 3D shape, as FID-3D. Further details on the evaluation metrics are available in the Appendix B.3.
|
| 135 |
+
|
| 136 |
+
Experimental Results We provide quantitative results in Table. 2 and qualitative examples in Fig. 3 and Fig. 4. Additional results are available in the supplementary video. Compared to OccNet [38] that uses 3D supervision during training, GET3D achieves better performance in terms of both diversity (COV) and quality (MMD), and our generated shapes have more geometric details. PointFlow [59] outperforms GET3D in terms of MMD on CD, while GET3D is better in MMD on LFG. We hypothesize that this is because PointFlow directly optimizes on point locations, which favours CD. GET3D also performs favourably when compared to 3D-aware image synthesis methods, we achieve significant improvements over PiGAN [7] and GRAF [52] in terms of all metrics on all datasets. Our generated shapes also contain more detailed geometry and texture. Compared with recent work EG3D [8]. We achieve comparable performance on generating 2D images (FID-ori), while we significantly improve on 3D shape synthesis in terms of FID-3D, which demonstrates the effectiveness of our model on learning actual 3D geometry and texture.
|
| 137 |
+
|
| 138 |
+

|
| 139 |
+
Figure 6: Shape interpolation. We interpolate both geometry and texture latent codes from left to right.
|
| 140 |
+
|
| 141 |
+

|
| 142 |
+
Figure 7: Shape variation. We locally perturb each latent code to generate different shapes.
|
| 143 |
+
|
| 144 |
+
Since we synthesize textured meshes, we can export our shapes into Blender1. We show rendering results in Fig. 1 and 5. GET3D is able to generate shapes with diverse and high quality geometry and topology, very thin structures (motorbikes), as well as complex textures on cars, animals, and houses.
|
| 145 |
+
|
| 146 |
+
Shape Interpolation GET3D also enables shape interpolation, which can be useful for editing purposes. We explore the latent space of GET3D in Fig. 6, where we interpolate the latent codes to generate each shape from left to right. GET3D is able to faithfully generate a smooth and meaningful transition from one shape to another. We further explore the local latent space by slightly perturbing the latent codes to a random direction. GET3D produces novel and diverse shapes when applying local editing in the latent space (Fig. 7).
|
| 147 |
+
|
| 148 |
+
# 4.2 Ablations
|
| 149 |
+
|
| 150 |
+
We ablate our model in two ways: 1) w/ and w/o volume subdivision, 2) training using different image resolutions. Further ablations are provided in the Appendix C.3.
|
| 151 |
+
|
| 152 |
+
Ablation of Volume Subdivision As shown in Tbl. 2, volume subdivision significantly improves the performance on classes with thin structures (e.g., motorbikes), while not getting gains on other classes. We hypothesize that the initial tetrahedral resolution is already sufficient to capture the detailed geometry on Chairs and Cars, and hence the subdivision cannot provide further improvements.
|
| 153 |
+
|
| 154 |
+
Table 3: Ablating the image resolution. ↑: higher is better, ↓: lower is better.
|
| 155 |
+
|
| 156 |
+
<table><tr><td rowspan="2">Class</td><td rowspan="2">Img Res</td><td colspan="2">COV (%,↑)</td><td colspan="2">MMD (↓)</td><td rowspan="2">FID (↓)</td></tr><tr><td>LFD</td><td>CD</td><td>LFD</td><td>CD</td></tr><tr><td rowspan="3">Car</td><td>1282</td><td>9.28</td><td>8.25</td><td>2224</td><td>1.30</td><td>39.21</td></tr><tr><td>5122</td><td>52.32</td><td>44.13</td><td>1593</td><td>0.80</td><td>13.19</td></tr><tr><td>10242</td><td>66.78</td><td>58.39</td><td>1491</td><td>0.71</td><td>10.25</td></tr><tr><td rowspan="3">Chair</td><td>128²</td><td>38.25</td><td>33.98</td><td>3886</td><td>5.90</td><td>43.04</td></tr><tr><td>5122</td><td>68.80</td><td>69.92</td><td>3149</td><td>3.90</td><td>30.16</td></tr><tr><td>10242</td><td>69.08</td><td>67.87</td><td>3167</td><td>3.74</td><td>23.28</td></tr><tr><td rowspan="2">Mbike</td><td>5122</td><td>68.49</td><td>65.75</td><td>3421</td><td>1.74</td><td>74.04</td></tr><tr><td>10242</td><td>67.12</td><td>64.38</td><td>3631</td><td>1.73</td><td>65.60</td></tr><tr><td rowspan="2">Animal</td><td>5122</td><td>77.53</td><td>78.65</td><td>3828</td><td>2.01</td><td>29.75</td></tr><tr><td>10242</td><td>79.78</td><td>78.65</td><td>3798</td><td>2.03</td><td>28.33</td></tr></table>
|
| 157 |
+
|
| 158 |
+
Ablating Different Image Resolutions We ablate the effect of the training image resolution in Tbl. 3. As expected, increased image resolution
|
| 159 |
+
|
| 160 |
+

|
| 161 |
+
Figure 8: Material generation and relighting. Despite being unsupervised, our model generates reasonable material properties, and can be realistically rendered with real-world HDR panoramas (bottom right). Normals are computed from the generated mesh. Note how specular effects change under two different lighting conditions.
|
| 162 |
+
|
| 163 |
+
improves the performance in terms of FID and shape quality, as the network can see more details, which are often not available in the low-resolution images. This corroborates the importance of training with higher image resolution, which are often hard to make use of for implicit-based methods.
|
| 164 |
+
|
| 165 |
+
# 4.3 Applications
|
| 166 |
+
|
| 167 |
+
# 4.3.1 Material Generation for View-dependent Lighting Effects
|
| 168 |
+
|
| 169 |
+
GET3D can easily be extended to also generate surface materials that are directly usable in modern graphics engines. In particular, we follow the widely used Disney BRDF [6, 29] and describe the materials in terms of the base color $( \mathbb { R } ^ { 3 } )$ , metallic $( \mathbb { R } )$ , and roughness $( \mathbb { R } )$ properties. As a result, we repurpouse our texture generator to now output a 5-channel reflectance field (instead of only RGB). To accommodate differentiable rendering of materials, we adopt an efficient spherical Gaussian (SG) based deferred rendering pipeline [12]. Specifically, we rasterize the reflectance field into a G-buffer, and randomly sample an HDR image from a set of real-world outdoor HDR panoramas $S _ { \mathrm { l i g h t } } = \{ L _ { S G } \} _ { K }$ , where $\bar { L _ { S G } } \doteq \mathbb { R } ^ { 3 2 \times 7 }$ is obtained by fitting $3 2 5 \mathrm { G }$ lobes to each panorama. The SG renderer [12] then uses the camera $c$ to render an RGB image with view-dependent lighting effects, which we feed into the discriminator during training. Note that GET3D does not require material supervision during training and learns to generate decomposed materials in an unsupervised manner.
|
| 170 |
+
|
| 171 |
+
We provide qualitative results of generated surface materials in Fig. 8. Despite unsupervised, GET3D discovers interesting material decomposition, e.g., the windows are correctly predicted with a smaller roughness value to be more glossy than the car’s body, and the car’s body is discovered as more dielectric while the window is more metallic. Generated materials enable us to produce realistic relighting results, which can account for complex specular effects under different lighting conditions.
|
| 172 |
+
|
| 173 |
+
# 4.3.2 Text-Guided 3D Synthesis
|
| 174 |
+
|
| 175 |
+
Similar to image GANs, GET3D also supports text-guided 3D content synthesis by fine-tuning a pre-trained model under the guidance of CLIP [51]. Note that our final synthesis result is a textured 3D mesh. To this end, we follow the dual-generator design from styleGAN-NADA [19], where a trainable copy $G _ { t }$ and a frozen copy $G _ { f }$ of the pre-trained generator are adopted. During optimization $G _ { t }$ and $G _ { f }$ both render images from 16 random camera views. Given a text query, we sample 500 pairs of noise vectors $\mathbf { z } _ { 1 }$ and $\mathbf { z } _ { 2 }$ . For each sample, we optimize the parameters of $G _ { t }$ to minimize the directional CLIP loss [19] (the source text labels are “car”, “animal” and “house” for the corresponding categories), and select the samples with minimal loss. To accelerate this process, we first run a small number of optimization steps for the 500 samples, then choose the top 50 samples with the lowest losses, and run the optimization for 300 steps. The results and comparison against a SOTA text-driven mesh stylization method, Text2Mesh [39], are provided in Fig. 9. Note that, [39] requires a mesh of the shape as an input to the method. We provide our generated meshes from the frozen generator as input meshes to it. Since it needs mesh vertices to be dense to synthesize surface details with vertex displacements, we further subdivide the input meshes with mid-point subdivision to make sure each mesh has 50k-150k vertices on average.
|
| 176 |
+
|
| 177 |
+

|
| 178 |
+
Figure 9: Text-guided 3D synthesis. Note that Text2Mesh [39] requires 3D mesh geometry as input. To fulfil the requirement, we provide our generated geometry as its input mesh.
|
| 179 |
+
|
| 180 |
+
# 5 Conclusion
|
| 181 |
+
|
| 182 |
+
We introduced GET3D, a novel 3D generative model that is able to synthesize high-quality 3D textured meshes with arbitrary topology. GET3D is trained using only 2D images as supervision. We experimentally demonstrated significant improvements on generating 3D shapes over previous state-of-the-art methods on multiple categories. We hope that this work brings us one step closer to democratizing 3D content creation using A.I..
|
| 183 |
+
|
| 184 |
+
Limitations While GET3D makes a significant step towards a practically useful 3D generative model of 3D textured shapes, it still has some limitations. In particular, we still rely on 2D silhouettes as well as the knowledge of camera distribution during training. As a consequence, GET3D was currently only evaluated on synthetic data. A promising extension could use the advances in instance segmentation and camera pose estimation to mitigate this issue and extend GET3D to real-world data. GET3D is also trained per-category; extending it to multiple categories in the future, could help us better represent the inter-category diversity.
|
| 185 |
+
|
| 186 |
+
Broader Impact We proposed a novel 3D generative model that generates 3D textured meshes, which can be readily imported into current graphics engines. Our model is able to generate shapes with arbitrary topology, high quality textures and rich geometric details, paving the path for democratizing A.I. tool for 3D content creation. As all machine learning models, GET3D is also prone to biases introduced in the training data. Therefore, an abundance of caution should be applied when dealing with sensitive applications, such as generating 3D human bodies, as GET3D is not tailored for these applications. We do not recommend using GET3D if privacy or erroneous recognition could lead to potential misuse or any other harmful applications. Instead, we do encourage practitioners to carefully inspect and de-bias the datasets before training our model to depict a fair and wide distribution of possible skin tones, races or gender identities.
|
| 187 |
+
|
| 188 |
+
# 6 Disclosure of Funding
|
| 189 |
+
|
| 190 |
+
This work was funded by NVIDIA. Jun Gao, Tianchang Shen, Zian Wang and Wenzheng Chen acknowledge additional revenue in the form of student scholarships from University of Toronto and the Vector Institute, which are not in direct support of this work.
|
| 191 |
+
|
| 192 |
+
# References
|
| 193 |
+
|
| 194 |
+
[1] Autodesk Maya, https://www.autodesk.com/products/maya/overview. Accessed: 2022-05-19.
|
| 195 |
+
[2] Renderpeople, http://https://renderpeople.com/. Accessed: 2022-05-19.
|
| 196 |
+
[3] Sketchfab, https://sketchfab.com/. Accessed: 2022-05-19.
|
| 197 |
+
[4] Turbosquid by Shutterstock, https://www.turbosquid.com/. Accessed: 2022-05-19.
|
| 198 |
+
[5] Panos Achlioptas, Olga Diamanti, Ioannis Mitliagkas, and Leonidas Guibas. Learning representations and generative models for 3d point clouds. In International conference on machine learning, pages 40–49. PMLR, 2018.
|
| 199 |
+
[6] Brent Burley and Walt Disney Animation Studios. Physically-based shading at disney. In ACM SIGGRAPH, volume 2012, pages 1–7. vol. 2012, 2012.
|
| 200 |
+
[7] Eric Chan, Marco Monteiro, Petr Kellnhofer, Jiajun Wu, and Gordon Wetzstein. pi-gan: Periodic implicit generative adversarial networks for 3d-aware image synthesis. In Proc. CVPR, 2021.
|
| 201 |
+
[8] Eric R Chan, Connor Z Lin, Matthew A Chan, Koki Nagano, Boxiao Pan, Shalini De Mello, Orazio Gallo, Leonidas J Guibas, Jonathan Tremblay, Sameh Khamis, et al. Efficient geometry-aware 3d generative adversarial networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 16123–16133, 2022.
|
| 202 |
+
[9] Angel X Chang, Thomas Funkhouser, Leonidas Guibas, Pat Hanrahan, Qixing Huang, Zimo Li, Silvio Savarese, Manolis Savva, Shuran Song, Hao Su, et al. Shapenet: An information-rich 3d model repository. arXiv preprint arXiv:1512.03012, 2015.
|
| 203 |
+
[10] Ding-Yun Chen, Xiao-Pei Tian, Yu-Te Shen, and Ming Ouhyoung. On visual similarity based 3d model retrieval. In Computer graphics forum, volume 22, pages 223–232. Wiley Online Library, 2003.
|
| 204 |
+
[11] Wenzheng Chen, Jun Gao, Huan Ling, Edward Smith, Jaakko Lehtinen, Alec Jacobson, and Sanja Fidler. Learning to predict 3d objects with an interpolation-based differentiable renderer. In Advances In Neural Information Processing Systems, 2019.
|
| 205 |
+
[12] Wenzheng Chen, Joey Litalien, Jun Gao, Zian Wang, Clement Fuji Tsang, Sameh Khalis, Or Litany, and Sanja Fidler. DIB- $\mathbf { \nabla } \cdot \mathbf { R } + +$ : Learning to predict lighting and material with a hybrid differentiable renderer. In Advances in Neural Information Processing Systems (NeurIPS), 2021.
|
| 206 |
+
[13] Zhiqin Chen and Hao Zhang. Learning implicit fields for generative shape modeling. Proceedings of IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
|
| 207 |
+
[14] Blender Online Community. Blender - a 3D modelling and rendering package. Blender Foundation, Stichting Blender Foundation, Amsterdam, 2018.
|
| 208 |
+
[15] Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in Neural Information Processing Systems, 34, 2021.
|
| 209 |
+
[16] Akio Doi and Akio Koide. An efficient method of triangulating equi-valued surfaces by using tetrahedral cells. IEICE TRANSACTIONS on Information and Systems, 74(1):214–224, 1991.
|
| 210 |
+
[17] Patrick Esser, Robin Rombach, and Bjorn Ommer. Taming transformers for high-resolution image synthesis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12873–12883, 2021.
|
| 211 |
+
[18] Matheus Gadelha, Subhransu Maji, and Rui Wang. 3d shape induction from 2d views of multiple objects. In 2017 International Conference on 3D Vision (3DV), pages 402–411. IEEE, 2017.
|
| 212 |
+
[19] Rinon Gal, Or Patashnik, Haggai Maron, Amit H Bermano, Gal Chechik, and Daniel Cohen-Or. Stylegannada: Clip-guided domain adaptation of image generators. ACM Transactions on Graphics (TOG), 41(4):1–13, 2022.
|
| 213 |
+
[20] Jun Gao, Wenzheng Chen, Tommy Xiang, Clement Fuji Tsang, Alec Jacobson, Morgan McGuire, and Sanja Fidler. Learning deformable tetrahedral meshes for 3d reconstruction. In Advances In Neural Information Processing Systems, 2020.
|
| 214 |
+
[21] Jun Gao, Chengcheng Tang, Vignesh Ganapathi-Subramanian, Jiahui Huang, Hao Su, and Leonidas J Guibas. Deepspline: Data-driven reconstruction of parametric curves and surfaces. arXiv preprint arXiv:1901.03781, 2019.
|
| 215 |
+
[22] Jun Gao, Zian Wang, Jinchen Xuan, and Sanja Fidler. Beyond fixed grid: Learning geometric image representation with a deformable grid. In European Conference on Computer Vision, pages 108–125. Springer, 2020.
|
| 216 |
+
[23] Jiatao Gu, Lingjie Liu, Peng Wang, and Christian Theobalt. Stylenerf: A style-based 3d aware generator for high-resolution image synthesis. In International Conference on Learning Representations, 2022.
|
| 217 |
+
[24] Zekun Hao, Arun Mallya, Serge Belongie, and Ming-Yu Liu. GANcraft: Unsupervised 3D Neural Rendering of Minecraft Worlds. In ICCV, 2021.
|
| 218 |
+
[25] Philipp Henzler, Niloy J. Mitra, and Tobias Ritschel. Escaping plato’s cave: 3d shape from adversarial rendering. In The IEEE International Conference on Computer Vision (ICCV), October 2019.
|
| 219 |
+
[26] Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. Advances in neural information processing systems, 30, 2017.
|
| 220 |
+
[27] Xun Huang, Arun Mallya, Ting-Chun Wang, and Ming-Yu Liu. Multimodal conditional image synthesis with product-of-experts GANs. In ECCV, 2022.
|
| 221 |
+
[28] Moritz Ibing, Gregor Kobsik, and Leif Kobbelt. Octree transformer: Autoregressive 3d shape generation on hierarchically structured sequences. arXiv preprint arXiv:2111.12480, 2021.
|
| 222 |
+
[29] Brian Karis and Epic Games. Real shading in unreal engine 4. Proc. Physically Based Shading Theory Practice, 4(3), 2013.
|
| 223 |
+
[30] Tero Karras, Miika Aittala, Samuli Laine, Erik Härkönen, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Alias-free generative adversarial networks. In Proc. NeurIPS, 2021.
|
| 224 |
+
[31] Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 4401–4410, 2019.
|
| 225 |
+
[32] Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of StyleGAN. In Proc. CVPR, 2020.
|
| 226 |
+
[33] Samuli Laine, Janne Hellsten, Tero Karras, Yeongho Seol, Jaakko Lehtinen, and Timo Aila. Modular primitives for high-performance differentiable rendering. ACM Transactions on Graphics, 39(6), 2020.
|
| 227 |
+
[34] William E Lorensen and Harvey E Cline. Marching cubes: A high resolution 3d surface construction algorithm. ACM siggraph computer graphics, 21(4):163–169, 1987.
|
| 228 |
+
[35] Sebastian Lunz, Yingzhen Li, Andrew Fitzgibbon, and Nate Kushman. Inverse graphics gan: Learning to generate 3d shapes from unstructured 2d data. arXiv preprint arXiv:2002.12674, 2020.
|
| 229 |
+
[36] Andrew Luo, Tianqin Li, Wen-Hao Zhang, and Tai Sing Lee. Surfgen: Adversarial 3d shape synthesis with explicit surface discriminators. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 16238–16248, 2021.
|
| 230 |
+
[37] Lars Mescheder, Sebastian Nowozin, and Andreas Geiger. Which training methods for gans do actually converge? In International Conference on Machine Learning (ICML), 2018.
|
| 231 |
+
[38] Lars Mescheder, Michael Oechsle, Michael Niemeyer, Sebastian Nowozin, and Andreas Geiger. Occupancy networks: Learning 3d reconstruction in function space. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 4460–4470, 2019.
|
| 232 |
+
[39] Oscar Michel, Roi Bar-On, Richard Liu, Sagie Benaim, and Rana Hanocka. Text2mesh: Text-driven neural stylization for meshes. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13492–13502, 2022.
|
| 233 |
+
[40] Ben Mildenhall, Pratul P. Srinivasan, Matthew Tancik, Jonathan T. Barron, Ravi Ramamoorthi, and Ren Ng. Nerf: Representing scenes as neural radiance fields for view synthesis. In ECCV, 2020.
|
| 234 |
+
[41] Kaichun Mo, Paul Guerrero, Li Yi, Hao Su, Peter Wonka, Niloy Mitra, and Leonidas Guibas. Structurenet: Hierarchical graph networks for 3d shape generation. ACM Transactions on Graphics (TOG), Siggraph Asia 2019, 38(6):Article 242, 2019.
|
| 235 |
+
[42] Jacob Munkberg, Jon Hasselgren, Tianchang Shen, Jun Gao, Wenzheng Chen, Alex Evans, Thomas Müller, and Sanja Fidler. Extracting triangular 3d models, materials, and lighting from images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8280–8290, 2022.
|
| 236 |
+
[43] Charlie Nash, Yaroslav Ganin, S. M. Ali Eslami, and Peter W. Battaglia. Polygen: An autoregressive generative model of 3d meshes. ICML, 2020.
|
| 237 |
+
[44] Michael Niemeyer and Andreas Geiger. Giraffe: Representing scenes as compositional generative neural feature fields. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 238 |
+
[45] Michael Oechsle, Lars Mescheder, Michael Niemeyer, Thilo Strauss, and Andreas Geiger. Texture fields: Learning texture representations in function space. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 4531–4540, 2019.
|
| 239 |
+
[46] Roy Or-El, Xuan Luo, Mengyi Shan, Eli Shechtman, Jeong Joon Park, and Ira Kemelmacher-Shlizerman. Stylesdf: High-resolution 3d-consistent image and geometry generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13503–13513, 2022.
|
| 240 |
+
[47] Taesung Park, Ming-Yu Liu, Ting-Chun Wang, and Jun-Yan Zhu. Semantic image synthesis with spatiallyadaptive normalization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2019.
|
| 241 |
+
[48] Dario Pavllo, Jonas Kohler, Thomas Hofmann, and Aurelien Lucchi. Learning generative models of textured 3d meshes from real-world images. In IEEE/CVF International Conference on Computer Vision (ICCV), 2021.
|
| 242 |
+
[49] Dario Pavllo, Graham Spinks, Thomas Hofmann, Marie-Francine Moens, and Aurelien Lucchi. Convolutional generation of textured 3d meshes. In Advances in Neural Information Processing Systems (NeurIPS), 2020.
|
| 243 |
+
[50] Songyou Peng, Michael Niemeyer, Lars Mescheder, Marc Pollefeys, and Andreas Geiger. Convolutional occupancy networks. In European Conference on Computer Vision (ECCV), 2020.
|
| 244 |
+
[51] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, pages 8748–8763. PMLR, 2021.
|
| 245 |
+
[52] Katja Schwarz, Yiyi Liao, Michael Niemeyer, and Andreas Geiger. Graf: Generative radiance fields for 3d-aware image synthesis. In Advances in Neural Information Processing Systems (NeurIPS), 2020.
|
| 246 |
+
[53] Katja Schwarz, Axel Sauer, Michael Niemeyer, Yiyi Liao, and Andreas Geiger. Voxgraf: Fast 3d-aware image synthesis with sparse voxel grids. ARXIV, 2022.
|
| 247 |
+
[54] Tianchang Shen, Jun Gao, Amlan Kar, and Sanja Fidler. Interactive annotation of 3d object geometry using 2d scribbles. In European Conference on Computer Vision, pages 751–767. Springer, 2020.
|
| 248 |
+
[55] Tianchang Shen, Jun Gao, Kangxue Yin, Ming-Yu Liu, and Sanja Fidler. Deep marching tetrahedra: a hybrid representation for high-resolution 3d shape synthesis. In Advances in Neural Information Processing Systems (NeurIPS), 2021.
|
| 249 |
+
[56] Edward J Smith and David Meger. Improved adversarial systems for 3d object generation and reconstruction. In Conference on Robot Learning, pages 87–96. PMLR, 2017.
|
| 250 |
+
[57] Jiajun Wu, Chengkai Zhang, Tianfan Xue, Bill Freeman, and Josh Tenenbaum. Learning a probabilistic latent space of object shapes via 3d generative-adversarial modeling. Advances in neural information processing systems, 29, 2016.
|
| 251 |
+
[58] Yinghao Xu, Sida Peng, Ceyuan Yang, Yujun Shen, and Bolei Zhou. 3d-aware image synthesis via learning structural and textural representations. In CVPR, 2022.
|
| 252 |
+
[59] Guandao Yang, Xun Huang, Zekun Hao, Ming-Yu Liu, Serge Belongie, and Bharath Hariharan. Pointflow: 3d point cloud generation with continuous normalizing flows. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 4541–4550, 2019.
|
| 253 |
+
[60] Kangxue Yin, Jun Gao, Maria Shugrina, Sameh Khamis, and Sanja Fidler. 3dstylenet: Creating 3d shapes with geometric and texture style variations. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 12456–12465, 2021.
|
| 254 |
+
[61] Jonathan Young. xatlas, 2021. https://github.com/jpcy/xatlas.
|
| 255 |
+
[62] Linqi Zhou, Yilun Du, and Jiajun Wu. 3d shape generation and completion through point-voxel diffusion. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 5826–5835, 2021.
|
| 256 |
+
[63] Peng Zhou, Lingxi Xie, Bingbing Ni, and Qi Tian. Cips-3d: A 3d-aware generator of gans based on conditionally-independent pixel synthesis. arXiv preprint arXiv:2110.09788, 2021.
|
| 257 |
+
|
| 258 |
+
# Checklist
|
| 259 |
+
|
| 260 |
+
1. For all authors...
|
| 261 |
+
|
| 262 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] We provide extensive experiments in Sec. 4.
|
| 263 |
+
(b) Did you describe the limitations of your work? [Yes] We provide the discussion on limitations in Sec. 5, and failure cases in Appendix.
|
| 264 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] We provide the discussion in the Broader Impact paragraph with further discussions in the main paper.
|
| 265 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 266 |
+
|
| 267 |
+
2. If you are including theoretical results...
|
| 268 |
+
|
| 269 |
+
(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
|
| 270 |
+
|
| 271 |
+
3. If you ran experiments...
|
| 272 |
+
|
| 273 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We have released the code here https://github.com/nv-tlabs/GET3D
|
| 274 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] We provide training details in both Sec. 4 in the main paper and Appendix.
|
| 275 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] Training existing 3D models, including ours, on large-scale 3D datasets is too computation costly to repeat multiple times.
|
| 276 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] We provide in the Appendix.
|
| 277 |
+
|
| 278 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 279 |
+
|
| 280 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] We used ShapeNet [9] core dataset, Turbosquid [4], Renderpeople [2] in Sec. 4.1. We also used official code to reproduce baselines with citations. In particular, OccNet [38], PiGAN [7], Pointflow [59], Eg3D [8].
|
| 281 |
+
(b) Did you mention the license of the assets? [Yes] We provided the license of ShapeNet, Turbosquid and RenderPeople in the Appendix.
|
| 282 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No] We did not include new assets in Supplemental material.
|
| 283 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes] We provide discussion on this in the Appendix.
|
| 284 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] We provide discussion on this in Appendix.
|
| 285 |
+
|
| 286 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 287 |
+
|
| 288 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 289 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 290 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/J8P7g_mDpno/J8P7g_mDpno.md
ADDED
|
@@ -0,0 +1,415 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ADVANCES IN SPARSE NEURAL MODEL TRAINING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
While larger neural models are pushing the boundaries on what deep learning can achieve, often more weights are needed to train models rather than to run inference for tasks. This paper explores how can we remove weights during training without impacting the ability to traverse parameter spaces (or the set of all weights a model can take). We first discover weights pruned for inference do not learn meaningful information over time but their short-term behavior is necessary for training. We then provide recommendations for removing such weights in order to train sparse neural models. With these recommendations, we attain competitive scores across dozens of deep learning workloads. We also find sparse models are tolerant of structures targeting existing hardware, opening avenues for training and inference acceleration. Our work encourages research to explore beyond massive neural models being used today.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
In the area of deep learning, increasing the size of neural models has led to dramatic advances (Hestness et al., 2017; Kaplan et al., 2020; Henighan et al., 2020), motivating training with hundreds of billions of parameters (Brown et al., 2020; Fedus et al., 2021). However, larger models incur higher memory costs and runtimes, which limits training and inference tasks that can run on existing hardware (Thompson et al., 2020). Nevertheless, larger models have been shown to train faster (Li et al., 2020) and better (Kaplan et al., 2020), which drives their adoption.
|
| 12 |
+
|
| 13 |
+
An area of research that seeks to compensate the increasing costs of model size is sparsity (Hoefler et al., 2021), which moves weights to zero so they can be discarded from storage or computations. Sparsity emerges as a promising option to reduce costs of inference (Luo et al., 2017; Allen-Zhu et al., 2019), as neural models are capable of performing tasks on sizes smaller than they were trained for (Narang et al., 2017; Renda et al., 2020). However, since overparameterization remains critical for training, sparsity observes limited success there (Lee et al., 2019; Frankle & Carbin, 2019; Wang et al., 2020; Tanaka et al., 2020; Frankle et al., 2021; Bellec et al., 2018; Mocanu et al., 2018; Dettmers & Zettlemoyer, 2019; Evci et al., 2020a; Jayakumar et al., 2020).
|
| 14 |
+
|
| 15 |
+
The ability to run inference but not training with fewer weights points to a problem with search (or how well can models navigate parameter spaces during training) rather than model capacity (LeCun et al., 1990). Literature shows adding more weights to training creates extra degrees of freedom that form new paths for optimization, rendering neural model training more effective (Evci et al., 2020b). While it is widely believed that having more weights facilitates escape from critical points during training, the question remains whether these weights are always needed (e.g., learn meaningful representations) or could be eventually discarded if they only help with the optimization process.
|
| 16 |
+
|
| 17 |
+
In this paper we explore how to remove weights from training without restricting its ability to effectively traverse parameter spaces towards good solutions. Surprisingly, we discover that weights pruned at inference time are transient and do not learn representations in the long-term. As such, these weights do not need to be stored throughout all of training, in contrast to weights that learn meaningful information for inference and thus need to be stored. The pruned weights however do learn short-term representations that provide the model extra degrees to escape regions of bad saddle points (Kawaguchi, 2016) and high error plateaus (Dauphin et al., 2014) that can slow down learning, after which they can be discarded.
|
| 18 |
+
|
| 19 |
+
With this understanding we propose new recommendations for training sparse models that consolidate recent advances in sparsity literature: (1) rewire weights to expand the parameter space, (2)
|
| 20 |
+
|
| 21 |
+
update gradients of all weights to encourage alternate paths of optimization, and (3) discard intermediate representations to reduce noise from gradient accumulations. Following these recommendations, we show that sparse neural models achieve competitive results on dozens of deep learning workloads, even when satisfying constraints needed to accelerate training and inference using Sparse Tensor Cores (Mishra et al., 2021) in NVIDIA GPUs.
|
| 22 |
+
|
| 23 |
+
The paper is organized as follows. In Section 2 we introduce a metric for learning and investigate the duration which weights retain meaningful information throughout training. We then devise recommendations for removing weights that do not learn long-term representations when training sparse models in Section 3. Section 4 summarizes our methodology for sparse training. Section 5 shows sparse models constructed in this fashion perform competitively across a plethora of deep learning workloads and can target current hardware accelerators (Mishra et al., 2021) for training and inference. Section 6 relates to prior research. In Section 7 we conclude with directions for future work.
|
| 24 |
+
|
| 25 |
+
# 2 METRIC FOR LEARNING
|
| 26 |
+
|
| 27 |
+
The crux of this paper is to understand whether weights that are being added for training are learning meaningful representations or solely being used to facilitate the optimization process. For this purpose, we use correlations to measure the duration that weights in a neural model retain (or learn) information that is relevant for inference.
|
| 28 |
+
|
| 29 |
+
Correlations determine how similar are two sets of data. When applied to weights learned over time, correlations measure how weights in future training time steps are similar to past ones. We postulate correlations represent the degree with which weights in a neural model learn. Weights that learn meaningful representations for inference are repeatedly reinforced throughout training, and their values form distinct temporal patterns that are correlated to past values. In contrast, weights that do not learn (and can be removed during inference) exhibit random behavior and have no dependence over time.
|
| 30 |
+
|
| 31 |
+
We measure correlations between a pair of time series $x$ and $y$ using the Pearson coefficient (Rodgers & Nicewander, 1988): $\rho _ { x , y } \equiv E [ ( x - \mu _ { x } ) ( y - \mu _ { y } ) ] / \sigma _ { x } \sigma _ { y }$ , where $\mu$ is the mean, $\sigma$ the standard deviation, and $E [ \cdot ]$ the expected value. Coefficients of value $+ 1$ denote two series have identical trends, 0 indicates the series are random, and $- 1$ represents series with opposite behavior. We treat each individual weight as a time series $w \in \{ w _ { 1 } , w _ { 2 } , \ldots , w _ { t } \}$ and compute Pearson coefficients between windows $x \in \{ w _ { 1 } , w _ { 2 } , \ldots , w _ { t - \tau } \}$ and $y \in \{ w _ { \tau } , w _ { \tau + 1 } , \ldots , w _ { t } \}$ , representing the similarity between the weights and their values at some future time $\tau$ . Correlations naturally decay with $\tau$ since temporal patterns are less likely to persist over long durations. An important metric we adopt is the time $\Delta$ after which weights no longer correlate to their future values, namely when $\rho = 0$ .
|
| 32 |
+
|
| 33 |
+

|
| 34 |
+
Figure 1: Time $( \Delta )$ it takes for weights to decorrelate (normalized by the total number of training steps) as a function of weight magnitudes obtained after training. Points correspond to the median $\Delta$ over weight bins sampled from a single neural layer. Shaded regions distinguish between weights that are needed (white) or can be removed (yellow) at inference time. From left to right: Transformer-XL (Language Modeling), GNMT (Machine Translation), ResNet50 (Image Classification).
|
| 35 |
+
|
| 36 |
+
Figure 1 plots the time $( \Delta )$ after which weights become completely uncorrelated with their past values. We observe that the correlation length grows with weight magnitudes obtained after training. While weights needed for inference exhibit correlations that persist across a significant fraction of training, weights that are not needed have short-term correlations and behave randomly over short periods. As a result, long-term correlations of large weights are characteristic of learning, signifying repeated reinforcement along the weight direction. On the other hand, the near-random motion of small weights suggests they don’t learn useful representations and can be removed during inference.
|
| 37 |
+
|
| 38 |
+
Because weights removable during inference are absent of correlations over long periods of training, we conjecture they do not need to be stored all the time. However, we still need pruned weights during training due to their short-term correlations. More specifically, their short-term interactions are critical for training to take different paths for optimization, facilitating escape from bad saddle points (Kawaguchi, 2016) or high error plateaus (Dauphin et al., 2014) that can slow down learning. Combining this understanding, in later sections we discover their learned values can be periodically destroyed throughout training (once correlations fall to zero) with no impact on accuracy, which paves the road for sparse training.
|
| 39 |
+
|
| 40 |
+
# 3 RECOMMENDATIONS FOR SPARSE TRAINING
|
| 41 |
+
|
| 42 |
+
This section outlines recommendations for training sparse neural models. While many of these ideas have been circling in sparsity literature, they remain misunderstood which hinders adoption. We use the understanding from the previous section to provide a deeper intuition in these cases. To summarize, we uncover the following steps to train sparse neural models:
|
| 43 |
+
|
| 44 |
+
(1) Frequently rewire weights that participate in training.
|
| 45 |
+
(2) Perform gradient updates for weights that do not participate in training.
|
| 46 |
+
(3) Induce exploitation (e.g., stop rewiring after some amount of time, reset non-participating weights to zero, or regularize them).
|
| 47 |
+
|
| 48 |
+
# 3.1 REWIRING OF NEURAL WEIGHTS
|
| 49 |
+
|
| 50 |
+
Sparse models are commonly trained by rewiring (or sampling) a subset of weights from a neural model according to some criteria (magnitude, sign, gradients, etc), allowing them to learn which weights are needed for inference. Some works rewire weights every training iteration (Bellec et al., 2018; Wortsman et al., 2019; Raihan & Aamodt, 2020; Jayakumar et al., 2020; Zhou et al., 2021), while others rewire every hundreds of training steps (Evci et al., 2020a) or after an entire pass through the data (Mocanu et al., 2018; Dettmers & Zettlemoyer, 2019). Since there are no clear reasons behind these choices, an important question becomes how often must weights be rewired so neural models can learn effectively.
|
| 51 |
+
|
| 52 |
+
We study the effects rewiring rates have on accuracy when training sparse models of various sizes $d$ , where $d$ denotes the fraction of total weights being used in the sparse model. Figure 2 (left) plots the task error (or accuracy difference between dense and sparse models) as a function of the number of training steps $r$ taken between rewirings. We find rewiring frequency does not matter when sparsity is low or moderate $d \sim 0 . 5 )$ , but errors increase with $r$ as models get sparser $d \ll 0 . 5$ ). Therefore, weights should be rewired frequently (within a few training steps) to avoid losing accuracy.
|
| 53 |
+
|
| 54 |
+
Correlations can help us explain why training improves when we rewire sparse neural models. While weights that do not learn long-term representations can be discarded during training, they have shortterm correlations that create extra degrees of freedom for escaping critical points (Evci et al., 2020b). But this escape only occurs when weights are rewired. For example, neural models always operate on reduced parameter spaces if weights being used remain unchanged throughout training $( r \infty )$ ), and expand exactly once after going through the entire data when they are rewired every epoch. By swapping between weights that participate (are used in forward and backward propagations) and do not participate (are fixed to zero during training), training can take different paths for optimization using the short-term correlations, which helps neural models explore the parameter space.
|
| 55 |
+
|
| 56 |
+

|
| 57 |
+
Figure 2: Investigations into various aspects of training sparse models using ResNet50. Left: Task error (or accuracy difference between dense and sparse models) as a function of rewiring steps $r$ . Middle: Task error as a function of scaling factor $s$ applied to gradients of weights that do not participate in training. Right: Task error where non-participating weights are reset to zero every $z$ training steps. We consider sparse models of different $d$ denoting the ratio of weights being used. Lines represent polynomial fits of sample points. Appendix A covers data for a broader span of neural models and tasks.
|
| 58 |
+
|
| 59 |
+
# .2 UPDATES FOR WEIGHTS NOT PARTICIPATING IN TRAINING
|
| 60 |
+
|
| 61 |
+
Previously, we found neural weights not needed for inference form short-term interactions that make training more effective. Since sparse models lack weights that have similar roles, we can approximate this behavior using gradient updates for non-participating weights. Because non-participating weights do not contribute to the loss, their gradients determine whether another optimization path is better suited to traverse the region being explored in the loss landscape. Repeating gradient updates registers the importance of these paths over some period of training and can trigger rewiring when weights exceed a threshold, which allows training to explore different regions of the parameter space while operating on (or forward and backward propagating) a smaller set of weights.
|
| 62 |
+
|
| 63 |
+
We evaluate the importance of gradients updates on non-participating weights by reducing their contribution with a scale factor $s$ . Figure 2 (middle) shows the task error as a function of the scale factor $s$ using various model sizes $d$ . We observe error increases as $s \to 0$ (no gradients contribute when $s = 0$ ), which can be attributed to premature convergence when training lacks expressive power to explore different paths. Dampening the gradient updates affect sparser models $( d \ll 0 . 5 )$ , which are more sensitive to critical points, more than larger models $\ : d \sim 0 . 5 )$ , which may still have sufficient weights to train effectively. As a result, non-participating weights should be updated regularly to retain accuracy.
|
| 64 |
+
|
| 65 |
+
Gradient updates for weights that do not participate in training could mean they also learn representations, such that more capacity rather than search improves accuracy. We verify this by resetting non-participating weights to zero after every $z$ training steps, thus removing any representations they might have learned. Figure 2 (right) shows the task error as a function of $z$ . Errors are the highest when values are reset every iteration $z = 1$ ), which is equivalent when training without any rewiring. Conversely, error decreases as weights are reset less frequently and saturates after sufficient training steps $( z \sim 1 k )$ ). Interestingly, this also represents the time it takes for added weights to decorrelate, as shown in previous sections, supporting our conjecture that correlations are indicative of learning, and weights can be discarded once they cease to exist. The ability to remove information from non-participating weights reinforces the idea that they make training more effective rather than augment model capacity.
|
| 66 |
+
|
| 67 |
+
While most of literature trains sparse models using fewer weights and gradients (Bellec et al., 2018; Mocanu et al., 2018; Dettmers & Zettlemoyer, 2019), more recent success has been found by updates gradients for weights that do not participate in training (Wortsman et al., 2019; Liu et al., 2020; Zhou et al., 2021; Hubara et al., 2021) as described above. However, so far there has been little understanding of why this helps improve sparse training, which we attribute to the use of short-term correlations to escape critical points.
|
| 68 |
+
|
| 69 |
+
# 3.3 BALANCING BETWEEN EXPLORATION AND EXPLOITATION
|
| 70 |
+
|
| 71 |
+
Deep learning like other optimization problems treads a delicate balance between exploration and exploitation. In early stages of training neural models explore search spaces using high learning rates, whereas late stages exploit specific regions using small learning rates. Training sparse neural models can also affect this balance, as fewer weights reduces the degrees of freedom and thus hinders exploration during training. On the other hand, gradient updates on non-participating weights introduces noise as any nonzero value will not reflect what is being used for training, which limits exploitation (training bounces around basins of attraction due to gradient noise).
|
| 72 |
+
|
| 73 |
+
Another option is to draw analogies with added weights, which can be safely discarded after sufficient training since they do not learn representations over time. We reset non
|
| 74 |
+
|
| 75 |
+

|
| 76 |
+
Figure 3 shows task error degrades without proper exploration, by training smaller models with neural layers of reduced widths (NO EXPLORE), or exploitation, by training sparse models delineated in previous sections (NO EXPLOIT). Therefore, we seek ways to induce exploitation when augmenting search spaces for more exploration. One course of action is to remove noise introduced by non-participating weights during late stages, so training can take steepest descents towards the minima. To achieve this we stop rewiring weights after sufficient training (FIX), such that nonparticipating weights can no longer contribute to the loss. Figure 3 shows this decreases error rates tremendously.
|
| 77 |
+
Figure 3: Task error after training TransformerXL Base using different exploration versus exploitation strategies as a function of model size $d$ . Appendix A covers data for a broader span of neural models and tasks.
|
| 78 |
+
|
| 79 |
+
participating weights to zero roughly every $1 k$ training steps (or the time it takes for added weights to decorrelate) in order to remove gradient noise that may trigger unnecessary rewiring, allowing training to exploit nearby regions. Figure 3 shows error decreases substantially when non-participating weights are either reset to zero (RESET) or regularized with a decay factor (REGULARIZE) as suggested in (Zhou et al., 2021). Sparsity literature introduces alternative courses for inducing exploitation (Mocanu et al., 2018; Dettmers & Zettlemoyer, 2019; Evci et al., 2020a).
|
| 80 |
+
|
| 81 |
+
# 4 METHODOLOGY
|
| 82 |
+
|
| 83 |
+
Using recommendations from the previous section, we summarize a methodology for sparse training in Algorithm 1. Namely, we rewire weights $w$ of sparse neural models based on their magnitudes in order to preserve long-term correlations that were discovered in Section 2. At each point in time, the top fraction $d$ of weights are chosen to participate in training. Participating weights $p$ are used to compute the loss and activation gradients, while the optimizer performs updates on all the weight gradients. We then induce exploitation on non-participating weights $n$ using any of the approaches discussed earlier.
|
| 84 |
+
|
| 85 |
+
We note some limitations of the methodology described above. Sparse training observes no memory savings because all weights need to be stored for their gradient updates. Sparsity is also only applied on weights, which means we can only accelerate the forward pass and part of the backward pass that computes activation gradients. For further acceleration, we can consider applying sparsity to activations or their gradients to accelerate weight gradient computations (Raihan & Aamodt, 2020).
|
| 86 |
+
|
| 87 |
+
The methods delineated above make a tradeoff between exploration and exploitation using variables $v , z ,$ , and $\beta$ . Stopping rewiring after half of training $\mathit { v } = 0 . 5$ ) often provides the best results. $z$ should be large enough to retain short-term correlations (on the order of $1 k$ training steps). $\beta =$ 0.0002 chosen in (Zhou et al., 2021) roughly matches our choice for $z$ . All methods perform equally well with their optimal variables, so these variables can either be automated or kept as default. For most experiments we adopt RESET and use FIX in a few select cases.
|
| 88 |
+
|
| 89 |
+
# Algorithm 1 TRAIN(D, γ, d, v, z, β)
|
| 90 |
+
|
| 91 |
+
<table><tr><td colspan="2">1: Initialize neural weights w at random</td></tr><tr><td>2: for each training iteration t do</td><td></td></tr><tr><td>3:</td><td>Sample a mini batch of data D</td></tr><tr><td>4:</td><td>p ← wi if wi ≥ T,where T is chosen so that lpl = d Get participating weights</td></tr><tr><td>5:</td><td>n←wiifwi<T Get non-participating weights Forward pass</td></tr><tr><td>6:</td><td>l ←L(p,D)</td></tr><tr><td>al aL(p,D) 7: 个 dw</td><td>Backward pass</td></tr><tr><td>8:</td><td>dw w←w+γ al</td></tr><tr><td>9:</td><td>Optimizer step if t≥u thenn←0</td></tr><tr><td>10: if t mod z=O then n←0</td><td>FIX RESET</td></tr><tr><td>11: n←n-βn</td><td>REGULARIZE</td></tr></table>
|
| 92 |
+
|
| 93 |
+
# 5 EMPIRICAL DATA
|
| 94 |
+
|
| 95 |
+
We are now in the position to train sparse neural models using our recommendations. This section presents empirical evidence that short-term correlations can help sparse models achieve better accuracy for inference tasks. We first demonstrate that our strategy performs competitively against state-of-the-art sparsity research. Then, we explore sparse models are tolerant to sparsity structures that target hardware acceleration using Sparse Tensor Cores (Mishra et al., 2021).
|
| 96 |
+
|
| 97 |
+
# 5.1 COMPARISONS TO DENSE MODELS
|
| 98 |
+
|
| 99 |
+
Experiments are conducted across a wide range of deep learning tasks and neural architectures trained on large data sets, as detailed in Appendix B. We draw comparisons between dense models (DENSE) and sparse models as described in this work (SPARSE). We also compare to smaller dense models (SMALL) consisting of neural layers with reduced widths that can run on existing dense hardware. We reduce the widths of neural layers by a factor of $1 / d$ along one of the dimensions to match the number of weights used in the sparse models. Appendix C demonstrates the benefit of sparse training compared to smaller dense models.
|
| 100 |
+
|
| 101 |
+
Table 1 lists accuracies for dense models and their differences for sparse models (adding the two numbers produces accuracies for sparse models) across various tasks as a function of model size $d$ (or the ratio of weights being used for the sparse models). We find using our recommendations most sparse models can be halved in size $d = 0 . 5$ ) without sacrificing any task accuracy, whereas training with a quarter of the weights $\acute { a } = 0 . 2 5 )$ often reduces accuracy by less than $1 \%$ . Some exceptions include efficient convolutional models and sparser models $d = 0 . 1$ ), which may be constrained by capacity.
|
| 102 |
+
|
| 103 |
+
# 5.2 COMPARISONS TO SPARSITY RESEARCH
|
| 104 |
+
|
| 105 |
+
We also draw comparisons to sparsity literature as detailed below.
|
| 106 |
+
|
| 107 |
+
LOTTERY. We construct lottery tickets (LOTTERY) by training models to completion (e.g., $k$ steps) and removing weights based on their trained values (Frankle & Carbin, 2019; Frankle et al., 2019). Sparse models are initialized with weights obtained after some amount of training $t = \epsilon ,$ ) and then trained for $k - t$ steps. We choose $\epsilon \in [ k / 1 0 , k / 1 0 0 ]$ across various workloads (Frankle et al., 2019).
|
| 108 |
+
|
| 109 |
+
SET AND RIGL. Participating weights are rewired over time based on magnitude and adding new ones either randomly (SET) (Mocanu et al., 2018) or based on their gradients (RIGL) (Evci et al., 2020a). Weights are initialized to zero when they become participating. The fraction of weights to rewire decays linearly throughout training. We sweep across workloads for the best initial value for the rewiring fraction and frequency.
|
| 110 |
+
|
| 111 |
+
Table 1: Accuracies for dense and their differences for sparse (positive means better) for different $d$ .
|
| 112 |
+
|
| 113 |
+
<table><tr><td>Model</td><td>DENSE</td><td>d=0.5</td><td>d=0.25</td><td>d=0.1</td><td>Model</td><td>DENSE</td><td>d=0.5</td><td>d=0.25</td><td>d=0.1</td></tr><tr><td>ResNet18</td><td>70.30</td><td>+0.01</td><td>-0.92</td><td>-2.75</td><td>SqueezeNet V1</td><td>60.77</td><td>-0.88</td><td>-5.20</td><td>一</td></tr><tr><td>ResNet34</td><td>73.87</td><td>-0.20</td><td>-0.65</td><td>-2.27</td><td>MobileNet V2</td><td>71.53</td><td>-0.87</td><td>-0.87</td><td>一</td></tr><tr><td>ResNet50</td><td>76.71</td><td>-0.05</td><td>-0.59</td><td>-2.17</td><td>Stacked UNet-64</td><td>69.53</td><td>-1.41</td><td>-3.79</td><td>-8.19</td></tr><tr><td>ResNet101</td><td>77.50</td><td>-0.25</td><td>-0.61</td><td>-1.52</td><td>SSD-ResNet18</td><td>19.15</td><td>-0.81</td><td>-2.49</td><td>-5.55</td></tr><tr><td>ResNeXt50</td><td>77.68</td><td>+0.02</td><td>-0.49</td><td>-2.01</td><td>SSD-ResNet50</td><td>24.93</td><td>-0.52</td><td>-2.06</td><td>-5.31</td></tr><tr><td>ResNeXt101</td><td>79.27</td><td>+0.20</td><td>+0.19</td><td>一</td><td>Faster R-CNN</td><td>37.71</td><td>-0.25</td><td>-1.61</td><td>-5.51</td></tr><tr><td>WideResNet50</td><td>78.13</td><td>+0.13</td><td>-0.34</td><td>-1.06</td><td>Mask R-CNN</td><td>38.26</td><td>-0.34</td><td>-1.42</td><td>-4.80</td></tr><tr><td>WideResNet101</td><td>78.63</td><td>-0.12</td><td>+0.04</td><td>-1.00</td><td>MaskR-CNN</td><td>35.03</td><td>-0.88</td><td>-2.65</td><td>-7.44</td></tr><tr><td>InceptionV3</td><td>77.10</td><td>-0.08</td><td>-0.88</td><td>-3.25</td><td>Mask R-CNN3×</td><td>40.78</td><td>-0.12</td><td>-1.12</td><td>-3.51</td></tr><tr><td>Xception</td><td>79.28</td><td>+0.04</td><td>-0.28</td><td>-1.26</td><td>MaskR-CNN3×</td><td>37.05</td><td>-0.03</td><td>-0.81</td><td>-2.98</td></tr><tr><td>DenseNet121</td><td>75.46</td><td>-0.46</td><td>-1.75</td><td>-4.35</td><td>RetinaNet</td><td>36.48</td><td>-0.42</td><td>-2.42</td><td>-6.00</td></tr><tr><td>DenseNet161</td><td>78.77</td><td>+0.01</td><td>-0.86</td><td>-2.35</td><td>RPN</td><td>57.61</td><td>-0.16</td><td>-0.90</td><td>-2.56</td></tr><tr><td>DenseNet169</td><td>76.97</td><td>+0.04</td><td>-0.96</td><td>-3.23</td><td>DETR</td><td>39.90</td><td>+0.10</td><td>-0.60</td><td>-0.80</td></tr><tr><td>VGG11-BN</td><td>70.70</td><td>-0.33</td><td>-0.79</td><td>-2.24</td><td>Pix2PixHD</td><td>68.83</td><td>+2.27</td><td>-3.02</td><td>-3.52</td></tr><tr><td>VGG16-BN</td><td>74.00</td><td>-0.25</td><td>-0.46</td><td>-1.75</td><td>Few-Shot Vid2Vid</td><td>25.78</td><td>+0.52</td><td>-0.63</td><td>-4.52</td></tr><tr><td>VGG19-BN</td><td>74.88</td><td>+0.09</td><td>-0.48</td><td>-1.52</td><td>FAZE</td><td>2.94</td><td>-0.04</td><td>+0.02</td><td>-0.04</td></tr><tr><td>DRN-C-26</td><td>75.22</td><td>-0.30</td><td>-0.74</td><td>-2.35</td><td>Vaswani Base</td><td>26.87</td><td>-0.68</td><td>-1.92</td><td>-3.62</td></tr><tr><td>DRN-C-42</td><td>76.78</td><td>-0.10</td><td>-0.62</td><td>-1.98</td><td>Vaswani Large</td><td>28.43</td><td>-0.09</td><td>-0.92</td><td>-2.12</td></tr><tr><td>DRN-A-50</td><td>78.30</td><td>-0.23</td><td>-0.74</td><td>-2.28</td><td>Levenshtein</td><td>6.16</td><td>-0.11</td><td>-0.23</td><td>-0.45</td></tr><tr><td>DeiT Tiny</td><td>72.70</td><td>-2.81</td><td>-8.09</td><td>-16.49</td><td>GNMT</td><td>24.81</td><td>-0.12</td><td>+0.26</td><td>-0.15</td></tr><tr><td>DeiT Small</td><td>80.08</td><td>-1.53</td><td>-3.75</td><td>-8.30</td><td>XL Base</td><td>22.88</td><td>-0.49</td><td>-2.04</td><td>-5.41</td></tr><tr><td>DeiTBase</td><td>81.95</td><td>-0.75</td><td>1</td><td>一</td><td>XL Large</td><td>17.90</td><td>-0.16</td><td>-1.01</td><td>-2.65</td></tr><tr><td>ShuffleNetV2</td><td>68.44</td><td>-0.43</td><td>-1.44</td><td></td><td>BERTBase</td><td>87.66</td><td>-0.04</td><td>1</td><td></td></tr><tr><td>MNASNet V1</td><td>71.80</td><td>-1.09</td><td>-3.36</td><td></td><td>BERTLarge</td><td>90.92</td><td>-0.02</td><td>一</td><td>一</td></tr></table>
|
| 114 |
+
|
| 115 |
+
Figure 4 plots the task error across the sparsity methods. We find that our strategy vastly outperforms competing approaches on all tasks and model sizes by a wide margin that increases with sparsity. Interestingly, the methods compared typically omit at least one of the recommendations listed in this work. For example, LOTTERY performs worse even when starting from a dense model because it does not rewire. Conversely, SET and RIGL underperform because they do not accumulate gradient updates. However, other works (Zhou et al., 2021; Hubara et al., 2021) that adopt concepts similar to those explored in this paper should perform similarly to our approach. As a result, leveraging short-term correlations seems to be a critical component for recent success in sparse training.
|
| 116 |
+
|
| 117 |
+
# 5.3 APPLICATION ON HARDWARE ACCELERATORS
|
| 118 |
+
|
| 119 |
+
We have shown earlier that we can train sparse neural models while maintaining accuracy. However, such models cannot be accelerated on modern hardware with current matrix-math pipelines (Park et al., 2017; Gale et al., 2020) without imposing particular structures (or positions of weights used during training and inference). On the other hand, neural structures targeting hardware acceleration (e.g., removing blocks (Gray et al., 2017), channels or filters (Wen et al., 2016; Li et al., 2017), layers (Michel et al., 2019)) often degrade accuracy. This apparent tradeoff between accuracy and performance (or speed) has hindered their adoption.
|
| 120 |
+
|
| 121 |
+

|
| 122 |
+
Figure 4: Accuracy difference between dense and sparse models comparing various methods as a function of model size $d$ . Left to right: ResNet50 (Classification), Transformer (Translation), Transformer-XL (Language Modeling). Appendix F covers a broader span of data.
|
| 123 |
+
|
| 124 |
+
Table 2: Accuracies for dense and their differences for 2:4 sparse (positive means better).
|
| 125 |
+
|
| 126 |
+
<table><tr><td>Model</td><td>DENSE</td><td>2:41D</td><td>2:4 2D</td><td>Model</td><td>DENSE</td><td>2:4 1D</td><td>2:4 2D</td></tr><tr><td>ResNet18</td><td>72.17</td><td>+0.00</td><td>-0.28</td><td>VGG19</td><td>74.88</td><td>+0.04</td><td>-0.21</td></tr><tr><td>ResNet34</td><td>75.14</td><td>+0.06</td><td>-0.27</td><td>Xception</td><td>79.28</td><td>+0.04</td><td>-0.11</td></tr><tr><td>ResNet50</td><td>77.67</td><td>+0.05</td><td>+0.09</td><td>DETR</td><td>39.90</td><td>-0.30</td><td>-0.40</td></tr><tr><td>ResNet101</td><td>78.94</td><td>-0.09</td><td>-0.31</td><td>Pix2PixHD</td><td>68.83</td><td>+1.34</td><td>-0.68</td></tr><tr><td>InceptionV3</td><td>78.11</td><td>-0.11</td><td>-0.18</td><td>Few-Shot Vid2Vid</td><td>26.06</td><td>+0.49</td><td>-0.04</td></tr><tr><td>ResNext50</td><td>78.36</td><td>-0.21</td><td>-0.19</td><td>FAZE</td><td>2.49</td><td>+0.08</td><td>1</td></tr><tr><td>ResNext101</td><td>79.27</td><td>+0.28</td><td>+0.36</td><td>GNMT</td><td>24.81</td><td>+0.15</td><td>+0.09</td></tr><tr><td>WideResNet50</td><td>78.13</td><td>-0.07</td><td>-0.08</td><td>Transformer Large</td><td>28.43</td><td>-0.10</td><td>-0.39</td></tr><tr><td>WideResNet101</td><td>78.63</td><td>+0.08</td><td>-0.07</td><td>BERTLarge</td><td>90.92</td><td>+0.03</td><td>-0.55</td></tr><tr><td>DRN C 26</td><td>77.66</td><td>-0.05</td><td>-0.11</td><td></td><td></td><td></td><td></td></tr></table>
|
| 127 |
+
|
| 128 |
+
Therefore, we explore whether our recommendations can make hardware-aware structures more amenable for deep learning. As a case study, we consider Sparse Tensor Cores introduced in NVIDIA Ampere GPU architecture (Mishra et al., 2021), which have twice the math throughput of regular matrix operations. The hardware expects a 2:4 sparsity structure that takes at least two values to be zero for each group of four values. Appendix E illustrates examples of 2:4 sparsity for inference (1D) and for training (2D).
|
| 129 |
+
|
| 130 |
+
Table 2 lists accuracy differences between sparse and dense models (positive values mean sparse performs better), where we extend learning rate schedules for some workloads compared to what is typically used in literature (see Appendix D for details). From the table, we find that structured sparse neural models can generally retain accuracy for tasks. While neural models adopting coarser structures such as block sparsity (Narang et al., 2017; Gray et al., 2017) fail to benefit from our recommendations and perform no better than smaller models (see Appendix E), using 2:4 for training (2D) and inference (1D) roughly matches accuracy of the dense models. Therefore, we can conclude 2:4 sparsity is particularly effective at leveraging short-term correlations due to its finer granularity. This suggests possible avenues towards accelerating training (Hubara et al., 2021) as well as obtaining efficient models for inference without having to repeat the training process (Mishra et al., 2021; Zhou et al., 2021).
|
| 131 |
+
|
| 132 |
+
# 6 RELATED WORK
|
| 133 |
+
|
| 134 |
+
Applying sparsity to reduce the size of neural models has been a topic of interest for the past three decades (LeCun et al., 1990; Hassibi & Stork, 1993; Reed, 1993; Castellano et al., 1997; Han et al., 2015; Jayakumar et al., 2020). Typically, sparse models are constructed by training much larger models (that are easier to train) and removing some of their weights either after training (Han et al., 2015; Mishra et al., 2021) or gradually alongside training (Narang et al., 2017; Zhu & Gupta, 2018; Gale et al., 2019). However, the above are only useful to reduce costs for inference.
|
| 135 |
+
|
| 136 |
+
For training acceleration, early works (Lee et al., 2019; Wang et al., 2020; Tanaka et al., 2020) sought to remove weights before training with limited success (Gale et al., 2019; Frankle et al., 2021). Surprisingly, it was shown sparse models can be trained when initialized the same way as the trained dense model (Frankle & Carbin, 2019). After this breakthrough, many works (Dettmers & Zettlemoyer, 2019; Evci et al., 2020a; Jayakumar et al., 2020) tried to dynamically learn sparse models by rewiring their weights throughout training, though some works existed earlier (Bellec et al., 2018; Mocanu et al., 2018). While this greatly improved accuracy, it was not enough to match that of dense models. More recent advances (Wortsman et al., 2019; Liu et al., 2020; Savarese et al., 2020; Zhou et al., 2021; Hubara et al., 2021) introduced gradient updates for all weights in a neural model, including ones that do not participate in training, and observed better success.
|
| 137 |
+
|
| 138 |
+
Our recommendations are similar to recent works (Zhou et al., 2021; Hubara et al., 2021) that were conducted in tandem with our research, but differ in some crucial aspects. (Zhou et al., 2021) adopts
|
| 139 |
+
|
| 140 |
+
$2 { : } 4 \ 1 \mathrm { D }$ sparsity patterns which cannot accelerate training. We also show alternatives to regularizing the non-participating weights which achieve the same effect. (Hubara et al., 2021) uses 4:8 sparsity patterns which are not useful for Sparse Tensor Cores, but they also adopt 2D patterns as we do.
|
| 141 |
+
|
| 142 |
+
While sparsity has been extensively explored for neural model training, our paper presents new perspectives on why certain methods should or not work. Our explanations about how additional weights do not learn meaningful information throughout training complement existing observations about the benefits of overparameterization (Evci et al., 2020b). We use this understanding to consolidate many ideas that have been circling around in sparsity literature but remain not clearly understood. For example, how frequently and why must weights be rewired.
|
| 143 |
+
|
| 144 |
+
# 7 CONCLUSION
|
| 145 |
+
|
| 146 |
+
In this paper we provide a better understanding of what is needed for sparse training. We first discover weights that can be pruned during inference do not learn meaningful representations over time, but exhibit short-term correlations that are necessary to train effectively. Based on this understanding, we uncover recommendations to remove such weights when training sparse models and conduct extensive empirical studies to determine the effects of different hyperparameters. We then demonstrate that sparse training can work across dozens of deep learning workloads that have not been investigated before in sparsity literature. Lastly, we are the first to employ sparsity patterns that can accelerate training of sparse models on existing hardware.
|
| 147 |
+
|
| 148 |
+
We believe these results open many questions. On the practical side, it may be interesting to consider how could this strategy be adopted to accelerate real-world training and inference workloads today, reducing the environmental impact from training very large models. On the theoretical side, we would like to understand better ways to approximate the short-term behavior in cases where accuracy still suffers as well as how to address potential biases induced by sparse models which may affect applications. We hope that our results will spur further research on these unconventional architectures, which challenge the default choice held by massive neural models today.
|
| 149 |
+
|
| 150 |
+
# REFERENCES
|
| 151 |
+
|
| 152 |
+
Zeyuan Allen-Zhu, Yuanzhi Li, and Zhao Song. A convergence theory for deep learning via overparameterization. In ICML, 2019.
|
| 153 |
+
|
| 154 |
+
Guillaume Bellec, David Kappel, Wolfgang Maass, and Robert Legenstein. Deep rewiring: Training very sparse deep networks. In ICLR, 2018.
|
| 155 |
+
|
| 156 |
+
Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In NeurIPS, 2020.
|
| 157 |
+
|
| 158 |
+
Giovanna Castellano, Anna Maria Fanelli, and Marcello Pelillo. An iterative pruning algorithm for feedforward neural networks. IEEE Transactions Neural Networks, 1997.
|
| 159 |
+
|
| 160 |
+
Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V. Le, and Ruslan Salakhutdinov. Transformer-XL: Attentive language models beyond a fixed-length context. arXiv preprint arXiv:1901.02860, 2019.
|
| 161 |
+
|
| 162 |
+
Yann N Dauphin, Razvan Pascanu, Caglar Gulcehre, Kyunghyun Cho, Surya Ganguli, and Yoshua Bengio. Identifying and attacking the saddle point problem in high-dimensional non-convex optimization. In NeurIPS. 2014.
|
| 163 |
+
|
| 164 |
+
Tim Dettmers and Luke Zettlemoyer. Sparse networks from scratch: Faster training without losing performance. arXiv preprint arXiv:1907.04840, 2019.
|
| 165 |
+
|
| 166 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
|
| 167 |
+
|
| 168 |
+
Utku Evci, Trevor Gale, Jacob Menick, Pablo Samuel Castro, and Erich Elsen. Rigging the lottery: Making all tickets winners. In ICML. 2020a.
|
| 169 |
+
|
| 170 |
+
Utku Evci, Fabian Pedregosa, Aidan Gomez, and Erich Elsen. The difficulty of training sparse neural networks. arXiv preprint arXiv:1906.10732, 2020b.
|
| 171 |
+
|
| 172 |
+
William Fedus, Barret Zoph, and Noam Shazeer. Switch transformers: Scaling to trillion parameter models with simple and efficient sparsity. arXiv preprint arXiv:2101.03961, 2021.
|
| 173 |
+
|
| 174 |
+
Jonathan Frankle and Michael Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. In ICLR, 2019.
|
| 175 |
+
|
| 176 |
+
Jonathan Frankle, Gintare K. Dziugaite, Daniel M. Roy, and Michael Carbin. The lottery ticket hypothesis at scale. arXiv preprint arXiv:1903.01611, 2019.
|
| 177 |
+
|
| 178 |
+
Jonathan Frankle, Gintare Karolina Dziugaite, Daniel Roy, and Michael Carbin. Pruning neural networks at initialization: Why are we missing the mark? In ICLR, 2021.
|
| 179 |
+
|
| 180 |
+
Trevor Gale, Erich Elsen, and Sara Hooker. The state of sparsity in deep neural networks. arXiv preprint arXiv:1902.09574, 2019.
|
| 181 |
+
|
| 182 |
+
Trevor Gale, Matei Zaharia, Cliff Young, and Erich Elsen. Sparse gpu kernels for deep learning. In SC20: International Conference for High Performance Computing, Networking, Storage and Analysis, 2020.
|
| 183 |
+
|
| 184 |
+
S. Gray, A. Radford, and D. P. Kingma. GPU kernels for block-sparse weights. https://cdn. openai.com/blocksparse/blocksparsepaper.pdf, 2017.
|
| 185 |
+
|
| 186 |
+
Jiatao Gu, Changhan Wang, and Junbo Zhao. Levenshtein transformer. In NeurIPS. 2019.
|
| 187 |
+
|
| 188 |
+
Song Han, Jeff Pool, John Tran, and William Dally. Learning both weights and connections for efficient neural network. In NeurIPS. 2015.
|
| 189 |
+
|
| 190 |
+
Babak Hassibi and David G. Stork. Second order derivatives for network pruning: Optimal brain surgeon. In NeurIPS. 1993.
|
| 191 |
+
|
| 192 |
+
K. He, G. Gkioxari, P. Dollar, and R. Girshick. Mask R-CNN. In ´ ICCV, 2017.
|
| 193 |
+
|
| 194 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
|
| 195 |
+
|
| 196 |
+
Tom Henighan, Jared Kaplan, Mor Katz, Mark Chen, Christopher Hesse, Jacob Jackson, Heewoo Jun, Tom B. Brown, Prafulla Dhariwal, Scott Gray, Chris Hallacy, Benjamin Mann, Alec Radford, Aditya Ramesh, Nick Ryder, Daniel M. Ziegler, John Schulman, Dario Amodei, and Sam McCandlish. Scaling laws for autoregressive generative modeling. arXiv preprint arXiv:2010.14701, 2020.
|
| 197 |
+
|
| 198 |
+
Joel Hestness, Sharan Narang, Newsha Ardalani, Gregory Diamos, Heewoo Jun, Hassan Kianinejad, Md. Mostofa Ali Patwary, Yang Yang, and Yanqi Zhou. Deep learning scaling is predictable, empirically. arXiv preprint arXiv:1712.00409, 2017.
|
| 199 |
+
|
| 200 |
+
Torsten Hoefler, Dan Alistarh, Tal Ben-Nun, Nikoli Dryden, and Alexandra Peste. Sparsity in deep learning: Pruning and growth for efficient inference and training in neural networks. arXiv preprint arXiv:2102.00554, 2021.
|
| 201 |
+
|
| 202 |
+
Itay Hubara, Brian Chmiel, Moshe Island, Ron Banner, Seffi Naor, and Daniel Soudry. Accelerated sparse neural training: A provable and efficient method to find n:m transposable masks. arXiv preprint arXiv:2102.08124, 2021.
|
| 203 |
+
|
| 204 |
+
Siddhant M. Jayakumar, Razvan Pascanu, Jack W. Rae, Simon Osindero, and Erich Elsen. TopKAST: Top-k always sparse training. In NeurIPS. 2020.
|
| 205 |
+
|
| 206 |
+
Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B. Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020.
|
| 207 |
+
|
| 208 |
+
Kenji Kawaguchi. Deep learning without poor local minima. In NeurIPS. 2016.
|
| 209 |
+
|
| 210 |
+
Yann LeCun, John S. Denker, and Sara A. Solla. Optimal brain damage. In NeurIPS. 1990.
|
| 211 |
+
|
| 212 |
+
Namhoon Lee, Thalaiyasingam Ajanthan, and Philip Torr. SNIP: Single-shot network pruning based on connection sensitivity. In ICLR, 2019.
|
| 213 |
+
|
| 214 |
+
Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient convnets. In ICLR. 2017.
|
| 215 |
+
|
| 216 |
+
Zhuohan Li, Eric Wallace, Sheng Shen, Kevin Lin, Kurt Keutzer, Dan Klein, and Joey Gonzalez. Train big, then compress: Rethinking model size for efficient training and inference of transformers. In ICML, 2020.
|
| 217 |
+
|
| 218 |
+
T. Lin, P. Goyal, R. Girshick, K. He, and P. Dollar. Focal loss for dense object detection. In ´ ICCV, 2017.
|
| 219 |
+
|
| 220 |
+
Junjie Liu, Zhe Xu, Runbin Shi, Ray C. C. Cheung, and Hayden K.H. So. Dynamic sparse training: Find efficient sparse network from scratch with trainable masked layers. In ICLR, 2020.
|
| 221 |
+
|
| 222 |
+
Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed, Cheng-Yang Fu, and Alexander C. Berg. SSD: Single shot multibox detector. arXiv preprint arXiv:1512.02325, 2015.
|
| 223 |
+
|
| 224 |
+
Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. RoBERTa: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019.
|
| 225 |
+
|
| 226 |
+
Jian-Hao Luo, Jianxin Wu, and Weiyao Lin. Thinet: A filter level pruning method for deep neural network compression. In ICCV, 2017.
|
| 227 |
+
|
| 228 |
+
Paul Michel, Omer Levy, and Graham Neubig. Are sixteen heads really better than one? In NeurIPS, volume 32, 2019.
|
| 229 |
+
|
| 230 |
+
Asit Mishra, Jorge Albericio Latorre, Jeff Pool, Darko Stosic, Dusan Stosic, Ganesh Venkatesh, Chong Yu, and Paulius Micikevicius. Accelerating sparse deep neural networks. arXiv preprint arXiv:2104.08378, 2021.
|
| 231 |
+
|
| 232 |
+
Decebal Constantin Mocanu, Elena Mocanu, Peter Stone, Phuong H. Nguyen, Madeleine Gibescu, and Antonio Liotta. Scalable training of artificial neural networks with adaptive sparse connectivity inspired by network science. Nature Communications, 2018.
|
| 233 |
+
|
| 234 |
+
Sharan Narang, Eric Undersander, and Gregory Diamos. Block-sparse recurrent neural networks. arXiv preprint arXiv:1711.02782, 2017.
|
| 235 |
+
|
| 236 |
+
NVIDIA. Deep learning examples. https://github.com/NVIDIA/ DeepLearningExamples, 2020a.
|
| 237 |
+
|
| 238 |
+
NVIDIA. Imaginaire. https://github.com/NVlabs/imaginaire, 2020b.
|
| 239 |
+
|
| 240 |
+
NVIDIA. Megatron-LM. https://github.com/NVIDIA/Megatron-LM, 2020c.
|
| 241 |
+
|
| 242 |
+
Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan Ng, David Grangier, and Michael Auli. fairseq: A fast, extensible toolkit for sequence modeling. In NAACL-HLT, 2019.
|
| 243 |
+
|
| 244 |
+
Jongsoo Park, Sheng Li, Wei Wen, Ping Tak Peter Tang, Hai Li, Yiran Chen, and Pradeep Dubey. Faster cnns with direct sparse convolutions and guided pruning. In ICLR, 2017.
|
| 245 |
+
|
| 246 |
+
Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. PyTorch: An imperative style, high-performance deep learning library. In NeurIPS. 2019.
|
| 247 |
+
|
| 248 |
+
A Radford, K Narasimhan, T Salimans, and I Sutskever. Improving language understanding by generative pre-training. https://s3-us-west-2.amazonaws.com/openai-assets/ research-covers/language-unsupervised/language_understanding_ paper.pdf2, 2018.
|
| 249 |
+
|
| 250 |
+
Md Aamir Raihan and Tor M. Aamodt. Sparse weight activation training. In NeurIPS. 2020.
|
| 251 |
+
|
| 252 |
+
R. Reed. Pruning algorithms-a survey. IEEE Transactions on Neural Networks, 1993.
|
| 253 |
+
|
| 254 |
+
Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster R-CNN: Towards real-time object detection with region proposal networks. In NeurIPS. 2015.
|
| 255 |
+
|
| 256 |
+
Alex Renda, Jonathan Frankle, and Michael Carbin. Comparing rewinding and fine-tuning in neural network pruning. In ICLR, 2020.
|
| 257 |
+
|
| 258 |
+
Joseph Lee Rodgers and W. Alan Nicewander. Thirteen ways to look at the correlation coefficient. The American Statistician, 1988.
|
| 259 |
+
|
| 260 |
+
Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. MobileNetV2: Inverted residuals and linear bottlenecks. In CVPR, 2018.
|
| 261 |
+
|
| 262 |
+
Pedro Savarese, Hugo Silva, and Michael Maire. Winning the lottery with continuous sparsification. In NeurIPS, 2020.
|
| 263 |
+
|
| 264 |
+
Sohil Shah, Pallabi Ghosh, Larry S. Davis, and Tom Goldstein. Stacked U-Nets: A no-frills approach to natural image segmentation. arXiv preprint arXiv:1804.10343, 2018.
|
| 265 |
+
|
| 266 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
|
| 267 |
+
|
| 268 |
+
Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In CVPR, 2015. URL http://arxiv.org/abs/1409.4842.
|
| 269 |
+
|
| 270 |
+
Hidenori Tanaka, Daniel Kunin, Daniel L. K. Yamins, and Surya Ganguli. Pruning neural networks without any data by iteratively conserving synaptic flow. In NeurIPS, 2020.
|
| 271 |
+
|
| 272 |
+
Neil C. Thompson, Kristjan Greenewald, Keeheon Lee, and Gabriel F. Manso. The computational limits of deep learning. arXiv preprint arXiv:2007.05558, 2020.
|
| 273 |
+
|
| 274 |
+
Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Herve J ´ egou. Training data-efficient image transformers distillation through attention. ´ arXiv preprint arXiv:2012.12877, 2020.
|
| 275 |
+
|
| 276 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS. 2017.
|
| 277 |
+
|
| 278 |
+
Chaoqi Wang, Guodong Zhang, and Roger Grosse. Picking winning tickets before training by preserving gradient flow. In ICLR, 2020.
|
| 279 |
+
|
| 280 |
+
Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Guilin Liu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. Video-to-video synthesis. In NeurIPS, 2018a.
|
| 281 |
+
|
| 282 |
+
Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. Highresolution image synthesis and semantic manipulation with conditional gans. In CVPR, 2018b.
|
| 283 |
+
|
| 284 |
+
Ting-Chun Wang, Ming-Yu Liu, Andrew Tao, Guilin Liu, Jan Kautz, and Bryan Catanzaro. Fewshot video-to-video synthesis. In NeurIPS, 2019.
|
| 285 |
+
|
| 286 |
+
Wei Wen, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Learning structured sparsity in deep neural networks. In NeurIPS. 2016.
|
| 287 |
+
|
| 288 |
+
Mitchell Wortsman, Ali Farhadi, and Mohammad Rastegari. Discovering neural wirings. In NeurIPS. 2019.
|
| 289 |
+
|
| 290 |
+
Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V. Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, Jeff Klingner, Apurva Shah, Melvin Johnson, Xiaobing Liu, Łukasz Kaiser, Stephan Gouws, Yoshikiyo Kato, Taku Kudo, Hideto Kazawa, Keith Stevens, George Kurian, Nishant Patil, Wei Wang, Cliff Young, Jason Smith, Jason Riesa, Alex Rudnick, Oriol Vinyals, Greg Corrado, Macduff Hughes, and Jeffrey Dean. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016.
|
| 291 |
+
|
| 292 |
+
Yuxin Wu, Alexander Kirillov, Francisco Massa, Wan-Yen Lo, and Ross Girshick. Detectron2. https://github.com/facebookresearch/detectron2, 2019.
|
| 293 |
+
|
| 294 |
+
Fisher Yu, Vladlen Koltun, and Thomas Funkhouser. Dilated residual networks. In CVPR, 2017.
|
| 295 |
+
|
| 296 |
+
A. Zhou, Y. Ma, J. Zhu, J. Liu, Z. Zhang, K. Yuan, W. Sun, , and H. Li. Learning n:m fine-grained structured sparse neural networks from scratch. In ICLR, 2021.
|
| 297 |
+
|
| 298 |
+
M. Zhu and S. Gupta. To prune, or not to prune: Exploring the efficacy of pruning for model compression. In ICLR. 2018.
|
| 299 |
+
|
| 300 |
+
# A RECOMMENDATIONS FOR TRAINING
|
| 301 |
+
|
| 302 |
+
We expand our investigations on how to remove weights that do not learn meaningful information when training sparse models, covering more neural architectures and deep learning tasks.
|
| 303 |
+
|
| 304 |
+
Figure 5 plots the task error as a function of rewiring steps $r$ for sparse models of different $d$ . We observe that error increases with less frequent rewiring $\begin{array} { r } { r \infty } \end{array}$ ) for other vision tasks, since rewiring is related to how often traversal through the parameter space expands.
|
| 305 |
+
|
| 306 |
+

|
| 307 |
+
Figure 5: Same as Figure 2 (left). From left to right: InceptionV3 (Image Classification), Mask RCNN (Semantic Segmentation), Pix2PixHD (Image Generation).
|
| 308 |
+
|
| 309 |
+
Figure 6 shows the task error as a function of the scale factor $s$ applied to gradient updates for nonparticipating weights. We observe the error increases with decreasing contributions of the gradients $s \to 0$ ), which suggests updates to non-participating weights are also important during training for other tasks.
|
| 310 |
+
|
| 311 |
+

|
| 312 |
+
Figure 6: Same as Figure 2 (middle). From left to right: Mask R-CNN (Semantic Segmentation), Transformer (Machine Translation), Transformer-XL (Language Modeling).
|
| 313 |
+
|
| 314 |
+
Figure 7 demonstrates the task error as a function of the number of training steps $z$ at which nonparticipating weights are reset to zero. Similar to results in Section 3.2, error rates saturate after sufficient training $( z \sim 1 k )$ , which reinforces the idea that non-participating weights augment parameter spaces rather than model capacity.
|
| 315 |
+
|
| 316 |
+

|
| 317 |
+
Figure 7: Same as Figure 2 (right). From left to right: Mask RCNN (Semantic Segmentation), Transformer-XL (Language Modeling), GNMT (Machine Translation).
|
| 318 |
+
|
| 319 |
+
Figure 8 compares various exploration and exploitation strategies for training sparse models, as described in Section 3.3. While task accuracy degrades with lack of proper exploration or exploitation, inducing exploitation by removing gradient noise from non-participating weights (FIX, RESET, REGULARIZE) substantially decreases the error rates.
|
| 320 |
+
|
| 321 |
+

|
| 322 |
+
Figure 8: Same as Figure 3. From left to right: Transformer (Translation), Transformer-XL Large (Language Modeling).
|
| 323 |
+
|
| 324 |
+
The above results across more deep learning workloads further validate recommendations put forth in Section 3 for training sparse models.
|
| 325 |
+
|
| 326 |
+
# B EXPERIMENTAL SETUP
|
| 327 |
+
|
| 328 |
+
We design experiments on PyTorch (Paszke et al., 2019) using custom autograd functions for convolutions and linear layers. Our functions emulate sparsity using a binary tensor (or mask) that we multiply elementwise with the weights of each layer during forward and backward propagation. We determine masks based on weight magnitudes, as described earlier, after the optimizer step and before the next training iteration.
|
| 329 |
+
|
| 330 |
+
# B.1 IMAGE CLASSIFICATION
|
| 331 |
+
|
| 332 |
+
We train popular convolutional models like ResNets (He et al., 2016), VGG (Simonyan & Zisserman, 2015), Stacked U-Nets (Shah et al., 2018), Dilated Residual Networks (Yu et al., 2017), Inception (Szegedy et al., 2015), MobileNet (Sandler et al., 2018), as well as vision transformers like DeiT (Touvron et al., 2020). Training involves standard pipelines for image classification on ImageNet-2012 as described in literature and found in public code repositories. For most workloads, we adopt learning rates with linear warmups for the first 5 epochs, drop the learning rate by a factor of ten at epochs 30-60-80, and stop training after 90 epochs. A few select neural models (e.g., mobilenets and vision transformers), however, are trained for more epochs using linear or cosine schedules.
|
| 333 |
+
|
| 334 |
+
We measure model quality using top-1 classification accuracy. We apply sparsity to convolutions and linear layers with some exceptions: convolutions whose input channels are not divisible by 16 (e.g., first convolution layer, group and depthwise separable convolutions).
|
| 335 |
+
|
| 336 |
+
# B.2 IMAGE SEGMENTATION AND DETECTION
|
| 337 |
+
|
| 338 |
+
Image segmentation and detection tasks include both regression and classification components. Popular detectors and segmentors are typically trained in two phases: first a backbone is trained for image classification, followed by the addition of model components that are trained for detection or segmentation. Backbones are trained on ImageNet-2012, while downstream tasks are trained on COCO. We adapt training scripts and code from Detectron2 (Wu et al., 2019).
|
| 339 |
+
|
| 340 |
+
We train neural models such as regions with convolutional neural networks (R-CNN) variants (Ren et al., 2015; He et al., 2017), vanilla one-shot detectors (Liu et al., 2015), and with focal loss (Lin et al., 2017). Convolution and linear layers encountered in pretrained backbones are sparse, like for classification tasks. Detection and segmentation heads are also targeted.
|
| 341 |
+
|
| 342 |
+
# B.3 GENERATIVE MODELING
|
| 343 |
+
|
| 344 |
+
Generative Adversarial Networks (GANs) contain two subnetworks: a generative model and a discriminative model which combine regression and discrimination tasks during training. For image and video tasks, the generator model regresses pixel colors. We explore conditional GANs for super image-to-image translation and video-to-video synthesis using Imaginaire (NVIDIA, 2020b). We measure quality of generated outputs using the Frechet Inception Distance (FID). We experiment with generative neural models like Pix2PixHD (Wang et al., 2018b), Vid2Vid (Wang et al., 2018a), and FewShot-Vid2Vid (Wang et al., 2019), targeting convolution and linear layers.
|
| 345 |
+
|
| 346 |
+
# B.4 MACHINE TRANSLATION
|
| 347 |
+
|
| 348 |
+
We explore transformer and recurrent neural models for language translation. All models are encoder-decoder style architectures trained for English to German (En-De) translation on WMT. We adapt model and training code from Fairseq (Ott et al., 2019) and NVIDIA Deep Learning Examples (NVIDIA, 2020a). We measure model quality using BLEU scores.
|
| 349 |
+
|
| 350 |
+
We experiment with GNMT (Wu et al., 2016) and transformer-based architectures (Vaswani et al., 2017; Gu et al., 2019). All linear layers are sparse, except for embeddings and vocabulary projections.
|
| 351 |
+
|
| 352 |
+
# B.5 LANGUAGE MODELING
|
| 353 |
+
|
| 354 |
+
We consider recent advances in word-level language modeling using transformer decoder (left-toright) or encoder (bi-directional) architectures (Radford et al., 2018; Devlin et al., 2018). We pretrain language models in an unsupervised fashion on WikiText-103 or Wikipedia corpus, and evaluate on downstream tasks that are zero shot or require additional finetuning. We train them using Megatron (NVIDIA, 2020c) and NVIDIA Deep Learning Examples (NVIDIA, 2020a). Model quality is measured in terms of perplexity or F1 score.
|
| 355 |
+
|
| 356 |
+
We train language models such as Transformer-XL Dai et al. (2019) and BERT Devlin et al. (2018). We make all linear layers sparse, except for embeddings, vocabulary projections, and classification heads for downstream tasks.
|
| 357 |
+
|
| 358 |
+
# C COMPARISONS TO DENSE MODELS
|
| 359 |
+
|
| 360 |
+
It is also interesting to understand where does accuracy of our sparse models (SPARSE) fall between accuracies of dense (DENSE) and smaller neural models (SMALL). We define a metric $f \ = \ \mathrm { \big ( D E N S E - S E A R C H \big ) } / \big ( \mathrm { D E N S E - S M A L L } \big )$ , where a value of one means accuracy matches that of dense, and zero implies accuracy is no better than a smaller model.
|
| 361 |
+
|
| 362 |
+
Figure 9 illustrates $f$ as a function of model size $d$ for various tasks. For $d \sim 0 . 5$ , sparse models are able to approximate dense models across all neural architectures and tasks. While $f$ decreases for sparser models $( d \ll 0 . 5 )$ ), they are still much more efficient than smaller models. Even at $d = 0 . 1$ , most models can retain a large amount of accuracy.
|
| 363 |
+
|
| 364 |
+

|
| 365 |
+
Figure 9: Fraction of accuracy that sparse models achieve between dense and smaller models as a function of $d$ across various tasks and neural architectures. We measure the fraction as $f =$ (DENSE − SEARCH)/(DENSE − SMALL).
|
| 366 |
+
|
| 367 |
+
# D EFFECTS OF LONGER TRAINING
|
| 368 |
+
|
| 369 |
+
Since conventional models can achieve higher accuracy when trained on larger data sets or with longer training schedules (Liu et al., 2019), another interesting direction is to explore the effects of sparsity on models that are trained to the limits of their capacity. We train neural models longer by extending their learning rate schedules after warmup , e.g. a schedule $1 / t$ becomes $2 / t$ .
|
| 370 |
+
|
| 371 |
+
Figure 10 (left) plots accuracy differences as a function of training time $t$ , which denotes the ratio of training steps to the original training schedule. The fact accuracy improves with more training suggests neural models are often not trained to capacity using conventional schedules. We observe sparse models achieve worse accuracy than dense models that are undertrained $( t \sim 1 )$ ), but can match accuracy when trained to capacity $( t \gg 1 )$ ).
|
| 372 |
+
|
| 373 |
+
Figure 10 (middle) illustrates task errors between dense and sparse models that have been trained for the same number of steps. We find error scales inversely with $t$ , since more training gives neural models better chances to explore parameter spaces. Particularly, errors can reach zero with sufficient training (Evci et al., 2020a) for models that are not constrained by capacity $( d \geq 0 . 2 5 )$ . Figure 10 (right) shows the time it takes for sparse models to recover accuracy of dense models is relatively short when $t \sim 1$ , but significantly longer as accuracy saturates $( t \gg 1 )$ ).
|
| 374 |
+
|
| 375 |
+
Investigations on the effects of longer training are expanded to more neural architectures and deep learning tasks. Figure 11 illustrates accuracy deltas as a function of training time $t$ . For vision tasks, we find sparse models of moderate sizes $d \geq 0 . 2 5 )$ can match accuracy of dense models after sufficient training $( t \geq 3 )$ ). On the other hand, for language modeling, sparse models cannot match accuracy for any time $t$ because dense models are already near capacity for the task at hand. Obviously, when using popular training schedules $( t \sim 1 )$ ), sparse models can be trained a bit longer to recover the accuracy lost.
|
| 376 |
+
|
| 377 |
+
# E APPLICATION ON HARDWARE ACCELERATORS
|
| 378 |
+
|
| 379 |
+
This appendix explores various sparsity structures considered in the paper that are amenable for acceleration using modern matrix-math hardware.
|
| 380 |
+
|
| 381 |
+

|
| 382 |
+
Figure 10: Effects of sparsity with longer training of ResNet18. Left: Accuracy differences as a function of training time $t$ (or ratio of steps to the original training schedule). Middle: Task error between dense and sparse models trained for the same duration. Right: Training time it takes for sparse models to match accuracy of dense models.
|
| 383 |
+
|
| 384 |
+

|
| 385 |
+
Figure 11: Same as Figure 10 (left). Left to right: ResNet50 (Classification), InceptionV3 (Classification), Transformer-XL (Language Modeling).
|
| 386 |
+
|
| 387 |
+
# E.1 BLOCK SPARSITY
|
| 388 |
+
|
| 389 |
+
We first consider block sparsity (Narang et al., 2017; Gray et al., 2017), which removes blocks of contiguous elements (or weights) in a neural layer as shown in Figure 12. Block sparsity addresses common issues that are present for unstructured formats: indices for active blocks reduce storage overhead by a factor of the block size, blocks are stored contiguously in memory which reduces irregular memory accesses, and their computations can exploit faster matrix-math hardware, such as Tensor Cores in NVIDIA GPUs.
|
| 390 |
+
|
| 391 |
+
We construct block sparse structures by (1) partitioning a neural layer into a set of blocks, (2) aggregating elements in each block into a metric, and (3) removing blocks according to some criteria based on their metrics. While we remove blocks based on largest magnitude $\operatorname* { m a x } _ { i \in ( 1 , b ^ { 2 } ) } w _ { i }$ . Other choices such as the $p$ -norm $( \sum _ { i } ^ { b ^ { 2 } } | w _ { i } | ^ { p } ) ^ { 1 / p }$ achieve similar results.
|
| 392 |
+
|
| 393 |
+
Because structures restrict the combination of weights that can be formed in a neural model, an important question is then for what block sizes $b$ (if any) can sparse models retain accuracy. Table 3 lists accuracy differences between sparse and dense models for $d = 0 . 5$ using various block sizes. We find block sparse models fail to maintain accuracy, performing no better than smaller models. Notably, accuracy deteriorates for all tasks and block sizes, including smaller blocks $( b \leq 4 )$ that are less amenable for hardware acceleration. In other words, block structures are too coarse for retaining short-term correlations. For example, different weights in a block may have different roles during training: a block that participates in training may contain weights that are not important, wheres a non-participating block may have weights that were crucial to keep. Both cases prevent sparse models from retaining weights over time that are relevant for traversing the parameter space, and thus impacting accuracy.
|
| 394 |
+
|
| 395 |
+

|
| 396 |
+
Figure 12: Block sparse, $2 { : } 4 ~ 1 \mathrm { D }$ , and $2 { : } 4 \ 2 \mathrm { D }$ structures for a $4 \times 4$ neural layer. Blank cells represent weights that do not participate in training (are assumed zero) and colored cells denote weights that participate (have nonzero values). Arrows indicate direction along which structure is imposed.
|
| 397 |
+
|
| 398 |
+
Table 3: Accuracies for dense models and their differences for block sparse models using different block sizes $b$ .
|
| 399 |
+
|
| 400 |
+
<table><tr><td>Model</td><td>DENSE</td><td>SMALL</td><td>b=1</td><td>b=2</td><td>b=4</td><td>b=8</td><td>b=16</td><td>b=32</td></tr><tr><td>Transformer-XL</td><td>22.88</td><td>-2.48</td><td>-0.82</td><td>-2.03</td><td>-2.35</td><td>-2.24</td><td>-2.36</td><td>-2.41</td></tr><tr><td>Transformer</td><td>28.43</td><td>-0.77</td><td>-0.21</td><td>-0.75</td><td>-1.10</td><td>-1.47</td><td>-1.98</td><td>-1.94</td></tr><tr><td>GNMT</td><td>24.81</td><td>-2.75</td><td>-0.15</td><td>-0.15</td><td>+0.02</td><td>-0.08</td><td>-0.15</td><td>+0.30</td></tr><tr><td>ResNet50</td><td>76.71</td><td>-1.63</td><td>-0.46</td><td>-0.99</td><td>-2.19</td><td>-2.79</td><td>1</td><td></td></tr><tr><td>Mask RCNN</td><td>35.03</td><td>-0.88</td><td>-0.28</td><td>-1.17</td><td>-2.43</td><td>-3.74</td><td>-4.41</td><td>-5.00</td></tr></table>
|
| 401 |
+
|
| 402 |
+
# E.2 2:4 SPARSITY
|
| 403 |
+
|
| 404 |
+
We next consider Sparse Tensor Cores (Mishra et al., 2021) introduced in NVIDIA Ampere GPU architecture which exploit 2:4 sparsity and have twice the math throughput of regular matrix units. Figure 12 shows that 2:4 sparsity mandates each group of four values must have at least two values that are zero. Typically, 2:4 is applied on weights $w$ in the forward pass, $y = w x$ . However, we can also apply 2:4 on weight transposes $w ^ { T }$ for the backward pass, $\bar { \partial } L / \partial \bar { x } = \partial L / \partial y \times w ^ { T }$ . We denote these two options as $2 { : } 4 \ 1 \mathrm { D }$ that accelerates forward pass for inference Mishra et al. (2021), and $2 { : } 4 ~ 2 \mathrm { D }$ that accelerates both forward and backward passes for training.
|
| 405 |
+
|
| 406 |
+
The 2:4 sparsity structure must always be imposed along the inner dimension of dot products. For linear layers, we apply 2:4 on a $n \times k$ weight tensor along $k$ or $n$ (for forward or backward pass, respectively). For convolutions, we apply 2:4 on a $k \times c \times r \times s$ weight tensor along input channels $c$ or $k \times r \times s$ (for forward or backward pass, respectively), where $k$ denotes output channels, $r$ and $s$ are kernel dimensions.
|
| 407 |
+
|
| 408 |
+
We can satisfy $2 { : } 4 \ 1 \mathrm { D }$ constraints by removing weights with lowest magnitudes. Since 2:4 2D constraints have no trivial solution, we seek to minimize the cumulative magnitude of the removed weights. In other words, for each $4 \times 4$ block in the tensor, we construct all possible combinations of $2 { : } 4 ~ 2 \mathrm { D }$ patterns, compute their 1-norm, and choose the structure that has the largest norm.
|
| 409 |
+
|
| 410 |
+
# F COMPARISONS TO SPARSITY RESEARCH
|
| 411 |
+
|
| 412 |
+
We expand our comparisons to literature covering more neural architectures and deep learning tasks. Figure 13 illustrates the task error across various methods, neural architectures, and tasks. We find our strategy outperforms competing approaches in most cases with a few exceptions: we do not outperform lottery tickets in segmentation tasks because detectors and segmentors are trained with small learning rates which limit exploration. For generation tasks, our models are slightly worse for $d \sim 0 . 5$ (though noisy scores make it difficult to draw conclusions), but the asymptotic behavior of error rates as $d \to 0$ clearly indicates that our approach is superior.
|
| 413 |
+
|
| 414 |
+

|
| 415 |
+
Figure 13: Same as Figure 4. Clockwise: InceptionV3 (Classification), DenseNet161 (Classification), VGG19 (Classification), GNMT (Translation), Pix2PixHD (Generation), Mask RCNN (Segmentation).
|
md/dev/JtBRnrlOEFN/JtBRnrlOEFN.md
ADDED
|
@@ -0,0 +1,465 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CHARFORMER: FAST CHARACTER TRANSFORMERS VIA GRADIENT-BASED SUBWORD TOKENIZATION
|
| 2 |
+
|
| 3 |
+
Yi Tay∗, Vinh Q. Tran∗, Sebastian Ruder†, Jai Gupta, Hyung Won Chung, Dara Bahri Zhen Qin, Simon Baumgartner, Cong Yu, Donald Metzler
|
| 4 |
+
|
| 5 |
+
Google Research and DeepMind† yitay@google.com, vqtran@google.com
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
State-of-the-art models in natural language processing rely on separate rigid subword tokenization algorithms, which limit their generalization ability and adaptation to new settings. In this paper, we propose a new model inductive bias that learns a subword tokenization end-to-end as part of the model. To this end, we introduce a soft gradient-based subword tokenization module (GBST) that automatically learns latent subword representations from characters in a data-driven fashion. Concretely, GBST enumerates candidate subword blocks and learns to score them in a position-wise fashion using a block scoring network. We additionally introduce CHARFORMER, a deep Transformer model that integrates GBST and operates on the byte level. Via extensive experiments on English GLUE, multilingual, and noisy text datasets, we show that CHARFORMER outperforms a series of competitive byte-level baselines while generally performing on par and sometimes outperforming subword-based models. Additionally, CHARFORMER is fast, improving the speed of both vanilla byte-level and subword-level Transformers by $2 8 \mathrm { - } 1 0 0 \%$ while maintaining competitive quality. We believe this work paves the way for highly performant token-free models that are trained completely end-to-end.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Neural networks have achieved tremendous success in natural language processing (NLP) by replacing feature-engineered models with stacks of functions that are learned end-to-end from vast amounts of data (Mikolov et al., 2013; Peters et al., 2018; Howard and Ruder, 2018). The single component of the traditional NLP pipeline (Manning and Schütze, 1999) that has so far resisted gradient-based learning is tokenization, which is commonly applied as a pre-processing step. State-of-the-art pre-trained language models (Devlin et al., 2019) generally rely on data-driven subword-based tokenization algorithms (Schuster and Nakajima, 2012; Sennrich et al., 2016; Wu et al., 2016; Kudo and Richardson, 2018) while expert-crafted segmentation algorithms are still common for languages without whitespace separation such as Chinese, Thai, and Korean (cf. Lample and Conneau, 2019).
|
| 14 |
+
|
| 15 |
+
This reliance on rigid tokenization methods introduces a bottleneck into current NLP systems that limits their capabilities. Subword segmentation algorithms split tokens into subwords solely based on frequency, without taking into account lexical or semantic similarity. As a result, models are brittle to rare words (Gong et al., 2018) and perturbations, both natural and adversarial (Belinkov and Bisk, 2018; Pruthi et al., 2019; Sun et al., 2020). In multilingual models, tokens in low-resource languages are split into many subwords, which impacts performance on those languages and deteriorates crosslingual transfer (Hu et al., 2020; Wang et al., 2021). Finally, a separate tokenization algorithm leads to a mismatch between the pre-training and downstream distribution of words when adapting pre-trained language models to new settings, which requires significant engineering effort to overcome.
|
| 16 |
+
|
| 17 |
+
The direct application of character-level modelling into pre-trained language models in turn results in severely increased computational and memory complexity due to an increased sequence length and generally lower performance. To address this problem, we propose gradient-based subword tokenization (GBST), a new method that combines the compositionality of character-level representations with the efficiency of subword tokenization while enabling end-to-end learning. Our method learns latent subword representations from characters using large amounts of unlabeled data. Specifically, GBST learns a position-wise soft selection over candidate subword blocks by scoring them with a scoring network. In contrast to prior tokenization-free methods (Clark et al., 2021), GBST learns interpretable latent subwords, which enables easy inspection of lexical representations and is more efficient than other byte-based models (Xue et al., 2021). Given that simply applying a standard Transformer on a sequence of characters and bytes is computationally prohibitive, GBST paves the way for usable, practical and highly performant character-level models. A high level overview of how the GBST module is applied can be found at Figure 3 (Appendix).
|
| 18 |
+
|
| 19 |
+
We furthermore introduce CHARFORMER, a Transformer encoder-decoder model that uses GBST to operate directly on the byte level. In addition, we experiment with a re-scaled variant of CHARFORMER, which allocates additional capacity to the encoder to make up for the lack of discrete subword embeddings.
|
| 20 |
+
|
| 21 |
+
We evaluate our model on a range of standard and non-standard English, and multilingual downstream tasks. On English GLUE and long document classification tasks, CHARFORMER outperforms strong byte-level baselines and overall achieves performance on par with subword-based models such as BERT (Devlin et al., 2019) and T5 (Raffel et al., 2020). On toxicity detection in social media datasets (Borkan et al., 2019; Wulczyn et al., 2017), CHARFORMER outperforms byte-level baselines as well as subword-based models, demonstrating robustness to spelling variation and non-standard language. Finally, a multilingually pre-trained CHARFORMER performs on par or outperforms strong subword-based multilingual baselines on standard cross-lingual datasets.
|
| 22 |
+
|
| 23 |
+
We additionally demonstrate CHARFORMER is more efficient compared to byte-level and subwordbased models with similar numbers of parameters. On a comparable setup, CHARFORMER outperforms a baseline similar to the recent state-of-the-art byte-level model ByT5 (Xue et al., 2021) while being $2 \times$ more memory efficient and $10 \mathrm { - } 9 3 \%$ faster. CHARFORMER also trains $28 \%$ faster than the subword-level mT5 model (Xue et al., 2020), has $3 \times$ fewer parameters and achieves comparable quality on well-established benchmarks. Finally, we demonstrate via visualization that the latent subwords learned by CHARFORMER are interpretable to some extent.
|
| 24 |
+
|
| 25 |
+
# 2 CHARFORMER
|
| 26 |
+
|
| 27 |
+
This section introduces our efficient character-level architecture, CHARFORMER. CHARFORMER is comprised of a Gradient-Based Subword Tokenization (GBST) module, followed by deep Transformer layers. The input to the GBST module is a sequence of characters or bytes1, which is then downsampled to construct latent subwords.
|
| 28 |
+
|
| 29 |
+
# 2.1 GRADIENT-BASED SUBWORD TOKENIZATION (GBST)
|
| 30 |
+
|
| 31 |
+
The input to GBST is a tensor of shape $\boldsymbol { X } \in \mathbb { R } ^ { L \times d }$ where $L$ is the number of input characters and $d$ is the character embedding dimension. The key idea behind GBST is for the model to learn to perform a latent subword segmentation of the input by selecting the most suitable subword block at every character position. A block is a contiguous span of characters $X _ { i : i + b }$ of length $b$ for $1 \leq i \leq L - b$ .
|
| 32 |
+
|
| 33 |
+
# 2.1.1 CONSTRUCTING CANDIDATE LATENT SUBWORD BLOCKS
|
| 34 |
+
|
| 35 |
+
We first enumerate all possible subword blocks of size $b$ up to a maximum block size $M$ . In order to learn subword block embeddings, we use a non-parameterized strided pooling function $F : \mathbb { R } ^ { b \times d } \mathbb { R } ^ { d }$ that projects a subword block consisting of a sequence of character embeddings $X _ { i : i + b } \in \mathbb { R } ^ { b \times d }$ to a single subword block representation $X _ { b , i } \in \mathbb { R } ^ { d }$ for block size $b$ at position $i$ . We compute subword blocks $X _ { b , i }$ with a stride $s$ :
|
| 36 |
+
|
| 37 |
+
$$
|
| 38 |
+
X _ { b } = [ F ( X _ { i : i + b } ) ; F ( X _ { ( i + s ) : ( i + s ) + b } ) ; . . . ]
|
| 39 |
+
$$
|
| 40 |
+
|
| 41 |
+

|
| 42 |
+
|
| 43 |
+

|
| 44 |
+
Figure 1: Illustration of subword block formation and scoring.
|
| 45 |
+
|
| 46 |
+
(a) Formation of subword blocks to be scored by $F _ { R }$ .
|
| 47 |
+
Offsets and/or pre-GBST convolutions not shown.
|
| 48 |
+
|
| 49 |
+
(b) Block scores that have been expanded back to length $L$ . Softmax is taken over block scores at each position $i$ to form block weights for constructing latent subword representations.
|
| 50 |
+
|
| 51 |
+
In practice we set $s = b$ , thus $X _ { b } \in \mathbb { R } ^ { \frac { L } { b } \times d }$ . The construction of latent subword blocks creates a shorter overall sequence length by downsampling. We construct $X _ { b }$ for $b \in { 1 , \dots , M }$ , which can be seen in Figure 1 for $M = 4$ .
|
| 52 |
+
|
| 53 |
+
Considering Offsets A limitation of a strided implementation is that it is unable to model all possible subword windows. For instance, for the character sequence $[ a , b , c , d ]$ we would only be able to allocate $[ a , b ]$ and $[ c , d ]$ as subword blocks of length $b = 2$ and would ignore the subword block $[ b , c ]$ . Offsets can be used to model sliding windows of all possible subword blocks. We consider enumerating all possible strided blocks by additionally shifting sequences up until the offset $s$ . As this increases computation, we instead propose to first apply a 1D convolution to $X$ , prior to enumerating subword blocks. This effectively “smoothes” over the subword blocks. We use the variant with 1D convolutions in our main experiments and provide additional ablations in $\ S 8 . 3$ of the Appendix.
|
| 54 |
+
|
| 55 |
+
Considering Intra-block Positions It is important to preserve the ordering of the characters within the block $X _ { i } , X _ { i + 1 } , \ldots , X _ { i + b }$ . E.g., the output of $F$ should differ for the blocks abc and bca. For certain choices of $F$ it may be valuable to add a positional embedding (Vaswani et al., 2017) to $X _ { i : i + b }$ before applying $F$ . Note that this positional embedding would only be for individual blocks, and is not global to the entire input sequence. That is, only positional embedding values for positions $1 , \ldots , b$ would be used. However, in practice we apply a 1D convolution before the GBST layer and use the mean-pooling function for $F$ . We find this to be sufficient to distinguish between same sized blocks with different character orders.
|
| 56 |
+
|
| 57 |
+
# 2.1.2 BLOCK SCORING NETWORK
|
| 58 |
+
|
| 59 |
+
In order to allow the model to learn which block to select for every character position, we introduce a block scoring network. The block scoring network is simply a parameterized function $F _ { R } ( . )$ that produces a score for each candidate block. Given a subword candidate block $X _ { b , i } \in \mathbb { R } ^ { d }$ , we compute a score $p _ { b , i }$ associated with the block using a simple linear transformation $F _ { R } : \mathbb { R } ^ { d } \mathbb { R }$ :
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
p _ { b , i } = F _ { R } ( X _ { b , i } )
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
We perform ranking of subword blocks with regard to each character position in the original sequence. At every position $i$ , the model learns to select the most suitable subword block $X _ { b , i }$ among all block sizes $1 \leq b \leq M$ . As each sequence of subword blocks $X _ { b }$ is downsampled, we realign the representations of the subword blocks by upsampling each $X _ { b }$ to its original sequence length $L$ . Specifically, for a block size of $b$ , we replicate each block representation $X _ { b , i } b$ times. We then score each candidate block at each position $i$ using the softmax function:
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
P _ { i } = \mathrm { s o f t m a x } ( [ p _ { 1 , i } , p _ { 1 , i } , \cdot \cdot \cdot , p _ { M , i } ] ) ,
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
which computes a relative score of each candidate block at each position and $P _ { i } \in \mathbb { R } ^ { M }$ . We show the scoring of realigned blocks in Figure 1.
|
| 72 |
+
|
| 73 |
+
# 2.1.3 FORMING LATENT SUBWORDS
|
| 74 |
+
|
| 75 |
+
We then sum the representations of all subword blocks $X _ { b , i }$ at each position $i$ multiplied by their learned probability $P _ { b , i }$ to form a latent subword representation $\hat { X } _ { i } \in \mathbb { R } ^ { d }$ :
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
\hat { X } _ { i } = \sum _ { b } ^ { M } P _ { b , i } X _ { b , i }
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
Intuitively, the model learns an ideal subword block for each position. In contrast to standard deterministic subword tokenization algorithms, this selection is soft and can thus consider different possible segmentations at every position $i$ . In general, however, this formulation still assumes that subwords are contiguous sequences of characters. While additional context can be considered via the convolutions in $\ S 2 . 1 . 1$ , non-concatenative morphology where morphemes are discontinuous may be harder for the method to model.2
|
| 82 |
+
|
| 83 |
+
# 2.1.4 POSITION-WISE SCORE CALIBRATION
|
| 84 |
+
|
| 85 |
+
In the above approach, the scoring of each position is independent of other positions. We hypothesize that it may be beneficial for block scores at each position to be aware of each other. To this end, we introduce an optional module that enables learning a consensus among block scores by calculating dot products across the scores $P _ { i }$ across all positions $i \in [ 1 , L ]$ . This can be viewed as a form of self-attention across block scores, albeit without any projections for computational efficiency. To learn the new scores $\hat { P } \in \mathbb { R } ^ { L \times M }$ , we compute $\hat { P } = \operatorname { s o f t m a x } ( P P ^ { \top } ) P$ .
|
| 86 |
+
|
| 87 |
+
# 2.1.5 DOWNSAMPLING
|
| 88 |
+
|
| 89 |
+
After learning a candidate block or mixture of blocks for each position, we use a downsampling function $F _ { D } : \mathbb { R } ^ { L \times d } \mathbb { R } ^ { \frac { L } { d _ { s } } \times d }$ that downsamples the sequence of latent subwords $\hat { X } = [ \hat { X } _ { 1 } , \dots , \hat { X } _ { L } ]$ to $\tilde { X }$ , reducing its sequence length by a factor of $d _ { s }$ . We choose $F _ { D }$ to be a non-parameterized mean pooling operation. Notably, such simple stride-based pooling removes potential redundancies caused by adjacent positions selecting similar blocks as the mean pool of two identical block embeddings produces the same outcome. Intuitively, as the downsampling operation is fixed, the parameterized components preceding it should learn an optimal subword tokenization given the downsampling.
|
| 90 |
+
|
| 91 |
+
# 2.2 TRANSFORMER STACK
|
| 92 |
+
|
| 93 |
+
The remainder of the CHARFORMER model remains identical to a regular Transformer encoderdecoder model. The Transformer stack operates on the downsampled latent subwords $\tilde { X }$ instead of subword embeddings.
|
| 94 |
+
|
| 95 |
+
Re-scaling of the Transformer Stack While subword-based models allocate much of their capacity to subword embeddings—up to $71 \%$ of all parameters for contemporary multilingual models (Chung et al., 2021)—, the character vocabulary of character-level models is much smaller and thus less expressive. Similar to Xue et al. (2021), we hypothesize that character-level models require deeper encoder stacks than subword-based models to make up for their smaller embedding capacity. Consequently, we explore a scaling variant of CHARFORMER that puts more parameters at the encoder at the expense of the decoder while preferring a deep narrow model over a larger wide model. Specifically, we re-configure the Base model size to be similar to the T5 Small model size, with an expanded 24 layers in the encoder. The resulting $\mathbf { C } _ { \mathrm { H A R F O R M E R } _ { S B a s e } }$ (Scaled Base) has $1 3 4 M$ parameters, which is about $67 \%$ the parameter footprint of the standard base T5 model (200M parameters; Raffel et al., 2020). Moreover, this particular CHARFORMER model is approximately $5 0 \mathrm { - } 1 0 0 \%$ faster than the T5 base model (see $\ S 4$ ).3 For the re-scaled variant, we also used the GLU variant described in (Shazeer, 2020) which is commonly referred to as the V1.1 variant in the T5 library.
|
| 96 |
+
|
| 97 |
+
A Note on Comparing Character-level and Subword-based Methods Prior work on efficient methods generally compares models with the same number of parameters (Chung et al., 2021). However, whereas embedding look-up even with large vocabularies in subword-based methods is $\mathcal { O } ( 1 )$ , re-distributing the subword embedding parameters in character-level models such as ByT5 (Xue et al., 2021) to dense layers incurs much higher computational costs—a $2 5 \%$ penalty in training speed. We believe that a fair re-scaling of character-level models should not only aim to match the number of parameters but also the compute and inference costs of subword-based models under the assumption that char/byte-level models will require longer sequences (see $\ S 4$ for a comparison).
|
| 98 |
+
|
| 99 |
+
Span-based Pre-training Our pre-training scheme follows T5 quite closely. We mask $N$ contiguous characters and train to predict them in a sequence-to-sequence architecture following Xue et al. (2021). The model optimizes the cross-entropy loss and is trained with teacher forcing.
|
| 100 |
+
|
| 101 |
+
# 3 EXPERIMENTS
|
| 102 |
+
|
| 103 |
+
We evaluate our method both in English as well as in a multilingual setting on relevant benchmarks and compare against state-of-the-art character-level and subword-based methods.
|
| 104 |
+
|
| 105 |
+
# 3.1 EXPERIMENTS ON MONOLINGUAL ENGLISH DATASETS
|
| 106 |
+
|
| 107 |
+
Data To showcase the effectiveness of the proposed method, we evaluate on a diverse set of standard English tasks from GLUE covering sentiment classification (SST-2; Socher et al., 2013), natural language inference (MNLI, QNLI; Williams et al., 2018; Rajpurkar et al., 2016), paraphrase detection (Dolan and Brockett, 2005, MRPC, QQP) and sentence similarity (Cer et al., 2017). In addition, we evaluate on tasks that require dealing with long documents, both for sentiment analysis (IMDb; Maas et al., 2011) and news classification (AGNews; Zhang et al., 2015).
|
| 108 |
+
|
| 109 |
+
Baselines We compare CHARFORMER against the following state-of-the-art subword-based models: BERT (Devlin et al., 2019), an encoder-only pre-trained masked language model; and T5 (Raffel et al., 2020), an encoder-decoder model. We also compare against Byte-level T5 (Xue et al., 2021), a T5 model that is directly applied to bytes. We additionally evaluate the impact of the downsampling in CHARFORMER by comparing it to the downsampling used by the character-level CANINE (Clark et al., 2021) model in our framework. CANINE downsamples a character sequence using local attention and pooling via strided convolutions. As the original CANINE uses an encoder-only model and was only trained on multilingual data, we integrate CANINE-style downsampling into Byte-level T5, which we refer to as Byte-level T5+LASC (local attention–strided convolution).4 As an ablation for the GBST inductive bias, we compare against Byte-level $\mathrm { T } 5 + \mathrm { C o n v } _ { B a s e }$ a convolutional baseline of Byte-level T5 with a 1D convolution of filter size 5 placed before the encoder. Note that in all the baselines and for CHARFORMER base models, in the spirit of fair comparison, we compare them at an equal parameterization (size). Our scaling experiments are reserved for our SBase models, which is intended to only be compared with subword T5 models, and not to unscaled byte-level baselines. Finally, we include an SBase scaled version of Byte-level T5 for comparison.
|
| 110 |
+
|
| 111 |
+
Setup We evaluate Base and SBase configurations of CHARFORMER with 203M and 134M parameters respectively. We compare to Base configurations of BERT and T5 that have a similar number of parameters. We pre-train all models on the C4 corpus for 1M steps using a batch size of 64 and sequence length of 1024. All non-subword models use a vocabulary of 256 bytes.5 Our pre-training scheme corrupts spans with a mean length of 20 bytes. Each model is pre-trained on 16 TPU V3 chips. We pre-train our models with the Adafactor optimizer with an inverse square root learning rate. We then fine-tune on each individual task separately using a constant learning rate of $1 0 ^ { - 3 }$ . More details can be found in the Appendix.
|
| 112 |
+
|
| 113 |
+
Table 1: Comparison of CHARFORMER against other subword and character-level models with different parameter sizes on diverse standard English datasets.
|
| 114 |
+
|
| 115 |
+
<table><tr><td>Model</td><td>0</td><td>SST-2</td><td>MNLI</td><td>QNLI</td><td>MRPC</td><td>QQP</td><td>STSB</td><td>COLA</td><td>AVG</td></tr><tr><td>BERTBase,Subword</td><td>110M</td><td>92.7</td><td>84.4/-</td><td>88.4</td><td>86.7/-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>T5Base,Subword</td><td>220M</td><td>92.7</td><td>84.2/84.6</td><td>90.5</td><td>88.9/92.1</td><td>91.6/88.7</td><td>88.0</td><td>53.8</td><td>84.3</td></tr><tr><td>Byte-level T5 Base</td><td>200M</td><td>91.6</td><td>82.5/82.7</td><td>88.7</td><td>87.3/91.0</td><td>90.9/87.7</td><td>84.3</td><td>45.1</td><td>81.5</td></tr><tr><td>Byte-level T5+ConV Base</td><td>205M</td><td>89.8</td><td>81.1/82.5</td><td>89.2</td><td>83.6/89.2</td><td>90.7/87.7</td><td>85.0</td><td>47.1</td><td>81.2</td></tr><tr><td>Byte-level T5+LASCBase</td><td>205M</td><td>90.0</td><td>80.0/80.8</td><td>87.1</td><td>82.8/88.1</td><td>89.0/85.4</td><td>83.7</td><td>25.3</td><td>77.0</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>91.6</td><td>82.6/82.7</td><td>89.0</td><td>87.3/91.1</td><td>91.2/88.1</td><td>85.3</td><td>42.6</td><td>81.4</td></tr><tr><td>Byte-level T5s Base</td><td>133M</td><td>91.2</td><td>83.9/83.7</td><td>90.9</td><td>85.5/89.2</td><td>91.1/88.1</td><td>85.7</td><td>49.3</td><td>82.6</td></tr><tr><td>CHARFORMERSBase</td><td>134M</td><td>91.5</td><td>83.7/84.4</td><td>91.0</td><td>87.5/91.4</td><td>91.4/88.5</td><td>87.3</td><td>51.8</td><td>83.6</td></tr></table>
|
| 116 |
+
|
| 117 |
+
Table 2: Results on comment classification on Civil Comments and Wiki Comments. Metrics are accuracy and AUC-PR. T5 baseline results are from (Tay et al., 2021).
|
| 118 |
+
|
| 119 |
+
<table><tr><td>Model</td><td>Civil Comments</td><td>Wiki Comments</td></tr><tr><td>T5Base,Subword</td><td>81.2/-</td><td>91.5/-</td></tr><tr><td>Byte-level T5 Base</td><td>82.8/78.7</td><td>93.2/75.4</td></tr><tr><td>Byte-level T5+LASCBase</td><td>82.9 / 78.2</td><td>93.0 / 75.0</td></tr><tr><td>CHARFORMER Base</td><td>83.0/78.8</td><td>92.7 / 79.7</td></tr><tr><td>CHARFORMER SBase</td><td>83.0 /78.9</td><td>93.5 /75.5</td></tr></table>
|
| 120 |
+
|
| 121 |
+
Table 3: Results on text classification on long documents.
|
| 122 |
+
|
| 123 |
+
<table><tr><td>Model</td><td>IMDb</td><td>News</td></tr><tr><td>T5 Base,Subword</td><td>94.2</td><td>93.5</td></tr><tr><td>Byte-level T5 Base</td><td>91.5</td><td>93.6</td></tr><tr><td>Byte-level T5+LASC Base</td><td>91.1</td><td>93.5</td></tr><tr><td>CHARFORMER Base</td><td>91.5</td><td>94.0</td></tr><tr><td>CHARFORMER SBase</td><td>94.4</td><td>94.1</td></tr></table>
|
| 124 |
+
|
| 125 |
+
Results For all result tables, we divide the table into three sections: subword baseline(s), un-scaled byte-level baselines, and scaled CHARFORMER results. If a section and task combination has more than one model result, we underline the best result. We show result for GLUE in Table 1. CHARFORMER outperforms other character-level baselines trained under the same conditions with the same number of parameters across all tasks, while being considerably faster and requiring less compute than T5-style models that are directly applied to bytes or characters (see $\ S 4$ ). CHARFORMERSBase performs even better despite having a smaller number of parameters compared to the Base configuration, demonstrating the usefulness of rescaling the transformer stack for character-level models. CHARFORMER $S B a s e$ furthermore is the only model that performs on par or even outperforms the standard subword-based models on some tasks in standard English. In Table 3 we provide results for text classification of long documents. Here, CHARFORMER $S B a s e$ is the only byte-level model to outperform $\mathrm { T } 5 _ { B a s e , S u b w o r d }$ on the IMDb classification task, and both CHARFORMER models outperform byte and subword level baselines on AGNews.
|
| 126 |
+
|
| 127 |
+
# 3.2 EXPERIMENTS ON NON-STANDARD ENGLISH DATASETS
|
| 128 |
+
|
| 129 |
+
The previous set of experiments demonstrated the ability of CHARFORMER to perform well on clean datasets consisting of standard English. However, character-level models are particularly suited to data that is noisy, containing spelling variations, typos, and other non-standard language.
|
| 130 |
+
|
| 131 |
+
Data To demonstrate CHARFORMER’s ability to perform well on such data, we evaluate on toxicity detection using the Civil Comments (Borkan et al., 2019) and the Wikipedia Comments (Wulczyn et al., 2017) datasets. Both are standard benchmarks that require estimating the toxicity of usergenerated content. We use the same setup as for the standard English datasets.
|
| 132 |
+
|
| 133 |
+
Results We show results in Table 2. Character-level models outperform the subword-based T5 model on both datasets, demonstrating their suitability to deal with such noisy, user-generated data. CHARFORMER achieves performs on par or outperforms other character-level methods on both datasets across the different model sizes.
|
| 134 |
+
|
| 135 |
+
# 3.3 MULTILINGUAL EXPERIMENTS
|
| 136 |
+
|
| 137 |
+
Data To evaluate the effectiveness of character-level models on multilingual data, we evaluate on standard cross-lingual question answering and classification tasks. In particular, we evaluate on the question answering tasks TyDiQA-GoldP (Clark et al., 2020), XQuAD (Artetxe et al., 2020), and MLQA (Lewis et al., 2020) as well as the natural language inference task XNLI (Conneau et al., 2018) and the paraphrase detection task PAWS-X (Yang et al., 2019) from XTREME (Hu et al., 2020). We evaluate on the in-language multi-task setting for TyDiQA-GoldP (Clark et al., 2020) where models are fine-tuned on the combined gold data in all target languages and the translate-train-all setting where models are fine-tuned on English training data plus translations in all target languages for the other datasets. Both are the best-performing settings for the respective tasks in (Hu et al., 2020). In addition, we evaluate on zero-shot cross-lingual transfer from English on XNLI and PAWS-X.
|
| 138 |
+
|
| 139 |
+
Table 4: Multilingual comparison of CHARFORMER against subword and byte-level models on in-language multi-task, translate-train multi-task, and cross-lingual zero-shot (training on English) settings. Model sizes are the same as those in Table 1. mBERT and mT5 baseline results are from (Xue et al., 2020).
|
| 140 |
+
|
| 141 |
+
<table><tr><td></td><td colspan="2">In-Language</td><td colspan="4">Translate-Train-All</td><td colspan="2">Zero-Shot</td></tr><tr><td>Model</td><td>|0</td><td>TyDiQA-GoldP</td><td>XQuAD</td><td>MLQA</td><td>XNLI</td><td>PAWS-X</td><td>XNLI</td><td>PAWS-X</td></tr><tr><td>mBERTBase (Subword)</td><td>179M</td><td>77.6/68.0</td><td>--</td><td>--</td><td>-</td><td>1</td><td>65.4</td><td>81.9</td></tr><tr><td>mT5 Base (Subword)</td><td>582M</td><td>80.8/70.0</td><td>75.3/59.7</td><td>67.6/48.5</td><td>75.9</td><td>89.3</td><td>75.4</td><td>86.4</td></tr><tr><td>Byte-level T5 Base</td><td>200M</td><td>75.6/65.4</td><td>68.6/54.3</td><td>61.8/44.4</td><td>69.4</td><td>87.1</td><td>57.4</td><td>80.9</td></tr><tr><td>Byte-level T5+LASCBase</td><td>205M</td><td>70.6/59.7</td><td>66.8/52.1</td><td>58.8/41.1</td><td>67.9</td><td>84.8</td><td>55.2</td><td>79.0</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>75.9/65.6</td><td>70.2/55.9</td><td>62.6/44.9</td><td>71.1</td><td>87.2</td><td>57.6</td><td>81.6</td></tr><tr><td>CHARFORMER S Base</td><td>134M</td><td>79.1/68.8</td><td>73.6/59.0</td><td>66.3/48.5</td><td>72.2</td><td>88.2</td><td>66.6</td><td>85.2</td></tr><tr><td>CHARFORMER s Base,LongPT</td><td>134M</td><td>81.2/71.3</td><td>74.2/59.8</td><td>67.2/49.4</td><td>72.8</td><td>88.6</td><td>67.8</td><td>83.7</td></tr></table>
|
| 142 |
+
|
| 143 |
+
Table 5: Comparison of pre-training compute metrics for mT5 (Subword) versus comparable quality CHARFORMER models on the $\mathrm { m C 4 }$ dataset. 64 TPUv3 chips were used for this experiment. CHARFORMERSBase sees the same number of tokens after downsampling as $\operatorname* { m T } 5 _ { B a s e }$ , while CHARFORMER $S B a s e , L o n g P T$ roughly sees the same amount of raw text as $\mathrm { m T } 5 _ { B a s e }$ , given that a SentencePiece subword token is about 4.1 bytes on average (Xue et al., 2021). CHARFORMERSBase is $28 \%$ faster than $\mathrm { m T } 5 _ { B a s e }$ , while using $33 \%$ of the FLOPS.
|
| 144 |
+
|
| 145 |
+
<table><tr><td>Model</td><td>Batch Size</td><td>L</td><td>ds</td><td>|0</td><td>Speed (steps/s)</td><td>FLOPS</td></tr><tr><td>mT5 Base (Subword)</td><td>1024</td><td>1024</td><td>-</td><td>582M</td><td>1.54</td><td>1.3 × 1015</td></tr><tr><td>CHARFORMERS Base</td><td>1024</td><td>2048</td><td>2</td><td>134M</td><td>1.98</td><td>4.3 ×1014</td></tr><tr><td>CHARFORMERs Base,LongPT</td><td>2048</td><td>2048</td><td>2</td><td>134M</td><td>1.01</td><td>4.3× 1014</td></tr></table>
|
| 146 |
+
|
| 147 |
+
Baselines We compare to strong multilingual subword-based baselines including multilingual BERT (Devlin et al., 2019) and multilingual T5 (Xue et al., 2020). In addition, we compare to the byte-level models from $\ S 3 . 1$ , which we pre-train on multilingual data.
|
| 148 |
+
|
| 149 |
+
Setup We pre-train CHARFORMER as well as the Byte-level T5 and Byte-level T5+LASC baselines on multilingual $\mathrm { m C 4 }$ Common Crawl (Xue et al., 2020) in 101 languages. Base size models were trained for 1M steps using a batch size of 64 and sequence length of 2048, with the exception of Byte-level $\mathrm { T } 5 _ { B a s e }$ , which was trained with a sequence length of 1024, as training speed was prohibitively slow (see Table 11). CHARFORMER $S B a s e$ and CHARFORMER $S B a s e , L o n g P T$ (longer pre-training) are trained with larger batch sizes for fair comparison with mT5. In particular, CHAR$\mathrm { F O R M E R } _ { S B a s e }$ pre-trains on the same amount of tokens after downsampling as $\mathbf { m T } 5 _ { B a s e }$ , while CHARFORMERSBase,LongP T pre-trains on roughly the same amount of raw text as $\operatorname* { m T } 5 _ { B a s e }$ , given that a SentencePiece subword token is about 4.1 bytes on average (Xue et al., 2021); see Table 5 for further details. All models were fine-tuned with an input sequence length of 4096 for questionanswering tasks and 2048 for inference tasks. Score calibration was not used for these experiments, as it did not benefit the model in the multilingual setting. For XNLI and PAWS-X (both translate-train and zero-shot settings), we also observed that performance improved if the GBST layer was not updated during fine-tuning; the reported CHARFORMER numbers reflect this configuration. Otherwise, all other hyper-parameters and model sizes are unchanged from the English experimental setup.
|
| 150 |
+
|
| 151 |
+
Results We show in-language multi-task, translate-train, and cross-lingual zero-shot results in Table 4. CHARFORMER $S B a s e$ is competitive with standard subword-based models and CHARFORMERSBase,LongP T outperforms subword-based models on TyDiQA-GoldP (in-language multitask). Additionally, in the translate-train setting CHARFORMER $S B a s e , L o n g P T$ is on par with subword models on XQuAD and MLQA, and close to parity on PAWS-X. Furthermore, CHARFORMER outperforms other character-level models in the zero-shot setting. However, we observe that this setting still remains a challenge for token-free models in general. We hypothesize that model size may be a major factor here. Finally, we provide additional comparison between GBST and LASC at a fixed down-sampling rate in Section 8.4 (Appendix), showing that GBST significantly outperforms LASC on TyDiQA.
|
| 152 |
+
|
| 153 |
+
Table 6: Pre-training compute metrics of models at different input lengths, downsampling rates, and model sizes on the English C4 dataset. 16 TPUv3 chips were used for this experiment. These numbers reflect a batch size of 64. Memory refers to per-device peak memory usage on TPUv3 chips.
|
| 154 |
+
|
| 155 |
+
<table><tr><td>Model</td><td>L</td><td>ds</td><td>0</td><td>Speed (steps/s)</td><td>FLOPS</td><td>Peak Mem.</td></tr><tr><td>T5Base :(Subword)</td><td>512</td><td>-</td><td>220M</td><td>9.3</td><td>1.1 × 1013</td><td>=</td></tr><tr><td>Byte-level T5 Base</td><td>1024</td><td>1</td><td>200M</td><td>8.2</td><td>2.9×1013</td><td>3.09GB</td></tr><tr><td>Byte-level T5+LASC Base</td><td>1024</td><td>4</td><td>205M</td><td>15</td><td>9.9 ×1012</td><td>1.62GB</td></tr><tr><td>CHARFORMER Base</td><td>1024</td><td>2</td><td>206M</td><td>11</td><td>1.6 ×1013</td><td>1.95GB</td></tr><tr><td>CHARFORMER Base</td><td>1024</td><td>3</td><td>203M</td><td>15</td><td>1.1 × 1013</td><td>1.63GB</td></tr><tr><td>CHARFORMERSBase</td><td>1024</td><td>2</td><td>134M</td><td>14</td><td>1.3 × 1013</td><td>1.73GB</td></tr><tr><td>CHARFORMERSBase</td><td>1024</td><td>3</td><td>134M</td><td>20</td><td>8.7×1012</td><td>1.34GB</td></tr></table>
|
| 156 |
+
|
| 157 |
+

|
| 158 |
+
Figure 2: Visualization of block scores (softmax weights) for every byte position from multilingual CHARFORMER $S B a s e$ on an example English input.
|
| 159 |
+
|
| 160 |
+
# 4 SPEED, MEMORY AND PARAMETERS
|
| 161 |
+
|
| 162 |
+
Table 6 reports the speed (global training steps per second), parameter sizes and number of floating point operations (FLOPS) for each forward pass of the models used in our experiments. All experiments were run on 16 TPU-v3 chips and speed is benchmarked on English C4 pre-training at the 1K input length $( L )$ . CHARFORMER models are generally more efficient both in terms of speed and FLOPS compared to other character-level models at different parameter sizes. With a low down-sampling rate $d _ { s }$ for CHARFORMER, Byte-level T5+LASC is more efficient due to using a higher down-sampling rate. Directly consuming the character sequence with a Transformer model is slow and requires a large number of FLOPS, which is exacerbated with longer sequence lengths where Byte-level T5 is more than $2 \times$ slower than the fastest CHARFORMER. This difference is even larger at longer input sequence lengths, which we report in the Appendix. CHARFORMERSBase achieves better performance (see $\ S 3$ ) with fewer parameters but more FLOPS by using a deep thin encoder and is twice as fast as the subword-based model with similar performance, $\mathrm { T } 5 _ { B a s e }$ .
|
| 163 |
+
|
| 164 |
+
# 5 VISUALIZING LATENT SUBWORDS
|
| 165 |
+
|
| 166 |
+
One benefit of CHARFORMER compared to other character-level methods is that the subwords it learns are directly interpretable and may give some indications to the behaviour of the underlying model. We visualize the scores the multilingual CHARFORMER has learned to assign to subword blocks of different sizes for the string ‘on subword tokenization’ in Figure 2. We observe that the model learns to allocate single-character subword blocks predominantly to vowels and whitespace in English. Moreover, in English the model allocates larger subword blocks to the beginning and end consonants of a subword. Together, we believe this suggests that the model has learned a meaningful segmentation of the input, and that it is able to dynamically mix between byte-level and subword-level features. Such behaviour could also parallel the relative importance attributed to consonants for word identification observed during reading in humans (Lee et al., 2001; Carreiras et al., 2008).
|
| 167 |
+
|
| 168 |
+
# 6 RELATED WORK
|
| 169 |
+
|
| 170 |
+
Subword tokenization Standard algorithms for deterministic subword tokenization are Byte Pair Encoding (BPE; Sennrich et al., 2016), Wordpiece (Wu et al., 2016), and SentencePiece (Kudo and Richardson, 2018). Prior work has highlighted issues with some of these algorithms (Bostrom and Durrett, 2020) and has generally observed that models learned with such rigid tokenization do not cope well with variation in language (Sun et al., 2020). To make a model more robust to morphological and compositional generalization, probabilistic segmentation algorithms such as subword regularization (Kudo, 2018) and BPE-dropout (Provilkov et al., 2020) have been proposed, which sample different segmentations during training. Recent methods propose to make models more robust for downstream tasks by enforcing prediction consistency between deterministic and probabilistic segmentations (Wang et al., 2021) and propose to update the tokenizer based on the downstream loss under different segmentations (Hiraoka et al., 2020; 2021). He et al. (2020) proposed DPE (dynamic programming encoding), a segmentation-based tokenization algorithm based on dynamic programming. Such methods, however, incur large computation costs due multiple forward passes needing to be performed for each segmentation of an example or due to the expensive DP computation, which make them unsuitable for pre-training.
|
| 171 |
+
|
| 172 |
+
Character-level models For recurrent neural networks, pure character-level models that take a sequence of characters as input (Graves, 2013; Zhang et al., 2015; Hwang and Sung, 2017) have mostly been superseded by character-aware methods that compute a token-level representation using a CNN over characters (Kim et al., 2016; Jozefowicz et al., 2016; Peters et al., 2018) due to poor performance when learning directly from characters. Such character-aware representations have lately been applied to deep Transformer models (El Boukkouri et al., 2020; Ma et al., 2020). These methods, however, still require tokenization for pre-processing and cannot be directly applied to languages without whitespace separation. Prior work also learned segmentation as part of the model but did not scale very well (Wang et al., 2017; Kreutzer and Sokolov, 2018; Kawakami et al., 2019). One notable exception is (Lee et al., 2017), which enabled fully character-level neural machine translation, using stacked convolutions, max pooling, and highway networks. Building on this, recent tokenization-free approaches such as CANINE (Clark et al., 2021) revisit the original character-level setting in the context of large pre-trained language models with a focus on multilingual models. Our method outperforms CANINE-style downsampling (local attention, strided convolutions) and also leads to improvements in the monolingual setting, while using less compute and parameters to down-sample than both Lee et al. (2017) and Clark et al. (2021). Recently, ByT5 (Xue et al., 2021) set new start-of-the-art results for tokenization-free models, by operating on the byte-level. This work performs on par with or outperforms ByT5, with significant gains in speed and compute efficiency.
|
| 173 |
+
|
| 174 |
+
Multilingual models Current multilingual models are generally analogues to successful monolingual Transformer models (Ruder et al., 2021). Consequently, models such as multilingual BERT (Devlin et al., 2019) and XLM-R (Conneau et al., 2020) employ the same subword tokenization algorithms as monolingual models, now applied to a massively multilingual corpus. In the multilingual setting, the problems of subword-based tokenization are exacerbated as tokens in languages with few data are over-segmented while high-frequency tokens are under-segmented, which limits cross-lingual transfer (Wang et al., 2021). This motivates our work as well as recent work on character-level models.
|
| 175 |
+
|
| 176 |
+
Efficient Transformers Moving from subwords to characters significantly increases the sequence length, which is an issue for Transformers due to the quadratic complexity of self-attention. Many efficient self-attention models have been proposed (Choromanski et al., 2020; Wang et al., 2020; Zaheer et al., 2020) to tackle this problem; see (Tay et al., 2020b;a) for a comprehensive overview. Notably, the CANINE model uses local attention (Parmar et al., 2018), which could also be swapped with another efficient Transformer variant. We note that the problem of efficiency is important but not the only challenge towards developing performant tokenization-free models. While applying an efficient attention mechanism might solve the fundamental computational costs of employing character-level models, there is no guarantee that these models will learn locally meaningful compositions.
|
| 177 |
+
|
| 178 |
+
# 7 CONCLUSION
|
| 179 |
+
|
| 180 |
+
We have proposed CHARFORMER, a re-scaled Transformer architecture that integrates gradient-based subword tokenization, a novel lightweight tokenization method that enables efficient end-to-end learning of latent subwords directly from characters. We have demonstrated that English and multilingual variants of CHARFORMER outperform strong character-level baselines across various datasets while being more efficient. CHARFORMER achieves performance on par with subword-based models on standard English tasks and outperforms subword-based models on noisy social media data. On multilingual data, CHARFORMER generally performs on par with subword-based models, while being faster than both byte-level and subword-level baselines. Finally, we provide a method to inspect the inner workings of the GBST module. Overall, we believe that the strong results presented in this paper pave the way for highly effective and powerful token-free models.
|
| 181 |
+
|
| 182 |
+
# ACKNOWLEDGEMENTS
|
| 183 |
+
|
| 184 |
+
We would like to thank Jon Clark, Noah Constant, and Kris Cao for valuable feedback on drafts of this manuscript.
|
| 185 |
+
|
| 186 |
+
# ETHICS STATEMENT
|
| 187 |
+
|
| 188 |
+
Standard subword tokenization algorithms produce segmentations that do not equally represents words and phrases in different languages. Instead, they are biased towards languages that already have many resources available, which leads to multilingual models performing worse on underrepresented languages (Wang et al., 2021). Tokenization-free approaches such as the one proposed in this paper may help to ameliorate this to some extent. Another challenge to using large multilingual models in practice is their relative computational inefficiency, which makes them unsuitable in resource-constrained settings common in scenarios where under-represented languages are spoken. CHARFORMER trains $28 \%$ faster than mT5 and has $3 \times$ fewer parameters, so may be a more suitable choice in such settings compared to state-of-the-art multilingual models.
|
| 189 |
+
|
| 190 |
+
# REPRODUCIBILITY STATEMENT
|
| 191 |
+
|
| 192 |
+
All code to train the core byte-level Transformer encoder-decoder for CHARFORMER its variants is already open-sourced as a part of the Mesh Tensorflow6 (Shazeer et al., 2018), $\mathrm { T } 5 ^ { 7 }$ (Raffel et al., 2020), and ByT58 (Xue et al., 2021) libraries. Additionally, an implementation of Charformer GBST compatible with existing open-source models has been open-sourced9. We also include a simplified Tensorflow implementation of GBST in Section 8.7 of the Appendix. All detailed experiment and hyperparameter settings required to reproduce our experiments can be found in Section 8.2 of the Appendix.
|
| 193 |
+
|
| 194 |
+
# REFERENCES
|
| 195 |
+
|
| 196 |
+
Mikel Artetxe, Sebastian Ruder, and Dani Yogatama. On the Cross-lingual Transferability of Monolingual Representations. In Proceedings of ACL 2020, 2020. URL http://arxiv.org/ abs/1910.11856.
|
| 197 |
+
|
| 198 |
+
Yonatan Belinkov and Yonatan Bisk. Synthetic and Natural Noise Both Break Neural Machine Translation. In Proceedings of ICLR 2018, 2018. URL http://arxiv.org/abs/1711. 02173.
|
| 199 |
+
|
| 200 |
+
Daniel Borkan, Lucas Dixon, Jeffrey Sorensen, Nithum Thain, and Lucy Vasserman. Nuanced metrics for measuring unintended bias with real data for text classification. CoRR, abs/1903.04561, 2019. URL http://arxiv.org/abs/1903.04561.
|
| 201 |
+
|
| 202 |
+
Kaj Bostrom and Greg Durrett. Byte Pair Encoding is Suboptimal for Language Model Pretraining. In Findings of EMNLP 2020, pages 4617–4624, 2020. doi: 10.18653/v1/2020.findings-emnlp.414.
|
| 203 |
+
|
| 204 |
+
Manuel Carreiras, Margaret Gillon-Dowens, Marta Vergara, and Manuel Perea. Are vowels and consonants processed differently? event-related potential evidence with a delayed letter paradigm. Journal of Cognitive Neuroscience, 21(2):275–288, 2008.
|
| 205 |
+
|
| 206 |
+
Daniel Cer, Mona Diab, Eneko Agirre, Inigo Lopez-Gazpio, and Lucia Specia. Semeval-2017 task 1: Semantic textual similarity-multilingual and cross-lingual focused evaluation. arXiv preprint arXiv:1708.00055, 2017.
|
| 207 |
+
|
| 208 |
+
Krzysztof Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Davis, Afroz Mohiuddin, Lukasz Kaiser, et al. Rethinking attention with performers. arXiv preprint arXiv:2009.14794, 2020.
|
| 209 |
+
|
| 210 |
+
Hyung Won Chung, Thibault Févry, Henry Tsai, Melvin Johnson, and Sebastian Ruder. Rethinking Embedding Coupling in Pre-trained Language Models. In Proceedings of ICLR 2021, 2021.
|
| 211 |
+
|
| 212 |
+
Jon Clark, Tom Kwiatkowski, Jennimaria Palomaki, Michael Collins, and Dan Garrette. TyDi QA: A Benchmark for Information-Seeking Question Answering in Typologically Diverse Languages. In Transactions of the ACL, 2020.
|
| 213 |
+
|
| 214 |
+
Jonathan H Clark, Dan Garrette, Iulia Turc, and John Wieting. Canine: Pre-training an efficient tokenization-free encoder for language representation. arXiv preprint arXiv:2103.06874, 2021.
|
| 215 |
+
|
| 216 |
+
Alexis Conneau, Guillaume Lample, Ruty Rinott, Adina Williams, Samuel R. Bowman, Holger Schwenk, and Veselin Stoyanov. XNLI: Evaluating Cross-lingual Sentence Representations. In Proceedings of EMNLP 2018, 2018. URL http://arxiv.org/abs/1809.05053.
|
| 217 |
+
|
| 218 |
+
Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzmán, Edouard Grave, Myle Ott, Luke Zettlemoyer, and Veselin Stoyanov. Unsupervised cross-lingual representation learning at scale. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 8440–8451, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.747. URL https://www.aclweb.org/anthology/2020.acl-main.747.
|
| 219 |
+
|
| 220 |
+
Jacob Devlin. Sharp models on dull hardware: Fast and accurate neural machine translation decoding on the cpu. arXiv preprint arXiv:1705.01991, 2017.
|
| 221 |
+
|
| 222 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. In Proceedings of NAACL 2019, 2019. URL http://arxiv.org/abs/1810.04805.
|
| 223 |
+
|
| 224 |
+
William B Dolan and Chris Brockett. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005), 2005.
|
| 225 |
+
|
| 226 |
+
Hicham El Boukkouri, Olivier Ferret, Thomas Lavergne, Hiroshi Noji, Pierre Zweigenbaum, and Jun’ichi Tsujii. CharacterBERT: Reconciling ELMo and BERT for word-level open-vocabulary representations from characters. In Proceedings of the 28th International Conference on Computational Linguistics, pages 6903–6915, Barcelona, Spain (Online), December 2020. International Committee on Computational Linguistics. doi: 10.18653/v1/2020.coling-main.609. URL https://www.aclweb.org/anthology/2020.coling-main.609.
|
| 227 |
+
|
| 228 |
+
Chengyue Gong, Di He, Xu Tan, Tao Qin, Liwei Wang, and Tie-Yan Liu. FRAGE: FrequencyAgnostic Word Representation. In Proceedings of NIPS 2018, 2018.
|
| 229 |
+
|
| 230 |
+
Alex Graves. Generating sequences with recurrent neural networks. arXiv preprint arXiv:1308.0850, 2013.
|
| 231 |
+
|
| 232 |
+
Xuanli He, Gholamreza Haffari, and Mohammad Norouzi. Dynamic programming encoding for subword segmentation in neural machine translation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 3042–3051, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.275. URL https://www. aclweb.org/anthology/2020.acl-main.275.
|
| 233 |
+
|
| 234 |
+
Tatsuya Hiraoka, Sho Takase, Kei Uchiumi, Atsushi Keyaki, and Naoaki Okazaki. Optimizing word segmentation for downstream task. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 1341–1351, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.findings-emnlp.120. URL https: //www.aclweb.org/anthology/2020.findings-emnlp.120.
|
| 235 |
+
|
| 236 |
+
Tatsuya Hiraoka, Sho Takase, Kei Uchiumi, Atsushi Keyaki, and Naoaki Okazaki. Joint Optimization of Tokenization and Downstream Model. In Findings of ACL-IJCNLP 2021, 2021. URL http: //arxiv.org/abs/2105.12410.
|
| 237 |
+
|
| 238 |
+
Jeremy Howard and Sebastian Ruder. Universal Language Model Fine-tuning for Text Classification. In Proceedings of ACL 2018, 2018. URL http://arxiv.org/abs/1801.06146.
|
| 239 |
+
|
| 240 |
+
Junjie Hu, Sebastian Ruder, Aditya Siddhant, Graham Neubig, Orhan Firat, and Melvin Johnson. XTREME: A Massively Multilingual Multi-task Benchmark for Evaluating Cross-lingual Generalization. In Proceedings of ICML 2020, 2020.
|
| 241 |
+
|
| 242 |
+
Kyuyeon Hwang and Wonyong Sung. Character-level language modeling with hierarchical recurrent neural networks. In 2017 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 5720–5724. IEEE, 2017.
|
| 243 |
+
|
| 244 |
+
Rafal Jozefowicz, Oriol Vinyals, Mike Schuster, Noam Shazeer, and Yonghui Wu. Exploring the limits of language modeling. arXiv preprint arXiv:1602.02410, 2016.
|
| 245 |
+
|
| 246 |
+
Jungo Kasai, Nikolaos Pappas, Hao Peng, James Cross, and Noah A. Smith. Deep Encoder, Shallow Decoder: Reevaluating Non-autoregressive Machine Translation. In Proceedings of ICLR 2021, 2021. ISBN 0080437516.
|
| 247 |
+
|
| 248 |
+
Kazuya Kawakami, Chris Dyer, and Phil Blunsom. Learning to discover, ground and use words with segmental neural language models. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6429–6441, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1645. URL https://www.aclweb.org/ anthology/P19-1645.
|
| 249 |
+
|
| 250 |
+
Yoon Kim, Yacine Jernite, David Sontag, and Alexander Rush. Character-aware neural language models. In Proceedings of the AAAI conference on artificial intelligence, volume 30, 2016.
|
| 251 |
+
|
| 252 |
+
Julia Kreutzer and Artem Sokolov. Learning to segment inputs for nmt favors character-level processing, 2018.
|
| 253 |
+
|
| 254 |
+
Taku Kudo. Subword regularization: Improving neural network translation models with multiple subword candidates. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 66–75, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1007. URL https://www.aclweb.org/anthology/P18-1007.
|
| 255 |
+
|
| 256 |
+
Taku Kudo and John Richardson. SentencePiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 66–71, Brussels, Belgium, November 2018. Association for Computational Linguistics. doi: 10.18653/v1/ D18-2012. URL https://www.aclweb.org/anthology/D18-2012.
|
| 257 |
+
|
| 258 |
+
Guillaume Lample and Alexis Conneau. Cross-lingual Language Model Pretraining. In Proceedings of NeurIPS 2019, 2019. URL https://github.com/google-research/bert.
|
| 259 |
+
|
| 260 |
+
Hye-Won Lee, Keith Rayner, and Alexander Pollatsek. The relative contribution of consonants and vowels to word identification during reading. Journal of Memory and Language, 44(2):189–205, 2001.
|
| 261 |
+
|
| 262 |
+
Jason Lee, Kyunghyun Cho, and Thomas Hofmann. Fully character-level neural machine translation without explicit segmentation. Transactions of the Association for Computational Linguistics, 5:365–378, 2017. doi: 10.1162/tacl_a_00067. URL https://aclanthology.org/ Q17-1026.
|
| 263 |
+
|
| 264 |
+
Patrick Lewis, Barlas Oguz, Ruty Rinott, Sebastian Riedel, and Holger Schwenk. MLQA: Evaluating ˘ Cross-lingual Extractive Question Answering. In Proceedings of ACL 2020, 2020. URL http: //arxiv.org/abs/1910.07475.
|
| 265 |
+
|
| 266 |
+
Wentao Ma, Yiming Cui, Chenglei Si, Ting Liu, Shijin Wang, and Guoping Hu. CharBERT: Characteraware pre-trained language model. In Proceedings of the 28th International Conference on Computational Linguistics, pages 39–50, Barcelona, Spain (Online), December 2020. International Committee on Computational Linguistics. doi: 10.18653/v1/2020.coling-main.4. URL https: //www.aclweb.org/anthology/2020.coling-main.4.
|
| 267 |
+
|
| 268 |
+
Andrew Maas, Raymond E Daly, Peter T Pham, Dan Huang, Andrew $\mathrm { ~ Y ~ N ~ g ~ }$ , and Christopher Potts. Learning word vectors for sentiment analysis. In Proceedings of the 49th annual meeting of the association for computational linguistics: Human language technologies, pages 142–150, 2011.
|
| 269 |
+
|
| 270 |
+
Christopher Manning and Hinrich Schütze. Foundations of statistical natural language processing. MIT press, 1999.
|
| 271 |
+
|
| 272 |
+
Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Distributed Representations of Words and Phrases and their Compositionality. In Advances in Neural Information Processing Systems, 2013.
|
| 273 |
+
|
| 274 |
+
Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin Tran. Image transformer. In International Conference on Machine Learning, pages 4055–4064. PMLR, 2018.
|
| 275 |
+
|
| 276 |
+
Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. In Proceedings of NAACL-HLT 2018, 2018.
|
| 277 |
+
|
| 278 |
+
Ivan Provilkov, Dmitrii Emelianenko, and Elena Voita. BPE-dropout: Simple and effective subword regularization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1882–1892, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.170. URL https://www.aclweb.org/anthology/2020. acl-main.170.
|
| 279 |
+
|
| 280 |
+
Danish Pruthi, Bhuwan Dhingra, and Zachary C. Lipton. Combating adversarial misspellings with robust word recognition. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5582–5591, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1561. URL https://www.aclweb.org/ anthology/P19-1561.
|
| 281 |
+
|
| 282 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer. Journal of Machine Learning Research, 21, 2020. URL http: //arxiv.org/abs/1910.10683.
|
| 283 |
+
|
| 284 |
+
Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. SQuAD: $^ { 1 0 0 , 0 0 0 + }$ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2383–2392, Austin, Texas, November 2016. Association for Computational Linguistics. doi: 10.18653/v1/D16-1264. URL https://www.aclweb. org/anthology/D16-1264.
|
| 285 |
+
|
| 286 |
+
Sebastian Ruder, Noah Constant, Jan Botha, Aditya Siddhant, Orhan Firat, Jinlan Fu, Pengfei Liu, Junjie Hu, Graham Neubig, and Melvin Johnson. Xtreme-r: Towards more challenging and nuanced multilingual evaluation. arXiv preprint arXiv:2104.07412, 2021.
|
| 287 |
+
|
| 288 |
+
Mike Schuster and Kaisuke Nakajima. Japanese and korean voice search. In 2012 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 5149–5152. IEEE, 2012.
|
| 289 |
+
|
| 290 |
+
Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1715–1725, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/P16-1162. URL https://www.aclweb.org/anthology/P16-1162.
|
| 291 |
+
|
| 292 |
+
Noam Shazeer. Glu variants improve transformer. arXiv preprint arXiv:2002.05202, 2020.
|
| 293 |
+
|
| 294 |
+
Noam Shazeer, Youlong Cheng, Niki Parmar, Dustin Tran, Ashish Vaswani, Penporn Koanantakool, Peter Hawkins, HyoukJoong Lee, Mingsheng Hong, Cliff Young, et al. Mesh-tensorflow: Deep learning for supercomputers. arXiv preprint arXiv:1811.02084, 2018.
|
| 295 |
+
|
| 296 |
+
Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew $\mathrm { N g }$ , and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 1631–1642, Seattle, Washington, USA, October 2013. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/D13-1170.
|
| 297 |
+
|
| 298 |
+
Lichao Sun, Kazuma Hashimoto, Wenpeng Yin, Akari Asai, Jia Li, Philip Yu, and Caiming Xiong. Adv-bert: Bert is not robust on misspellings! generating nature adversarial samples on bert. arXiv preprint arXiv:2003.04985, 2020.
|
| 299 |
+
|
| 300 |
+
Yi Tay, Mostafa Dehghani, Samira Abnar, Yikang Shen, Dara Bahri, Philip Pham, Jinfeng Rao, Liu Yang, Sebastian Ruder, and Donald Metzler. Long range arena: A benchmark for efficient transformers. arXiv preprint arXiv:2011.04006, 2020a.
|
| 301 |
+
|
| 302 |
+
Yi Tay, Mostafa Dehghani, Dara Bahri, and Donald Metzler. Efficient transformers: A survey. arXiv preprint arXiv:2009.06732, 2020b.
|
| 303 |
+
|
| 304 |
+
Yi Tay, Mostafa Dehghani, Jai Gupta, Dara Bahri, Vamsi Aribandi, Zhen Qin, and Donald Metzler. Are pre-trained convolutions better than pre-trained transformers? arXiv preprint arXiv:2105.03322, 2021.
|
| 305 |
+
|
| 306 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper/2017/file/ 3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf.
|
| 307 |
+
|
| 308 |
+
Chong Wang, Yining Wang, Po-Sen Huang, Abdelrahman Mohamed, Dengyong Zhou, and Li Deng. Sequence modeling via segmentations. In International Conference on Machine Learning, pages 3674–3683. PMLR, 2017.
|
| 309 |
+
|
| 310 |
+
Sinong Wang, Belinda Li, Madian Khabsa, Han Fang, and Hao Ma. Linformer: Self-attention with linear complexity. arXiv preprint arXiv:2006.04768, 2020.
|
| 311 |
+
|
| 312 |
+
Xinyi Wang, Sebastian Ruder, and Graham Neubig. Multi-view Subword Regularization. In Proceedings of NAACL 2021, 2021. URL http://arxiv.org/abs/2103.08490.
|
| 313 |
+
|
| 314 |
+
Adina Williams, Nikita Nangia, and Samuel Bowman. A broad-coverage challenge corpus for sentence understanding through inference. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 1112–1122, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. doi: 10.18653/v1/N18-1101. URL https://www.aclweb.org/anthology/N18-1101.
|
| 315 |
+
|
| 316 |
+
Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, Jeff Klingner, Apurva Shah, Melvin Johnson, Xiaobing Liu, Łukasz Kaiser, Stephan Gouws, Yoshikiyo Kato, Taku Kudo, Hideto Kazawa, Keith Stevens, George Kurian, Nishant Patil, Wei Wang, Cliff Young, Jason Smith, Jason Riesa, Alex Rudnick, Oriol Vinyals, Greg Corrado, Macduff Hughes, and Jeffrey Dean. Google’s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation. arXiv preprint arXiv:1609.08144, 2016.
|
| 317 |
+
|
| 318 |
+
Ellery Wulczyn, Nithum Thain, and Lucas Dixon. Ex machina: Personal attacks seen at scale. In Proceedings of the 26th International Conference on World Wide Web, WWW ’17, pages 1391– 1399, Republic and Canton of Geneva, CHE, 2017. International World Wide Web Conferences Steering Committee. ISBN 9781450349130. doi: 10.1145/3038912.3052591. URL https: //doi.org/10.1145/3038912.3052591.
|
| 319 |
+
|
| 320 |
+
Linting Xue, Noah Constant, Adam Roberts, Mihir Kale, Rami Al-Rfou, Aditya Siddhant, Aditya Barua, and Colin Raffel. mT5: A massively multilingual pre-trained text-to-text transformer, 2020.
|
| 321 |
+
|
| 322 |
+
Linting Xue, Aditya Barua, Noah Constant, Rami Al-Rfou, Sharan Narang, Mihir Kale, Adam Roberts, and Colin Raffel. ByT5: Towards a token-free future with pre-trained byte-to-byte models. arXiv preprint arXiv:2105.13626, 2021. URL http://arxiv.org/abs/2105.13626.
|
| 323 |
+
|
| 324 |
+
Yinfei Yang, Yuan Zhang, Chris Tar, and Jason Baldridge. PAWS-X: A Cross-lingual Adversarial Dataset for Paraphrase Identification. In Proceedings of EMNLP 2019, 2019. URL http: //arxiv.org/abs/1908.11828.
|
| 325 |
+
|
| 326 |
+
Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, et al. Big bird: Transformers for longer sequences. arXiv preprint arXiv:2007.14062, 2020.
|
| 327 |
+
|
| 328 |
+
Xiang Zhang, Junbo Zhao, and Yann LeCun. Character-level Convolutional Networks for Text Classification. Advances in Neural Information Processing Systems, pages 649–657, 2015. URL http://arxiv.org/abs/1509.01626#.
|
| 329 |
+
|
| 330 |
+
# 8 APPENDIX
|
| 331 |
+
|
| 332 |
+
# 8.1 OVERVIEW
|
| 333 |
+
|
| 334 |
+

|
| 335 |
+
Figure 3: High-level differences between traditional subword Transformer models and Charformer which uses gradient-based subword tokenization.
|
| 336 |
+
|
| 337 |
+
# 8.2 HYPERPARAMETERS
|
| 338 |
+
|
| 339 |
+
This section describes the hyperparameters that we use in our experiments.
|
| 340 |
+
|
| 341 |
+
Monolingual English Datasets Our small model follows the T5 small model size with 6 encoder layers and 6 decoder layers, hidden size $d _ { m o d e l }$ of 512, 8 heads, $d _ { k v }$ of 32 and $d _ { f f }$ of 2048. This corresponds to bi_v1_small.gin in the T5 codebase. The base model (corresponding to $b i \_ { \nu I . g i n } )$ has 12 encoder layers, 12 decoder layers, $d _ { m o d e l }$ of 768, $d _ { f f }$ of 3072 and 12 heads. The SBase model has 24 encoder layers and 6 decoder layers, while the remainder of its hyperparameters remain identical to the small model. All Transformer stacks use relative attention over positional encodings as per (Raffel et al., 2020). For pre-training, we run our models for $1 M$ steps on C4 with a batch size of 64. The maximum sequence length for all tasks is set to 1024. TPU packing is not activated for Charformer. For Charformer, the filter size of the pre-GBST convolution is set to 5 by default. For CHARFORMER, the downsampling rate is tuned in the range of $\{ 2 , 3 , 4 \}$ . For smaller models, the rate of 2 seems to work consistently the best. For base models, the best models used a downsampling rate of either 2 or 3. For the SBase models, the optimal downsampling rate was often 3.
|
| 342 |
+
|
| 343 |
+
Multilingual Datasets Hyperparameters are kept constant between English and multilingual tasks except for the following differences. For pre-training, we run our models for 1M steps with a batch size of 64, except for $\mathbf { C } _ { \mathrm { H A R F O R M E R } _ { S B a s e } }$ which uses a batch size of 1024 and CHARFORMERSBase,LongP T which usees a batch size of 2048. Models were pre-trained with a maximum sequence length of 2048 and fine-tuned with a maximum sequence length of 4096 for TyDiQA, XQuAD, and MLQA, and 2048 for XNLI and PAWS-X. Byte-level $\mathrm { T } 5 _ { B a s e }$ was the only model to be pre-trained with a maximum sequence length of 1024, as it was prohibitively slow, see Table 11. Fine-tuning and inference for this model, however still used 4096 and 2048 input lengths identical to other models. For all tasks, CHARFORMER models used a downsampling rate of 2, while Byte-level $_ { \mathrm { T } 5 + \mathrm { L A S C } }$ models used a downsampling rate of 4 (Clark et al., 2021). The downsampling rate of 2 was picked by ablating the downsampling rate on the TyDiQA-GoldP validation set. CHARFORMER models for XNLI and PAWS-X additionally did not back-propagate into the GBST layer during fine-tuning. Checkpoints were picked based on the dev set metrics, and then evaluated on test set. Reported metrics represent the macro-average of all languages in the task.
|
| 344 |
+
|
| 345 |
+
# 8.3 ABLATION STUDY
|
| 346 |
+
|
| 347 |
+
This section presents our ablation experiments for both English and multilingual tasks. We analyze the impact of various hyper-parameters and modeling choices such as using offsets vs 1D convolutions. Across experiments, we find that pre-GBST convolutions are preferred to enumerating offset blocks, as it results in similar (or better) quality but a more efficient implementation. For English tasks, block score calibration (BC) improves performance. We note that in the multilingual setting, block score calibration has little effect. The impact of different downsampling rates varies across tasks and model sizes. We also experimented with different convolution filter sizes in English and found that they did not significantly impact performance. Likewise, using a different character span corruption rate during pre-training did not significantly impact performance. Adding feed-forward layers to the CHARFORMER module in similar fashion to a Transformer block was also not obviously helpful.
|
| 348 |
+
|
| 349 |
+
Table 7: Ablation studies with CHARFORMERSmall on English tasks.
|
| 350 |
+
|
| 351 |
+
<table><tr><td>Ablation</td><td>ds</td><td>Size</td><td>SST-2</td><td>MNLImm</td><td>IMDb</td></tr><tr><td>Offsets</td><td></td><td>S</td><td>89.11</td><td>79.50</td><td>90.49</td></tr><tr><td>Conv</td><td></td><td>S</td><td>89.11</td><td>79.65</td><td>90.63</td></tr><tr><td>Conv + BC</td><td></td><td>S</td><td>89.56</td><td>80.15</td><td>90.60</td></tr><tr><td>Conv + Offsets + BC</td><td>2222</td><td>S</td><td>89.11</td><td>79.68</td><td>90.48</td></tr><tr><td>Conv</td><td>34</td><td>S</td><td>89.45</td><td>80.07</td><td>90.15</td></tr><tr><td>Conv</td><td></td><td>S</td><td>89.11</td><td>79.82</td><td>90.21</td></tr><tr><td>Conv</td><td>234</td><td>B</td><td>90.60</td><td>82.92</td><td>91.46</td></tr><tr><td>Conv</td><td></td><td>B</td><td>91.40</td><td>82.74</td><td>91.46</td></tr><tr><td>Conv</td><td></td><td>B</td><td>91.40</td><td>82.67</td><td>92.33</td></tr></table>
|
| 352 |
+
|
| 353 |
+
Table 8: Effect of freezing the GBST layer for XNLI and PAWS-X.
|
| 354 |
+
|
| 355 |
+
<table><tr><td>Model</td><td>ds</td><td>Freeze GBST</td><td>XNLI (Zero)</td><td>XNLI(Translate)</td><td>PAWS-X (Zero)</td><td>PAWS-X(Translate)</td></tr><tr><td>CHARFORMER Small</td><td>2</td><td>No</td><td>44.5</td><td>62.7</td><td>27.9</td><td>37.5</td></tr><tr><td>CHARFORMERSmall</td><td>2</td><td>Yes</td><td>50.9</td><td>68.7</td><td>77.1</td><td>84.8</td></tr><tr><td>CHARFORMER Small</td><td>3</td><td>No</td><td>47.9</td><td>67.9</td><td>29.5</td><td>36.8</td></tr><tr><td>CHARFORMER Small</td><td>3</td><td>Yes</td><td>43.2</td><td>68.6</td><td>77.8</td><td>83.7</td></tr><tr><td>CHARFORMER Small</td><td>4</td><td>No</td><td>47.5</td><td>47.5</td><td>30.9</td><td>36.9</td></tr><tr><td>CHARFORMER Small</td><td>4</td><td>Yes</td><td>43.6</td><td>43.6</td><td>77.9</td><td>83.5</td></tr></table>
|
| 356 |
+
|
| 357 |
+
# 8.4 COMPARING DOWNSAMPLING APPROACHES
|
| 358 |
+
|
| 359 |
+
In Table 10, we compare GBST downsampling with LASC downsampling (Clark et al., 2021) on TyDiQA-GoldP. For this experiment we use the same hyperparameters as in Section 3.3, except the pre-training input length is 1024 instead of 2048. Note that this difference is negligible (0.1 F1) for CHARFORMER $B a s e$ , $d _ { s } = 2$ which also appears in Table 4. All hyperparameters are fixed between CHARFORMER and Byte-level T5+LASC. Following (Clark et al., 2021) we set $d _ { s } = 4$ for LASC, and we compare CHARFORMER at the same downsampling rate. We additionally include $d _ { s } = 2$ and $d _ { s } = 3$ for CHARFORMER for comparison. With the same hyperparameters and downsampling rate, CHARFORMER outperforms Byte-level T5+LASC on TyDiQA-GoldP.
|
| 360 |
+
|
| 361 |
+
Table 9: Effect of $d _ { s }$ on TyDiQA-GoldP (in-language multi-task).
|
| 362 |
+
|
| 363 |
+
<table><tr><td>Model</td><td>ds</td><td>TyDiQA-GoldP F1</td></tr><tr><td>CHARFORMERSmall</td><td>2</td><td>69.6</td></tr><tr><td>CHARFORMERSmall</td><td>3</td><td>68.1</td></tr><tr><td>CHARFORMERSmall</td><td>4</td><td>66.6</td></tr><tr><td>Byte-level T5+LASCsmall</td><td>4</td><td>64.9</td></tr><tr><td>CHARFORMER Base</td><td>2</td><td>75.8</td></tr><tr><td>CHARFORMERBase</td><td>3</td><td>74.3</td></tr><tr><td>CHARFORMERBase</td><td>4</td><td>73.2</td></tr><tr><td>Byte-level T5+LASCBase</td><td>4</td><td>70.6</td></tr></table>
|
| 364 |
+
|
| 365 |
+
# 8.5 LARGE-SCALE EXPERIMENTS
|
| 366 |
+
|
| 367 |
+
In this section we report preliminary results for scaling Charformer using the same number of parameters as $\operatorname* { m T } 5 _ { L a r g e }$ and $\mathrm { B y T } 5 _ { L a r g e }$ (1.23B). We follow a model scaling configuration identical to ByT5 in these experiments, and use the same hyperparameter settings as our main multilingual results.
|
| 368 |
+
|
| 369 |
+
Table 10: Comparison on TyDiQA at 1.23B parameters. \*Due to resource constraints, the Charformer result below uses ${ \sim } 1 0 0 \mathrm { K }$ less pretraining steps than ByT5 and mT5.
|
| 370 |
+
|
| 371 |
+
<table><tr><td>Model</td><td>TyDiQA-GoldP F1 /EM</td></tr><tr><td>mT5Large</td><td>85.3 /75.3</td></tr><tr><td>ByT5 Large</td><td>87.7/79.2</td></tr><tr><td>CHARFORMER*</td><td>86.3 / 77.3</td></tr></table>
|
| 372 |
+
|
| 373 |
+
Results The CHARFORMER model under the same scaling as $\mathrm { B y T } 5 _ { L a r g e }$ was able to outperform $\operatorname* { m T } 5 _ { L a r g e }$ , a very strong baseline. Our preliminary results at this scale shows that CHARFORMER is competitive with, but is $1 . 4 \mathrm { F } 1$ behind $\mathrm { B y T } 5 _ { L a r g e }$ . However, we point out two important notes. First, the CHARFORMER result is undertrained compared to $\mathrm { B y T } 5 _ { L a r g e }$ since $10 \%$ of the pretraining has not finished. Second, the CHARFORMER model is also twice as fast as ByT5, as seen from Table 11.
|
| 374 |
+
|
| 375 |
+
# 8.6 MULTILINGUAL EXPERIMENTS
|
| 376 |
+
|
| 377 |
+
This section contains detailed results for our multilingual experiments.
|
| 378 |
+
|
| 379 |
+
Table 11: Compute metrics of base models at longer (2K) input length on the $\mathrm { m C 4 }$ pre-training corpus, using a batch size of 64 on 16 TPU-v3 chips.
|
| 380 |
+
|
| 381 |
+
<table><tr><td>Model</td><td>L</td><td>ds</td><td>|0</td><td>Speed (steps/s)</td><td>FLOPS</td></tr><tr><td>Byte-level T5 Base</td><td>2048</td><td>1</td><td>200M</td><td>2.7</td><td>2.0×1013</td></tr><tr><td>Byte-level T5+LASC Base</td><td>2048</td><td>4</td><td>205M</td><td>11</td><td>5.5× 1012</td></tr><tr><td>CHARFORMERBase</td><td>2048</td><td>2</td><td>203M</td><td>6.1</td><td>9.5×1012</td></tr><tr><td>CHARFORMERBase</td><td>2048</td><td>3</td><td>203M</td><td>10</td><td>6.5×1012</td></tr><tr><td>CHARFORMERSBase</td><td>2048</td><td>2</td><td>134M</td><td>6.1</td><td>9.2 ×1012</td></tr></table>
|
| 382 |
+
|
| 383 |
+
Table 12: Per-language breakdown of in-language multi-task TyDiQA-GoldP results.
|
| 384 |
+
|
| 385 |
+
<table><tr><td>Model</td><td>0</td><td>ar</td><td>bn</td><td>en</td><td>fi</td><td>id</td><td>ko</td><td>ru</td><td>SW</td><td>te</td><td>Avg.</td></tr><tr><td>mBERTBase (Subword)</td><td>179M</td><td>-/-</td><td>/</td><td>-</td><td>-/-</td><td>-/-</td><td>-</td><td>-/-</td><td>/</td><td>-/-</td><td>77.6/68.0</td></tr><tr><td>mT5 Base (Subword)</td><td>582M</td><td>84.2/71.8</td><td>80.0/69.0</td><td>76.6/65.2</td><td>80.1/69.3</td><td>85.5/75.0</td><td>70.3/61.6</td><td>77.5/64.4</td><td>83.6/74.9</td><td>88.2/78.0</td><td>80.8/70.0</td></tr><tr><td>Byte-level T5 Base</td><td>200M</td><td>81.4/67.0</td><td>66.8/56.6</td><td>69.8/59.5</td><td>75.6/63.0</td><td>81.6/72.4</td><td>64.6/58.7</td><td>74.1/60.8</td><td>81.8/74.3</td><td>85.0/76.1</td><td>75.6/65.4</td></tr><tr><td>Byte-level T5+LASCBase</td><td>205M</td><td>78.1/62.3</td><td>61.1/50.4</td><td>66.7/55.2</td><td>72.5/60.4</td><td>79.9/68.3</td><td>51.5/43.5</td><td>70.4/58.7</td><td>74.7/67.5</td><td>80.2/71.2</td><td>70.6/59.7</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>81.8/67.9</td><td>69.1/60.2</td><td>71.4/60.5</td><td>76.3/64.2</td><td>83.0/73.1</td><td>62.7/54.3</td><td>74.7/61.7</td><td>80.2/73.3</td><td>83.6/75.0</td><td>75.9/65.6</td></tr><tr><td>CHARFORMERSBase</td><td>134M</td><td>82.4/68.1</td><td>78.1/67.3</td><td>75.4/64.3</td><td>79.5/68.2</td><td>85.0/75.9</td><td>66.6/58.0</td><td>77.0/64.3</td><td>81.5/74.1</td><td>86.5/78.6</td><td>79.1/68.8</td></tr><tr><td>CHARFORMERSBase,LongPT</td><td>134M</td><td>85.7/74.5</td><td>78.7/67.3</td><td>76.8/65.9</td><td>81.9/70.6</td><td>86.7/79.1</td><td>69.4/61.6</td><td>79.2/67.1</td><td>83.7/75.2</td><td>88.8/80.6</td><td>81.2/71.3</td></tr></table>
|
| 386 |
+
|
| 387 |
+
Table 13: Per-language breakdown of translate-train-all XQuAD results.
|
| 388 |
+
|
| 389 |
+
<table><tr><td>Model</td><td>间</td><td>ar</td><td>de</td><td>el</td><td>en</td><td>es</td><td>hi</td><td>ru</td><td>th</td><td>tr</td><td>vi</td><td>zh</td><td></td><td>Avg.</td></tr><tr><td>mT5 Base (Subword)</td><td>582M</td><td>72.4/55.2</td><td>76.9/59.7</td><td>76.8/58.8</td><td>83.1/70.3</td><td></td><td>79.0/61.2</td><td>71.4/53.4</td><td>76.1/58.5</td><td>67.9/62.0</td><td>72.5/51.4</td><td>75.9/56.3</td><td>76.9/69.7</td><td>75.3/59.7</td></tr><tr><td>Byte-levelT5 Base</td><td>200M</td><td>64.8/47.9</td><td>74.3/58.3</td><td>69.2/51.8</td><td>81.5/70.4</td><td>77.2/60.4</td><td></td><td>67.0/51.5</td><td>72.3/55.5</td><td>48.3/41.9</td><td>69.6/51.7</td><td>73.3/54.4</td><td>57.3/53.3</td><td>68.6/54.3</td></tr><tr><td>Byte-level T5+LASCBase</td><td>205M</td><td>62.9/45.5</td><td>70.6/54.2</td><td>68.3/52.3</td><td>80.1/68.4</td><td>74.8/57.9</td><td></td><td>63.1/46.2</td><td>68.2/52.2</td><td>50.0/43.4</td><td>67.1/48.2</td><td>71.7/51.8</td><td>57.7/52.7</td><td>66.8/52.1</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>65.7/49.8</td><td>74.2/58.0</td><td>71.1/53.1</td><td>82.2/70.5</td><td>77.8/61.0</td><td></td><td>67.0/51.3</td><td>73.4/57.6</td><td>54.3/48.0</td><td>70.3/53.0</td><td>74.6/55.6</td><td>62.0/56.6</td><td>70.2/55.9</td></tr><tr><td>CHARFORMERS Base</td><td>134M</td><td>70.3/53.7</td><td>78.6/61.4</td><td>74.4/55.1</td><td>85.1/73.7</td><td>79.8/63.6</td><td></td><td>69.1/52.7</td><td>76.7/61.3</td><td>57.6/51.2</td><td>73.9/55.8</td><td>76.8/57.6</td><td>67.4/62.4</td><td>73.6/59.0</td></tr><tr><td>CHARFORMERS Base,LongPT</td><td>134M</td><td>72.6/55.0</td><td>79.0/62.3</td><td>74.9/56.1</td><td>85.4/74.5</td><td></td><td>80.4/63.4</td><td>70.6/56.1</td><td>77.8/62.2</td><td>56.1/49.2</td><td>76.1/58.2</td><td>77.7/59.4</td><td>66.0/61.8</td><td>74.2/59.8</td></tr></table>
|
| 390 |
+
|
| 391 |
+
Table 14: Per-language breakdown of translate-train-all MLQA results.
|
| 392 |
+
|
| 393 |
+
<table><tr><td>Model</td><td>0</td><td>ar</td><td>de</td><td>en</td><td>es</td><td>hi</td><td>vi</td><td>zh</td><td>Avg.</td></tr><tr><td>mT5 Base (Subword)</td><td>582M</td><td>61.1/40.7</td><td>65.5/49.2</td><td>80.7/66.3</td><td>70.7/52.1</td><td>63.6/44.3</td><td>68.0/47.6</td><td>63.5/39.4</td><td>67.6/48.5</td></tr><tr><td>Byte-levelT5 Base</td><td>200M</td><td>52.6/34.2</td><td>60.5/46.1</td><td>77.7/64.8</td><td>67.1/49.2</td><td>52.9/36.5</td><td>63.6/43.8</td><td>58.3/36.4</td><td>61.8/44.4</td></tr><tr><td>Byte-level T5+LASCBase</td><td>205M</td><td>50.8/32.0</td><td>58.1/43.5</td><td>75.8/62.2</td><td>64.7/46.7</td><td>49.2/32.6</td><td>60.4/40.4</td><td>52.6/30.6</td><td>58.8/41.1</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>53.5/34.5</td><td>61.3/46.8</td><td>78.5/65.4</td><td>67.2/49.3</td><td>54.5/37.6</td><td>64.3/43.9</td><td>58.8/36.6</td><td>62.6/44.9</td></tr><tr><td>CHARFORMER S Base</td><td>134M</td><td>58.3/39.1</td><td>65.7/50.5</td><td>81.8/68.7</td><td>71.0/53.1</td><td>57.7/40.8</td><td>67.3/46.8</td><td>62.7/40.8</td><td>66.3/48.5</td></tr><tr><td>CHARFORMER S Base,Long PT</td><td>134M</td><td>59.6/40.0</td><td>66.6/51.3</td><td>82.2/69.0</td><td>72.1/54.5</td><td>59.7/42.9</td><td>68.2/47.4</td><td>62.4/40.7</td><td>67.2/49.4</td></tr></table>
|
| 394 |
+
|
| 395 |
+
Table 15: Per-language breakdown of translate-train-all and cross-lingual zero-shot XNLI results.
|
| 396 |
+
|
| 397 |
+
<table><tr><td>Model</td><td>间</td><td>ar</td><td>bg</td><td>de</td><td>el</td><td>en</td><td>es</td><td>fr</td><td>hi</td><td>ru</td><td>sw</td><td>th</td><td>tr</td><td>ur</td><td>vi</td><td>zh Avg.</td></tr><tr><td></td><td colspan="10">Translate-Train-All</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>mT5 Base (Subword)</td><td>582M</td><td>74.4</td><td>78.5</td><td>77.7</td><td>78.1</td><td>82.0</td><td>79.1</td><td>77.9 72.2</td><td>76.5</td><td>71.5</td><td>75.0</td><td></td><td>74.8</td><td>70.4</td><td>74.5</td><td>76.0</td><td>75.9</td></tr><tr><td>Byte-level T5Base</td><td>200M</td><td>67.1</td><td>72.0</td><td>71.0</td><td>70.6</td><td>76.9</td><td>74.0</td><td>73.4</td><td>63.7</td><td>69.2 66.2</td><td></td><td>65.7</td><td>69.4</td><td>62.8</td><td>69.6</td><td>69.0</td><td>69.4</td></tr><tr><td>Byte-level T5+LASCBase</td><td>205M</td><td>65.6</td><td>72.1</td><td>70.5</td><td>67.9</td><td>75.6</td><td>73.4</td><td>72.2</td><td>63.5</td><td>68.6</td><td>65.4</td><td>64.5</td><td>67.4</td><td>62.4</td><td>68.3</td><td>61.0</td><td>67.9</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>69.5</td><td>72.9</td><td>72.7</td><td>72.6</td><td>78.2</td><td>74.5</td><td>73.6</td><td>67.0</td><td>71.7</td><td>67.9</td><td>68.1</td><td>70.8</td><td>65.0</td><td>70.7</td><td>71.5</td><td>71.1</td></tr><tr><td>CHARFORMERSBase</td><td>134M</td><td>70.8</td><td>75.7</td><td>75.9</td><td>73.1</td><td>80.9</td><td>76.9</td><td>76.8</td><td>65.6</td><td>74.7</td><td>65.7</td><td>67.7</td><td>72.0</td><td>63.1</td><td>72.9</td><td>71.5</td><td>72.2</td></tr><tr><td>CHARFORMERSBase,LongPT</td><td>134M</td><td>71.1</td><td>75.9</td><td>73.6</td><td>74.2</td><td>80.8</td><td>76.6</td><td>76.8</td><td>69.2</td><td>72.2</td><td>68.2</td><td>71.0</td><td>71.2</td><td>65.7</td><td>72.9</td><td>73.0</td><td>72.8</td></tr><tr><td>Cross-Lingual Zero-Shot</td><td colspan="10"></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>mBERTBase (Subword)</td><td>179M</td><td>64.3</td><td>68.0</td><td>70.0</td><td>65.3</td><td>80.8</td><td>73.5</td><td>73.4</td><td>58.9</td><td>67.8</td><td>49.7</td><td>54.1</td><td>60.9</td><td>57.2</td><td>69.3</td><td>67.8</td><td>65.4</td></tr><tr><td>mT5 Base (Subword)</td><td>582M</td><td>73.3</td><td>78.6</td><td>77.4</td><td>77.1</td><td>84.7</td><td>80.3</td><td>79.1</td><td>70.8</td><td>77.1</td><td>69.4</td><td>73.2</td><td>72.8</td><td>68.3</td><td>74.2</td><td>74.1</td><td>75.4</td></tr><tr><td>Byte-level T5Base</td><td>200M</td><td>56.7</td><td>61.2</td><td>63.0</td><td>60.9</td><td>79.2</td><td>70.1</td><td>65.3</td><td>43.9</td><td>61.0</td><td>45.5</td><td>43.5</td><td>52.0</td><td>44.3</td><td>58.3</td><td>55.6</td><td>57.4</td></tr><tr><td>Byte-level T5+LASCBase</td><td>205M</td><td>53.3</td><td>58.8</td><td>62.2</td><td>54.9</td><td>77.1</td><td>68.6</td><td>65.4</td><td>44.7</td><td>58.4</td><td>46.1</td><td>43.6</td><td>50.4</td><td>42.8</td><td>55.9</td><td>46.1</td><td>55.2</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>55.7</td><td>61.1</td><td>64.8</td><td>60.1</td><td>77.3</td><td>69.9</td><td>67.9</td><td>44.4</td><td>60.2</td><td>45.3</td><td>47.9</td><td>54.0</td><td>43.5</td><td>59.1</td><td>53.4</td><td>57.6</td></tr><tr><td>CHARFORMER S Base</td><td>134M</td><td>66.4</td><td>71.0</td><td>72.7</td><td>68.6</td><td>82.4</td><td>77.1</td><td>75.4</td><td>57.6</td><td>70.6</td><td>48.7</td><td>61.4</td><td>61.8</td><td>54.1</td><td>68.9</td><td>62.8</td><td>66.6</td></tr><tr><td>CHARFORMERSBase,LongPT</td><td>134M</td><td>68.4</td><td>70.9</td><td>74.3</td><td>70.2</td><td>82.4</td><td>77.0</td><td>76.6</td><td>59.9</td><td>71.0</td><td>42.6</td><td>64.0</td><td>65.5</td><td>56.5</td><td>71.2</td><td>66.0</td><td>67.8</td></tr></table>
|
| 398 |
+
|
| 399 |
+
Table 16: Per-language breakdown of translate-train-all and cross-lingual zero-shot PAWS-X results.
|
| 400 |
+
|
| 401 |
+
<table><tr><td>Model</td><td>0</td><td>de</td><td>en</td><td>es</td><td>fr</td><td>ja</td><td>ko</td><td>zh</td><td>Avg.</td></tr><tr><td colspan="10">Translate-Train-All</td></tr><tr><td>mT5 Base (Subword)</td><td>582M</td><td>90.9</td><td>95.5</td><td>91.4</td><td>92.5</td><td>83.6</td><td>84.8</td><td>86.4</td><td>89.3</td></tr><tr><td>Byte-level T5 Base</td><td>200M</td><td>89.3</td><td>94.6</td><td>90.1</td><td>90.3</td><td>81.4</td><td>81.1</td><td>82.3</td><td>87.0</td></tr><tr><td>Byte-level T5+LASC Base</td><td>205M</td><td>87.3</td><td>93.1</td><td>89.2</td><td>89.2</td><td>81.0</td><td>72.9</td><td>80.8</td><td>84.8</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>89.9</td><td>94.6</td><td>89.8</td><td>91.4</td><td>82.7</td><td>78.4</td><td>83.3</td><td>87.2</td></tr><tr><td>CHARFORMER sBase</td><td>134M</td><td>89.9</td><td>95.9</td><td>91.8</td><td>92.2</td><td>83.9</td><td>78.9</td><td>84.4</td><td>88.2</td></tr><tr><td>CHARFORMERs Base,LongPT</td><td>134M</td><td>90.7</td><td>95.1</td><td>92.2</td><td>92.2</td><td>84.1</td><td>81.6</td><td>84.6</td><td>88.6</td></tr><tr><td colspan="10">Cross-Lingual Zero-Shot</td></tr><tr><td>mBERTBase (Subword)</td><td>179M</td><td>85.7</td><td>94.0</td><td>87.4</td><td>87.0</td><td>73.0</td><td>69.6</td><td>77.0</td><td>81.9</td></tr><tr><td>mT5 Base (Subword)</td><td>582M</td><td>89.4</td><td>95.4</td><td>89.6</td><td>91.2</td><td>79.8</td><td>78.5</td><td>81.1</td><td>86.4</td></tr><tr><td>Byte-level T5 Base</td><td>200M</td><td>84.7</td><td>93.8</td><td>85.8</td><td>86.4</td><td>72.2</td><td>67.9</td><td>75.2</td><td>80.9</td></tr><tr><td>Byte-level T5+LASCBase</td><td>205M</td><td>83.2</td><td>93.2</td><td>84.1</td><td>85.0</td><td>67.9</td><td>66.4</td><td>73.4</td><td>79.0</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>86.1</td><td>94.8</td><td>87.2</td><td>88.0</td><td>70.1</td><td>69.7</td><td>75.5</td><td>81.6</td></tr><tr><td>CHARFORMER SBase</td><td>134M</td><td>89.6</td><td>95.2</td><td>90.7</td><td>90.7</td><td>77.1</td><td>74.4</td><td>78.9</td><td>85.2</td></tr><tr><td>CHARFORMERSBase,LongPT</td><td>134M</td><td>89.8</td><td>95.3</td><td>88.7</td><td>89.7</td><td>74.5</td><td>68.9</td><td>78.9</td><td>83.7</td></tr></table>
|
| 402 |
+
|
| 403 |
+
# 8.7 EXAMPLE IMPLEMENTATION
|
| 404 |
+
|
| 405 |
+
For additional clarity, we include a simplified implementation of the GBST module in Tensorflow below. Default hyper-parameters here match those used in the paper.
|
| 406 |
+
|
| 407 |
+
max_subword_block_width: Integer of max block size to use for enumeration. block_attention: Hhether to use block score calibration. block_scoring_network: module for parameterized block scoring.
|
| 408 |
+
conv_kernel_size: Integer of the size of the pre-GBST convolution kernel.
|
| 409 |
+
"""
|
| 410 |
+
|
| 411 |
+
def __init__(self,
|
| 412 |
+
|
| 413 |
+
input_shape: tf.Tensor, downsample_rate: int $= 2$ , max_subword_block_width: int $\qquad = \quad 4$ , block_attention: bool $=$ False, conv_kernel_size: Optional[int] $= ~ 5 )$ ):
|
| 414 |
+
|
| 415 |
+
super(GBSTLayer, self).__init__()
|
| 416 |
+
self.downsample_rate $=$ downsample_rate
|
| 417 |
+
self.max_subword_block_width $=$ max_subword_block_width
|
| 418 |
+
self.conv_kernel_size $=$ conv_kernel_size
|
| 419 |
+
self.conv_layer = keras_layers.Conv1D( input_shape[-1], self.conv_kernel_size, input_shape $\mathrm { \Omega } _ { \ast } = \mathrm { \Omega } _ { \ast }$ input_shape)
|
| 420 |
+
self.block_attention $=$ block_attention
|
| 421 |
+
self.block_scoring_network $=$ keras_layers.Dense(1, use_bias=False)
|
| 422 |
+
|
| 423 |
+
def call(self, inputs): """Performs downsampling on the character-scale input representation.
|
| 424 |
+
|
| 425 |
+
Args: inputs: float Tensor of shape [batch_size, seq_length, embedding_size].
|
| 426 |
+
|
| 427 |
+
Returns:
|
| 428 |
+
|
| 429 |
+
<float>[batch_size, seq_length / downsample_rate , embedding_size].
|
| 430 |
+
Downsampled sequences.
|
| 431 |
+
|
| 432 |
+
length = inputs.shape[1] if self.conv_kernel_size: inputs $=$ self.conv_layer(inputs)
|
| 433 |
+
|
| 434 |
+
all_block_scores $=$ []
|
| 435 |
+
all_sequences $=$ []
|
| 436 |
+
for subword_len in range(1, self.max_subword_block_width): padded_input = inputs # Pad the sequence length if needed. if length % subword_len $! = ~ 0$ : pad_amt $=$ subword_len - int(length % subword_len) padding = tf.constant([[0, 0], [0, pad_amt], [0, 0]]) padded_input $=$ tf.pad(inputs, padding)
|
| 437 |
+
|
| 438 |
+
# For this block size, form candidate block embeddings and scores.
|
| 439 |
+
|
| 440 |
+
# candidates shape: [batch, seq_len/subword_len, dim] # block_scores shape: [batch, seq_len/subword_len, 1]
|
| 441 |
+
|
| 442 |
+
padded_input, [subword_len], stride $; =$ [subword_len], padding="VALID") block_scores = self.block_scoring_network(candidates)
|
| 443 |
+
|
| 444 |
+
# Upsample it back to the original sequence length. retiled_seq $=$ tf.repeat(candidates, subword_len, axis=1) retiled_block_scores = tf.repeat(block_scores, subword_len, axis=1)
|
| 445 |
+
|
| 446 |
+
# # Repad the upsampled sequence if needed.
|
| 447 |
+
|
| 448 |
+
if retiled_block_scores.shape[1] $<$ length: repad_amt $=$ length - retiled_block_scores.shape[1] repadding $=$ tf.constant([[0, 0], [0, repad_amt], [0, 0]]) retiled_seq $=$ tf.pad(retiled_seq, repadding) retiled_block_scores = tf.pad(retiled_block_scores, repadding)
|
| 449 |
+
|
| 450 |
+
# Make sure everything is the right length and add new dimension to concat # candidate blocks on.
|
| 451 |
+
retiled_block_scores $=$ retiled_block_scores[:, :length, :, None]
|
| 452 |
+
retiled_seq $=$ retiled_seq[:, :length, :, None]
|
| 453 |
+
all_block_scores.append(retiled_block_scores)
|
| 454 |
+
all_sequences.append(retiled_seq)
|
| 455 |
+
|
| 456 |
+
block_scores = tf.concat(all_block_scores, axis=-1) block_scores $=$ tf.nn.softmax(block_scores, axis=-1) candidates $=$ tf.concat(all_sequences, axis=-1)
|
| 457 |
+
|
| 458 |
+
# TODO: Block score calibration / block-by-block attention is omitted in this implementation. # batch_size $_ \textrm { x }$ num_candidates $_ \mathrm { x }$ length $_ \textrm { x }$ dim
|
| 459 |
+
candidates $=$ candidates $^ { \star }$ block_scores
|
| 460 |
+
output = tf.reduce_sum(candidates, axis=-1) # bsz $_ \mathrm { x }$ length x dim
|
| 461 |
+
|
| 462 |
+
# Downsample by mean pooling.
|
| 463 |
+
|
| 464 |
+
if self.downsample_rate $> ~ 1$ : output $=$ tf.nn.avg_pool( output, (self.downsample_rate,), stride $; =$ (self.downsample_rate,), padding="VALID")
|
| 465 |
+
return output
|
md/dev/MCVfX7HgPO/MCVfX7HgPO.md
ADDED
|
@@ -0,0 +1,485 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Testing the General Deductive Reasoning Capacity of Large Language Models Using OOD Examples
|
| 2 |
+
|
| 3 |
+
Abulhair Saparov† Richard Yuanzhe Pang†
|
| 4 |
+
|
| 5 |
+
Vishakh Padmakumar† Nitish Joshi†
|
| 6 |
+
|
| 7 |
+
Seyed Mehran Kazemi∆ Najoung Kim∆,β,∗ He He†,∗
|
| 8 |
+
|
| 9 |
+
†New York University, ∆Google, $\beta$ Boston University as17582@nyu.edu
|
| 10 |
+
|
| 11 |
+
# Abstract
|
| 12 |
+
|
| 13 |
+
Given the intractably large size of the space of proofs, any model that is capable of general deductive reasoning must generalize to proofs of greater complexity. Recent studies have shown that large language models (LLMs) possess some abstract deductive reasoning ability given chain-of-thought prompts. However, they have primarily been tested on proofs using modus ponens or of a specific size, and from the same distribution as the in-context examples. To measure the general deductive reasoning ability of LLMs, we test on a broad set of deduction rules and measure their ability to generalize to more complex proofs from simpler demonstrations from multiple angles: depth-, width-, and compositional generalization. To facilitate systematic exploration, we construct a new synthetic and programmable reasoning dataset that enables control over deduction rules and proof complexity. Our experiments on four LLMs of various sizes and training objectives show that they are able to generalize to compositional proofs. However, they have difficulty generalizing to longer proofs, and they require explicit demonstrations to produce hypothetical subproofs, specifically in proof by cases and proof by contradiction.
|
| 14 |
+
|
| 15 |
+
# 1 Introduction
|
| 16 |
+
|
| 17 |
+
In many tasks that require deductive reasoning, such as theorem proving or medical diagnosis, the complexity of proofs can grow without bound via the use of multiple deduction rules and the composition of subproofs. Given the large space of proofs, it is infeasible to find data to cover proofs of all sizes. Therefore, a general reasoning model must extrapolate to complex proofs from simpler ones. Recent work has shown that LLMs, combined with in-context learning (ICL) and chain-of-thought (CoT) prompting, are capable of deductive reasoning to an extent [Huang and Chang, 2022, Han et al., 2022, Wei et al., 2022b, Kojima et al., 2022, Lewkowycz et al., 2022, Nye et al., 2021, Gontier et al., 2020]. However, much of the prior work focused on a limited set of deduction rules such as modus ponens [Zhang et al., 2022a, Saparov and He, 2023, Tafjord et al., 2021]. In addition, the evaluation is in-demonstration, where the test example comes from the same distribution as the in-context demonstrations. In this work, we evaluate whether LLMs are capable of general deductive reasoning by measuring how well they generalize to proofs that are more complex
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
|
| 21 |
+
FIGURE 1: An overview of the kinds of OOD generalization that we test in our experiments. Each training example is a sample CoT demonstration provided to the LLM in the few-shot prompt, whereas each test example is a sample proof that the model is expected to output.
|
| 22 |
+
|
| 23 |
+
than their demonstrations.1
|
| 24 |
+
|
| 25 |
+
We characterize the complexity of proofs from three angles: the deduction rules involved, the depth of the proof (i.e. length of a sequential chain of proof steps), and the width of the proof (i.e. the number of premises of each proof step). Each of the three dimensions contributes to the overall size of the proof. To measure the general deductive reasoning ability of LLMs, we extend prior studies in two key ways. First, we determine whether LLMs have learned a complete set of deduction rules, beyond modus ponens. Second, we evaluate whether they can reason over longer proofs than those given as in-context examples (depth- and width- generalization); and whether they are able to use multiple different deduction rules in a single proof (compositional generalization). Figure 1 shows an overview of our study.
|
| 26 |
+
|
| 27 |
+
Our findings suggest that in-context learning is best applied to reasoning tasks by including examples that cover a diverse set of deduction rules, and keeping the examples simple. The in-context examples should especially contain examples of deduction rules that are less familiar to the model (i.e. proof by cases and proof by contradiction), and distractors should be provided for such examples as the model is more prone to overfitting.
|
| 28 |
+
|
| 29 |
+
We test four different LLMs of different scales and training objectives: GPT-3.5 175B [Ouyang et al., 2022], PaLM 540B [Chowdhery et al., 2022], LLaMA 65B [Touvron et al., 2023], and FLAN-T5 11B [Chung et al., 2022], and we find:
|
| 30 |
+
|
| 31 |
+
1. CoT is able to elicit out-of-demonstration (OOD) reasoning in LLMs generalizing to compositional proofs. This is somewhat surprising given the amount of previous work that claim that LLMs are not able to generalize compositionally [Hosseini et al., 2022, An et al., 2023]. See Section 4.2.2 and Figure 6.
|
| 32 |
+
2. ICL generalizes differently compared to supervised learning (i.e. gradient descent on in-context examples). We find numerous examples where it is strictly worse to provide in-context examples from the same distribution as the test example. For instance, in some cases, we observe better generalization to compositional proofs when the in-context examples each contain individual deduction rules. See Sections 4.2.2 and 4.3, and Figures 6 and 8.
|
| 33 |
+
3. However, the LLMs cannot generalize to some deduction rules without explicit demonstrations, specifically, proof by cases and proof by contradiction, suggesting that pretraining is not sufficient to teach the model to generate hypothetical subproofs. See Section 4.2.1 and Figure 4.
|
| 34 |
+
4. Model size does not strongly correlate with performance. Smaller (but not the smallest) models with instruction tuning and longer pretraining perform comparably to larger models.
|
| 35 |
+
|
| 36 |
+
<table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>Automatedevaluation ofproofs</td><td rowspan=1 colspan=1>Contains proofswith multiplededuction rules</td><td rowspan=1 colspan=1>Tests proofdepthgeneralization</td><td rowspan=1 colspan=1>Tests proofwidthgeneralization</td><td rowspan=1 colspan=1>Testscompositionalgeneralization</td><td rowspan=1 colspan=1>Datagenerationcodeavailable</td></tr><tr><td rowspan=1 colspan=1>CLUTRRSinha et al. [2019]</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>一</td></tr><tr><td rowspan=1 colspan=1>LogiQALiu et al. [2020]</td><td rowspan=1 colspan=1>×</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>human-annotated</td></tr><tr><td rowspan=1 colspan=1>ProofWriterTafjord et al. [2021]</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>×</td></tr><tr><td rowspan=1 colspan=1>FOLIOHan et al. [2022]</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>human-annotated</td></tr><tr><td rowspan=1 colspan=1>PRONTOQASaparov and He [2023]</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td></tr><tr><td rowspan=1 colspan=1>PRONTOQA-OOD(this dataset)</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td></tr></table>
|
| 37 |
+
|
| 38 |
+
TABLE 1: Comparison of existing datasets to evaluate reasoning ability. Datasets marked with $\sim$ contain examples of varying width, depth, and compositionality, but these are not programmable (i.e. we cannot generate new examples controlling for these variables), and splitting the existing examples would produce highly imbalanced splits.
|
| 39 |
+
|
| 40 |
+
# 2 Related work
|
| 41 |
+
|
| 42 |
+
OOD generalization of LLMs. Previous work has measured the generalization ability of LLMs on tasks such as bit parity and Boolean variable assignment [Anil et al., 2022], semantic parsing [Hosseini et al., 2022, Qiu et al., 2022], deductive reasoning [Zhang et al., 2022a, Sanyal et al., 2022, Kazemi et al., 2023], and arithmetic reasoning [Kudo et al., 2023], where the length/complexity of the test example is greater than that of the in-context examples. On the bit parity and variable assignment tasks, LLMs are able to generalize to longer inputs with scratchpad prompting [Nye et al., 2021], but this generalization is imperfect, and accuracy still degrades with increasing input length. Generally, larger models tend to be better at generalization than smaller ones. The studies on reasoning were limited to reasoning using modus ponens. Wu et al. [2021] tests the OOD generalization of transformers and graph neural networks on symbolic mathematical reasoning. Our study more systematically examines OOD generalization of LLMs to larger proofs as well as to other deduction rules.
|
| 43 |
+
|
| 44 |
+
Evaluating reasoning abilities of LLMs. A number of recent studies measured the reasoning ability of LLMs [Huang and Chang, 2022, Han et al., 2022]. Table 1 provides a comparison of our proposed dataset to datasets from these studies. Many of these datasets are not amenable to automated evaluation of proofs, relying instead on measuring label accuracy. The datasets also do not test for proof width generalization and compositional generalization. Some datasets focus on a limited set of deduction rules, namely modus ponens. Our work is closest to PRONTOQA [Saparov and He, 2023] but extends it to a complete set of deduction rules and to compositional proofs.
|
| 45 |
+
|
| 46 |
+
Understanding in-context learning. Recent work has shed some light on ICL, and the mechanism by which the model learns from in-context examples. Akyürek et al. [2023], Dai et al. [2023], von Oswald et al. [2022] showed that transformers can learn in-context by performing gradient descent on in-context examples internally. Xie et al. [2022], Wang et al. [2023] show that LLMs exhibit behavior similar to that of topic models where their output is dependent on a latent topic, and the in-context examples help to specify the topic. Ye et al. [2022] demonstrated that ICL is more effective when the in-context examples are both diverse and relevant to the test example. An et al. [2023] and Levy et al. [2022] explored the effect of in-context demonstrations on compositional generalization, showing that it benefits from diverse and individually simple demonstrations. Our results contribute to this growing literature by showing that the generalization behavior in ICL is different from that of supervised learning, and so algorithms such as gradient descent are not the only mechanisms underlying ICL.
|
| 47 |
+
|
| 48 |
+
# 3 Approach
|
| 49 |
+
|
| 50 |
+
A programmable dataset. Our main evaluation approach is to prompt the LLM with simpler proofs and test it on proofs with greater depth and width, or with those using additional deduction rules. Therefore, we require a programmable approach to data generation, where the deduction rules “Alex is a dog. All dogs are mammals. Alex is a mammal. Alex is blue. All mean things are not blue. Suppose Alex is mean. Alex is not blue. This contradicts with Alex is blue. Therefore, Alex is not mean. Alex is a mammal and not mean.”
|
| 51 |
+
|
| 52 |
+
<table><tr><td rowspan=1 colspan=3>Deduction rule Formal definition Natural language example</td></tr><tr><td rowspan=2 colspan=1>Implication elimination(i.e. modus ponens)</td><td rowspan=1 colspan=1>f(a) ∀x(f(x)→ g(𝑥))</td><td rowspan=2 colspan=1>“Alex is a cat. All cats are carnivores. Alex is acarnivore.”</td></tr><tr><td rowspan=1 colspan=1>g(a)</td></tr><tr><td rowspan=1 colspan=1>Conjunctionintroduction</td><td rowspan=1 colspan=1>ABA>B</td><td rowspan=1 colspan=1>“Alex is a cat. Alex is orange. Alex is a cat andorange.”</td></tr><tr><td rowspan=1 colspan=1>Conjunctionelimination</td><td rowspan=1 colspan=1>A>BA</td><td rowspan=1 colspan=1>“Alex is a cat and orange. Alex is orange.”</td></tr><tr><td rowspan=1 colspan=1>Disjunctionintroduction</td><td rowspan=1 colspan=1>AAvB</td><td rowspan=1 colspan=1>“Alex is a cat. Alex is a cat or orange.”</td></tr><tr><td rowspan=1 colspan=1>Disjunction elimination(i.e. proof by cases)</td><td rowspan=1 colspan=1>AνB A├C B├CC</td><td rowspan=1 colspan=1>“Alex is a cat or a dog. Suppose Alex is a cat ... thenAlex is warm-blooded. Suppose Alex is a dog ... thenAlex is warm-blooded. Alex is warm-blooded."</td></tr><tr><td rowspan=1 colspan=1>Proof by contradiction</td><td rowspan=1 colspan=1>A├B-B-A</td><td rowspan=1 colspan=1>“Alex is cold-blooded. If Alex is a mammal,Alex isnot cold-blooded. Suppose Alex is a mammal.Alex isnot cold-blooded. This contradicts with Alex is cold-blooded. Alex is not a mammal."</td></tr></table>
|
| 53 |
+
|
| 54 |
+
TABLE 2: An overview of the deduction rules in PRONTOQA-OOD. The notation $A \vdash B$ denotes entailment: that $B$ is provable from $A$ .
|
| 55 |
+
|
| 56 |
+

|
| 57 |
+
FIGURE 2: An example of a compositional proof containing modus ponens, proof by contradiction, and conjunction introduction, shown in both natural language and a formal tree representation.
|
| 58 |
+
|
| 59 |
+
used, as well as the depth and width of each proof, are controllable parameters. To this end, we propose PRONTOQA-OOD, a generative process for synthetic reasoning questions. Each example in PRONTOQA-OOD contains a handful of premises, a query (the target fact to be proved/disproved), and a gold CoT containing the proof of the query. See Figure 10 for an example from this dataset. Specifically, we extend the PRONTOQA dataset [Saparov and He, 2023] that contains proofs generated from synthetic world models using modus ponens. (1) To evaluate reasoning using different deduction rules, we generate proofs with deduction rules for all connectives in propositional logic: conjunction $\wedge$ , disjunction ∨, implication , and negation ¬. (2) To study width/depth generalization, the proof depth and width are controllable parameters in proof generation, where they control the number of generated deduction rules, and the number of premises in each deduction rule, respectively. (3) To study compositional generalization, we generate compositional proofs using a simple recursive procedure, where each proof contains multiple subproofs with distinct deduction rules.
|
| 60 |
+
|
| 61 |
+
Generating proofs with a complete set of deduction rules. We follow the deduction rules of natural deduction [Gentzen, 1935, Pfenning, 2004], a well-studied proof calculus with desirable completeness properties.2 Examples of each deduction rule are shown in Table 2. For each type of deduction rule, we randomly generate a proof that applies that rule (see details in section A.4. An example of a compositional proof is shown in Figure 2. To prevent LLMs from exploiting knowledge from pretraining to solve the problems without reasoning, we use fictional names for all concepts (e.g. “wumpus” instead of “cat” etc.).
|
| 62 |
+
|
| 63 |
+
Varying proof width and depth. To characterize the size or complexity of each proof, we represent each proof as a tree (Figure 2), where each proof step corresponds to a node, and its premises correspond to the parent nodes. Then the size of the proof can be naturally described by the width and depth of this tree. When generating proofs, we control the depth by continuing to append proof steps until a proof of the desired depth is generated. The number of premises of deduction rules is set to the desired proof width.
|
| 64 |
+
|
| 65 |
+
Generating compositional proofs. To generate proofs combining many different types of deduction rules, we use a simple recursive procedure: (1) select a deduction rule uniformly at random, (2) select the premises for the selected rule, (3) recursively generate a subproof for each premise. See section A.5 for details and pseudocode.
|
| 66 |
+
|
| 67 |
+
Adding distractors. One key challenge to OOD generalization is shortcut solutions. For example, given the facts “Alex is a cat,” “All cats are feline,” since there is no other fact of the form “All cats are...,” the model can deterministically follow the only valid deduction and conclude “Alex is feline.” To make the heuristics uninformative, we add distractor sentences. In the above case, a distractor sentence would be “All cats are graceful.” Then the model is forced to choose the correct premise from two options for the next deduction step. See Section A.7 for details on distractors for all deduction rules.
|
| 68 |
+
|
| 69 |
+
Formal evaluation of chain-of-thought. Unlike previous datasets that evaluate on a binary true/false answer, PRONTOQA-OOD requires LLMs to generate full proofs.3 Therefore, we need a way to evaluate the correctness of the output proofs directly. The sentences in PRONTOQA-OOD are syntactically simple and amenable to semantic parsing, which allows us to formally analyze each step in the CoT. To determine whether a predicted CoT is correct, we: (1) semantically parse each CoT sentence into first-order logic, (2) determine whether each logical form follows from previous logical forms via a rule of deduction, and (3) compute whether there exists a path of correct steps from the premises to the goal. An example of this process is shown below:
|
| 70 |
+
|
| 71 |
+
“Alex is a dog. All dogs are mammals. Alex is a mammal.”
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
{ \begin{array} { l } { \qquad \quad \mathrm { d o g ( a l e x ) , } } \\ { \longrightarrow \forall x ( \mathrm { d o g ( } x ) \mathrm { m a m m a l ( } x ) ) , \quad \longrightarrow \quad { \frac { \forall x ( \mathrm { d o g ( } x ) \mathrm { m a m m a l ( } x ) ) \quad \mathrm { d o g ( a l e x ) } } { \mathrm { m a m m a l ( a l e x ) } } } } \\ { \qquad \mathrm { m a m m a l ( a l e x ) } } \end{array} }
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
Each proof step is considered correct if it is valid and if it immediately follows one of its premises.4 For further details see section A.6.
|
| 78 |
+
|
| 79 |
+
# 4 Results
|
| 80 |
+
|
| 81 |
+
In this section, we test existing LLMs on PRONTOQA-OOD and analyze whether they can produce longer and compositional proofs given simpler demonstrations. We experiment with a variety of models, with different sizes and training objectives, as shown in Figure 3. In all experiments, we use 8-shot chain-of-thought prompting.5
|
| 82 |
+
|
| 83 |
+
FIGURE 3: An overview and properties of the LLMs in our experiments. We place an asterisk\* for GPT-3.5 since we were not able to verify its size.
|
| 84 |
+
|
| 85 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>FLAN-T5</td><td rowspan=1 colspan=1>LLaMA</td><td rowspan=1 colspan=1>GPT-3.5</td><td rowspan=1 colspan=1>PaLM</td></tr><tr><td rowspan=1 colspan=1>Model Size</td><td rowspan=1 colspan=1>11B</td><td rowspan=1 colspan=1>65B</td><td rowspan=1 colspan=1>175B*</td><td rowspan=1 colspan=1>540B</td></tr><tr><td rowspan=1 colspan=1>Instruction Tuned</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>×</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>×</td></tr><tr><td rowspan=1 colspan=1>RLHF</td><td rowspan=1 colspan=1>×</td><td rowspan=1 colspan=1>×</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>×</td></tr><tr><td rowspan=1 colspan=1>Access</td><td rowspan=1 colspan=1>Open</td><td rowspan=1 colspan=1>Limited</td><td rowspan=1 colspan=1>Limited</td><td rowspan=1 colspan=1>Limited</td></tr></table>
|
| 86 |
+
|
| 87 |
+
We compare performance in two settings: (1) an in-demonstration (ID) setting where the 8 in-context demonstrations come from the same distribution as the test example, and (2) an out-of-demonstration (OOD) setting where the in-context demonstrations come from a distribution that is different from that of the test example. $9 5 \%$ confidence intervals are provided for all results.
|
| 88 |
+
|
| 89 |
+

|
| 90 |
+
FIGURE 4: (top) Proof accuracy across examples with different deduction rules. The in-context examples and test examples come from the same distribution. (bottom) Change in proof accuracy, where the test example is out-of-demonstration with respect to the in-context examples. That is, the test example has the specified deduction rule, but the in-context examples are uniformly distributed over all other deduction rules. See Figure 11 in the Appendix for the equivalent plot with absolute proof accuracy on the y-axis. See Figure 5 for an incorrect example. Implication elimination examples have proof width of 1 and depth of 2. Conjunction introduction, conjunction elimination, and disjunction introduction examples have proof width 3 and depth 2. Disjunction elimination examples have proof width 3 and depth 1. Proof by contradiction examples have proof width 2 and depth 1.
|
| 91 |
+
|
| 92 |
+
Prove: Max is a gorpus.
|
| 93 |
+
|
| 94 |
+
Predicted answer: Max is a tumpus or a rompus or a lempus. Max is a tumpus.
|
| 95 |
+
Tumpuses are wumpuses. Max is a wumpus. Rompuses are gorpuses. Max is a gorpus.
|
| 96 |
+
Max is a gorpus. Expected answer: Assume Max is a tumpus. Tumpuses are gorpuses. Max is a gorpus.
|
| 97 |
+
Assume Max is a rompus. Rompuses are gorpuses. Max is a gorpus.
|
| 98 |
+
Assume Max is a lempus. Lempuses are gorpuses. Max is a gorpus.
|
| 99 |
+
Since Max is a tumpus or a rompus or a lempus, Max is a gorpus.
|
| 100 |
+
|
| 101 |
+
FIGURE 5: Example of an incorrect proof generated by GPT-3.5 on an out-of-demonstration disjunction elimination example. The premises (axioms) are given in blue, and invalid steps are given in red. For the full example, see Figure 14 in the Appendix.
|
| 102 |
+
|
| 103 |
+
# 4.1 Can LLMs use deduction rules other than modus ponens?
|
| 104 |
+
|
| 105 |
+
We first evaluate whether LLMs “know” all deduction rules (Table 2) when provided with corresponding CoT prompts. For each deduction rule, we independently and identically generate 8 in-context examples and one test example, and prompt the model to answer the test example. We run each experiment for 100 trials and measure the accuracy of the output proofs. The accuracies are shown in the top chart of Figure 4. We emphasize that the $\Delta$ proof accuracies in the bottom row of the figure should be interpreted in comparison with the accuracies in the top row (e.g. for some rules, the zero $\Delta$ accuracy for FLAN-T5 is due to zero absolute accuracy). For clarity, we provide the same plots using absolute accuracy rather than $\Delta$ accuracy in Section A.2.
|
| 106 |
+
|
| 107 |
+
In general, most models are able to use each deduction rule reasonably well, with GPT-3.5 performing the best. Similar to prior studies [Liang et al., 2022], we do not observe a strong correlation between model size and performance. LLaMA performs comparably to PaLM, despite being smaller. FLANT5 is smaller and performs reasonably on implication and conjunction elimination, but is not able to learn the other deduction rules.
|
| 108 |
+
|
| 109 |
+

|
| 110 |
+
|
| 111 |
+
Prove: Polly is not a lempus.
|
| 112 |
+
|
| 113 |
+
Predicted answer: Polly is a wumpus, a jompus, and a tumpus. Everything that is a wumpus, a jompus, and a tumpus is not a lempus. Polly is not a lempus.
|
| 114 |
+
|
| 115 |
+
Expected answer: Polly is a tumpus. Polly is a jompus. Polly is a wumpus. Polly is a wumpus and a jompus and a tumpus. Everything that is a wumpus, a jompus, and a tumpus is not a lorpus. Polly is not a lorpus.
|
| 116 |
+
|
| 117 |
+
Assume Polly is a lempus. Each lempus is an impus and a lorpus and a rompus. Polly is an impus and a lorpus and a rompus. Polly is a lorpus. This contradicts with Polly is not a lorpus. Polly is not a lempus.
|
| 118 |
+
|
| 119 |
+
FIGURE 6: (top-left) Proof accuracy on compositional examples where the in-context examples are also compositional examples with the same min depth and number of rule types. (bottom-left) Change in proof accuracy where the test examples are compositional but the in-context examples are those of individual deduction rules. See Figure 12 in the Appendix for the equivalent plot with absolute proof accuracy on the y-axis. (right) Example of an incorrect proof generated by GPT-3.5 on an out-of-demonstration example with min depth 2 and 4 rule types. The premises (axioms) are given in blue, and invalid steps are given in red. For the full example, see Figure 15 in the Appendix.
|
| 120 |
+
|
| 121 |
+
# 4.2 Out-of-demonstration generalization
|
| 122 |
+
|
| 123 |
+
# 4.2.1 Can LLMs generalize to unseen deduction rules?
|
| 124 |
+
|
| 125 |
+
While the above results show that LLMs are able to reason with a variety of deduction rules, it is unclear whether the ability is learned from in-context examples or elicited from pretraining. We test the LLM with examples where the test proof requires a deduction rule that does not appear in the in-context examples (i.e. for each in-context example, we sample a deduction rule uniformly at random from the set of deduction rules excluding that of the test example). Our intuition was that LLMs would not be able to use deduction rules unless given explicit demonstrations thereof (aside from those like modus ponens which are well-represented in pretraining). The change in proof accuracy relative to the ID setting is shown in the bottom chart of Figure 4. Evidently, the models are able to use four deduction rules despite not being shown an in-context example with those rules: both conjunction rules, disjunction introduction, and (somewhat) implication elimination. GPT-3.5 was additionally able to use proof by contradiction by relying on an alternate deduction rule called modus tollens (i.e. given $\neg \bar { f } ( c )$ and $\forall x ( g ( c ) f ( \bar { c } ) )$ , conclude $\neg g ( c ) )$ . This is in contrast with McKenzie et al. [2022] which showed that reasoning with modus tollens exhibited inverse scaling behavior, and yet GPT-3.5 is able to use it correctly without any demonstrations. However, Wei et al. [2022a] has shown that when trained with additional compute, models are able to perform modus tollens. GPT-3.5 performed worse on disjunction elimination possibly due to the fact that there is no equivalent alternate rule (an example of an error is given in figure 5). However, no model is able to use disjunction elimination and proof by contradiction without demonstrations.
|
| 126 |
+
|
| 127 |
+
# 4.2.2 Can LLMs generalize to compositional proofs?
|
| 128 |
+
|
| 129 |
+
Next, we test whether the model is able to generalize to compositional proofs that contain multiple different deduction rules. In the ID setting, the in-context examples and test examples are both generated from the same distribution of compositional proofs. In the OOD setting, the in-context demonstrations contain non-compositional examples of each rule that appears in the test example. In Figure 6, in all but three experiments, we observe that the gap in proof accuracy between the ID and OOD settings is close to zero, indicating that the models are able to generalize compositionally to an extent. This is surprising since past studies show that LLMs struggle with compositional generalization, but this could be due to the fact that much of the previous work focused on semantic parsing rather than on reasoning. But there is prior work showing that models can generalize compositionally in some settings, such as in Hosseini et al. [2022] (see Figure 4) and in Press et al. [2022] (see Figure 6). In addition, our study is limited by the token limit of the LLMs, as we are not able to further increase the complexity of the proofs without reducing the number of in-context examples, which would render the results difficult to compare. GPT-3.5 and PALM have difficulty when the number of rule types is 4, with an example of an incorrect output given in the right side of Figure 6. Interestingly, PALM, LLAMA, and FLAN-T5 sometimes perform better in the OOD setting than in the ID setting, showing that, in ICL, it is not always best to provide demonstrations from the same distribution as the test example.
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
FIGURE 7: (top row) Proof accuracy vs proof depth of test examples, where in-context examples have fixed proof depth 2. (bottom row) Proof accuracy vs proof width of test examples, where in-context examples have fixed proof width 2. Dashed lines indicate in-distribution accuracy, where the depth and width of the in-context examples are the same as that of the text-examples. In these experiments, there are 4 rather than 8 in-context examples.
|
| 133 |
+
|
| 134 |
+
# 4.2.3 Can LLMs generalize to bigger proofs?
|
| 135 |
+
|
| 136 |
+
To test whether LLMs can generalize to bigger proofs, we test the models on examples where the proof width or depth is larger than those of the in-context examples. As is evident from Figure 7, when shown demonstrations of proofs of depth 2, the models’ performance decreases with increasing depth. But this is due to the increase in the inherent difficulty of the task, as both ID and OOD accuracies decrease with increasing depth. Though the notable exception is GPT-3.5 on conjunction elimination, where ID accuracy remains high as OOD accuracy decreases. Models are able to generalize better with increasing proof width on conjunction elimination, possibly because there are ample examples of long conjunctions in natural language, but only GPT-3.5 is able to generalize to greater proof widths on conjunction introduction.
|
| 137 |
+
|
| 138 |
+
# 4.3 Do distractors help OOD generalization?
|
| 139 |
+
|
| 140 |
+
In supervised learning, one challenge to OOD generalization is spurious correlations [Zhang et al., 2022b]. Intuitively, if ICL were to behave like supervised learning on in-context examples [Akyürek et al., 2023, Dai et al., 2023, von Oswald et al., 2022], we would expect that without distractors, the models would overfit to the in-context examples and perform poorly on OOD examples. An example where distractors hurt generalization is shown in Figure 9 where GPT-3.5 copies many of the distractor sentences into the output, likely due to the fact that it has learned to apply a copying heuristic from the in-context demonstrations. It seems only GPT-3.5 acquires these heuristics in implication and disjunction elimination. Surprisingly, this is not the case for all deduction rules, as is
|
| 141 |
+
|
| 142 |
+

|
| 143 |
+
FIGURE 8: (top) Proof accuracy on examples where both the in-context examples and test examples have distractors. Sentences in all questions are ordered randomly. (middle) Proof accuracy when distractors are removed from the in-context examples, but not from the test examples. The sentences of the in-context questions have a fixed order (corresponding to a postorder traversal of the ontology tree), whereas the sentences in the test question have random order. See Figure 13 in the Appendix for the equivalent plot with absolute proof accuracy on the y-axis. (bottom) The same setting as (middle) except the distractors in the in-context examples are instead replaced with irrelevant sentences. Implication elimination examples have proof width of 1 and depth of 2. Conjunction introduction, conjunction elimination, and disjunction introduction examples have proof width 2 and depth 2. Disjunction elimination examples have proof width 3 and depth 1. Proof by contradiction examples have proof width 2 and depth 1.
|
| 144 |
+
|
| 145 |
+
Prove: Sally is dull.
|
| 146 |
+
|
| 147 |
+
Predicted answer: Sally is an impus. Impuses are sterpuses. Every grimpus is a zumpus. Every brimpus is a grimpus. Lorpuses are dumpuses. Brimpuses are vumpuses. Every lorpus is a brimpus. Sally is a brimpus. Each vumpus is opaque. Each dumpus is not brown. Every grimpus is dull. Sally is a grimpus. Sally is dull.
|
| 148 |
+
|
| 149 |
+
Expected answer: Sally is a brimpus. Every brimpus is a grimpus. Sally is a grimpus. Each grimpus is dull. Sally is dull.
|
| 150 |
+
|
| 151 |
+
FIGURE 9: Example of an incorrect proof generated by GPT-3.5 on an OOD implication elimination example where the in-context demonstrations have no distractors, but the test example does. The premises (axioms) are given in blue, and invalid steps are given in red. For the full example, see Figure 16 in the Appendix.
|
| 152 |
+
|
| 153 |
+
visible in Figure 8. The models’ performance is largely unaffected, with the exception of a few rules for specific models. This is in stark contrast to supervised learning, where it is always best to train on examples from the same distribution as the test example.
|
| 154 |
+
|
| 155 |
+
# 5 Conclusion and future work
|
| 156 |
+
|
| 157 |
+
In this study, we provide a systematic test of the general deductive reasoning capabilities of LLMs, specifically measuring their rule-, depth-, width-, and compositional generalization abilities. We found that LLMs exhibit mixed generalization to unseen deduction rules, but they exhibit more robust generalization to compositional proofs than previously suggested.
|
| 158 |
+
|
| 159 |
+
One important future direction is to better understand the mechanism of ICL and CoT prompting. We found that in many cases, for a given test example, the best in-context examples were drawn from a distribution distinct from that of the test example. This is not explained by existing theories of Bayesian inference [Xie et al., 2022] or gradient descent [Akyürek et al., 2023, Dai et al., 2023, von Oswald et al., 2022]. Are simpler examples better even if the test example is fairly complex? Should we include examples with a diverse set of deduction rules [Levy et al., 2022]? Or should the in-context examples focus on rules for which the model’s OOD generalization is poor? Further study is needed to better characterize generalization from in-context examples.
|
| 160 |
+
|
| 161 |
+
# Reproducibility statement
|
| 162 |
+
|
| 163 |
+
For the sake of reproducibility of the analysis, model outputs (except those of PaLM), code for data generation, and analysis code are freely available with a permissive open-source license at github.com/asaparov/prontoqa. The generated data for all experiments in this paper is available in the file generated_ood_data.zip. The command python make_plots.py produces all figures used in this paper. GPT-3.5 experiments were run using the OpenAI API with the model text-davinci-003 on April $2 0 ^ { t h } - 2 3 ^ { \hat { r } d }$ , 2023. Experiments for Figure 7 and the bottom row of Figure 8 were run on August $3 ^ { r d } - 7 ^ { t h }$ , 2023.
|
| 164 |
+
|
| 165 |
+
# Acknowledgements
|
| 166 |
+
|
| 167 |
+
We thank Tania Bedrax-Weiss, Xin Xu, and Deepak Ramachandran for their valuable feedback. This work was supported by Open Philanthropy, AWS AI, Samsung Advanced Institute of Technology (under the project Next Generation Deep Learning: From Pattern Recognition to AI), and in part through the NYU IT High Performance Computing resources, services, and staff expertise. NJ is supported by an NSF Graduate Research Fellowship under grant number 1839302.
|
| 168 |
+
|
| 169 |
+
# References
|
| 170 |
+
|
| 171 |
+
Ekin Akyürek, Dale Schuurmans, Jacob Andreas, Tengyu Ma, and Denny Zhou. What learning algorithm is in-context learning? Investigations with linear models. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id= 0g0X4H8yN4I.
|
| 172 |
+
Shengnan An, Zeqi Lin, Qiang Fu, Bei Chen, Nanning Zheng, Jian-Guang Lou, and Dongmei Zhang. How do in-context examples affect compositional generalization? CoRR, abs/2305.04835, 2023. URL https://arxiv.org/abs/2305.04835.
|
| 173 |
+
Cem Anil, Yuhuai Wu, Anders Andreassen, Aitor Lewkowycz, Vedant Misra, Vinay V. Ramasesh, Ambrose Slone, Guy Gur-Ari, Ethan Dyer, and Behnam Neyshabur. Exploring length generalization in large language models. CoRR, abs/2207.04901, 2022. doi: 10.48550/arXiv.2207.04901. URL https://doi.org/10.48550/arXiv.2207.04901.
|
| 174 |
+
Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh, Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek Rao, Parker Barnes, Yi Tay, Noam Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Ben Hutchinson, Reiner Pope, James Bradbury, Jacob Austin, Michael Isard, Guy Gur-Ari, Pengcheng Yin, Toju Duke, Anselm Levskaya, Sanjay Ghemawat, Sunipa Dev, Henryk Michalewski, Xavier Garcia, Vedant Misra, Kevin Robinson, Liam Fedus, Denny Zhou, Daphne Ippolito, David Luan, Hyeontaek Lim, Barret Zoph, Alexander Spiridonov, Ryan Sepassi, David Dohan, Shivani Agrawal, Mark Omernick, Andrew M. Dai, Thanumalayan Sankaranarayana Pillai, Marie Pellat, Aitor Lewkowycz, Erica Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee, Zongwei Zhou, Xuezhi Wang, Brennan Saeta, Mark Diaz, Orhan Firat, Michele Catasta, Jason Wei, Kathy Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. Palm: Scaling language modeling with pathways. CoRR, abs/2204.02311, 2022. doi: 10.48550/arXiv.2204.02311. URL https://doi.org/10.48550/arXiv.2204.02311.
|
| 175 |
+
|
| 176 |
+
Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, Albert Webson, Shixiang Shane Gu, Zhuyun Dai, Mirac Suzgun, Xinyun Chen, Aakanksha Chowdhery, Sharan Narang, Gaurav Mishra, Adams Yu, Vincent Y. Zhao, Yanping Huang, Andrew M. Dai, Hongkun Yu, Slav Petrov, Ed H. Chi, Jeff Dean, Jacob Devlin, Adam Roberts, Denny Zhou, Quoc V. Le, and Jason Wei. Scaling instructionfinetuned language models. CoRR, abs/2210.11416, 2022. doi: 10.48550/arXiv.2210.11416. URL https://doi.org/10.48550/arXiv.2210.11416.
|
| 177 |
+
|
| 178 |
+
Damai Dai, Yutao Sun, Li Dong, Yaru Hao, Zhifang Sui, and Furu Wei. Why can gpt learn incontext? language models secretly perform gradient descent as meta optimizers. In Findings of the Association for Computational Linguistics: ACL 2023, Toronto, Canada, 2023. Association for Computational Linguistics.
|
| 179 |
+
|
| 180 |
+
G. Gentzen. Untersuchungen über das logische schließen i. Mathematische Zeitschrift, 39:176–210, 1935.
|
| 181 |
+
|
| 182 |
+
Nicolas Gontier, Koustuv Sinha, Siva Reddy, and Christopher Pal. Measuring systematic generalization in neural proof generation with transformers. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin, editors, Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. URL https://proceedings.neurips. cc/paper/2020/hash/fc84ad56f9f547eb89c72b9bac209312-Abstract.html.
|
| 183 |
+
|
| 184 |
+
Simeng Han, Hailey Schoelkopf, Yilun Zhao, Zhenting Qi, Martin Riddell, Luke Benson, Lucy Sun, Ekaterina Zubova, Yujie Qiao, Matthew Burtell, David Peng, Jonathan Fan, Yixin Liu, Brian Wong, Malcolm Sailor, Ansong Ni, Linyong Nan, Jungo Kasai, Tao Yu, Rui Zhang, Shafiq R. Joty, Alexander R. Fabbri, Wojciech Kryscinski, Xi Victoria Lin, Caiming Xiong, and Dragomir Radev. FOLIO: natural language reasoning with first-order logic. CoRR, abs/2209.00840, 2022. doi: 10.48550/arXiv.2209.00840. URL https://doi.org/10.48550/arXiv.2209.00840.
|
| 185 |
+
|
| 186 |
+
Arian Hosseini, Ankit Vani, Dzmitry Bahdanau, Alessandro Sordoni, and Aaron C. Courville. On the compositional generalization gap of in-context learning. In Jasmijn Bastings, Yonatan Belinkov, Yanai Elazar, Dieuwke Hupkes, Naomi Saphra, and Sarah Wiegreffe, editors, Proceedings of the Fifth BlackboxNLP Workshop on Analyzing and Interpreting Neural Networks for NLP, BlackboxNLP@EMNLP 2022, Abu Dhabi, United Arab Emirates (Hybrid), December 8, 2022, pages 272–280. Association for Computational Linguistics, 2022. URL https: //aclanthology.org/2022.blackboxnlp-1.22.
|
| 187 |
+
|
| 188 |
+
Jie Huang and Kevin Chen-Chuan Chang. Towards reasoning in large language models: A survey. CoRR, abs/2212.10403, 2022. doi: 10.48550/arXiv.2212.10403. URL https://doi.org/10. 48550/arXiv.2212.10403.
|
| 189 |
+
|
| 190 |
+
Seyed Mehran Kazemi, Najoung Kim, Deepti Bhatia, Xin Xu, and Deepak Ramachandran. LAMBADA: backward chaining for automated reasoning in natural language. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics, Toronto, Canada, July 2023. Association for Computational Linguistics.
|
| 191 |
+
|
| 192 |
+
Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. In Advances in Neural Information Processing Systems, 2022. URL http://papers.nips.cc/paper_files/paper/2022/hash/ 8bb0d291acd4acf06ef112099c16f326-Abstract-Conference.html.
|
| 193 |
+
|
| 194 |
+
Keito Kudo, Yoichi Aoki, Tatsuki Kuribayashi, Ana Brassard, Masashi Yoshikawa, Keisuke Sakaguchi, and Kentaro Inui. Do deep neural networks capture compositionality in arithmetic reasoning? In Andreas Vlachos and Isabelle Augenstein, editors, Proceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics, EACL 2023, Dubrovnik, Croatia, May 2-6, 2023, pages 1343–1354. Association for Computational Linguistics, 2023. URL https://aclanthology.org/2023.eacl-main.98.
|
| 195 |
+
|
| 196 |
+
Itay Levy, Ben Bogin, and Jonathan Berant. Diverse demonstrations improve in-context compositional generalization. CoRR, abs/2212.06800, 2022. doi: 10.48550/arXiv.2212.06800. URL https: //doi.org/10.48550/arXiv.2212.06800.
|
| 197 |
+
|
| 198 |
+
Aitor Lewkowycz, Anders Johan Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Venkatesh Ramasesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, Yuhuai Wu, Behnam Neyshabur, Guy Gur-Ari, and Vedant Misra. Solving quantitative reasoning problems with language models. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho, editors, Advances in Neural Information Processing Systems, 2022. URL https://openreview. net/forum?id $\cdot ^ { = }$ IFXTZERXdM7.
|
| 199 |
+
|
| 200 |
+
Percy Liang, Rishi Bommasani, Tony Lee, Dimitris Tsipras, Dilara Soylu, Michihiro Yasunaga, Yian Zhang, Deepak Narayanan, Yuhuai Wu, Ananya Kumar, Benjamin Newman, Binhang Yuan, Bobby Yan, Ce Zhang, Christian Cosgrove, Christopher D. Manning, Christopher Ré, Diana Acosta-Navas, Drew A. Hudson, Eric Zelikman, Esin Durmus, Faisal Ladhak, Frieda Rong, Hongyu Ren, Huaxiu Yao, Jue Wang, Keshav Santhanam, Laurel J. Orr, Lucia Zheng, Mert Yüksekgönül, Mirac Suzgun, Nathan Kim, Neel Guha, Niladri S. Chatterji, Omar Khattab, Peter Henderson, Qian Huang, Ryan Chi, Sang Michael Xie, Shibani Santurkar, Surya Ganguli, Tatsunori Hashimoto, Thomas Icard, Tianyi Zhang, Vishrav Chaudhary, William Wang, Xuechen Li, Yifan Mai, Yuhui Zhang, and Yuta Koreeda. Holistic evaluation of language models. CoRR, abs/2211.09110, 2022. doi: 10.48550/arXiv.2211.09110. URL https://doi.org/10.48550/arXiv.2211.09110.
|
| 201 |
+
|
| 202 |
+
Jian Liu, Leyang Cui, Hanmeng Liu, Dandan Huang, Yile Wang, and Yue Zhang. Logiqa: A challenge dataset for machine reading comprehension with logical reasoning. In Christian Bessiere, editor, Proceedings of the Twenty-Ninth International Joint Conference on Artificial Intelligence, IJCAI 2020, pages 3622–3628. ijcai.org, 2020. doi: 10.24963/ijcai.2020/501. URL https: //doi.org/10.24963/ijcai.2020/501.
|
| 203 |
+
|
| 204 |
+
Ian McKenzie, Alexander Lyzhov, Alicia Parrish, Ameya Prabhu, Aaron Mueller, Najoung Kim, Sam Bowman, and Ethan Perez. Inverse scaling prize: Second round winners, 2022. URL https://irmckenzie.co.uk/round2.
|
| 205 |
+
|
| 206 |
+
Maxwell I. Nye, Anders Johan Andreassen, Guy Gur-Ari, Henryk Michalewski, Jacob Austin, David Bieber, David Dohan, Aitor Lewkowycz, Maarten Bosma, David Luan, Charles Sutton, and Augustus Odena. Show your work: Scratchpads for intermediate computation with language models. CoRR, abs/2112.00114, 2021. URL https://arxiv.org/abs/2112.00114.
|
| 207 |
+
|
| 208 |
+
Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Gray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Christiano, Jan Leike, and Ryan Lowe. Training language models to follow instructions with human feedback. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho, editors, Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum?id $\cdot ^ { = }$ TG8KACxEON.
|
| 209 |
+
|
| 210 |
+
Frank Pfenning. Natural deduction. Lecture notes in 15-815 Automated Theorem Proving, 2004. URL https://www.cs.cmu.edu/\~fp/courses/atp/handouts/ch2-natded.pdf.
|
| 211 |
+
|
| 212 |
+
Ofir Press, Muru Zhang, Sewon Min, Ludwig Schmidt, Noah A. Smith, and Mike Lewis. Measuring and narrowing the compositionality gap in language models. CoRR, abs/2210.03350, 2022. doi: 10.48550/arXiv.2210.03350. URL https://doi.org/10.48550/arXiv.2210.03350.
|
| 213 |
+
|
| 214 |
+
Linlu Qiu, Peter Shaw, Panupong Pasupat, Tianze Shi, Jonathan Herzig, Emily Pitler, Fei Sha, and Kristina Toutanova. Evaluating the impact of model scale for compositional generalization in semantic parsing. In Yoav Goldberg, Zornitsa Kozareva, and Yue Zhang, editors, Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, EMNLP 2022, Abu Dhabi, United Arab Emirates, December 7-11, 2022, pages 9157–9179. Association for Computational Linguistics, 2022. URL https://aclanthology.org/2022.emnlp-main.624.
|
| 215 |
+
|
| 216 |
+
Soumya Sanyal, Zeyi Liao, and Xiang Ren. Robustlr: A diagnostic benchmark for evaluating logical robustness of deductive reasoners. In Yoav Goldberg, Zornitsa Kozareva, and Yue Zhang, editors, Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, EMNLP 2022, Abu Dhabi, United Arab Emirates, December 7-11, 2022, pages 9614–9631. Association for Computational Linguistics, 2022. doi: 10.18653/v1/2022.emnlp-main.653. URL https://doi.org/10.18653/v1/2022.emnlp-main.653.
|
| 217 |
+
|
| 218 |
+
Abulhair Saparov and He He. Language models are greedy reasoners: A systematic formal analysis of chain-of-thought. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=qFVVBzXxR2V.
|
| 219 |
+
|
| 220 |
+
Koustuv Sinha, Shagun Sodhani, Jin Dong, Joelle Pineau, and William L. Hamilton. CLUTRR: A diagnostic benchmark for inductive reasoning from text. In Kentaro Inui, Jing Jiang, Vincent Ng, and Xiaojun Wan, editors, Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, EMNLP-IJCNLP 2019, Hong Kong, China, November 3-7, 2019, pages 4505–4514. Association for Computational Linguistics, 2019. doi: 10.18653/v1/D19-1458. URL https: //doi.org/10.18653/v1/D19-1458.
|
| 221 |
+
|
| 222 |
+
Oyvind Tafjord, Bhavana Dalvi, and Peter Clark. Proofwriter: Generating implications, proofs, and abductive statements over natural language. In Chengqing Zong, Fei Xia, Wenjie Li, and Roberto Navigli, editors, Findings of the Association for Computational Linguistics: ACL/IJCNLP 2021, Online Event, August 1-6, 2021, volume ACL/IJCNLP 2021 of Findings of ACL, pages 3621–3634. Association for Computational Linguistics, 2021. doi: 10.18653/v1/2021.findings-acl.317. URL https://doi.org/10.18653/v1/2021.findings-acl.317.
|
| 223 |
+
|
| 224 |
+
Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, Aurélien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. LLaMA: Open and efficient foundation language models. CoRR, abs/2302.13971, 2023. doi: 10.48550/arXiv.2302.13971. URL https://doi. org/10.48550/arXiv.2302.13971.
|
| 225 |
+
|
| 226 |
+
Johannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento, Alexander Mordvintsev, Andrey Zhmoginov, and Max Vladymyrov. Transformers learn in-context by gradient descent. CoRR, abs/2212.07677, 2022. doi: 10.48550/arXiv.2212.07677. URL https://doi.org/10. 48550/arXiv.2212.07677.
|
| 227 |
+
|
| 228 |
+
Xinyi Wang, Wanrong Zhu, and William Yang Wang. Large language models are implicitly topic models: Explaining and finding good demonstrations for in-context learning. CoRR, abs/2301.11916, 2023. doi: 10.48550/arXiv.2301.11916. URL https://doi.org/10.48550/arXiv.2301. 11916.
|
| 229 |
+
|
| 230 |
+
Jason Wei, Yi Tay, and Quoc V. Le. Inverse scaling can become u-shaped. CoRR, abs/2211.02011, 2022a. doi: 10.48550/arXiv.2211.02011. URL https://doi.org/10.48550/arXiv.2211. 02011.
|
| 231 |
+
|
| 232 |
+
Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, brian ichter, Fei Xia, Ed H. Chi, Quoc V Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho, editors, Advances in Neural Information Processing Systems, 2022b. URL https://openreview.net/forum?id= _VjQlMeSB_J.
|
| 233 |
+
|
| 234 |
+
Yuhuai Wu, Albert Q. Jiang, Jimmy Ba, and Roger Baker Grosse. INT: an inequality benchmark for evaluating generalization in theorem proving. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021. URL https://openreview.net/forum?id=O6LPudowNQm.
|
| 235 |
+
|
| 236 |
+
Sang Michael Xie, Aditi Raghunathan, Percy Liang, and Tengyu Ma. An explanation of in-context learning as implicit bayesian inference. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. OpenReview.net, 2022. URL https://openreview.net/forum?id $\equiv$ RdJVFCHjUMI.
|
| 237 |
+
|
| 238 |
+
Xi Ye, Srinivasan Iyer, Asli Celikyilmaz, Ves Stoyanov, Greg Durrett, and Ramakanth Pasunuru. Complementary explanations for effective in-context learning. CoRR, abs/2211.13892, 2022. doi: 10.48550/arXiv.2211.13892. URL https://doi.org/10.48550/arXiv.2211.13892.
|
| 239 |
+
|
| 240 |
+
Hanlin Zhang, Yi-Fan Zhang, Li Erran Li, and Eric P. Xing. The impact of symbolic representations on in-context learning for few-shot reasoning. CoRR, abs/2212.08686, 2022a. doi: 10.48550/arXiv. 2212.08686. URL https://doi.org/10.48550/arXiv.2212.08686.
|
| 241 |
+
|
| 242 |
+
# A Appendix
|
| 243 |
+
|
| 244 |
+
# A.1 Example from PRONTOQA-OOD
|
| 245 |
+
|
| 246 |
+
Q: Everything that is a lorpus, a brimpus, or a jompus is a shumpus. Every wumpus is a vumpus and a sterpus and a brimpus. Everything that is a vumpus, a grimpus, or a brimpus is a lempus. Everything that is a lempus or a jompus or a lorpus is a dumpus. Vumpuses are rompuses. Every sterpus is a gorpus. Everything that is a vumpus, a grimpus, or a brimpus is a dumpus. Wumpuses are shumpuses. Polly is a rompus. Polly is a wumpus. Prove: Polly is a lempus or an impus or a yumpus.
|
| 247 |
+
|
| 248 |
+
A: Polly is a wumpus. Every wumpus is a vumpus and a sterpus and a brimpus. Polly is a vumpus and a sterpus and a brimpus. Polly is a brimpus. Polly is a vumpus, a grimpus, or a brimpus. Everything that is a vumpus, a grimpus, or a brimpus is a lempus. Polly is a lempus. Polly is a lempus, an impus, or a yumpus.
|
| 249 |
+
|
| 250 |
+
FIGURE 10: An example from PRONTOQA-OOD. This is a compositional example with a min depth of 4 and 3 rule types. The given answer is the expected chain-of-thought. The question is shown in blue, the query in red, and the chain-of-thought/answer in green.
|
| 251 |
+
|
| 252 |
+
# A.2 Results with absolute accuracy
|
| 253 |
+
|
| 254 |
+

|
| 255 |
+
FIGURE 11: (top) Proof accuracy across examples with different deduction rules. The in-context examples and test examples come from the same distribution. (bottom) Proof accuracy where the test example is out-ofdemonstration with respect to the in-context examples (for comparison, the in-demonstration proof accuracy is shown as the dotted black bars). That is, the test example has the specified deduction rule, but the in-context examples are uniformly distributed over all other deduction rules. See Figure 5 for an incorrect example. Implication elimination examples have proof width of 1 and depth of 2. Conjunction introduction, conjunction elimination, and disjunction introduction examples have proof width 3 and depth 2. Disjunction elimination examples have proof width 3 and depth 1. Proof by contradiction examples have proof width 2 and depth 1.
|
| 256 |
+
|
| 257 |
+

|
| 258 |
+
FIGURE 12: (top) Proof accuracy on compositional examples where the in-context examples are also compositional examples with the same min depth and number of rule types. (bottom) Proof accuracy where the test examples are compositional but the in-context examples are those of individual deduction rules (for comparison, the in-demonstration proof accuracy is shown as the dotted black bars).
|
| 259 |
+
|
| 260 |
+

|
| 261 |
+
FIGURE 13: (top) Proof accuracy on examples where both the in-context examples and test examples have distractors. Sentences in all questions are ordered randomly. (middle) Proof accuracy when distractors are removed from the in-context examples, but not from the test examples (for comparison, the in-demonstration proof accuracy is shown as the dotted black bars). The sentences of the in-context questions have a fixed order (corresponding to a postorder traversal of the ontology tree), whereas the sentences in the test question have random order. (bottom) The same setting as (middle) except the distractors in the in-context examples are instead replaced with irrelevant sentences. Implication elimination examples have proof width of 1 and depth of 2. Conjunction introduction, conjunction elimination, and disjunction introduction examples have proof width 2 and depth 2. Disjunction elimination examples have proof width 3 and depth 1. Proof by contradiction examples have proof width 2 and depth 1.
|
| 262 |
+
|
| 263 |
+
# A.3 Full examples of incorrect predicted proofs
|
| 264 |
+
|
| 265 |
+
Question: Lempuses are gorpuses. Rompuses are wumpuses. Tumpuses are wumpuses. Dumpuses are gorpuses. Every zumpus is a wumpus. Every brimpus is a gorpus. Yumpuses are gorpuses. Lempuses are wumpuses. Rompuses are gorpuses. Tumpuses are gorpuses. Max is a tumpus or a rompus or a lempus. Max is a zumpus, a tumpus, or a rompus.
|
| 266 |
+
|
| 267 |
+
Prove: Max is a gorpus.
|
| 268 |
+
|
| 269 |
+
Predicted answer: Max is a tumpus or a rompus or a lempus. Max is a tumpus.
|
| 270 |
+
Tumpuses are wumpuses. Max is a wumpus. Rompuses are gorpuses. Max is a gorpus.
|
| 271 |
+
Max is a gorpus. Expected answer: Assume Max is a tumpus. Tumpuses are gorpuses. Max is a gorpus.
|
| 272 |
+
Assume Max is a rompus. Rompuses are gorpuses. Max is a gorpus.
|
| 273 |
+
Assume Max is a lempus. Lempuses are gorpuses. Max is a gorpus.
|
| 274 |
+
Since Max is a tumpus or a rompus or a lempus, Max is a gorpus.
|
| 275 |
+
|
| 276 |
+
FIGURE 14: Example of an incorrect proof generated by GPT-3.5 on an out-of-demonstration disjunction elimination example. The premises (axioms) are given in blue, and invalid steps are given in red.
|
| 277 |
+
|
| 278 |
+
Question: Polly is a wumpus. Every rompus is a dumpus. Lempuses are vumpuses. Everything that is a wumpus, a jompus, and a tumpus is a dumpus. Polly is a gorpus. Every impus is a brimpus. Everything that is a wumpus, a gorpus, and a shumpus is a vumpus. Each lempus is an impus and a lorpus and a rompus. Everything that is a wumpus, a jompus, and a tumpus is not a lorpus. Zumpuses are lorpuses. Polly is a shumpus. Polly is a zumpus. Polly is a zumpus. Polly is a wumpus. Polly is a jompus. Polly is a tumpus.
|
| 279 |
+
|
| 280 |
+
Prove: Polly is not a lempus.
|
| 281 |
+
|
| 282 |
+
Predicted answer: Polly is a wumpus, a jompus, and a tumpus. Everything that is a wumpus, a jompus, and a tumpus is not a lempus. Polly is not a lempus.
|
| 283 |
+
|
| 284 |
+
Expected answer: Polly is a tumpus. Polly is a jompus. Polly is a wumpus. Polly is a wumpus and a jompus and a tumpus. Everything that is a wumpus, a jompus, and a tumpus is not a lorpus. Polly is not a lorpus.
|
| 285 |
+
Assume Polly is a lempus. Each lempus is an impus and a lorpus and a rompus. Polly is an impus and a lorpus and a rompus. Polly is a lorpus. This contradicts with Polly is not a lorpus. Polly is not a lempus.
|
| 286 |
+
|
| 287 |
+
FIGURE 15: Example of an incorrect proof generated by GPT-3.5 on an out-of-demonstration example with min depth 2 and 4 rule types. The premises (axioms) are given in blue, and invalid steps are given in red.
|
| 288 |
+
|
| 289 |
+
Question: Every grimpus is a zumpus. Each vumpus is opaque. Each dumpus is not brown. Each grimpus is dull. Lorpuses are moderate. Every brimpus is rainy. Impuses are temperate. Lorpuses are dumpuses. Brimpuses are vumpuses. Every lorpus is a brimpus. Zumpuses are angry. Grimpuses are yumpuses. Every brimpus is a grimpus. Impuses are sterpuses. Sally is an impus. Sally is a brimpus.
|
| 290 |
+
|
| 291 |
+
Prove: Sally is dull.
|
| 292 |
+
|
| 293 |
+
Predicted answer: Sally is an impus. Impuses are sterpuses. Every grimpus is a zumpus. Every brimpus is a grimpus. Lorpuses are dumpuses. Brimpuses are vumpuses. Every lorpus is a brimpus. Sally is a brimpus. Each vumpus is opaque. Each dumpus is not brown. Every grimpus is dull. Sally is a grimpus. Sally is dull.
|
| 294 |
+
|
| 295 |
+
Expected answer: Sally is a brimpus. Every brimpus is a grimpus. Sally is a grimpus. Each grimpus is dull. Sally is dull.
|
| 296 |
+
|
| 297 |
+
FIGURE 16: Example of an incorrect proof generated by GPT-3.5 on an OOD implication elimination example where the in-context demonstrations have no distractors, but the test example does. The premises (axioms) are given in blue, and invalid steps are given in red.
|
| 298 |
+
|
| 299 |
+
# A.4 Generative process details
|
| 300 |
+
|
| 301 |
+
In this section, we describe the process to generate examples of each deduction rule.
|
| 302 |
+
|
| 303 |
+
Implication elimination (i.e. modus ponens) Given $f ( c )$ and $\forall x ( f ( x ) g ( x ) )$ , prove $g ( c )$ . These are the examples in the original PRONTOQA. We follow the same process here:
|
| 304 |
+
|
| 305 |
+
1. Generate an ontology. For simplicity, we generate linear ontologies, consisting of a collection of concepts, as well as subtype-supertype relations between those concepts (i.e. concept $f$ is a subtype of the supertype $g$ if every instance of $f$ is an instance of $g$ ). For simplicity, we limit each type to have at most one supertype.
|
| 306 |
+
2. Perform a random walk of length $k$ from a randomly selected start vertex, where $k$ is the desired proof depth.
|
| 307 |
+
3. Traverse the edges of the ontology and convert each into a sentence of the question.
|
| 308 |
+
4. Convert each step of the random walk into a sentence of the gold chain-of-thought.
|
| 309 |
+
|
| 310 |
+
Note that this process allows us to generate proofs of any depth, but the width is fixed to 1.
|
| 311 |
+
|
| 312 |
+
Conjunction introduction Given $A$ and $B$ , prove $A \land B$ . The generative process is a modified version of that for implication elimination. Instead of generating rules of the form $\forall x ( f ( x ) g ( x ) )$ , we generate rules of the form $\forall x ( f _ { 1 } ( x ) \land \dots \land f _ { n } ( x ) g ( x ) )$ , where $n$ is the proof width. Given, $f _ { 1 } ( \bar { c } )$ , . . ., and $f _ { n } ( c )$ , the model must first prove $f _ { 1 } ( c ) \wedge \ldots \wedge f _ { n } ( c )$ before applying implication elimination to prove $g ( c )$ . To increase the depth of the proof, $g ( c )$ itself can be part of a conjunct in the antecedent of another rule.
|
| 313 |
+
|
| 314 |
+
Conjunction elimination Given $A \land B$ , prove $A$ . These examples are identical to those in conjunction introduction, except the conjunction appears in the consequent of each rule, rather than in the antecedent: $\forall x ( f ( x ) \bar { \to } g _ { 1 } ( x ) \land \bar { \land } . . . \land g _ { n } ( \bar { x } ) )$ where $n$ is the proof width.
|
| 315 |
+
|
| 316 |
+
Disjunction introduction Given $A$ , prove $A \lor B$ . These examples are identical to those in conjunction introduction, except the conjunction is replaced with disjunction: $\forall x ( f _ { 1 } ( x ) \lor . . . \lor f _ { n } ( x ) \to { \bar { g } } ( x ) )$ where $n$ is the proof width. But note that grounded axioms are not necessary for every disjunct: To apply the rule $\bar { \forall } x ( f _ { 1 } ( x ) \lor \dots \lor f _ { n } ( x ) \to \bar { g } ( x ) )$ , knowing $f _ { n } ( c )$ is sufficient, and we do not need to generate grounded axioms for the other disjuncts $f _ { i } ( c )$ for $i < n$ .
|
| 317 |
+
|
| 318 |
+
Disjunction elimination (i.e. proof by cases) Given $A _ { 1 } \lor . . . \lor A _ { n }$ , and $A _ { i } \vdash C$ for all $i$ , prove $C$ . Here, $n$ is the proof width. While it is possible to construct proofs containing multiple nested applications of disjunction elimination, such proofs are quite complex, even for humans to understand, and so we fix the depth of these examples to 1. To generate an example, we first generate the disjunction: $f _ { 1 } ( c ) \lor \dots \lor f _ { n } ( c )$ . Next, generate the rules for each case: $\forall x ( f _ { i } ( x ) g ( x ) )$ for all $i$ The goal is to prove $g ( c )$ .
|
| 319 |
+
|
| 320 |
+
Proof by contradiction Given $A \vdash B$ and $\neg B$ , prove $\neg A$ . Note that this is a rule composed of two natural deduction rules: negation elimination and introduction. But since those individual rules do not lend themselves to a natural text representation, we choose to study their composition. Similar to disjunction elimination, it is possible to construct proofs containing multiple nested applications of proof by contradiction, but such proofs are unnaturally complex. So we fix the depth to 1. To generate an example, we first generate an axiom $\neg g ( c )$ . Next, for each subproof, we generate a rule $\forall x ( f _ { 1 } ( x ) \lor \dots \lor f _ { n } ( x ) \to g \bar { ( x ) } )$ , where $n$ is the proof width. The goal is to prove $\neg f _ { 1 } ( c ) \land \dots \land \neg f _ { n } ( c )$ . Note that in addition to proof by contradiction, this proof requires disjunction introduction, implication elimination, and conjunction introduction.
|
| 321 |
+
|
| 322 |
+
Note that the above list constitutes a complete set of deduction rules from propositional natural deduction, save for one rule: implication introduction. However, it is unclear how to construct an example with this deduction rule where its difficulty can be controlled by increasing the width or depth of the proof (e.g. how can a statement of the form $A _ { 1 } \to A _ { 2 } \to . . . \to A _ { n }$ be expressed in natural language?).
|
| 323 |
+
|
| 324 |
+
Algorithm 1: Pseudocode for generating examples of compositional proofs in PRONTOQA-OOD. In this algorithm, $\Omega$ denotes the set of all logical forms. The function generate_compositional_proof is initially called with parameters $\Omega , \emptyset , d , e .$ , and false, where $d$ is the requested depth and $e$ is a randomly selected entity name (e.g. alex, fae, etc). sample is a helper function that, given an input set of logical forms $S$ and an entity $e$ , returns sample_uniform({set of logical forms in $S$ with minimal depth where all atoms are of the form $t ( e )$ where $t$ is a predicate}).
|
| 325 |
+
|
| 326 |
+
function generate_compositional_proof(set of possible conclusions (logical forms) $C$ ,
|
| 327 |
+
disallowed deduction rules $R$ ,
|
| 328 |
+
requested depth d,
|
| 329 |
+
ground entity $e$ ,
|
| 330 |
+
is proof hypothetical $h$ )
|
| 331 |
+
2 initialize $A$ as the set of all deduction rules excluding those in $R$
|
| 332 |
+
$^ { \prime * }$ filter deduction rules such that: (1) an element of $C$ can be a conclusion
|
| 333 |
+
of the rule, (2) for which we have sufficient depth, and (3) we don’t create
|
| 334 |
+
overly complex logical forms $^ { * / }$
|
| 335 |
+
3 if $C$ does not contain a conjunction
|
| 336 |
+
4 set $A = A \setminus \left\{ \begin{array} { r l r } \end{array} \right.$ conjunction_introduction}
|
| 337 |
+
5 if $C$ does not contain a disjunction
|
| 338 |
+
6 set $A = A$ \ {disjunction_introduction}
|
| 339 |
+
7 if $h = t r u e$ or $d = 1$ or $C$ does not contain a negation
|
| 340 |
+
8 set $A = A$ \ {proof_by_contradiction}
|
| 341 |
+
9 if $h = t r u e$ or $d = 1$ or $C$ contains only conjunctions or only disjunctions
|
| 342 |
+
10 set $A = A$ \ {disjunction_elimination}
|
| 343 |
+
11 if $C$ contains only conjunctions or only disjunctions
|
| 344 |
+
12 set $A = A \setminus \left\{ \begin{array} { r l r } \end{array} \right.$ conjunction_elimination}
|
| 345 |
+
13 if $C$ contains only conjunctions or only disjunctions and any operand is negated
|
| 346 |
+
14 set $A = A$ \ {implication_elimination}
|
| 347 |
+
15 if $d = 0$ or $C$ contains a singleton logical form or $A = \emptyset$
|
| 348 |
+
16 return axiom step with conclusion given by samp $\displaystyle { \bar { \imath } e ( C , e ) }$
|
| 349 |
+
17 $r =$ sample_uniform $( A )$
|
| 350 |
+
18 if r = implication_elimination
|
| 351 |
+
19 do
|
| 352 |
+
20 for any $c \in C$ , $a$ and $c$ share any operands or negations of operands
|
| 353 |
+
21 while $a =$ generate_compositional_proof $( \Omega , \emptyset , d - 1 , \bar { e } , h )$
|
| 354 |
+
22 do
|
| 355 |
+
23 $| \textit { \textbf { a } }$ and $s$ do not share any operands or negations of operands
|
| 356 |
+
24 while $s = s a m p l e ( C , e )$
|
| 357 |
+
25 return implication_elimination with premises a and $\forall x ( a [ e x ] s [ e x ]$ )
|
| 358 |
+
26 else if r = conjunction_introduction
|
| 359 |
+
27 initialize $P$ as an empty list, and $i = 0$
|
| 360 |
+
28 $L = | C |$ if $C$ contains only conjunctions, else $L = 3$
|
| 361 |
+
29 do
|
| 362 |
+
30 let $C _ { i } = i ^ { t h }$ operand of $C$ if $C$ contains only conjunctions, else $C _ { i } = \Omega$
|
| 363 |
+
31 $a =$ generate_compositional_proof( $C _ { i }$ , $\{$ conjunction_elimination} $, d - 1 , e , h )$
|
| 364 |
+
32 if $a$ is atomic and $a$ is not any other operand of $C$
|
| 365 |
+
33 append $a$ to $P$
|
| 366 |
+
34 $i = i + 1$
|
| 367 |
+
35 while $i < L$
|
| 368 |
+
36 return conjunction_introduction with premises $P$
|
| 369 |
+
37 else if $r =$ conjunction_elimination
|
| 370 |
+
38 let $C ^ { \prime }$ be the set of conjunctions of length 3, $i =$ sample_uniform $( \{ 1 , 2 , 3 \} )$ )
|
| 371 |
+
39 $C ^ { \prime } = \{ c \in C ^ { \prime }$ : the $i ^ { t h }$ operand of $c ^ { \prime }$ is in $C \}$
|
| 372 |
+
40 do
|
| 373 |
+
41 $a =$ generate_compositional_proof( $C ^ { \prime }$ , {conjunction_introduction}, $d - 1 , e , h )$
|
| 374 |
+
42 while a has no duplicate operands, and each operand of a is not itself a conjunction or disjunction
|
| 375 |
+
43 return conjunction_elimination with premise a and conclusion given by the $i ^ { t h }$ operand of $a$
|
| 376 |
+
44 else if $r = d \cdot$ isjunction_introduction
|
| 377 |
+
45 if $C = \Omega$ let $C$ be the set of disjunctions of length 3
|
| 378 |
+
46 $i =$ sample_uniform( number of disjuncts in $C$ )
|
| 379 |
+
47 do
|
| 380 |
+
48 let $C _ { i } = i ^ { t h }$ operand of $C$
|
| 381 |
+
49 $a =$ generate_compositional_proof( $C _ { i }$ , {disjunction_elimination}, d − 1, e, h)
|
| 382 |
+
50 while $a$ is atomic and a is not any other operand of $C$
|
| 383 |
+
51 replace $i ^ { t h }$ operand of $C$ with $a$
|
| 384 |
+
52 do
|
| 385 |
+
53 $\textbf { | } \ x = \mathtt { s a m p l e } ( C , e )$
|
| 386 |
+
54 while $i ^ { t h }$ disjunct of $_ x$ is distinct from all other disjuncts
|
| 387 |
+
55 return disjunction_introduction with premise given by the $i ^ { t h }$ operand of $_ x$ and conclusion $x$
|
| 388 |
+
56 else if $r = d$ isjunction_elimination
|
| 389 |
+
57 initialize $P$ as an empty list
|
| 390 |
+
58 while $| P | < 2$ do
|
| 391 |
+
59 $p =$ generate_compositional_proof(C, {disjunction_introduction}, $d - 1 , e$ , true)
|
| 392 |
+
60 if $p$ is not a conjunction or disjunction and $p$ has an axiom that is not an axiom of any $q \in P$
|
| 393 |
+
61 append $p$ to $P$
|
| 394 |
+
62 let $A _ { i }$ be the set of axioms of $P _ { i }$ that are not axioms of $P _ { j }$ for $i \neq j$
|
| 395 |
+
63 let $a _ { i } =$ sample_uniform $\left( A _ { i } \right)$ for all $_ { i }$
|
| 396 |
+
64 let $a ^ { \prime }$ be a disjunction with disjuncts $a _ { i }$
|
| 397 |
+
65 $a =$ generate_compositional_proof $( \{ a ^ { \prime } \}$ , {disjunction_introduction} $\cdot , d - 1 , e , h )$
|
| 398 |
+
66 return disjunction_introduction with premises a and $P _ { i }$
|
| 399 |
+
67 else if $r = p r o o f .$ _by_contradiction
|
| 400 |
+
68 let $N$ be the set of all negated logical forms
|
| 401 |
+
69 $a =$ generate_compositional_proof(N, {proof_by_contradiction}, d − 1, h)
|
| 402 |
+
70 do
|
| 403 |
+
let $a = \neg s$
|
| 404 |
+
$b =$ generate_compositional_proof $\langle \boldsymbol { \it s } \rangle$ , {proof_by_contradiction}, d − 1, e, true)
|
| 405 |
+
while b has an atomic non-negated axiom that is not an axiom of $a$
|
| 406 |
+
$s ^ { \prime } = { }$ sample_uniform({atomic non-negated axioms of $b$ that are not axioms of $a \}$ )
|
| 407 |
+
return proof_by_contradiction with premises a and b and conclusion $\boldsymbol { \neg { s ^ { \prime } } }$
|
| 408 |
+
|
| 409 |
+
# A.5 Generating compositional proofs
|
| 410 |
+
|
| 411 |
+
We use a simple recursive procedure to generate compositional proofs: (1) select a deduction rule uniformly at random, (2) select the premises for the selected rule, (3) recursively generate a subproof for each premise. A consistency checking step is required to make sure we avoid generating contradictory axioms.6 In addition, we avoid generating an elimination rule directly following an introduction rule (or vice versa).7 See Algorithm 1 in the appendix for pseudocode of this procedure. To test compositional proofs of various sizes, we implement a parameter that controls the minimum depth of the proof tree, and another parameter that controls the number of distinct rule types in each proof.
|
| 412 |
+
|
| 413 |
+
# A.6 Further details on evaluation of CoT
|
| 414 |
+
|
| 415 |
+
We aim to test whether LLMs are able to use deduction rules OOD, where the rules do not appear in the in-context examples, and we take care not to be overly strict. For example, we wish to avoid penalizing the model for formatting differences, so long as the reasoning is correct. To this end, in determining whether a logical form follows from previous logical forms, we consider any deduction rule listed in Table 2. We also allow for two additional rules: (1) given $\forall x ( f ( x ) g ( x ) )$ and $\forall x ( g ( x ) h ( x ) )$ conclude $\forall x ( f ( x ) h ( x ) )$ , and (2) given $\forall x ( f ( x ) g ( x ) )$ and $\neg g ( c )$ conclude $\neg f ( c )$ (i.e. modus tollens).8 Additionally, we are flexible with respect to the ordering of conjuncts and disjuncts. For example, given the previous steps $f ( a ) \land g ( a )$ and $\forall x ( g ( x ) \land f ( x ) \bar { \to } u ( x ) \lor \bar { v } ( x ) )$ , we consider $v ( a ) \lor u ( a )$ to be valid.
|
| 416 |
+
|
| 417 |
+
# A.7 Generating distractors
|
| 418 |
+
|
| 419 |
+
Implication elimination For any rule $\forall x ( f ( x ) g ( x ) )$ in the gold proof, we generate a distractor rule $\forall x ( f ( x ) h ( x ) )$ where the concept $h$ is a distractor and is not helpful in completing the proof. In addition, for any ground logical form in the gold proof $f ( c )$ , we generate a distractor logical form $h ( c )$ as well as a rule $\forall \bar { x ( h ( x ) h ^ { \prime } ( x ) ) }$ . Note that the original PRONTOQA only adds a single distractor, whereas we add multiple, one for each hop in the proof.
|
| 420 |
+
|
| 421 |
+
Conjunction introduction Similar to those in implication elimination. For any rule $\forall x ( f _ { 1 } ( x ) \wedge \ldots \wedge$ ${ \dot { f _ { n } } } ( x ) g ( x ) )$ , we generate a rule of the form $\forall x ( h _ { 1 } ( x ) \land \dotsc \land h _ { n - 1 } ( x ) \land f _ { n } ( x ) g ( x ) )$ where $h _ { i }$ are distractor concepts. Grounded distractor conjuncts are also generated as axioms $\dot { h _ { i } } ( c )$ , so that, given $f _ { n } ( c )$ , both the gold rule and distractor rule are valid proof steps.
|
| 422 |
+
|
| 423 |
+
Conjunction elimination Distractors are generated similarly to the conjunction introduction case.
|
| 424 |
+
|
| 425 |
+
Disjunction introduction Distractors are generated similarly to the conjunction introduction case.
|
| 426 |
+
|
| 427 |
+
Disjunction elimination Since this deduction step has many premises, multiple distractors are necessary to ensure the model doesn’t resort to heuristics. For every rule of the form $\forall x ( f _ { i } ( x ) g ( x ) )$ , two distractor rules are generated: $\forall x ( f _ { i } ( x ) h ^ { \prime } ( x ) )$ and $\forall x ( h _ { i } ( x ) \ \ g ( x ) )$ . A distractor disjunction is also generated: $h ^ { \prime \prime } ( c ) \vee h _ { 1 } ( c ) \vee \ldots \vee h _ { n - 1 } ( c )$ .
|
| 428 |
+
|
| 429 |
+
Proof by contradiction As with disjunction elimination, multiple distractors are necessary here. We generate two distractor rules $\forall x ( { \bar { f _ { 1 } } } ( x ) \lor . . . \lor f _ { n } ( x ) \to h ( x ) )$ and $\forall x ( h _ { 1 } ( x ) \lor . . . \lor h _ { n } ( x ) g ( x ) )$ . We also generate the distractor axiom $\neg h ^ { \prime } ( c )$ so that the model is forced to choose between two axioms for the first step of the proof.
|
| 430 |
+
|
| 431 |
+
To avoid creating inconsistencies when generating a distractor rule, we avoid using existing predicates in the consequent of each rule.
|
| 432 |
+
|
| 433 |
+
Algorithm 2: Pseudocode for evaluating the output chain-of-thought. Here, the comparison operations between logical forms ignore the order of conjuncts if both operands are conjunctions; and similarly for disjunctions. In addition, when iterating over previous steps in the proof, we consider them in reverse order, so that more recent steps are prioritized. The helper function negate is defined, in order of precedence: negate $( \neg A ) = A$ , negate $( A \lor B ) =$ negate(A) $\wedge$ negate $( B )$ , negate $ [ A \land B ) = { \mathsf { n e g a t e } } ( A ) \lor$ negate $( B )$ , or negat $\mathfrak { s } ( A ) = \neg A$ .
|
| 434 |
+
|
| 435 |
+
1 function evaluate_cot(context sentences $Q _ { 1 } , \ldots , Q _ { m }$ ,
|
| 436 |
+
predicted chain-of-thought sentences $C _ { 1 } , \ldots , C _ { n }$ ,
|
| 437 |
+
goal sentence $g$ )
|
| 438 |
+
2 $L ^ { g } =$ semantic_parse $( g )$ $^ { \prime * }$ parse the goal $^ { * / }$
|
| 439 |
+
3 for $i \in { 1 , \dots , m }$ do $^ { \prime * }$ parse the context $^ { * / }$
|
| 440 |
+
4 $L _ { i } ^ { Q } =$ semantic_parse( $( Q _ { i } )$
|
| 441 |
+
5 for $i \in { 1 , \dots , m }$ do $^ { \prime * }$ parse the predicted chain-of-thought $^ { * / }$
|
| 442 |
+
6 L $L _ { i } ^ { C } =$ semantic_parse(Ci)
|
| 443 |
+
initialize $S$ as an empty set, and $H$ as an empty map
|
| 444 |
+
8 for $i \in { 1 , \dots , n }$ do $^ { \prime * }$ reconstruct the proof from the chain-of-thought \*/
|
| 445 |
+
9 if $L _ { i } ^ { C }$ indicates ‘this is a contradiction’
|
| 446 |
+
10 if negate $( L _ { i + 1 } ^ { C } ) \in H ( L _ { i - 1 } ^ { C } )$
|
| 447 |
+
11 $\begin{array} { r l } { \Bigl | } & { { } \bigl ( \boldsymbol { \tilde { P } } , \boldsymbol { \tilde { D } } , \boldsymbol { k } \bigr ) \stackrel { \cdot \cdot \cdot } { = } \bigl ( \bigl \{ \boldsymbol { L } _ { i - 1 } ^ { \overline { { C } } } , \mathrm { n e g a t e } ( \boldsymbol { L } _ { i + 1 } ^ { C } ) \bigr \} , \bigl \{ \mathrm { n e g a t e } ( \boldsymbol { L } _ { i + 1 } ^ { C } ) \bigr \} , 1 \bigr ) } \end{array}$
|
| 448 |
+
12 else continue
|
| 449 |
+
13 else
|
| 450 |
+
14 $\begin{array} { r l } & { \bigcup _ { \mathbf { \alpha } } ( P , D , k ) = \operatorname { i s } _ { \mathbf { \alpha } \mathbf { - } \mathbf { p r o v a b l e } ( L _ { i } ^ { C } , \{ L _ { 1 } ^ { Q } , \dots , L _ { m } ^ { Q } \} , S , H ) } } \\ & { \operatorname { s e t } H ( L _ { i } ^ { C } ) = \bigcup _ { p \in P } H ( p ) \setminus D } \end{array}$
|
| 451 |
+
15
|
| 452 |
+
16 if k ≥ 0
|
| 453 |
+
17 add $L _ { i } ^ { C }$ to $S$
|
| 454 |
+
18 return $L ^ { g } \in S$ $^ { \prime * }$ the proof is correct if the final conclusion is provable \*/
|
| 455 |
+
|
| 456 |
+
19 function is_provable(logical form $\varphi$ , set of axioms $A$ , previous conclusions $S$ , hypothesis map $H$ )
|
| 457 |
+
|
| 458 |
+
20 if $\varphi \in A$
|
| 459 |
+
21 return $( \{ \varphi \} , 1 )$ /\* this is an axiom \*/
|
| 460 |
+
22 else if $\varphi$ is a conjunction or disjunction
|
| 461 |
+
23 initialize $P ^ { \prime }$ as an empty list, and $k ^ { \prime } = 0$
|
| 462 |
+
24 for $\varphi _ { i }$ operand in $\varphi$ do
|
| 463 |
+
25 $\begin{array}{c} \begin{array} { r l } { | } & { { } \left( \begin{array} { l } { | } \end{array} \right. } \end{array} ( P , k ) = \mathbf { i s } _ { - } \mathbf { p r o v a b l e } ( \varphi _ { i } , A , S , H ) \end{array}$
|
| 464 |
+
26 if $\varphi$ is a conjunction
|
| 465 |
+
27 if $k \geq 0$ and the step immediately preceding $\varphi$ in the proof is in $P$
|
| 466 |
+
28 append P to P ′
|
| 467 |
+
29 set $\boldsymbol { k } ^ { \prime } = \boldsymbol { k } ^ { \prime } + \boldsymbol { k }$
|
| 468 |
+
30 else break
|
| 469 |
+
31 else if $k > 0$ and $\varphi$ is a disjunction
|
| 470 |
+
32 $\Big \lfloor \Big \lfloor \mathbf { r e t u r n } \left( P , \mathcal { D } , k + 1 \right)$ $^ { \prime * }$ provable by disjunction introduction \*/
|
| 471 |
+
33 if $P ^ { \prime }$ has the same size as $\varphi$ has operands
|
| 472 |
+
34 $\lfloor \mathrm { \ r e t u r n } \left( \bigcup P ^ { \prime } , \emptyset , k ^ { \prime } \right)$ $^ { \prime * }$ provable by conjunction introduction $^ { * / }$
|
| 473 |
+
35 for $a \in S \cup A$ do
|
| 474 |
+
36 if $a$ is a conjunction and $\varphi = a _ { i }$ for some $i$
|
| 475 |
+
37 return $( \{ a \} , \emptyset , 1 + \mathbb { 1 } \{ a \in A \} )$ $^ { \prime * }$ provable by conjunction elimination \*/
|
| 476 |
+
38 else if $a$ has form $\forall x ( \psi \gamma )$ where $\gamma [ x \mapsto c ] = \varphi$
|
| 477 |
+
39 $| \mathbf { \Gamma } ( P , k ) = \operatorname { i s _ { - } p r o v a b l e } ( \psi [ x \mapsto c ] , A , S , H )$
|
| 478 |
+
40 if $k \geq 0$ and the step immediately preceding $\varphi$ in the proof is in $P \cup \{ a \}$
|
| 479 |
+
41 return $( P \cup \{ a \} , \emptyset , k + \mathbb { 1 } \{ a \in A \} )$ $^ { \prime * }$ provable by conjunction elimination \*/
|
| 480 |
+
42 for $s \in S$ where s is a disjunction do
|
| 481 |
+
43 if for all disjuncts $s _ { i }$ , there is a $s _ { j } \in S$ such that $s _ { j } = \varphi$ and $s _ { i } \in H ( s _ { j } )$
|
| 482 |
+
44 return $( \{ s _ { j } \} , \{ s _ { i } \} , 1 )$ $^ { \prime * }$ provable by disjunction elimination \*/
|
| 483 |
+
|
| 484 |
+

|
| 485 |
+
Algorithm 2: (continued from previous page)
|
md/dev/MG3YN3z1J4M/MG3YN3z1J4M.md
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Unveiling The Mask of Position-Information Pattern Through the Mist of Image Features
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 Recent studies show that paddings in convolutional neural networks encode ab
|
| 11 |
+
2 solute position information which can negatively affect the model performance
|
| 12 |
+
3 for certain tasks. However, existing metrics for quantifying the strength of po
|
| 13 |
+
4 sitional information remain unreliable and frequently lead to erroneous results.
|
| 14 |
+
5 To address this issue, we propose novel metrics for measuring (and visualizing)
|
| 15 |
+
6 the encoded positional information. We formally define the encoded information
|
| 16 |
+
7 as PPP (Position-information Pattern from Padding) and conduct a series of ex
|
| 17 |
+
8 periments to study its properties as well as its formation. The proposed metrics
|
| 18 |
+
9 measure the presence of positional information more reliably than the existing
|
| 19 |
+
10 metrics based on PosENet and a test in F-Conv. We also demonstrate that for any
|
| 20 |
+
11 extant (and proposed) padding schemes, PPP is primarily a learning artifact and is
|
| 21 |
+
12 less dependent on the characteristics of the underlying padding schemes.
|
| 22 |
+
|
| 23 |
+
# 13 1 Introduction
|
| 24 |
+
|
| 25 |
+
14 Padding, one of the most fundamental components in neural network architectures, has received
|
| 26 |
+
15 much less attention than other modules. Zero padding is frequently used in CNNs, perhaps due to its
|
| 27 |
+
16 simplicity and low computational costs. This design preference remains almost unchanged in the past
|
| 28 |
+
17 decade. Recent studies [1, 2, 3, 4] show that padding can implicitly provide a network model with
|
| 29 |
+
18 positional information. Such positional information can cause unwanted side-effects by interfering
|
| 30 |
+
19 and affecting other sources of position-sensitive cues (e.g., explicit coordinate inputs [5, 6, 7, 8, 9],
|
| 31 |
+
20 embeddings [10], or boundary conditions of the model [4, 11, 12]). Furthermore, padding may lead
|
| 32 |
+
21 to several unintended behaviors [5, 7, 8, 9], degrade model performance [10, 11, 12], or sometimes
|
| 33 |
+
22 create blind spots [6]. Meanwhile, simply ignoring the padding pixels (known as no-padding or
|
| 34 |
+
23 valid-padding) leads to the foveal effect [13, 14] that causes a model to become less attentive to
|
| 35 |
+
24 the features on the image border. These observations motivate us to thoroughly investigate the
|
| 36 |
+
25 phenomenon of positional encoding including the impact of commonly used padding schemes.
|
| 37 |
+
|
| 38 |
+
Conducting such a study requires a reliable metric to detect the presence of positional information introduced by padding, and more importantly, quantify its strength consistently. We observe that the existing methods for detecting and quantifying the strength of positional information yield inconsistent results. In Section 3, we revisit two closely related evaluation methods, PosENet [1] and F-Conv [3]. Our extensive experiments demonstrate that (a) metrics based on PosENet are unreliable with an unacceptably high variance, and (b) the ‘Border Handling Variants’ (BHV) test in F-Conv suffers from unaware confounding variables in its design, leading to unreliable test results.
|
| 39 |
+
|
| 40 |
+

|
| 41 |
+
Figure 1: Position-information Pattern from Padding (PPP). We propose a method that can consistently and effectively extract PPPs through the distributional difference between optimallypadded (gray-scale surfaces) and algorithmically-padded features (colored surfaces). The results show that the two distributions become distinguishable as the number of sample increases. Following the procedure in Section 2.2, we extract a clear view of PPP with the expectation of the pairwise differences between optimally-padded and algorithmically-padded features. We render each visualization in tilted view (first row) and top view (second row). The colors represent the magnitude (blue/cold/weak to green/warm/strong) at each pixel. The features are extracted at the 3rd layer of interest (Appendix A) from a randn-padded (Section 2.4) ResNet50 pretrained on ImageNet.
|
| 42 |
+
|
| 43 |
+
33 In addition, we observe all commonly-used padding schemes actually encode consistent patterns
|
| 44 |
+
34 underneath the highly dynamic model features. However, such a pattern is rather obscure, noisy,
|
| 45 |
+
35 and visually imperceptible1 in most cases. Fortunately, we show that such patterns can be consis
|
| 46 |
+
36 tently revealed with a sufficient number of samples by defining an optimal padding scheme (see
|
| 47 |
+
37 Section 2.1 and Figure 1). We accordingly propose a new evaluation paradigm and develop a method
|
| 48 |
+
38 to consistently detect the presence of the Position-information Pattern from Padding (PPP), which
|
| 49 |
+
39 is a persistent pattern embedded in the model features to retain positional information. We present
|
| 50 |
+
40 two metrics to measure the response of PPP from the signal-to-noise perspective and demonstrate its
|
| 51 |
+
41 robustness and low deviation among different settings, each with multiple trials of training.
|
| 52 |
+
42 To weaken the effect of PPP, we design a padding scheme with built-in stochasticity to halt the
|
| 53 |
+
43 model from constructing consistent patterns in Section 2.4. However, our experiments show that the
|
| 54 |
+
44 models can still circumvent the stochasticity and end up consistently constructing certain PPPs. This
|
| 55 |
+
45 observation suggests that a model likely constructs PPPs purposely to facilitate its training, rather
|
| 56 |
+
46 than falsely or accidentally learning some filters that respond to padding features.
|
| 57 |
+
47 With reliable PPP metrics, we conduct a series of experiments to analyze the characteristics of PPP in
|
| 58 |
+
48 Section 4.1. Specifically, we monitor the formation of PPP throughout each model training process in
|
| 59 |
+
49 Section 4.3. The results show PPPs are formed expeditiously at the early stage of model training,
|
| 60 |
+
50 slowly but steadily strengthened through time, and eventually shaped in clear and complete patterns.
|
| 61 |
+
51 These results show that a model intentionally develops and reinforces PPPs to facilitate its learning
|
| 62 |
+
52 process. Moreover, we observe the PPPs of all pretrained networks are significantly stronger than
|
| 63 |
+
53 those in their initial states. This indicates an unbiased training procedure is of great importance in
|
| 64 |
+
54 resolving the critical failures caused by PPP in numerous vision tasks [6, 7, 10, 11].
|
| 65 |
+
|
| 66 |
+
# 2 Observations and Methodology
|
| 67 |
+
|
| 68 |
+
In this section, we first define symbols for expressing the functionality of paddings and define the optimal-padding scheme. We then give a formal definition of Position-information Pattern from
|
| 69 |
+
|
| 70 |
+

|
| 71 |
+
Figure 2: Principal point shift. (a) The stride-2 Conv2d only pads on one side, causing the principal point shift (red squares) in earlier layers. (b) Such a shift requires careful margin correction while aligning algorithmically-padded and optimally-padded features (we describe the details of point shift in Appendix A). (c) The shift is visible in the feature space (spade-shaped and question-mark-shaped patterns in the marked box). (d) It is crucial to correct the principal point shift while measuring PPP. The PPP calculation involves pixel-wise distance functions, which are not robust to spatial shifts [15].
|
| 72 |
+
|
| 73 |
+
58 Padding (PPP) and utilize the optimal-padding scheme to develop propose a method to capture PPP
|
| 74 |
+
59 and measure its response with two metrics.
|
| 75 |
+
|
| 76 |
+
# 2.1 Optimal Padding
|
| 77 |
+
|
| 78 |
+
61 The process of capturing an image from the real world can be simplified as the 3D information of
|
| 79 |
+
62 the environment is first projected onto an infinitely large 2D plane, and then the camera determines
|
| 80 |
+
63 resolution as well as field-of-view to form an image from such infinitely large and continuous 2D
|
| 81 |
+
64 65 signals [16, 17]. Letand the collection o $S ^ { * } = \{ s _ { n } ^ { * } \} _ { n = 1 } ^ { N }$ be a collection of such infinitely largptured by cameras at a spatial size $( h _ { n } , w _ { n } )$ tinbe $S ^ { \prime } = \{ s _ { n } ^ { \prime } \} _ { n = 1 } ^ { N }$
|
| 82 |
+
66 A padding scheme produces a set of algorithmically-padded images $\hat { S } = \{ \hat { s } _ { n } \} _ { n = 1 } ^ { N }$ by a padding
|
| 83 |
+
67 function $\rho$ :
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
\hat { s } _ { n } [ i , j ] = \left\{ { \begin{array} { l l } { s _ { n } ^ { \prime } [ i , j ] = s ^ { * } [ i , j ] } & { { \mathrm { i f ~ } } 0 < i < h _ { n } { \mathrm { ~ a n d ~ } } 0 < j < w _ { n } , } \\ { \rho ( s _ { n } ^ { \prime } , i , j ) } & { { \mathrm { o t h e r w i s e } } , } \end{array} } \right.
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
68 where $i$ and $j$ are index of a pixel in the spatial dimension. We define a theoretical optimally-padded collection 69 ${ \cal { S } } ^ { \dagger } = \{ s _ { n } ^ { \dagger } \} _ { n = 1 } ^ { N }$ with an optimal-padding function $\rho ^ { \dagger }$ by:
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
\begin{array} { r } { s _ { n } ^ { \dagger } [ i , j ] = \left\{ { s _ { n } ^ { \prime } [ i , j ] } \atop { \rho ^ { \dagger } ( s _ { n } ^ { \prime } , i , j ) } \right. \ } & { = s ^ { * } [ i , j ] \quad \mathrm { i f ~ } 0 < i < h _ { n } \mathrm { ~ a n d ~ } 0 < j < w _ { n } , } \\ { s ^ { \dagger } _ { n } [ i , j ] = \left\{ { s _ { n } ^ { \prime } [ i , j ] } \atop { \rho ^ { \dagger } ( s _ { n } ^ { \prime } , i , j ) } \right. \ } & { = s ^ { * } [ i , j ] \quad \mathrm { o t h e r w i s e } . } \end{array}
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
70 In practice, such an optimal-padding scheme is difficult to achieve. However, it can be simulated if we have access to images beyond the sizes 71 $( h _ { n } , w _ { n } )$ and artificially create $S ^ { \prime }$ .
|
| 96 |
+
|
| 97 |
+
# 2.2 Positional-information Pattern from Padding
|
| 98 |
+
|
| 99 |
+
73 As PPP has not been well defined in the literature, there is no effective metric to detect or quantify it.
|
| 100 |
+
74 Ideally, PPP should have two properties. First, it is a spatial pattern as the padding pixels at different
|
| 101 |
+
75 locations contribute differently to the formation of PPP. Its shape enables the network to develop and
|
| 102 |
+
76 exploit the absolute positional information of each pixel, eventually leading to the unattended and
|
| 103 |
+
77 undesirable effects in certain tasks [5, 6, 7, 8, 9, 10, 11].
|
| 104 |
+
78 Second, as it represents the positional information purely contributed by the padding, it is a constant
|
| 105 |
+
79 term irrelevant to the image contents. Unfortunately, PPP shares space with image features, and
|
| 106 |
+
80 these two spaces interfere with each other, causing the appearance of PPP extremely obscure in most
|
| 107 |
+
81 cases (except zeros padding). Figure 1 shows if we visualize features sample-by-sample, there are
|
| 108 |
+
82 no obvious differences between optimally-padded features (gray-scale surface) and algorithmically
|
| 109 |
+
83 padded features (colored surface). Fortunately, if we assume the interferences between PPP and
|
| 110 |
+
84 image features to be random, then its expectation over a large set of images will saturate to a constant
|
| 111 |
+
85 bias and no longer hinder us from capturing PPP.
|
| 112 |
+
86 Based on these observations, we define PPP as the constant component independent of model inputs,
|
| 113 |
+
87 and its presence is completely contributed by the existence of a padding scheme $\rho$ . Given $\hat { S }$ and a
|
| 114 |
+
88 model $F ( \hat { s } ; \theta , \rho )$ , which $\theta$ is the model parameters and $\rho$ is a padding scheme applied to $F$ . Let the
|
| 115 |
+
89 model feature extracted at $k$ -th layer be $f _ { n , k } = F _ { k } ( \hat { s } _ { n } ; \theta , \rho )$ , where $F _ { k }$ is the model from the first
|
| 116 |
+
90 layer to the $k$ -th layer. The PPP at $k$ -th layer $( P P P _ { k } )$ can be formulated by:
|
| 117 |
+
|
| 118 |
+
$$
|
| 119 |
+
\begin{array} { r } { \mathsf { P P P } _ { k } \ = \ \underset { n } { \mathbb { E } } \left[ \textit { d } \big ( \begin{array} { l } { F _ { k } ( s _ { n } ^ { \dagger } ; \theta , \rho ^ { \dagger } ) , F _ { k } ( \hat { s } _ { n } ; \theta , \rho ) } \end{array} \big ) \ \right] \ , } \end{array}
|
| 120 |
+
$$
|
| 121 |
+
|
| 122 |
+
91 where $d ( \cdot , \cdot )$ can be any distance function, and we use $\ell _ { 1 }$ distance in this work.
|
| 123 |
+
|
| 124 |
+
Pitfalls: feature misalignment. It is important to note that, some CNN components can cause serious feature misalignment while computing PPP and leads to erroneous results. A typical example is principal point shift, where the uneven padding in stride-2 convolution causes the centers of features slightly drifted, as shown in Figure 2. Since the measurement of PPP requires perfect alignment, such a drift should be carefully considered while integrating PPP into new architectures. We further discuss the issue along with other pitfalls in Appendix A and provide three detailed examples of correcting the principal point shifting.
|
| 125 |
+
|
| 126 |
+
# 2.3 Metrics
|
| 127 |
+
|
| 128 |
+
In order to measure the strength of PPP, a proper baseline signal is needed. As discussed above, a strong PPP should be distinguishable from the interferences of the model features, so that the model can successfully extract the positional information from PPP. Thus, if we consider the model features as a background noise signal and PPP as the signal of interest, we can measure the significance of PPP using the signal-to-noise ratio (SNR). We define the SNR for PPP at $k$ -th layer as:
|
| 129 |
+
|
| 130 |
+
$$
|
| 131 |
+
\begin{array} { r } { \mathrm { S N R } \mathrm { - P P P } _ { k } \ = \ \mu \left( \underset { n } { \mathbb { E } } \left[ \begin{array} { l } { | } \end{array} \middle | F _ { k } \big ( s _ { n } ^ { \dagger } ; \theta , \rho ^ { \dagger } \big ) \ - \ F _ { k } \big ( \hat { s } _ { n } ; \theta , \rho \big ) \ B _ { 1 } \ \right] \ \right) \ / \ \sigma \big ( \ F _ { k } \big ( \hat { s } _ { n } ; \theta , \rho \big ) \ \big ) , } \end{array}
|
| 132 |
+
$$
|
| 133 |
+
|
| 134 |
+
where $\mu$ and $\sigma$ are the mean and standard deviation on the spatial dimensions.
|
| 135 |
+
|
| 136 |
+
106 However, SNR only measures the significance of the signal versus the noise but ignores the location
|
| 137 |
+
107 of the signal. Given PPP is a spatially varying pattern, we further include Mean Absolute Error
|
| 138 |
+
108 (MAE) to measure PPP versus the average of the noise map with:
|
| 139 |
+
|
| 140 |
+
$$
|
| 141 |
+
\begin{array} { r } { \mathbf { M A E - P P P } _ { k } \ = \ \underset { n } { \mathbb { E } } \left[ \ \mathbf { M A E } \left( \ F _ { k } ( s _ { n } ^ { \dagger } ; \theta , \rho ^ { \dagger } ) \ , \ F _ { k } ( \hat { s } _ { n } ; \theta , \rho ) \ \right) \ \right] \ . } \end{array}
|
| 142 |
+
$$
|
| 143 |
+
|
| 144 |
+
# 2.4 Randn Padding
|
| 145 |
+
|
| 146 |
+
10 Most of the existing padding schemes (e.g., zeros, reflect, replicate, circular) exhibit certain consistent
|
| 147 |
+
11 patterns that can be easily detected by some designed convolutional kernels. One may argue that the
|
| 148 |
+
12 nature of easy detectability can be a root cause of encouraging the models to learn to rely on these
|
| 149 |
+
113 obvious patterns. This motivates us to design an additional sampling-based padding scheme without
|
| 150 |
+
114 any consistent patterns, namely randn (i.e., random normal) padding, which produces dynamical
|
| 151 |
+
15 values from a normal distribution while following the local statistics. We first determine the maximal
|
| 152 |
+
116 and minimal values of a sliding window (which can be easily achieved with max-pooling), use the
|
| 153 |
+
17 average of them as a proxy mean $\mu _ { p }$ , and use the difference between the mean and the maximal
|
| 154 |
+
118 value as a proxy standard deviation $\sigma _ { p }$ . For each padding location, we sample the padding value
|
| 155 |
+
119 according to a normal distribution $\mathcal { N } ( \mu _ { p } , \sigma _ { p } ^ { 2 } )$ from the nearest sliding window. We include more
|
| 156 |
+
120 implementation details in Appendix A.
|
| 157 |
+
121 Aside from creating a pattern-less padding scheme with sampling, the design of randn padding is
|
| 158 |
+
122 based on several factors. The sampled padding pixels are allowed to occasionally exceed the min/max
|
| 159 |
+
123 bound of the sliding window. Without breaking the min/max bound can introduce detectable patterns
|
| 160 |
+
124 in certain extreme cases, such as a gradient-like feature that has its maximal intensity at the top-left
|
| 161 |
+
125 corner and minimal intensity at the bottom-right corner. We also design the padding scheme to
|
| 162 |
+
126 follow the local distribution. The padding exhibits a high entropy when the local variation is high,
|
| 163 |
+
127 while degenerates to value repetition with imperceptible perturbations while padding a flat area. As
|
| 164 |
+
|
| 165 |
+
such, not only do the padding pixels exhibit less pattern, but it also prevents the padding pixels from breaking the features in the border region. We later show that a model still deliberately and incredibly built up PPP over time even with such a sophisticated padding scheme.
|
| 166 |
+
|
| 167 |
+
# 3 Revisiting Prior Work
|
| 168 |
+
|
| 169 |
+
In this section, we first reproduce two experiments from the prior art, which aim to assess positional information from paddings. We show several critical design issues in these experiments and discuss how these problems affect the drawn conclusions. Finally, we propose two additional experiments to quantify the amount of positional information embedded in the paddings.
|
| 170 |
+
|
| 171 |
+
# 3.1 PosENet
|
| 172 |
+
|
| 173 |
+
Islam et al. show zeros-padding provides CNN models positional information cues, and propose PosENet [1] to quantify the amount of positional information encoded within CNN features. A PosENet experiment involves several components: a pretrained CNN model $F$ , a shallow CNN $E _ { p e m }$ (i.e., position encoding module), an image dataset $X = \{ x _ { i } \} _ { i = 1 } ^ { N }$ to examine, and a constant target pattern $y$ (e.g., 2D Gaussian pattern). PosENet first extracts intermediate features at $k$ - th layer with $f _ { ( i , k ) } = F _ { k } ( x _ { i } )$ using the pretrained CNN, and then optimizes $E _ { p e m }$ to minimize $\mathbb { E } _ { i , k } \big [ | | E _ { p e m } ( f _ { ( i , k ) } ) - y | | _ { 2 } \big ]$ . Finally, the amount of positional information is quantified by the average Spearman’s correlation (SPC) and Mean Absolute Error (MAE) overall $E _ { p e m } ( f _ { ( i , k ) } )$ toward $y$ .
|
| 174 |
+
|
| 175 |
+
145 A critical issue with PosENet is the use of an optimization-based metric. It is sensitive to hyper
|
| 176 |
+
146 parameters with large variation. As shown in Table 2, for all the PosENet results, the standard
|
| 177 |
+
147 deviation over five trials significantly dominates the differences between different types of paddings,
|
| 178 |
+
148 and thus no definitive conclusions can be drawn. We also observed that PosENet can report NaN
|
| 179 |
+
149 results in certain setups. Furthermore, PosENet quantifies the amount of positional information by
|
| 180 |
+
150 the faithfulness of the final reconstruction. However, a better reconstruction does not have a clear
|
| 181 |
+
151 relationship to measuring the strength and significance of positional information. For instance, the
|
| 182 |
+
152 VGG architecture with zeros-padding in Table 2, PosENet cannot recognize the positional information
|
| 183 |
+
153 has been strengthened after training, which can be seen in Figure 4. PosENet falsely assigns a much
|
| 184 |
+
154 lower SPC to the fully pretrained model. Moreover, for the no-padding entries in Table 2, PosENet
|
| 185 |
+
155 can still sometimes show responses to no-padding models, demonstrating it is a metric with an
|
| 186 |
+
156 indefinite bias pending on the memorization ability of $E _ { p e m }$ .
|
| 187 |
+
|
| 188 |
+
Another issue is that the no-padding scheme used in $E _ { p e m }$ is known to have the foveal effect [13, 14], where a model pays less attention to the information on the edge of inputs. Using such a padding scheme for detecting positional information from paddings, which is mostly concentrated on the edge of the feature maps, is less effective. This is an inevitable dilemma as PosENet aims to identify positional information from the padding of the pretrained $F$ , while applying any padding scheme to $E _ { p e m }$ introduces intractable effects between the paddings of the two models.
|
| 189 |
+
|
| 190 |
+
# 3.2 F-Conv
|
| 191 |
+
|
| 192 |
+
64 Kayhan et al. propose a full-padding scheme (F-Conv) [3] and demonstrate it is more translational
|
| 193 |
+
65 invariant than the alternatives. One of the critical results is on “border handling variants” (Exp 2
|
| 194 |
+
66 of [3]), which we call it BHV test. The BHV test creates a toy dataset, where each image has a black
|
| 195 |
+
67 background with a green square and a red square in the foreground. The task is to predict if the red
|
| 196 |
+
68 square is on the left of the green square (class 1), or vice versa (class 2). In addition, Kayhan et al.
|
| 197 |
+
69 intentionally adds a location bias such that both squares are located in the upper half of the image for
|
| 198 |
+
70 class 1, and located in the lower half of the image for class 2. During testing, a “similar test” inherits
|
| 199 |
+
71 the same bias, while a “dissimilar test” exchanges the bias (i.e., both squares are in the lower half
|
| 200 |
+
72 of the image for class 1). As a truly translation-invariant CNN model should not be affected by the
|
| 201 |
+
73 location bias, it should focus on the relation between the red and green squares and perform similarly
|
| 202 |
+
74 on both tests. Since the experimental results show that F-Conv performs best on the dissimilar test, it
|
| 203 |
+
75 is concluded that F-Conv is less sensitive to the location bias. The authors also conclude the circular
|
| 204 |
+
76 padding performs worse due to the behavior of wrapping the pixels to the other side of the image,
|
| 205 |
+
77 which leads to confusion between two classes.
|
| 206 |
+
178 However, as shown in Figure 3, we find the experimental design
|
| 207 |
+
179 does not consider a crucial confounding variable: the black back
|
| 208 |
+
180 ground has a zero intensity, making zeros padding the optimal
|
| 209 |
+
181 padding that perfectly follows the background distribution. In Ta
|
| 210 |
+
182 ble 1, we show that the dissimilar test is no longer in favor of
|
| 211 |
+
183 F-Conv zeros after changing the background color to grey. We also
|
| 212 |
+
184 show that F-Conv replicate and F-Conv circular perform best on
|
| 213 |
+
185 the dissimilar test, which is different from the original observation.
|
| 214 |
+
|
| 215 |
+
Table 1: Background color as a critical confounding variable in BHV test. We show that using a grey background similar to Figure 3 leads to discrepant results. The standard deviations are reported among 10 individual trials. We mark the best performance in green, and the worst two in red.
|
| 216 |
+
|
| 217 |
+
<table><tr><td rowspan="2">Padding</td><td rowspan="2">F-Conv?</td><td colspan="4">Black Background</td><td colspan="4">Grey Background</td></tr><tr><td>Similar (%)</td><td>Dissimilar (%)</td><td>Diff (%)</td><td>Inconsistency (%)</td><td>Similar (%)</td><td>Dissimilar (%)</td><td>Diff (%)</td><td>Inconsistency (%)</td></tr><tr><td rowspan="2">Zeros</td><td>N</td><td>99.83±0.00</td><td>3.21± 8.35</td><td>-87.68</td><td>95.81± 2.07</td><td>100.00± 0.00</td><td>4.96± 5.93</td><td>-95.04</td><td>97.85± 4.55</td></tr><tr><td>Y</td><td>89.24±0.98</td><td>89.24±0.98</td><td>0.00</td><td>18.02± 8.08</td><td>100.00±0.00</td><td>4.77± 6.52</td><td>95.23</td><td>96.79±7.13</td></tr><tr><td rowspan="2">Circular</td><td>N</td><td>80.31±3.23</td><td>80.31± 3.23</td><td>0.00</td><td>34.25± 8.32</td><td>72.75± 0.96</td><td>72.75± 0.96</td><td>0.00</td><td>26.30± 5.55</td></tr><tr><td>Y</td><td>99.20±0.23</td><td>93.14± 2.88</td><td>-6.06</td><td>18.48±3.55</td><td>98.26± 0.50</td><td>92.40±4.23</td><td>-5.87</td><td>28.67± 6.18</td></tr><tr><td rowspan="2">Reflect</td><td>N</td><td>100.00±0.00</td><td>15.67±12.72</td><td>-84.33</td><td>91.18±13.19</td><td>100.00±0.00</td><td>19.96±13.54</td><td>-80.04</td><td>90.33±11.95</td></tr><tr><td>Y</td><td>100.00±0.00</td><td>11.70±15.38</td><td>-88.30</td><td>97.33± 6.16</td><td>100.00±0.00</td><td>17.16±12.19</td><td>-82.84</td><td>98.13± 3.44</td></tr><tr><td rowspan="2">Replicate</td><td>N</td><td>100.00±0.00</td><td>43.39±11.42</td><td>-56.61</td><td>75.32± 8.20</td><td>100.00± 0.00</td><td>33.16± 6.42</td><td>-66.83</td><td>84.09± 6.47</td></tr><tr><td>Y</td><td>98.32±0.39</td><td>93.65± 1.36</td><td>-4.67</td><td>32.60± 4.97</td><td>97.17± 0.48</td><td>94.99± 1.20</td><td>-2.18</td><td>32.15± 5.11</td></tr><tr><td rowspan="2">Randn</td><td>N</td><td>100.00±0.00</td><td>10.31±12.56</td><td>-89.70</td><td>94.88± 5.55</td><td>99.97± 0.13</td><td>35.47±10.82</td><td>-64.50</td><td>83.59± 8.48</td></tr><tr><td>Y</td><td>100.00±0.00</td><td>20.80±14.15</td><td>-79.20</td><td>92.54±8.37</td><td>77.28±16.13</td><td>66.70±11.58</td><td>-10.59</td><td>45.70±20.62</td></tr><tr><td>No-pad</td><td>-</td><td>100.00±0.00</td><td>3.21± 8.35</td><td>-96.79</td><td>95.81± 2.07</td><td>100.00± 0.00</td><td>30.07± 4.06</td><td>-69.93</td><td>81.30± 2.44</td></tr></table>
|
| 218 |
+
|
| 219 |
+
Finally, we report an additional inconsistency rate to show that the CNN architecture used in the BHV test actually has access to the absolute position of the squares. Given a random sample in class 1, we create a trajectory of samples by simultaneously moving the two squares to the bottom of the canvas and recording the CNNmodel prediction in all intermediate states. We label a trajectory to be inconsistent if the prediction of the CNN-model switches classes at any step of the trajectory. A CNN model with no access to the absolute-position information should have all trajectories maintaining consistent predictions, with $0 \%$ inconsistency. Table 1 shows the inconsistent ratio over 228 uniformly sampled trajectories, where all models maintain high inconsistency rates, even with a no-padding architecture. These results show that the CNN model used in the BHV test is not translation invariant. This can be attributed to that a CNN model has a large receptive field covering the whole experiment canvas, therefore capable of gradually constructing absolute coordinates for each input pixel. Note that we only show the design of the BHV test is not suitable for quantifying the amount of positional information exhibited in a CNN model. Such a conclusion does not imply that F-Conv cannot potentially improve the translation-invariant property of CNNs.
|
| 220 |
+
|
| 221 |
+

|
| 222 |
+
Figure 3: The BHV test trains a binary classifier to predict the relative position of the two colored squares. It hypothesizes if the padding provides no positional information, the classifier will only focus on the relative position of the two squares. (Left) The black background is a confounding variable. (Right) Zeros padding no-longer pads optimum values after changing the background color.
|
| 223 |
+
|
| 224 |
+
# 4 Experiments and Analysis
|
| 225 |
+
|
| 226 |
+
Datasets Since most vision models are trained on tasks for recognizing objects, an image collection containing a diverse object appearance is more suitable for the task. We collect a set of 480 satellite images at $2 , 0 4 8 \times 2 , 0 4 8$ pixels from Google Map for experiments. All the PPP metrics are measured with this image collection. We crop such images depending on the requested input image sizes and principal point shifts from each model (see Appendix A for details). We will release the script for collecting and composing these large images.
|
| 227 |
+
|
| 228 |
+
# 4.1 Visualizing Position-information Pattern from Padding (PPP)
|
| 229 |
+
|
| 230 |
+
212 We start with visualizing PPP in Figure 4. All the visualizations are conducted at the 4th layer of
|
| 231 |
+
213 interest as detailed in Appendix A. We compute PPP using Eq. 3 and $\ell _ { 1 }$ norm as the distance metric,
|
| 232 |
+
214 then average the resulting PPP in the channel dimension to generate a gray-scale image. Since the
|
| 233 |
+
215 quantities are small and difficult to perceive, we normalize the gray-scale image to [0, 1] range, and
|
| 234 |
+
216 thus the colors between images are not directly comparable.
|
| 235 |
+
217 In all scenarios, a noticeable difference is that PPP spreads out after pretraining on ImageNet.
|
| 236 |
+
218 In Table 2, the PPP-SNR of the VGG19 and ResNet50 also reflects that the response of PPP is
|
| 237 |
+
219 significantly strengthened after model training. That is, the model training has substantial effects on
|
| 238 |
+
220 the construction of PPP. Although the formation of padding pattern is suggested to mainly caused by
|
| 239 |
+
21 the distributional difference between features and paddings [6], our results show that it only increases
|
| 240 |
+
22 the response slightly, compared to the considerable PPP-SNR gain through training.
|
| 241 |
+
|
| 242 |
+
Table 2: Comparing PosENet and our proposed PPP metrics. The standard deviation is computed by five different pretrained models for each test. The performance shows the accuracy for the classification task or weighted F-measure score [18] for the saliency object detection task. Note that we use 2D Gaussian as PosENet reconstruction pattern, and the PPP metrics are measured at the 4th layer of interest. Here, $( ^ { * } )$ indicates a NaN is reported in any of the trials, and (↑) indicates a higher value corresponds to stronger positional information or better performance on the task (vice versa for (↓)). For each group of pretrained models, we label the strongest and weakest positional information response with red and blue.
|
| 243 |
+
|
| 244 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">Padding</td><td rowspan="2">Pretrained</td><td colspan="2">PosENet</td><td colspan="2">PPP (ours)</td><td rowspan="2">Performance (个)</td></tr><tr><td>SPC (1)</td><td>MAE (↓)</td><td>SNR-PPP (↑)</td><td>MAE-PPP (↑)</td></tr><tr><td rowspan="10">VGG-19</td><td rowspan="2">Zeros</td><td rowspan="2">× ImageNet</td><td>0.518±0.121</td><td>0.184±0.004</td><td>0.0665±0.0024</td><td>0.0132±0.0006</td><td rowspan="2">74.0972±0.0870</td></tr><tr><td>0.142±0.139</td><td>0.194±0.006</td><td>1.2289±0.0613</td><td>0.0176±0.0005</td></tr><tr><td rowspan="2">Circular</td><td rowspan="2">× ImageNet</td><td>0.001±0.092</td><td>0.197±0.002</td><td>0.0000±0.0000</td><td>0.0000±0.0000</td><td rowspan="2">74.4716±0.0863</td></tr><tr><td>0.102±0.136</td><td>0.197±0.007</td><td>1.1488±0.0589</td><td>0.0158±0.0006</td></tr><tr><td rowspan="2">Reflect</td><td rowspan="2">× ImageNet</td><td></td><td>0.197±0.002</td><td>0.0000±0.0000</td><td>0.0000±0.0000</td><td rowspan="2"></td></tr><tr><td>0.001±0.091 0.116±0.134</td><td>0.195±0.006</td><td></td><td>0.0158±0.0002</td></tr><tr><td rowspan="2">Replicate</td><td rowspan="2">×</td><td></td><td></td><td>1.2022±0.0226</td><td></td><td rowspan="2">74.0516±0.0621</td></tr><tr><td>0.001±0.091</td><td>0.197±0.002</td><td>0.0000±0.0000</td><td>0.0000±0.0000</td></tr><tr><td rowspan="2">Randn</td><td rowspan="2">ImageNet ×</td><td>0.116±0.132</td><td>0.195±0.006</td><td>1.2494±0.0258</td><td>0.0144±0.0009</td><td rowspan="2">73.9964±0.1079</td></tr><tr><td>0.001±0.093 0.115±0.146</td><td>0.197±0.002 0.195±0.006</td><td>0.0000±0.0000</td><td>0.0000±0.0000</td></tr><tr><td rowspan="2">No-padding</td><td rowspan="2">ImageNet ×</td><td></td><td></td><td>1.2366±0.0774</td><td>0.0182±0.0012</td><td rowspan="2">73.7716±0.0758</td></tr><tr><td>0.000±0.091</td><td>0.197±0.002</td><td>0.0000±0.0000</td><td>0.0000±0.0000</td></tr><tr><td rowspan="9"></td><td rowspan="2">Zeros</td><td>ImageNet ×</td><td>0.001±0.220</td><td>0.203±0.012</td><td>0.0000±0.0000</td><td>0.0000±0.0000</td><td rowspan="2">62.0396±0.0830</td></tr><tr><td>DUTS</td><td>0.682±0.099 0.343±0.151</td><td>0.171±0.008</td><td>0.0306±0.0020</td><td>0.0068±0.0007</td></tr><tr><td rowspan="2">Circular</td><td></td><td></td><td>0.186±0.011</td><td>0.2429±0.0035</td><td>0.0049±0.0001</td><td rowspan="2">0.6269±0.0015</td></tr><tr><td>× DUTS</td><td>0.001±0.081 0.158±0.188</td><td>0.197±0.002 0.196±0.013</td><td>0.0000±0.0000 0.2677±0.0062</td><td>0.0000±0.0000 0.0062±0.0001</td></tr><tr><td rowspan="2">Reflect</td><td>X</td><td>-0.002±0.080</td><td>0.197±0.002</td><td></td><td></td><td rowspan="2">0.6260±0.0009</td></tr><tr><td>DUTS</td><td>0.160±0.223</td><td>0.195±0.014</td><td>0.0000±0.0000 0.1972±0.0024</td><td>0.0000±0.0000 0.0053±0.0001</td></tr><tr><td rowspan="2">Replicate</td><td>×</td><td>-0.002±0.087</td><td>0.197±0.002</td><td></td><td></td><td rowspan="2">0.6243±0.0022</td></tr><tr><td>DUTS</td><td>0.075±0.174</td><td>0.201±0.010</td><td>0.0000±0.0000 0.1908±0.0056</td><td>0.0000±0.0000 0.0043±0.0002</td></tr><tr><td rowspan="2">Randn</td><td>×</td><td>0.000±0.082</td><td></td><td></td><td></td><td rowspan="2">0.6255±0.0013</td></tr><tr><td>DUTS</td><td>0.004±0.106</td><td>0.197±0.002 0.196±0.001</td><td>0.0000±0.0000 0.0005±0.0001</td><td>0.0000±0.0000 0.0001±0.0000</td></tr><tr><td rowspan="8"></td><td rowspan="2">No-padding</td><td>×</td><td></td><td></td><td></td><td></td><td rowspan="2">0.2570±0.0022</td></tr><tr><td>DUTS</td><td>0.000±0.087 0.003±0.252</td><td>0.197±0.002</td><td>0.0000±0.0000</td><td>0.0000±0.0000 0.0000±0.0000</td></tr><tr><td rowspan="2">Zeros</td><td>×</td><td>0.096±0.118</td><td>0.200±0.010</td><td>0.0000±0.0000</td><td></td><td rowspan="2">0.4759±0.0013</td></tr><tr><td>ImageNet</td><td>0.329±0.201</td><td>0.196±0.003 0.185±0.011</td><td>0.0918±0.0119 0.8171±0.0173</td><td>0.0052±0.0004 0.0162±0.0012</td></tr><tr><td rowspan="2">Circular</td><td>×</td><td>*0.027±0.093</td><td>*0.197±0.003</td><td>0.0454±0.0041</td><td>0.0032±0.0004</td><td rowspan="2">75.6856±0.0924</td></tr><tr><td>ImageNet</td><td>0.184±0.201</td><td>0.192±0.010</td><td>0.7018±0.0320</td><td>0.0188±0.0016</td></tr><tr><td rowspan="2">Reflect</td><td>×</td><td>*0.004±0.094</td><td>*0.198±0.003</td><td>0.0291±0.0017</td><td>0.0018±0.0001</td><td rowspan="2">76.1432±0.1026 75.5068±0.1213</td></tr><tr><td>ImageNet ×</td><td>0.293±0.181</td><td>0.187±0.009</td><td>0.6960±0.0221</td><td>0.0150±0.0004</td></tr><tr><td rowspan="2">Randn</td><td>Replicate ImageNet</td><td>*0.002±0.094</td><td>*0.198±0.003</td><td>0.0226±0.0013</td><td>0.0015±0.0001</td><td></td><td rowspan="2">75.6122±0.0911</td></tr><tr><td>×</td><td>0.347±0.205 *0.006±0.090</td><td>0.184±0.012</td><td>0.7461±0.0254</td><td>0.0138±0.0003</td><td></td></tr><tr><td rowspan="2"></td><td rowspan="2"></td><td>ImageNet</td><td>0.358±0.240</td><td>*0.198±0.003 0.181±0.016</td><td>0.0326±0.0016 0.6648±0.0204</td><td>0.0020±0.0002 0.0147±0.0007</td><td rowspan="2">75.3076±0.1016</td></tr><tr><td>×</td><td>0.360±0.327</td><td>0.180±0.026</td><td>0.5074±0.0260</td><td>0.0398±0.0027</td></tr><tr><td rowspan="9">EfficientNet</td><td rowspan="2">Circular</td><td>ImageNet</td><td>0.667±0.111</td><td>0.166±0.014</td><td>0.7590±0.0208</td><td>0.0471±0.0022</td><td rowspan="2">61.8652±0.1380</td></tr><tr><td>×</td><td>0.004±0.192</td><td>0.205±0.013</td><td>0.3008±0.0883</td><td>0.0222±0.0048</td></tr><tr><td rowspan="2"></td><td>ImageNet</td><td>0.020±0.123</td><td>0.203±0.009</td><td>0.4326±0.0251</td><td>0.0256±0.0017</td><td rowspan="2">61.2208±0.2128</td></tr><tr><td>×</td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="2">Reflect</td><td>ImageNet</td><td>0.003±0.175 0.062±0.116</td><td>0.205±0.012 0.201±0.008</td><td>0.2245±0.0639 0.4667±0.0232</td><td>0.0183±0.0053 0.0268±0.0014</td><td rowspan="2">60.4164±0.2924</td></table>
|
| 245 |
+
|
| 246 |
+

|
| 247 |
+
Figure 4: Visualization of Position-Information Pattern from Padding (PPP). The visualizations are calculated based on Eq. 3 over 480 GMap samples extracted at the 3rd layer-of-interest (Appendix A). The results show that the pretrained model significantly reinforces PPP compared to randomly initialized networks. Note that each image is normalized to [0, 1] separately, therefore the colors between images are not comparable. More visualizations are presented in Appendix B.
|
| 248 |
+
|
| 249 |
+

|
| 250 |
+
Figure 5: Chronological PPP. We quantify PPP every 10 epochs and plot its development in four different layer of depth (the rightmost layer is the one closest to model output). All curves consistently show a sudden surge at the early stage, and all the later layers are slowly but steadily gaining stronger PPP until the end of training. The shadow region represents standard deviations among 5 individual training episodes. The colors represent zeros, circular, reflect, replicate, and randn paddings.
|
| 251 |
+
|
| 252 |
+
Another intriguing observation is that, despite some variations in the detailed patterns, the overall structure of PPP remains similar. Regardless of padding minimum values with zero-padding (consider the features are processed with ReLU activation), randn-padding that can sometimes produce large quantities by chance, or the unbalanced initial state of ResNet50 caused by strided convolution (the first row of ResNet50 in Figure 4), all models tend to have the maximal PPP response in the corner of the features after fully trained. While the underlying mechanism causing such consistent preferences remains unknown, such preferences may be an important factor to consider in future model design.
|
| 253 |
+
|
| 254 |
+
# 4.2 Quantifying PPP and Comparing with PosENet
|
| 255 |
+
|
| 256 |
+
Table 2 shows the measurements of PPP and PosENet on various architectures and padding schemes. We train five models for each setup and measure the standard deviation of these models. Our PPP metrics have significantly lower standard deviations compared to PosENet, where the standard deviation dominates the differences between padding variants, and thus the quantities from PosENet cannot provide sufficient information for any analysis. The main reason that PosENet has such a large variation is due to its optimization-based formulation, and thus the final quantities highly depend on the convergence of the PosENet training. In fact, we also observe a similar level of standard deviation even when the PosENet is measured on the same model for multiple trials. On the other hand, PPP metrics are based on a closed-form formulation, and thus the variations are only introduced by the differences among the parameters of the pretrained models. Furthermore, PosENet frequently reports positive SPC responses from no-padding models, as shown in its large standard deviation. In contrast, PPP has zero response to no-padding models by definition, and therefore is less biased for measuring the positional information from padding.
|
| 257 |
+
|
| 258 |
+
SNR-PPP and MAE-PPP assess the response of PPP from two different perspectives, the ratio of the overall PPP magnitude to the image feature variation, and the position-aware average gain of PPP. Despite both measuring the PPP gain and mostly following similar trends, the two metrics can sometimes have discrepancies, such as the randn padding case in EfficientNet pretrained on ImageNet in Table 2. We note that the two metrics should be both measured and considered altogether.
|
| 259 |
+
|
| 260 |
+
Although certain paddings seem to have lower SNR-PPP or MAE-PPP on trained networks, we find the differences are not significant when comparing the extremely low SNR-PPP and MAE-PPP from the randomly initialized networks. In most cases, the network can effectively construct its PPP, even with the highly stochastic randn padding. The only exception seems to be the case of randn padding in the salient object detection (SOD) task, where the network fails to achieve a compatible performance to other paddings2. The results show that the model training plays an important role in the formation of PPP, and perhaps its contribution is much larger than which underlying padding scheme is being used. This motivates us to further analyze the PPP formulation during model training.
|
| 261 |
+
|
| 262 |
+
# 4.3 Chronological PPP
|
| 263 |
+
|
| 264 |
+
To understand the formulation of PPP through time, we snapshot checkpoints every 10 epochs for all training episodes. By measuring the PPP metrics at all the checkpoints, we plot a chronological curve and monitor the progress of PPP. We train 5 individual models for each pair of model-padding setup and report the standard deviations, which demonstrates the significance of the trend.
|
| 265 |
+
|
| 266 |
+
Figure 5 shows all models achieve a significant gain of PPP within the first 10 epochs in all intermediate layers. Most models continuously increase their PPP as training proceeds, especially in the fourth layer of interest, which is the last output from the convolutional layers before the final linear projection. Another interesting observation is that our randn padding, which is designed to be less easily detectable with built-in stochasticity, indeed shows less PPP built-up at the intermediate stages in certain layers. However, the network still adjusts the behavior and ends up forming complete PPPs at the fourth layer of interest in all scenarios. All these evidences show that the network builds PPP purposely as a favorable representation to assist its learning.
|
| 267 |
+
|
| 268 |
+
# 5 Conclusion and Limitations
|
| 269 |
+
|
| 270 |
+
In this paper, we develop a reliable method for measuring PPP and conduct a series of analyses toward understanding the formation and properties of PPP. Through a large-scale study, we demonstrate that PPP is a representation that the network favorably develops as a part of its learning process, and its formation has weak connections to the underlying padding algorithm. We show that reliable PPP metrics are important steps for understanding the effects of PPPs in different tasks, and useful for measuring the effectiveness of future methods in debiasing PPP.
|
| 271 |
+
|
| 272 |
+
However, an unfortunate and inevitable limitation of the PPP metrics is that their measure is biased by the model architecture and parameters. Since the PPP metrics are based on the distributional differences between the paired model outputs (i.e., optimal padding to algorithmic padding), different architecture and layers of depth exhibit different and intractable biases due to different interactions between PPP and model parameters. Such a bias makes PPP metrics less useful for evaluating models, and therefore cannot be used to study the effect of architectural changes. This limitation is inevitable for any (and all existing) metric that attempts to measure PPP using the outputs of a model. We note future studies in measuring PPP without model inferences3 will be an important step toward tackling and understanding the property of PPP under different architectural choices.
|
| 273 |
+
|
| 274 |
+
# References
|
| 275 |
+
|
| 276 |
+
[1] Md Amirul Islam\*, Sen Jia\*, and Neil D. B. Bruce. How much position information do convolutional neural networks encode? In International Conference on Learning Representations, 2020. 1, 2, 5
|
| 277 |
+
[2] Md Amirul Islam, Matthew Kowal, Sen Jia, Konstantinos G Derpanis, and Neil DB Bruce. Position, padding and predictions: A deeper look at position information in cnns. arXiv preprint arXiv:2101.12322, 2021. 1
|
| 278 |
+
[3] Osman Semih Kayhan and Jan C van Gemert. On translation invariance in cnns: Convolutional layers can exploit absolute spatial location. In IEEE Conference on Computer Vision and Pattern Recognition, 2020. 1, 5
|
| 279 |
+
[4] Carlo Innamorati, Tobias Ritschel, Tim Weyrich, and Niloy J Mitra. Learning on the edge: Investigating boundary filters in cnns. International Journal of Computer Vision, 2020. 1
|
| 280 |
+
[5] Chieh Hubert Lin, Yen-Chi Cheng, Hsin-Ying Lee, Sergey Tulyakov, and Ming-Hsuan Yang. InfinityGAN: Towards infinite-pixel image synthesis. In International Conference on Learning Representations, 2022. 1, 3
|
| 281 |
+
[6] Bilal Alsallakh, Narine Kokhlikyan, Vivek Miglani, Jun Yuan, and Orion Reblitz-Richardson. Mind the pad – {cnn}s can develop blind spots. In International Conference on Learning Representations, 2021. 1, 2, 3, 8
|
| 282 |
+
[7] Rui Xu, Xintao Wang, Kai Chen, Bolei Zhou, and Chen Change Loy. Positional encoding as spatial inductive bias in gans. In IEEE Conference on Computer Vision and Pattern Recognition, 2021. 1, 2, 3
|
| 283 |
+
[8] Evangelos Ntavelis, Mohamad Shahbazi, Iason Kastanis, Radu Timofte, Martin Danelljan, and Luc Van Gool. Arbitrary-scale image synthesis. In IEEE Conference on Computer Vision and Pattern Recognition, 2022. 1, 3
|
| 284 |
+
[9] Jooyoung Choi, Jungbeom Lee, Yonghyun Jeong, and Sungroh Yoon. Toward spatially unbiased generative models. In IEEE International Conference on Computer Vision, 2021. 1, 3
|
| 285 |
+
[10] Songwei Ge, Thomas Hayes, Harry Yang, Xi Yin, Guan Pang, David Jacobs, Jia-Bin Huang, and Devi Parikh. Long video generation with time-agnostic vqgan and time-sensitive transformer. arXiv preprint arXiv:2204.03638, 2022. 1, 2, 3
|
| 286 |
+
[11] Antonio Alguacil, Wagner Gonçalves Pinto, Michael Bauerheim, Marc C Jacob, and Stéphane Moreau. Effects of boundary conditions in fully convolutional networks for learning spatio-temporal dynamics. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, 2021. 1, 2, 3
|
| 287 |
+
[12] Md Amirul Islam, Matthew Kowal, Sen Jia, Konstantinos G. Derpanis, and Neil Bruce. Boundary effects in $\{ \mathrm { c n n } \} \mathrm { s }$ : Feature or bug? https://openreview.net/forum?id=M4qXqdw3xC, 2021. 1
|
| 288 |
+
[13] Bilal Alsallakh, Vivek Miglani, Narine Kokhlikyan, David Adkins, and Orion Reblitz-Richardson. Are convolutional networks inherently foveated? In SVRHM 2021 Workshop at NeurIPS, 2021. 1, 5
|
| 289 |
+
[14] Wenjie Luo, Yujia Li, Raquel Urtasun, and Richard Zemel. Understanding the effective receptive field in deep convolutional neural networks. In Neural Information Processing Systems, 2016. 1, 5
|
| 290 |
+
[15] Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In IEEE Conference on Computer Vision and Pattern Recognition, 2018. 3
|
| 291 |
+
[16] Shichen Liu, Tianye Li, Weikai Chen, and Hao Li. Soft rasterizer: A differentiable renderer for image-based 3d reasoning. In IEEE International Conference on Computer Vision, 2019. 3
|
| 292 |
+
[17] Nikhila Ravi, Jeremy Reizenstein, David Novotny, Taylor Gordon, Wan-Yen Lo, Justin Johnson, and Georgia Gkioxari. Accelerating 3d deep learning with pytorch3d. arXiv preprint arXiv:2007.08501, 2020. 3
|
| 293 |
+
[18] Ran Margolin, Lihi Zelnik-Manor, and Ayellet Tal. How to evaluate foreground maps? In IEEE Conference on Computer Vision and Pattern Recognition, 2014. 7
|
| 294 |
+
[19] Nian Liu, Junwei Han, and Ming-Hsuan Yang. Picanet: Learning pixel-wise contextual attention for saliency detection. In IEEE Conference on Computer Vision and Pattern Recognition, 2018. 9
|
| 295 |
+
[20] Joe Mellor, Jack Turner, Amos Storkey, and Elliot J Crowley. Neural architecture search without training. In International Conference on Machine Learning, 2021. 9
|
| 296 |
+
|
| 297 |
+
# Checklist
|
| 298 |
+
|
| 299 |
+
1. For all authors...
|
| 300 |
+
|
| 301 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 302 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 303 |
+
(c) Did you discuss any potential negative societal impacts of your work? [No]
|
| 304 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 305 |
+
|
| 306 |
+
2. If you are including theoretical results...
|
| 307 |
+
|
| 308 |
+
(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
|
| 309 |
+
|
| 310 |
+
3. If you ran experiments...
|
| 311 |
+
|
| 312 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No] All the codes for reproducing all results shown in the paper will be made publicly available.
|
| 313 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 314 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 315 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [No] It is not a critical computational constraint to the experiments. In order to properly report the standard deviation, we use a total of 24 GPUs over 3 clusters to train 150 CNN models on ImageNet and DUTS datasets. These computations are completely for analyses. Running our PPP metrics only need 1GB of memory on any type of GPU, or even CPU.
|
| 316 |
+
|
| 317 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 318 |
+
|
| 319 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 320 |
+
(b) Did you mention the license of the assets? [No] The assets used in our codes are released under MIT or BSD-3, which have no restricted usage.
|
| 321 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 322 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] We did not obtain personal data.
|
| 323 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] We did not use personal data.
|
| 324 |
+
|
| 325 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 326 |
+
|
| 327 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 328 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 329 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/TiZYrQ-mPup/TiZYrQ-mPup.md
ADDED
|
@@ -0,0 +1,335 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# COLD Decoding: Energy-based Constrained Text Generation with Langevin Dynamics
|
| 2 |
+
|
| 3 |
+
Lianhui Qin1 Sean Welleck1 2 Daniel Khashabi3⇤ Yejin Choi1 2 1Paul G. Allen School of Computer Science & Engineering, University of Washington 2Allen Institute for Artificial Intelligence 3Department of Computer Science, Johns Hopkins University
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Many applications of text generation require incorporating different constraints to control the semantics or style of generated text. These constraints can be hard (e.g., ensuring certain keywords are included in the output) and soft (e.g., contextualizing the output with the left- or right-hand context). In this paper, we present Energy-based Constrained Decoding with Langevin Dynamics (COLD), a decoding framework which unifies constrained generation as specifying constraints through an energy function, then performing efficient differentiable reasoning over the constraints through gradient-based sampling. COLD decoding is a flexible framework that can be applied directly to off-the-shelf left-to-right language models without the need for any task-specific fine-tuning, as demonstrated through three challenging text generation applications: lexically-constrained generation, abductive reasoning, and counterfactual reasoning. Our experiments on these constrained generation tasks point to the effectiveness of our approach, both in terms of automatic and human evaluation.1
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Many text generation applications require producing text that is not only fluent, but also satisfies various constraints which control the semantics or style of the generated text. For example (Figure 1), for knowledge-grounded or keyword-guided generation, we might want to ensure that certain keywords are included in the generated output as hard lexical constraints [29, 52]. For other types of text generation, we often wish to incorporate soft topical constraints to contextualize the desired output, e.g., abductively $\mathbb { \lVert \rVert 3 \rVert }$ reasoning about what happened in the middle of a story given the past and the future story context [1]. Yet another class of text generation applications requires revising an input based on a new counterfactual condition $\mathbb { 1 1 3 }$ , which simultaneously requires semantic coherence as well as minimal-edit constraints with respect to the input text [44].
|
| 12 |
+
|
| 13 |
+
The dominant paradigm to various text generation applications has been supervised learning with task-specific training data. However, different applications require varied and potentially evolving constraints, and annotating a large amount of task-specific training data for each different combination of constraints can be costly. Recent work has explored incorporating constraints through energy-based text modeling that alleviates the need of supervised data [23, 7, 41]. Yet those approaches still require expensive training of specific generation models. In addition, training might not even be feasible with recent models that are extreme in scale, like GPT-3 [3]. This motivates the need to enrich decoding algorithms that can work directly with pretrained language models without task-specific fine-tuning, and support complex combinations of hard and soft constraints to control the generated text on the fly.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Applying COLD to different constrained generation tasks amounts to specifying an energy function $E$ by plugging in relevant constraint functions. Text in grey boxes is the input, and text in blue boxes is the output.
|
| 17 |
+
|
| 18 |
+
We propose a new constrained decoding approach that formulates decoding as sampling from an energy-based model (EBM) [16, 27]. Constrained generation with our approach amounts to specifying an energy function by plugging in arbitrary constraint functions that are suitable for the task at hand, then sampling from its induced distribution. In particular, to overcome the longstanding challenges of sampling discrete text from EBMs, we for the first time introduce Langevin dynamics $\tilde { \left\| 5 3 \right\| }$ to text-based EBMs for efficient gradient-based sampling. As a result, our approach, Constrained Decoding with Langevin Dynamics (COLD), performs sampling by iteratively updating a continuous relaxation of text using gradients of the energy function. The resulting continuous text samples are then mapped back to the discrete space with a simple guided discretization approach, yielding text sequences that are fluent and adhere to the constraints.
|
| 19 |
+
|
| 20 |
+
Our work makes unique contributions to a recent line of research investigating decoding algorithms for incorporating different constraints [45, 6, 33, 26] in three distinct aspects. First, our formulation unifies various constrained generation scenarios that involve hard lexical constraints and/or soft contextual constraints: specifying an energy function, then sampling from its induced distribution. Second, we propose a sampling method, which complements decoding algorithms that look for a single optimal solution. Finally, we provide new empirical insights into the strengths and weaknesses of existing approaches to discrete search and differentiable reasoning.
|
| 21 |
+
|
| 22 |
+
To test the flexibility and empirical performance of COLD decoding, we experiment with three challenging text generation tasks: lexically constrained generation $\mathbb { \ m } \mathbb { \bar { \left[ \left. 2 \mathrm { { 9 } } \right.} } \\right]bar { \left. { 1 } \mathrm { { 8 } } }\right]$ , abductive reasoning [1], and counterfactual story generation [44]. COLD achieves better lexical coverage than NEUROLOGIC [33], a beam-based discrete decoding algorithm specifically designed for lexically constrained generation, while producing more coherent and higher quality text than DELOREAN [45], a state-of-the-art gradient-based generation method for abductive reasoning and counterfactual reasoning. COLD supports all three constrained generation settings under a unified framework – specifying an energy function using a collection of fluency and task-specific constraints, then sampling from its induced distribution and achieves strong performance on both automatic and human evaluation.
|
| 23 |
+
|
| 24 |
+
# 2 Background
|
| 25 |
+
|
| 26 |
+
Neural text generation. Neural text generation typically involves two stages: modeling a distribution over text sequences, and using a decoding algorithm to generate sequences with the model. Let $\mathbf { y } = ( y _ { 1 } , \dots , y _ { T } )$ denote a discrete sequence where each $y _ { t }$ is a token from a vocabulary $\nu$ . Common neural language models (e.g., GPT-2/3 [46, $\textcircled { 3 } \textcircled { 1 }$ ) factorize the probability of a sequence into the product of per-token conditionals in left-to-right order, $\begin{array} { r } { p _ { \theta } ( \mathbf { y } ) = \bar { \prod } _ { t = 1 } ^ { T } p _ { \theta } \bar { ( y _ { t } | \mathbf { y } _ { < t } ) } } \end{array}$ , with each conditional parameterized by a shared neural network, such as transformer $\mathbb { \left. \boldsymbol { \mathsf { \Sigma } } \boldsymbol { \mathsf { O } } \right. }$ . Popular decoding algorithms, ranging from beam search or greedy decoding to sampling methods such as top- $k$ [12] or nucleus [19] sampling, produce text sequences y using the model $p _ { \theta }$ , often conditioned on a prompt $\mathbf { x }$ .
|
| 27 |
+
|
| 28 |
+
Constrained text generation. We view text generation as the problem of finding a sequence that satisfies a collection of constraints. For instance, the scenario above amounts to generating a sequence $\mathbf { y } = ( y _ { 1 } , \dots , y _ { T } )$ subject to a soft constraint that the continuation $\mathbf { y }$ should be fluent and logically coherent with the prompt $\mathbf { x }$ . Other constrained generation problems impose additional constraints, such as text infilling $\overline { { \mathbb { B O } } } \boxtimes $ where coherence constraints move beyond a left-hand prefix, lexically constrained generation in which hard constraints require the output to contain given tokens, and various forms of semantically-constrained generation in which the output is softly constrained to be similar to another sequence. Since common decoding algorithms generate text monotonically, relying on $p _ { \theta } ( y _ { t } | \mathbf { y } _ { < t } )$ for determining the next token, it is challenging to enforce these diverse constraints.
|
| 29 |
+
|
| 30 |
+

|
| 31 |
+
Figure 2: An overview of the COLD decoding procedure. Given an energy function $E ( \tilde { \bf { y } } ) =$ $\textstyle \sum _ { i } \lambda _ { i } f _ { i } ( \tilde { \mathbf { y } } )$ with various constraints, the procedure starts with a soft sequence $\tilde { \mathbf { y } } ^ { ( 0 ) }$ as a sample from an initial energy-based distribution, and performs Langevin dynamics iterations using the gradient $\nabla _ { \tilde { \mathbf { y } } } E ( \tilde { \mathbf { y } } ) \ ( \mathrm { E q } . \big \vert 2 )$ . The resulting sequence $\tilde { \mathbf { y } } ^ { ( N ) }$ after $N$ iterations is approximately a sample from the desired constrained distribution. We then apply top- $\mathbf { \nabla } \cdot \mathbf { k }$ filtering on the soft sequence to produce a discrete text sequence y $( \mathrm { E q } . 6 )$
|
| 32 |
+
|
| 33 |
+
Energy-based models and Langevin dynamics. Given an energy function $E ( \mathbf { y } ) \in \mathbb { R }$ , an energybased model (EBM) is defined as a Boltzmann distribution $p ( \mathbf { y } ) = \exp \{ - E ( \mathbf { y } ) \} / Z$ , where $Z =$ $\begin{array} { r } { \sum _ { \mathbf { y } } \exp \{ - E ( \mathbf { y } ) \} } \end{array}$ is the normalizing factor (The sum is replaced with an integral if $\mathbf { y }$ is continuous). EBMs are flexible, in that one can incorporate arbitrary functions such as constraints into the energy function $E ( \mathbf { y } )$ . Recent work has thus made attempts to train text-based EBMs each for specific tasks [21, 41, 7, 23]. As discussed earlier, we instead use the energy-based formulation to develop an inference (decoding) procedure that enables off-the-shelf pretrained language models to perform arbitrary constrained generation, without any fine-tuning.
|
| 34 |
+
|
| 35 |
+
Despite the flexibility, however, sampling from an EBM is particularly challenging, as computing $Z$ is intractable. Common gradient-free Markov chain Monte Carlo (MCMC) methods such as Gibbs sampling $\left[ \left[ 2 \right] \right]$ can be used, but they are often prohibitively slow $\textcircled { 1 0 } , \textcircled { 3 8 } \textcircled { 1 }$ . Langevin dynamics [53, 37, 34], a gradient-based MCMC method, offers more efficient sampling by using the gradient of the energy function $\nabla _ { \mathbf y } E ( \mathbf y )$ , enabling sampling in domains such as image generation [9, 48]. However, since text is discrete, the gradient $\nabla _ { \mathbf y } E ( \mathbf y )$ is not well-defined, making it non-trivial to apply Langevin dynamics for sampling text from an EBM. Our approach bridges this gap with continuous relaxation of text, differentiable constraints, and guided discretization, as described below.
|
| 36 |
+
|
| 37 |
+
# 3 COLD Decoding with Langevin Dynamics
|
| 38 |
+
|
| 39 |
+
To enable flexible and diverse constrained generation in off-the-shelf language models, we develop Constrained Decoding with Langevin Dynamics (COLD), a decoding approach that treats text generation as sampling from an energy-based distribution, allowing for flexibly composing constraints based on the task at hand. COLD decoding generates text by sampling from an EBM defined over a sequence of “soft” tokens using Langevin dynamics, then maps the continuous sample into discrete, fluent text. We provide our formulation of constrained text generation $( \ S _ { \perp } 3 . 1 )$ , present differentiable constraints that can be composed into energy functions $( \ S 3 . { \bar { 2 } } )$ along with our discretization method $( \ S 3 . 3 )$ and discuss practical details of COLD decoding $( \ S 3 . 4 )$ . Figure 2 provides an overview.
|
| 40 |
+
|
| 41 |
+
# 3.1 Energy-based Decoding
|
| 42 |
+
|
| 43 |
+
Constrained text generation aims to produce text samples $\mathbf { y }$ that satisfy a set of constraints (usually conditioned on an input $\mathbf { x }$ omitted for brevity). We assume each constraint can be captured by a constraint function $f _ { i } ( \mathbf { y } ) \in \mathbb { R }$ , where higher values of $f _ { i }$ mean that the text $\mathbf { y }$ better satisfies the constraint. For example, $f _ { i }$ could measure the likelihood of $\mathbf { y }$ as a fluency constraint (more in $\ S [ 3 . 2 )$ , while a hard constraint $f _ { i }$ amounts to a large negative penalty when y does not satisfy the constraint.
|
| 44 |
+
|
| 45 |
+

|
| 46 |
+
Figure 3: Illustrations of the differentiable constraints introduced in $\ S 3 . 2 .$ (1) The soft fluency constraint $\mathrm { ( E q } \vert \mathfrak { Z } \vert \mathfrak { p }$ to encourage fluency of $\tilde { \mathbf { y } } _ { t }$ based on LM probabilities. (2) The future contextualization constraint in Eq. $\textcircled{4}$ to encourage coherence w.r.t. the future context (has eight legs). (3) The $n$ -gram similarity constraint in $\operatorname { E q . } ( { \sqrt { 5 } } )$ , where the left figure shows the case of $n = 1$ which encourages keywords (e.g., hand) to appear in the generation, and the right figure shows the case of $n > 1$ which is typically used to encourage sequence similarity with a reference text $\mathbf { y } _ { * }$ .
|
| 47 |
+
|
| 48 |
+
The set of constraints induces a distribution over text, written in an energy-based form as:
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
p ( \mathbf { y } ) = \exp \left\{ \sum _ { i } \lambda _ { i } f _ { i } ( \mathbf { y } ) \right\} / Z ,
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
where $\lambda _ { i } \ \geq \ 0$ is the weight of the ith constraint, $Z$ is the normalizing factor. Here $E ( \mathbf { y } ) : =$ $- \sum _ { i } \lambda _ { i } f _ { i } ( \mathbf { y } )$ is the energy function. This energy-based form is flexible, as one can plug in any constraint functions required for a task of interest. Generating text under the constraints can then be seen as sampling from the energy-based distribution $\mathbf { y } \sim p ( \mathbf { y } )$ . One can also draw multiple samples and pick the best if only one sample is needed, as discussed later $( \ S \bigcirc . 4 )$ .
|
| 55 |
+
|
| 56 |
+
As mentioned above, for efficient sampling from $p ( \mathbf { y } )$ we want to use Langevin dynamics, which makes use of the gradient $\nabla _ { \mathbf y } E ( \mathbf y )$ . However, in our case $\mathbf { y }$ is a discrete sequence and the gradient $\nabla _ { \mathbf y } E ( \mathbf y )$ is not well-defined. As a result, we perform Langevin dynamics with an energy defined on a sequence of continuous token vectors, described below.
|
| 57 |
+
|
| 58 |
+
Differentiable decoding with Langevin dynamics. Instead of defining the energy function on discrete tokens, we define the energy function on a sequence of continuous vectors $\tilde { \mathbf { y } } = _ { . } ( \tilde { \mathbf { y } } _ { 1 } , \dots , \tilde { \mathbf { y } } _ { T } )$ , which we call a soft sequence. Each position in the soft sequence is a vector $\tilde { \mathbf { y } } _ { t } \in \mathbb { R } ^ { V }$ , where $V$ is the vocabulary size, and each element $\tilde { \mathbf { y } } _ { t } ( v ) \in \mathbb { R }$ corresponds to the logit of word $v$ in the vocabulary. Taking the softmax of $\tilde { \mathbf { y } } _ { t }$ yields a distribution over the vocabulary for position $t$ , $\tilde { \mathbf { p } } _ { t } ^ { \tau } = \mathrm { s o f t m a x } ( \tilde { \mathbf { y } } _ { t } / \tau )$ . As $\tau 0$ , $\tilde { \mathbf { p } } _ { t } ^ { \tau }$ becomes a one-hot vector, indicating a discrete token.
|
| 59 |
+
|
| 60 |
+
By specifying an energy $E ( \tilde { \mathbf { y } } )$ on the soft sequence $\tilde { \mathbf { y } }$ , we can use Langevin dynamics to obtain a sample. Specifically, the sampling is done by forming a Markov chain:
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\begin{array} { r } { \tilde { \mathbf { y } } ^ { ( n + 1 ) } \tilde { \mathbf { y } } ^ { ( n ) } - \eta \nabla _ { \tilde { \mathbf { y } } } E ( \tilde { \mathbf { y } } ^ { ( n ) } ) + \epsilon ^ { ( n ) } , } \end{array}
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
where $\eta > 0$ is the step size, and $\epsilon ^ { ( n ) } \in \mathcal { N } ( 0 , \sigma )$ is the noise at iteration $n$ . As shown in Welling and Teh $\mathbb { \lVert 5 3 \rVert }$ , by adding the right amount of noise and annealing the step size, the procedure will converge to samples from the true distribution. That is, if we let $p ^ { ( n ) }$ be the distribution such that $\tilde { \mathbf { y } } ^ { ( n ) } \sim p ^ { ( \bar { n } ) }$ , then as $n \to \infty$ and $\sigma \to 0$ , we have $p ^ { ( n ) } \to p ( \tilde { \mathbf { y } } ) : = \exp \{ - E ( \tilde { \mathbf { y } } ) \} / Z$ . That is, the procedure ends up generating samples from the distribution induced by the energy function.
|
| 67 |
+
|
| 68 |
+
Next, we describe constraint functions defined on the soft sequence $\tilde { \mathbf { y } }$ that can be plugged in as components of the energy function. Later in $\ S \bigstar 3 . 3 \AA$ we describe how to obtain a discrete sequence from a soft sequence sample $\tilde { \mathbf { y } }$ .
|
| 69 |
+
|
| 70 |
+
# 3.2 A Collection of COLD Constraints
|
| 71 |
+
|
| 72 |
+
COLD provides a flexible framework for plugging in a wide range of constraint functions for a task of interest. We describe constraint functions that are useful in various constrained generation problems, such as those we consider in the experiments $( \ S \boxed { 4 } )$ . The constraints include language model-based fluency constraints, along with lexical and semantic constraints on the sequence content. More generally, any differentiable function that outputs a goodness score of (soft) text can be used as a constraint function, as long as it reflects the requirements of the target task.
|
| 73 |
+
|
| 74 |
+
# Algorithm 1 Constrained Decoding w/ Langevin Dynamics.
|
| 75 |
+
|
| 76 |
+
input Constraints $\{ f _ { i } \}$ , length $T$ , iterations $N$ .
|
| 77 |
+
output Sample sequence 0L $\tilde { \mathbf { y } } _ { t } ^ { ( 0 ) } \gets \mathrm { i n i t } ( )$ for all position . $t$ // init soft-tokens for $n \in \{ 1 , \ldots , N \}$ do er $E ^ { ( n ) } \gets E ( \tilde { \mathbf { y } } ^ { ( n ) } ; \{ f _ { i } \} )$ $\tilde { \mathbf { y } } _ { t } ^ { ( n + 1 ) } \gets \tilde { \mathbf { y } } _ { t } ^ { ( n ) } - \eta \nabla _ { \tilde { \mathbf { y } } _ { t } } E ^ { ( n ) } + \epsilon _ { t } ^ { ( n ) }$ // compute energy for all $t$ // update soft tokens (Eq.2) $( \ S \sqrt { 3 . 2 } )$ $y _ { t } = \arg \operatorname* { m a x } _ { v }$ topk-filter $\left( \tilde { \mathbf { y } } _ { t } ^ { ( N ) } ( v ) \right)$ for all $t$ // discretize (Eq.6)
|
| 78 |
+
return: $\mathbf { y } = ( y _ { 1 } , \dots , y _ { T } )$
|
| 79 |
+
|
| 80 |
+
Soft fluency constraint. Fluency is a common requirement for generated text. To promote fluency, we use a constraint which favors soft sequences that receive high probability according to the underlying left-to-right LM $p _ { \mathrm { L M } } ^ { }$ (e.g., GPT2):
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
f _ { \mathrm { L M } } ^ { } ( \tilde { \bf y } ) = \sum _ { t = 1 } ^ { T } \sum _ { v \in \mathcal { V } } p _ { \mathrm { L M } } ^ { } ( v | \tilde { \bf y } _ { < t } ) \log \mathrm { s o f t m a x } ( \tilde { \bf y } _ { t } ( v ) ) ,
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
where $p _ { \mathrm { L M } } ^ { } ( \cdot | \tilde { \mathbf { y } } _ { < t } )$ means the next-token distribution when providing the neural language model with the preceding soft tokens $\tilde { \mathbf { y } } _ { < t }$ (i.e., feeding the weighted average of word embeddings, with the weights being softmax $\left( \tilde { \mathbf { y } } _ { t ^ { \prime } } / \tau \right)$ for $t ^ { \prime } < t$ [20, 45]).
|
| 87 |
+
|
| 88 |
+
Intuitively, the constraint says that each token distribution in the soft sequence, softmax $\left( \tilde { \mathbf { y } } _ { t } \right)$ , must match the “reference” distribution $p _ { \mathrm { L M } } ^ { } ( \cdot | \tilde { \mathbf { y } } _ { < t } )$ predicted by the underlying language model. The match is measured by the (negative) cross-entropy between the two distributions. The constraint thus encourages fluency. In practice, if there is left-side context $\mathbf { x }$ for the generation to condition on, we feed $\mathbf { x }$ to the LM to form the “reference” distribution $p _ { \mathtt { L M } } ^ { } ( \cdot | \tilde { \mathbf { y } } _ { < t } , \mathbf { x } )$ . As a result, $\tilde { \mathbf { y } }$ is encouraged to be fluent and coherent with the context $\mathbf { x }$ .
|
| 89 |
+
|
| 90 |
+
We can easily incorporate an additional reverse LM constraint, $f _ { \mathrm { L M } } ^ { }$ , using a right-to-left LM $p _ { \mathtt { L M } } ^ { } ( \cdot | \tilde { \mathbf { y } } _ { > t } )$ , as an additional fluency constraint. Flexibly leveraging multiple models in this way is infeasible with conventional decoding methods such as beam search or nucleus sampling.
|
| 91 |
+
|
| 92 |
+
Future-token prediction constraint. Applications such as text infilling involve future input tokens that remain fixed, but should contribute to updating past positions. For instance, consider updating the second position of The has eight legs. A sample should be coherent with the tokens ${ \bf x } _ { r }$ on the right (i.e., has eight legs).
|
| 93 |
+
|
| 94 |
+
To this end, we use a constraint that adjusts soft tokens to maximize the likelihood of input tokens ${ \bf x } _ { r }$
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
f _ { \mathrm { p r e d } } ( \tilde { \mathbf { y } } ; \mathbf { x } _ { r } ) = \sum _ { k = 1 } ^ { K } \log p _ { \mathrm { L M } } ^ { } ( x _ { r , k } | \tilde { \mathbf { y } } , \mathbf { x } _ { r , < k } ) ,
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
where $K$ is the length of ${ \bf x } _ { r }$ . In other words, the constraint adjusts the soft sequence $\tilde { \mathbf { y } }$ such that the underlying LM predicts the future tokens ${ \bf x } _ { r }$ after seeing $\tilde { \mathbf { y } }$ .
|
| 101 |
+
|
| 102 |
+
N-gram similarity constraint. Many constrained generation scenarios pose requirements on the wording and expression of generated text sequences. For instance, lexically constrained generation tasks $\bar { \mathbb { E } 8 } \mathbb { I }$ require certain keywords to be presented in the text samples, while counterfactual reasoning [44] or text editing $\textcircled { 1 1 5 } , \textcircled { 3 1 }$ tasks require the text to retain the essence of a reference sequence.
|
| 103 |
+
|
| 104 |
+
We formulate these requirements as an $n$ -gram similarity constraint which favors sequences that overlap with a reference $\mathbf { y } _ { * }$ at the $n$ -gram level,
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
f _ { \sin } ( { \tilde { \bf y } } ; { \bf y } _ { \ast } ) = \mathrm { n g r a m - m a t c h } ( { \tilde { \bf y } } , { \bf y } _ { \ast } ) ,
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
where ngram-mat $\operatorname { c h } ( \cdot , \cdot )$ is a recent differentiable $n$ -gram matching function $\left[ \left[ 3 2 \right] \right]$ which can be seen as a differentiable approximation to the BLEU- $^ n$ metric $\mathbb { H O }$ . When $n = 1$ and $\mathbf { y } _ { * }$ a sequence of keywords, the constraint in effect enforces $\tilde { \mathbf { y } }$ to assign higher values to the keywords (1-grams). When $n$ is larger and $\tilde { \mathbf { y } } _ { \ast }$ is a reference sequence, the constraint encourages $\tilde { \mathbf { y } }$ to resemble the reference by assigning high values to tokens making up $n$ -grams from $\mathbf { y } _ { * }$ .
|
| 111 |
+
|
| 112 |
+
# 3.3 From Soft to Discrete and Fluent Text
|
| 113 |
+
|
| 114 |
+
After receiving a soft sequence sample $\tilde { \mathbf { y } }$ from running Langevin dynamics $( \mathrm { E q . } \bigtriangledown )$ , we map the soft sequence to a discrete text sequence which we consider as the output of COLD decoding. A simple method would be selecting the most-likely token at each position $t$ , $y _ { t } = \arg \operatorname* { m a x } _ { v } \tilde { \mathbf { y } } _ { t } ( v$ $\tilde { \mathbf { y } } _ { t } ( v )$ . However, the resulting text can suffer from fluency issues even if the soft fluency constraint $( \mathrm { E q } . 3 )$ is used, due to competing constraints that sacrifice fluency. To overcome this, we use the underlying LM (e.g., GPT2-XL) as a “guardian” for obtaining the discrete sequence. Specifically, at each position $t$ , we first use the LM to produce the top- $k$ most-likely candidate tokens based on its generation distribution conditioning on preceding tokens, which we denote as $\nu _ { t } ^ { k }$ . We then select from the top- $k$ candidates the most likely token based on the soft sample $\tilde { \mathbf { y } }$ :
|
| 115 |
+
|
| 116 |
+
Table 1: Automatic and human evaluation of abductive reasoning $\underline { { ( \overline { { 4 . 1 } } ) } }$ Our proposed method (COLD decoding) outperforms DELOREAN, a recent decoding algorithm achieving strong results in this task.
|
| 117 |
+
|
| 118 |
+
<table><tr><td rowspan="2">Models</td><td colspan="4">Automatic Eval</td><td colspan="4">Human Eval</td></tr><tr><td>BLEU4</td><td>ROUGE-L</td><td>CIDEr</td><td>BERTScore</td><td>Grammar</td><td>Left-coherence (xiy)</td><td>Right-coherence (yxr)</td><td>Overall-coherence (xtyxr)</td></tr><tr><td>LEFT-ONLY</td><td>0.88</td><td>16.26</td><td>3.49</td><td>38.48</td><td>4.57</td><td>3.95</td><td>2.68</td><td>2.70</td></tr><tr><td>DELOREAN</td><td>1.60</td><td>19.06</td><td>7.88</td><td>41.74</td><td>4.30</td><td>4.23</td><td>2.83</td><td>2.87</td></tr><tr><td>COLD (ours)</td><td>1.79</td><td>19.50</td><td>10.68</td><td>42.67</td><td>4.44</td><td>4.00</td><td>3.06</td><td>2.96</td></tr></table>
|
| 119 |
+
|
| 120 |
+
$$
|
| 121 |
+
y _ { t } = \arg \operatorname* { m a x } _ { v \in \mathcal { V } _ { t } ^ { k } } \tilde { \mathbf { y } } _ { t } ( v ) .
|
| 122 |
+
$$
|
| 123 |
+
|
| 124 |
+
We refer to this method as “top- $k$ filtering”. The resulting text tends to be fluent because each token is among the top- $k$ most probable tokens from the LM $\bar { \mathbb { E } } \bar { 2 } \mathbb { I }$ . In practice, to ease the satisfaction of certain constraints (e.g. $n$ -gram similarity), we expand the candidate set $\mathcal { V } _ { t } ^ { k }$ to include constraint tokens (e.g., in the tasks of abductive reasoning $\ S 4 . { \dot { 1 } }$ and lexically constrained decoding $\ S [ \underline { { 4 . 3 } } )$
|
| 125 |
+
|
| 126 |
+
Figure $\boxed { 2 }$ illustrates the decoding procedure to get one output from COLD decoding. Algorithm 1 summarizes the algorithm. Next, we move to practical considerations of applying COLD.
|
| 127 |
+
|
| 128 |
+
# 3.4 Implementation of COLD Decoding
|
| 129 |
+
|
| 130 |
+
Sample-and-select. COLD decoding allows for drawing multiple text samples from the distribution induced by the energy function $E ( \tilde { \mathbf { y } } )$ . Depending on task requirements, we could either present the set of samples as output, or select one from the set based on some criteria (e.g., different energy terms) and return a single sequence, as in those tasks considered in the experiments $( \ S \boxed { 4 } )$ . This “sample-andselect” approach differs from deterministic constrained decoding methods, which optimize only one sequence [e.g., $\textcircled { 3 3 } , \textcircled { 2 6 } \textcircled { }$ , and is used widely in various generation settings [e.g., 28, 11, 4].
|
| 131 |
+
|
| 132 |
+
Initialization. We initialize the soft sequence $\tilde { \mathbf { y } }$ by running greedy decoding with the $\mathrm { L M } p _ { \mathrm { L M } }$ to obtain output logits. In our preliminary experiments, the initialization strategy had limited influence on the generation results.
|
| 133 |
+
|
| 134 |
+
Noise schedule. Each iteration of Langevin dynamics adds noise $\epsilon ^ { ( n ) } \sim \mathcal { N } ( 0 , \sigma ^ { ( n ) } )$ to the gradient (Eq. 2). We gradually decrease $\boldsymbol { \sigma } ^ { ( n ) }$ across iterations, which intuitively transitions the decoding procedure from exploration to optimization. In our experiments, we typically used the schedule which sets/reduces $\sigma$ to $\{ 1 , 0 . 5 , 0 . 1 , 0 . 0 5 , 0 . 0 1 \}$ at iterations $\{ 0 , 5 0 , 5 0 0 , \overleftarrow { 1 } 0 0 0 , \overleftarrow { 1 } 5 0 0 \}$ , respectively.
|
| 135 |
+
|
| 136 |
+
Long sequences. COLD decoding produces a fixed-length sequence $\mathbf { y } = ( y _ { 1 } , \dots , y _ { T } )$ . To produce longer sequences, e.g. in cases where $y _ { T }$ is not the end of a sentence, we use $p _ { \mathrm { L M } }$ to produce a continuation of $\mathbf { y }$ using greedy decoding.
|
| 137 |
+
|
| 138 |
+
# 4 Experiments
|
| 139 |
+
|
| 140 |
+
We evaluate COLD on three constrained generation tasks. Using COLD for each task amounts to specifying a set of task-specific constraints (instances of those in $\ S [ 3 . 2 )$ . Our focus is enabling constrained generation for settings in which fine-tuning is infeasible, through changing the decoding method. Thus, our experiments (i) use off-the-shelf LMs without fine-tuning, and (ii) compare COLD primarily against alternative decoding methods. As our base LM, we use GPT2-XL $\lVert \rVert \mathbf { 4 6 } \rVert$ .
|
| 141 |
+
|
| 142 |
+
# 4.1 Abductive Reasoning
|
| 143 |
+
|
| 144 |
+
We study a specific formulation of abductive reasoning $\mathbb { \lVert \rVert 3 \rVert }$ as a language generation challenge. Specifically, given a beginning sentence $\mathbf { x } _ { l }$ and an ending sentence ${ \bf x } _ { r }$ , the abductive language generation $( \alpha \mathbf { N } \mathbf { L } \mathbf { G } )$ problem [1] consists of generating a bridge sentence y that fills in between the two sentences and forms a coherent full story (see Figure $\boxed { 1 }$ for example). The task is particularly challenging for conventional monotonic left-to-right LMs (such as GPT-2 and GPT-3) since it requires non-monotonic reasoning that not only conditions on the past context $( { \bf x } _ { l }$ , on the left), but also the future story ending $\mathbf { \check { x } } _ { r }$ , on the right).
|
| 145 |
+
|
| 146 |
+
# 4.1.1 The COLD Solution
|
| 147 |
+
|
| 148 |
+
COLD decoding can readily accommodate the abductive reasoning task by simply plugging in appropriate constraints to specify an energy function. Specifically, the generated text needs to be (1) fluent and consistent with the left context $\mathbf { x } _ { l }$ , and (2) coherent with the right context ${ \bf x } _ { r }$ . Accordingly, we compose an energy using relevant constraints from $\ S 3 . 2 \colon$
|
| 149 |
+
|
| 150 |
+
$$
|
| 151 |
+
\begin{array} { r l } & { E ( \tilde { \bf { y } } ) = \lambda _ { a } ^ { l r } f _ { \mathrm { L M } } ^ { \right. } ( \tilde { \bf { y } } ; { \bf { x } } _ { l } ) + \lambda _ { a } ^ { r l } f _ { \mathrm { L M } } ^ { \left. } ( \tilde { \bf { y } } ; { \bf { x } } _ { r } ) + \lambda _ { b } f _ { \mathrm { p r e d } } ( \tilde { \bf { y } } ; { \bf { x } } _ { r } ) + \lambda _ { c } f _ { \mathrm { i m } } ( \tilde { \bf { y } } ; { \bf { k } } { \bf { w } } ( { \bf { x } } _ { r } ) - { \bf { k } } { \bf { w } } ( { \bf { x } } _ { l } ) ) . } \end{array}
|
| 152 |
+
$$
|
| 153 |
+
|
| 154 |
+
That is, we combine (a) a soft fluency constraint (Eq. 3) conditioning on the left sentence $\mathbf { x } _ { l }$ to enforce fluency and consistency with the left context, and a reverse fluency constraint with a right-to-left LM conditioning on ${ \bf x } _ { r }$ to encourage coherence with the right context; $\mathbf { ( b ) }$ a future-token prediction constraint $( \mathrm { E q . } \dot { \bigtriangledown } )$ that enforces consistency between the generation $\mathbf { y }$ and the story ending $\mathbf { x } _ { r }$ ; (c) a 1-gram similarity constraint $( \mathrm { E q . } 5 )$ between the generation $\mathbf { y }$ and keywords (non-stopwords) in ${ \bf x } _ { r }$ (excluding those in $\mathbf { x } _ { l }$ ), i.e., $\mathrm { k w } ( \mathbf x _ { r } ) - \mathrm { k w } ( \mathbf x _ { l } )$ , which intuitively promotes a ‘smooth transition’ between $\mathbf x _ { l } , \mathbf y$ , and $\mathbf { x } _ { r }$ .
|
| 155 |
+
|
| 156 |
+
For the energy function in $\operatorname { E q . } ( 7 )$ , we select the constraint weights on the dev set. Throughout the experiments, we set the number of Langevin dynamics steps to $N = 2 0 0 0$ , with a step size $\eta = 0 . 1$ (Eq. 2). We discuss more details of the configurations in the appendix.
|
| 157 |
+
|
| 158 |
+
Baselines. We compare with previous decoding approaches for this task. In particular, we compare with DELOREAN $\lvert \boxed { \boxplus 5 } \rvert$ which outperformed a wide range of supervised and unsupervised methods on the abductive reasoning task in Qin et al. $\lVert \boldsymbol { \mathsf { 4 5 } } \rVert$ . Following Qin et al. $\lVert \boldsymbol { \mathsf { 4 5 } } \rVert$ , we also compare with a LEFT-ONLY method that generates the continuation of $\mathbf { x } _ { l }$ without considering the right-side ${ \bf x } _ { r }$ , i.e., $\mathbf { y } \sim p _ { \mathrm { L M } } ( \mathbf { y } | \mathbf { x } _ { l } )$ .
|
| 159 |
+
|
| 160 |
+
Evaluation. We perform both automatic and human evaluation. We adopt the standard automatic metrics on the task $\mathbb { M }$ that measure the minimal edit between the generated text and the humanwritten references on the test set, including BLEU $\mathbb { H O }$ , ROUGE $\pmb { \Vert 3 0 \Vert }$ , CIDEr $\mathbb { \left[ \left[ 5 1 \right] \right] }$ , and BERTScore $\left[ \left[ 5 8 \right] \right]$ . For the human evaluation, we follow $\overline { { \| \sharp \bar { \cdot } \| } }$ and let crowdworkers from Amazon Mechanical Turk rate the generations on 200 test examples. Workers were presented a pair of observations $\mathbf { \Delta x } _ { l }$ and ${ \bf x } _ { r }$ ) and a generated hypothesis $\mathbf { y }$ , and asked to rate the coherence of the hypothesis with respect to the observation $\mathbf { x } _ { l }$ (i.e., $\mathbf { x } _ { l } \mathbf { y }$ ), the observation ${ \bf x } _ { r }$ (i.e., $\mathbf { y } \mathbf { x } _ { r }$ ), and both (i.e., $\mathbf { x } _ { l } \mathbf { y } \mathbf { x } _ { r }$ ), as well as the grammaticality of the hypothesis $\mathbf { y }$ itself, on a 5-point Likert scale. The average ordinal Krippendorff alpha $0 \leq \alpha \leq 1$ ) $[ [ 2 5 ] ]$ is 0.36, indicating a fair inner-annotator agreement.
|
| 161 |
+
|
| 162 |
+
# 4.1.2 Results
|
| 163 |
+
|
| 164 |
+
Table $^ 1$ shows the evaluation results on the abductive reasoning task. Under automatic evaluation (the left panel), COLD consistently outperforms the previous best unsupervised decoding algorithm DELOREAN, as well as the LEFT-ONLY method, in terms of both the lexical overlap metrics (BLEU, ROUGE and CIDEr) and semantic similarity metric BERTScore. The human evaluation (the right panel) provide more fine-grained insights. COLD achieves the best overall coherence, meaning that the generated y from COLD fits best with both the left-side context $\mathbf { x } _ { l }$ and the right-side context ${ \bf x } _ { r }$ compared to the other methods. In contrast, DELOREAN excels only in terms of the left-side coherence (with $\mathbf { x } _ { l }$ ), with inferior right-coherence (with ${ \bf x } _ { r }$ ). We speculate this is because of DELOREAN’s complex interleaving of forward and backward decoding passes that make it difficult to balance the left- and right-coherence constraints. In terms of grammaticality, unsurprisingly, LEFT-ONLY obtains the best score as it ignores any other constraints (and fails this task with low coherence scores). More importantly, COLD achieves a high grammaticality score along with its high coherence, substantially improving over DELOREAN. Example generations in Appendix Table 7 show how COLD can reason with the right-hand context (e.g. ‘no heels’), while DELOREAN’s generations are contradictory (‘red shoes’ vs. ‘white pair’) or equivalent to those from LEFT-ONLY.
|
| 165 |
+
|
| 166 |
+
<table><tr><td rowspan="2">Models</td><td colspan="2">Min-Edit</td><td colspan="2">Coherence</td></tr><tr><td>Overlap</td><td>Human</td><td>BERTS.</td><td>Human</td></tr><tr><td>LEFT-ONLY</td><td>50.56</td><td>1.21</td><td>73.83</td><td>2.30</td></tr><tr><td>Mix-Match </td><td>85.07</td><td>1</td><td>65.20</td><td>1</td></tr><tr><td>Mix-MatchL 国</td><td>84.79</td><td>1</td><td>66.03</td><td>1</td></tr><tr><td>DELOREAN</td><td>52.90</td><td>1.81</td><td>73.66</td><td>1.92</td></tr><tr><td>COLD (ours)</td><td>56.84</td><td>1.82</td><td>73.47</td><td>2.12</td></tr></table>
|
| 167 |
+
|
| 168 |
+
Table 2: Automatic and human evaluation of counterfactual story rewriting. As a trivial method, LEFT-ONLY is coherent but fails on minimal-edit. COLD is superior to DELOREAN in terms of most metrics, including human evaluation.
|
| 169 |
+
|
| 170 |
+
<table><tr><td rowspan="2">Models</td><td colspan="2">Coverage</td><td colspan="2">Fluency</td></tr><tr><td>Count</td><td>Percent</td><td>PPL</td><td>Human</td></tr><tr><td>TSMH</td><td>2.72</td><td>71.27</td><td>1545.15</td><td>1.72</td></tr><tr><td>NEUROLOGIC</td><td>3.30</td><td>91.00</td><td>28.61</td><td>2.53</td></tr><tr><td>COLD (ours)</td><td>4.24</td><td>94.50</td><td>54.98</td><td>2.07</td></tr></table>
|
| 171 |
+
|
| 172 |
+
Table 3: Results of lexically constrained decoding $( \ S 4 . 3 )$ . For keyword coverage, we report both the average number and average percentage of constraint words present in the generated text. For language fluency, we use perplexity and human judgement.
|
| 173 |
+
|
| 174 |
+
# 4.2 Counterfactual Story Rewriting
|
| 175 |
+
|
| 176 |
+
Next, we consider counterfactual story rewriting $\pm \mathbb { H }$ . Given a story context $\mathbf { x } _ { l }$ with ending ${ \bf x } _ { r }$ , the task is to generate a new story ending y that is (i) similar to the original ending $\mathbf { x } _ { r }$ , yet (ii) consistent with a new story context $\mathbf { x } _ { l } ^ { \prime }$ (see Figure 1 for example). The task is challenging as it requires capturing the aspects of future events that are invariant under the new (counterfactual) context, while only making necessary edits for coherence.
|
| 177 |
+
|
| 178 |
+
# 4.2.1 The COLD Solution
|
| 179 |
+
|
| 180 |
+
To tackle this task, we use COLD with an energy composed of constraint functions that promote coherence with the new context $\mathbf { x } _ { l } ^ { \prime }$ , and minimal edits to the original ending ${ \bf x } _ { r }$ :
|
| 181 |
+
|
| 182 |
+
$$
|
| 183 |
+
\begin{array} { r } { E ( \tilde { \mathbf { y } } ) = \lambda _ { a } ^ { l r } f _ { \mathrm { L M } } ^ { \right. } ( \tilde { \mathbf { y } } ; \mathbf { x } _ { l } ^ { \prime } ) + \lambda _ { a } ^ { r l } f _ { \mathrm { L M } } ^ { \left. } ( \tilde { \mathbf { y } } ) + \lambda _ { b } f _ { \mathrm { s i m } } ( \tilde { \mathbf { y } } ; \mathbf { x } _ { r } ) . } \end{array}
|
| 184 |
+
$$
|
| 185 |
+
|
| 186 |
+
These constraints combine: (a) a soft fluency constraint $\left( \mathrm { E q . } \bigstar \bigstar \right)$ conditioned on $\mathbf { x } _ { l } ^ { \prime }$ to promote coherence between the generation $\mathbf { y }$ and the new (counterfactual) context $\mathbf { x } _ { l } ^ { \prime }$ ; a reverse LM constraint to improve fluency; (b) a $n$ -gram similarity constraint (Eq. 5, $n = \{ 2 , 3 \} ,$ ) to encourage generating an ending $\tilde { \mathbf { y } }$ that is close to the original ending ${ \bf x } _ { r }$ . We largely follow the configurations in $\ S 4 . 1$ with some exceptions described in the appendix.
|
| 187 |
+
|
| 188 |
+
Baselines. Similar to the setup in $\ S [ 4 . 1 ]$ we compare with DELOREAN $\lVert \rVert \bigstar \bigstar \rVert$ , a recent state-of-the-art decoding algorithm. As a reference, we also report the performance of a trivial solution, LEFT-ONLY, that generates a continuation of $\mathbf { x } _ { l } ^ { \prime }$ without considering the minimal edit constraint with the original ending ${ \bf x } _ { r }$ . Thus the method is expected to generate a coherent ending which however does not necessarily resemble the original ending. Finally, we compare with Mix-and-Match $\left[ \left[ 3 6 \right] \right]$ , a recent energy-based decoding method with discrete MCMC sampling, using BERT-base and BERT-Large.
|
| 189 |
+
|
| 190 |
+
Evaluation. We use the benchmark dataset TIMETRAVEL [44]. The original data contains three sentences in a story ending. Due to computation constraints, we use the first sentence as the original ending and generate a new single-sentence ending accordingly. Following [44, 45] we conduct both automatic and human evaluation. For automatic evaluation, we measure BERTScore $\mathbb { \left. \boldsymbol { \mathsf { \Sigma } } \boldsymbol { \mathsf { 8 } } \right. }$ , and Minimal Edit which computes the overlap of text edits (insertion, deletion, replacement, etc.) [49] needed to produce the gold ending $\mathbf { y } _ { * }$ and the generated ending y, starting from the original ending ${ \bf x } _ { r }$ . We do not use other common metrics such as BLEU since they were shown to be ineffective [44]. For human evaluation, each crowdworker is presented with the original story $\left( \mathbf { x } _ { l } , \mathbf { x } _ { r } \right)$ , the counterfactual condition $\mathbf { x } _ { l } ^ { \prime }$ , and the generated ending $\mathbf { y }$ , and the worker is asked to rate (1) the coherence of $\tilde { \mathbf { y } }$ with respect to $\mathbf { x } _ { l } ^ { \prime }$ and (2) the extent to which the generated ending y preserves the details of the original ending ${ \bf x } _ { r }$ (“minimal edit”), on a 3-point Likert scale for 200 test examples. The average ordinal Krippendorff alpha is 0.52, indicating a moderate inner-annotator agreement. We exclude Mix-and-Match from human evaluation given the significant performance gap in automated evaluation.
|
| 191 |
+
|
| 192 |
+
# 4.2.2 Results
|
| 193 |
+
|
| 194 |
+
Table $2$ shows the results of automatic and human evaluation in terms of both minimal-edit and coherence. As expected, the reference method LEFT-ONLY that completely ignores the minimal edit constraint can easily generate a new ending that is coherent with the new context $\mathbf { x } _ { l } ^ { \prime }$ . Compared to the baseline approach DELOREAN, our method COLD achieves overall superior performance, with substantially improved coherence score and comparable minimal-edit score by human evaluation. Mix-and-Match, based on discrete MCMC sampling, performs poorly. Intuitively, its discrete sampling tends to get stuck in a mode of the target distribution (i.e., the region surrounding the original story ending), and struggles to explore further to find samples of interest. COLD’s gradientbased sampling with continuous approximation leads to more efficient and effective exploration and mixing, as evidenced by samples that better meet the task requirements. See Appendix for examples.
|
| 195 |
+
|
| 196 |
+
# 4.3 Lexically Constrained Decoding
|
| 197 |
+
|
| 198 |
+
Next, we use COLD for lexically constrained decoding. Given a set of words $\mathcal { W }$ , the task aims to generate a coherent sentence that contains these words (Figure $^ { 1 ) }$ . The task is challenging as it requires proper planning to coherently include the constraint words.
|
| 199 |
+
|
| 200 |
+
# 4.3.1 The COLD Solution
|
| 201 |
+
|
| 202 |
+
We specify an energy function of the following form:
|
| 203 |
+
|
| 204 |
+
$$
|
| 205 |
+
E ( \tilde { \mathbf { y } } ) = \lambda _ { a } ^ { l r } f _ { \mathrm { L M } } ^ { \right. } ( \tilde { \mathbf { y } } ) + \lambda _ { a } ^ { r l } f _ { \mathrm { L M } } ^ { \left. } ( \tilde { \mathbf { y } } ) + \lambda _ { b } f _ { \mathrm { s i m } } ( \tilde { \mathbf { y } } ; \mathcal { W } ) + \lambda _ { c } f _ { \mathrm { p r e d } } ( \tilde { \mathbf { y } } ; c ( \mathcal { W } ) ) .
|
| 206 |
+
$$
|
| 207 |
+
|
| 208 |
+
Specifically, this energy function incorporates: (a) a soft fluency constraint $( \mathrm { E q } . 3 )$ and a reverse LM fluency constraint as in the previous tasks; $\mathbf { ( b ) }$ a 1-gram similarity constraint (Eq. 5) between the generation $\tilde { \mathbf { y } }$ and the given words $\mathcal { W }$ ; (c) a future-token prediction constraint, where we concatenate the constraint words (in an arbitrary order), denoted as $c ( \mathcal { W } )$ , and use it as the right-side content ${ \bf x } _ { r }$ in Eq. $( 4 )$ . Again we use similar configurations as in $\ S 4 . 1 .$ More details can be found in appendix.
|
| 209 |
+
|
| 210 |
+
Baselines. We compare with a recent state-of-the-art method NEUROLOGIC $\pmb { \mathbb { B 3 } }$ , a beam-search variant specifically designed for lexically constrained generation which outperformed many supervised and unsupervised approaches in Lu et al. $\mathbb { \left[ \left. 3 3 \right] \right. }$ . We also report the results of TSMH $\dot { \mathbb { B } } \dot { \mathbb { Z } } \dot { \mathbb { I } }$ as another recent baseline which uses Monte-Carlo Tree Search [5].
|
| 211 |
+
|
| 212 |
+
Evaluation. We use the set of constraint words from the COMMONGEN corpus $\mathbb { E 9 }$ , but adopt the canonical setting that the generated text must contain the exact constraint words (e.g., write) instead of their variants (e.g., wrote) [18, 47]. Following previous works [18, 47, 57], we report a measure of constraint words coverage as well as language fluency by evaluating the perplexity of the text . We also ask crowdworkers to rate the text fluency on a 3-point Likert scale on 200 test examples. The average ordinal Krippendorff alpha is 0.29, indicating a fair inner-annotator agreement.
|
| 213 |
+
|
| 214 |
+
# 4.3.2 Results
|
| 215 |
+
|
| 216 |
+
Table $\triangledown$ shows the evaluation results for the lexically constrained decoding task. COLD, a general constrained decoding method, is comparable to the state-of-the-art method NEUROLOGIC designed specifically for dealing with lexical constraints. In particular, COLD achieves a higher coverage of given keywords, at the expense of generating slightly less fluent language. COLD is also substantially better than lexically constrained decoding method TSMH in terms of both coverage and fluency.
|
| 217 |
+
|
| 218 |
+
# 4.4 Additional Analysis
|
| 219 |
+
|
| 220 |
+
Ablation studies. We ablate two important ingredients of our approach, namely the constraints and the top- $k$ filtering. Due to space limit, we report the results of constraints and defer the results of top- $k$ filtering to the appendix. Table $\textcircled{5}$ shows the human evaluation results for ablations of the constraints used on the abductive reasoning task $( \mathrm { E q . ~ } 7 )$ . The $n$ -gram similarity constraint $f _ { \mathrm { s i m } }$ provides the largest contribution to the overall coherence. The reverse LM fluency constraint $f _ { \mathrm { L M } } ^ { }$ also to some extent helps with the right-side coherence by conditioning on the right-side content ${ \bf x } _ { r }$ . Removing the future-token prediction constraint similarly causes inferior scores in terms of right-side and
|
| 221 |
+
|
| 222 |
+
<table><tr><td>Models</td><td>Gra- mmar</td><td>Left- coher. (x-y)</td><td>Right- coher. (y-z)</td><td>Overall- coher. (x-y-z)</td></tr><tr><td>COLD (Full)</td><td>4.17</td><td>3.96</td><td>2.88</td><td>2.83</td></tr><tr><td>COLD -fsim</td><td>4.54</td><td>3.82</td><td>2.73</td><td>2.69</td></tr><tr><td>COLD -fim</td><td>4.35</td><td>3.97</td><td>2.84</td><td>2.80</td></tr><tr><td>COLD -fpred</td><td>4.61</td><td>4.07</td><td>2.75</td><td>2.77</td></tr></table>
|
| 223 |
+
|
| 224 |
+
Table 4: Ablation for the effect of different constraints in $\operatorname { E q . } ( 7 )$ . We do human evaluation on 125 test examples. The best overall coherence is achieved when all the constraints are present.
|
| 225 |
+
|
| 226 |
+
overall coherence, as expected. Removing the individual constraints leads to better grammaticality due to less competition among different constraints, at the cost of coherence. Our uniform treatment of all constraints as energy terms makes it straightforward to balance the different constraints by controlling the constraint weights.
|
| 227 |
+
|
| 228 |
+
Efficiency of COLD. We report the average runtime of generating one sample on the Counterfactual Story Rewriting data. The table below shows the results (on an NVIDIA Quadro GV100 GPU, batch size ${ \ = } 3 2$ ). We compare with Mix-and-Match $\pmb { \mathbb { B } } \pmb { \ 6 } \|$ , a recent energy-based decoding method with discrete MCMC sampling (Metropolis-Hastings, in particular). COLD, which uses gradient-based sampling, is faster than the gradient-free Mix-and-Match: COLD is $30 \%$ faster with base LMs of similar sizes (GPT2-M and BERTLarge), and has roughly the
|
| 229 |
+
|
| 230 |
+
<table><tr><td>Method</td><td>Runtime (s)</td></tr><tr><td>COLD (GPT2-XL,1.5B)</td><td>33.6</td></tr><tr><td>COLD (GPT2-M,355M)</td><td>22.7</td></tr><tr><td>Mix-and-Match (BERTLarge, 340M)</td><td>33.5</td></tr></table>
|
| 231 |
+
|
| 232 |
+
Table 5: COLD is more efficient than gradient-free Mix-and-Match $\left[ \left[ 3 6 \right] \right]$ . The runtime shown is seconds per sample on Counterfactual Story Rewriting.
|
| 233 |
+
|
| 234 |
+
same time cost when using a much larger LM (GPT2-XL).
|
| 235 |
+
|
| 236 |
+
# 5 Related Work
|
| 237 |
+
|
| 238 |
+
Previous works proposed beam search variants for lexically constrained decoding $\boxed { 1 8 } \boxed { 4 2 } \boxed { 3 3 }$ which enforce constraints in a discrete space. Recent works consider constraint satisfaction by adjusting vocabulary distributions using an additional discriminator or LM [6, 24, 56]. Differing from those approaches that determine the generation token by token auto-regressively, Qin et al. $[ \bar { 1 4 5 } ]$ optimize the whole (soft) token sequence via gradient propagation, which facilitates sequence-level semantic constraints (e.g., right-coherence, minimal-edits). COLD also samples complete sequences, while offering a principled and unified formulation based on energy-based modeling. Kumar et al. $\pmb { \left. 2 6 \right. }$ extend $\bar { \lfloor 1 7 \rfloor }$ by imposing constraints with a Lagrangian method and optimizing for a single output with gradient descent. In contrast, our approach based on energy-based sampling $( \ S 3 . 1 )$ allows for generating samples for other utilities (e.g., rank-and-select $\ S 3 . { \bar { 4 } } , \quad$ estimating expectations). We also introduce components for more fluent generations such as the novel discretization procedure. Also, on the empirical side, we explore a different class of problems and tackle them in the absence of labeled data. The recent CGMH $\overline { { \mathbb { B } 5 } }$ and TSMH $ { \mathbb { B } } ^ { { 7 } { \mathbb { I } } }$ , followed by [36, 14], perform constrained decoding with extended Gibbs sampling or Metropolis-Hastings sampling in the discrete text space. Our energy-based formulation with gradient-based Langevin dynamics sampling produces substantially better results than the discrete TSMH $( \ S 4 . 3 )$ . Sha $\dot { \mathbb { B } } \dot { \mathbf { 7 } } \dot { \mathbb { I } }$ uses gradient information to guide generation, which, however, is specifically designed for lexically constrained generation.
|
| 239 |
+
|
| 240 |
+
Energy-based models (EBMs) have been used for incorporating additional information to train text generation models [7, 23, 41, 21]. In contrast, we focus on the constrained decoding (inference) that can be directly applied to pretrained LMs without fine-tuning. Langevin dynamics is widely used on EBMs of modalities with continuous values, like images [48, 9, 59], 3D shapes $ { \Vert 5 5 \Vert }$ , latent features $\mathbb { \lVert 3 9 \rVert }$ , and audio sequences $\lVert 2 2 \rVert$ . To our knowledge, we are the first to apply Langevin dynamics for (constrained) discrete text generation (with a continuous approximation) for efficient sampling.
|
| 241 |
+
|
| 242 |
+
# 6 Conclusion
|
| 243 |
+
|
| 244 |
+
We introduce COLD decoding, an energy-based constrained text generation framework that can express various soft/hard constraints through an energy function, and sample using Langevin dynamics. COLD can be applied directly to off-the-shelf LMs without task-specific fine-tuning. We showcase its flexibility and strong performance on three distinct applications of constrained text generation.
|
| 245 |
+
|
| 246 |
+
# Acknowledgements
|
| 247 |
+
|
| 248 |
+
This work was funded in part by the Natural Sciences and Engineering Research Council of Canada (NSERC) (funding reference number 401233309), DARPA MCS program through NIWC Pacific (N66001-19-2-4031), the Allen Institute for AI, and Microsoft Research PhD Fellowship. We thank the XLab research group, and our anonymous reviewers for their feedback on this work. We also acknowledge the Beaker team (https://beaker.org) for their support with experiments.
|
| 249 |
+
|
| 250 |
+
References
|
| 251 |
+
[1] C. Bhagavatula, R. Le Bras, C. Malaviya, K. Sakaguchi, A. Holtzman, H. Rashkin, D. Downey, W.-t. Yih, and Y. Choi. Abductive commonsense reasoning. In International Conference on Learning Representations (ICLR), 2019. URL https://openreview.net/forum?id=Byg1v1HKDB.
|
| 252 |
+
[2] C. M. Bishop and N. M. Nasrabadi. Pattern recognition and machine learning, volume 4. Springer, 2006.
|
| 253 |
+
[3] T. B. Brown, B. Mann, N. Ryder, M. Subbiah, J. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, S. Agarwal, and et al. Language models are few-shot learners. In Advances in Neural Information Processing Systems (NourIPS), 2020. URL https://papers.nips.cc/paper/2020/hash/ 1457c0d6bfcb4967418bfb8ac142f64a-Abstract.html.
|
| 254 |
+
[4] M. Chen, J. Tworek, H. Jun, Q. Yuan, H. P. de Oliveira Pinto, J. Kaplan, H. Edwards, Y. Burda, N. Joseph, G. Brockman, A. Ray, R. Puri, G. Krueger, and M. P. et al. Evaluating large language models trained on code, 2021. URL https://arxiv.org/abs/2107.03374.
|
| 255 |
+
[5] R. Coulom. Efficient selectivity and backup operators in monte-carlo tree search. In International Conference on Computers and Games (ICCG), pages 72–83. Springer, 2006. URL https://hal. inria.fr/file/index/docid/116992/filename/CG2006.pdf.
|
| 256 |
+
[6] S. Dathathri, A. Madotto, J. Lan, J. Hung, E. Frank, P. Molino, J. Yosinski, and R. Liu. Plug and play language models: A simple approach to controlled text generation. In International Conference on Learning Representations (ICLR), 2019. URL https://openreview.net/forum?id=H1edEyBKDS.
|
| 257 |
+
[7] Y. Deng, A. Bakhtin, M. Ott, A. Szlam, and M. Ranzato. Residual energy-based models for text generation. In International Conference on Learning Representations, 2020. URL https://openreview.net/ forum?id=B1l4SgHKDH.
|
| 258 |
+
[8] C. Donahue, M. Lee, and P. Liang. Enabling language models to fill in the blanks. In Annual Meeting of the Association for Computational Linguistics (ACL), 2020. URL https://aclanthology.org/ 2020.acl-main.225/
|
| 259 |
+
[9] Y. Du and I. Mordatch. Implicit generation and modeling with energy based models. Advances in Neural Information Processing Systems (NourIPS), 32, 2019. URL https://papers.nips.cc/paper/ 2019/hash/378a063b8fdb1db941e34f4bde584c7d-Abstract.html.
|
| 260 |
+
[10] D. Duvenaud, J. Kelly, K. Swersky, M. Hashemi, M. Norouzi, and W. Grathwohl. No MCMC for me: Amortized samplers for fast and stable training of energy-based models. In International Conference on Learning Representations (ICLR), 2021. URL https://openreview.net/forum?id=ixpSxO9flk3.
|
| 261 |
+
[11] B. Eikema and W. Aziz. Sampling-based minimum bayes risk decoding for neural machine translation, 2021. URL https://arxiv.org/abs/2108.04718.
|
| 262 |
+
[12] A. Fan, M. Lewis, and Y. Dauphin. Hierarchical neural story generation. In Annual Meeting of the Association for Computational Linguistics (ACL), pages 889–898, 2018. URL https://aclanthology. org/P18-1082.pdf.
|
| 263 |
+
[13] N. Goodman. The problem of counterfactual conditionals. The Journal of Philosophy, 44(5):113– 128, 1947. URL https://www.pdcnet.org/jphil/content/jphil_1947_0044_0005_ 0113_0128.
|
| 264 |
+
[14] K. Goyal, C. Dyer, and T. Berg-Kirkpatrick. Exposing the implicit energy networks behind masked language models via metropolis–hastings. arXiv preprint arXiv:2106.02736, 2021.
|
| 265 |
+
[15] K. Guu, T. B. Hashimoto, Y. Oren, and P. Liang. Generating sentences by editing prototypes. Transactions of the Association for Computational Linguistics (TACL), 6:437–450, 2018. URL https: //aclanthology.org/Q18-1031.pdf.
|
| 266 |
+
[16] G. E. Hinton. Training products of experts by minimizing contrastive divergence. Neural Computation, 2002. URL https://www.cs.toronto.edu/\~hinton/absps/tr00-004.pdf.
|
| 267 |
+
[17] C. D. V. Hoang, G. Haffari, and T. Cohn. Towards decoding as continuous optimisation in neural machine translation. In Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 146–156, 2017. URL https://aclanthology.org/D17-1014/.
|
| 268 |
+
[18] C. Hokamp and Q. Liu. Lexically constrained decoding for sequence generation using grid beam search. In Annual Meeting of the Association for Computational Linguistics (ACL), pages 1535–1546, 2017. URL https://aclanthology.org/P17-1141.pdf.
|
| 269 |
+
[19] A. Holtzman, J. Buys, L. Du, M. Forbes, and Y. Choi. The curious case of neural text degeneration. In International Conference on Learning Representations, 2019. URL https://openreview.net/ forum?id=rygGQyrFvH.
|
| 270 |
+
[20] Z. Hu, Z. Yang, X. Liang, R. Salakhutdinov, and E. P. Xing. Toward controlled generation of text. In International Conference on Machine Learning (ICML), pages 1587–1596, 2017. URL http:// proceedings.mlr.press/v70/hu17e/hu17e.pdf.
|
| 271 |
+
[21] Z. Hu, Z. Yang, R. R. Salakhutdinov, L. Qin, X. Liang, H. Dong, and E. P. Xing. Deep generative models with learnable knowledge constraints. Advances in Neural Information Processing Systems, 31, 2018.
|
| 272 |
+
[22] V. Jayaram and J. Thickstun. Parallel and flexible sampling from autoregressive models via Langevin dynamics. In International Conference on Machine Learning (ICML), pages 4807–4818. PMLR, 2021. URL https://proceedings.mlr.press/v139/jayaram21b.html.
|
| 273 |
+
[23] M. Khalifa, H. Elsahar, and M. Dymetman. A distributional approach to controlled text generation. In International Conference on Learning Representations, 2020.
|
| 274 |
+
[24] B. Krause, A. D. Gotmare, B. McCann, N. S. Keskar, S. Joty, R. Socher, and N. F. Rajani. GeDi: Generative discriminator guided sequence generation. In Conference on Empirical Methods in Natural Language Processing (EMNLP) - Findings, pages 4929–4952, 2021. URL https://aclanthology.org/ 2021.findings-emnlp.424/.
|
| 275 |
+
[25] K. Krippendorff. Computing krippendorff’s alpha reliability. Departmental papers (ASC), page 43, 2007. URL https://repository.upenn.edu/asc_papers/43/.
|
| 276 |
+
[26] S. Kumar, E. Malmi, A. Severyn, and Y. Tsvetkov. Controlled text generation as continuous optimization with multiple constraints. Advances in Neural Information Processing Systems (NourIPS), 34, 2021. URL https://openreview.net/forum?id=kTy7bbm-4I4.
|
| 277 |
+
[27] Y. LeCun, S. Chopra, R. Hadsell, M. Ranzato, and F. J. Huang. A Tutorial on Energy-Based Learning. Predicting Structured Data, 2006. ISSN <null>. doi: 10.1198/tech.2008.s913. URL http://yann. lecun.com/exdb/publis/pdf/lecun-06.pdf.
|
| 278 |
+
[28] A. Lee, M. Auli, and M. Ranzato. Discriminative reranking for neural machine translation. In Annual Meeting of the Association for Computational Linguistics (ACL), pages 7250–7264, Online, Aug. 2021. URL https://aclanthology.org/2021.acl-long.563.
|
| 279 |
+
[29] B. Y. Lin, W. Zhou, M. Shen, P. Zhou, C. Bhagavatula, Y. Choi, and X. Ren. CommonGen: A constrained text generation challenge for generative commonsense reasoning. In Conference on Empirical Methods in Natural Language Processing (EMNLP) - Findings, 2020. URL https://aclanthology.org/ 2020.findings-emnlp.165.pdf.
|
| 280 |
+
[30] C.-Y. Lin. Rouge: A package for automatic evaluation of summaries. In Text summarization branches out, pages 74–81, 2004. URL https://aclanthology.org/W04-1013.pdf.
|
| 281 |
+
[31] S. Lin, W. Wang, Z. Yang, X. Liang, F. F. Xu, E. Xing, and Z. Hu. Record-to-text generation with style imitation. In Conference on Empirical Methods in Natural Language Processing (EMNLP) - Findings, pages 1589–1598, 2020. URL https://aclanthology.org/2020.findings-emnlp.144. pdf.
|
| 282 |
+
[32] G. Liu, Z. Yang, T. Tao, X. Liang, Z. Li, B. Zhou, S. Cui, and Z. Hu. Don’t take it literally: An edit-invariant sequence loss for text generation. arXiv preprint arXiv:2106.15078, 2021. URL https: //arxiv.org/abs/2106.15078.
|
| 283 |
+
[33] X. Lu, P. West, R. Zellers, R. Le Bras, C. Bhagavatula, and Y. Choi. Neurologic decoding:(un) supervised neural text generation with predicate logic constraints. In Conference of the North American Chapter of the Association for Computational Linguistics (NAACL), pages 4288–4299, 2021. URL https: //aclanthology.org/2021.naacl-main.339.pdf.
|
| 284 |
+
[34] Y.-A. Ma, Y. Chen, C. Jin, N. Flammarion, and M. I. Jordan. Sampling can be faster than optimization. Proceedings of the National Academy of Sciences (PNAS), 116(42):20881–20885, 2019. URL https: //www.pnas.org/content/116/42/20881.
|
| 285 |
+
[35] N. Miao, H. Zhou, L. Mou, R. Yan, and L. Li. CGMH: Constrained sentence generation by metropolishastings sampling. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 6834–6842, 2019.
|
| 286 |
+
|
| 287 |
+
[36] F. Mireshghallah, K. Goyal, and T. Berg-Kirkpatrick. Mix and match: Learning-free controllable text generation using energy language models. arXiv preprint arXiv:2203.13299, 2022.
|
| 288 |
+
|
| 289 |
+
[37] R. M. Neal et al. MCMC using hamiltonian dynamics. Handbook of markov chain monte carlo, 2(11):2, 2011. URL https://arxiv.org/abs/1206.1901.
|
| 290 |
+
|
| 291 |
+
[38] E. Nijkamp, M. Hill, T. Han, S.-C. Zhu, and Y. N. Wu. On the anatomy of MCMC-based maximum likelihood learning of energy-based models. In Conference on Artificial Intelligence (AAAI), volume 34, pages 5272–5280, 2020. URL https://ojs.aaai.org/index.php/AAAI/article/view/ 5973.
|
| 292 |
+
|
| 293 |
+
[39] B. Pang, T. Han, E. Nijkamp, S.-C. Zhu, and Y. N. Wu. Learning latent space energy-based prior model. Advances in Neural Information Processing Systems, 33:21994–22008, 2020.
|
| 294 |
+
|
| 295 |
+
[40] K. Papineni, S. Roukos, T. Ward, and W.-J. Zhu. Bleu: a method for automatic evaluation of machine translation. In Annual Meeting of the Association for Computational Linguistics (ACL), pages 311–318, 2002. URL https://aclanthology.org/P02-1040.pdf.
|
| 296 |
+
|
| 297 |
+
[41] T. Parshakova, J.-M. Andreoli, and M. Dymetman. Global autoregressive models for data-efficient sequence learning. In Proceedings of the 23rd Conference on Computational Natural Language Learning (CoNLL), pages 900–909, 2019.
|
| 298 |
+
|
| 299 |
+
[42] D. Pascual, B. Egressy, F. Bolli, and R. Wattenhofer. Directed beam search: Plug-and-play lexically constrained language generation. arXiv preprint arXiv:2012.15416, 2020. URL https://arxiv. org/abs/2012.15416.
|
| 300 |
+
|
| 301 |
+
[43] C. S. Peirce. Collected papers of charles sanders peirce, volume 2. Harvard University Press, 1974. URL https://www.hup.harvard.edu/catalog.php?isbn $\overline { { = } }$ 9780674138001.
|
| 302 |
+
|
| 303 |
+
[44] L. Qin, A. Bosselut, A. Holtzman, C. Bhagavatula, E. Clark, and Y. Choi. Counterfactual story reasoning and generation. In Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 5043–5053, 2019. URL https://aclanthology.org/D19-1509.pdf.
|
| 304 |
+
|
| 305 |
+
[45] L. Qin, V. Shwartz, P. West, C. Bhagavatula, J. Hwang, R. L. Bras, A. Bosselut, and Y. Choi. Back to the future: Unsupervised backprop-based decoding for counterfactual and abductive commonsense reasoning. In Conference on Empirical Methods in Natural Language Processing (EMNLP), 2020. URL https://aclanthology.org/2020.emnlp-main.58.
|
| 306 |
+
|
| 307 |
+
[46] A. Radford, J. Wu, R. Child, D. Luan, D. Amodei, I. Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019. URL https://openai.com/blog/ better-language-models/.
|
| 308 |
+
|
| 309 |
+
[47] L. Sha. Gradient-guided unsupervised lexically constrained text generation. In Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 8692–8703, 2020. URL https: //aclanthology.org/2020.emnlp-main.701.pdf.
|
| 310 |
+
|
| 311 |
+
[48] Y. Song and S. Ermon. Generative modeling by estimating gradients of the data distribution. Advances in Neural Information Processing Systems (NourIPS), 32, 2019. URL https://proceedings. neurips.cc/paper/2019/hash/3001ef257407d5a371a96dcd947c7d93-Abstract. html.
|
| 312 |
+
|
| 313 |
+
[49] M. Šošic and M. ´ Šikic. Edlib: a´ $\mathrm { c / c } { + + }$ library for fast, exact sequence alignment using edit distance. Bioinformatics, 33(9):1394–1395, 2017. URL https://pubmed.ncbi.nlm.nih.gov/28453688/.
|
| 314 |
+
|
| 315 |
+
[50] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems (NourIPS), 2017. URL https://proceedings.neurips.cc/paper/2017/hash/ 3f5ee243547dee91fbd053c1c4a845aa-Abstract.html.
|
| 316 |
+
|
| 317 |
+
[51] R. Vedantam, C. Lawrence Zitnick, and D. Parikh. Cider: Consensus-based image description evaluation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 4566–4575, 2015. URL https://arxiv.org/abs/1411.5726.
|
| 318 |
+
|
| 319 |
+
[52] S. Welleck, J. Liu, J. M. Han, and Y. Choi. Towards grounded natural language proof generation. MathAI4Ed Workshop at NeurIPS, 2021. URL https://mathai4ed.github.io/papers/ papers/paper_10.pdf.
|
| 320 |
+
|
| 321 |
+
[53] M. Welling and Y. W. Teh. Bayesian learning via stochastic gradient langevin dynamics. In International Conference on Machine Learning (ICML), pages 681–688, 2011. URL https://icml.cc/2011/ papers/398_icmlpaper.pdf.
|
| 322 |
+
|
| 323 |
+
[54] P. West, X. Lu, A. Holtzman, C. Bhagavatula, J. D. Hwang, and Y. Choi. Reflective decoding: Beyond unidirectional generation with off-the-shelf language models. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 1435–1450, Online, Aug. 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.114. URL https://aclanthology. org/2021.acl-long.114.
|
| 324 |
+
|
| 325 |
+
[55] J. Xie, Y. Xu, Z. Zheng, S.-C. Zhu, and Y. N. Wu. Generative pointnet: Deep energy-based learning on unordered point sets for 3D generation, reconstruction and classification. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 14976–14985, 2021.
|
| 326 |
+
|
| 327 |
+
[56] K. Yang and D. Klein. FUDGE: Controlled text generation with future discriminators. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 3511–3535, Online, June 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.naacl-main.276. URL https://aclanthology.org/2021. naacl-main.276.
|
| 328 |
+
|
| 329 |
+
[57] M. Zhang, N. Jiang, L. Li, and Y. Xue. Language generation via combinatorial constraint satisfaction: A tree search enhanced monte-carlo approach. In Learning Meets Combinatorial Algorithms at NeurIPS2020, 2020. URL https://openreview.net/forum?id=TZPfhZunXOb.
|
| 330 |
+
|
| 331 |
+
[58] T. Zhang, V. Kishore, F. Wu, K. Q. Weinberger, and Y. Artzi. Bertscore: Evaluating text generation with bert. In International Conference on Learning Representations (ICLR), 2019. URL https: //openreview.net/forum?id=SkeHuCVFDr.
|
| 332 |
+
|
| 333 |
+
[59] Y. Zhao, J. Xie, and P. Li. Learning energy-based generative models via coarse-to-fine expanding and sampling. In International Conference on Learning Representations, 2021.
|
| 334 |
+
|
| 335 |
+
[60] W. Zhu, Z. Hu, and E. Xing. Text infilling. arXiv preprint arXiv:1901.00158, 2019. URL https: //arxiv.org/abs/1901.00158.
|
md/dev/UERcQuXlwy/UERcQuXlwy.md
ADDED
|
@@ -0,0 +1,390 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PIX2STRUCT: SCREENSHOT PARSING AS PRETRAINING FOR VISUAL LANGUAGE UNDERSTANDING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Visually-situated language is ubiquitous—sources range from textbooks with diagrams to web pages with images and tables, to mobile apps with buttons and forms. Perhaps due to this diversity, previous work has typically relied on domainspecific recipes with limited sharing of the underlying data, model architectures, and objectives. We present Pix2Struct, a pretrained image-to-text model for purely visual language understanding, which can be finetuned on tasks containing visually-situated language. Pix2Struct is pretrained by learning to parse masked screenshots of web pages into simplified HTML. The web, with its richness of visual elements cleanly reflected in the HTML structure, provides a large source of pretraining data well suited to the diversity of downstream tasks. Intuitively, this objective subsumes common pretraining signals such as OCR, language modeling, image captioning. In addition to the novel pretraining strategy, we introduce a variable-resolution input representation and a more flexible integration of language and vision inputs, where language prompts such as questions are rendered directly on top of the input image. For the first time, we show that a single pretrained model can achieve state-of-the-art results in six out of nine tasks across four domains: documents, illustrations, user interfaces, and natural images.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Research on the interaction between language and vision has traditionally focused on tasks where images and text can be separated into distinct channels, e.g. visual question answering or image captioning. However, visually-situated language is a far more pervasive way in which these modalities interact and blend together. For example, documents, tables, infographics, and user interfaces (UIs) are intended to be consumed holistically, without clear boundaries between textual and visual elements (Figure 1). Comprehensive understanding of this information requires a deep set of skills, including the ability to recognize text, understand language, and incorporate diverse visual context.
|
| 12 |
+
|
| 13 |
+
Previous work on understanding visually-situated language is scattered. The focus is typically on complex task-specific combinations of available inputs and tools. For example, documentunderstanding models (Huang et al., 2022) rely on external OCR systems, UI-understanding models rely on platform-specific structural metadata (e.g. Android view hierarchy) (Bai et al., 2021), and diagram-understanding models rely on diagram parses (Kembhavi et al., 2016). Domain-specific engineering can be effective for high-resource settings such as documents, where there is an abundance of tools and data available. However, these pipelined models lack sharing of the underlying data, model architectures, and objectives across domains, limiting their general applicability. Moreover, relying on external systems like OCR increases engineering complexity, limits adaptability, and can increase overall computational cost. Recent work on OCR-free, end-to-end document understanding from images (Kim et al., 2022; Davis et al., 2022) has attempted to remove such task-specific engineering and reliance on external components during inference by learning to decode OCR outputs during pretraining—a significant step towards more general-purpose models. However, the focus on just text at the surface level limits the depth of knowledge transferred from unsupervised data. Effective use of pixel-only models remains an open challenge.
|
| 14 |
+
|
| 15 |
+
We present Pix2Struct, a pretrained model that combines the simplicity of purely pixel-level inputs with the generality and scalability provided by self-supervised pretraining from diverse and abundant web data. Specifically, we propose a screenshot parsing objective that requires predicting an HTML-based parse from a masked screenshot of a web page. HTML provides clean, vital signals about text, images, and layouts, while the masked inputs encourage joint reasoning about their cooccurrence. With the diversity and complexity of textual and visual elements found on the web, Pix2Struct learns rich representations of the underlying structure of web pages, which we show can effectively transfer to a variety of downstream visual language understanding tasks.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Examples of visually-situated language understanding tasks, including diagram QA (AI2D), app captioning (Screen2Words), and document QA (DocVQA). We also include an example of our proposed pretraining task (screenshot parsing) on the left. Pix2Struct directly encodes the pixels from the input image (above) and decodes the output text (below).
|
| 19 |
+
|
| 20 |
+
A key ingredient which enables this transfer is processing inputs visually and holistically as they are intended for human readers. We introduce variable-resolution inputs for vision transformers that prevent distortion of the original aspect ratio, which can vary greatly across documents, figures, and UIs. During finetuning, we render other inputs (e.g., questions in VQA and bounding boxes in UI tasks) onto the image input for the task. In effect, we consume all our inputs though a single modality, simplifying the modality combination problem in previous work.
|
| 21 |
+
|
| 22 |
+
We train two variants with 282M and 1.3B parameters, which we refer to as Pix2Struct-Base and Pix2Struct-Large respectively, on 80M screenshots of web pages from the C4 corpus (Raffel et al., 2020). Experiments on four domains and nine tasks show that our finetuned models strongly outperform Donut (ranging from 9 to 53 points), the strongest existing baseline without pipelines. Compared with baselines with domain-specific pipelines, we lag behind the state of the art in highresource domains such as documents and natural images, but we observe significant improvements (ranging from 1 to 44 points) in low-resource domains such as illustrations and UIs. We hope that these results encourage the community to continue developing such general-purpose methods and further enable new applications in this currently fragmented intersection of language and vision.
|
| 23 |
+
|
| 24 |
+
To summarize, our major contributions are as follows:
|
| 25 |
+
|
| 26 |
+
• We introduce the area of general-purpose visually-situated language understanding, which consists of diverse tasks but common challenges.
|
| 27 |
+
• We propose a screenshot parsing pretraining objective based on the HTML source of web pages. We show that our objective is more effective than previous attempts at enabling the elegant pixel-to-text design for general-purpose visually-situated language understanding.
|
| 28 |
+
• We introduce variable-resolution input representations to the Vision Transformer and new finetuning strategies that seamlessly integrate language and vision inputs by directly rendering any language prompts on top of the input image.
|
| 29 |
+
• The pretrained checkpoints and code for reproducing results for all nine tasks are available at https://github.com/anonymized/pix2struct.
|
| 30 |
+
|
| 31 |
+
# 2 METHOD
|
| 32 |
+
|
| 33 |
+
# 2.1 BACKGROUND
|
| 34 |
+
|
| 35 |
+
Prior attempts at pixel-only modeling of visually situated language have largely focused on documents and natural images. For documents, Donut (Kim et al., 2022) and Dessurt (Davis et al., 2022) combine pretrained objectives based on surface-level features from synthetic images or predicted OCR outputs. For natural images, concurrent work—GIT2 (Wang et al., 2022a) and PaLI (Chen et al., 2022b)—focus on collecting and training on large scale image captioning data that transfers well to datasets with natural images (e.g. TextCaps).
|
| 36 |
+
|
| 37 |
+
We aim to provide a single pretrained model that can be finetuned on a wider variety of tasks and domains. The input to our model is an image in the form of raw pixels only, and the output of our model is text in the form of token sequences, similar to Donut. The goal is a visual analog of models like T5 (Raffel et al., 2020), where the generality of simple inputs and outputs is combined with the power of pretraining on large unsupervised sources of data. During finetuning, the complexity of adapting to diverse downstream tasks resides only in data preprocessing.
|
| 38 |
+
|
| 39 |
+
Even without visual context, pixel-only language modeling for text has only recently been attempted (Rust et al., 2022)—perhaps because it requires solving multiple hard sub-problems. First, the ability to read with high fidelity while at the same time building rich high-level representations poses a difficult optimization problem. Second, encoding text-heavy inputs (e.g. long documents) involves processing high-resolution images with variable aspect ratios. State-of-the-art document understanding models (Huang et al., 2022) therefore rely on the combination of (possibly noisy) OCR outputs with low resolution images. We argue that the reliance on OCR has prevented exploration of learning more general-purpose representations that meaningfully extend beyond the text.
|
| 40 |
+
|
| 41 |
+
We show the various components of Pix2Struct that address these challenges. Section 2.2 discusses modifications to the transformer inputs to handle variable aspect ratios and resolutions. We then discuss our proposed screenshot parsing objective (Section 2.3) and how curriculum learning leads to more robust transfer learning (Section 2.4). Finally, Section 2.5 shows how Pix2Struct consumes textual and visual inputs (e.g. questions and images) in the same space by rendering text inputs onto images during finetuning.
|
| 42 |
+
|
| 43 |
+
# 2.2 ARCHITECTURE
|
| 44 |
+
|
| 45 |
+
Pix2Struct is an image-encoder-text-decoder based on the Vision Transformer (ViT) (Dosovitskiy et al., 2021). While the bulk of the model is fairly standard, we propose one small but impactful change to the input representation to make Pix2Struct more robust to various forms of visuallysituated language. Before extracting fixed-size patches, the standard ViT scales the input images to a predefined resolution, which creates two undesirable effects: (1) rescaling the image distorts the true aspect ratio, which can be highly variable for documents, mobile UIs, and figures. (2) transferring these models to downstream tasks with higher resolution is non-trivial (Touvron et al., 2019; Wang et al., 2021b), since the model only observes one specific resolution during pretraining.
|
| 46 |
+
|
| 47 |
+
We instead propose to always scale our input image up or down such that we extract the maximal number of patches that fit within the given sequence length (see Figure 5 in Appendix B). In order for the model to handle variable resolutions unambiguously, we use 2-dimensional absolute positional embeddings for the input patches. Together these changes to the standard ViT inputs provide two major advantages in terms of robustness to: (1) extreme aspect ratios, which is common in the domains that we experiment with, and (2) on-the-fly changes to the sequence length and resolution.
|
| 48 |
+
|
| 49 |
+
# 2.3 PRETRAINING
|
| 50 |
+
|
| 51 |
+
The goal of pretraining is for Pix2Struct to represent the underlying structure of the input image. To that end, we create self-supervised pairs of input images and target text from a web corpus. For each web page in the pretraining corpus, we start by collecting its screenshot and HTML source.
|
| 52 |
+
|
| 53 |
+
Screenshot parsing inputs $\pmb { \& }$ outputs The screenshot and HTML are modified to ensure rich and dense learning signal during pretraining. These modifications provide a reasonable trade-off between preserving the semantics of the page and requiring a practical decoder sequence length.
|
| 54 |
+
|
| 55 |
+

|
| 56 |
+
Figure 2: Toy illustration of input-output pairs (right) sampled from the original web page (left).
|
| 57 |
+
|
| 58 |
+
We condense the HTML DOM tree by (1) only keeping nodes with visible elements or descendants with visible elements and (2) if a node does not contain visible elements and it only has a single child, replacing the singleton child with any grandchildren to remove chained nesting. In each node, we only keep information about text and images, as represented by their filename and any alternative text. Much more information could be retained, such as element tags, style, bounding boxes, titles and URLs etc in future work. The decoder sequence length is further reduced by finding the largest subtree that fits within a predefined sequence length when linearized. A bounding box indicating the region covered by the chosen subtree is also drawn on the screenshot.
|
| 59 |
+
|
| 60 |
+
For better context modeling, we introduce a BART-like (Lewis et al., 2020) learning signal by masking $50 \%$ of the text while decoding the entire subtree. The masked regions are randomly sampled spans of text from the chosen subtree where we draw crossed-out opaque bounding boxes (Figure 2).
|
| 61 |
+
|
| 62 |
+
Comparison to existing pretraining strategies Our proposed screenshot parsing seamlessly integrates signals reminiscent of several well-known pretraining strategies:
|
| 63 |
+
|
| 64 |
+
• Recovering the unmasked parts of the parse is similar to OCR, a prerequisite skill for understanding language. OCR pretraining was proposed in Donut which uses synthetic renderings or predicted OCR outputs. In Figure 2, predicting ${ < } \mathsf { C } + + \mathsf { > }$ exemplifies this learning signal. • Recovering the masked parts of the parse is much like masked language modeling (Devlin et al., 2019). A major difference is that the visual context often provides additional cues useful for sharpening the predictions. In Figure 2, predicting <Python> exemplifies this learning signal. • Recovering the alt-text from images is a common pretraining strategy for image captioning (Sharma et al., 2018; Wang et al., $2 0 2 2 \mathrm { a }$ ; Chen et al., 2022b). A major difference is that the model is permitted to use the web page as additional context. In Figure 2, predicting img alt ${ \bf \mathrm { = } } \mathrm { C } + +$ exemplifies this learning signal.
|
| 65 |
+
|
| 66 |
+
Appendix F contains more examples of screenshots paired with their gold and predicted parses.
|
| 67 |
+
|
| 68 |
+
# 2.4 WARMING UP WITH A READING CURRICULUM
|
| 69 |
+
|
| 70 |
+
While we can directly pretrain Pix2Struct on the screenshot parsing task, we find that doing this naively can result in instability and slow learning. However, if we first expose the model to a short, intense “warmup” stage of simply learning to read, we find a strong curriculum learning effect where (1) pretraining is more stable and converges faster, and (2) we observe better finetuning performance, as discussed in Section 5. Specifically, we create images of text snippets with random colors and fonts on a white background. The model simply needs to decode the original text (see Appendix E for an example). This type of curriculum learning was also used in Dessurt (Davis et al., 2022) and can also be viewed as a simplified version of Donut’s pretraining.
|
| 71 |
+
|
| 72 |
+
# 2.5 FINETUNING
|
| 73 |
+
|
| 74 |
+
Finetuning Pix2Struct is straightforward and largely a matter of preprocessing the downstream data to unambiguously reflect the task in the image inputs and text outputs, analogous to the way T5 (Raffel et al., 2020) is used for text-based tasks. In this section, we cover the preprocessing strategies for the tasks described in Table 2. Examples of this preprocessing are shown in Figure 1.
|
| 75 |
+
|
| 76 |
+
Captioning is the most straightforward, since the input image and the output text can be directly used (as in TextCaps, Screen2Words). In the case where the focus of the caption is a specific bounding box (as in Widget Captioning), we draw the target bounding box on the image itself.
|
| 77 |
+
|
| 78 |
+
For visual question answering (as in OCR-VQA, ChartQA, DocVQA, InfographicsVQA), while multimodal models typically reserve a specialized text channel for the question, we opt to instead directly render the question as a header at the top of the original image. Pix2Struct reads both the question and the image jointly via the visual modality. This strategy is analogous to the common practice of simply concatenating all inputs during finetuning of pretrained text models, first proposed in GPT (Radford et al., 2018) and has been the default method in NLP since then. Intuitively, this strategy is effective because Pix2Struct has been pretrained to be sensitive to long-range interactions between various parts of the input image. In the case of multiple choice answers (as in AI2D), we also render the choices in the header as part of the question.
|
| 79 |
+
|
| 80 |
+
The most complex scenario is RefExp, where the task is choosing between UI components that a natural language expression could be referring to. For each candidate, we create a training instance where the input image contains the bounding box and referring expression, and the decoding target is “true” or “false”. We sample five negative candidates per positive candidate during training. During inference, we pick the candidate for which the model generates “true” with the highest score.1
|
| 81 |
+
|
| 82 |
+
# 3 EXPERIMENTAL SETUP
|
| 83 |
+
|
| 84 |
+
# 3.1 BENCHMARKS
|
| 85 |
+
|
| 86 |
+
We evaluate Pix2Struct on multiple benchmarks centered around visually-situated language understanding across four domains: illustrations, user interfaces, natural images, and documents. Since we are the first to aggregate datasets with this scope, we optimized for diversity in domains as well as in task-format. Evaluation is restricted to standard splits without additional labeled data. Table 2 provides a summary of the datasets with details discussed in Section 4.
|
| 87 |
+
|
| 88 |
+
We use evaluation metrics as defined in the original papers: (a) average normalized Levenshtein similarity (ANLS) for DocVQA and InfographicVQA, (b) exact match (EM) for AI2D, RefExp, and OCR-VQA, (c) relaxed accuracy (RA) for ChartQA, and (d) CIDEr for the generation tasks.
|
| 89 |
+
|
| 90 |
+
# 3.2 IMPLEMENTATION AND BASELINES
|
| 91 |
+
|
| 92 |
+
Pretraining We pretrain two model variants: (a) a base model with 282M parameters including 12 transformer layers with a hidden size of 768, and (b) a large model with 1.3B parameters including 18 layers with a hidden size of 1536. Both models have the same warmup stage using text rendered from BooksCorpus (Zhu et al., 2015) lasting 30K steps with a maximum input sequence length of 128 patches. The base model is then pretrained further for 270K steps with the screenshot parsing objective using a batch size of 3072 on 64 Google Cloud TPUs. The large model is pretrained for 170K steps with a batch size of 1024 on 128 Google Cloud TPUs. Both models use an input sequence length of 2048 patches and are optimized using Adafactor (Shazeer & Stern, 2018). The learning rate schedule uses a linear warmup of 1000 steps to 0.01, followed by cosine decay to 0. The decoder sequence length is 128 tokens, and we choose pretraining targets to have at most 1024 characters. As a reference point, the base model reaches 30 BLEU and the large model reaches 32 BLEU. Details about finetuning can be found in Appendix D.
|
| 93 |
+
|
| 94 |
+
Baselines Across all tasks, we found an exceedingly large number of methods which could serve as baselines. We compare our results against state of the art (SotA) methods in each domain (see Section 4 for method descriptions). Several methods use model ensembles, multitask with labeled training data from other datasets (Powalski et al., 2021; Wang et al., 2022a), or use validation data for training (Li et al., 2021a). For fair comparison and ease of experimentation, we focus on singlemodel and single-task baselines trained on standard splits. Several (per-task) SotA (Li et al., 2021c; Masry et al., 2022) use domain-specific inputs (e.g. view hierarchies for UIs or gold data tables for charts) making it difficult to apply them to other domains. For a strong, consistent visual baseline across domains, we finetuned Donut on all tasks where a purely visual baseline was unavailable.2
|
| 95 |
+
|
| 96 |
+
<table><tr><td colspan="2">Method</td><td>Pretraining</td><td>Chart QA</td><td>AI2D</td><td>OCR VQA</td><td>Ref Exp</td><td>Widget Cap</td><td>Screen2 Words</td><td>Text Caps</td><td>Doc VQA</td><td>Info VQA</td></tr><tr><td colspan="2">State of the art w/ pipelines</td><td></td><td>(VTP) 45.5</td><td>(DQAN) 38.5</td><td>(LATr) 67.5</td><td>(UIB) 90.8</td><td>(VUT) 97.0</td><td>(VUT) 64.3</td><td>(PaLI) 160.4</td><td>(LLMv3) 83.4</td><td>(T52DU) 46.1</td></tr><tr><td rowspan="5">puo gexid</td><td>GIT2 Donut</td><td>Image captioning</td><td>-</td><td>=</td><td>70.3</td><td>-</td><td>-</td><td></td><td>- 145.0</td><td>-</td><td>-</td></tr><tr><td></td><td>OCR</td><td>41.8</td><td>30.8</td><td>66.0</td><td>-</td><td>127.4</td><td>56.4</td><td>74.4</td><td>67.5</td><td>11.6</td></tr><tr><td>Pix2Struct</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Base</td><td>Screenshot parsing</td><td>56.0</td><td>40.9</td><td>69.4 92.2</td><td></td><td>133.1</td><td>107.0</td><td>88.0</td><td>72.1</td><td>38.2</td></tr><tr><td>Large</td><td>Screenshot parsing</td><td>58.6</td><td>42.1</td><td>71.3 94.2</td><td></td><td>136.7</td><td>109.4</td><td>95.5</td><td>76.6</td><td>40.0</td></tr></table>
|
| 97 |
+
|
| 98 |
+
Table 1: Pix2Struct outperforms prior visual methods on 8 out of 9 benchmarks with SotA results on 6. While GIT2’s image captioning-based pretraining understandably helps on TextCaps, our screenshot parsing objective transfers to a wider variety of downstream tasks. The individual pipeline SotA methods are described in Section 4 with full results in Appendix C.
|
| 99 |
+
|
| 100 |
+
# 4 RESULTS
|
| 101 |
+
|
| 102 |
+
We discuss here the main results comparing Pix2Struct with prior work, as shown in Table 1.
|
| 103 |
+
|
| 104 |
+
# 4.1 ILLUSTRATIONS
|
| 105 |
+
|
| 106 |
+
ChartQA (Masry et al., 2022) is a VQA dataset with questions based on charts, i.e. visual representations of tabular data.3. VisionTaPas (Masry et al., 2022), the current SotA, is a pipeline which operates on data tables predicted from the given charts. It consists of (1) a vision transformer encoder for encoding the chart image, (2) a TaPas encoder for encoding the question and the data table, and (3) a cross-modal encoder. In contrast, Pix2Struct does not rely on noisy table extractors and uses the given chart directly—improving the SotA from 45.5 to 58.6 with the large variant.
|
| 107 |
+
|
| 108 |
+
AI2D (Kembhavi et al., 2016) contains multiple choice questions based on illustrative science diagrams (about geological processes, biological structures etc.). The dataset comes with only train and test splits. We set aside $1 \%$ of the train split for validation. The current SotA DQA-NET (Kembhavi et al., 2016) focuses on modeling entity relationships via a pipeline of tools for extracting arrows, blobs, and other visual elements. Pix2Struct-Large outperforms DQA-NET and Donut by 3.6 and 11.27 points respectively without any domain-specific modifications.
|
| 109 |
+
|
| 110 |
+
OCR-VQA (Mishra et al., 2019) is a VQA dataset on images of book covers. The questions are based on book metadata such as title, author, genre etc. Much of work on OCR-VQA, including the pipeline SotA LATr (Biten et al., 2022), uses off-the-shelf OCR. Concurrent work, GIT2 (Wang et al., 2022a), the current SotA, is pretrained on 12.9B image caption pairs. Their final finetuning stage is preceded by intermediate finetuning on eight VQA datasets including VQAv2 (Goyal et al., 2017), VizWiz-VQA (Chen et al., 2022a), and OCR-VQA (Mishra et al., 2019) amongst others. Despite not using more labeled training data, we outperform GIT2 by almost 1 point.
|
| 111 |
+
|
| 112 |
+
# 4.2 UIS
|
| 113 |
+
|
| 114 |
+
RefExp (Bai et al., 2021) Given a natural language referring expression, an app screenshot, and a set of components (via bounding boxes on the screenshot), the goal here is to retrieve the component that the expression refers to. UIBert (Bai et al., 2021), the current SotA, is pretrained on a combination of inputs from mobile apps including screenshots, OCR text, and Android view hierarchies. Our models substantially ourperform UI Bert by 1.4 and $3 . 4 \%$ absolute, with Pix2Struct-Large setting the new state of the art with $94 \%$ accuracy.
|
| 115 |
+
|
| 116 |
+
Widget Captioning (Li et al., 2020b) is an image captioning task where the input is an app screenshot annotated with a single bounding box denoting a widget (e.g. a button or a scroll bar). The caption describes the functionality of the widget (e.g. find location). VUT (Li et al., 2021c), the current SotA uses a specialized UI encoder combining images, bounding boxes, and view hierarchies. Pix2Struct-Large improves the state of the art CIDEr from 97.0 to 136.7.
|
| 117 |
+
|
| 118 |
+
Screen2Words (Wang et al., 2021a) is an image captioning task where the input is an app screenshot and the caption describes the functionality of the page (see Figure 1 for an example). Pix2Struct-Large improves the state of the art CIDEr from 64.3 to 109.4.
|
| 119 |
+
|
| 120 |
+
# 4.3 NATURAL IMAGES
|
| 121 |
+
|
| 122 |
+
TextCaps Concurrent with our work, GIT2 (5.1B parameters) and PaLI (17B parameters) have advanced the state of the art on TextCaps by pretraining on $^ { 1 0 \mathrm { B } + }$ image-caption pairs extracted from the web. PaLI (CIDEr 135.4 without OCR) and GIT2 (CIDEr 145) show comparable performance when finetuned without OCR based inputs. PaLI achieves SotA (CIDEr 160.4) performance when finetuned with OCR, indicating that even large-scale methods, end-to-end pixel-only performance lags behind pipeline SotA. While their image captioning-based pretraining understandably helps on TextCaps, previous work (Kim et al., 2022) shows that captioning does not necessarily transfer to other domains like documents. Moreover, screenshot parsing subsumes signals from image captioning (Section 2.3) while using a fraction of the the data used for pretraining GIT2 and PaLI. Overall, these results indicate that Pix2Struct could benefit from scaling even further in future work.
|
| 123 |
+
|
| 124 |
+
# 4.4 DOCUMENTS
|
| 125 |
+
|
| 126 |
+
DocVQA (Mathew et al., 2021) is a dataset of questions about scanned documents,4 include typewritten, printed, handwritten and born-digital text. Pix2Struct-Large outperforms Donut, the previous visual SotA on DocVQA by 9 points. Top-performing single-task methods like LayoutLMv3 (Huang et al., 2022) (ANLS 83.4) typically use three components: (a) an off-the-shelf OCR system, (b) pretrained text and image encoders, and (c) additional pretraining on the IIT-CDIP scanned documents corpus. Despite using purely visual representations and no in-domain pretraining data, Pix2Struct achieves competitive performance (ANLS 76.6).
|
| 127 |
+
|
| 128 |
+
InfographicVQA (Mathew et al., 2022) is a dataset of questions about infographics from the web. A unique challenge of this dataset is its large images with extreme aspect ratios. Donut scales images to a fixed aspect ratio, which we speculate is the cause of its poor performance with an ANLS of 11.6. Pix2Struct-Large sets the state of the art amongst visual models with an ANLS of 40.
|
| 129 |
+
|
| 130 |
+
For both DocVQA and InfographicVQA, text-only baselines are at or near the state of the art. A T5-based model $( \mathrm { T } 5 + 2 \mathrm { D } + \mathrm { U } )$ with 2D positional biases (Borchmann et al., 2021) achieves ANLS of 81 on DocVQA and a SotA ANLS of 46.1 on InfographicVQA. This is in part due to the textheavy nature of the data (especially DocVQA) where visual context plays a lesser role, and the more mature pretrained text-based encoders can do the heavy lifting.
|
| 131 |
+
|
| 132 |
+
Common trends Overall, Pix2Struct outperforms Donut in all tasks underscoring the effectiveness of our pretraining. We also advance the single-task state of the art on six out of nine benchmarks across four domains. Scaling up from base to large results in considerable improvements on all tasks despite the base model making 4.5 times as many iterations over the data compared to the large version. Results indicate that further scaling up of Pix2Struct is a promising direction.
|
| 133 |
+
|
| 134 |
+
# 5 ANALYSIS
|
| 135 |
+
|
| 136 |
+
Ablating pretraining objectives Table 3 analyzes the importance of each component of our pretraining recipe on DocVQA, Widget Captioning, and TextCaps validation sets. The full pretraining recipe consists of a warmup reading stage on the books corpus followed by pretraining using the screenshot parsing objective. For these experiments, we use the base variant with a total of 100K steps of pretraining including 30K warmup steps followed by 70K steps of screenshot parsing. The screenshot parsing ablation removes the screenshot parsing stage altogether and uses an extended warmup stage of 100K steps. The warmup ablation removes the warmup stage and pretrains the next stage (from random initialization) for 100K steps. The masking ablation uses 30K steps warmup (like the full model) followed by 70K steps of screenshot parsing without masking.5
|
| 137 |
+
|
| 138 |
+
Figure 3: Ablations of pretraining components. Each ablation is a modification with respect to the full model, while keeping the total number of pretraining steps constant.
|
| 139 |
+
|
| 140 |
+
<table><tr><td>Pretraining</td><td>Doc VQA</td><td>Widget Captioning</td><td>Text Caps</td></tr><tr><td>Full</td><td>67.8</td><td>137.5</td><td>84.2</td></tr><tr><td>- Warmup</td><td>56.2</td><td>128.0</td><td>71.7</td></tr><tr><td>-Masking</td><td>55.7</td><td>129.4</td><td>77.4</td></tr><tr><td>- Screenshot Parsing</td><td>12.2</td><td>35.1</td><td>24.2</td></tr></table>
|
| 141 |
+
|
| 142 |
+

|
| 143 |
+
Figure 4: Our variable-resolution inputs prevent aspect-ratio distortion while minimizing padding.
|
| 144 |
+
|
| 145 |
+
Table 3 shows that all components of the pretraining scheme are crucial for good downstream task performance across all benchmarks. The biggest drop in performance comes from ablating the screenshot parsing stage, effectively reducing the pretraining to reading linear text. Ablating the warmup and masking is nearly equivalent on DocVQA and Widget Captioning while the warmup is slightly more important in TextCaps. Overall, our results seem to indicate that reading and understanding visually-situated language is a complex problem which needs a deep set of skills including recognizing text, understanding language, and incorporating visual context.
|
| 146 |
+
|
| 147 |
+
Ablating variable-resolution inputs Figure 4 compares various ways to convert input images into a constant number of patches. This ablation is performed on the warmup stage (Section 2.4), where we measure full sequence accuracy. The ‘padded’ variant maintains the original aspect ratio, but introduces significant padding, which sacrifices the effective resolution. The ‘stretched’ variant, typically used in ViT, introduces no padding but distorts the original image. Our variable-resolution inputs get the best of both worlds by maintaining the original aspect ratio while maximizing the budget specified by the sequence length.6 Experiments show that this benefit leads to more effective learning, even for a task as simple as transcribing text in the input image.
|
| 148 |
+
|
| 149 |
+
# 6 DISCUSSION
|
| 150 |
+
|
| 151 |
+
In this section, we lay out some of the challenges in training general-purpose visual language understanding models, and discuss a road map for future work.
|
| 152 |
+
|
| 153 |
+
Resolution Like Donut, we found that pretraining and finetuning performance are extremely sensitive to the input resolutions.7 The difficulty in using high-resolution images has been a bottleneck for pixel-only models since higher resolutions often lead to longer sequence lengths. This bottleneck has in part been responsible for the dominance of OCR-based pipelines which are able to use lower image resolutions due to a dedicated text encoder.8 However, steady progress with Donut and $\mathtt { P i x 2 S t }$ ruct combined with recent progress in long range transformers (Press et al., 2021) provides hope that pixel-only models will bridge the gap with OCR-based pipelines.
|
| 154 |
+
|
| 155 |
+
The visual web As a first attempt towards a general-purpose visual language understanding model, we focused on simplicity both in terms of how we use the HTML source and our choice for the pretraining corpus, C4—a known public corpus used in previous work (Raffel et al., 2020) that is significantly smaller and narrower than corpora used to train the largest language models today. However, web data includes even richer multimodal signals such as videos and interactions. We posit that future versions of general-purpose visual language understanding models will benefit from better data curation. This opportunity also comes with a caveat: just like text-based models, we must be careful of harmful content on the web, which multimodal models would also be sensitive to.
|
| 156 |
+
|
| 157 |
+
Generality While we have focused on general pixel-only models, we do acknowledge that using OCR-pipelines or metadata can be appropriate or even necessary in certain domains. For NLP, the scaling of pretrained text based models has led to not only simpler model architectures and preprocessing, but also emergent abilities on newer tasks which were hitherto considered far too difficult (Wei et al., 2022). A general-purpose model may also enable broader applications for visual language, e.g. filling in missing accessibility annotations (Zhang et al., 2021). The broader objective of this work is to bring pretraining for visually-situated language understanding a step closer to text-base counterparts and pave the way for similar benefits from data and model scaling.
|
| 158 |
+
|
| 159 |
+
# 7 RELATED WORK
|
| 160 |
+
|
| 161 |
+
To the best of our knowledge, no prior work has pretrained and evaluated a visually-situated language understanding model on tasks spanning all four domains of documents, illustrations, user interfaces, and natural images. 9 We build on prior work primarily focused on a single domain and briefly highlight the similarities as well as the points of departure with respect to such work here.
|
| 162 |
+
|
| 163 |
+
Document understanding State-of-the-art models in this domain are based on a pipeline of an external OCR system and a model that combines images and OCR annotations (Appalaraju et al., 2021; Powalski et al., 2021; Xu et al., 2021), inter alia. Prominent representatives are LayoutLMv3 (Huang et al., 2022), which uses a simplified Transformer-based architecture and losses that encourage patch–OCR alignment. TILT (Powalski et al., 2021) pretrains a text decoder and an image $+ { \mathrm { O C R - } }$ output encoder followed by intermediate finetuning on multiple QA tasks. Pix2Struct is more closely related to Donut and Dessurt (Davis et al., 2022), also image-to-text models without OCR at inference time; the main difference stems from our more powerful pretraining task from ground truth structures and resolution flexibility enabling transfer to a variety of visual language domains.
|
| 164 |
+
|
| 165 |
+
UI understanding Models in this group have focused solely on the UI domain and have been pretrained on data from mobile and web apps. While some models use image-only inputs (Liu et al., 2018; Chen et al., 2020), higher accuracy approaches also make use of the structures of view hierarchies and element annotations, e.g. UIBert (Bai et al., 2021), ActionBert (He et al., 2021), VUT (Li et al., 2021c) although the structured metadata is known to be noisy (Li et al., 2020a). The screen parsing task (Wu et al., 2021), while similar in name, is an amalgamation of pipelines over domain-specific structures that are not intended to produce transferable representations.
|
| 166 |
+
|
| 167 |
+
Natural image understanding A variety of model architectures (Singh et al., 2019; Sidorov et al., 2020; Wang et al., 2020) and objectives (Yang et al., 2021) have been proposed for understanding natural images containing short segments of text (e.g. street signs). The predominant source of pretraining data has been image-caption pairs often in conjunction with the output of OCR (Chen et al., 2022b; Yang et al., 2021). GIT2 (Wang et al., 2022a), the pixel-only SoTA, learns from 12.9 billion image-caption pairs and is about 4 times larger than Pix2Struct— it outperforms our model significantly on natural images (TextCaps) but underperforms on illustrations (OCR-VQA). PaLI benefits from using a pipeline with OCR, obtaining higher performance on TextCaps. These methods have not been evaluated on more text-dense input domains.
|
| 168 |
+
|
| 169 |
+
Illustrations Models for illustrations have not been fully pretrained on large scale data, perhaps because such data is not readily available. Some components of such models, e.g. T5 and TaPas (Eisenschlos et al., 2020) used in the VL-T5 and VisionTaPas models of Masry et al. (2022) or LATr’s OCR output encoder (Biten et al., 2022) have been pretrained on digital-born or OCR-ed documents. Our approach outperforms current SotA models, without relying on other intermediate structures.
|
| 170 |
+
|
| 171 |
+
Related models learning from markup structure MarkupLM (Li et al., 2021b) and Webformer (Wang et al., 2022b) learn encoders of HTML from web pages. HTLM (Aghajanyan et al., 2021) and CM3 (Aghajanyan et al., 2022) are generative models of simplified HTML to enable powerful zero-shot prompting with text and natural images. Im2Tex (Deng et al., 2017) is conceptually the most relevant in showing that a pixel-only parser can be learned from freely-available pairs of markup and renders, but they do not focus on transferring this signal to wider applications.
|
| 172 |
+
|
| 173 |
+
Datasets We have selected a set of datasets representing challenges in visually-situated language understanding in a variety of domains, but our selection is not aimed to be exhaustive. The DUE benchmark (Borchmann et al., 2021) focuses on a more limited domain of visual document understanding (e.g. excluding natural images and UIs), but integrates a more comprehensive set of tasks within that domain, including document layout analysis and academic papers.
|
| 174 |
+
|
| 175 |
+
# REFERENCES
|
| 176 |
+
|
| 177 |
+
Armen Aghajanyan, Dmytro Okhonko, Mike Lewis, Mandar Joshi, Hu Xu, Gargi Ghosh, and Luke Zettlemoyer. Htlm: Hyper-text pre-training and prompting of language models. arXiv preprint arXiv:2107.06955, 2021.
|
| 178 |
+
|
| 179 |
+
Armen Aghajanyan, Bernie Huang, Candace Ross, Vladimir Karpukhin, Hu Xu, Naman Goyal, Dmytro Okhonko, Mandar Joshi, Gargi Ghosh, Mike Lewis, et al. Cm3: A causal masked multimodal model of the internet. arXiv preprint arXiv:2201.07520, 2022.
|
| 180 |
+
|
| 181 |
+
Srikar Appalaraju, Bhavan Jasani, Bhargava Urala Kota, Yusheng Xie, and R. Manmatha. DocFormer: End-to-end Transformer for document understanding. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 993–1003, October 2021.
|
| 182 |
+
|
| 183 |
+
Chongyang Bai, Xiaoxue Zang, Ying Xu, Srinivas Sunkara, Abhinav Rastogi, Jindong Chen, and Blaise Aguera y Arcas. Uibert: Learning generic multimodal representations for ui understanding. ¨ In Zhi-Hua Zhou (ed.), Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence, IJCAI-21, pp. 1705–1712. International Joint Conferences on Artificial Intelligence Organization, 8 2021. doi: 10.24963/ijcai.2021/235. URL https://doi.org/10.24963/ ijcai.2021/235. Main Track.
|
| 184 |
+
|
| 185 |
+
Ali Furkan Biten, Ron Litman, Yusheng Xie, Srikar Appalaraju, and R Manmatha. Latr: Layoutaware transformer for scene-text vqa. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16548–16558, 2022.
|
| 186 |
+
|
| 187 |
+
Łukasz Borchmann, Michał Pietruszka, Tomasz Stanislawek, Dawid Jurkiewicz, Michał Turski, Karolina Szyndler, and Filip Gralinski. Due: End-to-end document understanding benchmark. ´ In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 2), 2021.
|
| 188 |
+
|
| 189 |
+
Chongyan Chen, Samreen Anjum, and Danna Gurari. Grounding answers for visual questions asked by visually impaired people. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 19098–19107, 2022a.
|
| 190 |
+
|
| 191 |
+
Jieshan Chen, Chunyang Chen, Zhenchang Xing, Xiwei Xu, Liming Zhu, Guoqiang Li, and Jinshui Wang. Unblind your apps: Predicting natural-language labels for mobile gui components by deep learning. 2020 IEEE/ACM 42nd International Conference on Software Engineering (ICSE), pp. 322–334, 2020.
|
| 192 |
+
|
| 193 |
+
Xi Chen, Xiao Wang, Soravit Changpinyo, AJ Piergiovanni, Piotr Padlewski, Daniel Salz, Sebastian Goodman, Adam Grycner, Basil Mustafa, Lucas Beyer, Alexander Kolesnikov, Joan Puigcerver, Nan Ding, Keran Rong, Hassan Akbari, Gaurav Mishra, Linting Xue, Ashish Thapliyal, James Bradbury, Weicheng Kuo, Mojtaba Seyedhosseini, Chao Jia, Burcu Karagol Ayan, Carlos Riquelme, Andreas Steiner, Anelia Angelova, Xiaohua Zhai, Neil Houlsby, and Radu Soricut. Pali: A jointly-scaled multilingual language-image model, 2022b. URL https: //arxiv.org/abs/2209.06794.
|
| 194 |
+
|
| 195 |
+
Brian Davis, Bryan Morse, Bryan Price, Chris Tensmeyer, Curtis Wigington, and Vlad Morariu. End-to-end document recognition and understanding with Dessurt. In Text in everything ECCV workshop, 2022. URL https://arxiv.org/abs/2203.16618.
|
| 196 |
+
|
| 197 |
+
Yuntian Deng, Anssi Kanervisto, Jeffrey Ling, and Alexander M Rush. Image-to-markup generation with coarse-to-fine attention. In International Conference on Machine Learning, pp. 980–989. PMLR, 2017.
|
| 198 |
+
|
| 199 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1423. URL https: //aclanthology.org/N19-1423.
|
| 200 |
+
|
| 201 |
+
Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021.
|
| 202 |
+
|
| 203 |
+
Julian Eisenschlos, Syrine Krichene, and Thomas Muller. Understanding tables with interme- ¨ diate pre-training. In Findings of the Association for Computational Linguistics: EMNLP 2020, pp. 281–296, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.findings-emnlp.27. URL https://aclanthology.org/2020. findings-emnlp.27.
|
| 204 |
+
|
| 205 |
+
Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the v in vqa matter: Elevating the role of image understanding in visual question answering. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 6904–6913, 2017.
|
| 206 |
+
|
| 207 |
+
Zecheng He, Srinivas Sunkara, Xiaoxue Zang, Ying Xu, Lijuan Liu, Nevan Wichers, Gabriel Schubiner, Ruby Lee, and Jindong Chen. Actionbert: Leveraging user actions for semantic understanding of user interfaces. In 35th AAAI Conference on Artificial Intelligence, AAAI 2021, 35th AAAI Conference on Artificial Intelligence, AAAI 2021, pp. 5931–5938. Association for the Advancement of Artificial Intelligence, 2021. Publisher Copyright: Copyright $©$ 2021, Association for the Advancement of Artificial Intelligence (www.aaai.org). All rights reserved.; 35th AAAI Conference on Artificial Intelligence, AAAI 2021 ; Conference date: 02-02-2021 Through 09-02-2021.
|
| 208 |
+
|
| 209 |
+
Yupan Huang, Tengchao Lv, Lei Cui, Yutong Lu, and Furu Wei. LayoutLMv3: Pre-training for document ai with unified text and image masking. In Proceedings of the 30th ACM International Conference on Multimedia, 2022.
|
| 210 |
+
|
| 211 |
+
Aniruddha Kembhavi, Mike Salvato, Eric Kolve, Minjoon Seo, Hannaneh Hajishirzi, and Ali Farhadi. A diagram is worth a dozen images. In European conference on computer vision, pp. 235–251. Springer, 2016.
|
| 212 |
+
|
| 213 |
+
Geewook Kim, Teakgyu Hong, Moonbin Yim, Jinyoung Park, Jinyeong Yim, Wonseok Hwang, Sangdoo Yun, Dongyoon Han, and Seunghyun Park. Donut: Document understanding transformer without OCR. In ECCV, 2022. URL https://arxiv.org/abs/2111.15664.
|
| 214 |
+
|
| 215 |
+
Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. BART: Denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 7871–7880, July 2020. doi: 10.18653/v1/2020.acl-main.703. URL https://aclanthology.org/2020. acl-main.703.
|
| 216 |
+
|
| 217 |
+
Chenliang Li, Bin Bi, Ming Yan, Wei Wang, Songfang Huang, Fei Huang, and Luo Si. Structurallm: Structural pre-training for form understanding. arXiv preprint arXiv:2105.11210, 2021a.
|
| 218 |
+
|
| 219 |
+
Junlong Li, Yiheng Xu, Lei Cui, and Furu Wei. Markuplm: Pre-training of text and markup language for visually-rich document understanding. arXiv preprint arXiv:2110.08518, 2021b.
|
| 220 |
+
|
| 221 |
+
Yang Li, Jiacong He, Xin Zhou, Yuan Zhang, and Jason Baldridge. Mapping natural language instructions to mobile UI action sequences. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 8198–8210, Online, July 2020a. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.729. URL https: //www.aclweb.org/anthology/2020.acl-main.729.
|
| 222 |
+
|
| 223 |
+
Yang Li, Gang Li, Luheng He, Jingjie Zheng, Hong Li, and Zhiwei Guan. Widget captioning: Generating natural language description for mobile user interface elements. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 5495– 5510, Online, November 2020b. Association for Computational Linguistics. doi: 10.18653/v1/ 2020.emnlp-main.443. URL https://aclanthology.org/2020.emnlp-main.443.
|
| 224 |
+
|
| 225 |
+
Yang Li, Gang Li, Xin Zhou, Mostafa Dehghani, and Alexey Gritsenko. Vut: Versatile ui transformer for multi-modal multi-task user interface modeling. arXiv preprint arXiv:2112.05692, 2021c.
|
| 226 |
+
|
| 227 |
+
Thomas F. Liu, Mark Craft, Jason Situ, Ersin Yumer, Radom´ır Mech, and Ranjitha Kumar. Learning design semantics for mobile apps. Proceedings of the 31st Annual ACM Symposium on User Interface Software and Technology, 2018.
|
| 228 |
+
|
| 229 |
+
Ahmed Masry, Do Long, Jia Qing Tan, Shafiq Joty, and Enamul Hoque. ChartQA: A benchmark for question answering about charts with visual and logical reasoning. In Findings of the Association for Computational Linguistics: ACL 2022, pp. 2263–2279, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.findings-acl.177. URL https://aclanthology.org/2022.findings-acl.177.
|
| 230 |
+
|
| 231 |
+
Minesh Mathew, Dimosthenis Karatzas, and CV Jawahar. Docvqa: A dataset for vqa on document images. In Proceedings of the IEEE/CVF winter conference on applications of computer vision, pp. 2200–2209, 2021.
|
| 232 |
+
|
| 233 |
+
Minesh Mathew, Viraj Bagal, Ruben Tito, Dimosthenis Karatzas, Ernest Valveny, and CV Jawahar.\` Infographicvqa. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pp. 1697–1706, 2022.
|
| 234 |
+
|
| 235 |
+
Anand Mishra, Shashank Shekhar, Ajeet Kumar Singh, and Anirban Chakraborty. Ocr-vqa: Visual question answering by reading text in images. In 2019 international conference on document analysis and recognition (ICDAR), pp. 947–952. IEEE, 2019.
|
| 236 |
+
|
| 237 |
+
Rafał Powalski, Łukasz Borchmann, Dawid Jurkiewicz, Tomasz Dwojak, Michał Pietruszka, and Gabriela Pałka. Going full-tilt boogie on document understanding with text-image-layout transformer. In International Conference on Document Analysis and Recognition, pp. 732–747. Springer, 2021.
|
| 238 |
+
|
| 239 |
+
Ofir Press, Noah A Smith, and Mike Lewis. Train short, test long: Attention with linear biases enables input length extrapolation. arXiv preprint arXiv:2108.12409, 2021.
|
| 240 |
+
|
| 241 |
+
Alec Radford, Karthik Narasimhan, Tim Salimans, Ilya Sutskever, et al. Improving language understanding by generative pre-training. OpenAI, 2018.
|
| 242 |
+
|
| 243 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-totext transformer. Journal of Machine Learning Research, 21(140):1–67, 2020. URL http: //jmlr.org/papers/v21/20-074.html.
|
| 244 |
+
|
| 245 |
+
Phillip Rust, Jonas F Lotz, Emanuele Bugliarello, Elizabeth Salesky, Miryam de Lhoneux, and Desmond Elliott. Language modelling with pixels. arXiv preprint arXiv:2207.06991, 2022.
|
| 246 |
+
|
| 247 |
+
Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 2556–2565, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1238. URL https://aclanthology.org/P18-1238.
|
| 248 |
+
|
| 249 |
+
Noam Shazeer and Mitchell Stern. Adafactor: Adaptive learning rates with sublinear memory cost. In International Conference on Machine Learning, pp. 4596–4604. PMLR, 2018.
|
| 250 |
+
|
| 251 |
+
Oleksii Sidorov, Ronghang Hu, Marcus Rohrbach, and Amanpreet Singh. Textcaps: a dataset for image captioningwith reading comprehension. In European Conference on Computer Vision, 2020.
|
| 252 |
+
|
| 253 |
+
Amanpreet Singh, Vivek Natarajan, Meet Shah, Yu Jiang, Xinlei Chen, Dhruv Batra, Devi Parikh, and Marcus Rohrbach. Towards vqa models that can read. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 8317–8326, 2019.
|
| 254 |
+
|
| 255 |
+
Hugo Touvron, Andrea Vedaldi, Matthijs Douze, and Herve Jegou. Fixing the train-test resolution discrepancy. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alche-Buc, E. Fox, and ´ R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/file/ d03a857a23b5285736c4d55e0bb067c8-Paper.pdf.
|
| 256 |
+
|
| 257 |
+
Bryan Wang, Gang Li, Xin Zhou, Zhourong Chen, Tovi Grossman, and Yang Li. Screen2words: Automatic mobile ui summarization with multimodal learning. In The 34th Annual ACM Symposium on User Interface Software and Technology, UIST ’21, pp. 498–510, New York, NY, USA, 2021a. Association for Computing Machinery. ISBN 9781450386357. doi: 10.1145/3472749.3474765. URL https://doi.org/10.1145/3472749.3474765.
|
| 258 |
+
|
| 259 |
+
Jianfeng Wang, Zhengyuan Yang, Xiaowei Hu, Linjie Li, Kevin Lin, Zhe Gan, Zicheng Liu, Ce Liu, and Lijuan Wang. Git: A generative image-to-text transformer for vision and language. arXiv preprint arXiv:2205.14100, 2022a.
|
| 260 |
+
|
| 261 |
+
Jing Wang, Jinhui Tang, and Jiebo Luo. Multimodal attention with image text spatial relationship for ocr-based image captioning. In Proceedings of the 28th ACM International Conference on Multimedia, pp. 4337–4345, 2020.
|
| 262 |
+
|
| 263 |
+
Qifan Wang, Yi Fang, Anirudh Ravula, Fuli Feng, Xiaojun Quan, and Dongfang Liu. Webformer: The web-page transformer for structure information extraction. In Proceedings of the ACM Web Conference 2022, pp. 3124–3133, 2022b.
|
| 264 |
+
|
| 265 |
+
Zirui Wang, Jiahui Yu, Adams Wei Yu, Zihang Dai, Yulia Tsvetkov, and Yuan Cao. Simvlm: Simple visual language model pretraining with weak supervision. CoRR, abs/2108.10904, 2021b. URL https://arxiv.org/abs/2108.10904.
|
| 266 |
+
|
| 267 |
+
Jason Wei, Yi Tay, Rishi Bommasani, Colin Raffel, Barret Zoph, Sebastian Borgeaud, Dani Yogatama, Maarten Bosma, Denny Zhou, Donald Metzler, et al. Emergent abilities of large language models. arXiv preprint arXiv:2206.07682, 2022.
|
| 268 |
+
|
| 269 |
+
Jason Wu, Xiaoyi Zhang, Jeff Nichols, and Jeffrey P Bigham. Screen parsing: Towards reverse engineering of UI models from screenshots. In The 34th Annual ACM Symposium on User Interface Software and Technology, pp. 470–483, 2021.
|
| 270 |
+
|
| 271 |
+
Yang Xu, Yiheng Xu, Tengchao Lv, Lei Cui, Furu Wei, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha Zhang, Wanxiang Che, Min Zhang, and Lidong Zhou. Layoutlmv2: Multi-modal pre-training for visually-rich document understanding. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics (ACL) 2021, 2021.
|
| 272 |
+
|
| 273 |
+
Zhengyuan Yang, Yijuan Lu, Jianfeng Wang, Xi Yin, Dinei Florencio, Lijuan Wang, Cha Zhang, Lei Zhang, and Jiebo Luo. Tap: Text-aware pre-training for text-vqa and text-caption. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 8751–8761, 2021.
|
| 274 |
+
|
| 275 |
+
Xiaoyi Zhang, Lilian de Greef, Amanda Swearngin, Samuel White, Kyle Murray, Lisa Yu, Qi Shan, Jeffrey Nichols, Jason Wu, Chris Fleizach, et al. Screen recognition: Creating accessibility metadata for mobile applications from pixels. In Proceedings of the 2021 CHI Conference on Human Factors in Computing Systems, pp. 1–15, 2021.
|
| 276 |
+
|
| 277 |
+
Yukun Zhu, Ryan Kiros, Richard S. Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Aligning books and movies: Towards story-like visual explanations by watching movies and reading books. 2015 IEEE International Conference on Computer Vision (ICCV), pp. 19–27, 2015.
|
| 278 |
+
|
| 279 |
+
# A DATASET DETAILS
|
| 280 |
+
|
| 281 |
+
B RESOLUTION IN VISUALLY-SITUATED LANGUAGE UNDERSTANDING TASKS
|
| 282 |
+
|
| 283 |
+
<table><tr><td>Dataset</td><td>Domain</td><td>Description</td></tr><tr><td>OCR-VQA</td><td>Illustrations</td><td>VQA over book covers.</td></tr><tr><td>ChartQA</td><td>Illustrations</td><td>VQA over charts (visualization of tabular data)</td></tr><tr><td>AI2D</td><td>Illustrations</td><td>VQA over science diagrams</td></tr><tr><td>RefExp</td><td>UIs</td><td>Detect UI component matching a natural language query</td></tr><tr><td>Widget Captioning</td><td>UIs</td><td>Captioning a UI component on a screen</td></tr><tr><td>Screen2Words</td><td>UIs</td><td>Captioning a UI screen to describe functionality</td></tr><tr><td>TextCaps</td><td>Natural images</td><td>Captioning of natural images containing text</td></tr><tr><td>DocVQA</td><td>Documents</td><td>VQA over scanned documents.</td></tr><tr><td>Infographics VQA</td><td>Documents</td><td>VQA over high-res infographics.</td></tr></table>
|
| 284 |
+
|
| 285 |
+
Table 2: Summary our proposed diverse benchmark for visually-situated language understanding
|
| 286 |
+
|
| 287 |
+

|
| 288 |
+
Figure 5: Comparison of our variable resolution inputs and the typical fixed resolution input. We illustrate the preprocessing for a target sequence length of 36 patches for both inputs.
|
| 289 |
+
|
| 290 |
+

|
| 291 |
+
Figure 6: Overview of the impact of resolution on the DocVQA task. Note that the bottom axis only applies to $\mathrm { P i } \mathrm { x } 2 \mathrm { S t }$ ruct. Pix2Struct is also the only model that adapts to various resolutions seamlessly, without any retraining or post-hoc parameter creation. (Left) In both Donut and Pix2Struct, we show clear benefits from use larger resolutions. (Right) Inference speed measured by auto-regressive decoding (max decoding length of 32 tokens) on the validation set of DocVQA using a v3-8 Cloud TPU.
|
| 292 |
+
|
| 293 |
+
Previous methods rescale input images to fixed resolutions, which can introduce aspect ratio distortions that can be severe for inputs such as webpages and documents. In contrast, we prevent aspect ratio distortion by rescaling input images up or down such that we extract the maximal number of patches that fit within the given sequence length (Figure 5).
|
| 294 |
+
|
| 295 |
+
Figure 6 gives an overview of the importance of input resolutions in visually-situated language understanding tasks. Though ${ \mathrm { P i } } { \mathrm { x } } 2 { \mathrm { S t } }$ ruct is more efficient at making use of the input resolution, both $\mathrm { P i } \mathrm { x } 2 \mathrm { S t }$ truct and Donut require high resolutions to perform well on DocVQA (note the log scale). For example, we only see significantly diminishing returns after about 1M pixels (4096 patches of $1 6 \times 1 6$ pixels for Pix2Struct and $1 0 2 4 \times 1 0 2 4$ for fixed-resolution models). However, ViT models typically pretrain with resolutions of $2 2 4 \times 2 2 4$ and finetune with up to $5 1 2 \times 5 1 2$ . This is a subtle but critical detail that makes using standard ViT out of the box suboptimal.
|
| 296 |
+
|
| 297 |
+
On the right of Figure 6, we also present example inference speeds on a v3-8 Cloud TPU when performing inference on DocVQA. At full resolution (4096 sequence length or 1M pixels), the base model processes 62 documents per second, and the large model processes 20 documents per second.
|
| 298 |
+
|
| 299 |
+
C FULL RESULTS
|
| 300 |
+
|
| 301 |
+
<table><tr><td>Method</td><td></td><td>Chart QA</td><td>AI2D</td><td>OCR VQA</td><td>Ref Exp</td><td>Widget Cap</td><td>Screen2 Words</td><td>Text Caps</td><td>Doc VQA</td><td>Info VQA</td></tr><tr><td></td><td>TILT</td><td></td><td></td><td></td><td></td><td>=</td><td></td><td></td><td>87.1*</td><td></td></tr><tr><td></td><td>VUT</td><td></td><td></td><td></td><td></td><td>94.8</td><td>64.3</td><td></td><td>=</td><td></td></tr><tr><td></td><td>TAP</td><td></td><td></td><td>=</td><td>=</td><td>-</td><td>1</td><td>99.5</td><td>=</td><td></td></tr><tr><td></td><td>LATr</td><td></td><td></td><td>67.5</td><td></td><td>-</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>PLC</td><td></td><td></td><td></td><td></td><td>97.0</td><td></td><td></td><td></td><td></td></tr><tr><td>prrigedid</td><td>T5 +2D+U</td><td></td><td></td><td>=</td><td></td><td>-</td><td></td><td>=</td><td>81.0</td><td>46.1</td></tr><tr><td></td><td>RoBERTa</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>69.5</td><td></td></tr><tr><td></td><td>LayoutLMv3</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>83.4</td><td></td></tr><tr><td></td><td>DQA-NET</td><td></td><td>38.5</td><td></td><td></td><td></td><td></td><td></td><td>1</td><td></td></tr><tr><td>UI Bert</td><td></td><td></td><td>=</td><td></td><td>90.8</td><td></td><td></td><td>=</td><td>=</td><td></td></tr><tr><td>M4C</td><td></td><td></td><td>=</td><td>63.9</td><td></td><td></td><td></td><td>81</td><td></td><td>14.7</td></tr><tr><td>PaLI</td><td>VisionTaPas</td><td>45.5</td><td>=</td><td>=</td><td></td><td></td><td></td><td>-</td><td>=</td><td>=</td></tr><tr><td></td><td></td><td></td><td>=</td><td>=</td><td>=</td><td></td><td></td><td>160.4</td><td></td><td></td></tr><tr><td rowspan="2">guo gexid</td><td>GIT2</td><td>-</td><td>=</td><td>70.3*</td><td>1</td><td>=</td><td></td><td>145.0</td><td>=</td><td></td></tr><tr><td>Donut</td><td>41.8</td><td>30.8</td><td>66.0</td><td>-</td><td>127.4</td><td>56.4</td><td>74.4</td><td>67.5</td><td>11.6</td></tr><tr><td></td><td>Pix2Struct-Base</td><td>56.0</td><td>40.9</td><td>69.4</td><td>92.2</td><td>133.1</td><td>107.0</td><td>88.0</td><td>72.1</td><td>38.2</td></tr><tr><td></td><td>Pix2Struct-Large</td><td>58.6</td><td>42.1</td><td>71.3</td><td>94.2</td><td>136.7</td><td>109.4</td><td>95.5</td><td>76.6</td><td>40.0</td></tr></table>
|
| 302 |
+
|
| 303 |
+
Table 3: Amongst single-task single-model methods, Pix2Struct achieves state-of-the-art results on 6 out of 9 benchmarks spanning 4 domains. \* indicates that the method used additional labeled data from other tasks and are not directly comparable to single task methods. VisionTaPas uses a table extraction tool. DQA-NET uses diagram processing tools for detecting arrows, blobs, etc in addition to standard OCR. UI Bert and VUT use Android view hierarchies. All other non-image methods use standard OCR.
|
| 304 |
+
|
| 305 |
+
Table 3 reports full results for pipeline and pixel-only methods across all datasets. For fair comparison and ease of experimentation, we focus on single-model and single-task baselines trained on standard splits. Several (per-task) SotA (Li et al., 2021c; Masry et al., 2022) use domain-specific inputs (e.g. view hierarchies for UIs or gold data tables for charts) making it difficult to apply them to other domains.
|
| 306 |
+
|
| 307 |
+
# D HYPERPARAMETERS
|
| 308 |
+
|
| 309 |
+
Finetuning The base and large models are finetuned with an input sequence length of 4096 and 3072 respectively, except the base model on InfographicVQA which benefits from a longer sequence length of 6144. We cannot use a longer sequence length for the large variant due to TPU/GPU memory constraints. We finetune for 5000 or 10000 steps with a batch size of 32, 128, or 256, with hyperparameter tuning and early stopping based on the validation set. Table 4 contains hyperparameter values for all tasks.
|
| 310 |
+
|
| 311 |
+
Table 4: Model hyperparameters
|
| 312 |
+
|
| 313 |
+
<table><tr><td rowspan="2">Dataset</td><td colspan="3">Base</td><td colspan="3">Large</td></tr><tr><td>Seq Len</td><td>Batch</td><td>Steps</td><td>Seq Len</td><td>Batch</td><td>Steps</td></tr><tr><td>DocVQA</td><td>4096</td><td>256</td><td>10000</td><td>3072</td><td>128</td><td>10000</td></tr><tr><td>InfographicVQA</td><td>6144</td><td>64</td><td>10000</td><td>3072</td><td>128</td><td>10000</td></tr><tr><td>AI2D</td><td>4096</td><td>32</td><td>5000</td><td>3072</td><td>32</td><td>5000</td></tr><tr><td>ChartQA</td><td>4096</td><td>256</td><td>10000</td><td>3072</td><td>128</td><td>10000</td></tr><tr><td>OCR-VQA</td><td>4096</td><td>256</td><td>10000</td><td>3072</td><td>128</td><td>10000</td></tr><tr><td>RefExp</td><td>4096</td><td>256</td><td>10000</td><td>3072</td><td>128</td><td>10000</td></tr><tr><td>Screen2Words</td><td>4096</td><td>32</td><td>10000</td><td>3072</td><td>32</td><td>10000</td></tr><tr><td>Widget Cap.</td><td>4096</td><td>256</td><td>5000</td><td>3072</td><td>128</td><td>5000</td></tr><tr><td>TextCaps</td><td>4096</td><td>256</td><td>5000</td><td>3072</td><td>128</td><td>5000</td></tr></table>
|
| 314 |
+
|
| 315 |
+
# E WARMUP STAGE EXAMPLE
|
| 316 |
+
|
| 317 |
+

|
| 318 |
+
Figure 7: Example of input-output pairs during the warmup stage.
|
| 319 |
+
|
| 320 |
+
Exposing the model to a short, intense “warmup” stage of simply learning to read, results in a strong curriculum learning effect where (1) pretraining is more stable and converges faster, and (2) we observe better finetuning performance. Figure 7 shows an example of rendered text from the Books corpus with its “parse”.
|
| 321 |
+
|
| 322 |
+
# F PRETRAINING EXAMPLES
|
| 323 |
+
|
| 324 |
+
The figures below show screenshots of our pretraining data along with ground-truth and predicted parses.
|
| 325 |
+
|
| 326 |
+

|
| 327 |
+
|
| 328 |
+
# Ground-truth Parse
|
| 329 |
+
|
| 330 |
+
$< < < < \mathrm { C }$ rossFit Thunderhawk | Rio Rancho> <dedicated to promote healthy kids and teens in Rio Rancho, ${ \tt N M } > >$ <<Home> <About> <Schedule> <Media> <Blog> <Contact Us> <Free Class>>>
|
| 331 |
+
<<Drop-ins> <Bring your child in for a drop-in to get a WOD in! $! > >$ $< < < \pm \ : \mathrm { { T f } }$ you are visiting from out of town or traveling for club sports, make sure your child’s routine is not disrupted. Bring them in for a drop in to get a WOD in $\downarrow >$ $< < 1$ -day CrossFit Athlete $\$ 152$ <1-day Competitor $\$ 25>>$ <<Become A Member> <We’d love to meet you and show you around.>>>>
|
| 332 |
+
|
| 333 |
+
# Predicted Parse
|
| 334 |
+
|
| 335 |
+
<<<<img_src $=$ thunderhawk-logo-white img_alt $=$ Thunderhawk Sports & Fitness> <Thunderhawk Sports & Fitness>> <<Home> <About> <Programs> <Team> <Blog> <Contact Us> <Get Started>>> <<<Drop-Ins> <Bring your child in for a drop-in to get a workout>> <<<If you are visiting from out of town or traveling for club sports, make sure your child’s routine is not disrupted. Bring them to our drop-in for a full session!> <<1:1 drop-in for
|
| 336 |
+
|
| 337 |
+

|
| 338 |
+
|
| 339 |
+

|
| 340 |
+
|
| 341 |
+
# Ground-truth Parse
|
| 342 |
+
|
| 343 |
+
<, I tried something Valentine’s themed. If you’d like to help raise money for fighting children’s cancer you can follow the link right above and help out, too. As inspiration for this semi-homemade recipe, I looked at the two recipes on the bag of sweet dough, I got an idea and today I’m going to share with you how that worked out. \xa0 I got the bag of Sweet Dough using a coupon for a free product that was sent to my by Rhodes BakeNServ in exchange for testing out their products and sharing the results with all of you; no other form of compensation was received.>
|
| 344 |
+
|
| 345 |
+
# Predicted Parse
|
| 346 |
+
|
| 347 |
+
<, I tried something Valentine’s themed. If you’d like to help out, I think you’d go right ahead and do a post. Click on the link right above and help out, too. As inspiration for this semi-homemade recipe, I’ve shared up two recipes on the bag of sweet dough. I got an idea and today $\mathbb { T } ^ { \prime } \mathbb { m }$ going to share with you the second one. Thank you for any of the amazing baking ideas plus this free product that was sent to my by Rhodes BakeNServ in exchange for testing. I’m really excited and sharing this recipe with all of you
|
| 348 |
+
|
| 349 |
+

|
| 350 |
+
|
| 351 |
+
# Ground-truth Parse
|
| 352 |
+
|
| 353 |
+
$< < < 1 0 0 \%$ FEMALE $100 \%$ UV PROTECTION SINCE $1 9 9 9 >$ <FAST FREE SHIPPING>>
|
| 354 |
+
<img_alt $=$ Velvet Eyewear>
|
| 355 |
+
$< < < < \mathbb { F }$ ringe Benefits> <<Posted by> <Lindsay Sperin> <on> <August 19, $2 0 1 6 > > >$ <<img_src $=$ img> <Fall is undeniably the best season for fashion for a multitude of reasons.> <img_src $=$ img>>> <<NEWS> <<Polarized vs. UV Protection - What’s The Difference?> <What’s Hot in The Hamptons>>>>
|
| 356 |
+
<<img_src $=$ en-us img_alt $=$ en> <English>>>
|
| 357 |
+
|
| 358 |
+
# Predicted Parse
|
| 359 |
+
|
| 360 |
+
$< < < 1 0 \%$ OFF YOUR FIRST ORDER WITH CODE: FIRST10> <FAST FREE SHIPPING>>
|
| 361 |
+
<img_alt $=$ Velvet>
|
| 362 |
+
<<<<Fringe Benefits> <<Posted by> <Velvet Fashion> <on> <October 1, $2 0 1 8 > > >$ <<Fall is undeniably the best season for fashion for a multitude of reasons.> <img_alt $=$ Fringe Benefits>>> <<Search> <<Polarized vs. UV Protection: Velvet’s Best Sunscreen> <The Best Sunblock Sunscreen>>>>>
|
| 363 |
+
|
| 364 |
+

|
| 365 |
+
|
| 366 |
+
# Ground-truth Parse
|
| 367 |
+
|
| 368 |
+
<img_src $=$ ftg_webheader>
|
| 369 |
+
<<<Spin-Off Games> <<Fairytale Games is a growing universe. Because of this, we have and will continue to grow spin-off games that utilize characters, storylines, and even poke fun of our games. Keep checking back and you just might be surprised at what you see!> <<Rumplestiltskin!> <Super Fairytale Fighters $2 > >$ <<<Share this:> <<Twitter> <Facebook>>> <Loading... $> > > >$
|
| 370 |
+
<<Leave a Reply> <<<Your email address will not be published.> <<Required fields are marked> <\*>>> <<Comment> <\*>>>>>>
|
| 371 |
+
|
| 372 |
+
# Predicted Parse
|
| 373 |
+
|
| 374 |
+
<img_src $=$ cropped-blogheader>
|
| 375 |
+
<<<Fairytale Games> <<Fairytale Games is a growing universe. Because of this, we are excited to continue to grow spin-off games that utilize characters, storylines, and even poke fun of our games. Keep checking back and you just might be surprised at what you see!> <<Fairytale Games> <Fairytale Games on Steam>> <<<Share this:> <<Twitter> <Facebook>>> <Loading...>>>>
|
| 376 |
+
<<Leave a Reply> <<<Your email address will not be published.> <<Required fields are marked
|
| 377 |
+
|
| 378 |
+

|
| 379 |
+
|
| 380 |
+
# Ground-truth Parse
|
| 381 |
+
|
| 382 |
+
<<<<Coronavirus Update! We are open and ready to help you.> <We are conducting most of our appointments via phone to help prevent the spread of the virus. $> >$ <Chapter 13 Coronavirus Update>> <<img_src $=$ Logoo img_alt $=$ Stamps & Stamps Attorneys At Law> <img_src $=$ Phone> <Contact for a free Initial Consultation> <<Call Us> $<$ (937) $2 4 7 - 6 4 4 7 > >$ <<Text Us> $<$ (937) $2 6 5 - 6 4 1 8 > > >$
|
| 383 |
+
<<Home> <About> <Articles> <Videos> <Testimonials> <Tax Relief> <News> <Podcasts> <Rate Us> <Contact>>
|
| 384 |
+
<<We can provide the guidance you need to get through stressful family> <disputes with your rights and interests intact.>> <<<img_src $=$ Bankruptcy img_alt $=$ Bankruptcy Overview> <<Bankruptcy> <Overview>>> <img_src $=$ Criminal-Defense1 img_alt $=$ Criminal Defense & Traffic Offenses>>>
|
| 385 |
+
|
| 386 |
+
# Predicted Parse
|
| 387 |
+
|
| 388 |
+
<<<<Coronavirus Update! We are open and ready to help you.> <We are conducting most of our appointments via phone to help prevent the spread of infection. $> >$ <CLICK HERE FOR MORE INFO>>
|
| 389 |
+
<<img_src $=$ logo img_alt $=$ Stamps & Stamps Attorneys At Law> <img_src $=$ phone> <<<Call Us> $<$ (904) 222-2222>> <<Text Us> $<$ (904) 222-2222>>>>
|
| 390 |
+
<<Home> <About> <Articles> <
|
md/dev/UhEJz3wgLnG/UhEJz3wgLnG.md
ADDED
|
@@ -0,0 +1,428 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# REVEALING SINGLE FRAME BIASFOR VIDEO-AND-LANGUAGE LEARNING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Training an effective video-and-language model intuitively requires multiple frames as model inputs. However, it is unclear whether using multiple frames is beneficial to downstream tasks, and if yes, whether the performance gain is worth the drastically-increased computation and memory costs resulting from using more frames. In this work, we explore single-frame models for video-andlanguage learning. On a diverse set of video-and-language tasks (including textto-video retrieval and video question answering), we show the surprising result that, with large-scale pre-training and a proper frame ensemble strategy at inference time, a single-frame trained model that does not consider temporal information can achieve better performance than existing methods that use multiple frames for training. This result reveals the existence of a strong “static appearance bias” in popular video-and-language datasets. Therefore, to allow for a more comprehensive evaluation of video-and-language models, we propose two new retrieval tasks based on existing fine-grained action recognition datasets that encourage temporal modeling. Code and models will be released upon acceptance.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Video and language are the two primary signals that constitute much of the world we perceive every day – we observe our surrounding environment with our eyes in the form of continuous visual input (video), and communicate with others via language. Intuitively, this leads one to assume that training an effective video-and-language model should require multiple video frames as input. Standard methods Zhu & Yang (2020); Xu et al. (2021); Li et al. (2020a); Luo et al. (2021) in this area typically use multiple densely sampled frames for training. Recent work Lei et al. (2021) proposes sparse sampling for video-and-language understanding, where it claims that a few sparsely sampled clips are sufficient for learning due to the high redundancy in videos. This technique has shown Lei et al. (2021); Zellers et al. (2021) to be successful in various video-language benchmarks Jang et al. (2017); Xu et al. (2016); Anne Hendricks et al. (2017); Krishna et al. (2017a); Xu et al. (2017); Yu et al. (2018); Lei et al. (2018). However, as demonstrated in Bain et al. (2021); Luo et al. (2021); Lei et al. (2021), training with fewer frames (e.g., a single frame) leads to significantly worse performance compared to their multi-frame counterparts. In contrast, in this work, we show that with proper modeling, single-frame models could achieve competitive performance, hence also revealing “static appearance bias” in popular video-and-language datasets.
|
| 12 |
+
|
| 13 |
+
We start by building a standard image-language model, with a vision encoder and a language encoder for image and text encoding, followed by a multi-modal encoder with cross-attention for cross-modal fusion. We pre-train the model on large-scale image-text and video-text datasets Chen et al. (2015); Krishna et al. (2017b); Ordonez et al. (2011); Sharma et al. (2018); Changpinyo et al. (2021); Bain et al. (2021). For fine-tuning, we randomly sample a single frame for training, and ensemble multiple uniformly sampled frames per video for making a video-level prediction at inference.
|
| 14 |
+
|
| 15 |
+
Single-frame predictions are often noisy and inaccurate, as they are made from incomplete information from single-frames without any context (see examples in Figure 5). Due to this issue, singleframe training typically performs significantly worse than multi-frame training Lei et al. (2021); Bain et al. (2021); Luo et al. (2021). Previous work Hendrycks et al. (2019) suggests that pretraining improves model robustness in the face of label corruption for image recognition. Inspired by this, we hypothesize that large-scale pre-training helps mitigate noise from single-frame training. Our analyses in Section 5 agree with our hypothesis, showing that as we increase pre-training data size, the performance of our single-frame model improves drastically and its gap with a similarly trained multi-frame model is largely eliminated. Besides training, these noisy single-frame predictions also render simple late fusion (e.g., mean-pooling in ClipBERT Lei et al. (2021)) less effective at inference time. To deal with this issue, we propose an early fusion strategy, which takes all frames as model inputs for directly making a more informative video-level prediction. Our analyses show that this early fusion ensemble method outperforms late fusion strategies and also delivers consistently improved performance when more frames are used.
|
| 16 |
+
|
| 17 |
+
We compare our approach with existing methods on six datasets across two video-language tasks, including text-to-video retrieval (MSRVTT Xu et al. (2016), DiDeMo Anne Hendricks et al. (2017), and ActivityNet Captions Krishna et al. (2017a)) and video question answering (MSRVTT-QA Xu et al. (2017), ActivityNet-QA Yu et al. (2019), and MSRVTT-MC Yu et al. (2018)). Results show that our approach achieves competitive (mostly better) performance than existing methods that use more training frames and more pre-training data, setting new state-of-the-art for multiple tasks. This conclusion holds for short 15-second videos in MSRVTT to 180-second videos in ActivityNet, demonstrating the effectiveness of our single-frame approach in various scenarios.
|
| 18 |
+
|
| 19 |
+
More importantly, this strong single-frame performance reveals that the current evaluation is biased towards still objects, scenes, etc., while the temporal dynamics seem negligible, which in fact should be important for “true” video-language understanding. To address this issue, we next propose two new tasks that are designed to test models’ true temporal modeling ability. Based on the videos and annotations from the find-grained action recognition dataset Something-Something v2 (SSv2) Goyal et al. (2017a), we create two text-to-video retrieval tasks, one that use SSv2’s action template as text queries, e.g., “Throwing [something] in the air and catching it”, and another that uses its annotated label as text queries, e.g., “Throwing keys in the air and catching it”. See examples in Figure 2. This template task removes the objects and only keeps the actions, enabling an evaluation that focuses almost solely on temporal modeling. The label task, on the other hand, contains both actions and objects, requiring an understanding of both still objects and their motion. Lastly, we present several baselines on these new tasks and show that temporal modeling is essential in achieving high scores.
|
| 20 |
+
|
| 21 |
+
In summary, our contributions are three-fold: (i) We explore single-frame training for video-andlanguage tasks. While simple, our approach can achieve state-of-the-art performance on a range of datasets, including both text-to-video retrieval and video question answering. Importantly, this result reveals the surprising static appearance bias in these existing datasets. (ii) We conduct careful analyses, which show that large-scale pre-training and a proper multi-frame ensemble strategy at inference are the core for single-frame trained models to be successful. (iii) We propose two new tasks specifically designed for testing models’ ability for find-grained temporal modeling. These two new tasks complement existing benchmarks for a more comprehensive evaluation.
|
| 22 |
+
|
| 23 |
+
# 2 RELATED WORK
|
| 24 |
+
|
| 25 |
+
Vision and Language. Vision and language learning considers the problem of learning from both visual and textual signals. Depending on their visual input type, methods in this area can be roughly categorized into two types, one with image Anderson et al. (2018); Tan & Bansal (2019); Lu et al. (2019); Chen et al. (2020); Li et al. (2019; 2020b; 2021b; 2022); Radford et al. (2021) and another with video Anne Hendricks et al. (2017); Sun et al. (2019); Zhu & Yang (2020); Xu et al. (2021); Li et al. (2020a); Lei et al. (2021); Zellers et al. (2021); Bain et al. (2021); Lin et al. (2021). Standard video-and-language methods Zhu & Yang (2020); Xu et al. (2021); Li et al. (2020a); Lei et al. (2021); Zellers et al. (2021); Luo et al. (2021) are typically trained with multiple video frames. This multi-frame training strategy has been the norm and is shown to work well across various datasets $\mathrm { X u }$ et al. (2016); Anne Hendricks et al. (2017); Krishna et al. (2017a); Jang et al. (2017); Xu et al. (2017); Lei et al. (2018; 2020). Unlike previous work that uses multiple frames for training, we explore single-frame training (i.e., similar to training an image-text model) and show it achieves strong performance on existing video-text benchmarks. Concurrent work Buch et al. (2022) proposes a new module, atemporal probe, for selecting the best single-frame as inputs to a trained image-text model during inference; whereas we utilize multiple uniformly sampled frames and study more effective ways of ensembling information from multiple frames.
|
| 26 |
+
|
| 27 |
+

|
| 28 |
+
Figure 1: SINGULARITY model overview. During training, we randomly sample a single frame as input, and make a video level prediction based on the information from this single frame along with its paired text input. During inference, we uniformly sample multiple frames, and early fuse their encoded image-level representations as input to the multi-modal encoder. See details in Section 3.
|
| 29 |
+
|
| 30 |
+
Dataset Bias. Biases are prevalent in datasets Goyal et al. (2017b); Gururangan et al. (2018); Li et al. (2018); Escorcia et al. (2019); Zellers et al. (2019); Lei et al. (2020). For example, Zhang et al. Zhang et al. (2016) pointed out that blindly answering “yes” to yes/no questions in VQA Antol et al. (2015) without looking at their corresponding images results in an accuracy of $87 \%$ ; Li et al. Li et al. (2018) discovered that many video action recognition datasets, such as Kinetics Kay et al. (2017) and UCF-101 Soomro et al. (2012), have a strong static representation, where a linear classifier trained on static appearance (e.g., object, scene, and people) representations achieves much higher performance than chance. In this work, we find similar static appearance bias exists in popular video-language datasets Xu et al. (2016); Anne Hendricks et al. (2017); Krishna et al. (2017a); $\mathrm { X u }$ et al. (2017); Yu et al. (2018; 2019), in which our models trained with single frames could achieve surprisingly good performance, even compared to models that perform explicit temporal modeling. When datasets are biased, they provide incorrect indications of the models’ ability. To allow for a more comprehensive evaluation, we propose two new tasks based on an existing action recognition dataset SSv2 Goyal et al. (2017a) to test the true temporal modeling ability of models.
|
| 31 |
+
|
| 32 |
+
# 3 METHODS
|
| 33 |
+
|
| 34 |
+
Model Architecture. Figure 1 shows an overview of our model (dubbed SINGULARITY). It consists of 3 main components, a vision encoder $\mathcal { F } _ { v }$ , a language encoder $\mathcal { F } _ { l }$ , and a multi-modal encoder $\mathcal { H }$ . The vision encoder is an image-level visual backbone model, such as ViT Dosovitskiy et al. (2020). The language encoder is an arbitrary language model such as BERT Devlin et al. (2019). For the multi-modal encoder, we use a transformer encoder Vaswani et al. (2017), in which each layer contains a self-attention, a cross-attention, and a feed-forward network (FFN). The cross-attention layer is used to gather information from encoded visual representations using the text as key, similar to recent work Jaegle et al. (2021; 2022); Li et al. (2021b; 2022).
|
| 35 |
+
|
| 36 |
+
We denote a video $V$ contains $T$ frames as $V { = } [ f _ { 1 } , f _ { 2 } , . . . , f _ { T } ]$ , its paired text as $S$ . During training, we randomly sample a single frame $f _ { t }$ from $V$ as model input , where $t \in \{ 1 , . . . , T \}$ . Its encoded representation can be written as $\mathcal { F } _ { v } ( \bar { f } _ { t } ) \in \mathbb { R } ^ { L _ { v } \times D }$ . For text, the encoded representation is $\mathcal { F } _ { l } ( S ) \in$ $\mathbb { R } ^ { \hat { L } _ { l } \times D }$ . $L _ { v }$ and $L _ { l }$ are encoded sequence lengths, $D$ is hidden size. We next make a prediction $p$ as:
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
\begin{array} { r l r } & { } & { { \boldsymbol { p } } = \mathcal { H } ( \ \mathcal { F } _ { l } ( S ) \ , \ \mathcal { F } _ { v } ( f _ { t } ) \ ) , } \\ & { } & { \mathsf { \boldsymbol { Q } } , \mathsf { K } , \mathsf { V } \ \mathrm { f o r \ s e l f - a t t } ; \mathsf { Q } \ \mathrm { f o r \ c r o s s - a t t } \ \uparrow \qquad \mathsf { \langle K , V \ f o r \ c r o s s - a t t \ \hat { \Pi } \ } } \end{array}
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
where Q, K, V denote the query, key, and value matrices of self- and cross-attention Vaswani et al. (2017). We calculate loss based on this prediction. During inference, we uniformly sample $T _ { t e s t }$ frames $\{ f _ { \tau _ { i } } \} _ { i = 1 } ^ { T _ { t e s t } }$ . Each frame is encoded separately, and their encoded representations are concate
|
| 43 |
+
|
| 44 |
+
nated as inputs to the multi-modal encoder to get a video-level prediction score:
|
| 45 |
+
|
| 46 |
+
$$
|
| 47 |
+
p = \mathcal { H } ( \mathcal { F } _ { l } ( S ) \mathrm { ~ , ~ } [ \mathcal { F } _ { v } ( f _ { \tau _ { 1 } } ) ; . . . ; \mathcal { F } _ { v } ( f _ { \tau _ { T _ { t e s t } } } ) ] \mathrm { ~ ) , ~ }
|
| 48 |
+
$$
|
| 49 |
+
|
| 50 |
+
where $[ ; ]$ denotes concatenation, and $[ \mathcal { F } _ { v } ( f _ { \tau _ { 1 } } ) ; . . . ; \mathcal { F } _ { v } ( f _ { \tau _ { T _ { t e s t } } } ) ] \in \mathbb { R } ^ { ( T _ { t e s t } \times L _ { v } ) \times D }$ . This early fusion design allows our model to make an informed prediction given full context. In ClipBERT Lei et al. (2021), an alternative late fusion design is used: scores are computed for each frame separately, and video-level score is obtained via a manually designed aggregation function $\mathcal { G }$ (e.g., mean-pooling):
|
| 51 |
+
|
| 52 |
+
$$
|
| 53 |
+
p = \mathcal { G } ( p _ { \tau _ { 1 } } , p _ { \tau _ { 2 } } , p _ { \tau _ { T _ { t e s t } } } ) ; p _ { \tau _ { i } } = \mathcal { H } ( \mathcal { F } _ { l } ( S ) \ , \ \mathcal { F } _ { v } ( f _ { \tau _ { i } } ) \ ) .
|
| 54 |
+
$$
|
| 55 |
+
|
| 56 |
+
Since the predictions in late fusion are made with incomplete information from individual frames, they can be quite noisy. In Section 5, we provide a detailed comparison w.r.t. these different frame ensemble methods and show that early fusion consistently outperforms late fusion.
|
| 57 |
+
|
| 58 |
+
Pre-Training Objectives. The model is trained with 3 losses: (i) Vision-Text Contrastive: a contrastive loss that aligns the pooled vision and text representations from the vision and language encoders. (ii) Masked Language Modeling (MLM) Devlin et al. (2019): predicting masked tokens from their text and visual context, with multi-modal encoder. (iii) Vision-Text Matching: predicting the matching score of a vision-text pair with multi-modal encoder. These losses have shown to be effective in learning multi-modal representations Tan & Bansal (2019); Chen et al. (2020); Li et al. (2021a;b); Lei et al. (2021); Radford et al. (2021). More details are in Appendix.
|
| 59 |
+
|
| 60 |
+
Implementation Details. As our model trains with single frames, in addition to video-text data, it can also utilize image-text data for pre-training. For image-text data, we use a combination of COCO Chen et al. (2015), Visual Genome (VG) Krishna et al. (2017b), SBU Captions Ordonez et al. (2011), CC3M Sharma et al. (2018), and CC12M Changpinyo et al. (2021). For video-text data, we use WebVid Bain et al. (2021). Note that, even for video-text data, we only sample a single frame from the whole video for training. We pre-train the model on two different subsets of the datasets: (i) 5M corpus that contains 5.44M images and videos from CC3M+WebVid, and (ii) 17M corpus that contains 17.28M images and videos from all the datasets above.
|
| 61 |
+
|
| 62 |
+
Our model is implemented in PyTorch Paszke et al. (2019). The vision encoder is initialized using the BEiTBASE Bao et al. (2021) model pre-trained on ImageNet-21K Deng et al. (2009). The text encoder is initialized from the first 9 layers of BERTBASE Devlin et al. (2019). The multi-modal encoder is initialized from the last 3 layers of the same BERTBASE model, though its cross-attention layers are randomly initialized. We optimize the model for 10 epochs using AdamW Loshchilov & Hutter (2019) optimizer with an initial learning rate of 1e-4. We warm up the learning rate in the first epoch followed by cosine decay Loshchilov & Hutter (2017) to 1e-6 during the rest of the training. Mixed precision is used for faster training. The batch size is set to 128 per GPU, and we train the model on 3 NVIDIA A100 GPUs with input image size $2 2 4 \times 2 2 4$ . We perform basic augmentations: random resize, crop, and flip to the frames/images during training. This pre-training takes around 1 day on the 5M corpus, and 4 days on the 17M corpus. Our pre-training is quite efficient compared to other similar work, e.g., 10 epochs’ pre-training in AlignPrompt Li et al. (2021a) takes 3 days on the same 5M corpus using 16 A100 GPUs, this amounts to $1 6 \times$ computation cost of our pre-training.
|
| 63 |
+
|
| 64 |
+
# 4 EXPERIMENTS AND RESULTS ON EXISTING DATASETS
|
| 65 |
+
|
| 66 |
+
# 4.1 DOWNSTREAM TASK SETUP
|
| 67 |
+
|
| 68 |
+
Text-to-Video Retrieval. Given a text query, the goal of this task is to retrieve relevant videos from a large collection of videos. We evaluate our model on the following datasets: (i) MSRVTT Xu et al. (2016) contains 10K YouTube videos, each paired with 20 captions. We follow Yu et al. (2018); Lei et al. (2021) to use the 7K train+val videos for training, and report results on the 1K test set. (ii) DiDeMo Anne Hendricks et al. (2017) contains 10K Flickr videos with 41K captions. We use standard train/val/test splits. (iii) ActivityNet Captions Krishna et al. (2017a) contains 20K YouTube videos with 100K captions. We use the train split with 10K videos for training, and we report results on the widely used val1 split, with 4.9K videos. For MSRVTT, we evaluate standard text-to-video retrieval. For DiDeMo and ActivityNet Captions, we evaluate paragraph-tovideo retrieval Liu et al. (2020); Lei et al. (2021); Luo et al. (2021), where the text captions in the same video are concatenated as a single paragraph-level text for retrieval. We report performance using recall at K $( \mathbb { R } ^ { \ @ \mathrm { K } } )$ .
|
| 69 |
+
|
| 70 |
+
Table 1: Comparison to existing methods on text-to-video retrieval. #PT denotes the number of images and or videos used in cross-modal pre-training. #Train Frame denotes the number of frames used at each training step during fine-tuning. For models that use different number of frames for different datasets, we list them together with a separator $" / "$ . We gray out methods that use significantly more pre-training data for a fair comparison. The 136M corpus is from HowTo100M Miech et al. (2019), 0.2M refers to $_ \mathrm { C O C O + V G }$ data, 138M is the combination of HowTo100M and WebVid, 400M is the private image-text data used in CLIP Radford et al. (2021).
|
| 71 |
+
|
| 72 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">#PT</td><td rowspan="2">#Train</td><td colspan="3">MSRVTT</td><td colspan="3">DiDeMo</td><td colspan="3">ActivityNet Cap</td></tr><tr><td>Frame</td><td>R1 </td><td></td><td></td><td></td><td></td><td></td><td></td><td>R5 R10 R1 R5 R10 R1 R5 R10</td></tr><tr><td>HERO (Li et al., 2020a)</td><td>136M</td><td>310</td><td>20.5 47.6 60.9</td><td></td><td></td><td>=</td><td>-</td><td></td><td>=</td><td>-</td><td>-</td></tr><tr><td>ClipBERT (Lei et al., 2021)</td><td>0.2M</td><td>16/16/8</td><td></td><td></td><td></td><td>22.0 46.8 59.9 20.4 48.0 60.8 21.3 49.0 63.5</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td> VideoCLIP (Xu et al., 2021)</td><td>136M</td><td>960</td><td>30.9 55.4 66.8</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Frozen (Bain et al., 2021)</td><td>5M</td><td>4</td><td></td><td></td><td></td><td>31.0 59.5 70.5 31.0 59.8 72.4</td><td></td><td></td><td></td><td>1</td><td>-</td></tr><tr><td>AlignPrompt (Li et al., 2021a)</td><td>5M</td><td>8</td><td></td><td></td><td></td><td>33.9 60.7 73.2 35.9 67.5 78.8</td><td></td><td></td><td></td><td>1</td><td>1</td></tr><tr><td>All-in-one (Wang et al., 2022) 138M</td><td></td><td>9</td><td></td><td></td><td></td><td>34.4 65.4 75.8 32.7 61.4 73.5 22.4 53.7 67.7</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>CLIP4Clip (Lu0 et al., 2021) 400M</td><td></td><td></td><td></td><td></td><td></td><td>12/64/64 42.0 68.6 78.7 42.8 68.5 79.2 40.5 72.4 98.2</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>SINGULARITY</td><td>5M</td><td>1</td><td></td><td></td><td></td><td>36.8 65.9 75.5 47.4 75.2 84.0 43.0 70.6 81.3</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>SINGULARITY</td><td>17M</td><td>1</td><td></td><td></td><td></td><td>41.5 68.7 77.0 53.9 79.4 86.9 47.1 75.5 85.5</td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 73 |
+
|
| 74 |
+
For fine-tuning, we use the same architecture as pre-training, except that MLM loss is removed. We use an initial learning rate of 1e-5 with cosine decay to 1e-6. We use a batch size of 32, and train the model for 5 epochs for MSRVTT, 10 epochs for DiDeMo and ActivityNet Captions. During training, we use a single frame per video. During testing, we use 12 frames per video for MSRVTT and DiDeMo, and 32 frames for ActivityNet Captions since it has longer videos. On a single A100, this fine-tuning takes around 1.5 hours for MSRVTT, 0.5 hours for ActivityNet Captions or DiDeMo.
|
| 75 |
+
|
| 76 |
+
Video Question Answering. Given a video (often with a text question), this task requires generating an answer to the question or selecting the most suitable answer from a set of candidates. (i) MSRVTT-QA Xu et al. (2017) contains 244K open-ended questions on 10K MSRVTT videos. (ii) ActivityNet-QA Yu et al. (2019) contains 58K open-ended questions on 5.8K sampled videos from ActivityNet Caba Heilbron et al. (2015). (iii) MSRVTT-MC Yu et al. (2018) is a multiple-choice task that requires selecting the matched caption from a set of 5 candidate captions for each video (3K videos from MSRVTT). We use standard train/val/test splits for the three tasks, and report accuracy.
|
| 77 |
+
|
| 78 |
+
For open-ended QA, we add an extra multi-modal decoder (initialized from pre-trained multi-modal encoder) that takes in multi-modal encoder outputs as cross-attention inputs, and decodes answer text with “[CLS]” as the start token (see details in Appendix). We use an initial learning rate of 1e-5, and warm up the learning rate in the first half epoch, followed by cosine decay to 1e-6. We use a batch size of 32, and train the model for 10 epochs. On a single A100 GPU, this fine-tuning takes around 4 hours for MSRVTT-QA, and 1 hour for ActivityNet-QA. We use a single frame per video for training, 12 frames for testing. For MSRVTT-MC, we follow Lei et al. (2021) to use the model trained on MSRVTT retrieval, and select the option with the highest retrieval score as the prediction.
|
| 79 |
+
|
| 80 |
+
For all downstream tasks, we use the same input image size $2 2 4 \times 2 2 4$ and image augmentations as in pre-training. During inference, we resize the input video frames to $2 2 4 \times 2 2 4$ .
|
| 81 |
+
|
| 82 |
+
# 4.2 COMPARISON TO STATE-OF-THE-ART ON EXISTING DATASETS
|
| 83 |
+
|
| 84 |
+
Text-to-Video Retrieval Results. In Table 1, we compare SINGULARITY with existing methods on text-to-video retrieval. Across all the datasets, SINGULARITY (5M) achieves better performance compared to methods trained on similar amounts of data, while using only single frames for training. On DiDeMo and ActivityNet Captions, SINGULARITY (5M) outperforms all previous work, including many that pre-train on significantly larger amounts of data, e.g., 400M image-text pairs
|
| 85 |
+
|
| 86 |
+
Table 2: Comparison to existing methods on video question answering. The 69M corpus is the 69M video questions in Yang et al. (2021), 180M refers to the 180M YouTube clip-text pairs in YT-Temporal-180M Zellers et al. (2021).
|
| 87 |
+
|
| 88 |
+
<table><tr><td>Method</td><td>#PT</td><td>#Train Frame MSRVTT-QA ActivityNet-QA MSRVTT-MC</td><td></td><td></td><td></td></tr><tr><td>ClipBERT (Lei et al., 2021)</td><td>0.2M</td><td>16</td><td>37.4</td><td></td><td>88.2</td></tr><tr><td>AlignPrompt (Li et al., 2021a)</td><td>5M</td><td>16</td><td>42.1</td><td></td><td>1</td></tr><tr><td>JustAsk (Yang et al., 2021)</td><td>69M</td><td>640</td><td>41.5</td><td>38.9</td><td>-</td></tr><tr><td>MERLOT (Zellers et al., 2021)</td><td>180M</td><td>5</td><td>43.1</td><td>41.4</td><td>90.9</td></tr><tr><td>VideoCLIP (Xu et al., 2021)</td><td>136M</td><td>960</td><td>-</td><td>-</td><td>92.1</td></tr><tr><td>All-in-one (Wang et al., 2022)</td><td>138M</td><td>9</td><td>44.3</td><td>-</td><td>92.0</td></tr><tr><td>SINGULARITY</td><td>5M</td><td>1</td><td>42.7</td><td>41.8</td><td>92.0</td></tr><tr><td>SINGULARITY</td><td>17M</td><td>1</td><td>43.5</td><td>43.1</td><td>92.1</td></tr></table>
|
| 89 |
+
|
| 90 |
+

|
| 91 |
+
template: Throwing [something] in the air and catching it. label: Throwing keys in the air and catching it.
|
| 92 |
+
|
| 93 |
+

|
| 94 |
+
template: Throwing [something] in the air and letting it fall. label: Throwing keys in the air and letting it fall.
|
| 95 |
+
|
| 96 |
+
Figure 2: SSv2 examples. For each video, we show 3 temporally-ordered frames with their template and label annotations. Based on these annotations, we propose two new retrieval tasks, using “template” and “label” as text queries, respectively.
|
| 97 |
+
|
| 98 |
+
in CLIP4Clip Luo et al. (2021), or 136M video-text pairs in VideoCLIP Xu et al. (2021) compared to 5M image-text and video-text pairs in SINGULARITY. We also note that our model is trained with single frames, while previous work uses many more frames, e.g., 64 frames in CLIP4Clip or 8 frames in AlignPrompt Li et al. (2021a). When trained with a larger amount of data (17M), we notice a further performance boost for our model, demonstrating that SINGULARITY benefits from large-scale pre-training.
|
| 99 |
+
|
| 100 |
+
Video QA Results. Table 2 compares SINGULARITY with existing methods on video question answering. We notice SINGULARITY (5M) achieves competitive performance with previous work even when using two orders of magnitude smaller pre-training data, e.g., 180M video-text pairs in MERLOT Zellers et al. (2021) vs. 5M image-text and video-text pairs. Our method also surpasses the strong video QA model JustAsk Yang et al. (2021), which is specifically designed for video QA and is pre-trained on 69M video QA pairs. When pre-trained with more data, our model performance further improves. These comparisons show the effectiveness of our single-frame approach.
|
| 101 |
+
|
| 102 |
+
Beyond what are present in the main text, we also provide additional results in Appendix: (i) SINGULARITY-temporal (introduced in Section 4.3) results on retrieval and QA; (ii) zero-shot retrieval; (iii) image-text retrieval; $( i v )$ VQA Antol et al. (2015), etc.
|
| 103 |
+
|
| 104 |
+
# 4.3 NEW TASKS THAT REQUIRE TEMPORAL MODELING
|
| 105 |
+
|
| 106 |
+
In the previous section, we revealed the interesting observation that popular video-language datasets have strong static appearance biases – enabling our model that uses only a single frame per video at each training step to achieve competitive performance compared to state-of-the-art models that digest multiple temporally-ordered frames. The biased evaluation on these datasets favors models that are strong in recognizing static concepts, and does not provide a good indicator of whether these models are capable of recognizing fine-grained temporal relationships between neighboring frames.
|
| 107 |
+
|
| 108 |
+
Hence, to address this issue, we propose two new datasets that complement existing datasets for a more comprehensive evaluation of video-and-language methods. We draw inspiration from the video action recognition community, and transform the temporally-heavy action recognition dataset Something-Something v2 (SSv2) Goyal et al. (2017a) into video-and-language datasets. In Figure 2, we show SSv2 examples. A unique property of the SSv2 dataset is that the videos often require finegrained temporal modeling to correctly predict their action classes. For example, to match the videos and their action classes (template) in Figure 2(a-b), one has to look at multiple temporally ordered frames. Based on SSv2 videos and annotations, we define two text-to-video retrieval tasks:
|
| 109 |
+
|
| 110 |
+
Table 3: Comparison to existing methods on SSv2 tasks. \* The training of Frozen on the SSv2-label retrieval task fails to converge despite our best efforts in tuning the model.
|
| 111 |
+
|
| 112 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">#PT</td><td rowspan="2">#Train Frame</td><td colspan="3">SSv2-label</td><td colspan="3">SSv2-template</td></tr><tr><td>R1</td><td>R5</td><td>R10</td><td>R1</td><td>R5</td><td>R10</td></tr><tr><td>Frozen (Bain et al., 2021)*</td><td>5M</td><td>4</td><td>1</td><td>1</td><td>1</td><td>52.9</td><td>94.8</td><td>99.4</td></tr><tr><td>CLIP4Clip (Luo et al., 2021)</td><td>400M</td><td>12</td><td>43.1</td><td>71.4</td><td>80.7</td><td>77.0</td><td>96.6</td><td>98.3</td></tr><tr><td>SINGULARITY</td><td>5M</td><td>1</td><td>36.4</td><td>64.9</td><td>75.4</td><td>42.0</td><td>86.2</td><td>94.3</td></tr><tr><td>SINGULARITY-temporal</td><td>5M</td><td>4</td><td>44.1</td><td>73.5</td><td>82.2</td><td>77.0</td><td>98.9</td><td>99.4</td></tr><tr><td>SINGULARITY-temporal</td><td>17M</td><td>4</td><td>47.4</td><td>75.9</td><td>84.0</td><td>77.6</td><td>96.0</td><td>98.9</td></tr></table>
|
| 113 |
+
|
| 114 |
+
• SSv2-Template Retrieval: We use the 174 templates (e.g., “Throwing [something] in the air and catching it”) in SSv2 as the text queries to retrieve videos. We use 168,913 SSv2 training videos for training. As ground-truth annotations for test videos are not available, we use validation videos: we sample 12 videos for each template, with a total of 2,088 videos for testing.
|
| 115 |
+
|
| 116 |
+
• SSv2-Label Retrieval: We use the annotated labels (e.g., “Throwing keys in the air and catching it”) in SSv2 as text queries to retrieve videos. We follow the same split in the template retrieval task, with 168,913 videos for training, and 2,088 videos for testing.
|
| 117 |
+
|
| 118 |
+
Since no objects are present in the text queries of the template retrieval task, it requires a deeper understanding of the actions than in the label retrieval task, while the label retrieval task provides a more comprehensive evaluation of both static and temporal understanding.
|
| 119 |
+
|
| 120 |
+
Experiments. We use Frozen Bain et al. (2021) and CLIP4Clip (seqTransf version) Luo et al. (2021) as baselines. Frozen uses a space-time transformer, CLIP4Clip is an extension based on the CLIP Radford et al. (2021) with an extra 4-layer temporal transformer encoder. We report performance using standard text-to-video retrieval metrics ${ \mathrm { R @ K } }$ . For our model, in addition to the single-frame version, we build a multi-frame variant, SINGULARITY-temporal. Specifically, we add a two-layer temporal transformer encoder following the vision encoder, and use its outputs as inputs to the multi-modal encoder (see details in Appendix). From a single-frame pre-trained checkpoint (5M or 17M), we perform a 2nd stage video pre-training with 4 frames using WebVid videos for SINGULARITY-temporal. We use an initial learning rate of 5e-5, and train the model for 5 epochs.
|
| 121 |
+
|
| 122 |
+
The results are shown in Table 3. Compared to Frozen and CLIP4Clip, while SINGULARITY shows competitive performance on existing benchmarks (see Table 1), it underperforms these methods on the two temporally-heavy tasks by a large margin. For example, SINGULARITY (5M) underperforms the 4-frame Frozen model by 10.9 for SSv2-template retrieval R1, though it shows a 16.4 improvement for DiDeMo R1, and 5.8 for MSRVTT R1. This is a good sign as it shows that the new tasks cannot be solved by models exploiting static appearance biases. On the other hand, after adding the 2-layer temporal encoder, the 4-frame SINGULARITY-temporal model gets a significant performance boost from the single-frame model, surpassing the baseline methods. When using more pre-training data $5 \mathrm { M } \to 1 7 \mathrm { M }$ ), we notice a good performance gain for SSv2-label, while the performance on SSv2-template stays similar. These observations indicate that the SSv2-label task requires both static and temporal modeling, and enhancing either will improve the task performance. For SSv2-template, as no objects exist in its text queries, it requires mostly temporal modeling.
|
| 123 |
+
|
| 124 |
+
# 5 ANALYSIS
|
| 125 |
+
|
| 126 |
+
Frames Ensemble Strategy. Our model is trained with a single-frame regime, and it uses multiple frames covering the full video at inference. As shown in Figure 3a (concat), encoded video frames are concatenated as input to the multi-modal encoder’s cross-attention layer for making a videolevel prediction. A naive alternative is to compute the prediction score for each frame separately (Figure 3b), and then aggregate these frame-level scores together to get a video-level score using an aggregation function, such as LogSumExp (lse), max-pooling and mean-pooling. This simple late fusion strategy has shown to be successful for video-and-language Lei et al. (2021) and video action recognition methods Bertasius et al. (2021); Carreira & Zisserman (2017); Wang et al. (2016).
|
| 127 |
+
|
| 128 |
+

|
| 129 |
+
Figure 4: Impact of frame ensemble strategy. Retrieval performance is shown as avg recall, i.e., average of $\mathbb { R } \ @ \{ 1 , 5 , 1 0 \}$ . We use the same finetuned checkpoint for each task, thus the results difference only comes from inference strategies.
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
|
| 133 |
+

|
| 134 |
+
Figure 3: Comparison of frame ensemble strategies at inference. concat is our early fusion strategy, lse, max, mean are the late fusion strategies studied in ClipBERT Lei et al. (2021).
|
| 135 |
+
Figure 5: Prediction score distribution for a MSRVTT-MC example. We show frame-level score distribution for each frame, and video-level score distribution for late fusion (we use mean as an example) and our early fusion (concat). The highest score for each prediction is indicated by $\checkmark$ , the correct answer is highlighted in green. Single-frame predictions are often inaccurate, unstable and they fluctuate across the frames. Late fusion can be biased by inaccurate but high confidence frame predictions, e.g., the late fusion prediction is biased towards the 4th frame prediction.
|
| 136 |
+
|
| 137 |
+
In Figure 4, we compare these different frame ensemble strategies, with varying number of frames at inference. From the comparison, we can draw the following conclusions: (i) Our early fusion strategy (concat) shows a significant gain over the three late fusion strategies (lse, max, mean) for both MSRVTT retrieval and ActivityNet-QA, demonstrating the importance of considering the whole video when making the predictions. (ii) In general, for all ensemble strategies, using more frames at inference improves model performance. However, for the late fusion strategies, sometimes using more frames hurts performance, e.g., for ActivityNet-QA, inference with over 4 frames underperforms that with 4 frames for max-pooling. This observation agrees with the MSRVTT-QA results in ClipBERT Lei et al. (2021). In contrast, early fusion delivers consistently improved performance when more frames are used. Overall, we hypothesize that the low and unstable performance of late fusion is because its video-level prediction is obtained via aggregating frame-level predictions, while these frame-level predictions can be inaccurate and unstable (see example in Figure 5) – as they are separately predicted using incomplete information within each frame, ignoring their context.
|
| 138 |
+
|
| 139 |
+
Pre-Training Data Size. In Figure 6, we study the effect of cross-modal pre-training data size for both the single-frame and the multi-frame model. We show downstream fine-tuning performance under 4 different pre-training data setups: no cross-modal pre-training (0M), pre-train on WebVid (2.49M videos), on 5M corpus (5.44M images+videos), or on 17M corpus (17.28M images+videos).
|
| 140 |
+
|
| 141 |
+
We obsereve that both 1-frame and 4-frame model greatly benefit from large-scale pre-training. When comparing the two models, an interesting observation is that, as the pre-training data size increases, the performance gap between the 1-frame and the 4-frame model decreases almost monotonically. This phenomenon suggests that, when pre-trained on a sufficient amount of data, the performance of models trained with single frames might be very close to models trained with multiple frames. Though there can be exceptions for tasks that require fine-grained temporal modeling, such as SSv2-label retrieval, where multi-frame modeling is necessary.
|
| 142 |
+
|
| 143 |
+

|
| 144 |
+
Figure 6: Model performance as a function of pre-training data size, for SINGULARITY (1-frame) and SINGULARITY-temporal (4-frame). The performance differences between the two models in each pre-training setup is also annotated, e.g., the average recall on MSRVTT retrieval for the two models without pre-training are 37.9 and 44.0, respectively, with $\cdot$ . In general, as pre-training data size increases, the performance gap between the two models decreases.
|
| 145 |
+
|
| 146 |
+
One possible explanation is that single-frame training is noisier than multi-frame training – due to incomplete context and random sampling, single-frame predictions are often inaccurate and less stable than multi-frame predictions, and pre-training is helpful Hendrycks et al. (2019) in this case. Meanwhile, single-frame training requires the model to extract all information from a single frame while a multi-frame model could rely on rich sources from multiple frames. Therefore, for downstream tasks, it is essential for the single-frame model to initialize from a strong pre-trained model.
|
| 147 |
+
|
| 148 |
+
Training Efficiency. A core advantage of single-frame training is its training efficiency. In Section 3, we discussed our pre-training cost is only 1/16 of a recent video-language model Li et al. (2021a). In Figure 7 we compare the training time and task performance of various models. We note our model (1- frame, SINGULARITY, 17M) trains much faster than the baselines $2 . 8 \times$ for 4-frame Frozen, $8 . 5 \times$ for 64-frame CLIP4Clip) while showing significantly better performance. Besides, it is also more memory efficient, i.e., its maximum allowed batch size on a single GPU is 190 while only 50 for Frozen. Experiments conducted on a single RTX A6000 GPU with 48GB memory, training time is averaged over 8,394 DiDeMo training examples. In Appendix, we show additional comparisons of various retrieval methods in terms of inference GFLOPs and the number of model parameters.
|
| 149 |
+
|
| 150 |
+

|
| 151 |
+
Figure 7: Comparison of training time and downstream task performance. The maximum allowed batch size is labeled besides each model as a reference.
|
| 152 |
+
|
| 153 |
+
# 6 CONCLUSION
|
| 154 |
+
|
| 155 |
+
In this work, we explore single-frame training for video-and-language learning. We find that, with sufficient pre-training data and a proper frame ensemble strategy at inference, our model trained with a single frame achieves surprisingly good performance on various video-text tasks, including text-to-video retrieval and video question answering. While these results show the potential of using single-frame training for various video-text tasks, it also reveals that current benchmarks are biased towards static objects and scenes, etc. To address this issue, we propose two new tasks designed to test models’ true temporal modeling ability and build several baseline methods for these new tasks. We hope these new tasks can complement existing benchmarks for a more comprehensive video-and-language understanding.
|
| 156 |
+
|
| 157 |
+
Societal Impact. Similar to many data-driven methods, the predictions from our system reflect the distribution of data on which it is trained on, and these predictions can be inaccurate and biased by the data. Therefore, users should not completely rely on the system for making real-world decisions.
|
| 158 |
+
|
| 159 |
+
# REFERENCES
|
| 160 |
+
|
| 161 |
+
Peter Anderson, Xiaodong He, Chris Buehler, Damien Teney, Mark Johnson, Stephen Gould, and Lei Zhang. Bottom-up and top-down attention for image captioning and visual question answering. In CVPR, 2018.
|
| 162 |
+
|
| 163 |
+
Lisa Anne Hendricks, Oliver Wang, Eli Shechtman, Josef Sivic, Trevor Darrell, and Bryan Russell. Localizing moments in video with natural language. In ICCV, 2017.
|
| 164 |
+
|
| 165 |
+
Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C Lawrence Zitnick, and Devi Parikh. Vqa: Visual question answering. In ICCV, 2015.
|
| 166 |
+
|
| 167 |
+
Max Bain, Arsha Nagrani, Gul Varol, and Andrew Zisserman. Frozen in time: A joint video and ¨ image encoder for end-to-end retrieval. In ICCV, 2021.
|
| 168 |
+
|
| 169 |
+
Hangbo Bao, Li Dong, and Furu Wei. Beit: Bert pre-training of image transformers. In ICLR, 2021.
|
| 170 |
+
|
| 171 |
+
Gedas Bertasius, Heng Wang, and Lorenzo Torresani. Is space-time attention all you need for video understanding. In ICML, 2021.
|
| 172 |
+
|
| 173 |
+
Shyamal Buch, Cristobal Eyzaguirre, Adrien Gaidon, Jiajun Wu, Li Fei-Fei, and Juan Carlos Niebles. Revisiting the “video” in video-language understanding. arXiv preprint arXiv:2206.01720, 2022.
|
| 174 |
+
|
| 175 |
+
Fabian Caba Heilbron, Victor Escorcia, Bernard Ghanem, and Juan Carlos Niebles. Activitynet: A large-scale video benchmark for human activity understanding. In CVPR, 2015.
|
| 176 |
+
|
| 177 |
+
Joao Carreira and Andrew Zisserman. Quo vadis, action recognition? a new model and the kinetics dataset. In CVPR, 2017.
|
| 178 |
+
|
| 179 |
+
Soravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual $1 2 \mathrm { m }$ : Pushing webscale image-text pre-training to recognize long-tail visual concepts. In CVPR, 2021.
|
| 180 |
+
|
| 181 |
+
Xinlei Chen, Hao Fang, Tsung-Yi Lin, Ramakrishna Vedantam, Saurabh Gupta, Piotr Dollar, and ´ C Lawrence Zitnick. Microsoft coco captions: Data collection and evaluation server. arXiv, 2015.
|
| 182 |
+
|
| 183 |
+
Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. Uniter: Learning universal image-text representations. In ECCV, 2020.
|
| 184 |
+
|
| 185 |
+
Jaemin Cho, Jie Lei, Hao Tan, and Mohit Bansal. Unifying vision-and-language tasks via text generation. arXiv, 2021.
|
| 186 |
+
|
| 187 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009.
|
| 188 |
+
|
| 189 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL, 2019.
|
| 190 |
+
|
| 191 |
+
Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2020.
|
| 192 |
+
|
| 193 |
+
Victor Escorcia, Mattia Soldan, Josef Sivic, Bernard Ghanem, and Bryan Russell. Temporal localization of moments in video collections with natural language. arXiv, 2019.
|
| 194 |
+
|
| 195 |
+
Valentin Gabeur, Chen Sun, Karteek Alahari, and Cordelia Schmid. Multi-modal transformer for video retrieval. In ECCV, 2020.
|
| 196 |
+
|
| 197 |
+
Raghav Goyal, Samira Ebrahimi Kahou, Vincent Michalski, Joanna Materzynska, Susanne Westphal, Heuna Kim, Valentin Haenel, Ingo Fruend, Peter Yianilos, Moritz Mueller-Freitag, et al. The” something something” video database for learning and evaluating visual common sense. In ICCV, 2017a.
|
| 198 |
+
|
| 199 |
+
Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the v in vqa matter: Elevating the role of image understanding in visual question answering. In CVPR, 2017b.
|
| 200 |
+
|
| 201 |
+
Suchin Gururangan, Swabha Swayamdipta, Omer Levy, Roy Schwartz, Samuel R Bowman, and Noah A Smith. Annotation artifacts in natural language inference data. In NAACL, 2018.
|
| 202 |
+
|
| 203 |
+
Dan Hendrycks, Kimin Lee, and Mantas Mazeika. Using pre-training can improve model robustness and uncertainty. In ICML, 2019.
|
| 204 |
+
|
| 205 |
+
Andrew Jaegle, Felix Gimeno, Andrew Brock, Andrew Zisserman, Oriol Vinyals, and Joao Carreira. Perceiver: General perception with iterative attention. In ICML, 2021.
|
| 206 |
+
|
| 207 |
+
Andrew Jaegle, Sebastian Borgeaud, Jean-Baptiste Alayrac, Carl Doersch, Catalin Ionescu, David Ding, Skanda Koppula, Daniel Zoran, Andrew Brock, Evan Shelhamer, et al. Perceiver io: A general architecture for structured inputs & outputs. In ICLR, 2022.
|
| 208 |
+
|
| 209 |
+
Yunseok Jang, Yale Song, Youngjae Yu, Youngjin Kim, and Gunhee Kim. Tgif-qa: Toward spatiotemporal reasoning in visual question answering. In CVPR, 2017.
|
| 210 |
+
|
| 211 |
+
Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc V Le, Yunhsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. arXiv, 2021.
|
| 212 |
+
|
| 213 |
+
Will Kay, Joao Carreira, Karen Simonyan, Brian Zhang, Chloe Hillier, Sudheendra Vijayanarasimhan, Fabio Viola, Tim Green, Trevor Back, Paul Natsev, et al. The kinetics human action video dataset. arXiv, 2017.
|
| 214 |
+
|
| 215 |
+
Wonjae Kim, Bokyung Son, and Ildoo Kim. Vilt: Vision-and-language transformer without convolution or region supervision. In ICML, 2021.
|
| 216 |
+
|
| 217 |
+
Ranjay Krishna, Kenji Hata, Frederic Ren, Li Fei-Fei, and Juan Carlos Niebles. Dense-captioning events in videos. In ICCV, 2017a.
|
| 218 |
+
|
| 219 |
+
Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A Shamma, et al. Visual genome: Connecting language and vision using crowdsourced dense image annotations. IJCV, 2017b.
|
| 220 |
+
|
| 221 |
+
Jie Lei, Licheng Yu, Mohit Bansal, and Tamara L Berg. Tvqa: Localized, compositional video question answering. In EMNLP, 2018.
|
| 222 |
+
|
| 223 |
+
Jie Lei, Licheng Yu, Tamara L Berg, and Mohit Bansal. What is more likely to happen next? videoand-language future event prediction. In EMNLP, 2020.
|
| 224 |
+
|
| 225 |
+
Jie Lei, Linjie Li, Luowei Zhou, Zhe Gan, Tamara L Berg, Mohit Bansal, and Jingjing Liu. Less is more: Clipbert for video-and-language learning via sparse sampling. In CVPR, 2021.
|
| 226 |
+
|
| 227 |
+
Dongxu Li, Junnan Li, Hongdong Li, Juan Carlos Niebles, and Steven CH Hoi. Align and prompt: Video-and-language pre-training with entity prompts. arXiv, 2021a.
|
| 228 |
+
|
| 229 |
+
Junnan Li, Ramprasaath R Selvaraju, Akhilesh Deepak Gotmare, Shafiq Joty, Caiming Xiong, and Steven Hoi. Align before fuse: Vision and language representation learning with momentum distillation. In NeurIPS, 2021b.
|
| 230 |
+
|
| 231 |
+
Junnan Li, Dongxu Li, Caiming Xiong, and Steven Hoi. Blip: Bootstrapping languageimage pre-training for unified vision-language understanding and generation. arXiv preprint arXiv:2201.12086, 2022.
|
| 232 |
+
|
| 233 |
+
Linjie Li, Yen-Chun Chen, Yu Cheng, Zhe Gan, Licheng Yu, and Jingjing Liu. Hero: Hierarchical encoder for video $^ +$ language omni-representation pre-training. In EMNLP, 2020a.
|
| 234 |
+
|
| 235 |
+
Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, and Kai-Wei Chang. Visualbert: A simple and performant baseline for vision and language. arXiv, 2019.
|
| 236 |
+
|
| 237 |
+
Wei Li, Can Gao, Guocheng Niu, Xinyan Xiao, Hao Liu, Jiachen Liu, Hua Wu, and Haifeng Wang. Unimo: Towards unified-modal understanding and generation via cross-modal contrastive learning. In ACL, 2021c.
|
| 238 |
+
|
| 239 |
+
Xiujun Li, Xi Yin, Chunyuan Li, Pengchuan Zhang, Xiaowei Hu, Lei Zhang, Lijuan Wang, Houdong Hu, Li Dong, Furu Wei, et al. Oscar: Object-semantics aligned pre-training for vision-language tasks. In ECCV, 2020b.
|
| 240 |
+
|
| 241 |
+
Yingwei Li, Yi Li, and Nuno Vasconcelos. Resound: Towards action recognition without representation bias. In ECCV, 2018.
|
| 242 |
+
|
| 243 |
+
Xudong Lin, Gedas Bertasius, Jue Wang, Shih-Fu Chang, Devi Parikh, and Lorenzo Torresani. Vx2text: End-to-end learning of video-based text generation from multimodal inputs. In CVPR, 2021.
|
| 244 |
+
|
| 245 |
+
Yang Liu, Samuel Albanie, Arsha Nagrani, and Andrew Zisserman. Use what you have: Video retrieval using representations from collaborative experts. In BMVC, 2020.
|
| 246 |
+
|
| 247 |
+
Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. In ICLR, 2017.
|
| 248 |
+
|
| 249 |
+
Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In ICLR, 2019.
|
| 250 |
+
|
| 251 |
+
Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. In NeurIPS, 2019.
|
| 252 |
+
|
| 253 |
+
Huaishao Luo, Lei Ji, Ming Zhong, Yang Chen, Wen Lei, Nan Duan, and Tianrui Li. Clip4clip: An empirical study of clip for end to end video clip retrieval. arXiv preprint arXiv:2104.08860, 2021.
|
| 254 |
+
|
| 255 |
+
Antoine Miech, Dimitri Zhukov, Jean-Baptiste Alayrac, Makarand Tapaswi, Ivan Laptev, and Josef Sivic. Howto $1 0 0 \mathrm { m }$ : Learning a text-video embedding by watching hundred million narrated video clips. In ICCV, 2019.
|
| 256 |
+
|
| 257 |
+
Vicente Ordonez, Girish Kulkarni, and Tamara Berg. Im2text: Describing images using 1 million captioned photographs. NeurIPS, 2011.
|
| 258 |
+
|
| 259 |
+
Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In NeurIPS, 2019.
|
| 260 |
+
|
| 261 |
+
Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. arXiv, 2021.
|
| 262 |
+
|
| 263 |
+
Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In ACL, 2018.
|
| 264 |
+
|
| 265 |
+
Khurram Soomro, Amir Roshan Zamir, and Mubarak Shah. Ucf101: A dataset of 101 human actions classes from videos in the wild. arXiv, 2012.
|
| 266 |
+
|
| 267 |
+
Chen Sun, Austin Myers, Carl Vondrick, Kevin Murphy, and Cordelia Schmid. Videobert: A joint model for video and language representation learning. In ICCV, 2019.
|
| 268 |
+
|
| 269 |
+
Hao Tan and Mohit Bansal. Lxmert: Learning cross-modality encoder representations from transformers. In EMNLP, 2019.
|
| 270 |
+
|
| 271 |
+
Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Herve J ´ egou. Training data-efficient image transformers & distillation through attention. In ´ ICML, 2021.
|
| 272 |
+
|
| 273 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, 2017.
|
| 274 |
+
|
| 275 |
+
Alex Jinpeng Wang, Yixiao Ge, Rui Yan, Yuying Ge, Xudong Lin, Guanyu Cai, Jianping Wu, Ying Shan, Xiaohu Qie, and Mike Zheng Shou. All in one: Exploring unified video-language pretraining. arXiv, 2022.
|
| 276 |
+
|
| 277 |
+
Limin Wang, Yuanjun Xiong, Zhe Wang, Yu Qiao, Dahua Lin, Xiaoou Tang, and Luc Van Gool. Temporal segment networks: Towards good practices for deep action recognition. In ECCV, 2016.
|
| 278 |
+
|
| 279 |
+
Dejing Xu, Zhou Zhao, Jun Xiao, Fei Wu, Hanwang Zhang, Xiangnan He, and Yueting Zhuang. Video question answering via gradually refined attention over appearance and motion. In ACM MM, 2017.
|
| 280 |
+
|
| 281 |
+
Hu Xu, Gargi Ghosh, Po-Yao Huang, Dmytro Okhonko, Armen Aghajanyan, Florian Metze, Luke Zettlemoyer, and Christoph Feichtenhofer. Videoclip: Contrastive pre-training for zero-shot video-text understanding. In EMNLP, 2021.
|
| 282 |
+
|
| 283 |
+
Jun Xu, Tao Mei, Ting Yao, and Yong Rui. Msr-vtt: A large video description dataset for bridging video and language. In CVPR, 2016.
|
| 284 |
+
|
| 285 |
+
Antoine Yang, Antoine Miech, Josef Sivic, Ivan Laptev, and Cordelia Schmid. Just ask: Learning to answer questions from millions of narrated videos. In ICCV, 2021.
|
| 286 |
+
|
| 287 |
+
Peter Young, Alice Lai, Micah Hodosh, and Julia Hockenmaier. From image descriptions to visual denotations: New similarity metrics for semantic inference over event descriptions. TACL, 2014.
|
| 288 |
+
|
| 289 |
+
Youngjae Yu, Jongseok Kim, and Gunhee Kim. A joint sequence fusion model for video question answering and retrieval. In ECCV, 2018.
|
| 290 |
+
|
| 291 |
+
Zhou Yu, Dejing Xu, Jun Yu, Ting Yu, Zhou Zhao, Yueting Zhuang, and Dacheng Tao. Activitynetqa: A dataset for understanding complex web videos via question answering. In AAAI, 2019.
|
| 292 |
+
|
| 293 |
+
Rowan Zellers, Yonatan Bisk, Ali Farhadi, and Yejin Choi. From recognition to cognition: Visual commonsense reasoning. In CVPR, 2019.
|
| 294 |
+
|
| 295 |
+
Rowan Zellers, Ximing Lu, Jack Hessel, Youngjae Yu, Jae Sung Park, Jize Cao, Ali Farhadi, and Yejin Choi. Merlot: Multimodal neural script knowledge models. NeurIPS, 2021.
|
| 296 |
+
|
| 297 |
+
Peng Zhang, Yash Goyal, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Yin and yang: Balancing and answering binary visual questions. In CVPR, 2016.
|
| 298 |
+
|
| 299 |
+
Linchao Zhu and Yi Yang. Actbert: Learning global-local video-text representations. In CVPR, 2020.
|
| 300 |
+
|
| 301 |
+
# A APPENDIX
|
| 302 |
+
|
| 303 |
+
In Section A.2, we show details of our open-ended QA model and SINGULARITY-temporal model, as well as pre-training objectives. In Section A.3, we show more experimental details, such as SINGULARITY-temporal results on existing datasets, SINGULARITY zero-shot results, impact of image size, and results on image-text tasks such as text-to-image retrieval tasks Flickr30K Young et al. (2014), COCO Chen et al. (2015) and image question answering task VQA Antol et al. (2015). In addition, we also show hyper-parameters and more experimental setups in this section. In Section A.4, we show more dataset details.
|
| 304 |
+
|
| 305 |
+
# A.1 AUTHOR RESPONSE
|
| 306 |
+
|
| 307 |
+
Memory and Time Cost of Frame Ensemble Strategies. In Sec.5, we discussed that our simple early fusion based frame ensemble strategy (concat) achieves the best performance for both MSRVTT retrieval and ActivityNet-QA tasks across different number of inference frames. In this section, we continue to compare its memory and computation time cost w.r.t. other frame ensemble strategies. For both tasks, our early fusion strategy (concat) achieves the better performance than late fusion strategies (lse, max, mean) while also runs faster. For memory cost, concat uses more memory for MSRVTT retrieval, but fewer memory for the ANet-QA. Overall, the early fusion approach is preferred in most cases due to its better accuracy and faster run time.
|
| 308 |
+
|
| 309 |
+

|
| 310 |
+
Figure 8: Impact of frame ensemble strategy. Retrieval performance is shown as avg recall, i.e., average of $\mathbb { R } \ @ \{ 1 , 5 , 1 0 \}$ . Top row shows the performance, time and memory comparisons for MSRVTT retrieval task, while bottom shows the same comparisons for ActivityNet-QA (ANet-QA). We use the same fine-tuned checkpoint for each task, thus the results difference only comes from inference strategies. We measure time and memory cost by running the models on the task-specific test splits. Since the three late fusion strategies (lse, max, mean) have similar memory and time costs, we only keep lse in the figures.
|
| 311 |
+
|
| 312 |
+
# A.2 ADDITIONAL MODELING DETAILS
|
| 313 |
+
|
| 314 |
+
Open-ended QA model. Figure 9a shows a graphic overview of the model architecture for openended video question answering. Following previous work Cho et al. (2021); Li et al. (2021b), we formulate this task as text generation instead of classification. Based on the base model described in main text, we add an extra multi-modal decoder that takes in multi-modal encoder outputs as crossattention inputs, and decodes answer text with “[CLS]” as the start token. This decoder has the exact same architecture as the multi-modal encoder. We initialize its weight using the pre-trained multi-modal encoder.
|
| 315 |
+
|
| 316 |
+

|
| 317 |
+
Figure 9: SINGULARITY model variants for video question answering and temporal modeling (i.e., SINGULARITY-temporal). The horizontal arrows indicate cross-attention inputs, while the vertical arrows indicate self-attention inputs.
|
| 318 |
+
|
| 319 |
+
SINGULARITY-temporal. Figure 9b shows a graphic overview of the model architecture for temporal modeling, this model is also referred to as SINGULARITY-temporal. Given multiple video frames {fτi }Ttrai=1 as input, the model firstly encode each frame into their visual representations $\{ \mathcal { F } _ { v } ( f _ { \tau _ { i } } ) \}$ with the vision encoder $\mathcal { F } _ { v }$ , where $\mathcal { F } _ { v } ( f _ { \tau _ { i } } ) \in \mathbb { R } ^ { L _ { v } \times D }$ . Next, we add temporal position encoding to each frame to indicate their temporal order. This temporal position encoding is learned from scratch and is initialized as zeros. For brevity, we omit this encoding in the formulation. These frame-level representations are concatenated together as input to the temporal encoder $\tau$ , and we feed temporal encoder outputs to the multi-modal encoder’s cross-attention layer for making a prediction $p$ :
|
| 320 |
+
|
| 321 |
+
$$
|
| 322 |
+
p = \mathcal { H } ( \mathcal { F } _ { l } ( S ) \ : , \ : T ( [ \mathcal { F } _ { v } ( f _ { \tau _ { 1 } } ) ; . . . ; \mathcal { F } _ { v } ( f _ { \tau _ { T _ { t r a i n } } } ) ] ) \ : ) ,
|
| 323 |
+
$$
|
| 324 |
+
|
| 325 |
+
# Q, K, V for self-att; Q for cross-att
|
| 326 |
+
|
| 327 |
+
where $[ ; ]$ denotes concatenation, and $[ \mathcal { F } _ { v } ( f _ { \tau _ { 1 } } ) ; . . . ; \mathcal { F } _ { v } ( f _ { \tau _ { T _ { t r a i n } } } ) ] \in \mathbb { R } ^ { ( T _ { t r a i n } \times L _ { v } ) \times D }$ . During inference, when $T _ { t e s t }$ trainframes are used as inputs to the model and $T _ { t e s t } > T _ { t r a i n }$ , we interpolate the temporal position encoding to allow for extended temporal length. This is similar to spatial position encoding interpolation in Touvron et al. (2021).
|
| 328 |
+
|
| 329 |
+
Pre-Training Objectives. During pre-training, we optimize the model with three standard visionand-language objectives, Vision-Text Contrastive (VTC), Masked Language Modeling (MLM) Devlin et al. (2019), and Vision-Text Matching. We explain them in detail below.
|
| 330 |
+
|
| 331 |
+
(i) Vision-Text Contrastive (VTC) loss aims to aligns paired vision and language embeddings. Given the encoded vision embedding $\mathcal { F } _ { v } ( f _ { i , t } )$ , we use a projection head (with pooling) $\phi _ { v }$ to project the embedding sequence into a vector representation $\phi _ { v } ( \mathcal { F } _ { v } ( f _ { i , t } ) ) \in \mathbb { R } ^ { D }$ . Here $f _ { i , t }$ is the $t$ -th frame in the $i$ -th video in the training set, and $t$ is randomly sampled from all available frames in this video. For brevity, we omit the subscript $t$ and use $f _ { i }$ to denote a randomly sampled frame from the $i$ -th video during the rest of the discussion. Similarly, we have $\phi _ { l } ( \mathcal { F } _ { l } ( S _ { j } ) ) \in \dot { \mathbb { R } } ^ { D }$ for the $j$ -th sentence. The similarity score $s _ { i , j }$ of the video and text pair is defined as their dot product:
|
| 332 |
+
|
| 333 |
+
$$
|
| 334 |
+
s _ { i , j } = \phi _ { v } ( \mathcal { F } _ { v } ( f _ { i } ) ) ^ { T } \phi _ { l } ( \mathcal { F } _ { l } ( S _ { j } ) )
|
| 335 |
+
$$
|
| 336 |
+
|
| 337 |
+
We apply a contrastive loss to encourage the alignment between paired vision-language embeddings:
|
| 338 |
+
|
| 339 |
+
$$
|
| 340 |
+
p _ { i } ^ { v } = \frac { \exp ( s _ { i , i } / \tau ) } { \sum _ { j } \exp ( s _ { i , j } / \tau ) } , ~ p _ { i } ^ { l } = \frac { \exp ( s _ { i , i } / \tau ) } { \sum _ { j } \exp ( s _ { j , i } / \tau ) } , \mathcal { L } _ { v t c } = - \sum _ { i = 1 } ^ { n } ( \log p _ { i } ^ { v } + \log p _ { i } ^ { l } ) ,
|
| 341 |
+
$$
|
| 342 |
+
|
| 343 |
+
where $\tau$ is a learned temperature parameter, and it is initialized as 0.07 following CLIP Radford et al. (2021). $n$ is the total number of examples in the training set.
|
| 344 |
+
|
| 345 |
+
$( i i )$ Masked Language Modeling (MLM) loss, or more precisely, Vision Conditioned Masked Language Modeling loss, aims to predict masked text tokens from their (masked) textual context as well as the visual context. This loss is applied at the last layer of the multi-modal encoder, and we follow the exact formulation in BERT Devlin et al. (2019), except that we add additional vision inputs and use a higher mask ratio of $50 \%$ .
|
| 346 |
+
|
| 347 |
+
(iii) Vision-Text Matching (VTM) loss works towards the same goal as the VTC loss – encouraging the alignment between paired vision and language inputs. It uses the [CLS] output from the multimodal encoder for binary classification – whether the input vision and language pair match or not. To make the training more effective, we also leverage hard negative sampling Li et al. (2021b); Chen et al. (2020) to sample more informative negatives within the batch for VTM.
|
| 348 |
+
|
| 349 |
+
# A.3 ADDITIONAL EXPERIMENTS
|
| 350 |
+
|
| 351 |
+
Analysis Setup. For all ablation studies, we report results on validation splits for the datasets if available. For example, we use validation splits for DiDeMo retrieval and ActivityNet-QA, and we use the test split for MSRVTT retrieval, val1 split for ActivityNet Captions retrieval, and test split for SSv2-label. For retrieval tasks, we use the average recall, which is the average score of $\mathbb { R } \ @ \{ 1 , 5 , 1 0 \} )$ ) to more holistically compare the model performance. For QA tasks, we use accuracy.
|
| 352 |
+
|
| 353 |
+
SINGULARITY-temporal Results on Existing Datasets. In Table 4 and Table 5 we show results of SINGULARITY-temporal on existing text-to-video retrieval and video question answering datasets. In general, the 4-frame model SINGULARITY-temporal improves upon the 1-frame model SINGULARITY, but the performance gap is relatively small, especially considering the greatly increased memory and computation cost (discussed in main text) of using 4 frames.
|
| 354 |
+
|
| 355 |
+
Table 4: SINGULARITY-temporal results on text-to-video retrieval.
|
| 356 |
+
Table 5: SINGULARITY-temporal results on video question answering.
|
| 357 |
+
|
| 358 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">#PT</td><td rowspan="2">#Train</td><td colspan="3">MSRVTT</td><td colspan="3">DiDeMo</td><td colspan="3">ActivityNet Cap</td></tr><tr><td>Frame</td><td>R1 R5 R10</td><td></td><td>R1</td><td></td><td></td><td></td><td></td><td>R5 R10 R1 R5 R10</td></tr><tr><td>HERO (Li et al., 2020a)</td><td>136M</td><td>310</td><td>20.5 47.6 60.9</td><td></td><td></td><td>-</td><td>=</td><td></td><td></td><td></td><td>-</td></tr><tr><td>MMT (Gabeur et al., 2020)</td><td>136M 1K/-/3K 26.6 57.1 69.6</td><td></td><td></td><td></td><td></td><td></td><td>=</td><td></td><td></td><td></td><td>28.7 61.4 94.5</td></tr><tr><td>ClipBERT (Lei et al., 2021)</td><td>0.2M 16/16/8 22.0 46.8 59.9 20.4 48.0 60.8 21.3 49.0 63.5</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>VideoCLIP (Xu et al., 2021)</td><td>136M</td><td>960</td><td>30.9 55.4 66.8</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Frozen (Bain et al., 2021)</td><td>5M</td><td>4</td><td>31.0 59.5 70.5 31.0 59.8 72.4</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>=</td></tr><tr><td>AlignPrompt (Li et al., 2021a)</td><td>5M</td><td>8</td><td>33.9 60.7 73.2 35.9 67.5 78.8</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>CLIP4Clip (Lu0 et al.,2021) 400M 12/64/64 42.0 68.6 78.7 42.8 68.5 79.2 40.5 72.4 98.2</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>SINGULARITY</td><td>5M</td><td>1</td><td>36.8 65.9 75.5 47.4 75.2 84.0 43.0 70.6</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>81.3</td></tr><tr><td>SINGULARITY-temporal</td><td>5M</td><td>4</td><td>39.9 67.3 76.0 49.2 77.5 85.4 45.9 73.3</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>83.8</td></tr><tr><td>SINGULARITY</td><td>17M</td><td>1</td><td>41.5 68.7</td><td></td><td>77</td><td> 53.9 79.4 86.9 47.1 75.5</td><td></td><td></td><td></td><td></td><td>85.5</td></tr><tr><td>SINGULARITY-temporal</td><td>17M</td><td>4</td><td></td><td>42.7 69.5 78.1</td><td></td><td>53.1 79.9 88.1 48.9 77.0</td><td></td><td></td><td></td><td></td><td>86.3</td></tr></table>
|
| 359 |
+
|
| 360 |
+
<table><tr><td>Method</td><td>#PT</td><td> #Train Frame MSRVTT-QA ActivityNet-QA MSRVTT-MC</td><td></td><td></td><td></td></tr><tr><td>ClipBERT (Lei et al., 2021)</td><td>0.2M</td><td>16</td><td>37.4</td><td></td><td>88.2</td></tr><tr><td>AlignPrompt (Li et al., 2021a)</td><td>5M</td><td>16</td><td>42.1</td><td></td><td>=</td></tr><tr><td>JustAsk (Yang et al., 2021)</td><td>69M</td><td>640</td><td>41.5</td><td>38.9</td><td>-</td></tr><tr><td>MERLOT (Zellers et al., 2021) </td><td>)180M</td><td>5</td><td>43.1</td><td>41.4</td><td>90.9</td></tr><tr><td>VideoCLIP (Xu et al., 2021)</td><td>136M</td><td>960</td><td>-</td><td>-</td><td>92.1</td></tr><tr><td>SINGULARITY</td><td>5M</td><td>1</td><td>42.7</td><td>41.8</td><td>92.0</td></tr><tr><td>SINGULARITY-temporal</td><td>5M</td><td>4</td><td>43.3</td><td>43.4</td><td>92.0</td></tr><tr><td>SINGULARITY</td><td>17M</td><td>1</td><td>43.5</td><td>43.1</td><td>92.1</td></tr><tr><td>SINGULARITY-temporal</td><td>17M</td><td>4</td><td>43.9</td><td>44.1</td><td>93.7</td></tr></table>
|
| 361 |
+
|
| 362 |
+
Zero-Shot Results. In Table 6 we show zero-shot results of SINGULARITY for text-to-video retrieval. SINGULARITY achieves significantly better results compared to existing methods with a similar amount of pre-training data.
|
| 363 |
+
|
| 364 |
+
Performance of Multiple Runs. In Table 7 we show mean and standard deviation of 5 random runs, for text-to-video retrieval.
|
| 365 |
+
|
| 366 |
+
Comparison on Inference Cost. In Table 8, we compare the cost of various retrieval methods in terms of inference GFLOPs and the number of model parameters. Overall, SINGULARITY models have a similar amount of parameters and lower inference GFLOPs, with higher performance.
|
| 367 |
+
|
| 368 |
+
Ablation Study on Training Objectives. In Table 9, we study the effect of using different training objectives. We notice that using all objectives achieves the best performance. One interesting note is that, compared to $\mathbf { ( I T M + M L M }$ ), adding ITC loss $\mathrm { I T M + M L M + I T C } )$ greatly improves retrieval performance on MSRVTT, but not ActivityNet QA. This makes sense as ITC is not applied on the multi-modal encoder which QA tasks may heavily rely on.
|
| 369 |
+
|
| 370 |
+
Impact of Image Size. In Figure 10 we study the impact of image size for downstream tasks. In general, a larger image size helps improve model performance, but the performance saturates at a certain size, e.g., the model performance saturates at around $3 3 6 \times 3 3 6$ for the 3 tasks. Note that our model performance with larger image sizes might suffer from the low resolution of the raw videos we have. For example, we are only able to get videos of resolution $3 2 0 \times 2 4 0$ for MSRVTT.
|
| 371 |
+
|
| 372 |
+
Comparison on Image-Text tasks. Since our model is pre-trained with single frames, it can be directly used for image-text tasks. In Table 11 we show image-text retrieval results on
|
| 373 |
+
|
| 374 |
+
Table 6: SINGULARITY zero-shot results on text-to-video retrieval.
|
| 375 |
+
Table 7: SINGULARITY results on text-to-video retrieval, with mean/std over 5 random runs. We show the results for the model pre-trained on the 17M corpus.
|
| 376 |
+
|
| 377 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">#PT</td><td rowspan="2">#Train</td><td colspan="3">MSRVTT</td><td colspan="3">DiDeMo</td><td colspan="3"> ActivityNet Cap</td></tr><tr><td>Frame1</td><td>R1 R5 R10 R1 R5 R10 R1 R5 R10</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>VideoCLIP (Xu et al., 2021)</td><td>137M</td><td>1K</td><td></td><td>10.4 22.2 30.0 16.6 46.9</td><td></td><td></td><td></td><td>=</td><td></td><td></td><td>-</td></tr><tr><td>Frozen (Bain et al., 2021)</td><td>5M</td><td>4</td><td></td><td>18.7 39.5 51.6 21.1 46.0 56.2</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>AlignPrompt (Li et al., 2021a)</td><td>5M</td><td>8</td><td></td><td>24.1 44.7 55.4 23.8 47.3 57.9</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td> CLIP-straight</td><td>400M</td><td>1</td><td></td><td>31.2 53.7 64.2</td><td></td><td>-</td><td>=</td><td>=</td><td>-</td><td>-</td><td></td></tr><tr><td>BLIP</td><td>130M</td><td>1</td><td></td><td> 43.3 65.6 74.7</td><td></td><td></td><td></td><td>=</td><td></td><td></td><td>-</td></tr><tr><td>SINGULARITY</td><td>5M</td><td>1</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>28.4 50.2 59.5 36.9 61.1 69.3 30.8 55.9 66.3</td></tr><tr><td>SINGULARITY</td><td>17M</td><td>1</td><td></td><td>34.0 56.7 66.7 37.1 61.7 69.9 30.6 55.6 66.9</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 378 |
+
|
| 379 |
+
<table><tr><td rowspan="3">Method</td><td colspan="3">MSRVTT</td><td colspan="3">DiDeMo</td><td colspan="3">ActivityNet</td></tr><tr><td>R1</td><td>R5</td><td>R10</td><td>R1</td><td>R5</td><td>R10</td><td>R1</td><td>R5</td><td>R10</td></tr><tr><td>SINGULARITY</td><td>42.1±0.5</td><td>69.3±0.4</td><td>78.1±0.7</td><td>53.3±1.0</td><td>78.7±1.3</td><td>86.3±1.5</td><td>47.0±0.5</td><td>75.7±0.3</td><td>85.3±0.3</td></tr></table>
|
| 380 |
+
|
| 381 |
+
Flickr30K Young et al. (2014) and COCO Chen et al. (2015). In Table 12 we show image question answering results on VQA Antol et al. (2015). We observe that SINGULARITY demonstrates competitive performance on the image-text tasks. As we still see a gap with state-of-the-art imagetext models such as Li et al. (2022), one future direction is to adopt improved designs in these methods to further improve video-text task performance.
|
| 382 |
+
|
| 383 |
+
Hyper-Parameters. The hyper-parameters for our pre-training and downstream task fine-tuning are listed in Table 13 and Table 14. Note that we did not do an extensive hyper-parameter search, but mostly use the same hyper-parameters for different datasets under the same task, it is possible that better results can be achieved with more tuning.
|
| 384 |
+
|
| 385 |
+
# A.4 ADDITIONAL DATA DETAILS
|
| 386 |
+
|
| 387 |
+
Statistics. We show statistics of pre-training datasets in Table 15, and downstream datasets in Table 16.
|
| 388 |
+
|
| 389 |
+
License. We show dataset licenses in Table 17.
|
| 390 |
+
|
| 391 |
+
Table 8: Comparison of recent retrieval methods on inference GLOPs and #params. For brevity, we show DiDeMo retrieval performance with Average Recall (AvgR) – the average of $\mathbb { R } \{ 1 , 5 , 1 0 \}$ .
|
| 392 |
+
|
| 393 |
+
<table><tr><td>Method</td><td>#PT</td><td>Inference GFLOPs #params DiDeMo AvgR</td><td></td><td></td></tr><tr><td>Frozen (Bain et al.,2021)</td><td>5M</td><td>542</td><td>181M</td><td>54.4</td></tr><tr><td>AlignPrompt (Li et al., 2021a)</td><td>5M</td><td>-</td><td>231M</td><td>60.7</td></tr><tr><td> CLIP4Clip (Radford et al., 2021) 400M</td><td></td><td>1,121</td><td>164M</td><td>63.5</td></tr><tr><td>SINGULARITY</td><td>5M</td><td>451</td><td>202M</td><td>68.9</td></tr><tr><td>SINGULARITY-temporal</td><td>5M</td><td>485</td><td>209M</td><td>70.7</td></tr></table>
|
| 394 |
+
|
| 395 |
+
Table 9: Ablation study on training objectives. The models are pre-trained on 2.5M WebVid videotext pairs for 10 epochs and are then fine-tuned.
|
| 396 |
+
|
| 397 |
+
<table><tr><td>Objectives</td><td>MSRVTTRetrieval AvgR ActivityNet-QA</td><td></td></tr><tr><td>ITM</td><td>32.4</td><td>40.2</td></tr><tr><td>ITM+MLM</td><td>52.5</td><td>47.0</td></tr><tr><td>ITM+ ITC</td><td>54.3</td><td>44.1</td></tr><tr><td>ITM +MLM+ITC</td><td>55.7</td><td>46.4</td></tr></table>
|
| 398 |
+
|
| 399 |
+
Table 10: Impact of Image Size. We fine-tune models from the same checkpoint, pre-trained with input image size $2 2 4 \times 2 2 4$ . We show average recall (average of $\mathbb { R } \ @ \{ 1 , 5 , 1 0 \} )$ ) for retrieval tasks, and accuracy for the QA task.
|
| 400 |
+
|
| 401 |
+
<table><tr><td>Image size</td><td>MSRVTT retrieval</td><td>DiDeMo retrieval</td><td>ActivityNet QA</td></tr><tr><td>112</td><td>58.7</td><td>65.9</td><td>46.6</td></tr><tr><td>224</td><td>62.4</td><td>73.4</td><td>49.2</td></tr><tr><td>336</td><td>65.5</td><td>73.4</td><td>49.6</td></tr><tr><td>448</td><td>64.2</td><td>72.9</td><td>49.8</td></tr></table>
|
| 402 |
+
|
| 403 |
+
Table 11: Comparison to existing methods on image-text retrieval. We show results for both text retrieval (image-to-text retrieval, TR) and image retrieval (IR).
|
| 404 |
+
|
| 405 |
+
<table><tr><td rowspan="3">Method</td><td rowspan="3">#PT</td><td colspan="4">COCO (5K test)</td><td colspan="5">Flickr30K (1K test)</td></tr><tr><td colspan="2">TR</td><td colspan="3">IR</td><td colspan="2">TR</td><td colspan="2">IR</td></tr><tr><td>R1</td><td>R5</td><td>R10 R1</td><td>R5</td><td>R10 R1</td><td></td><td>R5</td><td>R10 R1</td><td>R5</td><td>R10</td></tr><tr><td>ViLT (Kim et al., 2021)</td><td>4M 61.5 86.3 92.7 42.7 72.9 83.1 83.5 96.7</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>98.6 64.4 88.7 93.8</td><td></td><td></td></tr><tr><td>UNITER (Chen et al., 2020)</td><td></td><td></td><td></td><td>4M 65.7 88.6 93.8 52.9 79.9 88.0 87.3 98.0 99.2 75.6 94.1 96.8</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>OSCAR (Li et al., 2020b)</td><td></td><td></td><td></td><td>4M 70.0 91.1 95.5 54.0 80.8 88.5</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Frozen (Bain et al., 2021)</td><td>5M</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>61.0 87.5 92.7</td><td></td></tr><tr><td>ALBEF (Li et al., 2021b)</td><td></td><td></td><td></td><td>4M 73.1 91.4 96.0 56.8 81.5 89.2 94.3 99.4 99.8 82.8 96.7 98.4</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ALBEF (Li et al., 2021b)</td><td></td><td></td><td></td><td>14M 77.6 94.3 97.2 60.7 84.3 90.5 95.9 99.8 100.0 85.6 97.5 98.9</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>BLIP (Li et al., 2022)</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>14M 80.6 95.2 97.6 63.1 85.3 91.1 96.6 99.8 100.0 87.2 97.5 98.8</td><td></td></tr><tr><td>BLIP (Li et al., 2022)</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>129M 81.9 95.4 97.8 64.3 85.7 91.5 97.3 99.9 100.0 87.3 97.6 98.9</td><td></td></tr><tr><td>ALIGN (Jia et al., 2021)</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>1.2B 77.0 93.5 96.9 59.9 83.3 89.8 95.3 99.8 100.0 84.9 97.4 98.6</td><td></td></tr><tr><td>SINGULARITY</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>5M 71.9 90.8 95.4 54.6 80.0 87.8 93.3 99.4 99.8 81.4 95.8 97.9</td><td></td></tr><tr><td>SINGULARITY</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>17M 77.0 93.7 96.8 59.6 83.4 90.0 96.1 99.8 99.9 84.7 96.8 98.3</td><td></td></tr></table>
|
| 406 |
+
|
| 407 |
+
Table 12: Comparison to existing methods on VQA.
|
| 408 |
+
|
| 409 |
+
<table><tr><td>Method</td><td>#PT</td><td>test-dev</td><td>test-std</td></tr><tr><td>ClipBERT (Lei et al., 2021)</td><td>0.2M</td><td>69.08</td><td>69.43</td></tr><tr><td>ViLT (Kim et al., 2021)</td><td>4M</td><td>70.94</td><td>=</td></tr><tr><td>VL-BART (Cho et al., 2021)</td><td>0.2M</td><td>1</td><td>71.30</td></tr><tr><td>LXMERT(Tan & Bansal,2019)</td><td>4M</td><td>72.42</td><td>72.54</td></tr><tr><td>UNITER (Chen et al., 2020)</td><td>4M</td><td>72.70</td><td>72.91</td></tr><tr><td>UNIMO (Li et al., 2021c)</td><td>4M</td><td>73.79</td><td>74.02</td></tr><tr><td>OSCAR (Li et al., 2020b)</td><td>4M</td><td>73.16</td><td>73.44</td></tr><tr><td>ALBEF (Li et al., 2021b)</td><td>4M</td><td>74.54</td><td>74.70</td></tr><tr><td>ALBEF (Li et al., 2021b)</td><td>14M</td><td>75.84</td><td>76.04</td></tr><tr><td>BLIP (Li et al., 2022)</td><td>14M</td><td>77.54</td><td>77.62</td></tr><tr><td>BLIP (Li et al., 2022)</td><td>129M</td><td>78.24</td><td>78.17</td></tr><tr><td>SINGULARITY</td><td>5M</td><td>70.30</td><td>70.53</td></tr><tr><td>SINGULARITY</td><td>17M</td><td>73.13</td><td>73.27</td></tr></table>
|
| 410 |
+
|
| 411 |
+
Table 13: SINGULARITY hyper-parameters for pre-training, video QA, image QA and text-to-image retrieval. We only list a single value if all tasks share the same value. For SINGULARITY-temporal, we train with a similar setup, except that we set #training frames to be 4. In addition, for SINGULARITY-temporal 2nd stage pre-training, we also use a smaller batch size of 32 per GPU.
|
| 412 |
+
|
| 413 |
+
<table><tr><td>config</td><td>pre-training</td><td>video QA image QA</td><td></td><td>text-to-image retrieval</td></tr><tr><td>optimizer</td><td colspan="4">AdamW (Loshchilov & Hutter,2019)</td></tr><tr><td>optimizer momentum</td><td colspan="4">β1, β2=0.9,0.999</td></tr><tr><td>base learning rate</td><td>1e-4</td><td>1e-5</td><td>1e-5</td><td>1e-5</td></tr><tr><td>min learning rate</td><td>1e-5</td><td>1e-6</td><td>1e-6</td><td>1e-6</td></tr><tr><td>weight decay</td><td></td><td></td><td>0.02</td><td></td></tr><tr><td>learning rate schedule</td><td colspan="4">cosine decay (Loshchilov & Hutter,2017)</td></tr><tr><td>image size</td><td>224</td><td>224</td><td>336</td><td>336</td></tr><tr><td>image augmentation</td><td colspan="4">random resize,crop,horizontal flip</td></tr><tr><td>#training epochs</td><td>10</td><td>10</td><td>5</td><td>10 (Flickr30K),5 (COCO)</td></tr><tr><td>#warmup epochs</td><td>1</td><td>0.5</td><td>0.5</td><td>0</td></tr><tr><td>batch size x #GPUs</td><td>128×3</td><td>32×1</td><td>64×4</td><td>64×2</td></tr><tr><td>#training frames</td><td></td><td></td><td>1</td><td></td></tr><tr><td>#inference frames</td><td>1</td><td>12</td><td>1</td><td>1</td></tr></table>
|
| 414 |
+
|
| 415 |
+
Table 14: SINGULARITY hyper-parameters for text-to-video retrieval tasks. We only list a single value if all tasks share the same value. For SINGULARITY-temporal, we train it with a similar setup, except that we set #training frames to be 4.
|
| 416 |
+
|
| 417 |
+
<table><tr><td>config</td><td>MSRVTT</td><td>DiDeMo</td><td>ActivityNet Captions</td><td>SSv2-template/label</td></tr><tr><td>optimizer</td><td></td><td colspan="3">AdamWLoshchilov & Hutter (2019)</td></tr><tr><td>optimizer momentum</td><td></td><td></td><td>β1,β2=0.9,0.999</td><td></td></tr><tr><td>base learning rate</td><td>1e-5</td><td>1e-5</td><td>1e-5</td><td>1e-4</td></tr><tr><td> min learning rate</td><td>1e-6</td><td>1e-6</td><td>1e-6</td><td>1e-5</td></tr><tr><td>weight decay</td><td></td><td></td><td>0.02</td><td></td></tr><tr><td>learning rate schedule</td><td></td><td>cosine decay Loshchilov & Hutter (2017)</td><td></td><td></td></tr><tr><td>image size</td><td></td><td></td><td>224</td><td></td></tr><tr><td>image augmentation</td><td></td><td></td><td>random resize,crop,horizontal flip</td><td></td></tr><tr><td>#training epochs</td><td>5</td><td>10</td><td>10</td><td>10</td></tr><tr><td>#warmup epochs</td><td></td><td></td><td>0</td><td></td></tr><tr><td>batch size x #GPUs</td><td>32x1</td><td>32x1</td><td>32x1</td><td>32x2</td></tr><tr><td>#training frames</td><td></td><td></td><td>1</td><td></td></tr><tr><td>#inference frames</td><td>12</td><td>12</td><td>32</td><td>12</td></tr></table>
|
| 418 |
+
|
| 419 |
+
Table 15: Statistics of pre-training datasets. The average video length of WebVid is 18 seconds.
|
| 420 |
+
Table 16: Statistics of downstream datasets.
|
| 421 |
+
|
| 422 |
+
<table><tr><td>Dataset</td><td>#image/video</td><td>#text</td><td>Type</td></tr><tr><td>COCO (Chen et al., 2015)</td><td>113K</td><td>567K</td><td>image</td></tr><tr><td>VG (Krishna et al., 2017b)</td><td>100K</td><td>768K</td><td>image</td></tr><tr><td>SBU (Ordonez et al., 2011)</td><td>860K</td><td>860K</td><td>image</td></tr><tr><td>CC3M (Sharma et al., 2018)</td><td>2.95M</td><td>2.95M</td><td>image</td></tr><tr><td>CC12M (Changpinyo et al., 2021)</td><td>10.77M</td><td>10.77M</td><td>image</td></tr><tr><td>WebVid (Bain et al., 2021)</td><td>2.49M</td><td>2.49M</td><td>video</td></tr><tr><td>5M corpus = CC3M+WebVid</td><td>5.44M</td><td>5.44M</td><td>video+image</td></tr><tr><td>17M corpus = 5M+COCO+VG+SBU+CC12M</td><td>17.28M</td><td>18.41M</td><td>video+image</td></tr></table>
|
| 423 |
+
|
| 424 |
+
<table><tr><td rowspan="2">Dataset</td><td colspan="3">#video</td><td colspan="3">#text</td><td rowspan="2">Avg Video</td></tr><tr><td>Train</td><td>Val</td><td>Test</td><td>Train</td><td>Val</td><td>Test Length (s)</td></tr><tr><td>Text-to-Video Retrieval</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ActivityNet Cap (Krishna et al., 2017a)</td><td>10,009</td><td></td><td>- 4,917</td><td>10,009</td><td></td><td>4,917</td><td>180</td></tr><tr><td>DiDeMo (Anne Hendricks et al., 2017)</td><td></td><td></td><td>8,394 1,065 1,003</td><td>8,394</td><td>1,065</td><td>1,003</td><td>29.3</td></tr><tr><td>MSRVTT (Xu et al., 2016)</td><td>7,010</td><td></td><td>- 1,000</td><td>140,200</td><td></td><td>1,000</td><td>15</td></tr><tr><td>SSV2-Template (Goyal et al.,2017a)</td><td>168,913</td><td></td><td>- 2,088</td><td>174</td><td></td><td>174</td><td>4</td></tr><tr><td>SSV2-Label (Goyal et al., 2017a)</td><td>168,913</td><td></td><td>-2,088</td><td>109,968</td><td></td><td>1,989</td><td>4</td></tr><tr><td>Video Question Answering</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>MSRVTT-QA (Xu et al., 2017)</td><td>6,513</td><td></td><td></td><td>497 2,990 158,581 12,278 72,821</td><td></td><td></td><td>15</td></tr><tr><td>ActivityNet-QA (Yu et al.,2019)</td><td>3,200 1,800</td><td></td><td>800</td><td>32,000 18,000</td><td></td><td>8.000</td><td>180</td></tr><tr><td>MSRVTT-MC (Yu et al., 2018)</td><td>7,010</td><td></td><td>- 2,990</td><td>140,200</td><td></td><td>14,950</td><td>15</td></tr></table>
|
| 425 |
+
|
| 426 |
+
Table 17: Dataset licenses.
|
| 427 |
+
|
| 428 |
+
<table><tr><td>Dataset</td><td>License</td></tr><tr><td>COCO (Chen et al., 2015)</td><td>CC BY 4.0, Flickr Terms of Use</td></tr><tr><td>VG (Krishna et al., 2017b)</td><td>CC BY 4.0</td></tr><tr><td>SBU (Ordonez et al., 2011)</td><td>Flickr Terms of Use</td></tr><tr><td>CC3M (Sharma et al.,2018)</td><td>CC3MLicense</td></tr><tr><td>CC12M (Changpinyo et al., 2021)</td><td>CC12MLicense</td></tr><tr><td>WebVid (Bain et al.,2021)</td><td>Exceptions to Copyright</td></tr><tr><td>ActivityNet Captions (Krishna et al.,2017a)</td><td>Fair Use</td></tr><tr><td>DiDeMo (Anne Hendricks et al., 2017)</td><td>BSD-2-Clause, Creative Commons</td></tr><tr><td>MSRVTT (Xu et al., 2016)</td><td>unknown</td></tr><tr><td>SSV2-Template (Goyal et al., 2017a)</td><td>SSv2 License</td></tr><tr><td>SSV2-Label (Goyal et al., 2017a)</td><td>SSv2License</td></tr><tr><td>MSRVTT-QA (Xu et al., 2017)</td><td>MIT</td></tr><tr><td>ActivityNet-QA (Yu et al., 2019)</td><td>Apache</td></tr><tr><td>MSRVTT-MC (Yu et al., 2018)</td><td>unknown</td></tr></table>
|
md/dev/V88BafmH9Pj/V88BafmH9Pj.md
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# A Contrastive Framework for Neural Text Generation
|
| 2 |
+
|
| 3 |
+
Yixuan Su♠ Tian Lan♢ Yan Wang♢ Dani Yogatama♣ Lingpeng Kong♡ Nigel Collier♠ ♠Language Technology Lab, University of Cambridge ♢Tencent AI Lab ♣DeepMind ♡Department of Computer Science, The University of Hong Kong {ys484,nhc30}@cam.ac.uk lantiangmftby@gmail.com, yanwang.branden@gmail.com dyogatama@deepmind.com, lpk@cs.hku.hk
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Text generation is of great importance to many natural language processing applications. However, maximization-based decoding methods (e.g., beam search) of neural language models often lead to degenerate solutions—the generated text is unnatural and contains undesirable repetitions. Existing approaches introduce stochasticity via sampling or modify training objectives to decrease the probabilities of certain tokens (e.g., unlikelihood training). However, they often lead to solutions that lack coherence. In this work, we show that an underlying reason for model degeneration is the anisotropic distribution of token representations. We present a contrastive solution: (i) SimCTG, a contrastive training objective to calibrate the model’s representation space, and (ii) a decoding method—contrastive search—to encourage diversity while maintaining coherence in the generated text. Extensive experiments and analyses on three benchmarks from two languages demonstrate that our proposed approach significantly outperforms current state-of-the-art text generation methods as evaluated by both human and automatic metrics.1
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Open-ended neural text generation [19, 23] with Transformer [25] is an indispensable component in various natural language applications, such as story generation [7, 20], contextual text completion [18], and dialogue systems [22]. However, the conventional approach of training a language model with maximum likelihood estimation (MLE) and decoding the most likely sequence is often not sufficient [10, 27]. Specifically, this modelling formulation often leads to the problem of degeneration, i.e., the generated texts from the language model tend to be dull and contain undesirable repetitions at different levels (e.g., token-, phrase-, and sentence-level) [4]. To alleviate this problem, previous solutions modify the decoding strategy by sampling from less likely vocabularies [7, 10]. While reducing the generated repetition, these sampling methods introduce another critical problem (semantic inconsistency)—the sampled text tends to diverge from or even contradict to the original semantics defined by the human-written prefix [1]. Another approach addresses the degeneration problem by modifying the model’s output vocabulary distribution with unlikelihood training [27].
|
| 12 |
+
|
| 13 |
+
In this work, we argue that the degeneration of neural language models stems from the anisotropic distribution of token representations, i.e., their representations reside in a narrow subset of the entire space [6, 5, 21]. In Figure 1(a), we showcase a cosine similarity matrix of token representations (taken from the output layer of the Transformer) produced by GPT-2. We see that the cosine similarities between tokens within a sentence are over 0.95, meaning that these representations are close to each other. Such high similarity is undesirable as it can naturally cause the model to generate repetitive tokens at different steps. In an ideal setting, the token representations should follow an isotropic distribution, i.e., the token similarity matrix should be sparse and the representations of distinct tokens should be discriminative as shown in Figure 1(b). Moreover, during the decoding process, the sparseness of the token similarity matrix of the generated text should be preserved to avoid model degeneration.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Token cosine similarity matrix of (a) GPT-2 and (b) SimCTG. (best viewed in color)
|
| 17 |
+
|
| 18 |
+
Based on the above motivations, we present SimCTG (a simple contrastive framework for neural text generation) that encourages the model to learn discriminative and isotropic token representations. We also present a novel decoding strategy to complement SimCTG, contrastive search. The key intuitions behind contrastive search are: (i) at each decoding step, the output should be selected from the set of most probable candidates predicted by the model to better maintain the semantic coherence between the generated text and the human-written prefix, and (ii) the sparseness of the token similarity matrix of the generated text should be preserved to avoid degeneration.
|
| 19 |
+
|
| 20 |
+
We conduct comprehensive experiments on three widely used benchmarks. We show that our approach is generalizable to different tasks and different languages $\ S 4$ and $\ S 5$ ) as well as different model sizes $\ S 4 . 3$ and Appendix D). Specifically, the experimental results verify that SimCTG improves the intrinsic qualities of the language model, as evaluated by perplexity and token prediction accuracy $\Re 4 . 2$ and Appendix D). Moreover, we demonstrate that the proposed contrastive search significantly outperforms previous state-of-the-art decoding methods in both human and automatic evaluations $\{ \ S 4$ and $\ S 5$ ). Furthermore, we provide in-depth analyses to get better insights on the inner-workings of our proposed approach (§6).
|
| 21 |
+
|
| 22 |
+
# 2 Background
|
| 23 |
+
|
| 24 |
+
# 2.1 Language Modelling
|
| 25 |
+
|
| 26 |
+
The goal of language modelling is to learn a probability distribution $p _ { \theta } ( { \pmb x } )$ over a variable-length text sequence $\pmb { x } = \bar { \{ { x _ { 1 } , . . . , x _ { | x | } } \} }$ , where $\theta$ denotes model parameters. Typically, the maximum likelihood estimation (MLE) objective is used to train the language model which is defined as
|
| 27 |
+
|
| 28 |
+
$$
|
| 29 |
+
\mathcal { L } _ { \mathrm { M L E } } = - \frac { 1 } { | \pmb { x } | } \sum _ { i = 1 } ^ { | \pmb { x } | } \log p _ { \theta } ( x _ { i } | \pmb { x } _ { < i } ) .
|
| 30 |
+
$$
|
| 31 |
+
|
| 32 |
+
However, as observed in many recent studies [6, 5, 21], training with likelihood maximization objective often yields an anisotropic distribution of model representations (especially for Transformerbased models) that undermines the model’s capacity.
|
| 33 |
+
|
| 34 |
+
# 2.2 Open-ended Text Generation
|
| 35 |
+
|
| 36 |
+
In this work, we focus on studying the task of open-ended text generation due to its generality in various applications, such as story generation [7, 20], contextual text completion [18], poetry generation [14], and dialogue systems [22]. Formally, conditioned on a human-written prefix (i.e., context) $_ { \textbf { \em x } }$ , the task is to decode a continuation $\hat { \textbf { \textit { x } } }$ from the language model and the resulting text is $\{ x _ { 1 } , . . , x _ { | x | } , \hat { x } _ { | x | + 1 } , . . . , \hat { x } _ { | x | + | \hat { x } | } \}$ . Typically, there are two classes of methods used for decoding, which are (1) deterministic methods and (2) stochastic methods.
|
| 37 |
+
|
| 38 |
+
Deteriminstic Methods. Two widely used deterministic approaches are greedy and beam search which aim to select the text continuation with highest probability based on the model’s probability distribution $p _ { \theta }$ . However, solely maximizing the output probability often leads to dullness [13] and degeneration [7, 10] in the generated text.
|
| 39 |
+
|
| 40 |
+
Stochastic Methods. To remedy the issues of deterministic decoding, several approaches have been proposed to sample from $p _ { \theta }$ . To avoid sampling from the unreliable tail of distribution, Fan et al. [7] proposed top- $k$ sampling which draws sample from the vocabulary subset $V ^ { ( k ) }$ that maximizes $\begin{array} { r } { \sum _ { v \in V ^ { ( k ) } } p _ { \theta } ( v | \pmb { x } ) } \end{array}$ . Here, $| V ^ { ( k ) } | = k$ and $_ { \textbf { \em x } }$ is the prefix context. Differently, the current state-of-the-art nucleus sampling [10] draws sample from the smallest vocabulary subset $U$ with total probability mass above a threshold $p \in [ 0 , 1 ]$ ; i.e., $U$ is the smallest vocabulary subset such that $\begin{array} { r } { \bar { \sum _ { v \in U } } p _ { \theta } ( \bar { v } | \mathbf { x } ) \ge p } \end{array}$ . While the sampling approaches help to alleviate model degeneration, the intrinsic stochasticity in these methods could cause the semantic meaning of the sampled text to diverge from or even contradict to the human-written prefix [1].
|
| 41 |
+
|
| 42 |
+
# 3 Methodology
|
| 43 |
+
|
| 44 |
+
In this section, we first present how to apply contrastive learning to calibrate the representation space of the language model. Then, we introduce our proposed contrastive search decoding algorithm.
|
| 45 |
+
|
| 46 |
+
# 3.1 Contrastive Training
|
| 47 |
+
|
| 48 |
+
Our goal is to encourage the language model to learn discriminative and isotropic token representations. To this end, we introduce a contrastive objective ${ \mathcal { L } } _ { \mathrm { C L } }$ into the training of the language model. Specifically, given a variable-length sequence $\pmb { x } = \{ x _ { 1 } , . . . , x _ { | \pmb { x } | } \}$ , the ${ \mathcal { L } } _ { \mathrm { C L } }$ is defined as
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
\mathcal { L } _ { \mathrm { C L } } = \frac { 1 } { | \boldsymbol { x } | \times ( | \boldsymbol { x } | - 1 ) } \sum _ { i = 1 } ^ { | \boldsymbol { x } | } \sum _ { j = 1 , j \neq i } ^ { | \boldsymbol { x } | } \operatorname* { m a x } \{ 0 , \rho - s ( h _ { \boldsymbol { x } _ { i } } , h _ { \boldsymbol { x } _ { i } } ) + s ( h _ { \boldsymbol { x } _ { i } } , h _ { \boldsymbol { x } _ { j } } ) \} ,
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
where $\rho \in [ - 1 , 1 ]$ is a pre-defined margin and $h _ { x _ { i } }$ is the representation of token $x _ { i }$ produced by the model. The similarity function $s$ computes the cosine similarity between token representations as
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
s ( h _ { x _ { i } } , h _ { x _ { j } } ) = \frac { h _ { x _ { i } } ^ { \top } h _ { x _ { j } } } { \| h _ { x _ { i } } \| \cdot \| h _ { x _ { j } } \| } .
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
Intuitively, by training with ${ \mathcal { L } } _ { \mathrm { C L } }$ , the model learns to pull away the distances between representations of distinct tokens.2 Therefore, a discriminative and isotropic model representation space can be obtained. The overall training objective $\mathcal { L } _ { \mathrm { S i m C T G } }$ is then defined as
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\mathcal { L } _ { \mathrm { { S i m C T G } } } = \mathcal { L } _ { \mathrm { { M L E } } } + \mathcal { L } _ { \mathrm { { C L } } } ,
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
where the maximum likelihood estimation (MLE) objective $\mathcal { L } _ { \mathrm { M L E } }$ is described in Eq. (1). Note that, when the margin $\rho$ in ${ \mathcal { L } } _ { \mathrm { C L } }$ equals to $0$ , the $\mathcal { L } _ { \mathrm { S i m C T G } }$ degenerates to the vanilla MLE objective $\mathcal { L } _ { \mathrm { M L E } }$ .
|
| 67 |
+
|
| 68 |
+
# 3.2 Contrastive Search
|
| 69 |
+
|
| 70 |
+
We propose a novel decoding method, contrastive search. At each decoding step, the key ideas of contrastive search are (i) the generated output should be selected from the set of most probable candidates predicted by the model; and (ii) the generated output should be discriminative enough with respect to the previous context. In this way, the generated text can (i) better maintain the semantic coherence with respect to the prefix while (ii) avoiding model degeneration.
|
| 71 |
+
|
| 72 |
+
Formally, given the previous context $\scriptstyle { \mathbf { \mathcal { x } } } _ { < t }$ , at time step $t$ , the selection of the output $x _ { t }$ follows
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
x _ { t } = \underset { v \in V ^ { ( k ) } } { \arg \operatorname* { m a x } } \left\{ \left( 1 - \alpha \right) \times \underset { \mathrm { m o d e l } \mathrm { c o n f i d e n c e } } { p \theta \left( v | x _ { < t } \right) } - \alpha \times \underset { \mathrm { d e g e n e r a t i o n } \mathrm { p e n a l u } } { \underbrace { \left( \operatorname* { m a x } \{ s ( h _ { v } , h _ { x _ { j } } ) : 1 \leq j \leq t - 1 \} \right) } } \right\} ,
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
where $V ^ { ( k ) }$ is the set of top- $k$ predictions from the model’s probability distribution $p _ { \theta } ( \cdot | \pmb { x } _ { < t } )$ and $k$ is typically set as $3 { \sim } 1 0$ . In Eq. (5), the first term, model confidence, is the probability of candidate $v$ predicted by the model. The second term, degeneration penalty, measures how discriminative of candidate $v$ with respect to the previous context $\scriptstyle { \mathbf { { \mathcal { x } } } } _ { < t }$ and $s$ is defined in Eq. (3). Specifically, it is defined as the maximum cosine similarity between the representation of $v$ and that of all tokens in $\scriptstyle { \mathbf { { \mathcal { x } } } } _ { < t }$ . Here, the candidate representation $h _ { v }$ is computed by the model given the concatenation of $\scriptstyle { \mathbf { \mathcal { x } } } _ { < t }$ and $v$ . Intuitively, a larger degeneration penalty of $v$ means it is more similar to the context, therefore more likely leading to model degeneration. The hyperparameter $\alpha \in [ 0 , 1 ]$ regulates the importance of these two components. When $\alpha = 0$ , contrastive search degenerates to the greedy search method.
|
| 79 |
+
|
| 80 |
+
# 4 Document Generation
|
| 81 |
+
|
| 82 |
+
We first evaluate our approach on the task of open-ended document generation.
|
| 83 |
+
|
| 84 |
+
Model and Baselines. Our proposed approach is architecture-agnostic and can be applied to any generation model. In this work, we evaluate our method on the representative GPT-2 model [18]. Specifically, we fine-tune GPT-2 on the evaluated benchmark (detailed below) with the proposed objective $\mathcal { L } _ { \mathrm { { S i m C T G } } }$ (Eq. (4)) and generate the text continuation with different decoding methods. We perform experiments using the base model (117M parameters) which consists of 12 Transformer layers [25] with 12 attention heads.3 We compare our approach with two strong baselines: (1) GPT-2 fine-tuned with the standard MLE objective (Eq. (1)); and (2) GPT-2 fine-tuned with unlikelihood objective [27].4 Our implementation is based on the Huggingface Library [28].
|
| 85 |
+
|
| 86 |
+
Evaluation Benchmark. We conduct experiments on the Wikitext-103 dataset [16] which contains a large collection of Wikipedia articles with over 100 million words and 260 thousands unique tokens. Wikitext-103 is a document-level dataset and has been widely used for the evaluation of large-scale language modelling [3, 11, 29].
|
| 87 |
+
|
| 88 |
+
Training. For our SimCTG and the MLE baseline, we fine-tune the models on Wikitext-103 for 40k training steps. For the unlikelihood baseline, following Welleck et al. [27], we first fine-tune the model with the token-level unlikelihood objective for $3 8 . 5 \mathrm { k }$ steps and then with the sequence-level unlikelihood objective for $1 . 5 \mathrm { k }$ steps. Therefore, the overall training steps of all compared methods are the same. The batch size is set as 128 and the training samples are truncated to a maximum length of 256. We optimize the model with Adam optimizer [12] and a learning rate of 2e-5.
|
| 89 |
+
|
| 90 |
+
Decoding. We evaluate the models by producing text continuations given the prefixes from the test set. In the experiments, the lengths of the prefix and the generated continuation are set as 32 and 128, respectively. We test different models with various decoding methods. For deterministic method, we use greedy search and beam search with a beam size of 10. For stochastic method, we use the current state-of-the-art nucleus sampling [10] with $p = 0 . 9 5$ . For the proposed contrastive search, the $k$ and $\alpha$ in Eq. (5) are set as 8 and 0.6.5 The hyperparameters of different methods are selected based on their optimal MAUVE (detailed in $\ S 4 . 1 . 2 )$ performance on the validation set.
|
| 91 |
+
|
| 92 |
+
# 4.1 Evaluation Metrics
|
| 93 |
+
|
| 94 |
+
We perform evaluation from two aspects: (1) language modelling quality which measures the intrinsic quality of the model; and (2) generation quality which measures the quality of the generated text.
|
| 95 |
+
|
| 96 |
+
# 4.1.1 Language Modelling Quality
|
| 97 |
+
|
| 98 |
+
Following Welleck et al. [27], we report the results of the model on the metrics below.
|
| 99 |
+
|
| 100 |
+
Perplexity. The model perplexity (ppl) on the test set of Wikitext-103.
|
| 101 |
+
|
| 102 |
+
Prediction Accuracy. It is defined as: $\begin{array} { r } { \mathbf { a c c } = \frac { 1 } { \sum _ { \pmb { x } \in \mathcal { D } } | \pmb { x } | } \sum _ { \pmb { x } \in \mathcal { D } } \sum _ { t = 1 } ^ { | \pmb { x } | } \mathbb { 1 } [ \mathrm { a r g } \operatorname* { m a x } p _ { \theta } ( x | \pmb { x } _ { < t } ) = x _ { t } ] , } \end{array}$ where $\mathcal { D }$ is the Wikitext-103 test set, $\scriptstyle { \mathbf { \mathcal { x } } } _ { < t }$ is the prefix, and $x _ { t }$ is the reference token at time step $t$ .
|
| 103 |
+
|
| 104 |
+
Table 1: Evaluation results on Wikitext-103 test set. “Unlike.” denotes the model trained with unlikelihood objective. $\uparrow$ means higher is better and $\downarrow$ means lower is better.
|
| 105 |
+
|
| 106 |
+
<table><tr><td rowspan="2">Model</td><td colspan="4">LanguageModellingQuality</td><td colspan="8">Generation Quality</td></tr><tr><td>ppl</td><td>acc↑</td><td>rep↓</td><td>wrep↓</td><td>Method</td><td>rep-2↓</td><td>rep-3↓</td><td>rep-4↓</td><td>diversity↑</td><td>MAUVE↑</td><td>coherence↑</td><td>gen-ppl</td></tr><tr><td rowspan="4">MLE</td><td rowspan="4">24.32</td><td rowspan="4">39.63</td><td rowspan="4">52.82</td><td rowspan="4">29.97</td><td>greedy</td><td>69.21</td><td>65.18</td><td>62.05</td><td>0.04</td><td>0.03</td><td>0.587</td><td>7.32</td></tr><tr><td>beam</td><td>71.94</td><td>68.97</td><td>66.62</td><td>0.03</td><td>0.03</td><td>0.585</td><td>6.42</td></tr><tr><td>nucleus</td><td>4.45</td><td>0.81</td><td>0.43</td><td>0.94</td><td>0.90</td><td>0.577</td><td>49.71</td></tr><tr><td>contrastive</td><td>44.20</td><td>37.07</td><td>32.44</td><td>0.24</td><td>0.18</td><td>0.599</td><td>9.90</td></tr><tr><td rowspan="4">Unlike.</td><td rowspan="4">28.57</td><td rowspan="4">38.41</td><td rowspan="4">51.23</td><td rowspan="4">28.57</td><td>greedy</td><td>24.12</td><td>13.35</td><td>8.04</td><td>0.61</td><td>0.69</td><td>0.568</td><td>37.82</td></tr><tr><td>beam</td><td>11.83</td><td>5.11</td><td>2.86</td><td>0.81</td><td>0.75</td><td>0.524</td><td>34.73</td></tr><tr><td>nucleus</td><td>4.01</td><td>0.80</td><td>0.42</td><td>0.95</td><td>0.87</td><td>0.563</td><td>72.03</td></tr><tr><td>contrastive</td><td>7.48</td><td>3.23</td><td>1.40</td><td>0.88</td><td>0.83</td><td>0.574</td><td>43.61</td></tr><tr><td rowspan="4">SimCTG</td><td rowspan="4">23.82</td><td rowspan="4">40.91</td><td rowspan="4">51.66</td><td rowspan="4">28.65</td><td>greedy</td><td>67.36</td><td>63.33</td><td>60.17</td><td>0.05</td><td>0.05</td><td>0.596</td><td>7.16</td></tr><tr><td>beam</td><td>70.32</td><td>67.17</td><td>64.64</td><td>0.04</td><td>0.06</td><td>0.591</td><td>6.36</td></tr><tr><td>nucleus</td><td>4.05</td><td>0.79</td><td>0.37</td><td>0.94</td><td>0.92</td><td>0.584</td><td>47.19</td></tr><tr><td>contrastive</td><td>3.93</td><td>0.78</td><td>0.31</td><td>0.95</td><td>0.94</td><td>0.610</td><td>18.26</td></tr><tr><td>Human</td><td>-</td><td>-</td><td>36.19</td><td>-</td><td>-</td><td>3.92</td><td>0.88</td><td>0.28</td><td>0.95</td><td>1.00</td><td>0.644</td><td>24.01</td></tr></table>
|
| 107 |
+
|
| 108 |
+
Prediction Repetition. The fraction of next-token (top-1) predictions that occur in the prefix which is defined as: $\begin{array} { r } { \mathbf { r e p } = \frac { 1 } { \sum _ { \pmb { x } \in \mathcal { D } } | \pmb { x } | } \sum _ { \pmb { x } \in \mathcal { D } } \sum _ { t = 1 } ^ { | \pmb { x } | } \mathbb { 1 } \big [ \mathrm { a r g } \operatorname* { m a x } p _ { \theta } \big ( \pmb { x } | \pmb { x } _ { < t } \big ) \in \pmb { x } _ { < t } \big ] . } \end{array}$
|
| 109 |
+
|
| 110 |
+
In addition, the next token repetitions that do not equal to the ground truth token: wrep $=$ P 1x |x| Px∈D P|x|t=1 1[arg max pθ(x|x<t) ∈ x<t ∧ ̸= xt] is also reported.
|
| 111 |
+
|
| 112 |
+
# 4.1.2 Generation Quality
|
| 113 |
+
|
| 114 |
+
Generation Repetition. This metric measures the sequence-level repetition as the portion of duplicate $n$ -grams in the generated text [27]. For a generated text continuation $\hat { \textbf { \textit { x } } }$ , the repetion at $n$ -gram level is defined as: rep- $\begin{array} { r } { \mathbf { \delta n } = 1 0 0 \times \big ( 1 . 0 - \frac { | \mathrm { u n i q u e ~ n - g r a m s } ( \hat { \pmb x } ) | } { | \mathrm { t o t a l ~ n - g r a m s } ( \hat { \pmb x } ) | } \big ) } \end{array}$
|
| 115 |
+
|
| 116 |
+
Diversity. This metric takes into account the generation repetition at different -gram levels and it is defined as: diversity $\begin{array} { r } { = \prod _ { n = 2 } ^ { 4 } ( 1 . 0 - \frac { \mathrm { r e p - n } } { 1 0 0 } ) } \end{array}$ . It can be deemed as an overall assessment of model degeneration. A lower diversity means a more severe degeneration of the model.
|
| 117 |
+
|
| 118 |
+
MAUVE [17] is a metric that measures the token distribution closeness between the generated text and human-written text. A higher MAUVE score means the model generates more human-like texts.
|
| 119 |
+
|
| 120 |
+
Semantic Coherence. To automatically measure the semantic coherence (i.e., consistency) between the prefix and the generated text, we employ the advanced sentence embedding method, SimCSE [9]. Specifically, given the prefix $_ { \textbf { \em x } }$ and the generated text $\hat { \pmb x }$ , the coherence score is defined as: coherence $= v _ { x } ^ { \top } v _ { \hat { x } } / ( \| v _ { x } \| { \cdot } \| \hat { v } _ { \hat { x } } \| )$ , where $v _ { x } = \mathrm { S i m C S E } ( x )$ and $v _ { \hat { \mathbf { x } } } = \mathrm { S i m C S E } ( \hat { \mathbf { x } } )$ .
|
| 121 |
+
|
| 122 |
+
Perplexity of Generated Text. Lastly, we evaluate the perplexity of the generated text $\hat { \pmb x }$ given the prefix $_ { \textbf { \em x } }$ , which is defined as: $\mathbf { g e n - } \mathbf { \dot { p } } \mathbf { p } \mathbf { l } = 2 ^ { f ( T , \theta ) }$ and $\begin{array} { r } { \bar { f } ( \bar { D } , \theta ) = \frac { 1 } { \sum _ { \pmb { x } \in \mathcal { D } } | \hat { \pmb x } | } \sum _ { \pmb { x } \in \mathcal { D } } \log _ { 2 } p _ { \theta } ( \bar { \pmb x } | \pmb x ) } \end{array}$ Importantly, the optimal approach should produce text which has a perplexity close to that of the human-written text [10]. A high gen-ppl means the generated text is very unlikely given the prefix, therefore being low quality. In contrastive, a low gen-ppl means the generated text has a low diversity and gets stuck in repetitive loops [10]. We use the model $\theta$ trained with $\mathcal { L } _ { \mathrm { S i m C T G } }$ to measure the gen-ppl of different approaches, therefore making sure the numbers are comparable with each other.6
|
| 123 |
+
|
| 124 |
+
# 4.2 Results
|
| 125 |
+
|
| 126 |
+
The experimental results on Wikitext-103 are shown in Table 1.
|
| 127 |
+
|
| 128 |
+
Language Modelling Quality. From the results, we observe that SimCTG achieves the best perplexity and next token accuracy. The reason is that, with more discriminative representations, SimCTG is less confusing when making next token predictions, leading to the improved model performance.
|
| 129 |
+
|
| 130 |
+
On the rep and wrep metrics, the unlikelihood model yields the best result but at the expense of unfavorable performance drops in the perplexity and next token accuracy.
|
| 131 |
+
|
| 132 |
+
Generation Quality. Firstly, on the rep-n and diversity metrics, SimCTG $^ +$ contrastive search obtains the best result, suggesting it best addresses the degeneration problem. Secondly, the MAUVE score demonstrates that SimCTG $^ +$ contrastive search generates texts that are closest to human-written texts in terms of token distribution. Thirdly, among all methods, $\mathrm { S i m C T G } +$ contrastive search is the only approach that achieves over 0.6 coherence score, showing it produces semantically consistent text with respect to the prefix. Lastly, the gen-ppl metric also validates the superiority of $\mathrm { S i m C T G } +$ contrastive search as it obtains notably better generation perplexity comparing with other approaches.
|
| 133 |
+
|
| 134 |
+
Moreover, from the results of MLE and Unlikelihood baselines, we see that contrastive search still brings performance boost as compared with greedy and beam search. However, the performance gain still lags behind SimCTG, which demonstrates the necessity of contrastive training. The underlying reason is that, without using the contrastive objective ${ \mathcal { L } } _ { \mathrm { C L } }$ (Eq. (2)), the token representations obtained by MLE or Unlikelihood are less discriminative (§6.1). Therefore, the degeneration penalty (Eq. (5)) of different candidates are less distinguishable and the selection of output is dominated by the model confidence, making contrastive search less effective.
|
| 135 |
+
|
| 136 |
+
<table><tr><td>Model</td><td>DecodingMethod</td><td>Coherence</td><td>Fluency</td><td>Informativeness</td></tr><tr><td>Agreement</td><td>-</td><td>0.51</td><td>0.64</td><td>0.70</td></tr><tr><td rowspan="2">MLE</td><td>nucleus</td><td>2.92</td><td>3.32</td><td>3.91</td></tr><tr><td>contrastive</td><td>2.78</td><td>2.29</td><td>2.56</td></tr><tr><td rowspan="2">Unlikelihood</td><td>nucleus</td><td>2.59</td><td>3.02</td><td>3.58</td></tr><tr><td>contrastive</td><td>2.76</td><td>2.90</td><td>3.35</td></tr><tr><td rowspan="2">SimCTG</td><td>nucleus</td><td>2.96</td><td>3.34</td><td>3.96</td></tr><tr><td>contrastive</td><td>3.25*</td><td>3.57*</td><td>3.96</td></tr><tr><td rowspan="2">SimCTG-large</td><td>nucleus</td><td>3.01</td><td>3.37</td><td>3.98</td></tr><tr><td>contrastive</td><td>3.33*</td><td>3.66*</td><td>3.98</td></tr><tr><td>Human</td><td>-</td><td>3.70</td><td>3.71</td><td>4.21</td></tr></table>
|
| 137 |
+
|
| 138 |
+
Table 2: Human evaluation results. $\star$ results significantly outperforms the results of nucleus sampling with different models (Sign Test with p-value $< 0 . 0 5$ ).
|
| 139 |
+
|
| 140 |
+
# 4.3 Human Evaluation
|
| 141 |
+
|
| 142 |
+
We also conduct a human evaluation with the help of graders proficient in English from a third-party grading platform. We randomly select 200 prefixes with length of 32 from the test set of Wikitext-103. For each prefix, we use different models (MLE, Unlikelihood, and SimCTG) with two decoding methods (nucleus sampling and contrastive search) to generate text continuations with length of 128. To examine the generality of our approach across different model sizes, we include a large size SimCTG (i.e., SimCTG-large) which is obtained by fine-tuning the GPT-2-large model that consists of 36 Transformer layers with 20 attention heads. All generated results, plus the reference text, are randomly shuffled and evaluated by five graders, which results in 9,000 annotated samples in total. The evaluation follows a 5-point Likert scale (1, 2, 3, 4, or 5) for each of the following features:7
|
| 143 |
+
|
| 144 |
+
• Coherence: Whether the generated text is semantically consistent with the prefix.
|
| 145 |
+
• Fluency: Whether the generated text is fluent and easy to understand.
|
| 146 |
+
• Informativeness: Whether the generated text is diverse and contains interesting content.
|
| 147 |
+
|
| 148 |
+
Table 2 presents the human evaluation results, with the first row showing strong inter-annotator agreements as measured by Fleiss′ kappa coefficient [8]. Firstly, we see that, directly applying contrastive search with MLE or Unlikelihood model does not yield satisfactory results. This is due to the anisotropic nature of their representation space as discussed in Section $\ S 4 . 2$ . Secondly, the coherence score of Unlikelihood model is notably lower than MLE and SimCTG, suggesting it generates the most unlikely results which is also shown by its generation perplexity (gen-ppl) in Table 1. Furthermore, the results of SimCTG $^ +$ contrastive search significantly outperforms nucleus sampling with different models in terms of coherence and fluency (Sign Test with $\boldsymbol { \mathrm { p } }$ -value $< 0 . 0 5$ ).
|
| 149 |
+
|
| 150 |
+
Lastly, SimCTG-large $^ +$ contrastive search achieves the best performance across the board and even performs comparably with human-written text on the fluency metric (Sign Test with p-value $> 0 . 4$ ). This reveals the clear generalization ability of our approach to large size models and future work could focus on extending it to models that contain over billions of parameters such as GPT-3 [2].
|
| 151 |
+
|
| 152 |
+
# 5 Open-domain Dialogue Generation
|
| 153 |
+
|
| 154 |
+
To test the generality of our approach across different tasks and languages, we then evaluate our method on the task of open-domain dialogue generation. In this task, given a multi-turn dialogue context (where each turn is an user utterance), the model is asked to generate an adequate response that is semantically consistent with the context. Here, the dialogue context is deemed as the prefix.
|
| 155 |
+
|
| 156 |
+
Benchmark and Baselines. We conduct experiments on two benchmark datasets from two languages (i.e., Chinese and English). For the Chinese benchmark, we use the LCCC dataset [26]. For the English Benchmark, we use the DailyDialog dataset [15].
|
| 157 |
+
|
| 158 |
+
We compare the GPT-2 models fine-tuned with SimCTG and MLE.8 Specifically, for the Chinese benchmark (i.e., LCCC), we use a publicly available Chinese GPT-2 [31].9 Same as in Section $\ S 4$ , during training, we use a batch size of 128 and truncate the training samples to a maximum length of 256. On the LCCC dataset, we train (i.e., fine-tune) the models for $4 0 \mathrm { k }$ steps. As for the DailyDialog dataset, due to its smaller dataset size, we train the models for $5 \mathrm { k }$ steps. For optimization, we use Adam optimizer and a learning rate of 2e-5.
|
| 159 |
+
|
| 160 |
+
For each model, we use four decoding methods, including (1) greedy search; (2) beam search (beam size of 10); (3) nucleus sampling $( p = 0 . 9 5 )$ ; and (4) contrastive search ( $k = 5$ , $\alpha = 0 . 6$ ).
|
| 161 |
+
|
| 162 |
+
Evaluation. We rely on human evaluation to assess the model performance. Same as in Section $\ S 4 . 3$ , we randomly select 200 dialogue contexts from the test set and ask five annotators to evaluate the generated responses plus the reference response in three dimensions: (i) coherence, (ii) fluency; and (iii) informativeness. The scores follow a 5-point Likert scale (1, 2, 3, 4, or 5).
|
| 163 |
+
|
| 164 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">Method</td><td colspan="3">LCCC</td><td colspan="3">DailyDialog</td></tr><tr><td>Coherence</td><td>Fluency</td><td>Informativeness</td><td>Coherence</td><td>Fluency</td><td>Informativeness</td></tr><tr><td>Agreement</td><td>-</td><td>0.73</td><td>0.61</td><td>0.57</td><td>0.64</td><td>0.60</td><td>0.55</td></tr><tr><td rowspan="4">MLE</td><td>greedy</td><td>3.01</td><td>3.27</td><td>1.97</td><td>3.28</td><td>3.51</td><td>2.92</td></tr><tr><td>beam</td><td>2.60</td><td>2.90</td><td>1.55</td><td>3.16</td><td>3.43</td><td>2.78</td></tr><tr><td>nucleus</td><td>2.78</td><td>3.55</td><td>2.64</td><td>2.67</td><td>3.58</td><td>3.42</td></tr><tr><td>contrastive</td><td>3.28*</td><td>3.84*</td><td>3.06*</td><td>3.27</td><td>3.41</td><td>2.82</td></tr><tr><td rowspan="4">SimCTG</td><td>greedy</td><td>3.04</td><td>3.32</td><td>2.01</td><td>3.31</td><td>3.50</td><td>2.94</td></tr><tr><td>beam</td><td>2.57</td><td>2.93</td><td>1.59</td><td>3.19</td><td>3.45</td><td>2.79</td></tr><tr><td>nucleus</td><td>2.84</td><td>3.58</td><td>2.72</td><td>2.75</td><td>3.59</td><td>3.39</td></tr><tr><td>contrastive</td><td>3.32*</td><td>3.96*</td><td>3.13*</td><td>3.73*</td><td>3.85*</td><td>3.46</td></tr><tr><td>Human</td><td>■</td><td>3.42</td><td>3.76</td><td>3.20</td><td>4.11</td><td>3.98</td><td>3.74</td></tr></table>
|
| 165 |
+
|
| 166 |
+
Table 3: Human evaluation results. $\star$ results significantly outperforms the results of greedy search, beam search, and nucleus sampling with different models. (Sign Test with p-value $< 0 . 0 5$ ).
|
| 167 |
+
|
| 168 |
+
Table 3 shows the evaluation results where the first row shows strong inter-annotator agreements as measured by Fleiss′ kappa coefficient. On both datasets, we see that $\mathrm { S i m C T G } +$ contrastive search significantly outperforms other methods on various metrics, suggesting that our approach is generalizable to different languages and tasks. It is worth emphasizing that, on the LCCC benchmark, $\mathrm { S i m C T G } +$ contrastive search surprisingly outperforms the human performance on the fluency metric, while performing comparably on the coherence and informativeness metrics (Sign Test with p-value $>$ 0.4). Moreover, even without contrastive training, the MLE model performs significantly better when using contrastive search. This is due to the intrinsic property of Chinese language model for which the MLE objective can already yield a representation space that displays a high level of isotropy, making contrastive search directly applicable.10 This finding is particularly attractive as it reveals the potential applicability of contrastive search on off-the-shelf (i.e., without contrastive training) language models for certain languages such as Chinese.
|
| 169 |
+
|
| 170 |
+

|
| 171 |
+
Figure 2: Layer-wise representation self-similarity.
|
| 172 |
+
|
| 173 |
+

|
| 174 |
+
Figure 3: The effect of contrastive margin $\rho$
|
| 175 |
+
|
| 176 |
+
# 6 Further Analysis
|
| 177 |
+
|
| 178 |
+
# 6.1 Token Representation Self-similarity
|
| 179 |
+
|
| 180 |
+
To analyze the token representations learned by SimCTG, we follow Ethayarajh [6] and define the averaged self-similarity of token representations within a text sequence $_ { \textbf { \em x } }$ as
|
| 181 |
+
|
| 182 |
+
$$
|
| 183 |
+
\mathrm { s e l f - s i m i l a r i t y } ( \pmb { x } ) = \frac { 1 } { | \pmb { x } | \times ( | \pmb { x } | - 1 ) } \sum _ { i = 1 } ^ { | \pmb { x } | } \sum _ { j = 1 , j \neq i } ^ { | \pmb { x } | } \frac { h _ { x _ { i } } ^ { \top } h _ { x _ { j } } } { \| h _ { x _ { i } } \| \cdot \| h _ { x _ { j } } \| } ,
|
| 184 |
+
$$
|
| 185 |
+
|
| 186 |
+
where $h _ { x _ { i } }$ and $h _ { x _ { j } }$ are the token representations of $x _ { i }$ and $x _ { j }$ produced by the model. Intuitively, a lower self-similarity $( { \pmb x } )$ indicates the representations of distinct tokens within the sequence $_ { \textbf { \em x } }$ are less similar to each other, therefore being more discriminative.
|
| 187 |
+
|
| 188 |
+
We use texts from Wikitext-103 test set and compute the self-similarity of token representations over different layers for different models. Figure 2 plots the results averaged over all samples. We see that, in the intermediate layers, the self-similarity of different models are relatively the same. In contrast, at the output layer (layer 12), SimCTG’s self-similarity becomes notably lower than other baselines. We note that the Unlikelihood model also yields more discriminative representations than MLE, but its language model accuracy is lower than MLE and SimCTG as shown in Table 1. On the other hand, SimCTG obtains the most discriminative and isotropic representations while maintaining the best language model accuracy, which further validates the clear advantage of our proposed approach.
|
| 189 |
+
|
| 190 |
+
# 6.2 The Effect of Contrastive Loss Margin
|
| 191 |
+
|
| 192 |
+
Next, we analyze the effect of contrastive loss margin $\rho$ (Eq. (2)). To this end, we fine-tune the GPT-2 by varying $\rho$ from 0.1 to 1.0 and measure the model perplexity on the Wikitext-103 test set. Figure 3 plots the results of different $\rho$ along with the result of the MLE baseline. Note that, when $\rho = 0$ , SimCTG is equivalent to MLE (Section $\ S 3 . 1$ ). From Figure 3, we see that the contrastive training always helps to improve the perplexity as compared with MLE. However, when $\rho$ is either too small (e.g., 0.1) or large (e.g., 1.0), the learned representation space of the model would be either less or too isotropic, leading to a sub-optimal perplexity. In our experiments, the most suitable margin $\rho = 0 . 5$ .
|
| 193 |
+
|
| 194 |
+
# 6.3 Contrastive Search versus Nucleus Sampling
|
| 195 |
+
|
| 196 |
+
Then, we provide an in-depth comparsion between our proposed contrastive search and the current state of the art, nucleus sampling. To this end, we compare the results of SimCTG using these two decoding methods. Specifically, we vary the probability $p$ for nucleus sampling and the $\alpha$ (Eq. (5))
|
| 197 |
+
|
| 198 |
+

|
| 199 |
+
Figure 4: Contrastive search vs nucleus sampling.
|
| 200 |
+
|
| 201 |
+

|
| 202 |
+
Figure 5: Inference latency comparison.
|
| 203 |
+
|
| 204 |
+
for contrastive search to generate results using prefixes from Wikitext-103 test set.11 We evaluate the results from two aspects: (1) generation diversity and (2) perplexity of the generated text (gen-ppl). Both metrics are described in Section $\ S 4 . 1 . 2$ . Figure 4 plots the results of different methods along with the human performance. For nucleus sampling, when $p$ is small (i.e., $p \leq 0 . 7 )$ ), its generation perplexity is comparable to that of human. However, the diversity is notably lower than human performance, meaning it stuck in undesirable repetition loops [10]. On the other hand, when $p$ is large (i.e., $p \geq 0 . 9 5 )$ , the generation diversity is close to that of human but the generation perplexity is significantly higher. Such high perplexity means the generated text is very unlikely, therefore being low quality. As for contrastive search, when $\alpha \in [ 0 . 5 , 0 . 8 ]$ , it yields generation diversity and perplexity that are both comparable to human performance. These results demonstrate the superiority of contrastive search as it better balances the trade-off between the generation diversity and perplexity.
|
| 205 |
+
|
| 206 |
+
# 6.4 Decoding Latency Comparison
|
| 207 |
+
|
| 208 |
+
We compare the decoding latency of different decoding methods using SimCTG. For beam search and contrastive search, we vary the beam width $b$ and the $k$ in Eq. (5). The latency is measured by generating fixed length text continuations on Wikitext-103 test cases with a batch size of 1. In Figure 5, we show the averaged relative decoding latency of different methods. We see that greedy search is the fastest method and the latency of different methods are generally comparable with each other. Comparing contrastive search with beam search, when $b$ and $k$ are small (i.e., $\leq 6$ ), their latency are nearly identical. When $b$ and $k$ gets larger (i.e., $> 6$ ), contrastive search becomes faster. In summary, these comparison results further verify the practical usage of contrastive search.
|
| 209 |
+
|
| 210 |
+
<table><tr><td>prefix</td><td>Butt criticized Donald's controls in certain situations in the game,as well as the difficulty of some levels and puzzles.Buchanan also criticized the controls,calling</td><td>div.</td><td>coh.</td><td>gen-ppl</td></tr><tr><td>beam</td><td>them "too easy "and "too dificult ".He also criticized the game's graphics,stating that the game's graphics were" too simplistic " and "too simplistic ". He also criticized the game's graphics,stating that the game's graphics were "too simplistic "and "too simplistic".He also criticized the graphics, stating that the game's graphics were "too simplistic "and "too simplistic ".He also criticized the graphics,stating that the game's graphics were"too simplistic "and "too simplistic ".He also criticized the graphics,stating that the game's graphics were"...</td><td>0.02</td><td>0.605</td><td>7.91</td></tr><tr><td>nucleus</td><td>them"offensivelyrudimentary ".After the game was released,Buchanan wroteanumberof game reviews about his review of the game,primarily summarizing what he thought the reviewers had enjoyed about it. Buchanan was pleased with how consistently these reviews awarded the game. For one, he praised the puzzles,compared them to Nos.1 and 2 and enjoyed the construction of the artificial intelligence in the game's forms.He found no fault with the puzzles,even in those situations where they seemed repetitive.According to an Xbox Magazine review,"every time.</td><td>0.98</td><td>0.597</td><td>37.83</td></tr><tr><td>contrastive</td><td>them"unimpressive "and a "nightmare "of an experience to play with players unfamiliar with Tetris.On the other hand,his opinion was shared by other reviewers,and some were critical of the game's technical design for the Wii version of Tetris.In addition,Tintin's review included a quote from Roger Ebert,who said that Tetris was better than the original game due to its simplicity and ease of play.Ebert's comments were included in the game's DVD commentary,released on March 22,201o. It is unclear if any of the video commentary was taken from.</td><td>0.98</td><td>0.626</td><td>19.64</td></tr></table>
|
| 211 |
+
|
| 212 |
+
Table 4: Case Study: The beam search produces degeneration repetitions (highlighted in red) and the nucleus sampling produces text that has incoherent semantics with respect to the prefix (highlighted in blue). The reasonable repetitions produced by contrastive search are highlighted in green. The “div.��� and “coh.” stand for diversity and coherence metrics. (best viewed in color)
|
| 213 |
+
|
| 214 |
+
# 6.5 Case Study
|
| 215 |
+
|
| 216 |
+
In Table 4, we present generated examples of SimCTG with different decoding methods given a specific prefix.12 From the results, we see that beam search produces undesirable sequence-level repetitions, resulting in low diversity and low generation perplexity. On the other hand, in the prefix, the person “Buchanan” criticizes the game. However, the result from nucleus sampling displays a contradicted semantic, resulting in a low coherence score as well as a high generation perplexity. As for contrastive search, it generates a text that is semantically consistent to the prefix with a proper generation perplexity while obtaining the same diversity as that of the nucleus sampling. Additionally, it is worth emphasizing that, while the degeneration penalty in Eq. (5) encourages the model to generate diverse outputs, contrastive search is still able to generate reasonable repetitions as highlighted in Table 4. This is due to the incorporation of model confidence in Eq. (5) which enables the model to repeat the important content (e.g., person names or entity names) from the previous context like humans do.
|
| 217 |
+
|
| 218 |
+

|
| 219 |
+
Figure 6: (a) MLE $^ +$ beam search; (b) SimCTG $^ +$ beam search; (c) SimCTG $^ +$ contrastive search. The token similarity matrix of the prefix and the generated text are highlighted in red and yellow.
|
| 220 |
+
|
| 221 |
+
# 6.6 Comparison of Token Similarity Matrix
|
| 222 |
+
|
| 223 |
+
To better understand how contrastive search works, in Figure 6, we show the generated token similarity matrix of SimCTG using beam search and contrastive search. For a better comparsion, we also include the result of MLE using beam search. All results are produced with the same prefix as in Table 4. The red and yellow boxes highlight the similarity matrix of the prefix and the generated text. Firstly, we see that, the MLE $^ +$ beam search yields a very dense similarity matrix, meaning that its token representations are indiscriminative. In addition, the high similarity scores in its off-diagonal entries clearly show the degeneration repetitions. Secondly, for $\mathrm { S i m C T G } +$ beam search, we observe a desirable similarity matrix of the prefix which is sparse and isotropic. However, degeneration repetitions still exist in the generated result as shown in Figure 6(b). Lastly, for $\mathrm { S i m C T G } +$ contrastive search, the entire similarity matrix is sparse and isotropic, showing that it successfully solves the model degeneration. These observations are in line with our motivations as described in Section $\ S 1$ .
|
| 224 |
+
|
| 225 |
+
# 7 Conclusion
|
| 226 |
+
|
| 227 |
+
In this work, we show that the degeneration of neural language models stems from the anisotropic nature of their token representations. We present a new approach, SimCTG, for training the language model such that it obtains an isotropic and discriminative representation space. In addition, we introduce a novel decoding method, contrastive search, which works coherently with the proposed SimCTG. Extensive experiments and analyses are conducted on three benchmarks from two languages. Both automatic and human evaluations demonstrate that our approach substantially reduces model degeneration and significantly outperforms current state-of-the-art text generation approaches.
|
| 228 |
+
|
| 229 |
+
# Acknowledgments
|
| 230 |
+
|
| 231 |
+
The first author would like to thank Jialu Xu and Huayang Li for their insightful discussions and supports. Many thanks to our anonymous reviewers, area chairs, and senior area chairs for their suggestions and comments.
|
| 232 |
+
|
| 233 |
+
# References
|
| 234 |
+
|
| 235 |
+
[1] Sourya Basu, Govardana Sachitanandam Ramachandran, Nitish Shirish Keskar, and Lav R. Varshney. Mirostat: a neural text decoding algorithm that directly controls perplexity. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021.
|
| 236 |
+
[2] Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin, editors, Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
|
| 237 |
+
[3] Zihang Dai, Zhilin Yang, Yiming Yang, Jaime G. Carbonell, Quoc Viet Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. In Anna Korhonen, David R. Traum, and Lluís Màrquez, editors, Proceedings of the 57th Conference of the Association for Computational Linguistics, ACL 2019, Florence, Italy, July 28- August 2, 2019, Volume 1: Long Papers, pages 2978–2988. Association for Computational Linguistics, 2019.
|
| 238 |
+
[4] Emily Dinan, Varvara Logacheva, Valentin Malykh, Alexander H. Miller, Kurt Shuster, Jack Urbanek, Douwe Kiela, Arthur Szlam, Iulian Serban, Ryan Lowe, Shrimai Prabhumoye, Alan W. Black, Alexander I. Rudnicky, Jason Williams, Joelle Pineau, Mikhail S. Burtsev, and Jason Weston. The second conversational intelligence challenge (convai2). CoRR, abs/1902.00098, 2019.
|
| 239 |
+
[5] Yihe Dong, Jean-Baptiste Cordonnier, and Andreas Loukas. Attention is not all you need: pure attention loses rank doubly exponentially with depth. In Marina Meila and Tong Zhang, editors, Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, volume 139 of Proceedings of Machine Learning Research, pages 2793–2803. PMLR, 2021.
|
| 240 |
+
[6] Kawin Ethayarajh. How contextual are contextualized word representations? comparing the geometry of bert, elmo, and GPT-2 embeddings. In Kentaro Inui, Jing Jiang, Vincent Ng, and Xiaojun Wan, editors, Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, EMNLP-IJCNLP 2019, Hong Kong, China, November 3-7, 2019, pages 55–65. Association for Computational Linguistics, 2019.
|
| 241 |
+
[7] Angela Fan, Mike Lewis, and Yann N. Dauphin. Hierarchical neural story generation. In Iryna Gurevych and Yusuke Miyao, editors, Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, ACL 2018, Melbourne, Australia, July 15-20, 2018, Volume 1: Long Papers, pages 889–898. Association for Computational Linguistics, 2018.
|
| 242 |
+
[8] J.L. Fleiss et al. Measuring nominal scale agreement among many raters. Psychological Bulletin, 76(5):378–382, 1971.
|
| 243 |
+
[9] Tianyu Gao, Xingcheng Yao, and Danqi Chen. Simcse: Simple contrastive learning of sentence embeddings. In Marie-Francine Moens, Xuanjing Huang, Lucia Specia, and Scott Wen-tau Yih, editors, Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, EMNLP 2021, Virtual Event / Punta Cana, Dominican Republic, 7-11 November, 2021, pages 6894–6910. Association for Computational Linguistics, 2021.
|
| 244 |
+
[10] Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020.
|
| 245 |
+
[11] Urvashi Khandelwal, Omer Levy, Dan Jurafsky, Luke Zettlemoyer, and Mike Lewis. Generalization through memorization: Nearest neighbor language models. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020.
|
| 246 |
+
|
| 247 |
+
[12] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Yoshua Bengio and Yann LeCun, editors, 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015.
|
| 248 |
+
|
| 249 |
+
[13] Jiwei Li, Michel Galley, Chris Brockett, Jianfeng Gao, and Bill Dolan. A diversity-promoting objective function for neural conversation models. In Kevin Knight, Ani Nenkova, and Owen Rambow, editors, NAACL HLT 2016, The 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, San Diego California, USA, June 12-17, 2016, pages 110–119. The Association for Computational Linguistics, 2016.
|
| 250 |
+
[14] Piji Li, Haisong Zhang, Xiaojiang Liu, and Shuming Shi. Rigid formats controlled text generation. In Dan Jurafsky, Joyce Chai, Natalie Schluter, and Joel R. Tetreault, editors, Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pages 742–751. Association for Computational Linguistics, 2020.
|
| 251 |
+
[15] Yanran Li, Hui Su, Xiaoyu Shen, Wenjie Li, Ziqiang Cao, and Shuzi Niu. Dailydialog: A manually labelled multi-turn dialogue dataset. In Greg Kondrak and Taro Watanabe, editors, Proceedings of the Eighth International Joint Conference on Natural Language Processing, IJCNLP 2017, Taipei, Taiwan, November 27 - December 1, 2017 - Volume 1: Long Papers, pages 986–995. Asian Federation of Natural Language Processing, 2017.
|
| 252 |
+
[16] Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net, 2017.
|
| 253 |
+
[17] Krishna Pillutla, Swabha Swayamdipta, Rowan Zellers, John Thickstun, Sean Welleck, Yejin Choi, and Zaid Harchaoui. MAUVE: Measuring the gap between neural text and human text using divergence frontiers. In A. Beygelzimer, Y. Dauphin, P. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems, 2021.
|
| 254 |
+
[18] Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019.
|
| 255 |
+
[19] Yixuan Su and Nigel Collier. Contrastive search is what you need for neural text generation. arXiv preprint arXiv:2210.14140, 2022.
|
| 256 |
+
[20] Yixuan Su, Tian Lan, Yahui Liu, Fangyu Liu, Dani Yogatama, Yan Wang, Lingpeng Kong, and Nigel Collier. Language models can see: Plugging visual controls in text generation. arXiv preprint arXiv:2205.02655, 2022.
|
| 257 |
+
[21] Yixuan Su, Fangyu Liu, Zaiqiao Meng, Tian Lan, Lei Shu, Ehsan Shareghi, and Nigel Collier. Tacl: Improving BERT pre-training with token-aware contrastive learning. CoRR, abs/2111.04198, 2021.
|
| 258 |
+
[22] Yixuan Su, Yan Wang, Deng Cai, Simon Baker, Anna Korhonen, and Nigel Collier. PROTOTYPE-TO-STYLE: dialogue generation with style-aware editing on retrieval memory. IEEE ACM Trans. Audio Speech Lang. Process., 29:2152–2161, 2021.
|
| 259 |
+
[23] Yixuan Su and Jialu Xu. An empirical study on contrastive search and contrastive decoding for open-ended text generation. arXiv preprint arXiv:2211.10797, 2022.
|
| 260 |
+
[24] Romal Thoppilan, Daniel De Freitas, Jamie Hall, Noam Shazeer, Apoorv Kulshreshtha, Heng-Tze Cheng, Alicia Jin, Taylor Bos, Leslie Baker, Yu Du, YaGuang Li, Hongrae Lee, Huaixiu Steven Zheng, Amin Ghafouri, Marcelo Menegali, Yanping Huang, Maxim Krikun, Dmitry Lepikhin, James Qin, Dehao Chen, Yuanzhong Xu, Zhifeng Chen, Adam Roberts, Maarten Bosma, Yanqi Zhou, Chung-Ching Chang, Igor Krivokon, Will Rusch, Marc Pickett, Kathleen S. Meier-Hellstern, Meredith Ringel Morris, Tulsee Doshi, Renelito Delos Santos, Toju Duke, Johnny Soraker, Ben Zevenbergen, Vinodkumar Prabhakaran, Mark Diaz, Ben Hutchinson, Kristen Olson, Alejandra Molina, Erin Hoffman-John, Josh Lee, Lora Aroyo, Ravi Rajakumar, Alena Butryna, Matthew Lamm, Viktoriya Kuzmina, Joe Fenton, Aaron Cohen, Rachel Bernstein, Ray Kurzweil, Blaise Aguera-Arcas, Claire Cui, Marian Croak, Ed Chi, and Quoc Le. Lamda: Language models for dialog applications. CoRR, abs/2201.08239, 2022.
|
| 261 |
+
[25] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett, editors, Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 5998–6008, 2017.
|
| 262 |
+
[26] Yida Wang, Pei Ke, Yinhe Zheng, Kaili Huang, Yong Jiang, Xiaoyan Zhu, and Minlie Huang. A large-scale chinese short-text conversation dataset. In Xiaodan Zhu, Min Zhang, Yu Hong, and Ruifang He, editors, Natural Language Processing and Chinese Computing - 9th CCF International Conference, NLPCC 2020, Zhengzhou, China, October 14-18, 2020, Proceedings, Part I, volume 12430 of Lecture Notes in Computer Science, pages 91–103. Springer, 2020.
|
| 263 |
+
[27] Sean Welleck, Ilia Kulikov, Stephen Roller, Emily Dinan, Kyunghyun Cho, and Jason Weston. Neural text generation with unlikelihood training. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020.
|
| 264 |
+
[28] Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, and Jamie Brew. Huggingface’s transformers: State-of-the-art natural language processing. CoRR, abs/1910.03771, 2019.
|
| 265 |
+
[29] Dani Yogatama, Cyprien de Masson d’Autume, and Lingpeng Kong. Adaptive semiparametric language models. Trans. Assoc. Comput. Linguistics, 9:362–373, 2021.
|
| 266 |
+
[30] Yizhe Zhang, Siqi Sun, Michel Galley, Yen-Chun Chen, Chris Brockett, Xiang Gao, Jianfeng Gao, Jingjing Liu, and Bill Dolan. DIALOGPT : Large-scale generative pre-training for conversational response generation. In Asli Celikyilmaz and Tsung-Hsien Wen, editors, Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, ACL 2020, Online, July 5-10, 2020, pages 270–278. Association for Computational Linguistics, 2020.
|
| 267 |
+
[31] Zhe Zhao, Hui Chen, Jinbin Zhang, Xin Zhao, Tao Liu, Wei Lu, Xi Chen, Haotang Deng, Qi Ju, and Xiaoyong Du. UER: an open-source toolkit for pre-training models. In Sebastian Padó and Ruihong Huang, editors, Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, EMNLP-IJCNLP 2019, Hong Kong, China, November 3-7, 2019 - System Demonstrations, pages 241–246. Association for Computational Linguistics, 2019.
|
| 268 |
+
|
| 269 |
+
# Checklist
|
| 270 |
+
|
| 271 |
+
1. For all authors...
|
| 272 |
+
|
| 273 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 274 |
+
(b) Did you describe the limitations of your work? [Yes] See Appendix A.
|
| 275 |
+
(c) Did you discuss any potential negative societal impacts of your work? [N/A]
|
| 276 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 277 |
+
|
| 278 |
+
2. If you are including theoretical results...
|
| 279 |
+
|
| 280 |
+
(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
|
| 281 |
+
|
| 282 |
+
3. If you ran experiments...
|
| 283 |
+
|
| 284 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We provide the code and the instructions to re-implement our results as a supplementary material to this paper.
|
| 285 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] We specify the details in Section $\ S 4$ and $\ S 5$ .
|
| 286 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We did not run multiple times for our experiments due to computational constraints.
|
| 287 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] We describe the computational details in Appendix J.
|
| 288 |
+
|
| 289 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 290 |
+
|
| 291 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] We cite the authors of the datasets and the code of the models in Section $\ S 4$ and $\ S 5$ .
|
| 292 |
+
(b) Did you mention the license of the assets? [N/A] The datasets are publicly available.
|
| 293 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We provide the code and the instructions to re-implement our results as a supplementary material to this paper.
|
| 294 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] The datasets are publicly available.
|
| 295 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] We use the standard datasets, which are well known in literature, and there are no personally identifiable information or offensive content at the best of the community knowledge.
|
| 296 |
+
|
| 297 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 298 |
+
|
| 299 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [Yes] We provide the human evaluation guidelines in Appendix G.
|
| 300 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 301 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [Yes] We provide the details of participant compensation in Appendix G.
|
md/dev/_xwr8gOBeV1/_xwr8gOBeV1.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/cx5ViLfcVq/cx5ViLfcVq.md
ADDED
|
@@ -0,0 +1,577 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Information-Theoretic Analysis of Unsupervised Domain Adaptation
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 This paper uses information-theoretic tools to analyze the generalization error in
|
| 11 |
+
2 unsupervised domain adaptation (UDA). This study presents novel upper bounds
|
| 12 |
+
3 for two notions of generalization errors. The first notion measures the gap between
|
| 13 |
+
4 the population risk in the target domain and that in the source domain, and the
|
| 14 |
+
5 second measures the gap between the population risk in the target domain and the
|
| 15 |
+
6 empirical risk in the source domain. While our bounds for the first kind of error
|
| 16 |
+
7 are in line with the traditional analysis and give similar insights, our bounds on
|
| 17 |
+
8 the second kind of error are algorithm-dependent and also inspire insights into
|
| 18 |
+
9 algorithm designs. Specifically, we present two simple techniques for improving
|
| 19 |
+
10 generalization in UDA and validate them experimentally.
|
| 20 |
+
|
| 21 |
+
# 11 1 Introduction
|
| 22 |
+
|
| 23 |
+
12 This paper focuses on the unsupervised domain adaptation (UDA) task, where the learner is confronted
|
| 24 |
+
13 with a source domain and a target domain and the algorithm is allowed to access to a labeled training
|
| 25 |
+
14 sample from the source domain and an unlabeled training sample from the target domain. The goal is
|
| 26 |
+
15 to find a predictor that performs well on the target domain.
|
| 27 |
+
16 A main obstacle in such a task is the discrepancy between the two domains. Some recent works have
|
| 28 |
+
17 [1–9] proposed various measures to quantify such discrepancy, either for the UDA setting or for the
|
| 29 |
+
18 more general domain generalization tasks, and many learning algorithms are proposed. For example,
|
| 30 |
+
19 most recently, Nguyen et al. [9] uses a (reverse) KL divergence to measure the misalignment of
|
| 31 |
+
20 the distributions of the two domains, and motivated by their generalization bound, they design an
|
| 32 |
+
21 algorithm that penalizes the KL divergence between the marginal distributions of two domains in the
|
| 33 |
+
22 representation space. Despite that this “KL guided domain adaptation” algorithm is demonstrated
|
| 34 |
+
23 to outperform many existing marginal alignment algorithms [10, 11, 6, 12], it is not clear whether
|
| 35 |
+
24 KL-based alignment of marginal distributions is adequate for UDA, and more fundamentally what
|
| 36 |
+
25 role the unlabelled target-domain training sample should play to achieve cross-domain generalization.
|
| 37 |
+
26 Notably, most UDA algorithms are heuristically designed and intuitively justified and most existing
|
| 38 |
+
27 generalization bounds are algorithm-independent. Then there appears significant room for both
|
| 39 |
+
28 deeper theoretical understanding and more principled algorithm design.
|
| 40 |
+
29 In this paper, we analyze the generalization ability of hypotheses and algorithms for UDA tasks using
|
| 41 |
+
30 an information-theoretic framework developed in [13, 14]. The foundation of our bounding technique
|
| 42 |
+
31 is the Donsker-Varadhan representation of KL divergence (see Lemma A.1) with the application of
|
| 43 |
+
32 sub-gaussianity (see Assumption 2). We present novel upper bounds for two notions of generalization
|
| 44 |
+
33 errors. The first notion (“PP generalization error”) measures the gap between the population risk
|
| 45 |
+
34 in the target domain and that in the source domain for a hypothesis, and the second (“expected EP
|
| 46 |
+
35 generalization error”) measures the gap between the population risk in the target domain and the
|
| 47 |
+
36 empirical risk in the source domain for a learning algorithm. The specific contributions of this work
|
| 48 |
+
37 are as follows. We show that the PP generalization error for all hypotheses are uniformly bounded
|
| 49 |
+
38 by a quantity governed by the KL divergence between the two domain distributions, which, under
|
| 50 |
+
39 bounded losses, recovers the the bound in [9]. We then show that such this KL term upper-bounds
|
| 51 |
+
40 some other measures including Total-Variation distance [1], Wasserstein distance [6] and domain
|
| 52 |
+
41 disagreement [7]. Thus, minimizing KL-divergence forces the minimization of other discrepancy
|
| 53 |
+
42 measures as well. This, together with the ease of minimizing KL [9], explains the effectiveness
|
| 54 |
+
43 of the KL-guided alignment approach. For expected EP generalization error, we develop several
|
| 55 |
+
44 algorithm-dependent generalization bounds. These algorithm-dependent bounds further inspire the
|
| 56 |
+
45 design of two new and yet simple strategies that can further boost the performance of the KL guided
|
| 57 |
+
46 marginal alignment algorithms. Experiments are performed on standard benchmarks to verify the
|
| 58 |
+
47 effectiveness of these strategies.
|
| 59 |
+
|
| 60 |
+
# 48 2 Related Work
|
| 61 |
+
|
| 62 |
+
49 Domain Adaptation From a theoretical perspective, many domain adaptation generalization bounds
|
| 63 |
+
50 have been developed [1, 2, 15, 3, 6, 5, 7, 8], and some discrepancy measures are designed to derive
|
| 64 |
+
51 these bounds including the reduction of the total variation [1, 2, 15, 3], Wasserstein distance [6],
|
| 65 |
+
52 domain disagreement [7] and so on. In particular, bounds based on $\cdot$ in [2] are restricted to
|
| 66 |
+
53 a binary classification setting and assume a deterministic labeling function. Furthermore, [2] also
|
| 67 |
+
54 assumes the loss is the $L _ { 1 }$ distance between the predicted label and true label (which is bounded).
|
| 68 |
+
55 Our bounds work for the general supervised learning problems with any labelling mechanism (e.g.,
|
| 69 |
+
56 stochastic labelling), and we do not require the specific choice of the loss (which could be unbounded).
|
| 70 |
+
57 [16] proposed some generalization bounds based on Jensen-Shannon (JS) divergence, which are
|
| 71 |
+
58 related to our Corollary 4.2. Most existing works including [2, 16] that give upper bounds for Err,
|
| 72 |
+
59 while we give upper bounds for its absolute value, $\cdot$ , which also serves as a lower bound for
|
| 73 |
+
60 generalization, highlighting some fundamental difficulty of the UDA learning task (see Corollary 4.1).
|
| 74 |
+
61 For more details about the domain adaptation theory, we refer readers to [17] for a completed
|
| 75 |
+
62 survey. From the algorithmic perspective of the domain adaptation, the most common method is to
|
| 76 |
+
63 align the marginal distribution of representation between the source domain and the target domain,
|
| 77 |
+
64 including using the adversarial training mechanism [10, 6, 8] and aligning the first two moments of
|
| 78 |
+
65 the representation distribution [11]. There are numerous other domain adaptation algorithms, and we
|
| 79 |
+
66 refer readers to [18–21] for recent advances.
|
| 80 |
+
67 Information-Theoretic Generalization Bounds Information-theoretic analysis are usually used
|
| 81 |
+
68 to analyze the expected generalization error of supervised learning, where the training and testing
|
| 82 |
+
69 data come from the same distribution [13, 22, 14, 23–27]. By exploiting the chain rule property of
|
| 83 |
+
70 mutual information, these bounds are successfully applied to characterize the generalization ability of
|
| 84 |
+
71 stochastic gradient based optimization algorithms [28, 24, 26, 29–31]. Recently, this framework has
|
| 85 |
+
72 also been used in the multi task setting including meta-learning [32–35], semi-supervised learning
|
| 86 |
+
73 [36, 37] and some other transfer learning problems [38, 32, 39–41]. In particular, [38, 39] consider a
|
| 87 |
+
74 different transfer learning problem setup with ours. Specifically, their expected generalization error is
|
| 88 |
+
75 the gap between the target population risk and the empirical weighted risk (or the convex combination
|
| 89 |
+
76 of the source empirical risk and the target empirical risk), while our “EP” error is the gap between
|
| 90 |
+
77 the target population risk and the source empirical risk. That is to say, our work studies how to make
|
| 91 |
+
78 use of the unlabelled target data to improve the generalization performance on target domain except
|
| 92 |
+
79 for minimizing the empirical risk of source domain, and their works assume the training objective
|
| 93 |
+
80 function for the target domain data, which could be labelled, has already been known. In addition,
|
| 94 |
+
81 bounds in [38, 39] fail to characterize the dependence between $W$ and $\cdot$ . More precisely, the
|
| 95 |
+
82 algorithm-dependent term in their bounds is $I ( W ; Z _ { i } )$ or $\cdot$ , while our algorithm-dependent
|
| 96 |
+
83 term is $\cdot$ that directly depends on the unlabelled target data (see Theorem C.1 for more
|
| 97 |
+
84 discussion in Appendix).
|
| 98 |
+
|
| 99 |
+
# 3 Preliminary
|
| 100 |
+
|
| 101 |
+
Unless otherwise noted, a random variable will be denoted by a capitalized letter, and its realization denoted by the corresponding lower-case letter. Consider a prediction task with instance space ${ \mathcal { Z } } = { \mathcal { X } } \times { \mathcal { Y } }$ , where $\mathcal { X }$ and $y$ are the input space and the label (or output) space respectively. Let $\mathcal { F }$ be the hypothesis space of interesting, in which each $f \in { \mathcal { F } }$ is a function or predictor mapping $\mathcal { X }$ to $\mathcal { V }$ . We assume that each hypothesis $f \in { \mathcal { F } }$ is parameterized by some weight parameter $w$ in some space $\mathcal { W }$ and may write $f$ as $f _ { w }$ as needed.
|
| 102 |
+
|
| 103 |
+
92 Let $\mu$ and $\mu ^ { \prime }$ be two distributions on $\mathcal { Z }$ , unknown to the learner. Normally, $\mu$ and $\mu ^ { \prime }$ are not the
|
| 104 |
+
93 same and we consider $\mu$ characterizing the source domain and $\mu ^ { \prime }$ characterizing the target domain.
|
| 105 |
+
94 For the ease of notation, we may also write $\mu$ as $P _ { Z }$ or $P _ { X Y }$ and $\mu ^ { \prime }$ as $P _ { Z ^ { \prime } }$ or $P _ { X ^ { \prime } Y ^ { \prime } }$ , which also
|
| 106 |
+
95 defines random variables $Z = ( X , Y )$ and $Z ^ { \prime } = ( X ^ { \prime } , Y ^ { \prime } )$ . Let $S = \{ Z _ { i } \} _ { i = 1 } ^ { n } \sim \mu ^ { \otimes n }$ be a labeled
|
| 107 |
+
96 source-domain training sample and $S _ { X ^ { \prime } } ^ { \prime } = \{ X _ { j } ^ { \prime } \} _ { j = 1 } ^ { m } \sim P _ { X ^ { \prime } } ^ { \otimes m }$ be an unlabelled target-domain training
|
| 108 |
+
97 sample. The objective of UDA is to design an algorithm $\mathcal { A }$ takes $S$ and $S _ { X ^ { \prime } } ^ { \prime }$ as the input and outputs
|
| 109 |
+
98 a weight $W \in { \mathcal { W } }$ , giving rise to a predictor $f _ { W } \in \mathcal { F }$ that “works well” on the target domain. Note
|
| 110 |
+
99 that the algorithm $\mathcal { A }$ is in general characterized by a conditional distribution $P _ { W | S , S _ { X ^ { \prime } } ^ { \prime } }$ .
|
| 111 |
+
100 To be precise on the performance metric of UDA, let $\ell : \mathcal { V } \times \mathcal { V } \to \mathbb { R } _ { 0 } ^ { + }$ be a loss function. Then for
|
| 112 |
+
101 each weight configuration $w \in \mathcal { W }$ , its population risk in the target domain is defined as
|
| 113 |
+
|
| 114 |
+
$$
|
| 115 |
+
R _ { \mu ^ { \prime } } ( w ) \triangleq \mathbb { E } _ { Z ^ { \prime } } [ \ell ( f _ { w } ( X ^ { \prime } ) , Y ^ { \prime } ) ] .
|
| 116 |
+
$$
|
| 117 |
+
|
| 118 |
+
and a good UDA algorithm hopes to return a weight 102 $w$ that minimizes this risk. Since $\mu ^ { \prime }$ is unknown, 103 this risk can not be measured or minimized. On the other hand, one does have access to the empirical 104 risk in the source domain, as is defined by
|
| 119 |
+
|
| 120 |
+
$$
|
| 121 |
+
R _ { S } ( w ) \triangleq { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } \ell ( f _ { w } ( X _ { i } ) , Y _ { i } ) .
|
| 122 |
+
$$
|
| 123 |
+
|
| 124 |
+
105 Then the notion generalization error in this setting measures how well the hypothesis returned from
|
| 125 |
+
106 the algorithm generalize from the source-domain training sample to the target-domain unknown
|
| 126 |
+
107 distribution $\mu ^ { \prime }$ . Taking into account the stochastic nature of the algorithm $\mathcal { A }$ , a natural notion of
|
| 127 |
+
108 generalization error for UDA can be defined by
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
\begin{array} { r } { \mathrm { E r r } \triangleq \mathbb { E } _ { W , S } \left[ R _ { \mu ^ { \prime } } ( W ) - R _ { S } ( W ) \right] = \mathbb { E } _ { W , S , S _ { X ^ { \prime } } ^ { \prime } } \left[ R _ { \mu ^ { \prime } } ( W ) - R _ { S } ( W ) \right] , } \end{array}
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
109 110 e first equation is taken over the joint distribution ofe second equation is taken over the joint distribu. $( W , S ) \sim P _ { W | S } { \times } \mu ^ { \otimes n }$ $( W , S , S _ { X ^ { \prime } } ^ { \prime } ) \sim$ $P _ { W | S , S _ { X ^ { \prime } } ^ { \prime } } \times \mu ^ { \otimes n } \times P _ { X ^ { \prime } } ^ { \otimes m }$
|
| 134 |
+
|
| 135 |
+
112 Note that there is another notion of generalization error, more traditional in the domain adaptation
|
| 136 |
+
113 literature, namely, the gap between the population risk in the target domain and that in the source
|
| 137 |
+
114 domain, as us define by
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
{ \widetilde \mathrm { E r r } } ( w ) \triangleq R _ { \mu ^ { \prime } } ( w ) - R _ { \mu } ( w ) .
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+
115 where $R _ { \mu } ( w ) \triangleq \mathbb { E } _ { Z } [ \ell ( f _ { w } ( X ) , Y ) ]$ . It is apparent that $\widetilde { \mathrm { E r r } } ( w )$ and $\mathrm { E r r }$ are related by the following
|
| 144 |
+
116 triangle inequality:
|
| 145 |
+
|
| 146 |
+
$$
|
| 147 |
+
| R _ { \mu ^ { \prime } } ( w ) - R _ { S } ( w ) | \leq | R _ { \mu ^ { \prime } } ( w ) - R _ { \mu } ( w ) | + | R _ { \mu } ( w ) - R _ { S } ( w ) | .
|
| 148 |
+
$$
|
| 149 |
+
|
| 150 |
+
117 where the second term on the right hand side is the standard generalization error in the source domain,
|
| 151 |
+
118 which can be bounded by classical learning-theoretic tools, e.g., Rademacher complexity [42]. Thus
|
| 152 |
+
119 bounding $\widetilde { \mathrm { E r r } } ( w )$ helps bounding Err.
|
| 153 |
+
120 This paper studies both notions of generalization error for UDA. Specifically, starting from Section 5,
|
| 154 |
+
121 we will mainly use information-theoretic tools to bound $\mathrm { E r r }$ directly, without going through $\widetilde { \mathrm { E r r } } ( w )$ .
|
| 155 |
+
122 For the ease of reference, we refer to $\widetilde { \mathrm { E r r } } ( w )$ as the population-to-population $( P P )$ generalization
|
| 156 |
+
123 error for $w$ and $\mathrm { E r r }$ as the expected empirical-to-population $( E P )$ generalization error for the
|
| 157 |
+
124 algorithm $\mathcal { A }$ .
|
| 158 |
+
25 Some definitions are prerequisite in this paper, we now present some uncommon notions and defer
|
| 159 |
+
26 the common notions to Appendix.
|
| 160 |
+
|
| 161 |
+
127 Definition 1 (Disintegrated Mutual Information). Let $X$ , $Y$ and $Z$ be random variables and $z$ be a realization of 128 $Z$ . The disintegrated mutual information of $X$ and $Y$ given $Z = z$ is $I ^ { z } ( X ; Y ) \triangleq$ 129 $\mathrm { D } _ { \mathrm { K L } } ( P _ { X , Y | Z = z } | | P _ { X | Z = z } P _ { Y | Z = z } )$ .
|
| 162 |
+
|
| 163 |
+
Note that the conditional mutual information $I ( X ; Y | Z ) = \mathbb { E } _ { Z } I ^ { Z } ( X ; Y )$ .
|
| 164 |
+
|
| 165 |
+
131 Definition 2 (Lautum Information [43]). Define the lautum information between $X$ and $Y$ as
|
| 166 |
+
132 $L ( X ; Y ) \triangleq \operatorname { D \mathrm { { K L } } } ( P _ { X } P _ { Y } | | P _ { X Y } )$ .
|
| 167 |
+
|
| 168 |
+
# 133 4 Upper Bounds for PP Generalization Error
|
| 169 |
+
|
| 170 |
+
134 In this section, we present some upper bounds for $\widetilde { \mathrm { E r r } } ( w )$ . The key techniques used in developing
|
| 171 |
+
135 these bounds are the information-theoretic tools in the style of Lemma A.1. All these bounds adopt
|
| 172 |
+
136 certain KL divergence as a key quantity measuring the discrepancy between the source and target
|
| 173 |
+
137 domain. Notably, some previously established bounds are recovered under a different assumption of
|
| 174 |
+
138 the loss function. Additionally we demonstrate that under certain conditions, the KL-based bound is
|
| 175 |
+
139 an upper bound of many other discrepancy measures and hence minimizing the KL divergence forces
|
| 176 |
+
140 the minimization of these other measures.
|
| 177 |
+
|
| 178 |
+
41 We first list some common assumptions on the loss function, which we consider in this paper.
|
| 179 |
+
|
| 180 |
+
142 Assumption 1 (Boundedness). $\ell ( \cdot , \cdot )$ is bounded in $[ 0 , M ]$ .
|
| 181 |
+
|
| 182 |
+
Assumption 2 (Subgaussianity). 43 $\ell ( f _ { w } ( X ) , Y )$ is $R$ -subgaussian1 under $\mu$ for any $w \in \mathcal { W }$ .
|
| 183 |
+
|
| 184 |
+
44 Remark 4.1. Note that Assumption 1 implies Assumption 2, i.e., if $\because \ell ( f _ { w } ( X ) , Y )$ is bounded in $[ 0 , M ]$ ,
|
| 185 |
+
45 then it is also $M / 2$ -subgaussian. Thus, Assumption 2 is weaker than Assumption $^ { l }$ .
|
| 186 |
+
46 Assumption 3 (Lipschitzness). $\ell ( f _ { w } ( X ) , Y )$ is $\beta$ -Lipschitz continues in $\mathcal { Z }$ for any $w \in \mathcal { W }$ , i.e.,
|
| 187 |
+
47 $| \ell ( f _ { w } ( x _ { 1 } ) , y _ { 1 } ) - \ell ( f _ { w } ( x _ { 2 } ) , y _ { 2 } ) | \leq \beta d ( z _ { 1 } , z _ { 2 } )$ .
|
| 188 |
+
|
| 189 |
+
Remark 4.2. Note that Assumption $^ { l }$ implies Assumption $^ 3$ when $d$ is a discrete metric, i.e., if $\ell ( f _ { w } ( X ) , Y )$ is bounded in $[ 0 , M ]$ , then it is also $M$ -Lipschitz under the discrete metric.
|
| 190 |
+
|
| 191 |
+
Assumption 4 (Triangle). $\ell ( \cdot , \cdot )$ satisfies the following the triangle inequality: $\ell ( y _ { 1 } , y _ { 2 } ) \leq \ell ( y _ { 1 } , y _ { 3 } ) +$ $\ell ( y _ { 3 } , y _ { 2 } )$ for any $y _ { 1 } , y _ { 2 } , y _ { 3 } \in \mathcal { V }$ .
|
| 192 |
+
|
| 193 |
+
# 4.1 Generalization Bounds via the Subgaussian Condition
|
| 194 |
+
|
| 195 |
+
The following generalization bound is established by combining Lemma A.1 and Assumption 2, a technique developed in [14] for information-theoretic analysis of generalization.
|
| 196 |
+
|
| 197 |
+
Theorem 4.1. If Assumption 2 holds, then for any 55 $w \in \mathcal { W }$ , $\begin{array} { r } { \left| \widetilde { \mathrm { E r r } } ( w ) \right| \le \sqrt { 2 R ^ { 2 } \mathrm { D } _ { \mathrm { K L } } ( \mu ^ { \prime } | | \mu ) } . } \end{array}$ .
|
| 198 |
+
|
| 199 |
+
156 We note that this result on one hand can be turned into a generalization upper bound providing
|
| 200 |
+
157 guidance to algorithm design, and on the other hand provides a lower bound of the generalization
|
| 201 |
+
158 error, which highlights some fundamental difficulty of the learning task. To illustrate this, we present
|
| 202 |
+
159 an corollary of Theorem 4.1, while noting that similar development can also be applied to other
|
| 203 |
+
160 bounds presented later in this paper.
|
| 204 |
+
161 To that end, suppose that each $f _ { w }$ in the model family is expressed as the composition $\cdot$ , where $h$
|
| 205 |
+
162 is a function mapping $\mathcal { X }$ to a representation space $\tau$ and $\cdot$ is a function mapping $^ { \prime }$ to $\cdot$ . For any
|
| 206 |
+
163 given $h : \mathcal { X } \mathcal { T }$ , denote by $\cdot$ the distribution on $\tau \times \mathcal { V }$ obtained by pushing over $\cdot$ via $\cdot$ , that is,
|
| 207 |
+
164 $\begin{array} { r } { \mu _ { h } ( t , y ) = \int \delta ( t - h ( x ) ) d \mu ( x , y ) } \end{array}$ , where $\delta$ is the Dirac measure on $\cdot$ . Similarly, let $\cdot$ denote the
|
| 208 |
+
165 distribution on $\tau \times \mathcal { V }$ obtained by pushing over $\mu ^ { \prime }$ via $h$ .
|
| 209 |
+
|
| 210 |
+
166 Corollary 4.1. Suppose that $f _ { w } = g \circ h$ and that Assumption 2 holds. then for any $\cdot$ ,
|
| 211 |
+
|
| 212 |
+
$$
|
| 213 |
+
R _ { \mu } ( w ) - \sqrt { 2 R ^ { 2 } \mathrm { D } _ { \mathrm { K L } } ( \mu ^ { \prime } | | \mu ) } \le R _ { \mu ^ { \prime } } ( w ) \le R _ { \mu } ( w ) + \sqrt { 2 R ^ { 2 } \mathrm { D } _ { \mathrm { K L } } ( \mu _ { \mathrm { h } } ^ { \prime } | | \mu _ { \mathrm { h } } ) } .
|
| 214 |
+
$$
|
| 215 |
+
|
| 216 |
+
167 In this result, the lower bound of $R _ { \mu ^ { \prime } } ( w )$ indicates a fundamental difficulty in UDA learning in that,
|
| 217 |
+
168 using the same predictor mapping $\cdot$ , there is no way for the population risk in the target domain to
|
| 218 |
+
169 be lower than that of the source domain less a constant which depends only on the domain difference.
|
| 219 |
+
170 On the other hand, the upper bound suggests that it is possible to squeeze the gap between the two
|
| 220 |
+
171 population risks by choosing an appropriate representation map $h$ - evidently such a map should be
|
| 221 |
+
172 attempting to align $\cdot$ with $\mu _ { h }$ or to align their respective proxies.
|
| 222 |
+
|
| 223 |
+
173 It is also remarkable that under Assumption 1 and due to Remark 4.1, Theorem 4.1 implies
|
| 224 |
+
|
| 225 |
+
$$
|
| 226 |
+
\Bigl | \widetilde { \mathrm { E r r } } ( w ) \Bigr | \le \frac { M } { \sqrt { 2 } } \sqrt { \mathrm { D } _ { \mathrm { K L } } ( P _ { X ^ { \prime } } | | P _ { X } ) + \mathrm { D } _ { \mathrm { K L } } ( P _ { Y ^ { \prime } | X ^ { \prime } } | | P _ { Y | X } ) } .
|
| 227 |
+
$$
|
| 228 |
+
|
| 229 |
+
174 Similarly applying this result in the representation space $\tau$ , we see that Eq. (3) recovers the bound in
|
| 230 |
+
175 Proposition 1 of [9]. Notice that unlike [9], Theorem 4.1 ( or Eq. (3)) does not require the loss to be
|
| 231 |
+
176 the cross entropy loss.
|
| 232 |
+
177 Theorem 4.1 and [9] both use the KL divergence from source domain to target domain, $\mathrm { D } _ { \mathrm { K L } } ( \mu ^ { \prime } | | \mu )$ ,
|
| 233 |
+
178 and in fact, $\left| \widetilde { \mathrm { E r r } } ( w ) \right|$ can also be upper bounded by $\mathrm { D } _ { \mathrm { K L } } ( \mu | | \mu ^ { \prime } )$ . This can be done by invoking the
|
| 234 |
+
179 subgaussianality of $\overset { \vartriangle } { \boldsymbol { \ell } } ( f _ { w } ( \boldsymbol { X } ^ { \prime } ) , \boldsymbol { Y } ^ { \prime } )$ (rather than $\ell ( f _ { w } ( X ) , Y ) )$ ; for bounded loss, the subgaussianality
|
| 235 |
+
180 of $\ell ( f _ { w } ( X ^ { \prime } ) , Y ^ { \prime } )$ is also satisfied. Then we obtain the following corollary.
|
| 236 |
+
|
| 237 |
+
Corollary 4.2. If Assumption 81 $^ { l }$ holds, $\begin{array} { r l r } { \Big | \widetilde { \mathrm { E r r } } ( w ) \Big | } & { \le } & { \frac { M } { \sqrt { 2 } } \sqrt { \operatorname* { m i n } \{ \mathrm { D } _ { \mathrm { K L } } ( \mu | | \mu ^ { \prime } ) , \mathrm { D } _ { \mathrm { K L } } ( \mu ^ { \prime } | | \mu ) \} } \le } \end{array}$ 82 $\begin{array} { r } { \frac { M } { 2 } \sqrt { \mathrm { D } _ { \mathrm { K L } } ( \mu | | \mu ^ { \prime } ) + \mathrm { D } _ { \mathrm { K L } } ( \mu ^ { \prime } | | \mu ) } } \end{array}$ .
|
| 238 |
+
|
| 239 |
+
183 Remark 4.3. In the second inequality of Corollary 4.2, $\mathrm { D } _ { \mathrm { K L } } ( \mu | | \mu ^ { \prime } ) + \mathrm { D } _ { \mathrm { K L } } ( \mu ^ { \prime } | | \mu )$ is usually called
|
| 240 |
+
184 the symmetrized $K L$ divergence (or Jeffrey’s divergence $I 4 4 J ,$ ), and the regularization term used in
|
| 241 |
+
185 [9] is indeed the symmetrized $K L$ divergence between the distributions of the source and target
|
| 242 |
+
186 representations. Notice that bounds in [16] are based on the $J S$ divergence. Since there is a sharp
|
| 243 |
+
187 upper bound of the $\cdot$ divergence based on Jeffrey’s divergence $[ 4 5 ] ,$ minimizing Jeffrey’s divergence
|
| 244 |
+
188 (in the representation space) will simultaneously penalize the JS divergence.
|
| 245 |
+
189 In UDA, since $\cdot$ is completely unavailable to the algorithm $\mathcal { A }$ , it is impossible to minimize the
|
| 246 |
+
190 misalignment of conditional distributions, i.e. $\_$ , without any additional infor
|
| 247 |
+
191 mation. A common method is to assign pseudo labels to target data. However, it may also cause
|
| 248 |
+
192 some additional issues. For concreteness, suppose the trained model $\cdot$ can well approximate the
|
| 249 |
+
193 real mapping between $X$ and $\cdot$ on source domain (i.e. $Q _ { Y | T } = P _ { Y | T } ,$ ), which is usually the training
|
| 250 |
+
194 objective. Let $\hat { Y ^ { \prime } }$ be the pseudo label of $T ^ { \prime }$ generated by the trained model, i.e., $Q _ { \hat { Y ^ { \prime } } | T ^ { \prime } } = Q _ { Y | T } .$ Let
|
| 251 |
+
195 $Q _ { T ^ { \prime } , \hat { Y ^ { \prime } } } = P _ { T ^ { \prime } } Q _ { \hat { Y ^ { \prime } } | T ^ { \prime } }$ , then the following holds,
|
| 252 |
+
|
| 253 |
+
$$
|
| 254 |
+
\begin{array} { r l } & { \mathbb { D } _ { \mathrm { K L } } ^ { \nu , \nu } ( P _ { T ^ { \prime } , Y ^ { \prime } } | | P _ { T , Y } ) = \mathbb { E } _ { P _ { T ^ { \prime } , Y ^ { \prime } } } \log \frac { P _ { T ^ { \prime } , Y ^ { \prime } } Q _ { T ^ { \prime } , Y ^ { \prime } } } { Q _ { T ^ { \prime } , Y ^ { \prime } } P _ { T , Y } } = \mathrm { D } _ { \mathrm { K L } } ( P _ { T ^ { \prime } } | | P _ { T } ) + \mathrm { D } _ { \mathrm { K L } } ( P _ { Y ^ { \prime } | T ^ { \prime } } | | Q _ { Y ^ { \prime } | T ^ { \prime } } ) . } \end{array}
|
| 255 |
+
$$
|
| 256 |
+
|
| 257 |
+
196 For a specific $\cdot$ , if $-$ and $P ( \hat { Y ^ { \prime } } = y ^ { \prime } | T ^ { \prime } = t ^ { \prime } ) = 0$ , then the second term
|
| 258 |
+
197 in RHS of Eq. (4), $-$ . In this case, even the marginal distributions are
|
| 259 |
+
198 perfectly aligned, the overall value of the upper bound is large. Thus, incorrect pseudo labels may
|
| 260 |
+
199 even have negative impact on the target domain performance, and we hope two supports, $\cdot$
|
| 261 |
+
200 and $\cdot$ , could largely overlap with each other for every target data.
|
| 262 |
+
201 Indeed, the misalignment of the conditional distributions appears to be the main difficulty of UDA
|
| 263 |
+
202 [1, 8]. The next corollary suggests that this difficulty may be alleviated when the loss function satisfies
|
| 264 |
+
203 the triangle property, namely, Assumption 4. It can be verified that this assumption is satisfied by the
|
| 265 |
+
204 0-1 loss and square error loss; this assumption has also been considered in previous works [3, 6].
|
| 266 |
+
|
| 267 |
+
Theorem 4.2. If Assumption 4 holds and let $\ell ( f _ { w ^ { \prime } } ( X ) , f _ { w } ( X ) )$ be $R$ -subgaussian for any $w , w ^ { \prime } \in \mathcal { W }$ Then for any $w$ , $\widetilde { \mathrm { E r r } } ( w ) \leq \sqrt { 2 R ^ { 2 } \mathrm { D } _ { \mathrm { K L } } ( P _ { X ^ { \prime } } | | P _ { X } ) } + \lambda ^ { * }$ , where $\begin{array} { r } { \lambda ^ { * } = \operatorname* { m i n } _ { w \in \mathcal { W } } R _ { \mu ^ { \prime } } ( w ) + R _ { \mu } ( w ) . } \end{array}$ .
|
| 268 |
+
|
| 269 |
+
207 In this theorem, $\lambda ^ { * }$ measures the possibility of whether the domain adaptation algorithm will succeed
|
| 270 |
+
208 under the oracle knowledge of $\mu$ and $\mu ^ { \prime }$ . In particular, if the hypothesis space is large enough,
|
| 271 |
+
209 the minimizer $w ^ { * }$ for the “joint population risk” $R _ { \mu ^ { \prime } } ( w ) + R _ { \mu } ( \bar { w } )$ may give rise to $R _ { \mu ^ { \prime } } ( w ^ { \ast } ) =$
|
| 272 |
+
210 $R _ { \mu } ( w ^ { * } ) = 0$ . then we’re likely to generalize well on the target domain. Then the KL divergence
|
| 273 |
+
211 $\mathrm { D } _ { K L } ( P _ { X ^ { \prime } } | | P _ { X } )$ between the two $\mathcal { X }$ -marginals alone bounds the PP generalization error uniformly
|
| 274 |
+
212 for all $w \in \mathcal W$ .
|
| 275 |
+
213 This theorem motivates the strategy of penalizing $\mathrm { D } _ { K L } ( P _ { T ^ { \prime } } | | P _ { T } )$ in the representation space to
|
| 276 |
+
214 achieve better a generalization error. The next theorem suggests that such an approach also penalizes
|
| 277 |
+
215 other notions of domain discrepancy, for example, domain disagreement defined in [7, Definition 1.]
|
| 278 |
+
216 and serving as a key quantity in the PAC-Bayes type of domain adaptation generalization bounds [7]:
|
| 279 |
+
|
| 280 |
+
$\begin{array} { r } { \mathrm { d i s } ( P _ { X } , P _ { X ^ { \prime } } ) \triangleq | \mathbb { E } _ { W , W ^ { \prime } , X ^ { \prime } } \left[ \ell ( f _ { W } ( X ^ { \prime } ) , f _ { W ^ { \prime } } ( X ^ { \prime } ) ) \right] - \mathbb { E } _ { W , W ^ { \prime } , X } \left[ \ell ( f _ { W } ( X ) , f _ { W ^ { \prime } } ( X ) ) \right] | . } \end{array}$ . (5) Theorem 4.3. If $\ell ( f _ { w ^ { \prime } } ( X ) , f _ { w } ( X ) )$ is $R$ -subgaussian for any $w , w ^ { \prime } \in \mathcal { H }$ , then $\mathrm { d i s } ( P _ { X } , P _ { X ^ { \prime } } ) \leq$ $\sqrt { 2 R ^ { 2 } \mathrm { D } _ { \mathrm { K L } } ( P _ { X ^ { \prime } } | | P _ { X } ) }$ .
|
| 281 |
+
|
| 282 |
+
Note that unlike [7], here we do not require the loss function to be the 0-1 loss.
|
| 283 |
+
|
| 284 |
+
# 4.2 Generalization Bounds via the Lipschitz Condition
|
| 285 |
+
|
| 286 |
+
221 Wasserstein distance based generalization bound are often directly connected to, or even included
|
| 287 |
+
222 in, the information-theoretic bounds [46, 27]. We now present such a bound for UDA under the
|
| 288 |
+
223 Lipschitz continuity assumption of the loss function.
|
| 289 |
+
|
| 290 |
+
Theorem 4.4. If Assumption 3 holds, then224 $\left| \widetilde { \mathrm { E r r } } ( w ) \right| \le \beta \mathbb { W } ( \mu ^ { \prime } , \mu )$
|
| 291 |
+
|
| 292 |
+
225 Note that Theorem 4.4 can be related to the $\mathrm { K L }$ divergence based bounds in the previous section
|
| 293 |
+
226 when the Wasserstein distance is defined with respect to the discrete metric $d$ . In this case, if the loss
|
| 294 |
+
227 function is bounded, it is also Liptschitz continuous, and hence Theorem 4.4 applies. On the other
|
| 295 |
+
228 hand, Wasserstein distance is equivalent to the total variation distance [1, 2, 15, 3], while the latter is
|
| 296 |
+
229 connected to the KL divergence via Pinsker’s inequality [47, Theorem 6.5] and the Bretagnolle-Huber
|
| 297 |
+
230 inequality [48, Lemma 2.1]. Thus we arrive at the following result.
|
| 298 |
+
|
| 299 |
+
231 Corollary 4.3. If Assumption 1 holds holds and let d be the discrete metric, then
|
| 300 |
+
|
| 301 |
+
$$
|
| 302 |
+
\left| \widetilde { \mathrm { E r r } } ( w ) \right| \leq M \mathrm { T V } ( \mu ^ { \prime } , \mu ) \leq M \sqrt { \operatorname* { m i n } \left\{ \frac { 1 } { 2 } \mathrm { D } _ { \mathrm { K L } } ( \mu ^ { \prime } | | \mu ) , 1 - e ^ { - \mathrm { D } _ { \mathrm { K L } } ( \mu ^ { \prime } | | \mu ) } \right\} } .
|
| 303 |
+
$$
|
| 304 |
+
|
| 305 |
+
32 The bound in Corollary 4.3 can be immediately verified to be tighter than the bound in Eq. (3).
|
| 306 |
+
|
| 307 |
+
Parallel to Theorem 4.2, if the loss function satisfies the triangle property, we may establish another bound below, which recovers a similar result in [6, Theorem 1.].
|
| 308 |
+
|
| 309 |
+
Theorem 4.5. If Assumption 4 holds and $\ell ( f _ { w } ( X ) , f _ { w ^ { \prime } } ( X ) )$ is $\beta$ -Lipschitz in $\mathcal { X }$ for any $w , w ^ { \prime } \in \mathcal { W }$ , then for any $w \in \mathcal W$ , $\widetilde { \mathrm { E r r } } ( w ) \leq L \mathbb { W } ( P _ { X ^ { \prime } } , P _ { X } ) + \lambda ^ { * }$ , where $\begin{array} { r } { \lambda ^ { * } = \operatorname* { m i n } _ { w \in \mathcal { W } } R _ { \mu ^ { \prime } } ( w ) + R _ { \mu } ( w ) } \end{array}$ .
|
| 310 |
+
|
| 311 |
+
Unlike the bound in [6], we do not require the classification tasks to be binary in Theorem 4.5, and the loss does not need to be the $L _ { 1 }$ distance.
|
| 312 |
+
|
| 313 |
+
This section may convey the following message. Since the KL divergence based bounds upperbounds those based on other measures of domain differences, (e.g. total variation distance, domain discrepancy etc), if we penalize the KL divergence, we will also penalize those other measures. This is practically advantageous since it is usually easier and more stable to minimize the KL divergence[9].
|
| 314 |
+
|
| 315 |
+
# 43 5 Upper Bounds for Expected EP Generalization Error and Applications
|
| 316 |
+
|
| 317 |
+
There are two limitations in the bounds on the PP generalization error developed in the previous section and in the traditional analysis of domain adaptation. First, such bounds are independent of $w$ and hence algorithm-independent. Second, although these bounds may inspire strategies to exploit the unlabelled target sample, e.g., aligning its marginal distribution with that of the source sample in the representation space, they only provide very limited knowledge on the role that the unlabelled target sample plays in the algorithm. We now derive upper bounds for the EP generalization error, which better utilize the dependence of the algorithm output on the unlabelled target data. Applications of these bounds in designing the learning algorithms are also presented.
|
| 318 |
+
|
| 319 |
+
# 5.1 Bounds
|
| 320 |
+
|
| 321 |
+
Theorem 5.1. Assume 253 $\ell ( f _ { w } ( X ^ { \prime } ) , Y ^ { \prime } )$ is $R$ -subgaussian under $\mu ^ { \prime }$ for any $w \in \mathcal { W }$ . Then
|
| 322 |
+
|
| 323 |
+
$$
|
| 324 |
+
| \mathrm { E r r } | \leq \frac { 1 } { n m } \sum _ { j = 1 } ^ { m } \sum _ { i = 1 } ^ { n } \mathbb { E } _ { X _ { j } ^ { \prime } } \sqrt { 2 R ^ { 2 } I ^ { X _ { j } ^ { \prime } } ( W ; Z _ { i } ) } + \sqrt { 2 R ^ { 2 } \mathrm { D } _ { \mathrm { K L } } ( \mu | | \mu ^ { \prime } ) } .
|
| 325 |
+
$$
|
| 326 |
+
|
| 327 |
+
255 Remark 5.1. Note that the unlabelled target data plays a role in the first term of the bound. Indeed,
|
| 328 |
+
256 more source and target data will reduce the first term of the bound. Specifically, moving the
|
| 329 |
+
257 expectation inside the square root function by Jensen’s inequality and since $Z _ { i }$ ⊥⊥ $\cdot$ , the equations
|
| 330 |
+
258 $I ( W ; Z _ { i } | X _ { j } ^ { \prime } ) = I ( W ; Z _ { i } | X _ { j } ^ { \prime } ) + I ( Z _ { i } ; X _ { j } ^ { \prime } ) = I ( W ; Z _ { i } ) + I ( X _ { j } ^ { \prime } ; Z _ { i } | W )$ hold by the chain rule. The
|
| 331 |
+
259 term $\cdot$ will vanish as $n \infty$ and the term $\cdot$ will also vanish as $\_$ .
|
| 332 |
+
260 It is also worth mentioning that, from a practical perspective, the number of samples may have
|
| 333 |
+
261 different impact on the different algorithms. For example, the second term (KL divergence) in
|
| 334 |
+
262 our Theorem 5.1 can not be computed in the original space and we can only estimate it in the
|
| 335 |
+
263 representation space. On the one hand, it seems that having more data will make the approximation
|
| 336 |
+
264 (of KL between marginal distributions) more accurate. While on the other hand, some domain
|
| 337 |
+
265 adaptation algorithms involve the pseudo labelling process, and assigning incorrect pseudo labels to
|
| 338 |
+
266 the target data may even have negative impact on the target domain performance (as discussed in
|
| 339 |
+
267 Section 4). In this case, having more target data will not improve the performance.
|
| 340 |
+
|
| 341 |
+
$$
|
| 342 |
+
\mathrm { E r r } | \leq \frac { M } { \sqrt { 2 } n m } \sum _ { j = 1 } ^ { m } \sum _ { i = 1 } ^ { n } \mathbb { E } _ { X _ { j } ^ { \prime } } \sqrt { \operatorname* { m i n } \left\{ I ^ { X _ { j } ^ { \prime } } ( W ; Z _ { i } ) , L ^ { X _ { j } ^ { \prime } } ( W ; Z _ { i } ) \right\} } + \frac { M } { \sqrt { 2 } } \sqrt { \operatorname* { m i n } \left\{ \mathrm { D } _ { \mathrm { K L } } ( \mu | | \mu ^ { \prime } ) , \mathrm { D } _ { \mathrm { K L } } ( \mu ^ { \prime } | | \right\} } + \frac { M } { \sqrt { 2 } } \sqrt { \operatorname* { m i n } \left\{ \mathrm { D } _ { \mathrm { K L } } ( \mu | | \mu ^ { \prime } ) , \mathrm { D } _ { \mathrm { K L } } ( \mu ^ { \prime } | | \right\} } ) .
|
| 343 |
+
$$
|
| 344 |
+
|
| 345 |
+
where 269 $L ^ { X _ { j } ^ { \prime } } ( \cdot ; \cdot )$ is the disintegrated version of Lautum information.
|
| 346 |
+
|
| 347 |
+
270 Theorem 5.2. Assume $\ell$ is Lipschitz for both $w \in \mathcal { W }$ and $z \in { \mathcal { Z } }$ , i.e., $| \ell ( f _ { w } ( x ) , y ) - \ell ( f _ { w } ( x ^ { \prime } ) , y ^ { \prime } ) | \leq$
|
| 348 |
+
271 $\beta d _ { 1 } ( z , z ^ { \prime } )$ for all $z , z ^ { \prime } \in { \mathcal { Z } }$ and $| \ell ( f _ { w } ( x ) , y ) - \ell ( f _ { w ^ { \prime } } ( x ) , y ) | \leq \beta ^ { \prime } d _ { 2 } ( w , w ^ { \prime } )$ for all $w , w ^ { \prime } \in \mathcal { W }$ , then
|
| 349 |
+
|
| 350 |
+
$$
|
| 351 |
+
| \mathrm { E r r } | \leq \frac { \beta ^ { \prime } } { n m } \sum _ { j = 1 } ^ { m } \sum _ { i = 1 } ^ { n } \mathbb { E } _ { X _ { j } ^ { \prime } , Z _ { i } } \mathbb { W } ( P _ { W | Z _ { i } , X _ { j } ^ { \prime } } , P _ { W | X _ { j } ^ { \prime } } ) + \beta \mathbb { W } ( \mu , \mu ^ { \prime } ) .
|
| 352 |
+
$$
|
| 353 |
+
|
| 354 |
+
272 This bound is tighter than the bound in Theorem 5.1, as can be indicated by the following corollary.
|
| 355 |
+
|
| 356 |
+
273 Corollary 5.2. Let Assumption $^ { l }$ hold. Then
|
| 357 |
+
|
| 358 |
+
$$
|
| 359 |
+
\begin{array} { l l } { \displaystyle \left. \widetilde { \mathrm { E r r } } \right. \leq \frac { M } { n m } \displaystyle \sum _ { j = 1 } ^ { m } \displaystyle \sum _ { i = 1 } ^ { n } \mathbb { E } _ { X _ { j } ^ { \prime } , Z _ { i } } \left[ \mathrm { T V } ( P _ { W | Z _ { i } , X _ { j } ^ { \prime } } , P _ { W | X _ { j } ^ { \prime } } ) \right] + M \mathrm { T V } ( \mu , \mu ^ { \prime } ) } \\ { \displaystyle \qquad \leq \frac { 1 } { n m } \displaystyle \sum _ { j = 1 } ^ { m } \displaystyle \sum _ { i = 1 } ^ { n } \mathbb { E } _ { X _ { j } ^ { \prime } , Z _ { i } } \sqrt { \frac { M ^ { 2 } } { 2 } \mathrm { D } _ { \mathrm { K L } } ( P _ { W | Z _ { i } , X _ { j } ^ { \prime } } | | P _ { W | X _ { j } ^ { \prime } } ) } + \sqrt { \frac { M ^ { 2 } } { 2 } \mathrm { D } _ { \mathrm { K L } } ( \mu | | \mu ^ { \prime } ) } . } \end{array}
|
| 360 |
+
$$
|
| 361 |
+
|
| 362 |
+
274 Notice that to recover Theorem 5.1 from Corollary 5.2, we can use Jensen’s inequality to move the expectation over 275 $Z _ { i }$ inside the convex square root function.
|
| 363 |
+
|
| 364 |
+
# 5.2 Gradient Penalty as an Universal Regularizer
|
| 365 |
+
|
| 366 |
+
The algorithm-dependent bound in Theorem 5.1 tells us that one can reduce the expected generalization error by limiting the disintegrated mutual information $I ^ { X _ { j } ^ { \prime } } ( W ; Z _ { i } )$ . In the stochastic gradient based optimization algorithms, this term can be controlled by penalizing the gradient. To see this, we now consider a “noisy” iterative algorithm for updating $W$ , e.g., SGLD. At each time step $t$ , let the labelled mini-batch from the source domain be $Z _ { B _ { t } }$ , let the unlabelled mini-batch from the target domain be $X _ { B _ { t } } ^ { \prime }$ , and let $g ( W _ { t - 1 } , Z _ { B _ { t } } , X _ { B _ { t } } ^ { \prime } )$ be the gradient at time $t$ . Thus, the updating rule of $W$ is $W _ { t } = W _ { t - 1 } - \eta _ { t } g ( W _ { t - 1 } , Z _ { B _ { t } } , X _ { B _ { t } } ^ { \prime } ) + N _ { t }$ where $\eta _ { t }$ is the learning rate and $N _ { t } \sim \mathcal N ( 0 , \sigma ^ { 2 } \mathrm I _ { d } )$ is an isotropic Gaussian noise. The next theorem is an application of Theorem 5.1 in this setting.
|
| 367 |
+
|
| 368 |
+
Theorem 5.3. Let the total iteration number be 285 $T$ and let $G _ { t } = g ( W _ { t - 1 } , Z _ { B _ { t } } , X _ { B _ { t } } ^ { \prime } )$ , then
|
| 369 |
+
|
| 370 |
+
$$
|
| 371 |
+
| \mathrm { E r r } | \leq \sqrt { \frac { R ^ { 2 } } { n } \sum _ { t = 1 } ^ { T } \frac { \eta _ { t } ^ { 2 } } { \sigma _ { t } ^ { 2 } } \mathbb { E } _ { S _ { X ^ { \prime } } ^ { \prime } , W _ { t - 1 } , S } \left[ | | G _ { t } | | ^ { 2 } \right] } + \sqrt { 2 R ^ { 2 } \mathrm { D } _ { \mathrm { K L } } ( \mu | | \mu ^ { \prime } ) } .
|
| 372 |
+
$$
|
| 373 |
+
|
| 374 |
+
286 Remark 5.2. Considering a noisy iterative algorithm here is to simplify analysis. In fact it is also
|
| 375 |
+
287 possible to analyze the original iterative gradient optimization method without noise injected. For
|
| 376 |
+
288 example, one can follow the same development in [30, 31] to analyze vanilla SGD. In that case, there
|
| 377 |
+
289 will be some additional terms in the bound, which are related to flatness of the found minima.
|
| 378 |
+
|
| 379 |
+
Theorem 5.3 hints that to reduce the generalization error, one can restrict the gradient norm at each step. This strategy will also restrict the distance between the final output $W _ { T }$ and the initialization $W _ { 0 }$ , effectively shrinking the hypothesis space accessible by the algorithm.
|
| 380 |
+
|
| 381 |
+
Indeed, adding gradient penalty can be applied to any existing UDA algorithm and it is simple but effective in practice. Later on we will show that even when the algorithm $\mathcal { A }$ does not access to any target data, in which case $I ( W ; Z _ { i } | X _ { j } ^ { \prime } )$ reduces to $I ( W ; Z _ { i } )$ and $g ( W _ { t - 1 } , Z _ { B _ { t } } , X _ { B _ { t } } ^ { \prime } )$ becomes $g ( W _ { t - 1 } , Z _ { B _ { t } } )$ , minimizing the empirical loss of source domain sample while penalizing gradient norm will still improve the performance. Notice that gradient penalty is also used in Wasserstein distance based adversarial training [49, 6], and their motivation is to stabilize the training to avoid gradient vanishing problem while here we use it to improve the generalization performance directly.
|
| 382 |
+
|
| 383 |
+
300 Notably the bound in Theorem 5.3 only depends on the size $n$ of labelled source sample and does
|
| 384 |
+
301 not explicitly depend on $m$ , the size of unlabelled target sample. With a more careful design, if we
|
| 385 |
+
|
| 386 |
+
consider the mutual information as the expected KL divergence of a posterior and a prior, based on $I ^ { X _ { j } ^ { \prime } } ( W ; Z _ { i } )$ in Theorem 5.1, it is possible to create a target data dependent prior and derive a tighter bound based on some quantity similar to "gradient incoherence" in [24]. As this will introduce additional complexity in practice, we leave this as a future study.
|
| 387 |
+
|
| 388 |
+
# 5.3 Controlling Label Information for KL Guided Marginal Alignment
|
| 389 |
+
|
| 390 |
+
307 Consider instances in the representation space, $Z = ( T , Y )$ and $Z ^ { \prime } = ( T ^ { \prime } , Y )$ . Theorem 5.1 also
|
| 391 |
+
308 encourage us to align the distributions of two domains in the representation space, as argued earlier.
|
| 392 |
+
309 Then the KL guided marginal alignment algorithm proposed in [9] can be invoked here. One may
|
| 393 |
+
310 notice that Theorem 5.1 uses $\mathrm { D } _ { \mathrm { K L } } ^ { - } ( \mu | | \mu ^ { \prime } )$ while [9] uses $\mathrm { D } _ { \mathrm { K L } } ( \mu ^ { \prime } | | \mu )$ . As already discussed in
|
| 394 |
+
311 Section 4, this inconsistency can be ignored when loss is bounded (see Corollary 5.1).
|
| 395 |
+
312 Most domain adaptation algorithms aim to align the marginal distributions of two domains in the
|
| 396 |
+
313 representation space. However, without accessing to $Y ^ { \prime }$ , it remains unknown if an UDA algorithm
|
| 397 |
+
314 will work well since we cannot guarantee that discrepancy between conditional distribution $P _ { Y | T }$
|
| 398 |
+
315 and $P _ { Y ^ { \prime } | T ^ { \prime } }$ won’t become too large when we align the marginals. In [9], the authors show that
|
| 399 |
+
316 $\mathrm { D } _ { \mathrm { K L } } ( P _ { Y ^ { \prime } | T ^ { \prime } } | | P _ { Y | T } )$ can be upper-bounded by $\operatorname { D } _ { \mathrm { K L } } ( P _ { Y ^ { \prime } | X ^ { \prime } } | | P _ { Y | X } )$ , if $I ( X ; Y ) = I ( T ; Y )$ . The
|
| 400 |
+
317 authors then argue that penalizing the KL divergence of the marginals distributions is safe.
|
| 401 |
+
|
| 402 |
+
We now argue that in practice the condition $I ( X ; Y ) = I ( T ; Y )$ can be difficult to satisfy if the cross-entropy loss is used to define the source-domain empirical risk.
|
| 403 |
+
|
| 404 |
+
320 By data processing inequality on $Y - X - T$ , we know that $I ( X ; Y ) \geq I ( T ; Y ) = H ( Y ) - H ( Y | T )$ .
|
| 405 |
+
321 Thus, to let $I ( T ; Y )$ reach its maximum, one must minimize $H ( Y | T )$ . On the other hand, let $Q _ { Y | T , W }$
|
| 406 |
+
322 be the predictive distribution of labels in the source domain generated by the classifier. The expected
|
| 407 |
+
323 cross-entropy loss for each $Z _ { i }$ in the representation space is then
|
| 408 |
+
|
| 409 |
+
$$
|
| 410 |
+
\mathbb { E } _ { W , Z _ { i } } \left[ \ell ( f _ { W } ( T _ { i } ) , Y _ { i } ) \right] = \mathbb { E } _ { Z _ { i } } \left[ \mathbb { E } _ { W | Z _ { i } } \left[ - \log Q _ { Y _ { i } | T _ { i } , W } \right] \right] ,
|
| 411 |
+
$$
|
| 412 |
+
|
| 413 |
+
324 which also decomposes as [50, 51]
|
| 414 |
+
|
| 415 |
+
$$
|
| 416 |
+
\mathbb { E } _ { W , Z _ { i } } \left[ \ell \big ( f _ { W } ( T _ { i } ) , Y _ { i } \big ) \right] = H ( Y _ { i } | T _ { i } ) + \mathbb { E } _ { T _ { i } , W } \left[ \mathrm { D } _ { \mathrm { K L } } \big ( P _ { Y _ { i } | T _ { i } , W } | | Q _ { Y _ { i } | T _ { i } , W } \big ) \right] - I ( W ; Y _ { i } | T _ { i } ) .
|
| 417 |
+
$$
|
| 418 |
+
|
| 419 |
+
325 Then minimizing the expected cross-entropy loss may not adequately reduce $H ( Y _ { i } | T _ { i } )$ but rather
|
| 420 |
+
326 cause $I ( W ; Y _ { i } | T _ { i } )$ to significantly increase, particularly when the model capacity is large. This
|
| 421 |
+
327 may have two negative effects. First, the condition $I ( \dot { X } ; Y ) = I ( T ; Y )$ is significantly violated,
|
| 422 |
+
328 and $\mathrm { D } _ { \mathrm { K L } } ( P _ { Y ^ { \prime } | T ^ { \prime } } | | P _ { Y | T } )$ is no longer upper bounded by $\operatorname { D } _ { \mathrm { K L } } ( P _ { Y ^ { \prime } | X ^ { \prime } } | | P _ { Y | X } )$ . As a consequence,
|
| 423 |
+
329 aligning the two marginals alone may not be adequate. Second, large $I ( W ; Y _ { i } | T _ { i } )$ indicates $W$
|
| 424 |
+
330 just simply memorizes the label $Y _ { i }$ , resulting a form of overfitting and hurting the generalization
|
| 425 |
+
331 performance.
|
| 426 |
+
332 The key take-away from the above analysis is that when aligning the marginals in UDA, controlling the
|
| 427 |
+
333 source label information in the weights can be important to achieve good cross-domain generalization.
|
| 428 |
+
334 A similar message can also be deduced from Theorem 5.1, when it is viewed in the repsentation space
|
| 429 |
+
335 and noting $I ^ { T _ { j } ^ { \prime } } ( W ; Z _ { i } ) = I ^ { T _ { j } ^ { \prime } } ( W ; T _ { i } , ) + I ^ { T _ { j } ^ { \prime } } ( W ; Y _ { i } | T _ { i } )$ .
|
| 430 |
+
|
| 431 |
+
To control label information, [51] proposed an approach called LIMIT. However this method is rather complicated and arguably hard to train in domain adaptation (see Appendix). We now derive a simple alternative strategy for this purpose.
|
| 432 |
+
|
| 433 |
+
339 Notice that $\begin{array} { r } { I ^ { T _ { j } ^ { \prime } } ( W ; Y _ { i } ^ { \phantom { * } } | T _ { i } ) \leq \operatorname* { i n f } _ { Q } \mathbb { E } _ { T _ { i } } \left[ \mathrm { D } _ { \mathrm { K L } } ( P ( W | Y _ { i } , T _ { i } , { \cal T } _ { j } ^ { \prime } = t _ { j } ^ { \prime } ) | | Q ( W | { \cal T } _ { i } , { \cal T } _ { j } ^ { \prime } = t _ { j } ^ { \prime } ) ) \right] } \end{array}$ , which is
|
| 434 |
+
340 a simple extension of variational representation of mutual information [47, Corollary 3.1.]. Here
|
| 435 |
+
341 $Q$ could be any distribution. By assuming $P = \mathcal { N } ( W , \sigma ^ { 2 } \mathrm { I } _ { d } | Y _ { i } , T _ { i } , T _ { j } ^ { \prime } = t _ { j } ^ { \prime } )$ ) and taking $Q =$
|
| 436 |
+
342 $\mathcal { N } ( \widetilde { W } , \tilde { \sigma } ^ { 2 } \mathrm { I } _ { d } | T _ { i } , T _ { j } ^ { \prime } = t _ { j } ^ { \prime } )$ , we have
|
| 437 |
+
|
| 438 |
+
$$
|
| 439 |
+
\begin{array} { r } { I ^ { T _ { j } ^ { \prime } } ( W ; Y _ { i } | T _ { i } ) \leq \underset { Q } { \operatorname* { i n f } } \mathbb { E } _ { T _ { i } } \left[ \mathrm { D } _ { \mathrm { K L } } ( P ( W | Y _ { i } , T _ { i } , T _ { j } ^ { \prime } = t _ { j } ^ { \prime } ) | | Q ( \tilde { W } | T _ { i } , T _ { j } ^ { \prime } = t _ { j } ^ { \prime } ) ) \right] \propto | | W - \widetilde { W } | | ^ { 2 } . } \end{array}
|
| 440 |
+
$$
|
| 441 |
+
|
| 442 |
+
343 Thus, we may create an auxiliary classifier $f _ { \widetilde { w } }$ that is not allowed to access to the real source label
|
| 443 |
+
344 $Y$ e . In each iteration, we use the pseudo labels of target data (and source data) assigned by $f _ { w }$ to
|
| 444 |
+
345 train $f _ { \widetilde { w } }$ and adding $| | W - \widetilde W | | ^ { 2 }$ as a regularizer in the training of $W$ . The algorithm is given in
|
| 445 |
+
346 ethe Appendix. Remarkably the regularizer here resembles “Projection Norm” designed in [52] for
|
| 446 |
+
347 out-of-distribution generalization.
|
| 447 |
+
|
| 448 |
+
Table 1: RotatedMNIST and Digits Experiments. Results of baseline methods are reported from [9].
|
| 449 |
+
|
| 450 |
+
<table><tr><td></td><td colspan="5">RotatedMNIST(O° as source domain)</td><td colspan="5">Digits</td></tr><tr><td>Method</td><td>15°</td><td>30°</td><td>45°</td><td>60°</td><td>75°</td><td>Ave</td><td>M→U</td><td>U→M</td><td>S→M</td><td>Ave</td></tr><tr><td>ERM</td><td>97.5±0.2</td><td>84.1±0.8</td><td>53.9±0.7</td><td>34.2±0.4</td><td>22.3±0.5</td><td>58.4</td><td>73.1±4.2</td><td>54.8±6.2</td><td>65.9±1.4</td><td>64.6</td></tr><tr><td>DANN</td><td>97.3±0.4</td><td>90.6±1.1</td><td>68.7±4.2</td><td>30.8±0.6</td><td>19.0±0.6</td><td>61.3</td><td>90.7±0.4</td><td>91.2±0.8</td><td>71.1±0.5</td><td>84.3</td></tr><tr><td>MMD</td><td>97.5±0.1</td><td>95.3±0.4</td><td>73.6±2.1</td><td>44.2±1.8</td><td>32.1±2.1</td><td>68.6</td><td>91.8±0.3</td><td>94.4±0.5</td><td>82.8±0.3</td><td>89.7</td></tr><tr><td>CORAL</td><td>97.1±0.3</td><td>82.3±0.3</td><td>56.0±2.4</td><td>30.8±0.2</td><td>27.1±1.7</td><td>58.7</td><td>88.0±1.9</td><td>83.3±0.1</td><td>69.3±0.6</td><td>80.2</td></tr><tr><td>WD</td><td>96.7±0.3</td><td>93.1±1.2</td><td>64.1±3.3</td><td>41.4±7.6</td><td>27.6±2.0</td><td>64.6</td><td>88.2±0.6</td><td>60.2±1.8</td><td>68.4±2.5</td><td>72.3</td></tr><tr><td>KL</td><td>97.8±0.1</td><td>97.1±0.2</td><td>93.4±0.8</td><td>75.5±2.4</td><td>68.1±1.8</td><td>86.4</td><td>98.2±0.2</td><td>97.3±0.5</td><td>92.5±0.9</td><td>96.0</td></tr><tr><td>ERM-GP</td><td>97.5±0.1</td><td>86.2±0.5</td><td>62.0±1.9</td><td>34.8±2.1</td><td>26.1±1.2</td><td>61.2</td><td>91.3±1.6</td><td>72.7±4.2</td><td>68.4±0.2</td><td>77.5</td></tr><tr><td>KL-GP</td><td>98.2±0.2</td><td>96.9±0.1</td><td>95.0±0.6</td><td>88.0±8.1</td><td>78.1±2.5</td><td>91.2</td><td>98.8±0.1</td><td>97.8±0.1</td><td>93.8±1.1</td><td>96.8</td></tr><tr><td>KL-CL</td><td>98.4±0.2</td><td>97.3±0.2</td><td>95.6±0.1</td><td>83.0±8.2</td><td>73.6±4.0</td><td>89.6</td><td>98.9±0.1</td><td>97.7±0.1</td><td>93.0±0.3</td><td>96.5</td></tr></table>
|
| 451 |
+
|
| 452 |
+
# 348 6 Experimental Results
|
| 453 |
+
|
| 454 |
+
We now perform experiments to verify the proposed techniques inspired by our theory in the previous section. The experimental setup follows that in [9].
|
| 455 |
+
|
| 456 |
+
Datasets We select two popular small datasets, RotatedMNIST and Digits, to compare the different methods. In particular, RotatedMNIST is built based on the MNIST dataset [53] and consists of six domains with each domain containing 11, 666 images. These six domains are rotated MNIST images with rotation angle $0 ^ { \circ }$ , $1 5 ^ { \circ }$ , $3 0 ^ { \circ }$ , $4 5 ^ { \circ }$ , $6 0 ^ { \circ }$ and $7 5 ^ { \circ }$ , respectively. We will take the original MNIST dataset $( 0 ^ { \circ } )$ as the source domain and take other five domains as target domains. Hence there are five domain adaptation tasks on RotatedMNIST. Digits consists of three sub-datasets, namely MNIST, USPS [54] and SVHN [55], and the corresponding domain adaptation tasks are MNIST USPS $( \mathbf { M } \to \mathbf { U } )$ ), USPS MNIST $\mathbf { \Delta } [ \mathbf { U } \to \mathbf { M } ]$ , SVHN MNIST $( \mathbf { S } { } \mathbf { M } )$ ).
|
| 457 |
+
|
| 458 |
+
59 Compared Methods Baseline methods are some popular marginal alignment UDA methods
|
| 459 |
+
60 including DANN [10], MMD [12], CORAL [11], WD [6] and KL [9]. We also choose ERM for
|
| 460 |
+
another baseline in which the algorithm can only access to the source domain sample during training.
|
| 461 |
+
62 To verify the strategies inspired by our theory, we first add the gradient penalty to the ERM algorithm
|
| 462 |
+
63 (ERM-GP), and we then combine gradient penalty (GP) and controlling label information (CL)
|
| 463 |
+
4 with the recent proposed KL guided marginal alignment method, which are denoted by KL-GP and
|
| 464 |
+
65 KL-CL, respectively.
|
| 465 |
+
|
| 466 |
+
Implementation Details Most part of the implementation is based on the famous DomainBed suite [56]. Other settings are exactly the same with [9] and the results of baseline methods are reported directly from [9]. Specifically, each algorithm is run three times and we show the average performance with the error bar. Every dataset has a validation set, and the model selection scheme is based on the best performance achieved on the validation set of target domain during training (oracle). The hype-parameter searching process is also built upon the implementation in the DomainBed suite. Other details and additional experiments can be found in Appendix.
|
| 467 |
+
|
| 468 |
+
373 Results From Table 1, we first notice that gradient penalty is able to help ERM to be more
|
| 469 |
+
374 comparable with other marginal alignment methods. For example, on RotatedMNIST, ERM-GP
|
| 470 |
+
375 outperforms CORAL and performs nearly the same with DANN. On Digits, ERM-GP outperforms
|
| 471 |
+
376 WD. When GP and CL combined with KL guided algorithm, we can see that the performance can be
|
| 472 |
+
377 further boosted. This justifies the discussion in Section 5.2 and Section 5.3.
|
| 473 |
+
|
| 474 |
+
# 378 7 Conclusion
|
| 475 |
+
|
| 476 |
+
Despite that the numerous learning techniques have been developed for domain adaptation, significant room exists for more in-depth theoretical understanding and more principled design of learning algorithms. This paper presents the information-theoretic analysis for unsupervised domain adaptation, where we query two notions of the generalization errors in this context and present novel learning bounds. Some of these bounds recover the previous KL-based bounds under different conditions and confirm the insights in the learning algorithms that align the source and target distributions in the representation space. Our other bounds are algorithm-dependent, better exploiting the unlabelled target data, which have inspired novel and yet simple schemes for the design of learning algorithms. We demonstrate the effectiveness of these schemes on standard benchmark datasets.
|
| 477 |
+
|
| 478 |
+
References
|
| 479 |
+
[1] Shai Ben-David, John Blitzer, Koby Crammer, and Fernando Pereira. Analysis of representations for domain adaptation. Advances in neural information processing systems, 19, 2006.
|
| 480 |
+
[2] Shai Ben-David, John Blitzer, Koby Crammer, Alex Kulesza, Fernando Pereira, and Jennifer Wortman Vaughan. A theory of learning from different domains. Machine Learning, 79 (1-2):151–175, 2010.
|
| 481 |
+
[3] Yishay Mansour, Mehryar Mohri, and Afshin Rostamizadeh. Domain adaptation: Learning bounds and algorithms. In The 22nd Conference on Learning Theory, 2009.
|
| 482 |
+
[4] Han Zhao, Remi Tachet Des Combes, Kun Zhang, and Geoffrey Gordon. On learning invariant representations for domain adaptation. In International Conference on Machine Learning, pages 7523–7532. PMLR, 2019.
|
| 483 |
+
[5] Yuchen Zhang, Tianle Liu, Mingsheng Long, and Michael Jordan. Bridging theory and algorithm for domain adaptation. In International Conference on Machine Learning, pages 7404–7413. PMLR, 2019.
|
| 484 |
+
[6] Jian Shen, Yanru Qu, Weinan Zhang, and Yong Yu. Wasserstein distance guided representation learning for domain adaptation. In Thirty-second AAAI conference on artificial intelligence, 2018.
|
| 485 |
+
[7] Pascal Germain, Amaury Habrard, François Laviolette, and Emilie Morvant. Pac-bayes and domain adaptation. Neurocomputing, 379:379–397, 2020.
|
| 486 |
+
[8] David Acuna, Guojun Zhang, Marc T Law, and Sanja Fidler. f-domain adversarial learning: Theory and algorithms. In International Conference on Machine Learning, pages 66–75. PMLR, 2021.
|
| 487 |
+
[9] A. Tuan Nguyen, Toan Tran, Yarin Gal, Philip Torr, and Atilim Gunes Baydin. KL guided domain adaptation. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=0JzqUlIVVDd.
|
| 488 |
+
[10] Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, François Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. The journal of machine learning research, 17(1):2096–2030, 2016.
|
| 489 |
+
[11] Baochen Sun and Kate Saenko. Deep coral: Correlation alignment for deep domain adaptation. In European conference on computer vision, pages 443–450. Springer, 2016.
|
| 490 |
+
[12] Haoliang Li, Sinno Jialin Pan, Shiqi Wang, and Alex C Kot. Domain generalization with adversarial feature learning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 5400–5409, 2018.
|
| 491 |
+
[13] Daniel Russo and James Zou. Controlling bias in adaptive data analysis using information theory. In Artificial Intelligence and Statistics. PMLR, 2016.
|
| 492 |
+
[14] Aolin Xu and Maxim Raginsky. Information-theoretic analysis of generalization capability of learning algorithms. Advances in Neural Information Processing Systems, 2017.
|
| 493 |
+
[15] Shai Ben David, Tyler Lu, Teresa Luu, and Dávid Pál. Impossibility theorems for domain adaptation. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pages 129–136. JMLR Workshop and Conference Proceedings, 2010.
|
| 494 |
+
[16] Changjian Shui, Qi Chen, Jun Wen, Fan Zhou, Christian Gagné, and Boyu Wang. Beyond $\mathcal { H }$ -divergence: Domain adaptation theory with jensen-shannon divergence. arXiv preprint arXiv:2007.15567, 2020.
|
| 495 |
+
[17] Ievgen Redko, Emilie Morvant, Amaury Habrard, Marc Sebban, and Younes Bennani. A survey on domain adaptation theory. arXiv preprint arXiv:2004.11829, 2020.
|
| 496 |
+
[18] Gabriela Csurka. Domain adaptation for visual applications: A comprehensive survey. arXiv preprint arXiv:1702.05374, 2017.
|
| 497 |
+
[19] Garrett Wilson and Diane J Cook. A survey of unsupervised deep domain adaptation. ACM Transactions on Intelligent Systems and Technology (TIST), 11(5):1–46, 2020.
|
| 498 |
+
[20] Kaiyang Zhou, Ziwei Liu, Yu Qiao, Tao Xiang, and Chen Change Loy. Domain generalization: A survey. arXiv e-prints, pages arXiv–2103, 2021.
|
| 499 |
+
[21] Jindong Wang, Cuiling Lan, Chang Liu, Yidong Ouyang, Wenjun Zeng, and Tao Qin. Generalizing to unseen domains: A survey on domain generalization. arXiv preprint arXiv:2103.03097, 2021.
|
| 500 |
+
[22] Daniel Russo and James Zou. How much does your data exploration overfit? controlling bias via information usage. IEEE Transactions on Information Theory, 66(1):302–323, 2019.
|
| 501 |
+
[23] Yuheng Bu, Shaofeng Zou, and Venugopal V Veeravalli. Tightening mutual information based bounds on generalization error. In 2019 IEEE International Symposium on Information Theory (ISIT), pages 587–591. IEEE, 2019.
|
| 502 |
+
[24] Jeffrey Negrea, Mahdi Haghifam, Gintare Karolina Dziugaite, Ashish Khisti, and Daniel M Roy. Information-theoretic generalization bounds for sgld via data-dependent estimates. Advances in Neural Information Processing Systems, 2019.
|
| 503 |
+
[25] Thomas Steinke and Lydia Zakynthinou. Reasoning about generalization via conditional mutual information. In Conference on Learning Theory. PMLR, 2020.
|
| 504 |
+
[26] Mahdi Haghifam, Jeffrey Negrea, Ashish Khisti, Daniel M Roy, and Gintare Karolina Dziugaite. Sharpened generalization bounds based on conditional mutual information and an application to noisy, iterative algorithms. Advances in Neural Information Processing Systems, 2020.
|
| 505 |
+
[27] Borja Rodríguez Gálvez, Germán Bassi, Ragnar Thobaben, and Mikael Skoglund. Tighter expected generalization error bounds via wasserstein distance. Advances in Neural Information Processing Systems, 34, 2021.
|
| 506 |
+
[28] Ankit Pensia, Varun Jog, and Po-Ling Loh. Generalization error bounds for noisy, iterative algorithms. In 2018 IEEE International Symposium on Information Theory (ISIT). IEEE, 2018.
|
| 507 |
+
[29] Hao Wang, Rui Gao, and Flavio P Calmon. Generalization bounds for noisy iterative algorithms using properties of additive noise channels. arXiv preprint arXiv:2102.02976, 2021.
|
| 508 |
+
[30] Gergely Neu, Gintare Karolina Dziugaite, Mahdi Haghifam, and Daniel M Roy. Informationtheoretic generalization bounds for stochastic gradient descent. In Conference on Learning Theory. PMLR, 2021.
|
| 509 |
+
[31] Ziqiao Wang and Yongyi Mao. On the generalization of models trained with SGD: Informationtheoretic bounds and implications. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id $\equiv$ oWZsQ8o5EA.
|
| 510 |
+
[32] Sharu Theresa Jose and Osvaldo Simeone. Information-theoretic generalization bounds for meta-learning and applications. Entropy, 23(1):126, 2021.
|
| 511 |
+
[33] Sharu Theresa Jose, Osvaldo Simeone, and Giuseppe Durisi. Transfer meta-learning: Information-theoretic bounds and information meta-risk minimization. IEEE Transactions on Information Theory, 68(1):474–501, 2021.
|
| 512 |
+
[34] Arezou Rezazadeh, Sharu Theresa Jose, Giuseppe Durisi, and Osvaldo Simeone. Conditional mutual information-based generalization bound for meta learning. In 2021 IEEE International Symposium on Information Theory (ISIT), pages 1176–1181. IEEE, 2021.
|
| 513 |
+
[35] Qi Chen, Changjian Shui, and Mario Marchand. Generalization bounds for meta-learning: An information-theoretic analysis. Advances in Neural Information Processing Systems, 34, 2021.
|
| 514 |
+
[36] Haiyun He, Hanshu Yan, and Vincent YF Tan. Information-theoretic generalization bounds for iterative semi-supervised learning. arXiv preprint arXiv:2110.00926, 2021.
|
| 515 |
+
[37] Gholamali Aminian, Mahed Abroshan, Mohammad Mahdi Khalili, Laura Toni, and Miguel Rodrigues. An information-theoretical approach to semi-supervised learning under covariateshift. In International Conference on Artificial Intelligence and Statistics, pages 7433–7449. PMLR, 2022.
|
| 516 |
+
[38] Xuetong Wu, Jonathan H Manton, Uwe Aickelin, and Jingge Zhu. Information-theoretic analysis for transfer learning. In 2020 IEEE International Symposium on Information Theory (ISIT), pages 2819–2824. IEEE, 2020.
|
| 517 |
+
[39] Sharu Theresa Jose and Osvaldo Simeone. Information-theoretic bounds on transfer generalization gap based on jensen-shannon divergence. In 2021 29th European Signal Processing Conference (EUSIPCO), pages 1461–1465. IEEE, 2021.
|
| 518 |
+
[40] Mohammad Saeed Masiha, Amin Gohari, Mohammad Hossein Yassaee, and Mohammad Reza Aref. Learning under distribution mismatch and model misspecification. In 2021 IEEE International Symposium on Information Theory (ISIT), pages 2912–2917. IEEE, 2021.
|
| 519 |
+
[41] Yuheng Bu, Gholamali Aminian, Laura Toni, Gregory W Wornell, and Miguel Rodrigues. Characterizing and understanding the generalization error of transfer learning with gibbs algorithm. In International Conference on Artificial Intelligence and Statistics, pages 8673– 8699. PMLR, 2022.
|
| 520 |
+
[42] Peter L Bartlett and Shahar Mendelson. Rademacher and gaussian complexities: Risk bounds and structural results. Journal of Machine Learning Research, 3(Nov):463–482, 2002.
|
| 521 |
+
[43] Daniel P Palomar and Sergio Verdú. Lautum information. IEEE transactions on information theory, 54(3):964–975, 2008.
|
| 522 |
+
[44] Harold Jeffreys. An invariant form for the prior probability in estimation problems. Proceedings of the Royal Society of London. Series A. Mathematical and Physical Sciences, 186(1007): 453–461, 1946.
|
| 523 |
+
[45] Gavin E. Crooks. Inequalities between the jenson-shannon and jeffreys divergences. In Tech. Note 004, 2008.
|
| 524 |
+
[46] Hao Wang, Mario Diaz, José Cândido S Santos Filho, and Flavio P Calmon. An informationtheoretic view of generalization via wasserstein distance. In 2019 IEEE International Symposium on Information Theory (ISIT), pages 577–581. IEEE, 2019.
|
| 525 |
+
[47] Yury Polyanskiy and Yihong Wu. Lecture notes on information theory. Lecture Notes for 6.441 (MIT), ECE 563 (UIUC), STAT 364 (Yale), 2019., 2019.
|
| 526 |
+
[48] Jean Bretagnolle and Catherine Huber. Estimation des densités: risque minimax. Zeitschrift für Wahrscheinlichkeitstheorie und verwandte Gebiete, 47(2):119–137, 1979.
|
| 527 |
+
[49] Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron C Courville. Improved training of wasserstein gans. Advances in neural information processing systems, 30, 2017.
|
| 528 |
+
[50] Alessandro Achille and Stefano Soatto. Emergence of invariance and disentanglement in deep representations. The Journal of Machine Learning Research, 19(1):1947–1980, 2018.
|
| 529 |
+
[51] Hrayr Harutyunyan, Kyle Reing, Greg Ver Steeg, and Aram Galstyan. Improving generalization by controlling label-noise information in neural network weights. In International Conference on Machine Learning, pages 4071–4081. PMLR, 2020.
|
| 530 |
+
[52] Yaodong Yu, Zitong Yang, Alexander Wei, Yi Ma, and Jacob Steinhardt. Predicting out-ofdistribution error with the projection norm. arXiv preprint arXiv:2202.05834, 2022.
|
| 531 |
+
[53] Yann LeCun, Corinna Cortes, and CJ Burges. Mnist handwritten digit database. ATT Labs [Online]. Available: http://yann.lecun.com/exdb/mnist, 2, 2010.
|
| 532 |
+
[54] Jonathan J. Hull. A database for handwritten text recognition research. IEEE Transactions on pattern analysis and machine intelligence, 16(5):550–554, 1994.
|
| 533 |
+
[55] Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. In NeurIPS Workshop on Deep Learning and Unsupervised Feature Learning, 2011.
|
| 534 |
+
[56] Ishaan Gulrajani and David Lopez-Paz. In search of lost domain generalization. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum? id=lQdXeXDoWtI.
|
| 535 |
+
[57] XuanLong Nguyen, Martin J Wainwright, and Michael I Jordan. Estimating divergence functionals and the likelihood ratio by convex risk minimization. IEEE Transactions on Information Theory, 56(11):5847–5861, 2010.
|
| 536 |
+
[58] Jiantao Jiao, Yanjun Han, and Tsachy Weissman. Dependence measures bounding the exploration bias for general measurements. In 2017 IEEE International Symposium on Information Theory (ISIT), pages 1475–1479. IEEE, 2017.
|
| 537 |
+
[59] Rohit Agrawal and Thibaut Horel. Optimal bounds between f-divergences and integral probability metrics. In International Conference on Machine Learning, pages 115–124. PMLR, 2020.
|
| 538 |
+
[60] Villani Cédric. Optimal Transport: Old and New (Grundlehren der mathematischen Wissenschaften, 338). Springer, 2008.
|
| 539 |
+
[61] Clément L Canonne. A short note on an inequality between kl and tv. arXiv preprint arXiv:2202.07198, 2022.
|
| 540 |
+
[62] Vladimir Vapnik. Statistical learning theory. Wiley, 1998. ISBN 978-0-471-03003-4.
|
| 541 |
+
[63] Thomas M. Cover and Joy A. Thomas. Elements of Information Theory (Wiley Series in Telecommunications and Signal Processing). Wiley-Interscience, USA, 2006. ISBN 0471241954.
|
| 542 |
+
[64] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in Neural Information Processing Systems, 32:8026–8037, 2019.
|
| 543 |
+
[65] Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
|
| 544 |
+
|
| 545 |
+
# Checklist
|
| 546 |
+
|
| 547 |
+
1. For all authors...
|
| 548 |
+
|
| 549 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 550 |
+
(b) Did you describe the limitations of your work? [Yes] See Section 7.
|
| 551 |
+
(c) Did you discuss any potential negative societal impacts of your work? [N/A] This is a theoretical work and we do not see any potential negative societal impacts.
|
| 552 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 553 |
+
|
| 554 |
+
2. If you are including theoretical results...
|
| 555 |
+
|
| 556 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] e.g., see Section 4. (b) Did you include complete proofs of all theoretical results? [Yes] See Appendices.
|
| 557 |
+
|
| 558 |
+
3. If you ran experiments...
|
| 559 |
+
|
| 560 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See Section 6 and supplemental material.
|
| 561 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 6 and Appendices.
|
| 562 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Table 1.
|
| 563 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Appendices.
|
| 564 |
+
|
| 565 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 566 |
+
|
| 567 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 568 |
+
(b) Did you mention the license of the assets? [Yes] See Appendices.
|
| 569 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
|
| 570 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 571 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 572 |
+
|
| 573 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 574 |
+
|
| 575 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 576 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 577 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/dFbKQaRk15w/dFbKQaRk15w.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/krI-ahhgN2/krI-ahhgN2.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/l0zLcLGdcL/l0zLcLGdcL.md
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Memory-Assisted Sub-Prototype Mining for Universal Domain Adaptation
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 Universal domain adaptation aims to align the classes and reduce the feature
|
| 11 |
+
2 gap between the same category of the source and target domains. The target
|
| 12 |
+
3 private category is set as the unknown class during the adaptation process, as it
|
| 13 |
+
4 is not included in the source domain. However, most existing methods overlook
|
| 14 |
+
5 the intra-class structure within a category, especially in cases where there exists
|
| 15 |
+
6 significant concept shift between the samples belonging to the same category. When
|
| 16 |
+
7 samples with large concept shift are forced to be pushed together, it may negatively
|
| 17 |
+
8 affect the adaptation performance. Moreover, from the interpretability aspect, it is
|
| 18 |
+
9 unreasonable to align visual features with significant differences, such as fighter
|
| 19 |
+
10 jets and civil aircraft, into the same category. Unfortunately, due to such semantic
|
| 20 |
+
11 ambiguity and annotation cost, categories are not always classified in detail, making
|
| 21 |
+
12 it difficult for the model to perform precise adaptation. To address these issues,
|
| 22 |
+
13 we propose a novel Memory-Assisted Sub-Prototype Mining (MemSPM) method
|
| 23 |
+
14 that can learn the differences between samples belonging to the same category
|
| 24 |
+
15 and mine sub-classes when there exists significant concept shift between them.
|
| 25 |
+
16 By doing so, our model learns a more reasonable feature space that enhances the
|
| 26 |
+
17 transferability and reflects the inherent differences among samples annotated as
|
| 27 |
+
18 the same category. We evaluate the effectiveness of our MemSPM method over
|
| 28 |
+
19 multiple scenarios, including UniDA, OSDA, and PDA. Our method achieves
|
| 29 |
+
20 state-of-the-art performance on four benchmarks in most cases.
|
| 30 |
+
|
| 31 |
+
# 21 1 Introduction
|
| 32 |
+
|
| 33 |
+
22 Unsupervised Domain Adaptation (UDA) [15, 22, 41, 44, 9, 19, 21] has become a crucial research
|
| 34 |
+
23 area of transfer learning, as it allows models trained on a specific dataset to be applied to related but
|
| 35 |
+
24 distinct domains. However, traditional UDA methods are limited by the assumption that the source
|
| 36 |
+
25 and target domains have to share the same label space. This assumption is problematic in real-world
|
| 37 |
+
26 scenarios where the target distribution is complex, open, and diverse. Universal Domain Adaptation
|
| 38 |
+
27 (UniDA) represents a strategy to address the limitations of traditional unsupervised domain adaptation
|
| 39 |
+
28 methods. In the UniDA, the target domain have a different label set than the source domain. The
|
| 40 |
+
29 goal is to correctly classify target domain samples belonging to the shared classes in the source label
|
| 41 |
+
30 set, while any samples not conforming to the source label set are treated as "unknown". The term
|
| 42 |
+
31 "universal" characterizes UniDA as not relying on prior knowledge about the label sets of the target
|
| 43 |
+
32 domain. UniDA relaxes the assumption of a shared class space while aims to learn domain-invariant
|
| 44 |
+
33 features across a more broad range of domains.
|
| 45 |
+
34 Despite being widely explored, most existing universal domain adaptation methods [24, 47, 40, 39, 6,
|
| 46 |
+
35 34, 8, 26] overlook the internal structure intrinsically presented within each image category. These
|
| 47 |
+
36 methods aim to align the common classes between the source and target domains for adaptation, but
|
| 48 |
+
37 usually train a model to learn the class "prototype" representing each annotated category. This is
|
| 49 |
+
38 particularly controversial when significant concept shift exists between samples belonging to the same
|
| 50 |
+
39 category. These differences can lead to sub-optimal feature learning and adaptation if the intra-class
|
| 51 |
+
40 structure is neglected during training. Since such kind of semantic ambiguity without fine-grained
|
| 52 |
+
41 category labels almost happens in all the DA benchmarks, all the methods will encounter this issue.
|
| 53 |
+
42 In this paper, we aim to propose a method to learn the detailed intra-class distinction and mine "sub
|
| 54 |
+
43 prototypes" for better alignment and adaptation. This kind of sub-prototype is the further subdivision
|
| 55 |
+
44 of each category-level prototype, which represents the "sub-class" of the annotated categories. The
|
| 56 |
+
45 main idea of our proposed approach lies in its utilization of a learnable memory structure to learn sub
|
| 57 |
+
46 prototypes for their corresponding sub-classes. This can optimize the construction and refinement of
|
| 58 |
+
47 the feature space, bolstering the classifier’s ability to distinguish class-wise relationships and improve
|
| 59 |
+
48 the model’s transferability across domains. A comparison between our proposed sub-prototypes
|
| 60 |
+
49 mining approach and previous methods is illustrated in Figure 1. In previous methods, samples within
|
| 61 |
+
50 a category were forced to be aligned together in the feature space regardless of whether there exist
|
| 62 |
+
51 significant differences among them because the labels were one-hot encoded. Contrastively, our
|
| 63 |
+
52 sub-prototypes’ feature space distinguishes sub-classes with apparent differences within the category,
|
| 64 |
+
53 thus improving the model’s accuracy of domain adaption and interpretability.
|
| 65 |
+
54 Our proposed approach, named memory-assisted sub-prototype mining (MemSPM), is inspired by the
|
| 66 |
+
55 memory mechanism works [17, 10, 45, 36]. In our approach, the memory generates sub-prototypes
|
| 67 |
+
56 that embody sub-classes learned from the source domain. During testing of the target samples,
|
| 68 |
+
57 the encoder produces embedding that are compared to source domain sub-prototypes learned in
|
| 69 |
+
58 the memory. Subsequently, a embedding for the query sample is generated through weighted sub
|
| 70 |
+
59 prototype sampling in the memory. This results in reduced domain shifts before the embedding give
|
| 71 |
+
60 into the classifier. Our proposal of sub-prototypes mining, which are learned from the source domain
|
| 72 |
+
61 memory, improves the universal domain adaptation performance by promoting more refined visual
|
| 73 |
+
62 concept alignment.
|
| 74 |
+
63 MemSPM approach has been evaluated on four benchmark datasets (Office-31 [37], Office-Home [46],
|
| 75 |
+
64 VisDA [33],and Domain-Net [32]), under various category shift scenarios, including PDA, OSDA,
|
| 76 |
+
65 and UniDA. Our MemSPM method achieves state-of-the-art performance in most cases. Moreover,
|
| 77 |
+
66 we design a visualization module for the sub-prototype learned by our memory to demonstrate the
|
| 78 |
+
67 interpretability of MemSPM. Our contributions can be highlighted as follows:
|
| 79 |
+
|
| 80 |
+

|
| 81 |
+
Figure 1: Illustration of our motivation. (a) Examples of concept shift and intra-class diversity in DA benchmarks. For the class of alarm clock, we find that digital clock, pointer clock and alarm bell should be set in different sub-classes. For the class of airplane, we find that images containing more than one plane, single jetliner, and turboprop aircraft should be differently treated for adaptation. (b) Previous methods utilize one-hot labels to guide classifying without considering the intra-class distinction. Consequently, the model forces all samples from the same class to converge towards a single center, disregarding the diversity in the class. Our method clusters samples with large intra-class difference into separate sub-class, providing a more accurate representation. (c) During domain adaptation by our design, the samples in the target domain can also be aligned near the sub-class centers with similar features rather than just the class centers determined by labels.
|
| 82 |
+
|
| 83 |
+
• We study the UniDA problem from a new aspect, which focuses on the negative impacts caused by overlooking the intra-class structure within a category when simply adopting one-hot labels.
|
| 84 |
+
• We propose Memory-Assisted Sub-Prototype Mining(MemSPM), which explores the memory mechanism to learn sub-prototypes for improving the model’s adaption performance and interpretability. Meanwhile, visualizations reveal the sub-prototypes stored in memory, which demonstrate the interpretability of MemSPM approach.
|
| 85 |
+
• Extensive experiments on four benchmarks verify the superior performance of our proposed MemSPM compared with previous works.
|
| 86 |
+
|
| 87 |
+
# 77 2 Related Work
|
| 88 |
+
|
| 89 |
+
78 Closed-Set Domain Adaptation (CSDA). To mitigate the performance degradation caused by
|
| 90 |
+
79 the closed-set domain shift, [16, 29, 48] introduce adversarial learning methods with the domain
|
| 91 |
+
80 discriminator, aiming to minimize the domain gap between source and target domains. Beyond
|
| 92 |
+
81 the use of the additional domain discriminator, some studies [41, 23, 50, 30, 13] have explored the
|
| 93 |
+
82 use of two task-specific classifiers, otherwise referred to as bi-classifier, to implicitly achieve the
|
| 94 |
+
83 adversarial learning. However, the previously mentioned methods for CSDA cannot be directly
|
| 95 |
+
84 applied in scenarios involving the category shift.
|
| 96 |
+
85 Partial Domain Adaptation (PDA). PDA posits that private classes are exclusive to the source
|
| 97 |
+
86 domain. Representative PDA methods, such as those discussed in [3, 49], employ domain discrimi
|
| 98 |
+
87 nators with weight adjustments or utilize source samples based on their resemblance to the target
|
| 99 |
+
88 domain [5]. Methods incorporating residual correction blocks in PDA have been introduced by Li et
|
| 100 |
+
89 al. and Liang et al. [25, 27]. Other research [7, 11, 38] explores the use of Reinforcement Learning
|
| 101 |
+
90 for source data selection within the context of PDA.
|
| 102 |
+
91 Open-Set Domain Adaptation (OSDA). Saito et al. [42] developed a classifier inclusive of an
|
| 103 |
+
92 additional ’unknown’ class intended to differentiate categories unique to the target domain. Liu et al.
|
| 104 |
+
93 [28] and Shermin et al. [43] propose assigning individual weights to each sample depending on their
|
| 105 |
+
94 importance during domain adaptation. Jang et al. [20] strive to align the source and target-known
|
| 106 |
+
95 distributions, while concurrently distinguishing the target-unknown distribution within the feature
|
| 107 |
+
96 alignment process. The above PDA and OSDA methods are limited to specific category shift.
|
| 108 |
+
97 Universal Domain Adaptation (UniDA) You et al. [47] proposed Universal Adaptation Network
|
| 109 |
+
98 (UAN) to deal with the UniDA setting that the label set of target domain is unknown. Li et al.
|
| 110 |
+
99 [24] proposed Domain Consensus Clustering to differentiate the private classes rather than treat the
|
| 111 |
+
100 unknow classes as one class. Saito et al. [40] suggested that using the minimum inter-class distance in
|
| 112 |
+
101 the source domain as a threshold can be an effective approach for distinguishing between “known” and
|
| 113 |
+
102 “unknown” samples in the target domain. However, most existing methods [24, 47, 40, 39, 6, 34, 8, 26]
|
| 114 |
+
103 overlook the intra-class distinction within one category, especially in cases where there exists
|
| 115 |
+
104 significant concept shift between the samples belonging to the same category.
|
| 116 |
+
|
| 117 |
+
# 3 Proposed Methods
|
| 118 |
+
|
| 119 |
+
# 3.1 Preliminaries
|
| 120 |
+
|
| 121 |
+
In unsupervised domain adaptation, we are provided with labeled source samples $\mathcal { D } ^ { s } = \{ x _ { i } ^ { s } , y _ { i } ^ { s } ) \} _ { i = 1 } ^ { n ^ { s } }$ and unlabeled target samples $\mathcal { D } ^ { t } = \{ ( \boldsymbol { x } _ { i } ^ { t } ) \} _ { i = 1 } ^ { n ^ { t } }$ . As the label set for each domain in UniDA setting may not be identical, we use $C _ { s }$ and $C _ { t }$ to represent label sets for the two domains, respectively.
|
| 122 |
+
|
| 123 |
+

|
| 124 |
+
Figure 2: Our model first utilizes a fixed pre-trained model as the encoder to extract input-oriented embedding given an input sample. The extracted input-oriented embedding is then compared with sub-prototypes learned in memory to find the closest $K$ . These $K$ are then weighted-averaged into a task-oriented embedding to represent the input, and used for learning downstream tasks. During the UniDA process, we adopt the cycle-consistent matching method on the task-oriented embedding $\hat { Z }$ generated from the memory. Moreover, a decoder is designed to reconstruct the image, allowing for visualizing of the sub-prototypes in memory and verifying of the effectiveness of sub-class learning.
|
| 125 |
+
|
| 126 |
+
110 Then, we denote $C = C _ { s } \cap C _ { t }$ as the common label set. $\hat { C } _ { s }$ , $\hat { C } _ { t }$ are denoted as the private label sets
|
| 127 |
+
111 of the source domain and target domain, respectively. We aim to train a model on $\mathcal { D } ^ { s }$ and $\mathcal { D } ^ { t }$ to
|
| 128 |
+
112 classify target samples into $| C | + 1$ classes, where private samples are treated as unknown class.
|
| 129 |
+
113 Our method aims to address the issue of intra-class concept shift that often exists within the labeled
|
| 130 |
+
114 categories in most datasets, which is overlooked by previous methods. Our method enables the
|
| 131 |
+
115 model to learn an adaptive feature space that better aligns fine-grained sub-class concepts, taking
|
| 132 |
+
116 into account the diversity present within each category. Let $X$ denotes the input query, $Z$ denotes the
|
| 133 |
+
117 embedding extracted by the encoder, $L$ denotes the data labels, $\hat { Z }$ denotes the embedding obtained
|
| 134 |
+
118 from the memory, $\hat { X }$ denotes the visualization of the memory, $\hat { L }$ denotes the prediction of the input
|
| 135 |
+
119 query, and the $K$ denotes the top-K relevant sub-prototypes, respectively. The overall pipeline is
|
| 136 |
+
120 presented in Figure 2. More details will be described in the following sub-sections.
|
| 137 |
+
|
| 138 |
+
# 121 3.2 Input-Oriented Embedding vs. Task-Oriented Embedding
|
| 139 |
+
|
| 140 |
+
122 Usually, the image feature extracted by a visual encoder is directly used for learning downstream tasks.
|
| 141 |
+
123 We call this kind of feature as input-oriented embedding. However, it heavily relys on the original
|
| 142 |
+
124 image content. Since different samples of the same category always varies significantly in their visual
|
| 143 |
+
125 features, categorization based on the input-oriented embedding sometimes is unattainable. In our
|
| 144 |
+
126 pipeline, we simply adopt a CLIP-based[35] pre-trained visual encoder to extract the input-oriented
|
| 145 |
+
127 embeddings, which is not directly used for learning our downstream task.
|
| 146 |
+
128 In our MemSPM, we propose to generate task-oriented embedding, which is obtained by serving
|
| 147 |
+
129 $f _ { e n c o d e } ^ { \bar { f } i x e d } ( \cdot ) : X Z$ dding as a query to retrieve the sto represent the fixed pre-traine -prototypes encoder and $f _ { c l a s s } ^ { U n i D A } ( \cdot ) : \hat { Z } \stackrel { \cdot } { } \hat { L }$ it. We defineto represent
|
| 148 |
+
131 the UniDA classifier. The input-oriented embedding $Z$ is used to retrieve the relevant sub-prototypes
|
| 149 |
+
132 from the memory. The task-oriented embedding $\hat { Z }$ is obtained using the retrieved sub-prototypes for
|
| 150 |
+
133 classification tasks. In conventional ways, $\hat { Z } = Z$ , which means the $\hat { Z }$ is obtained directly from $Z$ .
|
| 151 |
+
134 Our method obtains the $\hat { Z }$ by retrieving the sub-prototypes from the memory, which differenciates $\hat { Z }$
|
| 152 |
+
135 136 with phas $Z$ , and eliminates the domain-specific infor As a result, it improves the performance of $f _ { c l a s s } ^ { U n i D A } ( \cdot )$ the target domain during the testing when performing UniDA.
|
| 153 |
+
|
| 154 |
+
# 37 3.3 Memory-Assisted Sub-Prototype Mining
|
| 155 |
+
|
| 156 |
+
138 The memory module proposed in MemSPM consists of two key components: a memory unit
|
| 157 |
+
139 responsible for learning sub-prototypes, and an attention-based addressing [18] operator to obtain
|
| 158 |
+
140 better task-oriented representation $\hat { Z }$ for the query, which is more domain-invariant.
|
| 159 |
+
142 The memory in MemSPM is represented as a matrix, denoted by $M \in \mathbb { R } ^ { N \times S \times D }$ , where $N$ indicates
|
| 160 |
+
143 the number of memory items stored, $S$ refers to the number of sub-prototypes partitioned in each
|
| 161 |
+
144 memory item, and $D$ represents the dimension of each sub-prototype. For convenience, we assume $D$
|
| 162 |
+
145 is the same to the dimension of $Z \in \mathbb { R } ^ { C } ( \mathbb { R } ^ { D } = \mathbb { R } ^ { C } )$ . Let the vector $m _ { i , j }$ , $\forall i \in [ N ]$ denote the $i$ -th row
|
| 163 |
+
146 of $M$ , where $[ N ]$ denotes the set of integers from 1 to $N$ , $\forall j \in [ S ]$ denote the $j$ -th sub-prototype of
|
| 164 |
+
147 $M$ items, where $\big [ S \big ]$ denotes the set of integers from 1 to $S$ . Each $m _ { i }$ denotes a memory item. Given a
|
| 165 |
+
148 embedding $Z \in \mathbb { R } ^ { D }$ , the memory module obtains $\hat { Z }$ through a soft addressing vector $W \in \mathbb { R } ^ { 1 \times 1 \times N }$
|
| 166 |
+
149 as follows:
|
| 167 |
+
|
| 168 |
+
$$
|
| 169 |
+
\begin{array} { r } { \hat { Z } = W \cdot M = \Sigma _ { i = 1 } ^ { N } w _ { i , j = s _ { i } } \cdot m _ { i , j = s _ { i } } , } \\ { w _ { i , j = s _ { i } } = \mathrm { a r g m a x } ( w _ { i , j } , d i m = 1 ) , \qquad } \end{array}
|
| 170 |
+
$$
|
| 171 |
+
|
| 172 |
+
151 where $W$ is a vector with non-negative entries that indicate the max attention weight of each item’s
|
| 173 |
+
152 sub-prototype, $s _ { i }$ denotes the index of the sub-prototype in the $i$ -th item and $w _ { i , j = s _ { i } }$ denotes the
|
| 174 |
+
153 $i , j = s _ { i }$ -th entry of $W$ . The hyperparameter $N$ determines the maximum capacity for memory items
|
| 175 |
+
154 and the hyper-parameter $S$ defines the number of sub-prototypes in each memory item. The effect of
|
| 176 |
+
155 different setting of hyper-parameters is evaluated in Section 4.
|
| 177 |
+
|
| 178 |
+
# 3.3.2 Sub-Prototype Addressing and Retrieving
|
| 179 |
+
|
| 180 |
+
157 In MemSPM, the memory $M$ is designed to learn the sub-prototypes to represent the input-oriented
|
| 181 |
+
158 embedding $Z$ . We define the memory as a content addressable memory [17, 10, 45, 36] that allows
|
| 182 |
+
159 for direct referencing of the content of the memory being matched. The sub-prototype is retrieved by
|
| 183 |
+
160 attention weights $W$ which are computed based on the similarity between the sub-prototypes in the
|
| 184 |
+
161 memory items and the input-oriented embedding $Z$ . To calculate the weight $w _ { i , j }$ , we use a softmax
|
| 185 |
+
162 operation:
|
| 186 |
+
|
| 187 |
+
$$
|
| 188 |
+
w _ { i , j } = \frac { \exp ( d ( z , m _ { i , j } ) ) } { \Sigma _ { n = 1 } ^ { N } \Sigma _ { s = 1 } ^ { S } \exp ( d ( z , m _ { n , s } ) ) } ,
|
| 189 |
+
$$
|
| 190 |
+
|
| 191 |
+
163 where $d ( \cdot , \cdot )$ denotes cosine similarity measurement. As indicated by Eq. 1 and 3, the memory
|
| 192 |
+
164 module retrieves the sub-prototype that is most similar to $Z$ from each memory item in order to
|
| 193 |
+
165 obtain the new representation embedding $\hat { Z }$ . As a consequence of utilizing the adaptive threshold
|
| 194 |
+
166 addressing technique(Section 3.3.3), only the $K$ can be utilized to obtain a task-oriented embedding
|
| 195 |
+
167 $\hat { Z }$ , that serves to represent the encoded embedding $Z$ .
|
| 196 |
+
|
| 197 |
+
# 3.3.3 Adaptive Threshold Technique for More Efficient Memory
|
| 198 |
+
|
| 199 |
+
169 Limiting the amount of sub-prototypes retrieved can enhance memory utilization and avoid negative
|
| 200 |
+
170 impacts on unrelated sub-prototypes during model parameter updates. Despite the natural reduction
|
| 201 |
+
171 in the number of selected memory items, the attention-based addressing mechanism may still lead to
|
| 202 |
+
172 the combination of small attention weight items into the output embedding $\hat { Z }$ , which have negative
|
| 203 |
+
173 impact on the classifier and sub-prototypes in the memory. Therefore, it is necessary to impose a
|
| 204 |
+
174 mandatory quantity limit on the amount of the relevant sub-prototypes retrieved. To address this
|
| 205 |
+
175 issue, we apply a adaptive threshold operation to restrict the amount of sub-prototypes retrieved in a
|
| 206 |
+
176 forward process.
|
| 207 |
+
|
| 208 |
+
$$
|
| 209 |
+
\hat { w } _ { i , j = s _ { i } } = \left\{ { \begin{array} { l l } { w _ { i , j = s _ { i } } , } & { w _ { i , j = s _ { i } } > \lambda } \\ { 0 , } & { \mathrm { o t h e r } } \end{array} } \right.
|
| 210 |
+
$$
|
| 211 |
+
|
| 212 |
+
177 where $\hat { w } _ { i , j = s _ { i } }$ denotes the $i , j = s _ { i }$ -th entry of $\hat { w }$ , the $\lambda$ denotes the adaptive threshold:
|
| 213 |
+
|
| 214 |
+
$$
|
| 215 |
+
\lambda = \operatorname { a r g m i n } ( t o p k ( w ) ) .
|
| 216 |
+
$$
|
| 217 |
+
|
| 218 |
+
178 Directly implementing the backward for the discontinuous function in Eq. 4 is not a easy task. For
|
| 219 |
+
179 simplicity, we use the method [17]that rewrites the operation using the continuous ReLU activation
|
| 220 |
+
180 function as:
|
| 221 |
+
|
| 222 |
+
$$
|
| 223 |
+
\hat { w } _ { i , j = s _ { i } } = \frac { \operatorname* { m a x } ( w _ { i , j = s _ { i } } - \lambda ) \cdot w _ { i , j = s _ { i } } } { | w _ { i , j = s _ { i } } - \lambda | + \epsilon } ,
|
| 224 |
+
$$
|
| 225 |
+
|
| 226 |
+
181 where $m a x ( \cdot , 0 )$ is commonly referred to as the ReLU activation function, and $\epsilon$ is a small positive
|
| 227 |
+
182 scalar. The prototype $\hat { Z }$ will be obtained by $\hat { Z } \ : = \ : \hat { W } \ : \cdot \ : M$ . The adaptive threshold addressing
|
| 228 |
+
183 encourages the model to represent embedding $Z$ using fewer but more relevant sub-prototypes,
|
| 229 |
+
184 leading to learning more effective feature in memory and reducing the impact on irrelevant sub
|
| 230 |
+
185 prototypes.
|
| 231 |
+
|
| 232 |
+
# 3.4 Visualization and Interpretability
|
| 233 |
+
|
| 234 |
+
We denote 7 what has b $f _ { d e c o d e } ^ { u n f i x e d } ( \cdot ) : \hat { Z } \hat { X }$ to represent the decoder. The decoder is trained to visualizeory by taking the retrieved sub-prototype as input. From an interpretability perspective, each encoded embedding $Z$ calculates the cosine similarity to find the top- $K$ fitting sub-prototype representation for the given input-oriented embedding. Then, these sub-prototypes are combined to represent the $Z$ in $\hat { Z }$ . The sub-prototype in this process can be 2 regarded as the visual description for the input embedding $Z$ . In other word, the input image is much like the sub-classes represented by these sub-prototypes. In this way, samples with significant intra-class differences will be matched to different sub-prototypes, thereby distinguishing different sub-classes. The use of a reconstruction auxiliary task can visualize the sub-prototypes in memory 6 to confirm whether our approach has learned intra-class differences for the annotated category. The results of this visualization are demonstrated in Figure 3.
|
| 235 |
+
|
| 236 |
+
# 3.5 Cycle-Consistent Alignment and Adaption
|
| 237 |
+
|
| 238 |
+
Once the sub-prototypes are mined through memory learning, the method of cycle-consistent matching, inspired by DCC [24], is employed to align the embedding $\hat { Z }$ . The cycle-consistent matching is preferred due to it can provides a better fit to the memory structure compared to other UniDA methods. The other method, One-vs-All Network (OVANet), proposed by Saito et al. [40], needs to train the memory multiple times, which can lead to a significant computational overhead. In brief, the Cycle-Consistent Alignment provides a solution by iteratively learning a consensus set of clusters between the two domains. The consensus clusters are identified based on the similarity of the prototypes, which is measured using a similarity metric. The similarity metric is calculated on the feature representations of the prototypes. For unknown classes, we set the size $N$ of our memory during the initial phase to be larger than the number of possible sub-classes that may be learned in the source domain. This size is a hyperparameter that is adjusted based on the dataset size. Redundant sub-prototypes are invoked to represent the $\hat { Z }$ , when encountering unknown classes, allowing for an improved distance separation between unknown and known classes in the feature space.
|
| 239 |
+
|
| 240 |
+
Training Objective. The adaptation loss in our training is similar to that of DCC, as $\mathcal { L } _ { D A }$
|
| 241 |
+
|
| 242 |
+
$$
|
| 243 |
+
\mathcal { L } _ { D A } = \mathcal { L } _ { c e } + \lambda _ { 1 } \mathcal { L } _ { c d d } + \lambda _ { 2 } \mathcal { L } _ { r e g } ,
|
| 244 |
+
$$
|
| 245 |
+
|
| 246 |
+
213 where the $\mathcal { L } _ { c e }$ denotes the cross-entropy loss on source samples, $\mathcal { L } _ { c d d }$ denotes the domain alignment
|
| 247 |
+
14 loss and $\mathcal { L } _ { r e g }$ denotes the regularizer. For the auxiliary reconstruction task, we add a mean-squared
|
| 248 |
+
15 error (MSE) loss function, denoted as $\mathcal { L } _ { r e c }$ . Thus, the model is optimized with:
|
| 249 |
+
|
| 250 |
+
$$
|
| 251 |
+
\begin{array} { r } { \mathcal { L } = \mathcal { L } _ { D A } + \lambda _ { 3 } \mathcal { L } _ { r e c } = \mathcal { L } _ { c e } + \lambda _ { 1 } \mathcal { L } _ { c d d } + \lambda _ { 2 } \mathcal { L } _ { r e g } + \lambda _ { 3 } \mathcal { L } _ { r e c } . } \end{array}
|
| 252 |
+
$$
|
| 253 |
+
|
| 254 |
+
# 4 Experiments
|
| 255 |
+
|
| 256 |
+
# 17 4.1 Datasets and Evaluation Metrics
|
| 257 |
+
|
| 258 |
+
We first conduct the experiments in the UniDA setting [47] where private classes exist in both domains. Moreover, we also evaluate our approach on two other sub-cases, namely Open-Set Domain Adaptation (OSDA) and Partial Domain Adaptation (PDA).
|
| 259 |
+
|
| 260 |
+
221 Datasets. Our experiments are conducted on four datasets: Office-31 [37], which con
|
| 261 |
+
222 tains 4652 images from three domains (DSLR, Amazon, and Webcam); OfficeHome
|
| 262 |
+
|
| 263 |
+
Table 2: H-score $( \% )$ comparison in UniDA scenario on DomainNet, VisDA and Office-31,some results are cited from [24, 34]
|
| 264 |
+
|
| 265 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Backbone</td><td colspan="7">DomainNet</td><td>VisDA</td><td colspan="7">Office-31</td></tr><tr><td>P2R</td><td>P2S</td><td>R2P</td><td>R2S</td><td>S2P</td><td>S2R</td><td>Avg</td><td>S2R</td><td>A2D</td><td>A2W</td><td>D2A</td><td>D2W</td><td>W2A</td><td>W2D</td><td>Avg</td></tr><tr><td>UAN [47]</td><td rowspan="7"></td><td>41.9 50.8</td><td>39.1</td><td>43.6</td><td>38.7</td><td>38.9</td><td>43.7</td><td>41.0</td><td>34.8</td><td>59.7</td><td>58.6</td><td>60.1</td><td>70.6</td><td>60.3</td><td>71.4</td><td>63.5</td></tr><tr><td>CMU [14]</td><td></td><td>45.1</td><td>52.2</td><td>45.6</td><td>44.8</td><td>51.0</td><td>48.3</td><td>32.9</td><td>68.1</td><td>67.3</td><td>71.4</td><td>79.3</td><td>72.2</td><td>80.4</td><td>73.1</td></tr><tr><td>DCC [24]</td><td>56.9</td><td>43.7</td><td>50.3</td><td>43.3</td><td>44.9</td><td>56.2</td><td>49.2</td><td>43.0</td><td>88.5</td><td>78.5</td><td>70.2</td><td>79.3</td><td>75.9</td><td>88.6</td><td>80.2</td></tr><tr><td>OVANet [40]</td><td>56.0 ResNet50</td><td>47.1</td><td>51.7</td><td>44.9</td><td>47.4</td><td>57.2</td><td>50.7</td><td>53.1</td><td>85.8</td><td>79.4</td><td>80.1</td><td>95.4</td><td>84.0</td><td>94.3</td><td>86.5</td></tr><tr><td>UMAD [26]</td><td>59.0</td><td>44.3</td><td>50.1</td><td>42.1</td><td>32.0</td><td>55.3</td><td>47.1</td><td>58.3</td><td>79.1</td><td>77.4</td><td>87.4</td><td>90.7</td><td>90.4</td><td>97.2</td><td>87.0</td></tr><tr><td>GATE [8]</td><td>57.4</td><td>48.7</td><td>52.8</td><td>47.6</td><td>49.5</td><td>56.3</td><td>52.1</td><td>56.4</td><td>87.7</td><td>81.6</td><td>84.2</td><td>94.8</td><td>83.4</td><td>94.1</td><td>87.6</td></tr><tr><td>UniOT [6]</td><td>59.3</td><td>47.8</td><td>51.8</td><td>46.8</td><td>48.3</td><td>58.3</td><td>52.0</td><td>57.3</td><td>83.7</td><td>85.3</td><td>71.4</td><td>91.2</td><td>70.9</td><td>90.84</td><td></td><td>82.2</td></tr><tr><td>GLC [34]</td><td rowspan="3"></td><td>63.3</td><td>50.5</td><td>54.9</td><td>50.9</td><td>49.6</td><td>61.3</td><td>55.1</td><td>73.1</td><td>81.5</td><td>84.5</td><td>89.8</td><td>90.4</td><td>88.4</td><td>92.3</td><td>87.8</td></tr><tr><td>GLC [34]</td><td>51.2</td><td>44.5</td><td>55.6</td><td>43.1</td><td>47.0</td><td>39.1</td><td>46.8</td><td>80.3</td><td>80.5</td><td>80.4</td><td>77.5</td><td>95.6</td><td>77.7</td><td>96.9</td><td>84.8</td></tr><tr><td>DCC [24]</td><td>ViT-B/16 61.1</td><td>38.8</td><td>51.8</td><td>49.3</td><td>49.1</td><td>60.3</td><td>52.2</td><td>61.2</td><td>82.2</td><td>76.9</td><td>83.6</td><td>75.2</td><td>85.8</td><td>88.7</td><td>82.1</td></tr><tr><td>MemSPM+DCC</td><td></td><td>62.4</td><td>52.8</td><td>58.5</td><td>53.3</td><td>50.4</td><td>62.6</td><td>56.7</td><td>79.3</td><td>88.0</td><td>84.6</td><td>88.7</td><td>87.6</td><td>87.9</td><td>94.3</td><td>88.5</td></tr></table>
|
| 266 |
+
|
| 267 |
+
Table 3: H-score $( \% )$ comparison in UniDA scenario on Office-Home, some results are cited from [24, 34]
|
| 268 |
+
|
| 269 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Backbone</td><td colspan="10">Office-Home</td></tr><tr><td>Ar2C1 Ar2Pr</td><td>Ar2Rw</td><td></td><td>Cl2Ar</td><td>Cl2Pr</td><td>Cl2Rw</td><td>Pr2Ar</td><td>Pr2Cl</td><td>Pr2Rw</td><td>Rw2Ar Rw2Cl</td><td>Rw2Pr</td><td>Avg</td></tr><tr><td>UAN [47]</td><td rowspan="5"></td><td>51.6 51.7</td><td>54.3</td><td>61.7</td><td>57.6</td><td>61.9</td><td>50.4</td><td>47.6</td><td>61.5</td><td>62.9</td><td>52.6</td><td>65.2</td><td>56.6</td></tr><tr><td>CMU [14]</td><td>56.0</td><td>56.9</td><td>59.2</td><td>67.0</td><td>64.3 67.8</td><td>54.7</td><td>51.1</td><td>66.4</td><td>68.2</td><td>57.9</td><td>69.7</td><td>61.6</td></tr><tr><td>DCC [24]</td><td>58.0</td><td>54.1</td><td>58.0</td><td>74.6</td><td>70.6 77.5</td><td>64.3</td><td>73.6</td><td>74.9</td><td>81.0</td><td>75.1</td><td>80.4</td><td>70.2</td></tr><tr><td>OVANet [40]</td><td>62.8 ResNet50</td><td>75.6</td><td>78.6</td><td>70.7</td><td>68.8 75.0</td><td>71.3</td><td>58.6</td><td>80.5</td><td>76.1</td><td>64.1</td><td>78.9</td><td>71.8</td></tr><tr><td>UMAD [26]</td><td>61.1</td><td>76.3</td><td>82.7</td><td>70.7 67.7</td><td>75.7</td><td>64.4</td><td>55.7</td><td>76.3</td><td>73.2</td><td>60.4</td><td>77.2</td><td>70.1</td></tr><tr><td>GATE[8]</td><td rowspan="4"></td><td>63.8</td><td>75.9</td><td>81.4</td><td>74.0 72.1</td><td>79.8</td><td></td><td>74.7</td><td>70.3</td><td>82.7</td><td>79.1</td><td>71.5 81.7</td><td></td><td>75.6</td></tr><tr><td>UniOT [6]</td><td>67.2</td><td>80.5</td><td>86.0</td><td>73.5</td><td>77.3</td><td>84.3</td><td>75.5</td><td>63.3</td><td>86.0</td><td>77.8</td><td>65.4</td><td></td><td>76.6</td></tr><tr><td>GLC [34]</td><td>64.3</td><td>78.2</td><td>89.8</td><td>63.1</td><td>81.7</td><td>89.1</td><td>77.6</td><td>54.2</td><td>88.9</td><td>80.7</td><td>54.2</td><td>81.9 85.9</td><td>75.6</td></tr><tr><td>GLC [34]</td><td>68.5</td><td>89.8</td><td>91.0</td><td>82.4</td><td>88.1</td><td>89.4</td><td>82.1</td><td>69.7</td><td>88.2</td><td>82.4</td><td>70.9</td><td></td><td>82.6</td></tr><tr><td>DCC [24]</td><td rowspan="3">ViT-B/16</td><td>62.6</td><td>88.7</td><td>87.4</td><td>63.3</td><td>68.5</td><td>79.3</td><td>67.9</td><td>63.8</td><td>82.4</td><td>70.7</td><td>69.8</td><td>88.9 87.5</td><td>74.4</td></tr><tr><td>MemSPM+DCC</td><td>78.1</td><td>90.3</td><td>90.7</td><td>81.9</td><td>90.5</td><td>88.3</td><td>79.2</td><td>77.4</td><td>87.8</td><td>78.8</td><td>76.2</td><td>91.6</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>84.2</td></tr></table>
|
| 270 |
+
|
| 271 |
+
223 [46], a more difficult dataset consisting of 15500 images across 65 categories and 4
|
| 272 |
+
224 domains (Artistic images, Clip-Art images, Product images, and Real-World images);
|
| 273 |
+
225 VisDA [33], a large-scale dataset with a synthetic source do
|
| 274 |
+
226 main of 15K images and a real-world target domain of 5K
|
| 275 |
+
227 images; and DomainNet [32], the largest domain adaptation
|
| 276 |
+
228 dataset with approximately 600,000 images. Similar to pre
|
| 277 |
+
229 vious studies [14], we evaluate our model on three subsets of
|
| 278 |
+
230 DomainNet (Painting, Real, and Sketch).
|
| 279 |
+
|
| 280 |
+
As in previous work [24, 41, 2, 4, 47], we divide the label set into three groups: common classes $C$ , source-private classes $\hat { C } _ { s }$ , and target-private classes $\hat { C } _ { t }$ . The separation of classes for each of the four datasets is shown in Table 1 and is determined according to alphabetical order.
|
| 281 |
+
|
| 282 |
+
Table 1: The division on label set, Common Class $( C )$ / Source-Private Class $( \hat { C } _ { s } )$ / Target Private Class $( \hat { C } _ { t } )$ .
|
| 283 |
+
|
| 284 |
+
<table><tr><td rowspan="2">Dataset</td><td colspan="3">ClassSplit(C/C/Ct)</td></tr><tr><td>PDA</td><td>OSDA</td><td>UniDA</td></tr><tr><td>Office-31</td><td>10/21/0</td><td>10/0/11</td><td>10/10/11</td></tr><tr><td>OfficeHome</td><td>25/40/0</td><td>25/0/40</td><td>10/5/50</td></tr><tr><td>VisDA</td><td>6/6/0</td><td>6/0/6</td><td>6/3/3</td></tr><tr><td>DomainNet</td><td></td><td></td><td>150/50/145</td></tr></table>
|
| 285 |
+
|
| 286 |
+
Evaluation Metrics. We report the averaged results of three runs. For the PDA scenario, we calculate the classification accuracy over all target samples. The usual metrics adopted to evaluate OSDA are the average class accuracy over the known classes $O S ^ { * }$ , and the accuracy of the unknown class $U N K$ . In the OSDA and UniDA scenarios, we consider the balance between “known” and “unknown” categories and report the H-score [1]:
|
| 287 |
+
|
| 288 |
+
$$
|
| 289 |
+
{ \mathrm { H - s c o r e } } = 2 \times { \frac { O S ^ { * } \times U N K } { O S ^ { * } + U N K } } ,
|
| 290 |
+
$$
|
| 291 |
+
|
| 292 |
+
240 which is the harmonic mean of the accuracy of “known” and “unknown” samples.
|
| 293 |
+
|
| 294 |
+
Implementation Details. Our implementation is based on PyTorch [31]. We use ViT-B/16 [12] as the backbone pretrained by CLIP [35] for the MemSPM is hard to train with a randomly initialized encoder. The classifier consists of two fully-connected layers, which follows the previous design [4, 47, 41, 14, 24]. The weights in the $\mathcal { L }$ are empirically set as $\lambda _ { 1 } = 0 . 1$ , $\lambda _ { 2 } = 3$ and $\lambda _ { 3 } = 0 . 5$ fellow DCC [24]. For a fair comparison, we also adopt ViT-B/16 as backbone for DCC [24] and state-ofart method GLC [34]. We use the official code of DCC [24] (https://github.com/Solacex/ Domain-Consensus-Clustering) and GLC [34] (https://github.com/ispc-lab/GLC).
|
| 295 |
+
|
| 296 |
+
Table 4: H-score $( \% )$ comparison in OSDA scenario on Office-Home, VisDA and Office-31, some results are cited from [24, 34]
|
| 297 |
+
|
| 298 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Backbone</td><td colspan="10">Office-Home</td><td rowspan="2"></td><td></td><td></td><td>Office-31</td><td>VisDA</td></tr><tr><td>Ar2CI</td><td>Ar2Pr</td><td>Ar2Rw</td><td>Cl2Ar</td><td>Cl2Pr</td><td>Cl2Rw</td><td>Pr2Ar</td><td>Pr2C1 Pr2Rw</td><td></td><td>Rw2Ar</td><td>Rw2Cl Rw2Pr</td><td>Avg</td><td>Avg</td><td>Avg</td></tr><tr><td>OSBP [41]</td><td rowspan="7"></td><td>55.1 55.0</td><td>65.2</td><td>72.9</td><td>64.3 59.3</td><td>64.7</td><td>70.6</td><td>63.2</td><td>53.2</td><td>73.9</td><td>66.7</td><td>54.5</td><td>72.3</td><td>64.7</td><td>83.7 65.2</td><td>52.3</td></tr><tr><td>CMU [14]</td><td rowspan="7"></td><td>57.0</td><td>59.0</td><td></td><td>58.2</td><td>60.6</td><td>59.2</td><td>51.3</td><td>61.2</td><td>61.9</td><td>53.5</td><td></td><td>55.3</td><td>57.6</td><td>54.2</td></tr><tr><td>DCC [24]</td><td>56.1</td><td>67.5</td><td>66.7</td><td>49.6 66.5</td><td>64.0</td><td>55.8</td><td>53.0</td><td>70.5</td><td>61.6</td><td>57.2</td><td>71.9</td><td>61.7</td><td>72.7</td><td>59.6</td></tr><tr><td>OVANet [40]</td><td>58.6</td><td>66.3</td><td>69.9</td><td>62.0</td><td>65.2 68.6</td><td>59.8</td><td>53.4</td><td>69.3</td><td>68.7</td><td>59.6</td><td>66.7</td><td>64.0</td><td>91.7</td><td>66.1</td></tr><tr><td>UMAD [26]</td><td>59.2</td><td>71.8</td><td>76.6</td><td>63.5</td><td>69.0 71.9</td><td>62.5</td><td>54.6</td><td>72.8</td><td>66.5</td><td>57.9</td><td>70.7</td><td>66.4</td><td>89.8</td><td>66.8</td></tr><tr><td>GATE [8]</td><td>63.8</td><td>70.5</td><td>75.8</td><td>66.4</td><td>67.9</td><td>71.7</td><td>67.3 61.5</td><td>76.0</td><td>70.4</td><td>61.8</td><td>75.1</td><td>69.0</td><td>89.5</td><td>70.8</td></tr><tr><td>ROS [6]</td><td>60.1</td><td>69.3</td><td>76.5</td><td>58.9</td><td>65.2</td><td>68.6 60.6</td><td>56.3</td><td>74.4</td><td>68.8</td><td>60.4</td><td>75.7</td><td>66.2</td><td>85.9</td><td>66.5</td></tr><tr><td>GLC [34]</td><td rowspan="3"></td><td>65.3</td><td>74.2</td><td>79.0</td><td>60.4</td><td>71.6</td><td>74.7</td><td>63.7</td><td>63.2 75.8</td><td></td><td>67.1</td><td>64.3</td><td>77.8</td><td>69.8</td><td>89.0</td><td>72.5</td></tr><tr><td>GLC [34]</td><td>68.4</td><td>81.7</td><td>84.5</td><td>76.0</td><td>82.4</td><td>83.8</td><td>69.9</td><td>59.6</td><td>84.6</td><td>73.3</td><td>66.8</td><td>83.9</td><td>76.2</td><td>90.1</td><td>81.6</td></tr><tr><td>DCC [24]</td><td>ViT-B/16 62.9</td><td>73.3</td><td>78.4</td><td>49.8</td><td>69.2</td><td>75.0</td><td>59.3</td><td>61.5</td><td>80.9</td><td>68.1</td><td>62.5</td><td>80.0</td><td>68.4</td><td>81.9</td><td>66.2</td></tr><tr><td>MemSPM+DCC</td><td rowspan="2"></td><td>69.7</td><td>83.2</td><td>85.2</td><td>72.0</td><td>79.2</td><td>81.2</td><td>72.3</td><td>66.7</td><td>85.2</td><td>72.7</td><td>66.0</td><td>84.5</td><td>76.5</td><td>95.6</td><td>79.7</td></tr></table>
|
| 299 |
+
|
| 300 |
+
Table 5: H-score $( \% )$ comparison in PDA scenario on Office-Home, VisDA and Office-31, some results are cited from [24, 34]
|
| 301 |
+
|
| 302 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Backbone</td><td colspan="10">Office-Home</td><td colspan="4"></td><td>Office-31 VisDA</td></tr><tr><td>Ar2C1</td><td>Ar2Pr</td><td>Ar2Rw</td><td>Cl2Ar</td><td>C12Pr</td><td>Cl2Rw</td><td>Pr2Ar</td><td>Pr2C1</td><td>Pr2Rw</td><td>Rw2Ar</td><td>Rw2Cl</td><td>Rw2Pr</td><td>Avg</td><td>Avg</td><td>Avg</td></tr><tr><td>ETN [5]</td><td rowspan="7"></td><td>59.2 60.6</td><td>77.0</td><td>79.5</td><td>62.9</td><td>65.7</td><td>75.0</td><td>68.3</td><td>55.4</td><td>84.4</td><td>75.7</td><td>57.7</td><td>84.5</td><td>70.4</td><td>96.7</td><td>59.8</td></tr><tr><td>BA3US [27]</td><td>54.2</td><td>83.2</td><td>88.4</td><td>71.8</td><td>72.8</td><td>83.4</td><td>75.5</td><td>61.6</td><td>86.5</td><td>79.3</td><td>62.8</td><td>86.1</td><td>76.0</td><td>97.8</td><td>54.9</td></tr><tr><td>DCC [24]</td><td rowspan="5">ResNet50</td><td>47.5</td><td>57.5</td><td></td><td>83.8 71.6</td><td>86.2</td><td>63.7</td><td>65.0</td><td>75.2</td><td>85.5</td><td>78.2</td><td>82.6</td><td>70.9</td><td>93.3</td><td>72.4</td></tr><tr><td>OVANet [40]</td><td>34.1</td><td>54.6</td><td>72.1</td><td>42.4</td><td>47.3 55.9</td><td>38.2</td><td>26.2</td><td>61.7</td><td>56.7</td><td>35.8</td><td>68.9</td><td>49.5</td><td>74.6</td><td>34.3</td></tr><tr><td>UMAD [26]</td><td>51.2</td><td>66.5</td><td>79.2</td><td>63.1</td><td>62.9</td><td>68.2 63.3</td><td>56.4</td><td>75.9</td><td>74.5</td><td>55.9</td><td>78.3</td><td>66.3</td><td>89.5</td><td>68.5</td></tr><tr><td>GATE [8]</td><td>55.8</td><td>75.9</td><td>85.3</td><td>73.6</td><td>70.2 83.0</td><td>72.1</td><td>59.5</td><td>84.7</td><td>79.6</td><td>63.9</td><td>83.8</td><td>74.0</td><td>93.7</td><td>75.6</td></tr><tr><td>GLC [34]</td><td>55.9</td><td>79.0</td><td>87.5</td><td>72.5</td><td>71.8</td><td>82.7</td><td>74.9</td><td>41.7</td><td>82.4</td><td>77.3</td><td>60.4</td><td>84.3</td><td>72.5</td><td>94.1</td><td>76.2</td></tr><tr><td>GLC [34]</td><td rowspan="3">ViT-B/16</td><td>63.2</td><td>80.7</td><td>86.5</td><td>76.0</td><td>77.9</td><td>84.1</td><td>74.5</td><td>56.8</td><td>84.7</td><td>79.8</td><td>57.4</td><td>83.0</td><td>75.4</td><td>91.5</td><td>86.2</td></tr><tr><td>DCC [24]</td><td>59.4</td><td>78.8</td><td>83.2</td><td>61.95</td><td>78.6</td><td>79.3</td><td>64.2</td><td>44.4</td><td>82.9</td><td>76.5</td><td>70.7</td><td>84.6</td><td>72.1</td><td>93.7</td><td>79.8</td></tr><tr><td>MemSPM+DCC</td><td>64.7</td><td>81.1</td><td>84.5</td><td>74.8</td><td>74.7</td><td>77.5</td><td>58.7</td><td>60.3</td><td>84.2</td><td>70.3</td><td>77.2</td><td>85.8</td><td>74.5</td><td>94.4</td><td>87.9</td></tr></table>
|
| 303 |
+
|
| 304 |
+
# 248 4.2 Comparison with State-of-The-Arts
|
| 305 |
+
|
| 306 |
+
We compare our method with previous state-of-the-art algorithms in three sub-cases of unsupervised domain adaptation, namely, object-specific domain adaptation (OSDA), partial domain adaptation (PDA), and universal domain adaptation (UniDA). In UniDA, we compare our method to previous universal domain adaptation approaches, which do not take into account the prior that private classes exist only in either the source domain (PDA) or the target domain (OSDA). Additionally, we compare our method to the OSDA and PDA baselines that consider the prior information unique to each sub-case.
|
| 307 |
+
|
| 308 |
+
Results on UniDA. In the most challenging setting, i.e. UniDA, our MemSPM approach achieves the state-of-the-art performance. Table 2 shows the results on DomainNet, VisDA and Office-31, and result of Office-Home is summarized in Table 3. We mainly compare with GLC and DCC using ViT-B/16 as backbone. On Office-31, the $\mathbf { M e m S P M + D C C }$ outperform previous state-of-art method GLC by $3 . 7 \%$ and surpasses the DCC by $6 . 4 \%$ . On visda, our method surpasses the DCC by a huge margin of $1 6 . 1 \%$ . Our method also surpasses the GLC by $9 . 9 \%$ and the DCC by $4 . 5 \%$ on DomainNet. On the Office-Home, we surpasses the DCC by $9 . 8 \%$ and the GLC by $3 . 7 \%$ .
|
| 309 |
+
|
| 310 |
+
Results on OSDA and PDA. In table 4 and table 5, we present the results on Office-Home, Office-31 and VisDA under OSDA and PDA scenarios. In the OSDA scenario, $\mathbf { M e m S P M + D C C }$ still achieves state-of-the-art performance. Specifically, $\mathbf { M e m S P M + D C C }$ obtains $9 5 . 6 \%$ H-score on Office-31, with an improvement of $5 . 5 \%$ compared to GLC and $1 3 . 7 \%$ compared to DCC. In the PDA scenario, MemSPM still achieves comparable performance compared to methods tailored for PDA. The MemSPM+DCC surpasses the DCC by $8 . 1 \%$ on the VisDA.
|
| 311 |
+
|
| 312 |
+
# 69 4.3 Ablation Studies
|
| 313 |
+
|
| 314 |
+
Visualization with Reconstruction and tSNE We first visualize what the memory learns from OfficeHome by sampling a single sub-prototype and adapting an auxiliary reconstruction task: $X { \hat { X } }$ . We also provide the tSNE of the $\hat { Z }$ which retrieving the most related sub-prototypes. The visualization is shown in Figure 3. The tSNE visualization depicts the distribution of sub-classes within each category, indicative of MemSPM’s successful mining of sub-prototypes. The reconstruction visualization shows what have been learned by MemSPM, demonstrating its ability to capture intra-class diversity.
|
| 315 |
+
|
| 316 |
+

|
| 317 |
+
Figure 3: (a) The tSNE visualization shows the feature space of the sub-classes belonging to the each category, which demonstrate the MemSPM mining the sub-prototypes successfully. (b) The results of different values of $S$ and $N$ . (c) The reconstruction visualization shows what have been learned in the memory, which demonstrate the intra-class diversity have been learned by MemSPM.
|
| 318 |
+
|
| 319 |
+
276 Effect of Memory-Assisted Sub-Prototype Mining. As the results shown in table 2, table 3, table 4
|
| 320 |
+
277 and table 5, the MemSPM $^ +$ DCC evaluted on four benchmarks has surpassed the DCC on UniDA,
|
| 321 |
+
278 OSDA and PDA scenarios. The MemSPM can significantly improve the performance of the DCC
|
| 322 |
+
279 when using ViT-B/16 as backbone. The reason for utilizing the ViT-B/16 is that the memory module
|
| 323 |
+
280 of the MemSPM with huge latent space is initialized by randomly normal distribution, which make it
|
| 324 |
+
281 hard to retrieve the different sub-prototypes at early stages of training. So, we need ViT as backbone,
|
| 325 |
+
282 which have learned a more global feature space.
|
| 326 |
+
283 Sensitivity to Hyper-parameters. We conducted experiments on the VisDA dataset under the UniDA
|
| 327 |
+
284 setting to demonstrate the impact of hyperparameters $S$ and $N$ on the performance of our method.
|
| 328 |
+
285 The impact of $S$ are shown in Figure 3. When $S \geq 2 0$ , the performance achieve a comparable level.
|
| 329 |
+
286 At the same time, the performance of the model is not sensitive to the value of $N$ , when $S = 3 0$ .
|
| 330 |
+
|
| 331 |
+
# 287 5 Conclusion
|
| 332 |
+
|
| 333 |
+
288 In this paper, we propose the Memory-Assisted Sub-Prototype Mining (MemSPM) method, which can
|
| 334 |
+
289 learn the intra-class diversity by mining the sub-prototypes to represent the sub-classes. Compared
|
| 335 |
+
290 with the previous methods, which overlook the intra-class structure by using one-hot label, our Mem
|
| 336 |
+
291 SPM can learn the class feature from a more subdivided sub-class perspective to improve adaptation
|
| 337 |
+
292 performance. At the same time, the visualization of the tSNE and reconstruction demonstrates the
|
| 338 |
+
293 sub-prototypes have been well learned as we expected. Our MemSPM method exhibits superior
|
| 339 |
+
294 performance in most cases compared with previous state-of-the-art methods on four benchmarks.
|
| 340 |
+
|
| 341 |
+
# References
|
| 342 |
+
|
| 343 |
+
[1] Silvia Bucci, Mohammad Reza Loghmani, and Tatiana Tommasi. On the effectiveness of image rotation for open set domain adaptation. In Proceedings of the European Conference on Computer Vision, pages 422–438, 2020.
|
| 344 |
+
[2] Pau Panareda Busto, Ahsan Iqbal, and Juergen Gall. Open set domain adaptation for image and action recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence, 42(2):413–429, 2018. [3] Zhangjie Cao, Mingsheng Long, Jianmin Wang, and Michael I Jordan. Partial transfer learning with selective adversarial networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2724–2732, 2018.
|
| 345 |
+
[4] Zhangjie Cao, Lijia Ma, Mingsheng Long, and Jianmin Wang. Partial adversarial domain adaptation. In Proceedings of the European Conference on Computer Vision, pages 135–150, 2018.
|
| 346 |
+
[5] Zhangjie Cao, Kaichao You, Mingsheng Long, Jianmin Wang, and Qiang Yang. Learning to transfer examples for partial domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2985–2994, 2019. [6] Wanxing Chang, Ye Shi, Hoang Tuan, and Jingya Wang. Unified optimal transport framework for universal domain adaptation. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh, editors, Advances in Neural Information Processing Systems, volume 35, pages 29512–29524. Curran Associates, Inc., 2022. [7] Jin Chen, Xinxiao Wu, Lixin Duan, and Shenghua Gao. Domain adversarial reinforcement learning for partial domain adaptation. IEEE Transactions on Neural Networks and Learning Systems, 33(2):539–553, 2020. [8] Liang Chen, Yihang Lou, Jianzhong He, Tao Bai, and Minghua Deng. Geometric anchor correspondence mining with uncertainty modeling for universal domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 16134–16143, 2022. [9] Yanbei Chen, Xiatian Zhu, and Shaogang Gong. Deep reconstruction-classification networks for unsupervised domain adaptation. In Proceedings of the European Conference on Computer Vision, pages 597–613, 2016.
|
| 347 |
+
[10] Yanbei Chen, Xiatian Zhu, and Shaogang Gong. Semi-supervised deep learning with memory. In Proceedings of the European Conference on Computer Vision, pages 268–283, 2018.
|
| 348 |
+
[11] Zhihong Chen, Chao Chen, Zhaowei Cheng, Boyuan Jiang, Ke Fang, and Xinyu Jin. Selective transfer with reinforced transfer network for partial domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12706–12714, 2020.
|
| 349 |
+
[12] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020.
|
| 350 |
+
[13] Zhekai Du, Jingjing Li, Hongzu Su, Lei Zhu, and Ke Lu. Cross-domain gradient discrepancy minimization for unsupervised domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3937–3946, 2021.
|
| 351 |
+
[14] Bo Fu, Zhangjie Cao, Mingsheng Long, and Jianmin Wang. Learning to detect open classes for universal domain adaptation. In Proceedings of the European Conference on Computer Vision, pages 567–583, 2020.
|
| 352 |
+
[15] Yaroslav Ganin and Victor Lempitsky. Unsupervised domain adaptation by backpropagation. In Francis Bach and David Blei, editors, Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pages 1180–1189. PMLR, 2015.
|
| 353 |
+
[16] Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, François Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. The journal of machine learning research, 17(1):2096–2030, 2016.
|
| 354 |
+
[17] Dong Gong, Lingqiao Liu, Vuong Le, Budhaditya Saha, Moussa Reda Mansour, Svetha Venkatesh, and Anton van den Hengel. Memorizing normality to detect anomaly: Memory-augmented deep autoencoder for unsupervised anomaly detection. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1705–1714, 2019.
|
| 355 |
+
[18] Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv preprint arXiv:1410.5401, 2014.
|
| 356 |
+
[19] Tzu Ming Harry Hsu, Wei Yu Chen, Cheng-An Hou, Yao-Hung Hubert Tsai, Yi-Ren Yeh, and YuChiang Frank Wang. Unsupervised domain adaptation with imbalanced cross-domain data. In Proceedings of the IEEE International Conference on Computer Vision, 2015.
|
| 357 |
+
[20] JoonHo Jang, Byeonghu Na, Dong Hyeok Shin, Mingi Ji, Kyungwoo Song, and Il-Chul Moon. Unknownaware domain adversarial learning for open-set domain adaptation. Advances in Neural Information Processing Systems, 35:16755–16767, 2022.
|
| 358 |
+
[21] Tarun Kalluri, Astuti Sharma, and Manmohan Chandraker. Memsac: Memory augmented sample consistency for large scale domain adaptation. In Proceedings of the European Conference on Computer Vision, pages 550–568, 2022.
|
| 359 |
+
[22] Guoliang Kang, Lu Jiang, Yi Yang, and Alexander G. Hauptmann. Contrastive adaptation network for unsupervised domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, June 2019.
|
| 360 |
+
[23] Chen-Yu Lee, Tanmay Batra, Mohammad Haris Baig, and Daniel Ulbricht. Sliced wasserstein discrepancy for unsupervised domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10285–10295, 2019.
|
| 361 |
+
[24] Guangrui Li, Guoliang Kang, Yi Zhu, Yunchao Wei, and Yi Yang. Domain consensus clustering for universal domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9757–9766, 2021.
|
| 362 |
+
[25] Shuang Li, Chi Harold Liu, Qiuxia Lin, Qi Wen, Limin Su, Gao Huang, and Zhengming Ding. Deep residual correction network for partial domain adaptation. IEEE Transactions on Pattern Analysis and Machine Intelligence, 43(7):2329–2344, 2020.
|
| 363 |
+
[26] Jian Liang, Dapeng Hu, Jiashi Feng, and Ran He. Umad: Universal model adaptation under domain and category shift. arXiv preprint arXiv:2112.08553, 2021.
|
| 364 |
+
[27] Jian Liang, Yunbo Wang, Dapeng Hu, Ran He, and Jiashi Feng. A balanced and uncertainty-aware approach for partial domain adaptation. In Proceedings of the European Conference on Computer Vision, pages 123–140, 2020.
|
| 365 |
+
[28] Hong Liu, Zhangjie Cao, Mingsheng Long, Jianmin Wang, and Qiang Yang. Separate to adapt: Open set domain adaptation via progressive separation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2927–2936, 2019.
|
| 366 |
+
[29] Mingsheng Long, Zhangjie Cao, Jianmin Wang, and Michael I Jordan. Conditional adversarial domain adaptation. Advances in Neural Information Processing Systems, 31, 2018.
|
| 367 |
+
[30] Zhihe Lu, Yongxin Yang, Xiatian Zhu, Cong Liu, Yi-Zhe Song, and Tao Xiang. Stochastic classifiers for unsupervised domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9111–9120, 2020.
|
| 368 |
+
[31] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019.
|
| 369 |
+
[32] Xingchao Peng, Qinxun Bai, Xide Xia, Zijun Huang, Kate Saenko, and Bo Wang. Moment matching for multi-source domain adaptation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, 2019.
|
| 370 |
+
[33] Xingchao Peng, Ben Usman, Neela Kaushik, Judy Hoffman, Dequan Wang, and Kate Saenko. Visda: The visual domain adaptation challenge. arXiv preprint arXiv:1710.06924, 2017.
|
| 371 |
+
[34] Sanqing Qu, Tianpei Zou, Florian Röhrbein, Cewu Lu, Guang Chen, Dacheng Tao, and Changjun Jiang. Upcycling models under domain and category shift. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2023.
|
| 372 |
+
[35] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. In Marina Meila and Tong Zhang, editors, Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pages 8748–8763. PMLR, 2021.
|
| 373 |
+
[36] Jack Rae, Jonathan J Hunt, Ivo Danihelka, Timothy Harley, Andrew W Senior, Gregory Wayne, Alex Graves, and Timothy Lillicrap. Scaling memory-augmented neural networks with sparse reads and writes. In D. Lee, M. Sugiyama, U. Luxburg, I. Guyon, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 29. Curran Associates, Inc., 2016.
|
| 374 |
+
[37] Kate Saenko, Brian Kulis, Mario Fritz, and Trevor Darrell. Adapting visual category models to new domains. In Proceedings of the European Conference on Computer Vision, pages 213–226, 2010.
|
| 375 |
+
[38] Aadarsh Sahoo, Rameswar Panda, Rogerio Feris, Kate Saenko, and Abir Das. Select, label, and mix: Learning discriminative invariant feature representations for partial domain adaptation. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 4210–4219, 2023.
|
| 376 |
+
[39] Kuniaki Saito, Donghyun Kim, Stan Sclaroff, and Kate Saenko. Universal domain adaptation through self supervision. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 16282–16292. Curran Associates, Inc., 2020. [40] Kuniaki Saito and Kate Saenko. Ovanet: One-vs-all network for universal domain adaptation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 9000–9009, 2021.
|
| 377 |
+
3 [41] Kuniaki Saito, Kohei Watanabe, Yoshitaka Ushiku, and Tatsuya Harada. Maximum classifier discrepancy for unsupervised domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2018.
|
| 378 |
+
6 [42] Kuniaki Saito, Shohei Yamamoto, Yoshitaka Ushiku, and Tatsuya Harada. Open set domain adaptation by
|
| 379 |
+
7 backpropagation. In Proceedings of the European Conference on Computer Vision, pages 153–168, 2018.
|
| 380 |
+
8 [43] Tasfia Shermin, Guojun Lu, Shyh Wei Teng, Manzur Murshed, and Ferdous Sohel. Adversarial network with multiple classifiers for open set domain adaptation. IEEE Transactions on Multimedia, 23:2732–2744, 2020.
|
| 381 |
+
1 [44] Rui Shu, Hung H Bui, Hirokazu Narui, and Stefano Ermon. A dirt-t approach to unsupervised domain adaptation. arXiv preprint arXiv:1802.08735, 2018.
|
| 382 |
+
3 [45] Sainbayar Sukhbaatar, arthur szlam, Jason Weston, and Rob Fergus. End-to-end memory networks. In
|
| 383 |
+
4 C. Cortes, N. Lawrence, D. Lee, M. Sugiyama, and R. Garnett, editors, Advances in Neural Information
|
| 384 |
+
5 Processing Systems, volume 28. Curran Associates, Inc., 2015.
|
| 385 |
+
6 [46] Hemanth Venkateswara, Jose Eusebio, Shayok Chakraborty, and Sethuraman Panchanathan. Deep hashing network for unsupervised domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2017.
|
| 386 |
+
9 [47] Kaichao You, Mingsheng Long, Zhangjie Cao, Jianmin Wang, and Michael I Jordan. Universal domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2720–2729, 2019.
|
| 387 |
+
2 [48] Chaohui Yu, Jindong Wang, Yiqiang Chen, and Meiyu Huang. Transfer learning with dynamic adversarial adaptation network. In 2019 IEEE International Conference on Data Mining, pages 778–786. IEEE, 2019.
|
| 388 |
+
4 [49] Jing Zhang, Zewei Ding, Wanqing Li, and Philip Ogunbona. Importance weighted adversarial nets for partial domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 8156–8164, 2018.
|
| 389 |
+
7 [50] Yabin Zhang, Hui Tang, Kui Jia, and Mingkui Tan. Domain-symmetric networks for adversarial domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5031–5040, 2019.
|
md/dev/nJfylDvgzlq/nJfylDvgzlq.md
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MAKE-A-VIDEO: TEXT-TO-VIDEO GENERATION WITHOUT TEXT-VIDEO DATA
|
| 2 |
+
|
| 3 |
+
Uriel Singer + Adam Polyak + Thomas Hayes + Xi Yin +
|
| 4 |
+
|
| 5 |
+
Jie An Songyang Zhang Qiyuan Hu Harry Yang Oron Ashual Oran Gafni
|
| 6 |
+
|
| 7 |
+
Devi Parikh + Sonal Gupta + Yaniv Taigman +
|
| 8 |
+
|
| 9 |
+
# Meta AI
|
| 10 |
+
|
| 11 |
+
# ABSTRACT
|
| 12 |
+
|
| 13 |
+
We propose Make-A-Video – an approach for directly translating the tremendous recent progress in Text-to-Image (T2I) generation to Text-to-Video (T2V). Our intuition is simple: learn what the world looks like and how it is described from paired text-image data, and learn how the world moves from unsupervised video footage. Make-A-Video has three advantages: (1) it accelerates training of the T2V model (it does not need to learn visual and multimodal representations from scratch), (2) it does not require paired text-video data, and (3) the generated videos inherit the vastness (diversity in aesthetic, fantastical depictions, etc.) of today’s image generation models. We design a simple yet effective way to build on T2I models with novel and effective spatial-temporal modules. First, we decompose the full temporal U-Net and attention tensors and approximate them in space and time. Second, we design a spatial temporal pipeline to generate high resolution and frame rate videos with a video decoder, interpolation model and two super resolution models that can enable various applications besides T2V. In all aspects, spatial and temporal resolution, faithfulness to text, and quality, Make-A-Video sets the new state-of-the-art in text-to-video generation, as determined by both qualitative and quantitative measures.
|
| 14 |
+
|
| 15 |
+
# 1 INTRODUCTION
|
| 16 |
+
|
| 17 |
+
The Internet has fueled collecting billions of (alt-text, image) pairs from HTML pages (Schuhmann et al., 2022), enabling the recent breakthroughs in Text-to-Image (T2I) modeling. However, replicating this success for videos is limited since a similarly sized (text, video) dataset cannot be easily collected. It would be wasteful to train Text-to-Video (T2V) models from scratch when there already exist models that can generate images. Moreover, unsupervised learning enables networks to learn from orders of magnitude more data. This large quantity of data is important to learn representations of more subtle, less common concepts in the world. Unsupervised learning has long had great success in advancing the field of natural language processing (NLP) (Liu et al., 2019a; Brown et al., 2020). Models pre-trained this way yield considerably higher performance than when solely trained in a supervised manner.
|
| 18 |
+
|
| 19 |
+
Inspired by these motivations, we propose Make-A-Video. Make-A-Video leverages T2I models to learn the correspondence between text and the visual world, and uses unsupervised learning on unlabeled (unpaired) video data, to learn realistic motion. Together, Make-A-Video generates videos from text without leveraging paired text-video data.
|
| 20 |
+
|
| 21 |
+
Clearly, text describing images does not capture the entirety of phenomena observed in videos. That said, one can often infer actions and events from static images (e.g. a woman drinking coffee, or an elephant kicking a football) as done in image-based action recognition systems (Girish et al., 2020). Moreover, even without text descriptions, unsupervised videos are sufficient to learn how different entities in the world move and interact (e.g. the motion of waves at the beach, or of an elephant’s trunk). As a result, a model that has only seen text describing images is surprisingly effective at generating short videos, as demonstrated by our temporal diffusion-based method. Make-A-Video sets the new state-of-the-art in T2V generation.
|
| 22 |
+
|
| 23 |
+

|
| 24 |
+
Figure 1: T2V generation examples. Our model can generate high-quality videos with coherent motion for a diverse set of visual concepts. In example (a), there are large and realistic motion for the dog. In example (b), the books are almost static but the scene changes with the camera motion. Video samples are available at make-a-video.github.io
|
| 25 |
+
|
| 26 |
+
Using function-preserving transformations, we extend the spatial layers at the model initialization stage, to include temporal information. The extended spatial-temporal network includes new attention modules that learn temporal world dynamics from a collection of videos. This procedure significantly accelerates the T2V training process by instantaneously transferring the knowledge from a previously trained T2I network to a new T2V one. To enhance the visual quality, we train spatial super-resolution models as well as frame interpolation models. This increases the resolution of the generated videos, as well as enables a higher (controllable) frame rate.
|
| 27 |
+
|
| 28 |
+
Our main contributions are:
|
| 29 |
+
|
| 30 |
+
• We present Make-A-Video – an effective method that extends a diffusion-based T2I model to T2V through a spatiotemporally factorized diffusion model.
|
| 31 |
+
• We leverage joint text-image priors to bypass the need for paired text-video data, which in turn allows us to potentially scale to larger quantities of video data.
|
| 32 |
+
• We present super-resolution strategies in space and time that, for the first time, generate high-definition, high frame-rate videos given a user-provided textual input.
|
| 33 |
+
• We evaluate Make-A-Video against existing T2V systems and present: (a) State-of-the-art results in quantitative as well as qualitative measures, and (b) A more thorough evaluation than existing literature in T2V. We also collect a test set of 300 prompts for zero-shot T2V human evaluation which we plan to release.
|
| 34 |
+
|
| 35 |
+
# 2 PREVIOUS WORK
|
| 36 |
+
|
| 37 |
+
Text-to-Image Generation. (Reed et al., 2016) is among the first methods to extend unconditional Generative Adversairal Network (GAN) (Goodfellow et al., 2014) to T2I generation. Later GAN variants have focused on progressive generation (Zhang et al., 2017; Hong et al., 2018), or better text-image alignment (Xu et al., 2018; Zhang et al., 2021). The pioneering work of DALLE (Ramesh et al., 2021) considers T2I generation as a sequence-to-sequence translation problem using a discrete variational auto-encoder (VQVAE) and Transformer (Vaswani et al., 2017). Additional variants (Ding et al., 2022) have been proposed since then. For example, Make-A-Scene (Gafni et al., 2022) explores controllable T2I generation using semantic maps. Parti (Yu et al., 2022a) aims for more diverse content generation through an encoder-decoder architecture and an improved image tokenizer (Yu et al., 2021). On the other hand, Denoising Diffusion Probabilistic Models (DDPMs) (Ho et al., 2020) are successfully leveraged for T2I generation. GLIDE (Nichol et al., 2021) trained a T2I and an upsampling diffusion model for cascade generation. GLIDE’s proposed classifier-free guidance has been widely adopted in T2I generation to improve image quality and text faithfulness. DALLE-2 (Ramesh et al., 2022) leverages the CLIP (Radford et al., 2021) latent space and a prior model. VQ-diffusion (Gu et al., 2022) and stable diffusion (Rombach et al., 2022) performs T2I generation in the latent space instead of pixel space to improve efficiency.
|
| 38 |
+
|
| 39 |
+
Text-to-Video Generation. While there is remarkable progress in T2I generation, the progress of T2V generation lags behind largely due to two main reasons: the lack of large-scale datasets with high-quality text-video pairs, and the complexity of modeling higher-dimensional video data. Early works (Mittal et al., 2017; Pan et al., 2017; Marwah et al., 2017; Li et al., 2018; Gupta et al., 2018; Liu et al., 2019b) are mainly focused on video generation in simple domains, such as moving digits or specific human actions. To our knowledge, Sync-DRAW (Mittal et al., 2017) is the first T2V generation approach that leverages a VAE with recurrent attention. (Pan et al., 2017) and (Li et al., 2018) extend GANs from image generation to T2V generation.
|
| 40 |
+
|
| 41 |
+
More recently, GODIVA (Wu et al., 2021a) is the first to use 2D VQVAE and sparse attention for T2V generation supporting more realistic scenes. NUWA (Wu et al., 2021b) extends GODIVA, and ¨ presents a unified representation for various generation tasks in a multitask learning scheme. To further improve the performance of T2V generation, CogVideo (Hong et al., 2022) is built on top of a frozen CogView-2 (Ding et al., 2022) T2I model by adding additional temporal attention modules. Video Diffusion Models (VDM) (Ho et al., 2022) uses a space-time factorized U-Net with joint image and video data training. While both CogVideo and VDM collected 10M private text-video pairs for training, our work uses solely open-source datasets, making it easier to reproduce.
|
| 42 |
+
|
| 43 |
+
Leveraging Image Priors for Video Generation. Due to the complexity of modeling videos and the challenges in high-quality video data collection, it is natural to consider leveraging image priors for videos to simplifying the learning process. After all, an image is a video with a single frame (Bain et al., 2021). In unconditional video generation, MoCoGAN-HD (Tian et al., 2021) formulates video generation as the task of finding a trajectory in the latent space of a pre-trained and fixed image generation model. In T2V generation, NUWA (Wu et al., 2021b) combines image and video datasets ¨ in a multitask pre-training stage to improve model generalization for fine-tuning. CogVideo (Hong et al., 2022) uses a pre-trained and fixed T2I model for T2V generation with only a small number of trainable parameters to reduce memory usage during training. But the fixed autoencoder and T2I models can be restrictive for T2V generation. The architecture of VDM (Ho et al., 2022) can enable joint image and video generation. However, they sample random independent images from random videos as their source of images, and do not leverage the massive text-image datasets.
|
| 44 |
+
|
| 45 |
+
Make-A-Video differs from previous works in several aspects. First, our architecture breaks the dependency on text-video pairs for T2V generation. This is a significant advantage compared to prior work, that has to be restricted to narrow domains (Mittal et al., 2017; Gupta et al., 2018; Ge et al., 2022; Hayes et al., 2022), or require large-scale paired text-video data (Hong et al., 2022; Ho et al., 2022). Second, we fine-tune the T2I model for video generation, gaining the advantage of adapting the model weights effectively, compared to freezing the weights as in CogVideo (Hong et al., 2022). Third, motivated from prior work on efficient architectures for video and 3D vision tasks (Ye et al., 2019; Qiu et al., 2017; Xie et al., 2018), our use of pseudo-3D convolution (Qiu et al., 2017) and temporal attention layers not only better leverage a T2I architecture, it also allows for better temporal information fusion compared to VDM (Ho et al., 2022).
|
| 46 |
+
|
| 47 |
+

|
| 48 |
+
Figure 2: Make-A-Video high-level architecture. Given input text $x$ translated by the prior $\mathrm { P }$ into an image embedding, and a desired frame rate $f p s$ , the decoder $\mathrm { D ^ { t } }$ generates $1 6 ~ 6 4 \times 6 4$ frames, which are then interpolated to a higher frame rate by $\uparrow _ { F }$ , and increased in resolution to $2 5 6 \times 2 5 6$ by $\mathrm { S R } _ { l } ^ { t }$ and $7 6 8 \times 7 6 8$ by $\mathrm { S R } _ { h }$ , resulting in a high-spatiotemporal-resolution generated video $\hat { y }$ .
|
| 49 |
+
|
| 50 |
+
# 3 METHOD
|
| 51 |
+
|
| 52 |
+
Make-A-Video consists of three main components: (i) A base T2I model trained on text-image pairs (Sec. 3.1), (ii) spatiotemporal convolution and attention layers that extend the networks’ building blocks to the temporal dimension (Sec. 3.2), and (iii) spatiotemporal networks that consist of both spatiotemporal layers, as well as another crucial element needed for T2V generation - a frame interpolation network for high frame rate generation (Sec. 3.3).
|
| 53 |
+
|
| 54 |
+
Make-A-Video’s final T2V inference scheme (depicted in Fig. 2) can be formulated as:
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\begin{array} { r } { \hat { y } _ { t } = \mathrm { S R } _ { h } \circ \mathrm { S R } _ { l } ^ { t } \circ \uparrow _ { F } \circ \mathrm { D } ^ { t } \circ \mathrm { P } \circ ( \hat { x } , \mathrm { C } _ { x } ( x ) ) , } \end{array}
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where $\hat { y } _ { t }$ is the generated video, $\mathrm { S R } _ { h } , \mathrm { S R } _ { l }$ are the spatial and spatiotemporal super-resolution networks (Sec. 3.2), $\uparrow _ { F }$ is a frame interpolation network (Sec. 3.3), $\mathrm { D } ^ { t }$ is the spatiotemporal decoder (Sec. 3.2), $\mathrm { P }$ is the prior (Sec. 3.1), $\hat { x }$ is the BPE-encoded text, $\mathrm { C } _ { x }$ is the CLIP text encoder (Radford et al., 2021), and $x$ is the input text. The three main components are described in detail in the following sections.
|
| 61 |
+
|
| 62 |
+
# 3.1 TEXT-TO-IMAGE MODEL
|
| 63 |
+
|
| 64 |
+
Prior to the addition of the temporal components, we train the backbone of our method: a T2I model trained on text-image pairs, sharing the core components with the work of (Ramesh et al., 2022).
|
| 65 |
+
|
| 66 |
+
We use the following networks to produce high-resolution images from text: (i) A prior network P, that during inference generates image embeddings $y _ { e }$ given text embeddings $x _ { e }$ and BPE encoded text tokens $\hat { x }$ , (ii) a decoder network $\mathbf { D }$ that generates a low-resolution $6 4 \times 6 4$ RGB image $\hat { y } _ { l }$ , conditioned on the image embeddings $y _ { e }$ , and (iii) two super-resolution networks $\mathbf { S R } _ { 1 } , \mathbf { S R } _ { \mathbf { h } }$ that increase the generated image $\hat { y } _ { l }$ resolution to $2 5 6 \times 2 5 6$ and $7 6 8 \times 7 6 8$ pixels respectively, resulting in the final1 generated image $\hat { y }$ .
|
| 67 |
+
|
| 68 |
+
# 3.2 SPATIOTEMPORAL LAYERS
|
| 69 |
+
|
| 70 |
+
In order to expand the two-dimensional (2D) conditional network into the temporal dimension, we modify the two key building blocks that now require not just spatial but also temporal dimensions in order to generate videos: (i) Convolutional layers (Sec. 3.2.1), and (ii) attention layers (Sec. 3.2.2), discussed in the following two subsections. Other layers, such as fully-connected layers, do not require specific handling when adding an additional dimension, as they are agnostic to structured spatial and temporal information. Temporal modifications are made in most U-Net-based diffusion networks: the spatiotemporal decoder $\mathrm { D ^ { t } }$ now generating 16 RGB frames, each of size $6 4 \times 6 4$ , the newly added frame interpolation network $\uparrow _ { F }$ , increasing the effective frame rate by interpolating between the 16 generated frames (as depicted in Fig. 2), and the super-resolution networks $\mathrm { \dot { S } R } _ { l } ^ { t }$ .
|
| 71 |
+
|
| 72 |
+

|
| 73 |
+
Figure 3: The architecture and initialization scheme of the Pseudo-3D convolutional and attention layers, enabling the seamless transition of a pre-trained Text-to-Image model to the temporal dimension. (left) Each spatial 2D conv layer is followed by a temporal 1D conv layer. The temporal conv layer is initialized with an identity function. (right) Temporal attention layers are applied following the spatial attention layers by initializing the temporal projection to zero, resulting in an identity function of the temporal attention blocks.
|
| 74 |
+
|
| 75 |
+
Note that super resolution involves hallucinating information. In order to not have flickering artifacts, the hallucination must be consistent across frames. As a result, our $\mathrm { S R } _ { l } ^ { t }$ module operates across spatial and temporal dimensions. In qualitative inspection we found this to significantly outperform per-frame super resolution. It is challenging to extend $\mathrm { S R } _ { h }$ to the temporal dimension due to memory and compute constraints, as well as a scarcity of high resolution video data. So $\mathrm { S R } _ { h }$ operates only along the spatial dimensions. But to encourage consistent detail hallucination across frames, we use the same noise initialization for each frame.
|
| 76 |
+
|
| 77 |
+
# 3.2.1 PSEUDO-3D CONVOLUTIONAL LAYERS
|
| 78 |
+
|
| 79 |
+
Motivated by separable convolutions (Chollet, 2017), we stack a 1D convolution following each 2D convolutional (conv) layer, as shown in Fig. 3. This facilitates information sharing between the spatial and temporal axes, without succumbing to the heavy computational load of 3D conv layers. In addition, it creates a concrete partition between the pre-trained 2D conv layers and the newly initialized 1D conv layers, allowing us to train the temporal convolutions from scratch, while retaining the previously learned spatial knowledge in the spatial convolutions’ weights.
|
| 80 |
+
|
| 81 |
+
Given an input tensor $h \in \mathbb { R } ^ { B \times C \times F \times H \times W }$ , where $B , C , F , H ,$ $W$ are the batch, channels, frames, height, and width dimensions respectively, the Pseudo-3D convolutional layer is defined as:
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
C o n v _ { P 3 D } ( h ) : = C o n v _ { 1 D } ( C o n v _ { 2 D } ( h ) \circ T ) \circ T ,
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
where the transpose operator $_ { \circ T }$ swaps between the spatial and temporal dimensions. For smooth initialization, while the $C o n v _ { 2 D }$ layer is initialized from the pre-trained T2I model, the $C o n v _ { 1 D }$ layer is initialized as the identity function, enabling a seamless transition from training spatial-only layers, to spatiotemporal layers. Note that at initialization, the network will generate K different images (due to random noise), each faithful to the input text but lacking temporal coherence.
|
| 88 |
+
|
| 89 |
+
# 3.2.2 PSEUDO-3D ATTENTION LAYERS
|
| 90 |
+
|
| 91 |
+
A crucial component of T2I networks is the attention layer, where in addition to self-attending to extracted features, text information is injected to several network hierarchies, alongside other relevant information, such as the diffusion time-step. While using 3D convolutional layers is computationally heavy, adding the temporal dimension to attention layers is outright infeasible in terms of memory consumption. Inspired by the work of (Ho et al., 2022), we extend our dimension decomposition strategy to attention layers as well. Following each (pre-trained) spatial attention layer, we stack a temporal attention layer, which as with the convolutional layers, approximates a full spatiotemporal attention layer. Specifically, given an input tensor $h$ , we define flatten as a matrix operator that flattens the spatial dimension into $h ^ { \prime } \in R ^ { B \times C \times F \times H W }$ . unf latten is defined as the inverse matrix operator. The Pseudo-3D attention layer therefore is therefore defined as:
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
A T T N _ { P 3 D } ( h ) = u n f l a t t e n ( A T T N _ { 1 D } ( A T T N _ { 2 D } ( f l a t t e n ( h ) ) \circ T ) \circ T ) .
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
Similarly to $C o n v _ { P 3 D }$ , to allow for smooth spatiotemporal initialization, the $A T T N _ { 2 D }$ layer is initialized from the pre-trained T2I model and the $A T T N _ { 1 D }$ layer is initialized as the identity function.
|
| 98 |
+
|
| 99 |
+
Factorized space-time attention layers have also been used in VDM (Ho et al., 2022) and CogVideo (Hong et al., 2022). CogVideo has added temporal layers to each (frozen) spatial layers whereas we train them jointly. In order to force their network to train for images and videos interchangeably, VDM has extended their 2D U-Net to 3D through unflattened 1x3x3 convolution filters, such that the subsequent spatial attention remains 2D, and added 1D temporal attention through relative position embeddings. In contrast, we apply an additional 3x1x1 convolution projection (after each $1 \mathrm { x } 3 \mathrm { x } 3 $ ) such that the temporal information will also be passed through each convolution layer.
|
| 100 |
+
|
| 101 |
+
Frame rate conditioning. In addition to the T2I conditionings, similar to CogVideo (Hong et al., 2022), we add an additional conditioning parameter $f p s$ , representing the number of frames-persecond in a generated video. Conditioning on a varying number of frames-per-second, enables an additional augmentation method to tackle the limited volume of available videos at training time, and provides additional control on the generated video at inference time.
|
| 102 |
+
|
| 103 |
+
Objectives. We optimize the model by minimizing the hybrid loss following Nichol & Dhariwal (2021); Ramesh et al. (2022) to train the video decoder. Specifically, the loss consists of two terms: a simple loss that learns to predict the added noise and a loss $L _ { v l b }$ that adds a constraint on the estimated variational lower bound (VLB). The $L _ { v l b }$ term is applied the same way as in Nichol & Dhariwal (2021). Thus, we only write the loss term that predicts the added noise as:
|
| 104 |
+
|
| 105 |
+
$$
|
| 106 |
+
\mathcal { L } _ { d e c o d e r } = \mathbb { E } _ { C _ { y } ( \mathbf { y } _ { 0 } ) , \epsilon , f p s , t } \left[ \| \epsilon _ { t } - \epsilon _ { \theta } ( \mathbf { z } _ { t } , C _ { y } ( \mathbf { y } _ { 0 } ) , f p s , t ) \| _ { 2 } ^ { 2 } \right]
|
| 107 |
+
$$
|
| 108 |
+
|
| 109 |
+
where $\mathbf { y }$ is an input video and $\mathbf { y } _ { 0 }$ represents the first frame of this video. $C _ { y } ( \mathbf { y } _ { 0 } )$ denotes the extracted CLIP image embedding of the first frame. $\mathbf { z } _ { t }$ is the noisy input added to $\mathbf { y }$ at time step $t$ that is uniformly sampled from 1 to $T$ during training. $f p s$ is the frame rate embedding as described above. $\epsilon _ { t }$ is the added noise that is to be estimated by the network represented as $\epsilon _ { \theta }$ .
|
| 110 |
+
|
| 111 |
+
# 3.3 FRAME INTERPOLATION NETWORK
|
| 112 |
+
|
| 113 |
+
In addition to the spatiotemporal modifications discussed in Sec. 3.2, we train a new masked frame interpolation and extrapolation network $\uparrow _ { F }$ , capable of increasing the number of frames of the generated video either by frame interpolation for a smoother generated video, or by pre/post frame extrapolation for extending the video length. In order to increase the frame rate within memory and compute constraints, we fine-tune a spatiotemporal decoder $\mathrm { D ^ { t } }$ on the task of masked frame interpolation, by zero-padding the masked input frames, enabling video upsampling. When fine-tuning on masked frame interpolation, we add an additional 4 channels to the input of the U-Net: 3 channels for the RGB masked video input and an additional binary channel indicating which frames are masked. We fine-tune with variable frame-skips and $f p s$ conditioning to enable multiple temporal upsample rates at inference time. The training objective is the same as Eq. 4 except that we add the additional condition of the unmasked frames. We denote $\uparrow _ { F }$ as the operator that expands the given video tensor through masked frame interpolation. For all of our experiments we applied $\uparrow _ { F }$ with frame skip 5 to upsample a 16 frame video to 76 frames $( ( 1 6 - 1 ) \times 5 + 1 )$ ). Note that we can use the same architecture for video extrapolation or image animation by masking frames at the beginning or end of a video.
|
| 114 |
+
|
| 115 |
+
# 3.4 TRAINING
|
| 116 |
+
|
| 117 |
+
The different components of Make-A-Video described above are trained independently. The only component that receives text as input is the prior P. We train it on paired text-image data and do not fine-tune it on videos. The decoder and two super-resolution components are first trained on images alone (no aligned text). Recall that the decoder receives CLIP image embedding as input, and the super-resolution components receive downsampled images as input during training. After training on images, we add and initialize the new temporal layers and fine-tune them over unlabeled video data. 16 frames are sampled from the original video with random f ps ranging from 1 to 30. We use the beta function for sampling and while training the decoder, start from higher FPS ranges (less motion) and then transition to lower FPS ranges (more motion). The masked-frame-interpolation component is fine-tuned from the temporal decoder.
|
| 118 |
+
|
| 119 |
+
Table 1: T2V generation evaluation on MSR-VTT. Zero-Shot means no training is conducted on MSR-VTT. Samples/Input means how many samples are generated (and then ranked) for each input.
|
| 120 |
+
|
| 121 |
+
<table><tr><td>Method GODIVA</td><td>Zero-Shot</td><td>Samples/Input</td><td>Resolution</td><td>FID (↓)</td><td>CLIPSIM (↑)</td></tr><tr><td>NUWA</td><td>No</td><td>30</td><td>128×128</td><td></td><td>0.2402</td></tr><tr><td></td><td>No</td><td>1</td><td>336 × 336</td><td>47.68</td><td>0.2439</td></tr><tr><td>CogVideo (Chinese)</td><td>Yes</td><td>1</td><td>480 ×480</td><td>24.78</td><td>0.2614</td></tr><tr><td>CogVideo (English)</td><td>Yes</td><td>1</td><td>480 × 480</td><td>23.59</td><td>0.2631</td></tr><tr><td> Make-A-Video (ours)</td><td>Yes</td><td>1</td><td>256 × 256</td><td>13.17</td><td>0.3049</td></tr></table>
|
| 122 |
+
|
| 123 |
+
# 4 EXPERIMENTS
|
| 124 |
+
|
| 125 |
+
# 4.1 DATASETS AND SETTINGS
|
| 126 |
+
|
| 127 |
+
Datasets. To train the image models, we use a 2.3B subset of the dataset from (Schuhmann et al.) where the text is English. We filter out sample pairs with NSFW images 2, toxic words in the text, or images with a watermark probability larger than 0.5. We use WebVid-10M (Bain et al., 2021) and a 10M subset from HD-VILA-100M (Xue et al., 2022) 3 to train our video generation models. Note that only the videos (no aligned text) are used. The decoder $\mathrm { D } ^ { t }$ and the interpolation model is trained on WebVid-10M. $\mathrm { S R } _ { l } ^ { t }$ is trained on both WebVid-10M and HD-VILA-10M. While prior work (Hong et al., 2022; Ho et al., 2022) have collected private text-video pairs for T2V generation, we use only public datasets (and no paired text for videos). We conduct automatic evaluation on UCF-101 (Soomro et al., 2012) and MSR-VTT (Xu et al., 2016) in a zero-shot setting.
|
| 128 |
+
|
| 129 |
+
Automatic Metrics. For UCF-101, we write one template sentence for each class (without generating any video) and fix it for evaluation. We report Frechet Video Distance (FVD) and Inception Score (IS) on 10K samples following (Ho et al., 2022). We generate samples that follow the same class distribution as the training set. For MSR-VTT, we report Frechet Inception Distance (FID) (Parmar et al., 2022) and CLIPSIM (average CLIP similarity between video frames and text) (Wu et al., 2021a), where all 59, 794 captions from the test set are used, following (Wu et al., 2021b).
|
| 130 |
+
|
| 131 |
+
Human Evaluation Set and Metrics. We collect an evaluation set from Amazon Mechanical Turk (AMT) that consists of 300 prompts. We asked annotators what they would be interested in generating if there were a T2V system. We filtered out prompts that were incomplete (e.g., “jump into water”), too abstract (e.g., “climate change”), or offensive. We then identified 5 categories (animals, fantasy, people, nature and scenes, food and beverage) and selected prompts for these categories. These prompts were selected without generating any videos for them, and were kept fixed. In addition, we also used the DrawBench prompts from Imagen (Saharia et al., 2022) for human evaluation. We evaluate video quality and text-video faithfulness. For video quality, we show two videos in random order and ask annotators which one is of higher quality. For faithfulness, we additionally show the text and ask annotators which video has a better correspondence with the text (we suggest them to ignore quality issues). In addition, we also conducted human evaluation to compare video motion realism of our interpolation model and FILM (Reda et al., 2022). For each comparison, we use the majority vote from 5 different annotators as the final result.
|
| 132 |
+
|
| 133 |
+
# 4.2 QUANTITATIVE RESULTS
|
| 134 |
+
|
| 135 |
+
Automatic Evaluation on MSR-VTT. In addition to GODIVA and NUWA that report on MSR-¨ VTT, we also perform inference on the officially released CogVideo model with both Chinese and English inputs for comparison.For CogVideo and Make-A-Video, we only generate one sample for each prompt in a zero-shot setting. We only generate videos that are at $1 6 \times 2 5 6 \times 2 5 6$ as the evaluation models do not expect higher resolutions and frame rate. The results are shown in Table 1.
|
| 136 |
+
|
| 137 |
+
Table 2: Video generation evaluation on UCF-101 for both zero-shot and fine-tuning settings.
|
| 138 |
+
|
| 139 |
+
<table><tr><td>Method</td><td>Pretrain</td><td>Class</td><td>Resolution</td><td>IS (↑)</td><td>FVD (↓)</td></tr><tr><td colspan="6">Zero-Shot Setting</td></tr><tr><td>CogVideo (Chinese)</td><td>No</td><td>Yes</td><td>480 ×480</td><td>23.55</td><td>751.34</td></tr><tr><td>CogVideo (English)</td><td>No</td><td>Yes</td><td>480×480</td><td>25.27</td><td>701.59</td></tr><tr><td> Make-A-Video (ours)</td><td>No</td><td>Yes</td><td>256 × 256</td><td>33.00</td><td>367.23</td></tr><tr><td colspan="6">Finetuning Setting</td></tr><tr><td>TGANv2(Saito et al., 2020)</td><td>No</td><td>No</td><td>128 ×128</td><td>26.60 ± 0.47</td><td>1</td></tr><tr><td>DIGAN(Yu et al., 2022b)</td><td>No</td><td>No</td><td></td><td>32.70 ± 0.35</td><td>577± 22</td></tr><tr><td>MoCoGAN-HD(Tian et al., 2021)</td><td>No</td><td>No</td><td>256× 256</td><td>33.95 ± 0.25</td><td>700±24</td></tr><tr><td>CogVideo (Hong et al., 2022)</td><td>Yes</td><td>Yes</td><td>160 × 160</td><td>50.46</td><td>626</td></tr><tr><td>VDM (Ho et al., 2022)</td><td>No</td><td>No</td><td>64 × 64</td><td>57.80 ± 1.3</td><td>1</td></tr><tr><td>TATS-base(Ge et al., 2022)</td><td>No</td><td>Yes</td><td>128 × 128</td><td>79.28 ± 0.38</td><td>278±11</td></tr><tr><td> Make-A-Video (ours)</td><td>Yes</td><td>Yes</td><td>256 × 256</td><td> 82.55</td><td>81.25</td></tr></table>
|
| 140 |
+
|
| 141 |
+
Table 3: Human evaluation results compared to CogVideo (Hong et al., 2022) on DrawBench and our test set, and to VDM (Ho et al., 2022) on the 28 examples from their website. The numbers show the percentage of raters that prefer the results of our Make-A-Video model.
|
| 142 |
+
|
| 143 |
+
<table><tr><td>Comparison</td><td>Benchmark</td><td>Quality</td><td>Faithfulness</td></tr><tr><td>Make-A-Video (ours) vs. VDM</td><td>VDM prompts (28)</td><td>84.38</td><td>78.13</td></tr><tr><td>Make-A-Video (ours) vs. ( CogVideo (Chinese)</td><td>DrawBench (200)</td><td>76.88</td><td>73.37</td></tr><tr><td>Make-A-Video (ours) vs.CogVideo (English)</td><td>DrawBench (200)</td><td>74.48</td><td>68.75</td></tr><tr><td>Make-A-Video (ours) vs.( .CogVideo (Chinese)</td><td>Our Eval. Set (300)</td><td>73.44</td><td>75.74</td></tr><tr><td>Make-A-Video (ours) vs. CogVideo (English)</td><td>Our Eval. Set (300)</td><td>77.15</td><td>71.19</td></tr></table>
|
| 144 |
+
|
| 145 |
+
Make-A-Video’s zero-shot performance is much better than GODIVA and NUWA which are trained ¨ on MSR-VTT. We also outperform CogVideo in both Chinese and English settings. Thus, Make-AVideo has significantly better generalization capabilities than prior work.
|
| 146 |
+
|
| 147 |
+
Automatic Evaluation on UCF-101. UCF-101 is a popular benchmark to evaluate video generation and has been recently used in T2V models. CogVideo performed finetuning of their pretrained model for class-conditional video generation. VDM (Ho et al., 2022) performed unconditional video generation and trained from scratch on UCF-101. We argue that both settings are not ideal and is not a direct evaluation of the T2V generation capabilities. Moreover, the FVD evaluation model expects the videos to be 0.5 second (16 frames), which is too short to be used for video generation in practice. Nevertheless, in order to compare to prior work, we conducted evaluation on UCF-101 in both zero-shot and finetuning settings. As shown in Table 2, Make-A-Video’s zero-shot performance is already competitive than other approaches that are trained on UCF-101, and is much better than CogVideo, which indicates that Make-A-Video can generalize better even to such a specific domain. Our finetuning setting achieves state-of-the-art results with a significant reduction in FVD, which suggests that Make-A-Video can generate more coherent videos than prior work.
|
| 148 |
+
|
| 149 |
+
Human Evaluation. We compare to CogVideo (the only public zero-shot T2V generation model) on DrawBench and our test set. We also evaluate on the 28 videos shown on the webpage of VDM (Ho et al., 2022) (which may be biased towards showcasing the model’s strengths). Since this is a very small test set, we randomly generate 8 videos for each input and perform evaluation 8 times and report the average results. We generate videos at $7 6 \times 2 5 6 \times 2 5 6$ resolution for human evaluation. For VDM, it is worth noting that we have achieved significantly better results The results are shown in Table 3. Make-A-Video achieves much better performance in both video quality and text-video faithfulness in all benchmarks and comparisons. For CogVideo, the results are similar on DrawBench and our evaluation set. Additional experiments combining components of CogVideo & Make-A-Video in order to measure the efficacy of different components are presented in Sec. 6.1. without any cherry-picking. We also evaluate our frame interpolation network in comparison to
|
| 150 |
+
|
| 151 |
+
FILM (Reda et al., 2022). We first generate low frame rate videos (1 FPS) from text prompts in DrawBench and our evaluation set, then use each method to upsample to 4 FPS. Raters choose our method for more realistic motion $62 \%$ of the time on our evaluation set and $54 \%$ of the time on DrawBench. We observe that our method excels when there are large differences between frames where having real-world knowledge of how objects move is crucial.
|
| 152 |
+
|
| 153 |
+
# 4.3 QUALITATIVE RESULTS
|
| 154 |
+
|
| 155 |
+
Examples of Make-A-Video’s generations are shown in Figure 1. In this section, we will show T2V generation comparison to CogVideo (Hong et al., 2022) and VDM (Ho et al., 2022), and video interpolation comparison to FILM (Reda et al., 2022). In addition, our models can be used for a variety of other tasks such as image animation, video variation, etc. Due to space constraint, we only show a single example of each. Figure 4 (a) shows the comparison of Make-A-Video to CogVideo and VDM. Make-A-Video can generate richer content with motion consistency and text correspondence. Figure 4 (b) shows an example of image animation where we condition the masked frame interpolation and extrapolation network $\uparrow _ { F }$ on the image and CLIP image embedding to extrapolate the rest of the video. This allows a user to generate a video using their own image – giving them the opportunity to personalize and directly control the generated video. Figure 4 (c) shows a comparison of our approach to FILM (Reda et al., 2022) on the task of interpolation between two images. We achieve this by using the interpolation model that takes the two images as the beginning and end frames and masks 14 frames in between for generation. Our model generates more semantically meaningful interpolation while FILM seems to primarily smoothly transition between frames without semantic real-world understanding of what is moving. Figure 4 (d) shows an example for video variation. We take the average CLIP embedding of all frames from a video as the condition to generate a semantically similar video. More video generation examples and applications can be found here: make-a-video.github.io.
|
| 156 |
+
|
| 157 |
+
# 5 DISCUSSION
|
| 158 |
+
|
| 159 |
+
Learning from the world around us is one of the greatest strengths of human intelligence. Just as we quickly learn to recognize people, places, things, and actions through observation, generative systems will be more creative and useful if they can mimic the way humans learn. Learning world dynamics from orders of magnitude more videos using unsupervised learning helps researchers break away from the reliance on labeled data. The presented work has shown how labeled images combined effectively with unlabeled video footage can achieve that.
|
| 160 |
+
|
| 161 |
+
As a next step we plan to address several of the technical limitations. As discussed earlier, our approach can not learn associations between text and phenomenon that can only be inferred in videos. How to incorporate these (e.g., generating a video of a person waving their hand left-to-right or right-to-left), along with generating longer videos, with multiple scenes and events, depicting more detailed stories, is left for future work.
|
| 162 |
+
|
| 163 |
+
Also, the lack of standard benchmarks in the field of large-scale generative models makes it difficult for works to compare with each other and measure progress over time. To address this issue, we went beyond what was done in most existing works, with extensive human evaluation, including a comparison to examples shared by authors of existing approaches (or generated using models when publicly released). We hope the community will continue making progress towards better benchmarks for generative models.
|
| 164 |
+
|
| 165 |
+
As with all large-scale models trained on data from the web, our models have learnt and likely exaggerated social biases, including harmful ones. Our T2I generation model was trained on data that removed NSFW content and toxic words. All our data (image as well as videos) is publicly available, adding a layer of transparency to our models, and making it possible for the community to reproduce our work.
|
| 166 |
+
|
| 167 |
+
# ACKNOWLEDGMENTS
|
| 168 |
+
|
| 169 |
+
Mustafa Said Mehmetoglu, Jacob Xu, Katayoun Zand, Jia-Bin-Huang, Jiebo Luo, Shelly Sheynin, Angela Fan, Kelly Freed. Thank you for your contributions! Thank you as well to all the people internal to FAIR who helped enable this work by providing extra compute for our experimentation.
|
| 170 |
+
|
| 171 |
+
# REFERENCES
|
| 172 |
+
|
| 173 |
+
Max Bain, Arsha Nagrani, Gul Varol, and Andrew Zisserman. Frozen in time: A joint video and ¨ image encoder for end-to-end retrieval. In ICCV, pp. 1728–1738, 2021.
|
| 174 |
+
|
| 175 |
+
Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. CoRR, abs/2005.14165, 2020. URL https://arxiv.org/abs/2005.14165.
|
| 176 |
+
|
| 177 |
+
Franc¸ois Chollet. Xception: Deep learning with depthwise separable convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1251–1258, 2017.
|
| 178 |
+
|
| 179 |
+
Ming Ding, Wendi Zheng, Wenyi Hong, and Jie Tang. Cogview2: Faster and better text-to-image generation via hierarchical transformers. arXiv preprint arXiv:2204.14217, 2022.
|
| 180 |
+
|
| 181 |
+
Oran Gafni, Adam Polyak, Oron Ashual, Shelly Sheynin, Devi Parikh, and Yaniv Taigman. Make-ascene: Scene-based text-to-image generation with human priors, 2022. URL https://arxiv. org/abs/2203.13131.
|
| 182 |
+
|
| 183 |
+
Songwei Ge, Thomas Hayes, Harry Yang, Xi Yin, Guan Pang, David Jacobs, Jia-Bin Huang, and Devi Parikh. Long video generation with time-agnostic vqgan and time-sensitive transformer. ECCV, 2022.
|
| 184 |
+
|
| 185 |
+
Deeptha Girish, Vineeta Singh, and Anca Ralescu. Understanding action recognition in still images. pp. 1523–1529, 06 2020. doi: 10.1109/CVPRW50498.2020.00193.
|
| 186 |
+
|
| 187 |
+
Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial networks. NIPS, 2014.
|
| 188 |
+
|
| 189 |
+
Shuyang Gu, Dong Chen, Jianmin Bao, Fang Wen, Bo Zhang, Dongdong Chen, Lu Yuan, and Baining Guo. Vector quantized diffusion model for text-to-image synthesis. In CVPR, pp. 10696– 10706, 2022.
|
| 190 |
+
|
| 191 |
+
Tanmay Gupta, Dustin Schwenk, Ali Farhadi, Derek Hoiem, and Aniruddha Kembhavi. Imagine this! scripts to compositions to videos. In ECCV, pp. 598–613, 2018.
|
| 192 |
+
|
| 193 |
+
Thomas Hayes, Songyang Zhang, Xi Yin, Guan Pang, Sasha Sheng, Harry Yang, Songwei Ge, Isabelle Hu, and Devi Parikh. Mugen: A playground for video-audio-text multimodal understanding and generation. ECCV, 2022.
|
| 194 |
+
|
| 195 |
+
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models, 2020. URL https://arxiv.org/abs/2006.11239.
|
| 196 |
+
|
| 197 |
+
Jonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J. Fleet. Video diffusion models, 2022. URL https://arxiv.org/abs/2204.03458.
|
| 198 |
+
|
| 199 |
+
Seunghoon Hong, Dingdong Yang, Jongwook Choi, and Honglak Lee. Inferring semantic layout for hierarchical text-to-image synthesis. In CVPR, pp. 7986–7994, 2018.
|
| 200 |
+
|
| 201 |
+
Wenyi Hong, Ming Ding, Wendi Zheng, Xinghan Liu, and Jie Tang. Cogvideo: Large-scale pretraining for text-to-video generation via transformers, 2022. URL https://arxiv.org/ abs/2205.15868.
|
| 202 |
+
|
| 203 |
+
Yitong Li, Martin Min, Dinghan Shen, David Carlson, and Lawrence Carin. Video generation from text. In AAAI, volume 32, 2018.
|
| 204 |
+
|
| 205 |
+
Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized BERT pretraining approach. CoRR, abs/1907.11692, 2019a. URL http://arxiv.org/abs/1907.11692.
|
| 206 |
+
|
| 207 |
+
Yue Liu, Xin Wang, Yitian Yuan, and Wenwu Zhu. Cross-modal dual learning for sentence-tovideo generation. In Proceedings of the 27th ACM International Conference on Multimedia, pp. 1239–1247, 2019b.
|
| 208 |
+
|
| 209 |
+
Tanya Marwah, Gaurav Mittal, and Vineeth N Balasubramanian. Attentive semantic video generation using captions. In ICCV, pp. 1426–1434, 2017.
|
| 210 |
+
|
| 211 |
+
Gaurav Mittal, Tanya Marwah, and Vineeth N Balasubramanian. Sync-draw: Automatic video generation using deep recurrent attentive architectures. In Proceedings of the 25th ACM international conference on Multimedia, pp. 1096–1104, 2017.
|
| 212 |
+
|
| 213 |
+
Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. arXiv preprint arXiv:2112.10741, 2021.
|
| 214 |
+
|
| 215 |
+
Alexander Quinn Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning, pp. 8162–8171. PMLR, 2021.
|
| 216 |
+
|
| 217 |
+
Yingwei Pan, Zhaofan Qiu, Ting Yao, Houqiang Li, and Tao Mei. To create what you tell: Generating videos from captions. In Proceedings of the 25th ACM international conference on Multimedia, pp. 1789–1798, 2017.
|
| 218 |
+
|
| 219 |
+
Gaurav Parmar, Richard Zhang, and Jun-Yan Zhu. On aliased resizing and surprising subtleties in gan evaluation. In CVPR, 2022.
|
| 220 |
+
|
| 221 |
+
Zhaofan Qiu, Ting Yao, and Tao Mei. Learning spatio-temporal representation with pseudo-3d residual networks. In ICCV, pp. 5533–5541, 2017.
|
| 222 |
+
|
| 223 |
+
Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In ICML, pp. 8748–8763. PMLR, 2021.
|
| 224 |
+
|
| 225 |
+
Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In ICML, pp. 8821–8831. PMLR, 2021.
|
| 226 |
+
|
| 227 |
+
Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with clip latents, 2022. URL https://arxiv.org/abs/ 2204.06125.
|
| 228 |
+
|
| 229 |
+
Fitsum Reda, Janne Kontkanen, Eric Tabellion, Deqing Sun, Caroline Pantofaru, and Brian Curless. Film: Frame interpolation for large motion. arXiv preprint arXiv:2202.04901, 2022.
|
| 230 |
+
|
| 231 |
+
Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text to image synthesis. In ICML, pp. 1060–1069. PMLR, 2016.
|
| 232 |
+
|
| 233 |
+
Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn Ommer. High- ¨ resolution image synthesis with latent diffusion models. In CVPR, pp. 10684–10695, 2022.
|
| 234 |
+
|
| 235 |
+
Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S. Sara Mahdavi, Rapha Gontijo Lopes, Tim Salimans, Jonathan Ho, David J Fleet, and Mohammad Norouzi. Photorealistic text-to-image diffusion models with deep language understanding, 2022. URL https://arxiv.org/abs/ 2205.11487.
|
| 236 |
+
|
| 237 |
+
Masaki Saito, Shunta Saito, Masanori Koyama, and Sosuke Kobayashi. Train sparsely, generate densely: Memory-efficient unsupervised training of high-resolution temporal gan. International Journal of Computer Vision, 128(10):2586–2606, 2020.
|
| 238 |
+
|
| 239 |
+
Christoph Schuhmann, Romain Beaumont, Cade W Gordon, Ross Wightman, Theo Coombes, Aarush Katta, Clayton Mullis, Patrick Schramowski, Srivatsa R Kundurthy, Katherine Crowson, et al. Laion-5b: An open large-scale dataset for training next generation image-text models.
|
| 240 |
+
|
| 241 |
+
Christoph Schuhmann, Richard Vencu, Romain Beaumont, Theo Coombes, Cade Gordon, Aarush Katta, Robert Kaczmarczyk, and Jenia Jitsev. LAION-5B: laion5b: A new era of open large-scale multi-modal datasets. https://laion.ai/ laion-5b-a-new-era-of-open-large-scale-multi-modal-datasets/, 2022.
|
| 242 |
+
|
| 243 |
+
Khurram Soomro, Amir Roshan Zamir, and Mubarak Shah. Ucf101: A dataset of 101 human actions classes from videos in the wild. arXiv preprint arXiv:1212.0402, 2012.
|
| 244 |
+
|
| 245 |
+
Yu Tian, Jian Ren, Menglei Chai, Kyle Olszewski, Xi Peng, Dimitris N Metaxas, and Sergey Tulyakov. A good image generator is what you need for high-resolution video synthesis. ICLR, 2021.
|
| 246 |
+
|
| 247 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need, 2017. URL https://arxiv. org/abs/1706.03762.
|
| 248 |
+
|
| 249 |
+
Chenfei Wu, Lun Huang, Qianxi Zhang, Binyang Li, Lei Ji, Fan Yang, Guillermo Sapiro, and Nan Duan. Godiva: Generating open-domain videos from natural descriptions. arXiv preprint arXiv:2104.14806, 2021a.
|
| 250 |
+
|
| 251 |
+
Chenfei Wu, Jian Liang, Lei Ji, Fan Yang, Yuejian Fang, Daxin Jiang, and Nan Duan. NUwa: Visual ¨ synthesis pre-training for neural visual world creation, 2021b. URL https://arxiv.org/ abs/2111.12417.
|
| 252 |
+
|
| 253 |
+
Saining Xie, Chen Sun, Jonathan Huang, Zhuowen Tu, and Kevin Murphy. Rethinking spatiotemporal feature learning: Speed-accuracy trade-offs in video classification. In ECCV, pp. 305–321, 2018.
|
| 254 |
+
|
| 255 |
+
Jun Xu, Tao Mei, Ting Yao, and Yong Rui. Msr-vtt: A large video description dataset for bridging video and language. In CVPR, pp. 5288–5296, 2016.
|
| 256 |
+
|
| 257 |
+
Tao Xu, Pengchuan Zhang, Qiuyuan Huang, Han Zhang, Zhe Gan, Xiaolei Huang, and Xiaodong He. Attngan: Fine-grained text to image generation with attentional generative adversarial networks. In CVPR, pp. 1316–1324, 2018.
|
| 258 |
+
|
| 259 |
+
Hongwei Xue, Tiankai Hang, Yanhong Zeng, Yuchong Sun, Bei Liu, Huan Yang, Jianlong Fu, and Baining Guo. Advancing high-resolution video-language representation with large-scale video transcriptions. In CVPR, pp. 5036–5045, 2022.
|
| 260 |
+
|
| 261 |
+
Rongtian Ye, Fangyu Liu, and Liqiang Zhang. 3d depthwise convolution: Reducing model parameters in 3d vision tasks. In Canadian Conference on Artificial Intelligence, pp. 186–199. Springer, 2019.
|
| 262 |
+
|
| 263 |
+
Jiahui Yu, Xin Li, Jing Yu Koh, Han Zhang, Ruoming Pang, James Qin, Alexander Ku, Yuanzhong Xu, Jason Baldridge, and Yonghui Wu. Vector-quantized image modeling with improved vqgan. arXiv preprint arXiv:2110.04627, 2021.
|
| 264 |
+
|
| 265 |
+
Jiahui Yu, Yuanzhong Xu, Jing Yu Koh, Thang Luong, Gunjan Baid, Zirui Wang, Vijay Vasudevan, Alexander Ku, Yinfei Yang, Burcu Karagol Ayan, Ben Hutchinson, Wei Han, Zarana Parekh, Xin Li, Han Zhang, Jason Baldridge, and Yonghui Wu. Scaling autoregressive models for content-rich text-to-image generation, 2022a. URL https://arxiv.org/abs/2206.10789.
|
| 266 |
+
|
| 267 |
+
Sihyun Yu, Jihoon Tack, Sangwoo Mo, Hyunsu Kim, Junho Kim, Jung-Woo Ha, and Jinwoo Shin. Generating videos with dynamics-aware implicit generative adversarial networks. ICLR, 2022b.
|
| 268 |
+
|
| 269 |
+
Han Zhang, Tao Xu, Hongsheng Li, Shaoting Zhang, Xiaogang Wang, Xiaolei Huang, and Dimitris N Metaxas. Stackgan: Text to photo-realistic image synthesis with stacked generative adversarial networks. In ICCV, pp. 5907–5915, 2017.
|
| 270 |
+
|
| 271 |
+
Han Zhang, Jing Yu Koh, Jason Baldridge, Honglak Lee, and Yinfei Yang. Cross-modal contrastive learning for text-to-image generation. In CVPR, pp. 833–842, 2021.
|
| 272 |
+
|
| 273 |
+
# 6 APPENDIX
|
| 274 |
+
|
| 275 |
+
6.1 DISENTANGLING EFFICACY OF THE T2I AND I2V COMPONENTS
|
| 276 |
+
|
| 277 |
+
We evaluate two additional baselines to disentangle the contributions of two components of MakeA-Video – Text-to-Image (T2I) and Image-to-Video (I2V). We do so by using Make-A-Video’s T2I with CogVideo’s I2V, and analogously CogVideo’s T2I with Make-A-Video’s I2V.
|
| 278 |
+
|
| 279 |
+
Note that Make-A-Video does not have two explicit T2I and I2V modules. That is, it does not generate an image first and then use it’s CLIP embedding to generate the 16 video frames. It generates the 16 video frames directly from the image CLIP embedding which is predicted using the prior. As a result, in order to evaluate an ablation like this, we first generate a frame with CogVideo’s T2I module, extract the image CLIP embedding from it, and use that to generate the 16 video frames.
|
| 280 |
+
|
| 281 |
+
We perform our ablation in a zero-shot setting on the MSR-VTT dataset where we generate 5K samples using each of the approaches. We condition CogVideo on English because English prompts performed better in our MSR-VTT evaluation (see Tab. 1).
|
| 282 |
+
|
| 283 |
+
Please see Tab. 4 for the results of this ablation study. We report FID and CLIPSIM metrics computed on static frames generated by the approaches. In addition, to evaluate temporal quality, we perform human evaluation on 200 videos out of the generated 5K. Each video was rated by 5 human evaluators, and we take the majority vote as the final result. We report the percentage of raters that prefer the results of our Make-A-Video model over the two baselines.
|
| 284 |
+
|
| 285 |
+
We see that Make-A-Video is favored across all metrics when compared to two of its CogVideo variants. Human evaluators preferred generations that used Make-A-Video’s spatial-temporal mechanism (I2V) over CogVideo’s about 2 out of 3 times. Similarly, evaluators preferred generations using Make-A-Video’s T2I module over CogVideo’s 3 out of 4 times. We also report CogVideo performance (CogVideo T2I and I2V) as reference.
|
| 286 |
+
|
| 287 |
+
Table 4: Evaluating the contribution of the T2I and I2V components in zero-shot generation on MSR-VTT. We report FID and CLIPSIM scores computed on static frames. Quality shows the percentage of human raters that prefer the results of our Make-A-Video model over the baselines.
|
| 288 |
+
|
| 289 |
+
<table><tr><td>Method</td><td>FID (↓)</td><td>CLIPSIM (↑)</td><td>Quality (↑)</td></tr><tr><td>CogVideo (English)</td><td>20.01</td><td>0.201</td><td>60%</td></tr><tr><td rowspan="2">CogVideo T2I + Make-A-Video I2V Make-A-Video T2I + CogVideo I2V</td><td>18.42</td><td>0.251</td><td>74%</td></tr><tr><td>14.09</td><td>0.302</td><td>66%</td></tr><tr><td>Make-A-Video (ours)</td><td>13.96</td><td>0.305</td><td></td></tr></table>
|
| 290 |
+
|
| 291 |
+
# 6.2 ABLATION STUDY
|
| 292 |
+
|
| 293 |
+
We perform an ablation study on several architecture and training choices. First, we ablate our architecture design. Specifically the contribution of temporal convolutional layers (Sec. 3.2.1) and temporal attention layers (Sec. 3.2.2). Second, we demonstrate the effectiveness of initializing our Text-to-Video model with pre-trained Text-to-Image model weights.
|
| 294 |
+
|
| 295 |
+
We perform our ablation in a zero-shot setting on the MSR-VTT dataset where we generated videos for 6K sentences. We report the automatic CLIPSIM metric to evaluate text faithfullness. In addition, to evaluate temporal quality, we generate videos for our human evaluation set of 300 prompts and ask raters to select which model’s generation is higher quality. Each pair of videos was rated by 5 human evaluators, and we take the majority vote as the final result. We report the percentage of raters that prefer the results of our Make-A-Video model over the two baselines. Please see Tab. 5 for the results of this ablation study.
|
| 296 |
+
|
| 297 |
+
In our architecture design ablation we trained two variants: (i) Make-A-Video architecture without temporal attention layers with the spatial attention layers kept as is - “No Attn”, (ii) Make-A-Video architecture without temporal convolutional layers with the spatial convolutional layers kept as is - “No Conv”, and, (iii) our complete Make-A-Video architecture - “Full”. All models were trained for 100K iterations. As can be seen, both the temporal convolutional layers and temporal attention layers are important to improve video quality and text faithfulness.
|
| 298 |
+
|
| 299 |
+
Table 5: Ablation study on architecture and training design choices. Results are reported on zeroshot generation on MSR-VTT. We report CLIPSIM scores computed on static frames. Quality shows the percentage of human raters that prefer the results of our Make-A-Video model over the baselines.
|
| 300 |
+
|
| 301 |
+
<table><tr><td>Method</td><td>CLIPSIM (↑) Quality (↑)</td></tr><tr><td>From Scratch</td><td>0.246 63.31%</td></tr><tr><td>No Conv</td><td>0.256 52.04%</td></tr><tr><td>No Attn</td><td>0.257 55.25%</td></tr><tr><td>Full</td><td>0.258 1</td></tr></table>
|
| 302 |
+
|
| 303 |
+
Table 6: Human evaluation comparing the effects of different components. Results are evaluated on the human evaluation set with 300 prompts. Quality shows the percentage of the human raters who prefer the results of setting B in each comparison.
|
| 304 |
+
|
| 305 |
+
<table><tr><td>Comparison</td><td> Setting A</td><td>Setting B</td><td>Quality (↑)</td></tr><tr><td>1</td><td>16 ×64× 64</td><td>16 ×256×256</td><td>92.48%</td></tr><tr><td>2</td><td>16 × 256× 256</td><td>76 × 256× 256</td><td>68.30%</td></tr><tr><td>3</td><td>16 × 256×256</td><td>16× 768 ×768</td><td>60.13%</td></tr><tr><td>4</td><td>16 × 256 × 256 (static SR)</td><td>16 × 256× 256</td><td>54.25%</td></tr><tr><td>5</td><td>16 × 768 × 768 (random noise)</td><td>16 × 768 × 768</td><td>50.98%</td></tr></table>
|
| 306 |
+
|
| 307 |
+
In addition to architecture design ablation, we justify our decision to initialize the T2V model with the weights of a pre-trained T2I model. We begin by reporting CLIPSIM and subjective quality evaluation metrics on a T2V model trained from scratch 100K iterations - “From Scratch”. As can be seen in Tab. 5, the model initialized with a pre-trained T2I weights (“Full”) outperforms the model trained from scratch when trained the same number of iterations. In addition, the model initialized with pre-trained T2I weights achieves the CLIPSIM score of the model trained from scratch after just 50K iterations, demonstrating the acceleration achieved by initializing with the weights of a T2I model.
|
| 308 |
+
|
| 309 |
+
# 6.3 EFFECTS OF DIFFERENT COMPONENTS
|
| 310 |
+
|
| 311 |
+
Our framework consists of several components that are independently trained and sequentially applied during inference. These models include: 1) a decoder that generates a video of $1 6 \times 6 4 \times 6 4$ from the image embedding generated from a prior model; 2) an interpolation model that improves the frame rate and generates a video of $7 6 \times 6 4 \times 6 4 ; 3$ ) a temporal super-resolution model that improves the video resolution by considering temporal information and generates a video of $7 6 \times 2 5 6 \times 2 5 6 ;$ ; 4) a second super-resolution model that is applied independently on each frame with the same sampled frame noise and generates the final video of $7 6 \times 7 6 8 \times 7 6 8$ .
|
| 312 |
+
|
| 313 |
+
We study the contributions of each of these components through human evaluation. The results are shown in Table 6. We have the following observations. First, improving the resolution from 64 to 256 helps boost the video quality significantly (Comparison 1). Second, increasing the frame rate from 4 fps (16 frames) to 19 fps (76 frames) also help to increase the quality quite a bit (Comparison 2). Third, further increasing the resolution from 256 to 768 can still boost the quality (Comparison 3). These three comparisons have demonstrated the effectiveness of our interpolation model, and two super-resolution models in improving the quality of the generated videos.
|
| 314 |
+
|
| 315 |
+
Furthermore, we also compare our temporal super-resolution model with a static super-resolution model. The latter is applied independently on each frame without considering temporal information. As shown in Table 6 (Comparison 4), the temporal super-resolution model shows better video quality compared to the static super-resolution model. This justifies our use of a temporal super-resolution model at the 256 resolution level. Another comparison we have done is to validate the effect of a fixed frame noise for the second super-resolution model. As shown in the last row of 6, using fixed noise has a slightly better result compared to using random noise for each frame.
|
| 316 |
+
|
| 317 |
+

|
| 318 |
+
(a) T2V Generation: comparison between VDM (top), CogVideo (mid), and Ours (bottom) for input “Busy freeway at night”.
|
| 319 |
+
|
| 320 |
+

|
| 321 |
+
|
| 322 |
+
(b) Image Animation: leftmost shows the input image, and we animated it to be a video.
|
| 323 |
+
|
| 324 |
+

|
| 325 |
+
|
| 326 |
+
(c) Image Interpolation: given two images (leftmost and rightmost), we interpolate frames. Comparing FILM (left) and Ours (right).
|
| 327 |
+
|
| 328 |
+

|
| 329 |
+
(d) Video Variation: we can generate a new video (bottom) as a variant to the original video (top).
|
| 330 |
+
Figure 4: Qualitative results for various comparisons and applications.
|
| 331 |
+
|
| 332 |
+
Table 7: Hyperparameters for the models
|
| 333 |
+
|
| 334 |
+
<table><tr><td></td><td>P</td><td>D ; Dt</td><td>个F</td><td>SRi ; SRt</td><td>SRh</td></tr><tr><td>Diffusion steps</td><td>1000</td><td>1000</td><td>1000</td><td>1000</td><td>1000</td></tr><tr><td>Noise schedule</td><td>cosine</td><td>cosine</td><td>cosine</td><td>cosine</td><td>linear</td></tr><tr><td>Objective</td><td>Xstart</td><td>E</td><td>E</td><td>Xstart</td><td>Xstart</td></tr><tr><td>Sampling steps</td><td>64</td><td>100</td><td>50</td><td>50</td><td>50</td></tr><tr><td>Sampling variance method</td><td>analytic</td><td>DDPM</td><td>DDPM</td><td>DDIM</td><td>DDIM</td></tr><tr><td>Crop fraction</td><td>=</td><td></td><td>1</td><td>1</td><td>1</td></tr><tr><td>Model size</td><td>1.3B</td><td>2.2B;3.1B</td><td>3.1B</td><td>1B ;1.4B</td><td>730M</td></tr><tr><td>Channels</td><td>=</td><td>512</td><td>512</td><td>320</td><td>320</td></tr><tr><td>Depth</td><td>1</td><td>3</td><td>3</td><td>3</td><td>3</td></tr><tr><td>Channels multiple</td><td>64</td><td>1,2,3,4</td><td>1,2,3,4</td><td>1,1,2,2,4,4</td><td>1,2,3,4</td></tr><tr><td>Headschannels</td><td>1</td><td>64</td><td>64</td><td></td><td>=</td></tr><tr><td>Attention resolution</td><td>=</td><td>32,16,8</td><td>32,16,8</td><td></td><td></td></tr><tr><td>Text encoder context</td><td>128</td><td></td><td>=</td><td></td><td></td></tr><tr><td>Text encoder width</td><td>2048</td><td></td><td></td><td></td><td></td></tr><tr><td>Text encoder depth</td><td>24</td><td>=</td><td>=</td><td>=</td><td>=</td></tr><tr><td>Text encoder heads</td><td>32</td><td>■</td><td>=</td><td>=</td><td></td></tr><tr><td>Dropout</td><td>1</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td></tr><tr><td>Weight decay</td><td>6.0e-2</td><td>1</td><td>1</td><td>=</td><td>1</td></tr><tr><td>Batch size</td><td>4096</td><td>2048 ; 512</td><td>512</td><td>1024; 256</td><td>1024</td></tr><tr><td>Iterations</td><td>3M</td><td>2M ;200K</td><td>100K</td><td>700K ;150K</td><td>700K</td></tr><tr><td>Learning rate</td><td>1.1e-4</td><td>6.0e-5</td><td>6.0e-5</td><td>1.2e - 4 ;6.0e -5</td><td>1.2e-4</td></tr><tr><td>Adam β2</td><td>0.96</td><td>0.999</td><td>0.999</td><td>0.999</td><td>0.999</td></tr><tr><td>Adam e</td><td>1.0e-6</td><td>1.0e-8</td><td>1.0e-8</td><td>1.0e-8</td><td>1.0e-8</td></tr><tr><td>EMA decay</td><td>0.9999</td><td>0.9999</td><td>0.9999</td><td></td><td></td></tr><tr><td>Model Parameters (B)</td><td>1.3</td><td>3.1</td><td>3.1</td><td>0.9999 1.4</td><td>0.9999 0.7</td></tr></table>
|
md/dev/xENf4QUL4LW/xENf4QUL4LW.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|