Datasets:
Add files using upload-large-folder tool
Browse files- md/dev/-70L8lpp9DF/-70L8lpp9DF.md +0 -0
- md/dev/0gouO5saq6K/0gouO5saq6K.md +324 -0
- md/dev/2EufPS5ABlJ/2EufPS5ABlJ.md +0 -0
- md/dev/3s9IrEsjLyk/3s9IrEsjLyk.md +358 -0
- md/dev/3tYvDb4dwab/3tYvDb4dwab.md +292 -0
- md/dev/5JdLZg346Lw/5JdLZg346Lw.md +681 -0
- md/dev/6HN7LHyzGgC/6HN7LHyzGgC.md +398 -0
- md/dev/6dlC7E1H_9/6dlC7E1H_9.md +0 -0
- md/dev/A1yGs_SWiIi/A1yGs_SWiIi.md +299 -0
- md/dev/AOKU4nRw1W/AOKU4nRw1W.md +429 -0
- md/dev/B4tkwuzeiY/B4tkwuzeiY.md +520 -0
- md/dev/BryMFPQ4L6/BryMFPQ4L6.md +226 -0
- md/dev/CbsJ53LdKc/CbsJ53LdKc.md +281 -0
- md/dev/CuV_qYkmKb3/CuV_qYkmKb3.md +0 -0
- md/dev/CzceR82CYc/CzceR82CYc.md +0 -0
- md/dev/DAxQXzdq8SF/DAxQXzdq8SF.md +0 -0
- md/dev/FKXVK9dyMM/FKXVK9dyMM.md +378 -0
- md/dev/IFXTZERXdM7/IFXTZERXdM7.md +0 -0
- md/dev/IJNDyqdRF0m/IJNDyqdRF0m.md +429 -0
- md/dev/JXhROKNZzOc/JXhROKNZzOc.md +510 -0
- md/dev/JvIFpZOjLF4/JvIFpZOjLF4.md +391 -0
- md/dev/K3BMejPSyQ/K3BMejPSyQ.md +546 -0
- md/dev/LSKlp_aceOC/LSKlp_aceOC.md +271 -0
- md/dev/MbCAOMGsZXC/MbCAOMGsZXC.md +239 -0
- md/dev/O476oWmiNNp/O476oWmiNNp.md +0 -0
- md/dev/VNqaB1g9393/VNqaB1g9393.md +321 -0
- md/dev/VOstHxDdsN/VOstHxDdsN.md +318 -0
- md/dev/XomEU3eNeSQ/XomEU3eNeSQ.md +355 -0
- md/dev/_keb_XuP5oI/_keb_XuP5oI.md +341 -0
- md/dev/aBsCjcPu_tE/aBsCjcPu_tE.md +645 -0
- md/dev/e2TBb5y0yFf/e2TBb5y0yFf.md +268 -0
- md/dev/eHrqmewX1B-/eHrqmewX1B-.md +393 -0
- md/dev/ePhEbo039l/ePhEbo039l.md +330 -0
- md/dev/eYciPrLuUhG/eYciPrLuUhG.md +0 -0
- md/dev/ek9a0qIafW/ek9a0qIafW.md +454 -0
- md/dev/gEZrGCozdqR/gEZrGCozdqR.md +0 -0
- md/dev/gJcEM8sxHK/gJcEM8sxHK.md +339 -0
- md/dev/lYNSvp51a7/lYNSvp51a7.md +412 -0
- md/dev/ldRb12nMfLQ/ldRb12nMfLQ.md +228 -0
- md/dev/nId8ZtIXub/nId8ZtIXub.md +486 -0
- md/dev/nVV6S2sb_UL/nVV6S2sb_UL.md +393 -0
- md/dev/ppJuFSOAnM/ppJuFSOAnM.md +0 -0
- md/dev/qY1hlv7gwg/qY1hlv7gwg.md +566 -0
- md/dev/rB6TpjAuSRy/rB6TpjAuSRy.md +454 -0
- md/dev/rTvH1_SRyXs/rTvH1_SRyXs.md +292 -0
- md/dev/rY2wXCSruO/rY2wXCSruO.md +285 -0
- md/dev/td6xbEOPLr/td6xbEOPLr.md +392 -0
- md/dev/uytgM9N0vlR/uytgM9N0vlR.md +301 -0
- md/dev/wtqb7pNL4e/wtqb7pNL4e.md +281 -0
- md/dev/x1FgW3vSM6/x1FgW3vSM6.md +407 -0
md/dev/-70L8lpp9DF/-70L8lpp9DF.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/0gouO5saq6K/0gouO5saq6K.md
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Multi-Game Decision Transformers
|
| 2 |
+
|
| 3 |
+
Kuang-Huei Lee∗ Ofir Nachum∗ Mengjiao Yang Lisa Lee
|
| 4 |
+
|
| 5 |
+
# Daniel Freeman Winnie Xu Sergio Guadarrama Ian Fischer
|
| 6 |
+
|
| 7 |
+
Eric Jang Henryk Michalewski Igor Mordatch∗
|
| 8 |
+
|
| 9 |
+
Google Research
|
| 10 |
+
|
| 11 |
+
# Abstract
|
| 12 |
+
|
| 13 |
+
A longstanding goal of the field of AI is a method for learning a highly capable, generalist agent from diverse experience. In the subfields of vision and language, this was largely achieved by scaling up transformer-based models and training them on large, diverse datasets. Motivated by this progress, we investigate whether the same strategy can be used to produce generalist reinforcement learning agents. Specifically, we show that a single transformer-based model – with a single set of weights – trained purely offline can play a suite of up to 46 Atari games simultaneously at close-to-human performance. When trained and evaluated appropriately, we find that the same trends observed in language and vision hold, including scaling of performance with model size and rapid adaptation to new games via fine-tuning. We compare several approaches in this multi-game setting, such as online and offline RL methods and behavioral cloning, and find that our Multi-Game Decision Transformer models offer the best scalability and performance. We release the pre-trained models and code to encourage further research in this direction.1
|
| 14 |
+
|
| 15 |
+
# 1 Introduction
|
| 16 |
+
|
| 17 |
+
Building large-scale generalist models that solve many tasks by training on massive task-agnostic datasets has emerged as a dominant approach in natural language processing [18, 12], computer vision [19, 6], and their intersection [61, 4]. These models can adapt to new tasks (such as translation [63, 78]), make use of unrelated data (such as using high-resource language to improve translations of low-resource languages [17]), or even incorporate new modalities by projecting images into language space [46, 75]. The success of these methods largely derives from a combination of scalable model architectures [77], an abundance of unlabeled task-agnostic data, and continuous improvements in high performance computing infrastructure. Crucially, scaling laws [38, 31] indicate that performance gains due to scale have not yet reached a saturation point.
|
| 18 |
+
|
| 19 |
+
In this work, we argue that a similar progression is possible in the field of reinforcement learning, and take initial steps toward scalable methods that produce highly capable generalist agents. In contrast to vision and language domains, reinforcement learning has seen advocacy for the use of smaller models [16, 49, 8] and is usually either used to solve single tasks, or multiple tasks within the same environment. Importantly, training across multiple environments – with very different dynamics, rewards, visuals, and agent embodiments – has been studied less significantly.
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Aggregates of human-normalized scores (Inter-Quartile Mean) across 41 Atari games. Grey bars are single-game specialist models while blue are generalists. Single-game BCQ [21] results are from Gulcehre et al. [25]. Multi-game models are all trained on a dataset [1] with inter-quartile mean human-normalized score of $101 \%$ , which Multi-Game DT notably exceeds.
|
| 23 |
+
|
| 24 |
+
Specifically, we investigate whether a single model – with a single set of parameters – can be trained to act in multiple environments from large amounts of expert and non-expert experience. We consider training on a suite of 41 Atari games [9, 25] for their diversity, informally asking “Can models learn something universal from playing many video games?”. To train this model, we use only the previously-collected trajectories from Agarwal et al. [1], but we evaluate our agent interactively. We are not striving for mastery or efficiency that game-specific agents can offer, as we believe we are still in early stages of this research agenda. Rather, we investigate whether the same trends observed in language and vision hold for large-scale generalist reinforcement learning agents.
|
| 25 |
+
|
| 26 |
+
We find that we can train a single agent that achieves $126 \%$ of human-level performance simultaneously across all games after training on offline expert and non-expert datasets (see Figure 1). Furthermore, we see similar trends that mirror those observed in language and vision: rapid finetuning to never-before-seen games with very little data (Section 4.5), a scaling relationship between performance and model size (Section 4.4), and faster training progress for larger models (Appendix G).
|
| 27 |
+
|
| 28 |
+
Notably, not all existing approaches to multi-environment training work well. We investigate several approaches, including treating the problem as offline decision transformer-based sequence modeling [14, 35], online RL [53], offline temporal difference methods [42], contrastive representations [56], and behavior cloning [60]. We find that decision transformer based models offer the best performance and scaling properties in the multi-environment regime. However, to permit training on both expert and non-expert trajectories, we find it is necessary to use a guided generation technique from language modeling to generate expert-level actions, which is an important departure from standard decision transformers.
|
| 29 |
+
|
| 30 |
+
Our contributions are threefold: First, we show that it is possible to train a single high-performing generalist agent to act across multiple environments from offline data alone. Second, we show that scaling trends observed in language and vision hold. And third, we compare multiple approaches for achieving this goal, finding that decision transformers combined with guided generation perform the best. It is our hope this study can inspire further research in generalist agents. To aid this, we make our pre-trained models and code publicly available.
|
| 31 |
+
|
| 32 |
+

|
| 33 |
+
Figure 2: An overview of the training and evaluation setup. We observe expert-level game-play in the interactive setting after offline learning from trajectories ranging from beginner to expert.
|
| 34 |
+
|
| 35 |
+
# 2 Related Work
|
| 36 |
+
|
| 37 |
+
A generalist agent for solving a variety of environments has been a goal for artificial intelligence (AI) researchers since the inception of AI as a field of study [50]. This same reason motivated the introduction of the Atari suite (the Arcade Learning Environment, or ALE) as a testbed for learning algorithms [10]; in their own words, the ALE is for “empirically assessing agents designed for general competency.” While the celebrated deep $Q$ -learning [52] and actor critic [54] agents were among the first to use a single algorithm for all games, they nevertheless required separate training and hyperparameters for each game agent. Later works have demonstrated the ability to learn a single neural network agent on multiple Atari games simultaneously, either online [20] or via policy distillation [59, 67]. The aim of our work is similar – to learn a single agent for playing multiple Atari games – with a focus on offline learning. We demonstrate results with human-level competency on up to 46 games, which is unseen in the literature.
|
| 38 |
+
|
| 39 |
+
A closely related setting is learning to solve multiple tasks within the same or similar environments. For example in the robotics field, existing works propose to use language-conditioned tasks [48, 3, 34], while others posit goal-reaching as a way to learn general skills [51], among other proposals [37, 82]. In this work, we tackle the problem of learning to act in a large collection of environments with distinctively different dynamics, rewards, and agent embodiments. This complicated but important setting requires a different type of generalization that has been studied significantly less.
|
| 40 |
+
|
| 41 |
+
A concurrent work [65] also aims to train a transformer-based generalist agent based on offline data including for the ALE. This work differs from ours in that the offline training data is exclusively near-optimal and it requires prompting by expert trajectories at inference time. In contrast, we extend decision transformers [14] from the Upside-Down RL family [71, 68] to learn from a diverse dataset (expert and non-expert data), predict returns, and pick optimality-conditioned returns. Furthermore, we provide comparisons against existing behavioral cloning, online and offline RL methods, and contrastive representations [80, 56]. Other works that also consider LLM-like sequence modeling for a variety of single control tasks include [66, 84, 35, 23, 57].
|
| 42 |
+
|
| 43 |
+
# 3 Method
|
| 44 |
+
|
| 45 |
+
We consider a decision-making agent that at every time $t$ receives an observation of the world $\mathbf { o } ^ { t }$ , chooses an action $a ^ { t }$ , and receives a scalar reward $r ^ { t }$ . Our goal is to learn a single optimal policy distribution $P _ { \theta } ^ { * } ( a ^ { t } | \mathbf { o } ^ { \le t } , a ^ { < t } , r ^ { < t } )$ with parameters $\theta$ that maximizes the agent’s total future return $\begin{array} { r } { R ^ { t } = \sum _ { k > t } r ^ { k } } \end{array}$ on all the environments we consider.
|
| 46 |
+
|
| 47 |
+
# 3.1 Reinforcement Learning as Sequence Modeling
|
| 48 |
+
|
| 49 |
+
Following [14], we pose the problem of offline reinforcement learning as a sequence modeling problem where we model the probability of the next sequence token $x _ { i }$ conditioned on all tokens prior to it: $P _ { \theta } ( x _ { i } | x _ { < i } )$ , similar to contemporary decoder-only sequence models [12, 15, 62]. The sequences we consider have the form:
|
| 50 |
+
|
| 51 |
+
$$
|
| 52 |
+
x = \langle . . . , { \bf o } _ { 1 } ^ { t } , . . . , { \bf o } _ { M } ^ { t } , \hat { R } ^ { t } , a ^ { t } , r ^ { t } , . . . \rangle
|
| 53 |
+
$$
|
| 54 |
+
|
| 55 |
+
where $t$ represents a time-step, $M$ is the number of image patches per observation (which we further discuss in Section 3.2), and $\hat { R } ^ { t }$ is the agent’s target return for the rest of the sequence. Such a sequence order respects the causal structure of the environment decision process. Figure 3 presents an overview of our model architecture.
|
| 56 |
+
|
| 57 |
+
Returns, actions, and rewards are tokenized (See Section 3.2 for details), and we train the model to predict the next return, action, and reward discrete token in a sequence via standard cross-entropy loss. The sequence we consider is different from Chen et al. [14], which has $\langle . . . , \hat { R } ^ { t } , \mathbf { o } ^ { t } , a ^ { t } , . . . \rangle$ . Our design allows predicting the return distribution and sampling from it, instead of relying on a user to manually select an expert-level return at inference time (See Section 3.4).
|
| 58 |
+
|
| 59 |
+
Predicting future value and rewards have been shown to be useful objectives for learning better representations in artificial reinforcement learning agents [47, 69, 44] and important signals for representation learning in humans [5]. Thus, while we may not directly use all of the predicted quantities, the task of predicting them encourages structure and representation learning of our environments. In this work, we do not attempt to predict future observations due to their non-discrete nature and the additional model capacity that would be required to generate images. However, building image-based forward prediction models of the environment has been shown to be a useful representation objective for RL [28, 27, 29]. We leave it for future investigation.
|
| 60 |
+
|
| 61 |
+

|
| 62 |
+
Figure 3: An overview of our decision transformer architecture.
|
| 63 |
+
|
| 64 |
+
# 3.2 Tokenization
|
| 65 |
+
|
| 66 |
+
To generate returns, actions, and rewards via multinomial distributions similarly to language generation, we convert these quantities to discrete tokens. Actions $a$ are already discrete quantities in the environments we consider. We convert scalar rewards to ternary quantities $\{ - 1 , 0 , + 1 \}$ , and uniformly quantize returns into a discrete range shared by all our environments.2
|
| 67 |
+
|
| 68 |
+
Inspired by the simplicity and effectiveness of transformer architectures for processing images [19], we divide each observation image into a collection of $M$ patches3 (see Figure 3). Each patch is additively combined with a trainable position encoding and linearly projected into the input token embedding space. We experimented with using image tokenizations coming from a convolutional network, but did not find it to have a significant benefit and omitted it for simplicity.
|
| 69 |
+
|
| 70 |
+
We chose our tokenization scheme with simplicity in mind, but many other schemes are possible. While all our environments use a shared action space, varying action spaces when controlling different agent morphologies can still be tokenized using methods of [33, 43, 26]. And while we used uniform quantization to discretize continuous quantities, more sophisticated methods such as VQ-VAE [76] can be used to learn more effective discretizations.
|
| 71 |
+
|
| 72 |
+
# 3.3 Training Dataset
|
| 73 |
+
|
| 74 |
+
To train the model, we use an existing dataset of Atari trajectories (with quantized returns) introduced in [1]. The dataset contains trajectories collected from the training progress of a DQN agent [53]. Following [25], we select 46 games where DQN significantly outperforms a random agent. 41 games are used for training and 5 games are held out for out-of-distribution generalization experiments.
|
| 75 |
+
|
| 76 |
+
We chose 5 held-out games representing different categories including Alien and MsPacman (maze based), Pong (ball tracking), SpaceInvaders (shoot vertically), and StarGunner (shoot horizontally), to ensure out-of-distribution generalization can be evaluated on different types of games.
|
| 77 |
+
|
| 78 |
+
For each of 41 games, we use data from 2 training runs, each containing roll-outs from 50 policy checkpoints, in turn each containing 1 million environment steps. This totals 4.1 billion steps. Using the tokenization scheme in previous sections, the dataset contains almost 160 billion tokens.
|
| 79 |
+
|
| 80 |
+
As the dataset contains agent behaviors at all stages of learning, it contains both expert and non-expert behaviors. We do not perform any special filtering, curation, or balancing of the dataset. The motivation to train on such data instead of expert-only behaviors is twofold: Firstly, sub-optimal behaviors are more diverse than optimal behaviors and may still be useful for learning representations of the environment and consequences of poor decisions. Secondly, it may be difficult to create a single binary criteria for optimality as it is typically a graded quantity. Thus, instead of assuming only task-relevant expert behaviors, we train our model on all available behaviors, yet generate expert behavior at inference time as described in the next section.
|
| 81 |
+
|
| 82 |
+
# 3.4 Expert Action Inference
|
| 83 |
+
|
| 84 |
+
As described above, our training datasets contain a mix of expert and non-expert behaviors, thus directly generating actions from the model imitating the data is unlikely to consistently produce expert behavior (as we confirm in Section 4.7). Instead, we want to control action generation to consistently produce actions of highly-rewarding behavior. This mirrors the problem of discriminator-guided generation in language models, for which a variety of methods have been proposed [40, 79, 58].
|
| 85 |
+
|
| 86 |
+
We propose an inference-time method inspired by [40] and assume a binary classifier $P ( \mathbf { e x p e r t } ^ { t } | . . . )$ that identifies whether or not the behavior is expert-level before taking an action at time $t$ . Following Bayes’ rule, the distribution of expert-level returns at time $t$ is then:
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
P ( \mathrm { e x p e r t } ^ { t } | R ^ { t } , \ldots ) \propto \exp ( \kappa ( R ^ { t } - R _ { l o w } ) / ( R _ { h i g h } - R _ { l o w } ) )
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
where $R _ { l o w }$ is the return lower bound and $R _ { h i g h }$ is the return upper bound. Similarly to [70, 73, 74, 39], we define a binary classifier to be proportional to future return with inverse temperature $\kappa ^ { 4 }$ :
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
P ( { \mathrm { e x p e r t } } ^ { t } | R ^ { t } , \ldots ) \equiv \exp ( \kappa R ^ { t } )
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+
This results in a simple auto-regressive procedure where we first sample high-but-plausible target returns $R ^ { t }$ according to log-probability $\log P _ { \theta } ( R ^ { t } | \ldots ) + \kappa ( R ^ { t } - R _ { l o w } ) / ( R _ { h i g h } ^ { - } - \dot { R } _ { l o w } )$ , and then sample actions according to $P _ { \theta } ( a ^ { t } | R ^ { t } , . . . )$ . See Figure 4 for an illustration of this procedure and Appendix B.3 for implementation details. It can be seen as a variation of return-conditioned policies [41, 71, 14] that automatically generates expert-level (but likely) returns at every timestep, instead of manually fixing them for the duration of the episode.
|
| 99 |
+
|
| 100 |
+

|
| 101 |
+
Figure 4: An illustration of our expert-level return and action sampling procedure. $P _ { \theta } ( R | . . . )$ and $\bar { P _ { \theta } ( a | R . . . ) }$ are the distributions learned by the sequence model.
|
| 102 |
+
|
| 103 |
+
Importantly, this formulation only affects the inference procedure of the model – training is entirely unaffected and can rely on standard next-token prediction frameworks and infrastructure. While we chose this formulation for its simplicity, controllable generation is an active area of study and we expect other more effective methods to be introduced in the future. As such, our contribution is to point out a connection between problems of controllable generation in language modeling and optimality conditioning in control.
|
| 104 |
+
|
| 105 |
+
# 4 Experiments
|
| 106 |
+
|
| 107 |
+
We formulate our experiments to answer a number of questions that are addressed in following sections:
|
| 108 |
+
|
| 109 |
+
• How do different online and offline methods perform in the multi-game regime? • How do different methods scale with model size? • How effective are different methods at transfer to novel games?
|
| 110 |
+
|
| 111 |
+
• Does multi-game decision transformer improve upon training data? • Does expert action inference (Section 3.4) improve upon behavioral cloning? • Does training on expert and non-expert data bring benefits over expert-only training?
|
| 112 |
+
|
| 113 |
+
We also consider whether there are benefits to specifically using the transformer architecture in Appendix D, and qualitatively explore the attention behavior of these models in Appendix H.
|
| 114 |
+
|
| 115 |
+
# 4.1 Setup
|
| 116 |
+
|
| 117 |
+
Model Variants and Scaling. We base our decision transformer (DT) configuration on GPT-2 [12] as summarized in Appendix B.1. We report results for DT-200M (a Multi-Game DT with 200M parameters) if not specified otherwise. Other smaller variants are DT-40M and DT-10M. We set sequence length to 4 game frames for all experiments, which results in sequences of 156 tokens.
|
| 118 |
+
|
| 119 |
+
Training and Fine-tuning. We train all Multi-Game DT models on TPUv4 hardware and the Jaxline (Babuschkin et al. [7]) framework for 10M steps using the LAMB optimizer [81] with a $3 \cdot 1 0 ^ { - 4 }$ learning rate, 4000 steps linear warm-up, no weight decay, gradient clip 1.0, $\beta _ { 1 } = 0 . 9$ and $\beta _ { 2 } = 0 . 9 9 9$ , and batch size 2048. For fine-tuning on novel games, we train for 100k steps with a $1 0 ^ { - 4 }$ learning rate, $1 0 ^ { - 2 }$ weight decay and batch size of 256 instead. Both regimes used image augmentations as described in Appendix B.5.
|
| 120 |
+
|
| 121 |
+
Metrics. We measure performance on individual Atari games by human normalized scores (HNS) [53], i.e. $( \mathrm { s c o r e - s c o r e } _ { \mathrm { r a n d o m } } ) / ( \mathrm { s c o r e } _ { \mathrm { h u m a n } } \mathrm { - s c o r e } _ { \mathrm { r a n d o m } } )$ , or DQN-normalized scores, i.e. normalizing by the best DQN scores seen in the training dataset instead of using human scores. To create an aggregate comparison metric across all games, we use inter-quartile mean (IQM) of humannormalized scores across all games, following evaluation best practices proposed in [2]. Due to the prohibitively long training times, we only evaluated one training seed. We additionally report median aggregate metric in Appendix E.
|
| 122 |
+
|
| 123 |
+
# 4.2 Baseline Methods
|
| 124 |
+
|
| 125 |
+
BC Our Decision Transformer (Section 3.1) can be reduced to a transformer-based Behavioral Cloning (BC) [60] agent by removing the target return condition and return token prediction. Similar to what we do for Decision Transformer, we also learn BC models at different scales (10M, 40M, 200M parameters) while keeping other configurations unchanged.
|
| 126 |
+
|
| 127 |
+
C51 DQN As a point of comparison for online performance, we use the C51 algorithm [11] which is a variant of deep $Q$ -learning (DQN) but with a categorical loss for minimizing the temporal difference (TD) errors. Following improvements suggested in Hessel et al. [30] as well as our own empirical observations, we use multi-step learning with $n = 4$ . For the single-game experiments, we use the standard convolutional neural network (CNN) used in the implementation of C51 [13]. For the multi-game experiments, we modify the C51 implementation based on a hyperparameter search to use an Impala neural network architecture [20] with three blocks using 64, 128, and 128 channels respectively with a batch size of 128 and update period of 256.
|
| 128 |
+
|
| 129 |
+
CQL For an offline TD-based learning algorithm we use conservative $Q$ -learning (CQL) [42]. Namely, we augment the categorical loss of C51 with a behavioral cloning loss minimizing $- \log \pi _ { Q } ( a | s )$ , where $( s , a )$ is a state-action pair sampled from the offline dataset and $\pi _ { Q } ( \cdot | s ) \bar { = }$ softmax $( Q ( s , \cdot ) )$ . Following the recommendations in Kumar et al. [42] we weight the contribution of the BC loss by 1 when using $100 \%$ of the offline data (multi-game training) and 4 when using $1 \%$ (single-game finetuning). For scaling experiments, we vary the number of blocks and channels in each block of the Impala: the number of blocks and channels is one of (5 blocks, 128 channels) $\approx$ 5M params, (10 blocks, 256 channels) $\approx 3 0 \mathrm { M }$ params, (5 blocks, 512 channels) $\approx 6 0 \mathrm { M }$ params, (10 blocks, 512 channels) $\approx 1 2 0 \mathrm { M }$ params.
|
| 130 |
+
|
| 131 |
+
CPC, BERT, and ACL For rapid adaptation to new games via fine-tuning, we consider representation learning baselines including contrastive predictive coding (CPC) [56], BERT pretraining [18], and attentive contrastive learning (ACL) [80]. All state representation networks are implemented as additional multi-layer perceptrons (MLPs) or transformer layers on top of the Impala CNN used in C51 and CQL baselines. CPC uses two additional MLP layers with 512 units each interleaved with ReLU activation to represent $\phi ( s )$ , which is optimized by maximizing $\phi ( s ) ^ { \top } W \phi ( s ^ { \prime } )$ of true transitions $( s , s ^ { \prime } )$ and minimizing $\phi ( s ) ^ { \top } W \phi ( { \tilde { s } } )$ where $\tilde { s }$ is a state randomly sampled from the batch (including states from other games). For BERT pretraining, we use 2 self-attention layers with 4 attention heads of 256 units each and feed-forward dimension 512, and train $\phi ( s )$ using BERT’s masked self-prediction loss on a trajectory of sequence length 16. ACL shares the same model parametrization as BERT, with the inclusion of action prediction in the pretraining objective.
|
| 132 |
+
|
| 133 |
+
# 4.3 How do different online and offline methods perform in the multi-game regime?
|
| 134 |
+
|
| 135 |
+
We compare different online and offline algorithms in the multi-game regime and their single-game counterparts in Figure 1. We find that single-game specialists are still most performant. Among multigame generalist models, our Multi-Game Decision Transformer model comes closest to specialist performance. Multi-game online RL with non-transformer models comes second, while we struggled to get good performance with offline non-transformer models. We note that our multi-game online C51 DQN median score of $68 \%$ (see Appendix E) which compares similarly to multi-game median Impala score of $70 \%$ , which we calculated from results reported by [20] for our suite of games.
|
| 136 |
+
|
| 137 |
+
We believe the apparent advantage of offline DT compared to online multi-game methods like C51 may be explained in part through classical differences between online and offline settings in RL [45]. Online methods must balance exploration with the ability to learn and generalize from experience, which could be challenging in the multi-game setting, whereas offline DT only needs to learn to distill and generalize from the fixed multi-game experience given to it (collected by specialist DQN agents [1]). Beyond the difference between online and offline, one could also argue that C51 suffers from more training instability than DT due to the use of a temporal difference (TD) loss, which we discuss in the next paragraph.
|
| 138 |
+
|
| 139 |
+
# 4.4 How do different methods scale with model size?
|
| 140 |
+
|
| 141 |
+
In large language and vision models, lowest-achievable training loss typically decreases predictably with increasing model size. Kaplan et al. [38] demonstrated an empirical scaling relationship between the capacity of a language model (NLP terminology for a next-token autoregressive generative model) and its performance (negative log likelihood on held-out data). These trends were verified over many orders of magnitude of model size, ranging from few-million parameter models to hundreds of billion parameter models.
|
| 142 |
+
|
| 143 |
+

|
| 144 |
+
|
| 145 |
+

|
| 146 |
+
(b) Scaling of IQM scores for all novel games after fine-tuning DT and CQL.
|
| 147 |
+
|
| 148 |
+
(a) Scaling of IQM scores for all training games with different model sizes and architectures.
|
| 149 |
+
|
| 150 |
+
Figure 5: How model performance scales with model size, on training set games and novel games.
|
| 151 |
+
(Impala) indicates using the Impala CNN architecture.
|
| 152 |
+
|
| 153 |
+
We investigate whether similar trends hold for interactive in-game performance – not just training loss – and show a similar performance scaling trend in Figure 5a. Multi-Game Decision Transformer performance reliably increases over more than an order of magnitude of parameter scaling, whereas the other methods either saturate, or have much slower performance growth.
|
| 154 |
+
|
| 155 |
+
In contrast, in Figures 5a and 5b, we find that CQL does not improve with increased model size, and actually shows a sharp drop in the performance of larger models on the fine-tuning tasks. Temporal Difference (TD) methods suffer greater instability with larger model size in the multi-game setting, leading to this “inverse” scaling. Indeed, our attempts at other objectives closer to pure TD (C51, DQN, DDQN) led to even worse results (which we do not report). We note that similar conclusions about instability with respect to network size have been made by other work [22].
|
| 156 |
+
|
| 157 |
+
We also find that larger models train faster, in the sense of reaching higher in-game performance after observing the same number of tokens. We discuss these results in Appendix G.
|
| 158 |
+
|
| 159 |
+
# 4.5 How effective are different methods at transfer to novel games?
|
| 160 |
+
|
| 161 |
+
Pretraining for rapid adaptation to new games has not been explored widely on Atari games despite being a natural and well-motivated task due to its relevance to how humans transfer knowledge to new games. Nachum and Yang [55] employed pretraining on large offline data and fine-tunining on small expert data for Atari and compared to a set of state representation learning objectives based on bisimulation [24, 83], but their pretraining and fine-tuning use the same game. We are instead interested in the transfer ability of pretrained agents to new games.
|
| 162 |
+
|
| 163 |
+
We hence devise our own evaluation setup by pretraining DT, CQL, CPC, BERT, and ACL on the full datasets of the 41 training games with 100M steps each, and fine-tuning one model per held-out game using $1 \%$ (1M steps) from each game. The $1 \%$ fine-tuning data is uniformly sampled from the 50M step dataset without quality filtering. DT and CQL use the same objective for pretraining and fine-tuning, whereas CPC, BERT, and ACL each use their own pretraining objective and are fine-tuned using the BC objective. All methods are fine-tuned for 100,000 steps, which is much shorter than training any agent from scratch. We additionally include training CQL from scratch on the $1 \%$ held-out data to highlight the benefit of rapid fine-tuning.
|
| 164 |
+
|
| 165 |
+
Fine-tuning performance on the held-out games is shown in Figure 6. Pretraining with the DT objective performs the best across all games. All methods with pretraining outperform training CQL from scratch, which verifies our hypothesis that pretraining on other games should indeed help with rapid learning of a new game. CPC and BERT underperform DT, suggesting that learning state representations alone is not sufficient for desirable transfer performance. While ACL adds an action prediction auxiliary loss to BERT, it showed little effect, suggesting that modeling the actions in the right way on the offline data is important for good transfer performance. Furthermore, we find that fine-tuning performance improves as the DT model becomes larger, while CQL fine-tuning performance is inconsistent with model size (see Figure 5b).
|
| 166 |
+
|
| 167 |
+

|
| 168 |
+
Figure 6: Fine-tuning performance on $1 \%$ of 5 held-out games’ data after pretraining on other 41 games using DT, CQL, CPC, BERT, and ACL. All pretraining methods outperform training CQL from scratch on the $1 \%$ held-out data, highlighting the transfer benefit of pretraining on other games. DT performs the best among all methods considered.
|
| 169 |
+
|
| 170 |
+
# 4.6 Does multi-game decision transformer improve upon training data?
|
| 171 |
+
|
| 172 |
+
We want to evaluate whether decision transformer with expert action inference is capable of acting better than the best demonstrations seen during training. To do this, we look at the top 3 performing decision transformer model rollouts. We use top 3 rollouts instead of the mean across all rollouts to more fairly compare to the best demonstration, rather than an average expert demonstration. We show percentage improvement over best demonstration score for individual games in Figure 7. We see significant improvement over the training data in a number of games.
|
| 173 |
+
|
| 174 |
+

|
| 175 |
+
Figure 7: Percent of improvement of top 3 decision transformer rollouts over the best score in the training dataset. $0 \%$ indicates no improvement. Top-3 metric (instead of mean) is used to more fairly compare to the best – rather than expert average – demonstration score.
|
| 176 |
+
|
| 177 |
+

|
| 178 |
+
4.7 Does optimal action inference improve upon behavior cloning?
|
| 179 |
+
Figure 8: Comparison of per-game scores for decision transformer to behavioral cloning. Bars indicate $\pm$ standard deviation around the mean across 16 trials. We show DQN-normalized scores in this figure for better presentations.
|
| 180 |
+
|
| 181 |
+
In Figure 1 we see that IQM performance across all games is indeed significantly improved by generating optimality-conditioned actions. Figure 8 shows the mean and standard deviation of scores across all games. While behavior cloning may sometimes produce highly-rewarding episodes, it is less likely to do so. We find decision transformer outperforms behavioral cloning in 31 out of 41 games.
|
| 182 |
+
|
| 183 |
+
# 4.8 Does training on expert and non-expert data bring benefits over expert-only training?
|
| 184 |
+
|
| 185 |
+
We believe that, comparing to learning from expert demonstrations, learning from large, diverse datasets that include some expert data but primarily non-expert data help learning and improve performance. To verify this hypothesis, we filter our training data [1] from each game by episodic returns and only preserve top $10 \%$ trajectories to produce an expert dataset (see Appendix F for details). We use this expert dataset to train our multi-game decision transformer (DT-40M) and the transformer-based behavioral cloning model (BC-40M). Figure 9 compares these models trained on expert data and our DT-40M trained on all data.
|
| 186 |
+
|
| 187 |
+
We observe that (1) Training only on expert data improves behavioral cloning; (2) Training on full data, including expert and non-expert data, improves Decision Transformer; (3) Decision Transformer with full data outperforms behavioral cloning trained on expert data.
|
| 188 |
+
|
| 189 |
+

|
| 190 |
+
Figure 9: Comparison of 40M transformer models trained on full data and only expert data.
|
| 191 |
+
|
| 192 |
+
# 5 Conclusion
|
| 193 |
+
|
| 194 |
+
In the quest to develop highly capable and generalist agents, we have made important and measurable progress. Namely, our results exhibit a clear benefit of using large transformer-based models in multi-game domains, and the general trends in these results – performance improvements with larger models and the ability to rapidly fine-tune to new tasks – mirror the successes observed for large-scale vision and language models. Our results also highlight difficulties of online RL algorithms in handling the complexity of multi-game training on Atari. It is interesting to note that our best results are achieved by decision transformers, which essentially learn via supervised learning on sequence data, compared to alternative approaches such as temporal difference learning (more typical in reinforcement learning), policy gradients, and contrastive representation learning. This begs the question of whether online learning algorithms can be modified to be as “data-absorbent” as DT-like methods. While even our best generalist agents at times fall short of performance achieved by agents trained on a single task, this is broadly consistent with related works that have trained single models on many tasks [36, 65]. Still, our best generalist agents are already capable of outperforming the data they are trained on. We believe the trends suggest clear paths for future work – that, with larger models and larger suites of tasks, performance is likely to scale up commensurately.
|
| 195 |
+
|
| 196 |
+
Limitations. We acknowledge reasons for caution in over-generalizing our conclusions. Our results are based largely on performance in the Atari suite, where action and observation spaces are aligned across different games. It is unclear whether offline RL datasets such as Atari are of sufficient scale and diversity that we would see similar performance scaling as observed in NLP and vision benchmarks. Whether we can observe other forms of generalization, such as zero-shot adaptation, as well as whether our conclusions hold for other settings, remains unclear.
|
| 197 |
+
|
| 198 |
+
Societal Impacts. In the current setting, we do not foresee significant societal impact as the models are limited to playing simple video games. We emphasize that our current agents are not intended to interact with humans or be used outside of self-contained game-playing domains. One should exercise increased caution if extending our algorithms and methods to such situations in order to ensure any safety and ethical concerns are appropriately addressed. At the same time, the capability of decision making based on reward feedback – rather than purely imitation of the data – has the potential to be easier to align with human values and goals.
|
| 199 |
+
|
| 200 |
+
# Acknowledgements
|
| 201 |
+
|
| 202 |
+
We would like to thank Oscar Ramirez, Roopali Vij, Sabela Ramos, Rishabh Agarwal, Shixiang (Shane) Gu, Aleksandra Faust, Noah Fiedel, Chelsea Finn, Sergey Levine, John Canny, Kimin Lee, Hao Liu, Ed Chi, and Luke Metz for their valuable contributions and support for this work.
|
| 203 |
+
|
| 204 |
+
# References
|
| 205 |
+
|
| 206 |
+
[1] Rishabh Agarwal, Dale Schuurmans, and Mohammad Norouzi. An optimistic perspective on offline reinforcement learning. In International Conference on Machine Learning, pages 104–114. PMLR, 2020.
|
| 207 |
+
[2] Rishabh Agarwal, Max Schwarzer, Pablo Samuel Castro, Aaron C Courville, and Marc Bellemare. Deep reinforcement learning at the edge of the statistical precipice. Advances in Neural Information Processing Systems, 34, 2021.
|
| 208 |
+
[3] Michael Ahn, Anthony Brohan, Noah Brown, Yevgen Chebotar, Omar Cortes, Byron David, Chelsea Finn, Keerthana Gopalakrishnan, Karol Hausman, Alex Herzog, et al. Do as i can, not as i say: Grounding language in robotic affordances. arXiv preprint arXiv:2204.01691, 2022.
|
| 209 |
+
[4] Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katie Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. arXiv preprint arXiv:2204.14198, 2022.
|
| 210 |
+
[5] William H Alexander and Samuel J Gershman. Representation learning with reward prediction errors. arXiv preprint arXiv:2108.12402, 2021.
|
| 211 |
+
[6] Anurag Arnab, Mostafa Dehghani, Georg Heigold, Chen Sun, Mario Luciˇ c, and Cordelia Schmid. Vivit: A ´ video vision transformer. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 6836–6846, 2021.
|
| 212 |
+
[7] Igor Babuschkin, Kate Baumli, Alison Bell, Surya Bhupatiraju, Jake Bruce, Peter Buchlovsky, David Budden, Trevor Cai, Aidan Clark, Ivo Danihelka, Claudio Fantacci, Jonathan Godwin, Chris Jones, Tom Hennigan, Matteo Hessel, Steven Kapturowski, Thomas Keck, Iurii Kemaev, Michael King, Lena Martens, Vladimir Mikulik, Tamara Norman, John Quan, George Papamakarios, Roman Ring, Francisco Ruiz, Alvaro Sanchez, Rosalia Schneider, Eren Sezener, Stephen Spencer, Srivatsan Srinivasan, Wojciech Stokowiec, and Fabio Viola. The DeepMind JAX Ecosystem, 2020. URL http://github.com/deepmind.
|
| 213 |
+
[8] Osbert Bastani, Yewen Pu, and Armando Solar-Lezama. Verifiable reinforcement learning via policy extraction. Advances in neural information processing systems, 31, 2018.
|
| 214 |
+
[9] M. G. Bellemare, Y. Naddaf, J. Veness, and M. Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47:253–279, jun 2013.
|
| 215 |
+
[10] Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47:253–279, 2013.
|
| 216 |
+
[11] Marc G Bellemare, Will Dabney, and Rémi Munos. A distributional perspective on reinforcement learning. In International Conference on Machine Learning, pages 449–458. PMLR, 2017.
|
| 217 |
+
[12] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
|
| 218 |
+
[13] Pablo Samuel Castro, Subhodeep Moitra, Carles Gelada, Saurabh Kumar, and Marc G Bellemare. Dopamine: A research framework for deep reinforcement learning. arXiv preprint arXiv:1812.06110, 2018.
|
| 219 |
+
[14] Lili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee, Aditya Grover, Misha Laskin, Pieter Abbeel, Aravind Srinivas, and Igor Mordatch. Decision transformer: Reinforcement learning via sequence modeling. Advances in neural information processing systems, 34, 2021.
|
| 220 |
+
[15] Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022.
|
| 221 |
+
[16] Giuseppe Cuccu, Julian Togelius, and Philippe Cudré-Mauroux. Playing atari with six neurons. arXiv preprint arXiv:1806.01363, 2018.
|
| 222 |
+
[17] Rishabh Dabral, Ganesh Ramakrishnan, Preethi Jyothi, et al. Rudder: A cross lingual video and text retrieval dataset. arXiv preprint arXiv:2103.05457, 2021.
|
| 223 |
+
[18] 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.
|
| 224 |
+
[19] 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.
|
| 225 |
+
[20] Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Vlad Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, Tim Harley, Iain Dunning, et al. Impala: Scalable distributed deep-rl with importance weighted actor-learner architectures. In International Conference on Machine Learning, pages 1407–1416. PMLR, 2018.
|
| 226 |
+
[21] Scott Fujimoto, David Meger, and Doina Precup. Off-policy deep reinforcement learning without exploration. In International Conference on Machine Learning, pages 2052–2062. PMLR, 2019.
|
| 227 |
+
[22] Hiroki Furuta, Tadashi Kozuno, Tatsuya Matsushima, Yutaka Matsuo, and Shixiang Shane Gu. Coadaptation of algorithmic and implementational innovations in inference-based deep reinforcement learning. Advances in neural information processing systems, 34:9828–9842, 2021.
|
| 228 |
+
[23] Hiroki Furuta, Yutaka Matsuo, and Shixiang Shane Gu. Generalized decision transformer for offline hindsight information matching. arXiv preprint arXiv:2111.10364, 2021.
|
| 229 |
+
[24] Carles Gelada, Saurabh Kumar, Jacob Buckman, Ofir Nachum, and Marc G Bellemare. Deepmdp: Learning continuous latent space models for representation learning. In International Conference on Machine Learning, pages 2170–2179. PMLR, 2019.
|
| 230 |
+
[25] Caglar Gulcehre, Ziyu Wang, Alexander Novikov, Thomas Paine, Sergio Gómez, Konrad Zolna, Rishabh Agarwal, Josh S Merel, Daniel J Mankowitz, Cosmin Paduraru, et al. Rl unplugged: A suite of benchmarks for offline reinforcement learning. Advances in Neural Information Processing Systems, 33:7248–7259, 2020.
|
| 231 |
+
[26] Agrim Gupta, Silvio Savarese, Surya Ganguli, and Li Fei-Fei. Embodied intelligence via learning and evolution. Nature communications, 12(1):1–12, 2021.
|
| 232 |
+
[27] Danijar Hafner, Timothy Lillicrap, Jimmy Ba, and Mohammad Norouzi. Dream to control: Learning behaviors by latent imagination. In International Conference on Learning Representations, 2019.
|
| 233 |
+
[28] Danijar Hafner, Timothy Lillicrap, Ian Fischer, Ruben Villegas, David Ha, Honglak Lee, and James Davidson. Learning latent dynamics for planning from pixels. In International conference on machine learning, pages 2555–2565. PMLR, 2019.
|
| 234 |
+
[29] Danijar Hafner, Timothy P Lillicrap, Mohammad Norouzi, and Jimmy Ba. Mastering atari with discrete world models. In International Conference on Learning Representations, 2020.
|
| 235 |
+
[30] Matteo Hessel, Joseph Modayil, Hado Van Hasselt, Tom Schaul, Georg Ostrovski, Will Dabney, Dan Horgan, Bilal Piot, Mohammad Azar, and David Silver. Rainbow: Combining improvements in deep reinforcement learning. In Thirty-second AAAI conference on artificial intelligence, 2018.
|
| 236 |
+
[31] Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, et al. Training compute-optimal large language models. arXiv preprint arXiv:2203.15556, 2022.
|
| 237 |
+
[32] Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. arXiv preprint arXiv:1904.09751, 2019.
|
| 238 |
+
[33] Wenlong Huang, Igor Mordatch, and Deepak Pathak. One policy to control them all: Shared modular policies for agent-agnostic control. In International Conference on Machine Learning, pages 4455–4464. PMLR, 2020.
|
| 239 |
+
[34] Eric Jang, Alex Irpan, Mohi Khansari, Daniel Kappler, Frederik Ebert, Corey Lynch, Sergey Levine, and Chelsea Finn. Bc-z: Zero-shot task generalization with robotic imitation learning. In Conference on Robot Learning, pages 991–1002. PMLR, 2022.
|
| 240 |
+
[35] Michael Janner, Qiyang Li, and Sergey Levine. Offline reinforcement learning as one big sequence modeling problem. Advances in neural information processing systems, 34, 2021.
|
| 241 |
+
[36] Lukasz Kaiser, Aidan N Gomez, Noam Shazeer, Ashish Vaswani, Niki Parmar, Llion Jones, and Jakob Uszkoreit. One model to learn them all. arXiv preprint arXiv:1706.05137, 2017.
|
| 242 |
+
[37] Dmitry Kalashnikov, Jacob Varley, Yevgen Chebotar, Benjamin Swanson, Rico Jonschkowski, Chelsea Finn, Sergey Levine, and Karol Hausman. Mt-opt: Continuous multi-task robotic reinforcement learning at scale. arXiv preprint arXiv:2104.08212, 2021.
|
| 243 |
+
[38] 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.
|
| 244 |
+
[39] Hilbert J Kappen, Vicenç Gómez, and Manfred Opper. Optimal control as a graphical model inference problem. Machine learning, 87(2):159–182, 2012.
|
| 245 |
+
[40] Ben Krause, Akhilesh Deepak Gotmare, Bryan McCann, Nitish Shirish Keskar, Shafiq Joty, Richard Socher, and Nazneen Fatema Rajani. Gedi: Generative discriminator guided sequence generation. arXiv preprint arXiv:2009.06367, 2020.
|
| 246 |
+
[41] Aviral Kumar, Xue Bin Peng, and Sergey Levine. Reward-conditioned policies. arXiv preprint arXiv:1912.13465, 2019.
|
| 247 |
+
[42] Aviral Kumar, Aurick Zhou, George Tucker, and Sergey Levine. Conservative $\mathbf { q }$ -learning for offline reinforcement learning. Advances in Neural Information Processing Systems, 33:1179–1191, 2020.
|
| 248 |
+
[43] Vitaly Kurin, Maximilian Igl, Tim Rocktäschel, Wendelin Boehmer, and Shimon Whiteson. My body is a cage: the role of morphology in graph-based incompatible control. arXiv preprint arXiv:2010.01856, 2020.
|
| 249 |
+
[44] Kuang-Huei Lee, Ian Fischer, Anthony Liu, Yijie Guo, Honglak Lee, John Canny, and Sergio Guadarrama. Predictive information accelerates learning in rl. Advances in Neural Information Processing Systems, 33: 11890–11901, 2020.
|
| 250 |
+
[45] Sergey Levine, Aviral Kumar, George Tucker, and Justin Fu. Offline reinforcement learning: Tutorial, review, and perspectives on open problems. arXiv preprint arXiv:2005.01643, 2020.
|
| 251 |
+
[46] Kevin Lu, Aditya Grover, Pieter Abbeel, and Igor Mordatch. Pretrained transformers as universal computation engines. arXiv preprint arXiv:2103.05247, 2021.
|
| 252 |
+
[47] Clare Lyle, Mark Rowland, Georg Ostrovski, and Will Dabney. On the effect of auxiliary tasks on representation dynamics. In International Conference on Artificial Intelligence and Statistics, pages 1–9. PMLR, 2021.
|
| 253 |
+
[48] Corey Lynch and Pierre Sermanet. Language conditioned imitation learning over unstructured data. arXiv preprint arXiv:2005.07648, 2020.
|
| 254 |
+
[49] Horia Mania, Aurelia Guy, and Benjamin Recht. Simple random search provides a competitive approach to reinforcement learning. arXiv preprint arXiv:1803.07055, 2018.
|
| 255 |
+
[50] John McCarthy, Marvin L Minsky, Nathaniel Rochester, and Claude E Shannon. A proposal for the dartmouth summer research project on artificial intelligence, august 31, 1955. AI magazine, 27(4):12–12, 2006.
|
| 256 |
+
[51] Russell Mendonca, Oleh Rybkin, Kostas Daniilidis, Danijar Hafner, and Deepak Pathak. Discovering and achieving goals via world models. Advances in Neural Information Processing Systems, 34, 2021.
|
| 257 |
+
[52] Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013.
|
| 258 |
+
[53] Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. nature, 518(7540):529–533, 2015.
|
| 259 |
+
[54] Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International conference on machine learning, pages 1928–1937. PMLR, 2016.
|
| 260 |
+
[55] Ofir Nachum and Mengjiao Yang. Provable representation learning for imitation with contrastive fourier features. Advances in Neural Information Processing Systems, 34, 2021.
|
| 261 |
+
[56] Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
|
| 262 |
+
[57] Pedro A Ortega, Markus Kunesch, Grégoire Delétang, Tim Genewein, Jordi Grau-Moya, Joel Veness, Jonas Buchli, Jonas Degrave, Bilal Piot, Julien Perolat, et al. Shaking the foundations: delusions in sequence models for interaction and control. arXiv preprint arXiv:2110.10819, 2021.
|
| 263 |
+
[58] 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.
|
| 264 |
+
[59] Emilio Parisotto, Jimmy Lei Ba, and Ruslan Salakhutdinov. Actor-mimic: Deep multitask and transfer reinforcement learning. arXiv preprint arXiv:1511.06342, 2015.
|
| 265 |
+
[60] Dean A Pomerleau. Efficient training of artificial neural networks for autonomous navigation. Neural computation, 3(1):88–97, 1991.
|
| 266 |
+
[61] 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.
|
| 267 |
+
[62] 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.
|
| 268 |
+
[63] 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. arXiv preprint arXiv:1910.10683, 2019.
|
| 269 |
+
[64] Maithra Raghu, Thomas Unterthiner, Simon Kornblith, Chiyuan Zhang, and Alexey Dosovitskiy. Do vision transformers see like convolutional neural networks? Advances in Neural Information Processing Systems, 34:12116–12128, 2021.
|
| 270 |
+
[65] Scott Reed, Konrad Zolna, Emilio Parisotto, Sergio Gomez Colmenarejo, Alexander Novikov, Gabriel Barth-Maron, Mai Gimenez, Yury Sulsky, Jackie Kay, Jost Tobias Springenberg, Tom Eccles, Jake Bruce, Ali Razavi, Ashley Edwards, Nicolas Heess, Yutian Chen, Raia Hadsell, Oriol Vinyals, Mahyar Bordbar, and Nando de Freitas. A generalist agent, 2022. URL https://arxiv.org/abs/2205.06175.
|
| 271 |
+
[66] Machel Reid, Yutaro Yamada, and Shixiang Shane Gu. Can wikipedia help offline reinforcement learning? arXiv preprint arXiv:2201.12122, 2022.
|
| 272 |
+
[67] Andrei A Rusu, Sergio Gomez Colmenarejo, Caglar Gulcehre, Guillaume Desjardins, James Kirkpatrick, Razvan Pascanu, Volodymyr Mnih, Koray Kavukcuoglu, and Raia Hadsell. Policy distillation. arXiv preprint arXiv:1511.06295, 2015.
|
| 273 |
+
[68] Juergen Schmidhuber. Reinforcement learning upside down: Don’t predict rewards–just map them to actions. arXiv preprint arXiv:1912.02875, 2019.
|
| 274 |
+
[69] Julian Schrittwieser, Ioannis Antonoglou, Thomas Hubert, Karen Simonyan, Laurent Sifre, Simon Schmitt, Arthur Guez, Edward Lockhart, Demis Hassabis, Thore Graepel, et al. Mastering atari, go, chess and shogi by planning with a learned model. Nature, 588(7839):604–609, 2020.
|
| 275 |
+
[70] Ross D Shachter. Probabilistic inference and influence diagrams. Operations research, 36(4):589–604, 1988.
|
| 276 |
+
[71] Rupesh Kumar Srivastava, Pranav Shyam, Filipe Mutz, Wojciech Jaskowski, and Jürgen Schmidhuber. ´ Training agents using upside-down reinforcement learning. arXiv preprint arXiv:1912.02877, 2019.
|
| 277 |
+
[72] Jianlin Su, Yu Lu, Shengfeng Pan, Bo Wen, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. arXiv preprint arXiv:2104.09864, 2021.
|
| 278 |
+
[73] Emanuel Todorov. Linearly-solvable markov decision problems. Advances in neural information processing systems, 19, 2006.
|
| 279 |
+
[74] Marc Toussaint. Robot trajectory optimization using approximate inference. In Proceedings of the 26th annual international conference on machine learning, pages 1049–1056, 2009.
|
| 280 |
+
[75] Maria Tsimpoukelli, Jacob L Menick, Serkan Cabi, SM Eslami, Oriol Vinyals, and Felix Hill. Multimodal few-shot learning with frozen language models. Advances in Neural Information Processing Systems, 34: 200–212, 2021.
|
| 281 |
+
[76] Aaron van den Oord, Oriol Vinyals, and Koray Kavukcuoglu. Neural discrete representation learning. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 6309–6318, 2017.
|
| 282 |
+
[77] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017.
|
| 283 |
+
[78] 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. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 483–498, 2021.
|
| 284 |
+
[79] Kevin Yang and Dan Klein. Fudge: Controlled text generation with future discriminators. arXiv preprint arXiv:2104.05218, 2021.
|
| 285 |
+
[80] Mengjiao Yang and Ofir Nachum. Representation matters: Offline pretraining for sequential decision making. In International Conference on Machine Learning, pages 11784–11794. PMLR, 2021.
|
| 286 |
+
[81] Yang You, Jing Li, Sashank Reddi, Jonathan Hseu, Sanjiv Kumar, Srinadh Bhojanapalli, Xiaodan Song, James Demmel, Kurt Keutzer, and Cho-Jui Hsieh. Large batch optimization for deep learning: Training bert in 76 minutes. arXiv preprint arXiv:1904.00962, 2019.
|
| 287 |
+
[82] Tianhe Yu, Deirdre Quillen, Zhanpeng He, Ryan Julian, Karol Hausman, Chelsea Finn, and Sergey Levine. Meta-world: A benchmark and evaluation for multi-task and meta reinforcement learning. In Conference on Robot Learning, pages 1094–1100. PMLR, 2020.
|
| 288 |
+
[83] Amy Zhang, Rowan McAllister, Roberto Calandra, Yarin Gal, and Sergey Levine. Learning invariant representations for reinforcement learning without reconstruction. arXiv preprint arXiv:2006.10742, 2020.
|
| 289 |
+
[84] Qinqing Zheng, Amy Zhang, and Aditya Grover. Online decision transformer. arXiv preprint arXiv:2202.05607, 2022.
|
| 290 |
+
|
| 291 |
+
# Checklist
|
| 292 |
+
|
| 293 |
+
1. For all authors...
|
| 294 |
+
|
| 295 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 296 |
+
(b) Did you describe the limitations of your work? [Yes] See Section 5
|
| 297 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 5
|
| 298 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 299 |
+
|
| 300 |
+
2. If you are including theoretical results...
|
| 301 |
+
|
| 302 |
+
(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]
|
| 303 |
+
|
| 304 |
+
3. If you ran experiments...
|
| 305 |
+
|
| 306 |
+
(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]
|
| 307 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 308 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 309 |
+
(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]
|
| 310 |
+
|
| 311 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 312 |
+
|
| 313 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 314 |
+
(b) Did you mention the license of the assets? [N/A]
|
| 315 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
|
| 316 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 317 |
+
|
| 318 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 319 |
+
|
| 320 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 321 |
+
|
| 322 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 323 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 324 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/2EufPS5ABlJ/2EufPS5ABlJ.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/3s9IrEsjLyk/3s9IrEsjLyk.md
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Diffusion-LM Improves Controllable Text Generation
|
| 2 |
+
|
| 3 |
+
Xiang Lisa Li Stanford University xlisali@stanford.edu
|
| 4 |
+
|
| 5 |
+
John Thickstun Stanford University jthickst@stanford.edu
|
| 6 |
+
|
| 7 |
+
Ishaan Gulrajani Stanford Univeristy igul@stanford.edu
|
| 8 |
+
|
| 9 |
+
Percy Liang Stanford Univeristy pliang@cs.stanford.edu
|
| 10 |
+
|
| 11 |
+
Tatsunori B. Hashimoto Stanford Univeristy thashim@stanford.edu
|
| 12 |
+
|
| 13 |
+
# Abstract
|
| 14 |
+
|
| 15 |
+
Controlling the behavior of language models (LMs) without re-training is a major open problem in natural language generation. While recent works have demonstrated successes on controlling simple sentence attributes (e.g., sentiment), there has been little progress on complex, fine-grained controls (e.g., syntactic structure). To address this challenge, we develop a new non-autoregressive language model based on continuous diffusions that we call Diffusion-LM. Building upon the recent successes of diffusion models in continuous domains, Diffusion-LM iteratively denoises a sequence of Gaussian vectors into word vectors, yielding a sequence of intermediate latent variables. The continuous, hierarchical nature of these intermediate variables enables a simple gradient-based algorithm to perform complex, controllable generation tasks. We demonstrate successful control of Diffusion-LM for six challenging fine-grained control tasks, significantly outperforming prior work.1
|
| 16 |
+
|
| 17 |
+
# 1 Introduction
|
| 18 |
+
|
| 19 |
+
Large autoregressive language models (LMs) are capable of generating high quality text [39, 3, 5, 56], but in order to reliably deploy these LMs in real world applications, the text generation process needs to be controllable: we need to generate text that satisfies desired requirements (e.g. topic, syntactic structure). A natural approach for controlling a LM would be to fine-tune the LM using supervised data of the form (control, text) $\mathbb { \lVert 1 8 \rVert }$ . However, updating the LM parameters for each control task can be expensive and does not allow for compositions of multiple controls (e.g. generate text that is both positive sentiment and non-toxic). This motivates light-weight and modular plug-and-play approaches $\textcircled { 6 }$ that keep the LM frozen and steer the generation process using an external classifier that measures how well the generated text satisfies the control. But steering a frozen autoregressive LM has been shown to be difficult, and existing successes have been limited to simple, attribute-level controls (e.g., sentiment or topic) [6, 25, 55].
|
| 20 |
+
|
| 21 |
+
In order to tackle more complex controls, we propose Diffusion-LM, a new language model based on continuous diffusions. Diffusion-LM starts with a sequence of Gaussian noise vectors and incrementally denoises them into vectors corresponding to words, as shown in Figure $\mathbb { L }$ These gradual denoising steps produce a hierarchy of continuous latent representations. We find that this hierarchical and continuous latent variable enables simple, gradient-based methods to perform complex control tasks such as constraining the parse tree of a generated sequence.
|
| 22 |
+
|
| 23 |
+
Continuous diffusion models have been extremely successful in vision and audio domains [13, 24, 41, 8, 4], but they have not been applied to text because of the inherently discrete nature of text $\textcircled { \ S 3 }$ . Adapting this class of models to text requires several modifications to standard diffusions: we add an embedding step and a rounding step to the standard diffusion process, design a training objective to learn the embedding, and propose techniques to improve rounding (§4). We control Diffusion-LM using a gradient-based method, as shown in Figure $\bar { \bigtriangledown }$ This method enables us to steer the text generation process towards outputs that satisfy target structural and semantic controls. It iteratively performs gradient updates on the continuous latent variables of Diffusion-LM to balance fluency and control satisfaction $\textcircled { | \ S 5 . 1 \ r { } }$
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
Figure 1: Diffusion-LM iteratively denoises a sequence of Gaussian vectors into word vectors, yielding a intermediate latent variables of decreasing noise level $\mathbf { x } _ { T } \cdots \mathbf { x } _ { 0 }$ . For controllable generation, we iteratively perform gradient updates on these continuous latents to optimize for fluency (parametrized by Diffusion-LM) and satisfy control requirements (parametrized by a classifier).
|
| 27 |
+
|
| 28 |
+
To demonstrate control of Diffusion-LM, we consider six control targets ranging from fine-grained attributes (e.g., semantic content) to complex structures (e.g., parse trees). Our method almost doubles the success rate of previous plug-and-play methods and matches or outperforms the fine-tuning oracle on all these classifier-guided control tasks $( \ S 7 . 1 )$ . In addition to these individual control tasks, we show that we can successfully compose multiple classifier-guided controls to generate sentences with both desired semantic content and syntactic structure $\textcircled { \lVert \mathbb { S } ^ { 7 . 2 } \rVert }$ . Finally, we consider span-anchored controls, such as length control and infilling. Diffusion-LM allows us to perform these control tasks without a classifier, and our Diffusion-LM significantly outperforms prior plug-and-play methods and is on-par with an autoregressive LM trained from scratch for the infilling task $( \ S 7 . \bar { 3 } )$ .
|
| 29 |
+
|
| 30 |
+
# 2 Related Work
|
| 31 |
+
|
| 32 |
+
Diffusion Models for Text. Diffusion models $ { \mathbb { B } } 7 { \mathbb { I } }$ have demonstrated great success in continuous data domains [13, 33, 24, 31], producing images and audio that have state-of-the-art sample quality. To handle discrete data, past works have studied text diffusion models on discrete state spaces, which defines a corruption process on discrete data (e.g., each token has some probability to be corrupted to an absorbing or random token) [1, 15, 16]. In this paper, we focus on continuous diffusion models for text and to the best of our knowledge, our work is the first to explore this setting. In contrast to discrete diffusion LMs, our continuous diffusion LMs induce continuous latent representations, which enables efficient gradient-based methods for controllable generation.
|
| 33 |
+
|
| 34 |
+
Autoregressive and Non-autoregressive LMs. Most large pre-trained LMs are left-to-right autoregressive (e.g., GPT-3 [3], PaLM [5]). The fixed generation order limits the models’ flexibility in many controllable generation settings, especially those that impose controls globally on both left and right contexts. One example is infilling, which imposes lexical control on the right contexts; another example is syntactic structure control, which controls global properties involving both left and right contexts. Since autoregressive LMs cannot directly condition on right contexts, prior works have developed specialized training and decoding techniques for these tasks [46, 9, 36]. For example, Qin et al. [37] proposed a decoding method that relaxes the discrete LM outputs to continuous variables and backpropagates gradient information from the right context. Diffusion-LM can condition on arbitrary classifiers that look at complex, global properties of the sentence. There are other non-autoregressive LMs that have been developed for machine translation and speech-to-text tasks [12, 43]. However these methods are specialized for speech and translation settings, where the entropy over valid outputs is low, and whether they work for language modeling remains an open problem. We leave detailed discussions to Appendix H.
|
| 35 |
+
|
| 36 |
+
Plug-and-Play Controllable Generation. Plug-and-play controllable generation aims to keep the LM frozen and steer its output using potential functions (e.g., classifiers). Given a probabilistic potential function that measures how well the generated text satisfies the desired control, the generated text should be optimized for both control satisfaction (measured by the potential function) and fluency (measured by LM probabilities) . There are several plug-and-play approaches based on autoregressive LMs: FUDGE $\bar { \| 5 5 \| }$ reweights the LM prediction at each token with an estimate of control satisfaction for the partial sequence; GeDi $\mathbb { \left[ \left[ 2 5 \right] \right] }$ and DExperts $\pmb { \left. \widetilde { 2 8 } \right. }$ reweight the LM prediction at each token with a smaller LM finetuned/trained for the control task.
|
| 37 |
+
|
| 38 |
+
The closest work to ours is PPLM $\pmb { \Vert 6 \Vert }$ , which runs gradient ascent on an autoregressive LM’s hidden activations to steer the next token to satisfy the control and maintain fluency. Because PPLM is based on autoregressive LMs, it can only generate left-to-right. This prevents PPLM from repairing and recovering errors made in previous generation steps. Despite their success on attribute (e.g., topic) controls, we will show these plug-and-play methods for autoregressive LMs fail on more complex control tasks such as controlling syntactic structure and semantic content in $\ S 7 . 1 .$ We demonstrate that Diffusion-LM is capable of plug-and-play controllable generation by applying classifier-guided gradient updates to the continuous sequence of latent variables induced by the Diffusion-LM.
|
| 39 |
+
|
| 40 |
+
# 3 Problem Statement and Background
|
| 41 |
+
|
| 42 |
+
We first define controllable generation $( \sqrt { \ S 3 . 1 } )$ and then review continuous diffusion models $\textcircled { | \ S 3 . 3 ) }$
|
| 43 |
+
|
| 44 |
+
# 3.1 Generative Models and Controllable Generation for Text
|
| 45 |
+
|
| 46 |
+
Text generation is the task of sampling w from a trained language model $p _ { \mathrm { l m } } ( \mathbf { w } )$ , where $\mathbf { w } =$ $[ w _ { 1 } \cdots w _ { n } ]$ is a sequence of discrete words and $p _ { \mathrm { l m } } ( \mathbf { w } )$ is a probability distribution over sequences of words. Controllable text generation is the task of sampling w from a conditional distribution $p ( \mathbf { w } \mid \mathbf { c } )$ , where c denotes a control variable. For syntactic control, c can be a target syntax tree (Figure $\bigstar \bigstar \bigstar \bigstar$ , while for sentiment control, c could be a desired sentiment label. The goal of controllable generation is to generate w that satisfies the control target c.
|
| 47 |
+
|
| 48 |
+
Consider the plug-and-play controllable generation setting: we are given a language model $p _ { \mathrm { l m } } ( \mathbf { w } )$ trained from a large amount of unlabeled text data, and for each control task, we are given a classifier $p ( \mathbf { c } \mid \mathbf { w } )$ trained from smaller amount of labeled text data (e.g., for syntactic control, the classifier is a probabilistic parser). The goal is to utilize these two models to approximately sample from the posterior $p ( \mathbf { w } \mid \mathbf { c } )$ via Bayes rule $p ( \mathbf { w } \mid \mathbf { c } ) \propto p _ { \mathrm { l m } } ( \mathbf { w } ) \cdot p ( \mathbf { c } \mid \mathbf { w } )$ . Here, $p _ { \mathrm { l m } } ( \mathbf { w } )$ encourages w to be fluent, and the $p ( \mathbf { c } \mid \mathbf { w } )$ encourages w to fulfill the control.
|
| 49 |
+
|
| 50 |
+
# 3.2 Autoregressive Language Models
|
| 51 |
+
|
| 52 |
+
The canonical approach to language modeling factors $p _ { \mathrm { l m } }$ in an autoregressive left-to-right mannar, $\begin{array} { r } { p _ { \mathrm { l m } } ( \mathbf { w } ) \ = \ p _ { \mathrm { l m } } ( \mathbf { \bar { \boldsymbol { w } } } _ { 1 } ) \prod _ { i = 2 } ^ { n } p _ { \mathrm { l m } } ( \mathbf { \bar { \boldsymbol { x } } } _ { i } \ \mathbf { \bar { \boldsymbol { \lfloor } } } \ x _ { < i } ) } \end{array}$ . In this case, text generation is reduced to the task of repeatedly predicting the next token conditioned on the partial sequence generated so far. The next token prediction $p _ { \operatorname { l m } } ( x _ { i } \mid x _ { < i } )$ is often parametrized by Transformer architecture $\lVert \boldsymbol { 5 2 } \rVert$ .
|
| 53 |
+
|
| 54 |
+
# 3.3 Diffusion Models for Continuous Domains
|
| 55 |
+
|
| 56 |
+
A diffusion model $\textcircled { 1 3 } \textcircled { 3 3 } \textcircled { }$ is a latent variable model that models the data $\mathbf { x } _ { 0 } \in \mathbb { R } ^ { d }$ as a Markov chain $\mathbf { x } _ { T } \ldots \mathbf { x } _ { 0 }$ with each variable in $\mathbb { R } ^ { d }$ , and $\mathbf { x } _ { T }$ is a Gaussian. The diffusion model incrementally denoises the sequence of latent variables $\mathbf { x } _ { T : 1 }$ to approximate samples from the target data distribution (Figure $\boxed { 2 }$ . The initial state $p _ { \theta } ( \mathbf { x } _ { T } ) \approx \mathcal { N } ( 0 , \mathbf { I } )$ , and each denoising transition ${ \bf x } _ { t } { \bf x } _ { t - 1 }$ is parametrized by the model $p _ { \theta } ( \mathbf { x } _ { t - 1 } \mid \mathbf { x } _ { t } ) = \mathcal { N } ( \mathbf { x } _ { t - 1 } ; \mu _ { \theta } ( \mathbf { x } _ { t } , t ) , \Sigma _ { \theta } ( \mathbf { x } _ { t } , t ) )$ . For example, $\mu _ { \theta }$ and $\Sigma _ { \theta }$ may be computed by a U-Net or a Tranformer.
|
| 57 |
+
|
| 58 |
+
To train the diffusion model, we define a forward process that constructs the intermediate latent variables $\mathbf { x } _ { 1 : T }$ . The forward process incrementally adds Gaussian noise to data $\mathbf { x } _ { \mathrm { 0 } }$ until, at diffusion step $T$ , samples $\mathbf { x } _ { T }$ are approximately Gaussian. Each transition $\mathbf { x } _ { t - 1 } \mathbf { x } _ { t }$ is parametrized by $q ( \bar { \mathbf { x } } _ { t } \mid \mathbf { x } _ { t - 1 } ) = \mathcal { N } ( \mathbf { x } _ { t } ; \sqrt { 1 - \beta _ { t } } \mathbf { x } _ { t - 1 } , \bar { \beta } _ { t } \mathbf { I } )$ , where the hyperparameter $\beta _ { t }$ is the amount of noise added at diffusion step $t$ . This parametrization of the forward process $q$ contains no trainable parameters and allows us to define a training objective that involves generating noisy data according to a pre-defined forward process $q$ and training a model to reverse the process and reconstruct the data.
|
| 59 |
+
|
| 60 |
+

|
| 61 |
+
Figure 2: A graphical model representing the forward and reverse diffusion processes. In addition to the original diffusion models $\bar { \mathbb { 1 } } \bar { 1 } \bar { 3 } \mathbb { I }$ , we add a Markov transition between $\mathbf { x } _ { \mathrm { 0 } }$ and $\mathbf { w }$ , and propose the embedding §4.1 and rounding $\ S 4 . 2$ techniques.
|
| 62 |
+
|
| 63 |
+
The diffusion model is trained to maximize the marginal likelihood of the data $\mathbb { E } _ { \mathbf { x } _ { 0 } \sim p _ { \mathrm { d a t a } } } [ \log p _ { \theta } ( \mathbf { x } _ { 0 } ) ]$ , and the canonical objective is the variational lower bound of $\log p _ { \theta } ( \mathbf { x } _ { 0 } )$ [47],
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
\mathcal { L } _ { \mathrm { v l b } } ( \mathbf { x } _ { 0 } ) = \underset { q ( \mathbf { x } _ { 1 : T } | \mathbf { x } _ { 0 } ) } { \mathbb { E } } \left[ \log \frac { q ( \mathbf { x } _ { T } | \mathbf { x } _ { 0 } ) } { p _ { \theta } ( \mathbf { x } _ { T } ) } + \sum _ { t = 2 } ^ { T } \log \frac { q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { 0 } , \mathbf { x } _ { t } ) } { p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } ) } - \log p _ { \theta } ( \mathbf { x } _ { 0 } | \mathbf { x } _ { 1 } ) \right] .
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+
However, this objective can be unstable and require many optimization tricks to stabilize $\pmb { \mathbb { B 3 } }$ . To circumvent this issue, Ho et al. $\mathbb { \lVert \lambda \rVert }$ devised a simple surrogate objective that expands and reweights each KL-divergence term in ${ \mathcal { L } } _ { \mathrm { v l b } }$ to obtain a mean-squared error loss (derivation in Appendix $\mathrm { J } )$ which we will refer to as
|
| 70 |
+
|
| 71 |
+
$$
|
| 72 |
+
\mathcal { L } _ { \mathrm { s i m p l e } } ( \mathbf { x } _ { 0 } ) = \sum _ { t = 1 } ^ { T } \underset { q ( \mathbf { x } _ { t } | \mathbf { x } _ { 0 } ) } { \mathbb { E } } | | \mu _ { \boldsymbol { \theta } } ( \mathbf { x } _ { t } , t ) - \hat { \mu } ( \mathbf { x } _ { t } , \mathbf { x } _ { 0 } ) | | ^ { 2 } ,
|
| 73 |
+
$$
|
| 74 |
+
|
| 75 |
+
where $\hat { \mu } ( \mathbf { x } _ { t } , \mathbf { x } _ { 0 } )$ is the mean of the posterior $q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { 0 } , \mathbf { x } _ { t } )$ which is a closed from Gaussian, and $\mu _ { \theta } ( \mathbf { x } _ { t } , t )$ is the predicted mean of $p _ { \theta } ( \mathbf { x } _ { t - 1 } \mid \mathbf { x } _ { t } )$ computed by a neural network. While $\mathcal { L } _ { \mathrm { s i m p l e } }$ is no longer a valid lower bound, prior work has found that it empirically made training more stable and improved sample qualit $^ { , 2 } .$ We will make use of similar simplifications in Diffusion-LM to stabilize training and improve sample quality $( | \ S 4 . 1 )$ .
|
| 76 |
+
|
| 77 |
+
# 4 Diffusion-LM: Continuous Diffusion Language Modeling
|
| 78 |
+
|
| 79 |
+
Constructing Diffusion-LM requires several modifications to the standard diffusion model. First, we must define an embedding function that maps discrete text into a continuous space. To address this, we propose an end-to-end training objective for learning embeddings $( \ S 4 . 1 )$ . Second, we require a rounding method to map vectors in embedding space back to words. To address this, we propose training and decoding time methods to facilitate rounding $( \ S 4 . 2 )$ .
|
| 80 |
+
|
| 81 |
+
# 4.1 End-to-end Training
|
| 82 |
+
|
| 83 |
+
To apply a continuous diffusion model to discrete text, we define an embedding function $\operatorname { E M B } ( w _ { i } )$ that maps each word to a vector in $\mathbb { R } ^ { d }$ . We define the embedding of a sequence w of length $n$ to be: $\mathbf { E M B } ( \bar { \mathbf { w } _ { n } } ) = [ \mathbf { E M B } ( w _ { 1 } ) , \dots , \mathbf { E M B } ( w _ { n } ) ] \in \mathbb { R } ^ { n d }$ .
|
| 84 |
+
|
| 85 |
+
We propose a modification of the diffusion model training objective (Equation $\bigstar \bigstar \bigstar \bigstar$ that jointly learns the diffusion model’s parameters and word embeddings. In preliminary experiments, we explored random Gaussian embeddings, as well as pre-trained word embeddings $[ \bar { 1 } 5 , \bar { 1 } \bar { 3 } 9 ]$ . We found that these fixed embeddings are suboptimal for Diffusion-LM compared to end-to-end training3.
|
| 86 |
+
|
| 87 |
+
As shown in Figure $\bigstar$ our approach adds a Markov transition from discrete words w to $\mathbf { x } _ { \mathrm { 0 } }$ in the forward process, parametrized by $q _ { \phi } ( \mathbf { x } _ { 0 } | \mathbf { w } ) = \mathcal { N } ( \mathrm { E M B } ( \mathbf { w } ) , \sigma _ { 0 } I )$ . In the reverse process, we add a |trainable rounding step, parametrized by $p _ { \theta } ( \mathbf { w } \mid \mathbf { x } _ { 0 } ) = \prod _ { i = 1 } ^ { n } p _ { \theta } ( w _ { i } \mid x _ { i } )$ , where $p _ { \theta } ( w _ { i } \mid x _ { i } )$ is a softmax distribution. The training objectives introduced in §3 now becomes
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
\begin{array} { r l } & { \mathcal { L } _ { \mathrm { v l b } } ^ { \mathrm { e 2 e } } ( \mathbf { w } ) = \underset { q _ { \phi } ( \mathbf { x } _ { 0 } | \mathbf { w } ) } { \mathbb { E } } [ \mathcal { L } _ { \mathrm { v l b } } ( \mathbf { x } _ { 0 } ) + \log q _ { \phi } ( \mathbf { x } _ { 0 } | \mathbf { w } ) - \log p _ { \theta } ( \mathbf { w } | \mathbf { x } _ { 0 } ) ] ] , } \\ & { \mathcal { L } _ { \mathrm { s i m p l e } } ^ { \mathrm { e 2 e } } ( \mathbf { w } ) = \underset { q _ { \phi } ( \mathbf { x } _ { 0 : T } | \mathbf { w } ) } { \mathbb { E } } [ \mathcal { L } _ { \mathrm { s i m p l e } } ( \mathbf { x } _ { 0 } ) + | | \mathrm { E M B } ( \mathbf { w } ) - \mu _ { \theta } ( \mathbf { x } _ { 1 } , 1 ) | | ^ { 2 } - \log p _ { \theta } ( \mathbf { w } | \mathbf { x } _ { 0 } ) ] . } \end{array}
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
We derive the simplifi $\mathcal { L } _ { \mathrm { s i m p l e } } ^ { \mathrm { e 2 e } } ( \mathbf { w } )$ m an $\mathcal { L } _ { \mathrm { v l b } } ^ { \mathrm { e 2 e } } ( \mathbf { w } )$ followingrivation de$\boxed { \ S 3 . 3 }$ tails are in Appendix J. Since we are training the embedding function, $q _ { \phi }$ now contains trainable parameters and we use the reparametrization trick [42, 20] to backpropagate through this sampling step. Empirically, we find the learned embeddings cluster meaningfully: words with the same part-of-speech tags (syntactic role) tend to be clustered, as shown in Figure 3.
|
| 94 |
+
|
| 95 |
+

|
| 96 |
+
Figure 3: A t-SNE [51] plot of the learned word embeddings. Each word is colored by its POS.
|
| 97 |
+
|
| 98 |
+
# 4.2 Reducing Rounding Errors
|
| 99 |
+
|
| 100 |
+
The learned embeddings define a mapping from discrete text to the continuous $\mathbf { x } _ { \mathrm { 0 } }$ . We now describe the inverse process of rounding a predicted $\mathbf { x } _ { \mathrm { 0 } }$ back to discrete text. Rounding is achieved by choosing the most probable word for each position, according to argmax $\begin{array} { r } { p _ { \theta } ( \mathbf { w } \mid \mathbf { \bar { x } } _ { 0 } ) = \prod _ { i = 1 } ^ { n } \bar { p _ { \theta } } ( w _ { i } \mid x _ { i } ) } \end{array}$ Ideally, this argmax-rounding would be sufficient to map back to discrete text, as the denoising steps should ensure that $\mathbf { x } _ { \mathrm { 0 } }$ lies exactly on the embedding of some word. However, empirically, the model fails to generate $\mathbf { x } _ { \mathrm { 0 } }$ that commits to a single word.
|
| 101 |
+
|
| 102 |
+
One explanation for this phenomenon is that the $\mathcal { L } _ { \mathrm { s i m p l e } } ( \mathbf { x } _ { 0 } )$ term in our objective $2$ puts insufficient emphasis on modeling the structure of $\mathbf { x } _ { \mathrm { 0 } }$ . Recall that we defined $L _ { \mathrm { s i m p l e } } ( \mathbf { x } _ { 0 } ) \ =$ $\begin{array} { r } { \sum _ { t = 1 } ^ { T } \mathbb { E } _ { \mathbf { x } _ { t } } | | \mu _ { \theta } ( \mathbf { x } _ { t } , t ) - \hat { \mu } ( \mathbf { x } _ { t } , \mathbf { x } _ { 0 } ) | | ^ { 2 } } \end{array}$ , where our model $\mu _ { \theta } ( \mathbf { x } _ { t } , t )$ directly predicts the mean of $p _ { \theta } ( \mathbf { x } _ { t - 1 } \mid \mathbf { x } _ { t } )$ for each denoising step $t$ . In this objective, the constraint that $\mathbf { x } _ { \mathrm { 0 } }$ has to commit to a single word embedding will only appear in the terms with $t$ near 0, and we found that this parametrization required careful tuning to force the objective to emphasize those terms (see Appendix $\boxed { \mathbf { M } }$ .
|
| 103 |
+
|
| 104 |
+
Our approach re-parametrizes $\mathcal { L } _ { \mathrm { s i m p l e } }$ to force Diffusion-LM to explicitly model $\mathbf { x } _ { \mathrm { 0 } }$ in every term of the objective. Specifically, we derive an analogue to $\mathcal { L } _ { \mathrm { s i m p l e } }$ which is parametrized via $\mathbf { x } _ { \mathrm { 0 } }$ $\begin{array} { r } { \mathcal { L } _ { \mathbf { x } _ { 0 } - \mathrm { s i m p l e } } ^ { \mathrm { e 2 e } } ( \mathbf { x } _ { 0 } ) = \sum _ { t = 1 } ^ { T } \mathbb { E } _ { \mathbf { x } _ { t } } | | f _ { \theta } ( \mathbf { x } _ { t } , t ) - \mathbf { x } _ { 0 } | | ^ { 2 } } \end{array}$ , where our model $f _ { \theta } ( \mathbf { x } _ { t } , t )$ predicts $\mathbf { x } _ { \mathrm { 0 } }$ directly 4. This forces the neural network to predict $\mathbf { x } _ { \mathrm { 0 } }$ in every term and we found that models trained with this objective quickly learn that $\mathbf { x } _ { \mathrm { 0 } }$ should precisely centered at a word embedding.
|
| 105 |
+
|
| 106 |
+
We described how re-parametrization can be helpful for model training, but we also found that the same intuition could be used at decoding time in a technique that we call the clamping trick. In the standard generation approach for a $\mathbf { x } _ { \mathrm { 0 } }$ -parametrized model, the model denoises $\mathbf { x } _ { t }$ to $\mathbf { x } _ { t - 1 }$ by first computing an estimate of $\mathbf { x } _ { \mathrm { 0 } }$ via $f _ { \theta } ( \mathbf { x } _ { t } , t )$ and then sampling $\mathbf { x } _ { t - 1 }$ conditioned on this estimate: $\mathbf { x } _ { t - 1 } = \sqrt { \bar { \alpha } } f _ { \theta } ( \mathbf { x } _ { t } , t ) + \sqrt { 1 - \bar { \alpha } } \epsilon$ , where $\begin{array} { r } { \bar { \alpha } _ { t } = \prod _ { s = 0 } ^ { t } ( 1 - \beta _ { s } ) } \end{array}$ and $\overline { { \epsilon } } \sim \bar { \mathcal { N } } ( 0 , I ) \big \lbrack \bar { \mathfrak { z } } \big \rbrack$ In the clamping trick, the model additionally maps the predicted vector $f _ { \theta } ( \mathbf { x } _ { t } , t )$ to its nearest word embedding sequence. Now, the sampling step becomes $\mathbf { x } _ { t - 1 } = \sqrt { \bar { \alpha } } \cdot \mathrm { C l a m p } ( f _ { \theta } ( \mathbf { x } _ { t } , t ) ) + \sqrt { 1 - \bar { \alpha } } \epsilon$ . The clamping trick forces the predicted vector to commit to a word for intermediate diffusion steps, making the vector predictions more precise and reducing rounding errors.6
|
| 107 |
+
|
| 108 |
+
# 5 Decoding and Controllable Generation with Diffusion-LM
|
| 109 |
+
|
| 110 |
+
Having described the Diffusion-LM, we now consider the problem of controllable text generation $\underline { { ( \ S ^ { 5 . 1 ) } } }$ and decoding $( \ S 5 . 2 )$ .
|
| 111 |
+
|
| 112 |
+
# 5.1 Controllable Text Generation
|
| 113 |
+
|
| 114 |
+
We now describe a procedure that enables plug-and-play control on Diffusion-LM. Our approach to control is inspired by the Bayesian formulation in $\underline { { \vec { \ S } \vec { 3 . 1 } } } ,$ but instead of performing control directly on the discrete text, we perform control on the sequence of continuous latent variables $\mathbf { x } _ { \mathrm { 0 : } T }$ defined by Diffusion-LM, and apply the rounding step to convert these latents into text.
|
| 115 |
+
|
| 116 |
+
Controlling $\mathbf { x } _ { \mathrm { 0 : } T }$ is equivalent to decoding from the posterior $\begin{array} { r } { p ( \mathbf { x } _ { 0 : T } | \mathbf { c } ) = \prod _ { t = 1 } ^ { T } p ( \mathbf { x } _ { t - 1 } \mid \mathbf { x } _ { t } , \mathbf { c } ) } \end{array}$ , and we decompose this joint inference problem to a sequence of control problems at each diffusion step: $p ( \mathbf { x } _ { t - 1 } \mid \mathbf { \bar { x } } _ { t } , \mathbf { c } ) \propto \bar { p } ( \mathbf { x } _ { t - 1 } \mid \mathbf { x } _ { t } ) \cdot \bar { p } ( \mathbf { c } \mid \mathbf { x } _ { t - 1 } , \mathbf { x } _ { t } )$ . We further simplify $p ( \mathbf { c } \mid \mathbf { x } _ { t - 1 } , \mathbf { x } _ { t } ) = p ( \mathbf { c } \mid$ $\mathbf { x } _ { t - 1 } )$ via conditional independence assumptions from prior work on controlling diffusions $[ | \overline { { 4 9 } } | |$ . Consequently, for the $t$ -th step, we run gradient update on $\mathbf { x } _ { t - 1 }$ :
|
| 117 |
+
|
| 118 |
+
$$
|
| 119 |
+
\nabla _ { \mathbf x _ { t - 1 } } \log p ( \mathbf x _ { t - 1 } \mid \mathbf x _ { t } , \mathbf c ) = \nabla _ { \mathbf x _ { t - 1 } } \log p ( \mathbf x _ { t - 1 } \mid \mathbf x _ { t } ) + \nabla _ { \mathbf x _ { t - 1 } } \log p ( \mathbf c \mid \mathbf x _ { t - 1 } ) ,
|
| 120 |
+
$$
|
| 121 |
+
|
| 122 |
+
where both $\log p ( \mathbf { x } _ { t - 1 } \mid \mathbf { x } _ { t } )$ and $\log p ( \mathbf { c } \mid \mathbf { x } _ { t - 1 } )$ are differentiable: the first term is parametrized by Diffusion-LM, and the second term is parametrized by a neural network classifier.
|
| 123 |
+
|
| 124 |
+
Similar to work in the image setting $ { \mathbb { B } } , { \mathbb { H } } 9 { \mathbb { I } }$ , we train the classifier on the diffusion latent variables and run gradient updates on the latent space $\mathbf { x } _ { t - 1 }$ to steer it towards fulfilling the control. These image diffusion works take one gradient step towards $\nabla _ { \mathbf { x } _ { t - 1 } } \log p ( \mathbf { c } \mid \mathbf { x } _ { t - 1 } )$ per diffusion steps. To improve performance on text and speed up decoding, we introduce two key modifications: fluency regularization and multiple gradient steps.
|
| 125 |
+
|
| 126 |
+
To generate fluent text, we run gradient updates on a control objective with fluency regularization: $\lambda \log p ( \mathbf { x } _ { t - 1 } \mid \mathbf { x } _ { t } ) + \log p ( \mathbf { c } \mid \bar { \mathbf { x } _ { t - 1 } } )$ , where $\lambda$ is a hyperparameter that trades off fluency (the first term) and control (the second term). While existing controllable generation methods for diffusions do not include the $\lambda \log p ( \mathbf { x } _ { t - 1 } \mid \mathbf { x } _ { t } )$ term in the objective, we found this term to be instrumental for generating fluent text. The resulting controllable generation process can be viewed as a stochastic decoding method that balances maximizing and sampling $p ( \mathbf { x } _ { t - 1 } \mid \mathbf { x } _ { t } , \mathbf { c } )$ , much like popular text generation techniques such as nucleus sampling $\textcircled { 1 1 4 } \textcircled { 1 }$ or sampling with low temperature. In order to improve the control quality, we take multiple gradient steps for each diffusion step: we run 3 steps of the Adagrad $^ 7 \mathbb { \equiv } { \frac { } { \mathbb { I } \mathbb { 0 } } } \mathbb { I }$ update for each diffusion steps. To mitigate for the increased computation cost, we downsample the diffusion steps from 2000 to 200, which speeds up our controllable generation algorithm without hurting sample quality much.
|
| 127 |
+
|
| 128 |
+
# 5.2 Minimum Bayes Risk Decoding
|
| 129 |
+
|
| 130 |
+
Many conditional text generation tasks require a single high-quality output sequence, such as machine translation or sentence infilling. In these settings, we apply Minimum Bayes Risk (MBR) decoding $\left[ \left[ 2 6 \right] \right]$ to aggregate a set of samples $s$ drawn from the Diffusion-LM , and select the sample that achieves the minimum expected risk under a loss function $\mathcal { L }$ (e.g., negative BLEU score): $\hat { \textbf { w } } =$ $\begin{array} { r } { \operatorname * { a r g m i n } _ { \mathbf { w } \in S } \sum _ { \mathbf { w } ^ { \prime } \in S } \frac { 1 } { | S | } \mathcal { L } ( \mathbf { \dot { w } } , \mathbf { w } ^ { \prime } ) } \end{array}$ . We found that MBR decoding often returned high quality outputs, since a low quality sample would be dissimilar from the remaining samples and penalized by the loss function.
|
| 131 |
+
|
| 132 |
+
# 6 Experimental Setup
|
| 133 |
+
|
| 134 |
+
With the above improvements on training $\textcircled{8 4 }$ and decoding $( \ S 5 )$ , we train Diffusion-LM for two language modeling tasks. We then apply the controllable generation method to 5 classifier-guided control tasks, and apply MBR decoding to a classifier-free control task (i.e. infilling).
|
| 135 |
+
|
| 136 |
+
# 6.1 Datasets and Hyperparameters
|
| 137 |
+
|
| 138 |
+
We train Diffusion-LM on two datasets: E2E $\pmb { \Vert 3 4 \Vert }$ and ROCStories $\left[ \left| 3 2 \right| \right]$ . The E2E dataset consists of 50K restaurant reviews labeled by 8 fields including food type, price, and customer rating. The ROCStories dataset consists of 98K five-sentence stories, capturing a rich set of causal and temporal commonsense relations between daily events. This dataset is more challenging to model than E2E, because the stories contain a larger vocabulary of 11K words and more diverse semantic content.
|
| 139 |
+
|
| 140 |
+
Table 1: Example input control and output text for each control tasks.
|
| 141 |
+
|
| 142 |
+
<table><tr><td>input (Semantic Content) output text</td><td>food : Japanese Browns Cambridge is good for Japanese food and also children friendly near The Sorrento.</td></tr><tr><td>input (Parts-of-speech) output text</td><td>PROPN AUX DET ADJ NOUN NOUN VERB ADP DET NOUN ADP DET NOUN PUNCT Zizzi is a local coffee shop located on the outskirts of the city .</td></tr><tr><td>input (Syntax Tree) output text</td><td>(TOP (S (NP(*) (*) (*)) (VP(*) (NP (NP(*) (*))) The Twenty Two has great food</td></tr><tr><td>input (Syntax Spans) output text</td><td>(7,10,VP) Wildwood pub serves multicultural dishes and is ranked 3 stars</td></tr><tr><td>input (Length) output text</td><td>14 Browns Cambridge offers Japanese food located near The Sorrento in the city centre .</td></tr><tr><td>input (left context) input (right context) output text</td><td>My dog loved tennis balls. My dog had stolen every one and put it under there. One day,I found all of my lost tennis balls underneath the bed.</td></tr></table>
|
| 143 |
+
|
| 144 |
+
Our Diffusion-LM is based on Transformer $\pmb { \Vert 5 2 } \Vert$ architecture with 80M parameters, with a sequence length $n = 6 4$ , diffusion steps $T = 2 0 0 0$ and a square-root noise schedule (see Appendix $\boxed { \mathrm { A } }$ for details). We treat the embedding dimension as a hyperparameter, setting $d = 1 6$ for E2E and $d = 1 2 8$ for ROCStories. See Appendix $\mathbf { B }$ for hyperparameter details. At decoding time, we downsample to 200 diffusion steps for E2E and maintain 2000 steps for ROCStories. Decoding Diffusion-LM for 200 steps is still $7 \mathbf { x }$ slower than decoding autoregressive LMs. For controllable generation, our method based on Diffusion-LM is $1 . 5 \mathrm { x }$ slower than FUDGE but $6 0 \mathrm { x }$ faster than PPLM.
|
| 145 |
+
|
| 146 |
+
# 6.2 Control tasks
|
| 147 |
+
|
| 148 |
+
We consider 6 control tasks shown in Table 1: the first 4 tasks rely on a classifier, and the last 2 tasks are classifier free8. For each control task (e.g. semantic content), we sample 200 control targets c (e.g., rating ${ = } 5$ star) from the validation splits, and we generate 50 samples for each control target. To evaluate the fluency of the generated text, we follow the prior works [55, 6] and feed the generated text to a teacher LM (i.e., a carefully fine-tuned GPT-2 model) and report the perplexity of generated text under the teacher LM. We call this metric lm-score (denoted as lm): a lower lm-score indicates better sample quality. 9 We define success metrics for each control task as follows:
|
| 149 |
+
|
| 150 |
+
Semantic Content. Given a field (e.g., rating) and value (e.g., 5 star), generate a sentence that covers field $\equiv$ value, and report the success rate by exact match of ‘value’.
|
| 151 |
+
|
| 152 |
+
Parts-of-speech. Given a sequence of parts-of-speech (POS) tags (e.g., Pronoun Verb Determiner Noun), generate a sequence of words of the same length whose POS tags (under an oracle POS tagger) match the target (e.g., I ate an apple). We quantify success via word-level exact match.
|
| 153 |
+
|
| 154 |
+
Syntax Tree. Given a target syntactic parse tree (see Figure 1), generate text whose syntactic parse matches the given parse. To evaluate the success, we parse the generated text by an off-the-shelf parser $\pmb { \left. \left[ 2 2 \right] \right. }$ , and report F1 scores.
|
| 155 |
+
|
| 156 |
+
Syntax Spans. Given a target (span, syntactic category) pair, generate text whose parse tree over span $[ i , j ]$ matches the target syntactic category (e.g. prepositional phrase).We quantify success via the fraction of spans that match exactly.
|
| 157 |
+
|
| 158 |
+
Length. Given a target length $1 0 , \ldots , 4 0$ , generate a sequence with a length within $\pm 2$ of the target.
|
| 159 |
+
In the case of Diffusion-LM, we treat this as a classifier-free control task.
|
| 160 |
+
|
| 161 |
+
Infilling. Given a left context $( O _ { 1 } )$ and a right context $( O _ { 2 } )$ from the aNLG dataset $\pmb { \mathbb { D } } \mathbf { l }$ , and the goal is to generate a sentence that logically connects $O _ { 1 }$ and $O _ { 2 }$ (algorithm details in Appendix $\mathbf { G } )$ . For evaluation, we report both automatic and human evaluation from the Genie leaderboard $\mathbb { 1 1 9 } \mathrm { j }$
|
| 162 |
+
|
| 163 |
+
<table><tr><td></td><td colspan="2">Semantic Content</td><td colspan="2">Parts-of-speech</td><td colspan="2">Syntax Tree</td><td colspan="2">Syntax Spans</td><td colspan="2">Length</td></tr><tr><td></td><td>ctrl 个</td><td>lm↓</td><td>ctrl个</td><td>im↓</td><td>ctrl个</td><td>lm↓</td><td>ctrl个</td><td>im↓</td><td>ctrl个</td><td>lm↓</td></tr><tr><td>PPLM FUDGE</td><td>9.9 69.9</td><td>5.32 2.83</td><td>1</td><td>1 7.96</td><td>1</td><td>-</td><td>1</td><td>1</td><td>1</td><td>-</td></tr><tr><td>Diffusion-LM</td><td></td><td></td><td>27.0</td><td></td><td>17.9</td><td>3.39</td><td>54.2</td><td>4.03</td><td>46.9</td><td>3.11</td></tr><tr><td></td><td>81.2</td><td>2.55</td><td>90.0</td><td>5.16</td><td>86.0</td><td>3.71</td><td>93.8</td><td>2.53</td><td>99.9</td><td>2.16</td></tr><tr><td>FT-sample</td><td>72.5</td><td>2.87</td><td>89.5</td><td>4.72</td><td>64.8</td><td>5.72</td><td>26.3</td><td>2.88</td><td>98.1</td><td>3.84</td></tr><tr><td>FT-search</td><td>89.9</td><td>1.78</td><td>93.0</td><td>3.31</td><td>76.4</td><td>3.24</td><td>54.4</td><td>2.19</td><td>100.0</td><td>1.83</td></tr></table>
|
| 164 |
+
|
| 165 |
+
Table 2: Diffusion-LM achieves high success rate (ctrl ") and good fluency $( \ln \downarrow )$ across all 5 control tasks, outperforming the PPLM and FUDGE baselines. Our method even outperforms the fine-tuning oracle (FT) on controlling syntactic parse trees and spans.
|
| 166 |
+
|
| 167 |
+
# 6.3 Classifier-Guided Control Baselines
|
| 168 |
+
|
| 169 |
+
For the first 5 control tasks, we compare our method with PPLM, FUDGE, and a fine-tuning oracle. Both PPLM and FUDGE are plug-and-play controllable generation approaches based on an autoregressive LM, which we train from scratch using the GPT-2 small architecture $\pmb { \mathbb { B } } \pmb { \mathrm { 9 } } \|$
|
| 170 |
+
|
| 171 |
+
PPLM[6]. This method runs gradient ascent on the LM activations to increase the classifier probabilities and language model probabilities, and has been successful on simple attribute control. We apply PPLM to control semantic content, but not the remaining 4 tasks which require positional information, as PPLM’s classifier lacks positional information.
|
| 172 |
+
|
| 173 |
+
FUDGE[55]. For each control task, FUDGE requires a future discriminator that takes in a prefix sequence and predicts whether the complete sequence would satisfy the constraint. At decoding time, FUDGE reweights the LM prediction by the discriminator scores.
|
| 174 |
+
|
| 175 |
+
FT. For each control task, we fine-tune GPT-2 on (control, text) pair, yielding an oracle conditional language model that’s not plug-and-play. We report both the sampling (with temperature 1.0) and beam search (with beam size 4) outputs of the fine-tuned models, denoted as FT-sample and FT-search.
|
| 176 |
+
|
| 177 |
+
# 6.4 Infilling Baselines
|
| 178 |
+
|
| 179 |
+
We compare to 3 specialized baseline methods developed in past work for the infilling task.
|
| 180 |
+
|
| 181 |
+
DELOREAN [36]. This method continuously relaxes the output space of a left-to-right autoregressive LM, and iteratively performs gradient updates on the continuous space to enforce fluent connection to the right contexts. This yields a continuous vector which is rounded back to text.
|
| 182 |
+
|
| 183 |
+
COLD[37]. COLD specifies an energy-based model that includes fluency (from left-to-right and right-to-left LM) and coherence constraints (from lexical overlap). It samples continuous vectors from this energy-based model and round them to text.
|
| 184 |
+
|
| 185 |
+
AR-infilling. We train an autoregressive LM from scratch to do sentence infilling task $\pmb { \Vert }$ . Similar to training Diffusion-LM, we train on the ROCStories dataset, but pre-process it by reordering sentences from $( O _ { 1 } , O _ { \mathrm { m i d d l e } , } O _ { 2 } )$ to $( O _ { 1 } , O _ { 2 } , O _ { \mathrm { m i d d l e } } )$ . At evaluation time, we feed in $O _ { 1 } , O _ { 2 }$ , and the model generates the middle sentence.
|
| 186 |
+
|
| 187 |
+
# 7 Main Results
|
| 188 |
+
|
| 189 |
+
We train Diffusion-LMs on the E2E and ROCStories datasets. In terms of negative log-likelihood (NLL, lower is better), we find that the variational upper bound of Diffusion-LM NLL 10 underperforms the equivalent autoregressive Transformer model (2.28 vs. 1.77 for E2E, 3.88 vs 3.05 for ROCStories) although scaling up model and dataset size partially bridges the gap $3 . 8 8 3 . 1 0$ on ROCStories). Our best log-likelihoods required several modifications from $\ S 4 ;$ we explain these and give detailed log-likelihood results in Appendix $\boxed { \mathrm { K } }$ Despite worse likelihoods, controllable generation based on our Diffusion-LM results in significantly better outputs than systems based on autoregressive LMs, as we will show in §7.1,§7.2, and §7.3
|
| 190 |
+
|
| 191 |
+
# 7.1 Classifier-Guided Controllable Text Generation Results
|
| 192 |
+
|
| 193 |
+
As shown in Table 2, Diffusion-LM achieves high success and fluency across all classifier-guided control tasks. It significantly outperforms the PPLM and FUDGE baselines across all 5 tasks.
|
| 194 |
+
|
| 195 |
+
Table 3: Qualitative examples from the Syntax Tree control. The syntactic parse tree is linearized by nested brackets representing the constituents, and we use the standard PTB syntactic categories. Tokens within each span are represented as \* . We color failing spans red and bold the spans of interest that we discuss in $\ S 7 . 1 .$
|
| 196 |
+
|
| 197 |
+
<table><tr><td>Syntactic Parse</td><td>(S(S(NP*)(VP*(NP(NP**)(VP*(NP(ADJP**)*)))))*(S(NP***)(VP*( ADJP(ADJP *)))))</td></tr><tr><td>FUDGE</td><td>Zizzi is a cheap restaurant . [incomplete]</td></tr><tr><td>Diffusion-LM FT</td><td>Zizzi is a pub providing family friendly Indian food Its customer rating is low Cocum is a Pub serving moderately priced meals and the customer rating is high</td></tr><tr><td>Syntactic Parse</td><td>(S(S(VP*(PP*(NP**)))) *(NP***)(VP*(NP(NP**)(SBAR(WHNP*)(S( VP*(NP**))))))*)</td></tr><tr><td>FUDGE</td><td>In the city near The Portland Arms is a coffee and fast food place named The Cricketers which is not family - friendly with a customer rating of 5 out of 5 .</td></tr><tr><td>Diffusion-LM FT</td><td>Located on the riverside,The Rice Boat is a restaurant that serves Indian food . Located near The Sorrento, The Millis a pub that serves Indian cuisine.</td></tr></table>
|
| 198 |
+
|
| 199 |
+
<table><tr><td colspan="4">Semantic Content + Syntax Tree</td><td colspan="3">Semantic Content + Parts-of-speech</td></tr><tr><td></td><td>semantic ctrl ↑</td><td>syntax ctrl ↑</td><td>lm↓</td><td>semantic ctrl ↑</td><td>POS ctrl ↑</td><td>lm↓</td></tr><tr><td>FUDGE</td><td>61.7</td><td>15.4</td><td>3.52</td><td>64.5</td><td>24.1</td><td>3.52</td></tr><tr><td>Diffusion-LM</td><td>69.8</td><td>74.8</td><td>5.92</td><td>63.7</td><td>69.1</td><td>3.46</td></tr><tr><td>FT-PoE</td><td>61.7</td><td>29.2</td><td>2.77</td><td>29.4</td><td>10.5</td><td>2.97</td></tr></table>
|
| 200 |
+
|
| 201 |
+
Table 4: In this experiment, we compose semantic control and syntactic control: Diffusion-LM achieves higher success rate (ctrl $\uparrow ,$ ) at some cost of fluency $( \ln \downarrow )$ . Our method outperforms both FUDGE and FT-PoE (product of experts of two fine-tuned models) on control success rate, especially for the structured syntactic controls (i.e. syntactic parse tree and POS).
|
| 202 |
+
|
| 203 |
+
Surprisingly, our method outperforms the fine-tuning oracle on controlling syntactic parse trees and spans, while achieving similar performance on the remaining 3 tasks.
|
| 204 |
+
|
| 205 |
+
Controlling syntactic parse trees and spans are challenging tasks for fine-tuning, because conditioning on the parse tree requires reasoning about the nested structure of the parse tree, and conditioning on spans requires lookahead planning to ensure the right constituent appears at the target position.
|
| 206 |
+
|
| 207 |
+
We observe that PPLM fails in semantic content controls and conjecture that this is because PPLM is designed to control coarse-grained attributes, and may not be useful for more targeted tasks such as enforcing that a restaurant review contains a reference to Starbucks.
|
| 208 |
+
|
| 209 |
+
FUDGE performs well on semantic content control but does not perform well on the remaining four tasks. Controlling a structured output (Parts-of-speech and Syntax Tree) is hard for FUDGE because making one mistake anywhere in the prefix makes the discriminator assign low probabilities to all continuations. In other control tasks that require planning (Length and Syntax Spans), the future discriminator is difficult to train, as it must implicitly perform lookahead planning.
|
| 210 |
+
|
| 211 |
+
The non-autoregressive nature of our Diffusion-LM allows it to easily solve all the tasks that require precise future planning (Syntax Spans and Length). We believe that it works well for complex controls that involve global structures (Parts-of-speech, Syntax Tree) because the coarse-to-fine representations allow the classifier to exert control on the entire sequence (near $t = T$ ) as well as on individual tokens (near $t = 0$ ).
|
| 212 |
+
|
| 213 |
+
Qualitative Results. Table $\textcircled { 3 }$ shows samples of Syntax Tree control. Our method and fine-tuning both provide fluent sentences that mostly satisfy controls, whereas FUDGE deviates from the constraints after the first few words. One key difference between our method and fine-tuning is that Diffusion-LM is able to correct for a failed span and have suffix spans match the target. In the first example, the generated span (“Family friendly Indian food”) is wrong because it contains 1 more word than the target. Fortunately, this error doesn’t propagate to later spans, since Diffusion-LM adjusts by dropping the conjunction.
|
| 214 |
+
|
| 215 |
+
# 7.2 Composition of Controls
|
| 216 |
+
|
| 217 |
+
One unique capability of plug-and-play controllable generation is its modularity. Given classifiers for multiple independent tasks, gradient guided control makes it simple to generate from the intersection of multiple controls by taking gradients on the sum of the classifier log-probabilities.
|
| 218 |
+
|
| 219 |
+
Table 5: For sentence infilling, Diffusion-LM significantly outperforms prior work COLD $\pmb { \Vert 3 7 \Vert }$ and Delorean $\pmb { \mathbb { B } } 6 \|$ (numbers taken from paper), and matches the performance of an autoregressive LM (AR) trained from scratch to do infilling.
|
| 220 |
+
|
| 221 |
+
<table><tr><td rowspan="2"></td><td colspan="4">Automatic Eval</td><td rowspan="2">Human Eval</td></tr><tr><td>BLEU-4个</td><td>ROUGE-L↑</td><td>CIDEr↑</td><td>BERTScore↑</td></tr><tr><td>Left-only</td><td>0.9</td><td>16.3</td><td>3.5</td><td>38.5</td><td>n/a</td></tr><tr><td>DELOREAN</td><td>1.6</td><td>19.1</td><td>7.9</td><td>41.7</td><td>n/a</td></tr><tr><td>COLD</td><td>1.8</td><td>19.5</td><td>10.7</td><td>42.7</td><td>n/a</td></tr><tr><td>Diffusion</td><td>7.1</td><td>28.3</td><td>30.7</td><td>89.0</td><td>0.37+0.03 -0.02</td></tr><tr><td>AR</td><td>6.7</td><td>27.0</td><td>26.9</td><td>89.0</td><td>0.39±0.02 -0.03</td></tr></table>
|
| 222 |
+
|
| 223 |
+
We evaluate this setting on the combination of Semantic Content $^ +$ Syntax Tree control and Semantic Content $^ +$ Parts-of-speech control. As shown in Table $^ { 4 , }$ our Diffusion-LM achieves a high success rate for both of the two components, whereas FUDGE gives up on the more global syntactic control. This is expected because FUDGE fails to control syntax on its own.
|
| 224 |
+
|
| 225 |
+
Fine-tuned models are good at POS and semantic content control individually but do not compose these two controls well by product of experts (PoE), leading to a large drop in success rates for both constraints.
|
| 226 |
+
|
| 227 |
+
# 7.3 Infilling Results
|
| 228 |
+
|
| 229 |
+
As shown in Table $5 ,$ our diffusion LM significantly outperforms continuous relaxation based methods for infilling (COLD and DELOREAN). Moreover, our method achieves comparable performance to fine-tuning a specialized model for this task. Our method has slightly better automatic evaluation scores and the human evaluation found no statistically significant improvement for either method. These results suggest that Diffusion LM can solve many types of controllable generation tasks that depend on generation order or lexical constraints (such as infilling) without specialized training.
|
| 230 |
+
|
| 231 |
+
# 7.4 Ablation Studies
|
| 232 |
+
|
| 233 |
+
We verify the importance of our proposed design choices in $\ S \dot { 4 }$ through two ablation studies. We measure the sample quality of DiffusionLM using the lm-score on 500 samples $\ S 6 . 2 .$
|
| 234 |
+
|
| 235 |
+
Learned v.s. Random Embeddings (§4.1) Learned embeddings outperform random embeddings on the ROCStories, which is a harder language modeling task. The same trend holds for the E2E dataset but with a smaller margin.
|
| 236 |
+
|
| 237 |
+
Objective Parametrization $\textcircled { \ S 4 . 2 }$ . We propose to let the diffusion model predict $\mathbf { x } _ { \mathrm { 0 } }$ directly. Here, we compare this with standard
|
| 238 |
+
|
| 239 |
+

|
| 240 |
+
Figure 4: We measure the impact of our proposed design choices through lm-score. We find both learned embeddings and reparametrization substantially improves sample quality.
|
| 241 |
+
|
| 242 |
+
parametrization in image generation which parametrizes by the noise term ✏. Figure $\boxed { 4 }$ (right) shows that parametrizing by $\mathbf { x } _ { \mathrm { 0 } }$ consistently attains good performance across dimensions, whereas parametrizing by $\epsilon$ works fine for small dimensions, but quickly collapses for larger dimensions.
|
| 243 |
+
|
| 244 |
+
# 8 Conclusion and Limitations
|
| 245 |
+
|
| 246 |
+
We proposed Diffusion-LM, a novel and controllable language model based on continuous diffusions, which enables new forms of complex fine-grained control tasks. We demonstrate Diffusion-LM’s success in 6 fine-grained control tasks: our method almost doubles the control success rate of prior methods and is competitive with baseline fine-tuning methods that require additional training.
|
| 247 |
+
|
| 248 |
+
We find the complex controls enabled by Diffusion-LM to be compelling, and we are excited by how Diffusion-LM is a substantial departure from the current paradigm of discrete autoregressive generation. As with any new technologies, there are drawbacks to the Diffusion-LMs that we constructed: (1) it has higher perplexity; (2) decoding is substantially slower; and (3) training converges more slowly. We believe that with more follow-up work and optimization, many of these issues can be addressed, and this approach will turn out to be a compelling way to do controllable generation at scale.
|
| 249 |
+
|
| 250 |
+
# Acknowledgments and Disclosure of Funding
|
| 251 |
+
|
| 252 |
+
We thank Yang Song, Jason Eisner, Tianyi Zhang, Rohan Taori, Xuechen Li, Niladri Chatterji, and the members of p-lambda group for early discussions and feedbacks. We gratefully acknowledge the support of a PECASE award. Xiang Lisa Li is supported by a Stanford Graduate Fellowship.
|
| 253 |
+
|
| 254 |
+
# References
|
| 255 |
+
|
| 256 |
+
[1] Jacob Austin, Daniel D. Johnson, Jonathan Ho, Daniel Tarlow, and Rianne van den Berg. Structured denoising diffusion models in discrete state-spaces. In A. Beygelzimer, Y. Dauphin, P. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems, 2021. URL https://openreview.net/forum?id=h7-XixPCAL.
|
| 257 |
+
|
| 258 |
+
[2] Chandra Bhagavatula, Ronan Le Bras, Chaitanya Malaviya, Keisuke Sakaguchi, Ari Holtzman, Hannah Rashkin, Doug Downey, Wen tau Yih, and Yejin Choi. Abductive commonsense reasoning. In International Conference on Learning Representations, 2020. URL https: //openreview.net/forum?id=Byg1v1HKDB.
|
| 259 |
+
[3] 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 H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 1877–1901. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/file/ 1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf.
|
| 260 |
+
[4] Nanxin Chen, Yu Zhang, Heiga Zen, Ron J Weiss, Mohammad Norouzi, and William Chan. Wavegrad: Estimating gradients for waveform generation. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=NsMLjcFaO8O.
|
| 261 |
+
[5] 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 M. Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Benton C. 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 García, 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 Oliveira Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee, Zongwei Zhou, Xuezhi Wang, Brennan Saeta, Mark Diaz, Orhan Firat, Michele Catasta, Jason Wei, Kathleen S. Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022.
|
| 262 |
+
[6] Sumanth Dathathri, Andrea Madotto, Janice Lan, Jane Hung, Eric Frank, Piero Molino, Jason Yosinski, and Rosanne Liu. Plug and play language models: A simple approach to controlled text generation. In International Conference on Learning Representations, 2020. URL https: //openreview.net/forum?id=H1edEyBKDS.
|
| 263 |
+
[7] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. ArXiv, abs/1810.04805, 2019.
|
| 264 |
+
[8] Prafulla Dhariwal and Alexander Quinn Nichol. Diffusion models beat GANs on image synthesis. In A. Beygelzimer, Y. Dauphin, P. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems, 2021. URL https://openreview.net/forum? id=AAWuCvzaVt.
|
| 265 |
+
[9] Chris Donahue, Mina Lee, and Percy Liang. Enabling language models to fill in the blanks. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 2492–2501, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/ 2020.acl-main.225. URL https://aclanthology.org/2020.acl-main.225.
|
| 266 |
+
[10] John C. Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. In J. Mach. Learn. Res., 2010.
|
| 267 |
+
|
| 268 |
+
[11] Marjan Ghazvininejad, Omer Levy, Yinhan Liu, and Luke Zettlemoyer. Mask-predict: Parallel decoding of conditional masked language models. 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), pages 6112–6121, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1633. URL https://aclanthology.org/D19-1633.
|
| 269 |
+
|
| 270 |
+
[12] Jiatao Gu, James Bradbury, Caiming Xiong, Victor O.K. Li, and Richard Socher. Nonautoregressive neural machine translation. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id=B1l8BtlCb.
|
| 271 |
+
|
| 272 |
+
[13] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In Advances in Neural Information Processing Systems, pages 6840–6851, 2020.
|
| 273 |
+
|
| 274 |
+
[14] 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.
|
| 275 |
+
|
| 276 |
+
[15] Emiel Hoogeboom, Didrik Nielsen, Priyank Jaini, Patrick Forré, and Max Welling. Argmax flows and multinomial diffusion: Towards non-autoregressive language models. arXiv preprint arXiv:2102.05379, 2021.
|
| 277 |
+
|
| 278 |
+
[16] Emiel Hoogeboom, Alexey A. Gritsenko, Jasmijn Bastings, Ben Poole, Rianne van den Berg, and Tim Salimans. Autoregressive diffusion models. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=Lm8T39vLDTE.
|
| 279 |
+
|
| 280 |
+
[17] Lukasz Kaiser, Samy Bengio, Aurko Roy, Ashish Vaswani, Niki Parmar, Jakob Uszkoreit, and Noam Shazeer. Fast decoding in sequence models using discrete latent variables. In Jennifer Dy and Andreas Krause, editors, Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pages 2390–2399. PMLR, 10–15 Jul 2018. URL https://proceedings.mlr.press/v80/kaiser18a.html.
|
| 281 |
+
|
| 282 |
+
[18] N. Keskar, B. McCann, L. R. Varshney, Caiming Xiong, and R. Socher. Ctrl: A conditional transformer language model for controllable generation. ArXiv, abs/1909.05858, 2019.
|
| 283 |
+
|
| 284 |
+
[19] Daniel Khashabi, Gabriel Stanovsky, Jonathan Bragg, Nicholas Lourie, Jungo Kasai, Yejin Choi, Noah A. Smith, and Daniel S. Weld. Genie: A leaderboard for human-in-the-loop evaluation of text generation. ArXiv, abs/2101.06561, 2021.
|
| 285 |
+
|
| 286 |
+
[20] Diederik P Kingma and Max Welling. Auto-encoding variational bayes. International Conference on Learning Representations (ICLR), 2014.
|
| 287 |
+
|
| 288 |
+
[21] Diederik P Kingma, Tim Salimans, Ben Poole, and Jonathan Ho. Variational diffusion models. arXiv preprint arXiv:2107.00630, 2021.
|
| 289 |
+
|
| 290 |
+
[22] Nikita Kitaev and Dan Klein. Constituency parsing with a self-attentive encoder. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2676–2686, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1249. URL https://aclanthology.org/P18-1249.
|
| 291 |
+
|
| 292 |
+
[23] Zhifeng Kong and Wei Ping. On fast sampling of diffusion probabilistic models. In ICML Workshop on Invertible Neural Networks, Normalizing Flows, and Explicit Likelihood Models, 2021. URL https://openreview.net/forum?id=agj4cdOfrAP.
|
| 293 |
+
|
| 294 |
+
[24] Zhifeng Kong, Wei Ping, Jiaji Huang, Kexin Zhao, and Bryan Catanzaro. Diffwave: A versatile diffusion model for audio synthesis. arXiv preprint arXiv:2009.09761, 2020.
|
| 295 |
+
|
| 296 |
+
[25] Ben Krause, Akhilesh Deepak Gotmare, Bryan McCann, Nitish Shirish Keskar, Shafiq Joty, Richard Socher, and Nazneen Fatema Rajani. GeDi: Generative Discriminator Guided Sequence Generation. arXiv preprint arXiv:2009.06367, 2020.
|
| 297 |
+
|
| 298 |
+
[26] Shankar Kumar and William Byrne. Minimum Bayes-risk decoding for statistical machine translation. In Proceedings of the Human Language Technology Conference of the North American Chapter of the Association for Computational Linguistics: HLT-NAACL 2004, pages 169–176, Boston, Massachusetts, USA, May 2 - May 7 2004. Association for Computational Linguistics. URL https://aclanthology.org/N04-1022.
|
| 299 |
+
|
| 300 |
+
[27] Jason Lee, Elman Mansimov, and Kyunghyun Cho. Deterministic non-autoregressive neural sequence modeling by iterative refinement. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1173–1182, Brussels, Belgium, OctoberNovember 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1149. URL https://aclanthology.org/D18-1149.
|
| 301 |
+
|
| 302 |
+
[28] Alisa Liu, Maarten Sap, Ximing Lu, Swabha Swayamdipta, Chandra Bhagavatula, Noah A. Smith, and Yejin Choi. DExperts: Decoding-time controlled text generation with experts and anti-experts. 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 6691–6706, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.522. URL https: //aclanthology.org/2021.acl-long.522.
|
| 303 |
+
|
| 304 |
+
[29] Xuezhe Ma, Chunting Zhou, Xian Li, Graham Neubig, and Eduard Hovy. FlowSeq: Nonautoregressive conditional sequence generation with generative flow. 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), pages 4282–4292, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/ D19-1437. URL https://aclanthology.org/D19-1437.
|
| 305 |
+
|
| 306 |
+
[30] Chenlin Meng, Yutong He, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. SDEdit: Guided image synthesis and editing with stochastic differential equations. In International Conference on Learning Representations, 2022. URL https://openreview. net/forum?id=aBsCjcPu_tE.
|
| 307 |
+
|
| 308 |
+
[31] Gautam Mittal, Jesse Engel, Curtis Hawthorne, and Ian Simon. Symbolic music generation with diffusion models. arXiv preprint arXiv:2103.16091, March 2021.
|
| 309 |
+
|
| 310 |
+
[32] Nasrin Mostafazadeh, Nathanael Chambers, Xiaodong He, Devi Parikh, Dhruv Batra, Lucy Vanderwende, Pushmeet Kohli, and James Allen. A corpus and cloze evaluation for deeper understanding of commonsense stories. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 839–849, San Diego, California, June 2016. Association for Computational Linguistics. doi: 10.18653/v1/N16-1098. URL https://aclanthology.org/N16-1098.
|
| 311 |
+
|
| 312 |
+
[33] Alex Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. arXiv preprint arXiv:2102.09672, 2021.
|
| 313 |
+
|
| 314 |
+
[34] Jekaterina Novikova, Ondˇrej Dušek, and Verena Rieser. The E2E dataset: New challenges for end-to-end generation. In Proceedings of the 18th Annual SIGdial Meeting on Discourse and Dialogue, pages 201–206, Saarbrücken, Germany, August 2017. Association for Computational Linguistics. doi: 10.18653/v1/W17-5525. URL https://aclanthology.org/W17-5525.
|
| 315 |
+
|
| 316 |
+
[35] Jeffrey Pennington, Richard Socher, and Christopher Manning. GloVe: Global vectors for word representation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1532–1543, Doha, Qatar, October 2014. Association for Computational Linguistics. doi: 10.3115/v1/D14-1162. URL https://aclanthology. org/D14-1162.
|
| 317 |
+
|
| 318 |
+
[36] Lianhui Qin, Vered Shwartz, Peter West, Chandra Bhagavatula, Jena D. Hwang, Ronan Le Bras, Antoine Bosselut, and Yejin Choi. Back to the future: Unsupervised backprop-based decoding for counterfactual and abductive commonsense reasoning. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 794–805, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020. emnlp-main.58. URL https://aclanthology.org/2020.emnlp-main.58.
|
| 319 |
+
|
| 320 |
+
[37] Lianhui Qin, Sean Welleck, Daniel Khashabi, and Yejin Choi. Cold decoding: Energy-based constrained text generation with langevin dynamics, 2022. URL https://arxiv.org/abs/ 2202.11705.
|
| 321 |
+
|
| 322 |
+
[38] Alec Radford and Karthik Narasimhan. Improving language understanding by generative pre-training. https://openai.com/blog/language-unsupervised/, 2018.
|
| 323 |
+
|
| 324 |
+
[39] Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. https://openai.com/blog/better-language-models/, 2019.
|
| 325 |
+
|
| 326 |
+
[40] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents, 2022. URL https://arxiv.org/abs/ 2204.06125.
|
| 327 |
+
|
| 328 |
+
[41] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, April 2022.
|
| 329 |
+
|
| 330 |
+
[42] Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014.
|
| 331 |
+
|
| 332 |
+
[43] Chitwan Saharia, William Chan, Saurabh Saxena, and Mohammad Norouzi. Non-autoregressive machine translation with latent alignments. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1098–1108, 2020.
|
| 333 |
+
|
| 334 |
+
[44] 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.
|
| 335 |
+
|
| 336 |
+
[45] Tim Salimans and Jonathan Ho. Progressive distillation for fast sampling of diffusion models. In International Conference on Learning Representations, 2022. URL https://openreview. net/forum?id=TIdIXIpzhoI.
|
| 337 |
+
|
| 338 |
+
[46] Lei Sha. Gradient-guided unsupervised lexically constrained text generation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 8692–8703, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/ v1/2020.emnlp-main.701. URL https://aclanthology.org/2020.emnlp-main.701.
|
| 339 |
+
|
| 340 |
+
[47] Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. 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 2256–2265, Lille, France, 07–09 Jul 2015. PMLR. URL https://proceedings.mlr.press/v37/sohl-dickstein15.html.
|
| 341 |
+
|
| 342 |
+
[48] Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations, 2021. URL https://openreview. net/forum?id=St1giarCHLP.
|
| 343 |
+
|
| 344 |
+
[49] Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations, 2021. URL https://openreview. net/forum?id=PxTIG12RRHS.
|
| 345 |
+
|
| 346 |
+
[50] Mitchell Stern, William Chan, Jamie Kiros, and Jakob Uszkoreit. Insertion transformer: Flexible sequence generation via insertion operations. In Kamalika Chaudhuri and Ruslan Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pages 5976–5985. PMLR, 09–15 Jun 2019. URL https://proceedings.mlr.press/v97/stern19a.html.
|
| 347 |
+
|
| 348 |
+
[51] Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-SNE. Journal of Machine Learning Research, 2008.
|
| 349 |
+
|
| 350 |
+
[52] 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, pages 5998–6008. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper/2017/file/ 3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf.
|
| 351 |
+
|
| 352 |
+
[53] Ben Wang and Aran Komatsuzaki. GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/mesh-transformer-jax, May 2021.
|
| 353 |
+
|
| 354 |
+
[54] Chunqi Wang, Ji Zhang, and Haiqing Chen. Semi-autoregressive neural machine translation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 479–488, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1044. URL https://aclanthology.org/D18-1044.
|
| 355 |
+
|
| 356 |
+
[55] Kevin Yang and Dan 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.
|
| 357 |
+
|
| 358 |
+
[56] Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, Todor Mihaylov, Myle Ott, Sam Shleifer, Kurt Shuster, Daniel Simig, Punit Singh Koura, Anjali Sridhar, Tianlu Wang, and Luke Zettlemoyer. Opt: Open pre-trained transformer language models, 2022. URL https: //arxiv.org/abs/2205.01068.
|
md/dev/3tYvDb4dwab/3tYvDb4dwab.md
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UNDERSTANDING SELF-SUPERVISED PRETRAINING WITH PART-AWARE REPRESENTATION LEARNING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
In this paper, we are interested in understanding self-supervised pretraining through studying the capability that self-supervised representation pretraining methods learn part-aware representations. The study is mainly motivated by that random views, used in contrastive learning, and random masked (visible) patches, used in masked image modeling, are often about object parts.
|
| 8 |
+
|
| 9 |
+
We explain that masked image modeling is a part-to-part task: the masked patches of the object are hallucinated from the visible patches, and that contrastive learning is a part-to-whole task: the projection layer hallucinates the whole object representation from the object part representation learned from the encoder. The explanation suggests that the self-supervised pretrained encoder is required to understand the object part. We empirically compare the off-the-shelf encoders pretrained with several representative methods on object-level recognition and part-level recognition. The results show that the fully-supervised model outperforms self-supervised models for object-level recognition, and most self-supervised contrastive learning and masked image modeling methods outperform the fully-supervised method for part-level recognition. It is observed that the combination of contrastive learning and masked image modeling further improves the performance.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Self-supervised representation pretraining has been attracting a lot of research efforts recently. The goal is to train an encoder that maps an image to a representation from visual contents without the necessity of human annotation, expecting that the encoder benefits the downstream tasks, e.g., segmentation and detection.
|
| 14 |
+
|
| 15 |
+
There are two main frameworks: contrastive learning1 and masked image modeling. Contrastive learning aims to maximize the agreement of the embeddings of random augmented views from the same image. Masked image modeling partitions an image into masked patches and visible patches, and makes predictions for masked patches from visible patches. Figure 1 gives examples of random views for contrastive learning and masked and visible patches for masked image modeling.
|
| 16 |
+
|
| 17 |
+
We observe that a random view and a set of masked (visible) patches usually contain a portion of an object. It is also reported in self-supervised learning methods, e.g., DINO (Caron et al., 2021) and iBOT (Zhou et al., 2021), that different attention heads in ViTs can attend to different semantic regions or parts of an object. In light of this, we attempt to understand self-supervised pretraining by studying the capability that the pretrained encoder learns part representations.
|
| 18 |
+
|
| 19 |
+
We present a part-to-whole explanation for typical contrastive learning methods (e.g., SimCLR (Chen et al., 2020), MoCo (Chen et al., 2021), and BYOL (Grill et al., 2020)): the embedding of the whole object is hallucinated from the embedding of the part of the object contained in the random crop through a projection layer. In this way, embeddings of random crops from the same image naturally agrees with each other. Masked image modeling is a part-to-part process: the embeddings of the masked patches of the object (a part of the object), are hallucinated from the visible patches (the other part of the object).
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: (a) original image, (b-c) two random crops, and (d-e) masked and visible patches.
|
| 23 |
+
|
| 24 |
+

|
| 25 |
+
Figure 2: Top-24 patch retrieval results with three frozen encoders of DeiT, MoCo v3, and CAE, by taking the patch in the red box as the query. It can be seen that the retrieved results from CAE and MoCo v3 are about the object part (wing and dog mouth) and more precise than DeiT (about the whole object) implying that self-supervised pretraining methods, CAE and MoCo v3 are stronger at learning part-aware representations than the fully-supervised method DeiT.
|
| 26 |
+
|
| 27 |
+
We empirically compare the supervised model DeiT (Touvron et al., 2020) and typical self-supervised representation pretraining methods, including MoCo v3 (Chen et al., 2021), DINO (Caron et al., 2021), CAE (Chen et al., 2022a), MAE (He et al., 2021), BEiT (Bao et al., 2021), and iBOT (Zhou et al., 2021), on object-level recognition (image classification and object segmentation) and part-level recognition (patch retrieval, patch classification, and part segmentation). Figure 2 presents patch retrieval results using the encoders learned through CAE, MoCo v3, and DeiT, implying that the encoders pretrained by CAE and MoCo v3 are able to learn part-aware representations.
|
| 28 |
+
|
| 29 |
+
Through extensive studies and comparisons, we make the following observations. 1) DeiT outperforms contrastive learning and MIM methods except iBOT in object-level recognition tasks, which may benefit from its explicit object-level supervision. 2) In contrast, self-supervised methods learn better part-aware representations than DeiT. For example, while DeiT is superior to DINO and CAE by $0 . 4 \%$ and $2 . 3 \%$ on ADE20K object segmentation, DINO and CAE outperform DeiT by $1 . 6 \%$ and $1 . 1 \%$ on ADE20K part segmentation, respectively. 3) In contrastive learning, the encoder can learn part-aware information, while the projected representation tends to be more about the whole object. The evidence could be found in part retrieval experiments on MoCo v3, DINO, and iBOT. 4) The MIM method CAE shows good potential in part-aware representation learning. Interestingly, the method combines contrastive learning and MIM is promising, e.g., iBOT learns better representations at both object and part levels.
|
| 30 |
+
|
| 31 |
+
To summarize, this paper presents the following contributions:
|
| 32 |
+
|
| 33 |
+
• We study the capability of learning part-aware representations as a way of understanding self-supervised representation pretraining.
|
| 34 |
+
• We explain masked image modeling as a part-to-part task and contrastive learning as a partto-whole task, and speculate that self-supervised pretraining has the potential for learning part-aware representations.
|
| 35 |
+
|
| 36 |
+
• We empirically compare several pretrained models on object-level and part-level recognition tasks, showing interesting findings with supporting evidence of the capability of part-aware representation learning for self-supervised learning.
|
| 37 |
+
|
| 38 |
+
# 2 RELATED WORK
|
| 39 |
+
|
| 40 |
+
Contrastive learning. Contrastive pretraining has been an intense academic field in the CNN era. In this work, we use it to refer to methods for comparing random views (Caron et al., 2020; Chen et al., 2020; Zbontar et al., 2021; Xie et al., 2021a; Chen et al., 2021; Caron et al., 2021), including some instance discrimination work such as (Grill et al., 2020; Chen & He, 2021; Bardes et al., 2021). As one of the representative works, SimCLR (Chen et al., 2020) learns representations through maximizing agreement between different views of the same image in the latent space. BYOL (Grill et al., 2020) uses two asymmetrical networks to bootstrap latent representation without negative samples involved during the interaction. As vision transformer (ViT) (Dosovitskiy et al., 2021) shows excellent performance via supervised learning, it is adopted subsequently in contrastive pertaining, and numerous outstanding works are proposed. For example, MoCo v3 (Chen et al., 2021) observes the hidden instability while training self-supervised ViT and solves it by using a fixed random patch projection. DINO (Caron et al., 2021) explores new properties derived from self-supervised ViT and accordingly designs a learning strategy interpreted as a form of self-distillation with no labels.
|
| 41 |
+
|
| 42 |
+
Masked image modeling (MIM). Masked image modeling is another self-supervised pretraining paradigm that attracts much attention recently. BEiT (Bao et al., 2021) follows masked language modeling in the natural language process (NLP) area and predicts tokens via mapping image patches by d-VAE (Ramesh et al., 2021). PeCo (Dong et al., 2021) boosts BEiT by taking into consideration more semantic information in visual tokens. MAE (He et al., 2021) learns rich hidden information by directly performing masked image reconstruction in RGB color space using ViT while SimMIM (Xie et al., 2021b) uses Swin-transformer (Liu et al., 2021). CAE (Chen et al., 2022a) adds a regressor between encoder and decoder, which is designed to align unmasked patches with masked ones, leading to a pure context encoder. Recently, a trend that combines MIM with siamese frameworks has surfaced and showed encouraging results including MST (Li et al., 2021), SplitMask (El-Nouby et al., 2021), iBOT (Zhou et al., 2021), dBOT (Liu et al., 2022), and SIM (Tao et al., 2022).
|
| 43 |
+
|
| 44 |
+
Understanding self-supervised contrastive pretraining. The studies on understanding contrastive pretraining (Saunshi et al., 2022; Chen et al., 2022b; Zhong et al., 2022; Wei et al., 2022) mainly focus on random augmentations (views), contrastive loss function and its variants under the assumption that: the augmentations of inputs from the same class have significant overlap in the representation space, but there is little overlap for inputs from different classes. Our work is complementary to these studies. Inspired by the observation that random views usually contain a portion of an object, and methods (Caron et al., 2021; Zhou et al., 2021) show that different attention heads in ViTs can attend to different semantic regions of an object, we investigate what the encoder and the projector do in typical self-supervised contrastive pretraining. We speculate that the pretraining task is a part-to-whole problem, predicting the representation of the whole object through the projector from the representation (obtained from the encoder) of the part of an object. We use empirical results to verify our analysis.
|
| 45 |
+
|
| 46 |
+
Understanding self-supervised masked image modeling. The comparison of attention in different layers between the pretrained models from MIM and the supervised approach is conducted: MIM pretraining brings locality to the trained model with sufficient diversity on the attention heads (Xie et al., 2022a). Consistent with the analysis in NLP, empirical studies are conducted in Xie et al. (2022b) to verify that MIM benefits from larger models, more data, and longer training. CAE (Chen et al., 2022a) gives the comparison between contrastive and MIM and shows MIM cares about all patches and thus achieves better results for fine-tuning. Cao et al. (2022) provides a mathematical understanding of MIM. Kong & Zhang (2022) points out that the learned occlusion invariant feature contributes to the success of MIM. In this work, we speculate that masked image modeling is a partto-part process: the embeddings of the masked part of the object are hallucinated from the visible part using the position information of the masked patches, leading to better part-aware representation than the supervised model DeiT (Touvron et al., 2020).
|
| 47 |
+
|
| 48 |
+

|
| 49 |
+
Figure 3: The pipeline of a typical contrastive learning approach. Two augmented views, red box and blue box, are generated from the original image. The augmented view in red is fed into the encoder and the projector, and then the predictor (which does not appear in earlier works like MoCo (Chen et al., 2021) and SimCLR (Chen et al., 2020)), and the view in blue is fed into the encoder and the projector. The two outputs are expected to be aligned. The gradient is stopped for the bottom stream.
|
| 50 |
+
|
| 51 |
+
# 3 UNDERSTANDING CONTRASTIVE LEARNING AND MASK IMAGE MODELING
|
| 52 |
+
|
| 53 |
+
# 3.1 CONTRASTIVE LEARNING
|
| 54 |
+
|
| 55 |
+
Contrastive learning aims to learn the encoder through maximizing the agreement between differently augmented views of the same image in the representation space. An example pipeline is depicted in Figure 3. Given an image I, the augmentations, e.g., random cropping, random color distortion, and random Gaussian blur, are applied to generate a set of $N$ augmented views, $\{ \mathsf { V } _ { 1 } , \mathsf { V } _ { 2 } , \cdots , \mathsf { V } _ { N } \}$ . An augmented view $\mathsf { V } _ { n }$ is fed into an encoder Encoder, generating the encoded representation ${ \bf x } _ { n }$ , and followed by a projector, generating the projection $\mathbf { z } _ { n }$ . The basic goal is to maximize the agreement between the projections $\{ \mathbf { z } _ { 1 } , \mathbf { z } _ { 2 } , \cdots , \mathbf { z } _ { N } \}$ , i.e., minimize the loss
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
{ \mathcal { L } } _ { \mathrm { C P T } } = \sum _ { i = 1 } ^ { N } \sum _ { j = 1 } ^ { N } { \ell } ( \mathrm { P r o j e c t o r ( E n c o d e r ( V } _ { i } ) ) , \mathrm { P r o j e c t o r ( E n c o d e r ( V } _ { j } ) ) ) .
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
In the formulation with a contrastive loss, the agreement between the projections of random augmentations from different images is minimized.
|
| 62 |
+
|
| 63 |
+
Part-to-whole prediction explanation. Let us consider two crops randomly sampled from the original image (see the examples given in Figure 1(b-c)). The encoded representation of the first crop is expected to describe a part of the object dog; the encoded representation of the second crop is expected to describe another part of the object $\mathrm { d o g ^ { 2 } }$ . The two representations are related but different. Contrastive learning methods project the two encoded representations into two projected representations that are expected to agree. We hypothesize that the projection process maps the encoded part representation to the representation of the whole object3. Through this way, the projected representations will agree to different views from the same image. It is assumed that the part-to-whole projection is more reliable if the encoded representation is semantically richer and is able to describe the part information. The part-to-whole process suggests that the encoder pretrained by contrastive learning methods is potentially capable of learning part-aware representations.
|
| 64 |
+
|
| 65 |
+
Figure 4 provides patch search results of a representative contrastive learning method MoCo v3 (Chen et al., 2021) based on the encoded representations before and after the projections. One can see that the results through the encoded representations are mainly about the local part, and the results through the projections tend to include the other parts of the same object. In other words, the projections tend to be about the whole object. Similar observations are also shown in Chen et al. (2022b). The search results verify the part-to-whole hypothesis.
|
| 66 |
+
|
| 67 |
+
# 3.2 MASKED IMAGE MODELING
|
| 68 |
+
|
| 69 |
+
Mask image modeling is the task of predicting some parts of an image from the remaining parts. An augmented view of an image is partitioned into patches, $\mathcal { R } = \{ \mathsf { R } _ { 1 } , \mathsf { R } _ { 2 } , \ldots , \mathsf { R } _ { M } \}$ . The task is to predict a subset of patches $\mathcal { R } _ { m }$ , named masked patches, from the remaining patches $\mathcal { R } _ { v }$ , named visible patches. Considering contrastive learning that explicitly compares representations of random views, we take context autoencoder (CAE) (Chen et al., 2022a) as an example that explicitly predicts the encoded representations of the masked patches from the encoded representations of the visible patches4.
|
| 70 |
+
|
| 71 |
+

|
| 72 |
+
Figure 4: Illustration of patch search results using encoded representations and projections (pretrained with MoCo v3 as). Left: patch search results with encoded representations. Right: patch search results with projections. In each result, the small patch encircled by the red box is taken as the query. It can be seen that for encoded representations, the returned patches are about the same part, and for projections, the result patches are about the same object, verifying the part-to-whole hypothesis.
|
| 73 |
+
|
| 74 |
+
One goal of CAE (illustrated in Figure 5), which we call masked representation modeling (MRM), is to maximize the agreement between the predictions of the representations of masked patches (through a regressor) and the representation of masked patches computed from the encoder by minimizing the loss
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
\ell _ { \mathrm { M R M } } ( \mathrm { R e g r e s s o r } ( \operatorname { E n c o d e r } ( \mathcal { P } _ { v } ) ) , \operatorname { E n c o d e r } ( \mathcal { P } _ { m } ) ) .
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
Here, we do not include the positional embeddings of masked and visible patches for clarity. It is noted that MRM differs from contrastive learning: MRM does not compare multiple random views, but compares the regressed representations for masked patches and the encoded representations of masked patches. In addition, there is another loss for target prediction (reconstruction) for the masked patches, which is commonly used in masked image modeling (MIM) methods:
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
\ell _ { \mathrm { M I M } } \big ( \mathrm { D e c o d e r } \big ( \mathrm { R e g r e s s o r } \big ( \mathrm { E n c o d e r } ( \mathcal { P } _ { v } ) \big ) \big ) , \mathrm { T a r g e t } ( \mathcal { P } _ { m } ) \big ) ,
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
where ${ \mathrm { T a r g e t } } ( { \mathcal { P } } _ { m } )$ is a function to map the masked patches to the targets, e.g., d-VAE (Ramesh et al., 2021) token used in CAE and BeiT (Bao et al., 2021), or normalized RGB values used in MAE (He et al., 2021).
|
| 87 |
+
|
| 88 |
+
Part-to-part prediction explanation. The masked image modeling approaches, including CAE, MAE, and BEiT, make use of the positions of masked patches for making predictions for masked patches from visible patches. The visible patches and masked patches often contain different parts of an object. In other words, MIM aims to predict the masked part of an object from the visible part. We name this a part-to-part process. There are two part-to-part tasks: one is to reconstruct the part targets from the visible part representations (MAE and CAE) or from the visible part raw pixels (BEiT), and the other one is to regress the masked part representations (CAE). The part-to-part process suggests that the encoder pretrained by MIM methods is potentially capable of learning part-aware representations. Figure 2 illustrates the capability with the patch retrieval results.
|
| 89 |
+
|
| 90 |
+

|
| 91 |
+
Figure 5: The pipeline of an MIM approach, context autoencoder (CAE). An augmented view (in blue) of the image is partitioned into visible and masked patches. The CAE approach feeds visible patches into the encoder and extracts their representations $\mathbf { Z } _ { v }$ and then completes the pretext task by predicting the representations $\mathbf { Z } _ { m }$ of the masked patches from the visible patches in the encoded representation space with latent contextual regressor and alignment constraint, and mapping predicted representations $\mathbf { Z } _ { m }$ of masked patches to the targets. The pretrained encoder in (a) is applied to downstream tasks by simply replacing the pretext task part (b, c) with the downstream task completion part.
|
| 92 |
+
|
| 93 |
+
Table 1: Top-1 accuracy with linear probing, and attentive probing (Chen et al., 2022a), on the ImageNet classification benchmark (Deng et al., 2009).
|
| 94 |
+
|
| 95 |
+
<table><tr><td>Method</td><td>Linear</td><td>Attentive</td></tr><tr><td colspan="3">Supervised Model:</td></tr><tr><td>DeiT</td><td>81.8</td><td>81.8</td></tr><tr><td colspan="3">Contrastive Learning:</td></tr><tr><td>MoCo v3</td><td>76.2</td><td>77.0</td></tr><tr><td>DINO</td><td>77.3</td><td>77.8</td></tr><tr><td colspan="3">Masked Image Modeling (MIM):</td></tr><tr><td>BEiT</td><td>41.8</td><td>51.9</td></tr><tr><td>MAE</td><td>67.8</td><td>74.2</td></tr><tr><td>CAE</td><td>70.4</td><td>77.1</td></tr><tr><td colspan="3">Contrastive Learning+MIM:</td></tr><tr><td>iBOT</td><td>79.5</td><td>79.8</td></tr></table>
|
| 96 |
+
|
| 97 |
+
Table 2: Linear evaluation of ADE20K (Zhou et al., 2019) object-level semantic segmentation (150 classes) using $4 \times$ upsampling and a single $1 \times 1$ convolutional layer on frozen backbones.
|
| 98 |
+
|
| 99 |
+
<table><tr><td>Method</td><td>mIoU</td><td>mAcc</td><td>aAcc</td></tr><tr><td>Supervised Model:</td><td></td><td></td><td></td></tr><tr><td>DeiT</td><td>34.9</td><td>44.2</td><td>75.4</td></tr><tr><td>Contrastive Learning:</td><td></td><td></td><td></td></tr><tr><td>MoCo v3</td><td>34.7</td><td>43.9</td><td>75.9</td></tr><tr><td>DINO</td><td>34.5</td><td>43.5</td><td>76.1</td></tr><tr><td colspan="4">Masked Image Modeling (MIM):</td></tr><tr><td>BEiT</td><td>17.8</td><td>23.7</td><td>64.9</td></tr><tr><td>MAE</td><td>27.1</td><td>34.8</td><td>71.6</td></tr><tr><td>CAE</td><td>32.6</td><td>42.2</td><td>75.2</td></tr><tr><td colspan="4">Contrastive Learning +MIM:</td></tr><tr><td>iBOT</td><td>38.3</td><td>47.4</td><td>78.1</td></tr></table>
|
| 100 |
+
|
| 101 |
+
# 4 EXPERIMENTS
|
| 102 |
+
|
| 103 |
+
We study seven representative methods with the same ViT-B encoder, including a supervised method DeiT (Touvron et al., 2020); contrastive learning methods MoCo v3 (Chen et al., 2021), DINO (Caron et al., 2021); masked image modeling (MIM) methods BEiT (Bao et al., 2021), MAE (He et al., 2021), and CAE (Chen et al., 2022a); and iBOT (Zhou et al., 2021) that combines contrastive learning and MIM. We take the training epochs specified in each work to ensure that all compared models are properly trained: 300 for DeiT, 300 $( 6 0 \dot { 0 } ^ { 5 } )$ for MoCo v3, 400 $( 1 6 0 0 ^ { 5 } )$ ) for DINO and iBOT, 800 for BEiT, and 1600 for MAE and CAE. Frozen encoders are used in all experiments to understand what these different representation pretraining methods learn. More details can be found in Appendix A.1.
|
| 104 |
+
|
| 105 |
+
# 4.1 OBJECT-LEVEL RECOGNITION
|
| 106 |
+
|
| 107 |
+
We benchmark two widely-studied object-level recognition, i.e., image classification and semantic segmentation to show the capability that the pretrained encoder learns object-level representations.
|
| 108 |
+
|
| 109 |
+
Table 3: Part retrieval (AP, $\%$ ) and classification (accuracy, $\%$ ) results on the cropped part patches of CUB-200-2011 and COCO. The “Encoded" and “Projected" refer to the encoded and projected representations. “Linear" and “Attentive" columns denote the linear probing and attentive probing accuracy, respectively.
|
| 110 |
+
|
| 111 |
+
<table><tr><td rowspan="3">Methods</td><td colspan="4">PartRetrieval</td><td colspan="4">Part Classification</td></tr><tr><td colspan="2">CUB-200-2011</td><td colspan="2">COCo</td><td colspan="2">CUB-200-2011</td><td colspan="2">COCO</td></tr><tr><td>Encoded</td><td>Projected</td><td>Encoded</td><td>Projected</td><td>Linear</td><td>Attentive</td><td>Linear</td><td>Attentive</td></tr><tr><td colspan="9">Supervised Model:</td></tr><tr><td>DeiT</td><td>35.0</td><td></td><td>44.1</td><td></td><td>90.9</td><td>92.9</td><td>88.5</td><td>91.4</td></tr><tr><td colspan="9">Contrastive Learning:</td></tr><tr><td>MoCo v3</td><td>50.8</td><td>28.4</td><td>52.3</td><td>36.8</td><td>93.8</td><td>96.0</td><td>92.4</td><td>95.3</td></tr><tr><td>DINO</td><td>48.9</td><td>31.7</td><td>51.8</td><td>41.2</td><td>93.2</td><td>95.2</td><td>91.7</td><td>94.5</td></tr><tr><td colspan="9">Masked Image Modeling (MIM):</td></tr><tr><td>BEiT</td><td>27.9</td><td>1</td><td>35.3</td><td>1</td><td>55.4</td><td>86.5</td><td>69.3</td><td>86.5</td></tr><tr><td>MAE</td><td>28.5</td><td>1</td><td>37.1</td><td></td><td>86.9</td><td>92.8</td><td>88.0</td><td>93.9</td></tr><tr><td>CAE</td><td>58.0</td><td>1</td><td>57.0</td><td>1</td><td>89.5</td><td>95.8</td><td>91.1</td><td>95.5</td></tr><tr><td colspan="9">Contrastive Learning +MIM:</td></tr><tr><td>iBOT</td><td>49.3</td><td>31.2</td><td>59.2</td><td>41.5</td><td>93.8</td><td>95.8</td><td>92.1</td><td>95.1</td></tr></table>
|
| 112 |
+
|
| 113 |
+
Image classification. We report the linear probing, and attentive probing results of the selected models on ImageNet (Deng et al., 2009). For attentive probing, we follow the protocol in CAE (Chen et al., 2022a) that append a cross-attention layer together with a batch normalization layer and a linear classifier.
|
| 114 |
+
|
| 115 |
+
We have the following observations from Table 1. 1) The supervised model, DeiT performs better than self-supervised models at object-level recognition. 2) The models that leverage contrastive learning, i.e., MoCo, DINO, and iBOT, show superior linear probing performance than MIM-based models, demonstrating they contain more object-aware high-level semantics. 3) MIM-based models, e.g., CAE, show inferior results in linear probing while competitive results with contrastive-based methods in attentive probing. The reason might be that MIM is capable of attending to all the regions, including non-object regions in an image, thus needs a spatial feature selection step to attend to the object part, which is pointed out in Chen et al. (2022a). BEiT and MAE perform inferior, implying that the two methods are less capable of learning semantics.
|
| 116 |
+
|
| 117 |
+
Object-level semantic segmentation. We perform linear evaluation on ADE20K (Zhou et al., 2019) to show the object-level semantic capabilities of the pretrained models. A $4 \times$ bilinear interpolation and a single $1 \times 1$ convolutional layer for pixel labeling are attached to the frozen encoder.
|
| 118 |
+
|
| 119 |
+
We can see from Table 2 that the supervised model DeiT outperforms all self-supervised models except iBOT, including contrastive learning and MIM methods on ADE20K object-level segmentation. This implies that in general the self-supervised models are not strong at object-level understanding, which is consistent with the observations for image classification. iBOT (Zhou et al., 2021), as a combination of contrastive learning and MIM, shows surprisingly better performance than the supervised model DeiT on ADE20K, implying the power of combining contrastive learning and masked image modeling for downstream tasks.
|
| 120 |
+
|
| 121 |
+
# 4.2 PART-LEVEL RECOGNITION
|
| 122 |
+
|
| 123 |
+
Self-supervised methods like iBOT (Zhou et al., 2021) and DINO (Caron et al., 2021) qualitatively show that different attention heads in ViTs can attend to different semantic regions of an object. We conduct the quantitative evaluation for part-aware representation obtained by pretrained models that is not well explored before, through three part-level recognition tasks, part retrieval, part classification, and part segmentation.
|
| 124 |
+
|
| 125 |
+
Part retrieval. We conduct part retrieval experiments on two datasets, CUB-200-2011 (Wah et al., 2011) and COCO (Lin et al., 2014). We build the part patch databases by cropping the patches centered at the keypoint. We consider four and three keypoints from the two datasets, respectively. For each keypoint, we find the minimum L2 distance $( d )$ from the distances between it and all the other keypoints in the same image, then crop a $d \times d$ patch centered at this keypoint and resize it to $2 2 4 \times 2 2 4$ . We use the cosine distance as the patch distance and evaluate the retrieval performance using average precision (AP) as the retrieval metric.
|
| 126 |
+
|
| 127 |
+
Table 4: Part-level linear semantic segmentation results on ADE20K-Part, Pascal-Part, and LIP datasets.
|
| 128 |
+
|
| 129 |
+
<table><tr><td rowspan="3">Methods</td><td colspan="3">ADE20K-Part 209 Part Classes</td><td colspan="3">Pascal-Part 193 Part Classes</td><td colspan="3">LIP 19 Part Classes</td></tr><tr><td>mIoU</td><td>mAcc</td><td>aAcc</td><td>mIoU</td><td>mAcc</td><td>aAcc</td><td>mIoU</td><td>mAcc</td><td>aAcc</td></tr><tr><td colspan="10">Supervised Model:</td></tr><tr><td>DeiT</td><td>27.3</td><td>34.7</td><td>69.2</td><td>27.4</td><td>36.1</td><td>65.8</td><td>41.4</td><td>52.6</td><td>73.5</td></tr><tr><td colspan="10">Contrastive Learning:</td></tr><tr><td>MoCo v3</td><td>27.1</td><td>34.7</td><td>70.1</td><td>27.1</td><td>35.8</td><td>66.0</td><td>41.9</td><td>53.0</td><td>74.5</td></tr><tr><td>DINO</td><td>28.9</td><td>36.8</td><td>70.3</td><td>27.8</td><td>36.5</td><td>66.4</td><td>41.0</td><td>51.9</td><td>74.0</td></tr><tr><td colspan="10">Masked ImageModeling ( (MIM):</td></tr><tr><td>BEiT</td><td>18.6</td><td>25.8</td><td>58.2</td><td>14.8</td><td>21.4</td><td>47.0</td><td>27.2</td><td>36.5</td><td>60.1</td></tr><tr><td>MAE</td><td>26.3</td><td>35.0</td><td>67.3</td><td>24.3</td><td>32.9</td><td>61.5</td><td>38.2</td><td>48.7</td><td>71.3</td></tr><tr><td>CAE</td><td>28.4</td><td>36.9</td><td>71.1</td><td>27.8</td><td>37.0</td><td>66.3</td><td>43.7</td><td>55.1</td><td>75.9</td></tr><tr><td colspan="10">Contrastive Learning + MIM:</td></tr><tr><td>iBOT</td><td>32.2</td><td>40.0</td><td>73.4</td><td>30.7</td><td>40.0</td><td>69.7</td><td>44.6</td><td>55.7</td><td>76.6</td></tr></table>
|
| 130 |
+
|
| 131 |
+
The results are provided in Table 3. We have the following observations. 1) Self-supervised models except BEiT and MAE outperform the supervised model DeiT, indicating the capability that contrastive learning and CAE learn part-aware representations. BEiT and MAE perform inferior, consistent to the observations in ImageNet classification in Table 1. 2) iBOT performs the best, and the reason might be that the capability of learning part-aware representations is boosted by making use of both contrastive learning and masked image modeling.
|
| 132 |
+
|
| 133 |
+
We also report the part retrieval performance of the projected representations of contrastive learning methods in Table 3. The performance is much lower than the encoded representations. This provides an extra evidence for the part-to-whole hypothesis of contrastive learning: the projected representations are more about the whole object.
|
| 134 |
+
|
| 135 |
+
Part classification. We further conduct part classification experiments on the datasets used for part retrieval. We consider two kinds of extra learnable layers, linear probing and attentive probing, for classification. The results in Table 3 show that: 1) While DeiT performs the best in the image classification task (see Table 1), for part classification, contrastive-based methods like MoCo v3, DINO, and iBOT outperform DeiT by more than $2 \%$ under both linear and attentive probing settings. 2) Though MIM-based models CAE and MAE are inferior to DeiT in object-level classification (e.g., more than $10 \%$ and $4 \%$ lower in linear and attentive probing), they show competitive performance in linear probing and higher results than DeiT in attentive probing, demonstrating they learn better partaware representations. 3) BEiT is inferior to other works, and iBOT has good performance, implying that the probing quality of pretrained encoders is a good indicator for downstream performance.
|
| 136 |
+
|
| 137 |
+
Part segmentation. We perform part-level linear semantic segmentation to study the finer-grained part representation modeling capability of different pretraining paradigms on three widely used datasets: ADE20K-Part (Zhou et al., 2019) containing 209 parts from the ADE20K dataset (Zhou et al., 2019), Pascal-Part (Chen et al., 2014) including 193 part categories, and LIP (Gong et al., 2017) consisting of 19 semantic human part labels. Similar to the object-level semantic segmentation experiments, linear evaluation is employed here. We maintain the same training protocols for all methods for fair comparisons. See Appendix A.2 and A.4 for dataset and training details.
|
| 138 |
+
|
| 139 |
+
The results are reported in Table 4 with the following observations. 1) Contrastive learning models, i.e., MoCo v3 and DINO, achieve competitive performance with the supervised model DeiT: DINO outperforms DeiT on ADE20K-Part and Pascal-Part, and MoCo v3 outperforms DeiT on LIP. 2) The MIM model CAE, outperforms DeiT by large margins on all three datasets, e.g., $1 . 1 \%$ on ADE20K-Part and $2 . 3 \%$ on LIP, indicating CAE learns good part-aware representations. Similar to part retrieval, possibly due to pretraining quality in representation encoding, BEiT and MAE perform inferior. 3) Compared with object-level segmentation results in Table 2, DeiT learns better object-level semantics by explicit supervision than both contrastive learning and MIM, however, it is generally inferior to self-supervised models on part segmentation. 4) The model iBOT, which leverages both contrastive learning and MIM, outperforms all other works on three datasets, demonstrating its powerful capability in learning finer part-level semantics. Combining the two self-supervised learning techniques is thus a promising direction.
|
| 140 |
+
|
| 141 |
+

|
| 142 |
+
Figure 6: Comparisons between object-level and part-level semantic segmentation on ADE20K and Pascal-Part datasets. Though the supervised DeiT is superior over self-supervised models (i.e., MoCo v3, DINO, MAE, CAE) on object-level segmentation, it is generally inferior to self-supervised models on part segmentation, demonstrating self-supervised methods learn good part-aware representations. iBOT enjoys the benefits of contrastive learning and MIM. See Appendix A.3 for detailed results.
|
| 143 |
+
|
| 144 |
+
In summary, we show that self-supervised methods are potentially capable of learning part-aware representations. Among them, CAE is a representative MIM work, showing good performance by explicitly predicting the encoded representations of the masked patches in the encoding space; contrastive learning methods MoCo v3 and DINO outperform BEiT and MAE; and iBOT performs the best by combining contrastive learning and MIM. The observations are evidenced by three part-based segmentation benchmarks consistently.
|
| 145 |
+
|
| 146 |
+
# 4.3 OBSERVATION SUMMARY BETWEEN OBJECT-LEVEL AND PART-LEVEL SEGMENTATION
|
| 147 |
+
|
| 148 |
+
We conduct both object-level and part-level linear semantic segmentation on different hierarchies of the same dataset. Considering that the 209 classes in ADE20K-Part are basically chosen from 59 object classes, we denote the 59-object dataset as ADE20K-Object. Similarly, Pascal-Object consists of 16 object categories, corresponding to the 193 part categories in Pascal-Part.
|
| 149 |
+
|
| 150 |
+
The results in Figure 6 show that: although the supervised DeiT is superior over contrastive learning and masked image modeling methods on ADE20K-Object and Pascal-Object except iBOT, it is generally inferior to self-supervised models on ADE20K-Part and Pascal-Part, demonstrating selfsupervised methods can learn good part-aware representations. Similar observations could be found from the object classification in Table 1 and part classification in Table 3.
|
| 151 |
+
|
| 152 |
+
In comparison to contrastive learning, CAE shows a stronger capability of learning part-aware representations, and a weaker capability of learning object-level semantics. The superiority of iBOT, a combination of contrastive learning and masked image modeling, demonstrates that it enjoys the benefits of contrastive learning and masked image modeling.
|
| 153 |
+
|
| 154 |
+
# 5 CONCLUSION
|
| 155 |
+
|
| 156 |
+
We attempt to study the capability of learning part-aware representations of self-supervised representation pretraining methods. We provide speculations for contrastive learning and masked image modeling: part-to-whole and part-to-part, with empirical results justifying the speculations. Our study presents an aspect to understand what self-supervised representation pretraining methods learn.
|
| 157 |
+
|
| 158 |
+
Future work. The strong capability of part-aware representation learning is one of the properties of self-supervised pretraining. There should be other characteristics that are leaved as the future work.
|
| 159 |
+
|
| 160 |
+
# REFERENCES
|
| 161 |
+
|
| 162 |
+
Hangbo Bao, Li Dong, and Furu Wei. BEiT: BERT pre-training of image transformers. arXiv:2106.08254, 2021.
|
| 163 |
+
|
| 164 |
+
Adrien Bardes, Jean Ponce, and Yann LeCun. Vicreg: Variance-invariance-covariance regularization for self-supervised learning. arXiv preprint arXiv:2105.04906, 2021.
|
| 165 |
+
|
| 166 |
+
Suzanna Becker and Geoffrey E. Hinton. A self-organizing neural network that discovers surfaces in random-dot stereograms. Nature, 355(6356):161–163, 1992.
|
| 167 |
+
|
| 168 |
+
Holger Caesar, Jasper Uijlings, and Vittorio Ferrari. Coco-stuff: Thing and stuff classes in context. In CVPR, pp. 1209–1218, 2018.
|
| 169 |
+
|
| 170 |
+
Shuhao Cao, Peng Xu, and David A Clifton. How to understand masked autoencoders. arXiv preprint arXiv:2202.03670, 2022.
|
| 171 |
+
|
| 172 |
+
Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. Unsupervised learning of visual features by contrasting cluster assignments. arXiv preprint arXiv:2006.09882, 2020.
|
| 173 |
+
|
| 174 |
+
Mathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou, Julien Mairal, Piotr Bojanowski, and Armand Joulin. Emerging properties in self-supervised vision transformers. In ICCV, 2021.
|
| 175 |
+
|
| 176 |
+
Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey E. Hinton. A simple framework for contrastive learning of visual representations. In ICML, volume 119 of Proceedings of Machine Learning Research, pp. 1597–1607. PMLR, 2020.
|
| 177 |
+
|
| 178 |
+
Xianjie Chen, Roozbeh Mottaghi, Xiaobai Liu, Sanja Fidler, Raquel Urtasun, and Alan Yuille. Detect what you can: Detecting and representing objects using holistic models and body parts. In CVPR, pp. 1971–1978, 2014.
|
| 179 |
+
|
| 180 |
+
Xiaokang Chen, Mingyu Ding, Xiaodi Wang, Ying Xin, Shentong Mo, Yunhao Wang, Shumin Han, Ping Luo, Gang Zeng, and Jingdong Wang. Context autoencoder for self-supervised representation learning. arXiv preprint arXiv:2202.03026, 2022a.
|
| 181 |
+
|
| 182 |
+
Xinlei Chen and Kaiming He. Exploring simple siamese representation learning. In CVPR, pp. 15750–15758, 2021.
|
| 183 |
+
|
| 184 |
+
Xinlei Chen, Saining Xie, and Kaiming He. An empirical study of training self-supervised vision transformers. In ICCV, pp. 9640–9649, 2021.
|
| 185 |
+
|
| 186 |
+
Yubei Chen, Adrien Bardes, Zengyi Li, and Yann LeCun. Intra-instance vicreg: Bag of self-supervised image patch embedding. arXiv preprint arXiv:2206.08954, 2022b.
|
| 187 |
+
|
| 188 |
+
MMSegmentation Contributors. MMSegmentation: Openmmlab semantic segmentation toolbox and benchmark. https://github.com/open-mmlab/mmsegmentation, 2020.
|
| 189 |
+
|
| 190 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, pp. 248–255. Ieee, 2009.
|
| 191 |
+
|
| 192 |
+
Xiaoyi Dong, Jianmin Bao, Ting Zhang, Dongdong Chen, Weiming Zhang, Lu Yuan, Dong Chen, Fang Wen, and Nenghai Yu. Peco: Perceptual codebook for bert pre-training of vision transformers. arXiv preprint arXiv:2111.12710, 2021.
|
| 193 |
+
|
| 194 |
+
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. OpenReview.net, 2021.
|
| 195 |
+
|
| 196 |
+
Alaaeldin El-Nouby, Gautier Izacard, Hugo Touvron, Ivan Laptev, Hervé Jegou, and Edouard Grave. Are large-scale datasets necessary for self-supervised pre-training? arXiv preprint arXiv:2112.10740, 2021.
|
| 197 |
+
|
| 198 |
+
M. Everingham, L. Van Gool, C. K. I. Williams, J. Winn, and A. Zisserman. The PASCAL Visual Object Classes Challenge 2010 (VOC2010) Results. http://www.pascalnetwork.org/challenges/VOC/voc2010/workshop/index.html, 2010.
|
| 199 |
+
|
| 200 |
+
Ke Gong, Xiaodan Liang, Dongyu Zhang, Xiaohui Shen, and Liang Lin. Look into person: Selfsupervised structure-sensitive learning and a new benchmark for human parsing. In CVPR, July 2017.
|
| 201 |
+
|
| 202 |
+
Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre H Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent: A new approach to self-supervised learning. arXiv preprint arXiv:2006.07733, 2020.
|
| 203 |
+
|
| 204 |
+
Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross Girshick. Masked autoencoders are scalable vision learners. arXiv preprint arXiv:2111.06377, 2021.
|
| 205 |
+
|
| 206 |
+
Xiangwen Kong and Xiangyu Zhang. Understanding masked image modeling via learning occlusion invariant feature. arXiv preprint arXiv:2208.04164, 2022.
|
| 207 |
+
|
| 208 |
+
Zhaowen Li, Zhiyang Chen, Fan Yang, Wei Li, Yousong Zhu, Chaoyang Zhao, Rui Deng, Liwei Wu, Rui Zhao, Ming Tang, et al. Mst: Masked self-supervised transformer for visual representation. Advances in Neural Information Processing Systems, 34:13165–13176, 2021.
|
| 209 |
+
|
| 210 |
+
Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ECCV, pp. 740–755. Springer, 2014.
|
| 211 |
+
|
| 212 |
+
Xingbin Liu, Jinghao Zhou, Tao Kong, Xianming Lin, and Rongrong Ji. Exploring target representations for masked autoencoders. arXiv preprint arXiv:2209.03917, 2022.
|
| 213 |
+
|
| 214 |
+
Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In ICCV, pp. 10012–10022, 2021.
|
| 215 |
+
|
| 216 |
+
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.
|
| 217 |
+
|
| 218 |
+
Nikunj Saunshi, Jordan T. Ash, Surbhi Goel, Dipendra Misra, Cyril Zhang, Sanjeev Arora, Sham M. Kakade, and Akshay Krishnamurthy. Understanding contrastive learning requires incorporating inductive biases. CoRR, abs/2202.14037, 2022. URL https://arxiv.org/abs/2202. 14037.
|
| 219 |
+
|
| 220 |
+
Chenxin Tao, Xizhou Zhu, Gao Huang, Yu Qiao, Xiaogang Wang, and Jifeng Dai. Siamese image modeling for self-supervised vision representation learning. arXiv preprint arXiv:2206.01204, 2022.
|
| 221 |
+
|
| 222 |
+
Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020.
|
| 223 |
+
|
| 224 |
+
Catherine Wah, Steve Branson, Peter Welinder, Pietro Perona, and Serge Belongie. The caltech-ucsd birds-200-2011 dataset. 2011.
|
| 225 |
+
|
| 226 |
+
Yixuan Wei, Han Hu, Zhenda Xie, Zheng Zhang, Yue Cao, Jianmin Bao, Dong Chen, and Baining Guo. Contrastive learning rivals masked image modeling in fine-tuning via feature distillation. arXiv preprint arXiv:2205.14141, 2022.
|
| 227 |
+
|
| 228 |
+
Zhenda Xie, Yutong Lin, Zhuliang Yao, Zheng Zhang, Qi Dai, Yue Cao, and Han Hu. Self-supervised learning with swin transformers. arXiv preprint arXiv:2105.04553, 2021a.
|
| 229 |
+
|
| 230 |
+
Zhenda Xie, Zheng Zhang, Yue Cao, Yutong Lin, Jianmin Bao, Zhuliang Yao, Qi Dai, and Han Hu. Simmim: A simple framework for masked image modeling. arXiv preprint arXiv:2111.09886, 2021b.
|
| 231 |
+
|
| 232 |
+
Zhenda Xie, Zigang Geng, Jingcheng Hu, Zheng Zhang, Han Hu, and Yue Cao. Revealing the dark secrets of masked image modeling. CoRR, abs/2205.13543, 2022a. doi: 10.48550/arXiv.2205. 13543. URL https://doi.org/10.48550/arXiv.2205.13543.
|
| 233 |
+
|
| 234 |
+
Zhenda Xie, Zheng Zhang, Yue Cao, Yutong Lin, Yixuan Wei, Qi Dai, and Han Hu. On data scaling in masked image modeling. CoRR, abs/2206.04664, 2022b. doi: 10.48550/arXiv.2206.04664. URL https://doi.org/10.48550/arXiv.2206.04664.
|
| 235 |
+
|
| 236 |
+
Jure Zbontar, Li Jing, Ishan Misra, Yann LeCun, and Stéphane Deny. Barlow twins: Self-supervised learning via redundancy reduction. arXiv preprint arXiv:2103.03230, 2021.
|
| 237 |
+
|
| 238 |
+
Yuanyi Zhong, Haoran Tang, Junkun Chen, Jian Peng, and Yu-Xiong Wang. Is self-supervised learning more robust than supervised learning? arXiv preprint arXiv:2206.05259, 2022.
|
| 239 |
+
|
| 240 |
+
Bolei Zhou, Hang Zhao, Xavier Puig, Tete Xiao, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Semantic understanding of scenes through the ade20k dataset. IJCV, 127(3):302–321, 2019.
|
| 241 |
+
|
| 242 |
+
Jinghao Zhou, Chen Wei, Huiyu Wang, Wei Shen, Cihang Xie, Alan Yuille, and Tao Kong. Ibot: Image bert pre-training with online tokenizer. arXiv preprint arXiv:2111.07832, 2021.
|
| 243 |
+
|
| 244 |
+
# A APPENDIX
|
| 245 |
+
|
| 246 |
+
# A.1 MODEL DESCRIPTION
|
| 247 |
+
|
| 248 |
+
For all the models involved in the experiments including DeiT (Touvron et al., 2020), MoCo v3 (Chen et al., 2021), DINO (Caron et al., 2021), BEiT (Bao et al., 2021), MAE (He et al., 2021), CAE (Chen et al., 2022a), and iBOT (Zhou et al., 2021), we use their official code to implement the encoders. It is worth noticing that for DINO and iBOT, we choose the checkpoint of the teacher models as they have been reported to perform better than the student models in their papers (Caron et al., 2021; Zhou et al., 2021).
|
| 249 |
+
|
| 250 |
+
# A.2 DATASETS
|
| 251 |
+
|
| 252 |
+
ADE20K (Zhou et al., 2019) is one of the most challenging benchmarks, containing 150 fine-grained semantic concepts and a variety of scenes with 1,038 image-level labels. There are 20,210 images in the training set and 2,000 images in the validation set. We choose 59 out of total 150 semantic concepts that are concrete objects containing parts (Zhou et al., 2019), termed ADE20K-Object. We also select 209 part categories that emerge both in the training set and the validation set, called ADE20K-Part.
|
| 253 |
+
|
| 254 |
+
Pascal-Part (Chen et al., 2014) is a set of additional annotations for PASCAL VOC 2010 (Everingham et al., 2010), thereby holding the same statistics as those of PASCAL VOC 2010. It provides segmentation masks for each part of objects. Concretely, the dataset includes 20 object-level categories and 193 part-level categories. In our experiments, we remove 4 object categories that do not contain parts including boat, table, chair, and sofa.
|
| 255 |
+
|
| 256 |
+
LIP (Gong et al., 2017) is a large-scale benchmark for human parsing research, which includes 50,462 images with pixel-wise annotations on 19 semantic part labels. In detail, it includes 19,081 full-body images, 13,672 upper-body images, 403 lower-body images, 3,386 head-missed images, 2,778 back-view images and 21,028 images with occlusions. There are 30,462 images in the training set and 10,000 images in the validation set. The rest 10,000 images are served as the test set with missing labels for competition evaluation.
|
| 257 |
+
|
| 258 |
+
CUB-200-2011 (Wah et al., 2011) is a popular benchmark for fine-grained image classification, and also provides bounding box and part location annotations. It contains 11,788 images of 200 bird species and 15 part keypoint annotations per bird. In this work, we mainly leverage its part keypoint annotations. And only 4 part categories (right eye, right leg, left wing, and tail) are chosen to be considered in our experiments, to make sure that the selected keypoints are far enough away from each other and enough context information can be contained in the cropped patches. (We also tried using all keypoints and the conclusion is consistent.)
|
| 259 |
+
|
| 260 |
+
COCO (Caesar et al., 2018), as one of the most widely-used human pose estimation datasets, contains more than 200,000 images and 250,000 labeled person instances. Similar to CUB-200-2011 mentioned above, only 3 (nose, right wrist, and left ankle) of its 17 keypoint categories are considered in our experiments.
|
| 261 |
+
|
| 262 |
+
# A.3 DETAILED RESULTS FOR OBJECT-LEVEL AND PART-LEVEL SEGMENTATION
|
| 263 |
+
|
| 264 |
+
In this section, we provide detailed comparisons between object-level and part-level semantic segmentation in Table 5 and Table 6. Similar observations as in Figure 6 in the main paper are found: although the supervised DeiT is superior over self-supervised methods on ADE20K-Object and Pascal-Object except iBOT, it is generally inferior to self-supervised models on ADE20K-Part and Pascal-Part, demonstrating self-supervised methods can learn good part-aware representations. BEiT and MAE perform inferior, perhaps because the two methods do not have an explicit process to predict the encoded representations of masked patches, instead, directly reconstruct the targets.
|
| 265 |
+
|
| 266 |
+
# A.4 EXPERIMENT DETAILS
|
| 267 |
+
|
| 268 |
+
Part retrieval. In our part retrieval experiments, we directly use the pretrained encoders to extract features, without additional training process. For each method, we take the better one from the class token or the average embedding of all patch tokens as the extracted representation. With each patch as the query patch, we calculate the cosine similarity between its representation and all the other patches’ in the dataset and utilize the average precision (AP) as the retrieval metric. Finally, we average all the obtained AP scores (with all patches respectively taken as the query patch for retrieval) as the final retrieval score of the method.
|
| 269 |
+
|
| 270 |
+
Table 5: Linear semantic segmentation results on ADE20K-Object and ADE20K-Part.
|
| 271 |
+
|
| 272 |
+
<table><tr><td rowspan="3">Methods</td><td colspan="3">Object Seg on ADE20K-Object 59 Object Classes</td><td colspan="3">Part Seg on ADE20K-Part 209 Part Classes</td></tr><tr><td>mIoU</td><td>mAcc</td><td>aAcc</td><td>mIoU</td><td>mAcc</td><td>aAcc</td></tr><tr><td colspan="7">Supervised Model:</td></tr><tr><td>DeiT</td><td>52.6</td><td>62.9</td><td>83.8</td><td>27.3</td><td>34.7</td><td>69.2</td></tr><tr><td colspan="7">Contrastive Learning:</td></tr><tr><td>MoCo v3</td><td>50.2</td><td>60.4</td><td>83.6</td><td>27.1</td><td>34.7</td><td>70.1</td></tr><tr><td>DINO</td><td>50.8</td><td>60.8</td><td>83.9</td><td>28.9</td><td>36.8</td><td>70.3</td></tr><tr><td colspan="7">MaskedImageModeling (MIM):</td></tr><tr><td>BEiT</td><td>28.6</td><td>37.2</td><td>73.4</td><td>18.6</td><td>25.8</td><td>58.2</td></tr><tr><td>MAE</td><td>41.0</td><td>50.6</td><td>79.9</td><td>26.3</td><td>35.0</td><td>67.3</td></tr><tr><td>CAE</td><td>47.4</td><td>58.4</td><td>82.9</td><td>28.4</td><td>36.9</td><td>71.1</td></tr><tr><td colspan="7">Contrastive Learning+MIM:</td></tr><tr><td>iBOT</td><td>55.2</td><td>65.1</td><td>85.6</td><td>32.2</td><td>40.0</td><td>73.4</td></tr></table>
|
| 273 |
+
|
| 274 |
+
Table 6: Linear semantic segmentation results on Pascal-Object and Pascal-Part.
|
| 275 |
+
|
| 276 |
+
<table><tr><td rowspan="2">Methods</td><td colspan="3">Object Seg on Pascal-Object 16 Object Classes</td><td colspan="3">Part Seg on Pascal-Part 193 Part Classes</td></tr><tr><td>mIoU</td><td>mAcc</td><td>aAcc</td><td>mIoU</td><td>mAcc</td><td>aAcc</td></tr><tr><td>Supervised Model: DeiT</td><td>92.2</td><td>95.3</td><td>96.8</td><td>27.4</td><td>36.2</td><td>65.8</td></tr><tr><td colspan="7">Contrastive Learning:</td></tr><tr><td>MoCo v3</td><td>89.4</td><td>93.7</td><td>95.7</td><td>27.1</td><td>35.8</td><td>66.0</td></tr><tr><td>DINO</td><td>88.0</td><td>92.7</td><td>95.3</td><td>27.8</td><td>36.5</td><td>66.4</td></tr><tr><td colspan="3">Masked Image Modeling (MIM):</td><td></td><td></td><td></td><td></td></tr><tr><td>BEiT</td><td>56.4</td><td>69.0</td><td>76.8</td><td>14.8</td><td>21.4</td><td>47.0</td></tr><tr><td>MAE</td><td>76.1</td><td>84.6</td><td>89.5</td><td>24.3</td><td>32.9</td><td>61.5</td></tr><tr><td>CAE</td><td>83.3</td><td>89.7</td><td>93.2</td><td>27.8</td><td>37.0</td><td>66.3</td></tr><tr><td colspan="3">Contrastive Learning+ MIM:</td><td></td><td></td><td></td><td></td></tr><tr><td>iBOT</td><td>92.1</td><td>95.3</td><td>97.1</td><td>30.7</td><td>40.0</td><td>69.7</td></tr></table>
|
| 277 |
+
|
| 278 |
+
Apart from the part retrieval experiments shown in Table 3, the visualized patch retrieval results in Figures 2 and 4 are obtained based on ImageNet (Deng et al., 2009) validation set. Concretely, from each pre-processed $2 2 4 \times 2 2 4$ validation image in ImageNet, we uniformly crop 49 patches sized $5 6 \times 5 6$ using a stride of 28. With all the cropped patches from the validation set, we select one patch as a query and find top 24 patches with the highest cosine similarity with it.
|
| 279 |
+
|
| 280 |
+
Part classification. For linear probing, we learn a supervised linear classification layer on the extracted class token of the frozen encoders. While for attentive probing, following Chen et al. (2022a), a cross attention module and a batch normalization layer without affine transformation are additionally inserted between the encoder and the linear classifier. And a new learnable class token is taken as the query of the cross attention module, to replace the original class token extracted by the frozen encoder. We use SGD optimizer with a learning rate of 0.4 and 0.04 for linear probing and attentive probing, respectively. For both linear probing and attentive probing, the models are trained for 90 epochs. And the momentum of SGD is set to 0.9, the weight decay is set to 0, and the batch size is set to 1024.
|
| 281 |
+
|
| 282 |
+

|
| 283 |
+
Figure 7: Patch retrieval comparisons of encoded representations on cropped patches from ImageNet.
|
| 284 |
+
|
| 285 |
+
Segmentation. We use the same model structure that contains a parameter-fixed pretrained encoder (e.g., MAE and DeiT) and a simple learnable $1 \times 1$ convolutional layer for object-level and part-level segmentation tasks. Note that the learning rate $( 4 e - 4 )$ , training iterations $( 1 6 0 k )$ , and batch size (16) among all the experiments maintain the same during training for fair comparisons. For ADE20K, the input size is set to $5 1 2 \times 5 1 2$ following previous works (Bao et al., 2021; He et al., 2021; Chen et al., 2022a; Zhou et al., 2021). For Pascal-Part, we adopt $4 8 0 \times 4 8 0$ as image input resolution following Contributors (2020). As for LIP, we use the same input size $3 2 0 \times 3 2 0 )$ proposed in LIP (Gong et al., 2017).
|
| 286 |
+
|
| 287 |
+
# A.5 IMAGENET PATCH RETRIEVAL VISUALIZATION
|
| 288 |
+
|
| 289 |
+
We visualize more patch retrieval results of the encoded representations on the ImageNet validation set in Figures 7 and 8. It is observed that the retrieved patches of self-supervised methods are generally more about the semantics of the query part than that of DeiT. The results demonstrate that the encoded representations of DeiT focus more on object-level semantics, while the encoded representations of these self-supervised methods are more about part-level semantics. Among these methods, the retrieved patches of MAE have less semantic correlation but often share similar hues.
|
| 290 |
+
|
| 291 |
+

|
| 292 |
+
Figure 8: Patch retrieval comparisons of encoded representations on cropped patches from ImageNet.
|
md/dev/5JdLZg346Lw/5JdLZg346Lw.md
ADDED
|
@@ -0,0 +1,681 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GENERATIVE MODELING WITH OPTIMAL TRANSPORT MAPS
|
| 2 |
+
|
| 3 |
+
# Alexander Korotin
|
| 4 |
+
|
| 5 |
+
Litu Rout Space Applications Centre Indian Space Research Organisation lr@sac.isro.gov.in
|
| 6 |
+
|
| 7 |
+
Skolkovo Institute of Science and Technology Artificial Intelligence Research Institute (AIRI) a.korotin@skoltech.ru
|
| 8 |
+
|
| 9 |
+
Evgeny Burnaev Skolkovo Institute of Science and Technology Artificial Intelligence Research Institute (AIRI) e.burnaev@skoltech.ru
|
| 10 |
+
|
| 11 |
+
# ABSTRACT
|
| 12 |
+
|
| 13 |
+
With the discovery of Wasserstein GANs, Optimal Transport (OT) has become a powerful tool for large-scale generative modeling tasks. In these tasks, OT cost is typically used as the loss for training GANs. In contrast to this approach, we show that the OT map itself can be used as a generative model, providing comparable performance. Previous analogous approaches consider OT maps as generative models only in the latent spaces due to their poor performance in the original high-dimensional ambient space. In contrast, we apply OT maps directly in the ambient space, e.g., a space of high-dimensional images. First, we derive a minmax optimization algorithm to efficiently compute OT maps for the quadratic cost (Wasserstein-2 distance). Next, we extend the approach to the case when the input and output distributions are located in the spaces of different dimensions and derive error bounds for the computed OT map. We evaluate the algorithm on image generation and unpaired image restoration tasks. In particular, we consider denoising, colorization, and inpainting, where the optimality of the restoration map is a desired attribute, since the output (restored) image is expected to be close to the input (degraded) one.
|
| 14 |
+
|
| 15 |
+
# 1 INTRODUCTION
|
| 16 |
+
|
| 17 |
+
Since the discovery of Generative Adversarial Networks (GANs, Goodfellow et al. (2014)), there has been a surge in generative modeling (Radford et al., 2016; Arjovsky et al., 2017; Brock et al., 2019; Karras et al., 2019). In the past few years, Optimal Transport (OT, Villani (2008)) theory has been pivotal in addressing important issues of generative models. In particular, the usage of Wasserstein distance has improved diversity (Arjovsky et al., 2017; Gulrajani et al., 2017), convergence (Sanjabi et al., 2018), and stability (Miyato et al., 2018; Kim et al., 2021) of GANs.
|
| 18 |
+
|
| 19 |
+
Generative models based on OT can be split into two classes depending on what OT is used for. First, the optimal transport cost serves as the loss for generative models, see Figure 1a. This is the most prevalent class of methods which includes WGAN (Arjovsky et al., 2017) and its modifications: WGAN-GP (Gulrajani et al., 2017), WGAN-LP (Petzka et al., 2018), and WGAN-QC (Liu et al., 2019). Second, the optimal transport map is used as a generative model itself, see Figure 1b. Such approaches include LSOT (Seguy et al., 2018), AE-OT (An et al., 2020a), ICNN-OT (Makkuva et al., 2020), W2GN (Korotin et al., 2021a). Models of the first class have been wellstudied, but limited attention has been paid to the second class. Existing approaches of the second class primarily consider OT maps in latent spaces of pre-trained autoencoders (AE), see Figure 3. The performance of such generative models depends on the underlying AEs, in which decoding transformations are often not accurate; as a result this deficiency limits practical applications in high-dimensional ambient spaces. For this reason, using OT in the latent space does not necessarily guarantee superior performance in generative modeling.
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Two existing approaches to use optimal transport in generative models.
|
| 23 |
+
|
| 24 |
+
The focus of our paper is the second class of OT-based models using OT map as the generative map. Finding an optimal mapping is motivated by its ability to preserve specific attributes of the input samples, a desired property in unpaired learning. For example, in unpaired image-to-image translation, the learner has to fit a map between two data distributions which preserves the image content. CycleGAN-based models (Zhu et al., 2017) are widely used for this purpose. However, they typically have complex optimization objectives consisting of several losses (Amodio & Krishnaswamy, 2019; Lu et al., 2019) in order to make the fitted map preserve the required attributes.
|
| 25 |
+
|
| 26 |
+
# The main contributions of this paper are as follows:
|
| 27 |
+
|
| 28 |
+
1. We propose an end-to-end algorithm ( 4.3) to fit OT maps for the quadratic cost (Wasserstein-2 distance) between distributions located on the spaces of equal dimensions ( 4.1) and extend the method to unequal dimensions as well ( 4.2). We prove error bounds for the method ( 4.4).
|
| 29 |
+
|
| 30 |
+
2. We demonstrate large-scale applications of OT maps in popular computer vision tasks. We consider image generation ( 5.1) and unpaired image restoration ( 5.2) tasks.
|
| 31 |
+
|
| 32 |
+
Our strict OT-based framework allows the theoretical analysis of the recovered transport map. The OT map obtained by our method can be directly used in large-scale computer vision problems which is in high contrast to previous related methods relying on autoencoders and OT maps in the latent space. Importantly, the performance and computational complexity of our method is comparable to OT-based generative models using OT cost as the loss.
|
| 33 |
+
|
| 34 |
+
Notations. In what follows, $\mathcal { X }$ and $\mathcal { V }$ are two complete metric spaces, $\mu ( x )$ and $\nu ( y )$ are probability distributions on $\mathcal { X }$ and $\mathcal { V }$ , respectively. For a measurable map $T : \mathcal { X } \mathcal { Y }$ , $T _ { \# } \mu$ denotes the pushforward distribution of $\mu$ , i.e., the distribution for which any measurable set $E \subset \mathcal { V }$ satisfies ${ \bf { \dot { T } } } _ { \# } \mu ( E ) = \mu ( T ^ { - 1 } ( E ) )$ . For a vector $x$ , $\| x \|$ denotes its Euclidean norm. We use $\langle x , y \rangle$ to denote the inner product of vectors $x$ and $y$ . We use $\Pi ( \mu , \nu )$ to denote the set of joint probability distributions on $\mathcal { X } \times \mathcal { V }$ whose marginals are $\mu$ and $\nu$ , respectively (couplings). For a function $f : \mathbb { R } ^ { \mathbf { \bar { \upsilon } } } \to \mathbb { R } \cup \{ \pm \infty \}$ its Legendre–Fenchel transform (the convex conjugate) is $\begin{array} { r } { \overline { { f } } ( y ) = \operatorname* { s u p } _ { x \in \mathbb { R } ^ { D } } \{ \langle x , y \rangle - f \left( x \right) \} } \end{array}$ . It is convex, even if $f$ is not.
|
| 35 |
+
|
| 36 |
+
# 2 BACKGROUND ON OPTIMAL TRANSPORT
|
| 37 |
+
|
| 38 |
+
Consider a cost of transportation, $c : \mathcal { X } \times \mathcal { Y } \mathbb { R }$ defined over the product space of $\mathcal { X }$ and $\mathcal { V }$ .
|
| 39 |
+
|
| 40 |
+
Monge’s Formulation. The optimal transport cost between $\mu$ and $\nu$ for ground cost $c ( \cdot , \cdot )$ is
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
\operatorname { C o s t } ( \mu , \nu ) \ { \stackrel { \mathrm { d e f } } { = } } \ \operatorname* { i n f } _ { T _ { \# } \mu = \nu } \int _ { \mathcal { X } } c \left( x , T ( x ) \right) d \mu ( x ) ,
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+

|
| 47 |
+
Figure 2: Monge’s OT.
|
| 48 |
+
|
| 49 |
+
where the infimum is taken over all measurable maps $T : \mathcal { X } \mathcal { Y }$ pushing $\mu$ to $\nu$ , see Figure 2. The map $T ^ { * }$ on which the infimum in (1) is attained is called the optimal transport
|
| 50 |
+
|
| 51 |
+
map. Monge’s formulation does not allow splitting. For example, when $\mu$ is a Dirac distribution and $\nu$ is a non-Dirac distribution, the feasible set of equation (1) is empty.
|
| 52 |
+
|
| 53 |
+
Kantorovich’s Relaxation. Instead of asking to which particular point $y \in \mathcal { V }$ should all the probability mass of $x$ be moved, Kantorovich (1948) asks how the mass of $x$ should be distributed among all $y \in \mathcal { V }$ . Formally, a transport coupling replaces a transport map; the OT cost is given by:
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
\operatorname { C o s t } ( \mu , \nu ) \stackrel { \mathrm { d e f } } { = } \operatorname* { i n f } _ { \pi \in \Pi ( \mu , \nu ) } \int _ { \mathcal { X } \times \mathcal { Y } } c ( x , y ) d \pi ( x , y ) ,
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
where the infimum is taken over all couplings $\pi \in \Pi ( \mu , \nu )$ of $\mu$ and $\nu$ . The coupling $\pi ^ { * }$ attaining the infimum of (2) is called the optimal transport plan. Unlike the formulation of (1), the formulation of (2) is well-posed, and with mild assumptions on spaces $\mathcal { X } , \mathcal { y }$ and ground cost $c ( \cdot , \cdot )$ , the minimizer $\pi ^ { * }$ of (2) always exists (Villani, 2008, Theorem 4.1). In particular, if $\pi ^ { * }$ is deterministic, i.e., $\pi ^ { * } = [ \mathrm { i d } _ { \mathcal { X } } , T ^ { * } ] _ { \# } \mu$ for some $T ^ { * } : \mathcal { X } \mathcal { Y }$ , then $T ^ { * }$ minimizes (1).
|
| 60 |
+
|
| 61 |
+
Duality. The dual form of (2) is given by (Kantorovich, 1948):
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
\mathrm { C o s t } ( \mu , \nu ) = \operatorname* { s u p } _ { ( u , v ) } \left\{ \int _ { \mathcal X } u ( x ) d \mu ( x ) + \int _ { \mathcal Y } v ( y ) d \nu ( y ) \colon u ( x ) + v ( y ) \le c ( x , y ) \right\} ,
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
with $u \in L ^ { 1 } ( \mu )$ , $v \in L ^ { 1 } ( \nu )$ called Kantorovich potentials. For $u : \mathcal { X } \mathbb { R }$ and $v : \mathcal { V } \to \mathbb { R }$ define their $c$ -transforms by $\begin{array} { r } { u ^ { c } ( y ) = \operatorname* { i n f } _ { x \in \mathcal { X } } \{ c \left( x , y \right) - u \left( x \right) \} } \end{array}$ and $v ^ { c } ( x ) = \operatorname* { i n f } _ { y \in \mathcal { V } } \{ c \left( x , y \right) - v \left( y \right) \}$ respectively. Using $c$ -transform, (3) is reformulated as (Villani, 2008, 5)
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
\mathrm { C o s t } ( \mu , \nu ) = \operatorname* { s u p } _ { v } \biggl \{ \int _ { \mathcal X } v ^ { c } ( x ) d \mu ( x ) + \int _ { \mathcal y } v ( y ) d \nu ( y ) \biggr \} = \operatorname* { s u p } _ { u } \biggl \{ \int _ { \mathcal X } u ( x ) d \mu ( x ) + \int _ { \mathcal y } u ^ { c } ( y ) d \nu ( y ) \biggr \} .
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
Primal-dual relationship. For certain ground costs $c ( \cdot , \cdot )$ , the primal solution $T ^ { * }$ of (1) can be recovered from the dual solution $u ^ { * }$ of (3). For example, if $\boldsymbol { \chi } = \boldsymbol { \dot { y } } = \mathbb { R } ^ { D }$ , $c ( x , y ) = h ( x - y )$ with strictly convex $h : \mathbb { R } ^ { D } \mathbb { R }$ and $\mu$ is absolutely continuous supported on the compact set, then
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
T ^ { * } ( x ) = x - ( \nabla h ) ^ { - 1 } \big ( \nabla u ^ { * } ( x ) \big ) ,
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
see (Santambrogio, 2015, Theorem 1.17). For general costs, see (Villani, 2008, Theorem 10.28).
|
| 80 |
+
|
| 81 |
+
# 3 OPTIMAL TRANSPORT IN GENERATIVE MODELS
|
| 82 |
+
|
| 83 |
+
OPTIMAL TRANSPORT COST AS THE LOSS (Figure 1a). Starting with the works of Arjovsky & Bottou (2017); Arjovsky et al. (2017), the usage of OT cost as the loss has become a major way to apply OT for generative modeling. In this setting, given data distribution $\nu$ and fake distribution $\mu _ { \theta }$ , the goal is to minimize $\operatorname { C o s t } ( \mu _ { \theta } , \nu )$ w.r.t. the parameters $\theta$ . Typically, $\mu _ { \theta }$ is a pushforward distribution of some given distribution, e.g., $\mathcal { N } ( 0 , I )$ , via generator network $G _ { \theta }$ .
|
| 84 |
+
|
| 85 |
+
The Wasserstein- $^ { l }$ distance $( \mathcal { W } _ { 1 } )$ , i.e., the transport cost for ground cost $c ( x , y ) \ = \ \| x - y \|$ , is the most practically prevalent example of such a loss. Models based on this loss are known as Wasserstein GANs (WGANs). They estimate $\mathcal { W } _ { 1 } ( \mu _ { \theta } , \nu )$ based on the dual form as given by (4). For $\mathcal { W } _ { 1 }$ , the optimal potentials $u ^ { * } , v ^ { * }$ of (4) satisfy $u ^ { * } = - v ^ { * }$ where $u ^ { * }$ is a 1-Lipschitz function (Villani, 2008, Case 5.16). As a result, to compute $\mathcal { W } _ { 1 }$ , one needs to optimize the following simplified form:
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
{ \mathcal W } _ { 1 } ( \mu _ { \theta } , \nu ) = \operatorname* { s u p } _ { \| u \| _ { L } \leq 1 } \left\{ \int _ { \mathcal K } u ( x ) d \mu _ { \theta } ( x ) - \int _ { \mathcal V } u ( y ) d \nu ( y ) \right\} .
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
In WGANs, the potential $u$ is called the discriminator. Optimization of (6) reduces constrained optimization of (4) with two potentials $u , v$ to optimization of only one discriminator $u$ . In practice, enforcing the Lipschitz constraint on $u$ is challenging. Most methods to do this are regularizationbased, e.g., they use gradient penalty (Gulrajani et al., 2017, WGAN-GP) and Lipschitz penalty (Petzka et al., 2018, WGAN-LP). Other methods enforce Lipschitz property via incorporating certain hard restrictions on the discriminator’s architecture (Anil et al., 2019; Tanielian & Biau, 2021).
|
| 92 |
+
|
| 93 |
+
General transport costs (other than $\mathcal { W } _ { 1 }$ ) can also be used as the loss for generative models. They are less popular since they do not have a dual form reducing to a single potential function similar to (6) for $\mathcal { W } _ { 1 }$ . Consequently, the challenging estimation of the $c$ -transform $u ^ { c }$ is needed. To avoid this, Sanjabi et al. (2018) consider the dual form of (3) with two potentials $u , v$ instead form (4) with one $u$ and softly enforce the condition $u ( x ) + v ( y ) \leq c ( x , y )$ via entropy or quadratic regularization. Nhan Dam et al. (2019) use the dual form of (4) and amortized optimization to compute $u ^ { c }$ via an additional neural network. Both methods work for general $c ( \cdot , \cdot )$ , though the authors test them for $c ( x , y ) = \| x - y \|$ only, i.e., $\mathcal { W } _ { 1 }$ distance. Mallasto et al. (2019) propose a fast way to approximate the $c$ -transform and test the approach (WGAN- $( q , p ) )$ with several costs, in particular, the Wasserstein-2 distance $( \mathcal { W } _ { 2 } )$ , i.e., the transport cost for the quadratic ground cost $c ( \dot { x } , y ) = \textstyle { \frac { 1 } { 2 } } \| x - y \| ^ { 2 }$ . Specifically for $\mathcal { W } _ { 2 }$ , Liu et al. (2019) approximate the $c$ -transform via a linear program (WGAN-QC).
|
| 94 |
+
|
| 95 |
+
A fruitful branch of OT-based losses for generative models comes from modified versions of OT cost, such as Sinkhorn (Genevay et al., 2018), sliced (Deshpande et al., 2018) and minibatch (Fatras et al., 2019) OT distances. They typically have lower sample complexity than usual OT and can be accurately estimated from random mini-batches without using dual forms such as (3). In practice, these approaches usually learn the ground OT cost $c ( \cdot , \cdot )$ .
|
| 96 |
+
|
| 97 |
+
The aforementioned methods use OT cost in the ambient space to train GANs. There also exist approaches using OT cost in the latent space. For example, Tolstikhin et al. (2017); Patrini et al. (2020) use OT cost between encoded data and a given distribution as an additional term to reconstruction loss for training an AE. As the result, AE’s latent distribution becomes close to the given one.
|
| 98 |
+
|
| 99 |
+
OPTIMAL TRANSPORT MAP AS THE GENERATIVE MAP (Figure 1b). Methods to compute the OT map (plan) are less common in comparison to those computing the cost. Recovering the map from the primal form (1) or (2) usually yields complex optimization objectives containing several adversarial terms (Xie et al., 2019; Liu et al., 2021; Lu et al., 2020). Such procedures require careful hyperparameter choice. This needs to be addressed before using these methods in practice.
|
| 100 |
+
|
| 101 |
+
Primal-dual relationship ( 2) makes it possible to recover the OT map via solving the dual form (3). Dual-form based methods primarily consider $\mathcal { W } _ { 2 }$ cost due to its nice theoretical properties and relation to convex functions (Brenier, 1991). In the semi-discrete case $\dot { \mu }$ is continuous, $\nu$ is discrete), An et al. (2020a) and Lei et al. (2019) compute the dual potential and the OT map by using the Alexandrov theory and convex geometry. For the continuous case, Seguy et al. (2018) use the entropy (quadratic) regularization to recover the dual potentials and extract OT map from them via the barycenteric projection. Taghvaei & Jalali (2019), Makkuva et al. (2020), Korotin et al. (2021a) employ input-convex neural networks (ICNNs, see Amos et al. (2017)) to parametrize potentials in the dual problem and recover OT maps by using their gradients.
|
| 102 |
+
|
| 103 |
+

|
| 104 |
+
Figure 3: The existing most prevalent approach to use OT maps in generative models.
|
| 105 |
+
|
| 106 |
+
The aforementioned dual form methods compute OT maps in LATENT SPACES for problems such as domain adaptation and latent space mass transport, see Figure 3. OT maps in high-dimensional ambient spaces, e.g., natural images, are usually not considered. Recent evaluation of continuous OT methods for $\mathcal { W } _ { 2 }$ (Korotin et al., 2021b) reveals their crucial limitations, which negatively affect their scalability, such as poor expressiveness of ICNN architectures or bias due to regularization.
|
| 107 |
+
|
| 108 |
+
# 4 END-TO-END SOLUTION TO LEARN OPTIMAL MAPS
|
| 109 |
+
|
| 110 |
+
# 4.1 EQUAL DIMENSIONS OF INPUT AND OUTPUT DISTRIBUTIONS
|
| 111 |
+
|
| 112 |
+
In this section, we use $\mathcal { X } = \mathcal { Y } = \mathbb { R } ^ { D }$ and consider the Wasserstein-2 distance $( \mathcal { W } _ { 2 } )$ , i.e., the optimal transport for the quadratic ground cost $c ( x , y ) = { \textstyle { \frac { 1 } { 2 } } } \| x - y \| ^ { 2 }$ . We use the dual form (4) to derive a saddle point problem the solution of which yields the OT map $T ^ { * }$ . We consider distributions $\mu , \nu$ with finite second moments. We assume that for distributions $\mu , \nu$ in view there exists a unique OT plan $\pi ^ { * }$ minimizing (3) and it is deterministic, i.e., $\pi ^ { * } = [ \mathrm { i d } _ { \mathbb { R } ^ { D } } , T ^ { * } ] _ { \# } \mu$ . Here $T ^ { * }$ is an OT map which minimizes (1). Previous related works (Makkuva et al., 2020; Korotin et al., 2021a) assumed the absolute continuity of $\mu$ , which implied the existence and uniqueness of $T ^ { * }$ (Brenier, 1991).
|
| 113 |
+
|
| 114 |
+
Let $\psi ( y ) \stackrel { \mathrm { d e f } } { = } \frac { 1 } { 2 } \| y \| ^ { 2 } - v ( y )$ , where $v$ is the potential of (4). Note that
|
| 115 |
+
|
| 116 |
+
$$
|
| 117 |
+
v ^ { c } ( x ) = \operatorname* { i n f } _ { y \in \mathbb { R } ^ { D } } \left\{ \frac { 1 } { 2 } \| x - y \| ^ { 2 } - v ( y ) \right\} = \frac { 1 } { 2 } \| x \| ^ { 2 } - \operatorname* { s u p } _ { y \in \mathbb { R } ^ { D } } \left\{ \langle x , y \rangle - \psi ( y ) \right\} = \frac { 1 } { 2 } \| x \| ^ { 2 } - \overline { { \psi } } ( x ) .
|
| 118 |
+
$$
|
| 119 |
+
|
| 120 |
+
Therefore, (4) is equivalent to
|
| 121 |
+
|
| 122 |
+
$$
|
| 123 |
+
\begin{array} { r } { \mathcal { W } _ { 2 } ^ { 2 } ( \mu , \nu ) = \displaystyle \int _ { \mathcal { X } } \frac { \lVert x \rVert ^ { 2 } } { 2 } d \mu ( x ) + \displaystyle \int _ { \mathcal { Y } } \frac { \lVert y \rVert ^ { 2 } } { 2 } d \nu ( x ) + \displaystyle \operatorname* { s u p } _ { \psi } \left\{ - \displaystyle \int _ { \mathcal { X } } \overline { { \psi } } ( x ) d \mu ( x ) - \int _ { \mathcal { Y } } \psi ( y ) d \nu ( y ) \right\} = } \\ { \mathrm { C o n s t a n t } ( \mu , \nu ) - \displaystyle \operatorname* { i n f } _ { \psi } \left\{ \int _ { \mathcal { X } } \overline { { \psi } } ( x ) d \mu ( x ) + \int _ { \mathcal { Y } } \psi ( y ) d \nu ( y ) \right\} = } \\ { \mathrm { C o n s t a n t } ( \mu , \nu ) - \displaystyle \operatorname* { i n f } _ { \psi } \left\{ \int _ { \mathcal { X } } \operatorname* { s u p } _ { y \in \mathbb { R } ^ { D } } \left\{ \langle x , y \rangle - \psi ( y ) \right\} d \mu ( x ) + \int _ { \mathcal { Y } } \psi ( y ) d \nu ( y ) \right\} = } \\ { \mathrm { C o n s t a n t } ( \mu , \nu ) - \displaystyle \operatorname* { i n f } _ { \psi } \left\{ \operatorname* { s u p } _ { T } \int _ { \mathcal { X } } \left\{ \langle x , T ( x ) \rangle - \psi ( T ( x ) ) \right\} d \mu ( x ) + \int _ { \mathcal { Y } } \psi ( y ) d \nu ( y ) \right\} } \end{array}
|
| 124 |
+
$$
|
| 125 |
+
|
| 126 |
+
where between lines (10) and (11) we replace the optimization over $\boldsymbol { y } \in \mathbb { R } ^ { D }$ with the equivalent optimization over functions $T : \dot { \mathbb { R } ^ { D } } \to \mathbb { R } ^ { \dot { D } }$ . The equivalence follows from the interchange between the integral and the supremum (Rockafellar, 1976, Theorem 3A). We also provide an independent proof of equivalence specializing Rockafellar’s interchange theorem in Appendix A.1. Thanks to the following lemma, we may solve saddle point problem (11) and obtain the OT map $T ^ { * }$ from its solution $( \psi ^ { * } , T ^ { * } )$ .
|
| 127 |
+
|
| 128 |
+
Lemma 4.1. Let $T ^ { * }$ be the OT map from $\mu$ to $\nu$ . Then, for every optimal potential $\psi ^ { * }$ ,
|
| 129 |
+
|
| 130 |
+
$$
|
| 131 |
+
T ^ { * } \in \arg \operatorname* { s u p } _ { T } \int _ { \mathcal { X } } \left\{ \langle x , T ( x ) \rangle - \psi ^ { * } \big ( T ( x ) \big ) \right\} d \mu ( x ) .
|
| 132 |
+
$$
|
| 133 |
+
|
| 134 |
+
We prove Lemma 4.1 in Appendix A.2. For general $\mu , \nu$ the arg $\mathrm { s u p } _ { T }$ set for optimal $\psi ^ { * }$ might contain not only OT map $T ^ { * }$ , but other functions as well. Working with real-world data in experiments ( 5.2), we observe that despite this issue, optimization (11) still recovers $T ^ { * }$ .
|
| 135 |
+
|
| 136 |
+
Relation to previous works. The use of the function $T$ to approximate the $c$ -transform was proposed by Nhan Dam et al. (2019) to estimate the Wasserstein loss in WGANs. For $\mathcal { W } _ { 2 }$ , the fact that $T ^ { * }$ is an OT map was used by Makkuva et al. (2020); Korotin et al. (2021a) who primarily assumed continuous $\mu , \nu$ and reduced (11) to convex $\psi$ and $T = \nabla \phi$ for convex $\phi$ . Issues with nonuniqueness of solution of (12) were softened, but using ICNNs to parametrize $\psi$ became necessary.
|
| 137 |
+
|
| 138 |
+
Korotin et al. (2021b) demonstrated that ICNNs negatively affect practical performance of OT and tested an unconstrained formulation similar to (11). As per the evaluation, it provided the best empirical performance (Korotin et al., 2021b, 4.5). The method $\mathrm { \lfloor M M : R \rceil }$ they consider parametrizes ${ \dot { \frac { 1 } { 2 } } } \parallel \cdot \parallel ^ { 2 } - \psi ( \cdot )$ by a neural network, while we directly parametrize $\psi ( \cdot )$ by a neural network ( 4.3).
|
| 139 |
+
|
| 140 |
+
Recent work by Fan et al. (2021) exploits formulation similar to (11) for general costs $c ( \cdot , \cdot )$ . While their formulation leads to a max-min scheme with general costs (Fan et al., 2021, Theorem 3), our approach gives rise to a min-max method for quadratic cost. In particular, we extend the formulation to learn OT maps between distributions in spaces with unequal dimensions, see the next subsection.
|
| 141 |
+
|
| 142 |
+
# 4.2 UNEQUAL DIMENSIONS OF INPUT AND OUTPUT DISTRIBUTIONS
|
| 143 |
+
|
| 144 |
+
Consider the case when $\mathcal { X } = \mathbb { R } ^ { H }$ and $\mathcal { V } = \mathbb { R } ^ { D }$ have different dimensions, i.e., $H \ne D$ . In order to map the probability distribution $\mu$ to $\nu$ , a straightforward solution is to embed $\mathcal { X }$ to $\mathcal { V }$ via some $Q : \mathcal { X } \mathcal { Y }$ and then to fit the OT map between $Q _ { \# } \mu$ and $\nu$ for the quadratic cost on $\mathcal { V } = \mathbb { R } ^ { D }$ . In this case, the optimization objective becomes
|
| 145 |
+
|
| 146 |
+
$$
|
| 147 |
+
\operatorname* { i n f } _ { \psi } \operatorname* { s u p } _ { T } \left\{ \int _ { \mathcal X } \left\{ \langle Q ( x ) , T ( Q ( x ) ) \rangle - \psi \bigl ( T \bigl ( Q ( x ) \bigr ) \bigr ) \right\} d \mu ( x ) + \int _ { \mathcal X } \psi ( y ) d \nu ( y ) \right\}
|
| 148 |
+
$$
|
| 149 |
+
|
| 150 |
+
with the optimal $T ^ { * }$ recovering the OT map from $Q _ { \# } \mu$ to $\nu$ . For equal dimensions $H = D$ and the identity embedding $Q ( x ) \equiv x$ , expression (13) reduces to optimization (11) up to a constant.
|
| 151 |
+
|
| 152 |
+
Instead of optimizing (13) over functions $T : Q ( \mathcal { X } ) \mathcal { Y }$ , we propose to consider optimization directly over generative mappings $G : \mathcal { X } \mathcal { Y }$ :
|
| 153 |
+
|
| 154 |
+
$$
|
| 155 |
+
{ \mathcal { L } } ( \psi , G ) { \stackrel { \mathrm { d e f } } { = } } \operatorname* { i n f } _ { \psi } \operatorname* { s u p } _ { G } \left\{ \int _ { \mathcal { X } } \left\{ \langle Q ( x ) , G ( x ) \rangle - \psi { \big ( } G ( x ) { \big ) } \right\} d \mu ( x ) + \int _ { \mathcal { Y } } \psi ( y ) d \nu ( y ) \right\}
|
| 156 |
+
$$
|
| 157 |
+
|
| 158 |
+
Our following lemma establishes connections between (14) and OT with unequal dimensions:
|
| 159 |
+
|
| 160 |
+
Lemma 4.2. Assume that exists a unique OT plan between $Q _ { \# } \mu$ and $\nu$ and it is deterministic, i.e., $[ i d _ { \mathbb { R } ^ { D } } , T ^ { * } ] _ { \# } ( Q _ { \# } \mu )$ . Then $G ^ { * } ( x ) = T ^ { * } { \bigl ( } Q ( x ) { \bigr ) }$ is the OT map between $\mu$ and $\nu$ for the $Q$ -embedded quadratic cost $\begin{array} { r } { c ( x , y ) = \frac { 1 } { 2 } \| Q ( x ) - y \| ^ { 2 } } \end{array}$ . Moreover, for every optimal potential $\psi ^ { * }$ of problem (14),
|
| 161 |
+
|
| 162 |
+
$$
|
| 163 |
+
G ^ { * } \in \arg \operatorname* { s u p } _ { G } \int _ { \mathcal { X } } \left\{ \langle Q ( x ) , G ( x ) \rangle - \psi ^ { * } { \big ( } G ( x ) { \big ) } \right\} d \mu ( x ) .
|
| 164 |
+
$$
|
| 165 |
+
|
| 166 |
+
We prove Lemma 4.2 in Appendix A.3 and schematically present its idea in Figure 4. Analogously to Lemma 4.1, it provides a way to compute the OT map $G ^ { * }$ for the $Q$ - embedded quadratic cost between distributions $\mu$ and $\nu$ by solving the saddle point problem (14). Note the situation with nonuniqueness of arg $\operatorname { s u p } _ { G }$ is similar to $\ S 4 . 1$ .
|
| 167 |
+
|
| 168 |
+
Relation to previous works. In practice, learning OT maps directly between spaces of unequal dimensions was considered in the work by (Fan et al., 2021, 5.2) but only on toy examples. We demonstrate that our method works well in large-scale generative modeling tasks ( 5.1). Theoretical properties of OT maps for embedded costs are studied, e.g., in (Pass, 2010; McCann & Pass, 2020).
|
| 169 |
+
|
| 170 |
+

|
| 171 |
+
Figure 4: The scheme of our approach for learning OT maps between unequal dimensions. In the figure, the setup of $\ S 5 . 1$ is shown: $\mu$ is a noise, $Q$ is the bicubic upscaling, $\nu$ is a distribution of images.
|
| 172 |
+
|
| 173 |
+
# 4.3 PRACTICAL ASPECTS AND OPTIMIZATION PROCEDURE
|
| 174 |
+
|
| 175 |
+
To optimize functional (14), we approximate $G : \mathbb { R } ^ { H } \mathbb { R } ^ { D }$ and $\psi : \mathbb { R } ^ { D } \mathbb { R }$ with neural networks $G _ { \theta } , \psi _ { \omega }$ and optimize their parameters via stochastic gradient descent-ascent (SGDA) by using minibatches from $\mu , \nu$ . The practical optimization procedure is given in Algorithm 1 below. Following the usual practice in GANs, we add a small penalty (MB.3) on potential $\psi _ { \omega }$ for better stability. The penalty is not included in Algorithm 1 to keep it simple.
|
| 176 |
+
|
| 177 |
+
Relation to previous works. WGAN by Arjovsky & Bottou (2017) uses $\mathcal { W } _ { 1 }$ as the loss to update the generator while we solve a diferent task — we fit the generator $G$ to be the OT map for $Q$ -embedded quadratic cost. Despite this, our Algorithm 1 has similarities with WGAN’s training. The update of $\psi$ (line 4) coincides with discriminator’s update in WGAN. The update of generator $G$ (line 8) differs from WGAN’s update by the term $- \langle Q ( \cdot ) , G _ { \theta } ( \cdot ) \rangle$ . Besides, in WGAN the optimization is $\operatorname { i n f } _ { G } \operatorname { s u p } _ { D }$ . We have $\operatorname { i n f } _ { \psi } \operatorname { s u p } _ { G }$ , i.e., the generator in our case is the solution of the inner problem.
|
| 178 |
+
|
| 179 |
+
# 4.4 ERROR ANALYSIS
|
| 180 |
+
|
| 181 |
+
Given a pair $( \hat { \psi } , \hat { G } )$ approximately solving (14), a natural question to ask is how good is the recovered OT map $\hat { G }$ . In this subsection, we provide a bound on the difference between $G ^ { * }$ and $\hat { G }$ based on the duality gaps for solving outer and inner optimization problems.
|
| 182 |
+
|
| 183 |
+
In (8), and, as the result, in (10), (11), (13), (14), it is enough to consider optimization over convex functions $\psi$ , see (Villani, 2008, Case 5.17). Our theorem below assumes the convexity of $\hat { \psi }$ although it might not hold in practice since in practice $\hat { \psi }$ is a neural network.
|
| 184 |
+
|
| 185 |
+
Algorithm 1: Learning the optimal transport map between unequal dimensions.
|
| 186 |
+
|
| 187 |
+
Input : Input distribution $\mu$ on $\mathcal { X } = \mathbb { R } ^ { H }$ ; output distribution $\nu$ on $\mathcal { V } = \mathbb { R } ^ { D }$ ; generator network $G _ { \theta } : \mathbb { R } ^ { H } \mathbb { R } ^ { D }$ ; potential network $\psi _ { \omega } : \mathbb { R } ^ { D } \mathbb { R }$ ; number of iterations per network: $K _ { G }$ , $K _ { \psi }$ ; embedding $Q : \mathcal { X } \mathcal { Y }$ ;
|
| 188 |
+
|
| 189 |
+
Output: Trained generator $G _ { \theta }$ representing OT map from $\mu$ to $\nu$
|
| 190 |
+
|
| 191 |
+
# 1 repeat
|
| 192 |
+
|
| 193 |
+
2 for $\boldsymbol k _ { \psi } = 1$ to $K _ { \psi }$ do
|
| 194 |
+
3 Draw batch $\overline { { X } } \sim \mu$ and $Y \sim \nu$ ;
|
| 195 |
+
4 $\begin{array} { r } { \mathcal { L } _ { \psi } \gets \frac { 1 } { | Y | } \sum _ { y \in Y } \psi _ { \omega } ( y ) - \frac { 1 } { | X | } \sum _ { x \in X } \psi _ { \omega } \big ( G _ { \theta } ( x ) \big ) ; } \end{array}$ ;
|
| 196 |
+
5 Update $\omega$ by using ∂Lψ to minimize Lψ ;
|
| 197 |
+
6 for $\underline { { k _ { G } = 1 } }$ to $\underline { { K } } _ { G }$ do
|
| 198 |
+
7 Draw batch $X \sim \mu$ ;
|
| 199 |
+
8 $\begin{array} { r } { \mathcal { L } _ { G } \gets \frac { 1 } { | X | } \sum _ { x \in X } \left[ \psi \big ( G ( x ) \big ) - \langle Q ( x ) , G _ { \theta } ( x ) \rangle \right] } \end{array}$ ;
|
| 200 |
+
9 Update $\theta$ by using ∂LG to minimize LG;
|
| 201 |
+
10 until not converged;
|
| 202 |
+
11 return $\underline { { \overline { { G _ { \theta } } } } }$
|
| 203 |
+
|
| 204 |
+
Theorem 4.3. Assume that there exists a unique deterministic OT plan for $Q$ -embedded quadratic cost between $\mu$ and $\nu$ , i.e., $\pi ^ { * } = [ i d _ { \mathbb { R } ^ { H } } , G ^ { * } ] _ { \# } \mu$ for $G ^ { * } : \mathbb { R } ^ { H } \mathbb { R } ^ { D }$ . Assume that $\hat { \psi }$ is $\beta$ -strongly convex $( \beta > 0 ,$ ) and $\hat { G } : \mathbb { R } ^ { H } \to \mathbb { R } ^ { D }$ . Define
|
| 205 |
+
|
| 206 |
+
$$
|
| 207 |
+
\epsilon _ { 1 } = \operatorname* { s u p } _ { G } \mathcal { L } ( \hat { \psi } , G ) - \mathcal { L } ( \hat { \psi } , \hat { G } ) \quad \quad a n d \quad \quad \epsilon _ { 2 } = \operatorname* { s u p } _ { G } \mathcal { L } ( \hat { \psi } , G ) - \operatorname* { i n f } _ { \psi \quad G } \mathcal { L } ( \psi , G )
|
| 208 |
+
$$
|
| 209 |
+
|
| 210 |
+
Then the following bound holds true for the OT map $G ^ { * }$ from $\mu$ to $\nu$ :
|
| 211 |
+
|
| 212 |
+
$$
|
| 213 |
+
\frac { \mathrm { F I D } ( \hat { G } _ { \# } \mu , \nu ) } { L ^ { 2 } } \leq 2 \cdot \mathcal { W } _ { 2 } ^ { 2 } ( \hat { G } _ { \# } \mu , \nu ) \leq \int _ { \mathcal { X } } \| \hat { G } ( x ) - G ^ { * } ( x ) \| ^ { 2 } d \mu ( x ) \leq \frac { 2 } { \beta } ( \sqrt { \epsilon _ { 1 } } + \sqrt { \epsilon _ { 2 } } ) ^ { 2 } ,
|
| 214 |
+
$$
|
| 215 |
+
|
| 216 |
+
where FID is the Frechet inception distance (Heusel et al., 2017) and ´ $L$ is the Lipschitz constant of the feature extractor of the pre-trained InceptionV3 neural network (Szegedy et al., 2016).
|
| 217 |
+
|
| 218 |
+
We prove Theorem 4.3 in Appendix A.4. The duality gaps upper bound $L ^ { 2 } ( \mu )$ norm between computed $\hat { G }$ and true $G ^ { * }$ maps, and the $\mathcal { W } _ { 2 } ^ { 2 }$ between true $\nu$ and generated (fake) distribution $\hat { G } _ { \# } \mu$ . Consequently, they upper bound FID between data $\nu$ and fake (generated) $\hat { G } _ { \# } \mu$ distributions.
|
| 219 |
+
|
| 220 |
+
Relation to previous works. Makkuva et al. (2020); Korotin et al. (2021a) prove related bounds for $\mathcal { W } _ { 2 }$ with $\mu , \nu$ located on the spaces of the same dimension. Our result holds for different dimensions.
|
| 221 |
+
|
| 222 |
+
# 5 EXPERIMENTS
|
| 223 |
+
|
| 224 |
+
We evaluate our algorithm in generative modeling of the data distribution from a noise ( 5.1) and unpaired image restoration task ( 5.2). Technical details are given in Appendix B. Additionally, in Appendix B.4 we test our method on toy 2D datasets and evaluate it on the Wasserstein-2 benchmark (Korotin et al., 2021b) in Appendix B.2. The code is in the supplementary material.
|
| 225 |
+
|
| 226 |
+
# 5.1 MODELING DATA DISTRIBUTION FROM NOISE DISTRIBUTION
|
| 227 |
+
|
| 228 |
+
In this subsection, $\mu$ is a 192-dimensional normal noise and $\nu$ the high-dimensional data distribution.
|
| 229 |
+
|
| 230 |
+
Let the images from $\nu$ be of size $w \times h$ with $c$ channels. As the embedding $Q : \mathcal { X } \mathcal { Y }$ we use a naive upscaling of a noise. For $x \in \mathbb { R } ^ { 1 9 2 }$ we represent it as 3-channel $8 \times 8$ image and bicubically upscale it to the size $w \times h$ of data images from $\nu$ . For grayscale images drawn from $\nu$ , we stack $c$ copies over channel dimension.
|
| 231 |
+
|
| 232 |
+
We test our method on MNIST $3 2 \times 3 2$ (LeCun et al., 1998), CIFAR10 $3 2 \times 3 2$ (Krizhevsky et al., 2009), and CelebA $6 4 \times 6 4$ (Liu et al., 2015) image datasets. In Figure 5, we show random samples generated by our approach, namely Optimal Transport Modeling (OTM). To quantify the results, in Tables 1 and 2 we give the inception (Salimans et al., 2016) and FID (Heusel et al., 2017) scores of generated samples. Similar to (Song & Ermon, 2019, Appendix B.2), we compute them on 50K real and generated samples. Additionally, in Appendix B.4, we test our method on $1 2 8 \times 1 2 8$ CelebA faces. We provide qualitative results (images of generated faces) in Figure 11.
|
| 233 |
+
|
| 234 |
+

|
| 235 |
+
Figure 5: Randomly generated MNIST, CIFAR10, and CelebA samples by our method (OTM).
|
| 236 |
+
|
| 237 |
+
Table 1: Results on CIFAR10 dataset.
|
| 238 |
+
|
| 239 |
+
<table><tr><td>Model</td><td>Related Work</td><td>Inception 个</td><td>FID↓</td></tr><tr><td>NVAE</td><td>Vahdat &Kautz (2020)</td><td>-</td><td>51.71</td></tr><tr><td>PixelIQN</td><td>Ostrovski et al. (2018)</td><td>5.29</td><td>49.46</td></tr><tr><td>EBM</td><td>Du & Mordatch (2019)</td><td>6.02</td><td>40.58</td></tr><tr><td>DCGAN</td><td>Radford et al. (2016)</td><td>6.64±0.14</td><td>37.70</td></tr><tr><td>NCSN</td><td>Song & Ermon (2019)</td><td>8.87±0.12</td><td>25.32</td></tr><tr><td>NCP-VAE</td><td>Aneja et al. (2021)</td><td>=</td><td>24.08</td></tr><tr><td>WGAN</td><td>Arjovsky et al. (2017)</td><td>-</td><td>55.2</td></tr><tr><td>WGAN-GP</td><td>Gulrajani et al. (2017)</td><td>6.49±0.09</td><td>39.40</td></tr><tr><td>3P-WGAN</td><td>Nhan Dam et al. (2019)</td><td>7.38 ± 0.08</td><td>28.8</td></tr><tr><td>AE-OT</td><td>An et al. (2020a)</td><td>-</td><td>28.5</td></tr><tr><td>AE-OT-GAN</td><td>An et al.(2020b)</td><td></td><td>17.1</td></tr><tr><td>OTM</td><td>Ours</td><td>7.42±0.06</td><td>21.78</td></tr></table>
|
| 240 |
+
|
| 241 |
+
Table 2: Results on CelebA dataset.
|
| 242 |
+
|
| 243 |
+
<table><tr><td>Model</td><td>Related Work</td><td>FID↓</td></tr><tr><td>DCGAN</td><td>Radford et al. (2016)</td><td>52.0</td></tr><tr><td>DRAGAN</td><td>Kodali et al. (2017)</td><td>42.3</td></tr><tr><td>BEGAN</td><td>Berthelot et al. (2017)</td><td>38.9</td></tr><tr><td>NVAE</td><td>Vahdat & Kautz (2020)</td><td>13.4</td></tr><tr><td>NCP-VAE</td><td>Aneja et al. (2021)</td><td>5.2</td></tr><tr><td>WGAN</td><td>Arjovsky et al. (2017)</td><td>41.3</td></tr><tr><td>WGAN-GP</td><td>Gulrajani et al. (2017)</td><td>30.0</td></tr><tr><td>WGAN-QC</td><td>Liu et al. (2019)</td><td>12.9</td></tr><tr><td>AE-OT</td><td>An et al. (2020a)</td><td>28.6</td></tr><tr><td>AE-OT-GAN</td><td>An et al.(2020b)</td><td>7.8</td></tr><tr><td>OTM</td><td>Ours</td><td>6.5</td></tr></table>
|
| 244 |
+
|
| 245 |
+
For comparison, we include the scores of existing generative models of three types: (1) OT map as the generative model; (2) OT cost as the loss; (3) not OT-based. Note that models of the first type compute OT in the latent space of an autoencoder in contrast to our approach. According to our evaluation, the performance of our method is better or comparable to existing alternatives.
|
| 246 |
+
|
| 247 |
+
# 5.2 UNPAIRED IMAGE RESTORATION
|
| 248 |
+
|
| 249 |
+
In this subsection, we consider unpaired image restoration tasks on CelebA faces dataset. In this case, the input distribution $\mu$ consists of degraded images, while $\nu$ are clean images. In all the cases, embedding $Q$ is a straightforward identity embedding $Q ( x ) \equiv x$ .
|
| 250 |
+
|
| 251 |
+
In image restoration, optimality of the restoration map is desired since the output (restored) image is expected to be close to the input (degraded) one minimizing the transport cost. Note that GANs do not seek for an optimal mapping. However, in practice, due to implicit inductive biases such as convolutional architectures, GANs still tend to fit low transport cost maps (Bezenac et al., 2021). ´
|
| 252 |
+
|
| 253 |
+
The experimental setup is shown in Figure 6. We split the dataset in 3 parts A, B, C containing 90K, 90K, 22K samples respectively. To each image we apply the degradation transform (decolorization, noising or occlusion) and obtain the degraded dataset containing of 3 respective parts A, B, C. For unpaired training we use part A of degraded and part B of clean images. For testing, we use parts C.
|
| 254 |
+
|
| 255 |
+

|
| 256 |
+
Figure 6: The training/testing scheme that we use for unpaired restoration tasks.
|
| 257 |
+
|
| 258 |
+
To quantify the results we compute FID of restored images w.r.t. clean images of part C. The scores for denoising, inpainting and colorization are given in Table 3, details of each experiment and qualitative results are given below.
|
| 259 |
+
|
| 260 |
+
As a baseline, we include WGAN-GP. For a fair comparison, we fit it using exactly the same hyperparameters as in our method OTM-GP. This is possible due to the similarities between our method and WGAN-GP’s training procedure, see discussion in $\ S 4 . 3$ . In OTM, there is no GP ( B.3).
|
| 261 |
+
|
| 262 |
+
<table><tr><td>Model</td><td>Denoising</td><td>Colorization</td><td>Inpainting</td></tr><tr><td>Input</td><td>166.59</td><td>32.12</td><td>47.65</td></tr><tr><td>WGAN-GP</td><td>25.49</td><td>7.75</td><td>16.51</td></tr><tr><td>OTM-GP (ours)</td><td>10.95</td><td>5.66</td><td>9.96</td></tr><tr><td>OTM (ours)</td><td>5.92</td><td>5.65</td><td>8.13</td></tr></table>
|
| 263 |
+
|
| 264 |
+
Table 3: $\mathrm { F I D \downarrow }$ on test part C in image restoration experiments.
|
| 265 |
+
|
| 266 |
+
Denoising. To create noisy images, we add white normal noise with $\sigma = 0 . 3$ to each pixel. Figure 7 illustrates image denoising using our OTM approach on the test part of the dataset. We show additional qualitative results for varying $\sigma$ in Figure 15 of (B.4).
|
| 267 |
+
|
| 268 |
+

|
| 269 |
+
Figure 7: OTM for image denoising on test C part of CelebA, $6 4 \times 6 4$
|
| 270 |
+
|
| 271 |
+
Colorization. To create grayscale images, we average the RGB values of each pixel. Figure 8 illustrates image colorization using OTM on the test part of the dataset.
|
| 272 |
+
|
| 273 |
+

|
| 274 |
+
Figure 8: OTM for image colorization on test C part of CelebA, $6 4 \times 6 4$ .
|
| 275 |
+
|
| 276 |
+
Inpainting. To create incomplete images, we replace the right half of each clean image with zeros.
|
| 277 |
+
Figure 9 illustrates image inpainting using OTM on the test part of the dataset.
|
| 278 |
+
|
| 279 |
+

|
| 280 |
+
Figure 9: OTM for image inpainting on test C part of CelebA, $6 4 \times 6 4$
|
| 281 |
+
|
| 282 |
+
# 6 CONCLUSION
|
| 283 |
+
|
| 284 |
+
Our method fits OT maps for the embedded quadratic transport cost between probability distributions. Unlike predecessors, it scales well to high dimensions producing applications of OT maps directly in ambient spaces, such as spaces of images. The performance is comparable to other existing generative models while the complexity of training is similar to that of popular WGANs.
|
| 285 |
+
|
| 286 |
+
Limitations. For distributions $\mu , \nu$ we assume the existence of the OT map between them. In practice, this might not hold for all real-world $\mu , \nu$ . Working with equal dimensions, we focus on the quadratic ground cost ${ \frac { 1 } { 2 } } \| x - y \| ^ { 2 }$ . Nevertheless, our approach extends to other costs $c ( \cdot , \cdot )$ , see Fan et al. (2021). When the dimensions are unequal, we restrict our analysis to embedded quadratic cost $\textstyle { \frac { 1 } { 2 } } \| Q ( x ) - y \| ^ { 2 }$ where $Q$ equalizes dimensions. Choosing the embedding $Q$ might not be straightforward in some practical problems, but our evaluation ( 5.1) shows that even naive choices of $Q$ work well.
|
| 287 |
+
|
| 288 |
+
Potential impact and ethics. Real-world image restoration problems often do not have paired datasets limiting the application of supervised techniques. In these practical unpaired learning problems, we expect our optimal transport approach to improve the performance of the existing models. However, biases in data might lead to biases in the pushforward samples. This should be taken into account when using our method in practical problems.
|
| 289 |
+
|
| 290 |
+
Reproducibility. The PyTorch source code is provided at https://github.com/LituRout/OptimalTransportModeling
|
| 291 |
+
|
| 292 |
+
The instructions to use the code are included in the README.md file.
|
| 293 |
+
|
| 294 |
+
# 7 ACKNOWLEDGMENT
|
| 295 |
+
|
| 296 |
+
This research was supported by the computational resources provided by Space Applications Centre (SAC), ISRO. The first author acknowledges the funding by HRD Grant No. 0303T50FM703/SAC/ISRO. Skoltech RAIC center was supported by the RF Government (subsidy agreement 000000D730321P5Q0002, Grant No. 70-2021-00145 02.11.2021).
|
| 297 |
+
|
| 298 |
+
# REFERENCES
|
| 299 |
+
|
| 300 |
+
Matthew Amodio and Smita Krishnaswamy. Travelgan: Image-to-image translation by transformation vector learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8983–8992, 2019.
|
| 301 |
+
|
| 302 |
+
Brandon Amos, Lei Xu, and J Zico Kolter. Input convex neural networks. In International Conference on Machine Learning, pp. 146–155. PMLR, 2017.
|
| 303 |
+
|
| 304 |
+
Dongsheng An, Yang Guo, Na Lei, Zhongxuan Luo, Shing-Tung Yau, and Xianfeng Gu. Ae-ot: A new generative model based on extended semi-discrete optimal transport. In International Conference on Learning Representations, 2020a. URL https://openreview.net/ forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ HkldyTNYwH.
|
| 305 |
+
|
| 306 |
+
Dongsheng An, Yang Guo, Min Zhang, Xin Qi, Na Lei, and Xianfang Gu. Ae-ot-gan: Training gans from data specific latent distribution. In European Conference on Computer Vision, pp. 548–564. Springer, 2020b.
|
| 307 |
+
|
| 308 |
+
Jyoti Aneja, Alexander Schwing, Jan Kautz, and Arash Vahdat. Ncp-vae: Variational autoencoders with noise contrastive priors. In Advances in Neural Information Processing Systems Conference, 2021.
|
| 309 |
+
|
| 310 |
+
Cem Anil, James Lucas, and Roger Grosse. Sorting out lipschitz function approximation. In International Conference on Machine Learning, pp. 291–301. PMLR, 2019.
|
| 311 |
+
|
| 312 |
+
Martin Arjovsky and Leon Bottou. Towards principled methods for training generative adversarial ´ networks. arXiv preprint arXiv:1701.04862, 2017.
|
| 313 |
+
|
| 314 |
+
Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein generative adversarial networks. ´ In International conference on machine learning, pp. 214–223. PMLR, 2017.
|
| 315 |
+
|
| 316 |
+
David Berthelot, Thomas Schumm, and Luke Metz. Began: Boundary equilibrium generative adversarial networks. arXiv preprint arXiv:1703.10717, 2017.
|
| 317 |
+
|
| 318 |
+
Emmanuel de Bezenac, Ibrahim Ayed, and Patrick Gallinari. Cyclegan through the lens of (dy-´ namical) optimal transport. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 132–147. Springer, 2021.
|
| 319 |
+
|
| 320 |
+
Yann Brenier. Polar factorization and monotone rearrangement of vector-valued functions. Communications on pure and applied mathematics, 44(4):375–417, 1991.
|
| 321 |
+
|
| 322 |
+
Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale GAN training for high fidelity natural image synthesis. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ B1xsqj09Fm.
|
| 323 |
+
|
| 324 |
+
Biwei Dai and Uros Seljak. Sliced iterative normalizing flows. In ICML Workshop on Invertible Neural Networks, Normalizing Flows, and Explicit Likelihood Models, 2021.
|
| 325 |
+
|
| 326 |
+
Ishan Deshpande, Ziyu Zhang, and Alexander G Schwing. Generative modeling using the sliced wasserstein distance. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3483–3491, 2018.
|
| 327 |
+
|
| 328 |
+
DC Dowson and BV Landau. The frechet distance between multivariate normal distributions. ´ Journal of multivariate analysis, 12(3):450–455, 1982.
|
| 329 |
+
|
| 330 |
+
Yilun Du and Igor Mordatch. Implicit generation and generalization in energy-based models. arXiv preprint arXiv:1903.08689, 2019.
|
| 331 |
+
|
| 332 |
+
Jiaojiao Fan, Shu Liu, Shaojun Ma, Yongxin Chen, and Haomin Zhou. Scalable computation of monge maps with general costs. arXiv preprint arXiv:2106.03812, 2021.
|
| 333 |
+
|
| 334 |
+
Kilian Fatras, Younes Zine, Remi Flamary, R ´ emi Gribonval, and Nicolas Courty. Learning with ´ minibatch wasserstein: asymptotic and gradient properties. arXiv preprint arXiv:1910.04091, 2019.
|
| 335 |
+
|
| 336 |
+
Aude Genevay, Gabriel Peyre, and Marco Cuturi. Learning generative models with sinkhorn di- ´ vergences. In International Conference on Artificial Intelligence and Statistics, pp. 1608–1617. PMLR, 2018.
|
| 337 |
+
|
| 338 |
+
Ian J Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron C Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in Neural Information Processing Systems Conference, pp. 2674–2680, 2014.
|
| 339 |
+
|
| 340 |
+
Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of wasserstein gans. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pp. 5769–5779, 2017.
|
| 341 |
+
|
| 342 |
+
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.
|
| 343 |
+
|
| 344 |
+
Leygonie Jacob, Jennifer She, Amjad Almahairi, Sai Rajeswar, and Aaron Courville. W2gan: Recovering an optimal transport map with a gan. 2018.
|
| 345 |
+
|
| 346 |
+
Leonid Vitalevich Kantorovich. On a problem of monge. Uspekhi Mat. Nauk, pp. 225–226, 1948.
|
| 347 |
+
|
| 348 |
+
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, pp. 4401–4410, 2019.
|
| 349 |
+
|
| 350 |
+
Cheolhyeong Kim, Seungtae Park, and Hyung Ju Hwang. Local stability of wasserstein gans with abstract gradient penalty. IEEE Transactions on Neural Networks and Learning Systems, 2021.
|
| 351 |
+
|
| 352 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 353 |
+
|
| 354 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
|
| 355 |
+
|
| 356 |
+
Naveen Kodali, Jacob Abernethy, James Hays, and Zsolt Kira. On convergence and stability of gans. arXiv preprint arXiv:1705.07215, 2017.
|
| 357 |
+
|
| 358 |
+
Alexander Korotin, Vage Egiazarian, Arip Asadulaev, Alexander Safin, and Evgeny Burnaev. Wasserstein-2 generative networks. In International Conference on Learning Representations, 2021a. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ bEoxzW_EXsa.
|
| 359 |
+
|
| 360 |
+
Alexander Korotin, Lingxiao Li, Aude Genevay, Justin Solomon, Alexander Filippov, and Evgeny Burnaev. Do neural optimal transport solvers work? a continuous wasserstein-2 benchmark. arXiv preprint arXiv:2106.01954, 2021b.
|
| 361 |
+
|
| 362 |
+
Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
|
| 363 |
+
|
| 364 |
+
Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
|
| 365 |
+
|
| 366 |
+
Na Lei, Kehua Su, Li Cui, Shing-Tung Yau, and Xianfeng David Gu. A geometric view of optimal transportation and generative model. Computer Aided Geometric Design, 68:1–21, 2019.
|
| 367 |
+
|
| 368 |
+
Huidong Liu, Xianfeng Gu, and Dimitris Samaras. Wasserstein gan with quadratic transport cost. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), October 2019.
|
| 369 |
+
|
| 370 |
+
Shu Liu, Shaojun Ma, Yongxin Chen, Hongyuan Zha, and Haomin Zhou. Learning high dimensional wasserstein geodesics. arXiv preprint arXiv:2102.02992, 2021.
|
| 371 |
+
|
| 372 |
+
Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of the IEEE international conference on computer vision, pp. 3730–3738, 2015.
|
| 373 |
+
|
| 374 |
+
Guansong Lu, Zhiming Zhou, Yuxuan Song, Kan Ren, and Yong Yu. Guiding the one-to-one mapping in cyclegan via optimal transport. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 4432–4439, 2019.
|
| 375 |
+
|
| 376 |
+
Guansong Lu, Zhiming Zhou, Jian Shen, Cheng Chen, Weinan Zhang, and Yong Yu. Large-scale optimal transport via adversarial training with cycle-consistency. arXiv preprint arXiv:2003.06635, 2020.
|
| 377 |
+
|
| 378 |
+
Ashok Makkuva, Amirhossein Taghvaei, Sewoong Oh, and Jason Lee. Optimal transport mapping via input convex neural networks. In International Conference on Machine Learning, pp. 6672– 6681. PMLR, 2020.
|
| 379 |
+
|
| 380 |
+
Anton Mallasto, Jes Frellsen, Wouter Boomsma, and Aasa Feragen. (q, p)-wasserstein gans: Comparing ground metrics for wasserstein gans. arXiv preprint arXiv:1902.03642, 2019.
|
| 381 |
+
|
| 382 |
+
Xudong Mao, Qing Li, Haoran Xie, Raymond YK Lau, Zhen Wang, and Stephen Paul Smolley. Least squares generative adversarial networks. In Proceedings of the IEEE international conference on computer vision, pp. 2794–2802, 2017.
|
| 383 |
+
|
| 384 |
+
Robert J McCann and Brendan Pass. Optimal transportation between unequal dimensions. Archive for Rational Mechanics and Analysis, 238(3):1475–1520, 2020.
|
| 385 |
+
|
| 386 |
+
Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. In International Conference on Learning Representations, 2018.
|
| 387 |
+
|
| 388 |
+
Quan Hoang Nhan Dam, Trung Le, Tu Dinh Nguyen, Hung Bui, and Dinh Phung. Threeplayer wasserstein gan via amortised duality. In Proc. of the 28th Int. Joint Conf. on Artificial Intelligence (IJCAI), 2019.
|
| 389 |
+
|
| 390 |
+
Georg Ostrovski, Will Dabney, and Remi Munos. Autoregressive quantile networks for generative ´ modeling. In International Conference on Machine Learning, pp. 3936–3945. PMLR, 2018.
|
| 391 |
+
|
| 392 |
+
Brendan Pass. Regularity of optimal transportation between spaces with different dimensions. arXiv preprint arXiv:1008.1544, 2010.
|
| 393 |
+
|
| 394 |
+
Giorgio Patrini, Rianne van den Berg, Patrick Forre, Marcello Carioni, Samarth Bhargav, Max Welling, Tim Genewein, and Frank Nielsen. Sinkhorn autoencoders. In Uncertainty in Artificial Intelligence, pp. 733–743. PMLR, 2020.
|
| 395 |
+
|
| 396 |
+
Henning Petzka, Asja Fischer, and Denis Lukovnikov. On the regularization of wasserstein gans. In International Conference on Learning Representations, 2018.
|
| 397 |
+
|
| 398 |
+
Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In 4th International Conference on Learning Representations, ICLR 2016, San Juan, Puerto Rico, May 2-4, 2016, Conference Track Proceedings, 2016. URL http://arxiv.org/abs/1511.06434.
|
| 399 |
+
|
| 400 |
+
R Tyrrell Rockafellar. Integral functionals, normal integrands and measurable selections. In Nonlinear operators and the calculus of variations, pp. 157–207. Springer, 1976.
|
| 401 |
+
|
| 402 |
+
Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. Advances in neural information processing systems, 29: 2234–2242, 2016.
|
| 403 |
+
|
| 404 |
+
Maziar Sanjabi, Meisam Razaviyayn, Jimmy Ba, and Jason D Lee. On the convergence and robustness of training gans with regularized optimal transport. Advances in Neural Information Processing Systems, 2018:7091–7101, 2018.
|
| 405 |
+
|
| 406 |
+
Filippo Santambrogio. Optimal transport for applied mathematicians. Birkauser, ¨ NY, 55(58-63):94, 2015.
|
| 407 |
+
|
| 408 |
+
Vivien Seguy, Bharath Bhushan Damodaran, Remi Flamary, Nicolas Courty, Antoine Rolet, and Mathieu Blondel. Large scale optimal transport and mapping estimation. In International Conference on Learning Representations, 2018.
|
| 409 |
+
|
| 410 |
+
Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. In Proceedings of the 33rd Annual Conference on Neural Information Processing Systems, 2019.
|
| 411 |
+
|
| 412 |
+
Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2818–2826, 2016.
|
| 413 |
+
|
| 414 |
+
Amirhossein Taghvaei and Amin Jalali. 2-wasserstein approximation via restricted convex potentials with application to improved training for gans. arXiv preprint arXiv:1902.07197, 2019.
|
| 415 |
+
|
| 416 |
+
Ugo Tanielian and Gerard Biau. Approximating lipschitz continuous functions with groupsort neural networks. In International Conference on Artificial Intelligence and Statistics, pp. 442–450. PMLR, 2021.
|
| 417 |
+
|
| 418 |
+
Ilya Tolstikhin, Olivier Bousquet, Sylvain Gelly, and Bernhard Schoelkopf. Wasserstein autoencoders. arXiv preprint arXiv:1711.01558, 2017.
|
| 419 |
+
|
| 420 |
+
Arash Vahdat and Jan Kautz. Nvae: A deep hierarchical variational autoencoder. In Advances in Neural Information Processing Systems Conference, 2020.
|
| 421 |
+
|
| 422 |
+
Cedric Villani. ´ Optimal transport: old and new, volume 338. Springer Science & Business Media, 2008.
|
| 423 |
+
|
| 424 |
+
Yujia Xie, Minshuo Chen, Haoming Jiang, Tuo Zhao, and Hongyuan Zha. On scalable and efficient computation of large scale optimal transport. In International Conference on Machine Learning, pp. 6882–6892. PMLR, 2019.
|
| 425 |
+
|
| 426 |
+
Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In Computer Vision (ICCV), 2017 IEEE International Conference on, 2017.
|
| 427 |
+
|
| 428 |
+
# A PROOFS
|
| 429 |
+
|
| 430 |
+
A.1 PROOF OF EQUIVALENCE: EQUATION (10) AND (11)
|
| 431 |
+
|
| 432 |
+
Proof. Pick any $T : \mathcal { X } \mathcal { Y }$ . For every point $x \in \mathcal { X }$ by the definition of the supremum we have
|
| 433 |
+
|
| 434 |
+
$$
|
| 435 |
+
\langle x , T ( x ) \rangle - \psi \left( T ( x ) \right) \leq \operatorname* { s u p } _ { y \in \mathcal { Y } } \left\{ \langle x , y \rangle - \psi ( y ) \right\} .
|
| 436 |
+
$$
|
| 437 |
+
|
| 438 |
+
Integrating the expression w.r.t. $x \sim \mu$ yields
|
| 439 |
+
|
| 440 |
+
$$
|
| 441 |
+
\int _ { \mathcal { X } } \{ \langle x , T ( x ) \rangle - \psi \left( T ( x ) \right) \} d \mu ( x ) \leq \int _ { \mathcal { X } } \operatorname* { s u p } _ { y \in \mathcal { Y } } \left\{ \langle x , y \rangle - \psi ( y ) \right\} d \mu ( x ) = \mathcal { L } _ { 1 } .
|
| 442 |
+
$$
|
| 443 |
+
|
| 444 |
+
Since the inequality holds for all $T : \mathcal { X } \mathcal { Y }$ , we conclude that
|
| 445 |
+
|
| 446 |
+
$$
|
| 447 |
+
\mathcal { L } _ { 2 } = \operatorname* { s u p } _ { T : \mathcal { X } \to \mathcal { Y } } \int _ { \mathcal { X } } \{ \langle x , T ( x ) \rangle - \psi \left( T ( x ) \right) \} d \mu ( x ) \leq \int _ { \mathcal { X } } \operatorname* { s u p } _ { y \in \mathcal { Y } } \{ \langle x , y \rangle - \psi ( y ) \} d \mu ( x ) = \mathcal { L } _ { 1 } ,
|
| 448 |
+
$$
|
| 449 |
+
|
| 450 |
+
i.e. $\mathcal { L } _ { 2 } \leq \mathcal { L } _ { 1 }$ . Now let us prove that the sup on the left side actually equals $\mathcal { L } _ { 1 }$ . To do this, we need to show that for every $\epsilon > 0$ there exists $T ^ { \epsilon } : \mathcal { X } \mathcal { Y }$ satisfying
|
| 451 |
+
|
| 452 |
+
$$
|
| 453 |
+
\int _ { \mathcal { X } } \{ \langle x , T ^ { \epsilon } ( x ) \rangle - \psi \left( T ^ { \epsilon } ( x ) \right) \} d \mu ( x ) \geq \mathcal { L } _ { 1 } - \epsilon .
|
| 454 |
+
$$
|
| 455 |
+
|
| 456 |
+
First note that for every $x \in \mathcal { X }$ by the definition of the supremum there exists $y ^ { \epsilon } = y ^ { \epsilon } ( x )$ which provides
|
| 457 |
+
|
| 458 |
+
$$
|
| 459 |
+
\langle x , y ^ { \epsilon } ( x ) \rangle - \psi \left( y ^ { \epsilon } ( x ) \right) \geq \operatorname* { s u p } _ { y \in \mathcal { V } } \left\{ \langle x , y \rangle - \psi ( y ) \right\} - \epsilon .
|
| 460 |
+
$$
|
| 461 |
+
|
| 462 |
+
We take $T ^ { \epsilon } ( x ) = y ^ { \epsilon } ( x )$ for all $x \in \mathcal { X }$ and integrate the previous inequality w.r.t. $x \sim \mu$ . We obtain
|
| 463 |
+
|
| 464 |
+
$$
|
| 465 |
+
\int _ { \mathcal X } \{ \langle x , T ^ { \epsilon } ( x ) \rangle - \psi \left( T ^ { \epsilon } ( x ) \right) \} d \mu ( x ) \geq \int _ { \mathcal X } \operatorname* { s u p } _ { y \in \mathcal y } \left\{ \langle x , y \rangle - \psi ( y ) \right\} d \mu ( x ) - \epsilon = \mathcal L _ { 1 } - \epsilon ,
|
| 466 |
+
$$
|
| 467 |
+
|
| 468 |
+
which is the desired inequality.
|
| 469 |
+
|
| 470 |
+
# A.2 PROOF OF LEMMA 4.1
|
| 471 |
+
|
| 472 |
+
Proof. It is enough to prove that $\overline { { \psi ^ { * } } } ( x ) = \langle T ^ { * } ( x ) , x \rangle - \psi ^ { * } \big ( T ( x ) \big )$ holds $\mu$ -almost everywhere, i.e., $T ^ { * } ( x ) \in \underset { y \in \mathbb { R } ^ { D } } { \arg \operatorname* { s u p } } \left. \left. x , y \right. - \psi ^ { * } ( y ) \right.$ . Since $\nu = T _ { \# } ^ { * } \mu$ , we use (9) with $\psi \psi ^ { * }$ to derive
|
| 473 |
+
|
| 474 |
+
$$
|
| 475 |
+
\begin{array} { r l r } & { } & { \mathcal { W } _ { 2 } ^ { 2 } ( \mu , \nu ) - \displaystyle \int _ { x } \frac { 1 } { 2 } \| x \| ^ { 2 } d \mu ( x ) - \displaystyle \int _ { y } \frac { 1 } { 2 } \| y \| ^ { 2 } d \mu ( y ) = } \\ & { } & { \quad - \displaystyle \int _ { x } \overline { { \psi ^ { * } } } ( x ) d \mu ( x ) - \displaystyle \int _ { y } \psi ^ { * } ( y ) d \nu ( y ) = - \displaystyle \int _ { x } \overline { { \psi ^ { * } } } ( x ) d \mu ( x ) - \displaystyle \int _ { y } \psi ^ { * } ( I ^ { * } ( x ) ) d \mu ( x ) = } \\ & { } & { \quad - \displaystyle \int _ { x } \left[ \frac { | \overline { { \psi ^ { * } } } ( x ) + \psi ^ { * } ( T ^ { * } ( x ) ) | } { \geq \langle T ^ { * } ( x ) , x \rangle } \right] d \mu ( x ) \leq - \displaystyle \int _ { x } \langle T ^ { * } ( x ) , x \rangle d \mu ( x ) = } \\ & { } & { \displaystyle \int _ { x } \frac { 1 } { 2 } \| x - T ^ { * } ( x ) \| ^ { 2 } d \mu ( x ) - \displaystyle \int _ { x } \frac { 1 } { 2 } \| x \| ^ { 2 } d \mu ( x ) - \displaystyle \int _ { x } \frac { 1 } { 2 } \| T ^ { * } ( x ) \| ^ { 2 } d \mu ( x ) = } \\ & { } & { \mathcal { W } _ { 2 } ^ { 2 } ( \mu , \nu ) - \displaystyle \int _ { x } \frac { 1 } { 2 } \| x \| ^ { 2 } d \mu ( x ) - \displaystyle \int _ { y } \frac { 1 } { 2 } \| y \| ^ { 2 } d \nu ( y ) . } \end{array}
|
| 476 |
+
$$
|
| 477 |
+
|
| 478 |
+
As a result, inequality (17) becomes the equality, in particular, $\overline { { \psi ^ { * } } } ( x ) + \psi ^ { * } \bigl ( T ^ { * } ( x ) \bigr ) = \langle T ^ { * } ( x ) , x \rangle$ holds $\mu$ -almost everywhere.
|
| 479 |
+
|
| 480 |
+
# A.3 PROOF OF LEMMA 4.2
|
| 481 |
+
|
| 482 |
+
Proof. Let $Q { \boldsymbol { \mathcal { W } } } _ { 2 } ^ { 2 }$ denote the $Q$ -embedded quadratic cost. We use the change of variables formula to derive
|
| 483 |
+
|
| 484 |
+
$$
|
| 485 |
+
\begin{array} { l } { { \displaystyle Q \mathcal { W } _ { 2 } ^ { 2 } ( \mu , \nu ) = \operatorname* { i n f } _ { \pi \in \Pi ( \mu , \nu ) } \int _ { \mathcal { X } \times \mathcal { Y } } \frac 1 2 \| Q ( x ) - y \| ^ { 2 } d \pi ( x , y ) = } } \\ { { \displaystyle \operatorname* { i n f } _ { \pi ^ { \prime } \in \Pi ( Q _ { \# } \mu , \nu ) } \int _ { \mathcal { X } \times \mathcal { Y } } \frac 1 2 \| x - y \| ^ { 2 } d \pi ^ { \prime } ( x , y ) = \mathcal { W } _ { 2 } ^ { 2 } ( Q _ { \# } \mu , \nu ) , } } \end{array}
|
| 486 |
+
$$
|
| 487 |
+
|
| 488 |
+
i.e., computing the OT plan for $Q { \mathcal { W } } _ { 2 } ^ { 2 } ( \mu , \nu )$ boils down to computing the OT plan for $\mathcal { W } _ { 2 } ^ { 2 } ( Q _ { \# } \mu , \nu )$ It follows that $[ \mathbf { i d } _ { \mathbb { R } ^ { H } } , T ^ { * } ( Q ( x ) ) ] _ { \# } \mu = [ \mathbf { i d } _ { \mathbb { R } ^ { H } } , G ^ { * } ] _ { \# } \mu$ is an OT plan for $Q { \mathcal { W } } _ { 2 } ^ { 2 } ( \mu , \nu )$ , and $G ^ { * }$ is the OT map. Inclusion (15) now follows from Lemma 4.1. □
|
| 489 |
+
|
| 490 |
+
# A.4 PROOF OF THEOREM 4.3
|
| 491 |
+
|
| 492 |
+
Proof. Pick any $\begin{array} { r } { G ^ { \prime } \in \arg \operatorname* { s u p } _ { G } \mathcal { L } ( \hat { \psi } , G ) = \arg \operatorname* { s u p } _ { G } \int _ { \mathcal { X } } \Big \{ \langle Q ( x ) , G ( x ) \rangle - \hat { \psi } \big ( G ( x ) \big ) \Big \} d \mu ( x ) } \end{array}$ or, equivalently, for all $\boldsymbol { x } \in \mathbb { R } ^ { H }$ , $G ^ { \prime } ( x ) \in \arg \operatorname* { s u p } _ { y } \left\{ \langle Q ( x ) , y \rangle - \hat { \psi } ( y ) \right\}$ . Consequently, for all $y \in \mathbb { R } ^ { D }$
|
| 493 |
+
|
| 494 |
+
$$
|
| 495 |
+
\langle Q ( x ) , G ^ { \prime } ( x ) \rangle - \hat { \psi } \big ( G ^ { \prime } ( x ) \big ) \geq \langle Q ( x ) , y \rangle - \hat { \psi } ( y ) ,
|
| 496 |
+
$$
|
| 497 |
+
|
| 498 |
+
which after regrouping the terms yields
|
| 499 |
+
|
| 500 |
+
$$
|
| 501 |
+
\hat { \psi } ( y ) \geq \hat { \psi } \big ( G ^ { \prime } ( x ) \big ) + \langle Q ( x ) , y - G ^ { \prime } ( x ) \rangle .
|
| 502 |
+
$$
|
| 503 |
+
|
| 504 |
+
This means that $Q ( x )$ is contained in the subgradient $\partial \hat { \psi }$ at $G ^ { \prime } ( x )$ for a convex $\hat { \psi }$ . Since $\hat { \psi }$ is $\beta$ -strongly convex, for points $G ( x ) , G ^ { \prime } ( x ) \in \mathbb { R } ^ { D }$ and $Q ( x ) \in \partial \hat { \psi } \bigl ( G ^ { \prime } ( x ) \bigr )$ we derive
|
| 505 |
+
|
| 506 |
+
$$
|
| 507 |
+
\hat { \psi } \big ( G ( x ) \big ) \geq \hat { \psi } \big ( G ^ { \prime } ( x ) \big ) + \langle Q ( x ) , G ( x ) - G ^ { \prime } ( x ) \rangle + \frac { \beta } { 2 } \| G ^ { \prime } ( x ) - G ( x ) \| ^ { 2 } .
|
| 508 |
+
$$
|
| 509 |
+
|
| 510 |
+
Regrouping the terms, this gives
|
| 511 |
+
|
| 512 |
+
$$
|
| 513 |
+
\big [ \langle Q ( x ) , G ^ { \prime } ( x ) \rangle - \hat { \psi } \big ( G ^ { \prime } ( x ) \big ) \big ] - \big [ \langle Q ( x ) , G ( x ) \rangle - \hat { \psi } \big ( G ( x ) \big ) \big ] \geq \frac { \beta } { 2 } \| G ^ { \prime } ( x ) - G ( x ) \| ^ { 2 } .
|
| 514 |
+
$$
|
| 515 |
+
|
| 516 |
+
Integrating w.r.t. $x \sim \mu$ yields
|
| 517 |
+
|
| 518 |
+
$$
|
| 519 |
+
\epsilon _ { 1 } = \mathcal { L } ( \hat { \psi } , G ^ { \prime } ) - \mathcal { L } ( \hat { \psi } , G ) \geq \beta \int _ { \mathcal { X } } \frac { 1 } { 2 } \| G ^ { \prime } ( x ) - G ( x ) \| ^ { 2 } d \mu ( x ) = \frac { \beta } { 2 } \cdot \| G - G ^ { \prime } \| _ { L ^ { 2 } ( \mu ) } ^ { 2 } .
|
| 520 |
+
$$
|
| 521 |
+
|
| 522 |
+
Let $G ^ { * }$ be the OT map from $\mu$ to $\nu$ . We use $G _ { \# } ^ { * } \mu = \nu$ to derive
|
| 523 |
+
|
| 524 |
+
$$
|
| 525 |
+
\begin{array} { r l r } { { \mathcal { L } ( \hat { \psi } , G ^ { \prime } ) = \int _ { \mathcal { X } } \Big \{ \langle Q ( x ) , G ^ { \prime } ( x ) \rangle - \hat { \psi } \big ( G ^ { \prime } ( x ) \big ) \Big \} d \mu ( x ) + \int _ { \mathcal { Y } } \hat { \psi } ( y ) d \nu ( y ) = } } \\ & { } & { \int _ { \mathcal { X } } \Big \{ \langle Q ( x ) , G ^ { \prime } ( x ) \rangle - \hat { \psi } \big ( G ^ { \prime } ( x ) \big ) \Big \} d \mu ( x ) + \int _ { \mathcal { X } } \hat { \psi } \big ( G ^ { * } ( x ) \big ) d \mu ( x ) = } \\ & { } & { \int _ { \mathcal { X } } \{ \underbrace { \langle Q ( x ) , G ^ { \prime } ( x ) \rangle - \hat { \psi } \big ( G ^ { \prime } ( x ) \big ) + \hat { \psi } \big ( G ^ { * } ( x ) \big ) } _ { \geq \langle Q ( x ) , G ^ { * } ( x ) \rangle + \beta \frac { 1 } { 2 } \| G ^ { \prime } - G ^ { * } \| ^ { 2 } } \} d \mu ( x ) \geq } \\ & { } & { \int _ { \mathcal { X } } \langle Q ( x ) , G ^ { * } ( x ) \rangle d \mu ( x ) + \beta \int _ { \mathcal { X } } \frac { 1 } { 2 } \| G ^ { \prime } - G ^ { * } \| ^ { 2 } d \mu ( x ) . } \end{array}
|
| 526 |
+
$$
|
| 527 |
+
|
| 528 |
+
Let $\psi ^ { * }$ be an optimal potential in (14). Thanks to Lemma 4.2, we have
|
| 529 |
+
|
| 530 |
+
$$
|
| 531 |
+
\begin{array} { r l r } & { } & { \underset { \psi } { \operatorname* { i n f } } \ \mathrm { s u p } \mathcal { L } ( \psi , G ) = \mathcal { L } ( \psi ^ { * } , G ^ { * } ) = } \\ & { } & { \displaystyle \int _ { \mathcal { X } } \left\{ \langle Q ( x ) , G ^ { * } ( x ) \rangle - \psi ^ { * } \left( G ^ { * } ( x ) \right) \right\} d \mu ( x ) + \int _ { \mathcal { V } } \psi ^ { * } ( y ) d \nu ( y ) = } \end{array}
|
| 532 |
+
$$
|
| 533 |
+
|
| 534 |
+
$$
|
| 535 |
+
\begin{array} { r } { \displaystyle \int _ { \mathcal X } \left\{ \langle Q ( x ) , G ^ { * } ( x ) \rangle - \psi ^ { * } \big ( G ^ { * } ( x ) \big ) \right\} d \mu ( x ) + \displaystyle \int _ { \mathcal X } \psi ^ { * } \big ( G ^ { * } ( x ) \big ) d \mu ( x ) = } \\ { \displaystyle \int _ { \mathcal X } \langle Q ( x ) , G ^ { * } ( x ) \rangle d \mu ( x ) } \end{array}
|
| 536 |
+
$$
|
| 537 |
+
|
| 538 |
+
By combining (20) with (21), we obtain
|
| 539 |
+
|
| 540 |
+
$$
|
| 541 |
+
\epsilon _ { 2 } = \mathcal { L } ( \boldsymbol { \hat { \psi } } , G ^ { \prime } ) - \mathcal { L } ( \boldsymbol { \psi } ^ { * } , G ^ { * } ) \geq \beta \int _ { \mathcal { X } } \frac { 1 } { 2 } \| G ^ { \prime } - G ^ { * } \| ^ { 2 } d \mu ( \boldsymbol { x } ) = \frac { \beta } { 2 } \cdot \| G ^ { \prime } - G ^ { * } \| _ { L ^ { 2 } ( \mu ) } ^ { 2 }
|
| 542 |
+
$$
|
| 543 |
+
|
| 544 |
+
The right-hand inequality of (16) follows from the triangle inequality combined with (19) and (22).
|
| 545 |
+
The middle inequality of (16) follows from (Korotin et al., 2021a, Lemma A.2) and $G _ { \# } ^ { * } \mu = \nu$ .
|
| 546 |
+
|
| 547 |
+
Now we prove the left-hand inequality of (16). Let $\mathcal { T }$ be the feature extractor of the pre-trained InceptionV3 neural networks. FID score between generated (fake) $\hat { G } _ { \# } \mu$ and data distribution $\nu$ is
|
| 548 |
+
|
| 549 |
+
$$
|
| 550 |
+
\begin{array} { r } { \mathrm { F I D } ( \hat { G } _ { \# } \mu , \nu ) = \mathrm { F D } ( \mathcal { T } _ { \# } \hat { G } _ { \# } \mu , \mathcal { T } _ { \# } \nu ) \leq 2 \cdot \mathcal { W } _ { 2 } ^ { 2 } ( \mathcal { T } _ { \# } \hat { G } _ { \# } \mu , \mathcal { T } _ { \# } \nu ) , } \end{array}
|
| 551 |
+
$$
|
| 552 |
+
|
| 553 |
+
where $\mathrm { F D } ( \cdot , \cdot )$ is the Frechet distance which lower bounds ´ $2 \cdot \mathcal { W } _ { 2 } ^ { 2 }$ , see (Dowson & Landau, 1982). Finally, from (Korotin et al., 2021a, Lemma A.1) it follows that
|
| 554 |
+
|
| 555 |
+
$$
|
| 556 |
+
\mathcal { W } _ { 2 } ^ { 2 } ( \mathbb { Z } _ { \# } \hat { G } _ { \# } \mu , \mathbb { Z } _ { \# } \nu ) \leq L ^ { 2 } \cdot \mathcal { W } _ { 2 } ^ { 2 } ( \hat { G } _ { \# } \mu , \nu ) .
|
| 557 |
+
$$
|
| 558 |
+
|
| 559 |
+
Here $L$ is the Lipschitz constant of $\mathcal { T }$ . We combine (23) and (24) to get the left-hand inequality in (16). □
|
| 560 |
+
|
| 561 |
+
# B EXPERIMENTAL DETAILS
|
| 562 |
+
|
| 563 |
+
We use the PyTorch framework. All the experiments are conducted on $2 \times \mathsf { V } 1 0 0$ GPUs. We compute inception and FID scores with the official implementation from OpenAI1 and TTUR2. The compared results are taken from the respective papers or publicly available source codes.
|
| 564 |
+
|
| 565 |
+
# B.1 GENERAL TRAINING DETAILS
|
| 566 |
+
|
| 567 |
+
MNIST (LeCun et al., 1998). On MNIST, we use $x \in \mathbb { R } ^ { 1 9 2 }$ and $y \in \mathbb { R } ^ { 3 2 \times 3 2 }$ . The batch size is 64, learning rate $2 \cdot 1 0 ^ { - 4 }$ , optimizer Adam (Kingma & Ba, 2014) with betas $( 0 , 0 . 9 )$ , gradient optimality coefficient $\lambda = 1 0$ , and the number of training epochs $T = 3 0$ . We observe stable training while updating $\psi$ once in multiple $G$ updates, i.e., $k _ { G } = 2$ and $k _ { \psi } = 1$ .
|
| 568 |
+
|
| 569 |
+
CIFAR10 (Krizhevsky et al., 2009). We use all 50000 samples while training. The latent vector $x \in \mathbb { R } ^ { 1 9 2 }$ and $y \in \mathbb { R } ^ { 3 2 \times 3 2 \times 3 }$ , batch size 64, $\lambda = 1 0$ , $k _ { G } = 1$ , $k _ { \psi } = 1$ , $T = 1 0 0 0$ , Adam optimizer with betas $( 0 , 0 . 9 )$ , and learning rate $2 \cdot 1 0 ^ { - 4 }$ for $G$ and $1 \cdot 1 0 ^ { - 3 }$ for $\psi$ .
|
| 570 |
+
|
| 571 |
+
CelebA (Liu et al., 2015). We use $x \in \mathbb { R } ^ { 1 9 2 }$ and $y \in \mathbb { R } ^ { 6 4 \times 6 4 \times 3 }$ . The images are first cropped at the center with size 140 and then resized to $6 4 \times 6 4$ . We consider all 202599 samples. We use Adam with betas $( 0 , 0 . 9 )$ , $T = 2 0 0$ , $K _ { G } = 2$ , $K _ { \psi } = 1$ and learning rate $2 \cdot 1 0 ^ { - 4 }$ .
|
| 572 |
+
|
| 573 |
+
Image restoration. In the unpaired image restoration experiments, we use Adam optimizer with betas $( 0 , 0 . 9 )$ , $K _ { G } = 5 , K _ { \psi } = 1 , \lambda = 0$ , learning rate $1 \cdot 1 \bar { 0 } ^ { - 4 }$ and train for $T = 3 0 0$ epochs.
|
| 574 |
+
|
| 575 |
+
CelebA128x128 (Liu et al., 2015). On this dataset, we resize the cropped images as in CelebA to $1 2 8 \times 1 2 8$ , i.e. $y \in \mathbb { R } ^ { 1 2 8 \times { \mathrm { i } 2 8 \times 3 } }$ . Here, $K _ { G } = 5$ , $K _ { \psi } = 1$ , $\lambda = 0 . 0 1$ , learning rate $1 \cdot 1 0 ^ { - 4 }$ and beta $\scriptstyle \mathsf { \lambda } = \left( 0 . 5 , 0 . 9 9 9 \right)$ . The batch size is reduced to 16 so as to fit in the GPU memory.
|
| 576 |
+
|
| 577 |
+
Anime1 $2 \mathbf { 8 } \mathbf { x } \mathbf { 1 } 2 \mathbf { 8 } ^ { 3 }$ . This dataset consists of 500000 high resolution images. We resize the cropped images as in CelebA to $1 2 8 \times 1 2 8$ , i.e. $y \in \mathbb { R } ^ { 1 2 8 \times \tilde { 1 } 2 8 \times 3 }$ . Here, $K _ { G } = 5$ , $K _ { \psi } = 1$ , $\lambda = 0 . 0 1$ , learning rate $2 \cdot 1 0 ^ { - 4 }$ , batch size 16, and betas $= ( 0 , 0 . 9 )$ .
|
| 578 |
+
|
| 579 |
+
Toy datasets. The dimension is $\begin{array} { r l r l r l } { D } & { { } = { } } & { H } & { { } = { } } & { 2 } & { { } } \end{array}$ , total number of samples is 10000. We use the batch size 400, $\begin{array} { r l r } { \lambda } & { { } = } & { 0 . 1 } \end{array}$ , $\begin{array} { r l r } { K _ { \psi } } & { { } = } & { 1 } \end{array}$ , $\begin{array} { r l r } { K _ { G } } & { { } = } & { 1 6 } \end{array}$ , and $\begin{array} { r l r } { T } & { { } = } & { 1 0 0 } \end{array}$ . The optimizer is Adam with betas (0.5, 0.99) and learning rate 1 · $1 0 ^ { - 3 }$ . We use the following datasets: Gaussian to mixture of Gaussians4, two moons (sklearn.datasets.make_moons), circles (sklearn.datasets.make_circles), gaussian to S-curve (sklearn.datasets.make_s_curve), and gaussian to swiss roll (sklearn.datasets.make_swiss_roll).
|
| 580 |
+
|
| 581 |
+
Wasserstein-2 benchmark (Appendix B.2). The dimension is $D = H = 6 4 \times 6 4 \times 3$ . We use batch size 64, $\lambda = 0$ , $K _ { \psi } = 1$ , $K _ { G } = 5$ , learning rate $1 0 ^ { - 4 }$ , and Adam optimizer with default betas.
|
| 582 |
+
|
| 583 |
+
# B.2 EVALUATION ON THE CONTINUOUS WASSERSTEIN-2 BENCHMARK
|
| 584 |
+
|
| 585 |
+
To empirically show that the method recovers the optimal transport maps well on equal dimensions, we evaluate it on the recent continuous Wasserstein-2 benchmark by Korotin et al. (2021b). The benchmark provides a number of artificial test pairs $( \mu , \nu )$ of continuous probability distributions with analytically known OT map $T ^ { * }$ between them.
|
| 586 |
+
|
| 587 |
+
For evaluation, we use the ”Early” images benchmark pair $( D = 1 2 2 8 8 )$ , see (Korotin et al., 2021b, 4.1) for details. We adopt the $\mathcal { L } ^ { 2 }$ -unexplained percentage metric (Korotin et al., 2021a, 5.1) to quantify the recovered OT map $\hat { T }$ : $\mathcal { L } ^ { 2 } \mathbf { - U V P } ( \hat { T } ) = 1 0 0 \cdot \lVert \hat { T } - \dot { T ^ { * } } \rVert ^ { 2 } / \dot { \mathrm { V a r } } ( \nu ) \%$ . For our method the $\mathcal { L } _ { 2 }$ -UVP metric is only $\approx ~ 1 \%$ , see Table 4. This is comparable to the best $\lceil \mathrm { M M } ! \mathrm { R } \rceil$ method which the authors evaluate on their benchmark. The qualitative results are given in Figure 10.
|
| 588 |
+
|
| 589 |
+
<table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>L²-UVP↓</td></tr><tr><td rowspan=1 colspan=1>MM:R]</td><td rowspan=1 colspan=1>1.4%</td></tr><tr><td rowspan=1 colspan=1>OTM (ours)</td><td rowspan=1 colspan=1>1.32%</td></tr></table>
|
| 590 |
+
|
| 591 |
+
Table 4: $\textstyle { \mathcal { L } } ^ { 2 }$ -UVP metric of the recovered transport map on the ”Early” images benchmark pair.
|
| 592 |
+
|
| 593 |
+

|
| 594 |
+
Figure 10: Qualitative results of OTM on the ”Early” images benchmark pair $( \mu , \nu )$ by Korotin et al. (2021b). The 1st line shows samples $x \sim \mu$ , the 2nd line shows fitted OT map ${ \hat { T } } ( x )$ , and the 3rd line shows the corresponding optimal map $T ^ { * } ( x ) \sim \nu$ .
|
| 595 |
+
|
| 596 |
+
# B.3 FURTHER DISCUSSION AND EVALUATION
|
| 597 |
+
|
| 598 |
+
Generative modeling. In the experiments, we use the gradient penalty on $\psi$ for better stability of optimization. The penalty is intended to make the gradient norm of the optimal WGAN critic equal to 1 (Gulrajani et al., 2017, Corollary 1). This condition does not necessarily hold for optimal $\psi ^ { * }$ in our case and consequently might introduce bias to optimization.
|
| 599 |
+
|
| 600 |
+
To address this issue, we additionally tested an alternative regularization which we call the gradient optimality. For every optimal potential $\psi ^ { * }$ and map $G ^ { * }$ of problem (14), we get from Lemma 4.2:
|
| 601 |
+
|
| 602 |
+
$$
|
| 603 |
+
\nabla _ { G } \Big \{ \mathbb { E } _ { \boldsymbol { x } \sim \boldsymbol { \mu } } \left[ \langle Q ( \boldsymbol { x } ) , G ^ { * } ( \boldsymbol { x } ) \rangle - \psi ^ { * } \left( G ^ { * } ( \boldsymbol { x } ) \right) \rangle \right] \Big \} = \mathbb { E } _ { \boldsymbol { x } \sim \boldsymbol { \mu } } \left[ Q ( \boldsymbol { x } ) \right] - \mathbb { E } _ { \boldsymbol { x } \sim \boldsymbol { \mu } } \left[ \nabla \psi ^ { * } \left( G ^ { * } ( \boldsymbol { x } ) \right) \right] = 0 .
|
| 604 |
+
$$
|
| 605 |
+
|
| 606 |
+
Since $\mu$ is normal noise distribution and $Q ( x )$ is naive upscaling ( 5.1), the above expression simplifies to $\mathbb { E } _ { { x } \sim { \mu } } \nabla \psi ^ { * } \left( G ^ { * } ( { x } ) \right) = 0$ . Based on this property, we establish the following regularizer $\lambda \| \mathbb { E } _ { x \sim \mu } \nabla \psi \left( { \dot { G } } ( x ) \right) ) \|$ for $\lambda > 0$ and add this to $\mathcal { L } _ { \psi }$ in our Algorithm 1.
|
| 607 |
+
|
| 608 |
+
While gradient penalty considers expectation of norm, gradient optimality considers norm of expectation. The gradient optimality is always non-negative and vanishes at the optimal point.
|
| 609 |
+
|
| 610 |
+
We conduct additional experiments with the gradient optimality and compare FID scores for different $\lambda$ in Table 5. It leads to an improvement of FID score from the earlier 7.7 with the gradient penalty to the current 6.5 with the gradient optimality on CelebA (Table 2).
|
| 611 |
+
|
| 612 |
+
Unpaired restoration. In the unpaired restoration experiments ( 5.2), we test OTM with the gradient penalty to make a fair comparison with the baseline WGAN-GP. We find OTM without regularization, i.e., $\lambda = 0$ works better than OTM-GP (Table 3). In practice, more $G$ updates for a single $\psi$ update works fairly well ( B.1).
|
| 613 |
+
|
| 614 |
+
Table 5: Ablation study of gradient optimality in OTM.
|
| 615 |
+
|
| 616 |
+
<table><tr><td>入</td><td>FID↓</td></tr><tr><td>0.001 0.01 0.1</td><td>16.91 16.22</td></tr><tr><td>1.0</td><td>16.70 10.01</td></tr><tr><td>10</td><td>6.50</td></tr></table>
|
| 617 |
+
|
| 618 |
+
# B.4 ADDITIONAL QUALITATIVE RESULTS
|
| 619 |
+
|
| 620 |
+
OTM works with both the grayscale and color embeddings of noise in the ambient space.
|
| 621 |
+
|
| 622 |
+
CelebA128x128. Figure 11 shows the grayscale embedding $Q ( x )$ , the recovered transport map $\hat { G } ( x )$ , and independently drawn real samples $y \sim \nu$ .
|
| 623 |
+
|
| 624 |
+

|
| 625 |
+
Figure 11: OTM between 128-dimensional noise and CelebA, $1 2 8 \times 1 2 8$ . The 1st line shows the grayscale embedding $Q$ (repeating bicubic upscaling of a noise, $1 6 \times 8$ ), the 2nd line shows corresponding generated samples, and the 3rd line shows random samples from the dataset.
|
| 626 |
+
|
| 627 |
+
Anime128x128. Figure 12 shows the color embedding $Q ( x )$ , the recovered transport map $\hat { G } ( x )$ , and independently drawn real samples $y \sim \nu$ .
|
| 628 |
+
|
| 629 |
+

|
| 630 |
+
Figure 12: OTM between 192-dimensional noise and Anime, $1 2 8 \times 1 2 8$ . The 1st line shows the color embedding $Q$ (bicubic upscaling of a noise, $3 \times 8 \times 8 $ ), the 2nd line shows corresponding generated samples, and the 3rd line shows random samples from the dataset.
|
| 631 |
+
|
| 632 |
+
The extended qualitative results with color embedding on MNIST, CIFAR10, and CelebA are shown in Figure 13a, Figure 13b, and Figure 13c respectively. Table 6 shows quantiative results on MNIST. The color embedding $Q$ is bicubic upscaling of a noise in $\mathbb { R } ^ { 3 \times 8 \times 8 }$ . The samples are generated randomly (uncurated) by fitted optimal transport maps between noise and ambient space, e.g., spaces of high-dimensional images. Figure 14 illustrates latent space interpolation between the generated samples. Figure 15 shows denoising of images with varying levels of $\sigma = 0 . 1 , 0 . 2 , 0 . 3 , 0 . 4$ by the model trained with $\sigma = 0 . 3$ .
|
| 633 |
+
|
| 634 |
+
Table 6: Results on MNIST dataset.
|
| 635 |
+
|
| 636 |
+
<table><tr><td>Model</td><td>Related Work</td><td>FID↓</td></tr><tr><td>VAE</td><td>Kingma&Welling (2013)</td><td>23.8±0.6</td></tr><tr><td>LSGAN</td><td>Mao et al. (2017)</td><td>7.8±0.6</td></tr><tr><td>BEGAN</td><td>Berthelot et al.(2017)</td><td>13.1±1.0</td></tr><tr><td>WGAN</td><td>Arjovsky et al. (2017)</td><td>6.7±0.4</td></tr><tr><td>SIG</td><td>Dai& Seljak(2021)</td><td>4.5</td></tr><tr><td>AE-OT</td><td>An et al. (2020a)</td><td>6.2±0.2</td></tr><tr><td>AE-OT-GAN</td><td>An et al. (2020b)</td><td>3.2</td></tr><tr><td>OTM</td><td>Ours</td><td>2.4</td></tr></table>
|
| 637 |
+
|
| 638 |
+

|
| 639 |
+
Figure 13: Randomly generated MNIST, CIFAR10, and CelebA samples by our method (OTM).
|
| 640 |
+
|
| 641 |
+

|
| 642 |
+
Figure 14: OTM for latent space interpolation on CelebA, $6 4 \times 6 4$ . Extended samples.
|
| 643 |
+
|
| 644 |
+
Toy datasets. Figure 16 shows the results of our method and related approaches ( 3) on a toy 2D dataset. Figure 17 shows the results of our method applied to other toy datasets.
|
| 645 |
+
|
| 646 |
+
# B.5 NEURAL NETWORK ARCHITECTURES
|
| 647 |
+
|
| 648 |
+
This section contains architectures on CIFAR10 (Table 7), CelebA (Table 8), CelebA $1 2 8 \times 1 2 8$ (Figure 11) generation, image restoration tasks (Table 9), evaluation on the toy 2D datasets and Wasserstein-2 images benchmark (Table 4).
|
| 649 |
+
|
| 650 |
+
In the unpaired restoration tasks ( 5.2), we use UNet architecture for transport map $G$ and convolutional architecture for potential $\psi$ . Similarly to (Song & Ermon, 2019), we use BatchNormaliation (BN) and InstanceNormalization $^ +$ (INorm+) layers. In the ResNet architectures, we use the ResidualBlock of NCSN (Song & Ermon, 2019).
|
| 651 |
+
|
| 652 |
+
In the toy 2D examples, we use a simple multi-layer perceptron with 3 hidden layers consisting of 128 neurons each and LeakyReLU activation. The final layer is linear without any activation.
|
| 653 |
+
|
| 654 |
+

|
| 655 |
+
Figure 15: OTM for image denoising for varying levels of noise on test C part of CelebA, $6 4 \times 6 4$
|
| 656 |
+
|
| 657 |
+

|
| 658 |
+
Figure 16: Mapping between a Gaussian and a Mixture of 8 Gaussians in 2D by various methods. The colors green, blue, and peru represent input, pushforward, and output samples respectively.
|
| 659 |
+
|
| 660 |
+
The transport map $G$ and potential $\psi$ architectures on MNIST $3 2 \times 3 2$ , CelebA $1 2 8 \times 1 2 8$ , and Anime $1 2 8 \times 1 2 8$ are the generator and discriminator architectures of WGAN-QC Liu et al. (2019) respectively.
|
| 661 |
+
|
| 662 |
+
In the evaluation on the Wasserstein-2 benchmark, we use publicly available Unet5 architecture for transport map $T$ and WGAN-QC discriminator’s architecture for $\psi$ (Liu et al., 2019). These neural network architectures are the same as the authors of the benchmark use.
|
| 663 |
+
|
| 664 |
+

|
| 665 |
+
Figure 17: OTM on toy datasets, $D = 2$ . Here, the colors green, blue, and peru represent input, pushforward, and output samples respectively.
|
| 666 |
+
|
| 667 |
+
Table 7: Architectures for generation task on CIFAR10, $3 2 \times 3 2$ .
|
| 668 |
+
|
| 669 |
+
<table><tr><td rowspan=1 colspan=1>G()</td></tr><tr><td rowspan=1 colspan=1>Noise: x ∈ R128Linear, Reshape,output shape: [128 × 4 × 4]ResidualBlock Up,output shape: [128 × 8 × 8]ResidualBlock Up,output shape: [128 × 16 × 16]ResidualBlock Up,output shape: [128 × 32 × 32]Conv, Tanh,output shape: [3 × 32 × 32]</td></tr><tr><td rowspan=1 colspan=1>()</td></tr><tr><td rowspan=1 colspan=1>Target: y ∈ R3×32×32ResidualBlock Down,output shape: [128 × 16 × 16]ResidualBlock Down, output shape: [128 × 8 × 8]ResidualBlock, output shape: [128 × 8 × 8]ResidualBlock, output shape: [128 × 8 × 8]ReLU, Global sum pooling, output shape: [128 × 1 × 1]Linear, output shape: [1]</td></tr></table>
|
| 670 |
+
|
| 671 |
+
Table 8: Architectures for generation task on Celeba, $6 4 \times 6 4$ .
|
| 672 |
+
|
| 673 |
+
<table><tr><td colspan="2">G(</td></tr><tr><td colspan="2">Noise: x ∈R128</td></tr><tr><td>ConvTranspose,BN,LeakyReLU,output shape: [256 ×1 × 1]</td><td></td></tr><tr><td>ConvTranspose,BN,LeakyReLU,output shape: [512 × 4 × 4]</td><td></td></tr><tr><td>Conv,PixelShuffle,BN,LeakyReLU,output shape: [512 ×8 × 8]</td><td></td></tr><tr><td>Conv, PixelShuffle,BN,LeakyReLU,output shape: [512 × 16 × 16]</td><td></td></tr><tr><td>Conv, PixelShuffle,BN,LeakyReLU,output shape: [512 × 32 × 32]</td><td></td></tr><tr><td colspan="2">ConvTranspose,Tanh,output shape: [3 × 64 × 64]</td></tr></table>
|
| 674 |
+
|
| 675 |
+
<table><tr><td colspan="2">()</td></tr><tr><td colspan="2">Target: y ∈R3×64×64</td></tr><tr><td>Conv, output shape: [128 × 64 × 64]</td><td></td></tr><tr><td>ResidualBlock Down, output shape: [256 × 32 × 32]</td><td></td></tr><tr><td>ResidualBlock Down, output shape: [256 × 16 × 16]</td><td></td></tr><tr><td>ResidualBlock Down, output shape: [256 × 8 × 8]</td><td></td></tr><tr><td>ResidualBlock Down, output shape: [128 × 4 × 4] Conv, output shape: [1]]</td><td></td></tr></table>
|
| 676 |
+
|
| 677 |
+
Table 9: Architectures for restoration tasks on CelebA, $6 4 \times 6 4$ .
|
| 678 |
+
|
| 679 |
+
<table><tr><td colspan="2">GO</td></tr><tr><td>Input: x ∈R3×64×64 Conv,BN,LeakyReLU,output shape: [256 × 64 × 64]</td><td></td></tr><tr><td>Conv,LeakyReLU, AvgPool, output shape: [256 × 32 × 32], x1 Conv,LeakyReLU, AvgPool, output shape: [256 × 16 × 16], x2 Conv,LeakyReLU,AvgPool, output shape: [256 × 8 × 8], x3</td><td></td></tr><tr><td>Conv,LeakyReLU, AvgPool, output shape: [256 × 4 × 4], x4 Nearest Neighbour Upsample, Conv, BN, ReLU, output shape: [256 × 8 × 8], y3 Add (y3,x3), output shape: [256 × 8 × 8],y3</td><td></td></tr><tr><td>Nearest Neighbour Upsample, Conv, BN,ReLU,output shape: [256 × 16 × 16], y2 Add (y2,x2),output shape: [256 × 16 × 16],y2</td><td></td></tr><tr><td>Nearest Neighbour Upsample, Conv, BN, ReLU,output shape: [256 × 32 × 32], y1 Add (y1, x1),output shape: [256 × 32 × 32], y1</td><td></td></tr><tr><td>Nearest Neighbour Upsample, Conv, BN, ReLU, output shape: [256 × 64 × 64], y Add (y, x), output shape: [256 × 64 × 64],y</td><td></td></tr></table>
|
| 680 |
+
|
| 681 |
+
$\overline { { \psi ( . ) } }$ Target: y ∈ R3×64×64 Conv, LeakyReLU, AvgPool, output shape: $\left[ 2 5 6 \times 3 2 \times 3 2 \right]$ Conv, LeakyReLU, AvgPool, output shape: $[ 2 5 6 \times 1 6 \times 1 6 ]$ Conv, LeakyReLU, AvgPool, output shape: [256 × 8 × 8] Conv, LeakyReLU, AvgPool, output shape: $[ 2 5 6 \times 4 \times 4 ]$ Linear, output shape: [1]
|
md/dev/6HN7LHyzGgC/6HN7LHyzGgC.md
ADDED
|
@@ -0,0 +1,398 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UNCERTAINTY MODELING FOR OUT-OF-DISTRIBUTION GENERALIZATION
|
| 2 |
+
|
| 3 |
+
Xiaotong $\mathbf { L i } ^ { 1 }$ , Yongxing $\mathbf { D a i } ^ { 1 }$ , Yixiao $\mathbf { G e ^ { 2 } }$ , $\mathbf { J u n L i u ^ { 3 } }$ , Ying Shan2, Ling-Yu Duan1,4∗
|
| 4 |
+
1Peking University, Beijing, China 2ARC Lab, Tencent PCG
|
| 5 |
+
3Singapore University of Technology and Design, Singapore
|
| 6 |
+
4Peng Cheng Laboratory, Shenzhen, China
|
| 7 |
+
lixiaotong@stu.pku.edu.cn, {yongxingdai, lingyu}@pku.edu.cn,
|
| 8 |
+
{yixiaoge, yingsshan}@tencent.com, jun liu@sutd.edu.sg
|
| 9 |
+
|
| 10 |
+
# ABSTRACT
|
| 11 |
+
|
| 12 |
+
Though remarkable progress has been achieved in various vision tasks, deep neural networks still suffer obvious performance degradation when tested in out-ofdistribution scenarios. We argue that the feature statistics (mean and standard deviation), which carry the domain characteristics of the training data, can be properly manipulated to improve the generalization ability of deep learning models. Common methods often consider the feature statistics as deterministic values measured from the learned features and do not explicitly consider the uncertain statistics discrepancy caused by potential domain shifts during testing. In this paper, we improve the network generalization ability by modeling the uncertainty of domain shifts with synthesized feature statistics during training. Specifically, we hypothesize that the feature statistic, after considering the potential uncertainties, follows a multivariate Gaussian distribution. Hence, each feature statistic is no longer a deterministic value, but a probabilistic point with diverse distribution possibilities. With the uncertain feature statistics, the models can be trained to alleviate the domain perturbations and achieve better robustness against potential domain shifts. Our method can be readily integrated into networks without additional parameters. Extensive experiments demonstrate that our proposed method consistently improves the network generalization ability on multiple vision tasks, including image classification, semantic segmentation, and instance retrieval. The code can be available at https://github.com/lixiaotong97/DSU.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
Deep neural networks have shown impressive success in computer vision, but with a severe reliance on the assumption that the training and testing domains follow an independent and identical distribution (Ben-David et al., 2010; Vapnik, 1992). This assumption, however, does not hold in many real-world applications. For instance, when employing segmentation models trained on sunny days for rainy and foggy environments (Choi et al., 2021), or recognizing art paintings with models that trained on photographs (Li et al., 2017), inevitable performance drop can often be observed in such out-of-distribution deployment scenarios. Therefore, the problem of domain generalization, aiming to improve the robustness of the network on various unseen testing domains, becomes quite important.
|
| 17 |
+
|
| 18 |
+
Previous works (Huang & Belongie, 2017; Li et al., 2021) demonstrate that feature statistics (mean and standard deviation), as the moments of the learned features, carry informative domain characteristics of the training data. Domain characteristics primarily refer to the information that is more specific to the individual domains but less relevant to the task objectives, such as the photo style and capturing environment information in object recognition. Consequently, domains with different data distributions generally have inconsistent feature statistics (Wang et al., 2020b; 2019a; Gao et al., 2021a). Most deep learning methods follow Empirical Risk Minimization principle (Vapnik, 1999) to minimize their average error over the training data (Shen et al., 2021). Despite the satisfactory performance on the training domain, these methods do not explicitly consider the uncertain statistics discrepancy caused by potential domain shifts during testing. As a result, the trained models tend to overfit the training domain and show vulnerability to the statistic changes at testing time, substantially limiting the generalization ability of the learned representations.
|
| 19 |
+
|
| 20 |
+

|
| 21 |
+
Figure 1: The visualization of reconstructed samples with synthesized feature statistics, using a pre-trained style transfer auto-encoder (Huang & Belongie, 2017). The illustration of the feature statistics shifts, which may vary in both intensity and direction (i.e., different offsets in the vector space of feature statistics). We also show images of “new” domains generated by manipulating feature statistic shifts with different direction and intensity. Note these images are for visualization only, rather than feeding into the network for training.
|
| 22 |
+
|
| 23 |
+
Intuitively, the test domains may bring uncertain statistics shifts with different potential directions and intensities compared to the training domain (as shown in Figure 1), implying the uncertain nature of domain shifts. Considering such “uncertainty” of potential domain shifts, synthesizing novel feature statistics variants to model diverse domain shifts can improve the robustness of the trained network to different testing distributions. Towards this end, we introduce a novel probabilistic method to improve the network generalization ability by properly modeling Domain Shifts with Uncertainty (DSU), i.e., characterizing the feature statistics as uncertain distributions.
|
| 24 |
+
|
| 25 |
+
In our method, instead of treating each feature statistic as a deterministic point measured from the feature, we hypothesize that the feature statistic, after considering potential uncertainties, follows a multi-variate Gaussian distribution. The distribution “center” is set as each feature’s original statistic value, and the distribution “scope” represents the variant intensity considering underlying domain shifts. Uncertainty estimation is adopted here to depict the distribution “scope” of probabilistic feature statistics. Specifically, we estimate the distribution “scope” based on the variances of the mini-batch statistics in an efficient non-parametric manner. Subsequently, feature statistics variants are randomly sampled from the estimated Gaussian distribution and then used to replace the original deterministic values for modeling diverse domain shifts, as illustrated in Figure 2. Due to the generated feature statistics with diverse distribution possibilities, the models can be trained to properly alleviate the domain perturbations and encode better domain-invariant features.
|
| 26 |
+
|
| 27 |
+
Our proposed method is simple yet fairly effective to alleviate performance drop caused by domain shifts, and can be readily integrated into existing networks without bringing additional model parameters or loss constraints. Comprehensive experiments on a wide range of vision tasks demonstrate the superiority of our proposed method, indicating that introducing uncertainty to feature statistics can well improve models’ generalization against domain shifts.
|
| 28 |
+
|
| 29 |
+
# 2 RELATED WORK
|
| 30 |
+
|
| 31 |
+
# 2.1 DOMAIN GENERALIZATION
|
| 32 |
+
|
| 33 |
+
Domain generalization (DG) has been attracting increasing attention in the past few years, which aims to achieve out-of-distribution generalization on unseen target domains using only single or multiple source domain data for training (Blanchard et al. (2011)). Research on addressing this problem has been extensively conducted in the literature (Zhou et al. (2021a); Wang et al. (2021); Shen et al. (2021)). Here some studies that are more related to our work are introduced below.
|
| 34 |
+
|
| 35 |
+
Data Augmentation: Data augmentation is an effective manner for improving generalization ability and relieving models from overfitting in training domains. Most augmentation methods adopt various transformations at the image level, such as AugMix (Hendrycks et al. (2020)) and CutMix (Yun et al. (2019)). Besides using handcraft transformations, mixup (Zhang et al. (2018)) trains the model by using pair-wise linearly interpolated samples in both the image and label spaces. Manifold Mixup (Verma et al. (2019)) further adopts this linear interpolation from image level to feature level. Some recent works extend the above transformations to feature statistics for improving model generalization. MixStyle (Zhou et al. (2021b)) adopts linear interpolation on feature statistics of two instances to generate synthesized samples. The pAdaIn (Nuriel et al. (2021)) swaps statistics between the samples applied with a random permutation of the batch.
|
| 36 |
+
|
| 37 |
+
Invariant Representation Learning: The main idea of invariant representation learning is to enable models to learn features that are invariant to domain shifts. Domain alignment-based approaches (Li et al. (2018c;b)) learn invariant features by minimizing the distances between different distributions. Instead of enforcing the entire features to be invariant, disentangled feature learning approaches (Chattopadhyay et al. (2020); Piratla et al. (2020)) decouple the features into domain-specific and domain-invariant parts and learn their representations simultaneously. In addition, normalizationbased methods (Pan et al. (2018); Choi et al. (2021)) can also be used to remove the style information to obtain invariant representations.
|
| 38 |
+
|
| 39 |
+
Learning Strategies: There are also some effective learning strategies that can be leveraged to improve generalization ability. Ensemble learning is an effective technique in boosting model performance. The ensemble predictions using a collection of diverse models (Zhou et al. (2020b)) or modules (Seo et al. (2020)) can be adopted to improve generalization and robustness. Metalearning-based methods (Finn et al. (2017); Li et al. (2018a); Dai et al. (2021)) learn to simulate the domain shifts following an episode training paradigm. Besides, self-challenging methods, such as RSC (Huang et al. (2020)), force the model to learn a general representation by discarding dominant features activated on the training data.
|
| 40 |
+
|
| 41 |
+
# 2.2 UNCERTAINTY IN DEEP LEARNING
|
| 42 |
+
|
| 43 |
+
Uncertainty capturing the “noise” and “randomness” inherent in the data has received increasing attention in deep representation learning. Variational Auto-encoder (Kingma & Welling (2013)), as an important method for learning generative models, can be regarded as a method to model the data uncertainty in the hidden space. Dropout (Srivastava et al. (2014)), which is widely used in many deep learning models to avoid over-fitting, can be interpreted to represent model uncertainty as a Bayesian approximation (Gal & Ghahramani (2016)). In some works, uncertainty is used to address the issues of low-quality training data. In person re-identification, DistributionNet (Gal & Ghahramani (2016)) adopts uncertainty to model the person images of noise-labels and outliers. In face recognition, DUL (Chang et al. (2020)) and PFE ((Shi & Jain, 2019)) apply data uncertainty to simultaneously learn the feature embedding and its uncertainty, where the uncertainty is learned through a learnable subnetwork to describe the quality of the image. Different from the aforementioned works, our proposed method is used to model the feature statistics uncertainty under potential domain shifts and acts as a feature augmentation method for handling our-of-distribution generalization problem.
|
| 44 |
+
|
| 45 |
+
# 3 METHOD
|
| 46 |
+
|
| 47 |
+
# 3.1 PRELIMINARIES
|
| 48 |
+
|
| 49 |
+
Given $x \in \mathbb { R } ^ { B \times C \times H \times W }$ to be the encoded features in the intermediate layers of the network, we denote $\mu \in \mathbb { R } ^ { B \times C }$ and $\sigma \in \mathbb { R } ^ { B \times C }$ as the channel-wise feature mean and standard deviation of each instance in a mini-batch, respectively, which can be formulated as:
|
| 50 |
+
|
| 51 |
+
$$
|
| 52 |
+
\begin{array} { l } { \displaystyle \mu ( x ) = \frac { 1 } { H W } \sum _ { h = 1 } ^ { H } \sum _ { w = 1 } ^ { W } { x _ { b , c , h , w } } , } \\ { \displaystyle \sigma ^ { 2 } ( x ) = \frac { 1 } { H W } \sum _ { h = 1 } ^ { H } \sum _ { w = 1 } ^ { W } ( { x _ { b , c , h , w } - \mu ( x ) } ) ^ { 2 } . } \end{array}
|
| 53 |
+
$$
|
| 54 |
+
|
| 55 |
+

|
| 56 |
+
Figure 2: Illustration of the proposed method. Feature statistic is assumed to follow a multi-variate Gaussian distribution during training. When passed through this module, the new feature statistics randomly drawn from the corresponding distribution will replace the original ones to model the diverse domain shifts.
|
| 57 |
+
|
| 58 |
+
As the abstraction of features, feature statistics can capture informative characteristics of the corresponding domain (such as color, texture, and contrast), according to previous works (Huang & Belongie, 2017; Li et al., 2021). In out-of-distribution scenarios, the feature statistics often show inconsistency with training domain due to different domain characteristics (Wang et al., $2 0 1 9 \mathrm { a }$ ; Gao et al., 2021a), which is ill-suited to deep learning modules like nonlinearity layers and normalization layer and degenerates the model’s generalization ability (Wang et al., 2020b). However, most of the deep learning methods only treat feature statistics as deterministic values measured from the features while lacking explicit consideration of the potential uncertain statistical discrepancy. Owing to the model’s inherent vulnerability to such discrepancy, the generalization ability of the learned representations is limited. Some recent methods (Nuriel et al., 2021; Zhou et al., 2021b) utilize feature statistics to tackle the domain generalization problem. Despite the success, they typically adopt linear manipulation (i.e., exchange and interpolation) on pairwise samples to generate new feature statistics, which limits the diversity of synthetic changes. Specifically, the direction of their variants is determined by the chosen reference sample and such internal operation restricts their variant intensity. Thus these methods are sub-optimal when handling the diverse and uncertain domain shifts in real world.
|
| 59 |
+
|
| 60 |
+
# 3.2 MODELING DOMAIN SHIFTS WITH UNCERTAINTY
|
| 61 |
+
|
| 62 |
+
Given the arbitrary testing domains with uncertain feature statistic shifts in both direction and intensity, properly modeling the domain shifts becomes an important task for tackling the challenge of domain generalization problem.
|
| 63 |
+
|
| 64 |
+
Considering the uncertainty and randomness of domain shifts, it is promising to employ the methods of “uncertainty” to treat the “uncertainty” of domain shifts. In this paper, we propose a novel method by modeling Domain Shifts with Uncertainty (DSU). Instead of treating each feature statistic as a deterministic value measured from the learned feature, we hypothesize that the distribution of each feature statistic, after considering potential uncertainties, follows a multi-variate Gaussian distribution. This means each feature statistic has a probabilistic representation drawn from a certain distribution, i.e., the feature statistics mean and standard deviation follow $\mathcal { N } ( \mu , \Sigma _ { \mu } ^ { 2 } )$ and $\textstyle \mathcal { N } ( \sigma , \Sigma _ { \sigma } ^ { 2 } )$ , respectively. Specifically, the corresponding Gaussian distribution’s center is set as each feature’s original statistics, while the Gaussian distribution’s standard deviation describes the uncertainty scope for different potential shifts. Through randomly sampling diverse synthesized feature statistics with the probabilistic approach, the models can be trained to improve the robustness of the network against statistics shifts.
|
| 65 |
+
|
| 66 |
+
# 3.2.1 UNCERTAINTY ESTIMATION
|
| 67 |
+
|
| 68 |
+
Taking the uncertainty of domain shifts into consideration, the uncertainty estimation in our method aims to depict the uncertainty scope of each probabilistic feature statistic. However, the testing domain is unknown, which makes it challenging to obtain an appropriate variant range.
|
| 69 |
+
|
| 70 |
+
Some generative-based studies (Shen & Zhou, 2021; Wang et al., 2019b) show that the variances between features contain implicit semantic meaning and the directions with larger variances can imply potentials of more valuable semantic changes. Inspired by this, we propose a simple yet effective non-parametric method for uncertainty estimation, utilizing the variance of the feature statistics to provide some instructions:
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
\begin{array} { l } { { \Sigma _ { \mu } ^ { 2 } ( x ) = \displaystyle \frac { 1 } { B } \sum _ { b = 1 } ^ { B } ( \mu ( x ) - \mathbb { E } _ { b } [ \mu ( x ) ] ) ^ { 2 } , } } \\ { { \Sigma _ { \sigma } ^ { 2 } ( x ) = \displaystyle \frac { 1 } { B } \sum _ { b = 1 } ^ { B } ( \sigma ( x ) - \mathbb { E } _ { b } [ \sigma ( x ) ] ) ^ { 2 } . } } \end{array}
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
where $\Sigma _ { \mu } \in \mathbb { R } ^ { C }$ and $\Sigma _ { \sigma } \in \mathbb { R } ^ { C }$ represent the uncertainty estimation of the feature mean $\mu$ and feature standard deviation $\sigma$ , respectively. The magnitudes of uncertainty estimation can reveal the possibility that the corresponding channel may change potentially. Although the underlying distribution of the domain shifts is unpredictable, the uncertainty estimation captured from the minibatch can provide an appropriate and meaningful variation range for each feature channel, which does not harm model training but can simulate diverse potential shifts.
|
| 77 |
+
|
| 78 |
+
# 3.2.2 PROBABILISTIC DISTRIBUTION OF FEATURE STATISTICS
|
| 79 |
+
|
| 80 |
+
Once the uncertainty estimation of each feature channel is obtained, the Gaussian distribution for probabilistic feature statistics can be established. To use randomness to model the uncertainty, we adopt the random sampling to further exploit the uncertainty in the probabilistic representations. The new feature statistics, mean $\beta ( x ) \sim { \mathrm { \bar { \mathcal { N } } } } ( \mu , \Sigma _ { \mu } ^ { 2 } )$ and standard deviation $\gamma ( x ) \sim \bar { \mathcal { N } } ( \sigma , \Sigma _ { \sigma } ^ { 2 } )$ , can be randomly drawn from the corresponding distributions as:
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
\begin{array} { l l } { { \beta ( x ) = \mu ( x ) + \epsilon _ { \mu } \Sigma _ { \mu } ( x ) , } } & { { \epsilon _ { \mu } \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { 1 } ) , } } \\ { { } } & { { } } \\ { { \gamma ( x ) = \sigma ( x ) + \epsilon _ { \sigma } \Sigma _ { \sigma } ( x ) , } } & { { \epsilon _ { \sigma } \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { 1 } ) . } } \end{array}
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
Here we use the re-parameterization trick (Kingma & Welling (2013)) to make the sampling operation differentiable, and $\epsilon _ { \mu }$ and $\epsilon _ { \sigma }$ both follow the standard Gaussian distribution. By exploiting the given Gaussian distribution, random sampling can generate various new feature statistics information with different combinations of directions and intensities.
|
| 87 |
+
|
| 88 |
+
# 3.2.3 IMPLEMENTATION
|
| 89 |
+
|
| 90 |
+
The implementation of our method is by the means of AdaIN (Huang & Belongie (2017)), and replaces the feature statistics with the randomly drawing ones to achieve the transformation. The final form of the proposed method can be formulated as:
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\begin{array} { r } { \mathrm { D S U } ( x ) = \underbrace { \left( \sigma ( x ) + \epsilon _ { \sigma } \Sigma _ { \sigma } ( x ) \right) } _ { \gamma ( x ) } \left( \frac { x - \mu ( x ) } { \sigma ( x ) } \right) + \underbrace { \left( \mu ( x ) + \epsilon _ { \mu } \Sigma _ { \mu } ( x ) \right) } _ { \beta ( x ) } . } \end{array}
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
The above operation can be integrated at various positions of the network as a flexible module. Note that the module only works during model training and can be discarded while testing. To trade off the strength of this module, we set a hyperparameter $p$ that denotes the probability to apply it. The algorithm is described in the Appendix. Benefiting from the proposed method, the model trained with uncertain feature statistics will gain better robustness against potential statistics shifts, and thus acquires a better generalization ability.
|
| 97 |
+
|
| 98 |
+
# 4 EXPERIMENTS
|
| 99 |
+
|
| 100 |
+
In order to verify the effectiveness of the proposed method in improving the generalization ability of networks, we conduct the experiments on a wide range of tasks, including image classification, semantic segmentation, instance retrieval, and robustness towards corruptions, where the training and testing sets have different cases of distribution shifts, such as style shift, synthetic-to-real gap, scenes change, and pixel-level corruption.
|
| 101 |
+
|
| 102 |
+
# 4.1 GENERALIZATION ON MULTI-DOMAIN CLASSIFICATION
|
| 103 |
+
|
| 104 |
+
Setup and Implementation Details: We evaluate the proposed method on PACS (Li et al. (2017)), a widely-used benchmark for domain generalization with four different styles: Art Painting, Cartoon, Photo, and Sketch. The implementation follows the official setup of MixStyle (Zhou et al. (2021b)) with a leave-one-domain-out protocol and ResNet18 (He et al., 2016) is used as the backbone. The random shuffle version of MixStyle is adopted for fair comparisons, which does not use domain labels. In addition to PACS, we also employ Office-Home (Venkateswara et al., 2017) for multidomain generalization experiments in the Appendix.
|
| 105 |
+
|
| 106 |
+
Experiment Results: The experiments results, shown in Table 1, demonstrate our significant improvement over the baseline method, which shows our superiority to the conventional deterministic approach. Especially in Art and Sketch, our method has nearly $10 \%$ improvement in average accuracy. Furthermore, our method also outperforms the competing methods, which indicates our method that models diverse uncertain shifts on feature statistics is effective to improve network generalization ability against different domain shifts. Photo has similiar domain characteristics as ImageNet dataset and the slight drop might be due to the ImageNet pretraining (also discussed in (Xu et al., 2021)). Our DSU augments the features and enlarges the diversity of the training domains. In contrast, the baseline method preserves more pre-trained knowledge from ImageNet thus tends to overfit the Photo style dataset benefiting from pretraining.
|
| 107 |
+
|
| 108 |
+
Table 1: Experiment results of PACS multi-domain classification task. ${ \mathrm { R S C } } ^ { * }$ denotes the reproduced results from pAdaIN (Nuriel et al., 2021).
|
| 109 |
+
|
| 110 |
+
<table><tr><td>Method</td><td>Reference</td><td>Art</td><td>Cartoon</td><td>Photo</td><td>Sketch</td><td>Average (%)</td></tr><tr><td>Baseline</td><td>=</td><td>74.3</td><td>76.7</td><td>96.4</td><td>68.7</td><td>79.0</td></tr><tr><td>Mixup (Zhang et al., 2018)</td><td>ICLR 2018</td><td>76.8</td><td>74.9</td><td>95.8</td><td>66.6</td><td>78.5</td></tr><tr><td>Manifold Mixup (Verma et al.,2019)</td><td>ICML 2019</td><td>75.6</td><td>70.1</td><td>93.5</td><td>65.4</td><td>76.2</td></tr><tr><td>CutMix (Yun et al., 2019)</td><td>ICCV 2019</td><td>74.6</td><td>71.8</td><td>95.6</td><td>65.3</td><td>76.8</td></tr><tr><td>RSC*(Huang et al.,2020)</td><td>ECCV 2020</td><td>78.9</td><td>76.9</td><td>94.1</td><td>76.8</td><td>81.7</td></tr><tr><td>L2A-OT (Zhou et al., 2020a)</td><td>ECCV 2020</td><td>83.3</td><td>78.2</td><td>96.2</td><td>73.6</td><td>82.8</td></tr><tr><td>SagNet (Nam et al., 2021)</td><td>CVPR 2021</td><td>83.6</td><td>77.7</td><td>95.5</td><td>76.3</td><td>83.3</td></tr><tr><td>pAdaIN (Nuriel et al., 2021)</td><td>CVPR 2021</td><td>81.7</td><td>76.6</td><td>96.3</td><td>75.1</td><td>82.5</td></tr><tr><td>MixStyle (Zhou et al., 2021b)</td><td>ICLR 2021</td><td>82.3</td><td>79.0</td><td>96.3</td><td>73.8</td><td>82.8</td></tr><tr><td>DSU</td><td>Ours</td><td>83.6</td><td>79.6</td><td>95.8</td><td>77.6</td><td>84.1</td></tr></table>
|
| 111 |
+
|
| 112 |
+
# 4.2 GENERALIZATION ON SEMANTIC SEGMENTATION
|
| 113 |
+
|
| 114 |
+
Setup and Implementation Details: Semantic segmentation, as a fundamental application for automatic driving, encounters severe performance declines due to scenarios differences (Wang et al., 2020a). GTA5 (Richter et al., 2016) is a synthetic dataset generated from Grand Theft Auto 5 game engine, while Cityscapes (Cordts et al., 2016) is a real-world dataset collected from different cities in primarily Germany. To evaluate the cross-scenario generalization ability of segmentation models, we adopt synthetic GTA5 for training while using real CityScapes for testing. The experiments are conducted on FADA released codes (Wang et al. (2020a)), using DeepLab-v2 (Chen et al., 2018) segmentation network with ResNet101 backbone. Mean Intersection over Union (mIOU) and mean Accuracy (mAcc) of all object categories are used for evaluation.
|
| 115 |
+
|
| 116 |
+
Table 2: Experiment results of semantic segmentation from synthetic GAT5 to real Cityscapes.
|
| 117 |
+
|
| 118 |
+
<table><tr><td>Method</td><td>Reference</td><td>mIOU (%)</td><td>mAcc (%)</td></tr><tr><td>Baseline</td><td>-</td><td>37.0</td><td>51.5</td></tr><tr><td>pAdaIN (Nuriel et al., 2021)</td><td>CVPR 2021</td><td>38.3</td><td>52.1</td></tr><tr><td>Mixstyle (Zhou et al., 2021b)</td><td>ICLR 2021</td><td>40.3</td><td>53.8</td></tr><tr><td>DSU</td><td>Ours</td><td>43.1</td><td>57.0</td></tr></table>
|
| 119 |
+
|
| 120 |
+
Experiment Results: Table 2 shows the experiment results compared to related methods. As for a pixel-level classification task, improper changes of feature statistics might constrain the performances. The variants generated from our method are centered on the original feature statistics with different perturbations. These changes of feature statistics are mild for preserving the detailed information in these dense tasks. Meanwhile, our method can take full use of the diverse driving scenes and generates diverse variants, thus show a significant improvement on mIOU and mAc by $6 . 1 \%$ and $5 . 5 \%$ , respectively. The visualization result is shown in Figure 3.
|
| 121 |
+
|
| 122 |
+

|
| 123 |
+
|
| 124 |
+
Figure 3: The visualization on unseen domain Cityscapes with the model trained on synthetic GTA5.
|
| 125 |
+
|
| 126 |
+
# 4.3 GENERALIZATION ON INSTANCE RETRIEVAL
|
| 127 |
+
|
| 128 |
+
Setup and Implementation Details: In this section, person re-identification (ReID), which aims at matching the same person across disjoint camera views, is used to verify the effectiveness of our method on the instance retrieval task. Experiments are conducted on the widely used DukeMTMC (Ristani et al. (2016)) and Market1501 (Zheng et al. (2015)) datasets. The implementation is based on MMT (Ge et al., 2020) released codes and ResNet50 is adopted as the backbone. Meanwhile, mean Average Precision (mAP) and Rank-1 (R1) precision are used as the evaluation criterions.
|
| 129 |
+
|
| 130 |
+
Table 3: Experiment results of instance retrieval on ReID dataset DukeMTMC and Market1501. A $ \mathbf { B }$ denotes models are trained on A while evaluated on B. For fair comparisons, we reproduce the experiments under the same framework.
|
| 131 |
+
|
| 132 |
+
<table><tr><td>Method</td><td>Reference</td><td>Market → Duke mAP (%) R1 (%)</td><td>mAP (%)</td><td>Duke-→Market R1 (%)</td></tr><tr><td>Baseline</td><td>1</td><td>25.8</td><td>42.3 46.1</td><td>26.7</td></tr><tr><td>pAdaIN (Nuriel et al., 2021)</td><td>CVPR 2021</td><td>28.0</td><td>27.9</td><td>54.7 56.1</td></tr><tr><td>MixStyle (Zhou et al.,2021b)</td><td>ICLR 2021</td><td>28.2</td><td>28.1</td><td>56.6</td></tr><tr><td>DSU</td><td>Ours</td><td>32.0</td><td>46.7 52.0 32.4</td><td>63.7</td></tr></table>
|
| 133 |
+
|
| 134 |
+
Experiment Results: ReID is a fine-grained instance retrieval task, where the subtle information of persons is important for retrieving an instance. MixStyle and pAdain rely on a reference sample to generate new feature statistics, which might introduce confounded information from the reference sample. Compared to them, our method does better in maintaining the original information and also has more variant possibilities. The experiment results are demonstrated in Table 3. Our method achieves huge improvement compared to the baseline method and also outperform MixStyle and pAdaIN by a big margin.
|
| 135 |
+
|
| 136 |
+
# 4.4 ROBUSTNESS TOWARDS CORRUPTIONS
|
| 137 |
+
|
| 138 |
+
Setup and Implementation Details: We validate the proposed method for robustness towards corruptions on ImageNet-C (Hendrycks & Dietterich (2019)), which contains 15 different pixel-level corruptions. ResNet50 is trained with 100 epochs for convergence on large-scale ImageNet-1K (Deng et al. (2009)) and the hyperparameter $p$ is set as 0.1 for training in ImageNet. We also add our method on APR (Chen et al. (2021)), a recently state-of-the-art method on ImageNet-C, to verify that our method can be compatible with other image-level augmentation methods. Error is adopted as the evalution metric for clean ImageNet. Mean Corruption Error (mCE) is adopted as evaluation metric for ImageNet-C, which is computed as the average of the 15 different corruption errors and normalized by the corruption error of AlexNet (Krizhevsky et al. (2012)).
|
| 139 |
+
|
| 140 |
+
Experiment Results: Although the corruptions are imposed on the pixel level, they still introduce a shift in the statistics (Benz et al., 2021). So our method shows consistent improvement on ImageNetC. Meanwhile, the instances in the testing set may not always fall into the distribution of the training set, and they still have slight statistic shifts (Gao et al. (2021b)). Thus it can be seen that the withindataset ImageNet accuracy is also increased. When combining APR with our method, mCE can be decreased from $6 5 . 0 \%$ to $6 4 . 1 \%$ , showing that our method can be compatible with state-of-the-art methods on ImageNet-C for further improvement.
|
| 141 |
+
|
| 142 |
+
Table 4: Experiment results of clean image classification on ImageNet, and the robustness toward corruptions on ImageNet-C.
|
| 143 |
+
|
| 144 |
+
<table><tr><td></td><td>Clean(↓)</td><td>Corrupted (↓)</td><td></td><td>Noise</td><td>Implulse</td><td></td><td>Blur</td><td></td><td></td><td></td><td>Weather</td><td></td><td></td><td></td><td>Digital</td><td></td><td></td></tr><tr><td></td><td>Error (%)</td><td>mCE(%)</td><td>Gauss</td><td>Shot</td><td></td><td>Defocus</td><td>Glass</td><td>Motion</td><td>Zoom</td><td>Snow</td><td>Frost</td><td>Fog</td><td>Bright</td><td>Contrast</td><td>Elastic</td><td>Pixel</td><td>JPEG</td></tr><tr><td>Baseline</td><td>23.8</td><td>76.2</td><td></td><td>81</td><td></td><td></td><td>87</td><td>76</td><td>80</td><td>78</td><td>74</td><td>67</td><td></td><td>70</td><td>83</td><td>76</td><td>73</td></tr><tr><td>DSU</td><td>23.4</td><td>73.4</td><td>6</td><td>77</td><td>5</td><td>五</td><td>83</td><td>77</td><td>79</td><td>74</td><td>71</td><td>66</td><td>5</td><td>68</td><td>82</td><td>65</td><td>71</td></tr><tr><td>APR</td><td>24.0</td><td>65.0</td><td>5</td><td></td><td>50</td><td>69</td><td>85</td><td>69</td><td>79</td><td>62</td><td>64</td><td>55</td><td>54</td><td>63</td><td>84</td><td>65</td><td>65</td></tr><tr><td>APR+DSU</td><td>23.7</td><td>64.1</td><td></td><td>56</td><td>49</td><td>69</td><td>84</td><td>67</td><td>78</td><td>61</td><td>63</td><td>51</td><td>53</td><td>56</td><td>83</td><td>66</td><td>65</td></tr></table>
|
| 145 |
+
|
| 146 |
+
# 5 ABLATION STUDY
|
| 147 |
+
|
| 148 |
+
In this section, we perform an extensive ablation study of the proposed method on PACS and segmentation task (GTA5 to Cityscapes) with models trained on ResNet. The effects of different inserted positions and hyper-parameter of the proposed method are analyzed below. Meantime, we also analyze the effects on different choices of uncertainty distribution.
|
| 149 |
+
|
| 150 |
+
Effects of Different Inserted Positions: DSU can be a plugand-play module to be readily inserted at any position. Here we name the positions of ResNet after first Conv, Max Pooling
|
| 151 |
+
|
| 152 |
+
Table 5: Effects of different inserted positions.
|
| 153 |
+
|
| 154 |
+
<table><tr><td>Inserted Positions</td><td>Baseline</td><td>0-3</td><td>1-4</td><td>2-5</td><td>0-5</td></tr><tr><td>PACS</td><td>79.0</td><td>82.2</td><td>83.1</td><td>83.5</td><td>84.1</td></tr><tr><td> GTA5 to Cityscapes</td><td>37.0</td><td>41.1</td><td>40.9</td><td>42.1</td><td>43.1</td></tr></table>
|
| 155 |
+
|
| 156 |
+
layer, 1,2,3,4-th ConvBlock as 0,1,2,3,4,5 respectively. As shown in Table 5, no matter where the modules are inserted, the performances are consistently higher than the baseline method. The results show that inserting the modules at positions 0-5 would have better performances, which also indicates modeling the uncertainty in all training stages will have better effects. Based on the analysis, we plug the module into positions 0-5 in all experiments.
|
| 157 |
+
|
| 158 |
+
Effects of Hyper-parameter: The hyper-parameter of the probability $p$ is to trade off the strength of feature statistics augmentation. As shown in Figure 4, the results are not sensitive to the probability setting and the accuracy reaches the best results when setting $p$ as 0.5, which is also adopted as the default setting in all experiments if not specified.
|
| 159 |
+
|
| 160 |
+
Choices of Uncertainty Distribution: In our method, the Gaussian distribution with uncertainty estimation is adopted as the default setting, we also conduct other distributions for comparisons in Table 6. Specifically, Random denotes directly adding random shifts draw from a fixed Gaussian $\mathcal { N } ( 0 , 1 )$ , and Uniform denotes that the shifts are drawn from $\mathrm { U } ( - \Sigma , \Sigma )$ , where $\Sigma$ is the scope obtained from our uncertainty estimation. As we can see, directly using Gaussian distribution with the improper variant scope will harm the model performances, indicating the variant range of feature statistics should have some instructions. Further analysis about different vanilla Gaussian distributions with pre-defined standard deviation are conducted in the Appendix. Meanwhile, the result of Uniform shows some improvement but is still lower than DSU, which indicates the boundless Gaussian distribution is more helpful to model more diverse variants.
|
| 161 |
+
|
| 162 |
+

|
| 163 |
+
Figure 4: The effects on the hyperparameter probability.
|
| 164 |
+
|
| 165 |
+
Table 6: Different choices of distribution for uncertainty.
|
| 166 |
+
|
| 167 |
+
<table><tr><td>Choice</td><td>Baseline</td><td>Random</td><td>Uniform</td><td>DSU</td></tr><tr><td>PACS</td><td>79.0</td><td>76.9</td><td>81.9</td><td>84.1</td></tr><tr><td>GTA5 to Cityscapes</td><td>37.0</td><td>38.2</td><td>41.6</td><td>43.1</td></tr></table>
|
| 168 |
+
|
| 169 |
+
# 6 FURTHER ANALYSIS
|
| 170 |
+
|
| 171 |
+
# 6.1 QUANTITATIVE ANALYSIS ON THE PROPOSED METHOD
|
| 172 |
+
|
| 173 |
+
In this subsection, we will analyze the effects of the proposed method on both intermediate features and feature representations. Quantitative experiments are conducted on PACS, where we choose Art Painting as the unseen testing domain and the rests are used as training domains.
|
| 174 |
+
|
| 175 |
+
To study the phenomena of feature statistic shifts, we capture the intermediate features after the second block in ResNet18 and measure the average feature statistics values of one category in the training and testing domain, respectively. The distributions of feature statistics are shown in Figure 5. As the previous works (Wang et al., 2020b; 2019a) show, the feature statistics extracted from the baseline model show an obvious shift due to different data distribution. It can be seen that the model trained with our method has less shift. Our method can help the model gain robustness towards domain shifts, as it properly models the potential feature statistic shifts.
|
| 176 |
+
|
| 177 |
+

|
| 178 |
+
Figure 5: Quantitative analysis on the shifts of feature statistics (mean and standard deviation) between training source domains and unseen testing domain.
|
| 179 |
+
|
| 180 |
+
# 6.2 VISUALIZATION ON THE SYNTHETIC CHANGES
|
| 181 |
+
|
| 182 |
+
Besides the quantitative experiment results, we also obtain a more intuitional view of the diverse changes provided by our method, through visualizing the reconstruction results using a predefined autoencoder1 (Huang & Belongie (2017)), where the proposed module is inserted into the encoder, and inverse the feature representations into synthetic images after the decoder. As the results shown in Figure 6, the reconstructed images obtained from our probabilistic approach show diverse synthetic changes, such as the environment, object texture, and contrast, etc.
|
| 183 |
+
|
| 184 |
+

|
| 185 |
+
Figure 6: The visualization on diverse synthetic changes obtained from our method.
|
| 186 |
+
|
| 187 |
+
# 7 CONCLUSIONS
|
| 188 |
+
|
| 189 |
+
In this paper, we propose a probabilistic approach to improve the network generalization ability by modeling the uncertainty of domain shifts with synthesized feature statistics during training. Each feature statistic is hypothesized to follow a multi-variate Gaussian distribution for modeling the diverse potential shifts. Due to the generated feature statistics with diverse distribution possibilities, the models can gain better robustness towards diverse domain shifts. Experiment results demonstrate the effectiveness of our method in improving the network generalization ability.
|
| 190 |
+
|
| 191 |
+
# ACKNOWLEDGEMENT
|
| 192 |
+
|
| 193 |
+
This work was supported by the National Natural Science Foundation of China under Grant 62088102, and in part by the PKU-NTU Joint Research Institute (JRI) sponsored by a donation from the $\mathrm { N g }$ Teng Fong Charitable Foundation.
|
| 194 |
+
|
| 195 |
+
# REFERENCES
|
| 196 |
+
|
| 197 |
+
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):151–175, 2010.
|
| 198 |
+
|
| 199 |
+
Philipp Benz, Chaoning Zhang, Adil Karjauv, and In So Kweon. Revisiting batch normalization for improving corruption robustness. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), pp. 494–503, 2021.
|
| 200 |
+
|
| 201 |
+
Gilles Blanchard, Gyemin Lee, and Clayton Scott. Generalizing from several related classification tasks to a new unlabeled sample. In Advances in Neural Information Processing Systems, 2011.
|
| 202 |
+
|
| 203 |
+
Jie Chang, Zhonghao Lan, Changmao Cheng, and Yichen Wei. Data uncertainty learning in face recognition. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5710–5719, 2020.
|
| 204 |
+
|
| 205 |
+
Prithvijit Chattopadhyay, Yogesh Balaji, and Judy Hoffman. Learning to balance specificity and invariance for in and out of domain generalization. In European Conference in Computer Vision (ECCV), 2020.
|
| 206 |
+
|
| 207 |
+
Guangyao Chen, Peixi Peng, Li Ma, Jia Li, Lin Du, and Yonghong Tian. Amplitude-phase recombination: Rethinking robustness of convolutional neural networks in frequency domain. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), 2021.
|
| 208 |
+
|
| 209 |
+
Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L. Yuille. Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs. IEEE Transactions on Pattern Analysis and Machine Intelligence, 40(4): 834–848, 2018.
|
| 210 |
+
|
| 211 |
+
Sungha Choi, Sanghun Jung, Huiwon Yun, Joanne T. Kim, Seungryong Kim, and Jaegul Choo. Robustnet: Improving domain generalization in urban-scene segmentation via instance selective whitening. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 11580–11590, 2021.
|
| 212 |
+
|
| 213 |
+
Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The cityscapes dataset for semantic urban scene understanding. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
|
| 214 |
+
|
| 215 |
+
Yongxing Dai, Xiaotong Li, Jun Liu, Zekun Tong, and Ling-Yu Duan. Generalizable person reidentification with relevance-aware mixture of experts. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 16145–16154, June 2021.
|
| 216 |
+
|
| 217 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255, 2009.
|
| 218 |
+
|
| 219 |
+
Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In Proceedings of the 34th International Conference on Machine Learning, pp. 1126–1135, 2017.
|
| 220 |
+
|
| 221 |
+
Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In Proceedings of The 33rd International Conference on Machine Learning, volume 48, pp. 1050–1059, 2016.
|
| 222 |
+
|
| 223 |
+
Shang-Hua Gao, Qi Han, Duo Li, Ming-Ming Cheng, and Pai Peng. Representative batch normalization with feature calibration. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 8669–8679, 2021a.
|
| 224 |
+
|
| 225 |
+
Shang-Hua Gao, Qi Han, Duo Li, Pai Peng, Ming-Ming Cheng, and Pai Peng. Representative batch normalization with feature calibration. 2021b.
|
| 226 |
+
|
| 227 |
+
Yixiao Ge, Dapeng Chen, and Hongsheng Li. Mutual mean-teaching: Pseudo label refinery for unsupervised domain adaptation on person re-identification. In International Conference on Learning Representations, 2020.
|
| 228 |
+
|
| 229 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
|
| 230 |
+
|
| 231 |
+
Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. International Conference on Learning Representations, 2019.
|
| 232 |
+
|
| 233 |
+
Dan Hendrycks, Norman Mu, Ekin Dogus Cubuk, Barret Zoph, Justin Gilmer, and Balaji Lakshminarayanan. Augmix: A simple method to improve robustness and uncertainty under data shift. In International Conference on Learning Representations, 2020.
|
| 234 |
+
|
| 235 |
+
X. Huang and S. Belongie. Arbitrary style transfer in real-time with adaptive instance normalization. In 2017 IEEE International Conference on Computer Vision (ICCV), pp. 1510–1519, 2017.
|
| 236 |
+
|
| 237 |
+
Zeyi Huang, Haohan Wang, Eric P. Xing, and Dong Huang. Self-challenging improves cross-domain generalization. In The European Conference on Computer Vision (ECCV), pp. 124–140, 2020.
|
| 238 |
+
|
| 239 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
|
| 240 |
+
|
| 241 |
+
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25:1097–1105, 2012.
|
| 242 |
+
|
| 243 |
+
Boyi Li, Felix Wu, Ser-Nam Lim, Serge Belongie, and Kilian Q Weinberger. On feature normalization and data augmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 12383–12392, 2021.
|
| 244 |
+
|
| 245 |
+
Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy M. Hospedales. Deeper, broader and artier domain generalization. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), 2017.
|
| 246 |
+
|
| 247 |
+
Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy Hospedales. Learning to generalize: Meta-learning for domain generalization. In Proceedings of the AAAI Conference on Artificial Intelligence, 2018a.
|
| 248 |
+
|
| 249 |
+
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 (CVPR), pp. 5400–5409, 2018b.
|
| 250 |
+
|
| 251 |
+
Ya Li, Xinmei Tian, Mingming Gong, Yajing Liu, Tongliang Liu, Kun Zhang, and Dacheng Tao. Deep domain generalization via conditional invariant adversarial networks. In Proceedings of the European Conference on Computer Vision (ECCV), 2018c.
|
| 252 |
+
|
| 253 |
+
Hyeonseob Nam, HyunJae Lee, Jongchan Park, Wonjun Yoon, and Donggeun Yoo. Reducing domain gap by reducing style bias. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 8690–8699, 2021.
|
| 254 |
+
|
| 255 |
+
Oren Nuriel, Sagie Benaim, and Lior Wolf. Permuted adain: Reducing the bias towards global statistics in image classification. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 9482–9491, 2021.
|
| 256 |
+
|
| 257 |
+
Xingang Pan, Ping Luo, Jianping Shi, and Xiaoou Tang. Two at once: Enhancing learning and generalization capacities via ibn-net. In Proceedings of the European Conference on Computer Vision (ECCV), 2018.
|
| 258 |
+
|
| 259 |
+
Vihari Piratla, Praneeth Netrapalli, and Sunita Sarawagi. Efficient domain generalization via common-specific low-rank decomposition. In Proceedings of the 37th International Conference on Machine Learning, volume 119, pp. 7728–7738, 2020.
|
| 260 |
+
|
| 261 |
+
Stephan R. Richter, Vibhav Vineet, Stefan Roth, and Vladlen Koltun. Playing for data: Ground truth from computer games. In European Conference on Computer Vision (ECCV), pp. 102–118, 2016.
|
| 262 |
+
|
| 263 |
+
Ergys Ristani, Francesco Solera, Roger S. Zou, R. Cucchiara, and Carlo Tomasi. Performance measures and a data set for multi-target, multi-camera tracking. In ECCV Workshops, 2016.
|
| 264 |
+
|
| 265 |
+
Seonguk Seo, Yumin Suh, Dongwan Kim, Geeho Kim, Jongwoo Han, and Bohyung Han. Learning to optimize domain specific normalization for domain generalization. In The European Conference on Computer Vision (ECCV), pp. 68–83, 2020.
|
| 266 |
+
|
| 267 |
+
Shiv Shankar, Vihari Piratla, Soumen Chakrabarti, Siddhartha Chaudhuri, Preethi Jyothi, and Sunita Sarawagi. Generalizing across domains via cross-gradient training. In International Conference on Learning Representations, 2018.
|
| 268 |
+
|
| 269 |
+
Yujun Shen and Bolei Zhou. Closed-form factorization of latent semantics in gans. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 270 |
+
|
| 271 |
+
Zheyan Shen, Jiashuo Liu, Yue He, Xingxuan Zhang, Renzhe Xu, Han Yu, and Peng Cui. Towards out-of-distribution generalization: A survey. arXiv preprint arXiv:2108.13624, 2021.
|
| 272 |
+
|
| 273 |
+
Yichun Shi and Anil K. Jain. Probabilistic face embeddings. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), 2019.
|
| 274 |
+
|
| 275 |
+
Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(56):1929–1958, 2014.
|
| 276 |
+
|
| 277 |
+
Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(11), 2008.
|
| 278 |
+
|
| 279 |
+
V. Vapnik. Principles of risk minimization for learning theory. In Advances in Neural Information Processing Systems, volume 4, 1992.
|
| 280 |
+
|
| 281 |
+
Vladimir N Vapnik. An overview of statistical learning theory. IEEE transactions on neural networks, 10(5):988–999, 1999.
|
| 282 |
+
|
| 283 |
+
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 (CVPR), July 2017.
|
| 284 |
+
|
| 285 |
+
Vikas Verma, Alex Lamb, Christopher Beckham, Amir Najafi, Ioannis Mitliagkas, David LopezPaz, and Yoshua Bengio. Manifold mixup: Better representations by interpolating hidden states. In Proceedings of the 36th International Conference on Machine Learning, volume 97, pp. 6438– 6447, 2019.
|
| 286 |
+
|
| 287 |
+
Haoran Wang, Tong Shen, Wei Zhang, Lingyu Duan, and Tao Mei. Classes matter: A fine-grained adversarial approach to cross-domain semantic segmentation. In The European Conference on Computer Vision (ECCV), 2020a.
|
| 288 |
+
|
| 289 |
+
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.
|
| 290 |
+
|
| 291 |
+
Ximei Wang, Ying Jin, Mingsheng Long, Jianmin Wang, and Michael I Jordan. Transferable normalization: Towards improving transferability of deep neural networks. In Advances in Neural Information Processing Systems, volume 32, 2019a.
|
| 292 |
+
|
| 293 |
+
Ximei Wang, Mingsheng Long, Jianmin Wang, and Michael Jordan. Transferable calibration with lower bias and variance in domain adaptation. In Advances in Neural Information Processing Systems, volume 33, pp. 19212–19223, 2020b.
|
| 294 |
+
|
| 295 |
+
Yulin Wang, Xuran Pan, Shiji Song, Hong Zhang, Gao Huang, and Cheng Wu. Implicit semantic data augmentation for deep networks. In Advances in Neural Information Processing Systems, pp. 12614–12623, 2019b.
|
| 296 |
+
|
| 297 |
+
Zhenlin Xu, Deyi Liu, Junlin Yang, Colin Raffel, and Marc Niethammer. Robust and generalizable visual representation learning via random convolutions. In International Conference on Learning Representations, 2021.
|
| 298 |
+
|
| 299 |
+
Sangdoo Yun, Dongyoon Han, Sanghyuk Chun, Seong Joon Oh, Youngjoon Yoo, and Junsuk Choe. Cutmix: Regularization strategy to train strong classifiers with localizable features. In 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 6022–6031, 2019.
|
| 300 |
+
|
| 301 |
+
Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In International Conference on Learning Representations, 2018.
|
| 302 |
+
|
| 303 |
+
Liang Zheng, Liyue Shen, Lu Tian, Shengjin Wang, Jingdong Wang, and Qi Tian. Scalable person re-identification: A benchmark. In 2015 IEEE International Conference on Computer Vision (ICCV), pp. 1116–1124, 2015.
|
| 304 |
+
|
| 305 |
+
Kaiyang Zhou, Yongxin Yang, Timothy Hospedales, and Tao Xiang. Learning to generate novel domains for domain generalization. In The European Conference on Computer Vision (ECCV), pp. 561–578, 2020a.
|
| 306 |
+
|
| 307 |
+
Kaiyang Zhou, Yongxin Yang, Yu Qiao, and Tao Xiang. Domain adaptive ensemble learning. arXiv preprint arXiv:2003.07325, 2020b.
|
| 308 |
+
|
| 309 |
+
Kaiyang Zhou, Ziwei Liu, Yu Qiao, Tao Xiang, and Chen Change Loy. Domain generalization: A survey. arXiv preprint arXiv:2103.02503, 2021a.
|
| 310 |
+
|
| 311 |
+
Kaiyang Zhou, Yongxin Yang, Yu Qiao, and Tao Xiang. Domain generalization with mixstyle. In International Conference on Learning Representations, 2021b.
|
| 312 |
+
|
| 313 |
+
# A APPENDIX
|
| 314 |
+
|
| 315 |
+
# A.1 ALGORITHM
|
| 316 |
+
|
| 317 |
+
The algorithm of the proposed method is illustrated in Algorithm 1.
|
| 318 |
+
|
| 319 |
+
# Algorithm 1: The algorithm of the proposed method (DSU)
|
| 320 |
+
|
| 321 |
+
Input: Intermediate feature $\boldsymbol { x } \in \mathbb { R } ^ { B \times C \times H \times W }$ , probability $p$ to forward this module;
|
| 322 |
+
Output: Intermediate feature $\widehat { x } \in \mathbb { R } ^ { B \times C \times H \times W }$ after considering potential statistics shifts;
|
| 323 |
+
1 Sample $p _ { 0 } \sim U ( 0 , 1 )$ ;
|
| 324 |
+
2 if $p _ { 0 } < p$ and Training then
|
| 325 |
+
3 Compute the channel-wise mean and standard deviation of each instance in a mini-batch;
|
| 326 |
+
4 $\begin{array} { l } { \displaystyle \mu ( x ) = \frac { 1 } { H W } \sum _ { h = 1 } ^ { H } \sum _ { w = 1 } ^ { W } x _ { b , c , h , w } , } \\ { \sigma ^ { 2 } ( x ) = \frac { 1 } { H W } \sum _ { h = 1 } ^ { H } \sum _ { w = 1 } ^ { W } ( x _ { b , c , h , w } - \mu ( x ) ) ^ { 2 } . } \end{array}$
|
| 327 |
+
5
|
| 328 |
+
6 Uncertainty estimation on feature statistics;
|
| 329 |
+
7 $\begin{array} { r l } & { \Sigma _ { \mu } ^ { 2 } ( x ) = \frac { 1 } { B } \displaystyle \sum _ { b = 1 } ^ { B } ( \mu _ { b c } ( x ) - E _ { b } ( \mu _ { b c } ( x ) ) ) ^ { 2 } , } \\ & { \Sigma _ { \sigma } ^ { 2 } ( x ) = \frac { 1 } { B } \displaystyle \sum _ { b = 1 } ^ { B } ( \sigma _ { b c } ( x ) - E _ { b } ( \sigma _ { b c } ( x ) ) ) ^ { 2 } . } \end{array}$
|
| 330 |
+
8
|
| 331 |
+
9 Compute the synthetic feature statistics randomly sampling from the given Guassian distributions;
|
| 332 |
+
10 $\begin{array} { r l } & { \beta ( x ) = \mu ( x ) + \epsilon _ { \mu } \Sigma _ { \sigma } ( x ) , \epsilon _ { \mu } \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { 1 } ) , } \\ & { \gamma ( x ) = \sigma ( x ) + \epsilon _ { \sigma } \Sigma _ { \sigma } ( x ) , \epsilon _ { \sigma } \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { 1 } ) . } \end{array}$ ,
|
| 333 |
+
11
|
| 334 |
+
12 Obtain the feature after considering potential statistics shifts;
|
| 335 |
+
13 $\begin{array} { r } { \widehat { x } = \gamma ( x ) \times \frac { x - \mu ( x ) } { \sigma ( x ) } + \beta ( x ) . } \end{array}$
|
| 336 |
+
14 return the feature $\widehat { x }$ with uncertain feature statistics.
|
| 337 |
+
|
| 338 |
+
# 15 else
|
| 339 |
+
|
| 340 |
+
adopt the original feature $x$ and skip this module.
|
| 341 |
+
|
| 342 |
+
17 end
|
| 343 |
+
|
| 344 |
+
# A.2 MULTI-DOMAIN GENERALIZATION ON OFFICE HOME.
|
| 345 |
+
|
| 346 |
+
In addition to multi-domain classification experiments on PACS, we further evaluate the effectiveness of the proposed method on Office-Home (Venkateswara et al., 2017), which contains 15,500 images of 65 classes for home and office recognition. The experiment results with ResNet18 backbone are shown in Table 7. It can be observed that our method brings obvious improvement over the baseline method and also outperforms the competing methods. By introducing the feature statistics uncertainty, the models trained with our method can learn to alleviate the domain perturbations, such as the style information, and obtain more domain-invariant features. For example, huge improvement can be observed from the results on Clipart, which is a domain with much different style from others.
|
| 347 |
+
|
| 348 |
+
Table 7: Experiment results of Office-Home multi-domain classification task.
|
| 349 |
+
|
| 350 |
+
<table><tr><td>Method</td><td>Reference</td><td>Art</td><td>Clipart</td><td>Product</td><td>Real</td><td>Average (%)</td></tr><tr><td>Baseline</td><td></td><td>58.8</td><td>48.3</td><td>74.2</td><td>76.2</td><td>64.4</td></tr><tr><td>Mixup (Zhang et al.,2018)</td><td>ICLR 2018</td><td>58.2</td><td>49.3</td><td>74.7</td><td>76.1</td><td>64.6</td></tr><tr><td>CrossGrad (Shankar et al., 2018)</td><td>ICLR 2018</td><td>58.4</td><td>49.4</td><td>73.9</td><td>75.8</td><td>64.4</td></tr><tr><td>Manifold Mixup (Verma et al., 2019)</td><td>ICML 2019</td><td>56.2</td><td>46.3</td><td>73.6</td><td>75.2</td><td>62.8</td></tr><tr><td>CutMix (Yun et al., 2019)</td><td>ICCV 2019</td><td>57.9</td><td>48.3</td><td>74.5</td><td>75.6</td><td>64.1</td></tr><tr><td>RSC (Huang et al.,2020)</td><td>ECCV2020</td><td>58.4</td><td>47.9</td><td>71.6</td><td>74.5</td><td>63.1</td></tr><tr><td>L2A-OT (Zhou et al., 2020a)</td><td>ECCV2020</td><td>60.6</td><td>50.1</td><td>74.8</td><td>77.0</td><td>65.6</td></tr><tr><td>MixStyle (Zhou et al.,2021b)</td><td>ICLR 2021</td><td>58.7</td><td>53.4</td><td>74.2</td><td>75.9</td><td>65.5</td></tr><tr><td>DSU</td><td>Ours</td><td>60.2</td><td>54.8</td><td>74.1</td><td>75.1</td><td>66.1</td></tr></table>
|
| 351 |
+
|
| 352 |
+
# A.3 CHOICE OF UNCERTAINTY DISTRIBUTION
|
| 353 |
+
|
| 354 |
+
Table 8: Intensive study about different vanilla Gaussian distributions with pre-defined standard deviation.
|
| 355 |
+
|
| 356 |
+
<table><tr><td>Choice</td><td>Baseline</td><td>Rand(10°)</td><td>Rand(10-1)</td><td>Rand(10-2)</td><td>Rand(10-3)</td><td>DSU</td></tr><tr><td>PACS</td><td>79.0</td><td>76.9</td><td>81.2</td><td>79.3</td><td>79.1</td><td>84.1</td></tr><tr><td>GTA5 to Cityscapes</td><td>37.0</td><td>38.2</td><td>39.8</td><td>40.1</td><td>38.9</td><td>43.1</td></tr></table>
|
| 357 |
+
|
| 358 |
+
Besides the analysis of the uncertainty estimation in the ablation study, we also conduct a more intensive study about the effects of pre-defined uncertainty estimations. Specifically, Rand $( s )$ denotes directly imposing random shifts draw from a fixed Gaussian ${ \mathcal { N } } ( 0 , s ^ { 2 } )$ . The intensive study is shown in Table 8. It can be observed that the results of different fixed distributions are all much lower than the proposed method. Some conclusions could be obtained from the results. (a): Imposing excessive uncertainty might harm the model training and degrade the performance. (b): The best fixed value of uncertainty estimation might vary from different tasks. By contrast, the proposed method can be adaptive to different tasks without any manual adjustment.
|
| 359 |
+
|
| 360 |
+
Table 9: Study about the effects of sharing the same uncertain distribution among different channels.
|
| 361 |
+
|
| 362 |
+
<table><tr><td>Choice</td><td>Baseline</td><td>Channel-share</td><td>DSU</td></tr><tr><td>PACS</td><td>79.0</td><td>80.2</td><td>84.1</td></tr><tr><td>GTA5 to Cityscapes</td><td>37.0</td><td>39.3</td><td>43.1</td></tr></table>
|
| 363 |
+
|
| 364 |
+
We also conduct the experiment to test the effectiveness of treating different channels with different potentials. Channel-share denotes all channels of the sample share the same uncertainty distribution, i.e., using the average uncertainty estimation among channels. As shown in Table 9, the results indicate that sharing the same uncertain distribution among different channels is less effective, which ignores the different potentials of channels and will limit their performances. Meanwhile, the proposed method explicitly considers the different potentials of different channels and brings better performances.
|
| 365 |
+
|
| 366 |
+
# A.4 T-SNE VISUALIZATION
|
| 367 |
+
|
| 368 |
+
To analyze the effects on feature representations, we visualize the feature representation vectors of different categories in unseen domain with t-SNE (Van der Maaten & Hinton, 2008) in Figure 7. The features of the same category become more compact benefiting from the proposed method. Because our method can alleviate the domain perturbations during training and make the model focus on content information, obtaining more invariant features representations.
|
| 369 |
+
|
| 370 |
+

|
| 371 |
+
Figure 7: The t-SNE visualization on unseen PACS domain.
|
| 372 |
+
|
| 373 |
+
# A.5 COMPARISONS TO THE RELATED METHODS
|
| 374 |
+
|
| 375 |
+
Some related methods (Zhou et al., 2021b; Nuriel et al., 2021) also tackle the domain generalization problem by producing synthetic feature statistics. Specifically, we denote the random shuffle copies of the batch feature as $\widehat { \boldsymbol { x } } = \mathrm { s h u f f l e } ( \boldsymbol { x } )$ . pAdaIN (Nuriel et al. (2021)) generate new samples by bswapping feature statistics between the batch samples applied with a random permutation, where $\beta ( x ) { \overset { \vartriangle } { = } } \mu ( { \widehat { x } } )$ and $\gamma ( x ) ~ = ~ \sigma ( { \widehat { x } } )$ . MixStyle (Zhou et al. (2021b)) generates synthesized domain b bsamples by mixing feature statistics information of two instances, where $\beta ( x ) \dot { } = \lambda \mu ( x ) + ( 1 -$ $\lambda ) \mu ( \widehat { x } )$ and $\gamma ( x ) \overset { - } { = } \lambda \sigma ( x ) + ( 1 - \lambda ) \sigma ( \widehat { x } )$ and $\lambda \in ( 0 , 1 )$ is a random interpolation weight.
|
| 376 |
+
|
| 377 |
+
Despite the success, they typically adopt linear manipulation on pairwise samples to generate new feature statistics, which limits the diversity of synthetic changes. Specifically, the direction of the variants is determined by the chosen reference sample and the internal operation also restricts the variant intensity. Our method, not relies on a specific reference sample, is based on the Gaussian distribution that can produce not only linear changes but diverse variants with more possibilities. Due to the boundless range of the Gaussian distribution, our method has the ability to generate feature statistics beyond the scope of training domain, which also breaks the limitation of inner interpolation between training samples. The visualization of the comparisons is shown in Figure 8.
|
| 378 |
+
|
| 379 |
+

|
| 380 |
+
Figure 8: Comparisons with related methods. The variants produced by previous pairwise-based methods are restricted by the combination of chosen sample pair, while our method can generate various feature statistics variants with different combination of directions and intensities.
|
| 381 |
+
|
| 382 |
+
# A.6 WITHIN-DATASET PERFORMANCE
|
| 383 |
+
|
| 384 |
+
In Table 4, we tested the within-dataset performance on the large-scale dataset ImageNet, denoted as ”Clean”. We observed that the top-1 error rate declines from $2 3 . 8 \%$ to $2 3 . 4 \%$ after training with the proposed DSU, indicating that DSU does not sacrifice the in-domain performance to gain the benefits on out-of-distribution domains.The reason might be that instances in the testing set may not always fall into exactly the same distribution of the training set, and they still have slight statistic shifts (Gao et al., 2021a). The proposed DSU can help the trained model improve the robustness to statistics shifts and thus gain better performance in within-dataset ImageNet.
|
| 385 |
+
|
| 386 |
+
Besides the experiments on ImageNet, we also supplement the within-dataset performances on PACS. According to the multi-source training protocol on PACS (Li et al., 2017), the within-domain performance is averaged over multiple training-domain datasets (P,A,C,S denotes Art, Cartoon, Photo and Sketch respectively). As shown in Table 10, it can be observed that the within-dataset performance of our DSU also slightly beats the baseline, verifying the conclusion as on ImageNet.
|
| 387 |
+
|
| 388 |
+
Table 10: Within-dataset performance on PACS. P,A,C,S denote Photo, Art Painting, Cartoon, and Sketch respectively.
|
| 389 |
+
|
| 390 |
+
<table><tr><td>Method</td><td>Reference</td><td>P,C,S</td><td>P,A,S</td><td>A,C,S</td><td>P,A,C</td><td>Average (%)</td></tr><tr><td>Baseline</td><td>1</td><td>95.70</td><td>95.28</td><td>94.22</td><td>96.58</td><td>95.44</td></tr><tr><td>DSU</td><td>Ours</td><td>96.20</td><td>96.32</td><td>95.17</td><td>97.20</td><td>96.21</td></tr></table>
|
| 391 |
+
|
| 392 |
+
# A.7 ABLATION STUDY ON BATCH SIZE
|
| 393 |
+
|
| 394 |
+
In Table 11, we conduct an ablation study on the batch size. As shown in the table, consistent performance gains are observed with various batch sizes on PACS. Note we use the batch size of 64 in our paper, following the original setting in PACS (Li et al., 2017) for fair comparison.
|
| 395 |
+
|
| 396 |
+
Table 11: Ablation study on the effects of batch size.
|
| 397 |
+
|
| 398 |
+
<table><tr><td>batchsize</td><td>Reference</td><td>16</td><td>32</td><td>64</td><td>128</td><td>256</td></tr><tr><td>Baseline</td><td>1</td><td>81.0</td><td>80.2</td><td>79.0</td><td>77.8</td><td>75.6</td></tr><tr><td>DSU</td><td>Ours</td><td>84.9 (+3.9)</td><td>84.5 (+4.3)</td><td>84.1 (+5.1)</td><td>82.1 (+4.3)</td><td>80.4 (+4.8)</td></tr></table>
|
md/dev/6dlC7E1H_9/6dlC7E1H_9.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/A1yGs_SWiIi/A1yGs_SWiIi.md
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TransTab: Learning Transferable Tabular Transformers Across Tables
|
| 2 |
+
|
| 3 |
+
Zifeng Wang1 and Jimeng $\mathbf { S u n ^ { 1 , 2 } }$
|
| 4 |
+
1 Department of Computer Science, University of Illinois Urbana-Champaign
|
| 5 |
+
2 Carle Illinois College of Medicine, University of Illinois Urbana-Champaign {zifengw2,jimeng}@illinois.edu
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
Tabular data (or tables) are the most widely used data format in machine learning (ML). However, ML models often assume the table structure keeps fixed in training and testing. Before ML modeling, heavy data cleaning is required to merge disparate tables with different columns. This preprocessing often incurs significant data waste (e.g., removing unmatched columns and samples). How to learn ML models from multiple tables with partially overlapping columns? How to incrementally update ML models as more columns become available over time? Can we leverage model pretraining on multiple distinct tables? How to train an ML model which can predict on an unseen table?
|
| 10 |
+
|
| 11 |
+
To answer all those questions, we propose to relax fixed table structures by introducing a Transferable Tabular Transformer (TransTab) for tables. The goal of TransTab is to convert each sample (a row in the table) to a generalizable embedding vector, and then apply stacked transformers for feature encoding. One methodology insight is combining column description and table cells as the raw input to a gated transformer model. The other insight is to introduce supervised and self-supervised pretraining to improve model performance. We compare TransTab with multiple baseline methods on diverse benchmark datasets and five oncology clinical trial datasets. Overall, TransTab ranks 1.00, 1.00, 1.78 out of 12 methods in supervised learning, feature incremental learning, and transfer learning scenarios, respectively; and the proposed pretraining leads to $2 . 3 \%$ AUC lift on average over the supervised learning.
|
| 12 |
+
|
| 13 |
+
# 1 Introduction
|
| 14 |
+
|
| 15 |
+
Tabular data are ubiquitous in healthcare, engineering, advertising, and finance [1, 2, 3, 4]. They are often stored in a relational database as tables or spreadsheets. Table rows represent the data samples, and columns represent the feature variables of diverse data types (e.g., categorical, numerical, binary, and textual). Recent works enhance tabular ML modeling using deep networks [5, 6, 7, 8] or designing self-supervision [2, 9, 10, 11]. Those existing works require the same table structure in training and testing data. However, there can be multiple tables sharing partially overlapped columns in the real world. Hence, learning across tables is inapplicable. The traditional remedy is to perform data cleaning by removing non-overlapping columns and mismatched samples before training any ML models, which waste data resources [12, 13, 14]. Therefore, learning across tables with disparate columns and transferring knowledge across tables are crucial to extending the success of deep learning/pretraining to the tabular domain.
|
| 16 |
+
|
| 17 |
+
Tables are highly structured yet flexible. The first step to achieve learning across tables is to rethink the basic elements in tabular data modeling. In computer vision, the basic elements are pixels [15] or patches, [16, 17]; in natural language processing (NLP), the basic elements are words [18] or tokens [19, 20]. In the tabular domain, it is natural to treat cells in each column as independent elements. Columns are mapped to unique indexes then models take the cell values for training and inference. The premise of this modeling formulation is to keep the same column structure in all the tables. But tables often have divergent protocols where the nomenclatures of columns and cells differ. By contrast, our proposed work contextualizes the columns and cells. For example, previous methods represent a cell valued man under the column gender by 0 referring to the codebook $\mathbf { \bar { \{ m a n : 0 , w o m a n : 1 \} } }$ . Our model converts the tabular input into a sequence input (e.g., gender is man), which can be modeled with downstream sequence models. We argue such featurizing protocol is generalizable across tables, thus enabling models to apply to different tables.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: The demonstration of ML modeling on different tabular data settings. Previous tabular methods only do vanilla supervised training or pretraining on the same table due to they only accept fixed-column tables. By contrast, TransTab covers more new tasks (1) to (4) as it accepts variablecolumn tables. Details are presented in $\ S$ .
|
| 21 |
+
|
| 22 |
+
In a nutshell, we propose Transferable Transformers for Tabular analysis (TransTab), a versatile tabular learning framework 1. TransTab applies to multiple use cases as shown in Fig. 1. The key contributions behind TransTab are
|
| 23 |
+
|
| 24 |
+
• A systematic featurizing pipeline considering both column and cell semantics which is shared as the fundamental protocol across tables.
|
| 25 |
+
• Vertical-Partition Contrastive Learning (VPCL) that enables pretraining on multiple tables and also allows finetuning on target datasets.
|
| 26 |
+
|
| 27 |
+
As shown by Fig. 1, due to the fixed-column assumption, all existing works only handle supervised learning or pretraining on the same-structure tables. On the contrary, TransTab relaxes this assumption and applies to four additional scenarios, which we will elaborate on in $\ S 2 . 1$ .
|
| 28 |
+
|
| 29 |
+
# 2 Method
|
| 30 |
+
|
| 31 |
+
In this section, we present the details of TransTab. Fig. 2 illustrates its workflow including the following key components: 1) The input processor featurizes and embeds arbitrary tabular inputs to token-level embeddings; 2) The stacked gated transformer layers further encode the token-level embeddings; 3) Finally, the learning module includes a classifier trained on labeled data and a projector for contrastive learning. Next we will present the details of each component.
|
| 32 |
+
|
| 33 |
+

|
| 34 |
+
Figure 2: The demonstration of TransTab framework. the input processor encodes the sample into the token-level embedding $\mathbf { E }$ ; the [cls] embedding $\mathbf { z } ^ { [ c l s ] }$ in the representation $\mathbf { Z } ^ { L }$ after $L$ gated transformer layers is used for prediction and learning. In supervised learning, $\mathbf { z } ^ { [ c l s ] }$ is leveraged by a classifier to make predictions of target $y$ ; in contrastive learning, the projected $\hat { \mathbf { z } } ^ { [ c l s ] }$ is is used for self or supervised contrastive loss.
|
| 35 |
+
|
| 36 |
+
# 2.1 Application scenarios of TransTab
|
| 37 |
+
|
| 38 |
+
Before presenting our method in details, we first introduce four novel applications scenarios which are tractable by TransTab, as shown in Fig. 1. Suppose we aim to predict the treatment efficacy for breast cancer trials using multiple clinical trial tables, here are several scenarios we often encounter.
|
| 39 |
+
|
| 40 |
+
S(1) Transfer learning. We collect data tables from multiple cancer trials for testing the efficacy of the same drug on different patients. These tables were designed independently with overlapping columns. How do we learn ML models for one trial by leveraging tables from all trials?
|
| 41 |
+
|
| 42 |
+
S(2) Incremental learning. Additional columns might be added over time. For example, additional features are collected across different trial phases. How do we update the ML models using tables from all trial phases?
|
| 43 |
+
|
| 44 |
+
S(3) Pretraining+Finetuning. The trial outcome label (e.g., mortality) might not be always available from all table sources. Can we benefit pretraining on those tables without labels? How do we finetune the model on the target table with labels?
|
| 45 |
+
|
| 46 |
+
S(4) Zero-shot inference. We model the drug efficacy based on our trial records. The next step is to conduct inference with the model to find patients that can benefit from the drug. However, patient tables do not share the same columns as trial tables so direct inference is not possible.
|
| 47 |
+
|
| 48 |
+
Overall, we witness that the assumption of fixed table structure is the obstacle to use ML for various applications. Next we will present TransTab and demonstrate how it addresses these scenarios.
|
| 49 |
+
|
| 50 |
+
# 2.2 Input processor for columns and cells
|
| 51 |
+
|
| 52 |
+
We build the input processor (1) to accept variable-column tables (2) to retain knowledge across tabular datasets. The idea is to convert tabular data (cells in columns) into a sequence of semantically encoded tokens. We utilize the following observation to create the sequence: the column description (e.g., column name) decides the meaning of cells in that column. For example, if a cell in column smoking history has value 1, it indicates the individual has a smoking history. Similarly, cell value 60 in column weight indicates $6 0 \mathrm { k g }$ in weight instead of 60 years old. Motivated by the discussion, we propose to include column names into the tabular modeling. As a result, TransTab treats any tabular data as the composition of three elements: text (for categorical & textual cells and column names), continuous values (for numerical cells), and boolean values (for binary cells) . Fig. 2 illustrates a visual example of how these elements are leveraged to process the four basic types of features: categorical/textual cat, binary bin, and numerical num.
|
| 53 |
+
|
| 54 |
+
Categorical/Textual feature. A category or textual feature contains a sequence of text tokens. For the categorical feature cat, we concatenate the column name with the feature value $x _ { c }$ , which forms as a sequence of tokens. This sentence is then tokenized and matched to the token embedding matrix to generate the feature embedding $\mathbf { E } _ { c } \in \mathbb { R } ^ { n _ { c } \times d }$ where $d$ is the embedding dimension and $n _ { c }$ is the number of tokens.
|
| 55 |
+
|
| 56 |
+
Binary feature. The binary feature bin is usually an assertive description and its value $x _ { b } \in \{ 0 , 1 \}$ . If $x _ { b } = 1$ , then bin is tokenized and encoded to the embeddings $\mathbf { E } _ { b } \in \mathbb { R } ^ { n _ { b } \times d }$ ; if not, it will not be processed to the subsequent steps. This design significantly reduces the computational and memory cost when the inputs have high-dimensional and sparse one-hot features.
|
| 57 |
+
|
| 58 |
+
Numerical feature. We do not concatenate column names and values for numerical feature because the tokenization-embedding paradigm was notoriously known to be bad at discriminating numbers [21]. Instead, we process them separately. num is encoded as same as cat and bin to get $\mathbf { E } _ { u , c o l } \in$ $\mathbb { R } ^ { n _ { u } \times d }$ . We then multiply the numerical features with the column embedding to yield the numerical embedding as $\mathbf { E } _ { u } = x _ { u } ^ { \top } \times \mathbf { E } _ { u , c o l } { } ^ { 2 }$ , which we identify gets an edge on more complicated numerical embedding techniques empirically.
|
| 59 |
+
|
| 60 |
+
At last, $\mathbf { E } _ { c }$ , $\mathbf { E } _ { u }$ , $\mathbf { E } _ { b }$ all pass the layer normalization [22] and the same linear layer to be aligned to the same space, then are concatenated with [cls] embedding to yield $\mathbf { E } = \tilde { \mathbf { E } } _ { c } \otimes \tilde { \mathbf { E } } _ { u } \otimes \tilde { \mathbf { E } } _ { b } \otimes \mathbf { e } ^ { [ c l s ] }$ .
|
| 61 |
+
|
| 62 |
+
As a result, all cell values are contextualized regarding the corresponding column properties thus the semantic meaning of one element can vary depending on the context composition. This formulation benefits the knowledge transfer across tables a lot. For example, previously smoked depicts the same thing as smoking history. Previous methods never capture this connection while it is possible for TransTab to learn to recognize that 1 under both columns are equivalent.
|
| 63 |
+
|
| 64 |
+
# 2.3 Gated transformers
|
| 65 |
+
|
| 66 |
+
The gated tabular transformer is an adaption of the classical transformer in NLP [23]. It consists of two main components: multi-head self-attention layer and gated feedforward layers. The input representation $\mathbf { Z } ^ { l }$ at the $l$ -th layer is first adopted for exploring interactions between features:
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
\begin{array} { r } { \mathbf { Z } _ { \mathrm { a t t } } ^ { l } = \mathbb { M } \mathrm { u } \mathrm { 1 t i } \mathrm { H e a d } \mathrm { A t t n } ( \mathbf { Z } ^ { l } ) = [ \mathrm { h e a d } _ { 1 } , \mathrm { h e a d } _ { 2 } , \dots , \mathrm { h e a d } _ { h } ] \mathbf { W } ^ { O } , } \\ { \mathrm { h e a d } _ { i } = \mathrm { A t t e n t i o n } ( \mathbf { Z } ^ { l } \mathbf { W } _ { i } ^ { Q } , \mathbf { Z } ^ { l } \mathbf { W } _ { i } ^ { K } , \mathbf { Z } ^ { l } \mathbf { W } _ { i } ^ { V } ) , } \end{array}
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
where ${ \bf Z } ^ { 0 } = { \bf E }$ at the first layer; $\mathbf { W } ^ { O } \in \mathbb { R } ^ { d \times d }$ ; $\{ \mathbf { W } _ { i } ^ { Q } , \mathbf { W } _ { i } ^ { K } , \mathbf { W } _ { i } ^ { V } \}$ are weight matrices (in $\textstyle \mathbb { R } ^ { d \times { \frac { d } { h } } }$ ) of query, key, value of the $i$ -th head self-attention module.
|
| 73 |
+
|
| 74 |
+
The multi-head attention output $\mathbf { Z } _ { \mathrm { a t t } } ^ { l }$ is further transformed by a token-wise gating layer as $\mathbf { g } ^ { l } =$ $\sigma ( \mathbf { Z } _ { \mathrm { a t t } } ^ { l } \mathbf { w } ^ { G } )$ , where $\sigma ( \cdot )$ is a sigmoid function; $\mathbf { g } ^ { l } \in [ 0 , 1 ] ^ { n }$ controls the magnitude of each token embedding before $\mathbf { Z } _ { \mathrm { a t t } }$ goes to the linear projection. This gates then filters the linear layer output
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
\mathbf { Z } ^ { l + 1 } = \mathtt { L i n e a r } \left( ( \mathbf { g } ^ { l } \odot \mathbf { Z } _ { \mathrm { a t t } } ^ { l } ) \oplus \mathtt { L i n e a r } ( \mathbf { Z } _ { \mathrm { a t t } } ^ { l } ) \right)
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
to obtain the transformer output $\mathbf { Z } ^ { l + 1 } \in \mathbb { R } ^ { n \times d }$ . This mechanism is learnt to focus on important features by redistributing the attention on tokens. The final [cls] embedding $\mathbf { z } ^ { [ c l s ] }$ at the $L$ -th layer is used by the classifier for prediction.
|
| 81 |
+
|
| 82 |
+
# 2.4 Self-supervised and supervised pretraining of TransTab
|
| 83 |
+
|
| 84 |
+
The input processor accepts variable-column tables, which opens the door for tabular pretraining on heterogeneous tables. In detail, TransTab is feasible for self-supervised and supervised pretraining.
|
| 85 |
+
|
| 86 |
+
Self-supervised VPCL. Most SSL tabular methods work on the whole fixed set of columns [2, 24, 11], which take high computational costs and are prone to overfitting. Instead, we take tabular vertical partitions to build positive and negative samples for CL under the hypothesis that the powerful representation should model view-invariant factors. In detail, we subset columns as illustrated by Fig. 3 where Self-VPCL is on the top right. Suppose a sample $\mathbf { x } _ { i } = \{ \mathbf { v } _ { i } ^ { 1 } , \ldots , \mathbf { v } _ { i } ^ { K } \}$ with $K$ partitions $\mathbf { v } _ { i } ^ { k }$ . Neighbouring partitions can have overlapping regions which are justified by the percentage of columns of the partition. Self-VPCL takes partitions from the same sample as the positive and others as the negative:
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\ell ( \mathbf { X } ) = - \sum _ { i = 1 } ^ { B } \sum _ { k = 1 } ^ { K } \sum _ { k ^ { \prime } \neq k } ^ { K } \log \frac { \exp \psi ( \mathbf { v } _ { i } ^ { k } , \mathbf { v } _ { i } ^ { k ^ { \prime } } ) } { \sum _ { j = 1 } ^ { B } \sum _ { k ^ { \prime } = 1 } ^ { K } \exp \psi ( \mathbf { v } _ { i } ^ { k } , \mathbf { v } _ { j } ^ { k ^ { \dagger } } ) } ,
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
where $B$ is the batch size; $\psi ( \cdot , \cdot )$ is the cosine similarity function. $\psi$ applies to $\hat { \mathbf { z } } ^ { [ c l s ] }$ which is the linear projection of partition $\mathbf { v }$ ’s embedding $\mathbf { z } ^ { [ c l s ] }$ . Compared with vanilla CL like SCARF [11], Self-VPCL significantly expand the positive and negative sampling for learning more robust and rich embeddings. What is more, this vertical partition sampling is extremely friendly to column-oriented databases [25] which support the fast querying a subset of columns from giant data warehouses. For the sake of computational efficiency, when $K > 2$ , we randomly sample two partitions.
|
| 93 |
+
|
| 94 |
+
Supervised VPCL. When we own labeled tabular data for pretraining, one natural idea would be taking task-specific predicting heads for pretraining on vanilla supervised loss, e.g., crossentropy loss. In finetuning, these heads are dropped and a new head will be added on top of the pretrained encoder. However, we argue it is suboptimal and may undermine the model transferability. The reason behind is that tabular datasets vary dramatically in size, task definition, and class distributions. Pretraining TransTab using supervised loss inevitably causes the encoder biased to the major tasks and classes. Moreover, the suitable hyperparameter range is often distinct across tabular data when applying supervised loss. The same set of hyperparameters can cause overfitting on one dataset and underfitting on another. Therefore, it is tricky to pick appropriate hyperparameters for pretraining based on vanilla supervised loss.
|
| 95 |
+
|
| 96 |
+

|
| 97 |
+
Figure 3: The demonstration of contrastive learning methods (different pieces can either be distinct or be overlapped partially). Self-VPCL: Positive pairs are partitions of the same sample; VPCL: Positive pairs are partitions of the sample belonging to the same class.
|
| 98 |
+
|
| 99 |
+
In this paper, we propose VPCL for pretraining inspired by supervised CL [26] which was proved robust to noise and hyperparameters. As illustrated by Fig. 3, we build positive pairs considering views from the same class except for only from the same sample:
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
\ell ( \mathbf { X } , \mathbf { y } ) = - \sum _ { i = 1 } ^ { B } \sum _ { j = 1 } ^ { B } \sum _ { k = 1 } ^ { K } \sum _ { k ^ { \prime } = 1 } ^ { K } \mathbf { 1 } \{ y _ { j } = y _ { i } \} \log { \frac { \exp \psi ( \mathbf { v } _ { i } ^ { k } , \mathbf { v } _ { j } ^ { k ^ { \prime } } ) } { \sum _ { j ^ { \prime } = 1 } ^ { B } \sum _ { k ^ { \prime } = 1 } ^ { K } \mathbf { 1 } \{ y _ { j ^ { \dagger } } \neq y _ { i } \} \exp \psi ( \mathbf { v } _ { i } ^ { k } , \mathbf { v } _ { j ^ { \dagger } } ^ { k ^ { \dagger } } ) } } .
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
$\mathbf { y } = \{ y _ { i } \} _ { i } ^ { B }$ are labels; $\mathbf { 1 } \{ \cdot \}$ is indicator function. VPCL relieves multiple pretraining predictors required to adjust to different datasets. Moreover, VPCL exposes more feature embeddings to the supervision by partitioning hence providing more discriminative and generalizable representations.
|
| 106 |
+
|
| 107 |
+
# 3 Experiments
|
| 108 |
+
|
| 109 |
+
In this section, we aim at answering the following questions by extensive experiments:
|
| 110 |
+
|
| 111 |
+
• Q1. How does TransTab perform compared with baselines under the vanilla supervised setting? • Q2. How well does TransTab address incremental columns from a stream of data (S(2) in Fig. 1)? • Q3. How is the impact of TransTab learned from multiple tables (with different columns) drawn from the same domain on its predictive ability (S(1) in Fig. 1)?
|
| 112 |
+
|
| 113 |
+
Table 1: Statistics of the use clinical trial mortality prediction datasets. All are binary classification tasks. Positive ratio means the ratio of data points belong the positive class. NCTxxx are trial identifiers which can be linked to trials on ClinicalTrials.gov.
|
| 114 |
+
|
| 115 |
+
<table><tr><td>Name</td><td>Datapoints</td><td>Categorical</td><td>Binary</td><td>Numerical</td><td>Positive ratio</td></tr><tr><td>NCT00041119</td><td>3871</td><td>5</td><td>8</td><td>2</td><td>0.07</td></tr><tr><td>NCT00174655</td><td>994</td><td>3</td><td>31</td><td>15</td><td>0.02</td></tr><tr><td>NCT00312208</td><td>1651</td><td>5</td><td>12</td><td>6</td><td>0.19</td></tr><tr><td>NCT00079274</td><td>2968</td><td>5</td><td>8</td><td>3</td><td>0.12</td></tr><tr><td>NCT00694382</td><td>1604</td><td>1</td><td>29</td><td>11</td><td>0.45</td></tr></table>
|
| 116 |
+
|
| 117 |
+
• Q4. Can TransTab be a zero-shot learner when pretrained on tables and infer on a new table (S(4) in Fig. 1)?
|
| 118 |
+
|
| 119 |
+
• Q5. Is the proposed vertical partition CL better than vanilla supervised pretraining and selfsupervised CL (S(3) in Fig. 1)?
|
| 120 |
+
|
| 121 |
+
Datasets. We introduce clinical trial mortality prediction datasets where each includes a distinct group of patients and columns 3. The data statistics are in Table 1. Accurately predicting the patient mortality in clinical trials is crucial because it helps identify catastrophic treatment then save patients from harm and improve the clinical trial design. Considering they are from a similar domain, we can utilize them to test if TransTab can achieve transfer learning. Besides, we also include a set of public tabular datasets, the statistics are in Table 7.
|
| 122 |
+
|
| 123 |
+
Dataset pre-processing. For all baselines, we represent categorical features by ordinal encoding if they need to specify categorical features, otherwise one-hot encoding is used. Numerical features are scaled to $[ 0 , 1 ]$ by min-max normalization. Exceptionally for TransTab, we map the categorical feature index to its original description, e.g., mapping class "1" under "gender" to "female".
|
| 124 |
+
|
| 125 |
+
Model and implementation protocols. Unless specified otherwise, we keep the settings fixed across all experiments. TransTab uses 2 layers of gated transformers where the embedding dimensions of numbers and tokens are 128, and the hidden dimension of intermediate dense layers is 256. The attention module has 8 heads. We choose ReLU activations and do not activate dropout. We train TransTab using Adam optimizer [27] with learning rate in $\{ 2 \mathrm { e } { - } 5 , 5 \mathrm { e } { - } 5 , 1 \mathrm { e } { - } 4 \}$ and no weight decay; batch size is in $\{ 1 6 , 6 4 , 1 2 8 \}$ . We set a maximum self-supervised pretraining epochs of 50 and supervised training epochs of 100. A patience of 10 is kept for supervised training for early stopping. Experiments were conducted with one RTX3070 GPU, i7-10700 CPU, and 16GB RAM.
|
| 126 |
+
|
| 127 |
+
Baselines. We include the following baselines for comparison: Logistic regression $( L R )$ ; XGBoost [28]; Multilayer perceptron $( M L P )$ ; SeLU MLP (SNN) [29]; TabNet [30]; DCN [1]; AutoInt [31]; TabTransformer [5]; FT-Transformer [32]; VIME [2]; SCARF [11]. We provide the baseline architectures and implementations in Appendix B.
|
| 128 |
+
|
| 129 |
+
# 3.1 Q1. Supervised learning
|
| 130 |
+
|
| 131 |
+
Results of supervised learning on clinical trial mortality prediction datasets are summarized by Table 2. Note that all methods including ours do not perform pre-training. We see that our method outperforms baselines on all. From the view of method ranks, we surprisingly identify that LR wins over half of baseline methods. Except for TransTab, FT-Transformer is the only model that shows significant superiority over LR, which illustrates the potential of transformers for tabular modeling. Additional results on public datasets are available in Table 8 where we witness that our method is comparable to the state-of-the-art baseline tabular models. We also discover the baselines drawn from the CTR prediction literature (DCN and AutoInt) turn out the be competitive in tabular modeling.
|
| 132 |
+
|
| 133 |
+
# 3.2 Q2. Feature incremental learning
|
| 134 |
+
|
| 135 |
+
For previous tabular models, we should either drop new features or drop old data when confronting feature incremental learning. By contrast, TransTab is able to continually learn from new data with incremental features. We split the raw dataset into three subsets: set1, 2, and 3 which mimic the incremental feature scenario shown by (2) in Fig. 1. Baseline methods apply to two scenarios: (a) learning from all data that only have features of set1 and (b) learning from the data of set3 only. We report the best of the two. TransTab applies to learning from all three subsets. Table 3 shows the results where we find our method outperforms baselines by a great margin. It demonstrates that TransTab makes the best of incremental features to learn better. Similar observations appear in public datasets, shown by Table 9.
|
| 136 |
+
|
| 137 |
+
Table 2: Test AUROC results on clinical trial mortality datasets the under supervised learning setting. All the remaining tables in this paper follow these setups to avoid clutter: the metric values are averaged over 10 random seeds; the Rank column reports the average rank across all datasets; Top results for each dataset are in bold.
|
| 138 |
+
|
| 139 |
+
<table><tr><td>Methods</td><td>N00041119</td><td>N00174655</td><td>N00312208</td><td>N00079274</td><td>N00694382</td><td>Rank(Std)</td></tr><tr><td>LR</td><td>0.6364</td><td>0.8543</td><td>0.7382</td><td>0.7067</td><td>0.7360</td><td>5.40(1.14)</td></tr><tr><td>XGBoost</td><td>0.5937</td><td>0.5000</td><td>0.6911</td><td>0.6784</td><td>0.7440</td><td>9.60(3.71)</td></tr><tr><td>MLP</td><td>0.6340</td><td>0.6189</td><td>0.7427</td><td>0.6967</td><td>0.7063</td><td>8.00(2.83)</td></tr><tr><td>SNN</td><td>0.6335</td><td>0.9130</td><td>0.7469</td><td>0.6948</td><td>0.7246</td><td>5.80(2.39)</td></tr><tr><td>TabNet</td><td>0.5856</td><td>0.5401</td><td>0.6910</td><td>0.6031</td><td>0.7113</td><td>11.40(0.89)</td></tr><tr><td>DCN</td><td>0.6349</td><td>0.7577</td><td>0.7431</td><td>0.6952</td><td>0.7458</td><td>5.60(2.51)</td></tr><tr><td>AutoInt</td><td>0.6327</td><td>0.7502</td><td>0.7479</td><td>0.6958</td><td>0.7411</td><td>6.20(2.59)</td></tr><tr><td>TabTrans</td><td>0.6187</td><td>0.9035</td><td>0.7069</td><td>0.7178</td><td>0.7229</td><td>7.20(3.56)</td></tr><tr><td>FT-Trans</td><td>0.6372</td><td>0.9073</td><td>0.7586</td><td>0.7090</td><td>0.7231</td><td>4.20(2.28)</td></tr><tr><td>VIME</td><td>0.6397</td><td>0.8533</td><td>0.7227</td><td>0.6790</td><td>0.7232</td><td>7.00(3.08)</td></tr><tr><td>SCARF</td><td>0.6248</td><td>0.9310</td><td>0.7267</td><td>0.7176</td><td>0.7103</td><td>6.60(3.91)</td></tr><tr><td>TransTab</td><td>0.6408</td><td>0.9428</td><td>0.7770</td><td>0.7281</td><td>0.7648</td><td>1.00(0.00)</td></tr></table>
|
| 140 |
+
|
| 141 |
+
Table 3: Test AUROC results on clinical trial datasets under feature incremental learning.
|
| 142 |
+
|
| 143 |
+
<table><tr><td>Methods</td><td>N00041119</td><td>N00174655</td><td>N00312208</td><td>N00079274</td><td>N00694382</td><td>Rank(Std)</td></tr><tr><td>LR</td><td>0.6213</td><td>0.8485</td><td>0.6801</td><td>0.6258</td><td>0.7236</td><td>4.6(3.21)</td></tr><tr><td>XGBoost</td><td>0.5735</td><td>0.7890</td><td>0.6760</td><td>0.6038</td><td>0.6463</td><td>8.8(2.59)</td></tr><tr><td>MLP</td><td>0.6371</td><td>0.7754</td><td>0.6871</td><td>0.6220</td><td>0.6851</td><td>6.2(2.95)</td></tr><tr><td>SNN</td><td>0.5765</td><td>0.7440</td><td>0.6854</td><td>0.6336</td><td>0.7035</td><td>6.4(2.30)</td></tr><tr><td>TabNet</td><td>0.5548</td><td>0.8419</td><td>0.5849</td><td>0.6052</td><td>0.6668</td><td>9.0(3.39)</td></tr><tr><td>DCN</td><td>0.5172</td><td>0.5846</td><td>0.6640</td><td>0.6535</td><td>0.6957</td><td>8.2(4.16)</td></tr><tr><td>AutoInt</td><td>0.5232</td><td>0.6075</td><td>0.7031</td><td>0.6394</td><td>0.6974</td><td>7.2(3.56)</td></tr><tr><td>TabTrans</td><td>0.5599</td><td>0.7652</td><td>0.6433</td><td>0.6365</td><td>0.6841</td><td>8.2(1.10)</td></tr><tr><td>FT-Trans</td><td>0.5552</td><td>0.8045</td><td>0.7148</td><td>0.6471</td><td>0.6815</td><td>5.8(3.11)</td></tr><tr><td>VIME</td><td>0.6101</td><td>0.8114</td><td>0.3705</td><td>0.6444</td><td>0.6436</td><td>7.4(4.22)</td></tr><tr><td>SCARF</td><td>0.5996</td><td>0.6261</td><td>0.7072</td><td>0.6535</td><td>0.6957</td><td>5.2(2.97)</td></tr><tr><td>TransTab</td><td>0.6797</td><td>0.8545</td><td>0.7617</td><td>0.6857</td><td>0.7795</td><td>1.0(0.00)</td></tr></table>
|
| 144 |
+
|
| 145 |
+
# 3.3 Q3. Transfer learning
|
| 146 |
+
|
| 147 |
+
We further test if TransTab is able to transfer knowledge across tables. Results are in Table 4. We split each dataset into two subsets with $50 \%$ overlaps of their columns. Baselines are trained and tested on set1 (only label-supervision) or set2 separately. For our method we pretrain it on set1 then finetune it on set2 and report its performance on set2, and vice versa. We observe that TransTab can benefit from knowledge transfer across tables to reach superior performances. Similar observations are made on public datasets shown by Table 10.
|
| 148 |
+
|
| 149 |
+
Table 4: Test AUROC results on clinical trial datasets under transfer learning across tables.
|
| 150 |
+
|
| 151 |
+
<table><tr><td rowspan="2">Methods</td><td colspan="2">N00041119</td><td colspan="2">NO0174655</td><td colspan="2">N00312208</td><td colspan="2">N00079274</td><td colspan="2">N00694382</td><td rowspan="2">Rank(Std)</td></tr><tr><td>set1</td><td>set2</td><td>set1</td><td>set2</td><td>set1</td><td>set2</td><td>set1</td><td>set2</td><td>set1</td><td>set2</td></tr><tr><td>LR</td><td>0.625</td><td>0.647</td><td>0.789</td><td>0.819</td><td>0.701</td><td>0.735</td><td>0.635</td><td>0.685</td><td>0.675</td><td>0.763</td><td>5.33(1.73)</td></tr><tr><td>XGBoost</td><td>0.638</td><td>0.575</td><td>0.574</td><td>0.886</td><td>0.690</td><td>0.700</td><td>0.596</td><td>0.647</td><td>0.592</td><td>0.677</td><td>7.56(3.75)</td></tr><tr><td>MLP</td><td>0.639</td><td>0.621</td><td>0.314</td><td>0.857</td><td>0.683</td><td>0.744</td><td>0.620</td><td>0.675</td><td>0.648</td><td>0.765</td><td>6.56(3.32)</td></tr><tr><td>SNN</td><td>0.627</td><td>0.634</td><td>0.215</td><td>0.754</td><td>0.687</td><td>0.732</td><td>0.631</td><td>0.683</td><td>0.651</td><td>0.759</td><td>7.44(2.07)</td></tr><tr><td>TabNet</td><td>0.564</td><td>0.558</td><td>0.856</td><td>0.592</td><td>0.671</td><td>0.657</td><td>0.443</td><td>0.605</td><td>0.581</td><td>0.677</td><td>10.67(2.96)</td></tr><tr><td>DCN</td><td>0.636</td><td>0.625</td><td>0.767</td><td>0.790</td><td>0.711</td><td>0.698</td><td>0.682</td><td>0.664</td><td>0.658</td><td>0.737</td><td>6.33(2.45)</td></tr><tr><td>AutoInt</td><td>0.629</td><td>0.630</td><td>0.843</td><td>0.730</td><td>0.725</td><td>0.698</td><td>0.679</td><td>0.665</td><td>0.686</td><td>0.661</td><td>5.89(2.89)</td></tr><tr><td>TabTrans</td><td>0.616</td><td>0.647</td><td>0.866</td><td>0.822</td><td>0.675</td><td>0.677</td><td>0.618</td><td>0.702</td><td>0.652</td><td>0.718</td><td>6.22(3.38)</td></tr><tr><td>FT-Trans</td><td>0.627</td><td>0.641</td><td>0.836</td><td>0.858</td><td>0.720</td><td>0.741</td><td>0.692</td><td>0.692</td><td>0.652</td><td>0.740</td><td>4.22(2.28)</td></tr><tr><td>VIME</td><td>0.603</td><td>0.625</td><td>0.312</td><td>0.726</td><td>0.601</td><td>0.642</td><td>0.477</td><td>0.668</td><td>0.614</td><td>0.715</td><td>10.44(1.51)</td></tr><tr><td>SCARF</td><td>0.635</td><td>0.657</td><td>0.651</td><td>0.814</td><td>0.653</td><td>0.686</td><td>0.682</td><td>0.701</td><td>0.671</td><td>0.776</td><td>5.56(3.40)</td></tr><tr><td>TransTab</td><td>0.653</td><td>0.653</td><td>0.904</td><td>0.846</td><td>0.730</td><td>0.756</td><td>0.680</td><td>0.711</td><td>0.747</td><td>0.774</td><td>1.78(1.30)</td></tr></table>
|
| 152 |
+
|
| 153 |
+
Table 5: Test AUROC results on clinical trial datasets under zero-shot learning setting.
|
| 154 |
+
|
| 155 |
+
<table><tr><td>TransTab</td><td>N00041119</td><td>N00174655</td><td>N00312208</td><td>N00079274</td><td>N00694382</td></tr><tr><td>Supervised</td><td>0.5854</td><td>0.6484</td><td>0.7536</td><td>0.7087</td><td>0.6479</td></tr><tr><td>Transfer</td><td>0.6130</td><td>0.6909</td><td>0.7658</td><td>0.7163</td><td>0.6752</td></tr><tr><td>Zero-shot</td><td>0.5990</td><td>0.6752</td><td>0.7576</td><td>0.7036</td><td>0.6740</td></tr></table>
|
| 156 |
+
|
| 157 |
+
# 3.4 Q4. Zero-shot learning
|
| 158 |
+
|
| 159 |
+
Although there are numerous papers on zero-shot learning (ZSL) in CV and NLP [33, 34, 35], we notice that ZSL was hardly mentioned in tabular domain. In this experiment, we refer to the ZSL scenario mentioned by S(4) of Fig. 1 where we split the raw table into three equal-size subsets. Three subsets have distinct columns. For the zero-shot setting, the model learns from set1+set2 and is tested on set3 without further training. In this scenario, the model needs to leverage the learned knowledge from set1 and set2 to support the inference on a new table set3. Besides, we design two baselines for comparison: supervised where the model learns from set3 and predicts on set3 and transfer where the model learns from set1 $^ +$ set2 and continues to be finetuned on set3. Results are in Table 5. We surprisingly find the ZSL model gets better performance than the supervised one on average. It boils down to that (1) ZSL TransTab succeeds to retain the learned knowledge from set1+set2 for predicting on a new table (set3) and (2) ZSL can benefit from more data (set1 $^ +$ set2) than the supervised (set3 only). Meanwhile, the transfer model takes the advantage of set1 $^ +$ set2 and is adapted for set3 by finetuning, hence reaches the best performance. Similarly, we witness that TransTab is able to make zero-shot predictions on public datasets as in Table 11.
|
| 160 |
+
|
| 161 |
+
Additional sensitivity check is provided by Fig. 6 where we vary the overlap ratio of two subsets from the same dataset. We witness that our model makes reasonable predictions even if the training set has no column overlap with the test set.
|
| 162 |
+
|
| 163 |
+
# 3.5 Q5. Supervised and self-supervised pretraining
|
| 164 |
+
|
| 165 |
+
We take experiments to compare the proposed VPCL with the vanilla transfer learning strategy, as in Table 6. We observe that the vanilla strategy harms the performance on two datasets while VPCL always brings positive effect for finetuning. Besides, we conduct experiments on varying the number of partitions and show the average AUROC on all five datasets, shown by Fig. 4. We specify that VPCL demonstrates an advantage over self-VPCL when we increase the partition numbers.
|
| 166 |
+
|
| 167 |
+
We also explore if pretraining works on public datasets. Results in Table 12 somewhat match our expectations that pretraining on unrelated tabular data usually yields few benefits for finetuning because these tables define totally different columns and targeted tasks. We also show the ablation on the number of partitions by Fig. 5 where VPCL consistently outperforms the Supervised baseline.
|
| 168 |
+
|
| 169 |
+
Table 6: Test AUROC on clinical trial datasets under the across-table pretraining plus finetuning setting. Supervised: baseline supervised model; Transfer: vanilla supervised transfer learning. Red shows the one worse than the Supervised baseline.
|
| 170 |
+
|
| 171 |
+
<table><tr><td>TransTab</td><td>N00041119</td><td>N00174655</td><td>NO0312208</td><td>NO0079274</td><td>N00694382</td></tr><tr><td>Supervised</td><td>0.6313</td><td>0.8348</td><td>0.7444</td><td>0.6885</td><td>0.7293</td></tr><tr><td>Transfer</td><td>0.6424</td><td>0.8183</td><td>0.7458</td><td>0.6928</td><td>0.7239</td></tr><tr><td>Self-VPCL</td><td>0.6412</td><td>0.8577</td><td>0.7486</td><td>0.7069</td><td>0.7348</td></tr><tr><td>VPCL</td><td>0.6405</td><td>0.8583</td><td>0.7517</td><td>0.7063</td><td>0.7392</td></tr></table>
|
| 172 |
+
|
| 173 |
+
Nevertheless, it is still worth investigating the table phenotypes to aggregate tables which are more likely to benefit from each other by transfer learning.
|
| 174 |
+
|
| 175 |
+
# 4 Related Works
|
| 176 |
+
|
| 177 |
+
Tabular Prediction. To enhance tabular predictions, numerous recent works try to design new algorithms [28, 36, 37, 30, 38, 32, 5, 10, 7, 39, 40, 41, 42, 43, 44, 45]. However, it was argued that boosting algorithms and MLPs are still the competitive choices for tabular data modeling, especially when the sample size is small [32, 46, 39, 47]. To alleviate label scarcity issue, SSL pretraining on unlabeled tabular data was introduced [2, 24, 10, 9, 11]. Nonetheless, none of them is transferable across tables then is able to extend the success of pretraining to the tabular domain. For practical tabular predictions, the common case is that we own a lot of labeled samples collected with diverse protocols hence heavy preprocessing is needed to align them by either dropping many samples or many features. By contrast, TransTab accepts variable-column tables and therefore can learn from different tables at scale and transfer to the target task. Also, it can support diverse tabular prediction tasks as depicted in Fig. 1, which cannot be done by off-the-shelf tabular methods.
|
| 178 |
+
|
| 179 |
+
Transfer learning. Transfer learning (TL) has long been a popular research field since the proposal of ImageNet [48], which gives rise to splendid works on utilizing supervised pretraining on a large general database and finetune on a small downstream task [49, 50, 51, 52, 53]. TL is also fast-growing in NLP beginning at BERT [20], which often leverages web-scale unlabeled texts for self-supervised pretraining and then applies to specific tasks [34, 54, 55, 56, 57]. However, few work was on TL in tabular predictions. As mentioned in $\ S$ , TransTab paves the way for effective tabular TL by establishing a feature processing protocol that applies for most table inputs, such that it shares knowledge across tables.
|
| 180 |
+
|
| 181 |
+
Self-supervised learning & contrastive learning. SSL uses unlabeled data with pretext tasks to learn useful representations and most of them are in CV and NLP [20, 17, 15, 16, 58, 23, 59, 60, 61, 62, 63]. Recent SSL tabular models can be classified into reconstruction and contrastive based methods: TabNet [30] and VIME [2] try to recover the corrupted inputs with auto-encoding loss; SCARF [11] takes a SimCLR-like [64] contrastive loss between the sample and its corrupted version; SubTab [9] takes a combination of both. Nevertheless, all fail to learn transferable models across tables such that cannot benefit from pretraining with scale. Contrastive learning can also be applied to supervised learning by leveraging class labels to build positive samples [26]. Our work extends it to to the tabular domain, which we prove works better than vanilla supervised pretraining. The vertical partition sampling also enjoys high query speed from large databases which are often column-oriented [25]. Another line of research takes table pretraining table semantic parsing [65, 66, 67, 68, 69] or table-to-text generation [70, 71]. But these methods either encode the whole table instead of each row or do not demonstrate to benefit tabular prediction yet.
|
| 182 |
+
|
| 183 |
+
# 5 Conclusion
|
| 184 |
+
|
| 185 |
+
This paper proposes TransTab that accepts variable-column inputs. By the proposed vertical partition contrastive learning, it can benefit from supervised pretraining from multiple tabular datasets with low memory cost. We envision it to be the basis of tabular foundation models and widely used to tabular-related applications in the future.
|
| 186 |
+
|
| 187 |
+
# Acknowledgement
|
| 188 |
+
|
| 189 |
+
This work was supported by NSF award SCH-2205289, SCH-2014438, IIS-1838042, NIH award R01 1R01NS107291-01.
|
| 190 |
+
|
| 191 |
+
# References
|
| 192 |
+
|
| 193 |
+
[1] Ruoxi Wang, Bin Fu, Gang Fu, and Mingliang Wang. Deep & cross network for ad click predictions. In Proceedings of the ADKDD’17, pages 1–7. 2017. [2] Jinsung Yoon, Yao Zhang, James Jordon, and Mihaela van der Schaar. VIME: Extending the success of self-and semi-supervised learning to tabular domain. Advances in Neural Information Processing Systems, 33:11033–11043, 2020.
|
| 194 |
+
[3] Yixuan Zhang, Jialiang Tong, Ziyi Wang, and Fengqiang Gao. Customer transaction fraud detection using xgboost model. In International Conference on Computer Engineering and Application, pages 554–558. IEEE, 2020.
|
| 195 |
+
[4] Zifeng Wang and Suzhen Li. Data-driven risk assessment on urban pipeline network based on a cluster model. Reliability Engineering & System Safety, 196:106781, 2020. [5] Xin Huang, Ashish Khetan, Milan Cvitkovic, and Zohar Karnin. TabTransformer: Tabular data modeling using contextual embeddings. arXiv preprint arXiv:2012.06678, 2020.
|
| 196 |
+
[6] Inkit Padhi, Yair Schiff, Igor Melnyk, Mattia Rigotti, Youssef Mroueh, Pierre Dognin, Jerret Ross, Ravi Nair, and Erik Altman. Tabular transformers for modeling multivariate time series. In IEEE International Conference on Acoustics, Speech and Signal Processing, pages 3565–3569. IEEE, 2021.
|
| 197 |
+
[7] Radostin Cholakov and Todor Kolev. The GatedTabTransformer. an enhanced deep learning architecture for tabular modeling. arXiv preprint arXiv:2201.00199, 2022.
|
| 198 |
+
[8] Zifeng Wang and Jimeng Sun. SurvTRACE: Transformers for survival analysis with competing events. arXiv preprint arXiv:2110.00855, 2021. [9] Talip Ucar, Ehsan Hajiramezanali, and Lindsay Edwards. SubTab: Subsetting features of tabular data for self-supervised representation learning. Advances in Neural Information Processing Systems, 34, 2021.
|
| 199 |
+
[10] Gowthami Somepalli, Micah Goldblum, Avi Schwarzschild, C Bayan Bruss, and Tom Goldstein. SAINT: Improved neural networks for tabular data via row attention and contrastive pre-training. arXiv preprint arXiv:2106.01342, 2021.
|
| 200 |
+
[11] Dara Bahri, Heinrich Jiang, Yi Tay, and Donald Metzler. SCARF: Self-supervised contrastive learning using random feature corruption. In International Conference on Learning Representations, 2022.
|
| 201 |
+
[12] Fatemeh Nargesian, Erkang Zhu, Ken Q Pu, and Renée J Miller. Table union search on open data. Proceedings of the VLDB Endowment, 11(7):813–825, 2018.
|
| 202 |
+
[13] Erkang Zhu, Dong Deng, Fatemeh Nargesian, and Renée J Miller. Josie: Overlap set similarity search for finding joinable tables in data lakes. In International Conference on Management of Data, pages 847–864, 2019.
|
| 203 |
+
[14] Yuyang Dong, Kunihiro Takeoka, Chuan Xiao, and Masafumi Oyamada. Efficient joinable table discovery in data lakes: A high-dimensional similarity-based approach. In IEEE International Conference on Data Engineering, pages 456–467. IEEE, 2021.
|
| 204 |
+
[15] Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross Girshick. Masked autoencoders are scalable vision learners. arXiv preprint arXiv:2111.06377, 2021.
|
| 205 |
+
[16] 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 International Conference on Learning Representations, 2020.
|
| 206 |
+
[17] Hangbo Bao, Li Dong, and Furu Wei. BEiT: Bert pre-training of image transformers. arXiv preprint arXiv:2106.08254, 2021.
|
| 207 |
+
[18] Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781, 2013.
|
| 208 |
+
[19] Mike Schuster and Kaisuke Nakajima. Japanese and korean voice search. In IEEE international conference on acoustics, speech and signal processing (ICASSP), pages 5149–5152. IEEE, 2012.
|
| 209 |
+
[20] 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.
|
| 210 |
+
[21] Bill Yuchen Lin, Seyeon Lee, Rahul Khanna, and Xiang Ren. Birds have four legs?! NumerSense: Probing numerical commonsense knowledge of pre-trained language models. In Proceedings of the EMNLP, pages 6862–6868, 2020.
|
| 211 |
+
[22] Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
|
| 212 |
+
[23] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in Neural Information Processing Systems, 30, 2017.
|
| 213 |
+
[24] Sajad Darabi, Shayan Fazeli, Ali Pazoki, Sriram Sankararaman, and Majid Sarrafzadeh. Contrastive mixup: Self-and semi-supervised learning for tabular domain. arXiv preprint arXiv:2108.12296, 2021.
|
| 214 |
+
[25] Mike Stonebraker, Daniel J Abadi, Adam Batkin, Xuedong Chen, Mitch Cherniack, Miguel Ferreira, Edmond Lau, Amerson Lin, Sam Madden, Elizabeth O’Neil, et al. C-store: a column-oriented dbms. In Making Databases Work: the Pragmatic Wisdom of Michael Stonebraker, pages 491–518. 2018.
|
| 215 |
+
[26] Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. Supervised contrastive learning. Advances in Neural Information Processing Systems, 33:18661–18673, 2020.
|
| 216 |
+
[27] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 217 |
+
[28] Tianqi Chen and Carlos Guestrin. Xgboost: A scalable tree boosting system. In ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pages 785–794, 2016.
|
| 218 |
+
[29] Günter Klambauer, Thomas Unterthiner, Andreas Mayr, and Sepp Hochreiter. Self-normalizing neural networks. Advances in Neural Information Processing Systems, 30, 2017.
|
| 219 |
+
[30] Sercan O Arık and Tomas Pfister. Tabnet: Attentive interpretable tabular learning. In AAAI, volume 35, pages 6679–6687, 2021.
|
| 220 |
+
[31] Weiping Song, Chence Shi, Zhiping Xiao, Zhijian Duan, Yewen Xu, Ming Zhang, and Jian Tang. AutoInt: Automatic feature interaction learning via self-attentive neural networks. In Proceedings of the 28th ACM International Conference on Information and Knowledge Management, pages 1161–1170, 2019.
|
| 221 |
+
[32] Yury Gorishniy, Ivan Rubachev, Valentin Khrulkov, and Artem Babenko. Revisiting deep learning models for tabular data. Advances in Neural Information Processing Systems, 34, 2021.
|
| 222 |
+
[33] Bernardino Romera-Paredes and Philip Torr. An embarrassingly simple approach to zero-shot learning. In International conference on machine learning, pages 2152–2161. PMLR, 2015.
|
| 223 |
+
[34] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in Neural Information Processing Systems, 33:1877–1901, 2020.
|
| 224 |
+
[35] 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.
|
| 225 |
+
[36] Guolin Ke, Qi Meng, Thomas Finley, Taifeng Wang, Wei Chen, Weidong Ma, Qiwei Ye, and Tie-Yan Liu. LightGBM: A highly efficient gradient boosting decision tree. Advances in Neural Information Processing Systems, 30, 2017.
|
| 226 |
+
[37] Anna Veronika Dorogush, Vasily Ershov, and Andrey Gulin. CatBoost: gradient boosting with categorical features support. arXiv preprint arXiv:1810.11363, 2018.
|
| 227 |
+
[38] Jintai Chen, Kuanlun Liao, Yao Wan, Danny Z Chen, and Jian Wu. Danets: Deep abstract networks for tabular data classification and regression. arXiv preprint arXiv:2112.02962, 2021.
|
| 228 |
+
[39] Vadim Borisov, Tobias Leemann, Kathrin Seßler, Johannes Haug, Martin Pawelczyk, and Gjergji Kasneci. Deep neural networks and tabular data: A survey. arXiv preprint arXiv:2110.01889, 2021.
|
| 229 |
+
[40] Ami Abutbul, Gal Elidan, Liran Katzir, and Ran El-Yaniv. Dnf-net: A neural architecture for tabular data. arXiv preprint arXiv:2006.06465, 2020.
|
| 230 |
+
[41] Liran Katzir, Gal Elidan, and Ran El-Yaniv. Net-dnf: Effective deep modeling of tabular data. In International Conference on Learning Representations, 2020.
|
| 231 |
+
[42] Yuanfei Luo, Hao Zhou, Wei-Wei Tu, Yuqiang Chen, Wenyuan Dai, and Qiang Yang. Network on network for tabular data classification in real-world applications. In Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval, pages 2317–2326, 2020.
|
| 232 |
+
[43] Xiawei Guo, Yuhan Quan, Huan Zhao, Quanming Yao, Yong Li, and Weiwei Tu. TabGNN: Multiplex graph neural network for tabular data prediction. arXiv preprint arXiv:2108.09127, 2021.
|
| 233 |
+
[44] Yuanfei Luo, Mengshuo Wang, Hao Zhou, Quanming Yao, Wei-Wei Tu, Yuqiang Chen, Wenyuan Dai, and Qiang Yang. Autocross: Automatic feature crossing for tabular data in real-world applications. In ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 1936–1945, 2019.
|
| 234 |
+
[45] Jiarui Qin, Weinan Zhang, Rong Su, Zhirong Liu, Weiwen Liu, Ruiming Tang, Xiuqiang He, and Yong Yu. Retrieval & interaction machine for tabular data prediction. In ACM SIGKDD Conference on Knowledge Discovery & Data Mining, pages 1379–1389, 2021.
|
| 235 |
+
[46] Ravid Shwartz-Ziv and Amitai Armon. Tabular data: Deep learning is not all you need. Information Fusion, 81:84–90, 2022.
|
| 236 |
+
[47] Arlind Kadra, Marius Lindauer, Frank Hutter, and Josif Grabocka. Well-tuned simple nets excel on tabular datasets. Advances in Neural Information Processing Systems, 34, 2021.
|
| 237 |
+
[48] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In IEEE Conference on Computer Vision and Pattern Recognition, pages 248–255. IEEE, 2009.
|
| 238 |
+
[49] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
|
| 239 |
+
[50] Jason Yosinski, Jeff Clune, Yoshua Bengio, and Hod Lipson. How transferable are features in deep neural networks? Advances in Neural Information Processing Systems, 27, 2014.
|
| 240 |
+
[51] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition, pages 770–778, 2016.
|
| 241 |
+
[52] Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In IEEE Conference on Computer Vision and Pattern Recognition, pages 4700– 4708, 2017.
|
| 242 |
+
[53] Barret Zoph, Vijay Vasudevan, Jonathon Shlens, and Quoc V Le. Learning transferable architectures for scalable image recognition. In IEEE Conference on Computer Vision and Pattern Recognition, pages 8697–8710, 2018.
|
| 243 |
+
[54] 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.
|
| 244 |
+
[55] 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:1–67, 2020.
|
| 245 |
+
[56] Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. XLNet: Generalized autoregressive pretraining for language understanding. Advances in Neural Information Processing Systems, 32, 2019.
|
| 246 |
+
[57] Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. BART: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. In Annual Meeting of the Association for Computational Linguistics, pages 7871–7880, 2020.
|
| 247 |
+
[58] Tianyu Gao, Xingcheng Yao, and Danqi Chen. Simcse: Simple contrastive learning of sentence embeddings. In Conference on Empirical Methods in Natural Language Processing, pages 6894–6910, 2021.
|
| 248 |
+
[59] Jacob Devlin Ming-Wei Chang Kenton and Lee Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of NAACL-HLT, pages 4171–4186, 2019.
|
| 249 |
+
[60] Yao-Hung Hubert Tsai, Shaojie Bai, Paul Pu Liang, J Zico Kolter, Louis-Philippe Morency, and Ruslan Salakhutdinov. Multimodal transformer for unaligned multimodal language sequences. In Proceedings of the Annual Meeting of the Association for Computational Linguistics, 2019.
|
| 250 |
+
[61] Hassan Akbari, Liangzhe Yuan, Rui Qian, Wei-Hong Chuang, Shih-Fu Chang, Yin Cui, and Boqing Gong. VATT: Transformers for multimodal self-supervised learning from raw video, audio and text. Advances in Neural Information Processing Systems, 34, 2021.
|
| 251 |
+
[62] Dmitry Lepikhin, HyoukJoong Lee, Yuanzhong Xu, Dehao Chen, Orhan Firat, Yanping Huang, Maxim Krikun, Noam Shazeer, and Zhifeng Chen. GShard: Scaling giant models with conditional computation and automatic sharding. In International Conference on Learning Representations, 2020.
|
| 252 |
+
[63] 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.
|
| 253 |
+
[64] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pages 1597–1607. PMLR, 2020.
|
| 254 |
+
[65] Pengcheng Yin, Graham Neubig, Wen-tau Yih, and Sebastian Riedel. TaBERT: Pretraining for joint understanding of textual and tabular data. In Annual Meeting of the Association for Computational Linguistics, pages 8413–8426, 2020.
|
| 255 |
+
[66] Hiroshi Iida, Dung Thai, Varun Manjunatha, and Mohit Iyyer. TABBIE: Pretrained representations of tabular data. In Conference of the North American Chapter of the Association for Computational Linguistics, 2021.
|
| 256 |
+
[67] Xi Victoria Lin, Richard Socher, and Caiming Xiong. Bridging textual and tabular data for cross-domain text-to-sql semantic parsing. arXiv preprint arXiv:2012.12627, 2020.
|
| 257 |
+
[68] Xiang Deng, Huan Sun, Alyssa Lees, You Wu, and Cong Yu. TURL: Table understanding through representation learning. Proceedings of the VLDB Endowment, 2021.
|
| 258 |
+
[69] Jingfeng Yang, Aditya Gupta, Shyam Upadhyay, Luheng He, Rahul Goel, and Shachi Paul. TableFormer: Robust transformer modeling for table-text encoding. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics, pages 528–537, 2022.
|
| 259 |
+
[70] Fei Wang, Kexuan Sun, Muhao Chen, Jay Pujara, and Pedro A Szekely. Retrieving complex tables with multi-granular graph representation learning. In SIGIR, 2021.
|
| 260 |
+
[71] Fei Wang, Zhewei Xu, Pedro Szekely, and Muhao Chen. Robust (controlled) table-to-text generation with structure-aware equivariance learning. arXiv preprint arXiv:2205.03972, 2022.
|
| 261 |
+
[72] Vincenzo Cutrona. Semantic enrichment for large-scale data analytics. 2019.
|
| 262 |
+
[73] 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, 2019.
|
| 263 |
+
[74] Aaron Van den Oord, Yazhe Li, Oriol Vinyals, et al. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2(3):4, 2018.
|
| 264 |
+
|
| 265 |
+
# Checklist
|
| 266 |
+
|
| 267 |
+
1. For all authors...
|
| 268 |
+
|
| 269 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 270 |
+
(b) Did you describe the limitations of your work? [Yes] See $\ S \ 3 . 5$ and Appendix $\ S \mathrm { A }$ .
|
| 271 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Appendix $\ S \mathrm { A }$ .
|
| 272 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 273 |
+
|
| 274 |
+
2. If you are including theoretical results...
|
| 275 |
+
|
| 276 |
+
(a) Did you state the full set of assumptions of all theoretical results? [N/A] This paper does not include theoretical results.
|
| 277 |
+
(b) Did you include complete proofs of all theoretical results? [N/A] This paper does not include theoretical results.
|
| 278 |
+
|
| 279 |
+
3. If you ran experiments...
|
| 280 |
+
|
| 281 |
+
(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 supplementary materials.
|
| 282 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] For our methods please see Model and Implementation Protocols of $\ S$ ; for the compared baselines please see Appendix $\ S _ { \mathrm { B } }$ ;
|
| 283 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 284 |
+
(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] Please see Model and Implementation Protocols of $\ S 3$ .
|
| 285 |
+
|
| 286 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 287 |
+
|
| 288 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] See Table 13.
|
| 289 |
+
|
| 290 |
+
(b) Did you mention the license of the assets? [Yes] Licenses are available referring to the provided links.
|
| 291 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] See Appendix $\ S C$ .
|
| 292 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes] See Appendix $\ S$ .
|
| 293 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] See Appendix $\ S C$ .
|
| 294 |
+
|
| 295 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 296 |
+
|
| 297 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] This paper does not use crowdsourcing.
|
| 298 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] This paper does not use crowdsourcing.
|
| 299 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] This paper does not use crowdsourcing.
|
md/dev/AOKU4nRw1W/AOKU4nRw1W.md
ADDED
|
@@ -0,0 +1,429 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Linguistic Binding in Diffusion Models: Enhancing Attribute Correspondence through Attention Map Alignment
|
| 2 |
+
|
| 3 |
+
Royi Rassin Bar-Ilan University, Israel rassinroyi@gmail.com
|
| 4 |
+
|
| 5 |
+
Eran Hirsch Bar-Ilan University, Israel eran.hirsch@biu.ac.il
|
| 6 |
+
|
| 7 |
+
Daniel Glickman Bar-Ilan University, Israel danielglickman1@gmail.com
|
| 8 |
+
|
| 9 |
+
# Shauli Ravfogel
|
| 10 |
+
|
| 11 |
+
Bar-Ilan University, Israel Allen Institute for AI, Israel shauli.ravfogel@gmail.com
|
| 12 |
+
|
| 13 |
+
Yoav Goldberg Bar-Ilan University, Israel Allen Institute for AI, Israel yoav.goldberg@gmail.com
|
| 14 |
+
|
| 15 |
+
Gal Chechik
|
| 16 |
+
Bar-Ilan University, Israel NVIDIA, Israel
|
| 17 |
+
gal.chechik@biu.ac.il
|
| 18 |
+
|
| 19 |
+
# Abstract
|
| 20 |
+
|
| 21 |
+
Text-conditioned image generation models often generate incorrect associations between entities and their visual attributes. This reflects an impaired mapping between linguistic binding of entities and modifiers in the prompt and visual binding of the corresponding elements in the generated image. As one example, a query like “a pink sunflower and a yellow flamingo” may incorrectly produce an image of a yellow sunflower and a pink flamingo. To remedy this issue, we propose SynGen, an approach which first syntactically analyses the prompt to identify entities and their modifiers, and then uses a novel loss function that encourages the cross-attention maps to agree with the linguistic binding reflected by the syntax. Specifically, we encourage large overlap between attention maps of entities and their modifiers, and small overlap with other entities and modifier words. The loss is optimized during inference, without retraining or fine-tuning the model. Human evaluation on three datasets, including one new and challenging set, demonstrate significant improvements of SynGen compared with current state of the art methods. This work highlights how making use of sentence structure during inference can efficiently and substantially improve the faithfulness of text-to-image generation.1
|
| 22 |
+
|
| 23 |
+
# 1 Introduction
|
| 24 |
+
|
| 25 |
+
Diffusion models for text-conditioned image generation produce impressive realistic images [1, 2, 3, 4]. Users control the generated content through natural-language text prompts that can be rich and complex. Unfortunately, in many cases the generated images are not faithful to the text prompt [5, 6]. Specifically, one very common failure mode results from improper binding, where modifier words fail to influence the visual attributes of the entity-nouns to which they are grammatically related.
|
| 26 |
+
|
| 27 |
+

|
| 28 |
+
Figure 1: Visual bindings of objects and their attributes may fail to match the linguistic bindings between entities and their modifiers. Our approach, SynGen, corrects these errors by matching the cross-attention maps of entities and their modifiers.
|
| 29 |
+
|
| 30 |
+
As an illustration, consider the prompt “a pink sunflower and a yellow flamingo”. Given this prompt, current models often confuse the modifiers of the two entity-nouns, and generate an image of a yellow sunflower and a pink flamingo (Fig. 1, bottom left, semantic leak in prompt). In other cases, the attribute may semantically leak to areas in the image that are not even mentioned in the prompt (Fig. 1, bottom center, semantic leak outside prompt) or the attribute may be completely neglected and missed from the generated image (Fig. 1, bottom right, attribute neglect). Such mismatch can be addressed by providing non-textual control like visual examples [7, 8], but the problem of correctly controlling generated images using text remains open.
|
| 31 |
+
|
| 32 |
+
A possible reason for these failures is that diffusion models use text encoders like CLIP [9], which are known to fail to encode linguistic structures [10]. This makes the diffusion process “blind" to the linguistic bindings, and as a result, generate objects that do not match their attributes. Building on this intuition, we propose to make the generation process aware of the linguistic structure of the prompt. Specifically, we suggest to intervene with the generation process by steering the cross-attention maps of the diffusion model. These cross-attention map serve as a link between prompt terms and the set of image pixels that correspond to these terms. Our linguistics-based approach therefore aims to generate an image where the visual binding between objects and their visual attributes adheres to the syntactic binding between entity-nouns and their modifiers in the prompt.
|
| 33 |
+
|
| 34 |
+
Several previous work devised solutions to improve the relations between prompt terms and visual components, with some success [11, 12, 13]. They did not focus on the problem of modifier-entity binding. Our approach specifically addresses this issue, by constructing a novel loss function that quantifies the distance between the attention patterns of grammatically-related (modifier, entity-noun) pairs, and the distance between pairs of unrelated words in the prompt. We then optimize the latent denoised image in the direction that separates the attention map of a given modifier from unrelated tokens and bring it closer to its grammatically-related noun. We show that by intervening in the latent code, we markedly improve the pairing between attributes and objects in the generated image while at the same time not compromising the quality of the generated image.
|
| 35 |
+
|
| 36 |
+
We evaluate our method on three datasets. (1) For a natural-language setting, we use the natural compositional prompts in the ABC-6K benchmark [13]; (2) To provide direct comparison with previous state-of-the-art in [11], we replicate prompts from their setting; (3) Finally, to evaluate binding in a challenging setting, we design a set of prompts that includes a variety of modifiers and entity-nouns. On all datasets, we find that SynGen shows significant improvement in performance based on human evaluation, sometimes doubling the accuracy. Overall, our work highlights the effectiveness of incorporating linguistic information into text-conditioned image generation models and demonstrates a promising direction for future research in this area.
|
| 37 |
+
|
| 38 |
+
(a) Entity-Modifier Identification
|
| 39 |
+
|
| 40 |
+

|
| 41 |
+
Figure 2: The SynGen workflow and architecture. (a) The text prompt is analyzed to extract entitynouns and their modifiers. (b) SynGen adds intermediates steps to the diffusion denoising process. In that step, we update the latent representation to minimize a loss over the cross attention maps of entity-nouns and their modifiers (Eq 3).
|
| 42 |
+
|
| 43 |
+
The main contributions of this paper are as follows: (1) A novel method to enrich the diffusion process with syntactic information, using inference-time optimization with a loss over cross-attention maps; (2) A new challenge set of prompts containing a rich number and types of modifiers and entities.
|
| 44 |
+
|
| 45 |
+
# 2 Syntax-Guided Generation
|
| 46 |
+
|
| 47 |
+
Our approach, which we call SynGen, builds on two key ideas. First, it is easy to analyze the syntactic structure of natural language prompts to identify bindings of entity-nouns and their modifiers. Second, one can steer the generation of images to adhere to these bindings by designing an appropriate loss over the cross-attention maps of the diffusion model. We describe the two steps of our approach: extracting syntactic bindings and then using them to control generation.
|
| 48 |
+
|
| 49 |
+
# 2.1 Identifying entity-nouns and their modifiers
|
| 50 |
+
|
| 51 |
+
To identify entity-nouns and their corresponding modifiers, we traverse the syntactic dependency graph, which defines the syntactic relation between words in the sentence. Concretely, we parse the prompt using spaCy’s transformer-based dependency parser [14] and identify all entity-nouns (either proper-nouns or common-nouns) that are not serving as direct modifiers of other nouns.
|
| 52 |
+
|
| 53 |
+
These are the nouns that correspond to objects in the generated image. We then recursively collect all modifiers2 of the noun into its modifier set. The set of modifier-labels includes a range of syntactic relations between nouns and their modifiers, such adjectivial modification (amod; “the regal dog”), compounds (compound; “the treasure map”), nominal modification through an intervening marker, adverbial modifiers (npadvmod; “A watermelon-styled chair”), adjectivial complement (acomp; “The apple is blue”), and coordination between modifiers (conj; “A black and white dog”).
|
| 54 |
+
|
| 55 |
+
# 2.2 Controlling generation with language-driven cross-attention losses
|
| 56 |
+
|
| 57 |
+
Consider a pair of a noun and its modifier. We expect the cross-attention map of the modifier to largely overlap with the cross-attention map of the noun, while remaining largely disjoint with the maps corresponding to other nouns and modifiers. To encourage the denoising process to obey these spatial relations between the attention maps, we design a loss that operates on all cross-attention maps. We then use this loss with a pretrained diffusion model during inference. Specifically, we
|
| 58 |
+
|
| 59 |
+

|
| 60 |
+
Figure 3: Evolution of cross-attention maps and latent representation along denoising steps, for the prompt “a red crown and a golden strawberry”. At first, the attention maps of all modifiers and entity-nouns are intertwined, regardless of the expected binding. During denoising, attention maps gradually becomes separated, adhering the syntactic bindings. The vertical line indicates that after 25 steps intervention stops, but the attention maps remain separated.
|
| 61 |
+
|
| 62 |
+
optimize the noised latents by taking a gradient step to reduce that loss. See illustration in Fig. 2.
|
| 63 |
+
Fig. 3 illustrates the effect of the loss over the cross-attention maps.
|
| 64 |
+
|
| 65 |
+
Loss functions: Consider a text prompt with $N$ tokens, for which our analysis extracted $k$ nounmodifier sets $\{ S _ { 1 } , S _ { 2 } , \ldots , S _ { k } \}$ . Let $P ( S _ { i } )$ represent all pairs $( m , n )$ of tokens between the noun root $n$ and its modifier descendants $m$ in the $i$ -th set $S _ { i }$ . For illustration, the set of “A black striped dog” contains two pairs (“black”, “dog”) and (“striped”, “dog”). Next, denote by $\{ A _ { 1 } , A _ { 2 } , \dotsc , { \overline { { A _ { N } } } } \}$ the attention maps of all $N$ tokens in the prompt, and denote by $d i s t ( A _ { m } , A _ { n } )$ a measure of distance (lack of overlap) between attention maps $A _ { m }$ and $A _ { n }$ .
|
| 66 |
+
|
| 67 |
+
Our first loss aims to minimize that distance (maximize the overlap) over all pairs of modifiers and their corresponding entity-nouns $( m , n )$ ,
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
\mathcal { L } _ { p o s } ( A , S ) = \sum _ { i = 1 } ^ { k } \sum _ { ( m , n ) \in P ( S _ { i } ) } d i s t ( A _ { m } , A _ { n } ) .
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
We also construct a loss that compares pairs of modifiers and entity-nouns with the remaining words in the prompt, which are grammatically unrelated to these pairs. In other words, this loss is defined between words within the (modifiers, entity-nouns) set and words outside of it. Formally, let $U ( S _ { i } )$ represent the set of unmatched words obtained by excluding the words in $S _ { i }$ from the full set of words and $A _ { u }$ is the corresponding attention map for a given unrelated word $u$ . The following loss encourages moving apart grammatically-unrealted pairs of words:
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
\mathcal { L } _ { n e g } = - \sum _ { i = 1 } ^ { k } \frac { 1 } { | U ( S _ { i } ) | } \sum _ { ( m , n ) \in P ( S _ { i } ) } \sum _ { u \in U ( S _ { i } ) } \frac { 1 } { 2 } \bigg ( d i s t ( A _ { m } , A _ { u } ) + d i s t ( A _ { u } , A _ { n } ) \bigg ) .
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
Our final loss combines the two loss terms:
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
\begin{array} { r } { \mathcal { L } = \mathcal { L } _ { p o s } + \mathcal { L } _ { n e g } . } \end{array}
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
For a measure of distance between attention maps we use a symmetric Kullback-Leibler divergence $\begin{array} { r } { d i s t ( A _ { i } , A _ { j } ) = \frac { 1 } { 2 } D _ { K L } ( A _ { i } | | A _ { j } ) + \frac { 1 } { 2 } D _ { K L } ( A _ { j } | | \mathcal { \bar { A } } _ { i } ) } \end{array}$ , where $A _ { i }$ , $A _ { j }$ are attention maps normalized to a sum of 1, $i$ and $j$ are generic indices, and $\begin{array} { r } { \dot { D _ { K L } } ( A _ { i } | | A _ { j } ) = \sum _ { p i x e l s } A _ { i } \log ( A _ { i } / A _ { j } ) } \end{array}$ .
|
| 86 |
+
|
| 87 |
+
Our test-time optimization approach resembles the one of [11], which defined a loss over the crossattention maps to update the latents at generation time. However, their loss aims to maximize the presence of the smallest attention map at a given timestep to guarantee a set of selected tokens is included in the generated image, and our loss depends on pairwise relations of linguistically-related words and aims to align the diffusion process to the linguistic-structure of the prompt.
|
| 88 |
+
|
| 89 |
+
# 2.3 The workflow
|
| 90 |
+
|
| 91 |
+
We use the loss of Eqs 1-3 to intervene in the first 25 out of 50 denoising steps. Empirically, using a smaller number of steps did not correct well improper binding, and using a larger number generated blurred images, as detailed in Appendix B. In each of the first 25 steps, a pretrained denoiser (U-Net) was first used to denoise the latent variable $z _ { t }$ . Then, we obtained the cross-attention maps as in [15]. Next, we used the loss $\mathcal { L }$ to update the latent representation $z _ { t }$ with a gradient step $z _ { t } ^ { \prime } = z _ { t } - \alpha \cdot \nabla _ { z _ { t } } \mathcal { L }$ . Finally, the U-Net architecture denoises the updated latent variable $z _ { t } ^ { \prime }$ for the next timestep.
|
| 92 |
+
|
| 93 |
+
# 3 Experiments
|
| 94 |
+
|
| 95 |
+
# 3.1 Compared baseline methods
|
| 96 |
+
|
| 97 |
+
We compare SynGen with three baseline methods. (1) Stable Diffusion 1.4 (SD) [1]; (2) Structured Diffusion [13], extracts noun-phrases from the prompt and embeds them separately, to improve the mapping of the semantics in the cross-attention maps; and (3) Attend-and-Excite (A&E) [11], a method that given a predetermined set of tokens, updates the latent a certain number of timesteps, to eventually incorporate these tokens in the generated image. To automate token selection in A&E, we follow the recommendation by the authors to select the nouns using a part-of-speech tagger.
|
| 98 |
+
|
| 99 |
+
# 3.2 Datasets
|
| 100 |
+
|
| 101 |
+
We evaluate our approach using two existing benchmark datasets, and one new dataset that we designed to challenge methods in this area.
|
| 102 |
+
|
| 103 |
+
(1) ABC-6K [13]. This benchmark consists of 3.2K natural compositional prompts from MSCOCO [16], which were manually written by humans, using natural language and contain at least two color words modifying different noun-entities. In addition, the dataset contains 3.2K counterparts, where the position of modifiers in the original prompts are swapped. (e.g., “a white bench in front of a green bush” and “a green bench in front of a white bush”). We randomly sample 600 prompts.
|
| 104 |
+
|
| 105 |
+
(2) Data from Attend-and-Excite [11]. Originally introduced to evaluate the A&E method which focuses on entity-neglect, this dataset also showed that A&E improved over previous work in terms of improper binding.
|
| 106 |
+
|
| 107 |
+
Prompts in this dataset belong to three categories: (1) “a {color} {in-animate object} and a {color} {in-animate object}”; (2) “a {color} {in-animate object} and an {animal}”; (3) “an {animal} and an {animal}”. Following the split in A&E, we sample 33 prompts from type (1) and 144 prompts from type (2), but exclude type (3), as it does not contain modifiers. This is a very simple dataset, which we use to facilitate direct comparison with previous work.
|
| 108 |
+
|
| 109 |
+
(3) Diverse Visual Modifier Prompts (DVMP). The above two datasets are limited in terms of number and types of modifiers, and the number of entity-nouns per prompt. To challenge our model, we design a dataset consisting of coordination sentences, in similar fashion to the dataset from A&E, but with strong emphasis on the number and types of modifiers per prompt. Specifically, we aim to compare the models with prompts that contain numerous and uncommon modifiers, creating sentences that would not usually be found in natural language or training data, such as “a pink spotted panda”. DVMP was designed with two key aspects in mind:
|
| 110 |
+
|
| 111 |
+
Expanding the set of modifiers: We have extended the number of modifiers referring to an entitynoun from one to up to three. For instance, “a blue furry spotted bird”. We also added types of modifiers besides colors, including material patterns (“a metal chair”), design patterns (“a checkered shoe”), and even nouns modifying other noun-entities (“a baby zebra”).
|
| 112 |
+
|
| 113 |
+
Visually verifiable and semantically coherent: The modifiers selected for DVMP are visually verifiable, with a deliberate avoidance of nuanced modifiers. For instance, “big” is a relative modifier dependent on its spatial context, and emotional states, such as in the prompt “an excited dog”, are largely excluded due to their subjective visual interpretation. Simultaneously, DVMP maintains semantic coherence by appropriately matching modifiers to noun-entities, thereby preventing the creation of nonsensical prompts like “a sliced bowl” or “a curved zebra”.
|
| 114 |
+
|
| 115 |
+
In total, we have generated 600 prompts through random sampling. For a comprehensive description of the dataset’s creation, see Appendix F.
|
| 116 |
+
|
| 117 |
+
# 3.3 Human Evaluation
|
| 118 |
+
|
| 119 |
+
We evaluate image quality using Amazon Mechanical Turk (AMT). Raters were provided with a multiple-choice task, consisting of a single text prompt and four images, each generated by the baselines and SynGen. Raters could also indicate that all images are “equally good” or “equally bad”. We provided each prompt and its corresponding generations to three raters, and report the majority decision. In cases where there is no majority model winner, we count it toward “no majority winner”.
|
| 120 |
+
|
| 121 |
+
We evaluate generated images in two main aspects: (1) concept separation (sometimes known as editability [17]) and (2) visual appeal. Concept separation refers to the ability of the model to distinctly depict different concepts or objects in the generated image. The effectiveness of concept separation is assessed by asking raters, “Which image best matches the given description?”. To asses visual quality, raters were asked “Which image is more visually appealing?”. To maintain fairness and reduce biases, the order of images was randomized in each task. Full rater instructions and further details are provided in Appendix G.1 of the supplemental materials.
|
| 122 |
+
|
| 123 |
+
We also experimented automatic evaluation, but find its quality subpar. For standardized evaluation purposes, it is detailed in Appendix G.2.
|
| 124 |
+
|
| 125 |
+
Fine-grained evaluation. In addition to a multiple-choice task, we evaluate concept separation using the following key metrics: (1) Proper Binding, quantifying how well the model associates attributes with their corresponding objects; (2) Improper Binding, measuring the instances where attributes are incorrectly linked to unrelated objects; and (3) Entity Neglect, capturing the frequency with which the model omits entities specified in the prompt.
|
| 126 |
+
|
| 127 |
+
To this end, we randomly select 200 prompts each from the DVMP and ABC-6K datasets, while using all 177 prompts available in the A&E dataset. Human evaluators were asked to mark if instances have correct or incorrect attribute-object mapping. Importantly, incorrect mappings are counted on a per-attribute basis—multiple incorrect mappings of a single attribute are considered one violation. For example, in the prompt “the white dog chased the cat up the tree”, if the modifier “white” is incorrectly mapped to both “cat” and “tree”, it is counted as one instance of violation. Evaluators also identify the number of entities mentioned in the prompt that are subsequently depicted in the generated image.
|
| 128 |
+
|
| 129 |
+
Based on these counts, we define the metric of Proper Binding as the ratio of correctly mapped attributes to the total number of attributes. Similarly, Improper Binding is defined as the ratio of incorrectly mapped attributes to the total number of attributes, while Entity Neglect is the complement of the ratio of mentioned entities that are depicted in the generated image to the total number of entities in the prompt. Rater instructions are provided in Appendix G.1.
|
| 130 |
+
|
| 131 |
+
# 4 Results
|
| 132 |
+
|
| 133 |
+
# 4.1 Quantitative Results
|
| 134 |
+
|
| 135 |
+
Table 1 provides results of the comparative experiment. SynGen is consistently ranked first in all three datasets, and by a large margin, sometimes double the approval rate of the second ranked method, A&E. These results are observed for concept separation, which measures directly the semantic leak, and for visual appeal.
|
| 136 |
+
|
| 137 |
+
The high number of “no winner” cases reflects the large difficulty of some of the prompts, for which no method provides good enough generated images. Population results before majority aggregation are given in Appendix G.1 of the supplemental material. Comparisons with StableDiffusion are given in Fig. 19 of the supplemental.
|
| 138 |
+
|
| 139 |
+
Table 2 provides results of the individual experiment. We find that SynGen outperforms all models by a landslide in both proper and improper binding and is on par with state-of-the-art on entity neglect [11], despite not directly tackling this problem.
|
| 140 |
+
|
| 141 |
+
Table 1: Human evaluation of all methods on the three datasets. The table reports scores for concept separation (how well the image matches the prompt) and visual appeal. Values are the fraction of majority vote of three raters, normalized to sum to 100.
|
| 142 |
+
|
| 143 |
+
<table><tr><td colspan="2"></td><td colspan="2">Concept Visual Separation Appeal</td></tr><tr><td>Dataset</td><td>Model</td><td>38.42</td><td>37.85</td></tr><tr><td rowspan="4">A&E</td><td>SynGen (ours) A&E</td><td>18.08</td><td>18.65</td></tr><tr><td>Structured Diffusion</td><td>04.52</td><td>04.52</td></tr><tr><td>Stable Diffusion</td><td>01.69</td><td>02.26</td></tr><tr><td>No majority winner</td><td>37.29</td><td>36.72</td></tr><tr><td rowspan="5">DVMP (challenge set)</td><td>SynGen (ours)</td><td>24.84</td><td>16.00</td></tr><tr><td>A&E</td><td>13.33</td><td>12.17</td></tr><tr><td>Structured Diffusion</td><td>04.33</td><td>07.83</td></tr><tr><td>Stable Diffusion</td><td>03.83</td><td>07.17</td></tr><tr><td> No majority winner</td><td>53.67</td><td>56.83</td></tr><tr><td rowspan="5">ABC-6K</td><td>SynGen (ours)</td><td>28.00</td><td>18.34</td></tr><tr><td>A&E</td><td>11.17</td><td>10.00</td></tr><tr><td>Structured Diffusion</td><td>05.83</td><td>06.33</td></tr><tr><td>Stable Diffusion</td><td>04.83</td><td>07.83</td></tr><tr><td>No majority winner</td><td>50.17</td><td>57.50</td></tr></table>
|
| 144 |
+
|
| 145 |
+
Table 2: Results of the fine-grained concept separation experiment. Proper Binding should be maximized to 100, while Improper Binding and Entity Neglect should be minimized to 0.
|
| 146 |
+
|
| 147 |
+
<table><tr><td colspan="4">Proper Binding ↑Improper Binding↓Entity Neglect↓</td></tr><tr><td>Dataset</td><td>Model</td><td>94.76</td><td>23.81 02.82</td></tr><tr><td rowspan="4">A&E</td><td>SynGen (ours) A&E</td><td>81.90</td><td>63.81 01.41</td></tr><tr><td>Structured Diffusion</td><td>55.71</td><td>67.62 21.13</td></tr><tr><td>Stable Diffusion</td><td>59.05</td><td>68.57 20.56</td></tr><tr><td></td><td></td><td>16.26</td></tr><tr><td rowspan="4">DVMP</td><td>SynGen (ours) A&E</td><td>74.90 52.47</td><td>19.49 31.64</td></tr><tr><td>(challenge set) Structured Diffusion</td><td>48.73</td><td>10.77 30.57 28.46</td></tr><tr><td>Stable Diffusion</td><td>47.80</td><td>30.44</td></tr><tr><td></td><td></td><td>26.22</td></tr><tr><td rowspan="4">ABC-6K</td><td>SynGen (ours)</td><td>63.68</td><td>14.37 34.41</td></tr><tr><td>A&E</td><td>56.26</td><td>26.43 33.18</td></tr><tr><td>Structured Diffusion</td><td>51.47</td><td>29.52 34.57</td></tr><tr><td>Stable Diffusion</td><td>52.70</td><td>27.20 36.57</td></tr></table>
|
| 148 |
+
|
| 149 |
+
# 4.2 Qualitative Analysis
|
| 150 |
+
|
| 151 |
+
Figures 4–6 provide qualitative examples from the three datasets, comparing SynGen with the two strongest baselines.
|
| 152 |
+
|
| 153 |
+
The qualitative examples illustrate several failure modes of our baselines. First, semantic leak in prompt, occurs when a modifier of an entity-noun “leaks” onto a different entity-noun in the prompt, as shown in Fig. 4, for the prompt “a pink clock and a brown chair”, in columns 3 and 4. In this case, all baselines incorrectly apply pink hues to the chair, despite the prompt explicitly defining it as brown. A more nuanced variant of this issue is semantic leak out of prompt, when a modifier is assigned to an entity-noun that is not mentioned in the prompt. For instance, the “spiky” attribute in “a spiky bowl and a green cat” leaks to a plant, which is not in the prompt, or the green coloration in the background of the images generated by the baselines, as seen in columns 5 and 6 in Fig. 5.
|
| 154 |
+
|
| 155 |
+
Attribute neglect occurs when a modifier from the prompt is absent from the generated image. As exhibited in Fig. 4, for “a frog and a brown apple”, both baselines do not include a brown color at all.
|
| 156 |
+
|
| 157 |
+
Entity casting is another failure type where a modifier is treated as a standalone entity, a phenomenon commonly observed with noun modifiers. For example, the prompt “a wooden crown and a furry baby
|
| 158 |
+
|
| 159 |
+
“a monkey and a black bow”
|
| 160 |
+
|
| 161 |
+
“a pink clock and a brown chair”
|
| 162 |
+
|
| 163 |
+
“a frog and a brown apple”
|
| 164 |
+
|
| 165 |
+

|
| 166 |
+
Figure 4: Qualitative comparison for prompts from the Attend-and-Excite dataset. For every prompt, the same three seeds are used for all methods.
|
| 167 |
+
|
| 168 |
+

|
| 169 |
+
Figure 5: Qualitative comparison for prompts from the DVMP dataset. For every prompt, the same three seeds are used for all methods.
|
| 170 |
+
|
| 171 |
+
rabbit” (column 1 in Fig. 5) has all methods, apart from ours, generate human infants. Presumably, this occurs because “baby” is interpreted as a noun rather than as a modifier, leading other methods to treat it as a separate object due to the lack of syntactic context. Conversely, SynGen correctly interprets “baby” as a modifier and accurately binds it to the rabbit. Similarly, in the prompt “a white fire hydrant sitting in a field next to a red building” (column 6 in Fig. 6), “fire” is wrongly interpreted as an entity-noun, which leads to the unwarranted inclusion of a fire in the scene.
|
| 172 |
+
|
| 173 |
+
All methods, barring SynGen, grapple with entity entanglement [18, 19, 20, 21, 22], where some objects tend to strongly associate with their most common attribute (e.g., tomatoes are typically red). This is evident in columns 3 and 4 in Fig. 6, where other methods fail to visually associate the blue attribute with the dog in “a blue and white dog sleeps in front of a black door”. Instead, they resort to typical attributes of the objects, generating a black and white dog.
|
| 174 |
+
|
| 175 |
+
Further qualitative analysis is provided in Appendix D.1.
|
| 176 |
+
|
| 177 |
+

|
| 178 |
+
Figure 6: Qualitative examples for ABC-6K prompts. For every prompt, all methods use the same three seeds.
|
| 179 |
+
|
| 180 |
+
# 4.3 Ablation study
|
| 181 |
+
|
| 182 |
+
The importance of using both positive and negative losses. We evaluated the relative importance of the two terms in our loss Eq. (3). The positive term $\mathcal { L } _ { p o s }$ , which encourages alignment of the attention map of an object and its modifiers, and the negative loss term, $\mathcal { L } _ { n e g }$ , which discourages alignment with other modifiers and objects. We sampled 100 prompts from the DVMP dataset and generated images with and without each of the two loss terms. See example in Fig. 7. Then, raters were asked to select the best of four variants. Table 3 shows that raters preferred the variant that combined both the positive and the negative terms. More examples are given in the supplemental Appendix B.
|
| 183 |
+
|
| 184 |
+
Table 3: Ablation of loss components. Values are percent preferred by human raters.
|
| 185 |
+
|
| 186 |
+
<table><tr><td>Loss</td><td>Concept Separation</td><td>Visual Appeal</td></tr><tr><td>Both losses Lpos +Lneg</td><td>27</td><td>22</td></tr><tr><td>Positive only Lpos</td><td>0</td><td>11</td></tr><tr><td>Negative only Lneg</td><td>3</td><td>35</td></tr><tr><td>Stable Diffusion</td><td>4</td><td>28</td></tr><tr><td>No majority winner</td><td>66</td><td>4</td></tr></table>
|
| 187 |
+
|
| 188 |
+

|
| 189 |
+
Figure 7: Ablation of loss components. Removing $\mathcal { L } _ { n e g }$ results in semantic leakage (the bird is white) and entity neglect (there is no crown). Removing $\mathcal { L } _ { p o s }$ also leads to semantic leakage (generating a bird and background with white parts), and failed attribution binding (generating a crown that is not white).
|
| 190 |
+
|
| 191 |
+
# 5 Related Work
|
| 192 |
+
|
| 193 |
+
Semantic leakage. [2] pointed out cases of semantic leakage in diffusion models, where properties of one entity-noun influence the depiction of another. [23] attributed this issue to a lack of understanding of syntax, specifically noting failures when processing texts requiring subtle syntactic binding comprehension. [6] identified semantic leakage issues in DALL-E, where properties of one entitynoun influence how other entity nouns are depicted. In this work, we pinpoint semantic leakage as a consequence of improper mapping between syntactic and visual binding.
|
| 194 |
+
|
| 195 |
+
Attention-based interventions. [15] demonstrated that the cross-attention mechanism determines the spatial layout of entities in generated images. This result suggested that cross-attention is causally involved in the aforementioned issues. A&E [11] addresses the problem of entity omission, where certain entities mentioned in the prompt do not appear in the generated image. They propose a loss function that encourages each noun token in the image to significantly attend to a corresponding image patch, thereby preventing its omission. Our approach is similar to [11] in that it updates the latent representation through a loss function over attention maps, during image generation.
|
| 196 |
+
|
| 197 |
+
Syntax-based generation was also explored in [13], proposing the Structured Diffusion method. It aims to address the problem of missing entities and semantic leakage of attributes. This is achieved by parsing the prompt, extracting phrases corresponding to nouns and modifiers, and encoding them separately. They also intervene in the attention patterns, ensuring that each individual phrase influences the attention patterns. Our experiments show that it is better to implicitly influence the attention patterns through our loss which we dynamically optimize. In contrast, their intervention remains fixed.
|
| 198 |
+
|
| 199 |
+
Concurrent to this work, [24] proposed an alternative approach to combine syntactic control and attention-based optimization. They extract nouns from prompts and train a layout predictor to identify the corresponding pixels for each noun. Then, they optimize the latents by encouraging the pixels corresponding to the objects to attend to CLIP representations of phrases containing those objects. While similar in spirit, the current paper demonstrates intervention in the generation process solely based on syntax, without explicitly learning the correspondence between image entities and tokens.
|
| 200 |
+
|
| 201 |
+
# 6 Limitations
|
| 202 |
+
|
| 203 |
+
Like previous methods, the performance of SynGen degrades with the number of attributes to be depicted (see supplemental Fig. 12). However, its decline is remarkably less pronounced compared to other methods. This decay in performance can be attributed to two primary factors: (1) an image begins to lose its visual appeal when the negative loss term becomes excessively large; (2) an overly cluttered image poses challenges in crafting a cohesive “narrative” for all the concepts. We expect that some of these issues can be addressed with more hyper-parameter tuning.
|
| 204 |
+
|
| 205 |
+
Naturally, the effectiveness of our method is intrinsically tied to the quality of the parser. When the parser fails to extract the stipulated syntactic relations, our method essentially operates akin to SD.
|
| 206 |
+
|
| 207 |
+
Finally, SynGen takes longer to generate images with modifiers in the prompt than SD and slightly slower than than A&E (see Appendix A).
|
| 208 |
+
|
| 209 |
+
# 7 Conclusions
|
| 210 |
+
|
| 211 |
+
In this work, we target the improper binding problem, a common failure mode of text-conditioned diffusion models, where objects and their attributes incorrectly correspond to the entity-nouns and their modifiers in the prompt. To address it, we propose SynGen, an inference-time intervention method, with a loss function that encourages syntax-related modifiers and entity-nouns to have overlapping cross-attention maps, and discourages an overlap from cross-attention maps of other words in the prompt. We challenge our method with three datasets, including DVMP – a new dataset that is specially-designed to draw out hard cases of improper-binding problem. Our method demonstrates improvement of over $100 \%$ across all three datasets over the previous state-of-the-art. Finally, our work highlights the importance of linguistic structure during denoising for attaining faithful text-to-image generation, suggesting promising avenues for future research.
|
| 212 |
+
|
| 213 |
+
# Acknowledgements
|
| 214 |
+
|
| 215 |
+
This study was funded by a grant to GC from the Israel Science Foundation (ISF 737/2018) and an equipment grant to GC and Bar-Ilan University from the Israel Science Foundation (ISF 2332/18). This project has also received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme, grant agreement No. 802774 (iEXTRACT). Shauli Ravfogel is grateful to be supported by the Bloomberg Data Science PhD Fellowship.
|
| 216 |
+
|
| 217 |
+
References
|
| 218 |
+
[1] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10684–10695, 2022.
|
| 219 |
+
[2] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
|
| 220 |
+
[3] 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.
|
| 221 |
+
[4] Yogesh Balaji, Seungjun Nah, Xun Huang, Arash Vahdat, Jiaming Song, Karsten Kreis, Miika Aittala, Timo Aila, Samuli Laine, Bryan Catanzaro, et al. ediffi: Text-to-image diffusion models with an ensemble of expert denoisers. arXiv preprint arXiv:2211.01324, 2022.
|
| 222 |
+
[5] Colin Conwell and Tomer Ullman. Testing relational understanding in text-guided image generation. arXiv preprint arXiv:2208.00005, 2022.
|
| 223 |
+
[6] Royi Rassin, Shauli Ravfogel, and Yoav Goldberg. DALLE-2 is seeing double: Flaws in word-to-concept mapping in Text2Image models. In Proceedings of the Fifth BlackboxNLP Workshop on Analyzing and Interpreting Neural Networks for NLP, pages 335–345, Abu Dhabi, United Arab Emirates (Hybrid), December 2022. Association for Computational Linguistics.
|
| 224 |
+
[7] Lvmin Zhang and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models, 2023.
|
| 225 |
+
[8] Yoad Tewel, Rinon Gal, Gal Chechik, and Yuval Atzmon. Key-locked rank one editing for text-to-image personalization. In ACM SIGGRAPH 2023 Conference Proceedings, SIGGRAPH ’23, 2023.
|
| 226 |
+
[9] 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, 2021.
|
| 227 |
+
[10] Mert Yuksekgonul, Federico Bianchi, Pratyusha Kalluri, Dan Jurafsky, and James Zou. When and why vision-language models behave like bags-of-words, and what to do about it? In The Eleventh International Conference on Learning Representations, 2023.
|
| 228 |
+
[11] Hila Chefer, Yuval Alaluf, Yael Vinker, Lior Wolf, and Daniel Cohen-Or. Attend-and-excite: Attentionbased semantic guidance for text-to-image diffusion models. arXiv preprint arXiv:2301.13826, 2023.
|
| 229 |
+
[12] Nan Liu, Shuang Li, Yilun Du, Antonio Torralba, and Joshua B Tenenbaum. Compositional visual generation with composable diffusion models. In Computer Vision–ECCV 2022: 17th European Conference, Tel Aviv, Israel, October 23–27, 2022, Proceedings, Part XVII, pages 423–439. Springer, 2022.
|
| 230 |
+
[13] Weixi Feng, Xuehai He, Tsu-Jui Fu, Varun Jampani, Arjun Akula, Pradyumna Narayana, Sugato Basu, Xin Eric Wang, and William Yang Wang. Training-free structured diffusion guidance for compositional text-to-image synthesis. arXiv preprint arXiv:2212.05032, 2022.
|
| 231 |
+
[14] Matthew Honnibal and Ines Montani. spaCy 2: Natural language understanding with Bloom embeddings, convolutional neural networks and incremental parsing. To appear, 2017.
|
| 232 |
+
[15] Amir Hertz, Ron Mokady, Jay Tenenbaum, Kfir Aberman, Yael Pritch, and Daniel Cohen-Or. Prompt-toprompt image editing with cross attention control. arXiv preprint arXiv:2208.01626, 2022.
|
| 233 |
+
[16] Tsung-Yi Lin, Michael Maire, Serge Belongie, Lubomir Bourdev, Ross Girshick, James Hays, Pietro Perona, Deva Ramanan, C. Lawrence Zitnick, and Piotr Dollár. Microsoft coco: Common objects in context, 2015.
|
| 234 |
+
[17] Rinon Gal, Yuval Alaluf, Yuval Atzmon, Or Patashnik, Amit H. Bermano, Gal Chechik, and Daniel Cohen-Or. An image is worth one word: Personalizing text-to-image generation using textual inversion, 2022.
|
| 235 |
+
[18] Yuval Atzmon, Felix Kreuk, Uri Shalit, and Gal Chechik. A causal view of compositional zero-shot recognition. Advances in Neural Information Processing Systems, 33:1462–1473, 2020.
|
| 236 |
+
[19] Massimiliano Mancini, Muhammad Ferjad Naeem, Yongqin Xian, and Zeynep Akata. Open world compositional zero-shot learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 5222–5230, 2021.
|
| 237 |
+
[20] Yuval Atzmon, Jonathan Berant, Vahid Kezami, Amir Globerson, and Gal Chechik. Learning to generalize to new compositions in image understanding. arXiv preprint arXiv:1608.07639, 2016.
|
| 238 |
+
[21] 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. CoRR, abs/1612.06890, 2016.
|
| 239 |
+
[22] Ishan Misra, Abhinav Gupta, and Martial Hebert. From red wine to red tomato: Composition with context. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 1160–1169, 2017.
|
| 240 |
+
[23] Evelina Leivada, Elliot Murphy, and Gary Marcus. Dall-e 2 fails to reliably capture common syntactic processes. arXiv preprint arXiv:2210.12889, 2022.
|
| 241 |
+
[24] Qiucheng Wu, Yujian Liu, Handong Zhao, Trung Bui, Zhe Lin, Yang Zhang, and Shiyu Chang. Harnessing the spatial-temporal attention of diffusion models for high-fidelity text-to-image synthesis. arXiv preprint arXiv:2304.03869, 2023.
|
| 242 |
+
|
| 243 |
+
# Supplementary Material
|
| 244 |
+
|
| 245 |
+
# A Implementation Details
|
| 246 |
+
|
| 247 |
+
Computing resources. Experiments were run on an NVIDIA DGX Station with four v100-SXM2- 32GB GPUs. The overall duration of all experiments in the paper was about two weeks.
|
| 248 |
+
|
| 249 |
+
Efficiency. SynGen takes ${ \sim } 1 4 4 \%$ longer than SD and ${ \sim } 1 0 . 9 \%$ longer than A&E to generate images with modifiers in the prompt. To arrive to these numbers, we randomly sampled a set of 50 images from the A&E dataset, the DVMP set, and ABC-6K and timed the generations for each method. On average, SD needs 4 seconds to generate an image, A&E 8.8 seconds, and SynGen 9.76 seconds.
|
| 250 |
+
|
| 251 |
+
Hyperparameters. The hyperparameters we used consist of 50 diffusion steps, a guidance scale of 7.5, a scale-factor of 20, and 25 latent update steps. The choices of scale factor and latent update steps are described in Appendix B.2 and Appendix B.3 respectively.
|
| 252 |
+
|
| 253 |
+
Parser. Throughout this project, we use the spacy parser with the out-of-the-box en_core_web_trf model.
|
| 254 |
+
|
| 255 |
+
Attending word pieces. When a relatively uncommon word is encountered by the tokenizer of the text encoder, it is split to sub-words (i.e., word pieces). In the context of our loss function, when an entity (or modifier) is split into word pieces, we compute our distance function (the Symmetric-KL) for each word piece. Then, only the word piece that maximizes the distance is added to the loss.
|
| 256 |
+
|
| 257 |
+
Cross-attention maps. We describe more formally the cross-attention maps on which we intervene. Let $N$ be the number of tokens in the prompt, and let $D ^ { 2 }$ be the dimensionality of the latent feature map in an intermediate denoising step. The denoising network defines a cross-attention map $A ^ { p a t c h e s t o k e n s } \in \mathbb { R } ^ { D ^ { 2 } \times N }$ between each of $D ^ { 2 }$ patches in the latent feature map and each token. Intuitively, the attention maps designates which tokens are relevant for generating each patch.
|
| 258 |
+
|
| 259 |
+
Atokens→patchesi c Our goal it to derive an attention distribution Atokens→patches ∈ RN×D2 ontains the attention distribution of token $i$ over patches. For this goal, we de- such that its $i$ -th row fine a score matrix $S$ to be the transpose of $A ^ { p a t c h e s t o k e n s }$ , i.e,. a matrix whose $i ^ { t h }$ row contains the attention scores from each patch to token $i$ . Since $S$ is not normalized, we divide each row by its sum to get a distribution over patches. Unless stated otherwise, across the paper, we refer to $A ^ { t o k e n s p a t c h e s } \ \in \ R ^ { N \times D ^ { 2 } }$ when mentioning the “cross-attention maps” $A$ and its $i ^ { t h }$ row $A _ { i }$ corresponding to the attention map from the $i ^ { t \tilde { h } }$ token.
|
| 260 |
+
|
| 261 |
+
# B Additional Ablation Experiments
|
| 262 |
+
|
| 263 |
+
# B.1 Further Investigation of the Positive and Negative Loss Terms
|
| 264 |
+
|
| 265 |
+
In Section 4.3, we investigate the importance of the positive and negative loss function terms using a human rater. Here, we accompany the rating with a qualitative analysis, to examine the effect of each term. To this end, we generate images for 15 randomly selected prompts, five from each dataset. Fig. 8 depicts a sample of the generated prompts.
|
| 266 |
+
|
| 267 |
+
We find that proper binding necessitates both the positive and negative terms: excluding the negative term from the loss function results in two noteworthy observations. First, the number of missing objects increase, evident by the missing crown, cat, metal chair, and tomato, in columns 1, 2, 4, and 5 in Fig. 8. One consequence of missing objects is the apparent improper binding, indicated by the red backpack and black shirt in columns 1 and 3.
|
| 268 |
+
|
| 269 |
+
On the other hand, excluding the positive term results in fuzzier separation between objects. For instance, the cat is not completely formed, and is “merged” with the pillow; and while it appears that there is some green residue on the dog, it is not colored green. Moreover, the grass is green, which indicates a semantic leakage.
|
| 270 |
+
|
| 271 |
+

|
| 272 |
+
Figure 8: We examine the effect of employing only one of the two losses instead of both. All images were generated using the same random seed.
|
| 273 |
+
|
| 274 |
+
Putting these insights together, we observe that to some extent, the effect the loss terms is complementary. In addition to the increase of objects and proper binding, the images are more coherent (less cases of objects mixed into each other, such as the cat in the only-negative loss or the elephant in the only-positive loss).
|
| 275 |
+
|
| 276 |
+
# B.2 Number of Timesteps for Intervention
|
| 277 |
+
|
| 278 |
+
Recall that our method intervenes in latent denoising generation. In this appendix, we study the effect of the hyperparameters determining the number of steps in which we intervene.
|
| 279 |
+
|
| 280 |
+
To identify an ideal number of timesteps to intervene, we experiment with 100 randomly selected prompts from the DVMP dataset, a fixed random seed, and a number of update steps from 5 to 50, in increments of 5. Examples of this experiment are shown in Fig. 9.
|
| 281 |
+
|
| 282 |
+
We observe that when intervening in a small number of timesteps, our method failed to adequately mitigate semantic leakage or that images are not completely formed. For instance, the apple in column 1 in the 15-steps example is cartoon-ish, while the dog is not. Conversely, intervening for the full 50 timesteps resulted in an increase rate of blurred images (potentially due to the significant modification of the latent, which shifts it away from the learned distribution). We conclude that the optimal number of timesteps for intervention is 25, as this allows for effective mitigation of improper binding, while still generating visually appealing images.
|
| 283 |
+
|
| 284 |
+
# B.3 Setting the Scale Factor
|
| 285 |
+
|
| 286 |
+
The scale factor affects the update step size. Recall the update step stated in Section 2 $z ^ { \prime } t \ =$ $z _ { t } - \alpha \cdot \nabla z _ { t } \mathcal { L }$ . Here, $\alpha$ is the scale-factor.
|
| 287 |
+
|
| 288 |
+
To determine a good selection for the scale-factor, we generate 100 randomly sampled prompts from the DVMP dataset, with a scale-factor value from 1 to 40, in increments of 10.
|
| 289 |
+
|
| 290 |
+
As can be seen in Fig. 10, we observe that merely updating the latent using a scale-factor of 1 yields relatively good results in terms of improper binding, which confirms the utility of our loss function. However, such a low scale-factor also consistently leads to missing objects.
|
| 291 |
+
|
| 292 |
+

|
| 293 |
+
Figure 9: We experiment with varying number of diffusion steps and examine the effect of changing the number of diffusion steps for which we intervene with the cross attention maps. All images were generated using the same random seed.
|
| 294 |
+
|
| 295 |
+
Interestingly, for greater scale-factor values, the generations become alike in their overall look, but are nonetheless very different. As an example, for both values, 10 and 30, the sliced banana is missing from the image in column 2, but the 30-value does result in a spotted teal skateboard. In column 3, values below 20 lead to images that contain two pandas (none of which are spotted), which indicates the proper binding process, and that the latent was not updated enough. On the other hand, a value greater than 20 leads to an image of a striped rabbit, instead of a spotted rabbit.
|
| 296 |
+
|
| 297 |
+
One interesting conclusion from this experiment is that the greater the scale-factor, the stronger the concept separation. However, this is only true to a point. For a great enough value, generations become too blurred or simply lose their visual appeal.
|
| 298 |
+
|
| 299 |
+
# C Additional Quantitative Analyses
|
| 300 |
+
|
| 301 |
+
To study the efficacy of SynGen relative to the baselines in improper binding setting, we analyze the results under three perspectives. (1) as a function of repeating entities and modifiers; (2) as a function of the number of modifiers; and (3) degree of entanglement. Samples of generations are shown in Fig. 14.
|
| 302 |
+
|
| 303 |
+
Number of repeating modifiers and entities. In this analysis, we examine the performance of all methods for prompts containing recurring modifiers (e.g., “a sliced strawberry and a sliced tomato) or entities (e.g., “a sliced tomato and a skewered tomato”). Aggregated results are illustrated in Fig. 11. Our observations reveal a decrease in performance across all methods when modifiers are repeated. However, the relative success between SynGen and the baselines in performance remains the same. Moreover, there is no substantial decline in results when entities are repeated.
|
| 304 |
+
|
| 305 |
+
Number of modifiers in prompt. We hypothesize that since our method is specifically designed to tackle improper binding, it handles prompts containing many modifiers with more success. This is confirmed in Fig. 12, which shows the gap between SynGen and the baselines widens as the number of modifiers in a prompt increases.
|
| 306 |
+
|
| 307 |
+

|
| 308 |
+
Figure 10: Qualitative comparison between scale factor values for SynGen. For every prompt, the same seeds are applied. We anecdotally show our scale-factor value (we use the value 20) provides superior results.
|
| 309 |
+
|
| 310 |
+
Entangled entities. As we describe in Section 4.2, entangled entities are strongly associated with their most common attribute. For instance, a tomato is typically red, and thus, it is common for images to depict red tomatoes.
|
| 311 |
+
|
| 312 |
+
We categorize the prompts into three groups: (1) entangled prompts, which contain entangled entities with a modifier that overrides a common modifier (e.g., a purple strawberry); (2) common entangled prompts, which contain entangled entities with their common modifiers; and (3) neutral prompts, which do not contain entangled entities at all. Performance as a function of these groups is demonstrated in Fig. 13.
|
| 313 |
+
|
| 314 |
+
# D Additional Qualitative Results
|
| 315 |
+
|
| 316 |
+
# D.1 Qualitative analysis by number of modifiers
|
| 317 |
+
|
| 318 |
+
In Fig. 15, examples from the DVMP challenge set include 2 to 6 modifiers.
|
| 319 |
+
|
| 320 |
+
While errors of all types are prevalent regardless of the number of modifiers, their frequency tends to rise as more modifiers are added.
|
| 321 |
+
|
| 322 |
+
As for SynGen, although it does not display semantic leakages at an increased rate compared to the baselines (as quantitatively demonstrated in Fig. 12), it does show a tendency to generate more than the specified number of entities as the modifier count increases. This behavior is observable in rows 8 and 10 for SynGen, and in rows 7 through 10 for the baselines.
|
| 323 |
+
|
| 324 |
+

|
| 325 |
+
Figure 11: The performance of SynGen and the baselines in concept separation on prompts containing (a) repeating modifiers; and (b) repeating entities in the DVMP dataset.
|
| 326 |
+
|
| 327 |
+

|
| 328 |
+
Figure 12: Concept Separation as a function of number of modifiers in a prompt in the DVMP dataset, introduced in Section 3.2. Only the top-competing method (Attend-and-Excite) is plotted for readability.
|
| 329 |
+
|
| 330 |
+
# D.2 Comparison to Spatial-Temporal Diffusion
|
| 331 |
+
|
| 332 |
+
As described in Section 5, concurrent to this work, [24] developed a method to optimize the latents. While they primarily attend spatial and temporal relations, they too report on improper binding, namely, attribute mismatch. Thus, we extend the tables from Section 4, to include Spatial-Temporal Diffusion, see Fig. 16, Fig. 17, Fig. 18.
|
| 333 |
+
|
| 334 |
+
Based on these 18 images, we observe that Spatial-Temporal Diffusion consistently misses at least one entity from the prompt. As an example, see Fig. 16. The images in columns 1 and 2 miss a crown (but include “wooden” objects), and columns 3 and 4 miss a lion and exhibit semantic leakage.
|
| 335 |
+
|
| 336 |
+
In other cases, we note many cases of semantic leakage in and out of the prompt. For instance, in Fig. 18, in column 2 the clock is brown and the wall is pink, and in column 3, the chair is pink.
|
| 337 |
+
|
| 338 |
+

|
| 339 |
+
Figure 13: The performance of SynGen and the baselines in concept separation when grouping the prompts with respect to entangled modifiers in the DVMP dataset.
|
| 340 |
+
|
| 341 |
+

|
| 342 |
+
Figure 14: Samples from the analyses in Appendix C. (a) a case of recurring entity (strawberry); (b) a recurring modifier (black) and entity (apple); (c) and (d) contain entangled entities (a blue bear and a purple strawberry); (e), (f), (g) are examples of prompts with more than two modifiers.
|
| 343 |
+
|
| 344 |
+

|
| 345 |
+
Figure 16: Extended qualitative comparison for prompts from the DMVP dataset. SynGen and Spatial-Temporal Diffusion [24].
|
| 346 |
+
|
| 347 |
+

|
| 348 |
+
Figure 15: Extended qualitative comparison for prompts from the DVMP challenge set.
|
| 349 |
+
|
| 350 |
+
# D.3 Stable Diffusion and Structured Diffusion Comparison
|
| 351 |
+
|
| 352 |
+
A comparison between Stable Diffusion and Structured Diffusion is depicted in Fig. 19. The findings from the study by [11] suggest that the generated images from Structured Diffusion are often similar to those generated by Stable Diffusion, with limited improvements in addressing semantic flaws and enhancing image quality. This is further supported by the comparable results presented in our findings Table 1. Therefore, while we include all baselines in our evaluations, our qualitative analysis only showcases images produced by the slightly superior Structured Diffusion.
|
| 353 |
+
|
| 354 |
+

|
| 355 |
+
|
| 356 |
+

|
| 357 |
+
Figure 17: Extended qualitative comparison for prompts from the ABC6K dataset. SynGen and Spatial-Temporal Diffusion [24].
|
| 358 |
+
Figure 18: Extended qualitative comparison for prompts from the Attend-and-Excite dataset. SynGen and Spatial-Temporal Diffusion [24].
|
| 359 |
+
|
| 360 |
+

|
| 361 |
+
Figure 19: Side-by-side generations of StableDiffusion and StructureDiffusion.
|
| 362 |
+
|
| 363 |
+
# E SynGen Failures
|
| 364 |
+
|
| 365 |
+
We observe three recurring types of failure SynGen displays Fig. 20. First, when there are many modifiers and entities in the prompt, despite the results in Fig. 12, we note that sometimes the negative loss component becomes exceedingly large, and thus, pushes the latent out of the distribution the decoder was trained on. Consequently, images become blurred, or contain concepts which are successfully separated, but are incoherent. This is likely because our method over-fixates on incorporating all elements described in the prompt.
|
| 366 |
+
|
| 367 |
+
Second, while SynGen typically successfully addresses the possible error cases described in Section 4.2, at times it can neglect generating all objects, unify separate entities, or neglect generating attributes. We conjecture that it is because the cross-attention maps of the modifier and its corresponding entity do not overlap enough. We note it usually occurs when there are many modifiers that refer to the same entity.
|
| 368 |
+
|
| 369 |
+
Finally, as common with many diffusion models, we report a recurring issue with faithfulness to the number of units specified in the prompt, for a certain entity. For instance, upon receiving prompts containing “a strawberry”, SynGen generates images with multiple strawberries, instead of just one. One explanation to this problem is that the representation of a certain entity begins “scattered”, and is never quite formed into a single cluster. Interestingly, the opposite problem, where multiple units are “merged” into one, occurs far less in the generations of SynGen. Possibly, because of the inherent objective function of our loss, which “pushes away” foreign concepts from one another.
|
| 370 |
+
|
| 371 |
+

|
| 372 |
+
Figure 20: Frequent failure modes in SynGen. (a) depicts a case of blurred image, (b) incoherent image which maintains concept separation. Both are a result of excessive updates to the latent, resulting from a large negative loss term. In example (c), the zebra and lion are merged into a single entity and (d) omits the sleepy lion. We conjecture (c) and (d) are a result of too little updates. (e) and (f) exhibit the well-known issue of flawed mapping between the number of units an entity is mentioned in the prompt to the generated image.
|
| 373 |
+
|
| 374 |
+
# F The Diverse Multiple Modifiers Prompts (DVMP) dataset
|
| 375 |
+
|
| 376 |
+
In Section 3.2 we describe DVMP, a new dataset containing rich and challenging combinations, for the purpose of evaluating improper binding.
|
| 377 |
+
|
| 378 |
+
In total, DVMP has 18 types of objects, 16 types of animals, and 4 types of fruit. There are four animal modifiers, 7 object modifiers, two fruit modifiers, and 13 colors. A comprehensive account of the entities and their possible modifiers is shown in Table 4.
|
| 379 |
+
|
| 380 |
+
# G Extended Evaluation
|
| 381 |
+
|
| 382 |
+
# G.1 Additional Details on Human Evaluation Experiments
|
| 383 |
+
|
| 384 |
+
In the manual evaluation procedure detailed in Section 3.3 the evaluator is tasked with comparing various image generations and selecting the optimal image based on multiple criteria. The guidelines and examples given to the evaluators are presented in Fig. 21 and Fig. 22. Fig. 23 provides a screenshot of the rating interface. The full results of the human evaluation are given in Table 5
|
| 385 |
+
|
| 386 |
+
Rater Compensation. Raters were selected based on their performance history, requiring a minimum of 5,000 approved HITs with an approval rate exceeding $98 \%$ . They were required to pass a qualification exam with a perfect score before given access to the task. The hourly compensation was $\$ 10$ , ensuring fair renumeration for their contributions.
|
| 387 |
+
|
| 388 |
+
Table 4: List of entities and their modifiers in the DVMP dataset. Colors are not restricted to categories.
|
| 389 |
+
|
| 390 |
+
<table><tr><td>Category</td><td>Entities</td><td>Modifiers</td></tr><tr><td>General</td><td>backpack, crown, suitcase, chair, balloon,bow, car, bowl,bench,clock, camera,umbrella, guitar, shoe, hat, surfboard, skateboard, bicycle</td><td>modern, spotted, wooden, metal, curved, spiky, checkered</td></tr><tr><td>Fruit</td><td>apple, tomato, banana, strawberry</td><td>sliced, skewered</td></tr><tr><td>Animals</td><td>cat, dog,bird,bear, lion,horse, elephant, monkey, frog, turtle,rabbit, mouse,panda, zebra, gorilla, penguin</td><td>furry, baby, spotted, sleepy</td></tr></table>
|
| 391 |
+
|
| 392 |
+
<table><tr><td>Color Modifiers</td></tr><tr><td>red, orange, yellow, green, blue, purple, pink, brown, gray, black,white,beige, teal</td></tr></table>
|
| 393 |
+
|
| 394 |
+
# Instructions
|
| 395 |
+
|
| 396 |
+
·Please read the folowing_instructions carefully:
|
| 397 |
+
·Inthis task,youwillbe givenadescriptionand twoimages.Yourjobis toevaluatetheimages basedontwo criteria:
|
| 398 |
+
·1.Concept Separation: How well does the image match the given description?
|
| 399 |
+
·2.Visual Appeal: Which image looks overallbetter or more natural?
|
| 400 |
+
·ConceptSeparation:Foreachimage,askyourself: -Do you seeallobjects from thedescription? - Are all objects'details correct? - Are there any details on objects that should not be there? Choosethemagettatcstriptio.lfrealyodooeeallyoodandfeyealldo 'equally bad'.
|
| 401 |
+
·Visual Appeal: After evaluating Concept Separation,decide which image looks better or natural to you.
|
| 402 |
+
·Please choose theimages based on Concept Separation first,and then consider their Visual Appeal.
|
| 403 |
+
|
| 404 |
+
Table 5: The population vote of three raters was normalized to sum to 100 and the standard error mean was added. The table reports the scores for concept separation (how well the image matches the prompt) and visual appeal for different models on each dataset.
|
| 405 |
+
|
| 406 |
+
<table><tr><td colspan="2">Dataset Model</td><td>Concept Separation</td><td>Visual Appeal</td></tr><tr><td rowspan="5"></td><td></td><td></td><td>40.11 ± 0.49</td></tr><tr><td>SynGen (ours) A&E</td><td>38.80 ± 0.48 22.60 ± 0.41</td><td>21.47 ± 0.41</td></tr><tr><td>Structured Diffusion</td><td>09.98 ± 0.29</td><td>11.87 ± 0.32</td></tr><tr><td>Stable Diffusion</td><td>08.85 ±0.28</td><td>09.79 ± 0.29</td></tr><tr><td>No majority winner</td><td>19.77 ± 0.39</td><td>16.76 ± 0.37</td></tr><tr><td rowspan="5">DVMP (challenge set)</td><td>SynGen (ours)</td><td>29.22 ± 0.45</td><td>23.55 ± 0.42</td></tr><tr><td>A&E</td><td>19.83 ± 0.39</td><td>19.00 ± 0.39</td></tr><tr><td>Structured Diffusion</td><td>09.00±0.28</td><td>15.56 ± 0.36</td></tr><tr><td>Stable Diffusion</td><td>09.89 ±0.29</td><td>15.56 ± 0.36</td></tr><tr><td>No majority winner</td><td>32.06 ± 0.46</td><td>26.33 ± 0.44</td></tr><tr><td rowspan="5">ABC-6K</td><td>SynGen (ours)</td><td>33.00 ± 0.47</td><td>25.72 ± 0.43</td></tr><tr><td>A&E</td><td>17.84 ± 0.38</td><td>17.28 ± 0.37</td></tr><tr><td>Structured Diffusion</td><td>13.44 ± 0.34</td><td>14.50 ± 0.35</td></tr><tr><td>Stable Diffusion</td><td>11.72 ± 0.32</td><td>14.50 ± 0.35</td></tr><tr><td>No majority winner</td><td>24.00 ± 0.42</td><td>28.00 ± 0.44</td></tr></table>
|
| 407 |
+
|
| 408 |
+

|
| 409 |
+
Figure 22: Examples given to raters in their instructions. Each example consists of a prompt and two images: A good match (top) and a bad match (bottom) for the concept separation criterion. These examples were accompanied by text explaining why the images are considered a good (or bad) match to the prompt.
|
| 410 |
+
|
| 411 |
+

|
| 412 |
+
Figure 23: A screenshot of the AMT task. The order of images was randomized per HIT. “equally good” and “equally bad” were merged during post-processing into "no winner", to simplify presentation of results.
|
| 413 |
+
|
| 414 |
+
# G.2 Phrases-to-Image Similarity
|
| 415 |
+
|
| 416 |
+
A common approach to automatically assess text-based image generation is by computing the cosine similarity between an image and prompt, using a vision-language model like CLIP [9]. However, the very challenge we tackle here is rooted in CLIP’s failure in establishing correct mapping between syntactic bindings and visual bindings, functioning like a bag-of-words model [10]. As an example, suppose CLIP is prompted with “a blue room with a yellow window”. If we present CLIP with an image of a yellow room with a blue window, it may yield a similar score to an image that accurately depicts a blue room with a yellow window.
|
| 417 |
+
|
| 418 |
+
In an attempt to address this flaw, we segment prompts to phrases containing entity-nouns and their corresponding modifiers (e.g., “a blue room” and “a yellow window”), and compute the similarity between these segmented phrases and the image. We then aggregate the result to a single score by computing the mean. With this approach, we expect CLIP to properly associate the modifiers (e.g., “blue” and “yellow”) with the correct entity-noun (i.e., “room” and “window”) as there is only one entity-noun in each segment. Unfortunately, this metric achieves relatively low agreement with the majority selection of human evaluation, only $4 3 . 5 \%$ of the time, where $25 \%$ is random selection. Despite the low agreement, we note the overall trend of selections of this automatic metric is very similar to the human majority selection. Table 6 shows the results of our automatic evaluation.
|
| 419 |
+
|
| 420 |
+
Task
|
| 421 |
+
|
| 422 |
+
"a white bicycle and a spiky bow"
|
| 423 |
+
|
| 424 |
+

|
| 425 |
+
Figure 24: A screenshot of the fine-grained AMT task.
|
| 426 |
+
|
| 427 |
+
Table 6: Automatic evaluation of all methods on the three datasets. The table reports scores for concept separation (how well the image matches the prompt) and visual appeal. Values are the fraction of majority vote of three raters, normalized to sum to 100.
|
| 428 |
+
|
| 429 |
+
<table><tr><td>Method</td><td>DVMP (ours)</td><td>ABC-6K</td><td>A&E</td></tr><tr><td>SynGen (ours)</td><td>47.33</td><td>41.33</td><td>44.63</td></tr><tr><td>A&E</td><td>27.66</td><td>24.33</td><td>27.11</td></tr><tr><td>Structured Diffusion</td><td>12.84</td><td>17.84</td><td>11.87</td></tr><tr><td>Stable Diffusion</td><td>12.17</td><td>16.50</td><td>16.39</td></tr></table>
|
md/dev/B4tkwuzeiY/B4tkwuzeiY.md
ADDED
|
@@ -0,0 +1,520 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Grammar Prompting for Domain-Specific Language Generation with Large Language Models
|
| 2 |
+
|
| 3 |
+
Bailin Wang⋄ Zi Wang† Xuezhi Wang† Yuan Cao‡ Rif A. Saurous† Yoon ${ \bf K i m } ^ { \circ }$ ⋄Massachusetts Institute of Technology †Google DeepMind ‡Google Research {bailinw, yoonkim}@mit.edu, {wangzi, xuezhiw, yuancao, rif}@google.com
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Large language models (LLMs) can learn to perform a wide range of natural language tasks from just a handful of in-context examples. However, for generating strings from highly structured languages (e.g., semantic parsing to complex domainspecific languages), it is challenging for the LLM to generalize from just a few exemplars. We propose grammar prompting, a simple approach to enable LLMs to use external knowledge and domain-specific constraints, expressed through a grammar in Backus–Naur Form (BNF), during in-context learning. Grammar prompting augments each demonstration example with a specialized grammar that is minimally sufficient for generating the particular output example, where the specialized grammar is a subset of the full DSL grammar. For inference, the LLM first predicts a BNF grammar given a test input, and then generates the output according to the rules of the grammar. Experiments demonstrate that grammar prompting can enable LLMs to perform competitively on a diverse set of DSL generation tasks, including semantic parsing (SMCalFlow, Overnight, GeoQuery), PDDL planning, and SMILES-based molecule generation.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Prompting large language models (LLMs) with demonstrations optionally combined with natural language instructions has been shown to be an effective approach for surfacing their myriad capabilities acquired through pretraining [10]. This approach is however inadequate for applications where the task specifications cannot be fully delineated through just a handful of exemplars, for example in semantic parsing where an LLM must translate a natural language utterance to an executable program in a domain-specific language (DSL). DSLs often incorporate domain-specific abstractions and semantics that are difficult to characterize via just a few demonstrations. And unlike generalpurpose programming languages, DSLs are by definition specialized and thus unlikely to have been encountered often enough (or at all) during pretraining for the LLM to acquire its full syntax.
|
| 12 |
+
|
| 13 |
+
How can we draw on the few-shot learning capabilities of LLMs to generate structured strings that are substantially different from those seen during pretraining? This work explores grammar prompting as a simple approach for data-efficient generation of structured languages where an output string in the language can be derived through a series of symbolic manipulations. We exploit the fact that constraints over a structured output space can often be succinctly described by a context-free grammar in Backus–Naur Form (BNF), which is commonly used to define the syntax of a language. Grammar prompting augments each in-context example $( { \pmb x } , { \pmb y } )$ with a specialized BNF grammar $G [ \pmb { y } ]$ that is minimally sufficient for generating $\textbf { { y } }$ . Given a new input, the LLM first predicts the specialized BNF grammar and then generates the answer conditioned on the grammar.
|
| 14 |
+
|
| 15 |
+
Grammar prompting follows the recent line of work which enhances the few-shot reasoning capabilities of LLMs by interleaving intermediate “reasoning” steps between each in-context input and output [51, 24, 86, 80, 73]. The key difference in our approach is that the intermediate variable is in the form of a formal grammar rather than in natural language, which focuses on eliciting the symbolic manipulation capabilities of LLMs. The use of a formal grammar moreover makes it possible to impose constraints during incremental decoding such that syntactic validity is guaranteed. Finally, unlike chain-of-thought-style prompts [86] which typically require manual verbalization of the intermediate reasoning steps, in our approach the specialized grammar $G [ \pmb { y } ]$ can be derived automatically by parsing the output $\textbf { { y } }$ with the full (unspecialized) DSL grammar.
|
| 16 |
+
|
| 17 |
+
To summarize,
|
| 18 |
+
|
| 19 |
+
• We propose grammar prompting as a simple approach for enabling LLMs to generate highly structured languages from just a few exemplars.
|
| 20 |
+
• We design a constrained LLM decoding algorithm tailored to grammar prompting, which guarantees syntactic validity while minimizing the number of LLM API calls.
|
| 21 |
+
• We apply grammar prompting to various domain specific languages for semantic parsing (SMCalFlow, Overnight, GeoQuery), AI planning (PDDL), and molecule generation (SMILES), and find that it can meaningfully improve upon standard prompting baselines in the few-shot setting.
|
| 22 |
+
|
| 23 |
+
# 2 Background
|
| 24 |
+
|
| 25 |
+
In this section, we define our problem and review the few-shot learning method that we build on.
|
| 26 |
+
|
| 27 |
+
# 2.1 Problem Formulation: Domain-Specific Language Generation
|
| 28 |
+
|
| 29 |
+
Let $\Sigma ^ { * }$ be the set of all finite strings over an alphabet $\Sigma$ , and further let $D \subseteq \Sigma ^ { * }$ be a domain-specific language (DSL) for an application of interest. Given an input $_ { \textbf { \em x } }$ (e.g., a natural language command) we are interested in generating $\pmb { y } \in D$ (e.g., a program in a DSL fulfilling the command), as shown by the following calendar assistant example from SMCalFlow [6]:
|
| 30 |
+
|
| 31 |
+
x : Add meeting with Jean’s manager on Wednesday at 3PM. y : CreateEvent(& (start_? WednesdayNumberPM(3))(attendee_? FindManager(Jean)))
|
| 32 |
+
|
| 33 |
+
DSLs are crafted by experts who use their domain-specific knowledge to incorporate higher-level abstractions than are typically found in general-purpose programming languages. We assume access to an expertdefined grammar $G$ that fully specifies the DSL’s syntax. As is the case with many DSLs, we further assume that $G$ is a context-free grammar in Backus–Naur Form (BNF). See Figure 1 for a simple example adapted from SMCalFlow [6]. Letting $L ( G )$ be the language generated by $G$ we have ${ \cal D } \subseteq { \cal L } ( G ) \subseteq \bar { \Sigma ^ { * } }$ (not all syntactically valid programs are semantically valid)
|
| 34 |
+
|
| 35 |
+

|
| 36 |
+
Figure 1: A simple BNF grammar for a calendar DSL.
|
| 37 |
+
|
| 38 |
+
# 2.2 Few-shot Learning with Large Language Models
|
| 39 |
+
|
| 40 |
+
In-context learning with large language models (LLMs) has been shown to be an effective approach for few-shot learning [10]. Under this approach, a pretrained LLM is conditioned on $N$ demonstration examples $( \pmb { x } ^ { ( i ) } , \pmb { y } ^ { ( i ) } ) _ { i = 1 } ^ { N }$ followed by a test example $_ { \textbf { \em x } }$ , and the output is given by decoding from the prompted LLM, i.e., $\mathsf { P } _ { \mathrm { L L M } } ( \pmb { y } | \pmb { x } , ( \pmb { x } ^ { ( i ) } , \pmb { y } ^ { ( i ) } ) _ { i = 1 } ^ { N } )$ . The demonstration examples can be optionally preceded by natural language instructions to further improve performance or even enable zeroshot learning [85, 62]. Recent work has additionally shown that interleaving natural language verbalizations of intermediate reasoning steps between each $\mathbf { \boldsymbol { x } } ^ { ( i ) }$ and $\mathbf { \boldsymbol { y } } ^ { ( i ) }$ can greatly improve few-shot performance on complex reasoning tasks [51, 86, 80, 73, 16].
|
| 41 |
+
|
| 42 |
+
The effectiveness of few-shot in-context learning depends both on how useful the implicit knowledge acquired through pretraining is for the task, and on how effectively the task specifications can be conveyed through the demonstrations. For DSL, the structured nature of combinatorial output space (i.e., the DSL grammar $G$ ) cannot be adequately captured through just a handful of demonstrations. Thus, few-shot generation of strings of a DSL remains challenging for LLMs.
|
| 43 |
+
|
| 44 |
+
<table><tr><td rowspan=1 colspan=1> LLM Prompt</td></tr><tr><td rowspan=1 colspan=1>You are an expert programmer,and you need to write a program for the given natural language query.First,you should write a grammar that contains all the necessary BNF rules.Then,you should writeprograms that conform to your predicted rules.</td></tr><tr><td rowspan=1 colspan=1>(optional) G: [BEGINRULES] [END RULES]</td></tr><tr><td rowspan=1 colspan=1>x(1).: find the meeting on Wednesday with Bob and Carol</td></tr><tr><td rowspan=1 colspan=1>G[y(①]: event "QueryEvent(" constraint ")"constraint "(&"constraint constraint ")""(start_?" date ")""(attendee_?" attendee attendee ")"date "Wednesday"attendee "Bob"|"Carol"</td></tr><tr><td rowspan=1 colspan=1>y1): QueryEvent(& (start_? Wednesday)(attendee_? Bob Caro1))</td></tr><tr><td rowspan=1 colspan=1>x:Add meeting with Jean's manager on Wednesday at 3PM</td></tr></table>
|
| 45 |
+
|
| 46 |
+
<table><tr><td colspan="4">LLM Output</td></tr><tr><td rowspan="7">G:</td><td rowspan="2">event constraint</td><td></td><td>"CreateEvent("constraint ")"</td></tr><tr><td></td><td>"(&" constraint constraint ")"</td></tr><tr><td rowspan="3"></td><td></td><td>"(start_?" date time ")"</td></tr><tr><td></td><td>"(attendee_?" attendee ")"</td></tr><tr><td></td><td>"Wednesday"</td></tr><tr><td rowspan="2">date time</td><td></td><td>"NumberPM(3)"</td></tr><tr><td>attendee</td><td>"FindManager("attendee")"丨"Jean"</td></tr><tr><td colspan="4">y: CreateEvent(& (start_? Wednesday NumberPM(3))(attendee_? FindManager(Jean)))</td></tr></table>
|
| 47 |
+
|
| 48 |
+
Figure 2: Example of grammar prompting for a calendar DSL. We interleave the minimal specialized grammar $G [ \pmb { y } ^ { ( i ) } ]$ between the demonstrations $\mathbf { \bar { x } } ^ { ( i ) }$ and $\mathbf { \boldsymbol { y } } ^ { ( i ) }$ . During decoding, the LLM first predicts the specialized grammar $\widehat { G }$ , and then predicts the program $\widehat { \pmb { y } }$ conditioned on $\widehat { G }$ . The blue portion is not part of the actual prompt and only shown for illustrative purposes.
|
| 49 |
+
|
| 50 |
+
# 3 Grammar Prompting
|
| 51 |
+
|
| 52 |
+
Grammar prompting exploits the fact that while the actual strings of a DSL may not have been encountered frequently enough (or at all) during pretraining for the LLM to implicitly acquire its syntax, the LLM will likely have encountered many instances of metalanguages (languages used to describe other languages). BNF grammars are a standard metalanguage for specifying a language’s syntax, and are expected to occur in the LLM training corpus with some frequency (e.g., in computer science textbooks). We thus focus on using BNF grammars for few-shot DSL generation.
|
| 53 |
+
|
| 54 |
+
Let $\textstyle G = \bigcup _ { j = 1 } ^ { M } \{ r _ { j } \}$ be an extended BNF grammar where each rule $r _ { j }$ is of the form
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
< \mathsf { s y m b o l } > \ : : = \ < \mathsf { e x p r } _ { 1 } > \ | < \mathsf { e x p r } _ { 2 } > \ | \quad . \ . \ .
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
Here <symbol $>$ is a nonterminal symbol and each ${ < } \mathsf { e x p r } _ { 1 } \mathsf { > }$ is a sequence of nonterminal and terminal symbols.1 A straightforward approach for incorporating a BNF grammar during in-context learning is to simply prepend the string representation of the full grammar $G$ to the demonstration examples, along with an instruction to use the grammar. However in preliminary experiments, we found that this did not yield any improvements.
|
| 61 |
+
|
| 62 |
+
# 3.1 Specialized Grammars
|
| 63 |
+
|
| 64 |
+
We propose to use specialized grammars to enable better use of domain-specific knowledge and constraints. A specialized grammar $G ^ { \prime } \subseteq G$ is a grammar obtained from taking a subset of the rules of the full grammar $G$ . We further define $G [ \pmb { y } ]$ , a minimal specialized grammar of $\textbf { { y } }$ , to be a BNF
|
| 65 |
+
|
| 66 |
+
grammar with the following properties: (1) $\pmb { y } \in L ( G [ \pmb { y } ] )$ , and $( 2 ) \forall r \in G [ { \pmb y } ] , { \pmb y } \notin L ( G [ { \pmb y } ] \setminus \{ r \} )$ . 3 We can readily obtain a minimal specialized grammar by using $G$ to parse $\textbf { { y } }$ and then taking the union of rules that were used in the derivation of $\textbf { { y } }$ .
|
| 67 |
+
|
| 68 |
+
Grammar prompting feeds a sequence of $( \pmb { x } ^ { ( i ) } , G [ \pmb { y } ^ { ( i ) } ] , \pmb { y } ^ { ( i ) } ) _ { i = 1 } ^ { N }$ along with $_ { \textbf { \em x } }$ as a prompt to an LLM. For inference we first obtain the specialized grammar with an (approximate) arg max decoding
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
\widehat { G } = \underset { G ^ { \prime } \subseteq G } { \arg \operatorname* { m a x } } \ P _ { \mathrm { L L M } } ( G ^ { \prime } \mid \boldsymbol { x } , ( \boldsymbol { x } ^ { ( i ) } , G [ \boldsymbol { y } ^ { ( i ) } ] , \boldsymbol { y } ^ { ( i ) } ) _ { i = 1 } ^ { N } ) .
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
We then obtain the program conditioned on $\widehat { G }$
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
\widehat { \pmb { y } } = \underset { \pmb { y } \in \cal L ( \widehat { G } ) } { \arg \operatorname* { m a x } } P _ { \mathrm { L L M } } ( \pmb { y } | \widehat { G } , \pmb { x } , ( \pmb { x } ^ { ( i ) } , G [ \pmb { y } ^ { ( i ) } ] , \pmb { y } ^ { ( i ) } ) _ { i = 1 } ^ { N } ) .
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
We discuss how to perform constrained decoding with ${ \widehat { G } } \subseteq G$ and ${ \widehat { \pmb { y } } } \in { \cal L } ( { \widehat { \cal G } } )$ in the next section. bGrammar prompting views DSL program generation as a grammar specialization process where given a natural language specification $_ { \textbf { \em x } }$ , a set of production rules, $\widehat { G }$ , is selected from $G$ , and then a program $\widehat { \pmb { y } }$ is deduced according to the selected rules. Grammar prompting can also be viewed as an binstance of chain-of-thought prompting [51, 86] where the intermediate thought is in the form of a formal grammar. However, unlike typical chain-of-thought prompting where the answer is (usually) deterministic given the intermediate reasoning steps, in our case there is still some uncertainty with respect to $\widehat { \pmb { y } }$ given $\widehat { G }$ (e.g., $L ( { \widehat { G } } )$ could still be infinite).
|
| 81 |
+
|
| 82 |
+
# 3.2 Constrained Decoding
|
| 83 |
+
|
| 84 |
+
The use of a formal grammar as an intermediate variable makes it possible to enforce grammatical constraints during autoregressive LLM decoding. We first discuss how we enforce the constraint ${ \textbf { \textit { y } } } \in$ $L ( { \widehat { G } } )$ . One approach to constrained decoding is to use $\widehat { G }$ to obtain a left-to-right Earley parser [18] and only decode from valid continuations at each decoding step. However this simple strategy poses several practical challenges when working with API-only LLMs. For one, a valid terminal continuation in $\widehat { G }$ may consist of multiple BPE tokens. Moreover, while we can sample a valid continuation at each time step by disallowing invalid tokens,4 since the set of valid continuations changes at each time step, this strategy would require calling the LLM API at each time step with the full
|
| 85 |
+
|
| 86 |
+
# Algorithm 1 Earley-based Constrained Generation
|
| 87 |
+
|
| 88 |
+
Input: Test input $_ { \textbf { \em x } }$ , predicted grammar $\widehat { G }$
|
| 89 |
+
Output: Program $\hat { y } \in L ( \widehat { G } )$
|
| 90 |
+
1: $\hat { \pmb y } \epsilon$ $\triangleright$ initialize to empty string
|
| 91 |
+
2: while True do
|
| 92 |
+
3: $\ddot { \pmb y } \operatorname { d e c o d e } ( P _ { \mathrm { L L M } } ( \cdot \vert \mathbf x , \widehat G , \hat { \pmb y } , \dots ) )$
|
| 93 |
+
4: yˆ ← yˆ · y¯ $\triangleright$ concatenation
|
| 94 |
+
5: if ${ \hat { y } } \in L ( { \widehat { G } } )$ then $\triangleright$ try parsing with $\widehat { G }$
|
| 95 |
+
6: return $\hat { \pmb { y } }$ $\triangleright$ return if successful
|
| 96 |
+
7: else $\triangleright$ if parsing fails, need to correct
|
| 97 |
+
8: $\begin{array} { r l } & { \pmb { y } _ { \mathrm { p r e f i x } } , \Sigma [ \pmb { y } _ { \mathrm { p r e f i x } } ] \mathrm { E a r l e y P a r s e } ( \hat { \pmb { y } } , \widehat { G } ) } \\ & { \pmb { w } ^ { * } \quad \arg \operatorname* { m a x } \quad P _ { \mathrm { L L M } } ( \pmb { w } \mid \pmb { y } _ { \mathrm { p r e f i x } } , \dots ) } \\ & { \qquad \pmb { w } \in \Sigma [ \pmb { y } _ { \mathrm { p r e f i x } } ] } \\ & { \hat { \pmb { y } } \pmb { y } _ { \mathrm { p r e f i x } } \cdot \pmb { w } ^ { * } } \end{array}$
|
| 98 |
+
9:
|
| 99 |
+
10:
|
| 100 |
+
11: end if
|
| 101 |
+
12: end while
|
| 102 |
+
13: return yˆ
|
| 103 |
+
|
| 104 |
+
prompt and prefix along with the disallowed continuations, which is prohitively expensive.5
|
| 105 |
+
|
| 106 |
+
While there are many methods for grammar-constrained LM decoding [68, 64, 26], we present a simple strategy which speculatively decodes from the LLM to look ahead for multiple tokens. The pseudocode is shown in Algorithm 1. At each prediction step, we ask the LLM to speculatively decode the full program conditioned on the current prefix (lines 4-5). If the resulting continuation leads to a valid program, we return it (lines 6-7). Otherwise, we consult an Earley parser to extract the longest valid prefix from the current prediction $( y _ { \mathrm { p r e f i x } } )$ , along with a set of valid terminals that can follow the prefix $( \Sigma [ \pmb { y } _ { \mathrm { p r e f i x } } ] )$ . Finally, we rely on the LLM’s probabilities to decide which terminal to use, with which a new partial program can be constructed (lines 10-11).6 Figure 3 illustrates one prediction step where the predicted program is corrected into a new valid partial program. Note that $\pmb { w }$ can consist of multiple BPE tokens, e.g., "FindManager(" in Figure 3. By scoring over multi-token terminals, the search procedure is implicitly augmented by looking ahead for a few tokens.
|
| 107 |
+
|
| 108 |
+

|
| 109 |
+
Figure 3: Illustration of how an predicted program is corrected in our proposed Earley-based constrained decoding. The final partial program will be subsequently fed into the LLM for continuation.
|
| 110 |
+
|
| 111 |
+
We use a similar procedure to operationalize the constraint $G ^ { \prime } \subseteq G$ , except that EarleyParse (used at Algorithm 1, line 9) is constructed with a metagrammar (i.e., the grammar of $G$ ) for grammar prediction. See appendix A.1 for more details. In our ablation study we find that while these constraints are helpful insofar as they guarantee syntactic validity, grammar prompting still meaningfully improves upon standard prompting with even with simple unconstrained decoding.
|
| 112 |
+
|
| 113 |
+
# 4 Experiments
|
| 114 |
+
|
| 115 |
+
We apply grammar prompting to diverse domains: DSLs for semantic parsing (SMCalFlow, Overnight, GeoQuery), an action DSL (PDDL planning), and a molecule generation DSL (SMILES). These experiments are not necessarily intended to improve upon the state-of-the-art on these benchmarks but rather intended to assess whether LLMs can improve upon standard prompting for few-shot DSL generation by learning to predict and use grammars during in-context learning.
|
| 116 |
+
|
| 117 |
+
# 4.1 Semantic Parsing for Tool Usage
|
| 118 |
+
|
| 119 |
+
Software tools are typically accompanied by a collection of human-interpretable APIs which provide a platform for developers to interact programmatically with the tools. These APIs constitute a DSL, where each production rule of the grammar specifies the input and output types for a specific API call (see Figure 1 for an example). These tools demonstrate a broad spectrum in terms of DSL complexity, ranging from single-function tools such as Google(user_query), Translate(sentence, language) to more complex tools such as the entirety of Wolfram language.7 Enabling LLMs to use external tools via APIs is an important step towards enhancing their capabilities [63, 56, 53, 72, 47].
|
| 120 |
+
|
| 121 |
+
We test our approach on standard semantic parsing benchmarks involving complex DSLs: SMCalFlow [6], which features human-generated utterances about calendar management (see Figure 2); GeoQuery [99] which features queries against a US Geography database; and Overnight-Blocks [81], which features queries about blocks in a synthetic block world. See appendix B for examples of input-output pairs along with the specialized grammars. The original benchmarks target the training of conventional semantic parsers and thus contain hundreds/thousands of training examples. Even prompting-based approaches on these benchmark rely on retrieval-based in-context learning which first retrieves $m$ exemplars from a large training set of $n$ examples $( n \gg m$ ) based on some similarity measure (e.g., BM-25), and then performs in-context learning with the retrieved exemplars [57, 95, 68, 46]. In contrast, we target the true few-shot setting where we only assume access to 16–32 demonstration examples.
|
| 122 |
+
|
| 123 |
+
Our baselines here include: (1) standard prompting, (2) standard prompting with constrained decoding based on the full DSL grammar $G$ [68, 64], and (3) a derivation tree-based prompting baseline which imbues more structural information to the exemplars by feeding the linearized derivation tree instead of the surface form program.8 We use Codex-davinci-002 [13] as the base LLM for these main experiments. Language models trained on code (such as Codex) have shown to be particularly effective on semantic parsing benchmarks [67]. We evaluate according to program accuracy (matching the predicted and reference programs) as well as execution accuracy (same execution in both programs) if possible.
|
| 124 |
+
|
| 125 |
+
Table 1: Results on few-shot semantic parsing with Codex with various decoding strategies. GeoQuery and Overnight-Blk use 32 in-context examples, and SMCalFlow uses 16 examples. We show both program (Prog.) and execution (Exec.) accuracy when possible.
|
| 126 |
+
|
| 127 |
+
<table><tr><td rowspan="2">Approach</td><td colspan="2">GeoQuery</td><td rowspan="2">SMCalFlow Prog.</td><td colspan="2">Overnight-Blk</td></tr><tr><td>Prog.</td><td>Exec.</td><td>Prog.</td><td>Exec.</td></tr><tr><td>Standard Prompting (unconstrained decoding)</td><td>60.7</td><td>81.5</td><td>46.4</td><td>29.3</td><td>54.7</td></tr><tr><td>w.constrained decoding(y ∈ L(G))</td><td>61.1</td><td>81.8</td><td>49.2</td><td>29.3</td><td>54.7</td></tr><tr><td>Linearized Derivation Tree Prompting</td><td>58.6</td><td>77.5</td><td>50.0</td><td>27.3</td><td>56.4</td></tr><tr><td>Grammar Prompting (unconstrained decoding)</td><td>67.1</td><td>87.5</td><td>50.8</td><td>34.8</td><td>57.4</td></tr><tr><td>w. grammar constraint (G C G)</td><td>67.9</td><td>88.6</td><td>51.3</td><td>37.1</td><td>60.4</td></tr><tr><td> w. grammar and program constraint (g ∈ L(G))</td><td>69.6</td><td>88.9</td><td>52.4</td><td>37.6</td><td>60.9</td></tr><tr><td>w. oracle grammar (G = G[yl)</td><td>95.7</td><td>96.1</td><td>80.0</td><td>73.9</td><td>94.2</td></tr><tr><td>w. oracle grammar + program constraint</td><td>95.7</td><td>96.8</td><td>83.6</td><td>74.4</td><td>96.5</td></tr></table>
|
| 128 |
+
|
| 129 |
+
Table 2: Results on retrieval-based in-context learning (left) and compositional generalization (right) with Codex. GeoQuery and Overnight-Blk show execution accuracy while SMCalFlow shows program accuracy. The numbers with ♣, ♠ and ♢ are taken from Herzig and Berant [31], Ye et al. [95] and Cao et al. [11], respectively.
|
| 130 |
+
|
| 131 |
+
<table><tr><td rowspan="2">Model</td><td colspan="3">Retrieval-based ICL</td><td colspan="4">GeoQuery Out-of-Distribution</td></tr><tr><td>GeoQuery (32/560)</td><td>SMCalFlow (16/128)</td><td>Overnight-Blk (32/1,436)</td><td>Template (32/441)</td><td>TMCD (32/440)</td><td>Length (32/440)</td><td>NewFunc (32/453)</td></tr><tr><td>Previous Work</td><td>86.1</td><td>60.7</td><td>65.2</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>Standard Prompting</td><td>96.8</td><td>60.0</td><td>69.4</td><td>93.2</td><td>77.1</td><td>86.4</td><td>63.3</td></tr><tr><td>Grammar Prompting</td><td>97.9</td><td>62.8</td><td>70.2</td><td>95.7</td><td>86.6</td><td>88.6</td><td>90.8</td></tr><tr><td>w. oracle grammar</td><td>98.6</td><td>88.9</td><td>97.2</td><td>97.9</td><td>95.0</td><td>95.7</td><td>96.2</td></tr></table>
|
| 132 |
+
|
| 133 |
+
Few-shot results. The main results are shown in Table 1. We find that grammar prompting can meaningfully improve upon the standard prompting baseline even without constrained decoding. Interestingly, grammar prompting outperforms derivation tree prompting which actually provides more information than the minimal specialized grammar $G [ \pmb { y } ]$ (since the derivation tree explicitly shows how the rules are actually applied to obtain the program). This potentially indicates that having the LLM “plan out” the program by forcing it to predict the specialized grammar $\widehat { G }$ first is an effective strategy. We also analyze the effect of constrained decoding on the number of LLM API calls in Table 7 of appendix A.1, where we observe that constrained decoding requires roughly three times more API calls than unconstrained decoding. However, despite the promising performance of grammar prompting, there is a large gap between using the predicted grammar versus using the oracle grammar (i.e., setting ${ \widehat { G } } = G [ { \mathbf { \widehat { y } } } ] )$ , indicating opportunities for further work in this area.
|
| 134 |
+
|
| 135 |
+
Retrieval-based in-context learning. While our core target application is few-shot semantic parsing, we also apply grammar prompting for retrieval-based in-context learning to test whether it can still improve performance in the data-rich regime and also to compare against prior work on these benchmarks. Results in Table 2 (left) show that grammar prompting can improve results even in this setting, although the improvements are less pronounced than in the few-shot setting.
|
| 136 |
+
|
| 137 |
+
Out-of-distribution generalization. We experiment to see whether grammar prompting can improve compositional generalization on GeoQuery. Specifically, we test grammar prompting on the compositional splits of GeoQuery split from Shaw et al. [66]. These splits feature structural divergence between training and test examples, e.g., programs have different templates or length. Results in Table 2 (right) shows that grammar prompting can improve upon standard prompting, across all splits (Template, TMCD, Length).
|
| 138 |
+
|
| 139 |
+
We next assess whether grammar prompting can enable LLMs to make zero-shot use of unseen functions (NewFunc) that are not even part of the retrieval set. We set aside 8 functions (smallest, shortest, most, highest, sum, population_1, count, major) and remove them from the retrieval set, simulating a scenario where new functions are supported in the backend yet no NL-program paired data is available for adapting a semantic parser. Note that for GeoQuery (and Overnight-Blk), we always prepend the full DSL grammar $G \mathrm { . }$ —which includes the held-out functions—before the in-context exemplars. Table 2 (right-most column) shows that grammar-prompted LLMs achieve significantly better performance than standard prompting. Our results suggest that the explicit prediction of specialized grammars elicits understanding and reasoning at the grammar level, thereby enabling generalization to unseen functions. We also found that without constrained generation, LLMs were often able to guess functions that did not exist but were nonetheless sensible. An interesting direction is to explore whether LLMs can tackle DSL-open benchmarks such as LARC [1].
|
| 140 |
+
|
| 141 |
+
Different base LLMs. We finally experiment with grammar prompting across different base LLMs. Since GPT3.5’s 4K token limit is smaller than Codex’s (8K) and GPT-4’s (8K) limits, we use fewer exemplars in these experiments than before (24/8/16 exemplars for GeoQuery/SMCalFlow/Overnight-B respectively). Due to API cost, we limit our experiments to a smaller subset of 100 test examples instead of the full test set.
|
| 142 |
+
|
| 143 |
+
Table 3 shows that grammar prompting improves upon standard prompting in the majority of the settings. The exceptions are
|
| 144 |
+
|
| 145 |
+
<table><tr><td>Base LM</td><td>Method</td><td>GeoQuery</td><td>SMCalFlow</td><td>Overnight-Blk</td></tr><tr><td>Codex</td><td>Standard</td><td>83</td><td>27</td><td>63</td></tr><tr><td></td><td>Grammar</td><td>95</td><td>35</td><td>66</td></tr><tr><td>GPT-3.5</td><td>Standard</td><td>75</td><td>9</td><td>49</td></tr><tr><td></td><td>Grammar</td><td>86</td><td>5</td><td>67</td></tr><tr><td>GPT-4</td><td>Standard</td><td>85</td><td>32</td><td>56</td></tr><tr><td></td><td>Grammar</td><td>98</td><td>36</td><td>62</td></tr><tr><td>PaLM 2-L</td><td>Standard</td><td>90</td><td>14</td><td>59</td></tr><tr><td></td><td>Grammar</td><td>87</td><td>17</td><td>62</td></tr></table>
|
| 146 |
+
|
| 147 |
+
Table 3: Results with different base LLMs on a subset of 100 examples sampled from the original test set. GeoQuery and Overnight-Blk show execution accuracy, while SMCalFlow shows program accuracy.
|
| 148 |
+
|
| 149 |
+
SMCalFlow with GPT-3.5 where both methods performed poorly, and GeoQuery with PaLM 2-L[7], where standard prompting already performed well.
|
| 150 |
+
|
| 151 |
+
# 4.2 Class-Specific Molecule Generation
|
| 152 |
+
|
| 153 |
+
We next demonstrate an application of grammar prompting beyond language parsing problems with a molecule generation task. Existing methods for molecule generation typically focus on training specialized neural models using large training sets [45, 37, 15, 2, 79, 61, 19]. We instead follow Guo et al. [29] and explore a few-shot setting where the task is to generate class-specific molecules given a small number of exemplars of that class. Formally, given a small set of molecules $\{ \pmb { y } _ { c } ^ { ( i ) } \} _ { i = 1 } ^ { N }$ belonging to a particular molecule class $c \in \{$ {Acrylates, Chain Extenders, Isocyanates}, our goal is to generate novel molecules $\mathbf { \nabla } _ { \mathbf { \boldsymbol { y } } _ { c } }$ of the same class that can be synthesized using existing molecules. Since the in-context examples in this case will only consist of molecules of the same class, the “input” $\pmb { x } _ { c } ^ { ( i ) }$ is the empty string in this case. The data contains 32 Acrylates, 11 Chain Extenders, and 11 Isocyanates (see appendix G of Guo et al. [29]).
|
| 154 |
+
|
| 155 |
+
While molecules can be more faithfully represented with 3D graph structure, the SMILES string representation [87] remains popular due to its ease of use.9 The specialized grammars $G [ y _ { c } ]$ (which are specialized from the SMILES grammar) encode various structural properties of the molecule that are specific to the molecule class. Figure 4 shows an example of a specialized grammar and the corresponding molecule in SMILES format. In this example, ring_closure : $\mathit { \Pi } : : = \mathit { \Pi } " 1 \mathit { \Pi } "$ specifies the number of rings, and branch : $\mathrel { \mathop : } = \mathrm { \Omega } ^ { \prime \prime } ( \mathrm { \Omega } ^ { \prime \prime }$ smiles ")" specifies whether there is a branch.
|
| 156 |
+
|
| 157 |
+
We test our approach by generating 100 molecules for each class and assessing the quality of the generated molecules. In addition to the standard prompting baseline, we also run the graph grammar baseline from Guo et al. [29] which learns a hypergraph grammar [38] from the given molecules. We use four metrics: Validity $( V )$ , the percentage of chemically valid molecules; Diversity $( D )$ , average pairwise Tanimoto distance over Morgan fingerprints [60]; Retrosynthesis score $( R )$ , the percentage
|
| 158 |
+
|
| 159 |
+
Figure 4: Example of a specialized grammar for generating a molecule from the Acrylates class.
|
| 160 |
+
|
| 161 |
+
<table><tr><td colspan="4">Specialized SMILES Grammar for Molecule Generation</td></tr><tr><td rowspan="9">G[y]:</td><td>smiles</td><td></td><td>atom chain branch chain chain丨atom chain</td></tr><tr><td>atom</td><td></td><td>organic_symbol</td></tr><tr><td>organic_symbol</td><td></td><td>"C” "N” |"0"</td></tr><tr><td>chain</td><td></td><td>atom ring_closure bond atom丨bond atom</td></tr><tr><td></td><td></td><td>bond atom ring_closure丨atom</td></tr><tr><td></td><td></td><td>atom bond atom bond atom</td></tr><tr><td></td><td></td><td>bond atom bond atom 0</td></tr><tr><td>ring_closure</td><td></td><td>"1"</td></tr><tr><td>bond</td><td></td><td>0</td></tr><tr><td colspan="2">branch</td><td>"=” "(” smiles")"</td></tr><tr><td colspan="2">y: CC(= C)C(= O)OCCOC1 = CC = CC = C1</td></tr></table>
|
| 162 |
+
|
| 163 |
+
<table><tr><td></td><td colspan="4">Acrylates</td><td colspan="4">Chain Extenders</td><td colspan="4">Isocyanates</td></tr><tr><td>Model</td><td>V</td><td>D</td><td>R</td><td>M</td><td>V</td><td>D</td><td>R</td><td>M</td><td>V</td><td>D</td><td>R</td><td>M</td></tr><tr><td>Graph Grammar [29]</td><td>100</td><td>0.83</td><td>79.0</td><td>30.3</td><td>100(</td><td>0.86</td><td>72.7</td><td>98.3</td><td>100</td><td>0.93</td><td>52.2</td><td>82.7</td></tr><tr><td>Standard Prompting</td><td>87.7</td><td>0.73</td><td>80.0</td><td>76.7</td><td>60.3</td><td>0.89</td><td>72.7</td><td>55.7</td><td>94.7</td><td>0.82</td><td>78.0</td><td>92.2</td></tr><tr><td>Grammar Prompting</td><td>98.0</td><td>0.74</td><td>91.0</td><td>93.3</td><td>96.3</td><td>0.90</td><td>86.7</td><td>94.0</td><td>97.7</td><td>0.79</td><td>78.0</td><td>96.3</td></tr></table>
|
| 164 |
+
|
| 165 |
+
Table 4: Results for few-shot molecule generation with GPT-3.5. The metrics are validity (V), diversity (D) retrosynthesis score (R) and membership (M). Higher is better for all metrics.
|
| 166 |
+
|
| 167 |
+
of molecules that are synthesizable from existing molecules, which is computed approximately via the Retro\* model [12]; Membership (M), the percentage of molecules that belong to the desired monomer class. We use GPT-3.5 as the base LLM and sample from the LLM without constrained decoding, as constrained decoding was found to decrease the diversity of samples. See appendix A.2 for the full experimental setup.
|
| 168 |
+
|
| 169 |
+
Results. Table 4 shows that, compared with standard prompting, grammar prompting significantly improves the synthesis of Acrylates and Chain Extenders across all metrics, while yielding mixed results for Isocyanates. Notably, both prompting-based methods outperform the graph grammar baseline in terms of Retro score, possibly due to that LLMs may have been pre-trained on existing datasets of molecules, enabling them to effectively generate synthesizable molecules. In contrast, the baseline method cannot incorporate any external knowledge beyond the 11 or 32 molecules provided. Our preliminary results indicate that LLMs can serve as a useful tool for generating string representations of chemical structures (and potentially other biological/chemical structures).
|
| 170 |
+
|
| 171 |
+
# 4.3 Action Subset Selection for Efficient PDDL Planning
|
| 172 |
+
|
| 173 |
+
Our final experiments show how grammar prompting can improve the efficiency of classical AI planners. Classical planning is the problem of finding a sequence of actions (i.e., a plan) that goes from an initial state $\scriptstyle { \pmb { s } } _ { 0 }$ to a goal state $s _ { g }$ . An action is represented by a ground operator (e.g., unstack(block1, block2) which consists of an operator unstack along with two object arguments). We additionally consider macro-operators which can potentially speed up planning [9].10 Planning tasks, along with actions, are represented in Planning Domain Definition Language (PDDL) [27]. We explore how grammar prompted LLMs can help guide classical planning algorithms.
|
| 174 |
+
|
| 175 |
+
We design specialized grammars to provide guidance to the classical greedy best-first search (GBFS) algorithm [5] by selecting a set of relevant actions. Figure 5 illustrates an example of such a specialized grammar, which captures all the necessary actions for the final plan $\textbf { { y } }$ that solves the given task. The process of the guided planning consists of the following steps: (1) given a task, predict a specialized grammar $G [ \bar { \pmb { y } } ]$ ; (2) use the specialized grammar $G [ \pmb { y } ]$ to subsequently generate a plan within the restricted action space derived from $G [ \pmb { y } ]$ ; (3) initialize GBFS’s priority queue with the LLM-generated plan, and (4) search for the final plan in the restricted action space. Our setup builds upon the idea of using an LLM-generated plan to initialize GBFS from Silver et al. [69], which has a simpler two-step process: (1) given a task, predict a plan via standard prompting, and (2) utilize this plan to guide GBFS. We use their method as our baseline.
|
| 176 |
+
|
| 177 |
+
Following Silver et al. [69], we create a similar few-shot setting for LLM planning, using 5 tasks as in-context examples and 10 tasks for evaluation from Pyperplan [5]. We test our approach on 3 classic domains in PDDL planning, including Blocks, Depot and Satellite. For the action space, we use either a set of primitive actions (Prim) or an augmented set with macro actions (Macro). In addition to standard prompting, we add two more baselines: (1) No LLM: planning with the entire set of actions; (2) Min Macro: where we construct a minimal set of macro actions for each domain by selecting actions from existing plans for the training tasks. The Min Macro baseline is a domain-specific method to reduce the action space. By comparing to Min Macro, we can verify the effectiveness of instance-specific v.s. domain-specific action selection. See appendix A.3 for more details.
|
| 178 |
+
|
| 179 |
+

|
| 180 |
+
|
| 181 |
+

|
| 182 |
+
Table 5: Results on PDDL planning. Created/Expanded refer to the number of nodes during planning (lower is better). Success refers to success rate (higher is better). Numbers are averaged over three runs using GPT-3.5.
|
| 183 |
+
|
| 184 |
+
Results. We evaluate the efficiency of planning in terms of the number of search nodes created/- expanded, as well as the success rate. Table 5 shows the promising performance of LLM-guided planning via grammar prompting. In Blocks, grammar prompting significantly improves efficiency while maintaining $100 \%$ success rate. In Depot, grammar prompting with macro actions improves the success rate by $20 \%$ over the best competing baseline. In Satellite, using primitive actions yields the best performance with $100 \%$ success rate and a reduction of $57 \%$ expanded nodes comparing to the No LLM baseline. While our experiments are not intended to complete with the state-of-the-art algorithms for fast planning [20–22, 32, 25, 84], they indicate the promise of LLMs for improving existing planning algorithms.
|
| 185 |
+
|
| 186 |
+
# 5 Discussion and Limitations
|
| 187 |
+
|
| 188 |
+
We discuss several limitations of our approach including some negative results. Grammar prompting did not yield any improvements for DSLs that were likely to have been frequently encountered during pretraining (e.g., regular expressions, SQL). Moreover, constrained generation based on specialized grammars led to increased API calls, and was not always beneficial for tasks beyond semantic parsing. For instance, in molecule generation we discovered that enforcing constraints can sometimes result in lower diversity. Additionally, in PDDL planning we observed that the constraints applied to prune objects can sometimes negatively impact performance, suggesting that relevant object selection is still very challenging for LLMs. It may be interesting to explore whether finetuning of moderately-sized LLMs using specialized grammars can lead to better grammar-based models for DSL generation.
|
| 189 |
+
|
| 190 |
+
On the positive front, our work demonstrates that LLMs have the capacity to understand and generate metalanguages. Working in this “metalanguage space” can be combined with chain-of-thought-style [86] prompts by, for example, manually providing natural language comments to the rules of the specialized grammars. We found this to improve results slightly on semantic parsing (see Figure 6 of appendix A.1). Moreover, many scientific problems can be formally approached by representing hypotheses as DSL programs [71], and DSLs can enable easier encoding of human prior knowledge and scientific principles, providing a foundation for scientific discovery. Recent work shows that state-of-the-art LLMs can follow previously unseen formal systems [75]. Techniques like grammar prompting can widen the scope of scientific problems for which LLMs could be effectively applied by more explicitly accounting for external knowledge and constraints.
|
| 191 |
+
|
| 192 |
+
# 6 Related Work
|
| 193 |
+
|
| 194 |
+
Chain-of-thought prompting. Grammar prompting extends a recent line of work on improving reasoning capabilities by requesting explicit reasoning steps as part of the prompt [51, 24, 86, 80, 14, 94]. Our approach is closely related to concurrent work on employing symbolic variables as part of the prompt [30, 50, 33, 97, 52], though we are not aware of any existing work that uses formal grammars as the intermediate reasoning step.
|
| 195 |
+
|
| 196 |
+
LLMs for program generation and semantic parsing. Generating programs from natural language specifications, a task often referred to as semantic parsing, is a sub-problem of program synthesis; for surveys, see Kamath and Das [39] and Gulwani et al. [28]. Recent works [8, 89] have explored using LLMs for generating code in general-purpose programming languages (e.g., Python). Our work further extends this line by examining whether LLMs can generate DSL programs, which are intrinsically scarce. There has also been work on using LLMs for tool usage via further training [63] or prompting [56, 77], investigating how model scales [57] and retrievers [96, 46] affect in-context learning for semantic parsing, and constrained decoding [64, 68, 55] for program generation.
|
| 197 |
+
|
| 198 |
+
Neural grammars. Grammar prompting can also been seen as a “fully LLM” instantiation of a line of work on neural parameterizations of symbolic grammars [35, 17, 43, 42, 36, 100, 92, 91, 93]. Indeed, our approach to semantic parsing essentially uses prompt-based learning to define a quasisynchronous grammar [70, 78] whose rules dynamically depend on the source sentence. Concretely, in contrast to recent works which embed learnable neural components within synchronous grammars [41, 23, 76], grammar prompting relies on the implicit in-context learning capabilities of LLMs for the learning component. (However unlike these works, our conditional grammar does not explicitly align its rules to the subparts of the source sentence).
|
| 199 |
+
|
| 200 |
+
Grammar-based molecule generation. Grammar-based methods have gained significant interest in the realm of molecule generation, offering advantages in interpretability, data-efficiency, and controllability. One line of research involves integrating generic SMILES grammars with neural networks to generate syntactically correct molecules [45, 15]. Another approach centers on datadriven induction of grammars for generation [29, 38]. Our work aligns with the former, viewing grammar prompting as a straightforward method for integrating grammar into an LLM without the need for additional training.
|
| 201 |
+
|
| 202 |
+
LLMs for planning. Recently, LLMs have been increasingly studied in the context of planning for autonomous agents. When given goals expressed in natural language in household environments, earlier works [3, 65, 34, 48] directly prompted LLMs to predict executable actions. However, in PDDL domains, recent works [69, 74] showed that LLMs underperform classical planners if the desired action sequences are very long. Grammar prompting represents a promising strategy for augmenting classical planners with LLMs to get the best of both worlds. Other related efforts include translating between problems and PDDL models [49] and corrective re-prompting [58]. Besides using LLMs, integrating learning and planning has been extensively studied in the past literature, e.g., learning actions [4, 82], skills [84], macro-actions [9], rules [88] and guidance strategies [90, 83, 40] for more efficient planning.
|
| 203 |
+
|
| 204 |
+
# 7 Conclusion
|
| 205 |
+
|
| 206 |
+
We propose grammar prompting as a simple approach for improving few-shot DSL generation with large language models. Experiments across a range of structured languages including DSLs for semantic parsing (SMCalFlow, GeoQuery, Overnight), PDDL planning (action DSL), and molecule generation (SMILES), show that grammar prompting can improve upon standard prompting baselines. The encouraging results in semantic parsing indicate its potential to assist LLMs with tool usage, and the promising results in other domains indicate that grammar prompting can enable application of LLMs in domains that intrinsically depend on DSLs.
|
| 207 |
+
|
| 208 |
+
# Acknowledgments
|
| 209 |
+
|
| 210 |
+
We thank Jacob Andreas, Gabriel Grand, Linlu Qiu, Tom Silver, and Hunter Lang for helpful discussion and feedback. This study was supported by funds from the Google-MIT research collaborations program and the GIST-MIT joint research program.
|
| 211 |
+
|
| 212 |
+
References [1] Sam Acquaviva, Yewen Pu, Marta Kryven, Theodoros Sechopoulos, Catherine Wong, Gabrielle Ecanow, Maxwell Nye, Michael Tessler, and Josh Tenenbaum. Communicating natural programs to humans and machines. Proceedings of NeurIPS, 35:3731–3743, 2022. [2] Walid Ahmad, Elana Simon, Seyone Chithrananda, Gabriel Grand, and Bharath Ramsundar. Chemberta-2: Towards chemical foundation models. arXiv preprint arXiv:2209.01712, 2022. [3] Michael Ahn, Anthony Brohan, Noah Brown, Yevgen Chebotar, Omar Cortes, Byron David, Chelsea Finn, Keerthana Gopalakrishnan, Karol Hausman, Alex Herzog, et al. Do as I can, not as I say: Grounding language in robotic affordances. arXiv preprint arXiv:2204.01691, 2022. [4] Diego Aineto, Sergio Jiménez, and Eva Onaindia. Learning STRIPS action models with classical planning. In Proceedings of the International Conference on Automated Planning and Scheduling, volume 28, pages 399–407, 2018. [5] Yusra Alkhazraji, Matthias Frorath, Markus Grützner, Malte Helmert, Thomas Liebetraut, Robert Mattmüller, Manuela Ortlieb, Jendrik Seipp, Tobias Springenberg, Philip Stahl, and Jan Wülfing. Pyperplan (v1.3), 2020. URL https://doi.org/10.5281/zenodo.3701399. [6] Jacob Andreas, John Bufe, David Burkett, Charles Chen, Josh Clausman, Jean Crawford, Kate Crim, Jordan DeLoach, Leah Dorner, Jason Eisner, Hao Fang, Alan Guo, David Hall, Kristin Hayes, Kellie Hill, Diana Ho, Wendy Iwaszuk, Smriti Jha, Dan Klein, Jayant Krishnamurthy, Theo Lanman, Percy Liang, Christopher H. Lin, Ilya Lintsbakh, Andy McGovern, Aleksandr Nisnevich, Adam Pauls, Dmitrij Petters, Brent Read, Dan Roth, Subhro Roy, Jesse Rusak, Beth Short, Div Slomin, Ben Snyder, Stephon Striplin, Yu Su, Zachary Tellman, Sam Thomson, Andrei Vorobev, Izabela Witoszko, Jason Wolfe, Abby Wray, Yuchen Zhang, and Alexander Zotov. Task-oriented dialogue as dataflow synthesis. Transactions of the Association for Computational Linguistics, 8:556–571, 2020. doi: 10.1162/tacl_a_00333. URL https: //aclanthology.org/2020.tacl-1.36. [7] Rohan Anil, Andrew M Dai, Orhan Firat, Melvin Johnson, Dmitry Lepikhin, Alexandre Passos, Siamak Shakeri, Emanuel Taropa, Paige Bailey, Zhifeng Chen, et al. PaLM 2 technical report. arXiv preprint arXiv:2305.10403, 2023. [8] Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, et al. Program synthesis with large language models. arXiv preprint arXiv:2108.07732, 2021. [9] Adi Botea, Markus Enzenberger, Martin Müller, and Jonathan Schaeffer. Macro-ff: Improving AI planning with automatically learned macro-operators. Journal of Artificial Intelligence Research, 24:581–621, 2005.
|
| 213 |
+
[10] Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. In Proceedings of NeurIPS, 2020.
|
| 214 |
+
[11] Ruisheng Cao, Su Zhu, Chen Liu, Jieyu Li, and Kai Yu. Semantic parsing with dual learning. In Proceedings of ACL, pages 51–64, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1007. URL https://aclanthology.org/P19-1007.
|
| 215 |
+
[12] Binghong Chen, Chengtao Li, Hanjun Dai, and Le Song. Retro\*: Learning retrosynthetic planning with neural guided A\* search. In Proceedings of ICML, pages 1608–1616. PMLR, 2020.
|
| 216 |
+
[13] Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, Dave Cummings, Matthias Plappert, Fotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William Hebgen Guss, Alex Nichol, Alex Paino, Nikolas Tezak, Jie Tang, Igor Babuschkin, Suchir Balaji, Shantanu Jain, William Saunders, Christopher Hesse, Andrew N. Carr, Jan Leike, Josh Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew Knight, Miles Brundage, Mira Murati, Katie Mayer, Peter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. Evaluating large language models trained on code. 2021.
|
| 217 |
+
[14] Wenhu Chen, Xueguang Ma, Xinyi Wang, and William W Cohen. Program of thoughts prompting: Disentangling computation from reasoning for numerical reasoning tasks. arXiv preprint arXiv:2211.12588, 2022.
|
| 218 |
+
[15] Hanjun Dai, Yingtao Tian, Bo Dai, Steven Skiena, and Le Song. Syntax-directed variational autoencoder for structured data. arXiv preprint arXiv:1802.08786, 2018.
|
| 219 |
+
[16] David Dohan, Winnie Xu, Aitor Lewkowycz, Jacob Austin, David Bieber, Raphael Gontijo Lopes, Yuhuai Wu, Henryk Michalewski, Rif A. Saurous, Jascha Sohl-dickstein, Kevin Murphy, and Charles Sutton. Language Model Cascades. arXiv:2207.10342, 2022.
|
| 220 |
+
[17] Chris Dyer, Adhiguna Kuncoro, Miguel Ballesteros, and Noah A. Smith. Recurrent neural network grammars. In Proceedings of NAACL, 2016.
|
| 221 |
+
[18] Jay Earley. An efficient context-free parsing algorithm. Communications of the ACM, 13(2): 94–102, 1970.
|
| 222 |
+
[19] Carl Edwards, Tuan Lai, Kevin Ros, Garrett Honke, and Heng Ji. Translation between molecules and natural language. arXiv preprint arXiv:2204.11817, 2022.
|
| 223 |
+
[20] Richard E Fikes and Nils J Nilsson. STRIPS: A new approach to the application of theorem proving to problem solving. Artificial intelligence, 2(3-4):189–208, 1971.
|
| 224 |
+
[21] Maria Fox and Derek Long. PDDL2. 1: An extension to PDDL for expressing temporal planning domains. Journal of Artificial Intelligence Research, 20:61–124, 2003.
|
| 225 |
+
[22] Maria Fox and Derek Long. Modelling mixed discrete-continuous domains for planning. Journal of Artificial Intelligence Research, 27:235–297, 2006.
|
| 226 |
+
[23] Dan Friedman, Alexander Wettig, and Danqi Chen. Finding Dataset Shortcuts with Grammar Induction. In Proceedings of EMNLP, 2022.
|
| 227 |
+
[24] Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. PAL: Program-aided Language Models. arXiv:2211.10435, 2022.
|
| 228 |
+
[25] Caelan R. Garrett, Tomas Lozano-Perez, and Leslie P. Kaelbling. PDDLStream: Integrating symbolic planners and blackbox samplers. In International Conference on Automated Planning and Scheduling (ICAPS), 2020. URL https://arxiv.org/abs/1802.08705.
|
| 229 |
+
[26] Saibo Geng, Martin Josifosky, Maxime Peyrard, and Robert West. Flexible Grammar-Based Constrained Decoding for Language Models. arXiv:2305.13971, 2023.
|
| 230 |
+
[27] Malik Ghallab, Adele Howe, Craig Knoblock, Drew McDermott, Ashwin Ram, Manuela Veloso, Daniel Weld, David Wilkins SRI, Anthony Barrett, Dave Christianson, et al. PDDL – the planning domain definition language. Technical Report CVC TR98003/DCS TR1165. New Haven, CT: Yale Center for Computational Vision and Control., 1998.
|
| 231 |
+
[28] Sumit Gulwani, Oleksandr Polozov, Rishabh Singh, et al. Program synthesis. Foundations and Trends® in Programming Languages, 4(1-2):1–119, 2017.
|
| 232 |
+
[29] Minghao Guo, Veronika Thost, Beichen Li, Payel Das, Jie Chen, and Wojciech Matusik. Data-efficient graph grammar learning for molecular generation. In Proceedings of ICLR, 2022.
|
| 233 |
+
[30] Joy He-Yueya, Gabriel Poesia, Rose E Wang, and Noah D Goodman. Solving math word problems by combining language models with symbolic solvers. arXiv preprint arXiv:2304.09102, 2023.
|
| 234 |
+
[31] Jonathan Herzig and Jonathan Berant. Span-based semantic parsing for compositional generalization. In Proceedings of ACL, pages 908–921, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.74. URL https: //aclanthology.org/2021.acl-long.74.
|
| 235 |
+
[32] Jörg Hoffmann. The metric-ff planning system: Translating“ignoring delete lists”to numeric state variables. Journal of Artificial Intelligence Research, 20:291–341, 2003.
|
| 236 |
+
[33] Hanxu Hu, Hongyuan Lu, Huajian Zhang, Wai Lam, and Yue Zhang. Chain-of-symbol prompting elicits planning in large langauge models. arXiv preprint arXiv:2305.10276, 2023.
|
| 237 |
+
[34] Wenlong Huang, Pieter Abbeel, Deepak Pathak, and Igor Mordatch. Language models as zero-shot planners: Extracting actionable knowledge for embodied agents. In Proceedings of ICML, pages 9118–9147. PMLR, 2022.
|
| 238 |
+
[35] Yong Jiang, Wenjuan Han, Kewei Tu, et al. Unsupervised neural dependency parsing. Association for Computational Linguistics (ACL), 2016.
|
| 239 |
+
[36] Lifeng Jin, Finale Doshi-Velez, Timothy Miller, Lane Schwartz, and William Schuler. Unsupervised learning of PCFGs with normalizing flow. In Proceedings of ACL, Florence, Italy, July 2019. Association for Computational Linguistics.
|
| 240 |
+
[37] Wengong Jin, Regina Barzilay, and Tommi Jaakkola. Junction tree variational autoencoder for molecular graph generation. In Proceedings of ICML, pages 2323–2332. PMLR, 2018.
|
| 241 |
+
[38] Hiroshi Kajino. Molecular hypergraph grammar with its application to molecular optimization. In Proceedings of ICML, pages 3183–3191. PMLR, 2019.
|
| 242 |
+
[39] Aishwarya Kamath and Rajarshi Das. A survey on semantic parsing. arXiv preprint arXiv:1812.00978, 2018.
|
| 243 |
+
[40] Beomjoon Kim, Zi Wang, Leslie Pack Kaelbling, and Tomás Lozano-Pérez. Learning to guide task and motion planning using score-space representation. The International Journal of Robotics Research, 38(7):793–812, 2019.
|
| 244 |
+
[41] Yoon Kim. Sequence-to-sequence learning with latent neural grammars. In Proceedings of NeurIPS, pages 26302–26317, 2021.
|
| 245 |
+
[42] Yoon Kim, Chris Dyer, and Alexander Rush. Compound probabilistic context-free grammars for grammar induction. In Proceedings of ACL, Florence, Italy, July 2019. Association for Computational Linguistics.
|
| 246 |
+
[43] Yoon Kim, Alexander Rush, Lei Yu, Adhiguna Kuncoro, Chris Dyer, and Gábor Melis. Unsupervised recurrent neural network grammars. In Proceedings of NAACL, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics.
|
| 247 |
+
[44] Mario Krenn, Florian Häse, AkshatKumar Nigam, Pascal Friederich, and Alan Aspuru-Guzik. Self-referencing embedded strings (selfies): A $100 \%$ robust molecular string representation. Machine Learning: Science and Technology, 1(4):045024, oct 2020.
|
| 248 |
+
[45] Matt J Kusner, Brooks Paige, and José Miguel Hernández-Lobato. Grammar variational autoencoder. In Proceedings of ICML, pages 1945–1954. PMLR, 2017.
|
| 249 |
+
[46] Itay Levy, Ben Bogin, and Jonathan Berant. Diverse demonstrations improve in-context compositional generalization. arXiv preprint arXiv:2212.06800, 2022.
|
| 250 |
+
[47] Yaobo Liang, Chenfei Wu, Ting Song, Wenshan Wu, Yan Xia, Yu Liu, Yang Ou, Shuai Lu, Lei Ji, Shaoguang Mao, Yun Wang, Linjun Shou, Ming Gong, and Nan Duan. TaskMatrix.AI: Completing Tasks by Connecting Foundation Models with Millions of APIs. arXiv:2303.16434, 2023.
|
| 251 |
+
|
| 252 |
+
[48] Bill Yuchen Lin, Chengsong Huang, Qian Liu, Wenda Gu, Sam Sommerer, and Xiang Ren. On grounded planning for embodied tasks with language models. arXiv preprint arXiv:2209.00465, 2022.
|
| 253 |
+
|
| 254 |
+
[49] Bo Liu, Yuqian Jiang, Xiaohan Zhang, Qiang Liu, Shiqi Zhang, Joydeep Biswas, and Peter Stone. Llm $^ +$ p: Empowering large language models with optimal planning proficiency. arXiv preprint arXiv:2304.11477, 2023.
|
| 255 |
+
|
| 256 |
+
[50] Qing Lyu, Shreya Havaldar, Adam Stein, Li Zhang, Delip Rao, Eric Wong, Marianna Apidianaki, and Chris Callison-Burch. Faithful chain-of-thought reasoning. arXiv preprint arXiv:2301.13379, 2023.
|
| 257 |
+
|
| 258 |
+
[51] Maxwell Nye, Anders Andreassen, Guy Gur-Ari, Henryk Witold Michalewski, Jacob Austin, David Bieber, David Martin Dohan, Aitor Lewkowycz, Maarten Paul Bosma, David Luan, Charles Sutton, and Augustus Odena. Show your work: Scratchpads for intermediate computation with language models. arXiv:2112.00114, 2021.
|
| 259 |
+
|
| 260 |
+
[52] Liangming Pan, Alon Albalak, Xinyi Wang, and William Yang Wang. Logic-LM: Empowering Large Language Models with Symbolic Solvers for Faithful Logical Reasoning. arXiv:2305.12295, 2023.
|
| 261 |
+
|
| 262 |
+
[53] Bhargavi Paranjape, Scott Lundberg anbd Sameer Singh, Hannaneh Hajishirzi, Luke Zettlemoyer, and Marco Tulio Ribeiro. ART: Automatic multi-step reasoning and tool-use for large language models. arXiv:2303.09014, 2023.
|
| 263 |
+
|
| 264 |
+
[54] Emmanouil Antonios Platanios, Adam Pauls, Subhro Roy, Yuchen Zhang, Alexander Kyte, Alan Guo, Sam Thomson, Jayant Krishnamurthy, Jason Wolfe, Jacob Andreas, and Dan Klein. Value-agnostic conversational semantic parsing. In Proceedings of ACL, August 2021.
|
| 265 |
+
|
| 266 |
+
[55] Gabriel Poesia, Alex Polozov, Vu Le, Ashish Tiwari, Gustavo Soares, Christopher Meek, and Sumit Gulwani. Synchromesh: Reliable Code Generation from Pre-trained Language Models. Proceedings of ICLR, 2022.
|
| 267 |
+
|
| 268 |
+
[56] Yujia Qin, Shengding Hu, Yankai Lin, Weize Chen, Ning Ding, Ganqu Cui, Zheni Zeng, Yufei Huang, Chaojun Xiao, Chi Han, et al. Tool learning with foundation models. arXiv preprint arXiv:2304.08354, 2023.
|
| 269 |
+
|
| 270 |
+
[57] 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 Proceedings of EMNLP, December 2022.
|
| 271 |
+
|
| 272 |
+
[58] Shreyas Sundara Raman, Vanya Cohen, Eric Rosen, Ifrah Idrees, David Paulius, and Stefanie Tellex. Planning with large language models via corrective re-prompting. arXiv preprint arXiv:2211.09935, 2022.
|
| 273 |
+
|
| 274 |
+
[59] Nils Reimers and Iryna Gurevych. Sentence-bert: Sentence embeddings using siamese bertnetworks. arXiv preprint arXiv:1908.10084, 2019.
|
| 275 |
+
|
| 276 |
+
[60] David Rogers and Mathew Hahn. Extended-connectivity fingerprints. Journal of chemical information and modeling, 50(5):742–754, 2010.
|
| 277 |
+
|
| 278 |
+
[61] Yu Rong, Yatao Bian, Tingyang Xu, Weiyang Xie, Ying Wei, Wenbing Huang, and Junzhou Huang. Self-supervised graph transformer on large-scale molecular data. Proceedings of NeurIPS, 33:12559–12571, 2020.
|
| 279 |
+
|
| 280 |
+
[62] Victor Sanh, Albert Webson, Colin Raffel, Stephen H. Bach, et al. Multitask prompted training enables zero-shot task generalization. In Proceedings of ICLR, 2022.
|
| 281 |
+
|
| 282 |
+
[63] Timo Schick, Jane Dwivedi-Yu, Roberto Dessi, Roberta Raileanu, Maria Lomeli, Luke Zettlemoyer, Nicola Cancedda, and Thomas Scialom. Toolformer: Language Models Can Teach Themselves to Use Tools. arXiv:2302.04761, 2023.
|
| 283 |
+
|
| 284 |
+
[64] Torsten Scholak, Nathan Schucher, and Dzmitry Bahdanau. PICARD: Parsing incrementally for constrained auto-regressive decoding from language models. In Proceedings of EMNLP, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics.
|
| 285 |
+
|
| 286 |
+
[65] Pratyusha Sharma, Antonio Torralba, and Jacob Andreas. Skill induction and planning with latent language. arXiv preprint arXiv:2110.01517, 2021.
|
| 287 |
+
|
| 288 |
+
[66] Peter Shaw, Ming-Wei Chang, Panupong Pasupat, and Kristina Toutanova. Compositional generalization and natural language variation: Can a semantic parsing approach handle both? In Proceedings of ACL, August 2021.
|
| 289 |
+
|
| 290 |
+
[67] Richard Shin and Benjamin Van Durme. Few-shot semantic parsing with language models trained on code. In Proceedings of NAACL, pages 5417–5425, Seattle, United States, July 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.naacl-main.396. URL https://aclanthology.org/2022.naacl-main.396.
|
| 291 |
+
|
| 292 |
+
[68] Richard Shin, Christopher Lin, Sam Thomson, Charles Chen, Subhro Roy, Emmanouil Antonios Platanios, Adam Pauls, Dan Klein, Jason Eisner, and Benjamin Van Durme. Constrained language models yield few-shot semantic parsers. In Proceedings of EMNLP. Association for Computational Linguistics, November 2021.
|
| 293 |
+
|
| 294 |
+
[69] Tom Silver, Varun Hariprasad, Reece S Shuttleworth, Nishanth Kumar, Tomás Lozano-Pérez, and Leslie Pack Kaelbling. PDDL planning with pretrained large language models. In NeurIPS 2022 Foundation Models for Decision Making Workshop, 2022.
|
| 295 |
+
|
| 296 |
+
[70] David Smith and Jason Eisner. Quasi-Synchronous Grammars: Alignment by Soft Projection of Syntactic Dependencies. In Proceedings on the Workshop on Statistical Machine Translation, 2006.
|
| 297 |
+
|
| 298 |
+
[71] Jennifer J Sun, Megan Tjandrasuwita, Atharva Sehgal, Armando Solar-Lezama, Swarat Chaudhuri, Yisong Yue, and Omar Costilla-Reyes. Neurosymbolic programming for science. arXiv preprint arXiv:2210.05050, 2022.
|
| 299 |
+
|
| 300 |
+
[72] Didac Suris, Sachit Menon, and Carl Vondrick. ViperGPT: Visual Inference via Python Execution for Reasoning. arXiv:2303.08128, 2023.
|
| 301 |
+
|
| 302 |
+
[73] Mirac Suzgun, Nathan Scales, Nathanael Scharli, Sebastian Gehrmann, Yi Tay, Hyung Won Chung, Aakanksha Chowdhery, Quoc V. Le, Ed H. Chi, Denny Zhou, and Jason Wei. Challenging big-bench tasks and whether chain-of-thought can solve them. arXiv:2210.09261, 2022.
|
| 303 |
+
|
| 304 |
+
[74] Karthik Valmeekam, Alberto Olmo, Sarath Sreedharan, and Subbarao Kambhampati. Large language models still can’t plan (a benchmark for llms on planning and reasoning about change). arXiv preprint arXiv:2206.10498, 2022.
|
| 305 |
+
|
| 306 |
+
[75] Gregor vom Scheidt. Experimental results from applying GPT-4 to an unpublished formal language. arXiv:2305.12196, 2023.
|
| 307 |
+
|
| 308 |
+
[76] Bailin Wang, Ivan Titov, Jacob Andreas, and Yoon Kim. Hierarchical Phrase-based Sequenceto-Sequence Learning. In Proceedings of EMNLP, 2022.
|
| 309 |
+
|
| 310 |
+
[77] Guanzhi Wang, Yuqi Xie, Yunfan Jiang, Ajay Mandlekar, Chaowei Xiao, Yuke Zhu, Linxi Fan, and Anima Anandkumar. Voyager: An open-ended embodied agent with large language models. arXiv preprint arXiv:2305.16291, 2023.
|
| 311 |
+
|
| 312 |
+
[78] Mengqiu Wang, Noah A. Smith, and Teruko Mitamura. What is the Jeopardy Model? A Quasi-Synchronous Grammar for QA. In Proceedings of EMNLP, 2007.
|
| 313 |
+
|
| 314 |
+
[79] Sheng Wang, Yuzhi Guo, Yuhong Wang, Hongmao Sun, and Junzhou Huang. Smiles-bert: large scale unsupervised pre-training for molecular property prediction. In Proceedings of the 10th ACM international conference on bioinformatics, computational biology and health informatics, pages 429–436, 2019.
|
| 315 |
+
|
| 316 |
+
[80] Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. In Proceedings of ICLR, 2023.
|
| 317 |
+
[81] Yushi Wang, Jonathan Berant, and Percy Liang. Building a semantic parser overnight. In Proceedings of ACL, Beijing, China, July 2015.
|
| 318 |
+
[82] Zi Wang, Stefanie Jegelka, Leslie Pack Kaelbling, and Tomás Lozano-Pérez. Focused modellearning and planning for non-Gaussian continuous state-action systems. In 2017 IEEE International conference on robotics and automation (ICRA), pages 3754–3761. IEEE, 2017.
|
| 319 |
+
[83] Zi Wang, Caelan Reed Garrett, Leslie Pack Kaelbling, and Tomás Lozano-Pérez. Active model learning and diverse action sampling for task and motion planning. In 2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 4107–4114. IEEE, 2018.
|
| 320 |
+
[84] Zi Wang, Caelan Reed Garrett, Leslie Pack Kaelbling, and Tomás Lozano-Pérez. Learning compositional models of robot skills for task and motion planning. The International Journal of Robotics Research, 40(6-7):866–894, 2021.
|
| 321 |
+
[85] Jason Wei, Maarten Paul Bosma, Vincent Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew Mingbo Dai, and Quoc V. Le. Finetuned language models are zero-shot learners. In Proceedings of ICLR, 2022.
|
| 322 |
+
[86] 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. In Proceedings of NeurIPS, 2022.
|
| 323 |
+
[87] David Weininger. Smiles, a chemical language and information system. 1. introduction to methodology and encoding rules. Journal of chemical information and computer sciences, 28 (1):31–36, 1988.
|
| 324 |
+
[88] Victoria Xia, Zi Wang, and Leslie Pack Kaelbling. Learning sparse relational transition models. In International Conference on Learning Representations, 2019.
|
| 325 |
+
[89] Frank F Xu, Uri Alon, Graham Neubig, and Vincent Josua Hellendoorn. A systematic evaluation of large language models of code. In Proceedings of the 6th ACM SIGPLAN International Symposium on Machine Programming, pages 1–10, 2022.
|
| 326 |
+
[90] Ryan Yang, Tom Silver, Aidan Curtis, Tomas Lozano-Perez, and Leslie Pack Kaelbling. Pg3: Policy-guided planning for generalized policy generation. arXiv preprint arXiv:2204.10420, 2022.
|
| 327 |
+
[91] Songlin Yang, Yanpeng Zhao, and Kewei Tu. Neural bi-lexicalized PCFG induction. In Proceedings of ACL, Online, August 2021. Association for Computational Linguistics.
|
| 328 |
+
[92] Songlin Yang, Yanpeng Zhao, and Kewei Tu. PCFGs can do better: Inducing probabilistic context-free grammars with many symbols. In Proceedings of NAACL, 2021.
|
| 329 |
+
[93] Songlin Yang, Roger P Levy, and Yoon Kim. Unsupervised discontinuous constituency parsing with mildly context-sensitive grammars. arXiv preprint arXiv:2212.09140, 2022.
|
| 330 |
+
[94] Shunyu Yao, Dian Yu, Jeffrey Zhao, Izhak Shafran, Thomas L Griffiths, Yuan Cao, and Karthik Narasimhan. Tree of thoughts: Deliberate problem solving with large language models. arXiv preprint arXiv:2305.10601, 2023.
|
| 331 |
+
[95] Jiacheng Ye, Zhiyong Wu, Jiangtao Feng, Tao Yu, and Lingpeng Kong. Compositional exemplars for in-context learning. arXiv preprint arXiv:2302.05698, 2023.
|
| 332 |
+
[96] Xi Ye, Qiaochu Chen, Isil Dillig, and Greg Durrett. Benchmarking multimodal regex synthesis with complex structures. In Proceedings of ACL. Association for Computational Linguistics, July 2020.
|
| 333 |
+
[97] Xi Ye, Qiaochu Chen, Isil Dillig, and Greg Durrett. Satisfiability-aided language models using declarative prompting. arXiv preprint arXiv:2305.09656, 2023.
|
| 334 |
+
[98] Pengcheng Yin, Hao Fang, Graham Neubig, Adam Pauls, Emmanouil Antonios Platanios, Yu Su, Sam Thomson, and Jacob Andreas. Compositional generalization for neural semantic parsing via span-level supervised attention. Proceedings of ACL, 2021.
|
| 335 |
+
[99] John M Zelle and Raymond J Mooney. Learning to parse database queries using inductive logic programming. In Proceedings of the national conference on artificial intelligence, pages 1050–1055, 1996.
|
| 336 |
+
[100] Hao Zhu, Yonatan Bisk, and Graham Neubig. The return of lexical dependencies: Neural lexicalized PCFGs. Transactions of the Association for Computational Linguistics, 8, 2020.
|
| 337 |
+
|
| 338 |
+
<table><tr><td></td><td colspan="3">Few-Shot</td><td colspan="3">Retrieval-based</td><td colspan="4">GeoQuery Out-of-Dist.</td></tr><tr><td></td><td></td><td></td><td>GeoQuery SMCalflow Overnight-Blk</td><td>GeoQuery</td><td></td><td>SMCalflow Overnight-Blk</td><td>Template</td><td>TMCD</td><td></td><td>Length NewFunc</td></tr><tr><td>Train</td><td>32</td><td>16</td><td>32</td><td>560</td><td>128</td><td>1436</td><td>441</td><td>440</td><td>440</td><td>453</td></tr><tr><td>Test</td><td>280</td><td>360</td><td>399</td><td>280</td><td>360</td><td>399</td><td>439</td><td>440</td><td>440</td><td>447</td></tr></table>
|
| 339 |
+
|
| 340 |
+
Table 6: Statistics of the splits used for experiments on semantic parsing.
|
| 341 |
+
|
| 342 |
+
<table><tr><td>Approach</td><td>GeoQuery</td><td>SMCalFlow</td><td>Overnight-B</td></tr><tr><td>Standard Prompting (unconstrained decoding)</td><td>81.5 (1.0)</td><td>46.4 (1.0)</td><td>54.7 (1.0)</td></tr><tr><td>w. constrained decoding (y E L(G))</td><td>81.8 (4.3)</td><td>49.2 (5.6)</td><td>54.7 (1.6)</td></tr><tr><td>Linearized Derivation Tree Prompting</td><td>77.5 (1.0)</td><td>50.0 (1.0)</td><td>56.4 (1.0)</td></tr><tr><td>Grammar Prompting (unconstrained decoding)</td><td>87.5 (1.0)</td><td>50.8 (1.0)</td><td>57.4 (1.0)</td></tr><tr><td>w. grammar constraint (G G)</td><td>88.6 (3.0)</td><td>51.3 (3.0)</td><td>60.4 (1.4)</td></tr><tr><td>W. grammar and program constraint (y ∈ L(G))</td><td>88.9 (3.3)</td><td>52.4 (3.3)</td><td>60.9 (2.8)</td></tr><tr><td>w. oracle grammar (G = G[y])</td><td>96.1 (1.3)</td><td>80.0 (1.0)</td><td>94.2 (1.0)</td></tr><tr><td>w. oracle grammar+program constraint</td><td>96.8 (2.1)</td><td>83.6 (2.6)</td><td>96.5 (1.0)</td></tr></table>
|
| 343 |
+
|
| 344 |
+
Table 7: Extended results which show the number of Codex calls per example on few-shot semantic parsing in brackets. Columns in grey show program accuracy, while white columns others indicate execution accuracy.
|
| 345 |
+
|
| 346 |
+
# A Experiment Details
|
| 347 |
+
|
| 348 |
+
# A.1 Semantic Parsing
|
| 349 |
+
|
| 350 |
+
Statistics and Splits. We show the statistics for the splits used for the experiments in Table 6.
|
| 351 |
+
|
| 352 |
+
For GeoQuery, we utilize the standard split from Zelle and Mooney [99] in the retrieval-based setting and the Template, TMCD, and Length splits from Shaw et al. [66]. We randomly sample 32 examples from the training set of the standard split to create the few-shot split. To generate the NewFunc split, we designate examples utilizing the following eight functions as test examples: smallest, shortest, most, highest, sum, population_1, count, major; the remaining examples are incorporated into the training set.
|
| 353 |
+
|
| 354 |
+
For SMCalFlow, we adopt the 16-shot and 128-shot cross-domain settings from Yin et al. [98] as our few-shot and retrieval-based settings, respectively. It is noteworthy that the training set of the original splits contains approximately 25k in-domain training examples. Previous work [96, 57] utilized these examples as their retrieval set. However, in our experiments, we found that incorporating in-domain examples did not enhance performance. Consequently, we use 16/128 cross-domain examples as our training set in the few-shot and retrieval settings, respectively. For all experiments on SMCalFlow, we used the preprocessed version from Qiu et al. [57], which employs a more concise LISPRESS format [54] than the original version [98]. This format aligns with Ye et al. [96] for a fair comparison.
|
| 355 |
+
|
| 356 |
+
For Overnight-Blocks, we employ the standard split from Wang et al. [81] in the retrieval setting. We randomly sample 32 examples from the training set of the standard split to create the few-shot split.
|
| 357 |
+
|
| 358 |
+
Scoring Functions for Constrained Generation. For each candidate continuation ${ \pmb w } \in \Sigma [ { \pmb y } _ { \mathrm { p r e f i x } } ]$ for correction, we first form a partial program via concatenation $y _ { \mathrm { p r e f i x } } \cdot w$ and then feed it into Codex to obtain the score for the candidate via
|
| 359 |
+
|
| 360 |
+
$$
|
| 361 |
+
\begin{array} { r } { \log P _ { \mathrm { L L M } } ( \pmb { w } | \widehat { G } , \pmb { x } , \pmb { y } _ { \mathrm { p r e f i x } } , ( \pmb { x } ^ { ( i ) } , G [ \pmb { y } ^ { ( i ) } ] , \pmb { y } ^ { ( i ) } ) _ { i = 1 } ^ { N } ) . } \end{array}
|
| 362 |
+
$$
|
| 363 |
+
|
| 364 |
+
In the case where $\pmb { w }$ consists of multiple BPE tokens, e.g., FindManger( is tokenized into Find, Manager, and (, we average the token-level log-likelihood to obtain a candidate-level score. However, when the size of $\Sigma [ \boldsymbol { y } _ { \mathrm { p r e f i x } } ]$ exceeds 16, invoking Codex for each candidate becomes too expensive. To address this issue, we employ SentenceBERT to select 16 most plausible candidates first via a dot product,
|
| 365 |
+
|
| 366 |
+
$$
|
| 367 |
+
( \mathrm { S e n t e n c e B E R T } ( \hat { y } _ { t } ) ) ^ { \top } ( \mathrm { S e n t e n c e B E R T } ( y _ { \mathrm { p r e f i x } } \cdot w ) ) ,
|
| 368 |
+
$$
|
| 369 |
+
|
| 370 |
+
where SentenceBERT yields the embeddings for the incorrect prediction $\hat { \mathbf { { y } } } _ { t }$ and a candidate of corrected partial program $y _ { \mathrm { p r e f i x } } \cdot w$ .
|
| 371 |
+
|
| 372 |
+
Table 8: Hyperparameters for sampling specialized grammars $\widehat { G }$ (top) and the molecules $\widehat { \pmb { y } }$ in grammar prompting for molecule generation. Standard prompting uses the same hyperparameters for $\textbf { { y } }$ .
|
| 373 |
+
|
| 374 |
+
<table><tr><td>Molecule Class</td><td>Temperature</td><td>Presence Penalty</td><td>Frequency Penalty</td></tr><tr><td>Sampling specialized grammars G</td><td></td><td></td><td></td></tr><tr><td>Acrylates</td><td>0.6</td><td>0.1</td><td>0.1</td></tr><tr><td>Chain Extenders</td><td>0.6</td><td>0.1</td><td>0.1</td></tr><tr><td>Isocyanates</td><td>0.6</td><td>0.4</td><td>0.4</td></tr><tr><td>Sampling molecules y</td><td></td><td></td><td></td></tr><tr><td>Acrylates</td><td>0.6</td><td>0.1</td><td>0.1</td></tr><tr><td>Chain Extenders</td><td>0.6</td><td>0.1</td><td>0.1</td></tr><tr><td>Isocyanates</td><td>0.3</td><td>0.4</td><td>0.4</td></tr></table>
|
| 375 |
+
|
| 376 |
+
The functionality of obtaining the log-likelihood for a candidate continuation given a prefix is applicable via Codex APIs 11 via setting logprobs ${ } = { }$ True and echo $\mid =$ True. Unfortunately, subsequent models (e.g., GPT-3.5 and GPT-4) disable such functionality. As a workaround, we simply use the scoring function based on SentenceBERT to directly select the best candidate in our PDDL planning experiments.
|
| 377 |
+
|
| 378 |
+
Cost Efficiency. We assess various decoding strategies for their cost efficiency, focusing on the number of API calls. The number of Codex calls resulting from the few-shot semantic parsing experiments is presented in Figure 7, alongside the corresponding accuracy metrics. The results indicate that standard prompting under constrained decoding leads to a significantly higher number of Codex calls. Similarly, grammar-prompting with constraints also results in an increased number of Codex calls. However, when employing both grammar and program constraints, the number of calls decreases meaningfully in comparison to standard prompting under constrained decoding. Future work might consider exploring strategies for more cost-efficient constrained decoding.
|
| 379 |
+
|
| 380 |
+
Grammar Prompting with Annotated Rules. We have additionally experimented with enhancing BNF rules by appending natural language comments. As illustrated in Figure 6, we pair each BNF rule with its corresponding natural language phrases extracted from the given query $_ { \textbf { \em x } }$ . These manually annotated comments yield an explicit correspondence between natural language phrases and their corresponding BNF rules, thereby better facilitating interpretation and application of the grammars for generating programs. When employing the augmented grammar prompting, we noticed marginal improvements on SMCalFlow $( + 1 . 0 \% )$ and Overnight-Blocks $( 0 . 5 \% )$ , with no observed enhancement on GeoQuery. While the gains might not appear significant, this predicted alignment could potentially contribute to improved interpretability and further constraints on generation. For instance, the phrase “someone’s manager” should consistently trigger the function FindManager(. We leave the exploration of utilizing the augmented rules for future work.
|
| 381 |
+
|
| 382 |
+
# A.2 Molecule Generation
|
| 383 |
+
|
| 384 |
+
Sampling Procedure Different from semantic parsing and PDDL planning, where the most probable program $\textbf { { y } }$ needs to be found via arg max inference, molecule generation has empty specification $_ { \textbf { \em x } }$ and requires sampling from a prompting-based distribution. The sampling procedure for grammar prompting consists of three stages: (1) we randomly sample a permutation of given molecules, denoted as $\pi$ , (2) based on a prompt formed by the permutation, we sample a specialized grammar $\widehat { G }$ via
|
| 385 |
+
|
| 386 |
+
$$
|
| 387 |
+
\widehat { G } \sim P _ { \mathrm { L L M } } ( G ^ { \prime } | \pmb { x } , ( G [ \pmb { y } ^ { ( \pi [ i ] ) } ] , \pmb { y } ^ { ( \pi [ i ] ) } ) _ { i = 1 } ^ { N } ) ,
|
| 388 |
+
$$
|
| 389 |
+
|
| 390 |
+
iii) we finally obtain the molecule conditioned $\widehat { G }$ ,
|
| 391 |
+
|
| 392 |
+
$$
|
| 393 |
+
\begin{array} { r } { \widehat { \pmb { y } } \sim P _ { \mathrm { L L M } } ( \pmb { y } | \widehat { G } , ( G [ \pmb { y } ^ { ( \pi [ i ] ) } ] , \pmb { y } ^ { ( \pi [ i ] ) } ) _ { i = 1 } ^ { N } ) . } \end{array}
|
| 394 |
+
$$
|
| 395 |
+
|
| 396 |
+
We list the hyperparameters used for the sampling procedure in for (2) in Table 8 (top) and for (3) in Table 8 (bottom).
|
| 397 |
+
|
| 398 |
+
You are an expert programmer, and you need to write a program for the given natural language query. First, you should write a grammar that contains all the necessary BNF rules. Then, you should write programs that conform to your predicted rules.
|
| 399 |
+
|
| 400 |
+
$\pmb { x } ^ { ( 1 ) }$ : find the meeting on Wednesday with Bob and Carol
|
| 401 |
+
|
| 402 |
+
$\mathbf { \ddot { \boldsymbol { G } } } [ \mathbf { \vec { y } } ^ { ( \mathrm { 1 } ) } ]$
|
| 403 |
+
|
| 404 |
+
event "QueryEvent(" constraint ")" find the meeting
|
| 405 |
+
constraint "(&" constraint constraint ")" "(start_?" date ")" on ... "(attendee_?" attendee attendee ")" with ...
|
| 406 |
+
date "Wednesday" Wednesday
|
| 407 |
+
attendee :: "Bob" | "Carol" Bob and Carol
|
| 408 |
+
|
| 409 |
+
y(1): QueryEvent(& (start_? Wednesday)(attendee_? Bob Carol))
|
| 410 |
+
|
| 411 |
+
$_ { \pmb { x } }$ : Add meeting with Jean’s manager on Wednesday at 3PM
|
| 412 |
+
|
| 413 |
+

|
| 414 |
+
Figure 6: Example of grammar prompting where BNF grammars are additionally annotated with natural language comments (shown in green). These manually curated comments provide a detailed mapping between natural language phrases and their corresponding BNF rules, thereby better facilitating interpretation and application of the grammars for generating programs. We manually craft and add these comments to the few-shot prompts (top). The model predicts this during inference (bottom).
|
| 415 |
+
|
| 416 |
+
In comparison, the sampling procedure for standard prompting only consists of two stages: (1) we randomly sample a permutation of given molecules, denoted as $\pi$ , (2) based on a prompt formed by the permutation, we directly sample a molecule via
|
| 417 |
+
|
| 418 |
+
$$
|
| 419 |
+
\widehat { \pmb { y } } \sim P _ { \mathrm { L L M } } ( \pmb { y } | ( \pmb { y } ^ { ( \pi [ i ] ) } ) _ { i = 1 } ^ { N } ) .
|
| 420 |
+
$$
|
| 421 |
+
|
| 422 |
+
The hyperparameters used for Step (2) is the same as in grammar prompting and shown in Table 8 (bottom).
|
| 423 |
+
|
| 424 |
+
While we observed that Earley-based constrained generation enhances grammar prompting in terms of improving validity, other metrics, such as the retrosynthesis score, decreased significantly. This discrepancy could be attributed to the fact that existing LLMs, due to their limited exposure to molecules represented in SMILES format, struggle with comprehending and applying the BNF grammar rules of SMILES. Overall, our current findings serve as preliminary evidence that grammar prompting can tap into the capacity of LLMs to understand and apply BNF rules. However such capacity still remains limited in text-focused LLMs.
|
| 425 |
+
|
| 426 |
+
# A.3 PDDL Planning
|
| 427 |
+
|
| 428 |
+
Restricted Action Space The specialized grammar defined for PDDL planning essentially delineates a constrained action space that includes necessary actions and their associated objects. Our empirical results found that limiting the classical GBFS planner to the objects selected by a specialized grammar proved too restrictive, yielding beneficial results only within the Blocks domain. Therefore, we decided to remove this limitation, thus expanding the action space of GBFS to contain the actions predicted from the grammar with an unrestricted range of objects.
|
| 429 |
+
|
| 430 |
+
# B Prompts
|
| 431 |
+
|
| 432 |
+
Figures 7, 8, and 9 demonstrate the prompts with grammars, based on actual examples in the SMCalFlow, GeoQuery, and Overnight datasets respectively. Because the general grammar of SMCalFlow is long (around 4k tokens), we do not include it within the prompt. For GeoQuery and Overnight, the general grammar is integrated as part of the instruction within the prompt. In the context of molecule generation, the general grammar for SMILES12 is also included. Figures 10 and 11 demonstrate the prompts with action DSLs for PDDL planning.
|
| 433 |
+
|
| 434 |
+

|
| 435 |
+
|
| 436 |
+

|
| 437 |
+
Figure 7: Prompt with real examples from the SMCalFlow dataset.
|
| 438 |
+
|
| 439 |
+
<table><tr><td colspan="2">LLM Prompt You are an expert programmer,and you need to write a program for the given natural language query.</td></tr><tr><td colspan="2">First, you should write grammar rules by choosing from the following BNF rules.Then,you should write programs that conform to your predicted rules. [BEGIN RULES]</td></tr><tr><td colspan="2">query "answer("answer_type ")" answer_type city丨state丨num丨place丨river丨country city "city(" city ")" "cityid(‘" CITYNAME "',‘" STATEABBREV "')" "cityid("" CITYNAME "’_)" "capital("city ")" "major(" city ")" "capital_1(" state ")" "loc_2(" state ")" "loc_2(" country ")" "largest(" city ")" "smallest(" city ")" "intersection("city","city ")" "exclude(" city "," city ")" "largest_one(population_1("city "))" "largest_one(density_1("city "))" "smallest_one(population_1("city "))" "smallest_one(density_1("city "))" ALL_CITY</td></tr><tr><td colspan="2">query:what states border hawaii ? BNF grammar rules: query "answer(" answer_type ")" answer_type state state "state(" state ")" "next_to_2("state")"</td></tr></table>
|
| 440 |
+
|
| 441 |
+

|
| 442 |
+
Figure 8: Prompt with real examples from the GeoQuery dataset.
|
| 443 |
+
|
| 444 |
+

|
| 445 |
+
|
| 446 |
+

|
| 447 |
+
Figure 9: Prompt with real examples from the Overnight dataset. Some long rules are omitted to fit the space.
|
| 448 |
+
|
| 449 |
+
# LLM Prompt
|
| 450 |
+
|
| 451 |
+
# Q:
|
| 452 |
+
|
| 453 |
+
(:objects a b c d e - block)
|
| 454 |
+
(:init (clear d) (clear c) (ontable d) (ontable a) (on c e) (on e b) (on b a) (handempty))
|
| 455 |
+
(:goal (on a e) (on e b) (on b d) (on d c))
|
| 456 |
+
|
| 457 |
+
DSL:
|
| 458 |
+
|
| 459 |
+
plan action+
|
| 460 |
+
action "(unstack" object object ")" "(put-down" object ")" "(pick-up-and-stack" object object ")" "(unstack-and-stack" object object object ")"
|
| 461 |
+
object ::= "c" | "e" | "d" | "b" | "a"
|
| 462 |
+
|
| 463 |
+
(unstack c e) (put-down c) (pick-up-and-stack d c) (unstack e b) (put-down e) (unstack-and-stack b a d) (pick-upand-stack e b) (pick-up-and-stack a e)
|
| 464 |
+
|
| 465 |
+
# Q:
|
| 466 |
+
|
| 467 |
+
(:objects a b c d - block)
|
| 468 |
+
(:init (clear a) (clear c) (clear d) (ontable a) (ontable b) (ontable d) (on c b) (handempty))
|
| 469 |
+
(:goal (on a b) (on b c) (on c d))
|
| 470 |
+
|
| 471 |
+
DSL:
|
| 472 |
+
|
| 473 |
+
plan action+
|
| 474 |
+
action "(unstack-and-stack" object object object ")" "(pick-up-and-stack" object object ")"
|
| 475 |
+
object ::= "c" | "b" | "d" | "a"
|
| 476 |
+
|
| 477 |
+
(unstack-and-stack c b d) (pick-up-and-stack b c) (pick-up-and-stack a b)
|
| 478 |
+
|
| 479 |
+

|
| 480 |
+
|
| 481 |
+
Q:
|
| 482 |
+
|
| 483 |
+
(:objects a b c d - block)
|
| 484 |
+
(:init (clear c) (clear a) (clear b) (clear d) (ontable c) (ontable a) (ontable b) (ontable d) (handempty))
|
| 485 |
+
(:goal (on d c) (on c b) (on b a))
|
| 486 |
+
|
| 487 |
+
<table><tr><td colspan="6">LLM Output</td></tr><tr><td></td><td>plan</td><td>:=</td><td colspan="3">action+</td></tr><tr><td rowspan="3"></td><td>action</td><td>:</td><td></td><td>"(pick-up-and-stack" object object ")"</td><td></td></tr><tr><td>object</td><td>:</td><td>"b"|"a" "c”</td><td>| "d"</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="6">A: (pick-up-and-stack b a) (pick-up-and-stack c b) (pick-up-and-stack d c)</td></tr></table>
|
| 488 |
+
|
| 489 |
+
Figure 10: Prompt with real examples in the Blocks domain from Pyperplan. The prompt template follows [69].
|
| 490 |
+
|
| 491 |
+
# LLM Prompt
|
| 492 |
+
|
| 493 |
+
Q:
|
| 494 |
+
(:objects crate0 crate1 crate2 crate3 crate4 crate5 depot0 distributor0 distributor1 hoist0 hoist1 hoist2 pallet0 pallet1 pallet2 pallet3 pallet4 pallet5 truck0 truck1 - object)
|
| 495 |
+
(:init (pallet pallet0) (surface pallet0) (at pallet0 depot0) (clear crate5) (pallet pallet1) (surface pallet1) (at pallet1 distributor0) (clear pallet1) (pallet pallet2) (surface pallet2) (at pallet2 distributor1) (clear crate3) (pallet pallet3) (surface pallet3) (at pallet3 distributor0) (clear pallet3) (pallet pallet4) (surface pallet4) (at pallet4 distributor0) (clear crate4) (pallet pallet5) (surface pallet5) (at pallet5 distributor1) (clear crate1) (truck truck0) (at truck0 distributor1) (truck truck1) (at truck1 depot0) (hoist hoist0) (at hoist0 depot0) (available hoist0) (hoist hoist1) (at hoist1 distributor0) (available hoist1) (hoist hoist2) (at hoist2 distributor1) (available hoist2) (crate crate0) (surface crate0) (at crate0 distributor0) (on crate0 pallet4) (crate crate1) (surface crate1) (at crate1 distributor1) (on crate1 pallet5) (crate crate2) (surface crate2) (at crate2 distributor1) (on crate2 pallet2) (crate crate3) (surface crate3) (at crate3 distributor1) (on crate3 crate2) (crate crate4) (surface crate4) (at crate4 distributor0) (on crate4 crate0) (crate crate5) (surface crate5) (at crate5 depot0) (on crate5 pallet0) (place depot0) (place distributor0) (place distributor1))
|
| 496 |
+
(:goal (on crate0 pallet3) (on crate1 crate4) (on crate3 pallet1) (on crate4 pallet5) (on crate5 crate1))
|
| 497 |
+
DSL:
|
| 498 |
+
|
| 499 |
+
plan action+
|
| 500 |
+
action "(lift-and-drive" object object object object object object ")" "(drive-and-load" object object object object ")" "(drive-and-lift" object object object object object ")" "(lift" object object object object ")" "(drive-and-unload" object object object object object ")" "(drop" object object object object ")"
|
| 501 |
+
object ::= "truck1" "hoist0" "crate5" | "pallet0" | "depot0" | "truck0" | "hoist2" "crate4" "crate0" "distributor1" | "hoist1" | "pallet4" | "distributor0" "crate1" "pallet5" "crate3" | "crate2" | "pallet1" | "pallet3"
|
| 502 |
+
|
| 503 |
+
# A:
|
| 504 |
+
|
| 505 |
+
(lift-and-drive truck1 hoist0 crate5 pallet0 depot0 depot0) (drive-and-load truck1 hoist0 crate5 depot0) (drive-andlift truck0 hoist2 crate4 crate0 distributor1) (lift hoist1 crate0 pallet4 distributor0) (drive-and-lift truck1 hoist0 crate1 pallet5 depot0) (drive-and-load truck1 hoist0 crate1 depot0) (drive-and-lift truck1 hoist0 crate3 crate2 depot0) (drive-and-load truck1 hoist0 crate3 depot0) (drive-and-unload truck1 hoist0 crate3 pallet1 depot0) (drop hoist2 crate4 pallet5 distributor1) (drive-and-unload truck1 hoist0 crate1 crate2 depot0) (drive-and-lift truck0 hoist2 crate1 crate2 distributor1) (drop hoist2 crate1 crate4 distributor1) (drive-and-unload truck1 hoist0 crate5 crate1 depot0) (drop hoist1 crate0 pallet3 distributor0)
|
| 506 |
+
|
| 507 |
+

|
| 508 |
+
|
| 509 |
+
# Q:
|
| 510 |
+
|
| 511 |
+
(:objects crate0 crate1 crate2 crate3 depot0 distributor0 distributor1 hoist0 hoist1 hoist2 pallet0 pallet1 pallet2 truck0 truck1 - object) (:init (pallet pallet0) (surface pallet0) (at pallet0 depot0) (clear crate0) (pallet pallet1) (surface pallet1) (at pallet1 distributor0) (clear crate3) (pallet pallet2) (surface pallet2) (at pallet2 distributor1) (clear crate2) (truck truck0) (at truck0 depot0) (truck truck1) (at truck1 depot0) (hoist hoist0) (at hoist0 depot0) (available hoist0) (hoist hoist1) (at hoist1 distributor0) (available hoist1) (hoist hoist2) (at hoist2 distributor1) (available hoist2) (crate crate0) (surface crate0) (at crate0 depot0) (on crate0 pallet0) (crate crate1) (surface crate1) (at crate1 distributor1) (on crate1 pallet2) (crate crate2) (surface crate2) (at crate2 distributor1) (on crate2 crate1) (crate crate3) (surface crate3) (at crate3 distributor0) (on crate3 pallet1) (place depot0) (place distributor0) (place distributor1)) (:goal (on crate0 pallet2) (on crate1 crate3) (on crate2 pallet0) (on crate3 pallet1)) DSL:
|
| 512 |
+
|
| 513 |
+
# LLM Output
|
| 514 |
+
|
| 515 |
+
plan :: action+
|
| 516 |
+
action · "(lift-and-drive" object object object object object object ")" "(lift" object object object object ")" "(drive" object object object ")" "(drive-and-lift" object object object object object ")" "(drop" object object object object ")" "(drive-and-load" object object object object ")" "(drive-and-unload" object object object object object ")"
|
| 517 |
+
object ::= "truck0" "hoist0" "crate0" | "pallet0" | "depot0" | "hoist2" "crate2" "crate1" "distributor1" | "distributor0" | "hoist1" "pallet2" | "crate3" | "truck1" A:
|
| 518 |
+
(lift-and-drive truck0 hoist0 crate0 pallet0 depot0 depot0) (lift hoist2 crate2 crate1 distributor1) (drive truck0 depot0 distributor0) (drive-and-lift truck0 hoist1 crate1 pallet2 distributor0) (drop hoist1 crate1 crate3 distributor0) (drive-and-load truck1 hoist0 crate0 depot0) (drive-and-unload truck1 hoist0 crate0 pallet2 depot0) (drive truck1 depot0 distributor1) (drive-and-load truck1 hoist2 crate2 distributor1) (drive-and-unload truck1 hoist2 crate2 pallet0 distributor1)
|
| 519 |
+
|
| 520 |
+
Figure 11: Prompt with real examples in the Depot domain from Pyperplan. The prompt template follows [69].
|
md/dev/BryMFPQ4L6/BryMFPQ4L6.md
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Augmenting Language Models with Long-Term Memory
|
| 2 |
+
|
| 3 |
+
Weizhi Wang†, Li Dong‡, Hao Cheng‡, Xiaodong Liu‡, Xifeng $\mathbf { Y a n } ^ { \dagger }$ , Jianfeng Gao‡, Furu Wei‡ †University of California, Santa Barbara ‡Microsoft Research weizhiwang@ucsb.edu, {lidong1, chehao, xiaodl}@microsoft.com
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Existing large language models (LLMs) can only afford fix-sized inputs due to the input length limit, preventing them from utilizing rich long-context information from past inputs. To address this, we propose a framework, Language Models Augmented with Long-Term Memory (LONGMEM), which enables LLMs to memorize long history. We design a novel decoupled network architecture with the original backbone LLM frozen as a memory encoder and an adaptive residual side-network as a memory retriever and reader. Such a decoupled memory design can easily cache and update long-term past contexts for memory retrieval without suffering from memory staleness. Enhanced with memory-augmented adaptation training, LONGMEM can thus memorize long past context and use long-term memory for language modeling. The proposed memory retrieval module can handle unlimited-length context in its memory bank to benefit various downstream tasks. Typically, LONGMEM can enlarge the long-form memory to $6 5 \mathrm { k }$ tokens and thus cache many-shot extra demonstration examples as long-form memory for in-context learning. Experiments show that our method outperforms strong longcontext models on ChapterBreak, a challenging long-context modeling benchmark, and achieves remarkable improvements on memory-augmented in-context learning over LLMs. The results demonstrate that the proposed method is effective in helping language models to memorize and utilize long-form contents. Our code is open-sourced at https://aka.ms/LongMem.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Large language models (LLMs) have revolutionized natural language processing with great successes in advancing the state-of-the-art on various understanding and generation tasks [DCLT19, $\mathrm { R W C ^ { + } } 1 9$ , $\mathrm { L O G ^ { + } } 1 9$ , $\bar { \mathrm { Y } } \mathrm { { D Y } ^ { + } 1 9 }$ , $\mathrm { B M R } ^ { + } 2 0$ , $\mathrm { R S R } ^ { + } 2 0 ]$ . Most LLMs benefit from self-supervised training over large corpora via harvesting knowledge from fix-sized local context, showing emergent abilities, e.g., zero-shot prompting $[ \mathrm { R W C ^ { + } } 1 9 ]$ , in-context learning $[ \mathrm { B M R } ^ { + } 2 0 ]$ , and Chain-of-Thought (CoT) reasoning $[ \mathrm { W } \bar { \mathrm { W } } \mathrm { S } ^ { + } \bar { 2 } 2 ]$ . Nevertheless, the input length limit of existing LLMs prevents them from generalizing to real-world scenarios where the capability of processing long-form information beyond a fix-sized session is critical, e.g., long horizontal planning.
|
| 12 |
+
|
| 13 |
+
To address the length limit issue, the most straightforward method is to simply scale up the input context length. For instance, GPT-3 $[ \mathrm { B M R } ^ { + } 2 0 ]$ increases the input length from 1k tokens in GPT-2 $[ \mathrm { R W C ^ { + } } 1 9 ]$ to $2 \mathrm { k }$ tokens, thereby allowing for better capture of long-range dependencies. However, this approach typically incurs computation-intensive training from scratch and the in-context dense attention is still heavily constrained by the quadratic computation complexity of Transformer self-attention $[ \mathrm { V S P ^ { + } 1 7 } ]$ . Another recent line of work [BPC20, $\mathrm { Z G D ^ { + } } 2 0 ]$ instead focuses on developing in-context sparse attention to avoid the quadratic cost of self-attention, which still largely requires training from scratch. In contrast, the prominent work, Memorizing Transformer (MemTRM) [WRHS22], approximates in-context sparse attention via dense attention over both incontext tokens and memorized tokens retrieved from a non-differentiable memory for Transformers. Thus, MemTRM scales up the resulting language model to handle up to 65k tokens and achieves substantial perplexity gains in modeling full-length books or long papers. However, MemTRM faces the memory staleness challenge during training due to its coupled memory design, which uses a single model for encoding memory and fusing memory for language modeling. In other words, as the model parameters are updated, cached older representations in memory may have distributional shifts from those from the latest model, thereby limiting the effectiveness of the memory augmentation.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Overview of the memory caching and retrieval flow of LONGMEM. The long text sequence is divided into fix-length segments with each previous segment processed through a frozen backbone LLM and the corresponding attention key and value vectors of $m$ -th layer are cached into the memory bank. Given current inputs, the corresponding attention query vectors are used to retrieve the top- $K$ attention key-value pairs from previous segments stored in the memory bank, which will be then fused with local context for language modeling.
|
| 17 |
+
|
| 18 |
+
In this paper, we present a framework for Language Models Augmented with Long-Term Memory (LONGMEM). This framework enables language models to cache lengthy previous context or knowledge into a non-differentiable memory bank, and then utilize them via a decoupled memory module to mitigate the issue of memory staleness. To achieve decoupled memory, we design a novel residual side-network (SideNet) in conjunction with a frozen backbone LLM. Paired attention keys and values of the previous context are extracted using the frozen backbone LLM, which are subsequently stored in the memory bank. In the memory-augmented layer of SideNet, the generated attention query of the current input is used to retrieve cached key-value pairs of previous contexts from the memory, and the corresponding memory augmentations are then fused into adaptable hidden states via a joint-attention mechanism. Furthermore, newly designed cross-network residual connections between the SideNet and the frozen backbone LLM facilitate better knowledge transfer from the pretrained backbone LLM. Through continuous training of the residual SideNet to retrieve and fuse memory augmentations, the pre-trained LLM can be adapted to effectively leverage longcontextual memory for enhanced modeling. The detailed memory cache, retrieval and fusion process is illustrated in Figure 1.
|
| 19 |
+
|
| 20 |
+
Our decoupled memory design offers two key advantages. First, our proposed architecture effectively separates the process of encoding previous inputs into memory and the process of memory retrieval and fusion, thanks to the decoupled frozen backbone LLM and SideNet. In this way, the backbone LLM only works as the long-context knowledge encoder, while the residual SideNet works as the memory retriever and reader, which effectively resolves the issue of memory staleness. Second, directly adapting the entire LLM with memory augmentations is computationally inefficient and also prone to catastrophic forgetting. As the backbone LLM is frozen during the efficient memoryaugmented adaptation stage, LONGMEM can not only tap into the pretrained knowledge but also avoid catastrophic forgetting.
|
| 21 |
+
|
| 22 |
+
LONGMEM is capable of taking various types of long-form text and knowledge into the memory bank based on downstream tasks. Here, we consider two representative cases, language modeling with full-length book contexts, and memory-augmented in-context learning with thousands of task-relevant demonstration examples. Specifically, we evaluate the effectiveness of the proposed LONGMEM on various long-text language modeling, and memory-augmented in-context learning for natural language understanding (NLU) tasks. Experimental results demonstrate that our model consistently outperforms the strong baselines in terms of long-text modeling and in-context learning abilities. Our method substantially improves LLM’s long-context language modeling capabilities, with a reduction in perplexity of $1 . 3 8 { \sim } 1 . 6 2$ over different length splits of Gutenberg-2022 corpus. Notably, our model achieves state-of-the-art performance of $4 0 . 5 \%$ identification accuracy on ChapterBreak, a challenging long-context modeling benchmark, significantly surpassing existing strong $\mathbf { X }$ -former baselines. Finally, with 2k demonstration examples in memory, LONGMEM shows pronounced improvements in in-context learning on popular NLU tasks, compared with prominent memoryaugmented and non-memory-augmented baselines.
|
| 23 |
+
|
| 24 |
+

|
| 25 |
+
Figure 2: Overview of LONGMEM architecture. “MemAug” represents Memory-Augmented Layer.
|
| 26 |
+
|
| 27 |
+
# 2 Methods
|
| 28 |
+
|
| 29 |
+
To enable LLMs to harvest relevant information from the past long context in memory, we propose to augment the frozen backbone LLM with a decoupled memory module. To fuse the memory context information, we design a novel lightweight residual SideNet, which can be continually trained in an efficient way. In the following, we first discuss the problem formulation of language modeling with memory augmentations. Then, we formally introduce our efficient residual SideNet for adapting the frozen pretrained LLM to jointly attend over local input context and retrieved memory context. Lastly, we provide our designed processes of how past memory is encoded, stored, recalled and fused for language modeling.
|
| 30 |
+
|
| 31 |
+
# 2.1 Language Models Augmented with Long-Term Memory
|
| 32 |
+
|
| 33 |
+
Here, we focus on the high-level problem setup and defer more component details to later sections. Given its wide adoption for pretrained LLMs, our LONGMEM model is built on the Transformer architecture $[ \mathrm { V S P ^ { + } \bar { 1 } 7 } ]$ . For LONGMEM, there are three key components: the frozen backbone LLM, SideNet, and Cache Memory Bank. As most existing pretrained LLMs can only take a fix-sized input, only the input segment of a long sequence (e.g., a book) that can fit in the length limit is denoted as the current input as done for most existing autoregressive language models. Those previous segments that can not fit are denoted as previous inputs, which are used for memory augmentations. To tap into the learned knowledge of the pretrained LLM, both previous and current inputs are encoded using the frozen backbone LLM but different representations are extracted. For previous inputs, the key-value pairs from the Transformer self-attention at $m$ -th layer are stored in Cache Memory Bank, whereas the hidden states from each LLM decoder layer for the current inputs are retained and transferred to SideNet. For each current input token, top relevant key-value vector pairs are retrieved as memory augmentations for language modeling. The SideNet module can be viewed as an efficient adaption model that is trained to fuse the current input context and relevant cached previous contexts in the decoupled memory.
|
| 34 |
+
|
| 35 |
+
Formally, for a fix-sized input text sequence $\{ { \bf x } _ { i } \} _ { i = 1 } ^ { | x | }$ (the current input), LONGMEM first performs a forward pass using the backbone LLM (indicated in blue in Figure 2) without any gradient calculation. The embedding layer of the backbone LLM first encodes the input $\{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { | x | }$ into embedding space and outputs the initial hidden states, $\mathbf { H } _ { \mathrm { L L M } } ^ { 0 } \in \mathbb { R } ^ { | x | \times E }$ , where $E$ is the hidden dimension. Then each successive Transformer decoder layer of the frozen backbone LLM computes the new hidden states using the hidden states from the previous layer, Hl′LLM = fθl′LLM ( $\mathbf { H } _ { \mathrm { L L M } } ^ { l ^ { \prime } } = f _ { \theta _ { \mathrm { L L M } } ^ { l ^ { \prime } } } ( \mathbf { H } _ { \mathrm { L L M } } ^ { l ^ { \prime } - 1 } ) , \forall l ^ { \prime } \in$ $[ 1 , L ^ { \prime } ]$ and $L ^ { \prime }$ is the total # layers for the backbone LLM. During the forward pass with the backbone LLM for all previous inputs, the key-value pairs used for self-attention at the $m$ -th Transformer decoder layer are stored in Cached Memory Bank (highlighted in orange in upper-left of Figure 2). These pairs are subsequently recalled as memory augmentations for future inputs.
|
| 36 |
+
|
| 37 |
+
Cached Memory Bank is a head-wise vector queue $\mathcal { Z } _ { k } , \mathcal { Z } _ { v } \in \mathbb { R } ^ { H \times M \times d }$ , which maintains attention key-value pairs of latest $M$ previous inputs $\widetilde { \mathbf { K } } , \widetilde { \mathbf { V } } \in \mathbb { R } ^ { H \times | x | \times d }$ , where $H , d$ denotes the number of attention heads and per-head dimension respectively. After memory retrieval and fusion (§2.3), the memory bank removes the key-value pairs of the oldest sequences and appends the current sequences to the cached vector bank. This update mechanism ensures the language modeling causality at the sequences level and enables the memory bank to consistently maintain records of the most recent previous context for the current inputs.
|
| 38 |
+
|
| 39 |
+
After the forward pass with the backbone LLM, the SideNet module then takes all current input hidden states from the backbone LLM {Hl′LLM}L′l′=1 and the past key-value pairs in the Cached Memory Bank for computing memory-augmented representations. Specifically, our SideNet of LONGMEM consists of $( L - 1 )$ normal Transformer decoder layers and one special memory-augmented decoder layer. For efficient purposes, we mainly consider the case where #layers $L$ of the SideNet is smaller than that of the backbone LLM, i.e., $L < L ^ { \prime }$ . Our SideNet encodes $\mathbf { H } ^ { 0 }$ into memory-augmented contextual representation via $( L - 1 )$ normal Transformer decoder layers and a special memory-augmented layer.
|
| 40 |
+
|
| 41 |
+
The memory-augmented layer is an extension of the vanilla Transformer decoder layer that takes a memory-augmented input, including both top relevant key-value pairs in memory and the hidden states from the current input. Here, the cached key-value pairs are recalled using a token-based memory retrieval module $( \ S 2 . 3 )$ . For each current input token, the memory retrieval module $s _ { r t } ( : )$ retrieves top- $K$ relevant key-value pairs in the memory bank $\{ \widetilde { \pmb { k } } _ { i j } , \widetilde { \pmb { v } } _ { i j } \} _ { j = 1 } ^ { K } = s _ { r t } ( \mathbf { x } _ { i } ) .$ . Then SideNet computes the output using the memory-augmented input, $\mathbf { H } _ { \mathrm { S i d e } } ^ { m _ { s } } = f _ { \theta _ { \mathrm { M e m } } } ( \mathbf { H } _ { \mathrm { S i d e } } ^ { m _ { s } - 1 } , \{ \{ \widetilde { \mathbf { k } } _ { i j } , \widetilde { \mathbf { v } } _ { i j } \} _ { j = 1 } ^ { K } \} _ { i = 1 } ^ { | x | } )$ , where is the layer index where we inject the memory-augmentation layer.
|
| 42 |
+
|
| 43 |
+
Finally, the token probability is computed using the last SideNet hidden states $P ( \mathbf { x } _ { i } | \mathbf { x } _ { 1 } , \cdot \cdot \cdot , \mathbf { x } _ { i - 1 } ) =$ softmax $( W \mathbf { H } ^ { L } )$ , where $W$ is the frozen output embedding weight shared by both the backbone LLM and SideNet. We perform a memory-augmented adaptation training for LONGMEM to utilize the decoupled memory. Following the generative unsupervised pre-training [RNSS18], the training objective of LONGMEM is the standard left-to-right language modeling objective, which maximizes the likelihood of the next token based on the left context: max $\begin{array} { r } { \sum _ { x \in \mathcal { D } } \sum _ { i = 1 } ^ { | \mathbf { x } | } \log P ( \mathbf { x } _ { i } | \mathbf { x } _ { 1 } , \cdots , \mathbf { x } _ { i - 1 } ) } \end{array}$ , where $x$ is a randomly sampled sentence from the pre-training text corpus $\mathcal { D }$ .
|
| 44 |
+
|
| 45 |
+
# 2.2 Residual SideNet
|
| 46 |
+
|
| 47 |
+
SideNet Architecture and Initialization. Here, we implement SideNet based on Transformer $[ \mathrm { V S P ^ { + } 1 7 } ]$ . Specifically, the number of decoder layers $L$ in SideNet is equal to the number of layers $L ^ { \prime }$ in the backbone LLM divided by a reduction factor (a layer reduction factor of 2 is used throughout this work, i.e., $L ^ { \prime } = 2 L$ ). The weights of each decoder layer in SideNet are initialized from the corresponding pre-trained decoder layer of the backbone LLM at the same depth: $\Theta _ { \mathrm { S i d e } } ^ { l } = \Theta _ { \mathrm { L L M } } ^ { 2 l }$ . As illustrated in Figure 2, the SideNet model takes the output of backbone LLM’ser and reuses the language modeling head of the backbone LLM, which remains frozen during the continual adaption stage. Throughout the memory-augmented adaptation stage, all other parameters of SideNet are updated based on the training signal. In this way, the lightweight SideNet adaptation achieves fast convergence with knowledge transferred from pre-trained parameters.
|
| 48 |
+
|
| 49 |
+
Cross-Network Residual Connections. To tap into knowledge from the pretrained backbone LLM, we utilize our proposed cross-network residual connections to fuse representations from the backbone
|
| 50 |
+
|
| 51 |
+
LLM into SideNet. Specifically, we add the difference between output hidden states at $2 l$ -th and $( 2 l - 2 )$ -th layers of the backbone LLM as the residual connections to the output hidden states at $l$ -th layer of SideNet. Then, the input to the next $( l + 1 )$ -th layer of SideNet is the sum of the original hidden state forwarded through the previous layer $f _ { \Theta _ { \mathrm { S i d e } } ^ { l } } ( \mathbf { H } _ { \mathrm { S i d e } } ^ { l - 1 } )$ and the cross-network residual connection of the hidden state difference from the backbone LLM
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
\mathbf { H } _ { \mathrm { S i d e } } ^ { l } = f _ { \ominus _ { \mathrm { S i d e } } ^ { l } } ( \mathbf { H } _ { \mathrm { S i d e } } ^ { l - 1 } ) + ( \mathbf { H } _ { \mathrm { L L M } } ^ { 2 l } - \mathbf { H } _ { \mathrm { L L M } } ^ { 2 l - 2 } ) , \forall l \in [ 1 , L ] ,
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
where $\mathbf { H } ^ { 0 }$ is the output of embedding layer. It is worth noting that the residual connections after the self-attention and feed-forward network of a decoder layer $[ \mathrm { V S P ^ { + } 1 7 } ]$ will be performed as normal in $f _ { \Theta _ { \mathrm { S i d e } } ^ { l } } ( \mathbf { H } _ { \mathrm { S i d e } } ^ { l - 1 } )$ and parallel to the proposed cross-network residual connections.
|
| 58 |
+
|
| 59 |
+
# 2.3 Memory Retrieval and Fusion
|
| 60 |
+
|
| 61 |
+
The long-term memory capability of LONGMEM is achieved via a memory-augmentation module for retrieval and fusion.
|
| 62 |
+
|
| 63 |
+
Token-to-Chunk Memory Retrieval. Instead of performing token-to-token retrieval, we focus on token-to-chunk retrieval for acceleration and integrity. A text-chunk refers to an n-gram structure of chunk-size $c s z$ number of contiguous tokens. The memory bank stores cached key-value pairs at the level of token chunks. We divide the memory bank into $M / c s z$ attention key-value paired chunks and use the mean-pooled vector on the chunk-size dimension to get the key vector for retrieval. Then we retrieve the top- $\left( K / c s z \right)$ attention key-value chunks w.r.t the dot product between the attention query of the current input token and the mean-pooled attention key of a candidate chunk. Finally, we squeeze the chunk-size dimension for retrieved key-value paired chunks and flatten them into $K$ key-value pairs at token-level the retrieval index and acceler $\{ \widetilde { \mathbf { K } } _ { j } , \widetilde { \mathbf { V } } _ { j } \} _ { j = 1 } ^ { K }$ . Adopting token-to-chunk retrieval reduces the sizess. Meanwhile, the retrieval accuracy can be further improved, which is also observed in $[ \mathrm { L G W } ^ { + } 2 3 ]$ and $[ \mathrm { B M H ^ { + } } 2 1 ]$ . The hyperparameter chunk-size $c s z$ controls the granularity of retrieved contexts, which can be empirically adjusted based on downstream tasks. For instance, in-context learning requires more fine-grained label tokens from demonstration examples cached in memory, where a smaller $c s z$ is helpful.
|
| 64 |
+
|
| 65 |
+
Memory Fusion. The memory fusion is performed within a special memory-augmented layer. As the conventional Transformer decoder layer uses the multi-head self-attention $[ \bar { \mathrm { V } } \mathrm { S P ^ { + } 1 7 } ]$ , we follow [WRHS22] to extend it to a joint-attention mechanism and propose a long-term memory fusion process to enable each token to attend on both local contexts and retrieved memory contexts. With the head-wise hidden state output from previous layer $\mathbf { H } ^ { l - 1 } \in \mathbb { R } ^ { | x | \times d }$ and the corresponding retrieved attention key-value pairs are $\{ \widetilde { \mathbf { K } } _ { i } , \widetilde { \mathbf { V } } _ { i } \} _ { i = 1 } ^ { | x | } \in \mathbb { R } ^ { | x | \times \mathrm { K } \times \mathrm { d } }$ , the output hidden state for the $l$ -th memory-augmented layer $\mathbf { H } ^ { l }$ is computed as:
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\begin{array} { r l } & { \mathbf { A } = \mathrm { s o f t m a x } ( \frac { \mathbf { Q } \mathbf { K } ^ { T } } { \sqrt { d } } ) \mathbf { V } , \mathbf { M } = \mathrm { C o n c a t } \{ \mathrm { s o f t m a x } ( \frac { \mathbf { Q } _ { i } \widetilde { \mathbf { K } } _ { i } ^ { T } } { \sqrt { d } } ) \widetilde { \mathbf { V } } _ { i } \} _ { i = 1 } ^ { | x | } , } \\ & { \mathbf { H } ^ { l } = \mathrm { s i g m o i d } ( g ) \cdot \mathbf { A } + ( 1 - \mathrm { s i g m o i d } ( g ) ) \cdot \mathbf { M } , } \end{array}
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
where $\mathbf { Q } , \mathbf { K } , \mathbf { V } , \mathbf { A } , \mathbf { M } \in \mathbb { R } ^ { | x | \times \mathrm { d } }$ , $\mathrm { K }$ is the number of retrieved attention key-value pairs in cached memory for each token, and $g$ is a trainable head-wise gating vector. The hidden state output from previous layer $\mathbf { H } ^ { ( l - 1 ) }$ is linearly projected into attention queries, keys, and values $\mathbf { Q } , \mathbf { K } , \mathbf { V }$ separately via three matrices $W ^ { Q } , W ^ { K } , \bar { W } ^ { V } \in \mathbb { R } ^ { \mathrm { d } \times \mathrm { d } }$ . It is worth noting that the retrieved attention key-value pairs in cached memory are distinct to each token.
|
| 72 |
+
|
| 73 |
+
# 3 Experiments
|
| 74 |
+
|
| 75 |
+
We evaluate our proposed LONGMEM model on different tasks that require long-context modeling: a) long-text language modeling and language understanding when loading the past long-context into cached memory; b) infinite-length in-context learning when loading a large number of demonstration examples into cached memory.
|
| 76 |
+
|
| 77 |
+

|
| 78 |
+
Figure 3: Batchfying the large text corpora into batches to ensure that each consecutive segments within each document is distributed in consecutive batches.
|
| 79 |
+
|
| 80 |
+
# 3.1 Training Setup
|
| 81 |
+
|
| 82 |
+
Batchfying the training corpora. The conventional batchyfing process for large corpora truncates the whole corpora into consecutive fix-length text segments without padding and shuffles all segments to construct mini-batches $[ \mathrm { R W C ^ { + } } 1 9 ]$ . In contrast, LONGMEM must disable global shuffling and ensure the global causality at the segment level. Firstly, we divide all long documents in training corpora into batch-size number of document groups with equivalent length and then perform a document-level shuffling within each group. Then, we concatenate shuffled documents within one group and truncate them into ordered segments. In order to ensure that two consecutive segments of one long document are distributed in two consecutive input batches after batchfying, we select one segment from batch-size number of document groups with the same inner-group index. Thus a mini-batch with batch-size number of segments are constructed from exactly the batch-size number of document groups. In this way, as the training iteration steps, the cached attention key-value pairs in the memory bank are previous context of current inputs within the same document. The batchfying process is illustrated in Figure 3.
|
| 83 |
+
|
| 84 |
+
Training Corpus, Backbone LLM and Hyperparameter. We sample a subset of the Pile $[ \mathrm { G B B ^ { + } } 2 0 ]$ as the training corpus, including BookCorpus2, Books3, OpenWebText2, Stack Exchange, Wikipedia, Gutenberg (PG-19), NIH ExPorter, and Pile-CC datasets. We reproduce GPT- $^ { . 2 ^ { * } }$ (407M-params) as the pre-trained backbone LLM with Alibi [PSL21] position embedding because original GPT$2 \left[ \mathrm { R W } \bar { \mathrm { C } } ^ { + } 1 9 \right]$ adopts absolute position embedding, which is found to perform poorly to enable LLM to learn long-distance dependencies $\mathrm { [ D Y Y ^ { + } 1 9 ] }$ . The backbone LLM holds a $L ^ { \prime } = 2 4 , H = 1 6 , d = 6 4$ architecture. The SideNet holds a $L = 1 2 , H = 1 6 , d = 6 4$ architecture. The training for memoryaugmented adaptation iterates on 26B tokens, with a global 256 batch-size and 1024 sequence length. The chunk-size $c s z$ is 4 tokens and the memory size $M$ is $6 5 \mathrm { k }$ key-value pairs of tokens. For each token, we retrieve $K { = } 6 4$ attention key-value pairs for augmentation, which are $K / c s z { = } 1 6$ text chunks. The memory-augmentation layer is the 9-th layer of SideNet. The attention keys and values from 18-th layer of backbone LLM is cached into memory and used for future retrieval. Other training details are presented in Appendix C.
|
| 85 |
+
|
| 86 |
+
Memory Retrieval Module. The fixed memory-size of cached memory bank in one GPU is 65536 key-value pairs of tokens. We enable each GPU to construct and update their own memory retrieval module for efficiency. For the implementation of the efficient token-to-chunk retrieval, we use the faiss [JDJ21] toolkit to construct an exact-search index on GPU to store the mean-pooled attention keys of text chunks and perform efficient retrieval. The faiss index maintains a fixed $M / c s z$ keys and provides the efficient exact search w.r.t. inner product. The retrieval takes about 15ms per 1k tokens, which is $55 \%$ timecost of backbone LLM forwarding pass. We can easily adapt the exact search index to approximate search index to gain more retrieval efficiency.
|
| 87 |
+
|
| 88 |
+
Baselines. In addition to the baseline of our pre-trained GPT- $^ { 2 ^ { * } }$ variant, we consider Memorizing Transformer (MemTRM) [WRHS22] and TRIME [ZLC22] as two memory-augmented baselines. The MemTRM model can be easily adapted to tune a pre-trained LLM to use external memory. We insert the KNN-augmented layer proposed by MemTRM as the same 18-th layer in the LLM decoder.
|
| 89 |
+
|
| 90 |
+
<table><tr><td>Dataset Splits</td><td>S2</td><td></td><td>PG-22 S3</td><td>S4</td><td>S5</td><td>ArXiv</td></tr><tr><td>Len. Range</td><td>5K-10K</td><td>10K-100K</td><td>100K-500K</td><td>500K-1M</td><td>>1M</td><td><60K</td></tr><tr><td>#Documents</td><td>500</td><td>100</td><td>30</td><td>8</td><td>1</td><td>100</td></tr><tr><td>Avg. #tokens</td><td>7.6K</td><td>47.6K</td><td>140K</td><td>640K</td><td>1.2M</td><td>15.4K</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 91 |
+
|
| 92 |
+
Table 1: Dataset Statistics of five splits of PG-22 based on length range and ArXiv.
|
| 93 |
+
|
| 94 |
+
To adapt TRIME for our experiments, we replace the batchfying function and loss function of training GPT- $^ { 2 ^ { * } }$ with those proposed by TRIME, which enables a memory-augmented adaptation tuning method for LLMs. The two reproduced baselines are trained for the same number of tokens under the same hyperparameter setting as LONGMEM.
|
| 95 |
+
|
| 96 |
+
# 3.2 Long-Context Language Modeling
|
| 97 |
+
|
| 98 |
+
The long-context language modeling can potentially benefit from the augmented memory of past longcontexts. The knowledge stored in retrieved attention key-values can provide valuable background and contextual information, helping models perform better in long-context language modeling. For instance, when trying to model a long-text book, acquiring knowledge from previous background and character relationships can be helpful in modeling the subsequent stories.
|
| 99 |
+
|
| 100 |
+
Evaluation Setting. We first compare LONGMEM and baselines on three long-context modeling datasets, Project Gutenberg 2020-2022, ArXiv, and ChapterBreak. The majority of included books or papers in these datasets have the length of at least 16k tokens. All listed datasets are evaluated in a zero-shot manner without any task-specific tuning. The detailed evaluation settings on the three datasets are as follows:
|
| 101 |
+
|
| 102 |
+
• Project Gutenberg 2020-2022 Language Modeling Dataset. We crawled and cleaned the books published between 2020 and 2022 under Project Gutenberg Library1 to build up a completely new long-text modeling dataset, named PG-22. It is significantly different from our training subset PG-19 in terms of domains and writing styles, because books in PG-19 [RPJL19] are published before 1919. We provide different validation splits of PG-22 based on length range, and the data statistics are presented in Table 1.
|
| 103 |
+
|
| 104 |
+
• ArXiv Dataset. The ArXiv dataset includes papers in the areas of Math, Computer Science, and Physics. We select a validation split of ArXiv paper subset in the Pile corpus $[ \mathrm { G B B ^ { + } } 2 0 ]$ . The ArXiv subset of Pile is excluded from our training and serves an out-of-distribution dataset. We report the token-level language modeling perplexity on the long-context language modeling benchmarks of PG-22 and ArXiv.
|
| 105 |
+
|
| 106 |
+
• ChapterBreak Benchmark. ChapterBreak [STI22] is a challenging suffix identification dataset that requires LLMs to distinguish the beginning of the ground-truth next chapter from a set of hard negative segments sampled from the same book, given the long context of previous chapters. ChapterBreak requires processing global long-context to comprehend and identify the correct suffix. [STI22] demonstrated that even state-of-the-art $\mathbf { X }$ -formers for long-text processing fail to effectively leverage long-range context to perform well on ChapterBreak. ChapterBreak has two subsets, the PG-19 subset and the Archive of Our Own (AO3) subset. As the PG-19 corpus has been included in the pre-training corpus of LONGMEM, it cannot be further used for evaluation. Thus, we select AO3 subset, which contains fan-fictions extracted from AO3. ChapterBreak provides 8 splits based on the prefix length from $0 . 5 \mathrm { k }$ to $^ \mathrm { 8 k }$ tokens to fit the length limit of different models. The splits of 4k, 6k, and $^ \mathrm { 8 k }$ prefix are selected for evaluation. For LLMs that cannot process over 4k tokens, we abandon the front prefix to fulfill the maximum input length of LLMs. For memory-augmented models (MemTRM and LONGMEM), we load the given $4 \mathrm { k } / 6 \mathrm { k } / 8 \mathrm { k }$ prefix contexts into the cached memory and then do the scoring. we use the perplexity as the scorer for each candidate suffix segment in a zero-shot manner. Then the suffix segment with lower perplexity is selected as the label. The suffix identification accuracy is used as the evaluation metric.
|
| 107 |
+
|
| 108 |
+
Results. The main results on evaluated long-context datasets are summarized in Table 2. The proposed LONGMEM model significantly outperforms all considered baselines on long-text language modeling datasets, with improvements of 1.38 to 1.62 perplexity on different length splits of $P G \mathrm { - } 2 2$ , and 1.0 on ARXIV datasets. Surprisingly, the proposed method achieves the state-of-the-art performance of $40 . 5 \%$ accuracy on ChapterBreakAO3 suffix identification benchmark and outperforms both the strong long-context transformers and GPT-3 with $3 1 3 \mathrm { x }$ larger parameters. The substantial improvements on these datasets demonstrate that LONGMEM can comprehend past long-context in cached memory well for predicting future inputs.
|
| 109 |
+
|
| 110 |
+
Table 2: Evaluation results on long-context language modeling datasets. We report token-level perplexity (PPL) (lower the better) on all datasets.
|
| 111 |
+
|
| 112 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">In-Context Len.</td><td rowspan="2">In-Memory Len.</td><td colspan="5">PG-22</td><td rowspan="2">ArXiv</td></tr><tr><td>5K-10K</td><td>10K-100K</td><td>100K-500K</td><td>500K-1M</td><td>>1M</td></tr><tr><td>GPT-2*</td><td>1k</td><td>N/A</td><td>22.78</td><td>24.39</td><td>24.12</td><td>24.97</td><td>18.07</td><td>11.05</td></tr><tr><td>MemTRM</td><td>1k</td><td>65K</td><td>21.77</td><td>23.56</td><td>23.23</td><td>24.16</td><td>17.39</td><td>10.81</td></tr><tr><td>TRIME</td><td>1k</td><td>65K</td><td>22.21</td><td>23.50</td><td>23.74</td><td>24.32</td><td>17.80</td><td>10.95</td></tr><tr><td>LONGMEM</td><td>1k</td><td>65K</td><td>21.29</td><td>23.01</td><td>22.55</td><td>23.35</td><td>16.71</td><td>10.05</td></tr></table>
|
| 113 |
+
|
| 114 |
+
Table 3: Zero-shot Suffix Identification Accuracy on AO3 subset of ChapterBreak. Baselines marked with † are directly cited from [STI22]. The MemTRM and LONGMEM loads the given $4 \mathrm { k } / 6 \mathrm { k } / 8 \mathrm { k }$ prefix contexts into cached memory, while the input length to local context is still 1k tokens.
|
| 115 |
+
|
| 116 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">#Params</td><td rowspan="2">In-Context Len.</td><td rowspan="2">In-Memory Len.</td><td colspan="3">ChapterBreakao3</td></tr><tr><td>ctx-4k</td><td>ctx-6k</td><td>ctx-8k</td></tr><tr><td>GPT-2-XLt [RWC+19]</td><td>1.5B</td><td>1K</td><td>N/A</td><td>24%</td><td>24%</td><td>24%</td></tr><tr><td>GPT-3† [BMR+20]</td><td>175B</td><td>2K</td><td>N/A</td><td>28%</td><td>28%</td><td>28%</td></tr><tr><td>LocalTRM+ [RSVG21]</td><td>516M</td><td>8K</td><td>N/A</td><td>24%</td><td>24%</td><td>24%</td></tr><tr><td>RoutTRM+ [RSVG21]</td><td>490M</td><td>8K</td><td>N/A</td><td>25%</td><td>24%</td><td>24%</td></tr><tr><td>Bigbirdt [ZGD+20]</td><td>128M</td><td>4K</td><td>N/A</td><td>26%</td><td>26%</td><td>26%</td></tr><tr><td>GPT-2*</td><td>407M</td><td>1K</td><td>N/A</td><td>18.4%</td><td>18.4%</td><td>18.4%</td></tr><tr><td>MemTRM</td><td>407M</td><td>1K</td><td>8</td><td>28.3%</td><td>28.7%</td><td>28.7%</td></tr><tr><td>LONGMEM</td><td>558M</td><td>1K</td><td>8</td><td>37.7%</td><td>39.4%</td><td>40.5%</td></tr></table>
|
| 117 |
+
|
| 118 |
+
# 3.3 Memory-Augmented In-Context Learning
|
| 119 |
+
|
| 120 |
+
LLMs have the emerging capability of in-context learning (ICL) via learning knowledge nonparametrically from few-shot demonstration examples in the local context. However, conventional in-context learning is heavily restricted by input context length, rendering it ineffective to absorb supervision from sufficient demonstration examples in the training set. With the proposed unlimited-length memory augmentation, LONGMEM can overcome the limitation of the number of demonstration examples in the local context and even attend on the whole training set by loading it into the cached memory. In this way, LONGMEM generalizes the conventional few-shot in-context learning to memory-augmented in-context learning with thousands of auxiliary demonstration examples.
|
| 121 |
+
|
| 122 |
+
Evaluation Setting. Here, we evaluate the in-context learning capability of baselines and the proposed LONGMEM model on five NLU datasets, SST-2 $[ \mathrm { S P W ^ { + } } 1 \bar { 3 } ]$ , MPQA [WWC05], MR $[ \mathrm { A } \mathrm { \bar { B } } \mathrm { K } ^ { + } 0 7 ]$ , Subj [PL04] and SST-5 $[ \mathrm { S P W ^ { + } } 1 3 ]$ . We evaluate models on two few-shot settings, 4-shot and 20- shot. The 4-shot case is the data-insufficient scenario, while the 20-shot demonstrations can almost fulfill the 1k input length and provide sufficient contextual self-supervisions. We transform the $\mathbf { k }$ -shot examples to semantically meaningful demonstration examples via fixed text template, i.e., $d _ { i } = "$ "Review: $x _ { i }$ Sentiment: $y _ { i } " , \forall \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { k } \in { \mathcal { D } } _ { \operatorname { t r a i n } }$ for sentiment analysis tasks. Additionally, we evaluate the 3-shot ICL on question-answering using SQuAD [RZLL16] under an open-ended generation setting. The details of all prompt templates are presented in Appendix D. Then we concatenate the demonstration examples with newlines to delimit them. The prediction label is directly generated using greedy decoding given the demonstration examples and test cases in context. The prediction accuracy is used as the evaluation metric. We report the mean and standard deviation of 6 runs with different random seeds to assess the randomness in selecting $\mathbf { k }$ -shot demonstration examples. As mentioned previously, the chunk size controls the granularity of retrieved text chunks. Since the considered NLU datasets require more fine-grained labels from cached memory, we perform a hyperparameter selection on the validation set of SST-2, and the best chunk-size 2 is used to report the results for MemTRM, TRIME and our model.
|
| 123 |
+
|
| 124 |
+
Table 5: Accuracy $[ \% ]$ of 4-shot and 20-shot ICL on 5 NLU tasks (SST-2, mr, subj, SST-5, mpqa). We sample 2000 extra demonstration examples and load them into cached memory. The subscript is the standard deviation across 6 runs. Avg. refers to the average accuracy on 5 datasets.
|
| 125 |
+
|
| 126 |
+
<table><tr><td>Model</td><td>In-Context #Demons.</td><td>In-Memory #Demons.</td><td>SST-2 ACC↑</td><td>MR ACC↑</td><td>Subj ACC↑</td><td>SST-5 ACC↑</td><td>MPQA ACC↑</td><td>Avg.</td></tr><tr><td>Majority</td><td>N/A</td><td>N/A</td><td>50.9</td><td>50.0</td><td>50.0</td><td>20.0</td><td>50.0</td><td>44.2</td></tr><tr><td>GPT-2*</td><td>4</td><td>N/A</td><td>68.311.6</td><td>64.712.5</td><td>51.94.2</td><td>31.44.4</td><td>61.511.8</td><td>55.6</td></tr><tr><td>MemTRM</td><td>4</td><td>2000</td><td>67.512.4</td><td>64.611.3</td><td>53.26.0</td><td>29.64.4</td><td>63.012.1</td><td>55.6</td></tr><tr><td>TRIME</td><td>4</td><td>2000</td><td>69.514.5</td><td>63.89.8</td><td>51.51.5</td><td>31.86.7</td><td>63.612.9</td><td>56.0</td></tr><tr><td>LONGMEM</td><td>4</td><td>2000</td><td>71.814.0</td><td>65.111.0</td><td>53.83.7</td><td>36.06.8</td><td>65.412.8</td><td>58.4</td></tr><tr><td>GPT-2*</td><td>20</td><td>N/A</td><td>68.211.5</td><td>63.45.2</td><td>57.610.2</td><td>33.66.0</td><td>70.87.6</td><td>58.7</td></tr><tr><td>MemTRM</td><td>20</td><td>2000</td><td>65.19.6</td><td>65.19.3</td><td>58.210.6</td><td>31.96.3</td><td>72.77.4</td><td>58.6</td></tr><tr><td>TRIME</td><td>20</td><td>2000</td><td>74.313.9</td><td>71.52.5</td><td>57.511.4</td><td>33.04.6</td><td>69.87.8</td><td>61.1</td></tr><tr><td>LONGMEM</td><td>20</td><td>2000</td><td>78.014.1</td><td>78.63.3</td><td>65.68.5</td><td>36.57.5</td><td>74.67.3</td><td>66.7</td></tr></table>
|
| 127 |
+
|
| 128 |
+
Results. The results on in-context learning are summarized in Table 5 and Table 4. LONGMEM achieves remarkable improvements on all NLU tasks under the 20-shot sufficient in-context setting, with $+ 5 . 6$ average scores increase over pretrained GPT- $^ { 2 ^ { * } }$ , MemTRM, and TRIME.
|
| 129 |
+
|
| 130 |
+
Meanwhile, LONGMEM also brings performance improvements on the 4-shot case. Additionally, LONGMEM improves the in-context learning capabilities of LLMs on open-ended generation tasks, with $+ 4 . 5$ EM score increase on SQuAD. The results indicate that having more demonstration examples loaded in cached memory can provide additional contextual cues to assist in-context learning. LONGMEM can utilize task-relevant knowledge from both local contextual demonstrations and in-memory augmented demonstrations, thereby achieving superior incontext learning capabilities.
|
| 131 |
+
|
| 132 |
+
<table><tr><td>Model</td><td>EM</td><td>F1</td></tr><tr><td>GPT-2*</td><td>22.282.3</td><td>30.782.0</td></tr><tr><td>MemTRM</td><td>22.843.5</td><td>32.652.8</td></tr><tr><td>LONGMEM</td><td>26.772.3</td><td>35.702.0</td></tr></table>
|
| 133 |
+
|
| 134 |
+
Table 4: Exact match (EM) and F1 scores of 3-shot (about 1k tokens) in-context learning on SQuAD. LONGMEM loads 200 extra demonstration examples into cached memory.
|
| 135 |
+
|
| 136 |
+
# 3.4 Ablation Studies
|
| 137 |
+
|
| 138 |
+
So far, we empirically verify the effectiveness and superiority of LONGMEM in utilizing cached memory for long-context modeling, long-context understanding, and many-shot in-context learning. Furthermore, we would like to investigate the extend to which the cached memory contributes to the long-context understanding capability of LONGMEM through an ablation study of removing memory augmentations. Besides, since the design of the cached memory bank involves several hyperparameters, such as memory size $m s z$ and chunk-size $c s z$ , we conduct a series of ablation studies to evaluate the effects of those choices.
|
| 139 |
+
|
| 140 |
+
Effects of Long-Term Memory Augmentation. To evaluate the effects and contributions of memory augmentations, we set the memory-size to 0 and maintain the SideNet parameters during inference. The results of LONGMEM without memory augmentation are shown in Table 6 of Appendix. As expected, without augmented long-term memory, the vanilla model with only backbone LLM and SideNet only gains 59.4 average scores on ICL NLU tasks, which is a 7.3 average accuracy decrease due to the removal of memory augmentation.
|
| 141 |
+
|
| 142 |
+
Effects of Chunk-Size. As analyzed before, the chunk-size $c s z$ controls the granularity of retrieval and thus it may make a difference to tasks with requirements of fine-grained retrieval. We perform an ablation study on the effects of various chunk-size choices $c s z \in \bar { \{ 2 , 4 , 8 \} }$ for in-context learning and the results are presented in 4(a). The chunk size of 2 yields the best performance on in-context learning tasks on five NLU datasets, which is consistent with the property of NLU tasks with the requirement of fine-grained retrieval and fusion towards classification label tokens.
|
| 143 |
+
|
| 144 |
+
Effects of Memory Size. The memory size (msz) controls the capacity of the memory bank. In general, the memory size should be compatible with the average length of documents or contexts, i.e., a set of books with average 16k tokens should deploy the memory size of 16k tokens in cached memory. The training $m s z$ of 65 tokens is excessive for downstream tasks such as ChapterBreak as the whole prefix context length does not exceed $6 5 \mathrm { k }$ tokens. Thus, we perform an ablation study on the effects of memory size $m s z \in \{ 8 k , 1 6 k , 3 2 k , 6 5 k \}$ during the inference stage on the PG-22 language modeling datasets and the results are shown in 4(b). To model the books with lengths of $8 \mathrm { k } { - } 5 0 \mathrm { k }$ , the smaller memory size $1 6 k$ which is consistent with the average length of target books yields the best perplexity.
|
| 145 |
+
|
| 146 |
+

|
| 147 |
+
Figure 4: (a) Accuracy on 5 NLU datasets given different chunk size during inference; (b) ∆Perplexity on 4 splits of PG-22 given different memory size during inference, in which the perplexity when $\scriptstyle { m s z = 6 5 \mathrm { k } }$ is used as baseline.
|
| 148 |
+
|
| 149 |
+
# 4 Related Work
|
| 150 |
+
|
| 151 |
+
Large Language Models. Large Language Models, i.e., GPT-3 $[ \mathrm { B M R } ^ { + } 2 0 ]$ , LLAMA $[ \mathrm { T M S ^ { + } } 2 3 ]$ , GPT-4 [Ope23], significantly revolutionized NLP research and promoted the state-of-the-art of various language understanding, language generation $[ \mathrm { W } Z \mathrm { G } ^ { + } 2 2 ]$ , and even vision-language tasks $[ \mathrm { W D C ^ { + } } 2 2 ]$ . Additionally, enabled by multi-task instruction tuning $[ \mathrm { W B } Z ^ { + } 2 1$ , $\mathrm { O W J ^ { + } } 2 2 ]$ , LLMs exhibit “emergent abilities“ $[ \dot { \mathrm { W } } \mathrm { T B } ^ { + } 2 2 ]$ like mathematical reasoning $[ \mathrm { W } \mathrm { W } \mathrm { S } ^ { + } 2 2 ]$ , code completion $[ \mathbf { C } \mathbf { T } \mathbf { J } ^ { + } 2 1 ]$ , etc.
|
| 152 |
+
|
| 153 |
+
$\mathbf { X }$ -formers. To enable transformers to attend on longer context, many variants of “ $\mathbf { \dot { x } }$ -formers“ are proposed. Transformer-XL $\mathrm { [ D Y Y ^ { + } 1 9 ] }$ proposes to cache attention keys and values of past segment and reuse them in recurrent manner. Recent seminal works of $\mathbf { X }$ -formers, including LinFormer $[ \bar { \mathrm { W } } \mathrm { L K } ^ { + } 2 0 ]$ , LongFormer [BPC20], Routing Transformer [RSVG21], proposed various sparse attention mechanisms for decreasing $O ( n ^ { 2 } )$ complexity to $O ( n \log n )$ or even $O ( n )$ . BigBird $[ Z \mathrm { G D } ^ { + } 2 0 ]$ achieves a $4 \mathrm { k }$ sequence length via attending on a subset of context tokens. Although these $\mathbf { X }$ -formers achieve substantial efficiency improvements, such efficiency gains are not remarkable when modeling sequences that spans book-level length. Moreover, the largest sequence length of these methods is still upper-bounded by 16k tokens, making them invalid in modeling long-sequences at the book or wikipedia-page level (i.e., average 70k tokens for full-length books in PG19 dataset [RPJL19]).
|
| 154 |
+
|
| 155 |
+
Side-Tuning. The method of Side-Tuning $[ Z \mathrm { S } Z ^ { + } 2 0$ , SCB22] is a task-specific tuning method for pre-trained models via training a lightweight side-network that is fused with the fixed pre-trained network via summation. Our method inherits the idea of adopting a side-network but distinguishes the side-tuning method in terms of learning objective and cross-network fusion ways. LONGMEM proposes to augment LLMs with decoupled memory to retrain information from long past inputs without any task-specific tuning. The cross-network residual connections introduced here are novel and distinct from the vanilla summation used in Side-Tuning.
|
| 156 |
+
|
| 157 |
+
# 5 Conclusion
|
| 158 |
+
|
| 159 |
+
In this paper, we propose to augment LLMs with long-term memory for enabling them to memorize long-form context and gain long-form memory. The designed decoupled memory module can cache attention key and value pairs of past inputs for future retrieval and fusion. A decoupled residual SideNet is introduced as the memory retriever and reader, meanwhile the LLM itself is frozen and works as knowledge and memory encoder. Experiments on various long-contextual language modeling datasets demonstrate the effectiveness of our model over other memory-augmentation baselines. The proposed method can also enable in-context learning of LLMs to overcome the limited number of demonstration examples in context, which is constrained by the contextual length, via caching thousands of auxiliary demonstration examples in memory.
|
| 160 |
+
|
| 161 |
+
# Acknowledgement
|
| 162 |
+
|
| 163 |
+
This work is done during the first author’s internship at Microsoft Research. We would like to thank the anonymous reviewers for the helpful comments. We appreciate Yutao Sun and Yaru Hao for helpful suggestions on implementation and evaluation benchmarks. The first author was partly sponsored by the DARPA PTG program (HR001122C0009). Any opinions, findings, conclusions, or recommendations expressed in this paper are those of the authors and do not necessarily reflect the views of funding agencies.
|
| 164 |
+
|
| 165 |
+
# References
|
| 166 |
+
|
| 167 |
+
$[ \mathrm { A B K ^ { + } } 0 7 ]$ Sören Auer, Christian Bizer, Georgi Kobilarov, Jens Lehmann, Richard Cyganiak, and Zachary Ives. Dbpedia: A nucleus for a web of open data. In The semantic web, pages 722–735. Springer, 2007.
|
| 168 |
+
$[ \mathrm { B M H } ^ { + } 2 1 ]$ Sebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai, Eliza Rutherford, Katie Millican, George van den Driessche, Jean-Baptiste Lespiau, Bogdan Damoc, Aidan Clark, Diego de Las Casas, Aurelia Guy, Jacob Menick, Roman Ring, T. W. Hennigan, Saffron Huang, Lorenzo Maggiore, Chris Jones, Albin Cassirer, Andy Brock, Michela Paganini, Geoffrey Irving, Oriol Vinyals, Simon Osindero, Karen Simonyan, Jack W. Rae, Erich Elsen, and L. Sifre. Improving language models by retrieving from trillions of tokens. ArXiv, abs/2112.04426, 2021.
|
| 169 |
+
$[ { \bf B } { \bf M } { \bf R } ^ { + } 2 0 ]$ 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, T. J. Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeff 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. ArXiv, abs/2005.14165, 2020. [BPC20] Iz Beltagy, Matthew E Peters, and Arman Cohan. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150, 2020.
|
| 170 |
+
$[ \mathrm { C T J } ^ { + } 2 1 ]$ ] 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.
|
| 171 |
+
[DCLT19] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In NAACL, 2019.
|
| 172 |
+
$\mathrm { [ D Y Y ^ { + } 1 9 ] }$ 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.
|
| 173 |
+
$[ \mathrm { G B B } ^ { + } 2 0 ]$ Leo Gao, Stella Biderman, Sid Black, Laurence Golding, Travis Hoppe, Charles Foster, Jason Phang, Horace He, Anish Thite, Noa Nabeshima, et al. The pile: An 800gb dataset of diverse text for language modeling. arXiv preprint arXiv:2101.00027, 2020. [JDJ21] Jeff Johnson, Matthijs Douze, and Hervé Jégou. Billion-scale similarity search with gpus. IEEE Transactions on Big Data, 7:535–547, 2021. [KB15] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2015.
|
| 174 |
+
$[ \mathrm { L G W } ^ { + } 2 3 ]$ Rui Lv, Junliang Guo, Rui Wang, Xu Tan, Qi Liu, and Tao Qin. N-gram nearest neighbor machine translation. arXiv preprint arXiv:2301.12866, 2023.
|
| 175 |
+
$[ \mathrm { L O G ^ { + } } 1 9 ]$ 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, abs/1907.11692, 2019. [Ope23] OpenAI. Gpt-4. https://openai.com/research/gpt-4, 2023. Accessed on March 14, 2023.
|
| 176 |
+
$[ \mathrm { O W J } ^ { + } 2 2 ]$ Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35:27730–27744, 2022. [PL04] Bo Pang and Lillian Lee. A sentimental education: Sentiment analysis using subjectivity summarization based on minimum cuts. arXiv preprint cs/0409058, 2004. [PSL21] 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.
|
| 177 |
+
[RNSS18] Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding with unsupervised learning. 2018.
|
| 178 |
+
[RPJL19] Jack W Rae, Anna Potapenko, Siddhant M Jayakumar, and Timothy P Lillicrap. Compressive transformers for long-range sequence modelling. arXiv preprint arXiv:1911.05507, 2019.
|
| 179 |
+
$[ \mathrm { R S R } ^ { + } 2 0 ]$ Colin Raffel, Noam M. 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. ArXiv, abs/1910.10683, 2020.
|
| 180 |
+
[RSVG21] Aurko Roy, Mohammad Saffar, Ashish Vaswani, and David Grangier. Efficient content-based sparse attention with routing transformers. Transactions of the Association for Computational Linguistics, 9:53–68, 2021.
|
| 181 |
+
$[ \mathrm { R W C ^ { + } } 1 9 ]$ Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019.
|
| 182 |
+
[RZLL16] Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. SQuAD: $1 0 0 { , } 0 0 0 { + }$ Questions for Machine Comprehension of Text. arXiv e-prints, page arXiv:1606.05250, 2016. [SCB22] Yi-Lin Sung, Jaemin Cho, and Mohit Bansal. Lst: Ladder side-tuning for parameter and memory efficient transfer learning. arXiv preprint arXiv:2206.06522, 2022.
|
| 183 |
+
$[ \mathrm { S P W ^ { + } } 1 3 ]$ Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Y Ng, 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, 2013. [STI22] Simeng Sun, Katherine Thai, and Mohit Iyyer. Chapterbreak: A challenge dataset for long-range language models. arXiv preprint arXiv:2204.10878, 2022.
|
| 184 |
+
$\mathrm { [ T M S ^ { + } } 2 3 $ ] Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023.
|
| 185 |
+
$[ \mathrm { V S P ^ { + } 1 7 } ]$ Ashish Vaswani, Noam M. Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NIPS, 2017.
|
| 186 |
+
$[ \mathrm { W B Z ^ { + } } 2 1 ]$ Jason Wei, Maarten Bosma, Vincent Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M Dai, and Quoc V Le. Finetuned language models are zero-shot learners. In International Conference on Learning Representations, 2021.
|
| 187 |
+
$[ \mathrm { W D C ^ { + } } 2 2 ]$ Weizhi Wang, Li Dong, Hao Cheng, Haoyu Song, Xiaodong Liu, Xifeng Yan, Jianfeng Gao, and Furu Wei. Visually-augmented language modeling. arXiv preprint arXiv:2205.10178, 2022.
|
| 188 |
+
$[ \mathrm { W L K ^ { + } } 2 0 ]$ Sinong Wang, Belinda Z Li, Madian Khabsa, Han Fang, and Hao Ma. Linformer: Self-attention with linear complexity. arXiv preprint arXiv:2006.04768, 2020.
|
| 189 |
+
[WRHS22] Yuhuai Wu, Markus N. Rabe, DeLesley S. Hutchins, and Christian Szegedy. Memorizing transformers. ArXiv, abs/2203.08913, 2022.
|
| 190 |
+
$[ \mathrm { W T B } ^ { + } 2 2 ]$ 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.
|
| 191 |
+
[WWC05] Janyce Wiebe, Theresa Wilson, and Claire Cardie. Annotating expressions of opinions and emotions in language. Language resources and evaluation, 39(2):165–210, 2005.
|
| 192 |
+
$[ \mathrm { W } \mathrm { W } \mathrm { S } ^ { + } 2 2 ]$ Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. arXiv preprint arXiv:2201.11903, 2022.
|
| 193 |
+
$[ \mathrm { W } Z \mathrm { G } ^ { + } 2 2 ]$ Weizhi Wang, Zhirui Zhang, Junliang Guo, Yinpei Dai, Boxing Chen, and Weihua Luo. Taskoriented dialogue system as natural language generation. In Proceedings of the 45th International ACM SIGIR Conference on Research and Development in Information Retrieval, pages 2698–2703, 2022.
|
| 194 |
+
$[ \mathrm { Y } \mathrm { D } \mathrm { Y } ^ { + } 1 9 ]$ Zhilin Yang, Zihang Dai, Yiming Yang, Jaime G. Carbonell, Ruslan Salakhutdinov, and Quoc V. Le. XLNet: Generalized autoregressive pretraining for language understanding. In NeurIPS, 2019.
|
| 195 |
+
$[ Z \mathrm { G D } ^ { + } 2 0 ]$ Manzil Zaheer, Guru Guruganesh, Kumar Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, et al. Big bird: Transformers for longer sequences. Advances in neural information processing systems, 33:17283–17297, 2020. [ZLC22] Zexuan Zhong, Tao Lei, and Danqi Chen. Training language models with memory augmentation. arXiv preprint arXiv:2205.12674, 2022.
|
| 196 |
+
$[ Z \mathbf { S } Z ^ { + } 2 0 ]$ Jeffrey O Zhang, Alexander Sax, Amir Zamir, Leonidas Guibas, and Jitendra Malik. Side-tuning: a baseline for network adaptation via additive side networks. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part III 16, pages 698–714. Springer, 2020.
|
| 197 |
+
|
| 198 |
+
A Ablation Study on the Effect of Memory Augmentation
|
| 199 |
+
|
| 200 |
+
<table><tr><td>Model</td><td>In-Context #Demons.</td><td>In-Memory #Demons.</td><td>SST-2 ACC↑</td><td>MR ACC↑</td><td>Subj ACC↑</td><td>SST-5 ACC↑</td><td>MPQA ACC↑</td><td>Avg.</td></tr><tr><td>Majority</td><td>N/A</td><td>N/A</td><td>50.9</td><td>50.0</td><td>50.0</td><td>20.0</td><td>50.0</td><td>44.2</td></tr><tr><td>GPT-2*</td><td>4</td><td>N/A</td><td>68.311.6</td><td>64.712.5</td><td>51.94.2</td><td>31.44.4</td><td>61.511.8</td><td>55.6</td></tr><tr><td>MemTRM</td><td>4</td><td>2000</td><td>67.512.4</td><td>64.611.3</td><td>53.26.0</td><td>29.64.4</td><td>63.012.1</td><td>55.6</td></tr><tr><td>TRIME</td><td>4</td><td>2000</td><td>69.514.5</td><td>63.89.8</td><td>51.51.5</td><td>31.86.7</td><td>63.612.9</td><td>56.0</td></tr><tr><td>LONGMEM</td><td>4</td><td>2000</td><td>71.814.0</td><td>65.111.0</td><td>53.83.7</td><td>36.06.8</td><td>65.412.8</td><td>58.4</td></tr><tr><td>w/o Memory</td><td>4</td><td>0</td><td>69.412.4</td><td>64.312.1</td><td>53.47.7</td><td>29.05.2</td><td>62.512.3</td><td>55.7</td></tr><tr><td>GPT-2*</td><td>20</td><td>N/A</td><td>68.211.5</td><td>63.45.2</td><td>57.610.2</td><td>33.66.0</td><td>70.87.6</td><td>58.7</td></tr><tr><td>MemTRM</td><td>20</td><td>2000</td><td>65.19.6</td><td>65.19.3</td><td>58.210.6</td><td>31.96.3</td><td>72.77.4</td><td>58.6</td></tr><tr><td>TRIME</td><td>20</td><td>2000</td><td>74.313.9</td><td>71.52.5</td><td>57.511.4</td><td>33.04.6</td><td>69.87.8</td><td>61.1</td></tr><tr><td>LONGMEM</td><td>20</td><td>2000</td><td>78.014.1</td><td>78.63.3</td><td>65.68.5</td><td>36.57.5</td><td>74.67.3</td><td>66.7</td></tr><tr><td>w/o Memory</td><td>20</td><td>0</td><td>70.012.8</td><td>70.86.2</td><td>52.94.6</td><td>30.96.4</td><td>72.57.5</td><td>59.4</td></tr></table>
|
| 201 |
+
|
| 202 |
+
Table 6: Ablation study results on the effect of memory augmentation of 4-shot and 20-shot ICL on 5 NLU tasks (SST-2, mr, subj, SST-5, mpqa). We sample 2000 extra demonstration examples and load them into cached memory. The subscript is the standard deviation across 6 runs. Avg. refers to the average accuracy on 5 datasets. "w/o" is short for "without".
|
| 203 |
+
|
| 204 |
+
# B Inference Efficiency and GPU-Memory Efficiency
|
| 205 |
+
|
| 206 |
+
When the model is required to comprehend long sequences, the proposed method LONGMEM can load the out-of-boundary inputs into the cached memory as previous context. Thus, the memory usage and inference speed can be significantly improved compared with vanilla self-attention-based models. The detailed statistics in terms of the efficiency is presented in Table 7.
|
| 207 |
+
|
| 208 |
+
<table><tr><td>Model</td><td>In-Context Len.</td><td>In-Memory Len.</td><td>Inference Speed (tokens/s)↑</td><td>GPU-Memory Usage (MBs)↓</td></tr><tr><td>GPT-2*</td><td>4k</td><td>N/A</td><td>14666</td><td>20671</td></tr><tr><td>LONGMEM</td><td>1k</td><td>3k</td><td>22638</td><td>13335</td></tr><tr><td>GPT-2*</td><td>8k</td><td>N/A</td><td>8417</td><td>54195</td></tr><tr><td>LONGMEM</td><td>1k</td><td>7k</td><td>21343</td><td>13437</td></tr></table>
|
| 209 |
+
|
| 210 |
+
Table 7: The superiority of our method over fully dense self-attention (GPT- $2 ^ { * }$ ) in terms of inference speed and GPU-memory utilization.
|
| 211 |
+
|
| 212 |
+
# C Training Details
|
| 213 |
+
|
| 214 |
+
The pre-training of reproduced GPT- $^ { 2 ^ { * } }$ iterates on 117B tokens in total, with 512 batch-size and 1024-token fixed segment-length. The Adam optimizer [KB15] is adopted in memory-augmented adaptation training. The pre-training and adaptation are trained on 16 32GB-Tesla-V100 GPUs. Other detailed training hypperparamters and settings are presented in Table 8.
|
| 215 |
+
|
| 216 |
+
<table><tr><td>Hyperparameter</td><td>LONGMEM</td></tr><tr><td colspan="2">Reproduced GPT-2* Backbone LLMHyperparameters</td></tr><tr><td>Parameters</td><td>407M</td></tr><tr><td>Precision</td><td>float16</td></tr><tr><td>Layers Hidden dim.</td><td>24</td></tr><tr><td>Attention heads</td><td>1024</td></tr><tr><td></td><td>16</td></tr><tr><td>Head Dim</td><td>64</td></tr><tr><td>Vocab size</td><td>52k</td></tr><tr><td>Sequence length</td><td>1024</td></tr><tr><td>Position emb.</td><td>Alibi</td></tr><tr><td>Tied embedding</td><td>False</td></tr><tr><td colspan="2">SideNetHyperparameters</td></tr><tr><td>Parameters</td><td>151M</td></tr><tr><td>Precision</td><td>float16</td></tr><tr><td>Layers</td><td>12</td></tr><tr><td>Hidden dim.</td><td>1024</td></tr><tr><td>Attention heads</td><td>16</td></tr><tr><td>Head Dim</td><td>64</td></tr><tr><td>Sequence length</td><td>1024</td></tr><tr><td colspan="2">Memory-Augmented Adaptation Hyperparameters</td></tr><tr><td>Global Batch Size</td><td>256</td></tr><tr><td>Learning rate</td><td>2.0e-4</td></tr><tr><td>Total tokens</td><td>26B</td></tr><tr><td>Warmup tokens</td><td>0</td></tr><tr><td>LR Decay style</td><td>polynomial</td></tr><tr><td>Adam(β1,β2)</td><td>(0.9, 0.98)</td></tr><tr><td>Adam eps</td><td>1e-06</td></tr><tr><td>Weight decay</td><td>0.01</td></tr><tr><td></td><td></td></tr><tr><td>Gradient clipping</td><td>2.0</td></tr></table>
|
| 217 |
+
|
| 218 |
+
Table 8: Memory-Augmented Adaptation and Architectural Hyperparameters.
|
| 219 |
+
|
| 220 |
+
# D Prompting Templates
|
| 221 |
+
|
| 222 |
+
We present all hand-crafted in-context learning prompting templates and labels for 5 NLU datasets and Squad QA dataset in Tabel 9.
|
| 223 |
+
|
| 224 |
+
<table><tr><td>Task</td><td>Prompt</td><td>Labels</td></tr><tr><td>SST-2</td><td>Review: [Sentence] Sentiment: [Label]</td><td>{positive, negative}</td></tr><tr><td>MR</td><td>Review: [Sentence] Sentiment: [Label]</td><td>{positive, negative}</td></tr><tr><td>MPQA</td><td>Review: [Sentence] Sentiment: [Label]</td><td>{positive, negative}</td></tr><tr><td>SST-5</td><td>input: [Sentence] type: [Label]</td><td>{terrible,bad,okay,good,great}</td></tr><tr><td>Subj</td><td>input: [Sentence] type: [Label]</td><td>{objective, subjective}</td></tr><tr><td> Squad</td><td colspan="2">Passage: [Passage]\n Question: [Question] Answer: [Answer]</td></tr></table>
|
| 225 |
+
|
| 226 |
+
Table 9: The hand-crafted prompts used to query the model predictions on the zero-shot evaluation of 5 NLU datasets and one question-answering dataset Squad.
|
md/dev/CbsJ53LdKc/CbsJ53LdKc.md
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# In-Context Impersonation Reveals Large Language Models’ Strengths and Biases
|
| 2 |
+
|
| 3 |
+
Leonard Salewski1,2 Stephan Alaniz1,2 Isabel Rio-Torto3,4∗
|
| 4 |
+
|
| 5 |
+
Eric Schulz2,5
|
| 6 |
+
|
| 7 |
+
Zeynep Akata1,2
|
| 8 |
+
|
| 9 |
+
1 University of Tübingen 2 Tübingen AI Center 3 University of Porto 4 INESC TEC 5 Max Planck Institute for Biological Cybernetics
|
| 10 |
+
|
| 11 |
+
# Abstract
|
| 12 |
+
|
| 13 |
+
In everyday conversations, humans can take on different roles and adapt their vocabulary to their chosen roles. We explore whether LLMs can take on, that is impersonate, different roles when they generate text in-context. We ask LLMs to assume different personas before solving vision and language tasks. We do this by prefixing the prompt with a persona that is associated either with a social identity or domain expertise. In a multi-armed bandit task, we find that LLMs pretending to be children of different ages recover human-like developmental stages of exploration. In a language-based reasoning task, we find that LLMs impersonating domain experts perform better than LLMs impersonating non-domain experts. Finally, we test whether LLMs’ impersonations are complementary to visual information when describing different categories. We find that impersonation can improve performance: an LLM prompted to be a bird expert describes birds better than one prompted to be a car expert. However, impersonation can also uncover LLMs’ biases: an LLM prompted to be a man describes cars better than one prompted to be a woman. These findings demonstrate that LLMs are capable of taking on diverse roles and that this in-context impersonation can be used to uncover their strengths and hidden biases. Our code is available at https://github.com/ ExplainableML/in-context-impersonation.
|
| 14 |
+
|
| 15 |
+
# 1 Introduction
|
| 16 |
+
|
| 17 |
+
Large Language Models (LLMs) can not only summarize documents and converse on a large range of topics [1], but they have also shown other emergent abilities [2, 3]. Because of their impressive abilities, LLMs are permeating into many applications [4, 5]. This means that there is a societal need to understand how these models “tick” [6, 7]. Traditionally, LLMs are provided with a context as a textual prompt and are asked to provide answers via text completion, thereby solving a variety of choice-based [8], description-based [9], and reasoning tasks [10]. Yet how in-context learning works is not fully understood. When Min et al. [11] prompted LLMs with random labels, they found that this did not drastically degrade performance, suggesting that the role of in-context demonstrations is to prime the model for a particular task. This is in line with other results suggesting that LLMs internally infer latent variables to make better predictions [12]. It has been suggested that LLMs, and other large models, can change their behavior when asked to respond as a particular persona. When Deshpande et al. [13] asked LLMs to respond as a hateful person, their toxicity score increased. When Wang and colleagues [14] asked LLMs to imagine being expert systematic reviewers, the quality of their literature search queries increased. That LLMs can impersonate specific people is also known; they can, for example, pretend to be Oscar Wilde, Carrie Bradshaw from Sex and the City, or Donald Trump [15]. But how does in-context impersonation affect LLMs’ behavior in language-based and other downstream tasks?
|
| 18 |
+
|
| 19 |
+
In the current work, we let LLMs impersonate, that is taking on different roles, in context. We do this by prefixing the prompt with “If you were a {persona}” where persona is replaced with the persona that the LLM is asked to impersonate. These personas are associated either with a social identity or a domain of expertise. In a first simulation using a multi-armed bandit task [16], we find that LLMs impersonating children of different ages can recover the developmental stages of human-like exploration strategies. In language-based reasoning tasks, we find that LLMs impersonating domain experts perform better than LLMs impersonating non-domain experts. Finally, we ask LLMs to describe different classes of either birds or cars and then use their descriptions in a downstream, visual classification task. The results of this experiment corroborate our earlier results: LLMs become better as they pretend to be older, and they are also better when they pretend to be domain experts. However, we also see how impersonating LLMs reproduce biases: LLMs impersonating a black person or a male describe cars better, while LLMs impersonating a white person or a female describe birds better. These results expand our understanding of in-context learning in LLMs and open up new research directions investigating role-taking and pretense in LLMs and beyond.
|
| 20 |
+
|
| 21 |
+
# 2 Related Work
|
| 22 |
+
|
| 23 |
+
In-context learning refers to an LLM’s ability to improve at a given task after being provided with a number of task-relevant demonstrations [1]. This ability sets LLMs apart from traditional models and has led to a totally new paradigm – one which does not require fine-tuning of weights on task-specific data but instead relies entirely on contextual information [17, 10, 18].
|
| 24 |
+
|
| 25 |
+
This contextual information is normally delivered as textual prompts [19], where a task or scenario is described and a model is asked to solve the task or reason about the scenario by generating the next words of the provided text. Due to its flexibility, prompting has been widely used as a generic method for natural language tasks [20, 21]. Importantly, the resulting in-context learning does not only work after LLMs have seen some examples, i.e. in the few-shot regime [22], but also without any examples, i.e. in the zero-shot regime [23]. LLMs are reasonably proficient at solving arithmetic [24] or reasoning tasks [25] without having been prompted with example solutions but only after being asked to provide an answer to a given problem. LLMs can require careful engineering of the provided prompts, either manually [26] or automatically [27]. Indeed, whole books have been written to provide guidelines on how to best perform prompt engineering [28], especially because engineering prompts can require a great amount of expertise [29].
|
| 26 |
+
|
| 27 |
+
One method known to influence LLMs behavior is to ask them to respond as a particular person [30, 31], an effect which is also described as role-taking [32]. LLMs can take in the text of one famous author, e.g. Oscar Wilde, and rewrite it in the style of another famous author, e.g. James Joyce [33]. This is not only true for LLMs but for any large model that provides results based on prompts, such as text-to-image models [34–36]. For example, using the artist’s name for generative art prompting is known to boost the quality [29] or to substantially affect the style [37–39] of the generated images. To make LLMs respond more truthfully, Lin and colleagues introduced scenarios from the perspective of a fictional persona called “Professor Smith” [40]. Conversely, to make LLMs act maliciously, Wolf et al. [41] prompt LLMs adversarially to overcome alignment techniques. LLMs can also be used to simulate multiple humans which changes how they cooperate in economic games [42].
|
| 28 |
+
|
| 29 |
+
LLMs can also have their own “personalities” which can be evoked in-context [43]. Although LLMs frequently behave like the average person [44], their personality profiles can be tinkered with [45], e.g. by changing the context to be more or less emotional [46]. This has led researchers to use LLMs to simulate survey responses [47] of subpopulations by conditioning them on socio-demographic descriptions [48] or to ask them to respond in persona when writing about fictitious childhood events [49]. Additionally, non-deterministic tasks such as open-ended questions have also been explored [50].
|
| 30 |
+
|
| 31 |
+
Semantics derived automatically from language corpora can contain human-like biases [51]. Thus, LLMs do not only reproduce human-like text but also replicate biases present in the training data [7, 52]. Importantly, these biases can get exacerbated if LLMs are asked to provide answers in persona [46, 13, 53].
|
| 32 |
+
|
| 33 |
+
LLMs are naturally combined with large vision-language models (VLMs) [54, 55] such as CLIP [56] due to their versatility in a wide range of visual recognition tasks. Menon et al. [57] used GPT-3 [1] to generate a diverse set of short descriptions of a class that improve zero-shot classification when their CLIP scores are combined. Similarly, Yang et al. [58] used GPT-3 descriptions of classes as concept bottlenecks for interpretable image classification. LLMs can also be used as a knowledge base for visual question-answering (VQA) tasks [59].
|
| 34 |
+
|
| 35 |
+
# 3 In-context Impersonation Methodology
|
| 36 |
+
|
| 37 |
+
Our methodology is composed of two steps. First, we prompt and query the LLM. Second, we evaluate the resulting text queries in three tasks, i.e. two-armed bandit, reasoning, and visual classification.
|
| 38 |
+
|
| 39 |
+
# 3.1 Prompting and Querying the Large Language Model with Personas
|
| 40 |
+
|
| 41 |
+
LLMs are trained to predict the most probable next token $t _ { k }$ given previous tokens $t _ { 1 } \ldots t _ { k - 1 }$ by maximizing the likelihood function $p _ { \mathrm { L L M } } ( t _ { k } | t _ { 1 } , \dots , t _ { k - 1 } )$ . In this work, we use pre-trained LLMs without further finetuning them. Depending on the task, we generate one or more tokens given a task-specific context $^ c$ that describes the task to the language model and prompts it for an answer. The context includes the instruction to impersonate using the phrase “If you were a {persona}” where persona $p$ is replaced by the persona name. Thus, we obtain generated tokens $\pmb { t }$ by sampling from
|
| 42 |
+
|
| 43 |
+
$$
|
| 44 |
+
p _ { \mathrm { L L M } } ( \pmb { t } | \pmb { c } ^ { ( p ) } ) = \prod _ { k = 1 } ^ { K } p _ { \mathrm { L L M } } ( t _ { k } | \boldsymbol { c } _ { 1 } ^ { ( p ) } , \ldots , \boldsymbol { c } _ { n } ^ { ( p ) } , t _ { 1 } , \ldots , t _ { k - 1 } )
|
| 45 |
+
$$
|
| 46 |
+
|
| 47 |
+
We refer to this type of contextualization as in-context impersonation.
|
| 48 |
+
|
| 49 |
+
Personas Considered. The first interesting question to look at was if LLMs could impersonate the behavior of differently aged people. For this, we ask the LLM to imagine it is either a 2, 4, 7, 13, or 20-year-old. We also evaluate whether the LLM is able to impersonate different fields of expertise. Depending on the task considered, the expertise profiles differ (more details below). Finally, we evaluate whether LLMs have biases regarding gender and skin color. For this, we asked LLMs to imagine that they were either a man or a woman or a black person or a white person.
|
| 50 |
+
|
| 51 |
+
Large Language Models Considered. In this work, we evaluate two LLMs. For all of our tasks, we used the Vicuna-13B language model [60] which has 13 billion parameters and was trained to follow natural language instructions. Vicuna is a fine-tuned version of the LLAMA language model [61] using ShareGPT [62] conversational data. We use an instruction fine-tuned model because it was optimized to follow user prompts. Its weights are publicly available, allowing us to run the model locally. Vicuna is competitive with proprietary services such as ChatGPT in some domains $[ 6 3 ] ^ { 2 }$ . In addition to Vicuna, we use the OpenAI API of ChatGPT [64] with the gpt-3.5-turbo model for the reasoning and vision tasks. For the bandit task, however, running $1 2 \mathrm { k }$ games with 10 trials each is infeasible.
|
| 52 |
+
|
| 53 |
+
We do not further train the models, nor do we provide sample solutions in-context; thus, all experiments are conducted in a zero-shot fashion. By providing minimal guidance to perform the task, we avoid pre-conditioning the model such that answers can better reflect the internalized language of the LLM instead of relying on few-shot examples. When sampling full sentences, we use a temperature of 0.7; to obtain the answer as a single symbol (token), we set it to 1 unless otherwise stated. These different temperatures were chosen based on the recommended default values of each LLM.
|
| 54 |
+
|
| 55 |
+
# 3.2 Bandit Task Design
|
| 56 |
+
|
| 57 |
+
We asked LLMs to imagine being in different personalities while participating in a multi-armed bandit task [65] taken from the psychology literature [66] and already applied to LLMs [8].
|
| 58 |
+
|
| 59 |
+
An agent gets to interact with a two-armed bandit problem for 10 trials. The mean reward for each arm $a$ is drawn from $p ( \theta _ { a } ) = \mathcal { N } ( 0 , 1 0 )$ at the beginning of a task, and the reward for each trial is drawn from $p ( r _ { t } | a _ { t } , \theta _ { a _ { t } } ) = \mathcal { N } ( \theta _ { a _ { t } } , 1 )$ . Feedback of past trials is provided via prompt-chaining, i.e. concatenating previous choices and their outcomes to the current prompt submitted to the LLM. We analyze the set of emerging exploration strategies, assuming that an agent uses Bayes’ rule to update its beliefs over unobserved parameters. If prior and rewards are normally distributed, then the posterior will be normally distributed and the corresponding updating rule is given by the Kalman filtering equations. Let $\dot { p ( \theta _ { a } | h _ { t } ) } = \mathcal { N } ( \mu _ { a , t } , \sigma _ { a , t } )$ be the posterior distribution at time-step $t$ . Based on the parameters of this posterior distribution, one can define a probit-regression model:
|
| 60 |
+
|
| 61 |
+

|
| 62 |
+
Figure 1: Our three tasks are designed to analyze the effect of in-context impersonation. First, we investigate bandit tasks (pink) where the LLM must maximize the reward while impersonating different age groups. Second, we evaluate the effect of domain expert impersonation on natural language reasoning tasks (yellow). Third, we study the usefulness of descriptions generated with impersonation w.r.t. age, expertise, ethnicity, and gender for visual classification (green).
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
p ( A _ { t } = 1 | \mathbf { w } ) = \Phi \left( \beta _ { 1 } \mathbf { V } _ { t } + \beta _ { 2 } \mathbf { R } \mathbf { U } _ { t } \right)
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
with $\Phi$ denoting the cumulative distribution function of a standard normal distribution. Here, $\mathrm { V } _ { t } =$ $\mu _ { 1 , t } - \mu _ { 2 , t }$ represents the estimated difference in value and $\mathrm { R U } _ { t } = \sigma _ { 1 , t } - \sigma _ { 2 , t }$ the relative uncertainty. One can use Equation 2 to analyze how much an agent engages in exploitation behavior by inspecting $\beta _ { 1 }$ and how much the agent uses uncertainty to explore in a directed fashion by inspecting $\beta _ { 2 }$ [16].
|
| 69 |
+
|
| 70 |
+
For this bandit task, we consider personas of different ages. Specifically, we study ages 2, 4, 7, 13, and 20 to cover key developmental stages of early childhood, childhood, adolescence, and adulthood where the learning progress is most pronounced in humans. The language model is prompted (see Figure 1, the pink path) to only answer “1” or $^ { \cdot 6 } 2 ^ { \cdot }$ depending on which arm $a$ it would like to choose. The LLM receives rewards and the associated actions from previous trials inside the context in the form of a list.
|
| 71 |
+
|
| 72 |
+
With $\begin{array} { r } { \log d _ { a _ { t } } = \log p _ { \mathrm { L L M } } ( t _ { 1 } = a _ { t } | \pmb { c } ^ { ( p ) } , a _ { 1 } , \ldots , a _ { t - 1 } , r _ { 1 } , \ldots , r _ { t - 1 } ) } \end{array}$ being the unnormalized logits from the LLM for the token of arm a, for each trial we sample an action aˆ ∼ σ({log dat }Aa =1) where we have two arms $A = 2$ . We do not apply temperature scaling in this case as we are only sampling a single token and want it to reflect the LLM decision-making as faithfully as possible.
|
| 73 |
+
|
| 74 |
+
# 3.3 Reasoning Task Design
|
| 75 |
+
|
| 76 |
+
In our reasoning task, the LLM has to answer a multiple-choice question regarding a given topic from the Multitask Language Understanding (MMLU) dataset [67], commonly used to benchmark LLMs [61]. The MMLU dataset consists of 57 tasks from Science, Technology, Engineering, and Mathematics (STEM), Humanities, Social Sciences, and Other, ranging from elementary, high school, college, and professional levels of complexity. We start by prompting the LLM with the context:
|
| 77 |
+
|
| 78 |
+
Please consider the following multiple-choice question and the four answer options A, B, C, and D. Question: {task} If you were a {persona}, which answer would you choose?
|
| 79 |
+
|
| 80 |
+
The task is replaced by the question and the 4 possible answers, while the persona is replaced by an expert (see Figure 1, the yellow path). We consider three types of experts as personas. The task expert, e.g. for the high school computer science task, is “high school computer science expert”. The domain expert is an aggregation of all the remaining experts in the same field as the task expert (but not the task expert himself), e.g. for high school computer science it would be any other STEM expert. The non-domain expert is an aggregation of the task experts from the other domains, e.g. for high school computer science it would be all Humanities, Social Sciences and Other experts.
|
| 81 |
+
|
| 82 |
+
After feeding the prompt to the LLM, the LLM prediction of the first token following the context is $d = p _ { \mathrm { L L M } } ( t _ { 1 } | \mathbf { c } ^ { ( p ) } )$ and the $N$ tokens for the possible answers of the multiple choice question are $o = \{ o _ { i } \} _ { i = 1 } ^ { N }$ which in this case are A, B, C, and D. The predicted option is then given by
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\hat { o } = \arg \operatorname* { m a x } ( \hat { c } _ { i } ) , \mathrm { w i t h } \hat { c } _ { i } = d [ c _ { i } ] , i = 1 \ldots N
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
which are the predicted probabilities of the language model. With this approach, we are able to obtain the option with the highest probability according to the LLM and, thus, compare it with the ground truth label to measure the accuracy resulting from different in-context impersonations.
|
| 89 |
+
|
| 90 |
+
# 3.4 Vision and Language Task Design
|
| 91 |
+
|
| 92 |
+
Lastly, we want to evaluate the usefulness of descriptions generated by in-context impersonation for downstream vision and language tasks. We focus on challenging fine-grained classification tasks, as the generated descriptions need to be domain specific for these tasks to succeed. We ask the LLMs to generate a description of a class, from the perspective of a persona. Our prompt is:
|
| 93 |
+
|
| 94 |
+
If you were a {persona}, how would you answer the following question in 45 words? Q: What is a/an {class_name}? A: It is
|
| 95 |
+
|
| 96 |
+
To avoid trivial solutions, i.e. the class name being mentioned in the description, we post-process the generated descriptions with a two-step approach: first, we replace class names used in noun phrases with an appropriate pronoun whilst respecting the given numerous. Second, if the class name is still not removed, we re-use the same language model to process the descriptions sentence by sentence. For this, we use 4 in-context examples, that demonstrate how to remove the class name information. The full process is documented in suppl. Section D.1.
|
| 97 |
+
|
| 98 |
+
Vision-Language Models (VLMs). We use CLIP (or variants thereof) [56, 68] to perform finegrained visual classification as a means to evaluate the usefulness of the generated descriptions. CLIP models are trained with contrastive image-text matching losses to rank matching image and text inputs highly and non-matching inputs lowly. [56, 68] show that CLIP variants generalize well to match unseen texts, e.g. class names, an ability commonly referred to as zero-shot classification.
|
| 99 |
+
|
| 100 |
+
First, the image to classify is converted into a normalized feature representation $I$ using CLIP’s pre-trained vision backbone. Then, the class names are embedded into normalized feature vectors $T _ { N }$ using the pre-trained text backbone. Next, all pairwise cosine similarities $I \cdot T _ { N }$ of the respective feature representations are computed. Finally, the $n ^ { * } = \arg \operatorname* { m a x } _ { N } ( I \cdot T _ { N } )$ over these similarities reveals the most similar class $n ^ { * }$ .
|
| 101 |
+
|
| 102 |
+
Inference. We generate a description $D _ { n } ^ { ( p ) }$ with the above prompt for each class $n$ for each persona $p$ where we use a generative approach, i.e. we auto-regressively sample a random token from the predicted logits (see Figure 1, the green path). For Vicuna-13B we use the default temperature of 0.7 and the default top- $\mathbf { \nabla } \cdot \mathbf { k }$ value of $k = 5 0$ . For ChatGPT we use the default temperature of 1.0. This continues until the model emits an <end of sequence> or the maximum number of tokens (96) is reached. We did not tune these values.
|
| 103 |
+
|
| 104 |
+
For visual classification, we use the zero-shot classification capabilities of CLIP models, but instead of using the embedded class name itself $( T _ { n } )$ , we use the embedding of the generated descriptions $D _ { n } ^ { ( p ) }$ for each class $n$ and for each persona $p$ . The predicted class for each persona $i ^ { ( p ) ^ { * } }$ is:
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
n ^ { ( p ) ^ { * } } = \arg \operatorname* { m a x } ( I \cdot D _ { n } ^ { ( p ) } )
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
Performance is measured by computing the classification accuracy of the test splits on both datasets. As the descriptions are sampled from the LLM output, the results of the experiments are stochastic and we repeat them five times. We report the mean performance as well as $9 5 \%$ confidence intervals.
|
| 111 |
+
|
| 112 |
+
# 4 Experiments
|
| 113 |
+
|
| 114 |
+
Using Vicuna-13B, we evaluate the two-armed bandit and MMLU language reasoning tasks. For the zero-shot image classification task using a VLM we generate descriptions with both Vicuna-13B and ChatGPT. We focus on highlighting how the chosen persona changes the task performance of the LLM. As LLMs seem to be sensitive to prompts [69], we follow the meta-prompting approach from [26] to vary our impersonation prompts. We run all Vicuna-13B experiments with each of the six prompt variations, which are shown in the suppl. Section A.1. All experiments are performed on the test splits using a single A100-40GB GPU and we mention inference times in suppl. Section A.2.
|
| 115 |
+
|
| 116 |
+
# 4.1 Age-based impersonation changes exploration strategies
|
| 117 |
+
|
| 118 |
+
In the bandit task, for every age group that the LLM impersonates, we perform $2 \mathrm { k }$ two-armed bandit games of 10 trials each for each prompt variation. We evaluate the task performance in three ways.
|
| 119 |
+
|
| 120 |
+
First, we show the average reward per trial the LLM obtained with personas of increasing age in Figure 2 (top). With an increasing number of trials, the LLM obtains a higher average reward, corroborating that Vicuna-13B is able to learn from past trials to improve its policy similarly to GPT-3 in [8]. Moreover, as the LLM takes on a persona of different ages, we observe a divergence of obtained rewards as the number of trials increases. Younger personas, i.e., 2- and 4-year-old personas, obtain a smaller reward than older ones, i.e., 13- and 20-year-old personas.
|
| 121 |
+
|
| 122 |
+
Secondly, we analyze the resulting rewards by using a regression, entering the trial number and age as independent variables. To extend the analysis, we evaluate two age groups, from 2 to 20 and from 20 to 60, where we evaluate ages in steps of 2 between 2 and 30 and steps of 5 from 30 to 60. We report these results in Figure 2 (bottom left). We find that the impersonating LLMs generally improved over trials, i.e. they increase their rewards as they progressed over trials of a game $\beta = 0 . 6 3$ , $p ~ < ~ . 0 0 1$ for ages 2–20 and $\beta ~ = ~ 0 . 6 0$ , $p ~ < ~ . 0 0 1$ for ages $^ { 2 0 - }$ 60). Importantly, LLMs impersonating older participants generate higher average rewards until age 20 $\beta = 0 . 1 7$ $p \ < \ . 0 0 1 )$ , thereby replicating a general pattern found in the developmental literature [70]. We find no significant effect from ages 20–60, which also mirrors observations of stagnating mental performance of adults.
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
Figure 2: Two-armed bandit task. Top: Average reward per persona (10k games of 10 trials), left: Age and # of trials have a positive effect on the expected reward, right: With age, exploration decreases, and exploitation increases.
|
| 126 |
+
|
| 127 |
+
Lastly, we analyze how regression weights of the probit-regression were influenced by the age group the LLM is impersonating, again analyzing ages 2–20 and 20–60. Figure 2 (bottom right) reveals that LLMs pretending to be older explored their environment less $\beta = - 0 . 0 3$ , $p < . 0 0 1 ,$ ) and exploited more $\beta = 0 . 0 4$ , $p < . 0 0 1 $ in the ages between 2–20. This pattern is in line with several results from the psychological literature which also found that children show higher levels of directed exploration [71] than adults [72]. These results suggest that impersonating LLMs can recover human-like developmental stages of exploration in a two-armed bandit task. If life is seen as an exploration-exploitation problem, then younger agents should show higher amounts of directed exploration [73, 74]. To the best of our knowledge we are the first to show that LLMs replicate similar trends when using in-context impersonation.
|
| 128 |
+
|
| 129 |
+
# 4.2 Expertise-based impersonation changes reasoning abilities
|
| 130 |
+
|
| 131 |
+
Our experiments on expertise-based impersonation (details in Section 3.3) are conducted on the MMLU dataset [67], for which we ask Vicuna-13B to impersonate experts from three different categories (task, domain, and non-domain). For each task we compute the task accuracy averaged over all task questions $9 5 \%$ confidence intervals are computed over the average task accuracy). We compare the task expert results with the average of all domain expert personas, the average of all non-domain expert personas, the average of all neutral personas, and the random baseline (horizontal line). We consider four neutral personas, namely student, average student, person, and average person, and the six aforementioned prompt variations.
|
| 132 |
+
|
| 133 |
+

|
| 134 |
+
Figure 3: Expertise-based impersonation on all domains of the MMLU reasoning benchmark (top) and on exemplary individual tasks (bottom). For each task, we consider four personas: the neutral, the task expert, the domain experts (all experts from the same domain except the task expert) and the nondomain experts (all experts from all remaining domains). The dashed line is the random baseline.
|
| 135 |
+
|
| 136 |
+
In Figure 3 (top row), as expected, when the LLM is asked to impersonate the task expert, the performance is the highest. This shows that the LLM can indeed impersonate task experts with accuracy higher than random. Similarly, the domain expert personas perform better than the nondomain expert personas. This trend holds for all four MMLU domains and thus for MMLU in its entirety. In general, we observe that the performance in the Humanities tasks is higher than the accuracy in the other domain tasks, which is in line with results reported in the literature [61, 75, 76, 67]. Overall, these results suggest that LLMs can increase their performance when asked to impersonate task experts compared to non-task experts.
|
| 137 |
+
|
| 138 |
+
To provide more details on the individual behaviors of these personas, in the plots on the bottom row of Figure 3, we sample various expert personas, e.g. three positive and one negative case. The first, second and last plots indicate that the task expert persona performs better than the domain expert persona, which, in turn, outperforms the non-domain expert persona. In those cases, all experts outperform the neutral persona. For the High School Macroeconomics task, the task expert persona performs close to random and to the non-domain expert persona. This may be because, as Hendrycks et al. [67] observed, LLMs tend to perform worse on procedural problems that are calculation-heavy compared to purely verbal tasks. Furthermore, when the LLM performs close to or below the random baseline, i.e. the task is more difficult to solve for all types of experts, the impersonation trends are not as clear, since the model does not know how to solve the task well, irrespective of the persona. Thus, while in the Social Sciences field, the High School Macroeconomics task has worse performance, we see that for World Religions, the exam result is higher than $60 \%$ , i.e. a passing grade. Especially for World Religions and Human Aging, we observe that the task expert performs much better than the corresponding domain expert personas. We show results for all tasks in Section C.1 of the suppl.
|
| 139 |
+
|
| 140 |
+
Finally, since several MMLU evaluations [67, 77], can lead to small variations when comparing different models’, we include results with the MMLU official prompt in suppl. Section C.2, where we verify that our findings on impersonation are not dependent on the formulation of the task. Lastly, we also show MMLU results for social groups in C.3.
|
| 141 |
+
|
| 142 |
+
# 4.3 Impersonation as categorical descriptions is complementary for visual categorization
|
| 143 |
+
|
| 144 |
+
In this section, we provide experimental results on two state-of-the-art fine-grained visual categorization datasets, i.e. Caltech UCSD Birds (CUB) [78] and Stanford Cars [79], with 200 and 196 classes of birds and cars, respectively. Additional results for FGVC Aircraft [80] and Oxford Flowers [81] can be found in Section D.2 of the supplementary. We first compare how different VLMs make use of the generated descriptions, then compare different LLMs in our in-context impersonation tasks and finally provide some qualitative results.
|
| 145 |
+
|
| 146 |
+
Comparing VLM variants. We first compare the classification accuracy of different VLMs when the Vicuna-13B generated descriptions of classes are fed to the language encoder of the VLM. For the vision encoders we consider the Vision Transformer (ViT) [82] based B/32 and B/16 variants of the official CLIP implementation [56] as well as the OpenCLIP B/32 ViT variant [68]. The latter is a replication of the original CLIP trained on a larger dataset (Laion 5B [83]). For each CLIP variant, we use the corresponding causal transformer text encoders, which might not encode text as well as Vicuna but are able to embed the text into a shared multi-modal space.
|
| 147 |
+
|
| 148 |
+

|
| 149 |
+
Figure 4: Comparing CLIP-32, CLIP-16 and OpenCLIP as VLMs (the language input comes from Vicuna-13B) on CUB (top) and Stanford Cars (bottom) datasets. We observe the effects of age, expertise, ethnicity and gender independent of the VLM used for fine-grained visual classification. The dashed line represents the random baseline.
|
| 150 |
+
|
| 151 |
+
Our results in Figure 4 show that across all three CLIP variants increased age in the impersonated persona increases performance for both bird and car classification. Interestingly, there is a significant increase in performance at 7 years of age when recognizing cars. Our expertise evaluation shows that the car mechanic persona’s descriptions performs better than ornithologist’s when recognizing cars. Interestingly, racial (column 3) and gender (column 4) personas, reveal consistent biases. While the black performs better in car classification, the white performs better in bird classification. This may indicate that there are stereotypical biases in the training data. Similarly, while the woman performs clearly better than man for bird classification, the trend is not as strong for car classification although man performs slightly better than woman. The language encoder of VLMs potentially being weaker than Vicuna, we expect these results to improve overall with a stronger language encoder in the VLM but this is an orthogonal direction to explore. To confirm the significance of our results, we run $\mathrm { C h i ^ { 2 } }$ tests for expertise, race and gender. We consider the three CLIP models, five different seeds and the six different impersonation prompt variations. We find that for all experiments considered, {CUB, Stanford Cars} x {man/woman, black/white, ornithologist/car mechanic}, $\mathrm { p { < } 0 . 0 0 1 }$ . Thus, we conclude that our results are significant.
|
| 152 |
+
|
| 153 |
+
We also investigate the effects of composing personas for a computationally feasible subset of persons. More specifically, we study all possible combinations of {Black, White} $\times$ {Female, Male} for the CUB dataset for 5 different seeds (Figure 6). With Vicuna-13B we see weak evidence that the biases co-construct: Individually the white persona outperforms the black persona and the same applies to the female persona outperforming the male persona. Combined, the white female persona outperforms both the black female persona (change in race) and the white male persona (change in gender). Furthermore, we also study performance of additional genders (agender and non-binary) and races (indian, asian and hispanic) in the suppl. in Section D.5.
|
| 154 |
+
|
| 155 |
+

|
| 156 |
+
Figure 6: Composition of personas on CUB for Vicuna-13B.
|
| 157 |
+
|
| 158 |
+
Comparing LLM variants We evaluate how different LLMs, namely Vicuna-13B and ChatGPT, generate descriptions of the classes of interest. In these experiments, we keep the VLM fixed to OpenCLIP, as it is the best of the CLIP variants tested above. For computational reasons, we only evaluate on our original impersonation prompt. Figure 5 shows the effect of LLM impersonation on the generated descriptions evaluated on zero-shot image classification.
|
| 159 |
+
|
| 160 |
+

|
| 161 |
+
Figure 5: Comparing Vicuna-13B and ChatGPT as LLM variants (OpenCLIP is the VLM) on CUB and Stanford Cars. For both LLMs, the accuracy increases with increasing age, the expert persona on the respective dataset performs better and both LLMs are not free of biases, and impersonation of different genders or race affects their performance. The dashed line represents the random baseline.
|
| 162 |
+
|
| 163 |
+
For the age personas, we observe a clear trend of increased performance for both LLMs as they impersonate older characters. The progression is particularly pronounced for ChatGPT, where on Stanford Cars the 2-year-old persona describes different cars with similar expressions leading to $\sim 4 \%$ accuracy, but as ChatGPT’s persona gets older, it becomes more accurate in describing cars, e.g. $5 4 . 9 \%$ for persona of age 20. This indicates that LLMs can replicate human language at different development stages, varying their language both in terms of vocabulary and general knowledge for accurately describing these objects as discussed in [84]. Similarly to the reasoning task, LLMs exhibit higher expertise on the topic when we ask them to impersonate a bird expert (“ornithologist” persona) and a car expert (“car mechanic” persona). The respective domain expert persona performs approximately twice as well as the non-domain expert persona when using ChatGPT. Impersonating an expert, the LLM tends to describe a class in more detail and mention more discriminative features.
|
| 164 |
+
|
| 165 |
+
We also observe that impersonation can reveal biases encoded in the LLMs. A race bias becomes apparent when we ask the LLMs to impersonate a “black” or “white” person. ChatGPT tends to describe both birds and cars better when posing as a white person. Vicuna-13B, on the other hand, provides better descriptions of cars as a black person. Gender biases are a bit less noticeable, but we still find Vicuna-13B giving better bird descriptions as a woman persona and ChatGPT identifying cars better as a man persona. While instruction-based fine-tuning [64] tries to remedy social biases encoded in LLMs to some extent, we can still expose them through in-context impersonation.
|
| 166 |
+
|
| 167 |
+
Overall, we find that ChatGPT shows larger effects, probably due to its access to more diverse (finetuning) data. The fact that the effects described above can be found with two very different language models suggests that they are a result of the overall language modeling and instruction following training on internet data instead of specific model artifacts.
|
| 168 |
+
|
| 169 |
+
Qualitative results and limitations. In Figure 7, we provide the descriptions generated by ChatGPT and Vicuna for one class, i.e. black billed cuckoo, from the CUB dataset and one class, i.e. AM General Hummer SUV 2000, from the Stanford Cars dataset. As personas, we sample all the age personas we considered in our experiments, namely 2, 4, 7, 13 and 20-year-old personas.
|
| 170 |
+
|
| 171 |
+
For both LLMs, in both datasets, we observe that with increasing age, the complexity of the vocabulary and attributes of the mentioned objects increases. A 2-year-old persona talks about the sound the bird or the car makes, the shapes of the wings or wheels, and the emotions attached to seeing or riding it. A 4-year-old persona interestingly mentions experiences seeing the bird or the car more distinctly. A 7-year-old persona starts using more complicated adjective phrases, e.g. can drive on rough roads and outside places, whereas a 13-year-old persona takes it one step further, e.g. brownish-gray body with distinctive rusty colored markings. Finally, a 20-year-old persona makes a more complete description of the object including where the bird is found or what the car is mainly used for. This is in line with [85] where the authors show that given the same length of text, smaller children use less diverse and non-academic vocabulary, and repeat a lot. Even though LLM’s may not faithfully represent the language of children, we qualitatively observe similar patterns. We show more examples and quantize the properties of the generated descriptions in suppl. Section D.3.
|
| 172 |
+
|
| 173 |
+

|
| 174 |
+
Figure 7: Qualitative results sampling all the age personas (2, 4, 7, 13 and 20-year-old personas) for two classes, i.e. Black Billed Cuckoo (CUB) and AM General Hummer SUV 2000 (Stanford Cars) classes. The results are obtained by querying ChatGPT and Vicuna.
|
| 175 |
+
|
| 176 |
+
One obvious difference between these two LLMs to point out is that the descriptions obtained from Vicuna appear to be longer and more detailed. Further, at earlier ages, e.g. 2 or 4, especially on a bird that goes "cuckoo". It has a black bill and likes to eat bugs. It can A bird that is black and has a curved bill. Answer: It is … 2 CUB, the descriptions of Vicuna seem poetic. The difference between the semantic content of the fly and live in trees. It makes a funny sound that makes me laugh. It's a bird! It's really cool! It's got a special tail. It's black and white.It's got a long beak. It's a old CUB descriptions of the 13-year-old persona and the 20-year-old persona seems to be less distinct in trees. Sometimes it makes a sound that sounds like "coo-coo"! It's a bird that's really cool! It's black with a bill that's rule! It flies around and sings so sweet. It's black billed cuckoo 4 year oldVicuna than in ChatGPT. One final interesting observation is that Vicuna descriptions talk about the a bird that has a black beak and is called a cuckoo. It likes to eat insects and lives in North America. They lay their eggs in other bird's nests and let one of my favorite birds to meet! 7 year color of the car whereas the color can not be a distinguishing property of a car.
|
| 177 |
+
|
| 178 |
+
# distinctive "coo-coo-coo" call a bird species found in North Aold 20 5 Broader Impact
|
| 179 |
+
|
| 180 |
+
a big car that goes vroom vroom and can go over rocks and bumps. It has big wheels and is fun to ride in. It is a big car that can go off-road. It has four wheels and a strong engine. It is red and black. 2 year We believe that a better understanding of in-context impersonation, as well as its resulting downIt is a big car that can go off-road. It has four wheels and a strong engine. It is red and black and has a lot of buttons and controls in the front. It is fun to ride in and can go really fast! 4 stream effects, can not only help to mitigate the risk of fraud but also to understand how these really tough and strong, like a superhero car! hummer suv It is a type of car that is like a big truck but still has four wheels and can drive on roads like a regular old newly-powerful agents behave more generally [86]. We have already seen that in-context impersona big and strong car that can drive on rough roads and outside places. It looks like a military vehicle and can hold lots of people inside. It is really car. It is made by a company called AM General and was first made in the year 2000. It is pretty big and can hold a lot of people or things inside. It is often used for driving in rough or off-road environments. 7 year old ation boosts performance and produces biases; these results could be followed up by investigating cool! a really cool and tough-looking SUV that was made by AM General in the year It is a type of sport utility vehicle (SUV) that was manufactured by the American automaker AM General in the year 2000. It is known for its rugged appearance and off-road capabilities. The Hummer SUV was popular in the 13 how these characteristics emerge during training, change with increasing model size [87], or adapt 2000. It's known for being able to go off-road and handle all kinds of terrain. early 2000s, but production of the vehicle stopped in 2010 due to declining sales and environmental concerns. old with additional fine-tuning [88]. Additionally, LLM providers could quantitatively test for these a large, military-style SUV designed for off-road use. It was popular in the early 2000s and known for its ruggedness and unique styling. However, it is It is a compact SUV that was manufactured by American Motors (AM) from 2000 to 2006. It was known for its rugged exterior and spacious interior, and was popular among both civilians and military personnel. It was 20 year biases before releasing new models. We specifically discourage crafting (system) prompts for maximaneuver in tight spaces or on city streets. camping. It had a V8 engine and was available in various trim levels. mal performance by exploiting biases, as this may have unexpected side effects, reinforce societal biases and poison training data obtained with such prompts. Other misuses may include amplification of stereotypical biases through generated content and using impersonation to invoke fake trust. However, we believe systematically studying these biases raises awareness in the ML community and general society and serves as a first step to research mitigation strategies. Lastly, we discuss limitations of our work in suppl. Section E.
|
| 181 |
+
|
| 182 |
+
# 6 Conclusion
|
| 183 |
+
|
| 184 |
+
We presented evidence that in-context impersonation, that is asking LLMs to take on different roles in context, can change their performance and reveal their biases. Asking LLMs to impersonate differently aged people in a two-armed bandit task, LLMs could reproduce human-like developmental stages of exploration behavior. Asking LLMs to impersonate domain experts, they performed better than LLMs that were asked to impersonate a non-domain expert. Finally, asking LLMs to impersonate various roles in a vision-language task revealed not only that impersonation can boost relative performance but also recovered societal biases about a person’s age, gender, and race.
|
| 185 |
+
|
| 186 |
+
We have demonstrated the effects of in-context impersonation on single agents performing relatively simple tasks across a limited range of personas. In future work, we want to scale up this approach to multiple LLMs impersonating a variety of personas across complex and interactive tasks [89]. Finally, we believe that in-context impersonation can also be applied to other modalities, for example to large models for video generation [90].
|
| 187 |
+
|
| 188 |
+
# 7 Acknowledgements
|
| 189 |
+
|
| 190 |
+
The authors thank IMPRS-IS for supporting Leonard Salewski. This work was partially funded by the Portuguese Foundation for Science and Technology (FCT) under PhD grant 2020.07034.BD, the Max Planck Society, the Volkswagen Foundation, the BMBF Tübingen AI Center (FKZ: 01IS18039A), DFG (EXC number 2064/1 – Project number 390727645) and ERC (853489-DEXIM).
|
| 191 |
+
|
| 192 |
+
# References
|
| 193 |
+
|
| 194 |
+
[1] 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. NeurIPS, 2020.
|
| 195 |
+
[2] Taylor Webb, Keith J Holyoak, and Hongjing Lu. Emergent analogical reasoning in large language models. arXiv:2212.09196, 2022.
|
| 196 |
+
[3] Jason Wei, Yi Tay, Rishi Bommasani, Colin Raffel, Barret Zoph, Sebastian Borgeaud, Dani Yogatama, Maarten Bosma, Denny Zhou, Donald Metzler, Ed H. Chi, Tatsunori Hashimoto, Oriol Vinyals, Percy Liang, Jeff Dean, and William Fedus. Emergent abilities of large language models. TMLR, 2022.
|
| 197 |
+
[4] Enkelejda Kasneci, Kathrin Seßler, Stefan Küchemann, Maria Bannert, Daryna Dementieva, Frank Fischer, Urs Gasser, Georg Groh, Stephan Günnemann, Eyke Hüllermeier, et al. Chatgpt for good? on opportunities and challenges of large language models for education. Learning and Individual Differences, 103, 2023. [5] Rishi Bommasani, Drew A Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, et al. On the opportunities and risks of foundation models. arXiv:2108.07258, 2021.
|
| 198 |
+
[6] Alex Tamkin, Miles Brundage, Jack Clark, and Deep Ganguli. Understanding the capabilities, limitations, and societal impact of large language models. arXiv:2102.02503, 2021.
|
| 199 |
+
[7] Emily M Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell. On the dangers of stochastic parrots: Can language models be too big? In ACM FAccT, 2021.
|
| 200 |
+
[8] Marcel Binz and Eric Schulz. Using cognitive psychology to understand gpt-3. PNAS, 120(6), 2023.
|
| 201 |
+
[9] Jonathan Pilault, Raymond Li, Sandeep Subramanian, and Christopher Pal. On extractive and abstractive neural document summarization with transformer language models. In EMNLP, 2020.
|
| 202 |
+
[10] 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 NeurIPS, 2022.
|
| 203 |
+
[11] Sewon Min, Xinxi Lyu, Ari Holtzman, Mikel Artetxe, Mike Lewis, Hannaneh Hajishirzi, and Luke Zettlemoyer. Rethinking the role of demonstrations: What makes in-context learning work? In EMNLP, 2022.
|
| 204 |
+
[12] Sang Michael Xie, Aditi Raghunathan, Percy Liang, and Tengyu Ma. An explanation of in-context learning as implicit bayesian inference. In ICLR, 2022.
|
| 205 |
+
[13] Ameet Deshpande, Vishvak Murahari, Tanmay Rajpurohit, Ashwin Kalyan, and Karthik Narasimhan. Toxicity in chatgpt: Analyzing persona-assigned language models. arXiv:2304.05335, 2023.
|
| 206 |
+
[14] Shuai Wang, Harrisen Scells, Bevan Koopman, and Guido Zuccon. Can chatgpt write a good boolean query for systematic review literature search? arXiv:2302.03495, 2023.
|
| 207 |
+
[15] Katherine Elkins and Jon Chun. Can gpt-3 pass a writer’s turing test? Journal of Cultural Analytics, 5(2), 2020.
|
| 208 |
+
[16] Marcel Binz and Eric Schulz. Modeling human exploration through resource-rational reinforcement learning. In NeurIPS, 2022.
|
| 209 |
+
[17] Andrew Lampinen, Ishita Dasgupta, Stephanie Chan, Kory Mathewson, Mh Tessler, Antonia Creswell, James McClelland, Jane Wang, and Felix Hill. Can language models learn from explanations in context? In EMNLP. ACL, 2022.
|
| 210 |
+
[18] Simran Arora, Avanika Narayan, Mayee F Chen, Laurel Orr, Neel Guha, Kush Bhatia, Ines Chami, and Christopher Re. Ask me anything: A simple strategy for prompting language models. In ICLR, 2023.
|
| 211 |
+
[19] Yongchao Zhou, Andrei Ioan Muresanu, Ziwen Han, Keiran Paster, Silviu Pitis, Harris Chan, and Jimmy Ba. Large language models are human-level prompt engineers. In NeurIPS Workshops, 2022.
|
| 212 |
+
[20] Timo Schick and Hinrich Schütze. Exploiting cloze-questions for few-shot text classification and natural language inference. In EACL, 2021.
|
| 213 |
+
[21] Victor Sanh, Albert Webson, Colin Raffel, Stephen Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Arun Raja, Manan Dey, M Saiful Bari, Canwen Xu, Urmish Thakker, Shanya Sharma Sharma, Eliza Szczechla, Taewoon Kim, Gunjan Chhablani, Nihal Nayak, Debajyoti Datta, Jonathan Chang, Mike Tian-Jian Jiang, Han Wang, Matteo Manica, Sheng Shen, Zheng Xin Yong, Harshit Pandey, Rachel Bawden, Thomas Wang, Trishala Neeraj, Jos Rozen, Abheesht Sharma, Andrea Santilli, Thibault Alexander M Rush. Multitask prompted training enables zero-shot task generalization. In ICLR, 2022.
|
| 214 |
+
[22] Yaqing Wang, Quanming Yao, James T Kwok, and Lionel M Ni. Generalizing from a few examples: A survey on few-shot learning. ACM computing surveys, 53(3), 2020.
|
| 215 |
+
[23] Yongqin Xian, Christoph H Lampert, Bernt Schiele, and Zeynep Akata. Zero-shot learning—a comprehensive evaluation of the good, the bad and the ugly. TPAMI, 41(9), 2018.
|
| 216 |
+
[24] Zheng Yuan, Hongyi Yuan, Chuanqi Tan, Wei Wang, and Songfang Huang. How well do large language models perform in arithmetic tasks? arXiv:2304.02015, 2023.
|
| 217 |
+
[25] Emre Kıcıman, Robert Ness, Amit Sharma, and Chenhao Tan. Causal reasoning and large language models: Opening a new frontier for causality. arXiv:2305.00050, 2023.
|
| 218 |
+
[26] Laria Reynolds and Kyle McDonell. Prompt programming for large language models: Beyond the few-shot paradigm. In CHI, 2021.
|
| 219 |
+
[27] Taylor Shin, Yasaman Razeghi, Robert L. Logan IV, Eric Wallace, and Sameer Singh. AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated Prompts. In EMNLP, 2020.
|
| 220 |
+
[28] Nathan Hunter. The art of prompt engineering with chatGPT. eBook, 2023.
|
| 221 |
+
[29] Jonas Oppenlaender, Rhema Linder, and Johanna Silvennoinen. Prompting ai art: An investigation into the creative skill of prompt engineering. arXiv:2303.13534, 2023.
|
| 222 |
+
[30] Seungju Han, Beomsu Kim, Jin Yong Yoo, Seokjun Seo, Sangbum Kim, Enkhbayar Erdenee, and Buru Chang. Meet your favorite character: Open-domain chatbot mimicking fictional characters with only a few utterances. In NAACL-HLT, 2022.
|
| 223 |
+
[31] Nitish Shirish Keskar, Bryan McCann, Lav R Varshney, Caiming Xiong, and Richard Socher. Ctrl: A conditional transformer language model for controllable generation. arXiv:1909.05858, 2019.
|
| 224 |
+
[32] Murray Shanahan, Kyle McDonell, and Laria Reynolds. Role-play with large language models. ArXiv:2305.16367, 2023.
|
| 225 |
+
[33] Zichao Yang, Zhiting Hu, Chris Dyer, Eric P Xing, and Taylor Berg-Kirkpatrick. Unsupervised text style transfer using language models as discriminators. NeurIPS, 2018.
|
| 226 |
+
[34] Katherine Crowson, Stella Rose Biderman, Daniel Kornis, Dashiell Stander, Eric Hallahan, Louis Castricato, and Edward Raff. Vqgan-clip: Open domain image generation and editing with natural language guidance. In ECCV, 2022.
|
| 227 |
+
[35] 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. In ICML, 2021.
|
| 228 |
+
[36] Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic textto-image diffusion models with deep language understanding. NeurIPS, 2022.
|
| 229 |
+
[37] Nassim Dehouche and Kullathida Dehouche. What’s in a text-to-image prompt? the potential of stable diffusion in visual arts education. Heliyon, 9, 2023.
|
| 230 |
+
[38] Manuel Brack, Patrick Schramowski, Felix Friedrich, Dominik Hintersdorf, and Kristian Kersting. The stable artist: Steering semantics in diffusion latent space. arXiv:2212.06013, 2022.
|
| 231 |
+
[39] Sam Witteveen and Martin Andrews. Investigating prompt engineering in diffusion models. arXiv:2211.15462, 2022.
|
| 232 |
+
[40] Stephanie Lin, Jacob Hilton, and Owain Evans. TruthfulQA: Measuring how models mimic human falsehoods. In ACL, 2022.
|
| 233 |
+
[41] Yotam Wolf, Noam Wies, Yoav Levine, and Amnon Shashua. Fundamental limitations of alignment in large language models. arXiv:2304.11082, 2023.
|
| 234 |
+
[42] Gati Aher, Rosa I Arriaga, and Adam Tauman Kalai. Using large language models to simulate multiple humans. arXiv:2208.10264, 2022.
|
| 235 |
+
[43] Max Pellert, Clemens M Lechner, Claudia Wagner, Beatrice Rammstedt, and Markus Strohmaier. Ai psychometrics: Using psychometric inventories to obtain psychological profiles of large language models. 2023.
|
| 236 |
+
[44] Peter S. Park, Philipp Schoenegger, and Chongyang Zhu. "correct answers" from the psychology of artificial intelligence. arXiv:2302.07267, 2023.
|
| 237 |
+
[45] Saketh Reddy Karra, Son Nguyen, and Theja Tulabandhula. Ai personification: Estimating the personality of language models. arXiv:2204.12000, 2022.
|
| 238 |
+
[46] Julian Coda-Forno, Kristin Witte, Akshay K Jagadish, Marcel Binz, Zeynep Akata, and Eric Schulz. Inducing anxiety in large language models increases exploration and bias. arXiv:2304.11111, 2023.
|
| 239 |
+
[47] Ricardo Dominguez-Olmedo, Moritz Hardt, and Celestine Mendler-Dunner. Questioning the survey responses of large language models. arXiv:2306.07951, 2023.
|
| 240 |
+
[48] Lisa P. Argyle, Ethan C. Busby, Nancy Fulda, Joshua R. Gubler, Christopher Rytting, and David Wingate. Out of one, many: Using language models to simulate human samples. Political Analysis, 2023.
|
| 241 |
+
[49] Hang Jiang, Xiajie Zhang, Xubo Cao, Jad Kabbara, and Deb Roy. Personallm: Investigating the ability of gpt-3.5 to express personality traits and gender differences. arXiv:2305.02547, 2023.
|
| 242 |
+
[50] Gati Aher, RosaI. Arriaga, and Adam Tauman Kalai. Using large language models to simulate multiple humans and replicate human subject studies. In ICML, 2022. corpora contain human-like biases. Science, 356(6334), 2017.
|
| 243 |
+
[52] Abubakar Abid, Maheen Farooqi, and James Zou. Persistent anti-muslim bias in large language models. In AAAI/ACM AEIS, 2021.
|
| 244 |
+
[53] Daniel Kang, Xuechen Li, Ion Stoica, Carlos Guestrin, Matei Zaharia, and Tatsunori Hashimoto. Exploiting programmatic behavior of llms: Dual-use through standard security attacks. arXiv:2302.05733, 2023.
|
| 245 |
+
[54] Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc V. Le, Yun-Hsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. In ICML, 2021.
|
| 246 |
+
[55] Amanpreet Singh, Ronghang Hu, Vedanuj Goswami, Guillaume Couairon, Wojciech Galuba, Marcus Rohrbach, and Douwe Kiela. FLAVA: A foundational language and vision alignment model. In CVPR, 2022.
|
| 247 |
+
[56] 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 ICML, 2021.
|
| 248 |
+
[57] Sachit Menon and Carl Vondrick. Visual classification via description from large language models. In ICLR, 2023.
|
| 249 |
+
[58] Yue Yang, Artemis Panagopoulou, Shenghao Zhou, Daniel Jin, Chris Callison-Burch, and Mark Yatskar. Language in a bottle: Language model guided concept bottlenecks for interpretable image classification. arXiv:2211.11158, 2022.
|
| 250 |
+
[59] Zhengyuan Yang, Zhe Gan, Jianfeng Wang, Xiaowei Hu, Yumao Lu, Zicheng Liu, and Lijuan Wang. An empirical study of GPT-3 for few-shot knowledge-based VQA. In AAAI, 2022.
|
| 251 |
+
[60] Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E Gonzalez, et al. Vicuna: An open-source chatbot impressing gpt-4 with $9 0 \% *$ chatgpt quality, 2023.
|
| 252 |
+
[61] Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv:2302.13971, 2023.
|
| 253 |
+
[62] Dom Eccleston. ShareGPT: Share your wildest conversations with one click. https://sharegpt.com/, 2023. [Online; accessed 15-May-2023].
|
| 254 |
+
[63] Lianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric P. Xing, Haotong Zhang, Joseph Gonzalez, and Ion Stoica. Judging llm-as-a-judge with mt-bench and chatbot arena. arXiv:2306.05685, 2023.
|
| 255 |
+
[64] Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. NeurIPS, 2022.
|
| 256 |
+
[65] Samuel J Gershman. Deconstructing the human algorithms for exploration. Cognition, 173, 2018.
|
| 257 |
+
[66] Eric Schulz and Samuel J Gershman. The algorithmic architecture of exploration in the human brain. Current opinion in neurobiology, 55, 2019.
|
| 258 |
+
[67] Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. In ICLR, 2021.
|
| 259 |
+
[68] Mehdi Cherti, Romain Beaumont, Ross Wightman, Mitchell Wortsman, Gabriel Ilharco, Cade Gordon, Christoph Schuhmann, Ludwig Schmidt, and Jenia Jitsev. Reproducible scaling laws for contrastive language-image learning. arXiv:2212.07143, 2022.
|
| 260 |
+
[69] Simran Arora, Avanika Narayan, Mayee F. Chen, Laurel J. Orr, Neel Guha, Kush S Bhatia, Ines Chami, Frederic Sala, and Christopher R’e. Ask me anything: A simple strategy for prompting language models. arXiv:2210.02441, 2022.
|
| 261 |
+
[70] Kate Nussenbaum and Catherine A Hartley. Reinforcement learning across development: What insights can we draw from a decade of research? Developmental cognitive neuroscience, 40, 2019.
|
| 262 |
+
[71] Emily G. Liquin and Alison Gopnik. Children are more exploratory and learn more than adults in an approach-avoid task. Cognition, 218, 2020.
|
| 263 |
+
[72] Eric Schulz, Charley M Wu, Azzurra Ruggeri, and Björn Meder. Searching for rewards like a child means less generalization and more directed exploration. Psychological science, 30(11), 2019.
|
| 264 |
+
[73] Anna P. Giron, Simon Ciranka, Eric Schulz, Wouter van den Bos, Azzurra, Ruggeri, Björn Meder, and Charley M. Wu. Developmental changes in learning resemble stochastic optimization. 2022.
|
| 265 |
+
[74] Nathaniel J. Blanco and Vladimir M. Sloutsky. Systematic exploration and uncertainty dominate young children’s choices. Developmental science, 2019.
|
| 266 |
+
[75] Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv:2204.02311, 2022.
|
| 267 |
+
[76] Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, et al. Training compute-optimal large language models. arXiv:2203.15556, 2022.
|
| 268 |
+
[77] 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’e, Diana Acosta-Navas, Drew A. Hudson, E. Zelikman, Esin Durmus, Faisal Ladhak, Frieda Rong, Hongyu Ren, Huaxiu Yao, Jue Wang, Keshav Santhanam, Laurel J. Orr, Lucia Zheng, Mert Yuksekgonul, Mirac Suzgun, Nathan S. Kim, Neel Guha, Niladri S. Chatterji, Omar Khattab, Peter Henderson, Qian Huang, Ryan Chi, Sang Michael Xie, Shibani Santurkar, Surya Ganguli, Tatsunori Hashimoto, Thomas F. Icard, Tianyi Zhang, Vishrav Chaudhary, William Wang, Xuechen Li, Yifan Mai, Yuhui Zhang, and Yuta Koreeda. Holistic evaluation of language models. Annals of the New York Academy of Sciences, 1525, 2023.
|
| 269 |
+
[78] Catherine Wah, Steve Branson, Peter Welinder, Pietro Perona, and Serge J. Belongie. The caltech-ucsd birds-200-2011 dataset. 2011.
|
| 270 |
+
[79] Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3d object representations for fine-grained categorization. ICCV Workshops, 2013.
|
| 271 |
+
[80] S. Maji, J. Kannala, E. Rahtu, M. Blaschko, and A. Vedaldi. Fine-grained visual classification of aircraft. Technical report, 2013.
|
| 272 |
+
[81] Maria-Elena Nilsback and Andrew Zisserman. Automated flower classification over a large number of classes. In Indian Conference on Computer Vision, Graphics and Image Processing, 2008.
|
| 273 |
+
[82] 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.
|
| 274 |
+
[83] Christoph Schuhmann, Romain Beaumont, Richard Vencu, Cade Gordon, Ross Wightman, Mehdi Cherti, Theo Coombes, Aarush Katta, Clayton Mullis, Mitchell Wortsman, Patrick Schramowski, Srivatsa Kundurthy, Katherine Crowson, Ludwig Schmidt, Robert Kaczmarczyk, and Jenia Jitsev. Laion-5b: An open large-scale dataset for training next generation image-text models. arXiv:2210.08402, 2022.
|
| 275 |
+
[84] John Ed Oates and Andrew Ed Grayson. Cognitive and language development in children. Open University Press, 2004.
|
| 276 |
+
[85] Philip Durrant and Mark Brenchley. Development of vocabulary sophistication across genres in english children’s writing. Springer Reading Writing, 32, 2019.
|
| 277 |
+
[86] Ryan Burnell, Wout Schellaert, John Burden, Tomer D Ullman, Fernando Martinez-Plumed, Joshua B Tenenbaum, Danaja Rutar, Lucy G Cheke, Jascha Sohl-Dickstein, Melanie Mitchell, et al. Rethink reporting of evaluation results in ai. Science, 380(6641), 2023.
|
| 278 |
+
[87] 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:2001.08361, 2020.
|
| 279 |
+
[88] Daniel M Ziegler, Nisan Stiennon, Jeffrey Wu, Tom B Brown, Alec Radford, Dario Amodei, Paul Christiano, and Geoffrey Irving. Fine-tuning language models from human preferences. arXiv:1909.08593, 2019.
|
| 280 |
+
[89] Joon Sung Park, Joseph C O’Brien, Carrie J Cai, Meredith Ringel Morris, Percy Liang, and Michael S Bernstein. Generative agents: Interactive simulacra of human behavior. arXiv:2304.03442, 2023.
|
| 281 |
+
[90] Yi Wang, Kunchang Li, Yizhuo Li, Yinan He, Bingkun Huang, Zhiyu Zhao, Hongjie Zhang, Jilan Xu, Yi Liu, Zun Wang, et al. Internvideo: General video foundation models via generative and discriminative learning. arXiv:2212.03191, 2022.
|
md/dev/CuV_qYkmKb3/CuV_qYkmKb3.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/CzceR82CYc/CzceR82CYc.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/DAxQXzdq8SF/DAxQXzdq8SF.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/FKXVK9dyMM/FKXVK9dyMM.md
ADDED
|
@@ -0,0 +1,378 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LIGHTGCL: SIMPLE YET EFFECTIVE GRAPH CON-TRASTIVE LEARNING FOR RECOMMENDATION
|
| 2 |
+
|
| 3 |
+
Xuheng Cai Chao Huang∗ Lianghao Xia Xubin Ren Department of Computer Science, University of Hong Kong {rickcai, lhaoxia}@hku.hk chaohuang75gmail.com
|
| 4 |
+
|
| 5 |
+
xubinrencs@gmail.com
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Graph neural network (GNN) is a powerful learning approach for graph-based recommender systems. Recently, GNNs integrated with contrastive learning have shown superior performance in recommendation with their data augmentation schemes, aiming at dealing with highly sparse data. Despite their success, most existing graph contrastive learning methods either perform stochastic augmentation (e.g., node/edge perturbation) on the user-item interaction graph, or rely on the heuristic-based augmentation techniques (e.g., user clustering) for generating contrastive views. We argue that these methods cannot well preserve the intrinsic semantic structures and are easily biased by the noise perturbation. In this paper, we propose a simple yet effective graph contrastive learning paradigm LightGCL that mitigates these issues impairing the generality and robustness of CL-based recommenders. Our model exclusively utilizes singular value decomposition for contrastive augmentation, which enables the unconstrained structural refinement with global collaborative relation modeling. Experiments conducted on several benchmark datasets demonstrate the significant improvement in performance of our model over the state-of-the-arts. Further analyses demonstrate the superiority of LightGCL’s robustness against data sparsity and popularity bias. The source code of our model is available at https://github.com/HKUDS/LightGCL.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Graph neural networks (GNNs) have shown effectiveness in graph-based recommender systems by extracting local collaborative signals via neighborhood representation aggregation (Wang et al., 2019; Chen et al., 2020b). In general, to learn user and item representations, GNN-based recommenders perform embedding propagation on the user-item interaction graph by stacking multiple message passing layers for exploring high-order connectivity (He et al., 2020; Zhang et al., 2019; Liu et al., 2021a). Most GNN-based collaborative filtering models adhere to the supervised learning paradigm, requiring sufficient quality labelled data for model training. However, many practical recommendation scenarios struggle with the data sparsity issue in learning high-quality user and item representations from limited interaction data (Liu et al., 2021b; Lin et al., 2021). To address the label scarcity issue, the benefits of contrastive learning have been brought into the recommendation for data augmentation (Wu et al., 2021). The main idea of contrastive learning in enhancing the user and item representation is to research the agreement between the generated embedding views by contrasting the defined positive pairs with negative instance counterparts (Xie et al., 2022).
|
| 14 |
+
|
| 15 |
+
While contrastive learning has been shown to be effective in improving the performance of graphbased recommendation methods, the view generators serve as the core part of data augmentation through identifying accurate contrasting samples. Most of current graph contrastive learning (GCL) approaches employ heuristic-based contrastive view generators to maximize the mutual information between the input positive pairs and push apart negative instances(Wu et al., 2021; Yu et al., 2022a; Xia et al., 2022b). To construct perturbed views, SGL (Wu et al., 2021) has been proposed to generate node pairs of positive view by corrupting the structural information of user-item interaction graph using stochastic augmentation strategies, e.g., node dropping and edge perturbation. To improve the graph contrastive learning in recommendation, SimGCL (Yu et al., 2022a) offers embedding augmentation with random noise perturbation. To work on identifying semantic neighbors of nodes (users and items), HCCF (Xia et al., 2022b) and NCL (Lin et al., 2022) are introduced to pursue consistent representations between the structurally adjacent nodes and semantic neighbors. Despite their effectiveness, state-of-the-art contrastive recommender systems suffer from several inherent limitations: i) Graph augmentation with random perturbation may lose useful structural information, which misleads the representation learning. ii) The success of heuristic-guided representation contrasting schemes is largely built upon the view generator, which limits the model generality and is vulnerable to the noisy user behaviors. iii) Most of current GNN-based contrastive recommenders are limited by the over-smoothing issue which leads to indistinguishable representations.
|
| 16 |
+
|
| 17 |
+
In light of the above limitations and challenges, we revisit the graph contrastive learning paradigm for recommendation with a proposed simple yet effective augmentation method LightGCL. In our model, the graph augmentation is guided by singular value decomposition (SVD) to not only distill the useful information of user-item interactions but also inject the global collaborative context into the representation alignment of contrastive learning. Instead of generating two handcrafted augmented views, important semantic of user-item interactions can be well preserved with our robust graph contrastive learning paradigm. This enables our self-augmented representations to be reflective of both user-specific preferences and cross-user global dependencies.
|
| 18 |
+
|
| 19 |
+
Our contributions are highlighted as follows:
|
| 20 |
+
|
| 21 |
+
• In this paper, we enhance the recommender systems by designing a lightweight and robust graph contrastive learning framework to address the identified key challenges pertaining to this task. • We propose an effective and efficient contrastive learning paradigm LightGCL for graph augmentation. With the injection of global collaborative relations, our model can mitigate the issues brought by inaccurate contrastive signals. • Our method exhibits improved training efficiency compared to existing GCL-based approaches. • Extensive experiments on several real-world datasets justify the performance superiority of our LightGCL. In-depth analyzes demonstrate the rationality and robustness of LightGCL.
|
| 22 |
+
|
| 23 |
+
# 2 RELATED WORK
|
| 24 |
+
|
| 25 |
+
Graph Contrastive Learning for Recommendation. A promising line of recent studies has incorporated contrastive learning (CL) into graph-based recommenders, to address the label sparsity issue with self-supervision signals. Particularly, SGL (Wu et al., 2021) and SimGCL (Yu et al., 2022a) perform data augmentation over graph structure and embeddings with random dropout operations. However, such stochastic augmentation may drop important information, which may make the sparsity issue of inactive users even worse. Furthermore, some recent alternative CL-based recommenders, such as HCCF (Xia et al., 2022b) and NCL (Lin et al., 2022), design heuristic-based strategies to construct view for embedding contrasting. Despite their effectiveness, their success heavily relies on their incorporated heuristics (e.g., the number of hyperedges or user clusters) for contrastive view generation, which can hardly be adaptive to different recommendation tasks.
|
| 26 |
+
|
| 27 |
+
Self-Supervised Learning on Graphs. Recently, self-supervised learning (SSL) has advanced the graph learning paradigm by enhancing node representation from unlabeled graph data (Zhu et al., 2021a;b; Velickovic et al., 2019; Hassani & Khasahmadi, 2020; Peng et al., 2020; Zhu et al., 2020; Wu et al., 2022). For example, to improve the predictive SSL paradigm, AutoSSL (Jin et al., 2022) automatically combines multiple pretext tasks for augmentation. Towards the line of contrastive SSL over graph structures, recent efforts focus on designing various graph contrastive learning methods (Yu et al., 2022b; Yin et al., 2022; Zhang et al., 2022; Xia et al., 2022a; Suresh et al., 2021). For instance, SimGRACE Xia et al. (2022a) proposes to generate contrastive views with the GNN encoder perturbations. In AutoGCL Yin et al. (2022), graph view generators are designed to be jointly trained with the graph encoder in an end-to-end way. Additionally, GCA (Zhu et al., 2021b) performs both topology-level and attribute-level data augmentation for contrastive view generation. In this method, important edges and features will be identified for adaptive augmentation. GraphCL (You et al., 2020) generates correlated graph representation views using various augmentation strategies, such as node/edge perturbation and attribute masking.
|
| 28 |
+
|
| 29 |
+

|
| 30 |
+
Figure 1: Overall structure of LightGCL.
|
| 31 |
+
|
| 32 |
+
# 3 METHODOLOGY
|
| 33 |
+
|
| 34 |
+
In this section, we describe our proposed LightGCL framework in detail. LightGCL is a lightweight graph contrastive learning paradigm as illustrated in Fig. 1. Complementary to the GCN backbone (the upper half of the figure) extracting the local graph dependency, the SVD-guided augmentation (the lower half of the figure) empowers the graph contrastive learning with global collaborative relation analysis for learning effective user and item representations.
|
| 35 |
+
|
| 36 |
+
# 3.1 LOCAL GRAPH DEPENDENCY MODELING
|
| 37 |
+
|
| 38 |
+
As a common practice of collaborative filtering, we assign each user $u _ { i }$ and item $v _ { j }$ with an embedding vector $e _ { i } ^ { ( u ) } , e _ { j } ^ { ( v ) } \in \mathbb { R } ^ { d }$ , where $d$ is the embedding size. The collections of all user and item embeddings are defined as $\pmb { { E } } ^ { ( u ) } \in \mathbb { R } ^ { I \times d }$ and $\pmb { { \cal E } } ^ { ( v ) } \in \mathbb { R } ^ { J \times d }$ , where $I$ and $J$ are the number of users and items, respectively. Following Xia et al. (2022b), we adopt a two-layer GCN to aggregate the neighboring information for each node. In layer $l$ , the aggregation process is expressed as follows:
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
\begin{array} { r } { \boldsymbol { z } _ { i , l } ^ { ( u ) } = \sigma ( p ( \tilde { \boldsymbol { A } } _ { i , : } ) \cdot \boldsymbol { E } _ { l - 1 } ^ { ( v ) } ) , \quad \boldsymbol { z } _ { j , l } ^ { ( v ) } = \sigma ( p ( \tilde { \boldsymbol { A } } _ { : , j } ) \cdot \boldsymbol { E } _ { l - 1 } ^ { ( u ) } ) } \end{array}
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
where z(u)i,l and z(v)j,l denote the $l$ -th layer aggregated embedding for user $u _ { i }$ and item $v _ { j }$ . $\sigma ( \cdot )$ represents the LeakyReLU with a negative slope of 0.5. $\tilde { \boldsymbol { \mathcal { A } } }$ is the normalized adjacency matrix, on which we perform the edge dropout denoted as $p ( \cdot )$ , to mitigate the overfitting issue. We implement the residual connections in each layer to retain the original information of the nodes as follows:
|
| 45 |
+
|
| 46 |
+
$$
|
| 47 |
+
\pmb { e } _ { i , l } ^ { ( u ) } = \pmb { z } _ { i , l } ^ { ( u ) } + \pmb { e } _ { i , l - 1 } ^ { ( u ) } , \quad \pmb { e } _ { j , l } ^ { ( v ) } = \pmb { z } _ { j , l } ^ { ( v ) } + \pmb { e } _ { j , l - 1 } ^ { ( v ) }
|
| 48 |
+
$$
|
| 49 |
+
|
| 50 |
+
The final embedding for a node is the sum of its embeddings across all layers, and the inner product between the final embedding of a user $u _ { i }$ and an item $v _ { j }$ predicts $u _ { i }$ ’s preference towards $v _ { j }$ :
|
| 51 |
+
|
| 52 |
+
$$
|
| 53 |
+
\pmb { e } _ { i } ^ { ( u ) } = \sum _ { l = 0 } ^ { L } \pmb { e } _ { i , l } ^ { ( u ) } , \quad \pmb { e } _ { j } ^ { ( v ) } = \sum _ { l = 0 } ^ { L } \pmb { e } _ { j , l } ^ { ( v ) } , \quad \hat { y } _ { i , j } = e _ { i } ^ { ( u ) \top } \pmb { e } _ { j } ^ { ( v ) }
|
| 54 |
+
$$
|
| 55 |
+
|
| 56 |
+
# 3.2 EFFICIENT GLOBAL COLLABORATIVE RELATION LEARNING
|
| 57 |
+
|
| 58 |
+
To empower graph contrastive learning for recommendation with global structure learning, we equip our LightGCL with the SVD scheme (Rajwade et al., 2012; Rangarajan, 2001) to efficiently distill important collaborative signals from the global perspective. Specifically, we first perform SVD on the adjacency matrix $\mathcal { A }$ as $\mathbf { \mathcal { A } } = U S V ^ { \top }$ . Here, $U / V$ is an $I \times I / J \times J$ orthonormal matrix with columns being the eigenvectors of $\mathcal { A }$ ’s row-row $/$ column-column correlation matrix. $_ { s }$ is an $I \times J$ diagonal matrix storing the singular values of $\mathcal { A }$ . The largest singular values are usually associated with the principal components of the matrix. Thus, we truncate the list of singular values to keep the largest q values, and reconstruct the adjacency matrix with the truncated matrices as $\hat { \ b { A } } = \ b { U } _ { q } \ b { S } _ { q } \ b { V } _ { q } ^ { \top }$ , where $U _ { q } \in \mathbb { R } ^ { I \times q }$ and $V _ { q } \in \mathbb { R } ^ { J \times q }$ contain the first $q$ columns of $U$ and $V$ respectively. $S _ { q } \in \mathbb { R } ^ { q \times q }$ is the diagonal matrix of the $q$ largest singular values.
|
| 59 |
+
|
| 60 |
+
The reconstructed matrix $\hat { A }$ is a low-rank approximation of the adjacency matrix $\mathcal { A }$ , for it holds that $r a n k ( { \hat { A } } ) = q$ . The advantages of SVD-based graph structure learning are two-folds. Firstly, it emphasizes the principal components of the graph by identifying the user-item interactions that are important and reliable to user preference representations. Secondly, the generated new graph structures preserve the global collaborative signals by considering each user-item pair. Given the $\hat { A }$ , we perform message propagation on the reconstructed user-item relation graph in each layer:
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\pmb { g } _ { i , l } ^ { ( u ) } = \sigma ( \hat { \mathcal { A } } _ { i , : } \cdot \pmb { E } _ { l - 1 } ^ { ( v ) } ) , \quad \pmb { g } _ { j , l } ^ { ( v ) } = \sigma ( \hat { \mathcal { A } } _ { : , j } \cdot \pmb { E } _ { l - 1 } ^ { ( u ) } )
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
However, performing the exact SVD on large matrices is highly expensive, making it impractical for handling large-scale user-item matrix. Therefore, we adopt the randomized SVD algorithm proposed by Halko et al. (2011), whose key idea is to first approximate the range of the input matrix with a low-rank orthonormal matrix, and then perform SVD on this smaller matrix.
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
\hat { U } _ { q } , \hat { S } _ { q } , \hat { V } _ { q } ^ { \top } = \mathrm { A p p r o x } { \mathrm { S V D } } ( { \cal A } , q ) , \quad \hat { A } _ { S V D } = \hat { U } _ { q } \hat { S } _ { q } \hat { V } _ { q } ^ { \top }
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
where $q$ is the required rank for the decomposed matrices, and $\hat { { \cal U } } _ { q } \in \mathbb { R } ^ { I \times q } , \hat { { \cal S } } _ { q } \in \mathbb { R } ^ { q \times q } , \hat { { \cal V } } _ { q } \in \mathbb { R } ^ { J \times q }$ are the approximated versions of $U _ { q }$ , $S _ { q }$ , $V _ { q }$ . Thus, we rewrite the message propagation rules in Eq. 4 with the approximated matrices and the collective representations of the embeddings as follows:
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
\pmb { G } _ { l } ^ { ( u ) } = \sigma ( \hat { A } _ { S V D } \pmb { E } _ { l - 1 } ^ { ( v ) } ) = \sigma ( \hat { U } _ { q } \hat { S } _ { q } \hat { V } _ { q } ^ { \top } \pmb { E } _ { l - 1 } ^ { ( v ) } ) ; \quad \pmb { G } _ { l } ^ { ( v ) } = \sigma ( \hat { A } _ { S V D } ^ { \top } \pmb { E } _ { l - 1 } ^ { ( u ) } ) = \sigma ( \hat { V } _ { q } \hat { S } _ { q } \hat { U } _ { q } ^ { \top } \pmb { E } _ { l - 1 } ^ { ( u ) } )
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
where $G _ { l } ^ { ( u ) }$ and $G _ { l } ^ { ( v ) }$ are the collections of user and item embeddings encoded from the new generated graph structure view. Note that we do not need to compute and store the large dense matrix $\hat { \boldsymbol { \mathcal { A } } } _ { S V D }$ . Instead, we can store $\hat { U } _ { q } , \hat { S } _ { q }$ and $\hat { V } _ { q }$ , which are of low dimensions. By pre-calculating $( \hat { U } _ { q } \hat { S } _ { q } )$ and $( \hat { V } _ { q } \hat { S } _ { q } )$ during the preprocessing stage with SVD, the model efficiency is improved.
|
| 79 |
+
|
| 80 |
+
# 3.3 SIMPLIFIED LOCAL-GLOBAL CONTRASTIVE LEARNING
|
| 81 |
+
|
| 82 |
+
The conventional GCL methods such as SGL and SimGCL contrast node embeddings by constructing two extra views, while the embeddings generated from the original graph (the main-view) are not directly involved in the InfoNCE loss. The reason for adopting such a cumbersome three-view paradigm may be that the random perturbation used to augment the graph may provide misleading signals to the main-view embeddings. In our proposed method, however, the augmented graph view is created with global collaborative relations, which can enhance the main-view representations. Therefore, we simplify the CL framework by directly contrasting the SVD-augmented view embeddings g(u)i,l with the main-view embeddings $\boldsymbol { z } _ { i , l } ^ { ( u ) }$ in the InfoNCE loss (Oord et al., 2018):
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\mathcal { L } _ { s } ^ { ( u ) } = \sum _ { i = 0 } ^ { I } \sum _ { l = 0 } ^ { L } - \log \frac { \exp ( s ( z _ { i , l } ^ { ( u ) } , \pmb { g } _ { i , l } ^ { ( u ) } / \tau ) ) } { \sum _ { i ^ { \prime } = 0 } ^ { I } \exp ( s ( z _ { i , l } ^ { ( u ) } , \pmb { g } _ { i ^ { \prime } , l } ^ { ( u ) } ) / \tau ) }
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
where $s ( \cdot )$ and $\tau$ stand for the cosine similarity and the temperature respectively. The InfoNCE loss $\mathcal { L } _ { s } ^ { ( v ) }$ for the items are defined in the same way. To prevent overfitting, we implement a random node dropout in each batch to exclude some nodes from participating in the contrastive learning. As shown in Eq. 8, the contrastive loss is jointly optimized with our main objective function for the recommendation task (where $\hat { y } _ { i , p _ { s } }$ and $\hat { y } _ { i , n _ { s } }$ denote the predicted scores for a pair of positive and negative items of user $\romannumeral 1$ ):
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
\mathcal { L } = \mathcal { L } _ { r } + \lambda _ { 1 } \cdot ( \mathcal { L } _ { s } ^ { ( u ) } + \mathcal { L } _ { s } ^ { ( v ) } ) + \lambda _ { 2 } \cdot \Vert \Theta \Vert _ { 2 } ^ { 2 } ; \quad \mathcal { L } _ { r } = \sum _ { i = 0 } ^ { I } \sum _ { s = 1 } ^ { S } \operatorname* { m a x } ( 0 , 1 - \hat { y } _ { i , p _ { s } } + \hat { y } _ { i , n _ { s } } )
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
# 4 EVALUATION
|
| 95 |
+
|
| 96 |
+
To verify the superiority and effectiveness of the proposed LightGCL method, we perform extensive experiments to answer the following research questions:
|
| 97 |
+
|
| 98 |
+
• RQ1: How does LightGCL perform on different datasets compared to various SOTA baselines? • RQ2: How does the lightweight graph contrastive learning improve the model efficiency? • RQ3: How does our model perform against data sparsity, popularity bias and over-smoothing? • RQ4: How does the local-global contrastive learning contribute to the performance of our model? • RQ5: How do different parameter settings affect our model performance?
|
| 99 |
+
|
| 100 |
+
# 4.1 EXPERIMENTAL SETTINGS
|
| 101 |
+
|
| 102 |
+
# 4.1.1 DATASETS AND EVALUATION PROTOCOLS
|
| 103 |
+
|
| 104 |
+
We evaluate our model and the baselines on five real-world datasets: Yelp (29,601 users, 24,734 items, 1,517,326 interactions): a dataset collected from the rating interactions on Yelp platform; Gowalla (50,821 users, 57,440 items, 1,172,425 interactions): a dataset containing users’ check-in records collected from Gowalla platform; ML-10M (69,878 users, 10,195 items, 9,988,816 interactions): a well-known movie-rating dataset for collaborative filtering; Amazon-book (78,578 users, 77,801 items, 2,240,156 interactions): a dataset composed of users’ ratings on books collected from Amazon; and Tmall (47,939 users, 41,390 items, 2,357,450 interactions): a E-commerce dataset containing users’ purchase records on different products in Tmall platform.
|
| 105 |
+
|
| 106 |
+
In accordance with He et al. (2020) and Wu et al. (2021), we split the datasets into training, validation and testing sets with a ratio of 7:2:1. We adopt the Recall $@ \mathbf { N }$ and Normalized Discounted Cumulative Gain $( \mathrm { N D C G } ) @ \mathrm { N }$ , where $\Nu = \{ 2 0 , 4 0 \}$ , as the evaluation metrics.
|
| 107 |
+
|
| 108 |
+
# 4.1.2 BASELINE METHODS
|
| 109 |
+
|
| 110 |
+
We compare our model against 16 state-of-the-art baselines with different learning paradigms:
|
| 111 |
+
|
| 112 |
+
• MLP-enhanced Collaborative Filtering: NCF (He et al., 2017).
|
| 113 |
+
• GNN-based Collaborative Filtering: GCCF (Chen et al., 2020c), LightGCN (He et al., 2020).
|
| 114 |
+
• Disentangled Graph Collaborative Filtering: DGCF (Wang et al., 2020b).
|
| 115 |
+
• Hypergraph-based Collaborative Filtering: HyRec (Wang et al., 2020a).
|
| 116 |
+
• Self-Supervised Learning Recommender Systems: GraphCL (You et al., 2020), GRACE (Zhu et al., 2020), GCA (Zhu et al., 2021b), MHCN (Yu et al., 2021), SAIL (Yu et al., 2022b), AutoGCL (Yin et al., 2022), SimGRACE (Xia et al., 2022a), SGL (Wu et al., 2021), HCCF (Xia et al., 2022b), SHT (Xia et al., 2022c), SimGCL (Yu et al., 2022a).
|
| 117 |
+
|
| 118 |
+
Due to space limit, the detailed descriptions of baselines are presented in Appendix A.
|
| 119 |
+
|
| 120 |
+
# 4.1.3 HYPERPARAMETER SETTINGS
|
| 121 |
+
|
| 122 |
+
To ensure a fair comparison, we tune the hyperparameters of all the baselines within the ranges suggested in the original papers, except the following fixed settings for all the models: the embedding size is set as 32; the batch size is 256; two convolutional layers are used for GCN models.
|
| 123 |
+
|
| 124 |
+
For our LightGCL, the regularization weights $\lambda _ { 1 }$ and $\lambda _ { 2 }$ are tuned from $\{ 1 \mathrm { e } { - } 5 , 1 \mathrm { e } { - } 6 , 1 \mathrm { e } { - } 7 \}$ and {1e4, 1e- $\{ 5 \}$ , respectively. The temperature $\tau$ is searched from $\{ 0 . 3 , 0 . 5 , 1 , \dot { 3 } , 1 0 \}$ . The dropout rate is chosen from $\{ 0 , 0 . 2 5 \}$ . The rank (i.e., $\grave { q } ,$ ) for SVD, is set as 5. We use the Adam optimizer with a learning rate of 0.001 decaying at the rate of 0.98 until the rate reaches 0.0005.\*
|
| 125 |
+
|
| 126 |
+
# 4.2 PERFORMANCE VALIDATION (RQ1)
|
| 127 |
+
|
| 128 |
+
We summarize the experimental result in Table $1 ^ { \dagger }$ , with the following observations and conclusions:
|
| 129 |
+
|
| 130 |
+
Table 1: Performance comparison with baselines on five datasets.
|
| 131 |
+
|
| 132 |
+
<table><tr><td>Data</td><td>Metric</td><td>DGCF</td><td>HyRec</td><td>LightGCN</td><td>MHCN</td><td>SGL</td><td>SimGRACE</td><td>GCA</td><td>HCCF</td><td>SHT</td><td>SimGCL</td><td>LightGCL</td><td>p-val.</td><td>impr.</td></tr><tr><td rowspan="4">o</td><td>R@20</td><td>0.0466</td><td>0.0472</td><td>0.0482</td><td>0.0503</td><td>0.0526</td><td>0.0603</td><td>0.0621</td><td>0.0626</td><td>0.0651</td><td>0.0718</td><td>0.0793</td><td>7e-9</td><td>10%</td></tr><tr><td>N@20</td><td>0.0395</td><td>0.0395</td><td>0.0409</td><td>0.0424</td><td>0.0444</td><td>0.0435</td><td>0.0530</td><td>0.0527</td><td>0.0546</td><td>0.0615</td><td>0.0668</td><td>8e-9</td><td>8%</td></tr><tr><td>R@40</td><td>0.0774</td><td>0.0791</td><td>0.0803</td><td>0.0826</td><td>0.0869</td><td>0.0989</td><td>0.1021</td><td>0.1040</td><td>0.1091</td><td>0.1166</td><td>0.1292</td><td>2e-9</td><td>10%</td></tr><tr><td>N@40</td><td>0.0511</td><td>0.0522</td><td>0.0527</td><td>0.0544</td><td>0.0571</td><td>0.0656</td><td>0.0677</td><td>0.0681</td><td>0.0709</td><td>0.0778</td><td>0.0852</td><td>2e-9</td><td>9%</td></tr><tr><td rowspan="5">Goeaal</td><td>R@20</td><td>0.0944</td><td>0.0901</td><td>0.0985</td><td>0.0955</td><td>0.1030</td><td>0.0869</td><td>0.0896</td><td>0.1070</td><td>0.1232</td><td>0.1357</td><td>0.1578</td><td>1e-6</td><td>16%</td></tr><tr><td>N@20</td><td>0.0522</td><td>0.0498</td><td>0.0593</td><td>0.0574</td><td>0.0623</td><td>0.0528</td><td>0.0537</td><td>0.0644</td><td>0.0731</td><td>0.0818</td><td>0.0935</td><td>2e-6</td><td>14%</td></tr><tr><td>R@40</td><td>0.1401</td><td>0.1356</td><td>0.1431</td><td>0.1393</td><td>0.1500</td><td>0.1276</td><td>0.1322</td><td>0.1535</td><td>0.1804</td><td>0.1956</td><td>0.2245</td><td>3e-6</td><td>14%</td></tr><tr><td>N@40</td><td>0.0671</td><td>0.0660</td><td>0.0710</td><td>0.0689</td><td>0.0746</td><td>0.0637</td><td>0.0651</td><td>0.0767</td><td>0.0881</td><td>0.0975</td><td>0.1108</td><td>3e-6</td><td>13%</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></td></tr><tr><td rowspan="4">WOI-TN</td><td>R@20</td><td>0.1763</td><td>0.1801</td><td>0.1789</td><td>0.1497</td><td>0.1833</td><td>0.2254</td><td>0.2145</td><td>0.2219</td><td>0.2173</td><td>0.2265</td><td>0.2613</td><td>1e-9</td><td>15%</td></tr><tr><td>N@20</td><td>0.2101</td><td>0.2178</td><td>0.2128</td><td>0.1814</td><td>0.2205</td><td>0.2686</td><td>0.2613</td><td>0.2629</td><td>0.2573</td><td>0.2613</td><td>0.3106</td><td>3e-9</td><td>18%</td></tr><tr><td>R@40</td><td>0.2681</td><td>0.2685</td><td>0.2650</td><td>0.2250</td><td>0.2768</td><td>0.3295</td><td>0.3231</td><td>0.3265</td><td>0.3211</td><td>0.3345</td><td>0.3799</td><td>7e-10</td><td>13%</td></tr><tr><td>N@40</td><td>0.2340</td><td>0.2340</td><td>0.2322</td><td>0.1962</td><td>0.2426</td><td>0.2939</td><td>0.2871</td><td>0.2880</td><td>0.3318</td><td>0.2880</td><td>0.3387</td><td>1e-9</td><td>17%</td></tr><tr><td rowspan="4">VAzaao</td><td>R@20</td><td>0.0211</td><td>0.0302</td><td>0.0319</td><td>0.0296</td><td>0.0327</td><td>0.0381</td><td>0.0309</td><td>0.0322</td><td>0.0441</td><td>0.0474</td><td>0.0585</td><td>2e-7</td><td>23%</td></tr><tr><td>N@20</td><td>0.0154</td><td>0.0225</td><td>0.0236</td><td>0.0219</td><td>0.0249</td><td>0.0291</td><td>0.0238</td><td>0.0247</td><td>0.0328</td><td>0.0360</td><td>0.0436</td><td>2e-6</td><td>21%</td></tr><tr><td>R@40</td><td>0.0351</td><td>0.0432</td><td>0.0499</td><td>0.0489</td><td>0.0531</td><td>0.0621</td><td>0.0498</td><td>0.0525</td><td>0.0719</td><td>0.0750</td><td>0.0933</td><td>1e-7</td><td>24%</td></tr><tr><td>N@40</td><td>0.0201</td><td>0.0246</td><td>0.0290</td><td>0.0284</td><td>0.0312</td><td>0.0371</td><td>0.0301</td><td>0.0314</td><td>0.0420</td><td>0.0451</td><td>0.0551</td><td>9e-7</td><td>22%</td></tr><tr><td rowspan="4">[ig</td><td>R@20</td><td>0.0235</td><td>0.0233</td><td>0.0225</td><td>0.0203</td><td>0.0268</td><td>0.0222</td><td>0.0373</td><td>0.0314</td><td>0.0387</td><td>0.0473</td><td>0.0528</td><td>3e-5</td><td>11%</td></tr><tr><td>N@20</td><td>0.0163</td><td>0.0160</td><td>0.0154</td><td>0.0139</td><td>0.0183</td><td>0.0152</td><td>0.0252</td><td>0.0213</td><td>0.0262</td><td>0.0328</td><td>0.0361</td><td>1e-4</td><td>10%</td></tr><tr><td>R@40</td><td>0.0394</td><td>0.0350</td><td>0.0378</td><td>0.0340</td><td>0.0446</td><td>0.0367</td><td>0.0616</td><td>0.0519</td><td>0.0645</td><td>0.0766</td><td>0.0852</td><td>1e-5</td><td>11%</td></tr><tr><td>N@40</td><td>0.0218</td><td>0.0199</td><td>0.0208</td><td>0.0188</td><td>0.0246</td><td>0.0203</td><td>0.0337</td><td>0.0284</td><td>0.0352</td><td>0.0429</td><td>0.0473</td><td>7e-5</td><td>10%</td></tr></table>
|
| 133 |
+
|
| 134 |
+
• Contrastive Learning Dominates. As can be seen from the table, recent methods implementing contrastive learning (SGL, HCCF, SimGCL) exhibit consistent superiority as compared to traditional graph-based (GCCF, LightGCN) or hypergraph-based (HyRec) models. They also perform better than some of other self-supervised learning approaches (MHCN). This could be attributed to the effectiveness of CL to learn evenly distributed embeddings (Yu et al., 2022a).
|
| 135 |
+
|
| 136 |
+
• Contrastive Learning Enhancement. Our method consistently outperforms all the contrastive learning baselines. We attribute such performance improvement to the effective augmentation of graph contrastive learning via injecting global collaborative contextual signals. Other compared contrastive learning-based recommenders (e.g., SGL, SimGCL, and HCCF) are easily biased by noisy interaction information and generate misleading self-supervised signals.
|
| 137 |
+
|
| 138 |
+
# 4.3 EFFICIENCY STUDY (RQ2)
|
| 139 |
+
|
| 140 |
+
GCL models often suffer from a high computational cost due to the construction of extra views and the convolution operations performed on them during training. However, the low-rank nature of the SVD-reconstructed graph and the simplified CL structure enable the training of our LightGCL to be highly efficient. We analyze the pre-processing and per-batch training complexity of our model in comparison to three competitive baselines, as summarized in Table 2.‡
|
| 141 |
+
|
| 142 |
+
Table 2: Comparisons of computational complexity against baselines.
|
| 143 |
+
|
| 144 |
+
<table><tr><td>Stage</td><td>Computation</td><td>LightGCN</td><td>SGL</td><td>SimGCL</td><td>LightGCL</td></tr><tr><td>Pre-processing</td><td>Normalization SVD</td><td>O(E)</td><td>O(E)</td><td>O(E)</td><td>O(E) O(qE)</td></tr><tr><td>Training</td><td>Augmentation Graph Convolution BPRLoss InfoNCE Loss</td><td>O(2ELd) O(2Bd) 1</td><td>O(2pE) O(2ELd+4pELd) O(2Bd) O(Bd+BMd)</td><td>O(6ELd) O(2Bd) O(Bd+BMd)</td><td>O[2ELd+ 2q(I+ J)Ld] O(2Bd) O[(Bd+BMd)L]</td></tr></table>
|
| 145 |
+
|
| 146 |
+
• Although our model requires performing the SVD in the pre-processing stage which takes $O ( q E )$ , the computational cost is negligible compared to the training stage since it only needs to be performed once. In fact, by moving the construction of contrastive view to the pre-processing stage, we avoid the repetitive graph augmentation during training, which improves model efficiency.
|
| 147 |
+
|
| 148 |
+
• Traditional GCN methods (e.g., LightGCN) only perform convolution on one graph, inducing a complexity of $O ( 2 E L d )$ per batch. For most GCL-based methods, three contrastive views are computed per batch, leading to a complexity of roughly three times of LightGCN. In our model, instead, only two contrastive views are involved. Additionally, due to the low-rank property of SVD-based graph structure learning, our graph encoder takes only $O [ 2 q ( I + J ) L d ]$ time. For most datasets, including the five we use, $\bar { 2 q } ( \bar { I } + J ) < E$ . Therefore, the training complexity of our model is less than half of that of the SOTA efficient model SimGCL.
|
| 149 |
+
|
| 150 |
+
# 4.4 RESISTANCE AGAINST DATA SPARSITY AND POPULARITY BIAS (RQ3)
|
| 151 |
+
|
| 152 |
+
To evaluate the robustness of our model in alleviating data sparsity, we group the sparse users by their interaction degrees and calculate the Recall $@ 2 0$ of each group on $Y e l p$ and Gowalla datasets. As can be seen from the figures, the performance of HCCF and SimGCL varies across datasets, but our LightGCL consistently outperforms them in all cases. In particular, our model performs notably well on the extremely sparse user group $< 1 5$ interactions), as the Recall $@ 2 0$ of these users is not much lower (and is even higher on Gowalla) than that of the whole dataset.
|
| 153 |
+
|
| 154 |
+

|
| 155 |
+
Figure 2: Performance on users of different sparsity degrees, in terms of Recall (histograms) and relative Recall w.r.t overall performances (charts).
|
| 156 |
+
|
| 157 |
+

|
| 158 |
+
Figure 3: LightGCL’s ability to alleviate popularity bias in comparison to SOTA CLbased methods HCCF and SimGCL.
|
| 159 |
+
|
| 160 |
+
Additionally, we illustrate our model’s ability to mitigate popularity bias compared to HCCF and SimGCL. Similar to Section 4.4, we group the long-tail items by their degree of interactions. Following Wu et al. (2021), we adopt the decomposed Recall@20 defined as Recall(g) = |(Vurec)(g)∩Vutest||Vu | where $\mathbb { V } _ { t e s t } ^ { u }$ refers to the set of test items for the user $u$ , and $( \mathbb { V } _ { r e c } ^ { u } ) ^ { ( g ) }$ is the set of Top-K recommended items for $u$ that belong to group $g$ . The results are shown in Fig. 3. Similar to the results on sparse users, HCCF and SimGCL’s performance fluctuates a lot with the influence of popularity bias. Our model performs better in most cases, which shows its resistance against popularity bias. Note that since the extremely sparse group ( $< 1 5$ interactions) is significantly larger than the other groups in Gowalla, they contribute to a large fraction of the Recall $@ 2 0$ , resulting in a different trend from that of Yelp in the figure.
|
| 161 |
+
|
| 162 |
+
# 4.5 BALANCING BETWEEN OVER-SMOOTHING AND OVER-UNIFORMITY (RQ3)
|
| 163 |
+
|
| 164 |
+
In this section, we illustrate the effectiveness of our model in learning a moderately dispersed embedding distribution, by preserving user unique preference pattern and inter-user collaborative dependencies. We randomly sample 2,000 nodes from Yelp and Gowalla and map their embeddings to the 2-D space with t-SNE (Van der Maaten & Hinton, 2008). The visualizations of these embeddings are presented in Fig. 4. We also calculate the Mean Average Distance (MAD) (Chen et al., 2020a) of the embeddings, summarized in Table 3.
|
| 165 |
+
|
| 166 |
+
Table 3: Mean Average Distance (MAD) of the embeddings learned by different methods.
|
| 167 |
+
|
| 168 |
+
<table><tr><td>Dataset</td><td>MHCN</td><td>LightGCN</td><td>LightGCL</td><td>SGL</td><td>SimGCL</td></tr><tr><td>Yelp</td><td>0.8806</td><td>0.9469</td><td>0.9657</td><td>0.9962</td><td>0.9956</td></tr><tr><td>Gowalla</td><td>0.9247</td><td>0.9568</td><td>0.9721</td><td>0.9859</td><td>0.9897</td></tr></table>
|
| 169 |
+
|
| 170 |
+

|
| 171 |
+
Figure 4: Embedding distributions on Yelp and Gowalla visualized with t-SNE.
|
| 172 |
+
|
| 173 |
+
As can be seen from Fig. 4, the embedding distributions of non-CL methods (i.e., LightGCN, MHCN) exhibit indistinguishable clusters in the embedding space, which indicates the limitation of addressing the over-smoothing issue. On the contrary, the existing CL-based methods tend to learn i) over-uniform distributions, e.g., SGL on $Y e l p$ learns a huge cloud of evenly-distanced embeddings with no clear community structure to well capture the collaborative relations between users; ii) highly dispersed small clusters with severe over-smoothing issue inside the clusters, e.g., the embeddings of SimGCL on Gowalla appear to be scattered grained clusters inside which embeddings are highly similar. Compared with them, clear community structures could be identified by our method to capture collaborative effects, while the embeddings inside each community are reasonably dispersed to be reflective of user-specific preference. The MAD of our model’s learned features is also in between of the two types of baselines as shown in Table 3.
|
| 174 |
+
|
| 175 |
+
# 4.6 ABLATION STUDY (RQ4)
|
| 176 |
+
|
| 177 |
+
To investigate the effectiveness of our SVD-based graph augmentation scheme, we perform the ablation study to answer the question of whether we could provide guidance to the contrastive learning with a different approach of matrix decomposition. To this end, we implement two variants of our model, replacing the approximated SVD algorithm with other matrix decomposition methods: $C L .$ - $M F$ adopts the view generated by a pre-trained MF (Koren et al., 2009); $C L { \cdot } S V D { + } +$ utilizes the $\mathrm { S V D + + }$ (Koren, 2008) which takes implicit user feedback into consideration. As shown in Table 4, with the information distilled from MF or $\mathrm { S V D + + }$ , the model is able to achieve satisfactory results, indicating the effectiveness of using matrix decomposition to empower CL and the flexibility of our proposed framework. However, adopting a pre-trained CL component is not only tedious and timeconsuming but also inferior to utilizing the approximate SVD algorithm in terms of performance.
|
| 178 |
+
|
| 179 |
+
Table 4: Ablation study on LightGCL.
|
| 180 |
+
|
| 181 |
+
<table><tr><td rowspan="2">Variant</td><td colspan="2">Yelp</td><td colspan="2">Gowalla</td></tr><tr><td>Recall@20</td><td>NDCG@20</td><td>Recall@20</td><td>NDCG@20</td></tr><tr><td>CL-MF</td><td>0.0781</td><td>0.0659</td><td>0.1561</td><td>0.0929</td></tr><tr><td>CL-SVD++</td><td>0.0788</td><td>0.0666</td><td>0.1568</td><td>0.0932</td></tr><tr><td>LightGCL</td><td>0.0793</td><td>0.0668</td><td>0.1578</td><td>0.0935</td></tr></table>
|
| 182 |
+
|
| 183 |
+

|
| 184 |
+
Figure 5: Recall change w.r.t. $q$
|
| 185 |
+
|
| 186 |
+
# 4.7 HYPERPARAMETER ANALYSIS (RQ5)
|
| 187 |
+
|
| 188 |
+
In this section, we investigate our model’s sensitivity in relation to several key hyperparameters: the regularization weight for InfoNCE loss $\lambda _ { 1 }$ , the temperature $\tau$ , and the required rank of SVD $q$ .
|
| 189 |
+
|
| 190 |
+
• The impact of $\lambda _ { 1 }$ . As illustrated in Fig. 6, for the three datasets Yelp, Gowalla and ML-10M, the model’s performance reaches the peak when $\lambda _ { 1 } = 1 0 ^ { - 7 }$ . It can be noticed that $\lambda _ { 1 }$ with the range of $[ 1 0 ^ { - 6 } , 1 0 ^ { - 8 } ]$ can often lead to performance improvement.
|
| 191 |
+
|
| 192 |
+

|
| 193 |
+
Figure 6: Impact of $\lambda _ { 1 }$ .
|
| 194 |
+
|
| 195 |
+

|
| 196 |
+
Figure 7: Impact of $\tau$
|
| 197 |
+
|
| 198 |
+
• The impact of $\tau$ . Fig. 7 indicates that the model’s performance is relatively stable across different selections of $\tau$ from 0.1 to 10, while the best configuration of $\tau$ value varies by datasets.
|
| 199 |
+
|
| 200 |
+
• The selection of $q$ . $q$ determines the rank of SVD in our model. Experiments have shown that satisfactory results can be achieved with a small $q$ . Specifically, as in Fig. 5, we observe that $q = 5$ is sufficient to preserve important structures of the user-item interaction graph.
|
| 201 |
+
|
| 202 |
+
# 4.8 CASE STUDY (RQ4)
|
| 203 |
+
|
| 204 |
+
In this section, we present a case study to intuitively show the effectiveness of our model to identify useful knowledge from noisy user-item interactions and make accurate recommendations accordingly. In Fig. 8, we can see that the venues visited by user $\# 2 6$ in Yelp mainly fall into two communities: Cleveland (where the user probably lives) and Arizona (where the user may have travelled to). In the reconstructed graph, these venues are assigned a new weight according to their potential importance. Note that item $\# 2 5 8 3$ , a car rental agency in Arizona, has been assigned a negative weight, which conforms to our common sense that people generally would not visit multiple car rental agencies in one trip. The SVD-augmented view also provides predictions on invisible links by assigning a large weight§ to potential venues of interest, such as #2647 and #658. Note that when exploiting the graph, the augmented view does not overlook the smaller Arizona community, which enables the model to predict items of minor interests that are usually overshadowed by the majority.
|
| 205 |
+
|
| 206 |
+

|
| 207 |
+
Figure 8: Case study on user $\# 2 6$ in Yelp dataset.
|
| 208 |
+
|
| 209 |
+
# 5 CONCLUSION
|
| 210 |
+
|
| 211 |
+
In this paper, we propose a simple and effective augmentation method to the graph contrastive learning framework for recommendation. Specifically, we explore the key idea of making the singular value decomposition powerful enough to augment user-item interaction graph structures. Our key findings indicate that our graph augmentation scheme exhibits strong ability in resisting data sparsity and popularity bias. Extensive experiments show that our model achieves new state-of-the-art results on several public evaluation datasets. In future work, we plan to explore the potential of incorporating casual analysis into our lightweight graph contrastive learning model to enhance the recommender system with mitigating confounding effects for data augmentation.
|
| 212 |
+
|
| 213 |
+
# REFERENCES
|
| 214 |
+
|
| 215 |
+
Deli Chen, Yankai Lin, Wei Li, Peng Li, Jie Zhou, and Xu Sun. Measuring and relieving the oversmoothing problem for graph neural networks from the topological view. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 3438–3445, 2020a.
|
| 216 |
+
|
| 217 |
+
Lei Chen, Le Wu, Richang Hong, Kun Zhang, and Meng Wang. Revisiting graph based collaborative filtering: A linear residual graph convolutional network approach. In AAAI conference on artificial intelligence, volume 34, pp. 27–34, 2020b.
|
| 218 |
+
|
| 219 |
+
Lei Chen, Le Wu, Richang Hong, Kun Zhang, and Meng Wang. Revisiting graph based collaborative filtering: A linear residual graph convolutional network approach. In Proceedings of the AAAI conference on artificial intelligence, volume 34, pp. 27–34, 2020c.
|
| 220 |
+
|
| 221 |
+
Nathan Halko, Per-Gunnar Martinsson, and Joel A Tropp. Finding structure with randomness: Probabilistic algorithms for constructing approximate matrix decompositions. SIAM review, 53 (2):217–288, 2011.
|
| 222 |
+
|
| 223 |
+
Kaveh Hassani and Amir Hosein Khasahmadi. Contrastive multi-view representation learning on graphs. In International Conference on Machine Learning (ICML), pp. 4116–4126. PMLR, 2020.
|
| 224 |
+
|
| 225 |
+
Xiangnan He, Lizi Liao, Hanwang Zhang, Liqiang Nie, Xia Hu, and Tat-Seng Chua. Neural collaborative filtering. In International conference on world wide web (WWW), pp. 173–182, 2017.
|
| 226 |
+
|
| 227 |
+
Xiangnan He, Kuan Deng, Xiang Wang, Yan Li, Yongdong Zhang, and Meng Wang. Lightgcn: Simplifying and powering graph convolution network for recommendation. In International conference on research and development in Information Retrieval (SIGIR), pp. 639–648, 2020.
|
| 228 |
+
|
| 229 |
+
Wei Jin, Xiaorui Liu, Xiangyu Zhao, Yao Ma, Neil Shah, and Jiliang Tang. Automated selfsupervised learning for graphs. ICLR, 2022.
|
| 230 |
+
|
| 231 |
+
Yehuda Koren. Factorization meets the neighborhood: a multifaceted collaborative filtering model. In Proceedings of the 14th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 426–434, 2008.
|
| 232 |
+
|
| 233 |
+
Yehuda Koren, Robert Bell, and Chris Volinsky. Matrix factorization techniques for recommender systems. Computer, 42(8):30–37, 2009.
|
| 234 |
+
|
| 235 |
+
Xixun Lin, Jia Wu, Chuan Zhou, Shirui Pan, Yanan Cao, and Bin Wang. Task-adaptive neural process for user cold-start recommendation. In Proceedings of the Web Conference (WWW), pp. 1306–1316, 2021.
|
| 236 |
+
|
| 237 |
+
Zihan Lin, Changxin Tian, Yupeng Hou, and Wayne Xin Zhao. Improving graph collaborative filtering with neighborhood-enriched contrastive learning. In Proceedings of the ACM Web Conference (WWW), pp. 2320–2329, 2022.
|
| 238 |
+
|
| 239 |
+
Fan Liu, Zhiyong Cheng, Lei Zhu, Zan Gao, and Liqiang Nie. Interest-aware message-passing gcn for recommendation. In The Web Conference (WWW), pp. 1296–1305, 2021a.
|
| 240 |
+
|
| 241 |
+
Weiming Liu, Jiajie Su, Chaochao Chen, and Xiaolin Zheng. Leveraging distribution alignment via stein path for cross-domain cold-start recommendation. Advances in Neural Information Processing Systems (NeurIPS), 34:19223–19234, 2021b.
|
| 242 |
+
|
| 243 |
+
Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
|
| 244 |
+
|
| 245 |
+
Zhen Peng, Wenbing Huang, Minnan Luo, Qinghua Zheng, Yu Rong, Tingyang Xu, and Junzhou Huang. Graph representation learning via graphical mutual information maximization. In The Web Conference (WWW), pp. 259–270, 2020.
|
| 246 |
+
|
| 247 |
+
Ajit Rajwade, Anand Rangarajan, and Arunava Banerjee. Image denoising using the higher order singular value decomposition. IEEE Transactions on Pattern Analysis and Machine Intelligence, 35(4):849–862, 2012.
|
| 248 |
+
|
| 249 |
+
Anand Rangarajan. Learning matrix space image representations. In International Workshop on Energy Minimization Methods in Computer Vision and Pattern Recognition, pp. 153–168. Springer, 2001.
|
| 250 |
+
|
| 251 |
+
Susheel Suresh, Pan Li, Cong Hao, and Jennifer Neville. Adversarial graph augmentation to improve graph contrastive learning. Advances in Neural Information Processing Systems (NeurIPS), 34: 15920–15933, 2021.
|
| 252 |
+
|
| 253 |
+
Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(11), 2008.
|
| 254 |
+
|
| 255 |
+
Petar Velickovic, William Fedus, William L Hamilton, Pietro Lio, Yoshua Bengio, and R Devon \` Hjelm. Deep graph infomax. ICLR, 2(3):4, 2019.
|
| 256 |
+
|
| 257 |
+
Jianling Wang, Kaize Ding, Liangjie Hong, Huan Liu, and James Caverlee. Next-item recommendation with sequential hypergraphs. In Proceedings of the 43rd international ACM SIGIR conference on research and development in information retrieval, pp. 1101–1110, 2020a.
|
| 258 |
+
|
| 259 |
+
Xiang Wang, Xiangnan He, Meng Wang, Fuli Feng, and Tat-Seng Chua. Neural graph collaborative filtering. In International Conference on Research and Development in Information Retrieval (SIGIR), pp. 165–174, 2019.
|
| 260 |
+
|
| 261 |
+
Xiang Wang, Hongye Jin, An Zhang, Xiangnan He, Tong Xu, and Tat-Seng Chua. Disentangled graph collaborative filtering. In Proceedings of the 43rd international ACM SIGIR conference on research and development in information retrieval, pp. 1001–1010, 2020b.
|
| 262 |
+
|
| 263 |
+
Jiancan Wu, Xiang Wang, Fuli Feng, Xiangnan He, Liang Chen, Jianxun Lian, and Xing Xie. Selfsupervised graph learning for recommendation. In International conference on research and development in information retrieval (SIGIR), pp. 726–735, 2021.
|
| 264 |
+
|
| 265 |
+
Zhebin Wu, Lin Shu, Ziyue Xu, Yaomin Chang, Chuan Chen, and Zibin Zheng. Robust tensor graph convolutional networks via t-svd based graph augmentation. In International Conference on Knowledge Discovery and Data Mining (KDD), pp. 2090–2099, 2022.
|
| 266 |
+
|
| 267 |
+
Jun Xia, Lirong Wu, Jintao Chen, Bozhen Hu, and Stan Z Li. Simgrace: A simple framework for graph contrastive learning without data augmentation. In the ACM Web Conference (WWW), pp. 1070–1079, 2022a.
|
| 268 |
+
|
| 269 |
+
Lianghao Xia, Chao Huang, Yong Xu, Jiashu Zhao, Dawei Yin, and Jimmy Xiangji Huang. Hypergraph contrastive collaborative filtering. In Proceedings of the 45th International ACM SIGIR Conference on Research and Development in Information Retrieval, SIGIR 2022, Madrid, Spain, July 11-15, 2022., 2022b.
|
| 270 |
+
|
| 271 |
+
Lianghao Xia, Chao Huang, and Chuxu Zhang. Self-supervised hypergraph transformer for recommender systems. In International Conference on Knowledge Discovery and Data Mining, KDD 2022, Washington DC, USA, August 14-18, 2022., 2022c.
|
| 272 |
+
|
| 273 |
+
Xu Xie, Fei Sun, Zhaoyang Liu, Shiwen Wu, Jinyang Gao, Jiandong Zhang, Bolin Ding, and Bin Cui. Contrastive learning for sequential recommendation. In International Conference on Data Engineering (ICDE), pp. 1259–1273. IEEE, 2022.
|
| 274 |
+
|
| 275 |
+
Yihang Yin, Qingzhong Wang, Siyu Huang, Haoyi Xiong, and Xiang Zhang. Autogcl: Automated graph contrastive learning via learnable view generators. In AAAI Conference on Artificial Intelligence (AAAI), volume 36, pp. 8892–8900, 2022.
|
| 276 |
+
|
| 277 |
+
Yuning You, Tianlong Chen, Yongduo Sui, Ting Chen, Zhangyang Wang, and Yang Shen. Graph contrastive learning with augmentations. Advances in Neural Information Processing Systems (NeurIPS), 33:5812–5823, 2020.
|
| 278 |
+
|
| 279 |
+
Junliang Yu, Hongzhi Yin, Jundong Li, Qinyong Wang, Nguyen Quoc Viet Hung, and Xiangliang Zhang. Self-supervised multi-channel hypergraph convolutional network for social recommendation. In Proceedings of the Web Conference 2021, pp. 413–424, 2021.
|
| 280 |
+
|
| 281 |
+
Junliang Yu, Hongzhi Yin, Xin Xia, Tong Chen, Lizhen Cui, and Quoc Viet Hung Nguyen. Are graph augmentations necessary? simple graph contrastive learning for recommendation. In International Conference on Research and Development in Information Retrieval (SIGIR), pp. 1294– 1303, 2022a.
|
| 282 |
+
|
| 283 |
+
Lu Yu, Shichao Pei, Lizhong Ding, Jun Zhou, Longfei Li, Chuxu Zhang, and Xiangliang Zhang. Sail: Self-augmented graph contrastive learning. In AAAI Conference on Artificial Intelligence (AAAI), volume 36, pp. 8927–8935, 2022b.
|
| 284 |
+
|
| 285 |
+
Jiani Zhang, Xingjian Shi, Shenglin Zhao, and Irwin King. Star-gcn: Stacked and reconstructed graph convolutional networks for recommender systems. International Joint Conference on Artificial Intelligence (IJCAI), 2019.
|
| 286 |
+
|
| 287 |
+
Yixin Zhang, Yong Liu, Yonghui Xu, Hao Xiong, Chenyi Lei, Wei He, Lizhen Cui, and Chunyan Miao. Enhancing sequential recommendation with graph contrastive learning. International Joint Conference on Artificial Intelligence (IJCAI), 2022.
|
| 288 |
+
|
| 289 |
+
Yanqiao Zhu, Yichen Xu, Feng Yu, Qiang Liu, Shu Wu, and Liang Wang. Deep graph contrastive representation learning. arXiv preprint arXiv:2006.04131, 2020.
|
| 290 |
+
|
| 291 |
+
Yanqiao Zhu, Yichen Xu, Qiang Liu, and Shu Wu. An empirical study of graph contrastive learning. arXiv preprint arXiv:2109.01116, 2021a.
|
| 292 |
+
|
| 293 |
+
Yanqiao Zhu, Yichen Xu, Feng Yu, Qiang Liu, Shu Wu, and Liang Wang. Graph contrastive learning with adaptive augmentation. In The Web Conference (WWW), pp. 2069–2080, 2021b.
|
| 294 |
+
|
| 295 |
+
# A DETAILS OF THE BASELINES
|
| 296 |
+
|
| 297 |
+
MLP-enhanced Collaborative Filtering:
|
| 298 |
+
|
| 299 |
+
• NCF (He et al., 2017) is a collaborative filtering model that leverages neural network to exploit non-linearity. Two hidden layers are used in our evaluation.
|
| 300 |
+
|
| 301 |
+
GNN-based Collaborative Filtering:
|
| 302 |
+
|
| 303 |
+
• GCCF (Chen et al., 2020c) strengthens the GNN-based collaborative filtering by implementing a residual network and reducing the non-linear transformation.
|
| 304 |
+
• LightGCN (He et al., 2020) adopts a simplified GCN structure without embedding weight matrices and non-linear projection.
|
| 305 |
+
|
| 306 |
+
Disentangled Graph Collaborative Filtering:
|
| 307 |
+
|
| 308 |
+
• DGCF (Wang et al., 2020b) learns a more sophisticated representation by segmenting the embedding vectors to represent multiple latent intentions.
|
| 309 |
+
|
| 310 |
+
Hypergraph-based Collaborative Filtering:
|
| 311 |
+
|
| 312 |
+
• HyRec (Wang et al., 2020a) makes use of hypergraph to encode multi-order information between users and items.
|
| 313 |
+
|
| 314 |
+
Self-Supervised Learning Recommender Systems:
|
| 315 |
+
|
| 316 |
+
• GraphCL (You et al., 2020) utilizes random node dropping and edge masking to generate two contrastive views, which were aligned by optimizing the SSL loss function.
|
| 317 |
+
|
| 318 |
+
• GRACE (Zhu et al., 2020) proposes to corrupt the graph structure by both random edge dropout and random node feature dropping, and uses the corrupted graphs as the contrastive views.
|
| 319 |
+
|
| 320 |
+
• GCA (Zhu et al., 2021b) adaptively dropout the nodes and edges by their importance calculated with node centrality.
|
| 321 |
+
|
| 322 |
+
• MHCN (Yu et al., 2021) creates self-supervised signals for the graph representation learning by graph infomax network.
|
| 323 |
+
|
| 324 |
+
• SAIL (Yu et al., 2022b) maximizes the neighborhood predicting probability between GNNgenerated high-level features and input node features.
|
| 325 |
+
|
| 326 |
+
• AutoGCL (Yin et al., 2022) uses GNN to learn to mask nodes and edges in the augmented graph. It minimizes the similarity between the augmented and the original graph, while maximizing the similarity of the embeddings generated through them, so as to uncover the most important information in the graph.
|
| 327 |
+
|
| 328 |
+
• SimGRACE (Xia et al., 2022a) creates augmented view by randomly perturbing the parameters of the GNN network.
|
| 329 |
+
|
| 330 |
+
• SGL (Wu et al., 2021) adopts random walk sampling and probabilistic edge/node dropout to create augmented views for contrastive learning. In our experiments, we adopt the SGL-ED variant, which implements random edge dropout and exhibits the strongest performance according to the original paper.
|
| 331 |
+
|
| 332 |
+
• HCCF (Xia et al., 2022b) encodes global graph information with hypergraph and contrasts it against the local information encoded with GCN. In our experiments, the number of hyper-edges are set as 128 following the original paper.
|
| 333 |
+
|
| 334 |
+
• SHT (Xia et al., 2022c) adopts a hypergraph transformer framework to exploit global collaborative relationships and distills the global information to generate the cross-view self-supervised signals. In our experiments, the number of hyper-edges are set as 128 following the original paper.
|
| 335 |
+
|
| 336 |
+
• SimGCL (Yu et al., 2022a) propose to simplify the graph augmentation process of contrastive learning by directly injecting random noises into the feature representation.
|
| 337 |
+
|
| 338 |
+
# B PERFORMANCE COMPARISON WITH BASELINES (CONTINUED)
|
| 339 |
+
|
| 340 |
+
In this appendix, we show the performance of NCF, GCCF, GraphCL, SAIL, GRACE, and AutoGCL, which are not shown in Table 1 due to space limit. The results are summarized in Table 5. As can be seen from the table, our model outperforms these baselines consistently.
|
| 341 |
+
|
| 342 |
+
Table 5: Performance comparison with baselines on five datasets (continued).
|
| 343 |
+
|
| 344 |
+
<table><tr><td rowspan=1 colspan=1>Data</td><td rowspan=1 colspan=1>Metric</td><td rowspan=1 colspan=1>NCF</td><td rowspan=1 colspan=1>GCCF</td><td rowspan=1 colspan=1>GraphCL</td><td rowspan=1 colspan=1>SAIL</td><td rowspan=1 colspan=1>GRACE</td><td rowspan=1 colspan=1>AutoGCL</td><td rowspan=1 colspan=1>LightGCL</td></tr><tr><td rowspan=2 colspan=1>Yelp</td><td rowspan=1 colspan=1>R@20N@20</td><td rowspan=1 colspan=1>0.02520.0202</td><td rowspan=1 colspan=1>0.04620.0398</td><td rowspan=1 colspan=1>0.04620.0401</td><td rowspan=1 colspan=1>0.04710.0405</td><td rowspan=1 colspan=1>0.05500.0470</td><td rowspan=1 colspan=1>0.05930.0494</td><td rowspan=1 colspan=1>0.07930.0668</td></tr><tr><td rowspan=1 colspan=1>R@40N@40</td><td rowspan=1 colspan=1>0.04870.0289</td><td rowspan=1 colspan=1>0.07600.0508</td><td rowspan=1 colspan=1>0.07640.0511</td><td rowspan=1 colspan=1>0.07730.0516</td><td rowspan=1 colspan=1>0.09170.0605</td><td rowspan=1 colspan=1>0.10090.0650</td><td rowspan=1 colspan=1>0.12920.0852</td></tr><tr><td rowspan=2 colspan=1>Gowalla</td><td rowspan=1 colspan=1>R@20N@20</td><td rowspan=1 colspan=1>0.01710.0106</td><td rowspan=1 colspan=1>0.09510.0535</td><td rowspan=1 colspan=1>0.09970.0603</td><td rowspan=1 colspan=1>0.09990.0602</td><td rowspan=1 colspan=1>0.07440.0452</td><td rowspan=1 colspan=1>0.08320.0484</td><td rowspan=1 colspan=1>0.15780.0935</td></tr><tr><td rowspan=1 colspan=1>R@40N@40</td><td rowspan=1 colspan=1>0.02160.0118</td><td rowspan=1 colspan=1>0.13920.0684</td><td rowspan=1 colspan=1>0.14730.0727</td><td rowspan=1 colspan=1>0.14720.0725</td><td rowspan=1 colspan=1>0.10710.0539</td><td rowspan=1 colspan=1>0.12910.0605</td><td rowspan=1 colspan=1>0.22450.1108</td></tr><tr><td rowspan=2 colspan=1>ML-10M</td><td rowspan=1 colspan=1>R@20N@20</td><td rowspan=1 colspan=1>0.10970.1297</td><td rowspan=1 colspan=1>0.17420.2109</td><td rowspan=1 colspan=1>0.16590.2038</td><td rowspan=1 colspan=1>0.17280.2118</td><td rowspan=1 colspan=1>0.21070.2476</td><td rowspan=1 colspan=1>0.23250.2755</td><td rowspan=1 colspan=1>0.26130.3106</td></tr><tr><td rowspan=1 colspan=1>R@40N@40</td><td rowspan=1 colspan=1>0.16340.1427</td><td rowspan=1 colspan=1>0.26060.2331</td><td rowspan=1 colspan=1>0.25600.2250</td><td rowspan=1 colspan=1>0.26390.2332</td><td rowspan=1 colspan=1>0.30750.2711</td><td rowspan=1 colspan=1>0.34150.3023</td><td rowspan=1 colspan=1>0.37990.3387</td></tr><tr><td rowspan=2 colspan=1>Amazon</td><td rowspan=1 colspan=1>R@20N@20</td><td rowspan=1 colspan=1>0.01420.0085</td><td rowspan=1 colspan=1>0.03170.0243</td><td rowspan=1 colspan=1>0.03600.0266</td><td rowspan=1 colspan=1>0.03570.0264</td><td rowspan=1 colspan=1>0.03600.0271</td><td rowspan=1 colspan=1>0.03250.0241</td><td rowspan=1 colspan=1>0.05850.0436</td></tr><tr><td rowspan=1 colspan=1>R@40N@40</td><td rowspan=1 colspan=1>0.02230.0133</td><td rowspan=1 colspan=1>0.04830.0285</td><td rowspan=1 colspan=1>0.05850.0340</td><td rowspan=1 colspan=1>0.05810.0338</td><td rowspan=1 colspan=1>0.05830.0345</td><td rowspan=1 colspan=1>0.05530.0318</td><td rowspan=1 colspan=1>0.09330.0551</td></tr><tr><td rowspan=2 colspan=1>Tmall</td><td rowspan=1 colspan=1>R@20N@20</td><td rowspan=1 colspan=1>0.00820.0059</td><td rowspan=1 colspan=1>0.02090.0141</td><td rowspan=1 colspan=1>0.02510.0175</td><td rowspan=1 colspan=1>0.02540.0177</td><td rowspan=1 colspan=1>0.03030.0210</td><td rowspan=1 colspan=1>0.03120.0204</td><td rowspan=1 colspan=1>0.05280.0361</td></tr><tr><td rowspan=1 colspan=1>R@40N@40</td><td rowspan=1 colspan=1>0.01400.0079</td><td rowspan=1 colspan=1>0.03560.0196</td><td rowspan=1 colspan=1>0.04160.0233</td><td rowspan=1 colspan=1>0.04240.0236</td><td rowspan=1 colspan=1>0.05050.0281</td><td rowspan=1 colspan=1>0.05240.0278</td><td rowspan=1 colspan=1>0.08520.0473</td></tr></table>
|
| 345 |
+
|
| 346 |
+
# C THEORETICAL ANALYSIS
|
| 347 |
+
|
| 348 |
+
We conduct theoretical analyses to show that our local-global CL (Eq. 7) is augmented to maximize the similarity between embeddings of potentially related nodes, based on the SVD-based global relation learning. Specifically, for a node $v _ { j } ~ \in { \mathcal { U } }$ , where $\mathcal { U } = \{ u _ { i ^ { \prime } } | \mathcal { A } _ { i , i ^ { \prime } } = 0 , \hat { \mathcal { A } } _ { i , i ^ { \prime } } \neq 0 \}$ , the embeddings are not updated by $s ( z _ { i , l } , g _ { i , l } )$ in the vanilla InfoNCE loss, as $v _ { j }$ is not adjacent to $u _ { i }$ . Instead, our local-global contrastive assigns the following gradients to the embeddings of $v _ { j }$ :
|
| 349 |
+
|
| 350 |
+
$$
|
| 351 |
+
\begin{array} { l } { \displaystyle \partial s ( z _ { i , l } , g _ { i , l } ) / \partial g _ { i , l - 1 } = \partial s \left( z _ { i , l } , \sigma ( \displaystyle \sum _ { j \in \mathcal { U } } \alpha _ { i , j } g _ { j , l - 1 } + \displaystyle \sum _ { A _ { i , j ^ { \prime } } \neq 0 } \alpha _ { i , j ^ { \prime } } g _ { j ^ { \prime } , l - 1 } ) \right) / \partial g _ { j , l - 1 } } \\ { = \frac { z _ { i , l } } { \| z _ { i , l } \| \| g _ { i , l } \| } \cdot \boldsymbol { \sigma } ^ { \prime } ( \cdot ) \cdot \boldsymbol { \alpha } _ { i , j } } \end{array}
|
| 352 |
+
$$
|
| 353 |
+
|
| 354 |
+
where $\alpha _ { i , j }$ denotes the normalization weight for node $u _ { i }$ and $v _ { j }$ . In this way, the embeddings of nodes in $\mathcal { U }$ are also pulled close to $s _ { i , l }$ , which injects relatedness information learned by the SVD into the local-global CL optimization.
|
| 355 |
+
|
| 356 |
+
# D CALCULATION OF COMPLEXITY
|
| 357 |
+
|
| 358 |
+
# D.1 ADJACENCY MATRIX NORMALIZATION
|
| 359 |
+
|
| 360 |
+
For a sparse user-item matrix stored in the Coordinate Format (COO), it requires visiting every nonzero elements in the matrix to perform normalization. Thus, the computational complexity is in the order of the number of edges ${ \bf \bar { \boldsymbol { O } } } ( E )$ . Note that for the baseline SGL, it requires normalizing the two augmented graph structures during the training phase, each of which contains $\rho E$ edges, so it induces a complexity of $O ( 2 \rho E )$ per batch.
|
| 361 |
+
|
| 362 |
+
# D.2 APPROXIMATE SVD ALGORITHM
|
| 363 |
+
|
| 364 |
+
We refer the readers to Halko et al. (2011) in which the complexity of the approximate SVD algorithm is explained in detail.
|
| 365 |
+
|
| 366 |
+
# D.3 GRAPH CONVOLUTION
|
| 367 |
+
|
| 368 |
+
Given a sparse COO matrix $\mathcal { A }$ with $E$ edges and a dense matrix $\pmb { \cal E }$ with dimensions $I ( J ) \times d$ , it takes $O ( E d )$ time to calculate $\mathcal { A } E$ . To perform graph convolution on a graph, we need to multiply the sparse adjacency matrix with $\pmb { { E } } _ { l - 1 } ^ { ( v ) } \in \mathbb { R } ^ { J \times d }$ and its transpose with $E _ { l - 1 } ^ { ( u ) } \in \mathbb { R } ^ { I \times d }$ , which takes $O ( E d )$ each, and $O ( 2 E d )$ in total. For $L$ layers, $O ( 2 E L d )$ is required. For traditional CL-based methods such as SGL and $\mathrm { S i m C G L }$ , a three-view structure is adopted, resulting in a complexity of $O ( 1 2 E L d )$ (for SGL it again varies a bit depending on $\rho$ ).
|
| 369 |
+
|
| 370 |
+
For the SVD-view of our model, $\hat { V } _ { q } ^ { \top } E _ { l - 1 } ^ { ( v ) }$ takes $O ( q J d )$ , and multiplying the result with the precalculated $( \hat { U } _ { q } \hat { S } _ { q } )$ takes $O ( q I d )$ ; $\hat { U } _ { q } ^ { \top } E _ { l - 1 } ^ { ( v ) }$ takes $O ( q I d )$ , and multiplying the result with the precalculated $( \hat { V } _ { q } \hat { S } _ { q } )$ takes $O ( q J d )$ . So in total it takes $O ( 2 q ( I + J ) d )$ .
|
| 371 |
+
|
| 372 |
+
# D.4 BPR LOSS
|
| 373 |
+
|
| 374 |
+
In each batch with $B$ users, calculating the scores for positive and negative items both take $O ( B d )$ , so in total it takes $O ( 2 B d )$ .
|
| 375 |
+
|
| 376 |
+
# D.5 CL LOSS
|
| 377 |
+
|
| 378 |
+
In each batch with $B$ users, calculating the numerator of InfoNCE loss takes $O ( B d )$ , and calculating the denominator takes $O ( B M d )$ where $M$ denotes the total number of nodes in the batch. Since our model adopts a per layer InfoNCE loss, a factor of $L$ is appended.
|
md/dev/IFXTZERXdM7/IFXTZERXdM7.md
ADDED
|
Binary file (55.5 kB). View file
|
|
|
md/dev/IJNDyqdRF0m/IJNDyqdRF0m.md
ADDED
|
@@ -0,0 +1,429 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Decomposing NeRF for Editing via Feature Field Distillation
|
| 2 |
+
|
| 3 |
+
Sosuke Kobayashi Preferred Networks, Inc. sosk@preferred.jp
|
| 4 |
+
|
| 5 |
+
Eiichi Matsumoto Preferred Networks, Inc. matsumoto@preferred.jp
|
| 6 |
+
|
| 7 |
+
Vincent Sitzmann Massachusetts Institute of Technology sitzmann@mit.edu
|
| 8 |
+
|
| 9 |
+
pfnet-research.github.io/distilled-feature-fields/
|
| 10 |
+
|
| 11 |
+
# Abstract
|
| 12 |
+
|
| 13 |
+
Emerging neural radiance fields (NeRF) are a promising scene representation for computer graphics, enabling high-quality 3D reconstruction and novel view synthesis from image observations. However, editing a scene represented by a NeRF is challenging, as the underlying connectionist representations such as MLPs or voxel grids are not object-centric or compositional. In particular, it has been difficult to selectively edit specific regions or objects. In this work, we tackle the problem of semantic scene decomposition of NeRFs to enable query-based local editing of the represented 3D scenes. We propose to distill the knowledge of off-the-shelf, supervised and self-supervised 2D image feature extractors such as CLIP-LSeg or DINO into a 3D feature field optimized in parallel to the radiance field. Given a user-specified query of various modalities such as text, an image patch, or a point-and-click selection, 3D feature fields semantically decompose 3D space without the need for re-training and enable us to semantically select and edit regions in the radiance field. Our experiments validate that the distilled feature fields can transfer recent progress in 2D vision and language foundation models to 3D scene representations, enabling convincing 3D segmentation and selective editing of emerging neural graphics representations.
|
| 14 |
+
|
| 15 |
+
# 1 Introduction
|
| 16 |
+
|
| 17 |
+
Emerging neural implicit representations or neural fields have been shown to be a promising approach for representing a variety of signals [82, 53, 65, 106, 56]. In particular, they play an important role in 3D scene reconstruction and novel view synthesis from a limited number of context images. Neural radiance fields (NeRF) [56] enabled the recovery of a continuous volume density and radiance field from a limited number of observations, producing high-quality images from arbitrary views via volume rendering with promising applications in computer graphics. However, editing a scene reconstructed by NeRF is non-obvious because the scene is not object-centric and is implicitly encoded in the weights of a connectionist representation such as an MLP [56] or a voxelgrid [23]. Although we can transform the scene in input or output space or via optimization-based editing [37, 97], this does not enable selective object-centric or semantic, local edits, such as moving a single object. Prior work has addressed this challenge via coordinate-level, semantic decompositions which allow to selectively move, deform, paint, or optimize parts of a NeRF, but relies on costly annotation of instance segmentations and training of instance-specific networks [104]. While this can be alleviated with pre-trained segmentation models [25, 41], such models require pre-defined closed label sets and domains (e.g., traffic scenes), limiting decomposition and editing. Local editing of NeRFs ideally requires an efficient, open-set method for coordinate-level decomposition.
|
| 18 |
+
|
| 19 |
+
In this work, we present distilled feature fields (DFFs), a novel approach to query-based scene decomposition for local, interactive editing of NeRFs. We focus on 3D neural feature fields, which map every 3D coordinate to a semantic feature descriptor of that coordinate. Conditioned on a user query such as a text or image patch, this 3D feature field can compute a decomposition of a scene without re-training. We train a scene-specific DFF via teacher-student distillation [34], using supervision from feature encoders pre-trained on the image domain. Unlike the domain of 3D scenes, the image domain boasts massive high-quality datasets and abundant prior work on self-supervised and supervised training of effective feature extraction models. Notably, recently proposed transformer-based models [96, 22] have demonstrated impressive capabilities across various vision- and text-based tasks (e.g., CLIP [69], LSeg [44], DINO [12]). Such feature spaces capture the semantic properties of regions and make it possible to correspond and segment them well by text, image queries, or clustering. We employ these models as teacher networks and distill them into 3D feature fields via volume rendering. The trained feature field enables us to semantically select and edit specific regions in 3D NeRF scenes and render multi-view consistent images from the locally edited scenes.
|
| 20 |
+
|
| 21 |
+
In extensive experiments, we investigate the applications of neural feature fields with two different pre-trained teacher networks, (1) LSeg [44], a CLIP-inspired language-driven semantic segmentation network, and (2) DINO [12, 3], a self-supervised network aware of various object boundaries and correspondences. LSeg and DINO features allow us to select 3D regions by a simple text query or an image patch, respectively. We first quantitatively demonstrate that LSeg-based DFFs with label queries can have high 3D segmentation performance compared with an existing point-cloud based 3D segmentation baseline trained on ScanNet [20], a supervised point-cloud dataset. We then demonstrate a variety of 3D appearance and geometry edits across real-world NeRF scenes with no annotations of segmentation; and show that we may edit regions with a single query of text, image, pixel, or cluster choice.
|
| 22 |
+
|
| 23 |
+
# 2 Related Work
|
| 24 |
+
|
| 25 |
+
Neural Implicit Representations. Neural implicit representations or neural fields have recently advanced neural processing for 3D data and multi-view 2D images [82, 53, 65, 106, 56]. For a review of this emerging space we point the reader to the reports by Kato et al. [39], Tewari et al. [90], and Xie et al. [102]. In particular, a neural radiance field (NeRF) can be fitted to a set of posed 2D images and maps a 3D point coordinate and a view direction to RGB color and density. When observations are limited, NeRF often overfits and fails to synthesize novel views with correct geometry and appearance. Pre-trained vision models have been used for regularizing NeRF via flows [62], multi-view consistency [35], perceptual loss [110], or depth estimation [100, 77]. Some pre-trained models operate not only in the visual world but also in other modalities such as language. The recently proposed CLIP model [69] has demonstrated impressive performance in image-and-text alignment, with strong generalization to various textual and visual concepts. Wang et al. [97], Jain et al. [36], and Poole et al. [68] use CLIP or Imagen [79] to edit or generate a single-object NeRF with a text prompt query by optimizing the NeRF parameters to generate images matched with the text. While such methods are promising, they do not enable accurate selective editing of specific scene regions. For example, the prompt “yellow flowers” may affect unintended scene regions, such as the leaves of a plant. Our proposed decomposition method leverages pre-trained foundation models to enable selective editing of real-world NeRF scenes. Neural descriptor fields [80] use intermediate features that emerge in a 3D occupancy field network [53] for efficiently teaching robots object grasping. Instead of a pre-trained object-centric 3D model, we use 2D vision models as teacher networks via distillation, exploiting recent progress in pre-trained foundation models [7].
|
| 26 |
+
|
| 27 |
+
Geometric Decomposition of Neural Scene Representations Kohli et al. [40] and Zhi et al. [112] show that neural implicit representations can be combined with the supervision of semantic labels. Yang et al. [104] demonstrate that given view-consistent ground-truth instance segmentation masks during training, NeRF can be trained to represent each object as different volumes, although such an annotation is expensive in practice. Concurrently, Benaim et al. [6] also experiment with the different parametarization. Conditional [49, 37, 21, 63] and generative models [60, 61, 31] enable a degree of category-specific decomposition (e.g., human bodyparts) and editing on constrained domains with large datasets. Regular structures such as voxelgrids or octrees [13, 48, 14, 88, 94, 89, 43, 81, 107, 59, 60] or unsupervised decomposition [73, 85, 109, 83] enable editability via manipulation of localized parameters. However, the decomposition is limited due to the inflexibly structured boundaries or strong assumptions about scenes; self-supervised object-centric learning is a difficult task. Other studies also explored reconstruction with more structured hybrid representations via pipelines specialized to a domain (e.g., traffic scene) [64, 25, 41] or situation (e.g., each object data is independently accessible) [28, 27, 105]. Note that this line of work defines and constrains domains or the types of segmentation during or before training and thus limits the degrees of freedom for editable scenes and objects. In contrast, our method can decompose scene-specific NeRFs into arbitrary semantic units via text and image queries, enabling versatile scene edits without retraining. A concurrent paper by Tschernezki et al. [93] also explores the same training framework and, in particular, investigates how fused features are improved from 2D teacher networks. It also complementarily shows the results with other teacher models (MoCo-v3 [17] and DeiT [91]), dimension reduction via PCA, and NeuralDiff [92]-based neural fields. Other concurrent studies explore decomposition through training scene-specific segmentation field [113] or 3DCNN [76] supervised by click or scribble annotations. Lastly, in a different but related task, video editing, Kasten et al. [38] use foreground-background decomposition and atlas representation for time-consistent, local editing; Loeschcke et al. [51] and Bar-Tal et al. [5] further use CLIP for editing.
|
| 28 |
+
|
| 29 |
+
Zero-shot Semantic Segmentation. Zero-shot semantic segmentation is a challenging task [24, 2, 10] where a model has to predict semantic labels of pixels in images without a-priori information of the categories. A typical solution is to use vision-and-language cross-modal encoders. They are trained to encode images (pixels) and text labels into the same semantic space and perform zero-shot prediction based on the similarity or alignments of the two inputs. Recent development of image encoder architectures [96, 22, 71] and large-scale training [69, 12] have improved the ability and generalization of vision models, including zero-shot models [44, 52, 99, 103, 114, 72]. On the other hand, ongoing studies on zero-shot perception in 3D still suffer from the lack of effective, efficient, and high-resolution architectures and large-scale annotated datasets [54, 33, 29, 101, 78, 30]. Our method is a new approach to perform zero-shot semantic segmentation on scene-specific 3D fields by exploiting progress in the image domain without semantic 3D supervision. We note that the goal of this paper is not to achieve state-of-the-art performance on 3D semantic segmentation tasks. Instead, our goal is the decomposition of neural scene representations for editing, which requires smooth segmentation results on continuous 3D space rather than segmentation of discrete point clouds or voxelgrids.
|
| 30 |
+
|
| 31 |
+
# 3 Preliminaries
|
| 32 |
+
|
| 33 |
+
# 3.1 Neural Radiance Fields (NeRF)
|
| 34 |
+
|
| 35 |
+
NeRF [56] uses MLPs to output density $\sigma$ and color c given a point coordinate $\mathbf { x } = ( x , y , z )$ in a 3D scene. This simple scene representation can be rendered and optimized via volume rendering. Given a pixel’s camera ray $\mathbf { r } ( t ) = \mathbf { o } + t \mathbf { d }$ , depth $t$ with bounds $[ t _ { \mathrm { n e a r } } , t _ { \mathrm { f a r } } ]$ , camera position $\mathbf { o }$ , and its view direction $\mathbf { d }$ , NeRF calculates the color of a ray using quadrature of $K$ sampled points $\{ \mathbf { x } _ { k } \} _ { k = 1 } ^ { K }$ with depths $\{ t _ { k } \} _ { k = 1 } ^ { K }$ as
|
| 36 |
+
|
| 37 |
+
$$
|
| 38 |
+
\hat { \mathbf { C } } ( \mathbf { r } ) = \sum _ { k = 1 } ^ { K } \hat { T } ( t _ { k } ) \alpha \left( \sigma ( \mathbf { x } _ { k } ) \delta _ { k } \right) \mathbf { c } ( \mathbf { x } _ { k } , \mathbf { d } ) , \quad \hat { T } ( t _ { k } ) = \exp \left( - \sum _ { k ^ { \prime } = 1 } ^ { k - 1 } \sigma ( \mathbf { x } _ { k ^ { \prime } } ) \delta _ { k ^ { \prime } } \right) ,
|
| 39 |
+
$$
|
| 40 |
+
|
| 41 |
+
where $\alpha \left( x \right) = 1 - \exp ( - x )$ , and $\delta _ { k } = t _ { k + 1 } - t _ { k }$ is the distance between adjacent point samples. NeRFs are optimized solely on a dataset of images and their camera poses by minimizing a rerendering loss.
|
| 42 |
+
|
| 43 |
+
# 3.2 Pre-trained Models and Zero-shot Segmentation of Images
|
| 44 |
+
|
| 45 |
+
Most semantic segmentation models pre-define a closed set of labels, and cannot flexibly change the segmentation categories or boundaries without supervised training. In contrast, zero-shot semantic segmentation predicts target regions given open-set queries. Li et al. [44] proposes LSeg, a model to feature field f and the pretrained text encoder f . Specifically, probability of a label l of a point x in 2 2Rperform zero-shot semantic segmentation by aligning pixel-level features and a text query feature. 182 the 3D space, p(l x), are predicted by dot product of the 3D feature f (x) and text label feature fq(l) = Lp + Lf , Lp = C (r) C(r) 2 , Lf = F(r) fimg(I, r) 1 , (4)4LSeg employs an image feature encoder with the DPT architecture [71] and a CLIP-based text label 183 followed by softmax: 5stency. In addition, importantly for user-friendly interactive editing, w52R 2Rfeature encoder [69], trained via large-scale language-image contrastive learning. The probability of a text label $l$ 4given a pixel $r$ in an image $I$ , $\mathbf { p } ( l | I , r )$ T 4, is then calculated via dot product of pixel-level image feature ${ \bf f } _ { \mathrm { i m g } } ( I , r )$ p(l|x) = Pand queried text feature ${ \bf f } _ { \mathrm { q } } ( l )$ q T . followed by a softmax:
|
| 46 |
+
|
| 47 |
+

|
| 48 |
+
as distillation from 2D teacher network to 3D student 4122 k k+1 k ˆ 214 breaks 3D consistency. In addition, importantly f214 breaks 3D consistency. In addition, importantly for usemize f through SGD on minimizing the difference between rendered features F (r) andLp = X Cˆ (r) C(r) , Lf = X Fˆ(r) fimg(I, r) , (4)iginal NeRF [46] for the training objective and the volume rendering strategy. Inps://huggingface.co/sentence-transformers/clip-ViT-B-32-multilingual-v1Figure 1: Left: A Distilled Feature Field (DFF) maps a coordinate x and a viewing direction d to ll this mode 124 work via ther2Rs Fˆ (r) anddensity $\sigma$ eural Perceptual Fields (NePeRF). els and ground-truth pixels of real images. nconsistent supervision with noise could harm reconstruction quality of geometry, although the lume rendering trick. We call this model distilled feature field (DFF).r2Re teacher’s outputs f (I, r). For volume rendering, we use two 4184 , color c, and feature f . It is trained by minimizing the difference between rendered features sformers/clip-ViT-B-32-multilingual-v1178 effect seems negligible in preliminary experiments. d at any 3D point without limiting resolution, so naturally used tog41 It is an interesting direction to introduce view de1 It is an interesting direction to introduce view dependehe original NeRF [46] for the training objective and the volume rendering strategy. Inume rendering with coarse-and-fine hierarchical sampling as well as the original185 and feature loss Lf , in total, L:and features as predicted by a pre-trained image feature encoder, as well as the rendered color and 3t is an interesting direction to introduce view dependency to the segmentation for discriminating view-dependent query like referring expressions (e.g., “the chdependent query like referring expressions (e.g., “the chair lef the photometric loss, we add a new objective for minimizing the difference betweenˆ 4 pLf , in total, L: 2ground-truth pixel color. Right: At test time, we may decompose and edit 3D space via selecting and 4 179 4.2 Query-based Decomposition and Editingdent query like referring expressions (e.g., “the chair left to the table” 2020, Liu et img or volume rendering with coarse-and-fine hierarchical sampling as well as the originalX ˆ 2 X ˆ L = Lp + Lf , Lp manipulating different 3D regions with a variety of queries.
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
{ \bf p } ( l | I , r ) = \frac { \exp ( { \bf f } _ { \mathrm { i m g } } ( I , r ) { \bf f } _ { \mathrm { q } } ( l ) ^ { \mathrm { T } } ) } { \sum _ { l ^ { \prime } \in \mathcal { L } } \exp ( { \bf f } _ { \mathrm { i m g } } ( I , r ) { \bf f } _ { \mathrm { q } } ( l ^ { \prime } ) ^ { \mathrm { T } } ) } ,
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
186 where $\mathcal { L }$ is a set of possible labels. If negative labels are not available, we may use other scores like and the query2 188 , so it and view synthesis with it are 3D consistent as well as the original NeRF. Unlikethresholded cosine similarity to directly compute the probability of a label. During training, LSeg 189 the proposed method, editing optimizes only the image encoder ${ \bf f } _ { \mathrm { i m g } } \bar { ( } I , r )$ nthesized images by image-based postprocessing breaksby minimizing cross-entropy on supervised semantic 190 3D consistency. In addition, we can chsegmentation datasets. The text encoder ${ \bf f } _ { \mathrm { q } } ( l )$ he segmentation by changing only the query withoutis obtained from a pre-trained CLIP model [69]. 191 retraining, which cannot be realized by existing methods using closed-set semantic segmentation [ZhiRecently, pre-trained CLIP has been leveraged as the backbone for a variety of tasks and has been 192 et al., 2021a] or instance segmentation annotation [Yang et al., 2021], but important for user-friendlyextended with additional modules sharing the same latent space. For example, Reimers and Gurevych [74, 75] trains a multi-lingual (more than $5 0 +$ languages) text encoder, which enables CLIP and 2 It is an interesting direction to introduce view dependency to the segmentation for discriminating view-CLIP-inspired variants to use non-English queries like Japanese. We similarly use the latent space of dependent query like referring expressions (e.g., “the chair left to the table”), but left for future work.a pre-trained CLIP for LSeg via distillation, enabling the decomposition of NeRFs with both English and non-English queries. Segmentation can further be performed with other modalities such as image, patch or pixel query features $\mathbf { f } _ { \mathrm { q } }$ 5using a similar dot-product similarity formulation as in Eq. 2. Notably, DINO [12], a self-supervised vision model, solves video instance segmentation and tracking by calculating similarity among features in adjacent frames. Amir et al. [3] also demonstrate that DINO features work well on co-segmentation and point correspondence by similarity and clustering. In our experiments, we use these two publicly available models, LSeg and DINO, to obtain features of images and texts for 3D decomposition.
|
| 55 |
+
|
| 56 |
+
# 4 Distilled Feature Fields
|
| 57 |
+
|
| 58 |
+
# 4.1 Distilling Foundation Modules into 3D Feature Fields via Volume Rendering
|
| 59 |
+
|
| 60 |
+
NeRF learns a neural field to compute the density and view-dependent color, $\sigma ( \mathbf { x } )$ and $\mathbf { c } ( \mathbf { x } , \mathbf { d } )$ . We may extend NeRF by adding decoders for other quantities of interest. For example, SemanticNeRF [112] adds a branch outputting a probability distribution of closed-set semantic labels, trained with supervision via images with ground-truth semantic labels. This enables the prediction of pairs of RGB and semantic segmentation masks from novel views, useful for data augmentation. However, because ground-truth annotation is costly, the method is inefficient as a means of scene editing [104]. For specific domains like traffic scenes [25, 41], we may instead train a closed-set segmentation model and use its prediction for training object-aware neural fields. However, this approach is possible only if the types of objects are limited and the domain-specific supervised dataset is available; limiting the application of scene editing in terms of domain and flexibility of decomposition.
|
| 61 |
+
|
| 62 |
+
We build on top of these ideas and perform 3D zero-shot segmentation of NeRFs using open-set text labels or other feature queries. Instead of a branch performing closed-set classification, we propose to add a feature branch outputting a feature vector itself. This branch models a 3D feature field describing the semantics of each spatial point. We supervise the feature field by a pretrained pixel-level image encoder $\mathbf { f } _ { \mathrm { i m g } }$ as a teacher network. Given a 3D coordinate $\mathbf { x }$ , the feature field outputs a feature vector $\mathbf { f } \left( \mathbf { x } \right)$ in addition to density $\sigma ( \mathbf { x } )$ and color $\mathbf { c } ( \mathbf { x } , \mathbf { d } )$ , as shown in Fig. 1. Volume rendering of the feature field is similarly performed via
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\hat { \mathbf { F } } ( \mathbf { r } ) = \sum _ { k = 1 } ^ { K } \hat { T } ( t _ { k } ) \alpha ( \sigma ( \mathbf { x } _ { k } ) \delta _ { k } ) \mathbf { f } ( \mathbf { x } _ { k } ) \ .
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
We can optimize f by minimizing the difference between rendered features $\hat { \mathbf { F } } ( \mathbf { r } )$ and the teacher’s features ${ \bf f } _ { \mathrm { i m g } } ( I , r )$ . Effectively, we are distilling [34] the 2D teacher network into our 3D student network via differentiable rendering, and thus dub this model a distilled feature field (DFF). We add a feature objective $\mathcal { L } _ { f }$ penalizing the difference between rendered features $\hat { \mathbf { F } } ( \mathbf { r } )$ and the teacher’s outputs ${ \bf f } _ { \mathrm { i m g } } ( I , r )$ to the photometric loss of the original NeRF. We use two networks for volume rendering with coarse-and-fine hierarchical sampling. We thus minimize the sum of photometric loss $L _ { p }$ and feature loss $L _ { f }$ , in total, $L$ :
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
L = L _ { p } + \lambda L _ { f } , L _ { p } = \sum _ { \mathbf { r } \in \mathbb { R } } \left\| \hat { \mathbf { C } } ( \mathbf { r } ) - \mathbf { C } ( r ) \right\| _ { 2 } ^ { 2 } , L _ { f } = \sum _ { \mathbf { r } \in \mathbb { R } } \left\| \hat { \mathbf { F } } ( \mathbf { r } ) - \mathbf { f } _ { \mathrm { i m g } } ( I , r ) \right\| _ { 1 } ,
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
where $\mathcal { R }$ are sampled rays, $\mathbf { C } ( r )$ is the ground truth pixel color of ray $r$ , $\lambda$ is the weight of the feature loss and is set to 0.04 to balance the losses [112]. We apply stop-gradient to density in rendering of features $\hat { \mathbf { F } } ( \mathbf { r } )$ in Equation 3 as the teacher’s features ${ \bf f } _ { \mathrm { i m g } } ( I , r )$ are not fully multi-view consistent, which could harm the quality of reconstructed geometry.
|
| 75 |
+
|
| 76 |
+
# 4.2 Query-based Decomposition and Editing
|
| 77 |
+
|
| 78 |
+
A trained DFF model can perform 3D zero-shot segmentation by its feature field $\mathbf { f }$ and a query encoder $\mathbf { f } _ { \mathrm { q } }$ . Probability of a label $l$ of a point $\mathbf { x }$ in the 3D space, ${ \bf p } ( l | { \bf x } )$ , is calculated by dot product of the 3D feature $\mathbf { f } \left( \mathbf { x } \right)$ and text label feature ${ \bf f } _ { \mathrm { q } } ( l )$ followed by a softmax:
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\mathbf { p } ( l | \mathbf { x } ) = \frac { \exp ( \mathbf { f } ( \mathbf { x } ) \mathbf { f } _ { \mathrm { q } } ( l ) ^ { \mathrm { T } } ) } { \sum _ { l ^ { \prime } \in \mathcal { L } } \exp ( \mathbf { f } ( \mathbf { x } ) \mathbf { f } _ { \mathrm { q } } ( l ^ { \prime } ) ^ { \mathrm { T } } ) } \mathrm { ~ . ~ }
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
This query-based segmentation field is at the core of the proposed method. It can be calculated at any 3D point without limiting resolution, naturally used in tandem with a radiance field and volume rendering. Note that the segmentation depends on only the 3D coordinate and the query1. As the original NeRF, it is thus multi-view consistent. In addition and important for interactive editing, we can change the segmentation via queries without re-training, which cannot be realized by closed-set methods using semantic [112] or instance segmentation annotation [104]. We may now use this query-conditional segmentation to identify a specific 3D region for editing. Various edits can be generalized to the merging of two NeRF scenes $\sigma _ { 1 } ( \mathbf { x } ) , \mathbf { c } _ { 1 } ( \mathbf { x } , \mathbf { d } )$ and $\sigma _ { 2 } ( \mathbf { x } ) , \mathbf { c } _ { 2 } ( \mathbf { x } , \mathbf { d } )$ , where we use the segmentation field $\mathbf { p }$ for blending. In the experiments section, we simply modify Eq. 1 as a blend of two scenes based on the ratio of $\alpha$ :
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
\begin{array} { l } { { \displaystyle { \hat { \bf C } } ( { \bf r } ) = \sum _ { k = 1 } ^ { K } { \hat { T } } ( t _ { k } ) \left( \alpha ( \sigma _ { 1 } ( { \bf x } _ { k } ) \delta _ { k } ) { \bf c } _ { 1 } ( { \bf x } _ { k } , { \bf d } ) \rho _ { k } + \alpha ( \sigma _ { 2 } ( { \bf x } _ { k } ) \delta _ { k } ) { \bf c } _ { 2 } ( { \bf x } _ { k } , { \bf d } ) ( 1 - \rho _ { k } ) \right) } , } \\ { { \displaystyle ~ , ~ \rho _ { k } = \frac { \alpha \left( \sigma _ { 1 } ( { \bf x } _ { k } ) \delta _ { k } \right) } { \alpha \left( \sigma _ { 1 } ( { \bf x } _ { k } ) \delta _ { k } \right) + \alpha \left( \sigma _ { 2 } ( { \bf x } _ { k } ) \delta _ { k } \right) } , ~ { \hat { T } } ( t _ { k } ) = \prod _ { k ^ { \prime } = 1 } ^ { k - 1 } \alpha ( \sigma _ { 1 } ( { \bf x } _ { k ^ { \prime } } ) \delta _ { k ^ { \prime } } ) + \alpha ( \sigma _ { 2 } ( { \bf x } _ { k ^ { \prime } } ) \delta _ { k ^ { \prime } } ) } . } \end{array}
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
For example, if we want to apply a geometric transformation $\mathbf { g }$ to a region of a query $l$ in a NeRF scene $( \sigma , \mathbf { c } )$ , we can render the transformed scene via Eqs. 6 and 7 by setting $\alpha ( \sigma _ { 1 } ( { \bf x } _ { k } ) \delta _ { k } ) =$ $( 1 - \mathbf { p } ( l | \mathbf { x } _ { k } ) ) \alpha ( \sigma ( \mathbf { x } _ { k } ) \delta _ { k } )$ , $\boldsymbol { \alpha } ( \sigma _ { 2 } ( \mathbf { x } _ { k } ) \boldsymbol { \delta } _ { k } ) = \mathbf { p } ( l | \mathbf { g } ^ { - 1 } ( \mathbf { x } _ { k } ) \big ) \boldsymbol { \alpha } ( \sigma ( \mathbf { g } ^ { - 1 } ( \mathbf { x } _ { k } \big ) ) \boldsymbol { \delta } _ { k } ) ,$ $\mathbf { c } _ { 1 } ( \mathbf { x } _ { k } , \mathbf { d } ) = ( 1 -$ $\mathbf { p } ( l | \mathbf { x } _ { k } ) ) \mathbf { c } ( \mathbf { x } _ { k } , \mathbf { d } )$ , and $\mathbf { c } _ { 2 } ( \mathbf { x } _ { k } , \mathbf { d } ) = \mathbf { p } ( l | \mathbf { g } ^ { - 1 } ( \mathbf { x } _ { k } ) ) \mathbf { c } ( \mathbf { g } ^ { - 1 } ( \mathbf { x } _ { k } ) , \mathbf { g } ^ { - 1 } ( \mathbf { d } ) )$ . More details of editing for colorization, translation, and deletion are shown in Appendix B. We can combine this with more complex edits, including optimization-based methods like CLIPNeRF [97]. While CLIPNeRF itself cannot selectively edit specific regions in multi-object scenes, our decomposition method enables it to update only desired objects without breaking unintended areas.
|
| 91 |
+
|
| 92 |
+

|
| 93 |
+
Figure 2: Comparison of predictions by coarse and fine MLPs.
|
| 94 |
+
|
| 95 |
+
Table 1: Performance of 3D semantic segmentation on Replica dataset. DFF outperforms a supervised point-cloud segmentation model MinkowskiNet42.
|
| 96 |
+
|
| 97 |
+
<table><tr><td></td><td>mIoU</td><td>accuracy</td></tr><tr><td>Supervised 3DCNN</td><td>0.475</td><td>0.758</td></tr><tr><td>DFF (Coarse)</td><td>0.589</td><td>0.855</td></tr><tr><td>DFF (Fine)</td><td>0.583</td><td>0.855</td></tr></table>
|
| 98 |
+
|
| 99 |
+
# 5 Experiments
|
| 100 |
+
|
| 101 |
+
We first conduct a quantitative evaluation of the decomposition achieved by DFF. We demonstrate that DFF enables 3D semantic segmentation in a benchmark dataset using scanned point clouds with human-annotated semantic segmentation labels. We then investigate the capabilities of DFF for editing and subsequent novel-view synthesis on real-world datasets. We use two teacher networks, LSeg [44] and DINO [12], which are pre-trained and publicly available. Each training image is encoded by the image encoders of the networks and used as target feature maps, ${ \bf f } _ { \mathrm { i m g } } ( I , r )$ , defined in Equation 4. Because the feature maps are of reduced sizes due to the limitation of the networks, we first resize them to the original image size. The implementation and settings of NeRF, unless otherwise stated, follow Zhi et al. [112]. During the training of 200K iterations, the loss $L$ in Equation 4 is minimized by Adam with a linearly decaying learning rate (5e-4 to 8e-5). During training, Gaussian noise for density is also applied. The number of coarse and fine samplings is 64 and 128, respectively. The MLP of the neural radiance field consists of eight ReLU layers with 256 dimensions, followed by a linear layer for density, three layers for color, and three layers for feature, as shown in Fig. 1. Positional encoding of length 10 is used for the input coordinate and its skip connection, and that of length 4 is for viewing direction. If an independent MLP is prepared for the feature field, it consists of four layers (with a skip connection at the third layer if the positional encoding is used). The size of a training image is $3 2 0 \times 2 4 0$ for the Replica dataset and $1 0 0 8 \times 7 5 6$ for the other datasets. The batchsize of training rays is 1024 for Replica and 2048 for the others. During finetuning of feature fields or radiance fields, Gaussian noise is removed, and the learning rate is set to 1e-4. See appendix A and C for further training details.
|
| 102 |
+
|
| 103 |
+
# 5.1 3D Semantic Segmentation
|
| 104 |
+
|
| 105 |
+
We construct a 3D semantic segmentation benchmark from four scenes in the Replica dataset [86] with data split and posed images provided by [112]. See appendix D for further details of the dataset. We train DFF to reconstruct each scene with radiance and feature fields from training images and evaluate the quality of novel view synthesis and 3D segmentation of the annotated point clouds. We use LSeg as a teacher network. The LSeg text encoder encodes each label, and the probability of each point is calculated by Equation $\cdot$ . Note that the training uses only the photometric and feature losses (Equation 4) and does not access any supervision via semantic labels.
|
| 106 |
+
|
| 107 |
+
Semantic Segmentation Results. First, we show evaluation metrics of 3D semantic segmentation, mean intersection-over-union (mIoU) and accuracy in Table 1. For comparison, we also experiment with a sparse 3D convolution-based segmentation model, MinkowskiNet42 [18] taking a colored point cloud as input. It has a standard state-of-the-art architecture for point cloud segmentation and is trained on the ScanNet dataset [20], the largest annotated training dataset of 3D semantic segmentation3. Results demonstrate that DFF, taught by $\mathrm { L S e g }$ , achieves promising performance, even better than the supervised model. This indicates that DFF succeeds at distilling 3D semantic segmentation from the 2D teacher network.
|
| 108 |
+
|
| 109 |
+
Table 2: Performance of novel view synthesis on Replica dataset. PSNR, SSIM, and LPIPS are metrics of image synthesis. $\delta { < } 1 . 2 5$ and absrel are metrics of geometry (depth estimation).
|
| 110 |
+
|
| 111 |
+
<table><tr><td></td><td>PSNR↑</td><td>SSIM↑</td><td>LPIPS↓</td><td>δ<1.25↑</td><td>absrel</td></tr><tr><td>basic NeRF</td><td>32.87</td><td>0.934</td><td>0.148</td><td>0.993</td><td>0.018</td></tr><tr><td>DFF</td><td>32.85</td><td>0.932</td><td>0.150</td><td>0.993</td><td>0.017</td></tr><tr><td>DFF (overweighting 入)</td><td>32.68</td><td>0.927</td><td>0.162</td><td>0.993</td><td>0.018</td></tr></table>
|
| 112 |
+
|
| 113 |
+
Impact of Sampling on Semantic Segmentation. NeRF employs two MLPs for hierarchical sampling, where the coarse MLP performs volume rendering with fewer points (64) using stratified sampling, and the fine MLP works with importance sampling (192 in total). So, we have two sampling options to train a feature field. Although fine sampling is critical for training accurate radiance fields, segmentation is of significantly lower spatial frequency than texture. We thus analyze the impact of coarse and fine training in Fig. 2. As expected, the coarse model produces smooth segmentations, while the fine version introduces high-frequency artifacts. This smoothness property is important for natural editable novel view synthesis and is discussed again later.
|
| 114 |
+
|
| 115 |
+
Compatibility with View Synthesis. We also check and compare the quality of novel view synthesis with NeRF, which does not learn feature fields. Because the feature branch partially shares the layers with the radiance field (as shown in Fig. 1), learning feature fields could possibly harm the radiance field. Despite this concern, as shown in Tab. 2, the performance of view synthesis is not degraded. Thus, we can train and use the branch-based DFF with small computational and parameter overhead compared to the original NeRF. If we excessively increased the weight of the feature loss, $\lambda \times 1 0$ , it hurt view synthesis while not improving segmentation performance further. We further confirm that training independent, light-weight feature-field MLP, instead of a branch of the radiance-field MLP, achieves semantic segmentation results competitive with the branch-based approach (see appendix Tab. 3 for the result of all variants)4. This option is useful especially when we want to introduce DFF decomposition into arbitrary 3D scene representations, including off-the-shelf NeRF models, dynamic NeRFs [26, 66, 45], or meshes, without re-training of the radiance field.
|
| 116 |
+
|
| 117 |
+
# 5.2 Editable Novel View Synthesis
|
| 118 |
+
|
| 119 |
+
In the previous section, we quantitatively validated the ability of DFF to perform semantic decomposition. We now discuss the capability for editable view synthesis on real-world scenes, including the LLFF dataset [55] and our own dataset. Our method can be used even for LLFF scenes based on normalized device coordinates. Please see the supplemental web page for further results, including videos. In addition to $\mathrm { L S e g }$ using a text query, we also experiment with self-supervised DINO [12] as another teacher network to enable query-based decomposition using image patch queries. Here, we use thresholded cosine similarity to directly compute the probability of a query instead of softmax with negative queries in Eq. 5 and set $\mathbf { p } = 1$ if the similarity exceeds the threshold 5, and $\mathbf { p } = 0$ otherwise for hard decomposition. We first train NeRFs without a feature branch for each scene for 200K iterations $( L _ { p } )$ and then finetune them with a feature branch via distillation for 5K iterations $( L _ { p } + \lambda L _ { f } )$ since we found that the feature loss converged significantly faster than the photometric loss and short training was thus sufficient. We use coarse sampling for training feature branches and use it for edited rendering with fine sampling. See appendix A for the details.
|
| 120 |
+
|
| 121 |
+

|
| 122 |
+
Figure 3: Appearance edits of specific objects via different query modalities: an image patch or text.
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
Figure 4: Extraction and deletion of specific objects via different query modalities, an image patch or text. The edited views are 3D consistent, unlike an image inpainting baseline [87]
|
| 126 |
+
|
| 127 |
+
Appearance Editing, Deletion, Extraction. We show qualitative evaluations of novel view synthesis in Fig. 3 and Fig. 4. Specific 3D regions in these scenes are identified and locally edited via decomposition depending on various query modalities. In these experiments, we use a text query for LSeg-DFF as in Section 5.1 and use an image patch query for DINO-DFF. Because DINO features capture the similarity and correspondences of regions well thanks to self-supervised learning [12, 3], image patch queries help select all semantically similar areas at once. The patch feature is then calculated by averaging the features of all pixels in the patch.
|
| 128 |
+
|
| 129 |
+
In Fig. 3, we demonstrate that the DFF enables convincing selective appearance edits. Because our focus is region selection via decomposition, we use simple color transformation for clarity here (e.g., flip RGB to BGR, blend colors). One might think that the MLP of a radiance field by the original NeRF also has hidden layers, and their features could possibly be used for decomposition. We confirm that the naive usage of NeRF features is not robust to decomposition, as shown in Fig. 5, especially in a complex multi-object scene. We use the 8th hidden layer of the fine radiance field network (i.e., the layer just before branching in Fig. 1) 6. NeRF features cannot clearly decompose even objects with simple shapes and colors. The region selections are leaked to other parts with similar colors, geometry, or positions while they do not entirely cover the targets. For example, floor selection is leaked to walls, a table, bins, or ceilings. Chair selection is leaked to irrelevant black parts like television, cables, lighting equipment, or shadows. This indicates that the feature space of the original NeRF does not learn semantic similarity well and is entangled with unpredictable and more low-level factors like color or spatial adjacency.
|
| 130 |
+
|
| 131 |
+
In Fig. 4, we demonstrate that the DFF also works well on deletion or extraction of objects, using two patch queries (query- $\textcircled{1}$ for leaves and ground, query- $\textcircled{2}$ for flowers) and a text query- $\textcircled{3}$ “flower”. For comparison with a baseline editing method, we show the results by a state-of-the-art image inpainting model, LaMa [87]. Because the model requires masks for inpainting regions, we manually annotate the views for evaluation. As shown in the figure, the image inpainting model cannot generate clear and realistic images, and the different views are inconsistent. On the other hand, DFF produces multi-view consistent plausible results, especially succeeding at extracting foreground objects. Although the performance on deleting foreground objects is high, a remaining shortcoming is the existence of floating artifacts and blurred volumes in the far distance behind the deleted object.
|
| 132 |
+
|
| 133 |
+
Priors for Smooth Decomposition We can organize the challenges of editable NeRFs into several categories: surface decomposition, volume decomposition, lighting decomposition, and estimation of less or never observed parts. If we edit appearances only, it practically requires decomposing regions only near the surface of objects, i.e., surface decomposition, because the color of a ray is determined mostly in a condensed interval around the surface. On the other hand, geometric transformations often require a higher level of decomposition. As shown in the deletion examples, geometric transformation may move or remove some surfaces and expose the space behind them. This forces models to render unknown regions less or never observed due to occlusions, including even the inside of objects. Thus, it is desirable to decompose volumes smoothly while synthesizing their inside and back7. Although these include the same challenges as novel view synthesis tackles, editability further highlights their importance.
|
| 134 |
+
|
| 135 |
+

|
| 136 |
+
Figure 5: Appearance edits of specific objects, compared with decomposition using features of a NeRF hidden layer. For reference, we also show PCA-based visualizations of the features.
|
| 137 |
+
|
| 138 |
+

|
| 139 |
+
Figure 6: Comparison of predictions by a branch-based feature field MLP and independent MLP with no positional encoding, each of which is trained with coarse and fine sampling.
|
| 140 |
+
|
| 141 |
+
Apart from lighting decomposition discussed in prior work [8, 9, 111], we further investigate the new challenge of smooth volume decomposition by experimenting with different DFF setups. As discussed in Section 5.1, DFF has two sampling options to train feature fields. The coarse training may introduce smoothness regularization and help cohesive decomposition and smoother in-painting of unobserved regions. Another reasonable smoothness regularizer is to eliminate the high-frequency positional encoding (PE). We thus train an independent MLP network for a feature field without PE. We compare four combinations of renderings in Fig. 6. To better understand their behavior, we use the DINO-DFF, show k-means clusters of the rendered feature map, and delete the head of the Triceratops by a query choosing its corresponding clusters. As expected, coarsely trained models and no-PE models succeed in smoother volume decomposition, and this combination can minimize high-frequency floating artifacts. A side effect is the lack of high-frequency representation power, which sometimes deletes disparate background regions and misses to represent features of complex structures (e.g., see the cluster visualization of the thin frames of the window). Towards the best of both worlds, developing proper priors or inductive biases is an important direction for future work [70]. Otherwise, surface-aware representations like IDR [106, 98] could avoid problems with floating artifacts. Note that not all geometric edits suffer from these problems. For example, it is often less problematic to move objects closer to the camera, enlarge them, or warp them to other scenes, as shown in Fig. 7.
|
| 142 |
+
|
| 143 |
+

|
| 144 |
+
Figure 7: Editing with warping, deformation, shift, and rotation.
|
| 145 |
+
|
| 146 |
+
Localizing Optimization-based Editing. Finally, we show a combination with an optimizationbased editing method. CLIPNeRF [97] optimizes the parameters of a radiance field so that its rendered images match with a text prompt via CLIP. While it is mainly designed for a single-object scene of specific categories, it is possible to apply to other real-world NeRFs. However, because it cannot control the scope of editing, a prompt like “white flower” may change the color of unintentional targets like leaves. Our DFF-based decomposition can upgrade such an optimization-based method to render a scene via the composition of a CLIP-optimized NeRF scene and the original NeRF scene. We show the results in Fig. 88. Although the naive CLIPNeRF edits unintentional parts, our method helps it to locally edit intentional parts only. In addition to switching rendering, we can also use the decomposition for controlling training signals during backpropagation. The additional experiment is shown in Appendix F. These extensions broaden the application of CLIPNeRF or other optimization-based editing methods to complex scenes.
|
| 147 |
+
|
| 148 |
+

|
| 149 |
+
Figure 8: Comparison of appearance editing by CLIPNeRF and our extension.
|
| 150 |
+
|
| 151 |
+
# 6 Discussion, Limitations, and Conclusions
|
| 152 |
+
|
| 153 |
+
In this work, we propose distilled feature field (DFF), a novel method of NeRF scene decomposition for selective editing. We present quantitative evaluations of segmentation and extensive qualitative evaluations of editable novel view synthesis. In addition to these promising results, DFF-based models will benefit from future improvements to self-supervised 2D foundation models. We also clarify future directions on editable view synthesis through our experiments, especially for smoothness priors and estimation of unobserved regions. Furthermore, while this work focuses on editable view synthesis, it is also intriguing to transfer DFF to other applications, including 3D registration of text queries [16, 1, 47, 4] or robot teaching [32, 80].
|
| 154 |
+
|
| 155 |
+
The limitations of the DFF framework are two-fold. The first one is the upper bduround of the performance due to distillation. The student model of distillation cannot largely outperform the teacher model9. If the resolution of teacher encoders is low, the corresponding DFFs also becomes coarse-grained. If the LSeg cannot understand a text query, the LSeg-DFF also cannot. Secondly, the DFF uses volume rendering depending on the 3D reconstruction by NeRF. A NeRF model is sometimes optimized to geometrically wrong solutions (e.g., floaters). Such geometry errors of the radiance fields would make supervision to DFFs noisy.
|
| 156 |
+
|
| 157 |
+
As a possible negative societal impact, one might use our method for making realistic but fake content by editing NeRFs as desired. Automatic fake detection methods may help in preventing such misuse. NeRFs are further computation-intense, leading to high electricity usage. Recent work on efficient NeRFs [23, 57, 15] may alleviate this concern.
|
| 158 |
+
|
| 159 |
+
# Acknowledgements
|
| 160 |
+
|
| 161 |
+
We thank Tsukasa Takagi, Toshiki Nakanishi, Hiroharu Kato, and Masaaki Fukuda for their helpful feedback.
|
| 162 |
+
|
| 163 |
+
# References
|
| 164 |
+
|
| 165 |
+
[1] Panos Achlioptas, Ahmed Abdelreheem, Fei Xia, Mohamed Elhoseiny, and Leonidas J. Guibas. ReferIt3D: Neural listeners for fine-grained 3d object identification in real-world scenes. In 16th European Conference on Computer Vision (ECCV), 2020.
|
| 166 |
+
[2] Zeynep Akata, Florent Perronnin, Zaid Harchaoui, and Cordelia Schmid. Label-embedding for image classification. IEEE Transactions on Pattern Analysis and Machine Intelligence, 38 (7):1425–1438, 2016.
|
| 167 |
+
|
| 168 |
+
[3] Shir Amir, Yossi Gandelsman, Shai Bagon, and Tali Dekel. Deep vit features as dense visual descriptors. arXiv preprint arXiv:2112.05814, 2021.
|
| 169 |
+
|
| 170 |
+
[4] Daichi Azuma, Taiki Miyanishi, Shuhei Kurita, and Motoki Kawanabe. Scanqa: 3d question answering for spatial scene understanding. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 171 |
+
|
| 172 |
+
[5] Omer Bar-Tal, Dolev Ofri-Amar, Rafail Fridman, Yoni Kasten, and Tali Dekel. Text2live: Text-driven layered image and video editing. In Proceedings of the European Conference on Computer Vision (ECCV), 2022.
|
| 173 |
+
|
| 174 |
+
[6] Sagie Benaim, Frederik Warburg, Peter Ebert Christensen, and Serge Belongie. Volumetric disentanglement for 3d scene manipulation. arXiv, 2022.
|
| 175 |
+
|
| 176 |
+
[7] Rishi Bommasani, Drew A. Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S. Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, Erik Brynjolfsson, Shyamal Buch, Dallas Card, Rodrigo Castellon, Niladri S. Chatterji, Annie S. Chen, Kathleen Creel, Jared Quincy Davis, Dorottya Demszky, Chris Donahue, Moussa Doumbouya, Esin Durmus, Stefano Ermon, John Etchemendy, Kawin Ethayarajh, Li FeiFei, Chelsea Finn, Trevor Gale, Lauren Gillespie, Karan Goel, Noah D. Goodman, Shelby Grossman, Neel Guha, Tatsunori Hashimoto, Peter Henderson, John Hewitt, Daniel E. Ho, Jenny Hong, Kyle Hsu, Jing Huang, Thomas Icard, Saahil Jain, Dan Jurafsky, Pratyusha Kalluri, Siddharth Karamcheti, Geoff Keeling, Fereshte Khani, Omar Khattab, Pang Wei Koh, Mark S. Krass, Ranjay Krishna, Rohith Kuditipudi, and et al. On the opportunities and risks of foundation models. arXiv, 2021. URL https://arxiv.org/abs/2108.07258.
|
| 177 |
+
|
| 178 |
+
[8] Mark Boss, Raphael Braun, Varun Jampani, Jonathan T. Barron, Ce Liu, and Hendrik P. A. Lensch. Nerd: Neural reflectance decomposition from image collections. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), 2021. URL http://arxiv. org/abs/2012.03918v4.
|
| 179 |
+
|
| 180 |
+
[9] Mark Boss, Varun Jampani, Raphael Braun, Ce Liu, Jonathan T. Barron, and Hendrik Lensch. Neural-PIL: Neural pre-integrated lighting for reflectance decomposition. In A. Beygelzimer, Y. Dauphin, P. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems, 2021. URL https://openreview.net/forum?id=fATZNtA1-V0.
|
| 181 |
+
|
| 182 |
+
[10] Maxime Bucher, Tuan-Hung VU, Matthieu Cord, and Patrick Pérez. Zero-shot semantic segmentation. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché- Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32, 2019. URL https://proceedings.neurips.cc/paper/2019/file/ 0266e33d3f546cb5436a10798e657d97-Paper.pdf.
|
| 183 |
+
|
| 184 |
+
[11] Holger Caesar, Jasper Uijlings, and Vittorio Ferrari. Coco-stuff: Thing and stuff classes in context. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1209–1218, 2018.
|
| 185 |
+
|
| 186 |
+
[12] Mathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou, Julien Mairal, Piotr Bojanowski, and Armand Joulin. Emerging properties in self-supervised vision transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 9650–9660, October 2021.
|
| 187 |
+
|
| 188 |
+
[13] Rohan Chabra, Jan Eric Lenssen, Eddy Ilg, Tanner Schmidt, Julian Straub, Steven Lovegrove, and Richard Newcombe. Deep local shapes: Learning local sdf priors for detailed 3d reconstruction. In Proceedings of the European Conference on Computer Vision (ECCV), 2020. URL http://arxiv.org/abs/2003.10983v3.
|
| 189 |
+
|
| 190 |
+
[14] Anpei Chen, Zexiang Xu, Fuqiang Zhao, Xiaoshuai Zhang, Fanbo Xiang, Jingyi Yu, and Hao Su. Mvsnerf: Fast generalizable radiance field reconstruction from multi-view stereo. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), 2021. URL http://arxiv.org/abs/2103.15595v2.
|
| 191 |
+
|
| 192 |
+
[15] Anpei Chen, Zexiang Xu, Andreas Geiger, Jingyi Yu, and Hao Su. Tensorf: Tensorial radiance fields. In Proceedings of the European Conference on Computer Vision (ECCV), 2022.
|
| 193 |
+
|
| 194 |
+
[16] Dave Zhenyu Chen, Angel X Chang, and Matthias Nießner. Scanrefer: 3d object localization in rgb-d scans using natural language. 16th European Conference on Computer Vision (ECCV), 2020.
|
| 195 |
+
|
| 196 |
+
[17] Xinlei Chen, Saining Xie, and Kaiming He. An empirical study of training self-supervised vision transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 9640–9649, 2021.
|
| 197 |
+
|
| 198 |
+
[18] Christopher Choy, JunYoung Gwak, and Silvio Savarese. 4d spatio-temporal convnets: Minkowski convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3075–3084, 2019.
|
| 199 |
+
|
| 200 |
+
[19] Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The cityscapes dataset for semantic urban scene understanding. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3213–3223, 2016.
|
| 201 |
+
|
| 202 |
+
[20] Angela Dai, Angel X. Chang, Manolis Savva, Maciej Halber, Thomas Funkhouser, and Matthias Nießner. Scannet: Richly-annotated 3d reconstructions of indoor scenes. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
|
| 203 |
+
|
| 204 |
+
[21] Boyang Deng, JP Lewis, Timothy Jeruzalski, Gerard Pons-Moll, Geoffrey Hinton, Mohammad Norouzi, and Andrea Tagliasacchi. Nasa: Neural articulated shape approximation. In Proceedings of the European Conference on Computer Vision (ECCV), 2020. URL http://arxiv.org/abs/1912.03207v4.
|
| 205 |
+
|
| 206 |
+
[22] 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 International Conference on Learning Representations, 2021. URL https:/ /openreview.net/forum?id $\cdot ^ { = }$ YicbFdNTTy.
|
| 207 |
+
|
| 208 |
+
[23] Sara Fridovich-Keil, Alex Yu, Matthew Tancik, Qinhong Chen, Benjamin Recht, and Angjoo Kanazawa. Plenoxels: Radiance fields without neural networks. In CVPR, 2022.
|
| 209 |
+
|
| 210 |
+
[24] Andrea Frome, Greg S Corrado, Jon Shlens, Samy Bengio, Jeff Dean, Marc' Aurelio Ranzato, and Tomas Mikolov. Devise: A deep visual-semantic embedding model. In C. J. C. Burges, L. Bottou, M. Welling, Z. Ghahramani, and K. Q. Weinberger, editors, Advances in Neural Information Processing Systems, volume 26. Curran Associates, Inc., 2013. URL https://proceedings.neurips.cc/paper/2013/file/ 7cce53cf90577442771720a370c3c723-Paper.pdf.
|
| 211 |
+
|
| 212 |
+
[25] Xiao Fu, Shangzhan Zhang, Tianrun Chen, Yichong Lu, Lanyun Zhu, Xiaowei Zhou, Andreas Geiger, and Yiyi Liao. Panoptic nerf: 3d-to-2d label transfer for panoptic urban scene segmentation. arxiv, 2022. URL https://arxiv.org/abs/2203.15224.
|
| 213 |
+
|
| 214 |
+
[26] Chen Gao, Ayush Saraf, Johannes Kopf, and Jia-Bin Huang. Dynamic view synthesis from dynamic monocular video. arXiv preprint arXiv:2105.06468, 2021. URL http://arxiv. org/abs/2105.06468v1.
|
| 215 |
+
|
| 216 |
+
[27] Jonathan Granskog, Till N Schnabel, Fabrice Rousselle, and Jan Novák. Neural scene graph rendering. ACM Transactions on Graphics (TOG), 40(4):1–11, 2021.
|
| 217 |
+
|
| 218 |
+
[28] Michelle Guo, Alireza Fathi, Jiajun Wu, and Thomas Funkhouser. Object-centric neural scene rendering. arXiv preprint arXiv:2012.08503, 2020. URL http://arxiv.org/abs/2012. 08503v1.
|
| 219 |
+
|
| 220 |
+
[29] Yulan Guo, Hanyun Wang, Qingyong Hu, Hao Liu, Li Liu, and Mohammed Bennamoun. Deep learning for 3d point clouds: A survey. IEEE Transactions on Pattern Analysis and Machine Intelligence, 43(12):4338–4364, 2021. doi: 10.1109/TPAMI.2020.3005434.
|
| 221 |
+
|
| 222 |
+
[30] Huy Ha and Shuran Song. Semantic abstraction: Open-world 3D scene understanding from 2D vision-language models. In Proceedings of the 2022 Conference on Robot Learning, 2022.
|
| 223 |
+
|
| 224 |
+
[31] Zekun Hao, Arun Mallya, Serge Belongie, and Ming-Yu Liu. Gancraft: Unsupervised 3d neural rendering of minecraft worlds. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), 2021. URL http://arxiv.org/abs/2104.07659v1.
|
| 225 |
+
|
| 226 |
+
[32] Jun Hatori, Yuta Kikuchi, Sosuke Kobayashi, Kuniyuki Takahashi, Yuta Tsuboi, Yuya Unno, Wilson Ko, and Jethro Tan. Interactively picking real-world objects with unconstrained spoken language instructions. In Proceedings of International Conference on Robotics and Automation, 2018.
|
| 227 |
+
|
| 228 |
+
[33] Yong He, Hongshan Yu, Xiaoyan Liu, Zhengeng Yang, Wei Sun, Yaonan Wang, Qiang Fu, Yanmei Zou, and Ajmal Mian. Deep learning based 3d segmentation: A survey. arxiv, 2021. URL https://arxiv.org/abs/2103.05423.
|
| 229 |
+
|
| 230 |
+
[34] Geoffrey Hinton, Oriol Vinyals, and Jeffrey Dean. Distilling the knowledge in a neural network. In NIPS Deep Learning and Representation Learning Workshop, 2015. URL http://arxiv.org/abs/1503.02531.
|
| 231 |
+
|
| 232 |
+
[35] Ajay Jain, Matthew Tancik, and Pieter Abbeel. Putting nerf on a diet: Semantically consistent few-shot view synthesis. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 5885–5894, October 2021.
|
| 233 |
+
|
| 234 |
+
[36] Ajay Jain, Ben Mildenhall, Jonathan T. Barron, Pieter Abbeel, and Ben Poole. Zero-shot text-guided object generation with dream fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022. URL https://arxiv.org/ abs/2112.01455.
|
| 235 |
+
|
| 236 |
+
[37] Wonbong Jang and Lourdes Agapito. Codenerf: Disentangled neural radiance fields for object categories. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), 2021. URL http://arxiv.org/abs/2109.01750v1.
|
| 237 |
+
|
| 238 |
+
[38] Yoni Kasten, Dolev Ofri, Oliver Wang, and Tali Dekel. Layered neural atlases for consistent video editing. ACM Transactions on Graphics (TOG), 2021. URL http://arxiv.org/abs/ 2109.11418v1.
|
| 239 |
+
|
| 240 |
+
[39] Hiroharu Kato, Deniz Beker, Mihai Morariu, Takahiro Ando, Toru Matsuoka, Wadim Kehl, and Adrien Gaidon. Differentiable rendering: A survey. arxiv, 2020. URL https://arxiv. org/abs/2006.12057.
|
| 241 |
+
|
| 242 |
+
[40] Amit Kohli, Vincent Sitzmann, and Gordon Wetzstein. Semantic implicit neural scene representations with semi-supervised training. In International Conference on 3D Vision (3DV). IEEE, 2020. URL http://arxiv.org/abs/2003.12673v2.
|
| 243 |
+
|
| 244 |
+
[41] Abhijit Kundu, Kyle Genova, Xiaoqi Yin, Alireza Fathi, Caroline Pantofaru, Leonidas Guibas, Andrea Tagliasacchi, Frank Dellaert, and Thomas Funkhouser. Panoptic Neural Fields: A Semantic Object-Aware Neural Scene Representation. In CVPR, 2022.
|
| 245 |
+
|
| 246 |
+
[42] John Lambert, Zhuang Liu, Ozan Sener, James Hays, and Vladlen Koltun. Mseg: A composite dataset for multi-domain semantic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2879–2888, 2020.
|
| 247 |
+
|
| 248 |
+
[43] Verica Lazova, Vladimir Guzov, Kyle Olszewski, Sergey Tulyakov, and Gerard Pons-Moll. Control-nerf: Editable feature volumes for scene rendering and manipulation. arXiv preprint arXiv:2204.10850, 2022.
|
| 249 |
+
|
| 250 |
+
[44] Boyi Li, Kilian Q Weinberger, Serge Belongie, Vladlen Koltun, and Rene Ranftl. Languagedriven semantic segmentation. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=RriDjddCLN.
|
| 251 |
+
|
| 252 |
+
[45] Tianye Li, Mira Slavcheva, Michael Zollhoefer, Simon Green, Christoph Lassner, Changil Kim, Tanner Schmidt, Steven Lovegrove, Michael Goesele, and Zhaoyang Lv. Neural 3d video synthesis. arXiv preprint arXiv:2103.02597, 2021. URL http://arxiv.org/abs/ 2103.02597v1.
|
| 253 |
+
|
| 254 |
+
[46] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pages 740–755. Springer, 2014.
|
| 255 |
+
|
| 256 |
+
[47] Haolin Liu, Anran Lin, Xiaoguang Han, Lei Yang, Yizhou Yu, and Shuguang Cui. Refer-it-inrgbd: A bottom-up approach for 3d visual grounding in rgbd images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6032–6041, 2021.
|
| 257 |
+
|
| 258 |
+
[48] Lingjie Liu, Jiatao Gu, Kyaw Zaw Lin, Tat-Seng Chua, and Christian Theobalt. Neural sparse voxel fields. In Proceedings of the European Conference on Computer Vision (ECCV), 2020. URL http://arxiv.org/abs/2007.11571v2.
|
| 259 |
+
|
| 260 |
+
[49] Steven Liu, Xiuming Zhang, Zhoutong Zhang, Richard Zhang, Jun-Yan Zhu, and Bryan Russell. Editing conditional radiance fields. arXiv preprint arXiv:2105.06466, 2021. URL http://arxiv.org/abs/2105.06466v2.
|
| 261 |
+
|
| 262 |
+
[50] Ze Liu, Han Hu, Yutong Lin, Zhuliang Yao, Zhenda Xie, Yixuan Wei, Jia Ning, Yue Cao, Zheng Zhang, Li Dong, Furu Wei, and Baining Guo. Swin transformer V2: scaling up capacity and resolution. arxiv, abs/2111.09883, 2021. URL https://arxiv.org/abs/2111.09883.
|
| 263 |
+
|
| 264 |
+
[51] Sebastian Loeschcke, Serge Belongie, and Sagie Benaim. Text-driven stylization of video objects. arXiv, 2022. URL https://arxiv.org/abs/2206.12396.
|
| 265 |
+
|
| 266 |
+
[52] Timo Lüddecke and Alexander Ecker. Prompt-based multi-modal image segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022. URL https://arxiv.org/abs/2112.10003.
|
| 267 |
+
|
| 268 |
+
[53] Lars Mescheder, Michael Oechsle, Michael Niemeyer, Sebastian Nowozin, and Andreas Geiger. Occupancy networks: Learning 3d reconstruction in function space. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2019. URL http://arxiv.org/abs/1812.03828v2.
|
| 269 |
+
|
| 270 |
+
[54] Björn Michele, Alexandre Boulch, Gilles Puy, Maxime Bucher, and Renaud Marlet. Generative zero-shot learning for semantic segmentation of 3d point clouds. In 2021 International Conference on 3D Vision (3DV), pages 992–1002, 2021. doi: 10.1109/3DV53792.2021.00107.
|
| 271 |
+
|
| 272 |
+
[55] Ben Mildenhall, Pratul P. Srinivasan, Rodrigo Ortiz-Cayon, Nima Khademi Kalantari, Ravi Ramamoorthi, Ren $\mathrm { N g }$ , and Abhishek Kar. Local light field fusion: Practical view synthesis with prescriptive sampling guidelines. ACM Transactions on Graphics (TOG), 2019.
|
| 273 |
+
|
| 274 |
+
[56] 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 Proceedings of the European Conference on Computer Vision (ECCV), 2020. URL http: //arxiv.org/abs/2003.08934v2.
|
| 275 |
+
|
| 276 |
+
[57] Thomas Müller, Alex Evans, Christoph Schied, and Alexander Keller. Instant neural graphics primitives with a multiresolution hash encoding. ACM Trans. Graph., 41(4):102:1–102:15, July 2022. doi: 10.1145/3528223.3530127. URL https://doi.org/10.1145/3528223. 3530127.
|
| 277 |
+
|
| 278 |
+
[58] Gerhard Neuhold, Tobias Ollmann, Samuel Rota Bulo, and Peter Kontschieder. The mapillary vistas dataset for semantic understanding of street scenes. In Proceedings of the IEEE international conference on computer vision, pages 4990–4999, 2017.
|
| 279 |
+
|
| 280 |
+
[59] Thu Nguyen-Phuoc, Chuan Li, Lucas Theis, Christian Richardt, and Yong-Liang Yang. Hologan: Unsupervised learning of 3d representations from natural images. In Proc. ICCV, pages 7588–7597, 2019.
|
| 281 |
+
|
| 282 |
+
[60] Thu H Nguyen-Phuoc, Christian Richardt, Long Mai, Yongliang Yang, and Niloy Mitra. Blockgan: Learning 3d object-aware scene representations from unlabelled images. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 6767–6778, 2020. URL https://proceedings. neurips.cc/paper/2020/file/4b29fa4efe4fb7bc667c7b301b74d52d-Paper.pdf.
|
| 283 |
+
|
| 284 |
+
[61] Michael Niemeyer and Andreas Geiger. Giraffe: Representing scenes as compositional generative neural feature fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021. URL http://arxiv.org/abs/2011.12100v2.
|
| 285 |
+
|
| 286 |
+
[62] Michael Niemeyer, Jonathan T. Barron, Ben Mildenhall, Mehdi S. M. Sajjadi, Andreas Geiger, and Noha Radwan. Regnerf: Regularizing neural radiance fields for view synthesis from sparse inputs. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 287 |
+
|
| 288 |
+
[63] Atsuhiro Noguchi, Xiao Sun, Stephen Lin, and Tatsuya Harada. Neural articulated radiance field. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), 2021. URL http://arxiv.org/abs/2104.03110v2.
|
| 289 |
+
|
| 290 |
+
[64] Julian Ost, Fahim Mannan, Nils Thuerey, Julian Knodt, and Felix Heide. Neural scene graphs for dynamic scenes. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 2856–2865, June 2021.
|
| 291 |
+
|
| 292 |
+
[65] Jeong Joon Park, Peter Florence, Julian Straub, Richard Newcombe, and Steven Lovegrove. Deepsdf: Learning continuous signed distance functions for shape representation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2019. URL http://arxiv.org/abs/1901.05103v1.
|
| 293 |
+
|
| 294 |
+
[66] Keunhong Park, Utkarsh Sinha, Peter Hedman, Jonathan T. Barron, Sofien Bouaziz, Dan B Goldman, Ricardo Martin-Brualla, and Steven M. Seitz. Hypernerf: A higher-dimensional representation for topologically varying neural radiance fields. arXiv preprint arXiv:2106.13228, 2021. URL http://arxiv.org/abs/2106.13228v2.
|
| 295 |
+
|
| 296 |
+
[67] 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.
|
| 297 |
+
|
| 298 |
+
[68] Ben Poole, Ajay Jain, Jonathan T. Barron, and Ben Mildenhall. Dreamfusion: Text-to-3d using 2d diffusion. arXiv, 2022. URL https://arxiv.org/abs/2209.14988.
|
| 299 |
+
|
| 300 |
+
[69] 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, 18–24 Jul 2021. URL https://proceedings.mlr.press/v139/radford21a. html.
|
| 301 |
+
|
| 302 |
+
[70] Sameera Ramasinghe, Lachlan E. MacDonald, and Simon Lucey. On regularizing coordinatemlps. arxiv, 2022.
|
| 303 |
+
|
| 304 |
+
[71] René Ranftl, Alexey Bochkovskiy, and Vladlen Koltun. Vision transformers for dense prediction. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), 2021. URL https://arxiv.org/abs/2103.13413.
|
| 305 |
+
|
| 306 |
+
[72] Yongming Rao, Wenliang Zhao, Guangyi Chen, Yansong Tang, Zheng Zhu, Guan Huang, Jie Zhou, and Jiwen Lu. Denseclip: Language-guided dense prediction with context-aware prompting. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 307 |
+
|
| 308 |
+
[73] Daniel Rebain, Wei Jiang, Soroosh Yazdani, Ke Li, Kwang Moo Yi, and Andrea Tagliasacchi. Derf: Decomposed radiance fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021. URL http://arxiv.org/abs/2011. 12490v1.
|
| 309 |
+
|
| 310 |
+
[74] Nils Reimers and Iryna Gurevych. Sentence-BERT: Sentence embeddings using Siamese BERT-networks. In Proceedings of the 2019 Conference on Empirical Methods in Natural
|
| 311 |
+
|
| 312 |
+
Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3982–3992, November 2019. doi: 10.18653/v1/D19-1410. URL https://aclanthology.org/D19-1410.
|
| 313 |
+
|
| 314 |
+
[75] Nils Reimers and Iryna Gurevych. Making monolingual sentence embeddings multilingual using knowledge distillation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4512–4525, November 2020. doi: 10.18653/ v1/2020.emnlp-main.365. URL https://aclanthology.org/2020.emnlp-main.365.
|
| 315 |
+
|
| 316 |
+
[76] Zhongzheng Ren, Aseem Agarwala†, Bryan Russell†, Alexander G. Schwing†, and Oliver Wang†. Neural volumetric object selection. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022. († alphabetic ordering).
|
| 317 |
+
|
| 318 |
+
[77] Barbara Roessle, Jonathan T. Barron, Ben Mildenhall, Pratul P. Srinivasan, and Matthias Nießner. Dense depth priors for neural radiance fields from sparse input views. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2022.
|
| 319 |
+
|
| 320 |
+
[78] David Rozenberszki, Or Litany, and Angela Dai. Language-grounded indoor 3d semantic segmentation in the wild. In Proceedings of the European Conference on Computer Vision (ECCV), 2022.
|
| 321 |
+
|
| 322 |
+
[79] 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 textto-image diffusion models with deep language understanding. arXiv, 2022. URL https: //arxiv.org/abs/2205.11487.
|
| 323 |
+
|
| 324 |
+
[80] Anthony Simeonov, Yilun Du, Andrea Tagliasacchi, Joshua B. Tenenbaum, Alberto Rodriguez, Pulkit Agrawal, and Vincent Sitzmann. Neural descriptor fields: Se(3)-equivariant object representations for manipulation. arXiv preprint arXiv:2112.05124, 2021.
|
| 325 |
+
|
| 326 |
+
[81] Vincent Sitzmann, Justus Thies, Felix Heide, Matthias Nießner, Gordon Wetzstein, and Michael Zollhöfer. Deepvoxels: Learning persistent 3d feature embeddings. In Proc. Computer Vision and Pattern Recognition (CVPR), IEEE, 2019.
|
| 327 |
+
|
| 328 |
+
[82] Vincent Sitzmann, Michael Zollhofer, and Gordon Wetzstein. Scene representation networks: Continuous 3d-structure-aware neural scene representations. In Advances in Neural Information Processing Systems (NeurIPS). Curran Associates, Inc., 2019. URL http: //arxiv.org/abs/1906.01618v2.
|
| 329 |
+
|
| 330 |
+
[83] Cameron Smith, Hong-Xing Yu, Sergey Zakharov, Fredo Durand, Joshua B. Tenenbaum, Jiajun Wu, and Vincent Sitzmann. Unsupervised discovery and composition of object light fields. arXiv, 2022.
|
| 331 |
+
|
| 332 |
+
[84] Shuran Song, Samuel P Lichtenberg, and Jianxiong Xiao. Sun rgb-d: A rgb-d scene understanding benchmark suite. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 567–576, 2015.
|
| 333 |
+
|
| 334 |
+
[85] Karl Stelzner, Kristian Kersting, and Adam R. Kosiorek. Decomposing 3d scenes into objects via unsupervised volume segmentation. arxiv, 2021. URL http://arxiv.org/abs/2104. 01148.
|
| 335 |
+
|
| 336 |
+
[86] Julian Straub, Thomas Whelan, Lingni Ma, Yufan Chen, Erik Wijmans, Simon Green, Jakob J. Engel, Raul Mur-Artal, Carl Ren, Shobhit Verma, Anton Clarkson, Mingfei Yan, Brian Budge, Yajie Yan, Xiaqing Pan, June Yon, Yuyang Zou, Kimberly Leon, Nigel Carter, Jesus Briales, Tyler Gillingham, Elias Mueggler, Luis Pesqueira, Manolis Savva, Dhruv Batra, Hauke M. Strasdat, Renzo De Nardi, Michael Goesele, Steven Lovegrove, and Richard Newcombe. The Replica dataset: A digital replica of indoor spaces. arxiv, 2019.
|
| 337 |
+
|
| 338 |
+
[87] Roman Suvorov, Elizaveta Logacheva, Anton Mashikhin, Anastasia Remizova, Arsenii Ashukha, Aleksei Silvestrov, Naejin Kong, Harshith Goka, Kiwoong Park, and Victor Lempitsky. Resolution-robust large mask inpainting with fourier convolutions. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), pages 2149–2159, January 2022. URL https://arxiv.org/abs/2109.07161.
|
| 339 |
+
|
| 340 |
+
[88] Towaki Takikawa, Joey Litalien, Kangxue Yin, Karsten Kreis, Charles Loop, Derek Nowrouzezahrai, Alec Jacobson, Morgan McGuire, and Sanja Fidler. Neural geometric level of detail: Real-time rendering with implicit 3d shapes. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021. URL http://arxiv.org/abs/2101.10994v1.
|
| 341 |
+
|
| 342 |
+
[89] Matthew Tancik, Vincent Casser, Xinchen Yan, Sabeek Pradhan, Ben Mildenhall, Pratul Srinivasan, Jonathan T. Barron, and Henrik Kretzschmar. Block-NeRF: Scalable large scene neural view synthesis. arXiv, 2022.
|
| 343 |
+
|
| 344 |
+
[90] A. Tewari, O. Fried, J. Thies, V. Sitzmann, S. Lombardi, Z. Xu, T. Simon, M. Nießner, E. Tretschk, L. Liu, B. Mildenhall, P. Srinivasan, R. Pandey, S. Orts-Escolano, S. Fanello, M. Guo, G. Wetzstein, J.-Y. Zhu, C. Theobalt, M. Agrawala, D. B Goldman, and M. Zollhöfer. Advances in neural rendering. In ACM SIGGRAPH 2021 Courses, SIGGRAPH ’21, 2021. doi: 10.1145/3450508.3464573. URL https://arxiv.org/abs/2111.05849.
|
| 345 |
+
|
| 346 |
+
[91] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. In Proceedings of the International Conference on Machine Learning (ICML), pages 10347– 10357, 2021.
|
| 347 |
+
|
| 348 |
+
[92] Vadim Tschernezki, Diane Larlus, and Andrea Vedaldi. Neuraldiff: Segmenting 3d objects that move in egocentric videos. arXiv preprint arXiv:2110.09936, 2021.
|
| 349 |
+
|
| 350 |
+
[93] Vadim Tschernezki, Iro Laina, Diane Larlus, and Andrea Vedaldi. Neural feature fusion fields: 3D distillation of self-supervised 2D image representations. In Proceedings of the International Conference on 3D Vision (3DV), 2022. URL https://arxiv.org/pdf/2209.03494.pdf.
|
| 351 |
+
|
| 352 |
+
[94] Haithem Turki, Deva Ramanan, and Mahadev Satyanarayanan. Mega-nerf: Scalable construction of large-scale nerfs for virtual fly-throughs. arxiv, 2021. URL https://arxiv.org/ abs/2112.10703.
|
| 353 |
+
|
| 354 |
+
[95] Girish Varma, Anbumani Subramanian, Anoop Namboodiri, Manmohan Chandraker, and CV Jawahar. Idd: A dataset for exploring problems of autonomous navigation in unconstrained environments. In 2019 IEEE Winter Conference on Applications of Computer Vision, pages 1743–1751. IEEE, 2019.
|
| 355 |
+
|
| 356 |
+
[96] 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.
|
| 357 |
+
|
| 358 |
+
[97] Can Wang, Menglei Chai, Mingming He, Dongdong Chen, and Jing Liao. Clip-nerf: Textand-image driven manipulation of neural radiance fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 359 |
+
|
| 360 |
+
[98] Peng Wang, Lingjie Liu, Yuan Liu, Christian Theobalt, Taku Komura, and Wenping Wang. Neus: Learning neural implicit surfaces by volume rendering for multi-view reconstruction. In Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence (IJCAI). International Joint Conferences on Artificial Intelligence Organization, 2021. URL http: //arxiv.org/abs/2106.10689v1.
|
| 361 |
+
|
| 362 |
+
[99] Zhaoqing Wang, Yu Lu, Qiang Li, Xunqiang Tao, Yandong Guo, Mingming Gong, and Tongliang Liu. Cris: Clip-driven referring image segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022. URL https://arxiv.org/abs/2111.15174.
|
| 363 |
+
|
| 364 |
+
[100] Yi Wei, Shaohui Liu, Yongming Rao, Wang Zhao, Jiwen Lu, and Jie Zhou. Nerfingmvs: Guided optimization of neural radiance fields for indoor multi-view stereo. Sep 2021. URL http://arxiv.org/abs/2109.01129v2.
|
| 365 |
+
|
| 366 |
+
[101] Xiaoshi Wu, Hadar Averbuch-Elor, Jin Sun, and Noah Snavely. Towers of babel: Combining images, language, and 3d geometry for learning multimodal vision. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 428–437, October 2021.
|
| 367 |
+
|
| 368 |
+
[102] Yiheng Xie, Towaki Takikawa, Shunsuke Saito, Or Litany, Shiqin Yan, Numair Khan, Federico Tombari, James Tompkin, Vincent Sitzmann, and Srinath Sridhar. Neural fields in visual computing and beyond, 2021. URL https://neuralfields.cs.brown.edu/.
|
| 369 |
+
|
| 370 |
+
[103] Mengde Xu, Zheng Zhang, Fangyun Wei, Yutong Lin, Yue Cao, Han Hu, and Xiang Bai. A simple baseline for zero-shot semantic segmentation with pre-trained vision-language model. arxiv, 2021. URL https://arxiv.org/abs/2112.14757.
|
| 371 |
+
|
| 372 |
+
[104] Bangbang Yang, Yinda Zhang, Yinghao Xu, Yijin Li, Han Zhou, Hujun Bao, Guofeng Zhang, and Zhaopeng Cui. Learning object-compositional neural radiance field for editable scene rendering. In International Conference on Computer Vision (ICCV), October 2021. URL https://arxiv.org/abs/2109.01847.
|
| 373 |
+
|
| 374 |
+
[105] Bangbang Yang, Yinda Zhang, Yijin Li, Zhaopeng Cui, Sean Fanello, Hujun Bao, and Guofeng Zhang. Neural rendering in a room: Amodal 3d understanding and free-viewpoint rendering for the closed scene composed of pre-captured objects. ACM Trans. Graph., 41(4):101:1–101:10, July 2022. doi: 10.1145/3528223.3530163. URL https://doi.org/10.1145/3528223. 3530163.
|
| 375 |
+
|
| 376 |
+
[106] Lior Yariv, Yoni Kasten, Dror Moran, Meirav Galun, Matan Atzmon, Ronen Basri, and Yaron Lipman. Multiview neural surface reconstruction by disentangling geometry and appearance. In Advances in Neural Information Processing Systems (NeurIPS). Curran Associates, Inc., 2020. URL http://arxiv.org/abs/2003.09852v3.
|
| 377 |
+
|
| 378 |
+
[107] Alex Yu, Ruilong Li, Matthew Tancik, Hao Li, Ren Ng, and Angjoo Kanazawa. Plenoctrees for real-time rendering of neural radiance fields. Proc. ICCV, 2021.
|
| 379 |
+
|
| 380 |
+
[108] Fisher Yu, Haofeng Chen, Xin Wang, Wenqi Xian, Yingying Chen, Fangchen Liu, Vashisht Madhavan, and Trevor Darrell. Bdd100k: A diverse driving dataset for heterogeneous multitask learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 2636–2645, 2020.
|
| 381 |
+
|
| 382 |
+
[109] Hong-Xing Yu, Leonidas Guibas, and Jiajun Wu. Unsupervised discovery of object radiance fields. In International Conference on Learning Representations, 2022. URL https:// openreview.net/forum?id $=$ rwE8SshAlxw.
|
| 383 |
+
|
| 384 |
+
[110] Jason Zhang, Gengshan Yang, Shubham Tulsiani, and Deva Ramanan. Ners: Neural reflectance surfaces for sparse-view 3d reconstruction in the wild. In M. Ranzato, A. Beygelzimer, Y. Dauphin, P.S. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems, volume 34, pages 29835–29847. Curran Associates, Inc., 2021. URL https://proceedings.neurips.cc/paper/2021/file/ f95ec3de395b4bce25b39ef6138da871-Paper.pdf.
|
| 385 |
+
|
| 386 |
+
[111] Xiuming Zhang, Pratul P. Srinivasan, Boyang Deng, Paul Debevec, William T. Freeman, and Jonathan T. Barron. Nerfactor: Neural factorization of shape and reflectance under an unknown illumination. arXiv preprint arXiv:2106.01970, 2021. URL http://arxiv.org/abs/2106. 01970v1.
|
| 387 |
+
|
| 388 |
+
[112] Shuaifeng Zhi, Tristan Laidlow, Stefan Leutenegger, and Andrew J. Davison. In-place scene labelling and understanding with implicit scene representation. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), 2021. URL http://arxiv.org/abs/ 2103.15875v2.
|
| 389 |
+
|
| 390 |
+
[113] Shuaifeng Zhi, Edgar Sucar, Andre Mouton, Iain Haughton, Tristan Laidlow, and Andrew J. Davison. iLabel: Interactive neural scene labelling. arXiv, 2021.
|
| 391 |
+
|
| 392 |
+
[114] Yiwu Zhong, Jianwei Yang, Pengchuan Zhang, Chunyuan Li, Noel Codella, Liunian Harold Li, Luowei Zhou, Xiyang Dai, Lu Yuan, Yin Li, and Jianfeng Gao. Regionclip: Region-based language-image pretraining. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022. URL https://arxiv.org/abs/2112.09106.
|
| 393 |
+
|
| 394 |
+
[115] Bolei Zhou, Hang Zhao, Xavier Puig, Tete Xiao, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Semantic understanding of scenes through the ade20k dataset. International Journal of Computer Vision, 127(3):302–321, 2019.
|
| 395 |
+
|
| 396 |
+
# Checklist
|
| 397 |
+
|
| 398 |
+
1. For all authors...
|
| 399 |
+
|
| 400 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] The claims are empirically demonstrated in Section 5, and described in the whole paper.
|
| 401 |
+
(b) Did you describe the limitations of your work? [Yes] See mainly Section 5, and 6.
|
| 402 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 6.
|
| 403 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 404 |
+
|
| 405 |
+
2. If you are including theoretical results...
|
| 406 |
+
|
| 407 |
+
(a) Did you state the full set of assumptions of all theoretical results? [N/A] Mathematical formulations of the models are written in Section 3 and 4.
|
| 408 |
+
(b) Did you include complete proofs of all theoretical results? [N/A] Mathematical formulations of the models are written in Section 3 and 4.
|
| 409 |
+
|
| 410 |
+
3. If you ran experiments...
|
| 411 |
+
|
| 412 |
+
(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] The complete code for the reproduction of all the experimental results is not publicly available. Because the code is a modification from a public code by Zhi et al. [112], reproduction is also easier than from scratch. We will make our scene dataset publicly available.
|
| 413 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Some of them are further described in the supplementary material.
|
| 414 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] Error bars are not reported because it would be computationally expensive and results are expected to be stable. Note that most existing studies on NeRF have not reported the bars too.
|
| 415 |
+
(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 difficult to completely track and sum the total amount of computing in the experiments. Instead, we reported the setup of the main experiments.
|
| 416 |
+
|
| 417 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 418 |
+
|
| 419 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] Codebase and datasets are appropriately cited, mainly in Section 5.
|
| 420 |
+
(b) Did you mention the license of the assets? [No] We refer the readers to the original source instead of mentioning them in this paper.
|
| 421 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We include generated video by models in the supplemental material.
|
| 422 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] No data about people.
|
| 423 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] No such data.
|
| 424 |
+
|
| 425 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 426 |
+
|
| 427 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] No such data or experiment.
|
| 428 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] No such data or experiment.
|
| 429 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] No such data or experiment.
|
md/dev/JXhROKNZzOc/JXhROKNZzOc.md
ADDED
|
@@ -0,0 +1,510 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SQUANT: ON-THE-FLY DATA-FREE QUANTIZATION VIA DIAGONAL HESSIAN APPROXIMATION
|
| 2 |
+
|
| 3 |
+
Cong $\mathbf { G u o } ^ { 1 , 2 }$ , Yuxian $\mathbf { Q i u } ^ { 1 , 2 }$ , Jingwen Leng1,2, ∗, Xiaotian Gao3, Chen Zhang4, Yunxin Liu5, Fan Yang3, Yuhao $\mathbf { Z } \mathbf { h } \mathbf { u } ^ { 6 }$ & Minyi Guo1,2, $^ *$
|
| 4 |
+
|
| 5 |
+
1 Shanghai Jiao Tong University, 2 Shanghai Qi Zhi Institute
|
| 6 |
+
3 Microsoft Research, 4 DAMO Academy, Alibaba Group
|
| 7 |
+
5 Institute for AI Industry Research (AIR), Tsinghua University, 6 University of Rochester
|
| 8 |
+
{guocong, qiuyuxian, leng-jw}@sjtu.edu.cn
|
| 9 |
+
{xiaotian.gao, fanyang}@microsoft.com
|
| 10 |
+
mingchong.zc@alibaba-inc.com, liuyunxin@air.tsinghua.edu.cn
|
| 11 |
+
yzhu@rochester.edu, guo-my@cs.sjtu.edu.cn
|
| 12 |
+
|
| 13 |
+
# ABSTRACT
|
| 14 |
+
|
| 15 |
+
Quantization of deep neural networks (DNN) has been proven effective for compressing and accelerating DNN models. Data-free quantization (DFQ) is a promising approach without the original datasets under privacy-sensitive and confidential scenarios. However, current DFQ solutions degrade accuracy, need synthetic data to calibrate networks, and are time-consuming and costly. This paper proposes an on-the-fly DFQ framework with sub-second quantization time, called SQuant, which can quantize networks on inference-only devices with low computation and memory requirements. With the theoretical analysis of the second-order information of DNN task loss, we decompose and approximate the Hessian-based optimization objective into three diagonal sub-items, which have different areas corresponding to three dimensions of weight tensor: element-wise, kernel-wise, and output channel-wise. Then, we progressively compose sub-items and propose a novel data-free optimization objective in the discrete domain, minimizing Constrained Absolute $\underline { { \mathbf { S } } } \mathbf { u m }$ of Error (or CASE in short), which surprisingly does not need any dataset and is even not aware of network architecture. We also design an efficient algorithm without back-propagation to further reduce the computation complexity of the objective solver. Finally, without fine-tuning and synthetic datasets, SQuant accelerates the data-free quantization process to a sub-second level with $> 3 0 \%$ accuracy improvement over the existing data-free post-training quantization works, with the evaluated models under 4-bit quantization. We have open-sourced the SQuant framework1.
|
| 16 |
+
|
| 17 |
+
# 1 INTRODUCTION
|
| 18 |
+
|
| 19 |
+
With the widespread application of DNN, more and more DNN models are deployed on both computation-constrained and memory-constrained environments, e.g., smartphones, IoT devices, and self-driving cars. The desire for lightweight and energy-efficient DNN deployment solutions is increasing. Quantization is one of the most promising techniques to convert weights and activations to lower bit formats and simultaneously reduce computational time and memory consumption. There are two kinds of quantization: Post-training quantization (PTQ) (Banner et al., 2018; Choukroun et al., 2019; Zhao et al., 2019; Nagel et al., 2020) and Quantization-aware training (QAT) (Gupta et al., 2015; Jacob et al., 2018; Wang et al., 2019; Zhuang et al., 2021). QAT requires to simulate quantization in the training process, which invokes time-consuming retraining and hyper-parameter tuning. In contrast, PTQ directly quantizes well-trained models without retraining. However, they still need training datasets to calibrate (Nagel et al., 2020) quantized models but are often unavailable due to privacy and security issues, such as medical and confidential scenarios.
|
| 20 |
+
|
| 21 |
+
In contrast, data-free quantization (DFQ) has recently been presented as a promising way to quantize models without original datasets (Nagel et al., 2019; Cai et al., 2020; Zhang et al., 2021; Xu et al., 2020; Liu et al., 2021; Qin et al., 2021; Choi et al., 2020). From a deployment perspective, DFQ is the most attractive quantization method since we can apply it to any trained models as a black box postprocessing step. However, current DFQ methods cannot achieve high accuracy and fast processing time simultaneously. Traditionally, DFQ (Nagel et al., 2019) uses rounding quantization, leading to the rounding-to-nearest strategy. Such a strategy causes significant accuracy loss, especially in low-bit settings. To bridge the accuracy gap between data-free and data-driven quantization, researchers propose a series of data-generative DFQ methods. They use gradient-based methods to generate fake datasets for trained models. With the synthetic data, they can employ a data-driven calibration and fine-tuning strategy to improve accuracy. However, data generation typically adopts the time-consuming gradient-based methods, which require multiple iterations to generate each input. For example, prior works often spend hours generating a calibration dataset and fine-tuning the network (Xu et al., 2020; Liu et al., 2021; Zhang et al., 2021).
|
| 22 |
+
|
| 23 |
+
To solve this dilemma, we propose SQuant, a fast and accurate data-free quantization framework for convolutional neural networks, employing the constrained absolute sum of error (CASE) of weights as the rounding metric. By leveraging Hessian information of network loss due to quantization, we propose a novel diagonal Hessian approximation, which decomposes the optimization objective into three data-free sub-items: element-wise, kernel-wise, and output channel-wise, each of which corresponds to a single or a set of dimensions of the weight tensor. We progressively compose and optimize these three sub-items in the discrete space. The final approximate objective eliminates the requirement of data generation. We propose a progressive algorithm with linear complexity to solve the optimization objective, further accelerating DFQ time to a sub-second level. For example, SQuant only needs an average of $4 \mathrm { m s }$ and $8 4 \mathrm { m s }$ for quantizing a layer and the overall network of ResNet18, respectively. As it does not require back-propagation nor fine-tuning, SQuant can run on inference-only devices with limited computation and memory resources on the fly. That opens up new opportunities and scenarios for adopting quantization.
|
| 24 |
+
|
| 25 |
+
Compared with state-of-the-art DFQ methods, SQuant achieves higher accuracy on all evaluated models under the 4/6/8-bit settings. SQuant only introduces $0 . 1 \%$ accuracy loss on average under the 8-bit setting. Under fewer bit precisions, the advantage of SQuant further expands. SQuant only introduces $1 . 8 \%$ accuracy loss on average under the 6-bit setting. Under the 4-bit setting, SQuant can achieve more than $30 \%$ accuracy improvement compared with data-free PTQ methods. In a word, SQuant pushes the accuracy and processing time of DFQ to a new frontier.
|
| 26 |
+
|
| 27 |
+
# 2 PRELIMINARIES
|
| 28 |
+
|
| 29 |
+
# 2.1 NOTATIONS
|
| 30 |
+
|
| 31 |
+
We specifically use $x$ , $y$ and $w$ to denote the input, output, and weight variables, respectively. Constant and scalar are denoted by italic letters, e.g., $c , M$ . Column vector and flattened matrix are denoted by bold lowercase letters, e.g., w, and matrices (or tensors) are represented by uppercase letters, e.g., W. The subscript and superscript can further represent the element indices and the layer of a network, respectively, e.g., $\mathbf { W } _ { i , j } ^ { \ell }$ . E[·] denotes the expectation operator, and the network loss function is represented by $\mathcal { L } ( \cdot )$ . For convenience in this paper, we call the row of FC (fully connected layer) weight as the output channel and the column of FC weight as the input channel, which are the counterparts to Conv (convolution layer) weight. We use $M$ , $N$ , and $K$ to denote output channel size, input channel size, and kernel height $\times$ kernel width, respectively. Specifically, FC has the shape of $( M , N , 1 )$ .
|
| 32 |
+
|
| 33 |
+
# 2.2 QUANTIZATION
|
| 34 |
+
|
| 35 |
+
Most previous works adopt the rounding-to-nearest approach for quantizing deep neural networks by rounding elements $w$ to the nearest quantization grid values with a fixed-point data type. The quantization and dequantization for a quantized element $\widehat { w }$ can be described as $\mathbf { \widehat { \boldsymbol { w } } } = \mathbf { \boldsymbol { s } } \cdot \mathrm { c l i p } ( \left\lfloor \frac { w } { s } \right\rceil , m i n , m a x )$ , where $s$ b bdenotes the quantization scale parameter and, min and max are the lower and upper thresholds for the clipping function $\mathrm { c l i p } ( \cdot )$ . The operator $\lfloor \cdot \rceil$ represents the rounding-to-nearest, i.e., minimizing the mean squared error (MSE) between the quantized and the original value.
|
| 36 |
+
|
| 37 |
+
# 2.3 HESSIAN-BASED OPTIMIZATION FOR NEURAL NETWORKS
|
| 38 |
+
|
| 39 |
+
The Hessian-based approach is one of the most promising optimizations to further improve the quantization (Dong et al., 2019b;a; Nagel et al., 2020; Shen et al., 2020; Qian et al., 2020; Wu et al., 2020; Hubara et al., 2020; Li et al., 2021; Yao et al., 2021) and pruning (Yu et al., 2021) performance for DNN models. Some of those works exploit the Hessian matrix to approximate loss degradation due to the quantization perturbation of weight, ∆W, by
|
| 40 |
+
|
| 41 |
+
$$
|
| 42 |
+
\mathbb { E } [ \mathcal { L } ( \mathbf { X } , \mathbf { Y } , \mathbf { W } + \Delta \mathbf { W } ) - \mathcal { L } ( \mathbf { X } , \mathbf { Y } , \mathbf { W } ) ] { \approx } \mathbb { E } [ \Delta \mathbf { W } \cdot \mathbf { g } ^ { \mathbf { W } } + \frac { 1 } { 2 } \Delta \mathbf { W } \cdot \mathbf { H } ^ { \mathbf { W } } \cdot \Delta \mathbf { W } ^ { T } ] ,
|
| 43 |
+
$$
|
| 44 |
+
|
| 45 |
+
where the equation comes from second-order Taylor series expansion, $\mathbf { g } ^ { \mathbf { W } }$ is the gradient and $\mathbf { H } ^ { \mathbf { W } }$ is the full network Hessian matrix w.r.t. original weight, W. Since a well-trained model has already converged, the gradient term will be close to 0 and thus can be safely ignored. However, computing $\mathbf { H } ^ { \mathbf { W } }$ is infeasible because of the large memory overhead and computation complexity. To tackle this problem, we approximate $\mathbf { H } ^ { \mathbf { W } }$ as a layer-wise Hessian matrix $\mathbf { H } ^ { \mathbf { W } ^ { \ell } }$ under the assumption of cross-layer independence (Dong et al., 2017; Nagel et al., 2020), i.e., $\mathbf { H ^ { W } } ^ { \ell } = \mathbf { x } ^ { \ell } \mathbf { x } ^ { \ell } { } ^ { T } \otimes \nabla _ { \mathbf { y } ^ { \ell } } ^ { 2 } \bar { \mathcal { L } }$ , where $\otimes$ denotes Kronecker product of two matrices, $\nabla _ { \mathbf { y } ^ { \ell } } ^ { 2 } \mathcal { L }$ is the Hessian of the task loss w.r.t. $\mathbf { y } ^ { \ell }$ .
|
| 46 |
+
|
| 47 |
+
For the $m$ -th output channel of Conv or FC, $\mathbf { H } ^ { \mathbf { W } ^ { \ell } }$ can be approximatively simplified into output channel-wise (Nagel et al., 2020; Yu et al., 2021; Wu et al., 2020; Qian et al., 2020),
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
\mathbf { H } ^ { \mathbf { W } _ { m } ^ { \ell } } \approx \nabla _ { \mathbf { y } ^ { \ell } } ^ { 2 } \mathcal { L } _ { m , m } \cdot \mathbf { x } ^ { \ell } \mathbf { x } ^ { \ell ^ { T } } = l _ { m } \cdot \mathbf { x } ^ { \ell } \mathbf { x } ^ { \ell ^ { T } } ,
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
where $\nabla _ { \mathbf { y } ^ { \ell } } ^ { 2 } \mathcal { L }$ is approximately a diagonal matrix. Then the final optimization objective is
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
\begin{array} { r l } { \Delta \widehat { \mathbf { W } } _ { m , : } ^ { \ell } = \underset { \Delta \mathbf { W } _ { m , : } ^ { \ell } } { \mathrm { a r g } \mathrm { m i n } } } & { \Delta \mathbf { W } _ { m , : } ^ { \ell } \mathbb { E } [ \mathbf { H } ^ { \mathbf { W } _ { m } ^ { \ell } } ] \Delta \mathbf { W } _ { m , : } ^ { \ell \mathrm { ~ \tiny ~ T ~ } } } \\ { \approx \underset { \Delta \mathbf { W } _ { m , : } ^ { \ell } } { \mathrm { a r g } \mathrm { m i n } } } & { \Delta \mathbf { W } _ { m , : } ^ { \ell } \mathbb { E } [ \mathbf { x } ^ { \ell } \mathbf { x } ^ { \ell ^ { T } } ] \Delta \mathbf { W } _ { m , : } ^ { \ell \mathrm { ~ \tiny ~ T ~ } } = \underset { \Delta \mathbf { W } _ { m , : } ^ { \ell } } { \mathrm { a r g } \mathrm { m i n } } \mathbb { E } [ ( \Delta \mathbf { W } _ { m , : } ^ { \ell } \mathbf { x } ^ { \ell } ) ^ { 2 } ] , } \end{array}
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
which is the MSE between the output activation produced from original and quantized weights. Each sub-problem deals with a single output channel $\Delta \mathbf { \bar { W } } _ { m , : } ^ { \ell }$ . We will further approximate Eq. (4) to remove any input data dependency from the optimization objective in Sec. 3.2.
|
| 60 |
+
|
| 61 |
+
# 3 METHODOLOGY
|
| 62 |
+
|
| 63 |
+
# 3.1 OVERVIEW
|
| 64 |
+
|
| 65 |
+
Although we can obtain a good quantization strategy by minimizing MSE for each output channel, it is an NP-hard combinatorial optimization problem. Even approaching an acceptable local minimum requires significant effort and involves input activations without the data-free promise.
|
| 66 |
+
|
| 67 |
+
To avoid the combinatorial optimization problem and eliminate the requirement of data, we propose the SQuant framework. First, SQuant approximates Eq. (4) with three diagonal Hessian matrices corresponding to the dimensions of weight, in Sec. 3.2. Due to the quantization with a fixed-point data type, SQuant transforms the problem into a data-free optimization problem in the discrete domain. SQuant dedicates to optimizing each layer’s weight employing a flipping approach (Nagel et al., 2020) without any input activation. To achieve our proposed optimization objective, minimizing CASE (Constrained Absolute Sum of Error), SQuant progressively composes three approximate sub-items under constraint relaxation, introduced in Sec. 3.3. Finally, SQuant needs to work out a flipping set f to minimize the CASE of each kernel and output channel. We design an efficient algorithm with a linear computation complexity to find a proper f based on Eq. (8), in Sec. 3.4.
|
| 68 |
+
|
| 69 |
+
# 3.2 DIAGONAL HESSIAN APPROXIMATION
|
| 70 |
+
|
| 71 |
+
In this work, we propose a new approximation of the Hessian matrix to cover non-diagonal elements and decompose Eq. (4) into three sub-items that correspond to the three dimensions of the weight
|
| 72 |
+
|
| 73 |
+

|
| 74 |
+
Figure $1 \colon \Delta \mathbf { W } _ { m , : } \mathbb { E } \big [ \mathbf { x x } ^ { T } \big ] \Delta \mathbf { W } _ { m , : } ^ { \phantom { } T }$ . SQaunt-E, SQaunt-K, and SQuant-C are three approximate subitems, which cover $\mathbf { H } { - } \mathbf { E }$ , $\mathbf { H - K }$ and $\mathtt { H - C }$ , respectively.
|
| 75 |
+
|
| 76 |
+
tensor as illustrated in Fig. 1: SQuant-E for element-wise optimization covers the diagonal elements of $\mathbf { H } ^ { \mathbf { w } _ { m } ^ { \ell } }$ (H-E); SQuant-K for kernel-wise optimization covers the diagonal blocks of $\mathbf { H } ^ { \mathbf { w } _ { m } ^ { \ell } }$ (H-K); SQuant-C for output channel-wise optimization covers the whole $\mathbf { H } ^ { \mathbf { w } _ { m } ^ { \ell } }$ (H-C).
|
| 77 |
+
|
| 78 |
+
The $\mathbb { E } [ { \mathbf { x } } ^ { \ell } { \mathbf { x } } ^ { \ell } ]$ can be approximated by the following equation:
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\mathbb { E } [ { \mathbf { x } } ^ { \ell } { \mathbf { x } } ^ { \ell ^ { T } } ] \approx \mathbf { E } + \mathbf { K } + \mathbf { C } ,
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
where $\mathbf { C } = c _ { m } \mathbf { J } _ { N K }$
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
\mathbf { K } = \left[ \begin{array} { l l l l } { k _ { 1 } \mathbf { J } _ { K } } & & & \\ & { \ddots } & & \\ & & { k _ { N } \mathbf { J } _ { K } } \end{array} \right] , \mathrm { a n d } \mathbf { E } = \left[ \begin{array} { l l l l } { e _ { 1 , 1 } } & & & \\ & { \ddots } & & \\ & & { e _ { N , K } } \end{array} \right] .
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
In the above equations, $\mathbf { J } _ { N K }$ is an all-one matrix with the dimension of $N \times K$ (denoted as $N K$ ), and $c _ { m }$ is a constant value for $m$ -th output channel. $\mathbf { K }$ is a diagonal block matrix, where $\mathbf { J } _ { K }$ represents an all-one matrix with the dimension of $K \times K$ . The $n$ -th diagonal block corresponds to $n$ -th kernel in convolution and has its own constant value $k _ { n }$ . $\mathbf { E }$ is a diagonal matrix with the diagonal elements of $e _ { n , i }$ , each of which is a constant value corresponding to $i$ -th element of $n$ -th kernel.
|
| 91 |
+
|
| 92 |
+
Eq. (5) provides an approximation that preserves as much information from three different levels of $\mathbb { E } [ { \mathbf { x } } ^ { \ell } { \mathbf { x } } ^ { \ell } ]$ as possible, which we explain in Appendix A.1. The matrix C catches the common component of the Hessian matrix, while the matrix $\mathbf { E }$ reserves the individual components in the diagonal line of the Hessian matrix. In addition, we consider kernel-wise approximation for convolution layers by using matrix K. For each inference, the weights of a kernel, $\mathbf { W } _ { m , n , : } ^ { \ell }$ , scan the same feature map. As a result, the corresponding $\mathbf { X }$ has nearly the same expectation values in the center area, with a small perturbation in the marginal area due to padding. Therefore, $k _ { n } \mathbf { J } _ { K }$ as a kernel-wise approximation achieves a low approximate error for convolution. For any $\mathbb { E } [ { \mathbf { x } } ^ { \ell } { \mathbf { x } } ^ { \ell } ]$ , we can always find a decomposition that satisfies $e _ { n , i } , k _ { n } , c _ { m } > 0$ , for which we present the decomposition method in Appendix A.2. Substituting Eq. (5) into Eq. (4) yields the following equation.
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
\Delta \mathbf { W } _ { m , : } ^ { \ell } \mathbb { E } [ { \mathbf { x } ^ { \ell } } { \mathbf { x } ^ { \ell } } ^ { T } ] \Delta \mathbf { W } _ { m , : } ^ { \ell } \approx \sum _ { n , i } e _ { n , i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } + \sum _ { n } k _ { n } \Delta \mathbf { W } _ { m , n , : } ^ { \ell } \mathbf { J } _ { K } \Delta \mathbf { W } _ { m , n , : } ^ { \ell } + c _ { m } \Delta \mathbf { W } _ { m , : } ^ { \ell } \mathbf { J } _ { N K } \Delta \mathbf { W } _ { m , : } ^ { \ell } .
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+
# 3.3 DATA-FREE OPTIMIZATION
|
| 99 |
+
|
| 100 |
+
To achieve the data-free optimization objective, we omit the coefficients $( e _ { n , i } , k _ { n }$ and $c _ { m } .$ ) in Eq. (6), which leads to the approximate objective in Eq. (8) optimized by our fast SQuant framework. We present the omitting process and empirically verify that the approximation does almost not influence the performance in Appendix A.2 and Appendix A.3. It can be easily found that there are no training samples needed to minimize,
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\begin{array} { r l } { \underset { \Delta \mathbf { W } _ { m , : } ^ { \ell } } { \mathrm { a r g } \mathrm { m i n } } } & { \sum _ { n , i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } ^ { 2 } + \underset { n } { \sum _ { n } } \Delta \mathbf { W } _ { m , n , : } ^ { \ell } \mathbf { J } _ { K } \Delta \mathbf { W } _ { m , n , : } ^ { \ell } + \Delta \mathbf { W } _ { m , : } ^ { \ell } \mathbf { J } _ { N K } \Delta \mathbf { W } _ { m , : } ^ { \ell } } \\ { = \underset { \Delta \mathbf { W } _ { m , : } ^ { \ell } } { \mathrm { a r g } \mathrm { m i n } } } & { \sum _ { n , i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } ^ { 2 } + \underset { n } { \sum _ { n } } \big ( \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } \big ) ^ { 2 } + \big ( \underset { n , i } { \sum _ { n } } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } \big ) ^ { 2 } . } \end{array}
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
Next, we transform the overall objective Eq. (8) in the discrete space and explain how to compose and optimize the three approximated sub-items inweights have been scaled with the scale parameter $s _ { m }$ der.for $\mathbf { W } _ { m , : } ^ { \ell }$ out loss of generality, we assume all.
|
| 107 |
+
|
| 108 |
+
Sub-item Analysis For the element-wise item, i.e., the first item in Eq. (8), the problem is reduced to the following objective, which we call SQuant-E.
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
\Delta \widehat { \mathbf { W } } _ { m ; } ^ { \ell } = \underset { \Delta \mathbf { W } _ { m ; } ^ { \ell } } { \mathrm { a r g } } \operatorname* { m i n } \sum _ { n , i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } \overset { 2 } { \underset { \Delta \mathbf { W } _ { m , n , i } ^ { \ell } } { \mathrm { a r g } } } = \underset { \Delta \mathbf { W } _ { m , n , i } ^ { \ell } } { \mathrm { a r g } } | \Delta \mathbf { W } _ { m , n , i } ^ { \ell } | \Leftrightarrow \forall \Delta \widehat { \mathbf { W } } _ { m , n , i } ^ { \ell } , | \Delta \widehat { \mathbf { W } } _ { m , n , i } ^ { \ell } | \leq r _ { e } = 0 . 5 ,
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+
SQuant-E is essentially the rounding method when $r _ { e } = 0 . 5$ . Rounding does not introduce any approximate error and has $O ( 1 )$ complexity for each weight element. However, as many previous works pointed out (Nagel et al., 2020), rounding-to-nearest is not optimal because it only considers the diagonal elements the matrix $\mathbb { E } [ { \mathbf { x } } ^ { \ell } { \mathbf { x } } ^ { \ell } ]$ while ignores the rest majority elements.
|
| 115 |
+
|
| 116 |
+
For kernel-wise item (the second item in Eq. (8)), we have the following objective called SQuant-K,
|
| 117 |
+
|
| 118 |
+
$$
|
| 119 |
+
\Delta \widehat { \mathbf { W } } _ { m ; \cdot } ^ { \ell } = \operatorname* { a r g m i n } _ { \Delta \mathbf { W } _ { m ; \cdot } ^ { \ell } } \sum _ { n } \left( \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } \right) ^ { 2 } = \operatorname* { a r g m i n } _ { \Delta \mathbf { W } _ { m , n , \cdot } ^ { \ell } } \Big | \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } \Big | \Leftrightarrow \forall \Delta \widehat { \mathbf { W } } _ { m , n , \cdot } ^ { \ell } , \ \Big | \sum _ { i } \Delta \widehat { \mathbf { W } } _ { m , n , i } ^ { \ell } \Big | \leq r _ { k } = 0 . 5 ,
|
| 120 |
+
$$
|
| 121 |
+
|
| 122 |
+
where $\begin{array} { r } { | \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } | } \end{array}$ is the Absolute Sum of Error (ASE) of each kernel-wise weight matrix in the convolution and $r _ { k }$ equals 0.5 because of the discrete quantization. In other words, SQuant is based on the insight of Sum of (Signed) error instead of the accumulation of absolute (unsigned) error.
|
| 123 |
+
|
| 124 |
+
Similarly, for the output channel-wise item (the third item in Eq. (8)), we have SQuant-C,
|
| 125 |
+
|
| 126 |
+
$$
|
| 127 |
+
\begin{array} { r } { \Delta \widehat { \mathbf { W } } _ { m , : } ^ { \ell } = \underset { \Delta \mathbf { W } _ { m , : } ^ { \ell } } { \operatorname { a r g m i n } } ( \underset { n , i } { \sum } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } ) ^ { 2 } \Leftrightarrow \forall \Delta \widehat { \mathbf { W } } _ { m , : } ^ { \ell } , \ \vert \underset { n , i } { \sum } \Delta \widehat { \mathbf { W } } _ { m , n , i } ^ { \ell } \vert \leq r _ { c } = 0 . 5 . } \end{array}
|
| 128 |
+
$$
|
| 129 |
+
|
| 130 |
+
Relaxation Obviously, $r _ { e } = 0 . 5$ is against $r _ { k } = 0 . 5$ because rounding $( r _ { e } = 0 . 5 )$ only guarantees the upper-bound $\dot { r _ { k } } = 0 . 5 K$ for SQuant-K. Some elements need to relax the constraint $r _ { e }$ to a larger number, such as 1.0, to satisfy $r _ { k } = 0 . 5$ . Similarly, SQuant-C also needs to relax $r _ { k } = 1 . 0$ .
|
| 131 |
+
|
| 132 |
+
CASE Flipping We adopt the flipping approach (Nagel et al., 2020) to minimize the ASE. Due to the discrete quantization, rounded elements can be flipped (from rounding up to rounding down and vice versa) with $\pm 1$ integer mutation. Formally, we need to work out a flipping set $\mathbf { f } _ { m }$ to satisfy the overall objective Eq. (8) by composing these three sub-items in order (SQuant- $\mathrm { E } $ SQuant- $\mathbf K $ SQuant-C) with constraints relaxation. After optimization, the $\mathbf { f } _ { m }$ will be
|
| 133 |
+
|
| 134 |
+
$$
|
| 135 |
+
\forall ( m , n , i ) \notin \mathbf { f } _ { m } , \ | \Delta \mathbf { W } _ { m , n , i } ^ { \ell } | \leq 0 . 5 ; \quad \forall ( m , n , j ) \in \mathbf { f } _ { m } , \ 0 . 5 \leq | \Delta \mathbf { W } _ { m , n , j } ^ { \ell } | < 1 . 0 ,
|
| 136 |
+
$$
|
| 137 |
+
|
| 138 |
+
where bASE $\mathbf { f } _ { m }$ is the index set of flipped elements for lements, whose perturbation has the sa $m$ -th outpue sign as pecifically, we need to flip . We prove the equivalence $k =$ $\begin{array} { r } { \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } } \end{array}$ Eq. (10) and Eq. (11) by illustrating the transformation process to a discrete problem in Appendix B.1.
|
| 139 |
+
|
| 140 |
+
However, any $k$ elements can satisfy Eq. (10) leading to large search space. Fortunately, based on Eq. (9), SQuant-K can select specific $k$ elements with the top- $k$ largest perturbation because they will have the smallest perturbation after flipping under the constraint of SQuant-E. Therefore, we adopt the Constrained ASE (CASE) to optimize the SQuant-E&K composition via the top- $k$ perturbation algorithm, which is the only solution for minimizing the CASE proven in Appendix B.2. Obviously, SQuant-E&K&C needs to “flip” the “SQuanted” kernel after SQuant-E&K. Notice that we can only flip one element for a kernel to satisfy the constraint $r _ { k } = 1 . 0$ .
|
| 141 |
+
|
| 142 |
+
The following section will introduce an efficient SQuant algorithm with a linear computation complexity for CASE flipping.
|
| 143 |
+
|
| 144 |
+
# 3.4 ON-THE-FLY SQUANT
|
| 145 |
+
|
| 146 |
+
Progressive Algorithm We design a progressive algorithm illustrated in algorithm 1 to meet our stated optimization objective, i.e., minimizing the CASE of weight perturbation. The critical insight of the progressive algorithm is to gradually calibrate the deviation from the optimal global solution introduced by the fine-grained diagonal sub-item. To calibrate the SQuant-E, SQuant-K flips certain rounded elements. After the SQuant-K calibration, SQuant-C then further flips SQuanted kernels.
|
| 147 |
+
|
| 148 |
+
We start by rounding the weight and updating its perturbation to satisfy $r _ { e } = 0 . 5$ (Line 4-5). Then we run the SQuant-K (Line 6) to flip specific elements under $r _ { e } = 1 . 0$ , satisfy $r _ { k } = 0 . 5$ , and update kernel perturbation (Line 7). The follow-up SQuant-C (Line 8) further flips specific kernels under $r _ { k } = 1 . 0$ and satisfy $r _ { c } = 0 . 5$ . Finally, we derive the quantized weights (Line 9).
|
| 149 |
+
|
| 150 |
+
Algorithm 1: Progressive SQuant Algorithm.
|
| 151 |
+
|
| 152 |
+
Input: Weight tensor W of layer $\ell$ , scale factor s of layer \`.
|
| 153 |
+
|
| 154 |
+
Output: Quantized weight tensor $\mathbf { C }$ of layer $\ell$ foreach $m \in [ 1 , . . , M ]$ do // SQuant-C: SQuant $M$ output channels.
|
| 155 |
+
|
| 156 |
+
2 foreach $n \in [ 1 , . . , N ]$ do // SQuant-K: SQuant $N$ kernels.
|
| 157 |
+
3 foreach $i \in [ 1 , . . . , K ]$ do // SQuant-E: Round $K$ elements.
|
| 158 |
+
4 $\mathbf { E } _ { m , n , i } = \lfloor \mathbf { W } _ { m , n , i } / \mathbf { s } _ { m } \rfloor$ // Scale and SQuant-E (Rounding).
|
| 159 |
+
5 $\Delta \mathbf { E } _ { m , n , i } = \mathbf { E } _ { m , n , i } - \mathbf { W } _ { m , n , i } \ / $ Element perturbation.
|
| 160 |
+
6 Km,n,: = SQuantFlip $( { \bf { E } } _ { m , n , : }$ , $\Delta \mathbf { E } _ { m , n , : } ) / $ SQuant-K.
|
| 161 |
+
7 $\Delta \mathbf { K } _ { m , n } ,$ : $=$ UpdatePerturbation $( \Delta \mathbf { E } _ { m , n , : }$ ) // Kernel perturbation.
|
| 162 |
+
8 $\mathbf { C } _ { m , : } = \mathrm { S Q u a n t F l i p } ( \mathbf { K } _ { m , : } , \Delta \mathbf { K } _ { m , : } ) \cdot \mathbf { s } _ { m } / /$ SQuant-C.
|
| 163 |
+
|
| 164 |
+
9 return C
|
| 165 |
+
|
| 166 |
+
Flip Algorithm SQuant-K and SQuant-C can utilize the same flip function. The goal of the flip algorithm is to find a proper element set f to flip and minimize the CASE depicted in algorithm 2. First, we need to compute the accumulated perturbation (e) (Line 2). We select weights with positive perturbation to decrease the positive $e$ and vice versa for negative $e$ . Therefore, we set 0 for the elements with a different sign (Line 3) to disable them. Obviously, we need only $k = \lfloor | e | \rceil$ elements and reduce $| e | < r _ { k } = 0 . 5$ (Line 4). Finally, we flip $k$ weights with the largest $| \mathbf { p } |$ (Line 5-6). For now, we have SQuanted the kernel and tuned kernel CASE to $| e | \le r _ { k } = 0 . 5$ . Specifically, for FC and Conv with a kernel size of $( 1 , 1 )$ , we can skip the SQuant-K. As mentioned in Section 3.3, SQuant-C flips only one element in each kernel. Therefore, we update the kernel perturbation (Line 7 of algorithm 1) for SQuant-C to flip kernel illustrated in Appendix B.3. As a result, SQuant successfully identifies the optimum combination f under a low computation complexity, which we analyze in Appendix B.4.
|
| 167 |
+
|
| 168 |
+
# Algorithm 2: SQuant Flip Algorithm.
|
| 169 |
+
|
| 170 |
+
Input: Rounded/SQuanted Weight w; Weight perturbation p. Output: Updated Quantized Weight w. 1 def SQuantFlip(w, p): 2 $\begin{array} { r } { e = \sum _ { i } \mathbf { p } _ { i } / / } \end{array}$ Accumulated perturbation. 3 $\mathbf { p } [ e \cdot \mathbf { p } < 0 ] = 0 ~ ,$ // Disable Elements/kernels with different sign from e. 4 $k = \lfloor e \rceil / / \mathrm { ~ F 1 i p ~ }$ $k$ elements/kernels based on the CASE. 5 $\mathbf { f } = \mathrm { T o p K } ( | \mathbf { p } | , k )$ .indices// Indices of $k$ largest perturbation. 6 $\mathbf { w } [ \mathbf { f } ] = \operatorname { F l i p } ( \mathbf { w } [ \mathbf { f } ] ) / \AA$ Flip $k$ elements/kernels with same sign as e. 7 return w
|
| 171 |
+
|
| 172 |
+
On-the-Fly Framework From the overall perspective of the optimization, SQuant-K has MN subproblems, while SQuant-C has $M$ sub-problems. Because of the independence of sub-problems, SQuant is friendly for DNN accelerators, e.g., GPU, allowing each sub-problem to be accelerated in parallel. Without the requirement of back-propagation nor fine-tuning, SQuant can run on inferenceonly devices with constrained computation and memory resources on the fly. That provides new opportunities for optimizing weight quantization. In the next section, we demonstrate the impressive efficiency and accuracy of SQuant.
|
| 173 |
+
|
| 174 |
+
# 4 EXPERIMENTS
|
| 175 |
+
|
| 176 |
+
For demonstrating the strength of SQuant, we evaluate the SQuant as well as four SOTA methods, DFQ (Nagel et al., 2019), ZeroQ (Cai et al., 2020), DSG (Zhang et al., 2021; Qin et al., 2021), and
|
| 177 |
+
|
| 178 |
+
Table 1: Results of data-free methods with ResNet18 and ResNet50. “No BP” means that no back-propagation algorithm is used to generate data, “No FT” means no fine-tuning (retraining) for weight quantization.
|
| 179 |
+
|
| 180 |
+
<table><tr><td>Arch</td><td colspan="5">Method No BP No FTW-bit A-bit Top-1</td></tr><tr><td rowspan="10">ResNet18</td><td>Baseline</td><td></td><td>1</td><td>32</td><td>32 71.47</td></tr><tr><td>DFQ</td><td>νxxxν</td><td>4</td><td>4</td><td>0.10</td></tr><tr><td>ZeroQ</td><td>√</td><td>4</td><td>4</td><td>19.09</td></tr><tr><td>DSG</td><td>×</td><td>4</td><td>4</td><td>34.53</td></tr><tr><td>GDFQ</td><td></td><td>4</td><td>4</td><td>60.60</td></tr><tr><td>SQuant</td><td></td><td>4</td><td>4</td><td>66.14</td></tr><tr><td>DFQ</td><td></td><td>6</td><td>6</td><td>67.30</td></tr><tr><td>ZeroQ</td><td></td><td></td><td>6 6</td><td>69.84</td></tr><tr><td>DSG</td><td></td><td></td><td></td><td>70.46</td></tr><tr><td>GDFQ</td><td></td><td>6</td><td>6</td><td>70.13</td></tr><tr><td>SQuant</td><td>xxxv</td><td></td><td>6</td><td>6</td><td>70.74</td></tr><tr><td>DFQ</td><td></td><td>√</td><td>8</td><td>8</td><td>69.70</td></tr><tr><td>ZeroQ</td><td>xxν</td><td></td><td>8</td><td>8</td><td>71.43</td></tr><tr><td>GDFQ</td><td></td><td>X</td><td>8</td><td>8</td><td>70.68</td></tr><tr><td>SQuant</td><td></td><td></td><td>8</td><td>8</td><td>71.47</td></tr><tr><td rowspan="9">ResNet50</td><td>Baseline</td><td></td><td></td><td>32</td><td>32</td><td>77.74</td></tr><tr><td>ZeroQ</td><td></td><td></td><td>4</td><td>4</td><td>7.75</td></tr><tr><td>DSG</td><td></td><td></td><td>4</td><td>4</td><td>23.10</td></tr><tr><td>GDFQ</td><td>xxxν</td><td>×</td><td>4</td><td>4</td><td>55.65</td></tr><tr><td>SQuant</td><td></td><td></td><td>4</td><td>4</td><td>70.80</td></tr><tr><td>ZeroQ</td><td></td><td>√</td><td>6</td><td>6</td><td>72.93</td></tr><tr><td>DSG</td><td>xxxν</td><td></td><td>6</td><td>6</td><td>76.07</td></tr><tr><td>GDFQ</td><td></td><td>X</td><td>6</td><td>6</td><td>76.59 77.05</td></tr><tr><td>SQuant</td><td></td><td></td><td>6</td><td>6</td><td></td></tr><tr><td>ZeroQ DSG</td><td>xxx</td><td></td><td>8</td><td>8</td><td>77.65</td></tr><tr><td></td><td></td><td></td><td>8</td><td>8</td><td>77.68</td></tr><tr><td>GDFQ</td><td></td><td>X</td><td>8</td><td>8</td><td>77.51</td></tr><tr><td>SQuant</td><td></td><td></td><td>8</td><td>8</td><td>77.71</td></tr></table>
|
| 181 |
+
|
| 182 |
+
Table 2: Results of data-free methods with InceptionV3, SqueezeNext, and ShuffleNet.
|
| 183 |
+
|
| 184 |
+
<table><tr><td>Arch</td><td colspan="6">Method No BP No FTW-bit A-bit Top-1</td></tr><tr><td rowspan="10">Inception</td><td>Baseline</td><td>1</td><td>1</td><td>32</td><td>32</td><td>78.81</td></tr><tr><td>ZeroQ</td><td></td><td>√</td><td>4</td><td>4</td><td>18.20</td></tr><tr><td>GDFQ</td><td>xx</td><td>×</td><td>4</td><td>4</td><td>70.39</td></tr><tr><td>SQuant</td><td>√</td><td>√</td><td>4</td><td>4</td><td>73.26</td></tr><tr><td>ZeroQ</td><td>xx</td><td>√</td><td>6</td><td>6</td><td>74.94</td></tr><tr><td>GDFQ</td><td></td><td>×</td><td>6</td><td>6</td><td>77.20</td></tr><tr><td>SQuant</td><td>√</td><td>√</td><td>6</td><td>6</td><td>78.30</td></tr><tr><td>ZeroQ</td><td>×</td><td>√</td><td>8</td><td>8</td><td>78.78</td></tr><tr><td>GDFQ</td><td>X</td><td>×</td><td>8</td><td>8</td><td>78.62</td></tr><tr><td>SQuant</td><td></td><td>5</td><td>8</td><td>8</td><td>78.79</td></tr><tr><td rowspan="9">Squeeze Next</td><td>Baseline</td><td></td><td></td><td>32</td><td>32</td><td>69.38</td></tr><tr><td>ZeroQ</td><td>×</td><td>√</td><td>4</td><td>4</td><td>0.09</td></tr><tr><td>GDFQ</td><td>×</td><td>×</td><td>4</td><td>4</td><td>28.93</td></tr><tr><td>SQuant</td><td>√</td><td>5</td><td>4</td><td>4</td><td>43.45</td></tr><tr><td>ZeroQ</td><td>X</td><td>√</td><td>6</td><td>6</td><td>16.54</td></tr><tr><td>GDFQ</td><td>X</td><td>×</td><td>6</td><td>6</td><td>65.46</td></tr><tr><td>SQuant</td><td>√</td><td></td><td>6</td><td>6</td><td>67.34</td></tr><tr><td>ZeroQ</td><td></td><td>√</td><td>8</td><td>8</td><td>68.18</td></tr><tr><td>GDFQ</td><td>xx</td><td>×</td><td>8</td><td>8 8</td><td>68.22</td></tr><tr><td>SQuant</td><td>√</td><td></td><td>8</td><td></td><td></td><td>69.22</td></tr><tr><td rowspan="7">Shuffle Net</td><td>Baseline</td><td></td><td></td><td>32</td><td>32</td><td>65.07</td></tr><tr><td>ZeroQ</td><td></td><td>√</td><td>6</td><td>6</td><td>35.21</td></tr><tr><td>GDFQ</td><td>xx</td><td>×</td><td>6</td><td>6</td><td>60.12</td></tr><tr><td>SQuant</td><td>√</td><td></td><td>6</td><td>6</td><td>60.25</td></tr><tr><td>ZeroQ</td><td>×</td><td>√</td><td>8</td><td>8</td><td>64.34</td></tr><tr><td>GDFQ</td><td>×</td><td>×</td><td>8</td><td>8</td><td>64.03</td></tr><tr><td>SQuant</td><td></td><td></td><td>8</td><td>8</td><td>64.68</td></tr></table>
|
| 185 |
+
|
| 186 |
+
GDFQ (Xu et al., 2020), with 5 different CNN models including ResNet-18 & 50 (He et al., 2016), Inception V3 (Szegedy et al., 2016), SqueezeNext (Gholami et al., 2018) and ShuffleNet (Zhang et al., 2018) on the golden standard dataset ImageNet (Krizhevsky et al., 2012).
|
| 187 |
+
|
| 188 |
+
In our experiments, SQuant is dedicated to weight quantization, including setting quantization range and selecting the grid point with per-channel quantization, which is friendly for hardware accelerators. With the BN-based approach, we adopt a simple rounding method and a wide quantization range for activation suggested by DFQ (Nagel et al., 2019) without breaking the data-free premise. We clip activation tensors in a layerwise manner (per-tensor). We utilize a uniform distribution as the initialization for the activation quantization range. All DFQ algorithms are implemented with PyTorch (Paszke et al., 2019) and evaluated on Nvidia GPU A100-40GB. Unless otherwise stated, we employ both weight and activation quantization in all experiments. Also, uniform quantization grids are used in all experiments, and hyper-parameters, e.g., $r _ { e } = r _ { k } = 1 . 0$ and $r _ { c } = 0 . 5$ , for all SQuant experiments are the same.
|
| 189 |
+
|
| 190 |
+
# 4.1 COMPARISON TO SOTA METHODS
|
| 191 |
+
|
| 192 |
+
Table 1 and Table 2 show the results on the ImageNet datasets for various bit-width choices, comparing our SQuant against other data-free methods. Among these methods, ZeroQ, DSG, and GDFQ are data-generative approaches with back-propagation. The former two are PTQ methods, while the last is a QAT method, which retrains the network with the synthetic data. DFQ is the only true data-free method with weight equalization and bias correction.
|
| 193 |
+
|
| 194 |
+
Experiments show that SQuant significantly outperforms all other SOTA DFQ methods, even with synthetic dataset calibrating their networks. The 8-bit quantization preserves better network accuracy than the lower-bit quantization does because of higher precision. The benefit of SQuant becomes more prominent as the bit-width decreases. SQuant outperforms the PTQ methods, i.e., DFQ, ZeroQ, and DSG, more than $30 \%$ on all models with 4-bit quantization. It is noteworthy that SQuant surpasses GDFQ in all cases and even surpasses more than $15 \%$ in ResNet50 under 4-bit quantization, although GDFQ is a quantization-aware training method.
|
| 195 |
+
|
| 196 |
+
Table 3: SQuant, ZeroQ and GDFQ 4-bit quantization time on GPU A100
|
| 197 |
+
|
| 198 |
+
<table><tr><td>Arch</td><td>ResNet18</td><td>ResNet50</td><td>InceptionV3</td><td>SqueezeNext</td><td>ShuffleNet</td></tr><tr><td>Layers</td><td>21</td><td>54</td><td>95</td><td>112</td><td>50</td></tr><tr><td>SQuant Time (ms)</td><td>84</td><td>188</td><td>298</td><td>272</td><td>121</td></tr><tr><td>ZeroQ Time (s)</td><td>38</td><td>92</td><td>136</td><td>109</td><td>38</td></tr><tr><td>GDFQ Time (hour)</td><td>1.7</td><td>3.1</td><td>5.7</td><td>4.8</td><td>1.9</td></tr></table>
|
| 199 |
+
|
| 200 |
+
Table 1 and Table 2 also show that GDFQ significantly outperforms ZeroQ and DSG under lower-bit settings (e.g., 4-bit). Since we use the same activation quantization method for evaluating these methods, the results indicate that the weight quantization plays a critical role in the overall model quantization. However, GDFQ requires fine-tuning (FT) with back-propagation (BP). In contrast, SQuant adopts a direct optimization objective of weight perturbation, which does not require finetuning nor BP, and still outperforms GDFQ in the 4-bit setting. These results clearly illustrate the advantages of SQuant, a CASE-based optimization framework, which is to minimize the CASE of weight perturbation.
|
| 201 |
+
|
| 202 |
+
# 4.2 SQUANT EFFICIENCY
|
| 203 |
+
|
| 204 |
+
The trade-off between efficiency and accuracy is challenging for previous DFQ methods. Before SQuant, DFQ is the fastest one since it does not require back-propagation and fine-tuning, but it performs poorly, especially in low-bit cases. GDFQ performs relatively well but takes hours to complete 400 epochs that produce synthetic data from weights and fine-tune the network. SQuant employs the direct optimization objective, minimizing the CASE of weight perturbation, pushes the quantization procedure to a sub-second level. Table 3 shows the 4-bit quantization time of the five models using SQuant, ZeroQ, and GDFQ. The efficient algorithm design also contributes to the surprising results. Note that the SQuant results in Table 3 are the sum of all layer quantization time, and it will be faster if we quantize layers in parallel. A single layer takes SQuant just 3 milliseconds on average because SQuant does not involve complex algorithms, such as back-propagation and fine-tuning. That means we can implement the SQuant algorithm on inference-only devices such as smartphones and IoT devices and quantize the network on the fly.
|
| 205 |
+
|
| 206 |
+
# 4.3 ABLATION STUDY
|
| 207 |
+
|
| 208 |
+
SQuant Granularity We decouple the effect of SQuant-K and SQuant-C, which have different granularities to optimize CASE. As shown in Table 4, their accuracies both outperform SQuant-E
|
| 209 |
+
Table 5: ResNet18 results of SQuant, ZeroQ and DSG with AdaRound. “No SD” means no synthetic data.
|
| 210 |
+
|
| 211 |
+
<table><tr><td>Method</td><td colspan="5">No BP No SD W-bit A-bit Top-1</td></tr><tr><td>Baseline</td><td>1</td><td>1</td><td>32</td><td>32</td><td>71.47</td></tr><tr><td>ZeroQ + AdaRound</td><td></td><td>X</td><td>3</td><td>32</td><td>49.86</td></tr><tr><td>DSG + AdaRound</td><td>xx</td><td>×</td><td>3</td><td>32</td><td>56.09</td></tr><tr><td> SQuant</td><td></td><td>【</td><td>3</td><td>32</td><td>60.78</td></tr><tr><td>ZeroQ + AdaRound</td><td>X</td><td>X</td><td>4</td><td>32</td><td>63.86</td></tr><tr><td>DSG + AdaRound</td><td>×</td><td>×</td><td>4</td><td>32</td><td>66.87</td></tr><tr><td> SQuant</td><td>√</td><td>√</td><td>4</td><td>32</td><td>69.75</td></tr><tr><td>ZeroQ+AdaRound</td><td>X</td><td>X</td><td>5</td><td>32</td><td>68.39</td></tr><tr><td>DSG + AdaRound</td><td>X</td><td>X</td><td>5</td><td>32</td><td>68.97</td></tr><tr><td>SQuant</td><td></td><td></td><td>5</td><td>32</td><td>71.19</td></tr></table>
|
| 212 |
+
|
| 213 |
+
Table 4: SQuant ablation results with ResNet18.
|
| 214 |
+
|
| 215 |
+
<table><tr><td>Method</td><td>W-bit</td><td>A-bit</td><td>Top-1</td></tr><tr><td>Baseline</td><td>32</td><td>32</td><td>71.47</td></tr><tr><td>SQuant-E</td><td>3</td><td>32</td><td>2.05</td></tr><tr><td>SQuant-E&C</td><td>3</td><td>32</td><td>40.87</td></tr><tr><td>SQuant-E&K</td><td>3</td><td>32</td><td>52.07</td></tr><tr><td>SQuant-E&K&C</td><td>3</td><td>32</td><td>60.78</td></tr><tr><td>SQuant-E</td><td>4</td><td>32</td><td>48.15</td></tr><tr><td>SQuant-E&C</td><td>4</td><td>32</td><td>67.14</td></tr><tr><td>SQuant-E&K</td><td>4</td><td>32</td><td>68.07</td></tr><tr><td>SQuant-E&K&C</td><td>4</td><td>32</td><td>69.75</td></tr></table>
|
| 216 |
+
|
| 217 |
+
(i.e., rounding), and combining them leads to higher accuracy for ResNet18. SQuant-E&C has a lower accuracy than SQuant-E&K because SQuant-C has a more significant approximation error than SQuant-K. On the other hand, SQuant-E alone is not optimal because it uses a smaller granularity and ignores a large amount of Hessian information as we analyze in Section 3. This ablation study shows that SQuant-E&K&C achieves the best accuracy by exploiting the most Hessian information (H-C), and SQuant-E&K also achieves a higher accuracy with $\mathbf { H } - \mathbf { \mathbf { x } }$ than SQuant-E with H-E.
|
| 218 |
+
|
| 219 |
+
Comparison to Data-free AdaRound AdaRound (Nagel et al., 2020) is a novel data-driven PTQ method, which also utilizes the Hessian-based approach to round-up or round-down the weights with an approximation assumption. Under the data-free premise, we augment ZeroQ and DSG with the AdaRound by feeding their generated synthetic data to AdaRound. Results in Table 5 show that SQuant has better accuracy than data-free AdaRound because SQuant directly optimizes the CASE objective instead of the MSE of the output activation adopted by AdaRound. It is hard for DSG $^ +$ AdaRound to find the optimal solution with an excessively long optimization path and gradient-based approaches. Even though AdaRound tries a shorter way to fine-tune the weights in the layer-wise fashion, SQuant still outperforms AdaRound in quantization time and accuracy.
|
| 220 |
+
|
| 221 |
+
# 5 RELATED WORK
|
| 222 |
+
|
| 223 |
+
Compression is a promising method to reduce the DNN model’s memory and computation cost. Pruning (Han et al., 2015b;a) is one of the effective approaches to exploit the inherent redundancy of DNN. However, pruning will cause sparse irregular memory accesses. Therefore, pruning needs software (Gale et al., 2020; Guan et al., 2020; Qiu et al., 2019; Guo et al., 2020a; Guan et al., 2021; Fedus et al., 2021) and hardware (Gondimalla et al., 2019; Guo et al., 2020b; Zhang et al., 2020; Wang et al., 2021) optimization to accelerate.
|
| 224 |
+
|
| 225 |
+
Quantization is more practical because it can be supported directly by existing accelerators. Quantization-aware training (QAT) (Gupta et al., 2015; Jacob et al., 2018; Wang et al., 2019; Zhuang et al., 2021) is one of the most promising techniques to retrain networks and mitigate the accuracy drop introduced by quantization. However, the training procedure is time-consuming and costly. Therefore, post-training quantization (PTQ) (Banner et al., 2018; Choukroun et al., 2019; Zhao et al., 2019; Nagel et al., 2020) has earned lots of attention due to the absence of any fine-tuning or retraining process, at the expense of accuracy.
|
| 226 |
+
|
| 227 |
+
Recently, several methods for CNN quantization without the original training datasets have been proposed. These methods are known as data-free quantization (DFQ), including PTQ (Nagel et al., 2019; Cai et al., 2020; Zhang et al., 2021) and QAT (Xu et al., 2020; Liu et al., 2021; Qin et al., 2021; Choi et al., 2020). DFQ (Nagel et al., 2019) and ACIQ (Nagel et al., 2019) rely on weight equalization or bias correction without requiring synthetic data. Other works synthesize the data to calibrate or fine-tune the network based on the batch normalization statistics (Cai et al., 2020) or adversarial knowledge distillation techniques (Liu et al., 2021; Choi et al., 2020).
|
| 228 |
+
|
| 229 |
+
# 6 CONCLUSION
|
| 230 |
+
|
| 231 |
+
This paper approximates and composes the original Hessian optimization objective into the CASE of weight perturbation with a data-free premise. Surprisingly, CASE only involves the weight perturbation and requires no knowledge of any datasets or network architecture. Based on that, we proposed the on-the-fly SQuant framework. We used a progressive algorithm to minimize CASE directly and significantly improve accuracy than other DFQ methods. SQuant considerably reduces optimization complexity and accelerates the data-free quantization procedure, which previously requires back-propagation with massive computation and memory resources consumption seen in other works. In summary, SQuant outperforms other data-free quantization approaches in terms of accuracy and pushes the quantization processing time to a sub-second level.
|
| 232 |
+
|
| 233 |
+
# ACKNOWLEDGMENTS
|
| 234 |
+
|
| 235 |
+
We would like to thank the anonymous reviewers for their constructive feedback. This work was supported by the National Key R&D Program of China under Grant 2021ZD0110104, and the National Natural Science Foundation of China (NSFC) grant (U21B2017, 62072297, and 61832006).
|
| 236 |
+
|
| 237 |
+
# REFERENCES
|
| 238 |
+
|
| 239 |
+
Ron Banner, Yury Nahshan, Elad Hoffer, and Daniel Soudry. Post-training 4-bit quantization of convolution networks for rapid-deployment. arXiv preprint arXiv:1810.05723, 2018.
|
| 240 |
+
|
| 241 |
+
Yaohui Cai, Zhewei Yao, Zhen Dong, Amir Gholami, Michael W Mahoney, and Kurt Keutzer. Zeroq: A novel zero shot quantization framework. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 13169–13178, 2020.
|
| 242 |
+
|
| 243 |
+
Yoojin Choi, Jihwan Choi, Mostafa El-Khamy, and Jungwon Lee. Data-free network quantization with adversarial knowledge distillation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, pp. 710–711, 2020.
|
| 244 |
+
|
| 245 |
+
Yoni Choukroun, Eli Kravchik, Fan Yang, and Pavel Kisilev. Low-bit quantization of neural networks for efficient inference. In ICCV Workshops, pp. 3009–3018, 2019.
|
| 246 |
+
|
| 247 |
+
Xin Dong, Shangyu Chen, and Sinno Jialin Pan. Learning to prune deep neural networks via layer-wise optimal brain surgeon. arXiv preprint arXiv:1705.07565, 2017.
|
| 248 |
+
|
| 249 |
+
Zhen Dong, Zhewei Yao, Yaohui Cai, Daiyaan Arfeen, Amir Gholami, Michael W Mahoney, and Kurt Keutzer. Hawq-v2: Hessian aware trace-weighted quantization of neural networks. arXiv preprint arXiv:1911.03852, 2019a.
|
| 250 |
+
|
| 251 |
+
Zhen Dong, Zhewei Yao, Amir Gholami, Michael W Mahoney, and Kurt Keutzer. Hawq: Hessian aware quantization of neural networks with mixed-precision. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 293–302, 2019b.
|
| 252 |
+
|
| 253 |
+
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.
|
| 254 |
+
|
| 255 |
+
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, pp. 1–14. IEEE, 2020.
|
| 256 |
+
|
| 257 |
+
Amir Gholami, Kiseok Kwon, Bichen Wu, Zizheng Tai, Xiangyu Yue, Peter Jin, Sicheng Zhao, and Kurt Keutzer. Squeezenext: Hardware-aware neural network design. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pp. 1638–1647, 2018.
|
| 258 |
+
|
| 259 |
+
Ashish Gondimalla, Noah Chesnut, Mithuna Thottethodi, and TN Vijaykumar. Sparten: A sparse tensor accelerator for convolutional neural networks. In Proceedings of the 52nd Annual IEEE/ACM International Symposium on Microarchitecture, pp. 151–165, 2019.
|
| 260 |
+
|
| 261 |
+
Yue Guan, Jingwen Leng, Chao Li, Quan Chen, and Minyi Guo. How far does bert look at: Distance-based clustering and analysis of bert’s attention. In Proceedings of the 28th International Conference on Computational Linguistics, pp. 3853–3860, 2020.
|
| 262 |
+
|
| 263 |
+
Yue Guan, Zhengyi Li, Jingwen Leng, Zhouhan Lin, Minyi Guo, and Yuhao Zhu. Block-skim: Efficient question answering for transformer. arXiv preprint arXiv:2112.08560, 2021.
|
| 264 |
+
|
| 265 |
+
Cong Guo, Bo Yang Hsueh, Jingwen Leng, Yuxian Qiu, Yue Guan, Zehuan Wang, Xiaoying Jia, Xipeng Li, Minyi Guo, and Yuhao Zhu. Accelerating sparse dnn models without hardware-support via tile-wise sparsity. In Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, pp. 1–15, 2020a.
|
| 266 |
+
|
| 267 |
+
Cong Guo, Yangjie Zhou, Jingwen Leng, Yuhao Zhu, Zidong Du, Quan Chen, Chao Li, Bin Yao, and Minyi Guo. Balancing efficiency and flexibility for dnn acceleration via temporal gpu-systolic array integration. In 2020 57th ACM/IEEE Design Automation Conference (DAC), pp. 1–6. IEEE, 2020b.
|
| 268 |
+
|
| 269 |
+
Suyog Gupta, Ankur Agrawal, Kailash Gopalakrishnan, and Pritish Narayanan. Deep learning with limited numerical precision. In International conference on machine learning, pp. 1737–1746. PMLR, 2015.
|
| 270 |
+
|
| 271 |
+
Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015a.
|
| 272 |
+
|
| 273 |
+
Song Han, Jeff Pool, John Tran, and William J Dally. Learning both weights and connections for efficient neural networks. arXiv preprint arXiv:1506.02626, 2015b.
|
| 274 |
+
|
| 275 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
|
| 276 |
+
|
| 277 |
+
Itay Hubara, Yury Nahshan, Yair Hanani, Ron Banner, and Daniel Soudry. Improving post training neural quantization: Layer-wise calibration and integer programming. arXiv preprint arXiv:2006.10518, 2020.
|
| 278 |
+
|
| 279 |
+
Benoit Jacob, Skirmantas Kligys, Bo Chen, Menglong Zhu, Matthew Tang, Andrew Howard, Hartwig Adam, and Dmitry Kalenichenko. Quantization and training of neural networks for efficient integer-arithmetic-only inference. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2704–2713, 2018.
|
| 280 |
+
|
| 281 |
+
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25:1097–1105, 2012.
|
| 282 |
+
|
| 283 |
+
Yuhang Li, Ruihao Gong, Xu Tan, Yang Yang, Peng Hu, Qi Zhang, Fengwei Yu, Wei Wang, and Shi Gu. Brecq: Pushing the limit of post-training quantization by block reconstruction. arXiv preprint arXiv:2102.05426, 2021.
|
| 284 |
+
|
| 285 |
+
Yuang Liu, Wei Zhang, and Jun Wang. Zero-shot adversarial quantization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1512–1521, 2021.
|
| 286 |
+
|
| 287 |
+
Markus Nagel, Mart van Baalen, Tijmen Blankevoort, and Max Welling. Data-free quantization through weight equalization and bias correction. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 1325–1334, 2019.
|
| 288 |
+
|
| 289 |
+
Markus Nagel, Rana Ali Amjad, Mart Van Baalen, Christos Louizos, and Tijmen Blankevoort. Up or down? adaptive rounding for post-training quantization. In International Conference on Machine Learning, pp. 7197–7206. PMLR, 2020.
|
| 290 |
+
|
| 291 |
+
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.
|
| 292 |
+
|
| 293 |
+
Xu Qian, Victor Li, and Crews Darren. Channel-wise hessian aware trace-weighted quantization of neural networks. arXiv preprint arXiv:2008.08284, 2020.
|
| 294 |
+
|
| 295 |
+
Haotong Qin, Yifu Ding, Xiangguo Zhang, Aoyu Li, Jiakai Wang, Xianglong Liu, and Jiwen Lu. Diverse sample generation: Pushing the limit of data-free quantization. arXiv preprint arXiv:2109.00212, 2021.
|
| 296 |
+
|
| 297 |
+
Yuxian Qiu, Jingwen Leng, Cong Guo, Quan Chen, Chao Li, Minyi Guo, and Yuhao Zhu. Adversarial defense through network profiling based path extraction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4777–4786, 2019.
|
| 298 |
+
|
| 299 |
+
Sheng Shen, Zhen Dong, Jiayu Ye, Linjian Ma, Zhewei Yao, Amir Gholami, Michael W Mahoney, and Kurt Keutzer. Q-bert: Hessian based ultra low precision quantization of bert. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 8815–8821, 2020.
|
| 300 |
+
|
| 301 |
+
Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2818–2826, 2016.
|
| 302 |
+
|
| 303 |
+
Yang Wang, Chen Zhang, Zhiqiang Xie, Cong Guo, Yunxin Liu, and Jingwen Leng. Dual-side sparse tensor core. In Proceedings of the 48th Annual International Symposium on Computer Architecture, ISCA ’21, pp. 1083–1095, 2021.
|
| 304 |
+
|
| 305 |
+
Ziwei Wang, Jiwen Lu, Chenxin Tao, Jie Zhou, and Qi Tian. Learning channel-wise interactions for binary convolutional neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 568–577, 2019.
|
| 306 |
+
|
| 307 |
+
Yikai Wu, Xingyu Zhu, Chenwei Wu, Annie Wang, and Rong Ge. Dissecting hessian: Understanding common structure of hessian in neural networks. arXiv preprint arXiv:2010.04261, 2020.
|
| 308 |
+
|
| 309 |
+
Shoukai Xu, Haokun Li, Bohan Zhuang, Jing Liu, Jiezhang Cao, Chuangrun Liang, and Mingkui Tan. Generative low-bitwidth data free quantization. In European Conference on Computer Vision, pp. 1–17. Springer, 2020.
|
| 310 |
+
|
| 311 |
+
Zhewei Yao, Zhen Dong, Zhangcheng Zheng, Amir Gholami, Jiali Yu, Eric Tan, Leyuan Wang, Qijing Huang, Yida Wang, Michael Mahoney, et al. Hawq-v3: Dyadic neural network quantization. In International Conference on Machine Learning, pp. 11875–11886. PMLR, 2021.
|
| 312 |
+
|
| 313 |
+
Shixing Yu, Zhewei Yao, Amir Gholami, Zhen Dong, Michael W Mahoney, and Kurt Keutzer. Hessian-aware pruning and optimal neural implant. arXiv preprint arXiv:2101.08940, 2021.
|
| 314 |
+
|
| 315 |
+
Xiangguo Zhang, Haotong Qin, Yifu Ding, Ruihao Gong, Qinghua Yan, Renshuai Tao, Yuhang Li, Fengwei Yu, and Xianglong Liu. Diversifying sample generation for accurate data-free quantization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15658–15667, 2021.
|
| 316 |
+
|
| 317 |
+
Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, and Jian Sun. Shufflenet: An extremely efficient convolutional neural network for mobile devices. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 6848–6856, 2018.
|
| 318 |
+
|
| 319 |
+
Zhekai Zhang, Hanrui Wang, Song Han, and William J Dally. Sparch: Efficient architecture for sparse matrix multiplication. In 2020 IEEE International Symposium on High Performance Computer Architecture (HPCA), pp. 261–274. IEEE, 2020.
|
| 320 |
+
|
| 321 |
+
Ritchie Zhao, Yuwei Hu, Jordan Dotzel, Chris De Sa, and Zhiru Zhang. Improving neural network quantization without retraining using outlier channel splitting. In International conference on machine learning, pp. 7543–7552. PMLR, 2019.
|
| 322 |
+
|
| 323 |
+
Bohan Zhuang, Mingkui Tan, Jing Liu, Lingqiao Liu, Ian Reid, and Chunhua Shen. Effective training of convolutional neural networks with low-bitwidth weights and activations. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021.
|
| 324 |
+
|
| 325 |
+
# A APPROXIMATION AND DECOMPOSITION
|
| 326 |
+
|
| 327 |
+
A.1 APPROXIMATED HESSIAN MATRIX FOR DATA-FREE QUANTIZATION
|
| 328 |
+
|
| 329 |
+
The quantization loss function for the entire network is
|
| 330 |
+
|
| 331 |
+
$$
|
| 332 |
+
\mathcal { L } ( \Delta \mathbf { W } ) = \Delta \mathbf { W } \mathbb { E } [ \mathbf { H } ] \Delta \mathbf { W } ^ { T } .
|
| 333 |
+
$$
|
| 334 |
+
|
| 335 |
+
Consider a convolution layer defined as
|
| 336 |
+
|
| 337 |
+
$$
|
| 338 |
+
\mathbf { Y } _ { m , h , w } = \sum _ { n , i , j } \mathbf { W } _ { m , n , i , j } \mathbf { X } _ { n , h - i , w - j } .
|
| 339 |
+
$$
|
| 340 |
+
|
| 341 |
+
Here, $\mathbf { Y }$ has three dimensions, output channel, output feature map height, and output feature map width, i.e., $( M \times O H \times O W )$ indexing by $( m , h , w )$ , $\mathbf { W }$ has four dimensions, output channel, input channel, kernel height, kernel width, i.e., $( M \times N \times K H \times K W )$ indexing by $( m , n , i , j )$ , and $\mathbf { X }$ has three dimensions, input channel, input feature map height, and input feature map width, i.e., $( N \times I H \times I W )$ indexing by $( n , h - i , w - j )$ . Ignoring the interaction between layers and output channels following Nagel et al. (2020), for a specific convolution layer $l$ and output channel $m$ , the elements of corresponding output channel-wise Hessian $\mathbf { H } ^ { \ l W _ { m } ^ { \ell } }$ is
|
| 342 |
+
|
| 343 |
+
$$
|
| 344 |
+
\begin{array} { r l } { \mathbf { H } _ { n , i , j , n ^ { \prime } , i ^ { \prime } , j ^ { \prime } } ^ { \mathrm { W Z } } } & { = \frac { \partial ^ { 2 } \cdot Q } { \partial \mathbf { W } _ { n , i , j , i ^ { \prime } , i ^ { \prime } , j ^ { \prime } } } } \\ & { = \frac { \partial } { \partial \mathbf { W } _ { n , i , j , i ^ { \prime } , j ^ { \prime } , i ^ { \prime } } } \frac { \partial \cdot Q } { \partial \mathbf { W } _ { n , i , j , n ^ { \prime } , i ^ { \prime } } } \frac { \partial \cdot \mathbf { W } _ { n , i , j , n ^ { \prime } } } { \partial \mathbf { W } _ { n , n , i , j , i ^ { \prime } } } } \\ & { = \frac { \partial } { \partial \mathbf { W } _ { n , i , j , i ^ { \prime } , i ^ { \prime } , i ^ { \prime } } } \frac { \partial \cdot Q } { \partial \mathbf { W } _ { n , i , n ^ { \prime } , i ^ { \prime } , i ^ { \prime } } } \mathbf { W } _ { n , i , i ^ { \prime } , i ^ { \prime } , i ^ { \prime } } } \\ & { = \frac { \partial } { \partial \mathbf { W } _ { n , i , n ^ { \prime } , i ^ { \prime } } } \frac { \partial \cdot Q } { \partial \mathbf { W } _ { n , i , n ^ { \prime } , i ^ { \prime } } } \mathbf { W } _ { n , i , i ^ { \prime } , i ^ { \prime } , i ^ { \prime } } } \\ & { = \frac { \partial } { \partial \mathbf { W } _ { n , i , n ^ { \prime } } } \left( \frac { \partial } { \partial \mathbf { W } _ { n , i , n ^ { \prime } , i ^ { \prime } } } \frac { \partial \cdot Q } { \partial \mathbf { W } _ { n , i ^ { \prime } , i ^ { \prime } , i ^ { \prime } } } \right) \mathbf { X } _ { n , i ^ { \prime } , i ^ { \prime } , i ^ { \prime } , n ^ { \prime } } } \\ & = \frac { \partial } { \partial \mathbf { W } _ { n } } \left( \frac { \partial } { \partial \mathbf { T } _ { n , i , n ^ { \prime } , i ^ { \prime } } } \frac { \partial \cdot Q } \partial \mathbf { W } _ { n , i ^ { \prime } , i ^ { \prime } , i ^ { \prime } } \mathbf { W } _ { n ^ { \prime } , i ^ { \prime } , i ^ { \prime } } \right) \mathbf { X } _ n , i ^ { \prime } , i ^ { \prime } , i \end{array}
|
| 345 |
+
$$
|
| 346 |
+
|
| 347 |
+
Assuming $\nabla _ { \mathbf { y } ^ { \ell } } ^ { 2 } \mathcal { L }$ is a diagonal matrix yields Eq. (30) in (Nagel et al., 2020)
|
| 348 |
+
|
| 349 |
+
$$
|
| 350 |
+
\mathbf { H } _ { n , i , j , n ^ { \prime } , i ^ { \prime } , j ^ { \prime } } ^ { \mathbf { W } _ { m } ^ { \ell } } \approx \sum _ { h , w } \frac { \partial ^ { 2 } \mathcal { L } } { \partial \mathbf { Y } _ { m , h , w } ^ { 2 } } \mathbf { X } _ { n , h - i , w - j } \mathbf { X } _ { n , h - i ^ { \prime } , w - j ^ { \prime } } .
|
| 351 |
+
$$
|
| 352 |
+
|
| 353 |
+
To make Eq. (13) get irrelevant to training samples, we assume that input feature maps auto-correlate with each other in a similar way, resulting in
|
| 354 |
+
|
| 355 |
+
$$
|
| 356 |
+
\mathbb { E } [ \mathbf { H } _ { n , i , j , n ^ { \prime } , i ^ { \prime } , j ^ { \prime } } ^ { \mathbf { W } _ { m } ^ { \ell } } ] = \mathbb { E } [ \sum _ { h , w } \frac { \partial ^ { 2 } \mathcal { L } } { \partial \mathbf { Y } _ { m , h , w } ^ { 2 } } \mathbf { X } _ { n , h - i , w - j } \mathbf { X } _ { n ^ { \prime } , h - i ^ { \prime } , w - j ^ { \prime } } ] \approx c _ { m }
|
| 357 |
+
$$
|
| 358 |
+
|
| 359 |
+
for all $n , i , j , n ^ { \prime } , i ^ { \prime }$ and $j ^ { \prime }$ , where $c _ { m }$ is a constant. It should be noted that Eq. (22) is a strong assumption. For more accurate approximation, we further look into each input channel (i.e., $n = \bar { n ^ { \prime } } , i \neq i ^ { \prime }$ , and $j \neq j ^ { \prime } ,$ ), and find
|
| 360 |
+
|
| 361 |
+
$$
|
| 362 |
+
\mathbb { E } [ \mathbf { H } _ { i , j , i ^ { \prime } , j ^ { \prime } } ^ { \mathbf { W } _ { m , n } ^ { \ell } } ] = \mathbb { E } [ \sum _ { h , w } \frac { \partial ^ { 2 } \mathcal { L } } { \partial \mathbf { Y } _ { m , h , w } ^ { 2 } } \mathbf { X } _ { n , h - i , w - j } \mathbf { X } _ { n , h - i ^ { \prime } , w - j ^ { \prime } } ] \approx k _ { m , n } ,
|
| 363 |
+
$$
|
| 364 |
+
|
| 365 |
+
for all $i , j , i ^ { \prime }$ , and $j ^ { \prime }$ , where $k _ { m , n }$ is a constant. It is generally true because the kernel size is usually much smaller than the size of feature maps, so the shift introduced by different $i , j , i ^ { \prime }$ , and $j ^ { \prime }$ is a small perturbation of E[HW\`m,ni, j,i0, j0 ] compared with the summation over the entire feature map. Finally, we focus on each diagonal element of Hessian matrix (i.e., $n = n ^ { \prime }$ , $i = i ^ { \prime }$ , and $j = j ^ { \prime }$ ) and denote
|
| 366 |
+
|
| 367 |
+
$$
|
| 368 |
+
\mathbb { E } [ \mathbf { H } ^ { \mathbf { W } _ { m , n , i , j } ^ { \ell } } ] = \mathbb { E } [ \sum _ { h , w } \frac { \partial ^ { 2 } \mathcal { L } } { \partial \mathbf { Y } _ { m , h , w } ^ { 2 } } \mathbf { X } _ { n , h - i , w - j } ^ { 2 } ] = e _ { m , n , i , j } ,
|
| 369 |
+
$$
|
| 370 |
+
|
| 371 |
+
where $e _ { m , n , i , j }$ is a constant. Please note that the output channel-wise expected Hessian matrix $\mathbb { E } \big [ \mathbf { H } _ { n , i , j , n ^ { \prime } , i ^ { \prime } , j ^ { \prime } } ^ { \mathbf { W } _ { m } ^ { \ell } } \big ]$ is a principle submatrix of $\mathbb { E } [ \mathbf { H } ]$ , so it must positive semi-define. Therefore, we set em,n,i, j > km,n > cm > 0 to ensure the approximation to E[HW\`mn,i, j,n 0,i0, j0 ] is also positive semi-define and nontrivial. Considering Eq. (22), Eq. (23), and Eq. (24) at the same time, we can get the approximation to expected Hessian shown in Eq. (5). Extending the discussion to fully connected layer is straightforward thus omitted here.
|
| 372 |
+
|
| 373 |
+
# A.2 DECOMPOSITION
|
| 374 |
+
|
| 375 |
+
In this section, we present the decomposition method for $\mathbf { H } ^ { \mathbf { W } _ { m } ^ { \ell } } = l _ { m } \mathbb { E } [ \mathbf { x } ^ { \ell } \mathbf { x } ^ { \ell ^ { T } } ]$ illustrated in the algorithm 3. First, we construct three matrices with the shape of $( N K , N K )$ , $\mathbf { C } ^ { \prime } = \mathbf { J } _ { N K }$ ,
|
| 376 |
+
|
| 377 |
+
$$
|
| 378 |
+
\mathbf { K } ^ { \prime } = \left[ \begin{array} { l l l l } { \mathbf { J } _ { K } } & & & \\ & { \ddots } & \\ & & & { \mathbf { J } _ { K } } \end{array} \right] , \mathrm { a n d } \mathbf { E } ^ { \prime } = \left[ \begin{array} { l l l l } { 1 } & & & \\ & { \ddots } & \\ & & { 1 } \end{array} \right] .
|
| 379 |
+
$$
|
| 380 |
+
|
| 381 |
+
Here, $\mathbf { J } _ { N K }$ is an all-one matrix with dimension $N K = N \times K$ and $\mathbf { J } _ { K }$ represents an all-one matrix with dimension $K$ . The $n$ -th diagonal block corresponds to $n$ -th kernel in convolution and has the same constant $k _ { n }$ . $\mathbf { E }$ is a diagonal matrix whose diagonal elements are 1.
|
| 382 |
+
|
| 383 |
+
# Algorithm 3: $\mathbb { E } [ { \mathbf { x } } ^ { \ell } { \mathbf { x } } ^ { \ell } ]$ Decomposition.
|
| 384 |
+
|
| 385 |
+
Input: $\mathbb { E } [ { \mathbf { x } } ^ { \ell } { \mathbf { x } } ^ { \ell } ] , \mathbf { H }$ ; Channel-wise matrix, $\mathbf { C ^ { \prime } }$ . Kernel-wise matrix, $\mathbf { K } ^ { \prime }$ . Element-wise matrix, $\mathbf { E ^ { \prime } }$ . Output: Matrix $\mathbf { E } , \mathbf { K }$ , and C. 1 $\mathbf { H } ^ { \prime } = | \mathbf { H } |$ 2 $c _ { m } = \left( 1 - \varepsilon \right) \cdot \mathrm { m i n } ( \mathbf { H } ^ { \prime } ) \ / .$ / Output channel-wise. 3 $\mathbf { C } = c _ { m } \mathbf { C ^ { \prime } }$ 4 foreach $n \in [ 1 , . . . , N ]$ do // Kernel-wise. 5 $k _ { n } = ( 1 - \varepsilon _ { n } ^ { \prime } ) \cdot \operatorname* { m i n } ( \mathbf { H } _ { n : n + K , \ n : n + K } ^ { \prime } - c _ { m } )$ 6 $\mathbf { K } _ { n , : } = k _ { n } \mathbf { K } _ { n , } ^ { \prime }$ : 7 foreach $i \in [ 1 , . . . , K ]$ do // Element-wise. 8 $e _ { n , i } = { \bf H } _ { n \times K + i , n \times K + i } ^ { \prime } - c _ { m } - k _ { n }$ 9 $\mathbf { E } _ { n , i } = e _ { n , i } \mathbf { E } _ { n , i } ^ { \prime }$
|
| 386 |
+
|
| 387 |
+
10 return E, K, C
|
| 388 |
+
|
| 389 |
+
In algorithm 3, $0 < \varepsilon , \varepsilon ^ { \prime } < 1$ , and we can get the matrices $\mathbf { E } , \mathbf { K }$ , and C. Evidently, algorithm 3 can make $c _ { m } > 0$ , $k _ { n } > 0$ , and $e _ { n , i } > 0$ for any $\mathbb { E } [ { \mathbf { x } } ^ { \ell } { \mathbf { x } } ^ { \ell ^ { T } } ] \approx \mathbf { E } + \mathbf { K } + \mathbf { C } .$
|
| 390 |
+
|
| 391 |
+
# A.3 APPROXIMATION ERROR ANALYSIS
|
| 392 |
+
|
| 393 |
+
To achieve the data-free optimization objective, we omit the coefficients $( e _ { n , i } , k _ { n }$ and $c _ { m , \astrosun }$ ) in Eq. (6), which leads to the approximate objective in Eq. (8) optimized by our fast SQuant framework. We approximate Eq. (6) to Eq. (8) to enable fast data-free quantization. The approximation error is insignificant as our comprehensive results have shown the high accuracy of the final quantized model in Table 1 and Table 2 of the manuscript. The intuition behind the approximation is that we use an iterative process which progressively reduces each term of Eq. (6). Because each term’s coefficient $( e _ { n , i } , k _ { n }$ , and $c _ { m }$ ) is positive, the reduction of each term would generally lead to the reduction of the precise objective in Eq. (6). In this section, we provide an empirical analysis of the approximation error between Eq. (6) andEq. (8).
|
| 394 |
+
|
| 395 |
+
In this empirical experiment, we use the real dataset to generate the precise coefficients of $e _ { n , i } , k _ { n }$ , and $c _ { m }$ in Eq. (6). To quantify the approximation error in our SQuant framework, we evaluate a metric called approximation precision and show that we achieve a nearly $9 5 \%$ approximation precision.
|
| 396 |
+
|
| 397 |
+
Since SQuant uses the flipping-based iterative optimization framework to minimize Eq. (8), we define an element as correctly flipped if its flipping leads to the decrease of the precise objective Eq. (6) and approximate objective Eq. (8). The approximation precision (AP) is the ratio of the correct element based on data-free Eq. (8) compared to data-driven Eq. (6), i.e.,
|
| 398 |
+
|
| 399 |
+
$$
|
| 400 |
+
\mathrm { A P } = { \frac { \mathrm { N u m b e r ~ o f ~ c o r r e c t ~ e l e m e n t s } } { \mathrm { N u m b e r ~ o f ~ f i i p p e d ~ e l e m e n t s } } } .
|
| 401 |
+
$$
|
| 402 |
+
|
| 403 |
+
Table 6: ResNet18 results under 4-bit weight-only quantization. “Flipped” is the number of the Flipped elements after SQuant optimization. “Correct” is the number of elements has the same optimization direction as the precise objective. AP is the approximation precision.
|
| 404 |
+
|
| 405 |
+
<table><tr><td>Layers</td><td colspan="2">Squant-E&K</td><td colspan="3">Squant-E&K&C</td></tr><tr><td></td><td colspan="2">Flipped Correct</td><td colspan="3">Flipped Correct</td></tr><tr><td>1</td><td>2346 2346</td><td>AP 100.00 %</td><td>123</td><td>123</td><td>100.0%</td></tr><tr><td>2</td><td>2683 2594</td><td>96.68 %</td><td>97</td><td>97</td><td>100.0%</td></tr><tr><td>3</td><td>2662 2653</td><td>99.66 %</td><td>100</td><td>100</td><td>100.0%</td></tr><tr><td>4</td><td>2698 2630</td><td>97.48 %</td><td>107</td><td>107</td><td>100.0%</td></tr><tr><td>5</td><td>1</td><td>1 -</td><td>230</td><td>220</td><td>95.7%</td></tr><tr><td>6</td><td>5349</td><td>5339 99.81 %</td><td>223</td><td>223</td><td>100.0 %</td></tr><tr><td>7</td><td>10782</td><td>10676 99.02 %</td><td>332</td><td>332</td><td>100.0%</td></tr><tr><td>8</td><td>10777</td><td>10633 98.66%</td><td>342</td><td>342</td><td>100.0%</td></tr><tr><td>9</td><td>10655</td><td>10424 97.83 %</td><td>348</td><td>348</td><td>100.0%</td></tr><tr><td>10</td><td>1</td><td>1 1</td><td>649</td><td>619</td><td>95.4 %</td></tr><tr><td>11</td><td>21371 21173</td><td>99.07 %</td><td>663</td><td>663</td><td>100.0%</td></tr><tr><td>12</td><td>43116 41561</td><td>96.39 %</td><td>906</td><td>906</td><td>100.0%</td></tr><tr><td>13</td><td>42976 41402</td><td>96.34%</td><td>932</td><td>932</td><td>100.0 %</td></tr><tr><td>14</td><td>43321 41315</td><td>95.37 %</td><td>918</td><td>918</td><td>100.0 %</td></tr><tr><td>15</td><td>- -</td><td>1</td><td>1988</td><td>1639</td><td>82.4%</td></tr><tr><td>16</td><td>86010 83070</td><td>96.58 %</td><td>1846</td><td>1846</td><td>100.0%</td></tr><tr><td>17</td><td>171344 161358</td><td>94.17 %</td><td>2629</td><td>2629</td><td>100.0%</td></tr><tr><td>18</td><td>172071 158066</td><td>91.86 %</td><td>2602</td><td>2602</td><td>100.0%</td></tr><tr><td>19</td><td>172623</td><td>154536 89.52 %</td><td>2504</td><td>2504</td><td>100.0 %</td></tr><tr><td>Total</td><td>800784</td><td>749776 93.6%</td><td>17539</td><td>17150</td><td>97.8%</td></tr><tr><td>Acc.</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td>68.07</td><td></td><td>69.75</td><td></td></tr></table>
|
| 406 |
+
|
| 407 |
+
We perform the above approximation error analysis on ResNet18 with ImageNet under 4-bit weightonly quantization. We evaluate the SQuanted weight on the inference datasets. We compute the coefficients $e _ { n , i }$ , $k _ { n }$ , and $c _ { m }$ with 1000 samples. Table 6 shows the results, which clearly show that SQuant-E&K&C achieves nearly $100 \%$ approximation precision. In other words, nearly all flipped elements can indeed reduce the precise objective in Eq. (6). Based on this empirical study, we show that the approximation from Eq. (6) to Eq. (8) is effective for our data-free quantization.
|
| 408 |
+
|
| 409 |
+
# B SQUANT ALGORITHM
|
| 410 |
+
|
| 411 |
+
# B.1 DISCRETE OPTIMIZATION PROBLEM
|
| 412 |
+
|
| 413 |
+
We introduce the transformation of the discrete optimization problem. We know that the quantization is to round the scaled elements to the integer grid. Each quantization step has two rounding directions, rounding up and down, with a step size of 1. We have the quantization example within $[ 0 , 1 ]$ shown in Fig. 2.
|
| 414 |
+
|
| 415 |
+
Clearly, the element 0.7 (0.4) can be rounded up (down) to 1.0 (0.0) with $+ 0 . 3 \ ( - 0 . 4 )$ orignal perturbation and flipped to 0.0 (1.0) with $- 0 . 7 \left( + 0 . 6 \right)$ flipped perturbation with $- 1 \left( + 1 \right)$ mutation. Each flipping operation leads to a $\pm 1$ integer mutation and increases the perturbation to [0.5, 1.0]. We prove that we can always find $\begin{array} { r } { k = \lfloor \vert \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } \vert \vert } \end{array}$ elements to flip and reduce $\begin{array} { r } { | \sum _ { i } \Delta \widehat { \mathbf { W } } _ { m , n , i } ^ { \ell } | \leq 0 . 5 } \end{array}$
|
| 416 |
+
|
| 417 |
+

|
| 418 |
+
Figure 2: The flipping approach.
|
| 419 |
+
|
| 420 |
+
Proof. Assume $n$ -th kernel has $K$ elements, $a$ rounded up elements with index set $\mathbf { f } _ { a }$ have positive perturbation, $^ b$ rounded down elements with index set $\mathbf { f } _ { b }$ have negative perturbation, and $K = a + b$ Then, we have
|
| 421 |
+
|
| 422 |
+
$$
|
| 423 |
+
\begin{array} { r l } & { \big \vert \underset { i } { \sum } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } \big \vert = \ \biggr \vert \underset { t } { \sum } \Delta \mathbf { W } _ { m , n , t } ^ { \ell } - \underset { j } { \sum } \big \vert \Delta \mathbf { W } _ { m , n , j } ^ { \ell } \big \vert \bigg \vert , \quad t \in \mathbf { f } _ { a } , \quad j \in \mathbf { f } _ { b } } \\ & { \qquad \leq \operatorname* { m a x } ( \underset { t } { \sum } \Delta \mathbf { W } _ { m , n , t } ^ { \ell } , \quad \underset { j } { \sum } \big \vert \Delta \mathbf { W } _ { m , n , j } ^ { \ell } \big \vert ) , \quad t \in \mathbf { f } _ { a } , \quad j \in \mathbf { f } _ { b } } \end{array}
|
| 424 |
+
$$
|
| 425 |
+
|
| 426 |
+
Without loss of generality, let $\begin{array} { r } { \sum _ { t } \Delta \mathbf { W } _ { m , n , t } ^ { \ell } > \sum _ { j } | \Delta \mathbf { W } _ { m , n , j } ^ { \ell } | } \end{array}$
|
| 427 |
+
|
| 428 |
+
$$
|
| 429 |
+
\operatorname* { m a x } ( \sum _ { t } \Delta \mathbf { W } _ { m , n , t } ^ { \ell } , \quad \sum _ { j } | \Delta \mathbf { W } _ { m , n , j } ^ { \ell } | ) = \sum _ { t } \Delta \mathbf { W } _ { m , n , t } ^ { \ell } \quad t \in \mathbf { f } _ { a } , \quad j \in \mathbf { f } _ { b }
|
| 430 |
+
$$
|
| 431 |
+
|
| 432 |
+
Therefore, we can always find $\begin{array} { r } { k = \lfloor \rfloor \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } \vert \rceil \leq \lfloor 0 . 5 \cdot a \rceil } \end{array}$ elements in $\mathbf { f } _ { a }$ with size of $a$ to flip down and make $\begin{array} { r } { | \sum _ { i } \Delta \widehat { \mathbf { W } } _ { m , n , i } ^ { \ell } | \leq 0 . 5 } \end{array}$ . For example, if $\begin{array} { r } { \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } = 3 . 2 } \end{array}$ , we need to flip 3 elements with positive perturbation (rounding up) to negative (rounding down) with $- 3 . 0$ mutation. Then, we have
|
| 433 |
+
|
| 434 |
+
$$
|
| 435 |
+
\Delta \widehat { \mathbf { W } } _ { m , n ; } ^ { \ell } = \underset { \Delta \mathbf { W } _ { m , n ; } ^ { \ell } } { \operatorname { a r g m i n } } ( \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } ) ^ { 2 } \Rightarrow \ | \sum _ { i } \Delta \widehat { \mathbf { W } } _ { m , n , i } ^ { \ell } | = \left| k - | \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } | \right| .
|
| 436 |
+
$$
|
| 437 |
+
|
| 438 |
+
For each kernel $\begin{array} { r } { | \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } | \geq 0 , \sum _ { i } \Delta \widehat { \mathbf { W } } _ { m , n , i } ^ { \ell } } \end{array}$ has the minimum value $\begin{array} { r } { | k - \vert \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } | | \leq 0 . 5 . } \end{array}$ . The sufficiency of Eq. (10) has been proven:
|
| 439 |
+
|
| 440 |
+
$$
|
| 441 |
+
\begin{array} { r } { \Delta \widehat { \mathbf { W } } _ { m , : } ^ { \ell } = \underset { \Delta \mathbf { W } _ { m , n ; } ^ { \ell } , } { \operatorname { a r g m i n } } ( \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } ) ^ { 2 } \Rightarrow \forall \Delta \widehat { \mathbf { W } } _ { m , n , : } ^ { \ell } , \ | \sum _ { i } \Delta \widehat { \mathbf { W } } _ { m , n , i } ^ { \ell } | \leq r _ { k } = 0 . 5 } \end{array}
|
| 442 |
+
$$
|
| 443 |
+
|
| 444 |
+
$a = K , b = 0$ and all perturbation $= 0 . 5$ , original $\begin{array} { r } { \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } } \end{array}$ have the upper bound $0 . 5 \cdot K$ .
|
| 445 |
+
|
| 446 |
+
Proof. If we flip $k - 1$ or $k + 1$ elements for $n$ -th kernel, the $\begin{array} { r } { \sum _ { i } \Delta \widehat { \mathbf { W } } _ { m , n , i } ^ { \ell } } \end{array}$ can reduce to $\left| k - 1 - \right|$ $\begin{array} { r } { \big \lvert \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } \big \rvert \big \rvert } \end{array}$ and $\begin{array} { r } { | k + 1 - \vert \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } | | } \end{array}$ , respectively. Obviously,
|
| 447 |
+
|
| 448 |
+
$$
|
| 449 |
+
\begin{array} { r l r } & { } & { \left| k - 1 - \vert \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } \right| \Big | = \left| \vert \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } \vert \right| - 1 - \vert \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } \vert \Big | > 0 . 5 , } \\ & { } & { \left| k + 1 - \vert \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } \right| \Big | = \left| \vert \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } \vert \right| + 1 - \vert \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } \vert \Big | > 0 . 5 . } \end{array}
|
| 450 |
+
$$
|
| 451 |
+
|
| 452 |
+
With other numbers $\neq k$ , we can also draw the same conclusions. Therefore, when $r _ { k } \le 0 . 5$ , there is only one value, i.e., the minimum value, with $k$ flipped elements satisfy the Eq. (10). The necessity of Eq. (10) has been proven:
|
| 453 |
+
|
| 454 |
+
$$
|
| 455 |
+
\underset { \Delta \mathbf { W } _ { m , n ; \cdot } ^ { \ell } } { \arg \operatorname* { m i n } } ( \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } ) ^ { 2 } \Leftrightarrow \forall \Delta \widehat { \mathbf { W } } _ { m , n , : } ^ { \ell } , \ | \sum _ { i } \Delta \widehat { \mathbf { W } } _ { m , n , i } ^ { \ell } | \leq r _ { k } = 0 . 5
|
| 456 |
+
$$
|
| 457 |
+
|
| 458 |
+
Similarly, we can extend all conclusions to SQuant-C.
|
| 459 |
+
|
| 460 |
+
For SQuant, we only consider the flipping operation in one quantization step and select the elements whose sign is the same as $\begin{array} { r } { \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } } \end{array}$ because flipping with more quantization steps (e.g., flip 0.7 to $- 1 . 0 )$ and the elements with different perturbation signs will cause a more significant perturbation and will violate the Eq. (8). We explain that in the next section.
|
| 461 |
+
|
| 462 |
+
# B.2 PROOF OF TOK- $k$ PERTURBATION ALGORITHM
|
| 463 |
+
|
| 464 |
+
Proof. We will prove the SQuant-E&K will lead to the top- $k$ algorithm. We have the composition SQuant-E and SQuant-K optimization objective for $n$ -th kernel,
|
| 465 |
+
|
| 466 |
+
$$
|
| 467 |
+
\begin{array} { r l } { \arg \operatorname* { m i n } } & { { } \displaystyle \sum _ { i } ( \Delta \mathbf { W } _ { m , n , i } ^ { \ell } ) ^ { 2 } + ( \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } ) ^ { 2 } , } \\ { \Delta \mathbf { W } _ { m , n , : } ^ { \ell } } & { { } \quad i } \end{array}
|
| 468 |
+
$$
|
| 469 |
+
|
| 470 |
+
which is the first two items of Eq. (8). Without loss of generality, we assume e = ∑i ∆W\`m,n,i > 0, then SQuant needs to flip $k = \lfloor e \rceil$ elements with perturbation $> 0$ to transform $\begin{array} { r } { \sum _ { i } \Delta \mathbf { W } _ { m , n , i } ^ { \ell } } \end{array}$ to $e - k$ and is still constant $e - k$ regardless of which $k$ elements are. Therefore, the $k$ elements are only determined by the first item of Eq. (34), $\begin{array} { r } { \sum _ { i } ( \Delta \mathbf { W } _ { m , n , i } ^ { \ell } ) ^ { 2 } } \end{array}$ . We denote f as the index set of the $k$ flipped elements and the original perturbation $\begin{array} { r } { \mathbf { 0 } = \Delta \mathbf { W } _ { m , n , } ^ { \ell } } \end{array}$ : for $n$ -th kernel. Therefore, $\mathbf { 0 } _ { j } > 0$ , $j \in \mathbf { f } .$ Substituting f and $\mathbf { o }$ in Eq. (34), we have the optimization objective for f after flipping $k$ elements,
|
| 471 |
+
|
| 472 |
+
$$
|
| 473 |
+
\begin{array} { r l } { \underset { \mathbf { f } } { \arg \operatorname* { m i n } } } & { \sum _ { t } ( | \mathbf { 0 } _ { t } | ) ^ { 2 } + \sum _ { j } ( 1 - | \mathbf { 0 } _ { j } | ) ^ { 2 } + ( e - k ) ^ { 2 } , \quad t \notin \mathbf { f } , \ \mathbf { 0 } _ { j } > 0 } \\ { \mathrm { ~ } } & { = \underset { \mathbf { f } } { \arg \operatorname* { m i n } } } & { \sum _ { i } ( | \mathbf { 0 } _ { i } | ) ^ { 2 } - \sum _ { j } ( | \mathbf { 0 } _ { j } | ) ^ { 2 } + \sum _ { j } ( 1 - | \mathbf { 0 } _ { j } | ) ^ { 2 } , \quad j \in \mathbf { f } , \ \mathbf { 0 } _ { j } > 0 } \\ { \underset { \mathbf { f } } { = \underset { \mathbf { f } } { \iint \operatorname* { m i n } } } } & { \sum _ { j } [ ( 1 - | \mathbf { 0 } _ { j } | ) ^ { 2 } - | \mathbf { 0 } _ { j } | ^ { 2 } ] , \quad j \in \mathbf { f } , \ \mathbf { 0 } _ { j } > 0 } \\ { \underset { \mathbf { f } } { = \underset { \mathbf { f } } { \iint \operatorname* { m i n } } } } & { \sum _ { j } ( 1 - 2 | \mathbf { 0 } _ { j } | ) , \quad j \in \mathbf { f } , \ \mathbf { 0 } _ { j } > 0 } \\ { \underset { \mathbf { f } } { = \underset { \mathbf { f } } { \sharp } \operatorname* { m a x } } } & { \sum _ { j } ( | \mathbf { 0 } _ { j } | ) , \quad j \in \mathbf { f } , \ \mathbf { 0 } _ { j } > 0 . } \end{array}
|
| 474 |
+
$$
|
| 475 |
+
|
| 476 |
+
Therefore, the Eq. (39) is essentially the top- $k$ perturbation algorithm. We can easily extend the top- $k$ algorithm in SQuant-C and design the perturbation update algorithm in B.3.
|
| 477 |
+
|
| 478 |
+
# B.3 PERTURBATION UPDATE ALGORITHM
|
| 479 |
+
|
| 480 |
+
SQuant-K initializes all rounded elements as flip candidates. After SQuant-K, we update the flip candidates for SQuant-C as shown in algorithm 4 based on the insight of top- $k$ perturbation algorithm ( B.2).
|
| 481 |
+
|
| 482 |
+
Over SQuant First we define the situation of $k > | e |$ as “Over SQuant” (line 6). For example, if we have a kernel with $e = + 1 . 6$ , we need to SQuant it to $- 0 . 4$ to satisfy in $\left( - 0 . 5 , 0 . 5 \right]$ with flipping $k = 2$ elements $\{ 2 . 6 , 2 . 7 \}$ to $\{ 2 , 2 \}$ . Obviously, when SQuant-C needs this kernel to calibrate, the last element 2.7 should be the first and the only candidate (line 7,8) to flip back to the original rounded number 3 to make the $e = + 0 . 6$ , due to it has the largest element perturbation in the $k$ fliped elements and the smallest element perturbation $\left( \left| - 0 . 3 \right| < 0 . { \bar { 5 } } \right)$ after it flips back. It is vice versa for $e < 0$ .
|
| 483 |
+
|
| 484 |
+
Under SQuant For “Under SQuant” (line 9), we need to make the first un-flipped element as the flip candidate (line 10, 11) for SQuant-C, and will lead the kernel to ”Over SQuant” with absolute kernel perturbation in (0.5, 1.0) when SQuant-C flips this element of the kernel.
|
| 485 |
+
|
| 486 |
+
Finally, each kernel has only one candidate flip element for SQuant-C to satisfy Eq. (8). In practice, it is easy to fuse the perturbation update algorithm with the flip algorithm without extra overhead.
|
| 487 |
+
|
| 488 |
+
# B.4 COMPLEXITY ANALYSIS
|
| 489 |
+
|
| 490 |
+
The original optimization problem described by Eq. (4) is NP-hard with $O ( M \cdot 2 ^ { N K } )$ . Based on the SQuant approximation, the new optimization objective is to minimize CASE whose complexity is
|
| 491 |
+
|
| 492 |
+
Algorithm 4: Perturbation Update Algorithm.
|
| 493 |
+
|
| 494 |
+
Input: Weight perturbation p;
|
| 495 |
+
|
| 496 |
+
Output: Updated weight perturbation p;
|
| 497 |
+
|
| 498 |
+
2 $\begin{array} { r } { e = \sum _ { i } \mathbf { p } _ { i } / / } \end{array}$ Accumulated perturbation (signed CASE).
|
| 499 |
+
3 $\mathbf { p } [ e \cdot \mathbf { p } < 0 ] = 0$ // Disable Elements/kernels with different sign from $e$ .
|
| 500 |
+
4 $\displaystyle { k = \lfloor | e | \rceil / \prime }$ Flip $k$ elements/kernels based on the CASE.
|
| 501 |
+
5 $\mathbf { f } = \mathrm { T o p K } ( | \mathbf { p } | , k )$ .indices// Indices of $k$ largest perturbation.
|
| 502 |
+
6 if $k > | e |$ then // Over SQuant.
|
| 503 |
+
7 $i = \mathbf { f } _ { k } \mathbf { \xi } / \mathbf { \xi }$ The $k$ -th (last) element of f.
|
| 504 |
+
8 $\nu = \mathbf { p } _ { i } ~ / / ~ 0 . 5 \leq | \nu | < 1 . 0$
|
| 505 |
+
9 else $/ /$ Under SQuant.
|
| 506 |
+
10 $i = \mathrm { T o p K } ( | \mathbf { p } | , k + 1 )$ .indices[k+1] // The $( k + 1 )$ -th largest element of p.
|
| 507 |
+
11 $\nu = { \bf p } _ { i } / / \vert \nu \vert \le 0 . 5$
|
| 508 |
+
12 $\mathbf { p } = 0 \mathbf { \Omega } / \mathbf { \Omega }$ Disable all elements.
|
| 509 |
+
13 ${ \bf p } _ { i } = \nu { \bf \nabla } / \nearrow$ The only flip element candidate of the kernel for SQuant-C.
|
| 510 |
+
14 return p
|
md/dev/JvIFpZOjLF4/JvIFpZOjLF4.md
ADDED
|
@@ -0,0 +1,391 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Geo-Neus: Geometry-Consistent Neural Implicit Surfaces Learning for Multi-view Reconstruction
|
| 2 |
+
|
| 3 |
+
Qiancheng $\mathbf { F u } ^ { 1 * }$ Qingshan $\mathbf { X } \mathbf { u } ^ { 2 * }$ Yew-Soon Ong2,3 Wenbing Tao1†
|
| 4 |
+
|
| 5 |
+
Huazhong University of Science and Technology 2Nanyang Technological University 3A\*STAR, Singapore 1{fqc98,wenbingtao}@hust.edu.cn 2{qingshan.xu,asysong}@ntu.edu.sg
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
Recently, neural implicit surfaces learning by volume rendering has become popular for multi-view reconstruction. However, one key challenge remains: existing approaches lack explicit multi-view geometry constraints, hence usually fail to generate geometry-consistent surface reconstruction. To address this challenge, we propose geometry-consistent neural implicit surfaces learning for multi-view reconstruction. We theoretically analyze that there exists a gap between the volume rendering integral and point-based signed distance function (SDF) modeling. To bridge this gap, we directly locate the zero-level set of SDF networks and explicitly perform multi-view geometry optimization by leveraging the sparse geometry from structure from motion (SFM) and photometric consistency in multi-view stereo. This makes our SDF optimization unbiased and allows the multi-view geometry constraints to focus on the true surface optimization. Extensive experiments show that our proposed method achieves high-quality surface reconstruction in both complex thin structures and large smooth regions, thus outperforming the state-ofthe-arts by a large margin. Code: https://github.com/GhiXu/Geo-Neus.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Reconstructing surfaces from calibrated multi-view images is a long-standing problem in computer vision and graphics. In the past years, traditional methods [30, 37, 15, 17] have adopted a multi-step pipeline to achieve impressive reconstruction results. Such a pipeline requires depth maps or point clouds to generate surface meshes. These intermediate representations inevitably introduce accumulated errors for the final reconstructed geometry. Recently, directly reconstructing surfaces from images [25, 43, 35, 42, 26] has attracted great interest for its potential to alleviate the accumulated errors and produce high-quality reconstructions. To achieve this, existing approaches represent surfaces as neural implicit representations and leverage volume rendering [21] to optimize them.
|
| 14 |
+
|
| 15 |
+
Inspired by neural volume rendering [23, 45] that simultaneously learns volume density and radiance field from input images, recent works [35, 42] use signed distance functions (SDF) [27] for surface representation and introduce the SDF-induced density function to enable the volume rendering to learn an implicit SDF representation. In essence, these works still focus on direct color field modeling by volume rendering integral rather than explicit multi-view geometry optimization. Therefore, existing approaches usually fail to generate geometry-consistent surface reconstruction. Intuitively, volume rendering samples multiple points along each ray and expresses the output pixel colors as the integral of the radiance field, or the weighted sum of sampled colors along the ray (cf. Fig. 1(a)). It means that the volume rendering integral directly optimizes the integral of geometry instead of the single surface intersection along the ray. This obviously introduces bias for geometry modeling, thus hindering true surface optimization. In Fig.1(b), we show the reconstruction case of NeuS [35], in which the bias between rendered colors and object geometry can be observed intuitively. Rendered colors are obtained by the color network via volume rendering. Surface colors are formed by the predicted colors of the surface where the SDF values are zeroes. It can be easily seen that there exists a gap between the rendered colors and the surface colors. Thus the reconstructed surface is imprecise despite the high-quality rendered image, indicating the bias between the color rendering and implicit geometry. (Detailed theoretical analysis will be elaborated later).
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: (a) Illustration of volume rendering. (b) A visual example. The volume rendering in NeuS uses integral colors to implicitly supervise surface modeling. Although its rendered colors achieve good results, the colors of estimated surface fail to preserve object geometry information. This shows the bias between rendered colors and geometry. In contrast, our approach achieves structurepreserving colors of estimated surface and produces geometry-consistent surface reconstruction.
|
| 19 |
+
|
| 20 |
+
To address the above problem, we propose Geo-Neus to devise an explicit and accurate neural geometry optimization model for geometry-consistent neural implicit surfaces learning by volume rendering, leading to better multi-view 3D reconstruction. Specifically, we directly locate the zerolevel set of SDF networks and explicitly perform multi-view geometry optimization by leveraging the sparse geometry from structure from motion (SFM) and photometric consistency in multi-view stereo. This model has several benefits. First, directly locating the zero-level set of SDF networks guarantees that our geometry modeling is unbiased. This enables our method to focus on true surface optimization. Second, we show that explicitly enforcing multi-view geometry constraints on the located zero-level set of SDF networks allows our method to generate geometry-consistent surface reconstruction. Previous neural implicit surfaces learning mainly uses the rendering loss to implicitly optimize SDF networks. This results in geometry ambiguity during the training optimization. Our introduced two types of explicit multi-view constraints encourage our SDF networks to reason about the correct geometry, including both complex thin structures and large smooth regions.
|
| 21 |
+
|
| 22 |
+
In summary, our contributions are: 1) We theoretically analyze that there exists a gap between volume rendering integral and point-based SDF modeling. This demonstrates that it is necessary to directly supervise the SDF networks to boost the neural implicit surfaces learning. 2) Based on our theoretical analysis, we propose to directly locate the zero-level set of SDF networks and leverage multi-view geometry constraints to explicitly supervise the training of SDF networks. In this way, the SDF networks are encouraged to focus on true surface optimization. Extensive experiments further validate the effectiveness of our theoretical analysis and the proposed direct optimization of SDF networks. We show that our proposed Geo-Neus is capable to reconstruct both complex thin structures and large smooth regions. Therefore, it greatly outperforms the state-of-the-art surface reconstruction methods, including traditional methods and neural implicit surface learning methods.
|
| 23 |
+
|
| 24 |
+
# 2 Related work
|
| 25 |
+
|
| 26 |
+
Traditional multi-view 3D reconstruction. Traditional multi-view 3D reconstruction is the classical pipeline of surface reconstruction from multi-view images. Given multi-view input images, traditional multi-view 3D reconstruction uses structure from motion (SFM) [33, 29] to extract and match features of neighbor views, and estimate camera parameters and sparse 3D points. After that, multi-view stereo (MVS) [30, 9, 37, 38, 36] is applied to estimate dense depth maps for each view and then all the depth maps are fused into dense point clouds. Finally, the surface reconstruction method [15, 17, 6], e.g., screened Poisson Surface Reconstruction [15] is used to reconstruct surfaces from point clouds. Traditional methods have achieved great success on various occasions, but there exists incompleteness of surface in some cases because their multiple intermediate steps are not made into an ensemble. With the development of deep learning, many attempts have been made on learning-based multi-view reconstruction [14, 40, 39, 27, 22], but the problem still exists.
|
| 27 |
+
|
| 28 |
+
Implicit representation of surface. Surface reconstruction methods can be generally divided into explicit methods and implicit methods, depending on the representation of surface. Explicit representation includes voxels [5, 31] and triangular mesh [3, 4, 16], which are limited by the resolution. Implicit representation uses an implicit function to represent the surface and thus is continuous. The surface can be extracted using the implicit function at any resolution. Traditional reconstruction methods, e.g., screened Poisson Surface Reconstruction [15], use basic functions to form the implicit function. As for learning-based methods, the most commonly used forms are the occupancy function [22, 28] and the signed distance function (SDF) [27] represented by the network. Based on these functions, many implicit surface reconstruction methods from point clouds have been proposed, e.g., ONet [22], DeepSDF [27], Point2Surf [8] and etc. For these methods, point clouds are obtained by scanner devices or multi-view stereo methods. That is, these point clouds are uniform and complete. Therefore, these methods are rarely applied on the sparse point clouds produced by SFM to reconstruct surfaces (In fact, we show that these methods degrade on sparse point clouds from SFM in our supplementary material). In this work, we use the sparse points from SFM as an explicit geometry supervision and show that they can facilitate the neural implicit surface reconstruction.
|
| 29 |
+
|
| 30 |
+
Neural implicit surface reconstruction. Neural implicit field is a new way to represent the geometry of objects. With NeRF [23] first using the neural radiance field represented by Multi-Layer Perceptron (MLP) in novel view synthesis, plenty of works [32, 18, 20] have sprung up using neural networks to represent scenes. IDR [43] reconstructs surfaces with neural networks by representing the geometry as the zero level set of an MLP that is considered to be an SDF. MVSDF [44] imports information from the MVS network to arrive at more geometry priors. VolSDF [42] and NeuS [35] use the weight function that involved SDF during the rendering process to make colors and geometry closer. UNISURF [26] explores the balance between surface rendering and volume rendering. The surface reconstructed by the neural network shows better completeness compared with the traditional multi-view reconstruction methods, especially when dealing with non-Lambertian cases. However, complex structures are not handled well. Meanwhile, flat planes and sharp corners could not be guaranteed. NeuralWarp [7], a concurrent work, also explores the use of patch-match on neural surface reconstruction. It combines volumetric rendering with a patch warping integration technique, which aggregates colors from points sampled along the camera ray from source views with patch warping. This way of patch aggregation is similar with volume rendering and shares the same sampled points and the same weights with those used by color integration. Note that NeuralWarp uses patch match with the color aggregation to optimize weights of sampled points, and thus to optimize the geometry indirectly. As we will analyze later, this kind of color integration operation will cause bias in the colors and the geometry. Therefore, NeuralWarp could not be trained from scratch and relies on the pre-trained model of VolSDF. Differently from NeuralWarp, our method locates the predicted surface of the SDF network using SDF-based interpolation and uses patch match to measure the photometric consistency among neighboring views. In this way, Geo-Neus can be trained from scratch and gets much better performance.
|
| 31 |
+
|
| 32 |
+
# 3 Method
|
| 33 |
+
|
| 34 |
+
Given posed multi-view images of an object, we aim at reconstructing the surface by neural volume rendering without mask supervision. The spatial field of the object is represented by a signed distance function (SDF), and the corresponding surface is extracted using the zero level set of the SDF. In the process of volume rendering, our goal is to optimize the signed distance function. In this section, we first analyze the inherent bias in color rendering which causes the inconsistency between rendered colors and implicit geometry. Then we introduce explicit SDF optimization to achieve geometry consistency. An overview of our approach is shown in Fig. 2.
|
| 35 |
+
|
| 36 |
+
# 3.1 Bias in color rendering
|
| 37 |
+
|
| 38 |
+
In the process of volume rending, there is a gap between the rendered colors and the geometry of the object. The rendered colors are not consistent with the real colors of the surface.
|
| 39 |
+
|
| 40 |
+

|
| 41 |
+
Figure 2: Overview of Geo-Neus. Previous neural implicit surfaces learning methods mainly depend on the color loss to implicitly supervise the SDF network. Our proposed Geo-Neus explicitly supervises the SDF network by introducing the SDF loss from sparse 3D points and photometric consistency loss from multi-view stereo.
|
| 42 |
+
|
| 43 |
+
For an opaque solid object $\varOmega \in \mathbb { R } ^ { 3 }$ , the opacity can be represented by an indicator function $\mathcal { O } ( \pmb { p } )$
|
| 44 |
+
|
| 45 |
+
$$
|
| 46 |
+
\begin{array} { r } { \mathscr { O } ( { p } ) = \left\{ \begin{array} { l l } { 1 , p \in \varOmega } \\ { 0 , p \notin \varOmega } \end{array} \right. . } \end{array}
|
| 47 |
+
$$
|
| 48 |
+
|
| 49 |
+
When we see some colors or we capture some colors with cameras, the colors are the light that transfers along the light ray into our eyes or cameras. Based on the inherent optical properties of the opaque solid object, we approximately assume that the colors $C$ of image set $\{ I _ { i } \}$ are the colors $c$ of object intersecting with the light ray $\nu$ from the corresponding camera position $\mathbf { \delta } _ { \pmb { o } }$ :
|
| 50 |
+
|
| 51 |
+
$$
|
| 52 |
+
C \left( \pmb { \sigma } , \pmb { \nu } \right) = c \left( \pmb { \sigma } + t ^ { * } \pmb { \nu } \right) ,
|
| 53 |
+
$$
|
| 54 |
+
|
| 55 |
+
where t∗ = argmin $\{ t | { \pmb { o } } + t { \pmb { v } } = { \pmb { p } }$ , $\pmb { p } \in \partial \Omega$ , $t \in ( 0 , \infty ) \}$ . $\partial \Omega$ represents geometry surfaces. The assumption is appropriate because light that transmits through the opaque object can be omitted. The intensity of light decays to about zero drastically when passing through the surface of the opaque object. Let us represent the surface of the object mathematically with the signed distance function. The signed distance function $s d f ( \pmb { p } )$ is the signed distance between a spatial point $\pmb { p }$ and the surface $\partial \varOmega$ . In this way, the surface $\partial \varOmega$ can be represented as:
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
\partial \varOmega = \left\{ p | s d f \left( p \right) = 0 \right\} .
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
With neural volume rendering, we estimate the signed distance function $s { \hat { d } } f$ and color field $\hat { c }$ by Multi-Layer Perceptron (MLP) networks $F _ { \Theta }$ and $G _ { \Phi }$ :
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
s \hat { d } f \left( \pmb { p } \right) = F _ { \Theta } \left( \pmb { p } \right) ,
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\hat { c } \left( \pmb { \sigma } , \pmb { \nu } , t \right) = G _ { \Phi } \left( \pmb { \sigma } , \pmb { \nu } , t \right) .
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
Thus the estimated colors of the image with camera position $\pmb { o }$ can be represented as:
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
\hat { C } = \int _ { 0 } ^ { + \infty } w \left( t \right) \hat { c } \left( t \right) d t ,
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
where $t$ is the depth along the ray that comes from $\mathbf { \delta } _ { \pmb { o } }$ with the direction $\nu$ and $w ( t )$ is a weight for the point at $t$ . For simplicity, the notes $\mathbf { \delta } _ { \pmb { o } }$ and $\nu$ are omitted. To obtain discrete counterparts of $w$ and $\hat { c }$ we also sample $t _ { i }$ discretely along the ray and use the Riemann sum:
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
\hat { C } = \sum _ { i = 1 } ^ { n } w \left( t _ { i } \right) \hat { c } \left( t _ { i } \right) .
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
Following NeuS [35], $w ( t _ { i } )$ is computed as $w ( t _ { i } ) = T ( t _ { i } ) \alpha ( t _ { i } )$ , where $\begin{array} { r } { T ( t _ { i } ) = \prod _ { j = 1 } ^ { i - 1 } ( 1 - \alpha ( t _ { j } ) ) } \end{array}$ represents accumulated transmittance, $\begin{array} { r } { \alpha ( t _ { i } ) = \operatorname* { m a x } ( \frac { \Phi _ { s } ( s d f ( p _ { i } ) ) - \Phi _ { s } ( s d f ( p _ { i + 1 } ) ) } { \Phi _ { s } ( s d f ( p _ { i } ) ) } , 0 ) } \end{array}$ j=1is opacity, and $\pmb { p } _ { i }$ represents the sampled spatial point at $t _ { i }$ . $\Phi _ { s } ( x ) = ( 1 + e ^ { - s x } ) ^ { - 1 }$ is a Sigmoid function, where $s$ is a learnable parameter which controls the smoothness of the transition at the surface.
|
| 84 |
+
|
| 85 |
+
Notably, the goal of novel view synthesis is to make an accurate prediction of the colors $\hat { C }$ , and bend efforts to minimize the difference between the colors of ground truth images $C$ and the prediction $\hat { C }$ :
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
C = \hat { C } = \sum _ { i = 1 } ^ { n } w \left( t _ { i } \right) \hat { c } \left( t _ { i } \right) .
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
In surface reconstruction tasks, what we concentrate more is the surface of the object rather than the color. In this way, the above formula can be rewritten as:
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
\begin{array} { l } { { \displaystyle C = \sum _ { i = 1 } ^ { j - 1 } w \left( t _ { i } \right) \hat { c } \left( t _ { i } \right) + w \left( t _ { j } \right) \hat { c } \left( \hat { t ^ { * } } \right) + w \left( t _ { j } \right) \left( \hat { c } \left( t _ { j } \right) - \hat { c } \left( \hat { t ^ { * } } \right) \right) + \sum _ { i = j + 1 } ^ { n } w \left( t _ { i } \right) \hat { c } \left( t _ { i } \right) } } \\ { { \displaystyle ~ = w \left( t _ { j } \right) \hat { c } \left( \hat { t ^ { * } } \right) + \varepsilon _ { s a m p l e } + \sum _ { i = 1 } ^ { n } w \left( t _ { i } \right) \hat { c } \left( t _ { i } \right) } } \\ { { \displaystyle ~ = w \left( t _ { j } \right) \hat { c } \left( \hat { t ^ { * } } \right) + \varepsilon _ { s a m p l e } + \varepsilon _ { w e i g h t } } , } \end{array}
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
where $s \hat { d } f ( \hat { t ^ { * } } ) = 0$ , $t _ { j }$ denotes the nearest sample point from $\hat { t ^ { * } }$ , $\varepsilon _ { s a m p l e }$ denotes the bias caused by sampling operation and $\varepsilon _ { w e i g h t }$ denotes the bias caused by weighted sum operation of volume rendering. With Formula (2), it can be rewritten as:
|
| 98 |
+
|
| 99 |
+
$$
|
| 100 |
+
w \left( t _ { j } \right) \hat { c } \left( \hat { t ^ { * } } \right) + \varepsilon _ { s a m p l e } + \varepsilon _ { w e i g h t } = c \left( t ^ { * } \right) ,
|
| 101 |
+
$$
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
\hat { c } \left( t ^ { * } \right) = \frac { c \left( t ^ { * } \right) - \varepsilon _ { s a m p l e } - \varepsilon _ { w e i g h t } } { w \left( t _ { j } \right) } .
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
There the total bias between the colors of object surface and estimated surface is:
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\Delta c = \hat { c } \left( \hat { t ^ { * } } \right) - c \left( t ^ { * } \right) = \frac { ( 1 - w \left( t _ { j } \right) ) c \left( t ^ { * } \right) - \varepsilon _ { s a m p l e } - \varepsilon _ { w e i g h t } } { w \left( t _ { j } \right) } .
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
The relative bias is:
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
\delta c = \frac { \Delta c } { c \left( t ^ { * } \right) } = \frac { 1 } { w \left( t _ { j } \right) } - 1 - \frac { \varepsilon _ { s a m p l e } + \varepsilon _ { w e i g h t } } { w \left( t _ { j } \right) c \left( t ^ { * } \right) } .
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
When $w \left( t _ { j } \right)$ approaches to 1 $, \varepsilon _ { w e i g h t }$ approaches to 0 and $\delta c$ approaches to $\varepsilon _ { s a m p l e } \Big / c \big ( t ^ { * } \big )$ . In this case, the total bias is only caused by discrete sampling, which is small (but still exists). Simulated weights of some existing neural reconstruction methods are shown in Fig. 3. As can be seen, it is nearly impossible to get right there in practice, especially without any geometric constraints. Furthermore, the problem becomes more intractable when dealing with cases of occlusion. Therefore, the weighted manner of volume rendering integral introduces a bias to implicit geometry modeling. Because the supervision of the whole network almost depends exclusively on the difference between rendered colors and ground truth colors, the bias would make it difficult to supervise the colors of surface and the SDF network, leading to a gap between the colors and the geometry.
|
| 120 |
+
|
| 121 |
+

|
| 122 |
+
Figure 3: Simulated weight in color rendering process of neural reconstruction methods.
|
| 123 |
+
|
| 124 |
+
A trivial solution is to directly supervise the geometry of the object. In this way, we design explicit supervision on the SDF network and geometry-consistent supervision with multi-view constraints.
|
| 125 |
+
|
| 126 |
+
# 3.2 Explicit supervision on SDF network
|
| 127 |
+
|
| 128 |
+
The SDF network, which estimates the signed distance from any spatial point to the surface of the object, is the key network that we need to optimize. So we propose an explicit supervision method on the SDF network to ensure its accuracy directly with points in 3D space.
|
| 129 |
+
|
| 130 |
+
For less extra cost, we use points generated by structure from motion (SFM) [29, 33] to supervise the SDF network. In fact, SFM is a canonical solution to compute the camera parameters of input images, where 2D feature matches $X$ and sparse 3D points $P$ are also generated as byproducts. Thus, these sparse 3D points can be used as "free" explicit geometry information. Approximately, we suppose that these sparse points are on the surface of the object. That is, the SDF values of the sparse points are zeroes: sdf $( \bar { { \pmb p } _ { i } } ) = 0$ , where $\pmb { p } _ { i } \in \pmb { P }$ . In practice, after obtaining sparse 3D points, a radius filter is applied to exclude some outliers [46].
|
| 131 |
+
|
| 132 |
+
Occlusion handling. Because we focus on opaque objects, some parts of objects are invisible from view of a certain camera position. Therefore, there are only some of the sparse points visible for each view. For an image $I _ { i }$ with camera position $\mathbf { \delta } _ { \pmb { o } _ { i } }$ , the visible points $\mathbf { \nabla } P _ { i }$ are consistent with feature points $X _ { i }$ of $I _ { i }$ :
|
| 133 |
+
|
| 134 |
+
$$
|
| 135 |
+
X _ { i } = K _ { i } \left[ { \pmb R } _ { i } | { \pmb t } _ { i } \right] P _ { i } ,
|
| 136 |
+
$$
|
| 137 |
+
|
| 138 |
+
where $\pmb { K } _ { i }$ is the internal calibration matrix, $\pmb { R } _ { i }$ is the rotation matrix and $t _ { i }$ is the translation vector for image $I _ { i }$ . The coordinates of $X _ { i }$ and $\mathbf { \nabla } P _ { i }$ are all homogeneous coordinates. The scale index before $X _ { i }$ is omitted for simplicity. According to feature points of each image, we get visible points for each view and use them to supervise the SDF network while rendering image from the corresponding view.
|
| 139 |
+
|
| 140 |
+
View-aware SDF loss. While rendering image $I _ { i }$ from view $V _ { i }$ , we use the SDF network to estimate SDF values for the visible points $\mathbf { \nabla } P _ { i }$ of $V _ { i }$ (see supplementary for the SDF loss by random sampling from sparse 3D points). Based on the approximation that the SDF values of sparse points are zeroes, we propose the view-aware SDF loss:
|
| 141 |
+
|
| 142 |
+
$$
|
| 143 |
+
\mathcal { L } _ { S D F } = \sum _ { \pmb { p _ { j } \in P _ { i } } } \frac { 1 } { N _ { i } } | s \hat { d } f \left( \pmb { p _ { j } } \right) - s d f \left( \pmb { p _ { j } } \right) | = \sum _ { \pmb { p _ { j } \in P _ { i } } } \frac { 1 } { N _ { i } } | s \hat { d } f \left( \pmb { p _ { j } } \right) | ,
|
| 144 |
+
$$
|
| 145 |
+
|
| 146 |
+
where $N _ { i }$ is the number of points in $\mathbf { \nabla } P _ { i }$ and $| \cdot |$ denotes the $L _ { 1 }$ distance. It is worth noting that the loss we use to supervise the SDF network varies according to the view being rendered. In this way, the introduced SDF loss is consistent with the process of color rendering.
|
| 147 |
+
|
| 148 |
+
With the explicit supervision on the SDF network, our network could converge faster owing to the use of geometry prior. Besides, because the complex geometric structures with strong textures are the concentrated distribution areas of the sparse points, our method could capture more meticulous geometries.
|
| 149 |
+
|
| 150 |
+
# 3.3 Geometry-consistent supervision with multi-view constraints
|
| 151 |
+
|
| 152 |
+
With SDF loss, our network could capture complex geometric details with strong textures. Since the sparse 3D points mainly provide the explicit constraints on the areas with rich textures, large smooth regions still lack explicit geometry constraints. To go a step further, we design geometry-consistent supervision on the implicit surface with multi-view stereo constraints.
|
| 153 |
+
|
| 154 |
+
Occlusion-aware implicit surface capture. We use the implicit representation of the surface, and extract surface with the zero-level set of the implicit function. So the question is: Where is our implicit surface? According to Formula (3), the estimated surface is:
|
| 155 |
+
|
| 156 |
+
$$
|
| 157 |
+
\hat { \partial \Omega } = \left\{ \pmb { p } | s \hat { d } f ( \pmb { p } ) = 0 \right\} .
|
| 158 |
+
$$
|
| 159 |
+
|
| 160 |
+
We aim to optimize $ { \partial } { \hat { \boldsymbol { \Omega } } }$ with geometry-consistent constraints among different views. Because the number of points on the surface is infinite, we need to sample points from $ { \partial } { \hat { \varOmega } }$ in practice. To maintain consistency with the process of color rendering using view rays, we sample the surface points on these rays. As mentioned in 3.1, we sample $t$ discretely along the view ray and use the Riemann sum to obtain the rendered colors. Based on the sampled points, we use linear interpolation to get the surface points, which is similar to the root-finding used in [25, 26] to estimate the surface.
|
| 161 |
+
|
| 162 |
+
Specifically, with sampled point $t$ on the ray, the corresponding 3D point is $\pmb { p } = \pmb { o } + t \pmb { \nu }$ , and the predicted SDF value is $s { \hat { d } } f ( \pmb { p } )$ . For simplicity, we further represent $s d f ( \pmb { p } )$ as $s { \hat { d } } f ( t )$ , which is the function of $t$ . We find the sample point $t _ { i }$ , the sign of whose SDF value is different from the next sample point $t _ { i + 1 }$ . The sample points set $T$ formed by $t _ { i }$ is:
|
| 163 |
+
|
| 164 |
+
$$
|
| 165 |
+
T = \left\{ t _ { i } | s \hat { d } f ( t _ { i } ) \cdot s \hat { d } f ( t _ { i + 1 } ) < 0 \right\} .
|
| 166 |
+
$$
|
| 167 |
+
|
| 168 |
+
In this situation, the line $t _ { i } t _ { i + 1 }$ intersects with the surface $ { \partial } { \hat { \varOmega } }$ . The intersection points set $\hat { T } ^ { * }$ is:
|
| 169 |
+
|
| 170 |
+
$$
|
| 171 |
+
\hat { T ^ { * } } = \left\{ t | t = \frac { s \hat { d } f ( t _ { i } ) t _ { i + 1 } - s \hat { d } f ( t _ { i + 1 } ) t _ { i } } { s \hat { d } f ( t _ { i } ) - s \hat { d } f ( t _ { i + 1 } ) } , t _ { i } \in T \right\} .
|
| 172 |
+
$$
|
| 173 |
+
|
| 174 |
+
The ray that interacts with the object may have more than one intersection with the surface. Specifically speaking, there may be at least two intersections. Similar to the SDF supervision mechanism, we just use the first intersection point along the ray considering the occlusion problem:
|
| 175 |
+
|
| 176 |
+
$$
|
| 177 |
+
t ^ { * } = \mathrm { a r g m i n } \left. t | t \in \hat { T ^ { * } } \right. .
|
| 178 |
+
$$
|
| 179 |
+
|
| 180 |
+
The selection of $t ^ { * }$ guarantees the sample points of the implicit surface are all visible for the corresponding view and makes the supervision consistent with the process of color rendering.
|
| 181 |
+
|
| 182 |
+
Multi-view photometric consistency constraints. We capture our estimated implicit surface, of which the geometric structures are supposed to be consistent among different views. Based on this intuition, we use the photometric consistency constraints in multi-view stereo (MVS) [9, 37, 10] to supervise our extracted implicit surface.
|
| 183 |
+
|
| 184 |
+
For a small area $s$ on the surface, the projection of $s$ on the image is a small pixel patch $q$ . The patches corresponding to $s$ are supposed to be geometry-consistent among different views, except for occlusion occasions. Similar to patch warping in traditional MVS methods, we use the central point and its normal to represent $s$ . For convenience, we represent the plane equation of $s$ in the camera coordinate of the reference image $I _ { r }$ :
|
| 185 |
+
|
| 186 |
+
$$
|
| 187 |
+
\pmb { n } ^ { T } \pmb { p } + d = 0 ,
|
| 188 |
+
$$
|
| 189 |
+
|
| 190 |
+
where $\pmb { p }$ is the intersection point computed through Formula (19) and ${ \pmb n } ^ { T }$ is the normal computed with automatic differentiation of SDF network at $\pmb { p }$ . Then the image point $\boldsymbol { x }$ in the pixel patch $q _ { i }$ of reference image $I _ { r }$ is related to the corresponding point $ { \boldsymbol { { x } } } ^ { \prime }$ in the pixel patch $q _ { i s }$ of the source image $I _ { s }$ via the plane-induced homography $\pmb { H }$ [12]:
|
| 191 |
+
|
| 192 |
+
$$
|
| 193 |
+
\pmb { x } = \pmb { H } \pmb { x } ^ { \prime } , \pmb { H } = \pmb { K } _ { s } ( \pmb { R } _ { s } \pmb { R } _ { r } ^ { T } - \frac { \pmb { R } _ { s } ( \pmb { R } _ { s } ^ { T } \pmb { t } _ { s } - \pmb { R } _ { r } ^ { T } \pmb { t } _ { r } ) \pmb { n } ^ { T } } { \pmb { d } } ) \pmb { K } _ { r } ^ { - 1 } ,
|
| 194 |
+
$$
|
| 195 |
+
|
| 196 |
+
where $\pmb { K }$ donates the intrinsic matrix, $\pmb { R }$ donates the rotation matrix and $t$ donates the translation vector. The index indicates which image the donation belongs to. To concentrate on the geometric information, we convert color images $\{ I _ { i } \}$ into gray images $\left\{ { { I } _ { i } ^ { \prime } } \right\}$ , and supervise our implicit surface with the photometric consistency among patches in $\{ I _ { i } ^ { \prime } \}$ (see supplementary for RGB image settings).
|
| 197 |
+
|
| 198 |
+
Photometric consistency loss. To measure the photometric consistency, we use the normalization cross correlation (NCC) of patches in the reference gray image $\left\{ I _ { r } ^ { \prime } \right\}$ and the source gray image $\{ I _ { s } ^ { \prime } \}$ :
|
| 199 |
+
|
| 200 |
+
$$
|
| 201 |
+
N C C ( I _ { r } ^ { \prime } ( q _ { i } ) , I _ { s } ^ { \prime } ( q _ { i s } ) ) = \frac { C o v ( I _ { r } ^ { \prime } ( q _ { i } ) , I _ { s } ^ { \prime } ( q _ { i s } ) ) } { \sqrt { V a r ( I _ { r } ^ { \prime } ( q _ { i } ) ) V a r ( I _ { s } ^ { \prime } ( q _ { i s } ) ) } } ,
|
| 202 |
+
$$
|
| 203 |
+
|
| 204 |
+
where $C o v$ denotes covariance and $V a r$ donates variance. While rendering colors for an image, we use the patches which take the pixels being rendered as center and the patch size is $1 1 \times 1 1$ . We take the rendered image as the reference image and compute NCC scores between its sampled patches and their corresponding patches on all source images. To handle occlusions, we find the best four of the computed NCC scores for each sampled patch following [10], and use them to compute the photometric consistency loss for the corresponding view:
|
| 205 |
+
|
| 206 |
+
$$
|
| 207 |
+
\mathcal { L } _ { p h o t o } = \frac { \sum _ { i = 1 } ^ { N } \sum _ { s = 1 } ^ { 4 } 1 - N C C ( I _ { r } ^ { \prime } ( q _ { i } ) , I _ { s } ^ { \prime } ( q _ { i s } ) ) } { 4 N } ,
|
| 208 |
+
$$
|
| 209 |
+
|
| 210 |
+
where $N$ is the number of sampled pixels on the rendered image. With the photometric consistency loss, the geometric consistency of the implicit surface among multiple views is guaranteed.
|
| 211 |
+
|
| 212 |
+
# 3.4 Loss function
|
| 213 |
+
|
| 214 |
+
During rendering colors from a specific view, our total loss is:
|
| 215 |
+
|
| 216 |
+
$$
|
| 217 |
+
\mathcal { L } = \mathcal { L } _ { c o l o r } + \alpha \mathcal { L } _ { r e g } + \beta \mathcal { L } _ { S D F } + \gamma \mathcal { L } _ { p h o t o } .
|
| 218 |
+
$$
|
| 219 |
+
|
| 220 |
+
$\mathcal { L } _ { c o l o r }$ is the difference between the ground truth colors and the rendered colors:
|
| 221 |
+
|
| 222 |
+
$$
|
| 223 |
+
\mathcal { L } _ { c o l o r } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } | C _ { i } - \hat { C } _ { i } | .
|
| 224 |
+
$$
|
| 225 |
+
|
| 226 |
+
And $\mathcal { L } _ { \boldsymbol { r } \boldsymbol { e } \boldsymbol { g } }$ is an eikonal term [11] to regularize the gradients of SDF network:
|
| 227 |
+
|
| 228 |
+
$$
|
| 229 |
+
\mathcal { L } _ { r e g } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } { \left( | \nabla \hat { s d f } ( \pmb { p } _ { i } ) | - 1 \right) ^ { 2 } } .
|
| 230 |
+
$$
|
| 231 |
+
|
| 232 |
+
In our experiments, we choose $\alpha$ , $\beta$ and $\gamma$ as 0.1, 1.0 and 0.5 respectively.
|
| 233 |
+
|
| 234 |
+
# 4 Experiments
|
| 235 |
+
|
| 236 |
+
# 4.1 Experimental setting
|
| 237 |
+
|
| 238 |
+
Datasets. Following previous practices [43, 35, 42], we reconstruct surfaces from 15 scans of DTU dataset [1] to evaluate our method. DTU dataset has objects of various categories, which are quite different in terms of appearance and geometries. There are 49 or 64 images at a resolution of $1 2 0 0 \times$ 1600 in each scan with camera parameters. We also test on 7 challenging scenes from the low-res set of the BlendedMVS dataset [41] (CC-4 License). Scenes in BlendedMVS have various numbers of views and camera parameters. The scenes are captured by images at a resolution of $7 6 8 \times 5 7 6$ , and the numbers of views vary from 31 to 143. We evaluate our reconstructed surfaces on DTU dataset with the Chamfer Distance provided by DTU evaluation metrics [1]. For the BlendedMVS dataset, we show the visual effects of the reconstructed surfaces.
|
| 239 |
+
|
| 240 |
+
Baselines. To better evaluate our method, we compare it with the-state-of-art learning-based methods and the traditional reconstruction method, colmap [30]. For learning-based methods, we compare with IDR [43], VolSDF [42], NeuS [35] and NeuralWarp [7]. For colmap, we use the reconstructed surface with trim parameter 7 (the best performance) [26].
|
| 241 |
+
|
| 242 |
+
Implementation details. Similar to [43, 35, 42], the SDF network is modeled by an 8-layer MLP with 256 hidden units and a skip connection in the middle. It is initialized by the geometric initialization presented in [2]. The radiance network is parameterized by a 4-layer MLP with 256 hidden units. Positional encoding [20] is applied to 3D location with 6 frequencies and to viewing direction with 4 frequencies. We sample 512 rays per batch and follow the hierarchical sampling strategy in NeuS [35] to sample points for each ray. We train our model for $3 0 0 \mathrm { k }$ iterations for around 16 hours on a single NVIDIA RTX2080Ti GPU. After network training, a mesh can be extracted from the SDF in a predefined bounding box by the Marching Cube [19] with the volume size of $5 1 2 ^ { 3 }$
|
| 243 |
+
|
| 244 |
+
# 4.2 Comparisons
|
| 245 |
+
|
| 246 |
+
We compare the reconstruction quality of our method and baselines on DTU dataset. Table 1 shows the quantitative results. Notably, our method outperforms baselines by a large margin. Specifically, it outperforms state-of-the-art neural implicit surfaces learning methods by over $2 5 \%$ and outperforms the traditional method colmap by $2 2 \%$ . As shown qualitatively in Fig. 4, our method achieves high-quality surface reconstruction in both complex thin structures and large smooth regions. For example, our method can recover abrupt depth changes in Scan 37 and reconstruct planar structures in Scan 24 and 40. To test the capability of handling
|
| 247 |
+
|
| 248 |
+
Table 1: Results on DTU scenes. The surfaces produced by colmap are trimmed with trimming value 7.
|
| 249 |
+
|
| 250 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>with mask</td><td rowspan=1 colspan=5>without mask</td></tr><tr><td rowspan=1 colspan=1>Scan</td><td rowspan=1 colspan=1>IDR</td><td rowspan=1 colspan=1>NeuS</td><td rowspan=1 colspan=1>VolSDF</td><td rowspan=1 colspan=1>NeuS</td><td rowspan=1 colspan=1>NeuralWarp</td><td rowspan=1 colspan=1>colmap</td><td rowspan=1 colspan=1>Ours</td></tr><tr><td rowspan=1 colspan=1>37</td><td rowspan=1 colspan=1>1.87</td><td rowspan=1 colspan=1>0.95</td><td rowspan=1 colspan=1>1.26</td><td rowspan=1 colspan=1>1.21</td><td rowspan=1 colspan=1>0.71</td><td rowspan=1 colspan=1>0.91</td><td></td></tr><tr><td></td><td rowspan=3 colspan=1>0.63</td><td></td><td rowspan=3 colspan=1>0.81</td><td rowspan=3 colspan=1>0.73</td><td rowspan=3 colspan=1>0.38</td><td rowspan=3 colspan=1>0.37</td><td></td></tr><tr><td></td><td></td><td rowspan=2 colspan=1>0.5370.336</td></tr><tr><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>0.80</td></tr><tr><td rowspan=1 colspan=1>55</td><td rowspan=1 colspan=1>0.48</td><td rowspan=1 colspan=1>0.39</td><td rowspan=1 colspan=1>0.49</td><td rowspan=1 colspan=1>0.40</td><td rowspan=1 colspan=1>0.38</td><td rowspan=1 colspan=1>0.37</td><td rowspan=1 colspan=1>0.357</td></tr><tr><td rowspan=1 colspan=1>63</td><td rowspan=1 colspan=1>1.04</td><td rowspan=1 colspan=1>1.26</td><td rowspan=1 colspan=1>1.25</td><td rowspan=1 colspan=1>1.20</td><td rowspan=1 colspan=1>0.79</td><td rowspan=1 colspan=1>0.90</td><td rowspan=1 colspan=1>0.800</td></tr><tr><td rowspan=1 colspan=1>65</td><td rowspan=1 colspan=1>0.79</td><td rowspan=1 colspan=1>0.72</td><td rowspan=1 colspan=1>0.70</td><td rowspan=1 colspan=1>0.70</td><td rowspan=1 colspan=1>0.81</td><td rowspan=1 colspan=1>1.00</td><td rowspan=1 colspan=1>0.454</td></tr><tr><td rowspan=1 colspan=1>69</td><td rowspan=1 colspan=1>0.77</td><td rowspan=1 colspan=1>0.69</td><td rowspan=1 colspan=1>0.72</td><td rowspan=1 colspan=1>0.72</td><td rowspan=1 colspan=1>0.82</td><td rowspan=1 colspan=1>0.54</td><td rowspan=1 colspan=1>0.408</td></tr><tr><td rowspan=1 colspan=1>83</td><td rowspan=1 colspan=1>1.33</td><td rowspan=1 colspan=1>0.94</td><td rowspan=1 colspan=1>1.29</td><td rowspan=1 colspan=1>1.01</td><td rowspan=1 colspan=1>1.20</td><td rowspan=1 colspan=1>1.22</td><td rowspan=1 colspan=1>1.032</td></tr><tr><td rowspan=1 colspan=1>97</td><td rowspan=1 colspan=1>1.16</td><td rowspan=1 colspan=1>1.14</td><td rowspan=1 colspan=1>1.18</td><td rowspan=1 colspan=1>1.16</td><td rowspan=1 colspan=1>1.06</td><td rowspan=1 colspan=1>1.08</td><td rowspan=1 colspan=1>0.843</td></tr><tr><td rowspan=1 colspan=1>105</td><td rowspan=1 colspan=1>0.76</td><td rowspan=1 colspan=1>0.77</td><td rowspan=1 colspan=1>0.70</td><td rowspan=1 colspan=1>0.82</td><td rowspan=1 colspan=1>0.68</td><td rowspan=1 colspan=1>0.64</td><td rowspan=1 colspan=1>0.548</td></tr><tr><td rowspan=1 colspan=1>106</td><td rowspan=1 colspan=1>0.67</td><td rowspan=1 colspan=1>0.66</td><td rowspan=1 colspan=1>0.66</td><td rowspan=1 colspan=1>0.66</td><td rowspan=1 colspan=1>0.66</td><td rowspan=1 colspan=1>0.48</td><td rowspan=1 colspan=1>0.460</td></tr><tr><td rowspan=1 colspan=1>110</td><td rowspan=1 colspan=1>0.90</td><td rowspan=1 colspan=1>1.35</td><td rowspan=1 colspan=1>1.08</td><td rowspan=1 colspan=1>1.69</td><td rowspan=1 colspan=1>0.74</td><td rowspan=1 colspan=1>0.59</td><td rowspan=2 colspan=1>0.4730.294</td></tr><tr><td rowspan=1 colspan=1>114</td><td rowspan=1 colspan=1>0.42</td><td rowspan=1 colspan=1>0.39</td><td rowspan=1 colspan=1>0.42</td><td rowspan=1 colspan=1>0.39</td><td rowspan=1 colspan=1>0.41</td><td rowspan=1 colspan=1>0.32</td></tr><tr><td rowspan=2 colspan=1>118122</td><td rowspan=1 colspan=1>0.51</td><td rowspan=1 colspan=1>0.51</td><td rowspan=1 colspan=1>0.61</td><td rowspan=1 colspan=1>0.49</td><td rowspan=1 colspan=1>0.63</td><td rowspan=1 colspan=1>0.45</td><td rowspan=1 colspan=1>0.355</td></tr><tr><td rowspan=1 colspan=1>0.53</td><td rowspan=1 colspan=1>0.52</td><td rowspan=1 colspan=1>0.55</td><td rowspan=1 colspan=1>0.51</td><td rowspan=1 colspan=1>0.51</td><td rowspan=1 colspan=1>0.43</td><td rowspan=1 colspan=1>0.345</td></tr><tr><td rowspan=1 colspan=1>mean</td><td rowspan=1 colspan=1>0.90</td><td rowspan=1 colspan=1>0.82</td><td rowspan=1 colspan=1>0.86</td><td rowspan=1 colspan=1>0.87</td><td rowspan=1 colspan=1>0.68</td><td rowspan=1 colspan=1>0.65</td><td rowspan=1 colspan=1>0.508</td></tr></table>
|
| 251 |
+
|
| 252 |
+

|
| 253 |
+
Figure 4: Surfaces reconstructed on DTU and BlendedMVS. We use NeuS trained with mask supervision and colmap with trimming value 7 (see supplementary for comparison with NeuralWarp).
|
| 254 |
+
|
| 255 |
+

|
| 256 |
+
Figure 5: Surface quality of ablation models.
|
| 257 |
+
|
| 258 |
+
various scenes, we test on 7 challenging
|
| 259 |
+
scenes of the BlendedMVS dataset. Qualitative results in Fig. 4 show that our method yields more smooth and consistent surface quality than other methods.
|
| 260 |
+
|
| 261 |
+
# 4.3 Analysis
|
| 262 |
+
|
| 263 |
+
Ablation study. To evaluate the effect of our proposed contributions, we conduct an ablation study on DTU dataset. NeuS is adopted as our baseline. Different modules are progressively added to the baseline to investigate their efficacy. Results are reported in Table 2. We see that, with very sparse 3D supervision on SDF networks, Model-A has begun to outperform colmap (0.62 vs 0.65). This demonstrates that explicit SDF optimization is very beneficial to improve geometries. With the proposed photometric consistency loss, Model-B can optimize SDF networks more completely, leading to much more performance improvement. Fig. 5 shows how the proposed loss functions improve the surface quality. Model-A reconstructs the apple stem finely but the surface is not smooth enough. Model-B reconstructs the smooth surface but the apple stem is lost. That is, the SDF loss is better to improve the reconstruction of complex thin structures, while the photometric loss is better for the reconstruction of large smooth regions. Moreover, our full model, Geo-Neus absorbs their individual advantages and achieves the best performance.
|
| 264 |
+
|
| 265 |
+
Geometry bias of volumetric integration. To further investigate the geometric bias of volumetric integration, we render the depth images from a particular pose in a similar fashion to rendering RGB pixels [20] (see supplementary for details), and then use the depth images to construct sparse 3D points and photometric consistency constraints. NeuS is also used as the baseline. Comparison results are shown in Table 3. As can be seen, compared with baseline (0.87), multi-view geometry constraints with depth integral bring little performance improvement or even degradation. It is a remarkable fact that photometric consistency supervision with depth integral surface location could not converge because of the initial immense bias while the SDF location model converges smoothly. As an alternative, we train these two models based on the baseline model pretrained with $2 0 0 \mathrm { k }$ iterations. The result of the depth integral model still degrades compared with the baseline. This verifies the existence of geometric bias in volumetric integration. With our proposed SDF-oriented optimization, surface reconstruction quality can be significantly boosted.
|
| 266 |
+
|
| 267 |
+
Table 2: Ablation study on DTU scenes.
|
| 268 |
+
|
| 269 |
+
<table><tr><td>Method</td><td>Lcolor</td><td>LsDF</td><td>Lphoto</td><td>mean</td></tr><tr><td>Baseline</td><td>√</td><td></td><td></td><td>0.87</td></tr><tr><td>Model-A</td><td></td><td>厂</td><td></td><td>0.62</td></tr><tr><td>Model-B</td><td></td><td></td><td></td><td>0.54</td></tr><tr><td>Geo-Neus</td><td></td><td></td><td></td><td>0.51</td></tr></table>
|
| 270 |
+
|
| 271 |
+
<table><tr><td rowspan=1 colspan=1>Constraint</td><td rowspan=1 colspan=1>Setting</td><td rowspan=1 colspan=1>mean</td></tr><tr><td rowspan=1 colspan=1>Sparse 3D points</td><td rowspan=1 colspan=1>DepthintegralSDF location</td><td rowspan=1 colspan=1>0.850.62</td></tr><tr><td rowspan=1 colspan=1>Photometric consistency</td><td rowspan=1 colspan=1>DepthintegralSDF location</td><td rowspan=1 colspan=1>1.080.57</td></tr></table>
|
| 272 |
+
|
| 273 |
+
Table 3: Comparison results between depth integral and SDF location.
|
| 274 |
+
|
| 275 |
+
Convergence speed. We further study the convergence speed of our proposed method, Geo-Neus, and baseline, NeuS. As shown in Fig. 6, our method converges rapidly from scratch and becomes stable after $2 0 0 \mathrm { k }$ iterations. In contrast, NeuS cannot extract the reasonable surface from SDF networks in the beginning and starts to become stable after $2 5 0 \mathrm { k }$ iterations. This demonstrates that our proposed explicit SDF optimization also improves the efficiency of neural surfaces learning by volume rendering, reducing the training time from around 16 hours to around 10 hours.
|
| 276 |
+
|
| 277 |
+
Limitation. We show failure cases of our method on scenes with strong specular highlights and transparent objects. Fig. 7(a) shows our reconstructed surfaces on the scene with strong specular highlights, DTU scan77. In this case, the strong specular highlights lead to large view-dependent effects, making the multi-view photometric consistency loss unable to reliably measure multi-view geometry constraints. Thus, our method cannot produce satisfactory surfaces in this case. In addition, Fig. 7(b) shows our reconstructed surfaces on the scene with transparent objects [13]. As proposed in Sec. 3.1, we assume the target objects are all opaque and solid. For transparent objects, the proposed bias between rendered colors and implicit geometry is invalid. Furthermore, the geometric loss we proposed may not work well, just like the photometric consistency used in traditional reconstruction methods.
|
| 278 |
+
|
| 279 |
+

|
| 280 |
+
Figure 6: Convergence speed.
|
| 281 |
+
|
| 282 |
+

|
| 283 |
+
Figure 7: Failure cases.
|
| 284 |
+
|
| 285 |
+
# 5 Conclusion
|
| 286 |
+
|
| 287 |
+
We have proposed Geo-Neus, a new method to perform neural implicit surfaces learning by enforcing explicit SDF optimization. In our paper, we first provide the theoretical analysis that there exists a gap between volume rendering integration and neural SDF learning. With this theoretical support, we propose to explicitly optimize neural SDF learning by introducing two multi-view geometry constraints: sparse 3D points in structure from motion and photometric consistency in multi-view stereo. In this way, Geo-Neus produces high-quality surface reconstruction in both complex thin structures and large smooth regions. Therefore, it outperforms the state-of-the-arts by a large margin, including both traditional and neural implicit surfaces learning methods. We note that although our method greatly improves reconstruction quality, its efficiency is still limited. In the future, it will be interesting to explore accelerating neural implicit surfaces learning by volume rendering through super-fast per-scene radiance field optimization methods [34, 24]. We don’t see an immediate negative societal impact of our work, but accurate 3D models may be used from malevolence.
|
| 288 |
+
|
| 289 |
+
Acknowledgments This work was in part supported by the National Natural Science Foundation of China under Grants 62176096 and 61991412, the Data Science and Artificial Intelligence Research Center (DSAIR), School of Computer Science and Engineering, Nanyang Technological University and the A\*Star Center for Frontier AI Research (CFAR).
|
| 290 |
+
|
| 291 |
+
References
|
| 292 |
+
[1] Henrik Aanæs, Rasmus Ramsbøl Jensen, George Vogiatzis, Engin Tola, and Anders Bjorholm Dahl. Large-scale data for multiple-view stereopsis. International Journal of Computer Vision, 120(2):153–168, 2016.
|
| 293 |
+
[2] Matan Atzmon and Yaron Lipman. Sal: Sign agnostic learning of shapes from raw data. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2565–2574, 2020.
|
| 294 |
+
[3] Bruce G Baumgart. A polyhedron representation for computer vision. In Proceedings of the National Computer Conference and Exposition, pages 589–596, 1975.
|
| 295 |
+
[4] Jean-Daniel Boissonnat and Bernhard Geiger. Three-dimensional reconstruction of complex shapes based on the delaunay triangulation. In Biomedical Image Processing and Biomedical Visualization, volume 1905, pages 964–975, 1993.
|
| 296 |
+
[5] Adrian Broadhurst, Tom W Drummond, and Roberto Cipolla. A probabilistic framework for space carving. In Proceedings of the IEEE International Conference on Computer Vision, volume 1, pages 388–393, 2001.
|
| 297 |
+
[6] Brian Curless and Marc Levoy. A volumetric method for building complex models from range images. In Proceedings of the 23rd annual conference on Computer graphics and interactive techniques, pages 303–312, 1996.
|
| 298 |
+
[7] François Darmon, Bénédicte Bascle, Jean-Clément Devaux, Pascal Monasse, and Mathieu Aubry. Improving neural implicit surfaces geometry with patch warping. arXiv preprint arXiv:2112.09648, 2021.
|
| 299 |
+
[8] Philipp Erler, Paul Guerrero, Stefan Ohrhallinger, Niloy J Mitra, and Michael Wimmer. Points2surf learning implicit surfaces from point clouds. In Proceedings of the European Conference on Computer Vision, pages 108–124. Springer, 2020.
|
| 300 |
+
[9] Yasutaka Furukawa and Jean Ponce. Accurate, dense, and robust multiview stereopsis. IEEE Transactions on Pattern Analysis and Machine Intelligence, 32(8):1362–1376, 2010.
|
| 301 |
+
[10] S. Galliani, K. Lasinger, and K. Schindler. Massively parallel multiview stereopsis by surface normal diffusion. In Proceedings of the IEEE International Conference on Computer Vision, pages 873–881, 2015.
|
| 302 |
+
[11] Amos Gropp, Lior Yariv, Niv Haim, Matan Atzmon, and Yaron Lipman. Implicit geometric regularization for learning shapes. arXiv preprint arXiv:2002.10099, 2020.
|
| 303 |
+
[12] Richard Hartley and Andrew Zisserman. Multiple View Geometry in Computer Vision. Cambridge University Press, 2 edition, 2004.
|
| 304 |
+
[13] Jeffrey Ichnowski, Yahav Avigal, Justin Kerr, and Ken Goldberg. Dex-nerf: Using a neural radiance field to grasp transparent objects. arXiv preprint arXiv:2110.14217, 2021.
|
| 305 |
+
[14] Abhishek Kar, Christian Häne, and Jitendra Malik. Learning a multi-view stereo machine. Advances in neural information processing systems, 30, 2017.
|
| 306 |
+
[15] Michael Kazhdan and Hugues Hoppe. Screened poisson surface reconstruction. ACM Transactions on Graphics, 32(3):1–13, 2013.
|
| 307 |
+
[16] Patrick Labatut, J-P Pons, and Renaud Keriven. Robust and efficient surface reconstruction from range data. In Computer Graphics Forum, volume 28, pages 2275–2290, 2009.
|
| 308 |
+
[17] Patrick Labatut, Jean-Philippe Pons, and Renaud Keriven. Efficient multi-view reconstruction of large-scale scenes using interest points, delaunay triangulation and graph cuts. In Proceedings of the IEEE International Conference on Computer Vision, pages 1–8, 2007.
|
| 309 |
+
[18] Lingjie Liu, Jiatao Gu, Kyaw Zaw Lin, Tat-Seng Chua, and Christian Theobalt. Neural sparse voxel fields. Advances in Neural Information Processing Systems, 33:15651–15663, 2020.
|
| 310 |
+
|
| 311 |
+
[19] 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.
|
| 312 |
+
|
| 313 |
+
[20] Ricardo Martin-Brualla, Noha Radwan, Mehdi SM Sajjadi, Jonathan T Barron, Alexey Dosovitskiy, and Daniel Duckworth. Nerf in the wild: Neural radiance fields for unconstrained photo collections. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 7210–7219, 2021.
|
| 314 |
+
|
| 315 |
+
[21] Nelson Max. Optical models for direct volume rendering. IEEE Transactions on Visualization and Computer Graphics, 1(2):99–108, 1995.
|
| 316 |
+
|
| 317 |
+
[22] 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.
|
| 318 |
+
|
| 319 |
+
[23] Ben Mildenhall, Pratul P Srinivasan, Matthew Tancik, Jonathan T Barron, Ravi Ramamoorthi, and Ren $\mathrm { N g }$ . Nerf: Representing scenes as neural radiance fields for view synthesis. In Proceedings of the European Conference on Computer Vision, pages 405–421, 2020.
|
| 320 |
+
|
| 321 |
+
[24] Thomas Müller, Alex Evans, Christoph Schied, and Alexander Keller. Instant neural graphics primitives with a multiresolution hash encoding. arXiv preprint arXiv:2201.05989, 2022.
|
| 322 |
+
|
| 323 |
+
[25] Michael Niemeyer, Lars Mescheder, Michael Oechsle, and Andreas Geiger. Differentiable volumetric rendering: Learning implicit 3d representations without 3d supervision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3504–3515, 2020.
|
| 324 |
+
|
| 325 |
+
[26] Michael Oechsle, Songyou Peng, and Andreas Geiger. Unisurf: Unifying neural implicit surfaces and radiance fields for multi-view reconstruction. In Proceedings of the IEEE International Conference on Computer Vision, pages 5589–5599, 2021.
|
| 326 |
+
|
| 327 |
+
[27] Jeong Joon Park, Peter Florence, Julian Straub, Richard Newcombe, and Steven Lovegrove. Deepsdf: Learning continuous signed distance functions for shape representation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 165–174, 2019.
|
| 328 |
+
|
| 329 |
+
[28] Songyou Peng, Michael Niemeyer, Lars Mescheder, Marc Pollefeys, and Andreas Geiger. Convolutional occupancy networks. In Proceedings of the European Conference on Computer Vision, pages 523–540, 2020.
|
| 330 |
+
|
| 331 |
+
[29] Johannes L Schonberger and Jan-Michael Frahm. Structure-from-motion revisited. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4104–4113, 2016.
|
| 332 |
+
|
| 333 |
+
[30] Johannes L. Schönberger, Enliang Zheng, Jan-Michael Frahm, and Marc Pollefeys. Pixelwise view selection for unstructured multi-view stereo. In Proceedings of the European Conference on Computer Vision, pages 501–518, 2016.
|
| 334 |
+
|
| 335 |
+
[31] Steven M Seitz and Charles R Dyer. Photorealistic scene reconstruction by voxel coloring. International Journal of Computer Vision, 35(2):151–173, 1999.
|
| 336 |
+
|
| 337 |
+
[32] Vincent Sitzmann, Julien Martel, Alexander Bergman, David Lindell, and Gordon Wetzstein. Implicit neural representations with periodic activation functions. Advances in Neural Information Processing Systems, 33:7462–7473, 2020.
|
| 338 |
+
|
| 339 |
+
[33] Noah Snavely, Steven M Seitz, and Richard Szeliski. Photo tourism: exploring photo collections in 3d. In ACM SIGGRAPH, pages 835–846, 2006.
|
| 340 |
+
|
| 341 |
+
[34] Cheng Sun, Min Sun, and Hwann-Tzong Chen. Direct voxel grid optimization: Super-fast convergence for radiance fields reconstruction. arXiv preprint arXiv:2111.11215, 2021.
|
| 342 |
+
|
| 343 |
+
[35] Peng Wang, Lingjie Liu, Yuan Liu, Christian Theobalt, Taku Komura, and Wenping Wang. Neus: Learning neural implicit surfaces by volume rendering for multi-view reconstruction. arXiv preprint arXiv:2106.10689, 2021.
|
| 344 |
+
|
| 345 |
+
[36] Qingshan Xu, Weihang Kong, Wenbing Tao, and Marc Pollefeys. Multi-scale geometric consistency guided and planar prior assisted multi-view stereo. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2022.
|
| 346 |
+
[37] Qingshan Xu and Wenbing Tao. Multi-scale geometric consistency guided multi-view stereo. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 5483–5492, 2019.
|
| 347 |
+
[38] Qingshan Xu and Wenbing Tao. Planar prior assisted patchmatch multi-view stereo. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 12516–12523, 2020.
|
| 348 |
+
[39] Qingshan Xu and Wenbing Tao. Pvsnet: Pixelwise visibility-aware multi-view stereo network. arXiv preprint arXiv:2007.07714, 2020.
|
| 349 |
+
[40] Yao Yao, Zixin Luo, Shiwei Li, Tian Fang, and Long Quan. Mvsnet: Depth inference for unstructured multi-view stereo. In Proceedings of the European Conference on Computer Vision, pages 767–783, 2018.
|
| 350 |
+
[41] Yao Yao, Zixin Luo, Shiwei Li, Jingyang Zhang, Yufan Ren, Lei Zhou, Tian Fang, and Long Quan. Blendedmvs: A large-scale dataset for generalized multi-view stereo networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 1790–1799, 2020.
|
| 351 |
+
[42] Lior Yariv, Jiatao Gu, Yoni Kasten, and Yaron Lipman. Volume rendering of neural implicit surfaces. In Advances in Neural Information Processing Systems, volume 34, 2021.
|
| 352 |
+
[43] Lior Yariv, Yoni Kasten, Dror Moran, Meirav Galun, Matan Atzmon, Basri Ronen, and Yaron Lipman. Multiview neural surface reconstruction by disentangling geometry and appearance. In Advances in Neural Information Processing Systems, volume 33, pages 2492–2502, 2020.
|
| 353 |
+
[44] Jingyang Zhang, Yao Yao, and Long Quan. Learning signed distance field for multi-view surface reconstruction. In Proceedings of the IEEE International Conference on Computer Vision, pages 6525–6534, 2021.
|
| 354 |
+
[45] Kai Zhang, Gernot Riegler, Noah Snavely, and Vladlen Koltun. Nerf $^ { + + }$ : Analyzing and improving neural radiance fields. arXiv preprint arXiv:2010.07492, 2020.
|
| 355 |
+
[46] Qian-Yi Zhou, Jaesik Park, and Vladlen Koltun. Open3d: A modern library for 3d data processing. arXiv preprint arXiv:1801.09847, 2018.
|
| 356 |
+
|
| 357 |
+
# Checklist
|
| 358 |
+
|
| 359 |
+
1. For all authors...
|
| 360 |
+
|
| 361 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 362 |
+
(b) Did you describe the limitations of your work? [Yes] See Section 4.3.
|
| 363 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 5.
|
| 364 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 365 |
+
|
| 366 |
+
2. If you are including theoretical results...
|
| 367 |
+
|
| 368 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 3.1.
|
| 369 |
+
(b) Did you include complete proofs of all theoretical results? [Yes] See Section 3.1.
|
| 370 |
+
|
| 371 |
+
3. If you ran experiments...
|
| 372 |
+
|
| 373 |
+
(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] We plan to release the code completely but have not yet with submission.
|
| 374 |
+
|
| 375 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 4.1.
|
| 376 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No]
|
| 377 |
+
(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.
|
| 378 |
+
|
| 379 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 380 |
+
|
| 381 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] See Section 4.1.
|
| 382 |
+
(b) Did you mention the license of the assets? [Yes] See Section 4.1.
|
| 383 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 384 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 385 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 386 |
+
|
| 387 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 388 |
+
|
| 389 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 390 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 391 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/K3BMejPSyQ/K3BMejPSyQ.md
ADDED
|
@@ -0,0 +1,546 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Two-timescale Derivative Free Optimization for Performative Prediction with Markovian Data
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
This paper studies the performative prediction problem where a learner aims to minimize the expected loss with a decision-dependent data distribution. Such setting is motivated when outcomes can be affected by the prediction model, e.g., in strategic classification. We consider a state-dependent setting where the data distribution evolves according to an underlying controlled Markov chain. We focus on stochastic derivative free optimization (DFO) where the learner is given access to a loss function evaluation oracle with the above Markovian data. We propose a two-timescale $\mathrm { D F O } ( \lambda )$ algorithm that features (i) a sample accumulation mechanism that utilizes every observed sample to estimate the overall gradient of performative risk, and (ii) a two-timescale diminishing step size that balances the rates of DFO updates and bias reduction. Under a general non-convex optimization setting, we show that $\mathrm { D F O } ( \lambda )$ requires $\mathcal { O } ( 1 / \epsilon ^ { 3 } )$ samples (up to a log factor) to attain a near-stationary solution with expected squared gradient norm less than $\epsilon > 0$ . Numerical experiments verify our analysis.
|
| 11 |
+
|
| 12 |
+
# 15 1 Introduction
|
| 13 |
+
|
| 14 |
+
16 Consider the following stochastic optimization problem with decision-dependent data:
|
| 15 |
+
|
| 16 |
+
$$
|
| 17 |
+
\operatorname* { m i n } _ { \pmb { \theta } \in \mathbb { R } ^ { d } } \mathcal { L } ( \pmb { \theta } ) = \mathbb { E } _ { Z \sim \Pi _ { \pmb { \theta } } } \big [ \ell ( \pmb { \theta } ; Z ) \big ] .
|
| 18 |
+
$$
|
| 19 |
+
|
| 20 |
+
17 Notice that the decision variable $\pmb \theta$ appears in both the loss function $\ell ( \pmb \theta ; Z )$ and the data distribution
|
| 21 |
+
18 $\Pi _ { \theta }$ supported on Z. The overall loss function $\mathcal { L } ( \pmb \theta )$ is known as the performative risk which captures
|
| 22 |
+
19 the distributional shift due to changes in the deployed model. This setting is motivated by the
|
| 23 |
+
20 recent studies on performative prediction (Perdomo et al., 2020), which considers outcomes that are
|
| 24 |
+
21 supported by the deployed model $\pmb \theta$ under training. For example, this models strategic classification
|
| 25 |
+
22 (Hardt et al., 2016; Dong et al., 2018) in economical and financial practices such as with the training
|
| 26 |
+
23 of loan classifier for customers who may react to the deployed model $\pmb { \theta }$ to maximize their gains; or
|
| 27 |
+
24 in price promotion mechanism (Zhang et al., 2018) where customers react to prices with the aim of
|
| 28 |
+
25 gaining a lower price; or in ride sharing business (Narang et al., 2022) with customers who adjust
|
| 29 |
+
26 their demand according to prices set by the platform.
|
| 30 |
+
27 The objective function $\mathcal { L } ( \pmb { \theta } )$ is non-convex in general due to the effects of $\pmb \theta$ on both the loss function
|
| 31 |
+
28 and distribution. Numerous efforts have been focused on characterizing and finding the so-called
|
| 32 |
+
29 performative stable solution which is a fixed point to the repeated risk minimization (RRM) process
|
| 33 |
+
30 (Perdomo et al., 2020; Mendler-Dunner et al. ¨ , 2020; Brown et al., 2022; Li & Wai, 2022; Roy et al.,
|
| 34 |
+
31 2022; Drusvyatskiy & Xiao, 2022). While RRM might be a natural algorithm for scenarios when the
|
| 35 |
+
32 learner is agnostic to the performative effects in the dynamic data distribution, the obtained solution
|
| 36 |
+
33 maybe far from being optimal or stationary to (1).
|
| 37 |
+
34 On the other hand, recent works have studied performative optimal solutions that minimizes (1). This
|
| 38 |
+
35 is challenging due to the non-convexity of $\mathcal { L } ( \pmb { \theta } )$ and more importantly, the absence of knowledge
|
| 39 |
+
36 of $\Pi _ { \theta }$ . In fact, evaluating $\nabla { \mathcal { L } } ( \theta )$ or its stochastic gradient estimate would require learning the
|
| 40 |
+
37 distribution $\Pi _ { \theta }$ a-priori (Izzo et al., 2021). To design a tractable procedure, prior works have assumed
|
| 41 |
+
38 structures for (1) such as approximating $\Pi _ { \theta }$ by Gaussian mixture (Izzo et al., 2021), $\Pi _ { \theta }$ depends
|
| 42 |
+
39 linearly on $\pmb \theta$ (Narang et al., 2022), etc., combined with a two-phase algorithm that separately learns
|
| 43 |
+
40 $\Pi _ { \theta }$ and optimizes $\pmb { \theta }$ . Other works have assumed a mixture dominance structure (Miller et al., 2021)
|
| 44 |
+
41 on the combined effect of $\Pi _ { \theta }$ and $\ell ( \cdot )$ on $\mathcal { L } ( \pmb \theta )$ , which in turn implies that $\mathcal { L } ( \pmb { \theta } )$ is convex. Based on
|
| 45 |
+
42 this assumption, a derivative free optimization (DFO) algorithm was analyzed in Ray et al. (2022).
|
| 46 |
+
43 This paper focuses on approximating the performa
|
| 47 |
+
44 tive optimal solution without relying on additional
|
| 48 |
+
45 condition on the distribution $\Pi _ { \theta }$ and/or using a two
|
| 49 |
+
46 phase algorithm. We concentrate on stochastic DFO
|
| 50 |
+
47 algorithms (Ghadimi & Lan, 2013) which do not in
|
| 51 |
+
48 volve first order information (i.e., gradient) about
|
| 52 |
+
49 $\mathcal { L } ( \pmb \theta )$ . As an advantage, these algorithms avoid the
|
| 53 |
+
50 need for estimating $\Pi _ { \theta }$ . Instead, the learner is given
|
| 54 |
+
51 access to the loss function evaluation oracle $\ell ( { \bar { \pmb { \theta } } } ; Z )$
|
| 55 |
+
52 and receive data samples from a controlled Markov
|
| 56 |
+
53 chain. Note that the latter models the stateful and
|
| 57 |
+
54 strategic agent setting considered in (Ray et al., 2022;
|
| 58 |
+
55 Roy et al., 2022; Li & Wai, 2022; Brown et al., 2022).
|
| 59 |
+
|
| 60 |
+
<table><tr><td>Stochastic DFO Settings</td><td>Rate</td></tr><tr><td>Decision-indep.</td><td>0(1/²2)</td></tr><tr><td>(Ghadimi & Lan, 2013)</td><td></td></tr><tr><td>Decision-depend. (Markov) O(1/ε)</td><td></td></tr></table>
|
| 61 |
+
|
| 62 |
+
Table 1: Comparison of the expected convergence rates (to find an $\epsilon$ -stationary point) for DFO under various settings where DFO is used to tackle an unstructured non-convex optimization problem such as (1).
|
| 63 |
+
|
| 64 |
+
Such setting is motivated when the actual data distribution adapts slowly to the decision model, which will be announced by the learner during the (stochastic) optimization process.
|
| 65 |
+
|
| 66 |
+
58 The proposed DFO $( \lambda )$ algorithm features (i) a two-timescale step sizes design to control the bias
|
| 67 |
+
59 variance tradeoff in the derivative-free gradient estimates, and (ii) a sample accumulation mechanism
|
| 68 |
+
60 with forgetting factor $\lambda$ that aggregates every observed samples to control the amount of error in
|
| 69 |
+
61 gradient estimates. In addition to the new algorithm design, our main findings are summarized below:
|
| 70 |
+
|
| 71 |
+
• Under the Markovian data setting, we show in Theorem 3.1 that the DFO $( \lambda )$ algorithm finds a nearstationary solution $\bar { \pmb { \theta } }$ with $\mathbb { E } [ \lVert \nabla \mathcal { L } ( \bar { \pmb { \theta } } ) \rVert ^ { 2 } ] \le \epsilon$ using $\textstyle { \mathcal { O } } ( { \frac { d ^ { 2 } } { \epsilon ^ { 3 } } } \log 1 / \epsilon )$ samples/iterations. Compared to prior works, our analysis does not require structural assumption on the distribution $\Pi _ { \theta }$ or convexity condition on the performative risk (Izzo et al., 2021; Miller et al., 2021; Ray et al., 2022).
|
| 72 |
+
|
| 73 |
+
• Our analysis demonstrates the trade-off induced by the forgetting factor $\lambda$ in the DFO $( \lambda )$ algorithm. We identify the desiderata for the optimal value(s) of $\lambda$ . We show that increasing $\lambda$ allows to reduce the number of samples requited by the algorithm if the performative risk gradient has a small Lipschitz constant.
|
| 74 |
+
|
| 75 |
+
0 For the rest of this paper, $\ S$ describes the problem setup and the DFO $( \lambda )$ algorithm, $\ S$ presents the main results, $\ S$ outlines the proofs. Finally, we provide numerical results to verify our findings in $\ S 5$ .
|
| 76 |
+
|
| 77 |
+
72 Finally, as displayed in Table 1, we remark that stochastic DFO under decision dependent (and
|
| 78 |
+
73 Markovian) samples has a convergence rate of $\mathcal { O } ( 1 / \epsilon ^ { 3 } )$ towards an $\epsilon$ -stationary point, which is worse
|
| 79 |
+
74 than the decision independent setting that has $\mathcal { O } ( 1 / \epsilon ^ { 2 } )$ in Ghadimi & Lan (2013). We believe that
|
| 80 |
+
75 this is a fundamental limit for DFO-type algorithms when tackling problems with decision-dependent
|
| 81 |
+
76 sample due to the challenges in designing a low variance gradient estimator; see $\ S$ .
|
| 82 |
+
77 Related Works. The idea of DFO dates back to Nemirovski˘ı (1983), and has been extensively studied
|
| 83 |
+
78 thereafter Flaxman et al. (2005); Agarwal et al. (2010); Nesterov & Spokoiny (2017); Ghadimi &
|
| 84 |
+
79 Lan (2013). Results on matching lower bound were established in (Jamieson et al., 2012). While a
|
| 85 |
+
80 similar DFO framework is adopted in the current paper for performative prediction, our algorithm is
|
| 86 |
+
81 limited to using a special design in the gradient estimator to avoid introducing unwanted biases.
|
| 87 |
+
82 There are only a few works considering the Markovian data setting in performative prediction. Brown
|
| 88 |
+
83 et al. (2022) is the first paper to study the dynamic settings, where the response of agents to learner’s
|
| 89 |
+
84 deployed classifier is modeled as a function of classifier and the current distribution of the population;
|
| 90 |
+
85 also see (Izzo et al., 2022). On the other hand, Li & Wai (2022); Roy et al. (2022) model the
|
| 91 |
+
86 unforgetful nature and the reliance on past experiences of single/batch agent(s) via controlled Markov
|
| 92 |
+
87 Chain. Lastly, Ray et al. (2022) investigated the state-dependent framework where agents’ response
|
| 93 |
+
88 may be driven to best response at a geometric rate.
|
| 94 |
+
|
| 95 |
+
1: Input: Constants $\delta _ { 0 } , \eta _ { 0 } , \tau _ { 0 } , \alpha , \beta$ , maximum epochs $T$ , forgetting factor $\lambda$ , loss function $\bar { \ell \left( \cdot ; \cdot \right) }$ .
|
| 96 |
+
2: Initialization: Set initial $\pmb { \theta } _ { 0 }$ and sample $Z _ { 0 }$ .
|
| 97 |
+
3: for $k = 0$ to $T - 1$ do
|
| 98 |
+
4: $\delta _ { k } \gets \delta _ { 0 } / ( 1 + k ) ^ { \beta }$ , $\eta _ { k } \eta _ { 0 } / ( 1 + k ) ^ { \alpha } .$ , $\tau _ { k } \gets \operatorname* { m a x } \{ 1 , \tau _ { 0 } \log ( 1 + k ) \}$
|
| 99 |
+
5: Update ) ← θk, Z(0k $Z _ { k } ^ { ( 0 ) } \gets Z _ { k }$ , ${ \pmb u } _ { k } \sim \mathrm { U n i f } ( \mathbb { S } ^ { { \mathsf { d } } - 1 } )$
|
| 100 |
+
6: for $m = 1 , 2 , \cdots , \tau _ { k } { \bf d }$ o
|
| 101 |
+
7: Deploy the model $\check { \pmb { \theta } } _ { k } ^ { ( m ) } = \pmb { \theta } _ { k } ^ { ( m ) } + \delta _ { k } \pmb { u } _ { k }$
|
| 102 |
+
|
| 103 |
+
Draw $Z _ { k } ^ { ( m ) } \sim \mathbb { T } _ { \check { \pmb { \theta } } _ { k } ^ { ( m ) } } ( Z _ { k } ^ { ( m - 1 ) } , \cdot )$
|
| 104 |
+
|
| 105 |
+
9: Update $\theta _ { k } ^ { ( m ) }$ as
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
\begin{array} { r l } & { \pmb { g } _ { k } ^ { ( m ) } = \frac { d } { \delta _ { k } } \ell \big ( \check { \pmb { \theta } } _ { k } ^ { ( m ) } ; Z _ { k } ^ { ( m ) } \big ) \pmb { u } _ { k } , } \\ & { \pmb { \theta } _ { k } ^ { ( m + 1 ) } = \pmb { \theta } _ { k } ^ { ( m ) } - \eta _ { k } \lambda ^ { \tau _ { k } - m } \pmb { g } _ { k } ^ { ( m ) } . } \end{array}
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
10: end for
|
| 112 |
+
|
| 113 |
+
11: $Z _ { k + 1 } \gets Z _ { k } ^ { ( \tau _ { k } ) }$ , $\pmb { \theta } _ { k + 1 } \pmb { \theta } _ { k } ^ { ( \tau _ { k } + 1 ) }$
|
| 114 |
+
|
| 115 |
+
12: end for
|
| 116 |
+
|
| 117 |
+
Output: Last iterate $\pmb { \theta } _ { T }$
|
| 118 |
+
|
| 119 |
+
89 Notations: Let $\mathbb { R } ^ { d }$ be the $d$ -dimensional Euclidean space equipped with inner product $\langle \cdot , \cdot \rangle$ and
|
| 120 |
+
90 induced norm $\| x \| = { \sqrt { \langle x , x \rangle } }$ . Let $s$ be a (measurable) sample space, and $\mu , \nu$ are two probability
|
| 121 |
+
91 measures defined on $s$ . Then, we use $\delta _ { \mathrm { T V } } \left( \mu , \nu \right) : = \operatorname* { s u p } _ { A \subset { \mathcal { S } } } \mu ( A ) - \nu ( A )$ to denote the total variation
|
| 122 |
+
92 distance between $\mu$ and $\nu$ . Denote $\mathbb { T } _ { \theta } ( \cdot , \cdot )$ ⊂S as the state-dependent Markov kernel and its stationary
|
| 123 |
+
93 distribution is $\Pi _ { \theta } ( \cdot )$ . Let $\mathbb { B } ^ { d }$ and $\mathbb { S } ^ { d - 1 }$ be the unit ball and its boundary (i.e., a unit sphere) centered
|
| 124 |
+
94 around the origin in $d$ -dimensional Euclidean space, respectively, and correspondingly, the ball and
|
| 125 |
+
95 sphere of radius r > 0 are rBd and rSd−1.
|
| 126 |
+
|
| 127 |
+
# 96 2 Problem Setup and Algorithm Design
|
| 128 |
+
|
| 129 |
+
97 In this section, we develop the DFO $( \lambda )$ algorithm for tackling (1) and describe the problem setup.
|
| 130 |
+
98 Assume that $\mathcal { L } ( \pmb { \theta } )$ is differentiable, we focus on finding an $\epsilon$ -stationary solution, $\pmb { \theta }$ , which satisfies
|
| 131 |
+
|
| 132 |
+
$$
|
| 133 |
+
\| \nabla \mathcal { L } ( \pmb { \theta } ) \| ^ { 2 } \leq \epsilon .
|
| 134 |
+
$$
|
| 135 |
+
|
| 136 |
+
99 With the goal of reaching (2), there are two key challenges in our stochastic algorithm design:
|
| 137 |
+
100 (i) to estimate the gradient $\nabla { \mathcal { L } } ( \theta )$ , and (ii) to handle the stateful setting where one cannot draw
|
| 138 |
+
101 samples directly from the distribution $\Pi _ { \theta }$ . We shall discuss how the proposed DFO $( \lambda )$ algorithm,
|
| 139 |
+
102 which is summarized in Algorithm 1, tackles the above issues through utilizing two ingredients: (a)
|
| 140 |
+
103 two-timescales step sizes, and (b) sample accumulation with the forgetting factor $\lambda \in [ 0 , 1 )$ .
|
| 141 |
+
|
| 142 |
+
Estimating $\nabla { \mathcal { L } } ( \theta )$ via Two-timescales DFO. First notice that the gradient of $\mathcal { L } ( \cdot )$ can be derived a
|
| 143 |
+
|
| 144 |
+
$$
|
| 145 |
+
\nabla \mathcal { L } ( \pmb { \theta } ) = \mathbb { E } _ { Z \sim \Pi _ { \pmb { \theta } } } [ \nabla \ell ( \pmb { \theta } ; Z ) + \ell ( \pmb { \theta } ; Z ) \nabla _ { \pmb { \theta } } \log \Pi _ { \pmb { \theta } } ( Z ) ] ,
|
| 146 |
+
$$
|
| 147 |
+
|
| 148 |
+
105 As a result, constructing the stochastic estimates of $\nabla { \mathcal { L } } ( \theta )$ typically requires knowledge of $\Pi _ { \pmb \theta } ( \cdot )$
|
| 149 |
+
106 which may not be known a-priori unless a separate estimation procedure is applied; see e.g., (Izzo
|
| 150 |
+
107 et al., 2021). To avoid the need for direct evaluations of $\nabla _ { \pmb { \theta } } \log \Pi _ { \pmb { \theta } } ( Z )$ , we consider an alternative
|
| 151 |
+
108 design via zero-th order optimization (Ghadimi & Lan, 2013). The intuition comes from observing
|
| 152 |
+
109 that with $\delta 0 ^ { + }$ , $\mathcal { L } ( \pmb { \theta } + \mathbf { \bar { \delta } } \mathbf { u } ) - \mathcal { L } ( \pmb { \theta } )$ is an approximate of the directional derivative of $\mathcal { L }$ along $\textbf { \em u }$
|
| 153 |
+
110 This suggests that an estimate for $\nabla { \mathcal { L } } ( \theta )$ can be constructed using the objective function values of
|
| 154 |
+
111 $\ell ( \pmb \theta ; Z )$ only.
|
| 155 |
+
112 Inspired by the above, we aim to construct a gradient estimate by querying $\ell ( \cdot )$ at randomly perturbed
|
| 156 |
+
113 points. Formally, given the current iterate $\pmb \theta \in \mathbb { R } ^ { d }$ and a query radius $\delta > 0$ , we sample a vector
|
| 157 |
+
114 $\mathbf { \bar { \boldsymbol { u } } } \in \mathbb { R } ^ { d }$ uniformly from $\mathbb { S } ^ { d - 1 }$ . The zero-th order gradient estimator for $\mathcal { L } ( \pmb { \theta } )$ is then defined as
|
| 158 |
+
|
| 159 |
+
$$
|
| 160 |
+
g _ { \delta } ( \pmb \theta ; \pmb u , Z ) : = \frac d \delta \ell ( \check { \pmb \theta } ; Z ) \pmb { u } \quad \mathrm { w i t h } \quad \check { \pmb \theta } : = \pmb \theta + \delta \pmb { u } , Z \sim \Pi _ { \check { \pmb \theta } } ( \cdot ) .
|
| 161 |
+
$$
|
| 162 |
+
|
| 163 |
+
115 In fact, as $\textbf { \em u }$ is zero-mean, $g _ { \delta } ( \pmb \theta ; \pmb u , Z )$ is an unbiased estimator for $\nabla { \mathcal { L } } _ { \delta } ( \pmb { \theta } )$ . Here, $\mathcal { L } _ { \delta } ( \pmb { \theta } )$ is a smooth
|
| 164 |
+
116 approximation of $\mathcal { L } ( \pmb { \theta } )$ (Flaxman et al., 2005; Nesterov & Spokoiny, 2017) defined as
|
| 165 |
+
|
| 166 |
+
$$
|
| 167 |
+
\begin{array} { r } { \mathcal { L } _ { \delta } ( \pmb { \theta } ) = \mathbb { E } _ { \pmb { u } } [ \mathcal { L } ( \pmb { \check { \theta } } ) ] = \mathbb { E } _ { \pmb { u } } [ \mathbb { E } _ { Z \sim \Pi _ { \check { \theta } } } [ \ell ( \pmb { \check { \theta } } ; Z ) ] ] . } \end{array}
|
| 168 |
+
$$
|
| 169 |
+
|
| 170 |
+
117 Furthermore, it is known that under mild condition [cf. Assumption 3.1 to be discussed later],
|
| 171 |
+
118 $\| \nabla \mathcal { L } _ { \delta } ( \pmb { \theta } ) - \nabla \mathcal { L } ( \pmb { \theta } ) \| = \mathcal { O } ( \delta )$ and thus (4) is an $\mathcal { O } ( \delta )$ -biased estimate for $\nabla { \mathcal { L } } ( \theta )$ .
|
| 172 |
+
119 We remark that the gradient estimator in (4) differs from the one used in classical works on DFO such
|
| 173 |
+
120 as (Ghadimi & Lan, 2013). The latter takes the form of $\begin{array} { r } { \frac { d } { \delta } ( \ell ( \check { \pmb { \theta } } ; Z ) - \ell ( \pmb { \theta } ; Z ) ) \mathbf { \delta } _ { \pmb { u } } } \end{array}$ . Under the setting
|
| 174 |
+
121 of standard stochastic optimization where the sample $Z$ is drawn independently of $\textbf { \em u }$ and Lipschitz
|
| 175 |
+
122 continuous $\ell ( \cdot ; Z )$ , the said estimator in (Ghadimi & Lan, 2013) is shown to have constant variance
|
| 176 |
+
123 while it remains $\dot { \mathcal { O } } ( \delta )$ -biased. Such properties cannot be transferred to (4) since $Z$ is drawn from a
|
| 177 |
+
124 distribution dependent on $\textbf { \em u }$ via $\check { \pmb { \theta } } = \pmb { \theta } + \delta \pmb { u }$ . In this case, the two-point gradient estimator would
|
| 178 |
+
125 become biased; see $\ S$ .
|
| 179 |
+
126 However, we note that the variance of (4) would increase as $\mathcal { O } ( 1 / \delta ^ { 2 } )$ when $\delta 0$ , thus the parameter
|
| 180 |
+
127 $\delta$ yields a bias-variance trade off in the estimator design. To remedy for the increase of variance, the
|
| 181 |
+
128 DFO $( \lambda )$ algorithm incorporates a two-timescale step size design for generating gradient estimates $( \delta _ { k } )$
|
| 182 |
+
129 and updating models $( \eta _ { k } )$ , respectively. Our design principle is such that the models are updated at a
|
| 183 |
+
130 slower timescale to adapt to the gradient estimator with $\hat { \mathcal { O } } ( 1 / \delta ^ { 2 } )$ variance. Particularly, we will set
|
| 184 |
+
131 $\eta _ { k + 1 } / \delta _ { k + 1 } \to 0$ to handle the bias-variance trade off, e.g., by setting $\alpha > \beta$ in line 4 of Algorithm 1.
|
| 185 |
+
132 Markovian Data and Sample Accumulation. We consider a setting where the sample/data distribu
|
| 186 |
+
133 tion observed by the DFO $( \lambda )$ algorithm evolves according to a controlled Markov chain (MC). Notice
|
| 187 |
+
134 that this describes a stateful agent(s) scenario such that the deployed models $\mathbf { \eta } ^ { ( \theta ) }$ would require time
|
| 188 |
+
135 to manifest their influence on the samples obtained; see (Li & Wai, 2022; Roy et al., 2022; Brown
|
| 189 |
+
136 et al., 2022; Ray et al., 2022; Izzo et al., 2022).
|
| 190 |
+
137 To describe the setting formally, we denote $\mathbb { T } _ { \pmb { \theta } } : \mathbb { Z } \times \mathcal { Z } \mathbb { R } _ { + }$ as a Markov kernel controlled by
|
| 191 |
+
138 a deployed model $\pmb { \theta }$ . For a given $\pmb \theta$ , the kernel has a unique stationary distribution $\Pi _ { \theta } ( \cdot )$ . Under
|
| 192 |
+
139 this setting, suppose that the previous state/sample is $Z$ , the next sample follows the distribution
|
| 193 |
+
140 $Z ^ { \prime } \sim \mathbb { T } _ { \pmb { \theta } } ( \bar { Z } , \cdot )$ which is not necessarily the same as $\Pi _ { \pmb \theta } ( \cdot )$ . As a consequence, the gradient estimator
|
| 194 |
+
141 (4) is not an unbiased estimator of $\nabla \dot { \mathcal { L } } _ { \delta } ( \pmb { \theta } )$ since $Z \sim \Pi _ { \tilde { \theta } } ( \cdot )$ cannot be conveniently accessed.
|
| 195 |
+
142 A common strategy in settling the above issue is to allow a burn-in phase in the algorithm as in (Ray
|
| 196 |
+
143 et al., 2022); also commonly found in MCMC methods (Robert et al., 1999). Using the fact that $\mathbb { T } _ { \theta }$
|
| 197 |
+
144 admits the stationary distribution $\Pi _ { \theta }$ , if one can wait a sufficiently long time before applying the
|
| 198 |
+
145 current sample, i.e., consider initializing with the previous sample $Z ^ { ( 0 ) } = Z$ , the procedure
|
| 199 |
+
|
| 200 |
+
$$
|
| 201 |
+
\begin{array} { r } { Z ^ { ( m ) } \sim \mathbb { T } _ { \pmb { \theta } } ( Z ^ { ( m - 1 ) } , \cdot ) , m = 1 , \dots , \tau , } \end{array}
|
| 202 |
+
$$
|
| 203 |
+
|
| 204 |
+
would yield a sample 6 $Z ^ { + } = Z ^ { ( \tau ) }$ that admits a distribution close to $\Pi _ { \theta }$ provided that $\tau \gg 1$ is 7 sufficiently large compared to the mixing time of $\mathbb { T } _ { \theta }$ .
|
| 205 |
+
|
| 206 |
+
148 Intuitively, the procedure (6) may be inefficient as a number of samples $Z ^ { ( 1 ) } , Z ^ { ( 2 ) } , \dots , Z ^ { ( \tau - 1 ) }$ will
|
| 207 |
+
149 be completely ignored at the end of each iteration. As a remedy, the DFO $( \lambda )$ algorithm incorporates
|
| 208 |
+
150 a sample accumulation mechanism which gathers the gradient estimates generated from possibly
|
| 209 |
+
151 non-stationary samples via a forgetting factor of $\lambda \in [ 0 , 1 )$ . Following (4), $\nabla { \mathcal { L } } ( \theta )$ is estimated by
|
| 210 |
+
|
| 211 |
+
$$
|
| 212 |
+
\begin{array} { r } { \pmb { g } = \frac { d } { \delta } \sum _ { m = 1 } ^ { \tau } \lambda ^ { \tau - m } \ell ( \pmb { \theta } ^ { ( m ) } + \delta \pmb { u } ; Z ^ { ( m ) } ) \pmb { u } , \mathrm { w i t h } Z ^ { ( m ) } \sim \mathbb { T } _ { \pmb { \theta } ^ { ( m ) } + \delta \pmb { u } } \big ( Z ^ { ( m - 1 ) } , \cdot \big ) . } \end{array}
|
| 213 |
+
$$
|
| 214 |
+
|
| 215 |
+
152 At a high level, the mechanism works by assigning large weights to samples that are close to the
|
| 216 |
+
153 end of an epoch (which are less biased). Moreover, $\bar { \pmb { \theta } } ^ { ( m ) }$ is simultaneously updated within the
|
| 217 |
+
154 epoch to obtain an online algorithm that gradually improves the objective value of (1). Note that
|
| 218 |
+
155 with $\lambda = 0$ , the DFO(0) algorithm reduces into one that utilizes burn-in (6). We remark that from
|
| 219 |
+
156 the implementation perspective for performative prediction, Algorithm 1 corresponds to a greedy
|
| 220 |
+
157 deployment scheme (Perdomo et al., 2020) as the latest model θ(m)k $\pmb { \theta } _ { k } ^ { ( m ) } + \delta _ { k } \pmb { u } _ { k }$ is deployed at every
|
| 221 |
+
158 sampling step. Line 6–10 of Algorithm 1 details the above procedure.
|
| 222 |
+
159 Lastly, we note that recent works have analyzed stochastic algorithms that rely on a single trajectory
|
| 223 |
+
160 of samples taken from a Markov Chain, e.g., (Sun et al., 2018; Karimi et al., 2019; Doan, 2022),
|
| 224 |
+
161 that are based on stochastic gradient. Sun & Li (2019) considered a DFO algorithm for general
|
| 225 |
+
162 optimization problems but the MC studied is not controlled by $\pmb \theta$ .
|
| 226 |
+
|
| 227 |
+
# 3 Main Results
|
| 228 |
+
|
| 229 |
+
64 This section studies the convergence of the DFO $( \lambda )$ algorithm and demonstrates that the latter finds
|
| 230 |
+
65 an $\epsilon$ -stationary solution [cf. (2)] to (1). We first state the assumptions required for our analysis:
|
| 231 |
+
|
| 232 |
+
166 Assumption 3.1. (Smoothness) $\mathcal { L } ( \pmb \theta )$ is differentiable, and there exists a constant $L > 0$ such that
|
| 233 |
+
|
| 234 |
+
$$
|
| 235 |
+
\| \nabla \mathcal { L } ( \pmb { \theta } ) - \nabla \mathcal { L } ( \pmb { \theta } ^ { \prime } ) \| \leq L \left\| \pmb { \theta } - \pmb { \theta } ^ { \prime } \right\| , \forall \pmb { \theta } , \pmb { \theta } ^ { \prime } \in \mathbb { R } ^ { d } .
|
| 236 |
+
$$
|
| 237 |
+
|
| 238 |
+
167 Assumption 3.2. (Bounded Loss) There exists a constant $G > 0$ such that
|
| 239 |
+
|
| 240 |
+
$$
|
| 241 |
+
\begin{array} { r } { | \ell ( \pmb \theta ; z ) | \leq G , \forall \pmb \theta \in \mathbb { R } ^ { d } , \forall z \in { \sf Z } . } \end{array}
|
| 242 |
+
$$
|
| 243 |
+
|
| 244 |
+
168 Assumption 3.3. (Lipschitz Distribution Map) There exists a constant $L _ { 1 } > 0$ such that
|
| 245 |
+
|
| 246 |
+
$$
|
| 247 |
+
\delta _ { \mathrm { T V } } \left( \Pi _ { \pmb { \theta } _ { 1 } } , \Pi _ { \pmb { \theta } _ { 2 } } \right) \leq L _ { 1 } \left. \pmb { \theta } _ { 1 } - \pmb { \theta } _ { 2 } \right. \ \quad \forall \pmb { \theta } _ { 1 } , \pmb { \theta } _ { 2 } \in \mathbb { R } ^ { d } .
|
| 248 |
+
$$
|
| 249 |
+
|
| 250 |
+
169 The conditions above state that the gradient of the performative risk is Lipschitz continuous and the
|
| 251 |
+
170 state-dependent distribution vary smoothly w.r.t. $\pmb \theta$ . Note that Assumption 3.1 is found in recent
|
| 252 |
+
171 works such as (Izzo et al., 2021; Ray et al., 2022), and Assumption 3.2 can be found in (Izzo et al.,
|
| 253 |
+
172 2021). Assumption 3.3 is slightly strengthened from the Wasserstein-1 distance bound in (Perdomo
|
| 254 |
+
173 et al., 2020), and it gives better control for distribution shift in our Markovian data setting.
|
| 255 |
+
|
| 256 |
+
Next, we consider the assumptions about the controlled Markov chain induced by $\mathbb { T } _ { \theta }$ :
|
| 257 |
+
|
| 258 |
+
175 Assumption 3.4. (Geometric Mixing) Let $\{ Z _ { k } \} _ { k \ge 0 }$ denote a Markov Chain on the state space Z
|
| 259 |
+
176 with transition kernel $\mathbb { T } _ { \theta }$ and stationary measure $\Pi _ { \theta }$ . There exist constants $\rho \in [ 0 , 1 )$ , $M \geq 0$ , such
|
| 260 |
+
177 that for any $k \geq 0 , z \in Z$ ,
|
| 261 |
+
|
| 262 |
+
$$
|
| 263 |
+
\begin{array} { r } { \delta _ { \mathrm { T V } } \left( \mathbb { P } _ { \pmb { \theta } } ( Z _ { k } \in \cdot | Z _ { 0 } = z ) , \Pi _ { \pmb { \theta } } \right) \le M \rho ^ { k } . } \end{array}
|
| 264 |
+
$$
|
| 265 |
+
|
| 266 |
+
178 Assumption 3.5. (Smoothness of Markov Kernel) There exists a constant $L _ { 2 } \geq 0$ such that
|
| 267 |
+
|
| 268 |
+
$$
|
| 269 |
+
\delta _ { \mathrm { T V } } \left( \mathbb { T } _ { \pmb { \theta } _ { 1 } } ( z , \cdot ) , \mathbb { T } _ { \pmb { \theta } _ { 2 } } ( z , \cdot ) \right) \leq L _ { 2 } \left\| \pmb { \theta } _ { 1 } - \pmb { \theta } _ { 2 } \right\| , \forall \pmb { \theta } _ { 1 } , \pmb { \theta } _ { 2 } \in \mathbb { R } ^ { d } , z \in \mathbb { Z } .
|
| 270 |
+
$$
|
| 271 |
+
|
| 272 |
+
179 Assumption 3.4 is a standard condition on the mixing time of the Markov chain induced by $\mathbb { T } _ { \theta }$ ;
|
| 273 |
+
180 Assumption 3.5 imposes a smoothness condition on the Markov transition kernel $\mathbb { T } _ { \theta }$ with respect to
|
| 274 |
+
181 $\pmb \theta$ . For instance, the geometric dynamically environment in Ray et al. (2022) constitutes a special
|
| 275 |
+
182 case which satisfies the above conditions.
|
| 276 |
+
183 Unlike (Ray et al., 2022; Izzo et al., 2021; Miller et al., 2021), we do not impose any additional
|
| 277 |
+
184 assumption (such as mixture dominance) other than Assumption 3.3 on $\Pi _ { \theta }$ . As a result, (1) remains
|
| 278 |
+
185 an ‘unstructured’ non-convex optimization problem. Our main theoretical result on the convergence
|
| 279 |
+
186 of the DFO $( \lambda )$ algorithm towards a near-stationary solution of (1) is summarized as:
|
| 280 |
+
|
| 281 |
+
Theorem 3.1. Suppose Assumptions 3.1-3.5 hold, step size sequence $\{ \eta _ { k } \} _ { k \ge 1 }$ , and query radius sequence $\{ \delta _ { k } \} _ { k \ge 1 }$ satisfy the following conditions,
|
| 282 |
+
|
| 283 |
+
$$
|
| 284 |
+
\begin{array} { l } { \eta _ { k } = d ^ { - 2 / 3 } \cdot ( 1 + k ) ^ { - 2 / 3 } , \quad \delta _ { k } = d ^ { 1 / 3 } \cdot ( 1 + k ) ^ { - 1 / 6 } , } \\ { \tau _ { k } = \operatorname* { m a x } \{ 1 , \displaystyle \frac { 2 } { \log { 1 / \operatorname* { m a x } \{ \rho , \lambda \} } } \log ( 1 + k ) \} \quad \forall k \geq 0 . } \end{array}
|
| 285 |
+
$$
|
| 286 |
+
|
| 287 |
+
187
|
| 288 |
+
|
| 289 |
+
Then, there exists constants $t _ { 0 } , c _ { 5 } , c _ { 6 } , c _ { 7 }$ , such that for any $T \geq t _ { 0 }$ , the iterates $\{ \pmb { \theta } _ { k } \} _ { k \ge 0 }$ generated by $D F O ( \lambda )$ satisfy the following inequality,
|
| 290 |
+
|
| 291 |
+
$$
|
| 292 |
+
\operatorname* { m i n } _ { 0 \leq k \leq T } \mathbb { E } \left\| \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \right\| ^ { 2 } \leq 1 2 \operatorname* { m a x } \left\{ c _ { 5 } ( 1 - \lambda ) , c _ { 6 } , \frac { c _ { 7 } } { 1 - \lambda } \right\} \frac { d ^ { 2 / 3 } } { ( T + 1 ) ^ { 1 / 3 } } .
|
| 293 |
+
$$
|
| 294 |
+
|
| 295 |
+
188 We have defined the following quantities and constants:
|
| 296 |
+
|
| 297 |
+
$$
|
| 298 |
+
c _ { 5 } = 2 G , \quad c _ { 6 } = \frac { \operatorname* { m a x } \{ L ^ { 2 } , G ^ { 2 } ( 1 - \beta ) \} } { 1 - 2 \beta } , \quad c _ { 7 } = \frac { L G ^ { 2 } } { 2 \beta - \alpha + 1 } ,
|
| 299 |
+
$$
|
| 300 |
+
|
| 301 |
+
189 with $\begin{array} { r } { \alpha = \frac { 2 } { 3 } , \beta = \frac { 1 } { 6 } } \end{array}$ . Observe the following corollary on the iteration complexity of DFO $( \lambda )$ algorithm:
|
| 302 |
+
190 Corollary 3.1. (ϵ-stationarity) Suppose that the Assumptions of Theorem 3.1 hold. Fix any $\epsilon > 0$ ,
|
| 303 |
+
191 the condition $\begin{array} { r } { \operatorname* { m i n } _ { 0 \leq k \leq T - 1 } \mathbb { E } \left\| \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \right\| ^ { 2 } \leq \epsilon } \end{array}$ holds whenever
|
| 304 |
+
|
| 305 |
+
$$
|
| 306 |
+
\begin{array} { r } { T \ge \left( 1 2 \operatorname* { m a x } \left\{ c _ { 5 } ( 1 - \lambda ) , c _ { 6 } , \frac { c _ { 7 } } { 1 - \lambda } \right\} \right) ^ { 3 } \frac { d ^ { 2 } } { \epsilon ^ { 3 } } . } \end{array}
|
| 307 |
+
$$
|
| 308 |
+
|
| 309 |
+
192 In the corollary above, the lower bound on $T$ is expressed in terms of the number of epochs that
|
| 310 |
+
193 Algorithm 1 needs to achieve the target accuracy. Consequently, the total number of samples required
|
| 311 |
+
194 (i.e., the number of inner iterations taken in Line 6–9 of Algorithm 1 across all epochs) is:
|
| 312 |
+
|
| 313 |
+
$$
|
| 314 |
+
\begin{array} { r } { \mathbf { S } _ { \epsilon } = \sum _ { k = 1 } ^ { T } \tau _ { k } = \mathcal { O } \left( \frac { d ^ { 2 } } { \epsilon ^ { 3 } } \log ( 1 / \epsilon ) \right) . } \end{array}
|
| 315 |
+
$$
|
| 316 |
+
|
| 317 |
+
195 We remark that due to the decision-dependent properties of the samples, the DFO $( \lambda )$ algorithm
|
| 318 |
+
196 exhibits a worse sampling complexity (12) than prior works in stochastic DFO algorithm, e.g.,
|
| 319 |
+
197 (Ghadimi & Lan, 2013) which shows a rate of $\mathcal { O } ( \bar { d } / \epsilon ^ { 2 } )$ on non-convex smooth objective functions.
|
| 320 |
+
198 In particular, the adopted one-point gradient estimator in (4) admits a variance that can only be
|
| 321 |
+
199 controlled by a time varying $\delta$ ; see the discussions in $\ S 4 . 1$ .
|
| 322 |
+
200 Achieving the desired convergence rate requires setting $\eta _ { k } = \Theta ( k ^ { - 2 / 3 } )$ , $\delta _ { k } = \Theta ( k ^ { - 1 / 6 } )$ , i.e.,
|
| 323 |
+
201 yielding a two-timescale step sizes design with $\eta _ { k } / \delta _ { k } \to 0$ . Notice that the influence of forgetting
|
| 324 |
+
202 factor $\lambda$ are reflected in the constant factor of (9). Particularly, if $c _ { 5 } > c _ { 7 }$ and $c _ { 5 } \geq c _ { 6 }$ , the optimal
|
| 325 |
+
203 choice is $\begin{array} { r } { \lambda = 1 - \sqrt { \frac { c _ { 7 } } { c _ { 5 } } } } \end{array}$ , otherwise the optimal choice is $\lambda \in [ 0 , 1 - c _ { 7 } / c _ { 6 } ]$ . Informally, this indicates
|
| 326 |
+
204 that when the performative risk is smoother (i.e. its gradient has a small Lipschitz constant), a large $\lambda$
|
| 327 |
+
205 can speed up the convergence of the algorithm; otherwise a smaller $\lambda$ is preferable.
|
| 328 |
+
|
| 329 |
+
# 206 4 Proof Outline of Main Results
|
| 330 |
+
|
| 331 |
+
This section outlines the key steps in proving Theorem 3.1. Notice that analyzing the DFO $( \lambda )$ algorithm is challenging due to the two-timescales step sizes and Markov chain samples with time varying kernel. Our analysis departs significantly from prior works such as (Ray et al., 2022; Izzo et al., 2021; Brown et al., 2022; Li & Wai, 2022) to handle the challenges above.
|
| 332 |
+
|
| 333 |
+
Let $\mathcal { F } ^ { k } = { \sigma } ( \theta _ { 0 } , Z _ { s } ^ { ( m ) } , u _ { s } , 0 \le s \le k , 0 \le m \le \tau _ { k } )$ be the filtration. Our first step is to exploit the smoothness of $\mathcal { L } ( \pmb \theta )$ to bound the squared norms of gradient. Observe that:
|
| 334 |
+
|
| 335 |
+
213 Lemma 4.1. (Decomposition) Under Assumption 3.1, it holds that
|
| 336 |
+
|
| 337 |
+
$$
|
| 338 |
+
\sum _ { k = 0 } ^ { t } \mathbb { E } \left. \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \right. ^ { 2 } \leq \mathbf { I } _ { 1 } ( t ) + \mathbf { I } _ { 2 } ( t ) + \mathbf { I } _ { 3 } ( t ) + \mathbf { I } _ { 4 } ( t ) ,
|
| 339 |
+
$$
|
| 340 |
+
|
| 341 |
+
214 for any $t \geq 1$ , where
|
| 342 |
+
|
| 343 |
+
$$
|
| 344 |
+
\begin{array} { r l } & { \mathbf { I } _ { 1 } ( t ) : = \sum _ { k = 1 } ^ { t } \frac { 1 - \lambda } { \eta _ { k } } \left( \mathbb { E } \left[ \mathcal { L } ( \pmb { \theta } _ { k } ) \right] - \mathbb { E } \left[ \mathcal { L } ( \pmb { \theta } _ { k + 1 } ) \right] \right) } \\ & { \mathbf { I } _ { 2 } ( t ) : = - \sum _ { k = 1 } ^ { t } \mathbb { E } \left. \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \big | ( 1 - \lambda ) \sum _ { m = 1 } ^ { \tau _ { k } } \lambda ^ { \tau _ { k } - m } \cdot \Big ( g _ { k } ^ { ( m ) } - \mathbb { E } _ { Z \sim \Pi _ { \tilde { \theta } _ { k } } } \left[ g _ { \delta _ { k } } ( \pmb { \theta } _ { k } ; \boldsymbol { u } _ { k } , Z ) \right] \Big ) \right. } \\ & { \mathbf { I } _ { 3 } ( t ) : = - \sum _ { k = 1 } ^ { t } \mathbb { E } \left. \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \big | ( 1 - \lambda ) \left( \sum _ { m = 1 } ^ { \tau _ { k } } \lambda ^ { \tau _ { k } - m } \nabla \mathcal { L } _ { \delta _ { k } } ( \pmb { \theta } _ { k } ) \right) - \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \right. } \\ & { \mathbf { I } _ { 4 } ( t ) : = \frac { L ( 1 - \lambda ) } { 2 } \sum _ { k = 1 } ^ { t } \eta _ { k } \mathbb { E } \left\| \sum _ { m = 1 } ^ { \tau _ { k } } \lambda ^ { \tau _ { k } - m } g _ { k } ^ { ( m ) } \right\| ^ { 2 } } \end{array}
|
| 345 |
+
$$
|
| 346 |
+
|
| 347 |
+
215 The lemma is achieved through the standard descent lemma implied by Assumption 3.1 and decom
|
| 348 |
+
216 posing the upper bound on $| | \mathbf { \check { V } } \mathcal { L } ( \pmb { \theta } _ { k } ) | | ^ { 2 }$ into respectful terms; see the proof in Appendix A. Among
|
| 349 |
+
217 the terms on the right hand side of (13), we note that ${ \bf I } _ { 1 } ( t ) , { \bf I } _ { 3 } ( t )$ and ${ \mathbf I } _ { 4 } ( t )$ arises directly from
|
| 350 |
+
218 Assumption 3.1, while ${ \bf I } _ { 2 } ( t )$ comes from bounding the noise terms due to Markovian data.
|
| 351 |
+
219 We bound the four components in Lemma 4.1 as follows. For simplicity, we denote $A ( t ) : =$
|
| 352 |
+
220 $\begin{array} { r } { \frac { 1 } { 1 + t } \sum _ { k = 0 } ^ { t } \mathbb { E } \left. \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \right. ^ { 2 } } \end{array}$ . Among the four terms, we highlight that the main challenge lies on
|
| 353 |
+
221 obtaining a tight bound for ${ \bf I } _ { 2 } ( t )$ . Observe that
|
| 354 |
+
|
| 355 |
+
$$
|
| 356 |
+
\mathbf { I } _ { 2 } ( t ) \leq ( 1 - \lambda ) \mathbb { E } \left[ \sum _ { k = 0 } ^ { t } \| \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \| \cdot \bigg \| \sum _ { m = 1 } ^ { \tau _ { k } } \lambda ^ { \tau _ { k } - m } \Delta _ { k , m } \bigg \| \right]
|
| 357 |
+
$$
|
| 358 |
+
|
| 359 |
+
222 where ${ \Delta _ { k , m } } { \stackrel { \mathrm { d e f } } { = } } \mathbb { E } _ { \mathcal { F } ^ { k - 1 } } [ { g _ { k } ^ { ( m ) } } - \mathbb { E } _ { Z \sim \Pi _ { \tilde { \theta } _ { k } } } g _ { k } ( \pmb { \theta } _ { k } ; \boldsymbol { u } _ { k } , Z ) ]$ . There are two sources of bias in $\Delta _ { k , m }$ : one is
|
| 360 |
+
223 the noise induced by drifting of decision variable in every epoch, the other is the bias that depends
|
| 361 |
+
224 on the mixing time of Markov kernel. To control these biases, we are inspired by the proof of $\mathrm { W u }$
|
| 362 |
+
225 et al., 2020, Theorem 4.7) to introduce a reference Markov chain $\tilde { Z } _ { k } ^ { ( \ell ) }$ , $\ell = 0 , . . . , \tau _ { k }$ , whose decision
|
| 363 |
+
variables remains fixed for a period of length 226 $\tau _ { k }$ and is initialized with $\tilde { Z } _ { k } ^ { ( 0 ) } = Z _ { k } ^ { ( 0 ) }$ :
|
| 364 |
+
|
| 365 |
+
$$
|
| 366 |
+
\tilde { Z } _ { k } ^ { ( 0 ) } \ \xrightarrow { \check { \theta } _ { k } } \ \tilde { Z } _ { k } ^ { ( 1 ) } \ \xrightarrow { \check { \theta } _ { k } } \ \tilde { Z } _ { k } ^ { ( 2 ) } \ \xrightarrow { \check { \theta } _ { k } } \ \tilde { Z } _ { k } ^ { ( 3 ) } \ \cdot \ \cdot \ \xrightarrow { \check { \theta } _ { k } } \ \tilde { Z } _ { k } ^ { ( \tau _ { k } ) }
|
| 367 |
+
$$
|
| 368 |
+
|
| 369 |
+
227 and we recall that the actual chain in the algorithm evolves as
|
| 370 |
+
|
| 371 |
+
$$
|
| 372 |
+
Z _ { k } ^ { ( 0 ) } \ { \xrightarrow { \breve { \theta } _ { k + 1 } ^ { ( 0 ) } } } Z _ { k } ^ { ( 1 ) } \ { \xrightarrow { \breve { \theta } _ { k + 1 } ^ { ( 1 ) } } } Z _ { k } ^ { ( 2 ) } \cdots { \xrightarrow { \breve { \theta } _ { k + 1 } ^ { ( \tau _ { k } - 1 ) } } } Z _ { k } ^ { ( \tau _ { k } ) } .
|
| 373 |
+
$$
|
| 374 |
+
|
| 375 |
+
228 With the help of the reference chain, we decompose $\Delta _ { k , m }$ into
|
| 376 |
+
|
| 377 |
+
$$
|
| 378 |
+
\begin{array} { r l } & { \Delta _ { k , m } = \mathbb { E } _ { \mathcal { F } ^ { k - 1 } } \left[ \frac { d } { \delta _ { k } } \left( \mathbb { E } [ \ell ( \tilde { \theta } _ { k } ^ { ( m ) } ; Z _ { k } ^ { ( m ) } ) | \tilde { \theta } _ { k } ^ { ( m ) } , Z _ { k } ^ { ( 0 ) } ] - \mathbb { E } _ { \tilde { Z } _ { k } ^ { ( m ) } } [ \ell ( \tilde { \theta } _ { k } ^ { ( m ) } ; \tilde { Z } _ { k } ^ { ( m ) } ) | \tilde { \theta } _ { k } ^ { ( m ) } , \tilde { Z } _ { k } ^ { ( 0 ) } ] \right) u _ { k } \right] } \\ & { \qquad + \mathbb { E } _ { \mathcal { F } ^ { k - 1 } } \left[ \frac { d } { \delta _ { k } } \left( \mathbb { E } _ { \tilde { Z } _ { k } ^ { ( m ) } } [ \ell ( \tilde { \theta } _ { k } ^ { ( m ) } ; \tilde { Z } _ { k } ^ { ( m ) } ) | \tilde { \theta } _ { k } ^ { ( m ) } , \tilde { Z } _ { k } ^ { ( 0 ) } ] - \mathbb { E } _ { Z \sim \Pi _ { \tilde { \theta } _ { k } } } [ \ell ( \tilde { \theta } _ { k } ^ { ( m ) } ; Z ) | \tilde { \theta } _ { k } ^ { ( m ) } ] \right) u _ { k } \right] } \\ & { \qquad + \mathbb { E } _ { \mathcal { F } ^ { k - 1 } } \frac { d } { \delta _ { k } } \mathbb { E } _ { Z \sim \Pi _ { \tilde { \theta } _ { k } } } \left[ \ell ( \tilde { \theta } _ { k } ^ { ( m ) } ; Z ) - \ell ( \tilde { \theta } _ { k } ; Z ) | \tilde { \theta } _ { k } ^ { ( m ) } , \tilde { \theta } _ { k } \right] u _ { k } : = A _ { 1 } + A _ { 2 } + A _ { 3 } } \end{array}
|
| 379 |
+
$$
|
| 380 |
+
|
| 381 |
+
229 We remark that $A _ { 1 }$ reflects the drift of (16) from initial sample $Z _ { k } ^ { ( 0 ) }$ driven by varying $\check { \pmb { \theta } } _ { k } ^ { ( m ) }$ , $A _ { 2 }$
|
| 382 |
+
230 captures the statistical discrepancy between above two Markov chains (16) and (15) at same step $m$ ,
|
| 383 |
+
231 and $A _ { 3 }$ captures the drifting gap between $\check { \pmb { \theta } } _ { k }$ and $\check { \pmb { \theta } } _ { k } ^ { ( m ) }$ . Applying Assumption 3.3, $A _ { 1 }$ and $A _ { 2 }$ can be
|
| 384 |
+
232 upper bounded with the smoothness and geometric mixing property of Markov kernel. In addition,
|
| 385 |
+
233 $A _ { 3 }$ can be upper bounded using Lipschitz condition on (stationary) distribution map $\Pi _ { \theta }$ . Finally, the
|
| 386 |
+
234 forgetting factor $\lambda$ helps to control $\lVert \check { \pmb { \theta } } _ { k } ^ { ( \cdot ) } - \check { \pmb { \theta } } _ { k } \rVert$ to be at the same order of a single update. Therefore,
|
| 387 |
+
235 $\| \Delta _ { k , m } \|$ can be controlled by an upper bound relying on $\lambda , \rho , L$ .
|
| 388 |
+
|
| 389 |
+
The following lemma summarizes the above results as well as the bounds on the other terms:
|
| 390 |
+
|
| 391 |
+
Lemma 4.2. Under Assumption 3.2, 3.3, 3.4 and 3.5, with $\eta _ { t + 1 } = \eta _ { 0 } ( 1 + t ) ^ { - \alpha }$ , $\delta _ { t + 1 } = \delta _ { 0 } ( 1 + t ) ^ { - \beta }$ and $\alpha \in ( 0 , 1 )$ , $\beta \in ( 0 , \frac { 1 } { 2 } )$ . Suppose that $0 < 2 \alpha - 4 \beta < 1$ and
|
| 392 |
+
|
| 393 |
+
$$
|
| 394 |
+
\tau _ { k } \geq \frac { 1 } { \log { 1 / \operatorname* { m a x } \{ \rho , \lambda \} } } \left( \log ( 1 + k ) + \operatorname* { m a x } \{ \log \frac { \delta _ { 0 } } { d } , 0 \} \right) .
|
| 395 |
+
$$
|
| 396 |
+
|
| 397 |
+
239 Then, it holds that
|
| 398 |
+
|
| 399 |
+
$$
|
| 400 |
+
\begin{array} { l } { \displaystyle \mathbf I _ { 2 } ( t ) \le \frac { c _ { 2 } d ^ { 5 / 2 } } { ( 1 - \lambda ) ^ { 2 } } \mathcal { A } ( t ) ^ { \frac 1 2 } ( 1 + t ) ^ { 1 - ( \alpha - 2 \beta ) } , \forall t \ge \operatorname* { m a x } \{ t _ { 1 } , t _ { 2 } \} } \\ { \displaystyle \mathbf I _ { 1 } ( t ) \le c _ { 1 } ( 1 - \lambda ) ( 1 + t ) ^ { \alpha } , \mathbf I _ { 3 } ( t ) \le c _ { 3 } \mathcal { A } ( t ) ^ { \frac 1 2 } ( 1 + t ) ^ { 1 - \beta } , \mathbf I _ { 4 } ( t ) \le \frac { c _ { 4 } d ^ { 2 } } { 1 - \lambda } ( 1 + t ) ^ { 1 - ( \alpha - 2 \beta ) } , } \end{array}
|
| 401 |
+
$$
|
| 402 |
+
|
| 403 |
+
240 where $t _ { 1 } , t _ { 2 }$ are defined in (25), (26), and $c _ { 1 } , c _ { 2 } , c _ { 3 } , c _ { 4 }$ are constants defined as follows:
|
| 404 |
+
|
| 405 |
+
$$
|
| 406 |
+
\begin{array} { l } { { c _ { 1 } : = 2 G / \eta _ { 0 } , ~ c _ { 2 } : = \displaystyle \frac { \eta _ { 0 } } { \delta _ { 0 } ^ { 2 } } \frac { 6 \cdot \left( L _ { 1 } G ^ { 2 } + L _ { 2 } G ^ { 2 } + \sqrt { L } G ^ { 3 / 2 } \right) } { \sqrt { 1 - 2 \alpha + 4 \beta } } , } } \\ { { c _ { 3 } : = \displaystyle \frac { 2 } { \sqrt { 1 - 2 \beta } } \operatorname* { m a x } \{ L \delta _ { 0 } , G \sqrt { 1 - \beta } \} , ~ c _ { 4 } : = \displaystyle \frac { \eta _ { 0 } } { \delta _ { 0 } ^ { 2 } } \cdot \frac { L G ^ { 2 } } { 2 \beta - \alpha + 1 } . } } \end{array}
|
| 407 |
+
$$
|
| 408 |
+
|
| 409 |
+
241 See Appendix B for the proof. We comment that the bound for $\mathbf { I } _ { 4 } ( t )$ cannot be improved. As a
|
| 410 |
+
242 concrete example, consider the constant function $\ell ( \pmb \theta ; z ) = \mathrm { c } \neq 0$ for all $z \in { \mathbb { Z } }$ , it can be shown that
|
| 411 |
+
243 $\| g _ { k } ^ { ( m ) } \| ^ { 2 } = \mathrm { c } ^ { 2 }$ and consequently $\mathbf { I } _ { 4 } ( t ) = \Omega ( \eta _ { k } / \delta _ { k } ^ { 2 } ) = \Omega ( t ^ { 1 - ( \alpha - 2 \beta ) } )$ , which matches (18). Finally,
|
| 412 |
+
244 plugging Lemma 4.2 into Lemma 4.1 gives:
|
| 413 |
+
|
| 414 |
+
$$
|
| 415 |
+
A ( t ) \leq \frac { c _ { 1 } ( 1 - \lambda ) } { ( 1 + t ) ^ { 1 - \alpha } } + \frac { c _ { 2 } d ^ { 5 / 2 } } { ( 1 - \lambda ) ^ { 2 } } \frac { A ( t ) ^ { \frac { 1 } { 2 } } } { ( 1 + t ) ^ { \alpha - 2 \beta } } + c _ { 3 } \frac { A ( t ) ^ { \frac { 1 } { 2 } } } { ( 1 + t ) ^ { \beta } } + c _ { 4 } \frac { d ^ { 2 } } { 1 - \lambda } \frac { 1 } { ( 1 + t ) ^ { \alpha - 2 \beta } } .
|
| 416 |
+
$$
|
| 417 |
+
|
| 418 |
+
245 Since $\mathbf { \mathcal { A } } ( t ) \geq 0$ , the above is a quadratic inequality that implies the following bound:
|
| 419 |
+
|
| 420 |
+
Lemma 4.3. Under Assumption 3.1–3.5, with the step sizes 246 $\eta _ { t + 1 } = \eta _ { 0 } ( 1 + t ) ^ { - \alpha }$ , $\delta _ { t + 1 } = \delta _ { 0 } ( 1 +$ 247 $\begin{array} { r } { t ) ^ { - \beta } , \tau _ { k } \geq \frac { 1 } { \log { 1 / \operatorname* { m a x } \{ \rho , \lambda \} } } \left( \log ( 1 + k ) + \operatorname* { m a x } \{ \log \frac { \delta _ { 0 } } { d } , 0 \} \right) , \eta _ { 0 } = d ^ { - 2 / 3 } } \end{array}$ $\eta _ { 0 } ~ = ~ d ^ { - 2 / 3 } , \delta _ { 0 } ~ = ~ d ^ { 1 / 3 }$ , $\alpha \in ( 0 , 1 )$ 248 $\beta \in ( 0 , \textstyle { \frac { 1 } { 2 } } )$ . If $2 \alpha - 4 \beta < 1$ , then there exists a constant $t _ { 0 }$ such that the iterates $\{ \pmb { \theta } _ { k } \} _ { k \ge 0 }$ satisfies
|
| 421 |
+
|
| 422 |
+
$$
|
| 423 |
+
\frac { 1 } { 1 + T } \sum _ { k = 0 } ^ { T } \mathbb { E } \left\| \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \right\| ^ { 2 } \leq 1 2 \operatorname* { m a x } \{ c _ { 5 } ( 1 - \lambda ) , c _ { 6 } , \frac { c _ { 7 } } { 1 - \lambda } \} d ^ { 2 / 3 } T ^ { - \operatorname* { m i n } \{ 2 \beta , 1 - \alpha , \alpha - 2 \beta \} } , \forall T \geq t _ { 0 } .
|
| 424 |
+
$$
|
| 425 |
+
|
| 426 |
+
249 Optimizing the step size exponents $\alpha , \beta$ in the above concludes the proof of Theorem 3.1.
|
| 427 |
+
|
| 428 |
+
251 We conclude by discussing two alternative zero-th order gradient estimators to (4), and argue that
|
| 429 |
+
252 they do not improve over the sample complexity in the proposed DFO $( \lambda )$ algorithm. We study:
|
| 430 |
+
|
| 431 |
+
$$
|
| 432 |
+
\begin{array} { r } { g _ { 2 \mathrm { p t } - 1 } : = \frac { d } { \delta } \left[ \ell \left( \theta + \delta u ; Z \right) - \ell ( \theta ; Z ) \right] u , \quad g _ { 2 \mathrm { p t } - 1 1 } : = \frac { d } { \delta } \left[ \ell \left( \theta + \delta u ; Z _ { 1 } \right) - \ell ( \theta ; Z _ { 2 } ) \right] u , } \end{array}
|
| 433 |
+
$$
|
| 434 |
+
|
| 435 |
+
53 where $\pmb { u } \sim \mathrm { U n i f } ( \mathbb { S } ^ { \mathsf { d } - 1 } )$ . For ease of illustration, we assume that the samples $Z , Z _ { 1 } , Z _ { 2 }$ are drawn
|
| 436 |
+
254 directly from the stationary distributions $Z \sim \Pi _ { \pmb { \theta } + \delta \pmb { u } } , Z _ { 1 } \sim \Pi _ { \pmb { \theta } + \delta \pmb { u } } , Z _ { 2 } \sim \overset { \cdot } { \Pi } _ { \pmb { \theta } }$ .
|
| 437 |
+
255 We recall from $\ S$ that the estimator $\mathbf { \sigma } _ { g _ { 2 } \mathsf { p t } - 1 }$ is a finite difference approximation of the directional
|
| 438 |
+
256 derivative of objective function along the randomized direction $\textbf { \em u }$ , as proposed in Nesterov &
|
| 439 |
+
257 Spokoiny (2017); Ghadimi & Lan (2013). For non-convex stochastic optimization with decision
|
| 440 |
+
258 independent sample distribution, i.e., $\Pi _ { \pmb { \theta } } \equiv \bar { \Pi }$ for all $\pmb \theta$ , the DFO algorithm based on $\mathbf { \sigma } _ { g _ { 2 } \mathsf { p t } - 1 }$ is
|
| 441 |
+
259 known to admit an optimal sample complexity of $\mathcal { O } ( 1 / \epsilon ^ { 2 } )$ (Jamieson et al., 2012). Note that
|
| 442 |
+
260 $\mathbb { E } _ { u \sim \mathrm { U n i f } ( \mathbb { S } ^ { d - 1 } ) , Z \sim \bar { \Pi } } [ \ell ( \pmb { \theta } ; Z ) \pmb { u } ] = \mathbf { 0 }$ . However, in the case of decision-dependent sample distribution
|
| 443 |
+
261 as in (1), $\mathbf { \sigma } _ { g _ { 2 } \mathsf { p t } - 1 }$ would become a biased estimator since the sample $Z$ is drawn from $\prod _ { \pm \delta u }$ which
|
| 444 |
+
262 depends on $\textbf { \em u }$ . The DFO algorithm based on $\mathbf { \sigma } _ { g _ { 2 } \mathsf { p t } - 1 }$ may not converge to a stationary solution of (1).
|
| 445 |
+
263 A remedy to handle the above issues is to consider the estimator $\mathbf { \sigma } _ { g _ { 2 } \mathsf { p t } - 1 \mathsf { l } }$ which utilizes two samples
|
| 446 |
+
264 $Z _ { 1 } , Z _ { 2 }$ , each independently drawn at a different decision variable, to form the gradient estimate. In
|
| 447 |
+
265 fact, it can be shown that $\vec { \mathbb { E } } [ g _ { 2 \mathsf { p t } - 1 1 } ] = \nabla \mathcal { L } _ { \delta } ( \pmb { \theta } )$ yields an unbiased gradient estimator. However, due
|
| 448 |
+
266 to the decoupled random samples $Z _ { 1 } , Z _ { 2 }$ , we have
|
| 449 |
+
|
| 450 |
+
$$
|
| 451 |
+
\begin{array} { r l } & { \displaystyle \mathbb { E } \left\| g _ { 2 \mathrm { p t } - 1 1 } \right\| ^ { 2 } = \mathbb { E } \left[ \big ( \ell \left( \theta + \delta u ; Z _ { 1 } \right) - \ell ( \theta ; Z _ { 1 } ) + \ell ( \theta ; Z _ { 1 } ) - \ell ( \theta ; Z _ { 2 } ) \big ) ^ { 2 } \right] \frac { d ^ { 2 } } { \delta ^ { 2 } } } \\ & { \displaystyle \overset { ( a ) } { \geq } \mathbb { E } \left[ \frac { 3 } { 4 } \big ( \ell ( \theta ; Z _ { 1 } ) - \ell ( \theta ; Z _ { 2 } ) \big ) ^ { 2 } - 3 \big ( \ell ( \theta + \delta u ; Z _ { 1 } \big ) - \ell ( \theta ; Z _ { 1 } ) \big ) ^ { 2 } \right] \frac { d ^ { 2 } } { \delta ^ { 2 } } } \\ & { \displaystyle = \frac { 3 } { 2 } \mathsf { V a r } [ \ell ( \theta ; Z ) ] \frac { d ^ { 2 } } { \delta ^ { 2 } } - 3 \mathbb { E } \left[ \big ( \ell \left( \theta + \delta u ; Z _ { 1 } \right) - \ell ( \theta ; Z _ { 1 } ) \big ) ^ { 2 } \right] \frac { d ^ { 2 } } { \delta ^ { 2 } } \geq \frac { 3 } { 2 } \frac { \sigma ^ { 2 } d ^ { 2 } } { \delta ^ { 2 } } - 3 \mu ^ { 2 } d ^ { 2 } = \Omega ( 1 / \delta ^ { 2 } ) . } \end{array}
|
| 452 |
+
$$
|
| 453 |
+
|
| 454 |
+
267 where in (a) we use the fact that $( x + y ) ^ { 2 } \ \geq \ { \frac { 3 } { 4 } } x ^ { 2 } - 3 y ^ { 2 }$ , in (b) we assume $\mathsf { V a r } [ \ell ( \pmb { \theta } ; Z ) ] : =$
|
| 455 |
+
268 $\begin{array} { r } { \mathbb { E } \left( \ell ( \pmb { \theta } ; Z ) - \mathcal { L } ( \pmb { \theta } ) \right) ^ { 2 } \ge \sigma ^ { 2 } > 0 } \end{array}$ and $\ell ( \pmb \theta ; z )$ is $\mu$ -Lipschitz in $\pmb \theta$ . As such, this two-point gradi
|
| 456 |
+
269 ent estimator does not reduce the variance when compared with the estimator in (4). Note that a
|
| 457 |
+
270 two-sample estimator also incurs additional sampling overhead in the scenario of Markovian samples.
|
| 458 |
+
|
| 459 |
+
# 5 Numerical Experiments
|
| 460 |
+
|
| 461 |
+
We examine the efficacy of the DFO $( \lambda )$ algorithm on a few toy examples by comparing DFO $( \lambda )$ with a simple stochastic gradient descent scheme with greedy deployment. Unless otherwise specified, we use the step size choices in (8) for DFO $( \lambda )$ . All experiments are conducted on a server with an Intel Xeon 6318 CPU using Python 3.7. To measure performance, we record the gradient norm $\| \nabla { \mathcal { L } } ( \pmb { \theta } ) \|$ and estimate its expected value using at least 8 trials.
|
| 462 |
+
|
| 463 |
+
1-Dimensional Case: Quadratic Loss. The first example considers a scalar quadratic loss function $\ell : \mathbb { R } \times \mathbb { R } \to \mathbb { R }$ defined by $\begin{array} { r } { \ell ( \pmb { \theta } ; z ) = \frac { 1 } { 1 2 } z \pmb { \theta } ( 3 \pmb { \theta } ^ { 2 } - 8 \pmb { \hat { \theta } } - 4 8 ) } \end{array}$ . To simulate the controlled Markov chain scenario, the samples are generated dynamically according to an auto-regressive (AR) process $Z _ { t + 1 } = ( 1 - \gamma ) Z _ { t } + \gamma \bar { Z } _ { t + 1 }$ with $\begin{array} { r } { \bar { Z } _ { t + 1 } \sim \mathcal { N } ( \pmb { \theta } , \frac { ( 2 - \gamma ) } { \gamma } \sigma ^ { 2 } ) } \end{array}$ with parameter $\gamma \in ( 0 , 1 )$ . Note that the stationary distribution of the AR process is $\Pi _ { \pmb \theta } = \mathcal { N } ( \pmb \theta , \sigma ^ { 2 } )$ . As such, the performative risk function in this case is $\begin{array} { r } { \mathcal { L } ( \pmb { \theta } ) = \mathbb { E } _ { Z \sim \Pi _ { \pmb { \theta } } } \left[ \ell ( \pmb { \theta } ; Z ) \right] = \frac { \pmb { \theta } ^ { 2 } } { 1 2 } ( \pmb { \theta } ^ { 2 } - 8 \pmb { \theta } - 4 8 ) } \end{array}$ , which is quartic in $\pmb \theta$ . Note that $\mathcal { L } ( \pmb { \theta } )$ is not convex in $\pmb \theta$ and the set of stationary solution is $\{ \pmb \theta : \nabla \mathcal { L } ( \pmb \theta ) = 0 \} \overset { - } { = } \{ 4 , 0 , - 2 \}$ , among which the optimal solution is $\pmb { \theta } _ { P O } = \arg \operatorname* { m i n } _ { \pmb { \theta } } \mathcal { L } ( \pmb { \theta } ) = 4$ .
|
| 464 |
+
|
| 465 |
+
In our experiments below, we initialize all the algorithms are initialized by $\theta _ { 0 } = 6$ . In Figure 1 (left), we compare the norms of the gradient for performative risk with pure DFO (no burn-in), the $\tt D F O ( \lambda )$ algorithm, and stochastic gradient descent with greedy deployment scheme (SGD-GD) against the number of samples observed by the algorithms. We first observe from Figure 1 (left) that pure DFO and SGD-GD methods do not converge to a stationary point to $\mathcal { L } ( \pmb { \theta } )$ even after more samples
|
| 466 |
+
|
| 467 |
+

|
| 468 |
+
Figure 1: (left) One Dimension Quadratic Minimization problem with samples generated by AR distribution model where regressive parameter $\gamma = 0 . 5$ . (middle) Markovian Pricing Problem with $d = 5$ dimension. (right) Linear Regression problem based on AR distribution model $( \gamma = 0 . 5 )$ ).
|
| 469 |
+
|
| 470 |
+
290 are observed. On the other hand, DFO $( \lambda )$ converges to a stationary point of $\mathcal { L } ( \pmb { \theta } )$ at the rate of
|
| 471 |
+
291 $\| \nabla \mathcal { L } ( \pmb { \theta } ) \| ^ { 2 } = \mathcal { O } ( 1 / S ^ { 0 . 3 6 } )$ , matching Theorem 3.1 that predicts a rate of $\mathcal { O } ( 1 / S ^ { 1 / 3 } )$ , where $S$ is the
|
| 472 |
+
292 total number of samples observed.
|
| 473 |
+
293 Besides, we observe that with large $\lambda = 0 . 7 5$ , DFO $( \lambda )$ converges at a faster rate at the beginning (i.e.,
|
| 474 |
+
294 transient phase), but the convergence rate slows down at the steady phase (e.g., when no. of samples
|
| 475 |
+
295 observed is greater than $1 0 ^ { 6 }$ ) compared to running the same algorithm with smaller $\lambda$ .
|
| 476 |
+
|
| 477 |
+
Higher Dimension Case: Markovian Pricing. The second example examines a multi-dimensional $\mathrm { { } } d = 5$ ) pricing problem similar to (Izzo et al., 2021, Sec. 5.2). The decision variable $\pmb \theta \in \mathbb { R } ^ { 5 }$ denotes the prices of $d = 5$ goods and $\kappa$ is a drifting parameter for the prices. Our goal is to maximize the average revenue $\mathbb { E } _ { Z \sim \Pi _ { \pmb { \theta } } } [ \ell ( \pmb { \theta } ; Z ) ]$ with $\ell ( \pmb { \theta } ; z ) = - \langle \pmb { \theta } | z \rangle$ , where $\Pi _ { \pmb \theta } \equiv \tilde { \mathcal { N } } ( \pmb \mu _ { 0 } - \kappa \pmb \theta , \sigma ^ { 2 } \pmb I )$ is the unique stationary distribution of the Markov process (i.e., an AR process)
|
| 478 |
+
|
| 479 |
+
Note that in this case, the performative optimal solution is $\theta _ { P O } = \mathrm { a r g } \operatorname* { m i n } _ { \theta } \mathcal { L } ( \theta ) = \mu _ { 0 } / ( 2 \kappa )$
|
| 480 |
+
|
| 481 |
+
302 We set $\gamma = 0 . 5 , \sigma = 5$ , drifting parameter $\kappa = 0 . 5$ , initial mean of non-shifted distribution
|
| 482 |
+
303 $\pmb { \mu } _ { 0 } = \left[ - 2 , 2 , - 2 , 2 , - 2 \right] ^ { \top }$ . All the algorithms are initialized by $\pmb { \theta } _ { 0 } = \left[ 2 , - 2 , 2 , - 2 , 2 \right] ^ { \top }$ . We simulate
|
| 483 |
+
304 the convergence behavior for different algorithms in Figure 1 (middle). Observe that the differences
|
| 484 |
+
305 between the DFO $( \lambda )$ algorithms with different $\lambda$ becomes less significant than Figure 1 (left).
|
| 485 |
+
306 Markovian Performative Regression. The last example considers the linear regression problem
|
| 486 |
+
307 in (Nagaraj et al., 2020) which is a prototype problem for studying stochastic optimization with
|
| 487 |
+
308 Markovian data (e.g., reinforcement learning). Unlike the previous examples, this problem involves a
|
| 488 |
+
309 pair of correlated r.v.s that follows a decision-dependent joint distribution. We adopt a setting similar
|
| 489 |
+
310 to the regression example in (Izzo et al., 2021), where $( { \bar { X } } , Y ) \sim \Pi _ { \theta }$ with $X \sim \hat { \mathcal { N } } ( 0 , \sigma _ { 1 } ^ { 2 } I ) , \mathsf { Y } | X \sim$
|
| 490 |
+
311 $\mathcal { N } \left( \langle \beta ( \pmb { \theta } ) | X \rangle , \sigma _ { 2 } ^ { 2 } \right)$ , $\beta ( \pmb \theta ) = { { a } _ { 0 } } + { { a } _ { 1 } } \pmb \theta$ . The loss function is $\begin{array} { r } { \ell ( \pmb { \theta } ; x , y ) = ( \left. x \mid \pmb { \theta } \right. - y ) ^ { 2 } + \frac { \mu } { 2 } \left\| \pmb { \theta } \right\| ^ { 2 } } \end{array}$ .
|
| 491 |
+
312 In this case, the performative risk is:
|
| 492 |
+
|
| 493 |
+
$$
|
| 494 |
+
\begin{array} { r } { \boldsymbol { : } ( \pmb { \theta } ) = \mathbb { E } _ { \Pi _ { \theta } } \left[ \ell ( \pmb { \dot { \theta } } ; X , Y ) \right] = \left( \sigma _ { 1 } ^ { 2 } a _ { 1 } ^ { 2 } - 2 \sigma _ { 1 } ^ { 2 } a _ { 1 } + \sigma _ { 1 } ^ { 2 } + \frac { \mu } { 2 } \right) \left. \pmb { \theta } \right. ^ { 2 } - 2 \sigma _ { 1 } ^ { 2 } ( 1 - a _ { 1 } ) \pmb { \theta } ^ { \top } a _ { 0 } + \sigma _ { 1 } ^ { 2 } \left. \mathbf { a } _ { 0 } \right. ^ { 2 } + \sigma _ { 2 } ^ { 2 } , } \end{array}
|
| 495 |
+
$$
|
| 496 |
+
|
| 497 |
+
313 For simplicity, we assume $\sigma _ { 1 } ^ { 2 } ( 1 - a _ { 1 } ) = \sigma _ { 1 } ^ { 2 } a _ { 1 } ^ { 2 } - 2 \sigma _ { 1 } ^ { 2 } a _ { 1 } + \sigma _ { 1 } ^ { 2 } + \mu / \underset { } { 2 }$ , from which we can deduce
|
| 498 |
+
314 ${ \pmb \theta } _ { P O } = { \bf \bar { a } } _ { 0 }$ . In this experiment, we consider Markovian samples $( \tilde { X _ { t } } , \tilde { Y _ { t } } ) _ { t = 1 } ^ { T }$ drawn from an AR
|
| 499 |
+
315 process:
|
| 500 |
+
|
| 501 |
+
$$
|
| 502 |
+
\begin{array} { r l } & { ( { \tilde { X } } _ { t } , { \tilde { Y } } _ { t } ) = ( 1 - \gamma ) ( { \tilde { X } } _ { t - 1 } , { \tilde { Y } } _ { t - 1 } ) + \gamma ( X _ { t } , Y _ { t } ) , } \\ & { X _ { t } \sim { \mathcal { N } } ( 0 , \frac { 2 - \gamma } { \gamma } \sigma _ { 1 } ^ { 2 } I ) , Y _ { t } | X _ { t } \sim { \mathcal { N } } ( \langle X _ { t } | \beta ( \pmb { \theta } _ { t - 1 } ) \rangle , \frac { 2 - \gamma } { \gamma } \sigma _ { 2 } ^ { 2 } ) , } \end{array}
|
| 503 |
+
$$
|
| 504 |
+
|
| 505 |
+
316 for any $t \geq 1$ . We set $d \ = \ 5$ , $a _ { 0 } ~ = ~ [ - 1 , 1 , - 1 , 1 , - 1 ] ^ { \top }$ , $a _ { 1 } \ = \ 0 . 5 , \sigma _ { 1 } ^ { 2 } \ = \ \sigma _ { 2 } ^ { 2 } \ = \ 1$ , regu
|
| 506 |
+
317 larization parameter $\mu = 0 . 5$ , mixing parameter $\gamma = 0 . 1$ . The algorithms are initialized with
|
| 507 |
+
318 $\pmb { \theta } _ { 0 } = [ 1 , - 1 , 1 , - 1 , 1 ] ^ { \top }$ . Figure 1 (right) shows the result of the simulation. Similar to the previous
|
| 508 |
+
319 examples, we observe that pure DFO and SGD fail to find a stationary solution to $\mathcal { L } ( \pmb \theta )$ . Meanwhile,
|
| 509 |
+
320 DFO $( \lambda )$ converges to a stationary solution after a reasonable number of samples are observed.
|
| 510 |
+
321 Conclusions. We have described a derivative-free optimization approach for finding a stationary
|
| 511 |
+
322 point of the performative risk function. In particular, we consider a non-i.i.d. data setting with
|
| 512 |
+
323 samples generated from a controlled Markov chain and propose a two-timescale step sizes approach
|
| 513 |
+
324 in constructing the gradient estimator. The proposed DFO $( \lambda )$ algorithm is shown to converge to a
|
| 514 |
+
325 stationary point of the performative risk function at the rate of $\mathcal { O } ( 1 / T ^ { 1 / 3 } )$ .
|
| 515 |
+
|
| 516 |
+
326 References
|
| 517 |
+
327 Agarwal, A., Dekel, O., and Xiao, L. Optimal algorithms for online convex optimization with multi-point bandit feedback. In Annual Conference Computational Learning Theory, 2010.
|
| 518 |
+
329 Brown, G., Hod, S., and Kalemaj, I. Performative prediction in a stateful world. In International Conference on Artificial Intelligence and Statistics, pp. 6045–6061. PMLR, 2022. Doan, T. T. Finite-time analysis of markov gradient descent. IEEE Transactions on Automatic Control, 2022. Dong, J., Roth, A., Schutzman, Z., Waggoner, B., and Wu, Z. S. Strategic classification from revealed preferences. In Proceedings of the 2018 ACM Conference on Economics and Computation, pp. 55–70, 2018.
|
| 519 |
+
336 Drusvyatskiy, D. and Xiao, L. Stochastic optimization with decision-dependent distributions. Mathematics of Operations Research, 2022. Flaxman, A. D., Kalai, A. T., and McMahan, H. B. Online convex optimization in the bandit setting: Gradient descent without a gradient. In Proceedings of the Sixteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA ’05, pp. 385–394, USA, 2005. Society for Industrial and Applied Mathematics. ISBN 0898715857. Ghadimi, S. and Lan, G. Stochastic first- and zeroth-order methods for nonconvex stochastic programming, 2013. URL https://arxiv.org/abs/1309.5549. Hardt, M., Megiddo, N., Papadimitriou, C., and Wootters, M. Strategic classification. In Proceedings of the 2016 ACM conference on innovations in theoretical computer science, pp. 111–122, 2016. Izzo, Z., Ying, L., and Zou, J. How to learn when data reacts to your model: Performative gradient descent. In Meila, M. and Zhang, T. (eds.), Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 4641–4650. PMLR, 18–24 Jul 2021. URL https://proceedings.mlr.press/v139/izzo21a.html. Izzo, Z., Zou, J., and Ying, L. How to learn when data gradually reacts to your model. In International Conference on Artificial Intelligence and Statistics, pp. 3998–4035. PMLR, 2022. Jamieson, K. G., Nowak, R., and Recht, B. Query complexity of derivative-free optimization. In Pereira, F., Burges, C., Bottou, L., and Weinberger, K. (eds.), Advances in Neural Information Processing Systems, volume 25. Curran Associates, Inc., 2012. URL https://proceedings. neurips.cc/paper/2012/file/e6d8545daa42d5ced125a4bf747b3688-Paper.pdf.
|
| 520 |
+
356 Karimi, B., Miasojedow, B., Moulines, E., and Wai, H.-T. Non-asymptotic analysis of biased stochastic approximation scheme. In Conference on Learning Theory, pp. 1944–1974. PMLR, 2019. Li, Q. and Wai, H.-T. State dependent performative prediction with stochastic approximation. In International Conference on Artificial Intelligence and Statistics, pp. 3164–3186. PMLR, 2022.
|
| 521 |
+
361 Mendler-Dunner, C., Perdomo, J., Zrnic, T., and Hardt, M. Stochastic optimization for performative ¨ prediction. Advances in Neural Information Processing Systems, 33:4929–4939, 2020.
|
| 522 |
+
363 Miller, J., Perdomo, J. C., and Zrnic, T. Outside the echo chamber: Optimizing the performative risk. In International Conference on Machine Learning, 2021.
|
| 523 |
+
365 Nagaraj, D., Wu, X., Bresler, G., Jain, P., and Netrapalli, P. Least squares regression with markovian data: Fundamental limits and algorithms. Advances in neural information processing systems, 33: 16666–16676, 2020.
|
| 524 |
+
368 Narang, A., Faulkner, E., Drusvyatskiy, D., Fazel, M., and Ratliff, L. J. Multiplayer performative prediction: Learning in decision-dependent games. arXiv preprint arXiv:2201.03398, 2022.
|
| 525 |
+
370 Nemirovski˘ı, A. S. Problem complexity and method efficiency in optimization. Wiley series in discrete mathematics. Wiley, Chichester, 1983.
|
| 526 |
+
|
| 527 |
+
372 Nesterov, Y. and Spokoiny, V. G. Random gradient-free minimization of convex functions. Founda
|
| 528 |
+
373 tions of Computational Mathematics, 17:527–566, 2017.
|
| 529 |
+
374 Perdomo, J., Zrnic, T., Mendler-Dunner, C., and Hardt, M. Performative prediction. In ¨ International
|
| 530 |
+
375 Conference on Machine Learning, pp. 7599–7609. PMLR, 2020.
|
| 531 |
+
376 Ray, M., Ratliff, L. J., Drusvyatskiy, D., and Fazel, M. Decision-dependent risk minimization
|
| 532 |
+
377 in geometrically decaying dynamic environments. In Proceedings of the AAAI Conference on
|
| 533 |
+
378 Artificial Intelligence, volume 36, pp. 8081–8088, 2022.
|
| 534 |
+
379 Robert, C. P., Casella, G., and Casella, G. Monte Carlo statistical methods, volume 2. Springer, 1999.
|
| 535 |
+
380 Roy, A., Balasubramanian, K., and Ghadimi, S. Projection-free constrained stochastic nonconvex
|
| 536 |
+
381 optimization with state-dependent markov data. In Advances in neural information processing
|
| 537 |
+
382 systems, 2022.
|
| 538 |
+
383 Sun, T. and Li, D. Decentralized markov chain gradient descent. arXiv preprint arXiv:1909.10238,
|
| 539 |
+
384 2019.
|
| 540 |
+
385 Sun, T., Sun, Y., and Yin, W. On markov chain gradient descent. Advances in neural information
|
| 541 |
+
386 processing systems, 31, 2018.
|
| 542 |
+
387 Wu, Y. F., Zhang, W., Xu, P., and Gu, Q. A finite-time analysis of two time-scale actor-critic methods.
|
| 543 |
+
388 Advances in Neural Information Processing Systems, 33:17617–17628, 2020.
|
| 544 |
+
389 Zhang, D. J., Dai, H., Dong, L., Qi, F., Zhang, N., Liu, X., Liu, Z., and Yang, J. How do price
|
| 545 |
+
390 promotions affect customer behavior on retailing platforms? evidence from a large randomized
|
| 546 |
+
391 experiment on alibaba. Production and Operations Management, 2018.
|
md/dev/LSKlp_aceOC/LSKlp_aceOC.md
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Merging Models with Fisher-Weighted Averaging
|
| 2 |
+
|
| 3 |
+
Michael Matena Colin Raffel Department of Computer Science University of North Carolina at Chapel Hill {mmatena,craffel}@cs.unc.edu
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Averaging the parameters of models that have the same architecture and initialization can provide a means of combining their respective capabilities. In this paper, we take the perspective that this “merging” operation can be seen as choosing parameters that approximately maximize the joint likelihood of the posteriors of the models’ parameters. Computing a simple average of the models’ parameters therefore corresponds to making an isotropic Gaussian approximation to their posteriors. We develop an alternative merging procedure based on the Laplace approximation where we approximate each model’s posterior as a Gaussian distribution whose precision matrix corresponds to its Fisher information. We first show that our “Fisher merging” technique provides a performance boost in settings where simple parameter averaging is currently used – specifically, robust fine-tuning and model ensembling. Then, we compare merging to standard gradient-based transfer learning and demonstrate that merging enables a fundamentally different method for transferring capabilities across models. Specifically, we show that Fisher merging is competitive with gradient-based transfer learning approaches (while being significantly cheaper) in intermediate-task training and domain-adaptive pre-training. We also show that our merging procedure makes it possible to combine models in previously unexplored ways. We release our code to facilitate future research into methods for merging models.1
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
How should we transfer knowledge and capabilities across trained models? One popular approach is transfer learning [44], which fine-tunes a pre-trained model on a target task through additional gradient-based training. The preparatory step of pre-training the model on a data-rich task ideally instills useful “knowledge” into the network’s parameters, which allows the model to learn more rapidly and effectively when fine-tuned on a downstream task of interest. Transfer learning has therefore become a particularly important and omnipresent tool across many fields, including natural language processing [57, 13, 9, 52, 53, 46] and computer vision [43, 24, 68]. Recently, it has been shown that training on an “intermediate” task between pre-training and fine-tuning can further boost performance through additional transfer of capabilities from the intermediate task [47, 60, 51, 48]. Alternatively, continued self-supervised training on unlabeled domain-specialized data can serve as a form of domain adaptation [19].
|
| 12 |
+
|
| 13 |
+
All of the aforementioned transfer learning methods transfer knowledge by using a trained network to initialize another network followed by iterative gradient descent. While demonstrably powerful, several drawbacks arise from this: First, improvements to ancestor models cannot be passed down to descendants; instead, we must restart the whole process from the improved ancestor model, throwing away our previous work. For example, if we fine-tune a pre-trained model on a downstream task, but then the pre-trained model is improved through additional training, we must re-fine-tune the new model on our downstream task if we want to confer benefits from this additional pre-training. Furthermore, if we gain access to a checkpoint that has been fine-tuned on a useful intermediate task, we must again throw away our previous work and fine-tune from the intermediate task checkpoint. Existing methods for transfer learning also have the disadvantage of only being able to transfer information from a single model. While it may be possible to train on multiple intermediate tasks sequentially, one quickly either runs into a combinatorial explosion of saved checkpoints or faces the issue of “catastrophic forgetting” in continual learning [28]. In addition to slowing down experimentation by preventing reuse of work, these drawbacks impose limitations on the types of transfer that can occur.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Merging patterns considered in this work. Left: Merging many fine-tuned models as a form of ensembling. Center, top: “Robust fine-tuning” [66] , where a fine-tuned model is merged with the pre-trained model to improve performance on the original pre-training task. Center, bottom: Merging a fine-tuned model with a “donor” task, analogous to intermediate-task transfer learning [47, 51]. Right: Merging an intermediate-task trained model with a donor model.
|
| 17 |
+
|
| 18 |
+
A less common way of transferring capabilities across models is to simply average their parameters. This procedure, which we call “merging”, is generally only feasible when the models being averaged share a common architecture and initialization. Merging is the core component of the FedAvg algorithm used in Federated Learning [39], where updates to a shared model computed by individual workers that are training on different datasets are combined by simpling averaging the updates. Recently, Wortsman et al. [66] demonstrated that merging can be used to improve robustness to domain shift in fine-tuned models by averaging the parameters of the original pre-trained model with the fine-tuned parameters. Merging is also a common way of performing ensembling [49, 67], where the parameters of individual models trained on the same dataset are averaged to create a single performant model.
|
| 19 |
+
|
| 20 |
+
In this work, we view model merging as approximately maximizing the joint likelihood of the models’ posterior distribution over parameters. Since gradient-based maximum likelihood training only provides a point estimate of the posterior, some approximation of the posterior distribution is required. When an isotropic Gaussian distribution is used to approximate the posterior (with identity precision matrix and mean set to the model’s parameter values), we show that maximizing the joint likelihood across models is equivalent to simply averaging their parameters. We therefore refer to merging models by averaging parameters as isotropic merging. The view of merging as maximizing the joint likelihood of model posteriors suggests that using a better estimate of the posterior distribution may yield improved merging results. This leads us to introduce Fisher merging, which leverages the Laplace approximation by using the diagonal of each model’s Fisher information as the precision matrix for that model’s posterior.
|
| 21 |
+
|
| 22 |
+
Empirically, we demonstrate that merging models with Fisher merging outperforms isotropic merging in a variety of settings. We first focus on the existing applications of model ensembling [49, 67] and improving fine-tuned model robustness [66]. Then, we demonstrate for the first time that merging is a viable alternative to traditional gradient-based transfer learning. Specifically, we compare merging to intermediate-task transfer learning [47, 51] and domain-adaptive pre-training [19], finding that merging can achieve comparable performance at significantly lower cost. Additionally, we show that merging can provide an additional boost to models created via traditional intermediate-task training. This provides a concrete example of transfer that is fast and easy with merging but onerous or impossible to do with existing methods. Diagrams of the merging patterns we consider in this work are shown in fig. 1.
|
| 23 |
+
|
| 24 |
+
The rest of our paper is structured as follows: In section 2, we provide necessary background and detail our Fisher merging procedure. Section 3 provides experimental results on model ensembling, robust fine-tuning, intermediate-task training, and domain adaptation. We explore related works in section 4 and provide conclusions and thoughts on future work in section 5.
|
| 25 |
+
|
| 26 |
+
# 2 Weighted Parameter Averaging for Model Merging
|
| 27 |
+
|
| 28 |
+
Our focus is on procedures for model merging, i.e. averaging the parameters of models that share an architecture and initialization. In this section, we first frame the common practice of averaging together model parameters as approximately maximizing the joint likelihood of model posteriors. Specifically, we show that parameter averaging corresponds to using an isotropic Gaussian as the approximate posterior for each model. We then introduce Fisher merging, which uses the model’s diagonal Fisher information matrix as the precision matrix of the Gaussian approximate posterior. Fisher merging can be implemented by setting each merged parameter value to a weighted average of the corresponding parameter values from the original models, with the weighting for each parameter determined by its Fisher information. In addition, we add model-level weightings as additional hyperparameters to set the relative importance of each model.
|
| 29 |
+
|
| 30 |
+
# 2.1 Isotropic merging
|
| 31 |
+
|
| 32 |
+
Consider the problem setting where we have $M$ trained neural networks with parameters $\theta _ { 1 } , \dots , \theta _ { M }$ and our goal is to create a single neural network with parameters $\theta$ that, loosely speaking, inherits the capabilities of the $M$ trained neural networks. Assume that all of these neural networks share a common architecture and had the same set of initial parameter values before being trained. Merging attacks this problem by finding the parameters $\theta$ that maximize the joint likelihood of the posterior distributions of the $M$ models. Unfortunately, typical neural network training procedures do not provide access to a posterior distribution, which necessitates approximation. If the posterior of each model is approximated via an isotropic Gaussian with mean set to the model’s parameters, the optimization problem can be written as $\begin{array} { r } { \theta ^ { * } = \operatorname * { a r g m a x } _ { \theta } \sum _ { i } \log p ( \theta | \theta _ { i } , I ) } \end{array}$ where $p ( \theta | \theta _ { i } , I )$ is the probability distribution of the aforementioned approximate isotropic Gaussian posterior distribution used for model $i$ and $I$ is the identity matrix. This optimization problem has a closed-form solution given by $\begin{array} { r } { \theta ^ { * } = \frac { 1 } { M } \sum _ { i } \theta _ { i } } \end{array}$ , i.e. an average of the model parameters. Such an averaging procedure has been used in past work aiming to combine model capabilities, e.g. in federated learning [39], model ensembling [49, 67], and robust fine-tuning [66].
|
| 33 |
+
|
| 34 |
+
# 2.2 Per-model weights
|
| 35 |
+
|
| 36 |
+
In this work, we additionally introduce model-specific scalar hyperparameters $\lambda _ { i } , i \in \{ 1 , \dots , M \}$ into the model merging framework described above. Specifically, we change the optimization problem to $\begin{array} { r } { \theta ^ { * } = \mathrm { a r g m a x } _ { \theta } \sum _ { i } \bar { \lambda } _ { i } \log p ( \underline { { \theta } } | \theta _ { i } , I ) } \end{array}$ where $\begin{array} { r } { \lambda _ { i } \geq 0 , \bar { \sum _ { i } } \lambda _ { i } = \bar { 1 } } \end{array}$ . In the case of isotropic merging, this changes the solution to $\theta ^ { * } = \textstyle \sum _ { i } \lambda _ { i } \theta _ { i }$ , These hyperparameters provide control over the importance assigned to each of the models that are being merged. For example, when using merging to perform ensembling we might expect each model to be equally important and therefore set $\lambda _ { i } = 1 / M$ for all $i$ On the other hand, when mimicking the setup of intermediate-task training where the capabilities of a “donor” model are used to improve performance of a recipient model, we might weigh the recipient model more highly. Wortsman et al. [66] introduce a similar hyperparameter $\alpha$ when averaging the parameters of two models and report results for varying values of $\alpha$ .
|
| 37 |
+
|
| 38 |
+
# 2.3 Laplace Approximation
|
| 39 |
+
|
| 40 |
+
Framing merging as approximate maximization of the joint posterior likelihood reveals that simple parameter averaging is implicitly using an isotropic Gaussian posterior approximation. Such an approximation may be overly simplistic and lead to degraded performance. To explore improved merging procedures, we consider improved methods for creating an approximate posterior from a point estimate. Specifically, we use the Laplace approximation to the posterior, which corresponds to a second-order Taylor expansion of the log density around a mode [36, 10]. This leads to a Gaussian approximation $\mathcal { N } ( \theta , H ^ { - 1 } )$ of the posterior, where $H$ is the Hessian matrix and $\theta$ are the model’s trained parameter values. More precisely, we assume that the parameter values $\theta$ of a trained neural network are a local maximum of the posterior. It can then be shown that the precision matrix of the Laplace approximation is given by the Fisher information matrix of the network at $\theta$ .
|
| 41 |
+
|
| 42 |
+
The Fisher information matrix $F _ { \theta }$ [16, 3] of a neural network $p _ { \theta } ( y | x )$ trained to predict an output $y$ from input data $x$ is a $\left| \theta \right| \times \left| \theta \right|$ positive semidefinite matrix given by the formula
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
F _ { \theta } = \mathbb { E } _ { x } \left[ \underset { y \sim p _ { \theta } ( y | x ) } { \mathbb { E } } \nabla _ { \theta } \log p _ { \theta } ( y | x ) \nabla _ { \theta } \log p _ { \theta } ( y | x ) ^ { T } \right] .
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
It can be shown that the Fisher information matrix coincides with the Hessian $H$ at modes of the distribution [45], explaining its use in the Laplace approximation. The Fisher information matrix $F _ { \theta }$ can also be used to relate changes in the model parameters to changes in the model output by noting that $\begin{array} { r } { \mathbb { E } _ { x } \left[ D _ { \mathrm { K L } } ( p _ { \theta } ( y | x ) | | p _ { \theta + \delta } ( y | x ) ) \right] \approx \frac { 1 } { 2 } \delta ^ { T } F _ { \theta } \delta } \end{array}$ as $\delta 0$ , where $D _ { \mathrm { K L } }$ denotes the KL-divergence [45].
|
| 49 |
+
|
| 50 |
+
As the full Fisher matrix takes $O ( | \theta | ^ { 2 } )$ memory to store, it quickly becomes impractical for all but the smallest models. We are thus forced to use an approximation to the full Fisher in practice. In this paper, we follow the common practice of using the diagonal of the Fisher matrix [28]. While other methods (e.g. [1]) exist for estimating the Fisher, we leave their exploration for future work. In our experiments, we estimated the diagonal of the Fisher matrix via
|
| 51 |
+
|
| 52 |
+
$$
|
| 53 |
+
\hat { F } _ { \theta } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \underset { y \sim p _ { \theta } ( y | x _ { i } ) } { \mathbb { E } } ( \nabla _ { \theta } \log p _ { \theta } ( y | x _ { i } ) ) ^ { 2 } ,
|
| 54 |
+
$$
|
| 55 |
+
|
| 56 |
+
where $x _ { 1 } , \ldots , x _ { N }$ are drawn i.i.d. from the dataset that was used to train the model. The expectation over $y$ can be estimated via sampling from $p _ { \theta } ( y | x _ { i } )$ or computed exactly when the number of classes is small. We note that computing the Fisher requires $N$ per-example gradients, which can be straightforwardly computed for neural networks using backpropagation. This makes computing the diagonal Fisher have roughly the same computational cost as training on $N$ examples.
|
| 57 |
+
|
| 58 |
+
# 2.4 Fisher Merging
|
| 59 |
+
|
| 60 |
+
Having noted that the Laplace approximation provides a tractable way to obtain a better approximation to the posterior, we now use it to create an improved merging procedure that we call Fisher merging. Letting $F _ { 1 } , \ldots , F _ { M }$ correspond to the diagonal approximate Fisher matrices, we construct $p ( \boldsymbol { \theta } | \boldsymbol { \theta } _ { i } , F _ { i } )$ as a Gaussian-distributed posterior over the parameters of the merged model with mean $\theta _ { i }$ and precision $F _ { i }$ . To obtain the merged model, we find a single set of parameters that is given a high probability under all posteriors. Formally, we have
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\theta ^ { * } = \operatorname { a r g m a x } _ { \theta } \sum _ { i = 1 } ^ { M } \lambda _ { i } \log p ( \theta | \theta _ { i } , F _ { i } ) ,
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
which has the closed-form solution
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
\theta ^ { * ( j ) } = \frac { \sum _ { i = 1 } ^ { M } \lambda _ { i } F _ { i } ^ { ( j ) } \theta _ { i } ^ { ( j ) } } { \sum _ { i = 1 } ^ { M } \lambda _ { i } F _ { i } ^ { ( j ) } } ,
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
where $j = 1 , \ldots , | \theta |$ . Intuitively, we can think of Fisher merging as computing a weighted average of the parameter values in each model where the weighting is done according to each parameter’s Fisher information. Since the Fisher information is a local property of a single parameter value, Fisher merging might be less performant when applied to models whose parameters are far apart in parameter space. We therefore limit our focus to models that were trained from the same initialization.
|
| 73 |
+
|
| 74 |
+
Numerical Issues. Note that (4) can run into numerical issues when the Fisher is close to zero across all models for a given parameter. In practice, we choose a privileged “target model” in all of our experiments and “default” to the parameter’s value in the target model in these cases. An alternative would be to take an average weighted only by the merging coefficients (i.e., pretend the Fisher is the same across all models). In practice, the choice of a “default” value for these parameters had little impact on performance (likely because a small Fisher value implies that changing the parameter has a minute effect on the model’s outputs and is therefore relatively unimportant to the model’s behavior).
|
| 75 |
+
|
| 76 |
+
Unmergeable Parameters. In many cases, we have some parameters from each model that do not appear in all of the models we are merging. For example, this includes having task-specific classification heads on top of a common body architecture. We handle this by only applying the merging procedure (3) to the shared body parameters and keeping the task-specific heads unchanged. Although this may lead to a distribution shift in the classification head inputs, we found it to work well in practice for the datasets and tasks we consider.
|
| 77 |
+
|
| 78 |
+
# 3 Experiments
|
| 79 |
+
|
| 80 |
+
Our first experimental goal is to validate that our use of an improved estimate of the posterior yields improved merging performance. To test this hypothesis, we apply Fisher merging to two settings where isotropic merging has already proven successful: Model ensembling [49, 67] and robust fine-tuning [66]. Then, we demonstrate that Fisher merging provides a cheap and effective alternative to traditional transfer learning pipelines by validating its performance in intermediate-task transfer learning [47, 51] and domain-adaptive pre-training [19]. Finally, we demonstrate that merging opens up new paths of transferring capabilities across models by demonstrating a boost in performance when merging an intermediate task-trained model with different donor models.
|
| 81 |
+
|
| 82 |
+
# 3.1 Ensembling
|
| 83 |
+
|
| 84 |
+
An existing application of isotropic merging is for ensembling, i.e. combining models trained on the same dataset to obtain better predictions. Ensembling is most commonly performed by averaging the predictions of the individual models. This form of ensembling requires computing the output of all $M$ models in the ensemble, thereby increasing the computational cost by a factor of $M$ compared to computing the output for a single model. A cheaper alternative is to average the parameters of the models themselves. This approach is diagrammed in fig. 1, left. Such an approach is used in the classical method of Polyak averaging [49], where parameter values from the final $M$ iterations of training are averaged. More recently, Wortsman et al. [67] introduced the “Model Soup” approach where fine-tuned models with different hyperparameter settings are averaged to improve performance. To the best of our knowledge, all parameter-averaging ensemble methods have used isotropic merging, i.e. an unweighted average.
|
| 85 |
+
|
| 86 |
+
To test whether Fisher merging provides a boost over isotropic merging when averaging parameters for ensembling, we consider ensembling fine-tuned checkpoints derived from the same pre-trained model. Specifically, we consider the BERT-Base model [13] fine-tuned on the RTE [8], MRPC [14], and SST-2 [59] datasets. For each dataset, we use five fine-tuned checkpoints downloaded from the Hugging Face model hub.2 These checkpoints were fine-tuned with a variety of hyperparameter settings that were not chosen by us, so our experimental setting most closely matches the “Model Soup” approach [67]. A list of the checkpoints used is available in appendix A. Since we do not anticipate that any member of the ensemble should be given a larger weight, we set $\lambda _ { i } = 1 / 5$ for all models.
|
| 87 |
+
|
| 88 |
+
Our results are shown in fig. 2. We report validation set scores for Fisher merging, isotropic merging, and prediction ensembling (specifically, averaging the output probabilties of all models). Fisher merging significantly outperforms isotropic merging in all cases and attains comparable performance to prediction ensembling. Notably, performing inference after merging is $M \times$ cheaper than prediction ensembling, suggesting that merging can provide a cheaper alternative to standard ensembling procedures.
|
| 89 |
+
|
| 90 |
+
# 3.2 Robust Fine-Tuning
|
| 91 |
+
|
| 92 |
+
Recently, Wortsman et al. [66] found that while fine-tuning a pre-trained vision model tends to improve performance on the downstream task, it also tends to decreases accuracy on the original pretraining task. They therefore propose a “robust fine-tuning” procedure called WiSE-FT that computes a weighted average of the original pre-trained parameters and the fine-tuned parameters. Different weighting values produce different trade-offs between pre-training and fine-tuning task performance. In some cases, robust fine-tuning can even improve performance on the original pre-training task without sacrificing performance on the downstream fine-tuning task relative to traditional fine-tuning.
|
| 93 |
+
|
| 94 |
+

|
| 95 |
+
Figure 2: Validation set accuracy for ensembles of five fine-tuned BERT models using different ensembling methods on the RTE, MRPC, and SST-2 datasets. Fisher merging produces a single model that performs comparably to output ensembling while being $5 \times$ cheaper.
|
| 96 |
+
|
| 97 |
+

|
| 98 |
+
Figure 3: IID (ImageNet) and average outof-domain (OOD) accuracy across five OOD datasets when using the WiSE-FT procedure [66] with either Fisher or isotropic merging. Dark to light color indicates increasing $\lambda _ { 1 }$ from 0 to 1.
|
| 99 |
+
|
| 100 |
+
This procedure implicitly uses isotropic merging and therefore provides another natural testbed for determining whether Fisher merging provides a boost in performance. A schematic of robust fine-tuning is shown in fig. 1, center top.
|
| 101 |
+
|
| 102 |
+
We use the codebase and experimental setup of Wortsman et al. [66] exactly, simply replacing isotropic merging with Fisher merging. For full details of this setup, we refer to Wortsman et al. [66]. As a short summary, we apply WiSE-FT to the ImageNet [11, 58] pre-trained ViT-B/16 model [15] on five out-of-domain (OOD) datasets: ImageNet-A [21], ImageNet-R [20], ImageNet Sketch [62], ImageNet V2 [56], and ObjectNet [4]. Following Wortsman et al. [66], we measure IID (ImageNet) and OOD performance when averaging together the original pre-trained model parameters and parameters from models fine-tuned on each of the OOD datasets, varying $\lambda _ { 1 }$ (the averaging weight for the pre-trained model, called $\alpha$ by Wortsman et al. [66]) from 0 to 1 in 0.1-step increments (with $\lambda _ { 2 } = 1 - \lambda _ { 1 }$ correspondingly decreasing from 1 to 0). To determine whether Fisher merging confers a boost in performance, we compare parameter averaging using either isotropic or Fisher merging.
|
| 103 |
+
|
| 104 |
+
We plot the IID (ImageNet) accuracy against the average accuracy on the five OOD datasets for varying values of $\lambda _ { 1 }$ in fig. 3, with plots for individual OOD datasets in fig. 7 (appendix). Fisher merging produces a significantly better trade-off between IID and OOD accuracy. In particular, Fisher merging seems to general improve IID accuracy compared to isotropic merging. For example, for the value of $\lambda _ { 1 }$ producing the best average OOD accuracy, Fisher merging produces about $1 \%$ higher IID accuracy than isotropic merging.
|
| 105 |
+
|
| 106 |
+
# 3.3 Intermediate-task training
|
| 107 |
+
|
| 108 |
+
Having established that Fisher merging produces better results than isotropic merging in settings where merging has been attempted before, we now explore the use of merging as an alternative to a gradient-based transfer learning procedure. Specifically, we explore intermediate-task training [47, 51], where a model is fine-tuned on an intermediate “donor” task before being trained on the target task of interest. To the best of our knowledge, no prior work has considered parameter averaging as a way of performing intermediate-task transfer learning. For the most part, intermediate-task training has mainly been considered in the NLP domain; as such, we limit our experiments to the BERT [13] and RoBERTa [33] pre-trained language models. To enable comparison to past work, we mostly explored merging pairs of models but we are interested in exploring merging more than two models in future work. As in section 3.1, we made use of fine-tuned BERT and RoBERTa checkpoints from the Hugging Face repository [65].
|
| 109 |
+
|
| 110 |
+
Following previous work [47, 51], we first ran experiments using BERT-base on the GLUE benchmark [61]. The GLUE benchmark consists of the sentence acceptability task CoLA [64], the sentiment detection task SST-2 [59], the paraphrase detection tasks MRPC and QQP [14, 23], the sentence similarity task STS-B [7], and the natural language inference (NLI) tasks MNLI, QNLI, RTE, and
|
| 111 |
+
|
| 112 |
+

|
| 113 |
+
Figure 4: Validation set accuracy on RTE when performing intermediate-task training with datasets from GLUE as the donor task. Dashed line denotes RTE accuracy without intermediatetask training.
|
| 114 |
+
|
| 115 |
+

|
| 116 |
+
Figure 5: Validation accuracy on RTE after first fine-tuning on MNLI, then fine-tuning on RTE, and finally Fisher merging with various donor task models. Dashed line denotes RTE accuracy after MNLI intermediate-task training.
|
| 117 |
+
|
| 118 |
+
WNLI [6, 54, 8, 31]. All of the GLUE tasks are classification tasks except for STS-B, which is a regression task with a score ranging from 0 to 5. To simplify computation of the Fisher, we turn STS-B into a classification task by partitioning the continuous label into 25 equally-sized buckets [53]. Following common practice, we do not run experiments on WNLI due to the tricks required to get a good score [12, 29]. See Wang et al. [61] for more details on these tasks and their associated metrics. We detail how we obtained fine-tuned checkpoints on these tasks in appendix C. We computed a diagonal Fisher approximation for each checkpoint using up to 4096 examples from the corresponding train set. Since it is not clear a priori what weighting coefficients $\lambda _ { i }$ to use in this setting, we chose $\lambda _ { i }$ by a grid search with 50 points, using the score on the first 2048 validation examples as the selection metric. We compare Fisher merging to isotropic merging as well as a standard gradient-based intermediate-task fine-tuning baseline [47]. A diagram of intermediate-task merging is shown in fig. 1, center bottom.
|
| 119 |
+
|
| 120 |
+
In initial experiments (reported in tables A1 to A3), we performed intermediate-task training for possible pair of datasets from the GLUE benchmark. Congruent with past work [47, 51, 60], we found that intermediate-task training provided the most notable performance boost when the RTE dataset was the target. We therefore focus on RTE results in the main text. Figure 4 shows the results of intermediate-task training of BERT-base with RTE as the target task and the other GLUE datasets as donor tasks, using Fisher merging, isotropic merging, or standard gradient-based training. Notably, performing gradient-based intermediate-task training hurts on some datasets, whereas merging always helps. Fisher merging gets comparable or better performance than isotropic merging with the largest gap observed when using MNLI as the intermediate task. On the other hand, merging performs worse than standard gradient-based training when using MNLI as the donor task.
|
| 121 |
+
|
| 122 |
+
Exploring new paths for transfer Given this performance gap, we were interested to see whether merging could provide an additional boost on top of gradient-based intermediate-task training. We therefore performed Fisher merging on a BERT-base model that was first fine-tuned on MNLI and then fine-tuned on RTE. A diagram of this setup is shown in fig. 1, right. This procedure does not have a direct analog in traditional gradient-based, and as we will show later, performing multi-stage gradient-based intermediate-task training generally harms results.
|
| 123 |
+
|
| 124 |
+
We consider Fisher merging the intermediate-task trained RTE model with all GLUE tasks and show the results in fig. 5. Fisher merging provides a boost over gradient-based intermediate-task training for all tasks. Interestingly, a boost is still conferred when merging with an MNLI-trained model, suggesting that merging provides a complementary path for transferring capabilities across models.
|
| 125 |
+
|
| 126 |
+
Scaling to RoBERTa-large Seeing that merging can provide a boost on top of intermediate-task training, we explored whether this boost could still be obtained for a stronger model than BERTbase. We therefore applied the same procedure to a RoBERTa-large RTE model that had been fine-tuned from an MNLI intermediate checkpoint. Our donor models were the original RoBERTalarge checkpoint (i.e., not fine-tuned on MNLI) fine-tuned on MRPC, RTE, STS-B, and SST-2. We additionally ran a sequential gradient-based fine-tuning baseline where we started with the MNLI checkpoint, fine-tuned on the donor task, and then fine-tuned on the target task.
|
| 127 |
+
|
| 128 |
+
The results are shown in fig. 6. We find merging provides a boost in performance even on the more performant RoBERTa model. The largest boost of 2.2 points came from Fisher merging with another RTE checkpoint, which is reminiscent of using merging for ensembling. Notably, including an additional intermediate task in gradient-based training significantly harmed performance compared to performing intermediate-task training on MNLI alone. We hypothesize this is related to the phenomena of catastrophic forgetting [17], where the model’s capabilities on MNLI are forgotten as it is trained on the next intermediate task. Nevertheless, this illustrates model merging’s ability to sidestep the issue of catastrophic forgetting and enable exploration of novel transfer strategies.
|
| 129 |
+
|
| 130 |
+
Costs We had previously noted that our merging procedure could potentially be substantially more efficient than standard gradient-based fine-tuning. To measure this claim concretely, we computed the FLOPs required for fine-tuning and merging an RTE checkpoint based on the heuristics described in Kaplan et al. [26]. Fine-tuning BERT-base on RTE for 10 epochs would require about 5.5e14 FLOPs. Our merging procedures require computing the merged checkpoint (eq. (4)) and then evaluating it on the validation set with Fisher merging also requiring the estimation of the Fisher matrix (eq. (2)) beforehand. These steps require about 4.0e8, 2.0e12, and 9.1e13 FLOPs respectively, resulting in a roughly $6 \times$ lower total cost compared to fine-tuning for Fisher merging and $2 7 5 \times$ lower cost for isotropic merging. We note that the Fisher matrix only needs to be computed once and can be reused for subsequent merges, which amortizes the most expensive step in Fisher merging.
|
| 131 |
+
|
| 132 |
+
To explore methods for further reducing costs, we experimented with using fewer examples to estimate the Fisher. Specifically, we experimented with intermediate-task Fisher merging of BERT-base with MNLI as the donor task and RTE as the target task. The results are shown in table A4. While using the full training set to estimate the Fisher produced the best performance $( 7 3 . 4 \% )$ , using only 256 examples to estimate the Fisher only produced a mild degradation in accuracy $( 7 2 . 7 \% )$ and still outperformed the isotropic merging baseline. This suggests that computing the Fisher over fewer examples could further reduce computational costs without sacrificing a great deal of accuracy.
|
| 133 |
+
|
| 134 |
+
# 3.4 Domain Adaptation
|
| 135 |
+
|
| 136 |
+
We now turn our attention to the “domain-adaptive pre-training” (DAPT) approach for domain adaptation advocated by Gururangan et al. [19], which is methodologically similar to intermediatetask training. DAPT consists of additional pre-training of an original general-purpose pre-trained checkpoint on domain-specific unlabeled data. We explore the benefits of merging in an experimental setup similar to Gururangan et al. [19]. We focus on the biomedical (BIOMED) and computer science (CS) domains because they correspond to the classification tasks that saw the largest gains from domain-adaptive pre-training in [19]. Namely, we experimented with the CHEMPROT [30] relation classification task on the BIOMED domain. On the CS domain, we used the citation intent task of ACL-ARC [25] and the relation classification task of SCIERC [35]. Following Gururangan et al. [19], we report macro- $F _ { 1 }$ for ACL-ARC and SCIERC, and we report micro- $F _ { 1 }$ for CHEMPROT. We used RoBERTa-base [33] as our baseline model. Appendix D includes full details of the pre-training, fine-tuning, and merging procedures used.
|
| 137 |
+
|
| 138 |
+
We present our results in table 1. Merging provided the largest boost on ACL-ARC, and outperformed traditional fine-tuning in this setting. We only observed a minor improvement in performance on CHEMPROT and SCIERC. We note that our boosts from gradient-based fine-tuning were smaller than reported in [19], which was likely because we were only able to train on public data and we applied domain-adaptive pre-training for fewer steps. However, our results are consistent in the sense that ACL-ARC received the largest boost and CHEMPROT received the smallest boost.
|
| 139 |
+
|
| 140 |
+
# 4 Related Work
|
| 141 |
+
|
| 142 |
+
Like our work, elastic weight consolidation (EWC) [28] uses the Laplace approximation to the posterior over model parameters to create a regularizer to prevent catastrophic forgetting in the context of continual learning. While their framework supports the use of posteriors from multiple
|
| 143 |
+
|
| 144 |
+

|
| 145 |
+
Figure 6: Validation accuracy on RTE using the setup of fig. 5, but with RoBERTa-large instead of BERT-base. “Standard training” fine-tunes on MNLI, then the donor task, then RTE. Dashed line denotes MNLI intermediate-task training.
|
| 146 |
+
|
| 147 |
+
<table><tr><td>Method</td><td>ChemProt</td><td>ACL-ARC</td><td>SciERC</td></tr><tr><td>Unmerged</td><td>82.70.3</td><td>70.53.2</td><td>81.00.4</td></tr><tr><td>Fisher</td><td>83.10.4</td><td>73.21.7</td><td>81.30.5</td></tr><tr><td>Isotropic</td><td>82.80.4</td><td>72.52.3</td><td>81.70.5</td></tr><tr><td>Fine-tuned</td><td>82.50.1</td><td>71.53.0</td><td>81.61.0</td></tr></table>
|
| 148 |
+
|
| 149 |
+
Table 1: Domain adaptation results. “Unmerged” refers to checkpoints fine-tuned from RoBERTabase. “Fisher” and “Isotropic” refer to the result of merging those checkpoints with the domainadaptive pre-trained (DAPT) checkpoint. “Finetuned” refers to models fine-tuned from the DAPT checkpoint. Subscripts provide the standard deviation across five trials.
|
| 150 |
+
|
| 151 |
+
models as well, they restrict such models to be previous checkpoints of a continually trained model. EWC keeps the model from losing previously acquired knowledge while merging provides a means of directly adding new knowledge to a model.
|
| 152 |
+
|
| 153 |
+
Some other existing procedures such as distillation [22] and ensembling [42] can also be thought of as combining or transferring knowledge between neural networks. However, those methods represent knowledge solely through the output of models. The knowledge contained within the parameters of a network will necessarily be greater than the knowledge contained in its output [2]. Hence, methods that directly combine model parameters such as merging have the potential to be more powerful than those methods. Furthermore, our merging procedure has an efficient and closed-form solution (eq. (4)) while distillation requires iterative gradient descent-based training.
|
| 154 |
+
|
| 155 |
+
Isotropic checkpoint averaging is used by federated learning [39] and Polyak averaging [49]. However, the checkpoints merged by those methods can be thought of coming from the same training run of single model. We believe we are the first to demonstrate cross-task transfer coming from checkpoint averaging and to explore it in the context of transfer learning. However, adapting ideas from federated learning such as [32, 63] could provide a fruitful avenue for future model merging research.
|
| 156 |
+
|
| 157 |
+
Natural gradient descent refers to an optimization procedure that uses KL-divergence of model predictions as a distance measure rather than the Euclidean distance in parameter space employed by regular gradient descent [3]. It does this by performing gradient descent on a Riemannian manifold with the Fisher information matrix as its metric [45]. In practice, this amounts to using the Fisher as a preconditioner during gradient descent. Some work on natural gradient descent may prove relevant for model merging such as using Kronecker-factorized Fisher matrices as an alternative to the diagonal approximation employed in this paper [37, 18, 38]. More broadly, in the field of information geometry the Fisher information matrix plays the role of a metric on a Riemannian manifold [40]. This has led to explorations of model averaging using tools from information geometry, e.g. [5, 41, 50].
|
| 158 |
+
|
| 159 |
+
# 5 Conclusion
|
| 160 |
+
|
| 161 |
+
In this paper, we introduced Fisher merging, a way to combine the capabilities of different models by computing a weighted average of their parameters. Fisher merging is motivated by a novel perspective of parameter averaging as maximizing the joint likelihood of model posteriors. Through extensive experiments, we demonstrated that using the Fisher information as a weight on the contribution of each parameter outperforms using an unweighted average. Furthermore, we showed that Fisher merging attains comparable and sometimes better performance than traditional gradient-based transfer learning methods at significantly lower costs. Our experiments also demonstrated various merging strategies that would be onerous with traditional gradient-based training, which opens up new avenues for transferring capabilities across models. In future work, we plan to investigate different methods for approximating the Fisher information and model posteriors as well as more esoteric combinations of models.
|
| 162 |
+
|
| 163 |
+
# Acknowledgments and Disclosure of Funding
|
| 164 |
+
|
| 165 |
+
This work was supported by the NSF CAREER award under Grant No. 2145822.
|
| 166 |
+
|
| 167 |
+
# References
|
| 168 |
+
|
| 169 |
+
[1] Achille, A., Lam, M., Tewari, R., Ravichandran, A., Maji, S., Fowlkes, C. C., Soatto, S., and Perona, P. Task2vec: Task embedding for meta-learning. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 6430–6439, 2019.
|
| 170 |
+
[2] Achille, A., Paolini, G., and Soatto, S. Where is the information in a deep neural network? arXiv preprint arXiv:1905.12213, 2019.
|
| 171 |
+
[3] Amari, S. Neural learning in structured parameter spaces-natural riemannian gradient. Advances in neural information processing systems, pp. 127–133, 1997.
|
| 172 |
+
[4] Barbu, A., Mayo, D., Alverio, J., Luo, W., Wang, C., Gutfreund, D., Tenenbaum, J., and Katz, B. Objectnet: A large-scale bias-controlled dataset for pushing the limits of object recognition models. In Advances in Neural Information Processing Systems (NeurIPS), 2019.
|
| 173 |
+
[5] Bartels, L. M. Specification uncertainty and model averaging. American Journal of Political Science, 1997.
|
| 174 |
+
[6] Bowman, S. R., Angeli, G., Potts, C., and Manning, C. D. A large annotated corpus for learning natural language inference. arXiv preprint arXiv:1508.05326, 2015.
|
| 175 |
+
[7] Cer, D., Diab, M., Agirre, E., Lopez-Gazpio, I., and Specia, L. Semeval-2017 task 1: Semantic textual similarity-multilingual and cross-lingual focused evaluation. arXiv preprint arXiv:1708.00055, 2017.
|
| 176 |
+
[8] Dagan, I., Glickman, O., and Magnini, B. The pascal recognising textual entailment challenge. In Machine Learning Challenges Workshop, pp. 177–190. Springer, 2005.
|
| 177 |
+
[9] Dai, A. M. and Le, Q. V. Semi-supervised sequence learning. In Advances in neural information processing systems, 2015.
|
| 178 |
+
[10] Daxberger, E., Kristiadi, A., Immer, A., Eschenhagen, R., Bauer, M., and Hennig, P. Laplace redux-effortless bayesian deep learning. Advances in Neural Information Processing Systems (NeurIPS), 2021.
|
| 179 |
+
[11] Deng, J., Dong, W., Socher, R., Li, L.-J., Li, K., and Fei-Fei, L. ImageNet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, 2009.
|
| 180 |
+
[12] Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
|
| 181 |
+
[13] Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
|
| 182 |
+
[14] Dolan, W. B. and Brockett, C. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005), 2005.
|
| 183 |
+
[15] Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., Uszkoreit, J., and Houlsby, N. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020.
|
| 184 |
+
[16] Fisher, R. A. On the mathematical foundations of theoretical statistics. Philosophical Transactions of the Royal Society of London. Series A, Containing Papers of a Mathematical or Physical Character, 222(594-604):309–368, 1922.
|
| 185 |
+
[17] Goodfellow, I. J., Mirza, M., Xiao, D., Courville, A., and Bengio, Y. An empirical investigation of catastrophic forgetting in gradient-based neural networks. arXiv preprint arXiv:1312.6211, 2013.
|
| 186 |
+
[18] Grosse, R. and Martens, J. A kronecker-factored approximate fisher matrix for convolution layers. In International Conference on Machine Learning, pp. 573–582. PMLR, 2016.
|
| 187 |
+
[19] Gururangan, S., Marasovic, A., Swayamdipta, S., Lo, K., Beltagy, I., Downey, D., and Smith, ´ N. A. Don’t stop pretraining: Adapt language models to domains and tasks. arXiv preprint arXiv:2004.10964, 2020.
|
| 188 |
+
[20] Hendrycks, D., Basart, S., Mu, N., Kadavath, S., Wang, F., Dorundo, E., Desai, R., Zhu, T., Parajuli, S., Guo, M., Song, D., Steinhardt, J., and Gilmer, J. The many faces of robustness: A critical analysis of out-of-distribution generalization. International Conference on Computer Vision (ICCV), 2021.
|
| 189 |
+
[21] Hendrycks, D., Zhao, K., Basart, S., Steinhardt, J., and Song, D. Natural adversarial examples. Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 190 |
+
[22] Hinton, G., Vinyals, O., and Dean, J. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
|
| 191 |
+
[23] Iyer, S., Dandekar, N., and Csernai, K. First quora dataset release: Question pairs, 2017. URL https://data.quora.com/First-Quora-Dataset-Release-Question-Pairs.
|
| 192 |
+
[24] Jia, Y., Shelhamer, E., Donahue, J., Karayev, S., Long, J., Girshick, R., Guadarrama, S., and Darrell, T. Caffe: Convolutional architecture for fast feature embedding. In Proceedings of the 22nd ACM international conference on Multimedia, 2014.
|
| 193 |
+
[25] Jurgens, D., Kumar, S., Hoover, R., McFarland, D., and Jurafsky, D. Measuring the evolution of a scientific field through citation frames. Transactions of the Association for Computational Linguistics, 6:391–406, 2018.
|
| 194 |
+
[26] Kaplan, J., McCandlish, S., Henighan, T., Brown, T. B., Chess, B., Child, R., Gray, S., Radford, A., Wu, J., and Amodei, D. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020.
|
| 195 |
+
[27] Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 196 |
+
[28] Kirkpatrick, J., Pascanu, R., Rabinowitz, N., Veness, J., Desjardins, G., Rusu, A. A., Milan, K., Quan, J., Ramalho, T., Grabska-Barwinska, A., et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114(13):3521–3526, 2017.
|
| 197 |
+
[29] Kocijan, V., Cretu, A.-M., Camburu, O.-M., Yordanov, Y., and Lukasiewicz, T. A surprisingly robust trick for winograd schema challenge. arXiv preprint arXiv:1905.06290, 2019.
|
| 198 |
+
[30] Kringelum, J., Kjaerulff, S. K., Brunak, S., Lund, O., Oprea, T. I., and Taboureau, O. Chemprot3.0: a global chemical biology diseases mapping. Database, 2016, 2016.
|
| 199 |
+
[31] Levesque, H., Davis, E., and Morgenstern, L. The winograd schema challenge. In Thirteenth International Conference on the Principles of Knowledge Representation and Reasoning, 2012.
|
| 200 |
+
[32] Liu, X., Masana, M., Herranz, L., Van de Weijer, J., Lopez, A. M., and Bagdanov, A. D. Rotate your networks: Better weight consolidation and less catastrophic forgetting. In 2018 24th International Conference on Pattern Recognition (ICPR), pp. 2262–2268. IEEE, 2018.
|
| 201 |
+
[33] Liu, Y., Ott, M., Goyal, N., Du, J., Joshi, M., Chen, D., Levy, O., Lewis, M., Zettlemoyer, L., and Stoyanov, V. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019.
|
| 202 |
+
[34] Lo, K., Wang, L. L., Neumann, M., Kinney, R., and Weld, D. S. S2orc: The semantic scholar open research corpus. arXiv preprint arXiv:1911.02782, 2019.
|
| 203 |
+
[35] Luan, Y., He, L., Ostendorf, M., and Hajishirzi, H. Multi-task identification of entities, relations, and coreference for scientific knowledge graph construction. arXiv preprint arXiv:1808.09602, 2018.
|
| 204 |
+
[36] MacKay, D. J. A practical bayesian framework for backpropagation networks. Neural computation, 4(3):448–472, 1992.
|
| 205 |
+
[37] Martens, J. and Grosse, R. Optimizing neural networks with kronecker-factored approximate curvature. In International conference on machine learning, pp. 2408–2417. PMLR, 2015.
|
| 206 |
+
[38] Martens, J., Ba, J., and Johnson, M. Kronecker-factored curvature approximations for recurrent neural networks. In International Conference on Learning Representations, 2018.
|
| 207 |
+
[39] McMahan, B., Moore, E., Ramage, D., Hampson, S., and y Arcas, B. A. Communicationefficient learning of deep networks from decentralized data. In Artificial Intelligence and Statistics, pp. 1273–1282. PMLR, 2017.
|
| 208 |
+
[40] Nielsen, F. An elementary introduction to information geometry. Entropy, 22(10):1100, 2020.
|
| 209 |
+
[41] Nielsen, F. and Nock, R. Sided and symmetrized bregman centroids. IEEE transactions on Information Theory, 55(6), 2009.
|
| 210 |
+
[42] Opitz, D. W. and Shavlik, J. W. Actively searching for an effective neural network ensemble. Connection Science, 8(3-4):337–354, 1996.
|
| 211 |
+
[43] Oquab, M., Bottou, L., Laptev, I., and Sivic, J. Learning and transferring mid-level image representations using convolutional neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2014.
|
| 212 |
+
[44] Pan, S. J. and Yang, Q. A survey on transfer learning. IEEE Transactions on knowledge and data engineering, 22(10):1345–1359, 2009.
|
| 213 |
+
[45] Pascanu, R. and Bengio, Y. Revisiting natural gradient for deep networks. arXiv preprint arXiv:1301.3584, 2013.
|
| 214 |
+
[46] Peters, M. E., Neumann, M., Iyyer, M., Gardner, M., Clark, C., Lee, K., and Zettlemoyer, L. Deep contextualized word representations. arXiv preprint arXiv:1802.05365, 2018.
|
| 215 |
+
[47] Phang, J., Févry, T., and Bowman, S. R. Sentence encoders on stilts: Supplementary training on intermediate labeled-data tasks. arXiv preprint arXiv:1811.01088, 2018.
|
| 216 |
+
[48] Phang, J., Htut, P. M., Pruksachatkun, Y., Liu, H., Vania, C., Kann, K., Calixto, I., and Bowman, S. R. English intermediate-task training improves zero-shot cross-lingual transfer too. arXiv preprint arXiv:2005.13013, 2020.
|
| 217 |
+
[49] Polyak, B. T. and Juditsky, A. B. Acceleration of stochastic approximation by averaging. SIAM journal on control and optimization, 30(4):838–855, 1992.
|
| 218 |
+
[50] Posada, D. and Buckley, T. R. Model selection and model averaging in phylogenetics: advantages of akaike information criterion and bayesian approaches over likelihood ratio tests. Systematic biology, 53(5), 2004.
|
| 219 |
+
[51] Pruksachatkun, Y., Phang, J., Liu, H., Htut, P. M., Zhang, X., Pang, R. Y., Vania, C., Kann, K., and Bowman, S. R. Intermediate-task transfer learning with pretrained models for natural language understanding: When and why does it work? arXiv preprint arXiv:2005.00628, 2020.
|
| 220 |
+
[52] Radford, A., Narasimhan, K., Salimans, T., and Sutskever, I. Improving language understanding by generative pre-training, 2018.
|
| 221 |
+
[53] Raffel, C., Shazeer, N., Roberts, A., Lee, K., Narang, S., Matena, M., Zhou, Y., Li, W., and Liu, P. J. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683, 2019.
|
| 222 |
+
[54] Rajpurkar, P., Zhang, J., Lopyrev, K., and Liang, P. Squad: $1 0 0 { , } 0 0 0 { + }$ questions for machine comprehension of text. arXiv preprint arXiv:1606.05250, 2016.
|
| 223 |
+
[55] Rajpurkar, P., Jia, R., and Liang, P. Know what you don’t know: Unanswerable questions for squad. arXiv preprint arXiv:1806.03822, 2018.
|
| 224 |
+
[56] Recht, B., Roelofs, R., Schmidt, L., and Shankar, V. Do ImageNet classifiers generalize to ImageNet? In International Conference on Machine Learning (ICML), 2019.
|
| 225 |
+
[57] Ruder, S., Peters, M. E., Swayamdipta, S., and Wolf, T. Transfer learning in natural language processing. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Tutorials, pp. 15–18, 2019.
|
| 226 |
+
[58] Russakovsky, O., Deng, J., Su, H., Krause, J., Satheesh, S., Ma, S., Huang, Z., Karpathy, A., Khosla, A., Bernstein, M., et al. ImageNet large scale visual recognition challenge. International journal of computer vision, 2015.
|
| 227 |
+
[59] Socher, R., Perelygin, A., Wu, J., Chuang, J., Manning, C. D., Ng, A. Y., and Potts, C. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pp. 1631–1642, 2013.
|
| 228 |
+
[60] Vu, T., Wang, T., Munkhdalai, T., Sordoni, A., Trischler, A., Mattarella-Micke, A., Maji, S., and Iyyer, M. Exploring and predicting transferability across nlp tasks. arXiv preprint arXiv:2005.00770, 2020.
|
| 229 |
+
[61] Wang, A., Singh, A., Michael, J., Hill, F., Levy, O., and Bowman, S. R. Glue: A multitask benchmark and analysis platform for natural language understanding. arXiv preprint arXiv:1804.07461, 2018.
|
| 230 |
+
[62] Wang, H., Ge, S., Lipton, Z., and Xing, E. P. Learning robust global representations by penalizing local predictive power. In Advances in Neural Information Processing Systems (NeurIPS), 2019.
|
| 231 |
+
[63] Wang, H., Yurochkin, M., Sun, Y., Papailiopoulos, D., and Khazaeni, Y. Federated learning with matched averaging. arXiv preprint arXiv:2002.06440, 2020.
|
| 232 |
+
[64] Warstadt, A., Singh, A., and Bowman, S. R. Neural network acceptability judgments. Transactions of the Association for Computational Linguistics, 7:625–641, 2019.
|
| 233 |
+
[65] Wolf, T., Debut, L., Sanh, V., Chaumond, J., Delangue, C., Moi, A., Cistac, P., Rault, T., Louf, R., Funtowicz, M., et al. Huggingface’s transformers: State-of-the-art natural language processing. arXiv preprint arXiv:1910.03771, 2019.
|
| 234 |
+
[66] Wortsman, M., Ilharco, G., Li, M., Kim, J. W., Hajishirzi, H., Farhadi, A., Namkoong, H., and Schmidt, L. Robust fine-tuning of zero-shot models. arXiv preprint arXiv:2109.01903, 2021.
|
| 235 |
+
[67] Wortsman, M., Ilharco, G., Gadre, S. Y., Roelofs, R., Gontijo-Lopes, R., Morcos, A. S., Namkoong, H., Farhadi, A., Carmon, Y., Kornblith, S., and Schmidt, L. Model soups: averaging weights of multiple fine-tuned models improves accuracy without increasing inference time. arXiv preprint arXiv:2203.05482, 2022.
|
| 236 |
+
[68] Yosinski, J., Clune, J., Bengio, Y., and Lipson, H. How transferable are features in deep neural networks? In Advances in neural information processing systems, 2014.
|
| 237 |
+
|
| 238 |
+
# Checklist
|
| 239 |
+
|
| 240 |
+
1. For all authors...
|
| 241 |
+
|
| 242 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 243 |
+
(b) Did you describe the limitations of your work? [Yes] Settings where merging underperforms traditional gradient-based training are covered in section 3 and also discuss caveats of our method in section 2.4.
|
| 244 |
+
(c) Did you discuss any potential negative societal impacts of your work? [No]
|
| 245 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 246 |
+
|
| 247 |
+
2. If you are including theoretical results...
|
| 248 |
+
|
| 249 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] We state that merging assumes a shared architecture and initialization at various points in the paper and explain why in section 2.4.
|
| 250 |
+
(b) Did you include complete proofs of all theoretical results? [N/A] No theoretical advances were sufficiently complex to warrant proof.
|
| 251 |
+
|
| 252 |
+
3. If you ran experiments...
|
| 253 |
+
|
| 254 |
+
(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] Code is provided in the supplementary. All datasets are public and are downloadable with our code.
|
| 255 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See appendix C and appendix D
|
| 256 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See tables A1 to A3.
|
| 257 |
+
(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]
|
| 258 |
+
|
| 259 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 260 |
+
|
| 261 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 262 |
+
(b) Did you mention the license of the assets? [No] All datasets are widely-used (hundreds or thousands of citations) public datasets.
|
| 263 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We include code in the supplemental.
|
| 264 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 265 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 266 |
+
|
| 267 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 268 |
+
|
| 269 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 270 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 271 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/MbCAOMGsZXC/MbCAOMGsZXC.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Point-M2AE: Multi-scale Masked Autoencoders for Hierarchical Point Cloud Pre-training
|
| 2 |
+
|
| 3 |
+
Renrui Zhang1,2, Ziyu Guo2, Rongyao Fang1, Bin Zhao2, Dong Wang2, Yu Qiao2, Hongsheng $\mathbf { L i ^ { 1 , 3 } }$ , Peng GaoB2
|
| 4 |
+
|
| 5 |
+
1 CUHK-SenseTime Joint Laboratory, The Chinese University of Hong Kong, 2 Shanghai AI Laboratory, 3 Centre for Perceptual and Interactive Intelligence Limited
|
| 6 |
+
|
| 7 |
+
{zhangrenrui, gaopeng}@pjlab.org.cnhsli@ee.cuhk.edu.hk
|
| 8 |
+
|
| 9 |
+
# Abstract
|
| 10 |
+
|
| 11 |
+
Masked Autoencoders (MAE) have shown great potentials in self-supervised pretraining for language and 2D image transformers. However, it still remains an open question on how to exploit masked autoencoding for learning 3D representations of irregular point clouds. In this paper, we propose Point-M2AE, a strong Multi-scale MAE pre-training framework for hierarchical self-supervised learning of 3D point clouds. Unlike the standard transformer in MAE, we modify the encoder and decoder into pyramid architectures to progressively model spatial geometries and capture both fine-grained and high-level semantics of 3D shapes. For the encoder that downsamples point tokens by stages, we design a multi-scale masking strategy to generate consistent visible regions across scales, and adopt a local spatial self-attention mechanism during fine-tuning to focus on neighboring patterns. By multi-scale token propagation, the lightweight decoder gradually upsamples point tokens with complementary skip connections from the encoder, which further promotes the reconstruction from a global-to-local perspective. Extensive experiments demonstrate the state-of-the-art performance of Point-M2AE for 3D representation learning. With a frozen encoder after pretraining, Point-M2AE achieves $9 2 . 9 \%$ accuracy for linear SVM on ModelNet40, even surpassing some fully trained methods. By fine-tuning on downstream tasks, Point-M2AE achieves $8 6 . 4 3 \%$ accuracy on ScanObjectNN, $+ 3 . 3 6 \%$ to the secondbest, and largely benefits the few-shot classification, part segmentation and 3D object detection with the hierarchical pre-training scheme. Code is available at https://github.com/ZrrSkywalker/Point-M2AE.
|
| 12 |
+
|
| 13 |
+
# 1 Introduction
|
| 14 |
+
|
| 15 |
+
Learning to represent from unlabeled data without annotations, known as self-supervised learning, has attained great success in natural language processing [10, 32, 33, 5], computer vision [19, 7, 8, 18] and multi-modality learning [31, 50, 21]. By pre-training on the large-scale raw data, the networks are endowed with robust representation abilities and can significantly benefit downstream tasks with fine-tuning. Motivated by masked language modeling [32, 10], MAE [18] and some other methods [46, 53, 3] adopt asymmetric encoder-decoder transformers [13] to apply masked autoencoding for self-supervised learning on 2D images. They represent the input image as multiple local patches, and randomly mask them with a high ratio to build the pretext task for reconstruction. Specifically, the encoder aims at capturing high-level latent representations from limited visible patches, and the lightweight decoder is forced to reconstruct the RGB values of masked patches on top. Despite its superiority on grid-based 2D images, we ask the question: can MAE-style masked autoencoding be adapted to irregular point clouds as a powerful 3D representation learner?
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Comparison of MAE (Top) and our Point-M2AE (Bottom). MAE for 2D image pretraining adopts standard transformer of the plain encoder and decoder, while Point-M2AE introduces a hierarchical transformer with skip connections for multi-scale point cloud pre-training.
|
| 19 |
+
|
| 20 |
+
To tackle this challenge, we propose Multi-scale Masked autoencoders for learning the hierarchical representations of point clouds via self-supervised pre-training, termed as Point-M2AE. We represent a point cloud as a set of point tokens depicting different spatial local regions, and inherit MAE’s pipeline to first encode visible point tokens and then reconstruct the masked 3D coordinates. Different from 2D images, masked autoencoding for 3D point clouds has three characteristics to be specially considered. Firstly, it is critical to understand the relations between local parts and the overall 3D shapes, which have strong geometric and semantic dependence. As examples, the network can recognize an airplane starting from its wing, or segment the wing’s part from the airplane’s global feature. Therefore, we regard the standard transformer with the plain encoder and decoder is sub-optimal for capturing such local-global spatial relations in 3D, which directly downsamples the input into a low-resolution representation as shown in Figure 1 (Top). We modify both the encoder and decoder into multi-stage hierarchies for progressively encoding multi-scale features of point clouds, constructing an asymmetric U-Net [35] like architecture in Figure 1 (Bottom). Secondly, as our Point-M2AE encodes multi-scale point clouds unlike the single-scale 2D images, the unmasked visible regions are required to be both block-wise within one scale and consistent across scales, which are respectively for reserving complete local geometries and ensuring coherent feature learning for the network. For this, we introduce a multi-scale masking strategy, which generates random masks at the final scale with a high ratio (e.g., $80 \%$ ), and back-projects the unmasked positions to all preceding scales. Thirdly, to better reconstruct 3D geometries from a local-to-global perspective, we utilize skip connections to complement the decoder with fine-grained information from the corresponding stages of the encoder. During fine-tuning on downstream tasks, we also adopt a local spatial self-attention mechanism with increasing attention scopes for point tokens at different stages of the encoder, which refocus each token within neighboring detailed structures.
|
| 21 |
+
|
| 22 |
+
By the multi-scale pre-training, Point-M2AE can encode point clouds from local-to-global hierarchies and then reconstructs the masked coordinates from global-to-local perspectives, which learns powerful 3D representations and performs superior transfer ability. After self-supervised pre-training on ShapeNet [6], Point-M2AE achieves $9 2 . 9 \%$ classification accuracy for linear SVM on ModelNet40 [44] with the frozen encoder, which surpasses the runner-up CrossPoint [2] by $+ 1 . 2 \%$ and even outperforms some fully supervised methods. By fine-tuning on various downstream tasks, Point-M2AE achieves $8 6 . 4 3 \%$ $( + 3 . 3 6 \% )$ accuracy on ScanObjectNN [38] and $9 4 . 0 \%$ $( + 0 . 8 \% )$ accuracy on ModelNet40 [44] for shape classification, $8 6 . 5 1 \%$ $( + 0 . 9 1 \% )$ instance mIoU on ShapeNetPart [48] for part segmentation, and $9 5 . 0 \%$ $( + 2 . 7 \% )$ accuracy on 10-way 20-shot ModelNet40 for few-shot classification. Our multi-scale masked autoencoding also benefits the 3D object detection on ScanNetV2 [9] by $+ 1 . 3 \%$ $\mathsf { A P } _ { 2 5 }$ and $+ 1 . 3 \%$ $\mathrm { { A P } _ { 5 0 } }$ , which provides the detection backbone with a hierarchical understanding of the point clouds.
|
| 23 |
+
|
| 24 |
+
We summarize the contributions of our paper as follows:
|
| 25 |
+
|
| 26 |
+
1. We propose Point-M2AE, a strong masked autoencoding framework, which conducts hierarchical point cloud encoding and reconstruction for better learning multi-scale spatial geometries of 3D shapes.
|
| 27 |
+
2. We introduce a U-Net like transformer architecture for MAE-style pre-training on point clouds, and adopt a multi-scale masking strategy to generate consistent visible regions across scales.
|
| 28 |
+
3. Point-M2AE achieves state-of-the-art performance for transfer learning on various downstream tasks, which indicates our approach to be a powerful representation learner for 3D point clouds.
|
| 29 |
+
|
| 30 |
+
# 2 Related Work
|
| 31 |
+
|
| 32 |
+
Pre-training by Masked Modeling. Compared to contrastive learning methods [19, 7, 8] that learn from inter-sample relations, self-supervised pre-training by masked autoencoding builds the pretext tasks to predict the masked parts of the input signals. The series of GPT [32, 33, 5] and BERT [11] apply masked modeling to natural language processing and achieve extraordinary performance boost on downstream tasks with fine-tuning. Inspired by this, BEiT [4] proposes to match image patches with discrete tokens via dVAE [34] and pre-train a standard vision transformer [13, 49] by masked image modeling. On top of that, MAE [18] directly reconstructs the raw pixel values of masked tokens and performs great efficiency with a high mask ratio. The follow-up works further improve the performance of MAE by momentum encoder [53], contrastive learning [3], and modified reconstruction targets [42]. For self-supervised pre-training on 3D point clouds, the masked autoencoding has not been widely adopted. Similar to BEiT, Point-BERT [49] utilizes dVAE to map 3D patches to tokens for masked point modeling, but heavily relies on constrastive learning [19], complicated data augmentation, and the costly two-stage pre-training. In contrast, our Point-M2AE is a pure masked autoencoding method of one-stage pre-training, and follows MAE to reconstruct the input signals without dVAE mapping. Different from previous MAE methods adopting standard plain transformer, we propose a hierarchical transformer architecture along with the multi-scale masking strategy to better learn a strong and generic representation for 3D point clouds.
|
| 33 |
+
|
| 34 |
+
Self-supervised Learning for Point Clouds. 3D representation learning without annotations has been widely studied in recent years. Mainstream methods mainly build the pretext tasks to reconstruct the transformed input point cloud based on the encoded latent vectors, such as rotation [28], deformation [1], rearranged parts [36] and occlusion [40]. From another perspective, PointContrast [45] utilizes contrastive learning between features of the same points from different views to learn discriminative 3D representations. DepthContrast [51] further extends the contrast for depth maps of different augmentations. CrossPoint [2] conducts cross-modality contrastive learning between point clouds and their corresponding rendering images to acquire rich self-supervised signals. Point-BERT [49] and Point-MAE [27] respectively introduce BERT-style [10] and MAE-style [18] pre-training schemes for 3D point clouds with standard transformer networks and performs competitively on various downstream tasks, but both of them can only encode point clouds with a single resolution and ignores the local-global relations between 3D shapes. In this paper, we propose Point-M2AE, an MAE-style framework with a hierarchical transformer for multi-scale point cloud pre-training. We achieve state-of-the-art downstream performance by learning the multi-scale representation of point clouds.
|
| 35 |
+
|
| 36 |
+
# 3 Method
|
| 37 |
+
|
| 38 |
+
The overall pipeline of Point-M2AE is shown in Figure 2, where we encode and reconstruct the point cloud by a hierarchical network architecture. In Section 3.1, We first introduce the masking strategy of Point-M2AE with multi-scale representations of point clouds. Then in Section 3.2 and Section 3.3, we present the details of our encoder and decoder with multi-stage hierarchies.
|
| 39 |
+
|
| 40 |
+

|
| 41 |
+
Figure 2: Overall pipeline of Point-M2AE. After the multi-scale masking, we embed point tokens at the 1-st scale and feed the visible ones into a hierarchical encoder-decoder transformer, which captures both high-level semantics and fine-grained patterns of the point cloud during pre-training.
|
| 42 |
+
|
| 43 |
+
# 3.1 Multi-scale Masking
|
| 44 |
+
|
| 45 |
+
To build a U-Net [35] like masked autoencoder for hierarchical learning, we encode the point cloud by $S$ scales with different number of points at each scale, and correspondingly modify the standard plain encoder into the $S$ -stage architecture. Following MAE, we embed the point cloud into discrete point tokens and randomly mask them for reconstruction. Importantly, for irregular-distributed points in the multi-scale architecture, the unmasked visible spatial regions are required to be consistent not only within one scale, but also across different scales. This is because the block-wise parts of 3D shapes tend to preserve more complete fine-grained geometries, and the unmasked positions are better to be shared across all scales for coherent feature learning of the encoder. Therefore, as shown in Figure 3, we first construct the $S$ -scale coordinate representations of the input point cloud and back-project the random masks from the final $S$ -th scale to the earlier scales to avoid fragmented visible parts.
|
| 46 |
+
|
| 47 |
+
$S$ -scale Representations. We denote the input point cloud as $P \in \mathbb { R } ^ { N \times 3 }$ and regard it as the 0-th scale. For the $i$ -th scale, $1 \leq i \leq S$ , we utilize Furthest Point Sampling (FPS) to downsample the points from the $( i - 1 )$ -th scale, which produces seed points $P _ { i } \in \mathbb { R } ^ { N _ { i } \times 3 }$ for scale $i$ of $N _ { i }$ points. Then, we adopt $k$ Nearest-Neighbour ( $k$ -NN) to aggregate the neighboring $k$ points for each seed point and obtain the neighbor indices $I _ { i } \in \mathbb { R } ^ { N _ { i } \times k }$ . By successively downsampling and grouping, we acquire the $S$ -scale representations $\{ P _ { i } , I _ { i } \} _ { i = 1 } ^ { S }$ of the input point cloud, where the number of points $N _ { i }$ gradually decreases and the inclusion relations between scales are recorded in $I _ { i }$ .
|
| 48 |
+
|
| 49 |
+
Back-projecting Visible Positions. For seed points $P _ { S }$ at the final $S$ -th scale, we randomly mask them with a large proportion (e.g., $80 \%$ ) and denote the remaining visible points as $P _ { S } ^ { v } \in \dot { \mathbb { R } } ^ { N _ { S } ^ { v } \times 3 }$ of $N _ { S }$ points. We then back-project the unmasked positions $P _ { S } ^ { v }$ to ensure the consistent visible regions across scales. For the $i$ -th scale, $1 \leq i < S$ , we retrieve all the $k$ nearest neighbors of $P _ { i + 1 } ^ { v }$ from the indices $I _ { i + 1 }$ to serve as the visible positions $P _ { i } ^ { v }$ , and mask the others. By recursively back-projecting, we obtain the visible and masked positions of all v m $S$ scales, denoted as $\{ P _ { i } ^ { v } , P _ { i } ^ { m } \} _ { i = 1 } ^ { S }$ , where $P _ { i } ^ { v } \in \mathbb { R } ^ { N _ { i } ^ { v } \times 3 }$ , $P _ { i } ^ { m } \in \mathbb { R } ^ { N _ { i } ^ { m } \times 3 }$ and $N _ { i } = N _ { i } ^ { v } + N _ { i } ^ { m }$ .
|
| 50 |
+
|
| 51 |
+
# 3.2 Hierarchical Encoder
|
| 52 |
+
|
| 53 |
+
Based on the multi-scale masking, we embed the initial tokens of visible points $P _ { 1 } ^ { v }$ for the 1-st scale and them into the hierarchical encoder with $S$ stages. Every stage is equipped with $K$ stacked encoder blocks, and each block contains a self-attention layer and a Feed Forward Network (FFN) of MLP layers. Between every two consecutive stages, we introduce spatial token merging modules to aggregate adjacent visible tokens and enlarge receptive fields for downsampling the point clouds.
|
| 54 |
+
|
| 55 |
+

|
| 56 |
+
Figure 3: Multi-scale masking strategy. To obtain a consistent visible regions across scales, we first represent the input point cloud by multi-scale coordinates and generate the random mask at the highest one. Then, we back-project the unmasked visible positions to all earlier scales.
|
| 57 |
+
|
| 58 |
+
Token Embedding and Merging. Indexed by $I _ { 1 }$ , we utilize a mini-PointNet [29] to extract and fuse the features of every seed point from $P _ { 1 } ^ { v } \in \mathbb { R } ^ { N _ { 1 } ^ { v } \times 3 }$ with its $k$ nearest neighbors. After that, we obtain the initial point tokens $T _ { 1 } ^ { v } \in \mathbb { R } ^ { N _ { 1 } ^ { v } \times C _ { 1 } }$ for the 1-st stage of the encoder, which embeds $N _ { 1 } ^ { e }$ local patterns of the 3D shape. Between the $( i - 1 )$ -th and $i$ -th stages, $1 < i \leq S$ , we merge $T _ { i - 1 } ^ { \dot { v } } \in \mathbb { R } ^ { \mathsf { \tilde { N } } _ { i - 1 } \times C _ { i - 1 } }$ to acquire the downsampled point tokens for the $i$ -th stage. We utilize MLP layers and a max pooling to integrate every $k$ tokens nearest to $P _ { i } ^ { v }$ indexed by $I _ { i }$ , which outputs $T _ { i } ^ { v } \in \mathbb { R } ^ { N _ { i } \times C _ { i } }$ . Due to our multi-scale masking, the merged $T _ { i } ^ { v }$ corresponds to the same visible parts of $T _ { i - 1 } ^ { v }$ , which enables the consistent feature encoding across different scales. For larger $i$ of deeper stages, we set higher feature dimension $C _ { i }$ to encode spatial geometries with richer semantics.
|
| 59 |
+
|
| 60 |
+
Local Spatial Self-Attention. During pre-training, we expect point tokens in the multi-stage encoder to capture global cues for 3D shapes, which benefits the reconstruction of masked parts. However, when fine-tuning on downstream tasks without masked autoencoding, point tokens in the shallower stages are better to mainly focus on local information and not to be disturbed by long-range signals, referring to the inductive bias of 3D locality [30]. Thus, during fine-tuning, we modify the original self-attention layer in the encoder with a local spatial constraint that only neighboring tokens within a ball query would be available for attention calculation. As the point tokens are downsampled by stages, we set increasing radii $\{ r _ { i } \} _ { i = 1 } ^ { S }$ of multi-scale ball queries for gradually expanding the attention scopes, which fulfills the local-to-global feature aggregation scheme.
|
| 61 |
+
|
| 62 |
+
# 3.3 Hierarchical Decoder
|
| 63 |
+
|
| 64 |
+
Via the hierarchical encoder, we obtain the encoded visible tokens $\{ T _ { i } ^ { v } \} _ { i = 1 } ^ { S }$ of all scales. Starting from the highest and concatenate $S$ -th scale, we assign a sharedem with the visible tokens arnable mask token to. We denote them as ked positions with coordin $P _ { S } ^ { m }$ $T _ { S } ^ { v }$ $\{ H _ { 1 } ^ { v } , H _ { 1 } ^ { m } \}$ $\{ P _ { S } ^ { v } , P _ { S } ^ { m } \}$ S , which serve as the input of the hierarchical decoder. We design the decoder to be lightweight with $S - 1$ stages and only one decoder block for each stage, which enforces the encoder to embed more semantics of the point clouds. Each decoder block consists of a vanilla self-attention layer and an FFN. We do not apply the local constraint to the attention in the decoder, since a global understanding between visible and mask tokens is crucial to the reconstruction.
|
| 65 |
+
|
| 66 |
+
Point Token Upsampling. We upsample the point tokens between stages to progressively recover the fine-grained geometries of 3D shapes before reconstruction. We regulate that the $j$ -th stage of the decoder corresponds to the $( S + 1 - j )$ -th stage of the encoder, both of which contain point tokens of the same $( S + 1 - j )$ -th scale with the feature dimension $C _ { S + 1 - j }$ . Between the $( j - 1 )$ - th and $j$ -th stage, $1 < j \le S - 1$ , we upsample the tokens $\{ H _ { j - 1 } ^ { v } , H _ { j - 1 } ^ { m } \}$ from the coordinates $\{ P _ { S + 2 - j } ^ { v } , P _ { S + 2 - j } ^ { m } \}$ into $\{ P _ { S + 1 - j } ^ { v } , P _ { S + 1 - j } ^ { m } \}$ via the token propagation module. Specifically, we obtain the $k$ nearest neighbors of each point token in $\{ H _ { j - 1 } ^ { v } , H _ { { \underline { { j } } } - 1 } ^ { m } \}$ indexed by $I _ { S + 2 - j }$ , and recover their neighbors’ features by weighted interpolation referring to PointNet+ $^ { \cdot + }$ [30], which generates the tokens $\{ \bar { H } _ { j } ^ { v } , H _ { j } ^ { m } \}$ of the $j$ -th stage.
|
| 67 |
+
|
| 68 |
+
Table 1: Linear evaluation on ModelNet40 [44] by SVM. We report different self-supervised learning methods and underline the second-best one.
|
| 69 |
+
|
| 70 |
+
<table><tr><td rowspan=1 colspan=2>Method Acc. (%)</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=3 colspan=1>3D-GAN [43] 83.3Latent-GAN [39] 85.7</td></tr><tr><td rowspan=5 colspan=1></td><td rowspan=5 colspan=1>Latent-GAN [39] 85.7SO-Net [22] 87.3FoldingNet [47] 88.4MAP-VAE[17] 88.4VIP-GAN[16] 90.2</td></tr><tr><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>87.3</td></tr><tr><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>88.4</td></tr><tr><td rowspan=4 colspan=1></td><td rowspan=2 colspan=1>DGCNN + Jiasaw [37] 90.6DGCNN + OcCo [40] 90.7DGCNN + CrossPoint [2] 91.2</td></tr><tr><td rowspan=1 colspan=1>90.7</td></tr><tr><td rowspan=1 colspan=1>Transformer + OcCo [49] 89.6</td></tr><tr><td rowspan=1 colspan=1>Point-BERT[49] 87.4</td></tr><tr><td rowspan=1 colspan=2>Point-M2AE 92.9</td></tr><tr><td rowspan=1 colspan=2>Improvement +1.7</td></tr></table>
|
| 71 |
+
|
| 72 |
+
Table 2: Shape classification on ModelNet40 [44]. ‘#points’ and ‘Acc.’ denote the number of points for training and the overall accuracy. [S] represents finetuning after self-supervised pre-training.
|
| 73 |
+
|
| 74 |
+
<table><tr><td>Method</td><td>#points</td><td>Acc. (%)</td></tr><tr><td>PointNet [29] PointNet++ [30]</td><td>1k</td><td>89.2</td></tr><tr><td></td><td>1k</td><td>90.5</td></tr><tr><td>PointCNN [23]</td><td>1k</td><td>92.2</td></tr><tr><td>[S] SO-Net [22] DGCNN [41]</td><td>5k</td><td>92.5</td></tr><tr><td>PCT[15]</td><td>1k</td><td>92.9</td></tr><tr><td>Point Transformer [52]</td><td>1k</td><td>93.2</td></tr><tr><td></td><td>-</td><td>93.7</td></tr><tr><td>Transformer [49]</td><td>1k</td><td>91.4</td></tr><tr><td>[S] Transformer + OcCo [49]</td><td>1k</td><td>92.1</td></tr><tr><td>[S] Point-BERT[49]</td><td>1k</td><td>93.2</td></tr><tr><td>[S] Point-BERT</td><td>4k</td><td>93.4</td></tr><tr><td>[S] Point-BERT</td><td>8k</td><td>93.8</td></tr><tr><td>[S] Point-M2AE</td><td>1k</td><td>94.0</td></tr></table>
|
| 75 |
+
|
| 76 |
+
Skip Connections. To further complement the fine-grained geometries, we channel-wisely concatenate the visible tokens $H _ { j } ^ { v } \in \mathbb { R } ^ { N _ { S + 1 - j } \times C _ { S + 1 - j } }$ of the decoder with $T _ { S + 1 - j } ^ { v } \in \mathbb { R } ^ { N _ { S + 1 - j } \times \check { C } _ { S + 1 - j } }$ from the corresponding $( S + 1 - j )$ -th stage of the encoder via skip connections, and adopt a linear projection layer to fuse their features. For the mask tokens $H _ { j } ^ { m }$ , we keep them unchanged, since the encoder only contains visible tokens without the masked ones.
|
| 77 |
+
|
| 78 |
+
Point Reconstruction. After $S - 1$ stages of the decoder, we acquire $\{ H _ { S - 1 } ^ { v } , H _ { S - 1 } ^ { m } \}$ with coordinates $\{ P _ { 2 } ^ { v } , P _ { 2 } ^ { m } \}$ and reconstruct the masked values from the mask tokens $H _ { S - 1 } ^ { m }$ . Other than predicting values at the 0-th scale of the input point cloud $P$ , we reconstruct the coordinates of $P _ { 1 } ^ { m }$ , namely, recovering the masked positions of the 1-st scale $P _ { 1 } ^ { m } \in \mathbb { R } ^ { N _ { 1 } ^ { m } \times 3 }$ from the 2-nd scale $\bar { P _ { 2 } ^ { m } } \in \mathbb { R } ^ { N _ { 2 } ^ { m } \times 3 }$ . This is because $\{ P _ { 1 } ^ { v } , P _ { 1 } ^ { m } \}$ of the 1-st scale could well represent the overall 3D shape and simultaneously preserve enough local patterns, which already constructs a comparatively challenging pretext task for pre-training. If we further upsample $\{ H _ { S - 1 } ^ { \bar { v } } , H _ { S - 1 } ^ { m } \}$ into $\{ \bar { H } _ { S } ^ { v } , H _ { S } ^ { m } \}$ and reconstruct the masked raw points from $P _ { 1 } ^ { m }$ , the extra spatial noises and computational overhead would adversely influence our performance and efficiency. Therefore, for every token in $H _ { S - 1 } ^ { m } \in \mathbb { R } ^ { N _ { 2 } ^ { m } \times C _ { 2 } }$ , we reconstruct its $k$ nearest neighbors recorded in $I _ { 2 }$ by a reconstruction head of one linear projection layer and compute the loss by $l _ { 2 }$ Chamfer Distance [14], formulated as,
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\begin{array} { r l } & { \widehat { P } _ { 2 \to 1 } ^ { m } = \mathrm { L i n e a r } ( H _ { S - 1 } ^ { m } ) , \mathrm { ~ w h e r e ~ } \widehat { P } _ { 2 \to 1 } ^ { m } \in \mathbb { R } ^ { N _ { 2 } ^ { m } \times k \times 3 } , } \\ & { \mathcal { L } _ { C D } = \mathrm { C h a m f e r D i s t a n c e } ( P _ { 2 \to 1 } ^ { m } , \widehat { P } _ { 2 \to 1 } ^ { m } ) , } \end{array}
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
where $\widehat { P } _ { 2 1 } ^ { m }$ and $P _ { 2 1 } ^ { m }$ denote the predicted and ground-truth reconstruction coordinates from the 2-nd scale to the 1-st scale. We only utilize $\mathcal { L } _ { C D }$ for supervision without contrastive loss to conduct a pure masked autoencoding for self-supervised pre-training.
|
| 85 |
+
|
| 86 |
+
# 4 Experiments
|
| 87 |
+
|
| 88 |
+
In Section 4.1 and Section 4.2, we introduce the pre-training experiments of Point-M2AE and report the fine-tuning performance on various downstream tasks. We also conduct ablation studies in Section 4.3 to validate the effectiveness of our approach.
|
| 89 |
+
|
| 90 |
+
# 4.1 Self-supervised Pre-training
|
| 91 |
+
|
| 92 |
+
Settings. We pre-train our Point-M2AE on ShapeNet [6] dataset, which contains 57,448 synthetic 3D shapes of 55 categories. We set the stage number $S$ as 3, and construct a 3-stage encoder and a
|
| 93 |
+
|
| 94 |
+
Table 3: Shape classification on ScanObjectNN [38]. We report the accuracy $( \% )$ on the three splits of ScanObjectNN. [S] represents fine-tuning after self-supervised pre-training.
|
| 95 |
+
|
| 96 |
+
<table><tr><td>Method</td><td>OBJ-BG</td><td>OBJ-ONLY</td><td>PB-T50-RS</td></tr><tr><td>PointNet [29]</td><td>73.3</td><td>79.2</td><td>68.0</td></tr><tr><td>PointNet++ [30]</td><td>82.3</td><td>84.3</td><td>77.9</td></tr><tr><td>DGCNN [41]</td><td>82.8</td><td>86.2</td><td>78.1</td></tr><tr><td>PointCNN [23]</td><td>86.1</td><td>85.5</td><td>78.5</td></tr><tr><td>Transformer [49]</td><td>79.86</td><td>80.55</td><td>77.24</td></tr><tr><td>[S] Transformer + OcCo [49]</td><td>84.85</td><td>85.54</td><td>78.79</td></tr><tr><td>[S] Point-BERT[49]</td><td>87.43</td><td>88.12</td><td>83.07</td></tr><tr><td>[S] Point-M2AE</td><td>91.22</td><td>88.81</td><td>86.43</td></tr><tr><td>Improvement</td><td>+3.79</td><td>+0.69</td><td>+3.36</td></tr></table>
|
| 97 |
+
|
| 98 |
+
2-stage decoder for hierarchical learning. We adopt 5 blocks in each encoder stage, but only 1 block per stage for the lightweight decoder. For the 3-scale point clouds, we set the point numbers and token dimensions respectively as {512, 256, 64} and {96, 192, 384}. We also set different $k$ for the $k$ -NN at different scales, which are {16, 8, 8}. We mask the highest scale of point clouds with a high ratio of $80 \%$ and set 6 heads for all the attention modules. The detailed training settings are in Appendix.
|
| 99 |
+
|
| 100 |
+
Linear SVM. After pre-training on ShapeNet, we test the 3D representation capability of PointM2AE via linear evaluation on ModelNet40 [44]. We sample 1,024 points from each 3D shape of ModelNet40 and utilize our frozen encoder to extract their features. On top of that, we train a linear SVM and report the classification accuracy in Table 1. As shown, Point-M2AE achieves the best performance among all existing self-supervised methods for point clouds, and surpasses the second-best CrossPoint [2] by $+ 1 . 7 \%$ . Point-M2AE also exceeds Point-BERT [49] by $+ 5 . 5 \%$ , which is a masked point modeling method with a MoCo loss [19] but adopts a standard transformer and conducts single-scale learning. It is worth noting that even if we freeze all our parameters, Point-M2AE with $9 2 . 9 \%$ accuracy still outperforms many fully trained methods on ModelNet40, e.g., $9 0 . 5 \%$ by PointNet $^ { + + }$ [30], $9 2 . 8 \%$ by DensePoint [24], etc. The experiments fully demonstrate the superior 3D representation capacity of our Point-M2AE.
|
| 101 |
+
|
| 102 |
+
# 4.2 Downstream Tasks
|
| 103 |
+
|
| 104 |
+
For fine-tuning on downstream tasks, we discard the hierarchical decoder in pre-training and append different heads onto the hierarchical encoder for different tasks.
|
| 105 |
+
|
| 106 |
+
Shape Classification. We fine-tune Point-M2AE on two shape classification datasets: the widely adopted ModelNet40 [44] and the challenging ScanObjectNN [38]. For local spatial attention layers, we set the ball queries’ radii of 3-scale point clouds as {0.32, 0.64, 1.28}. We follow Point-BERT to use the voting strategy [25] for fair comparison on ModelNet40. To handle the noisy spatial structures, we increase $k$ of $k$ -NN into {32, 16, 16} for ScanObjectNN to encode local patterns with larger receptive fields. As reported in Table 2, Point-M2AE achieves $9 4 . 0 \%$ accuracy on ModelNet40 with 1024 points per sample, which surpasses Point-BERT fine-tuned with 1024 points by $+ 0 . 8 \%$ and 8192 points by $+ 0 . 2 \%$ . For ScanObjectNN in Table 3, our Point-M2AE outperforms the secondbest Point-BERT by a significant margin, $+ 3 . 7 9 \%$ , $+ 0 . 6 9 \%$ and $+ 3 . 3 6 \%$ , respectively for the three splits, indicating our great advantages under complex circumstances by multi-scale encoding. As ScanObjectNN of real-world scenes has a large semantic gap with the pre-trained synthetic ShapeNet, Point-M2AE also exerts strong transfer ability to understand point clouds of another domain.
|
| 107 |
+
|
| 108 |
+
Part Segmentation. We evaluate Point-M2AE for part segmentation on ShapeNetPart [48], which predicts per-point part labels and requires detailed understanding for local patterns. We adopt an extremely simple segmentation head to validate the effectiveness of our pre-training for well capturing both high-level semantics and fine-grained details. By the hierarchical encoder, we obtain
|
| 109 |
+
|
| 110 |
+
Table 4: Few-shot classification on ModelNet40 [44]. We report the average accuracy $( \% )$ and standard deviation $( \% )$ of 10 independent experiments.
|
| 111 |
+
|
| 112 |
+
<table><tr><td rowspan="2">Method</td><td colspan="2">5-way</td><td colspan="2">10-way</td></tr><tr><td>10-shot</td><td>20-shot</td><td>10-shot</td><td>20-shot</td></tr><tr><td>DGCNN [41]</td><td>91.8 ± 3.7</td><td>93.4 ± 3.2</td><td>86.3 ± 6.2</td><td>90.9 ± 5.1</td></tr><tr><td>[S] DGCNN + OcCo [40]</td><td>91.9 ± 3.3</td><td>93.9 ± 3.1</td><td>86.4 ± 5.4</td><td>91.3 ± 4.6</td></tr><tr><td>Transformer [49]</td><td>87.8 ±5.2</td><td>93.3 ± 4.3</td><td>84.6 ± 5.5</td><td>89.4 ± 6.3</td></tr><tr><td>[S] Transformer + OcCo [49]</td><td>94.0±3.6</td><td>95.9 ± 2.3</td><td>89.4 ± 5.1</td><td>92.4 ± 4.6</td></tr><tr><td>[S] Point-BERT[49]</td><td>94.6 ± 3.1</td><td>96.3 ± 2.7</td><td>91.0 ± 5.4</td><td>92.7 ± 5.1</td></tr><tr><td>[S] Point-M2AE</td><td>96.8 ± 1.8</td><td>98.3 ± 1.4</td><td>92.3 ± 4.5</td><td>95.0 ± 3.0</td></tr><tr><td>Improvement</td><td>+2.2</td><td>+2.0</td><td>+1.3</td><td>+2.3</td></tr></table>
|
| 113 |
+
|
| 114 |
+
Table 5: Part segmentation on ShapeNetPart [48]. $\mathbf { \hat { m } } \mathbf { I o U } _ { C }$ ’ $( \% )$ and $\mathbf { \dot { m l o U } } _ { I } ,$ $( \% )$ denote the mean IoU across all part categories and all instances in the dataset, respectively.
|
| 115 |
+
|
| 116 |
+
<table><tr><td>Method</td><td>mIoUc</td><td>mIoU1</td></tr><tr><td>PointNet [29] PointNet++ [30]</td><td>80.39 81.85</td><td>83.70 85.10</td></tr><tr><td>DGCNN [41]</td><td>82.33</td><td>85.20</td></tr><tr><td>Transformer [49]</td><td>83.42</td><td>85.10</td></tr><tr><td>[S] Transformer + OcCo [49]</td><td>83.42</td><td>85.10</td></tr><tr><td>[S] Point-BERT[49]</td><td>84.11</td><td>85.60</td></tr><tr><td>[S] Point-M2AE</td><td>84.86</td><td>86.51</td></tr><tr><td>Improvement</td><td>+0.75</td><td>+0.91</td></tr></table>
|
| 117 |
+
|
| 118 |
+
Table 6: 3D object detection on ScanNetV2 [9]. We report the performance $( \% )$ of self-supervised learning methods based on VoteNet [12] and 3DETR-m [26].
|
| 119 |
+
|
| 120 |
+
<table><tr><td>Method</td><td>AP25</td><td>AP50</td></tr><tr><td>VoteNet [12] [S] STRL [20] [S] PointContrast [45]</td><td>58.6 59.5 59.2</td><td>33.5 38.4 38.0</td></tr><tr><td>[S] DepthContrast [51] 3DETR[26]</td><td>61.3 62.1</td><td>1 37.9</td></tr><tr><td>3DETR-m [26]</td><td>65.0</td><td>47.0</td></tr><tr><td>[S] Point-M2AE</td><td>66.3</td><td>48.3</td></tr><tr><td>Improvement</td><td>+1.3</td><td>+1.3</td></tr></table>
|
| 121 |
+
|
| 122 |
+
3-scale point tokens of {512, 256, 64} points, and perform feature propagation in PointNet $^ { - + }$ [30] to independently upsample the tokens into 2048 points of the input point cloud. Then, we concatenate the upsampled 3-scale features for each point and predict the part label by stacked linear projection layers. As reported in Table 4.2, Point-M2AE achieves the best $8 6 . 5 1 \%$ instance mIoU with the simple segmentation head, surpassing the second-best Point-BERT by $+ 0 . 9 1 \%$ . Note that Point-BERT [49] and other methods [29, 30, 41] adopt hierarchical segmentation heads to progressively upsample the point features from intermediate layers, while our head contains no hierarchical structure and only relies on the pre-trained encoder to capture the multi-scale information of point clouds. The results fully demonstrate the significance of Point-M2AE’s multi-scale pre-training to segmentation tasks.
|
| 123 |
+
|
| 124 |
+
Few-shot Classification. We conduct experiments for few-shot classification on ModelNet40 [44] to evaluate the performance of Point-M2AE with limited fine-tuning data. As reported in Table 4.2, Point-M2AE achieves the best performance for all four settings, and surpasses Point-BERT by $+ 2 . 2 \%$ , $+ 2 . 0 \%$ , $+ 1 . 3 \%$ , and $+ 2 . 7 \%$ , respectively. Our approach also shows smaller deviations than other transformer-based methods, which indicates Point-M2AE has learned to produce more universal 3D representations for well adapting to downstream tasks under low-data regimes.
|
| 125 |
+
|
| 126 |
+
3D Object Detection To further evaluate our hierarchical pre-training on 3D object detection, we apply Point-M2AE to serving as the feature backbone on the indoor ScanNetV2 [9] dataset. We select 3DETR-m [26] as our baseline, which consists of a 3-block encoder and a transformer decoder. Considering the quite different dataset statistics, e.g., 2k input points for ShapeNet [6] and $5 0 \mathrm { k }$ input points for ScanNetV2, we adopt the same encoder architecture with that of 3DETR-m, and keep our hierarchical decoder with skip connections unchanged for self-supervised pre-training on ScanNetV2. More details of models and training are in Appendix. As reported in Table 4.2, compared to training from scratch, our hierarchical pre-training boosts the performance of 3DETR-m by $+ 1 . 3 4 \%$ $\mathrm { A P _ { 2 5 } }$ and $+ 1 . 2 9 \%$ $\mathsf { A P } _ { 5 0 }$ . The experiments demonstrate the effectiveness of Point-M2AE to learn multi-scale point cloud encoding for object detection and its potential to benefit a wider range of 3D applications.
|
| 127 |
+
|
| 128 |
+

|
| 129 |
+
Figure 4: Visualization of fine-grained information. We denote the outputs from hierarchical and non-hierarchical architectures as [NH] and [H], respectively. For an input point cloud (Middle), we visualize its extracted features (Left) and reconstruction results (Right).
|
| 130 |
+
|
| 131 |
+
Table 7: Hierarchical Modules. ‘H’ represents the encoder and decoder with multi-stage hierarchies. ‘Skip C.’ denotes the skip connections.
|
| 132 |
+
|
| 133 |
+
<table><tr><td>Encoder</td><td>Decoder</td><td>Skip C.</td><td>Acc. (%)</td></tr><tr><td>H</td><td>H</td><td>√</td><td>92.9</td></tr><tr><td></td><td>1</td><td>√</td><td>90.7</td></tr><tr><td>1</td><td>H</td><td>√</td><td>91.5</td></tr><tr><td>H</td><td>1</td><td>√</td><td>92.2</td></tr><tr><td>H</td><td>H</td><td></td><td>92.1</td></tr></table>
|
| 134 |
+
|
| 135 |
+
Table 8: Different Masking Strategy. ‘MS Mask’ and ‘Ratio’ denote the multi-scale masking and the mask ratio.
|
| 136 |
+
|
| 137 |
+
<table><tr><td>MS Mask</td><td>Ratio</td><td>Acc. (%)</td></tr><tr><td>了</td><td>0.8</td><td>92.9</td></tr><tr><td>1</td><td>0.8</td><td>88.4</td></tr><tr><td>√</td><td>0.6</td><td>92.3</td></tr><tr><td><</td><td>0.7</td><td>92.7</td></tr><tr><td>√</td><td>0.9</td><td>92.5</td></tr></table>
|
| 138 |
+
|
| 139 |
+
# 4.3 Ablation Study
|
| 140 |
+
|
| 141 |
+
We conduct ablation study by modifying one of the components at a time during pre-training and explore the best masking strategy. We report the classification accuracy on ModelNet40 [44] by linear SVM to evaluate the pre-trained representations. For downstream tasks, we train the network from scratch to validate the significance of our hierarchical pre-training.
|
| 142 |
+
|
| 143 |
+
Hierarchical Modules. As reported in Table 7, on top of our final solution, Point-M2AE, in the first row, we respectively experiment with removing the hierarchical encoder, hierarchical decoder, and skip connections from our framework. Specifically, we replace our encoder and decoder with 1-stage plain architectures similar to MAE, which contains 15 and 2 vanilla transformer blocks, respectively. We observe the absence of multi-stage structures either in encoder or decoder hurts the performance, and the hierarchical encoder plays a better role than the decoder. Also, the skip connections well benefits the accuracy by providing complementary information for the decoder.
|
| 144 |
+
|
| 145 |
+
Masking Strategy. In Table 8, we report Point-M2AE with different mask settings. Without the multi-scale masking, we randomly generate masks at each scale, which leads to fragmented visible regions for all scales. With this strategy, the network would ‘peek’ different parts of the point cloud at different stages, which disturbs the representation learning and harms the performance by $- 4 . 5 \%$ accuracy. For different mask ratios, we find the $8 0 \%$ ratio performs the best to build a properly challenging pretext task for self-supervised pre-training.
|
| 146 |
+
|
| 147 |
+
With and Without Pre-training. We report the performance of Point-M2AE on downstream tasks with and without the pre-training in Table 9. For ‘w/o’, we randomly initialize the parameters and train the network from scratch. As shown, the pre-training can largely boost the performance on four datasets respectively by $+ 1 . 5 \%$ , $+ 2 . 5 \%$ , $+ 3 . 8 \%$ , and $+ 1 . 1 \bar { \% }$ , which indicates the superiority and significance of our hierarchical pre-training.
|
| 148 |
+
|
| 149 |
+
Table 9: With and without the pre-training. ‘ModelNet40-FS’ denotes the few-shot classification on 10-way 20-shot ModelNet40 [44].
|
| 150 |
+
|
| 151 |
+
<table><tr><td>Dataset</td><td>w/o (%)</td><td>w (%)</td></tr><tr><td>ModelNet40 [44]</td><td>92.5</td><td>94.0</td></tr><tr><td>ScanObjectNN[38]</td><td>83.9</td><td>86.4</td></tr><tr><td>ModelNet40-FS [44]</td><td>91.2</td><td>95.0</td></tr><tr><td>ShapeNetPart [48]</td><td>85.4</td><td>86.5</td></tr></table>
|
| 152 |
+
|
| 153 |
+

|
| 154 |
+
Figure 5: Visualization of multi-scale point clouds. In each row, we visualize the input point clouds, their multi-scale representations, the reconstructed coordinates, and multi-scale masked point clouds.
|
| 155 |
+
|
| 156 |
+
# 5 Visualization
|
| 157 |
+
|
| 158 |
+
Multi-scale Masking. To ease the understanding of our multi-scale masking strategy, we visualize the input point cloud, the 3-scale representations, the reconstructed point cloud, and 3-scale masked point clouds, respectively in each row of Figure 5. As shown, different scales can represent different levels of geometric details and semantics for point clouds. By the multi-scale masking strategy, we observe the visible positions of masked point clouds are block-wise within one scale and consistent across scales, which is significant for our hierarchical pre-training.
|
| 159 |
+
|
| 160 |
+
Fine-grained Information. The fine-grained 3D structures, e.g., thin branches of a plant, fingers of a human, engines of a plane, are significant to distinguish similar shapes and can be well encoded by our hierarchical representations. In Figure 4, we compare our Point-M2AE with multi-stage, [H], and single-scale, [NH], architectures by visualizing their extracted point features and reconstructed point clouds during pre-training. In contarst to the single-scale network, the multi-scale one indicates higher feature responses in the fine-grained structures and reconstructs more accurate spatial details.
|
| 161 |
+
|
| 162 |
+
# 6 Conclusion
|
| 163 |
+
|
| 164 |
+
We propose Point-M2AE, a multi-scale masked autoencoder for self-supervised pre-training on 3D point clouds. With a hierarchical architecture, Point-M2AE learns to produce powerful 3D representations by encoding multi-scale point clouds and reconstructing the masked coordinates from a global-to-local upsampling scheme. Extensive experiments have demonstrated the superiority of Point-M2AE to be a strong 3D representation learner. For limitations and future work, we will focus on applying Point-M2AE for wider 3D applications, e.g., outdoor and open-world scene understanding. We do not foresee negative social impact from the proposed work.
|
| 165 |
+
|
| 166 |
+
Acknowledgement. This work is supported by the National Natural Science Foundation of China (Grant No. 62206272), Shanghai Committee of Science and Technology (Grant No. 21DZ1100100), Centre for Perceptual and Interactive Intelligence Limited, and the General Research Fund through the Research Grants Council of Hong Kong (Grant No. 14204021, 14207319).
|
| 167 |
+
|
| 168 |
+
# References
|
| 169 |
+
|
| 170 |
+
[1] Idan Achituve, Haggai Maron, and Gal Chechik. Self-supervised learning for domain adaptation on point clouds. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 123–133, 2021. 3
|
| 171 |
+
[2] Mohamed Afham, Isuru Dissanayake, Dinithi Dissanayake, Amaya Dharmasiri, Kanchana Thilakarathna, and Ranga Rodrigo. Crosspoint: Self-supervised cross-modal contrastive learning for 3d point cloud understanding. arXiv preprint arXiv:2203.00680, 2022. 2, 3, 6, 7
|
| 172 |
+
[3] Alexei Baevski, Wei-Ning Hsu, Qiantong Xu, Arun Babu, Jiatao Gu, and Michael Auli. Data2vec: A general framework for self-supervised learning in speech, vision and language. arXiv preprint arXiv:2202.03555, 2022. 1, 3
|
| 173 |
+
[4] Hangbo Bao, Li Dong, and Furu Wei. Beit: Bert pre-training of image transformers. arXiv preprint arXiv:2106.08254, 2021. 3
|
| 174 |
+
[5] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. 1, 3
|
| 175 |
+
[6] 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. 2, 6, 8
|
| 176 |
+
[7] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pages 1597–1607. PMLR, 2020. 1, 3
|
| 177 |
+
[8] Xinlei Chen and Kaiming He. Exploring simple siamese representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 15750–15758, 2021. 1, 3
|
| 178 |
+
[9] Angela Dai, Angel X Chang, Manolis Savva, Maciej Halber, Thomas Funkhouser, and Matthias Nießner. Scannet: Richly-annotated 3d reconstructions of indoor scenes. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 5828–5839, 2017. 3, 8
|
| 179 |
+
[10] 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. 1, 3
|
| 180 |
+
[11] 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. 3
|
| 181 |
+
[12] Zhipeng Ding, Xu Han, and Marc Niethammer. Votenet: A deep learning label fusion method for multi-atlas segmentation. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pages 202–210. Springer, 2019. 8
|
| 182 |
+
[13] 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. 1, 3
|
| 183 |
+
[14] Haoqiang Fan, Hao Su, and Leonidas J Guibas. A point set generation network for 3d object reconstruction from a single image. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 605–613, 2017. 6
|
| 184 |
+
[15] Meng-Hao Guo, Jun-Xiong Cai, Zheng-Ning Liu, Tai-Jiang Mu, Ralph R Martin, and Shi-Min Hu. Pct: Point cloud transformer. Computational Visual Media, 7(2):187–199, 2021. 6
|
| 185 |
+
[16] Zhizhong Han, Mingyang Shang, Yu-Shen Liu, and Matthias Zwicker. View inter-prediction gan: Unsupervised representation learning for 3d shapes by learning global shape memories to support local view predictions. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 8376–8384, 2019. 6
|
| 186 |
+
[17] Zhizhong Han, Xiyang Wang, Yu-Shen Liu, and Matthias Zwicker. Multi-angle point cloudvae: Unsupervised feature learning for 3d point clouds from multiple angles by joint selfreconstruction and half-to-half prediction. In 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pages 10441–10450. IEEE, 2019. 6
|
| 187 |
+
[18] Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross Girshick. Masked autoencoders are scalable vision learners. arXiv preprint arXiv:2111.06377, 2021. 1, 3
|
| 188 |
+
[19] Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 9729–9738, 2020. 1, 3, 7 [20] Siyuan Huang, Song ervised representation learning for 3d point clouds. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 6535–6545, 2021. 8 [21] Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc Le, YunHsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. In International Conference on Machine Learning, pages
|
| 189 |
+
4904–4916. PMLR, 2021. 1 [22] Jiaxin Li, Ben M Chen, and Gim Hee Lee. So-net: Self-organizing network for point cloud analysis. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 9397–9406, 2018. 6 [23] Yangyan Li, Rui Bu, Mingchao Sun, Wei Wu, Xinhan Di, and Baoquan Chen. Pointcnn: Convolution on $\mathbf { X }$ -transformed points. Advances in neural information processing systems,
|
| 190 |
+
31:820–830, 2018. 6, 7 [24] Yongcheng Liu, Bin Fan, Gaofeng Meng, Jiwen Lu, Shiming Xiang, and Chunhong Pan. Densepoint: Learning densely contextual representation for efficient point cloud processing. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 5239–5248,
|
| 191 |
+
2019. 7 [25] Yongcheng Liu, Bin Fan, Shiming Xiang, and Chunhong Pan. Relation-shape convolutional neural network for point cloud analysis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8895–8904, 2019. 7 [26] Ishan Misra, Rohit Girdhar, and Armand Joulin. An end-to-end transformer model for 3d object detection. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 2906–2917, October 2021. 8 [27] Yatian Pang, Wenxiao Wang, Francis EH Tay, Wei Liu, Yonghong Tian, and Li Yuan. Masked autoencoders for point cloud self-supervised learning. arXiv preprint arXiv:2203.06604, 2022.
|
| 192 |
+
3 [28] Omid Poursaeed, Tianxing Jiang, Han Qiao, Nayun Xu, and Vladimir G Kim. Self-supervised learning of point clouds via orientation estimation. In 2020 International Conference on 3D Vision (3DV), pages 1018–1028. IEEE, 2020. 3 [29] Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 652–660, 2017. 5, 6, 7, 8 [30] Charles R Qi, Li Yi, Hao Su, and Leonidas J Guibas. Pointnet++: Deep hierarchical feature learning on point sets in a metric space. arXiv preprint arXiv:1706.02413, 2017. 5, 6, 7, 8 [31] 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. 1 [32] Alec Radford and Karthik Narasimhan. Improving language understanding by generative pre-training. 2018. 1, 3 [33] Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019. 1, 3 [34] Jason Tyler Rolfe. Discrete variational autoencoders. arXiv preprint arXiv:1609.02200, 2016. 3 [35] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. Springer, 2015. 2, 4 [36] Jonathan Sauder and Bjarne Sievers. Self-supervised deep learning on point clouds by reconstructing space. Advances in Neural Information Processing Systems, 32, 2019. 3 [37] Jonathan Sauder and Bjarne Sievers. Self-supervised deep learning on point clouds by reconstructing space. Advances in Neural Information Processing Systems, 32, 2019. 6 [38] Mikaela Angelina Uy, Quang-Hieu Pham, Binh-Son Hua, Thanh Nguyen, and Sai-Kit Yeung. Revisiting point cloud classification: A new benchmark dataset and classification model on real-world data. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1588–1597, 2019. 2, 7, 9 [39] Diego Valsesia, Giulia Fracastoro, and Enrico Magli. Learning localized representations of point clouds with graph-convolutional generative adversarial networks. IEEE Transactions on Multimedia, 23:402–414, 2020. 6 [40] Hanchen Wang, Qi Liu, Xiangyu Yue, Joan Lasenby, and Matt J Kusner. Unsupervised point cloud pre-training via occlusion completion. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 9782–9792, 2021. 3, 6, 8
|
| 193 |
+
[41] Yue Wang, Yongbin Sun, Ziwei Liu, Sanjay E Sarma, Michael M Bronstein, and Justin M Solomon. Dynamic graph cnn for learning on point clouds. Acm Transactions On Graphics (tog), 38(5):1–12, 2019. 6, 7, 8
|
| 194 |
+
[42] Chen Wei, Haoqi Fan, Saining Xie, Chao-Yuan Wu, Alan Yuille, and Christoph Feichtenhofer. Masked feature prediction for self-supervised visual pre-training. arXiv preprint arXiv:2112.09133, 2021. 3
|
| 195 |
+
[43] 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. 6
|
| 196 |
+
[44] Zhirong Wu, Shuran Song, Aditya Khosla, Fisher Yu, Linguang Zhang, Xiaoou Tang, and Jianxiong Xiao. 3d shapenets: A deep representation for volumetric shapes. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1912–1920, 2015. 2, 6, 7, 8, 9
|
| 197 |
+
[45] Saining Xie, Jiatao Gu, Demi Guo, Charles R Qi, Leonidas Guibas, and Or Litany. Pointcontrast: Unsupervised pre-training for 3d point cloud understanding. In European conference on computer vision, pages 574–591. Springer, 2020. 3, 8
|
| 198 |
+
[46] Zhenda Xie, Zheng Zhang, Yue Cao, Yutong Lin, Jianmin Bao, Zhuliang Yao, Qi Dai, and Han Hu. Simmim: A simple framework for masked image modeling. arXiv preprint arXiv:2111.09886, 2021. 1
|
| 199 |
+
[47] Yaoqing Yang, Chen Feng, Yiru Shen, and Dong Tian. Foldingnet: Point cloud auto-encoder via deep grid deformation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 206–215, 2018. 6
|
| 200 |
+
[48] Li Yi, Vladimir G Kim, Duygu Ceylan, I-Chao Shen, Mengyan Yan, Hao Su, Cewu Lu, Qixing Huang, Alla Sheffer, and Leonidas Guibas. A scalable active framework for region annotation in 3d shape collections. ACM Transactions on Graphics (ToG), 35(6):1–12, 2016. 2, 7, 8, 9
|
| 201 |
+
[49] Xumin Yu, Lulu Tang, Yongming Rao, Tiejun Huang, Jie Zhou, and Jiwen Lu. Pointbert: Pre-training 3d point cloud transformers with masked point modeling. arXiv preprint arXiv:2111.14819, 2021. 3, 6, 7, 8
|
| 202 |
+
[50] Renrui Zhang, Ziyu Guo, Wei Zhang, Kunchang Li, Xupeng Miao, Bin Cui, Yu Qiao, Peng Gao, and Hongsheng Li. Pointclip: Point cloud understanding by clip. arXiv preprint arXiv:2112.02413, 2021. 1
|
| 203 |
+
[51] Zaiwei Zhang, Rohit Girdhar, Armand Joulin, and Ishan Misra. Self-supervised pretraining of 3d features on any point-cloud. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 10252–10263, 2021. 3, 8
|
| 204 |
+
[52] Hengshuang Zhao, Li Jiang, Jiaya Jia, Philip HS Torr, and Vladlen Koltun. Point transformer. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 16259– 16268, 2021. 6
|
| 205 |
+
[53] Jinghao Zhou, Chen Wei, Huiyu Wang, Wei Shen, Cihang Xie, Alan Yuille, and Tao Kong. ibot: Image bert pre-training with online tokenizer. arXiv preprint arXiv:2111.07832, 2021. 1, 3
|
| 206 |
+
|
| 207 |
+
# Checklist
|
| 208 |
+
|
| 209 |
+
1. For all authors...
|
| 210 |
+
|
| 211 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 212 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 213 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes]
|
| 214 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 215 |
+
|
| 216 |
+
2. If you are including theoretical results...
|
| 217 |
+
|
| 218 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes]
|
| 219 |
+
|
| 220 |
+
3. If you ran experiments...
|
| 221 |
+
|
| 222 |
+
(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]
|
| 223 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 224 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 225 |
+
(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]
|
| 226 |
+
|
| 227 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 228 |
+
|
| 229 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 230 |
+
(b) Did you mention the license of the assets? [N/A]
|
| 231 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
|
| 232 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 233 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 234 |
+
|
| 235 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 236 |
+
|
| 237 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 238 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 239 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/O476oWmiNNp/O476oWmiNNp.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/VNqaB1g9393/VNqaB1g9393.md
ADDED
|
@@ -0,0 +1,321 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DECOUPLED ADAPTATION FOR CROSS-DOMAIN OBJECT DETECTION
|
| 2 |
+
|
| 3 |
+
Junguang Jiang, Baixu Chen, Jianmin Wang, Mingsheng Long
|
| 4 |
+
School of Software, BNRist, Tsinghua University, China
|
| 5 |
+
{jjg20,chenbx18}@mails.tsinghua.edu.cn, {jimwang,mingsheng}@tsinghua.edu.cn
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Cross-domain object detection is more challenging than object classification since multiple objects exist in an image and the location of each object is unknown in the unlabeled target domain. As a result, when we adapt features of different objects to enhance the transferability of the detector, the features of the foreground and the background are easy to be confused, which may hurt the discriminability of the detector. Besides, previous methods focused on category adaptation but ignored another important part for object detection, i.e., the adaptation on bounding box regression. To this end, we propose $D$ -adapt, namely Decoupled Adaptation, to decouple the adversarial adaptation and the training of the detector. Besides, we introduce a bounding box adaptor to improve the localization performance. Experiments show that $D$ -adapt achieves state-of-the-art results on four crossdomain object detection tasks and yields $17 \%$ and $21 \%$ relative improvement on benchmark datasets Clipart1k and Comic $2 k$ in particular.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
The object detection task has aroused great interest due to its wide applications. In the past few years, the development of deep neural networks has boosted the performance of object detectors [33; 15; 41]. While these detectors have achieved excellent performance on the benchmark datasets [11; 31], object detection in the real world still faces challenges from the large variance in viewpoints, object appearance, backgrounds, illumination, image quality, etc. Such domain shifts have been observed to cause significant performance drop [8]. Thus, some work uses domain adaptation [39] to transfer a detector from a source domain, where sufficient training data is available, to a target domain where only unlabeled data is available [8; 43]. This technique successfully improves the performance of the detector on the target domain. However, the improvement of domain adaptation in object detection remains relatively mild compared with that in object classification.
|
| 14 |
+
|
| 15 |
+
The inherent challenges come from three aspects. Data challenge: what to adapt in the object detection task is unknown. Instance feature adaptation in the object level (Figure 1(a)) might confuse the features of the foreground and the background since the generated proposals may not be true objects and many true objects might be missing (Figure 5). Global feature adaptation in the image level (Figure 1(b)) is likely to mix up features of different objects since each input image of detection has multiple objects. Local feature adaptation in the pixel level (Figure 1(c)) can alleviate domain shift when the shift is primarily low-level, yet it will struggle when the domains are different at the semantic level. Architecture challenge: while the above adaptation methods introduce domain discriminators and gradient reverse layers [12] into the detector architecture to encourage domaininvariant features, the discriminability of features might get deteriorated [6; 5], which will greatly influence the localization and the classification of the detectors. Besides, where to place these modules in the detection architecture has a great impact on the final performance but is a little tricky. Therefore, the scalability of these methods to different detection architectures is not so satisfactory. Task challenge: object detection is a multi-task learning problem, consisting of both classification and localization. Yet previous adaptation algorithms mainly explored the category adaptation, and it’s still difficult to obtain an adaptation model suitable for different tasks at the same time.
|
| 16 |
+
|
| 17 |
+
To overcome these challenges, we propose a general framework – $D$ -adapt, namely Decoupled Adaptation. Since adversarial alignment directly on the features of the detector might hurt its discriminability (architecture challenge), we decouple the adversarial adaptation from the training of the detector by introducing a parameter-independent category adaptor (see Figure 1(d)). To tackle the task challenge, we introduce another bounding box adaptor that’s decoupled from both the detector and the category adaptor. To tackle the data challenge, we propose to adjust the object-level data distribution for specific adaptation tasks. For example, in the category adaptation step, we encourage the input proposals to have $\mathrm { I o U }$ close to 0 or 1 to better satisfy the low-density separation assumption, while in the bounding box adaptation step, we encourage the input proposals to have IoU between 0.5 and 1 to ease the optimization of the bounding box localization task.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Comparisons among techniques. Most previous methods can be categorized into instance adaptation [8], global adaptation [58], or local adaptation [43], which perform adaptation on the features of the detector. In decoupled adaptation, the adaptors are decoupled from the detector, and different adaptors are also decoupled. Decouple means that different parts have independent model parameters, independent input data distributions and independent training losses. Different parts are coordinated into some relationships through data rather than gradients, e.g., different adaptors form a cascading relationship while the detector and the adaptors form a self-feedback relationship.
|
| 21 |
+
|
| 22 |
+
The contributions of this work are summarized as three-fold. (1) We introduce D-adapt framework for cross-domain object detection, which is general for both two-stage and single-stage detectors. (2) We propose an effective method to adapt the bounding box localization task, which is ignored by existing methods but is crucial for achieving superior final performance. (3) We conduct extensive experiments and validate that our method achieves state-of-the-art performance on four object detection tasks, and yields $17 \%$ and $21 \%$ relative improvement on Clipart1k and Comic2k.
|
| 23 |
+
|
| 24 |
+
# 2 RELATED WORK
|
| 25 |
+
|
| 26 |
+
Generic domain adaptation for classification. Domain adaptation is proposed to overcome the distribution shift across domains. In the classification setting, most of the domain adaptation methods are based on Moment Matching or Adversarial Adaptation. Moment Matching methods [50; 36] align distributions by minimizing the distribution discrepancy in the feature space. Taking the same spirit as Generative Adversarial Networks [16], Adversarial Adaptation [12; 37] introduces a domain discriminator to distinguish the source from the target, then the feature extractor is encouraged to fool the discriminator and learn domain invariant features. However, directly applying these methods to object detection yields an unsatisfactory effect. The difficulty is that the image of object detection usually contains multiple objects, thus the features of an image can have complex multimodal structures [20; 58; 5], making the image-level feature alignment problematic [58; 20].
|
| 27 |
+
|
| 28 |
+
Generic domain adaptation for regression. Most domain adaptation methods designed for classification do not work well on regression tasks since the regression space is continuous with no clear decision boundary [22]. Some specific regression algorithms are proposed, including importance weighting [54] or learning invariant representations [40; 38]. RSD [7] defines a geometrical distance for learning transferable representations and disparity discrepancy [57] proposes an upper bound for the distribution distance in the regression problems. Yet previous methods are mainly tested on simple tasks while this paper extends domain adaptation to the object localization tasks.
|
| 29 |
+
|
| 30 |
+
Domain adaptation for object detection. DA-Faster [8] performs feature alignment at both image-level and instance-level. SWDA [43] proposes that strong alignment of the local features is more effective than the strong alignment of the global features. Hsu et al. [20] carries out centeraware alignment by paying more attention to foreground pixels. HTCN [5] calibrates the transferability of feature representations hierarchically. Zheng et al. [59] proposes to extract foreground regions and adopts coarse-to-fine feature adaptation. ATF [19] introduces an asymmetric tri-way approach to account for the differences in labeling statistics between domains. CRDA [53] and MCAR [58] use multi-label classification as an auxiliary task to regularize the features. However, although the auxiliary task of outputting domain-invariant features to fool a domain discriminator in most aforementioned methods can improve the transferability, it also impairs the discriminability of the detector. In contrast, we decouple the adversarial adaptation and the training of the detector, thus the adaptors could specialize in transfer between domains, and the detector could focus on improving the discriminability while enjoying the transferability brought by the adaptors.
|
| 31 |
+
|
| 32 |
+
Self-training with pseudo labels. Pseudo-labeling [30], which leverages the model itself to obtain labels on unlabeled data, is widely used in self-training. To generate reliable pseudo labels, temporal ensembling [29] maintains an exponential moving average prediction for each sample, while the mean-teacher [49] averages model weights at different training iterations to get a teacher model. Deep mutual learning [56] trains a pool of student models with supervisions from each other. FixMatch [47] uses the model’s predictions on weakly-augmented images to generate pseudo-labels for the strongly-augmented ones. Unbiased Teacher [35] introduces the teacher-student paradigm to Semi-Supervised Object Detection (SS-OD). When some image-level labels exist, the performance can be further improved by encoding correlations between coarse-grained and fine-grained classes [55], employing noise-tolerant training strategies [13], or learning a mapping from weaklysupervised to fully-supervised detectors [24] in SS-OD. Recent works [21; 25; 26] utilize selftraining in cross-domain object detection and take the most confident predictions as pseudo labels. MTOR [3] uses the mean teacher framework and UMT [10] adopts distillation and CycleGAN [60] in self-training. However, self-training suffers from the problem of confirmation bias [1; 4]: the performance of the student will be limited by that of the teacher. Although pseudo labels are also used in our proposed D-adapt, they are generated from adaptors that have independent parameters and different tasks from the detector, thereby alleviating the confirmation bias of the overly tight relationship in self-training.
|
| 33 |
+
|
| 34 |
+
# 3 PROPOSED METHOD
|
| 35 |
+
|
| 36 |
+
In supervised object detection, we have a labeled source domain $\mathcal { D } _ { s } = \{ ( \mathbf { X } _ { s } ^ { i } , \mathbf { B } _ { s } ^ { i } , \mathbf { Y } _ { s } ^ { i } ) \} _ { i = 1 } ^ { n _ { s } }$ , where $\mathbf { X } _ { s } ^ { i }$ is the image, $\mathbf { B } _ { s } ^ { i }$ is the bounding box coordinates, and $\mathbf { Y } _ { s } ^ { i }$ is the categories. The detector $G ^ { \mathrm { d e t } }$ is trained with $\mathcal { L } _ { s } ^ { \mathrm { d e t } }$ , which consists of four losses in Faster RCNN [42]: the RPN classification loss $\mathcal { L } _ { \mathrm { c l s } } ^ { \mathrm { r p n } }$ s, the RPN regression loss $\mathcal { L } _ { \mathrm { r e g } } ^ { \mathrm { r p n } }$ , the RoI classification loss $\mathcal { L } _ { \mathrm { c l s } } ^ { \mathrm { r o i } }$ and the RoI regression loss $\mathcal { L } _ { \mathrm { r e g } } ^ { \mathrm { r o i } }$ ,
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
\begin{array} { r } { \mathcal { L } _ { s } ^ { \mathrm { d e t } } = \mathbb { E } _ { ( \mathbf { X } _ { s } , \mathbf { B } _ { s } , \mathbf { Y } _ { s } ) \in \mathcal { D } _ { s } } \mathcal { L } _ { \mathrm { c l s } } ^ { \mathrm { r p n } } + \mathcal { L } _ { \mathrm { r e g } } ^ { \mathrm { r p n } } + \mathcal { L } _ { \mathrm { c l s } } ^ { \mathrm { r o i } } + \mathcal { L } _ { \mathrm { r e g } } ^ { \mathrm { r o i } } . } \end{array}
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
In cross-domain object detection, there exists another unlabeled target domain $\mathcal { D } _ { t } = \{ \mathbf { X } _ { t } ^ { i } \} _ { i = 1 } ^ { n _ { t } }$ that follows different distributions from $\mathcal { D } _ { s }$ . The objective of $G ^ { \mathrm { d e t } }$ is to improve the performance on $\mathcal { D } _ { t }$ .
|
| 43 |
+
|
| 44 |
+
# 3.1 D-ADAPT FRAMEWORK
|
| 45 |
+
|
| 46 |
+
To deal with the architecture challenge mentioned in Section 1, we propose the D-adapt framework, which has three steps: (1) decouple the original cross-domain detection problem into several subproblems (2) design adaptors to solve each sub-problem (3) coordinate the relationships between different adaptors and the detector.
|
| 47 |
+
|
| 48 |
+
Since adaptation might hurt the discriminability of the detector, we decouple the category adaptation from the training of the detector by introducing a parameter-independent category adaptor (see Figure 1(d)). The adaptation is only performed on the features of the category adaptor, thus will not hurt the detector’s ability to locate objects. To fill the blank of regression domain adaptation in object detection, we need to perform adaptation on the bounding box regression. Yet feature visualization in Figure 6(c) reveals that features that contain both category and location information do not have an obvious cluster structure, and alignment might hurt its discriminability. Besides, the common category adaptation methods are also not effective on regression tasks [22], thus we decouple category adaptation and the bounding box adaptation to avoid their interfering with each other. Section 3.2 and 3.3 will introduce the design of category adaptor and box adaptor in details. In this section, we will assume that such two adaptors are already obtained.
|
| 49 |
+
|
| 50 |
+
To coordinate the adaptation on different tasks, we maintain a cascading relationship between the adaptors. In the cascading structure, the later adaptors can utilize the information obtained by the previous adaptors for better adaptation, e.g. in the box adaptation step, the category adaptor will select foreground proposals to facilitate the training of the box adaptor. Compared with the multi-task learning relationship where we need to balance the weights of different adaptation losses carefully, the cascade relationship greatly reduces the difficulty of hyper-parameter selection since each adaptor has only one adaptation loss. Since the adaptors are specifically designed for cross-domain tasks, their predictions on the target domain can serve as pseudo labels for the detector. On the other hand, the detector generates proposals to train the adaptors and higher-quality proposals can improve the adaptation performance (see Table 5 for details). And this enables the self-feedback relationship between the detector and the adaptors.
|
| 51 |
+
|
| 52 |
+
For a good initialization of this self-feedback loop, we first pre-train the detector $G ^ { \mathrm { d e t } }$ on the source domain with $\mathcal { L } _ { s } ^ { \mathrm { d e t } }$ . Using the pre-trained $G ^ { \mathrm { d e t } }$ , we can derive two new data distributions, the source proposal distribution $\mathcal { D } _ { s } ^ { \bar { \mathrm { p r o p } } }$ and the target proposal distribution $\mathcal { D } _ { t } ^ { \mathrm { p r o p } }$ . Each proposal consists of a crop of the image $\textbf { x }$ , its corresponding bounding box $\mathbf { b } ^ { \mathrm { d e t } }$ , predicted category $\mathbf { y } ^ { \mathrm { d e t } }$ and the class confidence $\mathbf { c } ^ { \mathrm { { d e t } } }$ . We can annotate each source-domain proposal $\mathbf { x } _ { s } \in \mathcal { D } _ { s } ^ { \mathrm { p r o p } }$ with a ground truth bounding box ${ \bf b } _ { s } ^ { \mathrm { g t } }$ and category label ${ \bf y } _ { s } ^ { \mathrm { g t } }$ , similar to labeling each RoI in Fast RCNN [14], and then use these labels to train the adaptors. In turn, for each target proposal $\mathbf { x } _ { t } \in \mathcal { D } _ { t } ^ { \mathrm { p r o p } }$ , adaptors will provide category pseudo label $\mathbf { y } _ { t } ^ { \mathrm { c l s } }$ and box pseudo label ${ \bf b } _ { t } ^ { \mathrm { r e g } }$ to train the RoI heads,
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
\begin{array} { r l } & { \mathcal { L } _ { t } ^ { \mathrm { d e t } } = \mathbb { E } _ { ( \mathbf { X } _ { t } , \mathbf { b } _ { t } ^ { \mathrm { d e t } } , \mathbf { y } _ { t } ^ { \mathrm { c l s } } , \mathbf { b } _ { t } ^ { \mathrm { r e g } } ) \in \mathcal { D } _ { t } ^ { \mathrm { p o p } } } \mathcal { L } _ { \mathrm { c l s } } ^ { \mathrm { r o i } } ( \mathbf { X } _ { t } , \mathbf { b } _ { t } ^ { \mathrm { d e t } } , \mathbf { y } _ { t } ^ { \mathrm { c l s } } ) + \mathcal { L } _ { \mathrm { c l s } } ^ { \mathrm { r o i } } ( \mathbf { X } _ { t } , \mathbf { b } _ { t } ^ { \mathrm { r e g } } , \mathbf { y } _ { t } ^ { \mathrm { c l s } } ) } \\ & { \qquad + \mathbb { I } _ { \mathrm { f g } } ( \mathbf { y } _ { t } ^ { \mathrm { c l s } } ) \cdot \mathcal { L } _ { \mathrm { r e g } } ^ { \mathrm { r o i } } ( \mathbf { X } _ { t } , \mathbf { b } _ { t } ^ { \mathrm { d e t } } , \mathbf { b } _ { t } ^ { \mathrm { r e g } } ) , } \end{array}
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
where $\mathbb { I } _ { \mathrm { f g } }$ is a function that indicates whether it is a foreground class. Note that regression loss is activated only for foreground anchors. After obtaining a better detector by optimizing Equation 2, we can generate higher-quality proposals, which facilitate better category adaptation and bounding box adaptation. This process can iterate multiple times and the detailed optimization procedures are summarized in Algorithm 1.
|
| 59 |
+
|
| 60 |
+
# Algorithm 1: D-adapt Training Pipeline.
|
| 61 |
+
|
| 62 |
+
input : Source domain $\mathcal { D } _ { s }$ and target domain $\mathcal { D } _ { t }$ , number of iterations $_ T$
|
| 63 |
+
output: Cross-domain object detector Gdet
|
| 64 |
+
initialize the object detector $G ^ { \mathrm { d e t } }$ by optimizing with $\mathcal { L } _ { s } ^ { \mathrm { d e t } }$ ;
|
| 65 |
+
for $t \gets 1$ to $_ T$ do generate proposals $\mathcal { D } _ { s } ^ { \mathrm { p r o p } }$ and $\mathcal { D } _ { t } ^ { \mathrm { p r o p } }$ for each sample in $\mathcal { D } _ { s }$ and $\mathcal { D } _ { t }$ by $G ^ { \mathrm { d e t } }$ ; for each mini-batch in $\mathcal { D } _ { s } ^ { p r o p }$ and $\mathcal { D } _ { t } ^ { p r o p }$ do train the category adaptor $G ^ { \mathrm { c l s } }$ ; end generate category label for each proposal in Dpropt ; generate foreground proposals $\mathcal { D } _ { s } ^ { \mathrm { f g } }$ and $\mathcal { D } _ { t } ^ { \mathrm { f g } }$ from $\mathcal { D } _ { s } ^ { \mathrm { p r o p } }$ and $\mathcal { D } _ { t } ^ { \mathrm { p r o p } }$ ; for each mini-batch in train the boundin $\mathcal { D } _ { s } ^ { f g }$ and x ad $\mathcal { D } _ { t } ^ { f g }$ r ; $G ^ { \mathrm { r e g } }$ end generate bounding box label for each proposal in Dfg; train the object detector $G ^ { \mathrm { d e t } }$ by optimizing with $\mathcal { L } _ { t } ^ { \mathrm { d e t } }$ ;
|
| 66 |
+
end
|
| 67 |
+
|
| 68 |
+
Note that our D-adapt framework does not introduce any computational overhead in the inference phase, since the adaptors are independent of the detector and can be removed during detection. Also, D-adapt does not depend on a specific detector, thus the detector can be replaced by SSD [34], RetinaNet [32], or other detectors.
|
| 69 |
+
|
| 70 |
+
# 3.2 CATEGORY ADAPTATION
|
| 71 |
+
|
| 72 |
+
The goal of category adaptation is to use labeled source-domain proposals $( \mathbf { x } _ { s } , \mathbf { y } _ { s } ^ { \mathrm { g t } } ) \in \mathcal { D } _ { s } ^ { \mathrm { p r o p } }$ to obtain a relatively accurate classification $\mathbf { y } _ { t } ^ { \mathrm { c l s } }$ of the unlabeled target-domain proposals $\mathbf { x } _ { t } \in \mathcal { D } _ { t } ^ { \mathrm { p r o p } }$ . Some generic adaptation methods, such as DANN [12], can be adopted. DANN introduces a domain discriminator to distinguish the source from the target, then the feature extractor tries to learn domain-invariant representations to fool the discriminator, which will enlarge the decision boundaries between classes on the unlabeled target domain. However, the above adversarial alignment might fail due to the data challenge – the input data distribution doesn’t satisfy the low-density separation assumption well, i.e., the Intersection-over-Union of a proposal and a foreground instance may be any value between 0 and 1 (see Figure 2(a)) and explicit task-specific boundaries between classes hardly exist, which will impede the adversarial alignment [22]. Recall that in standard object detection, proposals with IoU between 0.3 and 0.7 will be removed to discretize the input space and ease the optimization of the classification. Yet it can hardly be used in the domain adaptation problem since we cannot obtain ground truth IoU for target proposals.
|
| 73 |
+
|
| 74 |
+

|
| 75 |
+
Figure 2: Category adaptation (best viewed in color). (a) The IoU distribution of the proposals from Foggy Cityscapes. When we increase the confidence threshold from 0 to 0.9, undefined proposals (proposals with IoU between 0.3 and 0.7) will decrease. (b) Proposals with lower confidence will be assigned a lower weight in the adaptation. (c) The discriminator $D$ is trained to separate the source-domain proposals from the target-domain proposals for each class independently, while the feature extractor $F ^ { \mathrm { c l s } }$ is encouraged to fool $D$ .
|
| 76 |
+
|
| 77 |
+
To overcome the data challenge, we use the confidence of each proposal to discretize the input space, i.e., when a proposal has a high confidence $\mathbf { c } ^ { \mathrm { { d e t } } }$ being the foreground or background, it should have a higher weight $w ( \mathbf { c } ^ { \mathrm { { d e t } } } )$ in the adaptation, and vice versa (see Figure 2(b)). This will reduce the participation of proposals that are neither foreground nor background and improve the discreteness of the input space in the sense of probability. Then the objective of the discriminator $D$ is,
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
\operatorname* { m a x } _ { D } \mathcal { L } _ { \mathrm { a d v } } ^ { \mathrm { c l s } } = \mathbb { E } _ { { \mathbf { x } _ { s } } \sim \mathcal { D } _ { s } ^ { \mathrm { p r o p } } } w ( \mathbf { c } _ { s } ) \log [ D ( \mathbf { f } _ { s } , \mathbf { g } _ { s } ) ] + \mathbb { E } _ { \mathbf { x } _ { t } \sim \mathcal { D } _ { t } ^ { \mathrm { p r o p } } } w ( \mathbf { c } _ { t } ) \log [ 1 - D ( \mathbf { f } _ { t } , \mathbf { g } _ { t } ) ] ,
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
where both the feature representation $\mathbf { f } \ = \ F ^ { \mathrm { c l s } } ( \mathbf { x } )$ and the category prediction $\mathbf { g } = G ^ { \mathrm { c l s } } ( \mathbf { f } )$ are fed into the domain discriminator $D$ (see Figure 2(c)). This will encourage features aligned in a conditional way [37], and thus avoid that most target proposals aligned to the dominant category on the source domain. The objective of the feature extractor $F ^ { \mathrm { c l s } }$ is to separate different categories on the source domain and learn domain-invariant features to fool the discriminator,
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
\operatorname* { m i n } _ { F ^ { \mathrm { c l s } } , G ^ { \mathrm { c l s } } } \mathbb { E } _ { ( \mathbf { x } _ { s } , \mathbf { y } _ { s } ^ { \mathrm { g t } } ) \sim \mathcal { D } _ { s } ^ { \mathrm { p r o p } } } \mathcal { L } _ { \mathbf { C E } } ( G ^ { \mathrm { c l s } } ( \mathbf { f } _ { s } ) , \mathbf { y } _ { s } ^ { \mathrm { g t } } ) + \lambda \mathcal { L } _ { \mathrm { a d v } } ^ { \mathrm { c l s } } ,
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
where $\mathcal { L } _ { \mathbf { C E } }$ is the cross-entropy loss, $\lambda$ is the trade-off between source risk and domain adversarial loss. After obtaining the adapted classifier, we can generate category pseudo label $\mathbf { y } _ { t } ^ { \mathrm { c l s } } = G ^ { \mathrm { c l s } } \circ$ $F ^ { \mathrm { c l s } } ( \mathbf { x } _ { t } )$ for each proposal $\mathbf { x } _ { t } \in \mathcal { D } _ { t } ^ { \mathrm { p r o p } }$ .
|
| 90 |
+
|
| 91 |
+
# 3.3 BOUNDING BOX ADAPTATION
|
| 92 |
+
|
| 93 |
+
The objective of box adaptation is to utilize labeled source-domain foreground proposals $( \mathbf { x } _ { s } , \mathbf { b } _ { s } ^ { \mathrm { g t } } ) \in$ $\mathcal { D } _ { s } ^ { \mathrm { f g } }$ to obtain bounding box labels ${ \bf b } _ { t } ^ { \mathrm { r e g } }$ of the unlabeled target-domain proposals ${ \bf x } _ { t } \in \mathcal { D } _ { t } ^ { \mathrm { f g } }$ . Recall that in object detection, regression loss is activated only for foreground anchor and is disabled otherwise [14], thus we only adapt the foreground proposals when training the bounding box regressor. Since the ground truth labels of target-domain proposals are unknown, we use the prediction obtained in the category adaptation step, i.e. $\mathcal { D } _ { t } ^ { \mathrm { f g } } = \{ ( \mathbf { x } _ { t } , \mathbf { y } _ { t } ^ { \mathrm { c l s } } ) \in \mathcal { D } _ { t } ^ { \mathrm { p r o p } } | \mathbb { I } _ { \mathrm { f g } } ( \mathbf { y } _ { t } ^ { \mathrm { c l s } } ) \}$ .
|
| 94 |
+
|
| 95 |
+
Following RCNN [15], weing box regression offsets, On the source domain, we $t ^ { k } \overset { ^ { \ast } } { = } ( t _ { x } ^ { k } , t _ { y } ^ { k } , t _ { w } ^ { k } , t _ { h } ^ { k } )$ c bounding-boxfor each of the h category and $K$ gressor, which predicts the bounforeground classes, indexed by nding box label for each propos $k$ thus we use the smooth $L _ { 1 }$ loss to train the regressor,
|
| 96 |
+
|
| 97 |
+
$$
|
| 98 |
+
\operatorname* { m i n } _ { F ^ { \mathrm { r e g } } , G ^ { \mathrm { r e g } } } \mathcal { L } _ { s } ^ { \mathrm { r e g } } = \mathbb { E } _ { ( \mathbf { x } _ { s } , \mathbf { y } _ { s } ^ { \mathrm { g t } } , \mathbf { b } _ { s } ^ { \mathrm { g t } } , \mathbf { b } _ { s } ^ { \mathrm { d e t } } ) \sim \mathcal { D } _ { s } ^ { \mathrm { f g } } } \sum _ { i \in \{ x , y , w , h \} } { \mathrm { s m o o t h } } _ { L _ { 1 } } ( t _ { i } ^ { u } - v _ { i } ) ,
|
| 99 |
+
$$
|
| 100 |
+
|
| 101 |
+
where $t = G ^ { \mathrm { r e g } } \circ F ^ { \mathrm { r e g } } ( \mathbf { x } _ { s } )$ is the regression prediction, $u \ = \ \mathbf { y } _ { s } ^ { \mathrm { g t } }$ is ground truth category, $v$ is the ground truth bounding box offsets calculated from ${ \bf b } _ { s } ^ { \mathrm { g t } }$ and $\mathbf { b } _ { s } ^ { \mathrm { d e t } }$ . However, it’s hard to obtain a satisfactory regressor with $\mathcal { L } _ { s } ^ { \mathrm { r e g } }$ on the target domain due to the domain shift.
|
| 102 |
+
|
| 103 |
+
Inspired by the lastest theory [57], we propose an IoU disparity discrepancy method. As shown in Figure 3(a), we train a feature generator network $F ^ { \mathrm { r e g } }$ which takes proposal inputs, and two regressor networks $G ^ { \mathrm { r e g } }$ and $G _ { \mathrm { a d v } } ^ { \mathrm { r e g } }$ which take features from $F ^ { \mathrm { r e g } }$ . The objective of the adversarial
|
| 104 |
+
|
| 105 |
+

|
| 106 |
+
Figure 3: Bounding box adaptation (best viewed in color). Box adaptor has three parts: feature generator $F ^ { \mathrm { r e g } }$ , regressor $G ^ { \mathrm { r e g } }$ and adversarial regressor $G _ { \mathrm { a d v } } ^ { \mathrm { r e g } } \cdot G _ { \mathrm { a d v } } ^ { \mathrm { r e g } }$ Gregadv learns to maximize the target disparity by moving two predicted boxes far from each other while $F ^ { \mathrm { r e g } }$ learns to minimize the target disparity by making two predicted boxes overlap as much as possible.
|
| 107 |
+
|
| 108 |
+
regressor network $G _ { \mathrm { a d v } } ^ { \mathrm { r e g } }$ is to maximize its disparity with the main regressor on the target domain while minimizing the disparity on the source domain to measure the discrepancy across domains. Then the objective of the adversarial regressor is
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
\begin{array} { r } { \underset { G _ { \mathrm { a d v } } ^ { \mathrm { r e g } } } { \operatorname* { m a x } } \mathcal { L } _ { \mathrm { a d v } } ^ { \mathrm { r e g } } = \mathbb { E } _ { ( \mathbf { x } _ { t } , \mathbf { y } _ { t } ^ { \mathrm { c l } } ) \sim \mathcal { D } _ { t } ^ { \mathrm { f s } } } { \mathrm { s m o o t h } } _ { L _ { 1 } } \big ( G _ { \mathrm { a d v } } ^ { \mathrm { r e g } } \circ F ^ { \mathrm { r e g } } \big ( \mathbf { x } _ { t } \big ) ^ { \mathbf { y } _ { t } ^ { \mathrm { c l } } } , G ^ { \mathrm { r e g } } \circ F ^ { \mathrm { r e g } } \big ( \mathbf { x } _ { t } \big ) ^ { \mathbf { y } _ { t } ^ { \mathrm { c l } } } \big ) } \\ { - \mathbb { E } _ { ( \mathbf { x } _ { s } , \mathbf { y } _ { s } ^ { \mathrm { g l } } ) \sim \mathcal { D } _ { s } ^ { \mathrm { f s } } } { \mathrm { s m o o t h } } _ { L _ { 1 } } \big ( G _ { \mathrm { a d v } } ^ { \mathrm { r e g } } \circ F ^ { \mathrm { r e g } } \big ( \mathbf { x } _ { s } \big ) ^ { \mathbf { y } _ { s } ^ { \mathrm { g l } } } , G ^ { \mathrm { r e g } } \circ F ^ { \mathrm { r e g } } \big ( \mathbf { x } _ { s } \big ) ^ { \mathbf { y } _ { s } ^ { \mathrm { g l } } } \big ) . } \end{array}
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+
Note that smooth $L _ { 1 }$ on the source domain is only defined on the box corresponding to the ground truth category ${ \bf y } _ { s } ^ { \mathrm { g t } }$ and that on the target domain is only defined on the box associated with the predicted category $\mathbf { y } _ { t } ^ { \mathrm { c l s } }$ . Equation 6 guides the adversarial regressor to predict correctly on the source domain while making as many mistakes as possible on the target domain (Figure 3(b)). Then the feature extractor $F ^ { \mathrm { r e g } }$ is encouraged to output domain-invariant features to decrease domain discrepancy,
|
| 115 |
+
|
| 116 |
+
$$
|
| 117 |
+
\operatorname* { m i n } _ { F ^ { \mathrm { r e g } } } \mathcal { L } _ { s } ^ { \mathrm { r e g } } + \eta \mathcal { L } _ { \mathrm { a d v } } ^ { \mathrm { r e g } } ,
|
| 118 |
+
$$
|
| 119 |
+
|
| 120 |
+
where $\eta$ is the trade-off between source risk and adversarial loss. After obtaining the adapted regressor, we can generate box pseudo label $\mathbf { b } _ { t } ^ { \mathrm { r e g } } = G ^ { \mathrm { r e g } } \circ F ^ { \mathrm { r e g } } ( \mathbf { x } _ { t } )$ for each proposal ${ \bf x } _ { t } \in \mathcal { D } _ { t } ^ { \mathrm { f g } }$ .
|
| 121 |
+
|
| 122 |
+
# 4 EXPERIMENTS
|
| 123 |
+
|
| 124 |
+
# 4.1 DATASETS
|
| 125 |
+
|
| 126 |
+
Following six object detection datasets are used: Pascal VOC [11], Clipart [21], Comic [21], $\mathrm { S i m } 1 0 \mathrm { k }$ [23], Cityscapes [9] and FoggyCityscapes [44]. Pascal VOC contains 20 categories of common realworld objects and 16, 551 images. Clipart contains 1k images and shares 20 categories with Pascal VOC. Comic2k contains 1k training images and 1k test images, sharing 6 categories with Pascal VOC. Sim10k has 10, 000 images with 58, 701 bounding boxes of car categories, rendered by the gaming engine Grand Theft Auto. Both Cityscapes and FoggyCityscapes have 2975 training images and 500 validation images with 8 object categories. Following [43], we evaluate the domain adaptation performance of different methods on the following four domain adaptation tasks, VOC-toClipart, VOC-to-Comic2k, Sim10k-to-Cityscapes, Cityscapes-to-FoggyCityscapes, and report the mean average precision (mAP) with a threshold of 0.5.
|
| 127 |
+
|
| 128 |
+
# 4.2 IMPLEMENTATION DETAILS
|
| 129 |
+
|
| 130 |
+
Stage 1: Source-domain pre-training. In the basic experiments, Faster-RCNN [42] with ResNet101 [17] or VGG-16 [46] as backbone is adopted and pre-trained the on the source domain with a learning rate of 0.005 for $1 2 \mathrm { k }$ iterations.
|
| 131 |
+
|
| 132 |
+
Stage 2: Category adaptation. The category adaptor has the same backbone as the detector but a simple classification head. It’s trained for $1 0 k$ iterations using SGD optimizer with an initial learning rate of 0.01, momentum 0.9, and a batch size of 32 for each domain. The discriminator $D$ is a threelayer fully connected networks following DANN [12]. $\lambda$ is kept 1 for all experiments. $w ( \mathbf { c } )$ is 1 when $\mathbf { c } > 0 . 5$ and 0 otherwise.
|
| 133 |
+
|
| 134 |
+

|
| 135 |
+
Figure 4: Qualitative results on the target domain.
|
| 136 |
+
|
| 137 |
+
Stage 3: Bounding box adaptation. The box adaptor has the same backbone as the detector but a simple regression head (two-layer convolutions networks). The training hyper-parameters (learning rate, batch size, etc.) are the same as that of the category adaptor. $\eta$ is kept 0.1 for all experiments. The input of the bounding box adaptor (the crops of objects) will be twice larger than the original predicted box, so that the bounding box adapter could access more location information.
|
| 138 |
+
|
| 139 |
+
Stage 4: Target-domain pseudo-label training. The detector is trained on the target domain for $4 k$ iterations, with an initial learning rate of $2 . 5 \times 1 0 ^ { - 4 }$ and reducing to $2 . 5 \times 1 0 ^ { - 5 }$ exponentially.
|
| 140 |
+
|
| 141 |
+
The adaptors and the detector are trained in an alternative way for $T = 3$ iterations. We perform all experiments on public datasets using a 1080Ti GPU. Code is available at https://github. com/thuml/Decoupled-Adaptation-for-Cross-Domain-Object-Detection.
|
| 142 |
+
|
| 143 |
+
# 4.3 COMPARISON WITH STATE-OF-THE-ARTS
|
| 144 |
+
|
| 145 |
+
Adaptation between dissimilar domains. We first show experiments on dissimilar domains using the Pascal VOC Dataset as the source domain and Clipart as the target domain. Table 1 shows that our proposed method outperforms the state-of-the-art method by 6.9 points on mAP. Figure 4 presents some qualitative results in the target domain. We also compare with Unbiased Teacher [35], the state-of-the-art method in semi-supervised object detection, which generates pseudo labels on the target domain from the teacher model. Due to the large domain shift, the prediction from the teacher detection model is unreliable, thus it doesn’t do well. In contrast, our method alleviates the confirmation bias problem by generating pseudo labels from different models (adaptors).
|
| 146 |
+
|
| 147 |
+
We also use Comic2k as the target domain, which has a very different style from Pascal VOC and a lot of small objects. As shown in Table 2, both image-level and instance-level feature adaptation will fall into the dilemma of transferability and discriminability, and do not work well on this difficult dataset. In contrast, our method effectively solves this problem by decoupling the adversarial adaptation from the training of the detector and improves mAP by 7.0 compared with the state-of-the-art.
|
| 148 |
+
|
| 149 |
+
Table 1: Results from PASCAL VOC to Clipart (ResNet101).
|
| 150 |
+
Table 2: Results from VOC to Comic (ResNet-101). Oracle results are obtained by training on labeled data in the target domain.
|
| 151 |
+
|
| 152 |
+
<table><tr><td>Method</td><td>bike</td><td>bird</td><td>car</td><td>cat</td><td>dog</td><td>prsn</td><td>mAP</td></tr><tr><td>Source Only</td><td>32.5</td><td>12.0</td><td>21.1</td><td>10.4</td><td>12.4</td><td>29.9</td><td>19.7</td></tr><tr><td>DA-Faster [8]</td><td>31.1</td><td>10.3</td><td>15.5</td><td>12.4</td><td>19.3</td><td>39.0</td><td>21.2</td></tr><tr><td>SWDA [43]</td><td>36.4</td><td>21.8</td><td>29.8</td><td>15.1</td><td>23.5</td><td>49.6</td><td>29.4</td></tr><tr><td>MCAR [58]</td><td>47.9</td><td>20.5</td><td>37.4</td><td>20.6</td><td>24.5</td><td>53.6</td><td>33.5</td></tr><tr><td>Instance Adapt</td><td>39.5</td><td>17.7</td><td>26.5</td><td>27.3</td><td>22.4</td><td>48.4</td><td>30.3</td></tr><tr><td>Global Adapt</td><td>31.9</td><td>15.7</td><td>30.3</td><td>21.3</td><td>17.1</td><td>37.9</td><td>25.7</td></tr><tr><td>D-adapt</td><td>52.4</td><td>25.4</td><td>42.3</td><td>43.7</td><td>25.7</td><td>53.5</td><td>40.5</td></tr><tr><td>Oracle</td><td>42.2</td><td>35.3</td><td>31.9</td><td>46.2</td><td>40.9</td><td>70.9</td><td>44.6</td></tr></table>
|
| 153 |
+
|
| 154 |
+
Adaptation from synthetic to real images. We use $\mathrm { S i m } 1 0 \mathrm { k }$ as the source domain and Cityscapes as the target domain. Following [43], we evaluate on the validation split of the Cityscapes and report the mAP on car. Table 3 shows that our method surpasses all other methods.
|
| 155 |
+
|
| 156 |
+
Table 3: Sim10k to Cityscapes.
|
| 157 |
+
|
| 158 |
+
<table><tr><td>Method</td><td></td><td>Backbone|AP on Car</td></tr><tr><td>Source Only</td><td rowspan="10">VGG-16</td><td>34.6</td></tr><tr><td>DA-Faster [8]</td><td>38.9</td></tr><tr><td>BDC-Faster [43]</td><td>31.8</td></tr><tr><td>SWDA [43]</td><td>40.1</td></tr><tr><td>MAF [18]</td><td>41.1</td></tr><tr><td>Selective DA [61]</td><td>43.0 49.3</td></tr><tr><td>CDN [48]</td><td></td></tr><tr><td>HTCN*[5]</td><td>42.5</td></tr><tr><td>CFFA [59]</td><td>43.8 42.8</td></tr><tr><td>ATF[19]</td><td>49.0</td></tr><tr><td>CADA [20]</td><td></td></tr><tr><td>MeGA-CDA [52]</td><td>44.8</td></tr><tr><td>UMT*[10]</td><td>43.1</td></tr><tr><td>D-adapt</td><td>50.3</td></tr><tr><td>Oracle</td><td>69.7</td></tr><tr><td>Source-only CADA [20]</td><td>ResNet101</td><td>41.8 51.2</td></tr><tr><td>D-adapt</td><td rowspan="3"></td><td></td></tr><tr><td></td><td>51.9</td></tr><tr><td>Oracle</td><td>70.4</td></tr></table>
|
| 159 |
+
|
| 160 |
+
Table 4: Results from Cityscapes to Foggy Cityscapes.
|
| 161 |
+
|
| 162 |
+
<table><tr><td>Method</td><td>Backbone</td><td>prsn</td><td>rider</td><td>car</td><td>truck</td><td>bus</td><td>train</td><td>mcycle</td><td>bcycle</td><td>MAP</td></tr><tr><td>Source only</td><td></td><td>25.1</td><td>32.7</td><td>31.0</td><td>12.5</td><td>23.9</td><td>9.1</td><td>23.7</td><td>29.1</td><td>23.4</td></tr><tr><td>DA-Faster [8]</td><td></td><td>25.0</td><td>31.0</td><td>40.5</td><td>22.1</td><td>35.3</td><td>20.2</td><td>20.0</td><td>27.1</td><td>27.7</td></tr><tr><td>BDC-Faster [43]</td><td></td><td>26.4</td><td>37.2</td><td>42.4</td><td>21.2</td><td>29.2</td><td>12.3</td><td>22.6</td><td>28.9</td><td>27.5</td></tr><tr><td>SW-DA [43]</td><td></td><td>36.2</td><td>35.3</td><td>43.5</td><td>30.0</td><td>29.9</td><td>42.3</td><td>32.6</td><td>24.5</td><td>34.3</td></tr><tr><td>Selective DA [61]</td><td>VGG-16</td><td>33.5</td><td>38.0</td><td>48.5</td><td>26.5</td><td>39.0</td><td>23.3</td><td>28.0</td><td>33.6</td><td>33.8</td></tr><tr><td>DD-MRL*[28]</td><td></td><td>30.8</td><td>40.5</td><td>44.3</td><td>27.2</td><td>38.4</td><td>34.5</td><td>28.4</td><td>32.2</td><td>34.5</td></tr><tr><td>CADA [20]</td><td></td><td>41.9</td><td>38.7</td><td>56.7</td><td>22.6</td><td>41.5</td><td>26.8</td><td>24.6</td><td>35.5</td><td>36.0</td></tr><tr><td>CRDA [53]</td><td></td><td>32.9</td><td>43.8</td><td>49.2</td><td>27.2</td><td>45.1</td><td>36.4</td><td>30.3</td><td>34.6</td><td>37.4</td></tr><tr><td>CFFA [59]</td><td></td><td>34.0</td><td>46.9</td><td>52.1</td><td>30.8</td><td>43.2</td><td>29.9</td><td>34.7</td><td>37.4</td><td>38.6</td></tr><tr><td>ATF[19]</td><td></td><td>34.6</td><td>47.0</td><td>50.0</td><td>23.7</td><td>43.3</td><td>38.7</td><td>33.4</td><td>38.8</td><td>38.7</td></tr><tr><td>MCAR [58]</td><td></td><td>32.0</td><td>42.1</td><td>43.9</td><td>31.3</td><td>44.1</td><td>43.4</td><td>37.4</td><td>36.6</td><td>38.8</td></tr><tr><td>HTCN*[20]</td><td></td><td>33.2</td><td>47.5</td><td>47.9</td><td>31.6</td><td>47.4</td><td>40.9</td><td>32.3</td><td>37.1</td><td>39.8</td></tr><tr><td>D-adapt</td><td></td><td>43.1</td><td>51.8</td><td>58.1</td><td>26.3</td><td>36.8</td><td>14.6</td><td>32.2</td><td>42.0</td><td>38.1</td></tr><tr><td>D-adapt*</td><td></td><td>44.9</td><td>54.2</td><td>61.7</td><td>25.6</td><td>36.3</td><td>24.7</td><td>37.3</td><td>46.1</td><td>41.3</td></tr><tr><td>Oracle</td><td></td><td>47.4</td><td>40.8</td><td>66.8</td><td>27.2</td><td>48.2</td><td>32.4</td><td>31.2</td><td>38.3</td><td>41.5</td></tr><tr><td>Source-only</td><td>ResNet101</td><td>33.8</td><td>34.8</td><td>39.6</td><td>18.6</td><td>27.9</td><td>6.3</td><td>18.2</td><td>25.5</td><td>25.6</td></tr><tr><td>CADA [20]</td><td></td><td>41.5</td><td>43.6</td><td>57.1</td><td>29.4</td><td>44.9</td><td>39.7</td><td>29.0</td><td>36.1</td><td>40.2</td></tr><tr><td>D-adapt</td><td></td><td>42.8</td><td>48.4</td><td>56.8</td><td>31.5</td><td>42.8</td><td>37.4</td><td>35.2</td><td>42.4</td><td>42.2</td></tr><tr><td>D-adapt*</td><td></td><td>40.8</td><td>47.1</td><td>57.5</td><td>33.5</td><td>46.9</td><td>41.4</td><td>33.6</td><td>43.0</td><td>43.0</td></tr><tr><td>Oracle</td><td></td><td>|44.7</td><td>43.9</td><td>64.7</td><td>31.5</td><td>48.8</td><td>44.0</td><td>31.0</td><td>36.7</td><td>43.2</td></tr></table>
|
| 163 |
+
|
| 164 |
+
Adaptation between similar domains. We perform adaptation from Cityscapes to FoggyCityscape and report the results3 in Table 4. Note that since the two domains are relatively similar, the performance of adaptation is already close to the oracle results.
|
| 165 |
+
|
| 166 |
+
# 4.4 ABLATION STUDIES
|
| 167 |
+
|
| 168 |
+
In this part, we will analyze both the performance of the detector and the adaptors. Denote $n _ { i j }$ be the number of proposals of class $i$ predicted as class $j , t _ { i }$ be the total number of proposals of class $i$ , and $N$ be the number of classes (including the background), then we use $\begin{array} { r } { \mathrm { m I o U } ^ { \mathrm { c l s } } = \frac { 1 } { N } \frac { \sum _ { i } n _ { i i } } { t _ { i } + \sum _ { j } n _ { j i } - n _ { i i } } } \end{array}$ to measure the overall performance of the category adaptor. We use the intersection-over-union between the predicted bounding boxes and the ground truth boxes, i.e., $\mathrm { m I o U ^ { \mathrm { r e g } } }$ , to measure the performance of the bounding box adaptor. All ablations are performed on $\mathrm { V O C } \mathfrak { t }$ Clipart and the iteration $T$ is kept 1 for a fair comparison.
|
| 169 |
+
|
| 170 |
+
Ablation on the category adaptation. Table 6(a) show the effectiveness of several specific designs mentioned in Section 3.2. Among them, the weight mechanism has the greatest impact, indicating the necessity of the low-density assumption in the adversarial adaptation. To verify this, we assume that the ground truth IoU of each proposal is known, and then we select the proposal with IoU greater than a certain threshold when we train the category adaptor. Table 5 shows that as the IoU threshold of the foreground proposals improves from 0.05 to 0.7, the accuracy of the category adaptor will increase from 36.1 to 51.4, which shows the importance of the low-density separation assumption.
|
| 171 |
+
|
| 172 |
+
Table 5: Effect of proposals’ quality.
|
| 173 |
+
|
| 174 |
+
<table><tr><td>IoU threshold</td><td>0.05</td><td>0.3</td><td>0.5</td><td>0.7</td></tr><tr><td>mIouels</td><td>36.1</td><td>38.2</td><td>46.7</td><td>51.4</td></tr></table>
|
| 175 |
+
|
| 176 |
+
Ablation on the bounding box adaptation. Table 6(b) illustrates that minimizing the disparity discrepancy improves the performance of the box adaptor and bounding box adaptation improves the performance of the detector in the target domain.
|
| 177 |
+
|
| 178 |
+
Ablation on the training strategy with pseudo-labels. In Equation 2, losses are only calculated on the regions where the proposals are located, and those anchor areas overlapping with the proposals are ignored. Here, we compare this strategy with the common practice in self-training – filter out bounding boxes with low confidence, then label each proposal that overlaps with these boxes. Although the category labels of these bounding boxes are also generated from the category adaptor, the accuracy of these generated proposals is low (see Table 6(c)). In contrast, our strategy is more conservative and both the mIoUcls on the proposals and the final mAP of the detector are higher.
|
| 179 |
+
|
| 180 |
+
# 4.5 ANALYSIS
|
| 181 |
+
|
| 182 |
+
Table 6: Ablations on PASCAL VOC to Clipart. Note that no bounding box adaptation is adopted in (a) and (c) for a fair comparison. (a) Category adaptation. w/o condition: use a class-independent discriminator. w/o bg proposals: no background proposals added to source domain or target domain or neither. w/o weight: remove the weight mechanism in Equation 3. w/o adaptor: remove the category adaptation step and directly use the labels generated from detector on the target domain as pseudo labels. (b) Spatial Adaptation. w/o DD: remove the disparity discrepancy in Equation 6. w/o adaptor: remove the bounding box adaptation step and only trains the classification branch of the detector. (c) Training strategy. In the standard training, if the confidence threshold increases, the number of false negatives will increase, otherwise the number of false positives will increase.
|
| 183 |
+
|
| 184 |
+
(a) Category adaptation
|
| 185 |
+
|
| 186 |
+
<table><tr><td rowspan="3">metric</td><td rowspan="3">ours</td><td rowspan="3">w/o |condition|</td><td colspan="4">w/o bg proposals</td><td rowspan="3">w/o 一 | weight|adaptor</td><td rowspan="3">w/o</td></tr><tr><td>source target</td><td>X X</td><td>X √</td><td>√ X</td></tr><tr><td>mIoUcls|</td><td>38.2</td><td>36.9</td><td>-</td><td>36.6 33.6 25.1</td><td></td><td></td><td>17.2</td><td>12.6</td></tr><tr><td>mAP</td><td>43.5</td><td>41.7</td><td>-</td><td>41.7 38.8 36.5</td><td></td><td></td><td>33.3</td><td>28.0</td></tr></table>
|
| 187 |
+
|
| 188 |
+
(b) Spatial Adaptation
|
| 189 |
+
|
| 190 |
+
<table><tr><td>metric</td><td></td><td>Oursw/o DD</td><td>)w/oadaptor</td></tr><tr><td>mIoUreg</td><td>0.631</td><td>0.598</td><td>0.531</td></tr><tr><td>mAP</td><td>45.0</td><td>44.4</td><td>43.5</td></tr></table>
|
| 191 |
+
|
| 192 |
+
(c) Training strategy
|
| 193 |
+
|
| 194 |
+
<table><tr><td>metric</td><td colspan="2">standard way</td><td>ours</td></tr><tr><td>confidence threshold</td><td>0.1 0.3 0.5</td><td>0.7</td><td>0.1</td></tr><tr><td>mIoUcls</td><td>17.2 17.617.11</td><td>16.3</td><td>38.2</td></tr><tr><td>mAP</td><td>38.9 37.3 35.9</td><td>34.4</td><td>43.5</td></tr></table>
|
| 195 |
+
|
| 196 |
+
Error Analysis. Figure 5 gives the percent of error of each model on $\mathrm { V O C } { } 0$ Clipart following [2]. The main errors in the target domain come from: Miss (ground truth regarded as backgrounds) and Cls (classified incorrectly). Loc (classified correctly but localized incorrectly) errors are slightly less, but still cannot be ignored especially after category adaptation, which implies the necessity of box adaptation in object detection. Category adaptation can effectively reduce the proportion of Cls errors while increasing that of Loc errors, thus it is reasonable to cascade the box adaptor after the category adaptor. Bounding box adaptation can reduce the proportion of Loc errors, revealing its effectiveness.
|
| 197 |
+
|
| 198 |
+

|
| 199 |
+
Figure 5: Error analysis.
|
| 200 |
+
|
| 201 |
+
Feature visualization. We visualize by t-SNE [51] in Figures 6(a)-6(b) the representations of task $\mathrm { V O C } \to \mathrm { C o m i c 2 k }$ (6 classes) by category adaptor with $\lambda = 0$ and category adaptor with $\lambda = 1$ . The source and target are well aligned in the latter, which indicates that it learns domain-invariant features. We also extract box features from the detector and get Figure 6(c)-6(d). We find that the features of the detector do not have an obvious cluster structure, even on the source domain. The reason is that the features of the detector contain both category information and location information. Thus adversarial adaptation directly on the detector will hurt its discriminability, while our method achieves better performance through decoupled adaptation.
|
| 202 |
+
|
| 203 |
+

|
| 204 |
+
Figure 6: T-SNE visualization of features. (a) and (b) are features from the category adaptor. (c) and (d) are features from the Faster RCNN. (Orange: VOC; Blue: Comic2k).
|
| 205 |
+
|
| 206 |
+
# 5 DISCUSSION AND CONCLUSION
|
| 207 |
+
|
| 208 |
+
Our method achieved considerable improvement on several benchmark datasets for domain adaptation. In actual deployment, the detection performance can be further boosted by employing stronger adaptors without introducing any computational overhead since the adaptors can be removed during inference. It is also possible to extend the D-adapt framework to other detection tasks, e.g., instance segmentation and keypoint detection, by cascading more specially designed adaptors. We hope D-adapt will be useful for the wider application of detection tasks.
|
| 209 |
+
|
| 210 |
+
# ACKNOWLEDGEMENTS
|
| 211 |
+
|
| 212 |
+
This work was supported by the National Megaproject for New Generation AI (2020AAA0109201), National Natural Science Foundation of China (62022050 and 62021002), Beijing Nova Program (Z201100006820041), and BNRist Innovation Fund (BNR2021RC01002).
|
| 213 |
+
|
| 214 |
+
# REFERENCES
|
| 215 |
+
|
| 216 |
+
[1] Eric Arazo, Diego Ortego, Paul Albert, Noel E O’Connor, and Kevin McGuinness. Pseudolabeling and confirmation bias in deep semi-supervised learning. In IJCNN, 2020.
|
| 217 |
+
[2] Daniel Bolya, Sean Foley, James Hays, and Judy Hoffman. Tide: A general toolbox for identifying object detection errors. In ECCV, 2020.
|
| 218 |
+
[3] Qi Cai, Yingwei Pan, Chong-Wah Ngo, Xinmei Tian, Lingyu Duan, and Ting Yao. Exploring object relation in mean teacher for cross-domain detection. In CVPR, 2019.
|
| 219 |
+
[4] Paola Cascante-Bonilla, Fuwen Tan, Yanjun Qi, and Vicente Ordonez. Curriculum labeling: Revisiting pseudo-labeling for semi-supervised learning. In AAAI, 2021.
|
| 220 |
+
[5] Chaoqi Chen, Zebiao Zheng, Xinghao Ding, Yue Huang, and Qi Dou. Harmonizing transferability and discriminability for adapting object detectors. In CVPR, 2020.
|
| 221 |
+
[6] Xinyang Chen, Sinan Wang, Mingsheng Long, and Jianmin Wang. Transferability vs. discriminability: Batch spectral penalization for adversarial domain adaptation. In ICML, 2019.
|
| 222 |
+
[7] Xinyang Chen, Sinan Wang, Jianmin Wang, and Mingsheng Long. Representation subspace distance for domain adaptation regression. In ICML, 2021.
|
| 223 |
+
[8] Yuhua Chen, Wen Li, Christos Sakaridis, Dengxin Dai, and Luc Van Gool. Domain adaptive faster r-cnn for object detection in the wild. In CVPR, 2018.
|
| 224 |
+
[9] Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The cityscapes dataset for semantic urban scene understanding. In CVPR, 2016.
|
| 225 |
+
[10] Jinhong Deng, Wen Li, Yuhua Chen, and Lixin Duan. Unbiased mean teacher for cross-domain object detection. In CVPR, 2021.
|
| 226 |
+
[11] Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes (voc) challenge. In IJCV, 2010.
|
| 227 |
+
[12] Yaroslav Ganin and Victor Lempitsky. Unsupervised domain adaptation by backpropagation. In ICML, 2015.
|
| 228 |
+
[13] Jiyang Gao, Jiang Wang, Shengyang Dai, Li-Jia Li, and Ram Nevatia. Note-rcnn: Noise tolerant ensemble rcnn for semi-supervised object detection. In ICCV, 2019.
|
| 229 |
+
[14] Ross Girshick. Fast r-cnn. In ICCV, 2015.
|
| 230 |
+
[15] Ross Girshick, Jeff Donahue, Trevor Darrell, and Jitendra Malik. Rich feature hierarchies for accurate object detection and semantic segmentation. In CVPR, 2014.
|
| 231 |
+
[16] Ian J Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial networks. In NeurIPS, 2014.
|
| 232 |
+
[17] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
|
| 233 |
+
[18] Zhenwei He and Lei Zhang. Multi-adversarial faster-rcnn for unrestricted object detection. In ICCV, 2019.
|
| 234 |
+
[19] Zhenwei He and Lei Zhang. Domain adaptive object detection via asymmetric tri-way fasterrcnn. In ECCV, 2020.
|
| 235 |
+
[20] Cheng-Chun Hsu, Yi-Hsuan Tsai, Yen-Yu Lin, and Ming-Hsuan Yang. Every pixel matters: Center-aware feature alignment for domain adaptive object detector. In ECCV, 2020.
|
| 236 |
+
[21] Naoto Inoue, Ryosuke Furuta, Toshihiko Yamasaki, and Kiyoharu Aizawa. Cross-domain weakly-supervised object detection through progressive domain adaptation. In CVPR, 2018.
|
| 237 |
+
[22] Junguang Jiang, Yifei Ji, Ximei Wang, Yufeng Liu, Jianmin Wang, and Mingsheng Long. Regressive domain adaptation for unsupervised keypoint detection. In CVPR, 2021.
|
| 238 |
+
[23] Matthew Johnson-Roberson, Charles Barto, Rounak Mehta, Sharath Nittur Sridhar, Karl Rosaen, and Ram Vasudevan. Driving in the matrix: Can virtual worlds replace humangenerated annotations for real world tasks? arXiv preprint arXiv:1610.01983, 2016.
|
| 239 |
+
[24] Siddhesh Khandelwal, Raghav Goyal, and Leonid Sigal. Unit: Unified knowledge transfer for any-shot object detection and segmentation. In CVPR, 2021.
|
| 240 |
+
[25] Mehran Khodabandeh, Arash Vahdat, Mani Ranjbar, and William G Macready. A robust learning approach to domain adaptive object detection. In ICCV, 2019.
|
| 241 |
+
[26] Seunghyeon Kim, Jaehoon Choi, Taekyung Kim, and Changick Kim. Self-training and adversarial background regularization for unsupervised domain adaptive one-stage object detection. In ICCV, 2019.
|
| 242 |
+
[27] Seunghyeon Kim, Jaehoon Choi, Taekyung Kim, and Changick Kim. Self-training and adversarial background regularization for unsupervised domain adaptive one-stage object detection. In ICCV, 2019.
|
| 243 |
+
[28] Taekyung Kim, Minki Jeong, Seunghyeon Kim, Seokeon Choi, and Changick Kim. Diversify and match: A domain adaptive representation learning paradigm for object detection. In CVPR, 2019.
|
| 244 |
+
[29] Samuli Laine and Timo Aila. Temporal ensembling for semi-supervised learning. In ICLR, 2017.
|
| 245 |
+
[30] Dong-Hyun Lee et al. Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks. In ICML, 2013.
|
| 246 |
+
[31] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ ECCV, 2014.
|
| 247 |
+
[32] Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense ´ object detection. In ICCV, 2017.
|
| 248 |
+
[33] Li Liu, Wanli Ouyang, Xiaogang Wang, Paul Fieguth, Jie Chen, Xinwang Liu, and Matti Pietikainen. Deep learning for generic object detection: A survey. In ¨ IJCV, 2020.
|
| 249 |
+
[34] Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed, Cheng-Yang Fu, and Alexander C Berg. Ssd: Single shot multibox detector. In ECCV, 2016.
|
| 250 |
+
[35] Yen-Cheng Liu, Chih-Yao Ma, Zijian He, Chia-Wen Kuo, Kan Chen, Peizhao Zhang, Bichen Wu, Zsolt Kira, and Peter Vajda. Unbiased teacher for semi-supervised object detection. In ICLR, 2021.
|
| 251 |
+
[36] Mingsheng Long, Yue Cao, Jianmin Wang, and Michael I. Jordan. Learning transferable features with deep adaptation networks. In ICML, 2015.
|
| 252 |
+
[37] Mingsheng Long, Zhangjie Cao, Jianmin Wang, and Michael I. Jordan. Conditional adversarial domain adaptation. In NeurIPS, 2018.
|
| 253 |
+
[38] Ramin Nikzad-Langerodi, Werner Zellinger, Susanne Saminger-Platz, and Bernhard A. Moser. Domain adaptation for regression under beer–lambert’s law. Knowledge-Based Systems, 210: 106447, 2020.
|
| 254 |
+
[39] Sinno Jialin Pan and Qiang Yang. A survey on transfer learning. IEEE Transactions on Knowledge and Data Engineering, pp. 1345–1359, 2010.
|
| 255 |
+
[40] Sinno Jialin Pan, Ivor W. Tsang, James T. Kwok, and Qiang Yang. Domain adaptation via transfer component analysis. IEEE Transactions on Neural Networks, 22(2):199–210, 2011. doi: 10.1109/TNN.2010.2091281.
|
| 256 |
+
[41] Joseph Redmon, Santosh Divvala, Ross Girshick, and Ali Farhadi. You only look once: Unified, real-time object detection. In CVPR, 2016.
|
| 257 |
+
[42] Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In NeurIPS, 2015.
|
| 258 |
+
[43] Kuniaki Saito, Yoshitaka Ushiku, Tatsuya Harada, and Kate Saenko. Strong-weak distribution alignment for adaptive object detection. In CVPR, 2019.
|
| 259 |
+
[44] Christos Sakaridis, Dengxin Dai, and Luc Van Gool. Semantic foggy scene understanding with synthetic data. In IJCV, 2018.
|
| 260 |
+
[45] Zhiqiang Shen, Harsh Maheshwari, Weichen Yao, and Marios Savvides. Scl: Towards accurate domain adaptive object detection via gradient detach based stacked complementary losses. arXiv preprint arXiv:1911.02559, 2019.
|
| 261 |
+
[46] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
|
| 262 |
+
[47] Kihyuk Sohn, David Berthelot, Chun-Liang Li, Zizhao Zhang, Nicholas Carlini, Ekin D Cubuk, Alex Kurakin, Han Zhang, and Colin Raffel. Fixmatch: Simplifying semi-supervised learning with consistency and confidence. In NeurIPS, 2020.
|
| 263 |
+
[48] Peng Su, Kun Wang, Xingyu Zeng, Shixiang Tang, Dapeng Chen, Di Qiu, and Xiaogang Wang. Adapting object detectors with conditional domain normalization. In ECCV, 2020.
|
| 264 |
+
[49] Antti Tarvainen and Harri Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In NeurIPS, 2017.
|
| 265 |
+
[50] Eric Tzeng, Judy Hoffman, Ning Zhang, Kate Saenko, and Trevor Darrell. Deep domain confusion: Maximizing for domain invariance. In CORR, 2014.
|
| 266 |
+
[51] Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. In JMLR, 2008.
|
| 267 |
+
[52] Vibashan VS, Vikram Gupta, Poojan Oza, Vishwanath A Sindagi, and Vishal M Patel. Megacda: Memory guided attention for category-aware unsupervised domain adaptive object detection. In CVPR, 2021.
|
| 268 |
+
[53] Chang-Dong Xu, Xing-Ran Zhao, Xin Jin, and Xiu-Shen Wei. Exploring categorical regularization for domain adaptive object detection. In CVPR, 2020.
|
| 269 |
+
[54] M. Yamada, L. Sigal, and Yi Chang. Domain adaptation for structured regression. International Journal of Computer Vision, 109:126–145, 2013.
|
| 270 |
+
[55] Hao Yang, Hao Wu, and Hao Chen. Detecting 11k classes: Large scale object detection without fine-grained bounding boxes. In CVPR, 2019.
|
| 271 |
+
[56] Ying Zhang, Tao Xiang, Timothy M Hospedales, and Huchuan Lu. Deep mutual learning. In CVPR, 2018.
|
| 272 |
+
[57] Yuchen Zhang, Tianle Liu, Mingsheng Long, and Michael Jordan. Bridging theory and algorithm for domain adaptation. In ICML, 2019.
|
| 273 |
+
[58] Zhen Zhao, Yuhong Guo, Haifeng Shen, and Jieping Ye. Adaptive object detection with dual multi-label prediction. In ECCV, 2020.
|
| 274 |
+
[59] Yangtao Zheng, Di Huang, Songtao Liu, and Yunhong Wang. Cross-domain object detection through coarse-to-fine feature adaptation. In CVPR, 2020.
|
| 275 |
+
[60] Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In ICCV, 2017.
|
| 276 |
+
[61] Xinge Zhu, Jiangmiao Pang, Ceyuan Yang, Jianping Shi, and Dahua Lin. Adapting object detectors via selective cross-domain alignment. In CVPR, 2019.
|
| 277 |
+
|
| 278 |
+
# A MORE EXPERIMENT RESULTS
|
| 279 |
+
|
| 280 |
+
Results on Other Architecture. As shown in Tables 7, our method also applies to the one-stage detector RetinaNet [32] , which improves the mAP by 17.5 on $\mathrm { V O C } \cdot$ Clipart. The proposed D-adapt framework also surpasses both image-level1(b) and feature-level1(c) alignment as well as their combination by a considerable margin.
|
| 281 |
+
|
| 282 |
+
Table 7: Results from PASCAL VOC to Clipart (RetinaNet, ResNet101).
|
| 283 |
+
|
| 284 |
+
<table><tr><td>Method</td><td>aero</td><td>bcycle</td><td>bird</td><td>boat</td><td>bottle</td><td>bus</td><td>car</td><td>cat</td><td>chair</td><td>cow</td><td>table</td><td>dog</td><td>hrs</td><td>bike</td><td>prsn</td><td>plnt</td><td>sheep</td><td>sofa</td><td>train</td><td>tv mAP</td></tr><tr><td>Source Only</td><td>30.1</td><td>40.8</td><td>21.7</td><td>15.3</td><td>28.4</td><td>51.6</td><td>33.1</td><td>13.1</td><td>34.5</td><td>14.2</td><td>29.6</td><td>16.2</td><td>21.4</td><td>53.1</td><td>37.4 30.3</td><td>6.9</td><td>24.8</td><td>31.8</td><td>42.1</td><td>28.8</td></tr><tr><td>Global Adapt</td><td>33.2</td><td>43.4</td><td>23.8</td><td>24.5</td><td>43.4</td><td>54.9</td><td>36.5</td><td>6.5 36.0</td><td>19.1</td><td>26.4</td><td>13.0</td><td></td><td>23.6 49.4</td><td></td><td>52.6 39.8</td><td>5.8</td><td>27.6</td><td>39.1</td><td>54.1</td><td>32.6</td></tr><tr><td>Local Adapt</td><td>31.0</td><td>28.3</td><td>26.2</td><td>18.2</td><td>42.2</td><td>53.5</td><td>33.6</td><td>18.4</td><td>37.2</td><td>33.2 28.7</td><td>14.3</td><td>33.4</td><td>54.6</td><td>48.7</td><td>40.4</td><td>6.8</td><td>30.4</td><td>42.1</td><td>48.1</td><td>33.4</td></tr><tr><td>Global + Local</td><td>37.5</td><td>50.4</td><td>25.3</td><td>28.8</td><td>45.0</td><td>51.7</td><td>45.9</td><td>16.9 38.2</td><td>31.9</td><td>24.2</td><td>12.6</td><td>26.4</td><td>48.7</td><td>53.4</td><td>44.5</td><td>5.5</td><td>28.2</td><td>45.7</td><td>53.5</td><td>35.7</td></tr><tr><td>D-adapt</td><td>47.4</td><td>65.0</td><td>33.1</td><td>37.5</td><td>56.8</td><td>61.2</td><td>55.1</td><td>27.3</td><td>45.5</td><td>51.8 29.1</td><td>29.6</td><td>38.0</td><td>74.5</td><td>66.7</td><td>46.0</td><td>24.2</td><td>29.3</td><td>54.2</td><td>53.8</td><td>46.3</td></tr></table>
|
| 285 |
+
|
| 286 |
+
Results on VOC WaterColor. As shown in Table 8, D-adapt also achieves strong performance on WaterColor dataset.
|
| 287 |
+
|
| 288 |
+
Table 8: Results from VOC to WaterColor (ResNet-101).
|
| 289 |
+
|
| 290 |
+
<table><tr><td>Method</td><td>bike</td><td>bird</td><td>car</td><td>cat</td><td>dog</td><td>prsn</td><td>mAP</td></tr><tr><td>Source Only</td><td>68.8</td><td>46.8</td><td>37.2</td><td>32.7</td><td>21.3</td><td>60.7</td><td>44.6</td></tr><tr><td>BDC-Faster [43]</td><td>68.6</td><td>48.3</td><td>47.2</td><td>26.5</td><td>21.7</td><td>60.5</td><td>45.5</td></tr><tr><td>DA-Faster [8]</td><td>75.2</td><td>40.6</td><td>48.0</td><td>31.5</td><td>20.6</td><td>60.0</td><td>46.0</td></tr><tr><td>WST-BSR [27]</td><td>75.6</td><td>45.8</td><td>49.3</td><td>34.1</td><td>30.3</td><td>64.1</td><td>49.9</td></tr><tr><td>MAF[18]</td><td>73.4</td><td>55.7</td><td>46.4</td><td>36.8</td><td>28.9</td><td>60.8</td><td>50.3</td></tr><tr><td>SWDA [43]</td><td>82.3</td><td>55.9</td><td>46.5</td><td>32.7</td><td>35.5</td><td>66.7</td><td>53.3</td></tr><tr><td>ATF [19]</td><td>78.8</td><td>59.9</td><td>47.9</td><td>41.0</td><td>34.8</td><td>66.9</td><td>54.9</td></tr><tr><td>SCL [45]</td><td>82.2</td><td>55.1</td><td>51.8</td><td>39.6</td><td>38.4</td><td>64.0</td><td>55.2</td></tr><tr><td>MCAR [58]</td><td>87.9</td><td>52.1</td><td>51.8</td><td>41.6</td><td>33.8</td><td>68.8</td><td>56.0</td></tr><tr><td>UMT*[10]</td><td>88.2</td><td>55.3</td><td>51.7</td><td>39.8</td><td>43.6</td><td>69.9</td><td>58.1</td></tr><tr><td>D-adapt</td><td>77.4</td><td>54.0</td><td>52.8</td><td>43.9</td><td>48.1</td><td>68.9</td><td>57.5</td></tr><tr><td>Oracle</td><td>48.5</td><td>54.7</td><td>41.3</td><td>36.2</td><td>52.6</td><td>74.6</td><td>51.3</td></tr></table>
|
| 291 |
+
|
| 292 |
+
Ablations on the decouple strategy. Further, we discuss whether the decoupling of different adaptors is useful.
|
| 293 |
+
|
| 294 |
+
In our original implementation, the input distributions of different adaptors are completely different. In the category adaptation step, we encourage the input proposals to have IoU close to 0 or 1 to better satisfy the low-density separation assumption. In the bounding box adaptation step, we encourage the input proposals to have IoU between 0.5 and 1 to ease the optimization of the bounding box localization task.
|
| 295 |
+
|
| 296 |
+
If different adaptors are coupled, they must share the same input distribution. Table 9 shows that only sharing the input distributions will greatly damage their respective performance. Note that different adaptors still have independent architectures. And we can conclude that the decoupling of different adaptors is quite crucial.
|
| 297 |
+
|
| 298 |
+
Table 9: Ablations on the decouple strategy on $\mathrm { V O C } { }$ Clipart.
|
| 299 |
+
|
| 300 |
+
<table><tr><td>Input Distribution</td><td>mIoUcls</td><td>mIoUreg</td></tr><tr><td>all proposals w/o weight (both adaptors use the proposals directly output by the detector)</td><td>17.2</td><td>0.551</td></tr><tr><td>all proposals w/ weight (both adaptors use the proposals fed to the original category adaptor)</td><td>33.3</td><td>0.319</td></tr><tr><td>foreground proposals weight (both adaptors use the proposals fed to the original box adaptor)</td><td>24.7</td><td>0.631</td></tr><tr><td>Ours (different adaptors have different input data distributions)</td><td>33.3</td><td>0.631</td></tr></table>
|
| 301 |
+
|
| 302 |
+
Table 10: Ablations on the box adaptor when $T$ varies.
|
| 303 |
+
|
| 304 |
+
<table><tr><td>Setting</td><td>mAP (T=1)</td><td>mAP (T=2)</td><td>mAP (T=3)</td></tr><tr><td>without box adaptor</td><td>43.5</td><td>45.8</td><td>47.0</td></tr><tr><td>with box adaptor (ours)</td><td>45.0</td><td>47.7</td><td>49.1</td></tr></table>
|
| 305 |
+
|
| 306 |
+
Ablation on bounding box adaptor. Table 10 shows that the gain brought by box adaptation is consistent, for example when $T = 3$ , it can still improve the mAP from 47.0 to 49.1.
|
| 307 |
+
|
| 308 |
+
# B MORE VISUALIZATION RESULTS.
|
| 309 |
+
|
| 310 |
+

|
| 311 |
+
Figure 7-10 gives more qualitative results on Faster RCNN.
|
| 312 |
+
Figure 7: Qualitative results on VOC Clipart.
|
| 313 |
+
|
| 314 |
+

|
| 315 |
+
Figure 8: Qualitative results on VOC Comic.
|
| 316 |
+
|
| 317 |
+

|
| 318 |
+
Figure 9: Qualitative results on $\mathrm { S i m 1 0 k } $ Cityscapes.
|
| 319 |
+
|
| 320 |
+

|
| 321 |
+
Figure 10: Qualitative results on Cityscapes Foggy Cityscapes.
|
md/dev/VOstHxDdsN/VOstHxDdsN.md
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Hard Prompts Made Easy: Gradient-Based Discrete Optimization for Prompt Tuning and Discovery
|
| 2 |
+
|
| 3 |
+
Yuxin Wen∗, Neel $\mathbf { J a i n ^ { * } }$ , John Kirchenbauer University of Maryland {ywen, njain17, jkirchen}@umd.edu
|
| 4 |
+
|
| 5 |
+
Micah Goldblum New York University goldblum@nyu.edu
|
| 6 |
+
|
| 7 |
+
Jonas Geiping, Tom Goldstein University of Maryland {jgeiping, tomg}@umd.edu
|
| 8 |
+
|
| 9 |
+
# Abstract
|
| 10 |
+
|
| 11 |
+
The strength of modern generative models lies in their ability to be controlled through prompts. Hard prompts comprise interpretable words and tokens, and are typically hand-crafted by humans. Soft prompts, on the other hand, consist of continuous feature vectors. These can be discovered using powerful optimization methods, but they cannot be easily edited, re-used across models, or plugged into a text-based interface.
|
| 12 |
+
|
| 13 |
+
We describe an easy-to-use approach to automatically optimize hard text prompts through efficient gradient-based optimization. Our approach can be readily applied to text-to-image and text-only applications alike. This method allows API users to easily generate, discover, and mix and match image concepts without prior knowledge of how to prompt the model. Furthermore, using our method, we can bypass token-level content filters imposed by Midjourney by optimizing through the open-sourced text encoder. Code is available at https://github. com/YuxinWenRick/hard-prompts-made-easy.
|
| 14 |
+
|
| 15 |
+
# 1 Introduction
|
| 16 |
+
|
| 17 |
+
Prompt engineering is the art of creating instructions to guide generative models. It is the key to unlocking the power of large models for both image generation and language tasks. As it stands today, prompt engineering methods can be coarsely divided into two camps. First, there are hard prompting methods, which use hand-crafted sequences of interpretable tokens to elicit model behaviors. Hard prompt discovery is a specialized alchemy, with many good prompts being discovered by trial and error, or sheer intuition. Then there are soft prompts, which consist of continuous-valued language embeddings that do not correspond to any human-readable tokens. Soft prompt discovery is a mathematical science; gradient-based optimizers and large curated datasets are used to generate highly performant prompts for specialized tasks.
|
| 18 |
+
|
| 19 |
+
Despite the difficulty of engineering hard prompts, they have their advantages. Hard prompts and the tricks they exploit can be mixed, matched, and mutated to perform a range of different tasks, while soft prompts are highly specialized. Hard prompts can be edited by hand to change their behavior. Hard prompts are portable; they can be discovered using one model and then deployed on another. This portability is impossible with soft prompts due to differences in embedding dimension and representation space between models. Finally, hard prompts can be used when only API access to a model is available and it is not possible to control the embeddings of inputs.
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Two examples of hard prompt discovery through optimization. Given an image (left), a discrete text prompt is discovered using CLIP and used to prompt Stable Diffusion, generating new images (right). Two shades of gray are used to show the token boundaries in the recovered prompt.
|
| 23 |
+
|
| 24 |
+
This work explores the use of efficient gradient methods to optimize and learn discrete text, with an emphasis on applications to prompt engineering. In doing so, we unlock the ability to learn hard prompts via optimization. Learned hard prompts combine the ease and automation of soft prompts with the portability, flexibility, and simplicity of hard prompts. Our primary contributions are summarized as follows:
|
| 25 |
+
|
| 26 |
+
• We propose a simple scheme for learning hard prompts using continuous optimization. The scheme builds on existing gradient reprojection schemes for optimizing text, and adapts lessons learned from the large-scale discrete optimization literature for quantized networks. • We show that this optimization method can be used to learn hard prompts for image generation, giving us a general tool to create prompts that elicit specific image styles, objects, and appearances. The learned prompts perform competitively with highly specialized prompt generation tools, despite using far fewer tokens and containing no hand-crafted components. • We demonstrate that optimizing solely over the text encoder can effectively bypass content filters that use word or token-level red lists. Specifically, our approach successfully circumvents content filters imposed by Midjourney, highlighting the need to implement content filters in feature space. Additionally, this suggests that diffusion models may possess a “secret” language, emphasizing the importance of further exploration in this area.
|
| 27 |
+
|
| 28 |
+
In addition to capturing the quantifiable benefits of learned prompts, the proposed schemes can be used to facilitate prompt exploration and discovery, as optimization often recovers words and tokens that are simultaneously highly interpretable and also highly non-obvious.
|
| 29 |
+
|
| 30 |
+
# 2 Related Works
|
| 31 |
+
|
| 32 |
+
Prompting in Language Models. Brown et al. [2020] was one of the first to demonstrate the power of prompting for task adaption of pre-trained language models. This “instruction tuning” paradigm has since become a standard way to increase the ability of large models to follow complex, task-specific instructions [Sanh et al., 2022, Chung et al., 2022]. However, automatically finding suitable sets of text prompts, i.e. hard prompts, for these purposes remains an open challenge. Lester et al. [2021b] simplified the “prefix tuning” technique presented in Li and Liang [2021] to establish the procedure referred to as standard soft “prompt-tuning” where they optimize sequences of continuous-valued embeddings prepended to the real embeddings of the input tokens. However, subsequent work by Khashabi et al. [2022] showed that the sequences of embeddings produced by this technique could map to token sequences with limited semantic scrutability. To address these limitations, in this work we construct a method for hybridizing the continuous soft-prompt optimization with hard vocabulary constraints, resulting in task-specific, interpretable tokens.
|
| 33 |
+
|
| 34 |
+
Hard Prompt Optimization. AutoPrompt [Shin et al., 2020] was one of the first discrete prompt optimization frameworks for transformer language models and subsequent approaches have included a gradient-free phrase editing method [Prasad et al., 2022], an embedding optimization approach based on Langevin dynamics [Shi et al., 2022], a reinforcement learning approach [Deng et al.,
|
| 35 |
+
|
| 36 |
+
2022] and an optimization procedure of learning the target distribution with a continuous matrix of coefficients [Guo et al., 2021].
|
| 37 |
+
|
| 38 |
+
AutoPrompt, which utilizes HotFlip proposed by Ebrahimi et al. [2018], greedily chooses the optimal token for each location in the prompt utilizing the gradient to find a selection of good candidates. FluentPrompt differs from AutoPrompt by utilizing Langevin dynamics [Kumar et al., 2022] to optimize the prompt embeddings, as well as adding a fluency penalty. We consider these two gradientbased methods as baselines, which can be found in supplementary material. However, AutoPrompt can become expensive very quickly. For each gradient step, the method requires an evaluation of each candidate at each location in the prompt, adding numerous additional forward passes. To avoid the additional forward passes, we originally considered AutoPrompt $\stackrel { \cdot } { k } = 1$ with and without an added fluency constraint but found that AutoPromptSGD with a fluency constraint outperformed its counterparts, and thus we use SGD version of AutoPrompt as our other baseline similar to Shi et al. [2022].
|
| 39 |
+
|
| 40 |
+
For these methods discussed above, at the end of every update step, the optimized prompt embeddings are projected onto their nearest neighbor embeddings to ensure that optimization is performed on the discrete set of natural language tokens. However, if the nearest neighbors are far away from the embeddings and the learning rate is not tuned properly, the embeddings may become stagnant, which can require extensive hyperparameter tuning as demonstrated in Figure 5(a). The cost of such a constraint is a loss of flexibility in the solutions the optimization can find. On the other hand, while soft prompts are not as limited in this way, just clamping a well-trained soft prompt to the nearest discrete prompt strongly degrades performance as observed in Khashabi et al. [2022].
|
| 41 |
+
|
| 42 |
+
Prompt Discovery from Images. The process of extracting rich information from images and conveying it through natural language texts is known as image captioning. Zhang et al. [2021], Hu et al. [2022], and Li et al. [2022] achieve this goal by training large captioning models on image-text pairs. However, these captions are often generic and may not accurately reflect new or unseen objects. In Gal et al. [2022], the authors propose a method that utilizes a soft prompt to optimize a text-guided diffusion model, allowing for the generation of similar visual concepts to those in the original image. In this case, though the final soft prompt is effective, optimization through a diffusion model is very expensive, and the prompts are neither interpretable nor portable.
|
| 43 |
+
|
| 44 |
+
Discrete Optimization. Discrete optimizers have long been used to train neural networks with quantized (e.g. binary) weights. In that context, the approach of re-projecting between gradient steps is known as stochastic rounding. However, it is known that this approach lacks the convergence guarantees of continuous optimization [Li et al., 2017]. Over the last decade, stochastic rounding has been replaced by newer optimizers that maintain a continuous, rather than discrete, representation of the weights [Courbariaux et al., 2015]. These optimizers consistently result in higher accuracy [Rastegari et al., 2016, Courbariaux et al., 2016] and avoid local minima [Li et al., 2017].
|
| 45 |
+
|
| 46 |
+
We take inspiration from these lessons learned in the binary networks community and adapt them to refine and simplify discrete optimizers for language.
|
| 47 |
+
|
| 48 |
+
# 3 Methodology
|
| 49 |
+
|
| 50 |
+
Learning Hard Prompts. We now present our effective and easy-to-use technique for discrete prompt optimization. The process requires the following inputs: a frozen model, $\theta$ , a sequence of learnable embeddings, $\bar { \bf P } = [ { \bf e _ { i } } , . . . \bar { \bf e _ { M } } ] , { \bf e _ { i } } \in \mathbb { R } ^ { d }$ , where $M$ is the number of “tokens” worth of vectors to optimize, and $d$ is the dimension of the embeddings. Additionally, we employ an objective function $\mathcal { L }$ . The discreteness of the token space is realized using a projection function, $\mathrm { P r o j } _ { \bf E }$ , that takes the individual embedding vectors $\mathbf { e _ { i } }$ in the prompt and projects them to their nearest neighbor in the embedding matrix $E ^ { | V | \times d }$ where $| V |$ is the vocabulary size of the model, and we denote the result of this operation as $\mathbf { P } ^ { \prime } = \operatorname { P r o j } _ { \mathbf { E } } ( \mathbf { P } ) : = [ \operatorname { P r o j } _ { \mathbf { E } } ( \mathbf { e } _ { \mathbf { i } } ) , . . . \operatorname { P r o j } _ { \mathbf { E } } ( \mathbf { e } _ { \mathbf { M } } ) ]$ . Additionally, we define a broadcast function, $\boldsymbol { B } : \mathbb { R } ^ { ( M \times d ) } \mathbb { R } ^ { \overline { { ( } } M \times d \times b ) }$ that repeats the current prompt embeddings $( \mathbf { P } )$ in the batch dimension $b$ times.
|
| 51 |
+
|
| 52 |
+
Formally, to learn a hard prompt, we minimize the following risk by measuring the performance of $\mathbf { P }$ on the task data: $R ( { \bf P } ^ { \prime } ) \bar { = } \mathbb { E } _ { D } \big ( \mathcal { L } ( \theta ( \mathcal { B } ( { \bf P } , { \bf X } ) ) , { \bf Y } ) \big )$ .
|
| 53 |
+
|
| 54 |
+
Our Method. We propose a simple but efficient gradient-based discrete optimization algorithm that combines the advantages of the baseline discrete optimization methods and soft prompt optimization.
|
| 55 |
+
|
| 56 |
+
<table><tr><td>Input: Model 0, vocabulary embedding ElVl, projection function Proj, broadcast function B, optimization steps T,learning rate γ,Dataset D Sampled from real embeddings:</td></tr><tr><td>P=[ei,..em]~ElVI</td></tr><tr><td>for1,...,T do</td></tr><tr><td>Retrieve current mini-batch(X,Y) D.</td></tr><tr><td>Forward Projection: P'= Proje(P)</td></tr><tr><td>Calculate the gradient w.r.t. the projected embedding:</td></tr><tr><td>g = Vp'Ltask(B(P',Xi),Yi,0)</td></tr><tr><td>Apply the gradient on the continuous embedding:</td></tr><tr><td>P=P-γg</td></tr><tr><td>end for</td></tr><tr><td>Final Projection: P = Projε[P] return P</td></tr></table>
|
| 57 |
+
|
| 58 |
+
The steps of our scheme, which we call PEZ, are concretely defined in Algorithm 1. The method maintains continuous iterates, which in our applications corresponds to a soft prompt. During each forward pass, we first project the current embeddings $\mathbf { P }$ onto the nearest neighbor $\mathbf { P ^ { \prime } }$ before calculating the gradient. Then, using the gradient of the discrete vectors, $\mathbf { P ^ { \prime } }$ , we update the continuous/soft iterate, $\mathbf { P }$ .
|
| 59 |
+
|
| 60 |
+
# 4 Prompt Inversion with CLIP
|
| 61 |
+
|
| 62 |
+
We showcase the strength of PEZ by learning hard prompts on multimodal vision-language models. With these models, like CLIP [Radford et al., 2021], we can use PEZ to discover captions which describe one or more target images. In turn, these discovered captions can be deployed as prompts for image generation applications. Since most text-guided diffusion models utilize pre-trained text encoders, such as the CLIP text encoder, and freeze them during training, we can discover prompts using these pre-trained text encoders that are directly relevant for downstream diffusion models. For instance, we can optimize a caption which describes an image and use this caption as a prompt for a diffusion model to generate other images with the same content.
|
| 63 |
+
|
| 64 |
+
Since the CLIP model has its own image encoder, we can leverage it as a loss function to drive our PEZ method. This way we are optimizing prompts only for their cosine similarity to the CLIP image encoder, and avoiding gradient calculations on the full diffusion model altogether.
|
| 65 |
+
|
| 66 |
+
Formally, given a text encoder function $f$ and an image encoder function $g$ , we optimize the hard prompt embedding $\mathbf { P }$ corresponding to a target image $x$ by minimizing the following objective: $\mathbf { \bar { \mathcal { L } } ( P , \bar { \mathcal { X } } ) } = 1 - \mathcal { S } ( \mathbf { \bar { \mathcal { f } } ( P ) } , g ( x ) )$ , where $s$ is the cosine similarity between two vectors.
|
| 67 |
+
|
| 68 |
+
# 4.1 Experimental Setting
|
| 69 |
+
|
| 70 |
+
We conduct experiments on four datasets with diverse distributions: LAION [Schuhmann et al., 2022], MS COCO [Lin et al., 2014], Celeb-A [Liu et al., 2015], and Lexica.art [Santana, 2022]. LAION comprises over 5 billion in diverse images scraped from the internet, including photos and paintings. MS COCO mainly contains real-life photographs with multiple common objects, whereas Celeb-A consists of celebrity portraits. Lexica.art is a set of AI-generated paintings with their prompts.
|
| 71 |
+
|
| 72 |
+
We measure the quality of the prompt via image similarity between the original (target) image, and an image generated using the learned hard prompt. To do so, we use a larger reference CLIP model, OpenCLIP-ViT/G, that was not used during optimization and serves as a neutral metric for the semantic similarity between the images.
|
| 73 |
+
|
| 74 |
+
We choose Stable Diffusion-v2 [Rombach et al., 2022] as our generative model, and the open-source CLIP model, OpenCLIP-ViT/H [Cherti et al., 2022] for crafting the prompt, as both share the same text encoder. During the prompt optimization process, we use a generic learning rate of 0.1 and run 3000 optimization steps using the AdamW optimizer [Loshchilov and Hutter, 2017]. For Stable Diffusion-v2, we set the guidance scale to 9 and the number of inference steps to 25. For each dataset, we randomly sample 100 data points and average CLIP scores over 5 runs with different random seeds. All experiments are conducted on a single NVIDIA RTX A4000.
|
| 75 |
+
|
| 76 |
+

|
| 77 |
+
rowland pino percy lovely ponies moment seaside fra
|
| 78 |
+
Figure 2: Generations using learned hard prompts on four different target images. For a given target image (left), a discrete text prompt is discovered using CLIP and used to prompt Stable Diffusion and Midjourney, generating new images (right). Two shades of gray are used to show the token boundaries in the recovered prompt.
|
| 79 |
+
|
| 80 |
+
A natural baseline for hard prompt discovery with CLIP is the CLIP Interrogator1. To generate a descriptive hard prompt, this tool first uses a pre-trained captioning model, BLIP [Li et al., 2022] to create a caption of the target image. Then, top- $k$ keywords from a pre-collected bank of keywords are appended to the caption based on CLIP scores between the keywords and the target image. These keywords were collected from various sources, including 5,265 artist names like “Van Gogh” and 100,970 phrases from prompt engineering, resulting in a diverse set. We find this keyword bank to contain most of the phrases from the Lexica.art dataset. CLIP Interrogator then greedily samples keywords until the prompt reaches CLIP’s token length limit of 77.
|
| 81 |
+
|
| 82 |
+
Table 1: Quantitative evaluation of learned hard prompts. We report the CLIP score between the original images and the images generated by the hard prompts. A high score indicates that generated and target images contain similar semantic content.
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
<table><tr><td>Method</td><td>#Tokens</td><td>Requirement</td><td>LAION</td><td>MS COCO</td><td>Celeb-A</td><td>Lexica.art</td></tr><tr><td>AutoPromptsGD</td><td>8</td><td>CLIP</td><td>0.689</td><td>0.669</td><td>0.595</td><td>0.702</td></tr><tr><td>FluentPrompt</td><td>8</td><td>CLIP</td><td>0.688</td><td>0.671</td><td>0.583</td><td>0.702</td></tr><tr><td>PEZ (Ours)</td><td>8</td><td>CLIP</td><td>0.697</td><td>0.677</td><td>0.602</td><td>0.711</td></tr><tr><td>CLIP Inter.</td><td>~77</td><td>C.+ Ba. + BL.</td><td>0.707</td><td>0.690</td><td>0.558</td><td>0.762</td></tr><tr><td>PEZ + Bank</td><td>8</td><td>CLIP + Bank</td><td>0.702</td><td>0.689</td><td>0.629</td><td>0.740</td></tr><tr><td>PEZ +5 Seeds</td><td>8</td><td>C.+ 5 Seeds</td><td>0.705</td><td>0.692</td><td>0.614</td><td>0.722</td></tr><tr><td>C. I. w/o BLIP</td><td>~77</td><td>CLIP + Bank</td><td>0.677</td><td>0.674</td><td>0.572</td><td>0.737</td></tr><tr><td>CLIP Inter.</td><td>8</td><td>C.+ Ba. + BL.</td><td>0.539</td><td>0.575</td><td>0.360</td><td>0.532</td></tr><tr><td>CLIP Inter.</td><td>16</td><td>C.+ Ba.+ BL.</td><td>0.650</td><td>0.650</td><td>0.491</td><td>0.671</td></tr><tr><td>CLIP Inter.</td><td>32</td><td>C.+ Ba.+ BL.</td><td>0.694</td><td>0.663</td><td>0.540</td><td>0.730</td></tr><tr><td>Soft Prompt</td><td>8</td><td>CLIP</td><td>0.408</td><td>0.420</td><td>0.451</td><td>0.554</td></tr></table>
|
| 86 |
+
|
| 87 |
+

|
| 88 |
+
Figure 3: Learned hard prompts for style transfer. Given several samples with the same style, we can extract the style with a hard prompt and transfer it to other objects or scenes. Detailed templates and hard prompts can be found in Appendix A.1. Sample images credits: Qinni and facundo-lopez.
|
| 89 |
+
|
| 90 |
+
# 4.2 Results
|
| 91 |
+
|
| 92 |
+
We show example hard prompts learned using our method and corresponding generations in Figure 2. The generated images clearly show that the prompts effectively capture the semantic features of the target images. Further, the generations are highly similar to the original images as measured by CLIP score and under visual inspection. Additionally, the hard prompts do not overfit to the original target image and produce a diverse set of generated images given different random seeds.
|
| 93 |
+
|
| 94 |
+
Prompts are human-readable, containing a mix of real words and gibberish (non-word token sequences). However, the valid words that are included in the prompts provide a significant amount of information about the image. For example, in the first row, we can see the words “milkyway” and “campfire,” which are the two main elements in the target image. Interestingly, the optimized prompts may also include emojis, like present in the second row. represents the trees on the side and also the color theme of the image. The optimization process seems to choose these emojis to include useful information while keeping the prompt concise.
|
| 95 |
+
|
| 96 |
+
Meanwhile, PEZ is able to find some “secret languages”. For instance, in Appendix Figure 10, the prompt “translucent abyss assaulted surfing featured regrann nbappinterest” produces an image of a surfer in a wave tunnel. We find that some tokens like “nbappinterest” and “assaulted” are not
|
| 97 |
+
|
| 98 |
+

|
| 99 |
+
bway victorian traditional yd sofa ht vn hung $^ +$ wahoo gumbo payments vase sunflowers watercolor expresses qu
|
| 100 |
+
|
| 101 |
+
Figure 4: Concatenated learned hard prompts. We show the hard prompts learned on two unrelated images can be concatenated to fuse the semantic concepts in them.
|
| 102 |
+
|
| 103 |
+
necessary for effective image generation. However, “regrann”, although seemingly unrelated to the depicted image and not being a recognized word, is indispensable. It plays a crucial role in generating coherent images, ensuring, for example, that there isn’t a second person or that the surfboard remains intact. It should be noted that the term “secret languages” here differs from the definition provided by Daras and Dimakis [2022]. Daras and Dimakis [2022] describe “secret languages” that are entirely unintelligible to humans. However, “secret languages” we talk about here are the words/tokens that contribute to the image in ways that are non-obvious at first glance.
|
| 104 |
+
|
| 105 |
+
Further, we present quantitative evaluations in Table 1. PEZ performs consistently well across all four datasets and outperforms other gradient-based optimization baselines (full table can be found in the supp. material Table 2). Notably, we can achieve similar performance to CLIP Interrogator, which has the highest CLIP score on LAION, MS COCO, Lexica.art, but not Celeb-A (The keyword bank in CLIP Interrogator does not include many words related to real human faces). However, CLIP Interrogator uses a large curated prompt dataset, the image captioning model BLIP, and a large number of tokens (as many as 77), while our proposed method only uses the CLIP model for prompt discovery and 8 tokens in total demonstrating its simultaneous simplicity and strength.
|
| 106 |
+
|
| 107 |
+
We ablate each of these differences. To do so, we include the keyword bank in our optimization method and only allow projections onto tokens from the keyword bank. Overall, we find that when adding this constraint to our model, and disabling BLIP to compare both methods on equal footing, we recover most of the quantitative difference between the methods on LAION and Lexica.art. Additionally, reducing the token length for the CLIP Interrogator, leads to a sharp drop in performance, again, particularly when normalizing by comparing both approaches at equal token lengths of 8.
|
| 108 |
+
|
| 109 |
+
In a realistic scenario, our method can be applied iteratively to find better prompts. For each image, we simulate this by optimizing prompts with 5 different initializations and selecting the one with the lowest loss. According to Table 1, this simple technique improves single trial performance and narrows the gap between PEZ and CLIP Interrogator.
|
| 110 |
+
|
| 111 |
+
We note that even though Stable Diffusion and CLIP share the same text encoder, soft prompts do not transfer well compared to all hard prompt methods in our evaluation.
|
| 112 |
+
|
| 113 |
+
Learning Rate. We conducted an ablation study on the learning rate for PEZ and two other discrete optimizers. As shown in Figure 5(a), PEZ is robust and reliable across a wide range of learning rates, from 0.001 to 100. In contrast, AutoPromptSGD and FluentPrompt are sensitive to the choice of the learning rate, with performance approaching that of a random prompt at low learning rates.
|
| 114 |
+
|
| 115 |
+
Prompt Length. We further ablate the optimal number of tokens. In Figure 5(b), we find that longer prompts do not necessarily produce better results when generating with Stable Diffusion, even though they strictly reduce the loss on the CLIP image encoder. Such an overfitting problem suggests that long prompts are less transferable, and we empirically find a length of 16 to result in the most generalizable performance.
|
| 116 |
+
|
| 117 |
+

|
| 118 |
+
Figure 5: Ablation on learning rate and prompt length.
|
| 119 |
+
|
| 120 |
+

|
| 121 |
+
Figure 6: Ablation on the number of optimization steps. For each data point, we select the maximum number from three learning rates: 0.1, 1.0, and 10.
|
| 122 |
+
|
| 123 |
+
Efficiency. We compare the convergence rates of PEZ and AutoPromptSGD at prompt lengths of 4, 8, and 16 across three distinct learning rates: 0.1, 1, and 10. For every data point, the maximum value from the three learning rates is selected. As illustrated in Figure 6, our observations suggest that PEZ converges faster than AutoPromptSGD for images from LIAON data. This rapid convergence is advantageous for users, allowing them to achieve superior results with fewer optimization steps.
|
| 124 |
+
|
| 125 |
+
# 4.3 Style Transfer
|
| 126 |
+
|
| 127 |
+
The proposed approach can also be easily adapted to style transfer. We follow the setting investigated with soft prompts in Gal et al. [2022] but with our hard prompts. Given several examples that share the same style, we extract their shared style characteristics into a single hard prompt and use this prompt to apply the style to new objects or scenes. Figure 3 presents two examples of style transfer, showing that our method can easily embed the shared style elements in the prompt and apply them to novel concepts. Templates and learned prompts can be found in supplementary material.
|
| 128 |
+
|
| 129 |
+

|
| 130 |
+
Figure 7: Prompt distillation. With fewer tokens, the hard prompts can still generate images very similar in concept to the original.
|
| 131 |
+
|
| 132 |
+
# 4.4 Prompt Concatenation
|
| 133 |
+
|
| 134 |
+
Learned hard prompts are also very useful as composable building blocks for intricate scenes. We test this in Figure 4, where we separately generate prompts for two unrelated images, and then fuse both images by concatenating their prompts. We find that even different concepts, such as painted horses on a beach and a realistic sunset in a forest can be combined via their generated prompts.
|
| 135 |
+
|
| 136 |
+
# 4.5 Prompt Distillation
|
| 137 |
+
|
| 138 |
+
Another application where we can use our prompt optimization method is prompt distillation, reducing the length of prompts while preserving their capability. Distillation is useful in situations where the text encoder of the diffusion model has a limited maximum input length, such as the CLIP model, which has a maximum input length of 77 tokens. Also, long prompts may contain redundant and unimportant information, especially when hand-crafted, so we aim to distill their essence, preserving only important information in the prompt. We optimize a shorter prompt to match the features of the longer prompt simply based on its text encoder $f$ . Given a target prompt’s embedding $\mathbf { P } _ { \mathrm { t a r g e t } }$ and learnable embedding e, we simply modify our loss into: $\mathcal { L } = 1 - \bar { S } i \bar { m } ( f ( \mathbf { P } _ { \mathrm { t a r g e t } } ) , f ( \mathbf { P } ) \bar { ) }$ . We define the distillation ratio by $| \mathbf { P } | / | \mathbf { P } _ { \mathrm { t a r g e t } } |$ , where $| \mathbf { P } |$ is the number of tokens in the prompt.
|
| 139 |
+
|
| 140 |
+
In Figure 7, we show images generated by the original prompts and the distilled prompts with four different distillation ratios: 0.5, 0.3, and 0.1. We see here that even with only 3 or 4 tokens, the hard prompts can still generate images very similar in concept to the original, successfully distilling the longer human-made instructions. We further show the quantitative results of prompt distillation in supplementary material Figure 9. The distilled prompts can still maintain high CLIP scores even if the ratio is below 0.3.
|
| 141 |
+
|
| 142 |
+
# 5 Safety Concerns
|
| 143 |
+
|
| 144 |
+
Token or word-level content filters are often used in text-to-image diffusion model APIs to prevent the generation of NSFW or copyrighted content. For instance, the image generation API Midjourney has banned prompts containing the substring “Afghan” due to a copyright issue with the famous photo of an Afghan girl 2.
|
| 145 |
+
|
| 146 |
+
However, prompt optimization can be used as a mechanism to bypass simple rule-based content filters. PEZ can generate a prompt that avoids banned tokens, yet still matches textual features with the original target prompt “Afghan girl.” Figure 8 shows the output of Midjourney using an optimized prompt which successfully reproduces the banned image without containing the banned word “Afghan.” Note that the prompt seems to incorrectly associate the subject of the image, Sharbat Gula, with the Taliban.
|
| 147 |
+
|
| 148 |
+
Even if a defender now iterates the block-list and bans additional words from the adversarial prompt, an attacker can consistently optimize around addition content restrictions, as we show in supplementary material Figure 11. Overall, we suspect that only complete feature-based content detectors have the potential to mitigate these concerns for model owners [Rando et al., 2022].
|
| 149 |
+
|
| 150 |
+
# 6 Conclusion
|
| 151 |
+
|
| 152 |
+
Overall, we show through our experiments that hard prompts can be easily generated and flexibly used in practical applications. To make hard prompts easy, we propose a new variant that utilizes continuous embeddings to reliably optimize hard prompts. The key advantage of this method, PEZ, is the use of continuous, i.e. soft, prompts as intermediate variables during the optimization of hard prompt tokens, leveraging gradient-based optimization.
|
| 153 |
+
|
| 154 |
+

|
| 155 |
+
Figure 8: Generated copyrighted image via Midjourney. Here, requested from the API only for research purposes.
|
| 156 |
+
|
| 157 |
+
Hard prompts are helpful for users of a number of image generation systems because they are easy to understand, edit, extend, and combine with existing concepts. Yet, a limitation of hard prompts is that even though they are human-readable, they may still contain several un-interpretable tokens. Additionally, hard prompts can surface harmful phrases or sensitive content from a model’s training data.
|
| 158 |
+
|
| 159 |
+
# 7 Acknowledgements
|
| 160 |
+
|
| 161 |
+
This work was made possible by the ONR MURI program, the Office of Naval Research (N000142112557), and the AFOSR MURI program. Commercial support was provided by Capital One Bank, the Amazon Research Award program, and Open Philanthropy. Further support was provided by the National Science Foundation (IIS-2212182), and by the NSF TRAILS Institute (2229885).
|
| 162 |
+
|
| 163 |
+
# References
|
| 164 |
+
|
| 165 |
+
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 34th Conference on Neural Information Processing Systems (NeurIPS 2020), December 2020. URL http://arxiv. org/abs/2005.14165.
|
| 166 |
+
|
| 167 |
+
Mehdi Cherti, Romain Beaumont, Ross Wightman, Mitchell Wortsman, Gabriel Ilharco, Cade Gordon, Christoph Schuhmann, Ludwig Schmidt, and Jenia Jitsev. Reproducible scaling laws for contrastive language-image learning. arXiv preprint arXiv:2212.07143, 2022.
|
| 168 |
+
|
| 169 |
+
Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, et al. Scaling instruction-finetuned language models. arXiv preprint arXiv:2210.11416, 2022.
|
| 170 |
+
|
| 171 |
+
Matthieu Courbariaux, Yoshua Bengio, and Jean-Pierre David. Binaryconnect: Training deep neural networks with binary weights during propagations. Advances in neural information processing systems, 28, 2015.
|
| 172 |
+
|
| 173 |
+
Matthieu Courbariaux, Itay Hubara, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Binarized neural networks: Training deep neural networks with weights and activations constrained to+ 1 or-1. arXiv preprint arXiv:1602.02830, 2016.
|
| 174 |
+
|
| 175 |
+
Giannis Daras and Alexandros G. Dimakis. Discovering the hidden vocabulary of dalle-2. ArXiv, abs/2206.00169, 2022. URL https://api.semanticscholar.org/CorpusID:249240104.
|
| 176 |
+
|
| 177 |
+
Mingkai Deng, Jianyu Wang, Cheng-Ping Hsieh, Yihan Wang, Han Guo, Tianmin Shu, Meng Song, Eric P. Xing, and Zhiting Hu. Rlprompt: Optimizing discrete text prompts with reinforcement learning. ArXiv, abs/2205.12548, 2022.
|
| 178 |
+
|
| 179 |
+
Ning Ding, Shengding Hu, Weilin Zhao, Yulin Chen, Zhiyuan Liu, Haitao Zheng, and Maosong Sun. OpenPrompt: An open-source framework for prompt-learning. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, pages 105–113, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-demo.10. URL https://aclanthology.org/2022.acl-demo.10.
|
| 180 |
+
|
| 181 |
+
Javid Ebrahimi, Anyi Rao, Daniel Lowd, and Dejing Dou. HotFlip: White-box adversarial examples for text classification. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 31–36, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-2006. URL https://aclanthology.org/P18-2006.
|
| 182 |
+
|
| 183 |
+
Rinon Gal, Yuval Alaluf, Yuval Atzmon, Or Patashnik, Amit H Bermano, Gal Chechik, and Daniel Cohen-Or. An image is worth one word: Personalizing text-to-image generation using textual inversion. arXiv preprint arXiv:2208.01618, 2022.
|
| 184 |
+
|
| 185 |
+
Chuan Guo, Alexandre Sablayrolles, Hervé Jégou, and Douwe Kiela. Gradient-based adversarial attacks against text transformers. arXiv preprint arXiv:2104.13733, 2021.
|
| 186 |
+
|
| 187 |
+
Xiaowei Hu, Zhe Gan, Jianfeng Wang, Zhengyuan Yang, Zicheng Liu, Yumao Lu, and Lijuan Wang. Scaling up vision-language pre-training for image captioning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 17980–17989, 2022.
|
| 188 |
+
|
| 189 |
+
Daniel Khashabi, Xinxi Lyu, Sewon Min, Lianhui Qin, Kyle Richardson, Sean Welleck, Hannaneh Hajishirzi, Tushar Khot, Ashish Sabharwal, Sameer Singh, and Yejin Choi. Prompt waywardness: The curious case of discretized interpretation of continuous prompts. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 3631–3643, Seattle, United States, July 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.naacl-main.266. URL https://aclanthology.org/2022.naacl-main.266.
|
| 190 |
+
|
| 191 |
+
Sachin Kumar, Biswajit Paria, and Yulia Tsvetkov. Gradient-based constrained sampling from language models. arXiv preprint arXiv:2205.12558, 2022.
|
| 192 |
+
|
| 193 |
+
Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 3045–3059, Online and Punta Cana, Dominican Republic, November 2021a. Association for Computational Linguistics. doi: 10.18653/v1/2021.emnlp-main.243. URL https: //aclanthology.org/2021.emnlp-main.243.
|
| 194 |
+
|
| 195 |
+
Brian Lester, Rami Al-Rfou, and Noah Constant. The Power of Scale for Parameter-Efficient Prompt Tuning. arXiv:2104.08691 [cs], September 2021b. URL http://arxiv.org/abs/2104.08691.
|
| 196 |
+
|
| 197 |
+
Hao Li, Soham De, Zheng Xu, Christoph Studer, Hanan Samet, and Tom Goldstein. Training quantized nets: A deeper understanding. Advances in Neural Information Processing Systems, 30, 2017.
|
| 198 |
+
|
| 199 |
+
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.
|
| 200 |
+
|
| 201 |
+
Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. 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 4582–4597, 2021.
|
| 202 |
+
|
| 203 |
+
Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pages 740–755. Springer, 2014.
|
| 204 |
+
|
| 205 |
+
Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of the IEEE international conference on computer vision, pages 3730–3738, 2015.
|
| 206 |
+
|
| 207 |
+
Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
|
| 208 |
+
|
| 209 |
+
Julian McAuley and Jure Leskovec. Hidden factors and hidden topics: Understanding rating dimensions with review text. In Proceedings of the 7th ACM Conference on Recommender Systems, RecSys ’13, page 165–172, New York, NY, USA, 2013. Association for Computing Machinery. ISBN 9781450324090. doi: 10.1145/2507157.2507163. URL https://doi.org/ 10.1145/2507157.2507163.
|
| 210 |
+
|
| 211 |
+
Archiki Prasad, Peter Hase, Xiang Zhou, and Mohit Bansal. Grips: Gradient-free, edit-based instruction search for prompting large language models. arXiv preprint arXiv:2203.07281, 2022.
|
| 212 |
+
|
| 213 |
+
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language Models are Unsupervised Multitask Learners. OpenAI, page 24, 2019.
|
| 214 |
+
|
| 215 |
+
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.
|
| 216 |
+
|
| 217 |
+
Javier Rando, Daniel Paleka, David Lindner, Lennard Heim, and Florian Tramèr. Red-teaming the stable diffusion safety filter. ArXiv, abs/2210.04610, 2022.
|
| 218 |
+
|
| 219 |
+
Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, and Ali Farhadi. Xnor-net: Imagenet classification using binary convolutional neural networks. In European conference on computer vision, pages 525–542. Springer, 2016.
|
| 220 |
+
|
| 221 |
+
Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. Highresolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10684–10695, 2022.
|
| 222 |
+
|
| 223 |
+
Victor Sanh, Albert Webson, Colin Raffel, Stephen Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Arun Raja, Manan Dey, M Saiful Bari, Canwen Xu, Urmish Thakker, Shanya Sharma Sharma, Eliza Szczechla, Taewoon Kim, Gunjan Chhablani, Nihal Nayak, Debajyoti Datta, Jonathan Chang, Mike Tian-Jian Jiang, Han Wang, Matteo Manica, Sheng Shen, Zheng Xin Yong, Harshit Pandey, Rachel Bawden, Thomas Wang, Trishala Neeraj, Jos Rozen, Abheesht Sharma, Andrea Santilli, Thibault Fevry, Jason Alan Fries, Ryan Teehan, Teven Le Scao, Stella Biderman, Leo Gao, Thomas Wolf, and Alexander M Rush. Multitask prompted training enables zero-shot task generalization. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id $\cdot ^ { = }$ 9Vrb9D0WI4.
|
| 224 |
+
|
| 225 |
+
Gustavo Santana. Gustavosta/Stable-Diffusion-Prompts $\cdot$ Datasets at Hugging Face, December 2022. URL https://huggingface.co/datasets/Gustavosta/Stable-Diffusion-Prompts.
|
| 226 |
+
|
| 227 |
+
Christoph Schuhmann, Romain Beaumont, Richard Vencu, Cade Gordon, Ross Wightman, Mehdi Cherti, Theo Coombes, Aarush Katta, Clayton Mullis, Mitchell Wortsman, et al. Laion-5b: An open large-scale dataset for training next generation image-text models. arXiv preprint arXiv:2210.08402, 2022.
|
| 228 |
+
|
| 229 |
+
Noam Shazeer and Mitchell Stern. Adafactor: Adaptive learning rates with sublinear memory cost. In International Conference on Machine Learning, pages 4596–4604. PMLR, 2018.
|
| 230 |
+
|
| 231 |
+
Weijia Shi, Xiaochuang Han, Hila Gonen, Ari Holtzman, Yulia Tsvetkov, and Luke Zettlemoyer. Toward human readable prompt tuning: Kubrick’s the shining is a good movie, and a good prompt too? arXiv preprint arXiv:2212.10539, 2022.
|
| 232 |
+
|
| 233 |
+
Taylor Shin, Yasaman Razeghi, Robert L. Logan IV, Eric Wallace, and Sameer Singh. AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated Prompts. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4222–4235, Online, November 2020. Association for Computational Linguistics. doi: 10. 18653/v1/2020.emnlp-main.346. URL https://aclanthology.org/2020.emnlp-main.346.
|
| 234 |
+
|
| 235 |
+
Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Ng, 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.
|
| 236 |
+
|
| 237 |
+
Pengchuan Zhang, Xiujun Li, Xiaowei Hu, Jianwei Yang, Lei Zhang, Lijuan Wang, Yejin Choi, and Jianfeng Gao. Vinvl: Revisiting visual representations in vision-language models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5579–5588, 2021.
|
| 238 |
+
|
| 239 |
+
Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, et al. Opt: Open pre-trained transformer language models. arXiv preprint arXiv:2205.01068, 2022.
|
| 240 |
+
|
| 241 |
+
Xiang Zhang, Junbo Zhao, and Yann LeCun. Character-level convolutional networks for text classification. Advances in neural information processing systems, 28, 2015.
|
| 242 |
+
|
| 243 |
+
# A Appendix
|
| 244 |
+
|
| 245 |
+
# A.1 Additional Results for Prompt Inversion with CLIP
|
| 246 |
+
|
| 247 |
+
We provide more qualitative results in Figure 10.
|
| 248 |
+
|
| 249 |
+
For each example in Figure 3, we use the following templates respectively: “a tiger in the style of {}”, “the streets of Paris in the style of $\{ \} ^ { \ast }$ , “a rocket in the style of $\{ \} ^ { \ast }$ , where $\{ \}$ is replaced with the hard prompts:
|
| 250 |
+
|
| 251 |
+
resonvillains stargazing illustration tutorials sma internationalwomensday watercolor fiberlilycamila yokohama -sorrow fluids latest
|
| 252 |
+
|
| 253 |
+
npr anime novels pureibanganesha irvin paints encapsulmondo illustrillustroversized sultanconan $\Phi$
|
| 254 |
+
|
| 255 |
+
for experiments 1 and 2, respectively.
|
| 256 |
+
|
| 257 |
+
Table 2: Quantitative results on learned hard prompts. We report the CLIP score between the original images and the images generated by the hard prompts.
|
| 258 |
+
|
| 259 |
+
<table><tr><td>Method</td><td>#Tokens</td><td>Requirement</td><td>LAION</td><td>MS COCO</td><td>Celeb-A</td><td>Lexica.art</td></tr><tr><td>AutoPromptsGD</td><td>8</td><td>CLIP</td><td>0.689±0.001</td><td>0.669±0.003</td><td>0.595±0.001</td><td>0.702±0.001</td></tr><tr><td>FluentPrompt</td><td>8</td><td>CLIP</td><td>0.688±0.001</td><td>0.671±0.005</td><td>0.583±0.004</td><td>0.702±0.002</td></tr><tr><td>PEZ (Ours)</td><td>8</td><td>CLIP</td><td>0.697±0.001</td><td>0.677±0.001</td><td>0.602±0.003</td><td>0.711±0.002</td></tr><tr><td>CLIP Inter.</td><td>~77</td><td>C.+ Ba. + BL.</td><td>0.707</td><td>0.690</td><td>0.558</td><td>0.762</td></tr><tr><td>PEZ + Bank</td><td>8</td><td>CLIP + Bank</td><td>0.702±0.001</td><td>0.689±0.001</td><td>0.629±0.003</td><td>0.740±0.001</td></tr><tr><td>PEZ +5 Seeds</td><td>8</td><td>C.+ 5 Seeds</td><td>0.705</td><td>0.692</td><td>0.614</td><td>0.722</td></tr><tr><td>C. I. w/o BLIP</td><td>~77</td><td>CLIP + Bank</td><td>0.677</td><td>0.674</td><td>0.572</td><td>0.737</td></tr><tr><td>CLIP Inter.</td><td>8</td><td>C.+ Ba. + BL.</td><td>0.539</td><td>0.575</td><td>0.360</td><td>0.532</td></tr><tr><td>CLIP Inter.</td><td>16</td><td>C.+ Ba.+ BL.</td><td>0.650</td><td>0.650</td><td>0.491</td><td>0.671</td></tr><tr><td>CLIP Inter.</td><td>32</td><td>C.+ Ba.+ BL.</td><td>0.694</td><td>0.663</td><td>0.540</td><td>0.730</td></tr><tr><td>Soft Prompt</td><td>8</td><td>CLIP</td><td>0.408</td><td>0.420</td><td>0.451</td><td>0.554</td></tr></table>
|
| 260 |
+
|
| 261 |
+

|
| 262 |
+
Figure 9: Quantitative results on prompt distillation with different distillation ratios. The CLIP score is calculated between the images generated by the original prompt and the images generated by the distilled prompt.
|
| 263 |
+
|
| 264 |
+

|
| 265 |
+
Figure 10: Additional qualitative results with learned hard prompts.
|
| 266 |
+
|
| 267 |
+

|
| 268 |
+
Figure 11: Iteratively evade Midjourney content filter and remove sensitive words/tokens.
|
| 269 |
+
|
| 270 |
+
# A.2 Text-to-Text Experiments
|
| 271 |
+
|
| 272 |
+
In this section, we compare our Algorithm 1 to its counterparts in text-to-text setting, which is the more classical setting. We found that PEZ is comparable to other gradient methods outperforming on the classification dataset, AGNEWS. Furthermore, we found that PEZ transfers better.
|
| 273 |
+
|
| 274 |
+
Table 3: Accuracy and standard deviation on the SST-2 validation set across the fives prompts for each method trained on GPT-2 Large and transferred onto larger models ranging from 1.3B to 6.7B. The baseline accuracy of a soft prompt is $\mathbf { 9 3 . 3 5 { \scriptstyle \pm 0 . 0 1 } }$ (optimized for GPT-2 Large), but cannot be transferred. Note EmptyTemplate refers to no prompt at the front but containing the predetermined template.
|
| 275 |
+
|
| 276 |
+
<table><tr><td>Method</td><td>GPT-2 Large (755M, Source)</td><td>GPT-2 XL (1.3B)</td><td>T5-LM-XL (3B)</td><td>OPT (2.7B)</td><td>OPT (6.7B)</td></tr><tr><td>EmptyTemplate</td><td>80.84</td><td>73.85</td><td>52.75</td><td>72.48</td><td>58.72</td></tr><tr><td>AutoPromptsGD</td><td>87.56±0.48</td><td>78.19±6</td><td>56.01±3.74</td><td>73.69±3.64</td><td>65.28±3.91</td></tr><tr><td>FluentPrompt</td><td>88.33±0.48</td><td>78.53±6.3</td><td>55.64±1.33</td><td>70.39±4.66</td><td>61.74±2.8</td></tr><tr><td>OurSNo Fluency</td><td>88.12±0.21</td><td>77.8±7.71</td><td>61.12±6.57</td><td>76.93±2.88</td><td>71.72±7.06</td></tr><tr><td>OurSFluency</td><td>88.05±0.76</td><td>79.72±7.3</td><td>63.3±5.14</td><td>77.18±8.54</td><td>72.39±4.07</td></tr></table>
|
| 277 |
+
|
| 278 |
+
In the context of prompting in the text-to-text setting, the goal of Algorithm 1 is to discover a discrete sequence of tokens, the hard prompt, that will prompt the language model to predict the outcome of a classification task. As an important property of text is its fluency, Shi et al. [2022] find that fluency can increase a prompt’s readability and performance. Thus, we define the optimization objective in this section as a weighted function of task loss and fluency loss,
|
| 279 |
+
|
| 280 |
+
$$
|
| 281 |
+
\mathcal { L } = ( 1 - \lambda _ { \mathrm { f l u e n c y } } ) \mathcal { L } _ { \mathrm { t a s k } } + \lambda _ { \mathrm { f l u e n c y } } \mathcal { L } _ { \mathrm { f l u e n c y } } .
|
| 282 |
+
$$
|
| 283 |
+
|
| 284 |
+
We set $\lambda = 0 . 0 0 3$ similar to Shi et al. [2022] for all methods, and we ablate our method without fluency $( \lambda = 0$ ), which we denote as no fluency. We set out to show that hard prompts generated by this approach are successful both when transferring between a number of transformer-based language models, and when used to discover prompts in few-shot settings. An attractive quality of these prompts, especially for language applications, is that they can be optimized on smaller language models and then transferred to other, much larger models.
|
| 285 |
+
|
| 286 |
+
# A.3 Datasets and Setup
|
| 287 |
+
|
| 288 |
+
We evaluate Algorithm 1 against related algorithms on three classification tasks, two sentiment analysis tasks, SST-2 [Socher et al., 2013] and Amazon Polarity [McAuley and Leskovec, 2013], and a 4-way classification task, AGNEWS [Zhang et al., 2015]. We build on the setting explored in Ding et al. [2022] and optimize hard prompts using GPT-2 Large (774M parameters) [Radford et al., 2019] with the Adafactor optimizer [Shazeer and Stern, 2018] and a batch size of 32 [Lester et al., 2021a].
|
| 289 |
+
|
| 290 |
+
Transferability Set-up. To test transferability, we generate prompts from GPT-2 Large for 5000 steps. We then select the five prompts with the highest average validation accuracy for each technique and test them on larger models. We test the transferred text on: GPT-2 XL, T5-LM-XL, OPT-2.7B, and OPT-6B [Radford et al., 2019, Lester et al., 2021b, Zhang et al., 2022], verifying the reliability of the proposed algorithm over related techniques and testing whether the hard prompt can reliably boost performance. Thus, we also consider a baseline of empty prompts, with only the template.
|
| 291 |
+
|
| 292 |
+
Few-Shot Setup. For the few-shot setting, we optimize each prompt for 100 epochs on GPT-2 Large on the AGNEWS dataset, where we sample two examples $k = 2$ ) and four examples $k = 4$ ) from each class to obtain the training set. Additionally, we create a holdout set of the same size, and finally validate the prompts on the entire validation set.
|
| 293 |
+
|
| 294 |
+
# A.4 Results
|
| 295 |
+
|
| 296 |
+
We verify that our method is comparable to other methods in the sentiment analysis setting outperform the other methods on AGNEWS by about $2 \%$ . See Table 4 for details.
|
| 297 |
+
|
| 298 |
+
For Table 4, we report the best validation accuracy across three learning rates (0.1, 0.3, and 0.5), and for FluentPrompt and AutoPromptSGD we used the learning reported (1, 3, and 10) and follow Shi et al. [2022] for the remaining hyperparameters for FluentPrompt. For these experiments, we prepend our 10 token prompt to each input text. We employ early stopping for all methods using a hold-out set of 5000 examples for each dataset, evaluating every 100 steps.
|
| 299 |
+
|
| 300 |
+
Table 4 shows that we are comparable to other methods in sentiment analysis and outperform the other methods on AGNEWS by about $2 \%$ . Examining the prompts, we find prompts are not coherent English for any of the methods. However, it does produce relevant tokens and phrases. For example, our method for SST-2 with the fluency constraint produced “negative vibeThis immatureollywood MandarinollywoodThis energetic screenplay.” 3 This suggests the optimization process is finding relevant words to the task but lacks the ability to create full sentences.
|
| 301 |
+
|
| 302 |
+
Table 4: Validation accuracy for 10 discrete tokens trained prepended at the beginning of the input text. Best accuracy across three learning with standard error reported over 5 speeds.
|
| 303 |
+
|
| 304 |
+
<table><tr><td>Method</td><td>SST-2</td><td>AGNEWS</td><td>Amazon</td></tr><tr><td>AutoPromptsGD</td><td>87.56±0.35</td><td>74.36±0.47</td><td>87.75±0.17</td></tr><tr><td>FluentPrompt</td><td>88.33±0.35</td><td>74.62±0.24</td><td>87.42±0.18</td></tr><tr><td>OurSNo Fluency</td><td>88.12±0.15</td><td>77.06±0.20</td><td>87.70±0.21</td></tr><tr><td>OurSFluency</td><td>88.05±0.55</td><td>76.94±0.48</td><td>87.78±0.19</td></tr><tr><td>Soft Prompt</td><td>93.35±0.01</td><td>92.76±0.01</td><td>94.65±0.01</td></tr></table>
|
| 305 |
+
|
| 306 |
+
Prompt Transferability. Table 3 shows for each method the five prompts trained on GPT-2 Large transferred to other LLMs. Interestingly, simply scaling a model–with no additional training–does not guarantee that the model will scale perform according on SST-2.4 We see that all gradient-based methods are able to transfer compared to evaluating just the template, finding that our prompts trained with the fluency constraint transfer better than the other prompts. Additionally, we can see the largest boost from OPT-6.7B with our fluent method with about a $1 4 \%$ increase over just the template baseline. Additionally, we see our AGNEWS prompts are able to transfer from GPT-2 Large to GPT-2 XL in Table 5.
|
| 307 |
+
|
| 308 |
+
Table 5: Shows the validation accuracy with standard deviation from transferring hard prompts learned on GPT-2 Large to GPT-2 XL.
|
| 309 |
+
|
| 310 |
+
<table><tr><td>Method</td><td>GPT-2Large (755M)</td><td>GPT-2 XL (1.3B)</td></tr><tr><td>Emptytemplate</td><td>58.34</td><td>52.42</td></tr><tr><td>AutoPrompt</td><td>74.36±0.47</td><td>63.79±3.61</td></tr><tr><td>FluentPrompt</td><td>74.62±0.24</td><td>61.57±5.1</td></tr><tr><td>OurSNo Fluency</td><td>77.06±0.20</td><td>59.45±8.63</td></tr><tr><td>OurSFluency</td><td>76.94±0.48</td><td>67.59±2.67</td></tr></table>
|
| 311 |
+
|
| 312 |
+
3Although we initialize the tokens with the label tokens, when examining the prompt over the optimization process, all tokens moved away from the initial tokens. This suggests that the process was able to relearn the class label. $^ 4 \mathrm { A }$ quick experiment with and without the template on GPT-2 Large and XL showed that the template boosts performance differently for different models.
|
| 313 |
+
|
| 314 |
+
Table 6: Average validation accuracy with standard error on AGNEWS with $k$ examples/shots per class using early stopping (including soft prompt) for all methods across 100 seeds for three tokens append to the end of the text similar to the original template (“It was about”). We set $\lambda = 0 . 0 3$ for these experiments. “Empty” is the template with no additional prompt.
|
| 315 |
+
|
| 316 |
+
<table><tr><td>Method</td><td>k=2</td><td>k=4</td></tr><tr><td>EmptyTemplate</td><td>58.34</td><td>58.34</td></tr><tr><td>OurSNo Fluency</td><td>70.07±0.81</td><td>73.99±0.45</td></tr><tr><td>OurSFluency</td><td>70.93±0.60</td><td>74.15±0.48</td></tr><tr><td>Soft Prompt</td><td>74.92±0.58</td><td>79.93±0.36</td></tr></table>
|
| 317 |
+
|
| 318 |
+
Prompt Discovery. Table 6 shows that even with just a few shots we can achieve high validation accuracy compared to our prepended counterparts. It is worth noting that each few-shot run takes about 5min. We ran 100 seeds where the training set contains $k$ samples each class and did a quick examination of the top prompts, and although many of the prompts were gibberish, many of them were coherent. For example, even for $k = 2$ , some of the prompts included news sources like $\mathbf { \ddot { \mathit { B B C } } } ^ { \mathbf { \vec { \mu } } }$ , while other prompts found new approaches to the news classification task considering the text coming from a blog: “Brian blog,” or “Blog Revolution analyze.” Due to the efficiency of these gradient-based methods, these methods can allow new ways for prompt engineers to discover novel prompts.
|
md/dev/XomEU3eNeSQ/XomEU3eNeSQ.md
ADDED
|
@@ -0,0 +1,355 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CODE TRANSLATION WITH COMPILER REPRESENTATIONS
|
| 2 |
+
|
| 3 |
+
Marc Szafraniec∗ Baptiste Rozière\* Patrick Labatut Gabriel Synnaeve
|
| 4 |
+
|
| 5 |
+
Hugh Leather François Charton
|
| 6 |
+
|
| 7 |
+
Meta AI {mszafraniec,broz}@meta.com
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
In this paper, we leverage low-level compiler intermediate representations (IR) to improve code translation. Traditional transpilers rely on syntactic information and handcrafted rules, which limits their applicability and produces unnaturallooking code. Applying neural machine translation (NMT) approaches to code has successfully broadened the set of programs on which one can get a naturallooking translation. However, they treat the code as sequences of text tokens, and still do not differentiate well enough between similar pieces of code which have different semantics in different languages. The consequence is low quality translation, reducing the practicality of NMT, and stressing the need for an approach significantly increasing its accuracy. Here we propose to augment code translation with IRs, specifically LLVM IR, with results on the $\mathrm { C } { + } { + }$ , Java, Rust, and Go languages. Our method improves upon the state of the art for unsupervised code translation, increasing the number of correct translations by $11 \%$ on average, and up to $79 \%$ for the Java $ \mathrm { R u s t }$ pair with greedy decoding. With beam search, it increases the number of correct translations by $5 . 5 \%$ in average. We extend previous test sets for code translation, by adding hundreds of Go and Rust functions. Additionally, we train models with high performance on the problem of IR decompilation, generating programming source code from IR, and study using IRs as intermediary pivot for translation.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
Automatic code translation allows to port old codebases to new frameworks, or high-level (but slow) languages to low-level (and fast) ones. Current industry solutions, known as transpilers or transcompilers1, rely on handcrafted rules that are applied systematically. They produce unidiomatic translations that prove hard to read for human programmers. This is a serious limitation: the translated code should be easy to read and understand, as it will eventually be maintained by human developers.
|
| 16 |
+
|
| 17 |
+
In recent years, Neural Machine Translation (NMT) was proposed as an alternative to rule-based code translation (Roziere et al., 2020; Weisz et al., 2021; 2022). These models, trained from existing human-readable code, produce idiomatic, easy to understand, translations. Unfortunately, neural transpilers are unreliable, and often fail to translate the semantics of the input program accurately. This is a serious limitation, as some of the human work saved by the transpiler has to be reinvested debugging its output.
|
| 18 |
+
|
| 19 |
+
We propose to improve the reliability of NMT by leveraging information from compiler toolchains. When processing source code, compilers create Intermediary Representations (IR): language-agnostic pseudocode that describes the semantics of the program. Augmenting training data with the corresponding IR can benefit a Neural Transpiler in two ways: it helps align embeddings for different languages and improves the semantic understanding of the code. As shown in Figure 1, this can greatly improve the semantic quality of neural translations.
|
| 20 |
+
|
| 21 |
+
In this work, we leverage LLVM (Lattner and Adve, 2004) to augment source code with corresponding Intermediate Representation and train models for code translation and decompilation. We compare
|
| 22 |
+
|
| 23 |
+

|
| 24 |
+
|
| 25 |
+
Figure 1: Improvements over TransCoder. The first example shows a translation from $\mathrm { C } { + } { + }$ to rust, where TransCoder generates code using unsigned instead of signed integers. In the second example, a translation from Java to Go, it generates a function with the wrong return type. In the third example, which is also a translation from Java to Go, the model outputs a function that looks similar to the correct solution but it confuses $>$ with $\gg$ and closes an expression with a parenthesis too early. In these cases and many others, TransCoder makes mistakes that are small in terms of edit distance, but have a large impact on the semantics of the code. Using the IR to ground the representations to the semantics often helps solving these issues.
|
| 26 |
+
|
| 27 |
+
it to TransCoder, which uses only code and no IR. We also design an IR-only baseline, dubbed the pivot method, which generates a translation solely by decompiling an IR generated from the source language to a different target language. We experiment with four languages: $\mathrm { C } { + } { + }$ Java, Rust and Go, and show that utilizing both the code and the IR allows for an average relative improvement of $5 . 5 \%$ . Moreover, our method only uses the IR at training time and does not require extra computations at inference time.
|
| 28 |
+
|
| 29 |
+
Our main contributions are:
|
| 30 |
+
|
| 31 |
+
• We implement a new IR-augmented translation method, which leverages LLVM IRs to improve code representations. It allows us to increase the number of correct translations generated by TransCoder for $\mathrm { C } { + } { + }$ , Java, Go and Rust by $5 . 5 \%$ . Compared to our IR-only pivot method, the improvement reaches $170 \%$
|
| 32 |
+
• Our method is especially useful in the low data regime: with relative improvements reaching $2 9 . 7 \%$ when translating to Rust and $2 5 . 6 \%$ when translating from it.
|
| 33 |
+
• We extend the parallel evaluation dataset of 852 functions in $\mathrm { C } { + + }$ , Java and Python from Roziere et al. (2020) with 343 more functions in Go and 280 more in Rust, along with corresponding test cases
|
| 34 |
+
• In addition, we achieve $78 \%$ accuracy when decompiling LLVM IRs to $\mathrm { C } { + + }$
|
| 35 |
+
|
| 36 |
+
# 2 INTERMEDIATE REPRESENTATIONS IN COMPILERS
|
| 37 |
+
|
| 38 |
+
Compilers translate programs written in a computer language into executable code for a specific machine. Most compilers consist of a front-end taking source code as input, and a back-end which produces machine binary code. The front-end lexes (tokenizes) and parses the program. Then, it produces an abstract syntax tree (AST), and translates it into some Intermediate Representation (IR). The back-end converts the IR into machine-specific executable code.
|
| 39 |
+
|
| 40 |
+
In modern compilers such as LLVM (Lattner and Adve, 2004), the IR is generic across different input languages (and thus different front-ends). It allows the application of transformations and target agnostic optimizations to the IR, in a middle-end module independent from the source language and target machine. This results in an efficient compiler structure: new languages can be implemented by rewriting the front-end, and new target machines by rewriting the back-end.
|
| 41 |
+
|
| 42 |
+

|
| 43 |
+
Figure 2: A bird’s eye view of a compiler toolchain, exemplified with LLVM. The unoptimized version $( - 0 0 )$ is shown here for illustration. In practice we used the size-optimized version $( - \mathsf { O z } )$ of the IR as boxed, which does the compile time optimization of computing the addition of 26 and 16.
|
| 44 |
+
|
| 45 |
+
Several IRs usually co-exist in a compiler: each stage in the toolchain (Figure 2) introduces a new representation. Early stage IRs are language-dependent (e.g. ASTs mirror the syntax of the source language). Late stage IRs replace named variables by registers and reflect the specifics of the target architecture. In this work, we are interested in middle-end IRs, which are independent from the target machine, and similar for all source languages (like dialects in natural languages).
|
| 46 |
+
|
| 47 |
+
# 3 TRAINING OBJECTIVES
|
| 48 |
+
|
| 49 |
+
Unsupervised machine translation consists of learning multilingual sequence embeddings, and generating sequence in any output language from these embeddings (Lample et al., 2018a). We now present the objective functions for these tasks. In section 3.1, we review the three basic objectives used by TransCoder, our baseline NMT system. In section 3.2, we introduce three new functions that leverage LLVM IRs to improve the multilingual representation of source code, and the performance of our translation models. During training, we alternate between all six objectives, running each for the same number of optimisation steps. At inference, the model is only provided with the source code, i.e. the IR is not needed.
|
| 50 |
+
|
| 51 |
+
Formally, let $x = x _ { 1 } \ldots x _ { N _ { s o } }$ be the source sentence, $z ^ { ( x ) } = z _ { 1 } ^ { ( x ) } \dots z _ { N _ { i r } } ^ { ( x ) }$ the corresponding IR, and $y = y _ { 1 } \dots y _ { N _ { t a } } $ the target sentence. We write $\begin{array} { r } { \mathcal { L } _ { C E } ( \hat { y } , y ) = \sum _ { i } \ell _ { C E } ( \ddot { y } _ { i } , y _ { i } ) } \end{array}$ , with $\ell _ { C E } ( \hat { y } _ { i } , y _ { i } )$ the pairwise cross-entropy loss between $\hat { y } _ { i }$ and $y _ { i }$ . We define the machine translation loss (or seq2seq loss) from $x$ to $y$ , $\mathcal { L } _ { M T }$ as the sum of the negative log-likelihood of each token $y _ { i }$ , given $x$ and previous tokens $y _ { 0 } \ldots y _ { i - 1 }$ (note that $x$ and $y$ can have different lengths) :
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
\mathcal { L } _ { M T } ( x , y ) = - \sum _ { i } \log \left( P ( y _ { i } | x , y _ { 1 } \ldots y _ { i - 1 } ) \right)
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
# 3.1 COMMON OBJECTIVE FUNCTIONS
|
| 58 |
+
|
| 59 |
+
TransCoder (Roziere et al., 2020) learns to translate between programming languages by leveraging three unsupervised objectives developed for natural language (Lample et al., 2018b):
|
| 60 |
+
|
| 61 |
+
Masked Language Modeling (MLM) trains an encoder to predict randomly masked inputs. It is commonly used to pre-train embeddings for natural (Devlin et al., 2018; Liu et al., 2019) and programming languages (Kanade et al., 2020; Feng et al., 2020). MLM allows the model to learn the syntax and semantics of programs. Alternative objectives, have been proposed for programming languages (Guo et al., 2020; Lachaux et al., 2021; Ahmad et al., 2021; Wang et al., 2021). We do not use them here, as MLM remains effective and easy to use on a wide range of programming languages.
|
| 62 |
+
|
| 63 |
+
Denoting $m a s k ( x )$ the masked version of the code sentence $x$ , and $e n c ( t )$ the encoder output, MLM uses the following loss:
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
\mathcal { L } _ { M L M } = \mathcal { L } _ { C E } \left( e n c ( m a s k ( x ) ) , x \right) .
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+

|
| 70 |
+
Figure 3: IR for code representation objectives. We show examples of masking (used in TLM and TAE) and IR generation used to improve code representations with IRs. The masking objective in TLM or TAE makes the model understand the relationship between code and IR. The IR generation objective helps the model to build semantic representations of the code. For instance, another $\mathrm { C } { + + }$ function computing $3 9 \ + \ 3$ would result in the same IR. A Go function that returns 42 would also have a similar LLVM IR. Therefore, the IR Generation objective encourages the model to build similar representations for these three semantically equivalent functions.
|
| 71 |
+
|
| 72 |
+
Denoising Auto Encoding (AE) trains a sequence to sequence (seq2seq) model to retrieve an original sequence from a corrupted version. Corruption is done by masking spans of tokens randomly sampled from a Poisson distribution, as well as removing and shuffling tokens. It uses the following loss $( n o i s e ( x )$ denotes the corrupted version of $x$ ):
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
\mathcal { L } _ { A E } = \mathcal { L } _ { M T } \left( n o i s e ( x ) , x \right) .
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
Back-Translation (BT). Back-Translation (Sennrich et al., 2015) uses the model to generate a noisy translation of the input sentence, and then trains the model to recover the original input from the translation. It is a simple yet powerful objective for unsupervised machine translation (Lample et al., 2018a; Artetxe et al., 2018). In practice, it is a required loss to get competitive performance, so it is a staple of all our experiments. Formally, we use the model to translate sequence $x$ into $\hat { y }$ and train the model to reverse the translation process, using the loss:
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\mathcal { L } _ { B T } = \mathcal { L } _ { M T } \left( \hat { y } , x \right)
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
# 3.2 IR FOR CODE REPRESENTATIONS
|
| 85 |
+
|
| 86 |
+
Intermediate representations (IR) provide additional information about the code to be translated. We add them to the training dataset, as described in section 4.2, and leverage them by adding three new objective functions to those described in section 3.1.
|
| 87 |
+
|
| 88 |
+
Translation Language Modeling (TLM), first introduced in Lample and Conneau (2019), strives at generating common representations for parallel sentences in different languages. Like the masked language modeling (MLM) objective, it trains an encoder to predict random masked inputs. However, TLM is trained on pairs of parallel sentences, concatenated together and separated by a special token. Here, we concatenate functions in their source language and their corresponding IR, using the source code and IR language embeddings, and train the encoder to predict randomly masked tokens. This allows the model to learn correspondences between the source and the IR. The corresponding loss is ( $\oplus$ denotes concatenation):
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
\mathcal { L } _ { T L M } = \mathcal { L } _ { C E } \left( m a s k ( x \oplus z ^ { ( x ) } ) , x \oplus z ^ { ( x ) } \right)
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+

|
| 95 |
+
Figure 4: IR Decompilation objective. Here, we generate the IR corresponding to each function and train a model to decompile it. The IR pivot model uses this objective, as well as back-translation objectives, allowing it generalize to IRs generated from any language.
|
| 96 |
+
|
| 97 |
+
Translation Auto-Encoding (TAE) amounts to transposing the TLM objective into a denoising auto-encoder. The source code and corresponding IR are corrupted and masked, and then concatenated into one sequence (using the language embeddings for code and IR, as previously). TAE is then tasked to recover the original, using the following loss:
|
| 98 |
+
|
| 99 |
+
$$
|
| 100 |
+
\mathcal { L } _ { T A E } = \mathcal { L } _ { M T } \left( n o i s e ( x ) \oplus n o i s e ( z ^ { ( x ) } ) , x \oplus z ^ { ( x ) } \right)
|
| 101 |
+
$$
|
| 102 |
+
|
| 103 |
+
IR Generation (MT) trains the model to translate the source code into the corresponding IR. This allows the encoder to learn source code representations from the semantics of the IR. The loss is:
|
| 104 |
+
|
| 105 |
+
$$
|
| 106 |
+
\mathcal { L } _ { I R G e n } = \mathcal { L } _ { M T } \left( x , z ^ { ( x ) } \right)
|
| 107 |
+
$$
|
| 108 |
+
|
| 109 |
+
These three objectives need both the source code and the corresponding IR. However, only a fraction of the functions and files in our dataset could be compiled. To mitigate this, we also train the models on the full monolingual data using the MLM and AE objectives described above. In this setup, the back-translation (BT) objective is the same as in Roziere et al. (2020), and allows our model to translate directly from source code only at inference time.
|
| 110 |
+
|
| 111 |
+
# 3.3 ADDITIONAL LOSSES: IR DECOMPILATION AND PIVOT
|
| 112 |
+
|
| 113 |
+
We study two alternative uses of intermediary representations: IR decompilation, and IR pivot translation. IR decompilation consists of recovering source code corresponding to a given IR. In practice, it reverses the computations performed by the compiler. IR Pivot is a translation method built upon IR decompilation. Since LLVM can compile many languages $( \mathbf { C } + +$ , Java, Rust, Go) into the same IR, an obvious approach to code translation consists of decompiling the IR generated from the source language into code in the target language. We call this method “IR pivot”. Note that, whereas the IR for code representation techniques only used IR during training, both the decompilation and pivot method also need the IR for inference.
|
| 114 |
+
|
| 115 |
+
Decompilation. In this supervised task, we use LLVM to generate IR from source code, and train a language model to reverse the process, i.e. learn to predict the source code from the IR. Models are pre-trained using the MLM and AE objectives, and decompilation is learned using the machine translation loss:
|
| 116 |
+
|
| 117 |
+
$$
|
| 118 |
+
\mathcal { L } _ { D e c o m p } = \mathcal { L } _ { M T } \left( z ^ { ( x ) } , x \right)
|
| 119 |
+
$$
|
| 120 |
+
|
| 121 |
+
IR Pivot. This task leverages the IR as a pivot for code translation. For instance, to translate from Rust to $\mathrm { C } { + } { + }$ , we first use LLVM to compile a Rust program into IR and then decompile the IR to $\mathrm { C } { + } { + }$ using a neural decompiler. In practice, slight variations exists between the IR generated for different languages: the Rust-IR and $\mathrm { C } { + + }$ -IR behave like dialects of the LLVM-IR. This often leads to poor performance of the IR Pivot method. We mitigate these issues using a variety of techniques, which we describe in section C of the appendix.
|
| 122 |
+
|
| 123 |
+
# 4 DATA
|
| 124 |
+
|
| 125 |
+
# 4.1 TRAINING DATA
|
| 126 |
+
|
| 127 |
+
Our training data was extracted with Google BigQuery, which indexes over 2.8 million open source repositories from $\mathrm { G i t H u b } ^ { 2 }$ . We selected projects whose license explicitly permits re-distribution of parts, and extracted all individual $\mathrm { C } { + } { + }$ , Java, Rust and Go functions. To learn to decompile IRs, we also used the CodeNet dataset (Puri et al., 2021), a repository of 14 million competitive programming solutions in 55 languages. Our models work at function level: this reduces compilation failures over missing dependencies, while keeping sequence lengths short.
|
| 128 |
+
|
| 129 |
+
Table 1: Dataset coverage across languages, in number of standalone functions. More details can be found in Table 7 in the appendix.
|
| 130 |
+
|
| 131 |
+
<table><tr><td></td><td>C++</td><td>Go</td><td>Java</td><td>Rust</td></tr><tr><td>Monolingual data</td><td>6.6M</td><td>9.4 M</td><td>7.8M</td><td>576.3K</td></tr><tr><td>Code/IRParallel Data</td><td>344.4 K</td><td>384.4K</td><td>2.2 M</td><td>19.2 K</td></tr><tr><td>Successful IR Compilation</td><td>5.2%</td><td>4.1%</td><td>28.2%</td><td>3.3%</td></tr></table>
|
| 132 |
+
|
| 133 |
+
# 4.2 GENERATING INTERMEDIATE REPRESENTATIONS
|
| 134 |
+
|
| 135 |
+
While the LLVM ecosystem is large, not every language has an LLVM front-end, and not every front-end can produce LLVM IR out-of-the-box. We use $\mathsf { c } \mathtt { l a n g } + + \mathbf { \lambda } ^ { 3 }$ Lattner and Adve (2004) from the established LLVM $\mathrm { C } { + + }$ compilation toolchain, JLang4 for Java, Gollvm5 for Go and rustc Matsakis and Klock II (2014) for Rust. For the same program, written in different languages, different front-ends may produce different IR. To minimize these variations, we process the source code as follows. First, we generate the most size-optimized IR (- ${ \bf \nabla } \cdot O z$ flag), which makes the IR more uniform across languages. Second, we strip all unnecessary information (e.g. header and footer with attributes, debug information, comments). Finally, block names are canonicalized and symbol names demangled to facilitate their recovery. The functions that fail to compile at this point (e.g. because of missing dependencies) are not included in the parallel dataset, as seen in the last row of Table 1.
|
| 136 |
+
|
| 137 |
+
# 4.3 EVALUATION
|
| 138 |
+
|
| 139 |
+
Traditional NMT evaluation relies on metrics such as BLEU, that are based on n-gram overlaps. However, when dealing with programming languages, syntax and in particular compilation and computation outputs can differ widely despite minor changes in the code. Conversely, semantically equivalent code, that differ only in variable names or order of operations can have a low BLEU score. To take this into account, we use and enhance the computational accuracy test suite from Roziere et al. (2020), that contains 852 parallel competitive programming solutions in $\mathrm { C } { + + }$ , Java and Python. Using C2Rust, $\mathbf { \boldsymbol { C } } \mathbf { \boldsymbol { x } } \mathbf { \boldsymbol { G } } \mathbf { \boldsymbol { 0 } }$ and some manual code cleaning, we translated 280 functions and test suites in Rust and 343 in Go to measure the performance of our models in these languages. We measure our performance using the computational accuracy $\left( \mathbf { C A @ 1 } \right)$ metric (Kulal et al., 2019; Roziere et al., 2020), which considers that a translation is correct if it passes a series of unit tests.
|
| 140 |
+
|
| 141 |
+
# 5 RESULTS
|
| 142 |
+
|
| 143 |
+
# 5.1 EXPERIMENTAL DETAILS
|
| 144 |
+
|
| 145 |
+
For TransCoder, we consider a sequence-to-sequence (seq2seq) transformer model (Vaswani et al., 2017) with attention (Bahdanau et al., 2015; Sutskever et al., 2014) and the same architecture as Roziere et al. (2020). Our model has 12 layers (6 in the encoder and 6 in the decoder), 8 attention heads, and a dimension of 1024. For the objectives that add noise and masks to the input sentence, such as MLM, TLM, AE, and TAE, we choose the masked tokens and noise randomly on the fly at each epoch. We mask $15 \%$ of the tokens in MLM and TLM. In AE and TAE, we mask $20 \%$ of the tokens. MLM is trained on streams of data, while the other objectives are trained at function level. We use the Adam optimizer (Kingma and Ba, 2015) and an inverse squared-root learning rate scheduler, with an initial learning rate of $1 0 ^ { - 5 }$ in most of our experiments. Our models are implemented in PyTorch using mixed-precision floats. The pre-trained models were trained until convergence. The translation models presented in Tables 2 and 3 were trained for a week on 32 NVIDIA V100 GPUs.
|
| 146 |
+
|
| 147 |
+
Table 2: Translation performance $( \mathbf { C A } @ \mathbf { 1 } )$ , for greedy decoding and beam size 5. “To $X ^ { \ast }$ : average performance when translating to language X. “From $X ^ { \ast }$ : average performance when translating from language X. See Table 3 in the appendix for more detailed results. All these methods except for the IR pivot also use the three objectives defined in TransCoder: MLM, DAE and Back-Translation (BT). All combinations of the TLM, MT and TAE objectives improve the performance compared to TransCoder. The best results are obtained when all three are used at the same time. Beam search, using beam size 5 and returning only the top element from the beam results in improved performance. The IR Pivot method generates a translation in the target language from an IR generated from the source, and performs poorly in our setting.
|
| 148 |
+
|
| 149 |
+
<table><tr><td></td><td>from C++ to C++ from Go to Go from Java to Java from Rust to Rust</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>AVG</td></tr><tr><td>Greedy decoding</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>IR Pivot</td><td>17.4</td><td>24.0</td><td>19.9</td><td>11.5</td><td>11.9</td><td>22.2</td><td>16.3</td><td>7.8</td><td>16.4</td></tr><tr><td>TransCoder (baseline)</td><td>46.4</td><td>52.1</td><td>42.1</td><td>45.6</td><td>41.2</td><td>44.5</td><td>29.6</td><td>17.0</td><td>39.8</td></tr><tr><td>TLM</td><td>47.5</td><td>54.8</td><td>45.4</td><td>41.2</td><td>39.8</td><td>52.1</td><td>31.1</td><td>15.7</td><td>40.9</td></tr><tr><td>MLM+ TAE</td><td>47.3</td><td>53.3</td><td>47.2</td><td>44.8</td><td>41.8</td><td>45.9</td><td>25.1</td><td>17.4</td><td>40.4</td></tr><tr><td>TLM+TAE</td><td>46.9</td><td>55.9</td><td>45.0</td><td>37.9</td><td>38.5</td><td>54.5</td><td>34.9</td><td>16.8</td><td>41.3</td></tr><tr><td>MLM+MT</td><td>45.5</td><td>51.0</td><td>44.0</td><td>48.9</td><td>46.6</td><td>45.2</td><td>25.7</td><td>16.6</td><td>40.5</td></tr><tr><td>TLM + MT</td><td>45.6</td><td>51.5</td><td>45.1</td><td>47.1</td><td>46.9</td><td>45.5</td><td>24.4</td><td>17.9</td><td>40.5</td></tr><tr><td>TAE +MT</td><td>47.8</td><td>54.3</td><td>43.8</td><td>43.9</td><td>39.1</td><td>49.2</td><td>33.4</td><td>16.7</td><td>41.0</td></tr><tr><td>TLM + TAE +MT</td><td>47.8</td><td>54.3</td><td>46.6</td><td>51.6</td><td>47.1</td><td>49.6</td><td>35.3</td><td>21.4</td><td>44.2</td></tr><tr><td>Beam size 5</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>TransCoder (baseline)</td><td>53.8</td><td>53.4</td><td>45.2</td><td>54.4</td><td>46.1</td><td>51.5</td><td>35.9</td><td>20.9</td><td>45.3</td></tr><tr><td>TLM + TAE +MT</td><td>52.9</td><td>53.5</td><td>48.8</td><td>57.1</td><td>51.5</td><td>53.4</td><td>37.9</td><td>27.1</td><td>47.8</td></tr></table>
|
| 150 |
+
|
| 151 |
+
# 5.2 IR-AUGMENTED CODE REPRESENTATIONS FOR TRANSLATION
|
| 152 |
+
|
| 153 |
+
Models using combinations of the three objectives—TAE, TLM and MT—introduced to leverage IR, were trained to translate between pairs of four languages $\scriptstyle ( + +$ , Java, Rust, Go). Their average performance when translating to and from every language are presented in table 2. Additional information, including a comparison to TransCoder-ST for $\mathrm { C } { + } { + } $ Java, can be found in Table 3) in the appendix. As a baseline, we use a TransCoder (Roziere et al., 2020) model, trained with MLM on the same dataset.
|
| 154 |
+
|
| 155 |
+
Using greedy decoding, the new TLM, TAE and MT objectives, which leverage the IR, improve performance for every language. The best average results are obtained when combining all of them. Compared to TransCoder, they improve performance by an average $4 . 4 \%$ point ( $1 1 \%$ relative). The largest impacts are observed in the low data regime: translations from and into Rust (a language less represented in our training set) are improved by $2 5 . 6 \%$ and $1 9 . 3 \%$ (relative). Beam search improves the results of both TransCoder and our models, using IR-augmented representation still results in better performance. Qualitatively, we observe that IRs help our model translate types when the source and target types are represented by different tokens. For instance, in the first example of Table 1, it translates the semantics of int correctly using $\pm 3 2$ instead of an unsigned integer type (usize). See Appendix H for more analysis on how our objectives improve word embeddings.
|
| 156 |
+
|
| 157 |
+
Compared to IR-augmented translation models, the “obvious” IR Pivot method proves disappointing, even though it achieves non-trivial performances. It is heavily dependent on the size of the training set: the IR pivot performs relatively well when translating from low-resource to high-resource languages (e.g. from Rust), and badly when translating to low-resource languages (e.g. to Rust).
|
| 158 |
+
|
| 159 |
+
# 5.3 DECOMPILATION RESULTS
|
| 160 |
+
|
| 161 |
+
To compute the IR pivot, we trained a neural decompiler to retrieve source code from IRs. We tried two separate configurations for decompilation: a shared decoder with 6 layers for all language / IR pairs, or four separate decoders of with two layers each (one per language). Using a shared decoder improves the performance for all languages, and particularly when the data is scarce (e.g. Rust). See Table 5 in the appendix for more information.
|
| 162 |
+
|
| 163 |
+
We compare the performance of our model to RetDec (Kˇroustek et al., 2017), a rule-based decompiler. It obtains a computational accuracy of 68.75 on our $\mathrm { C } { + + }$ dataset and a BLEU score of 8.54. In comparison, our model obtains a computational accuracy of 77.9 and a BLEU score of 63.6 in the same setting. In particular, RetDec fails to decompile LLVM files generated from $\mathrm { C } { + } { + }$ code, especially snippets leveraging the standard library structures such as unordered_map or $s t d :$ allocator. The limitations of RetDec, which was implemented by a team of 24 developers in 7 years 6, shows how difficult it is to build exhaustive rule-based decompilers, especially when the IR comes from different languages or tools.
|
| 164 |
+
|
| 165 |
+
# 6 DISCUSSION
|
| 166 |
+
|
| 167 |
+
Different IR and interpreted languages The four languages considered in this work have frontends that can output LLVM Intermediary Representation. LLVM presently covers more than 30 computer languages. Using IR as pivot requires that the source and destination language have front-ends that use the same IR. This rules out some widely-used languages (e.g. Python). Using the IR to improve embeddings is less restrictive: the source and destination language can be trained on different IR, and aligned with back-translation. In this paper, we focus on compiled languages, but it is important to note that Intermediary Representations are usually available for interpreted languages as well: modern interpreters translate the source code into byte-code, that can serve as an IR.
|
| 168 |
+
|
| 169 |
+
Pivot vs Embedding TransCoder is an unsupervised model that learns to align code representations and translate code from one language to another. It is based solely on source code and does not use IRs. The pivot method uses automatically generated parallel sentences to learn to decompile IRs, and back-translation to adapt to different IR dialects. This method learns to translate using only IR-level similarities, and does not use the source code itself except to compute the IR. Although it underperforms other methods, it performs relatively well when little data is available for the source language, because the IR can be computed using a rule-based compiler. However, it requires to compute IRs at test time, which can be cumbersome. Instead, adding the TLM, TAE, and MT objectives to the objectives generally used for unsupervised code translation allows the model to get the best of both worlds. It can learn multilingual representations of source code from similarities in the IR and in the source code itself. As shown in Table 2, it outperforms both TransCoder and the pivot method. At the same time, this model does not require to compute IRs at test time, and is as easy to use as TransCoder.
|
| 170 |
+
|
| 171 |
+
Using our model at inference time. Our self-supervised IR-augmented TLM, TAE and MT objectives are designed to improve the multilingual code representations used in translation models. However, the translation task does not require to compute these objectives. Therefore, they lead to models that are just as simple to use as TransCoder: computing the IR is not required at test time and the model generates the translation directly from the source function.
|
| 172 |
+
|
| 173 |
+
# 7 RELATED WORKS
|
| 174 |
+
|
| 175 |
+
Source-to-Source Translation. Many rule-based methods are available for transpilation, an inventory of which can be found online1. In particular, ${ \mathrm { C } } 2 { \mathrm { R u s t } } ^ { 7 }$ and $\mathrm { C x G o } ^ { 8 }$ , along with manual corrections, were central for us in translating evaluation tests to Go and Rust (See Section 4.3). Similarly, $2 \mathrm { t o } 3 ^ { 9 }$ , a Python library porting Python 2 code to Python 3, was used in Aggarwal et al. (2015) to create a parallel dataset and train a machine learning model.
|
| 176 |
+
|
| 177 |
+
Neural Machine Translation for code is hampered by the lack of parallel data between programming languages. Indeed, apart from a few language pairs, such as Java-C# (Nguyen et al., 2013; Chen et al., 2018), and specific domains (e.g. competitive programming code), it is difficult to collect large datasets of semantically equivalent code in different languages. TransCoder (Roziere et al., 2020) bridges this gap by introducing unsupervised machine translation to programming languages. They take advantage of large monolingual code bases to learn to translate between $\mathrm { C } { + } { + }$ , Python and Java with high performance. Later, DOBF (Lachaux et al., 2021) improved the model pre-training method used in TransCoder, and Roziere et al. (2022) used automatically generated unit tests to improve translation performance between Java, $\mathrm { C } { + } { + }$ and Python. Recently, large language models trained on code, such as Codex (Chen et al., 2021) and PALM (Chowdhery et al., 2022), have been used for unsupervised code translation.
|
| 178 |
+
|
| 179 |
+
Using the Transcoder model, Weisz et al. (2021) and Weisz et al. (2022) survey the links between humans and NMT methods for code translation. They view neural translation methods as aids to programmers. In this context, they demonstrate that even imperfect models can improve the quality of an engineer’s work for code translation, and plead for the improvement of human-machine interfaces.
|
| 180 |
+
|
| 181 |
+
Decompilation. Like transpilation, decompilation is usually performed using rule-based methods that rely on pattern matching to parse the control flow structure of the program. RetDec, an open source decompiler created by Avast (Kˇroustek et al., 2017), can decompile an executable to C and a Python-like language via LLVM IR. Other tools exist, such as the Hex-Rays Decompiler10 and Brumley et al. (2013). A thorough review of rule-based methods can be found in papers such as Liang et al. (2021a) and Katz et al. (2019). With these methods, decompilation can fail if the code is too convoluted, or if it contains language features that were not explicitly translated. Most methods also produce unstructured programs, relying on a large number of goto statements to simulate the control flow of the lower level programming languages. This is semantically correct, but very rarely found in human-written code.
|
| 182 |
+
|
| 183 |
+
A few works have studied the use of sequence-to-sequence neural networks for neural decompilation. Katz et al. (2019) uses LSTM networks to decompile LLVM IRs and assembly code to C. Their approach generates code templates based on the IR, that determine the structure of the output. Then, they fill them with correct variable assignments and numerical values. In the same vein, Fu et al. (2019) tries to address limitations of neural decompilation with two sequential phases: code sketch generation and iterative error correction. Finally, Liang et al. (2021b) use a method close to ours, and train Transformer models to translate between binary code and C.
|
| 184 |
+
|
| 185 |
+
Intermediate representations are almost as old as compiler design. The first IR, UNCOL (Strong et al., 1958) was introduced in the mid-1950s, together with the idea of reusing the same compiler for several languages and machines. In 1960, NELIAC (a variant of ALGOL) (Huskey et al., 1960) was the first retargetable compiler, portable to different architectures. Feldman (1979) describes how a compiler for Fortran 77 can be added to the C compilers of Johnson (1979) and Ritchie (1979). GCC (Stallman, 2001) introduces Register Transfer Language (RTL) a low-level IR inspired by Davidson and Fraser (1980), and then GENERIC and GIMPLE (Merrill, 2003), precursors of the IR used in LLVM (Lattner and Adve, 2004).
|
| 186 |
+
|
| 187 |
+
# 8 CONCLUSION
|
| 188 |
+
|
| 189 |
+
In this paper, we leverage LLVM IRs to improve neural machine translation for source code. The IR provides a common semantically-rich language, into which $\mathrm { C } { + } { + }$ , Go, Java and Rust code can all be compiled. We develop three objectives, designed to leverage IRs for better multilingual representations of source code, which lead to a $5 . 5 \%$ relative average improvement for code translation. We also show that sequence-to-sequence transformers perform well for neural decompilation, and use this for pivot translation.
|
| 190 |
+
|
| 191 |
+
We only worked with the LLVM IR, but our approach is broadly applicable to any pair of languages that share a common Intermediate Representation. More generally any IR can help improve the code representations by tying them to the semantics. Another limitation is the scale of our current source and target sequences. As future work, LLVM IRs could be generated at a larger scale by compiling entire projects, which would greatly improve the percentage of successful IR compilations in Table 1. More languages and IRs could be used, and those extensions could be powered by larger models.
|
| 192 |
+
|
| 193 |
+
# REFERENCES
|
| 194 |
+
|
| 195 |
+
Karan Aggarwal, Mohammad Salameh, and Abram Hindle. Using machine translation for converting Python 2 to Python 3 code. Technical report, PeerJ PrePrints, 2015.
|
| 196 |
+
|
| 197 |
+
Wasi Ahmad, Saikat Chakraborty, Baishakhi Ray, and Kai-Wei Chang. Unified pre-training for program understanding and generation. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2655–2668, 2021.
|
| 198 |
+
|
| 199 |
+
Mikel Artetxe, Gorka Labaka, and Eneko Agirre. Unsupervised statistical machine translation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, 2018.
|
| 200 |
+
|
| 201 |
+
Dzmitry Bahdanau, Kyung Hyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In 3rd International Conference on Learning Representations, 2015.
|
| 202 |
+
|
| 203 |
+
David Brumley, JongHyup Lee, Edward J Schwartz, and Maverick Woo. Native $\mathbf { \boldsymbol { x } } 8 6$ decompilation using semantics-preserving structural analysis and iterative control-flow structuring. In 22nd USENIX Security Symposium (USENIX Security 13), pages 353–368, 2013.
|
| 204 |
+
|
| 205 |
+
Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde, Jared Kaplan, Harri Edwards, Yura Burda, Nicholas Joseph, Greg Brockman, et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021.
|
| 206 |
+
|
| 207 |
+
Xinyun Chen, Chang Liu, and Dawn Song. Tree-to-tree neural networks for program translation. In Advances in neural information processing systems, pages 2547–2557, 2018.
|
| 208 |
+
|
| 209 |
+
Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022.
|
| 210 |
+
|
| 211 |
+
Jack W. Davidson and Christopher W. Fraser. The design and application of a retargetable peephole optimizer. ACM Trans. Program. Lang. Syst., 2(2):191–202, apr 1980. ISSN 0164-0925.
|
| 212 |
+
|
| 213 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. CoRR, abs/1810.04805, 2018.
|
| 214 |
+
|
| 215 |
+
Stuart I. Feldman. Implementation of a portable Fortran 77 compiler using modern tools. SIGPLAN Not., 14(8):98–106, aug 1979. ISSN 0362-1340. doi: 10.1145/872732.806959. URL https: //doi.org/10.1145/872732.806959.
|
| 216 |
+
|
| 217 |
+
Zhangyin Feng, Daya Guo, Duyu Tang, Nan Duan, Xiaocheng Feng, Ming Gong, Linjun Shou, Bing Qin, Ting Liu, Daxin Jiang, et al. Codebert: A pre-trained model for programming and natural languages. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: Findings, pages 1536–1547, 2020.
|
| 218 |
+
|
| 219 |
+
Cheng Fu, Huili Chen, Haolan Liu, Xinyun Chen, Yuandong Tian, Farinaz Koushanfar, and Jishen Zhao. Coda: An end-to-end neural program decompiler. In Advances in Neural Information Processing Systems, pages 3703–3714, 2019.
|
| 220 |
+
|
| 221 |
+
Daya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng, Duyu Tang, LIU Shujie, Long Zhou, Nan Duan, Alexey Svyatkovskiy, Shengyu Fu, et al. Graphcodebert: Pre-training code representations with data flow. In International Conference on Learning Representations, 2020.
|
| 222 |
+
|
| 223 |
+
Harry D. Huskey, M. H. Halstead, and R. McArthur. NELIAC — dialect of ALGOL. Commun. ACM, 3(8):463–468, aug 1960. ISSN 0001-0782. doi: 10.1145/367368.367373. URL https: //doi.org/10.1145/367368.367373.
|
| 224 |
+
|
| 225 |
+
S. C. Johnson. A tour through the portable C compiler. In Unix Programmer’s Manual, 7th Edition, 2B, Section 33, 1979.
|
| 226 |
+
|
| 227 |
+
Aditya Kanade, Petros Maniatis, Gogul Balakrishnan, and Kensen Shi. Learning and evaluating contextual embedding of source code. In International Conference on Machine Learning, pages 5110–5121. PMLR, 2020.
|
| 228 |
+
|
| 229 |
+
Omer Katz, Yuval Olshaker, Yoav Goldberg, and Eran Yahav. Towards neural decompilation. arXiv preprint arXiv:1905.08325, 2019.
|
| 230 |
+
|
| 231 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. ICLR, 2015.
|
| 232 |
+
|
| 233 |
+
Jakub Kˇroustek, Peter Matula, and P Zemek. RetDec: An open-source machine-code decompiler, 2017. URL https://github.com/avast/retdec.
|
| 234 |
+
|
| 235 |
+
Sumith Kulal, Panupong Pasupat, Kartik Chandra, Mina Lee, Oded Padon, Alex Aiken, and Percy S Liang. Spoc: Search-based pseudocode to code. Advances in Neural Information Processing Systems, 32:11906–11917, 2019.
|
| 236 |
+
|
| 237 |
+
Marie-Anne Lachaux, Baptiste Roziere, Marc Szafraniec, and Guillaume Lample. DOBF: A deobfuscation pre-training objective for programming languages. arXiv preprint arXiv:2102.07492, 2021.
|
| 238 |
+
|
| 239 |
+
Guillaume Lample and Alexis Conneau. Cross-lingual language model pretraining. Advances in Neural Information Processing Systems, 32:7059–7069, 2019.
|
| 240 |
+
|
| 241 |
+
Guillaume Lample, Alexis Conneau, Ludovic Denoyer, and Marc’Aurelio Ranzato. Unsupervised machine translation using monolingual corpora only. ICLR, 2018a.
|
| 242 |
+
|
| 243 |
+
Guillaume Lample, Myle Ott, Alexis Conneau, Ludovic Denoyer, and Marc’Aurelio Ranzato. Phrase based & neural unsupervised machine translation. In EMNLP, 2018b.
|
| 244 |
+
|
| 245 |
+
Chris Lattner and Vikram Adve. Llvm: A compilation framework for lifelong program analysis & transformation. In International Symposium on Code Generation and Optimization, 2004. CGO 2004., pages 75–86. IEEE, 2004.
|
| 246 |
+
|
| 247 |
+
Ruigang Liang, Ying Cao, Peiwei Hu, and Kai Chen. Neutron: an attention-based neural decompiler. Cybersecurity, 4(1):1–13, 2021a.
|
| 248 |
+
|
| 249 |
+
Ruigang Liang, Ying Cao, Peiwei Hu, Jinwen He, and Kai Chen. Semantics-recovering decompilation through neural machine translation. arXiv preprint arXiv:2112.15491, 2021b.
|
| 250 |
+
|
| 251 |
+
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.
|
| 252 |
+
|
| 253 |
+
Nicholas D Matsakis and Felix S Klock II. The Rust language. In ACM SIGAda Ada Letters, volume 34, pages 103–104. ACM, 2014.
|
| 254 |
+
|
| 255 |
+
Jason Merrill. GENERIC and GIMPLE: A new tree representation for entire functions. In in Proc. GCC Developers Summit, 2003, pages 171–180, 2003.
|
| 256 |
+
|
| 257 |
+
Anh Tuan Nguyen, Tung Thanh Nguyen, and Tien N Nguyen. Lexical statistical machine translation for language migration. In Proceedings of the 2013 9th Joint Meeting on Foundations of Software Engineering, pages 651–654, 2013.
|
| 258 |
+
|
| 259 |
+
Ruchir Puri, David S. Kung, Geert Janssen, Wei Zhang, Giacomo Domeniconi, Vladimir Zolotov, Julian Dolby, Jie Chen, Mihir R. Choudhury, Lindsey Decker, Veronika Thost, Luca Buratti, Saurabh Pujar, and Ulrich Finkler. Project CodeNet: A large-scale AI for code dataset for learning a diversity of coding tasks. CoRR, abs/2105.12655, 2021. URL https://arxiv.org/abs/ 2105.12655.
|
| 260 |
+
|
| 261 |
+
D.M. Ritchie. A Tour Through the UNIX C Compiler. 1979. URL https://books.google. com/books?id ${ . } = { }$ 5UvEGwAACAAJ.
|
| 262 |
+
|
| 263 |
+
Baptiste Roziere, Marie-Anne Lachaux, Lowik Chanussot, and Guillaume Lample. Unsupervised translation of programming languages. Advances in Neural Information Processing Systems, 33, 2020.
|
| 264 |
+
|
| 265 |
+
Baptiste Roziere, Jie M Zhang, Francois Charton, Mark Harman, Gabriel Synnaeve, and Guillaume Lample. Leveraging automated unit tests for unsupervised code translation. ICLR, 2022.
|
| 266 |
+
|
| 267 |
+
Rico Sennrich, Barry Haddow, and Alexandra Birch. Improving neural machine translation models with monolingual data. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, pages 86–96, 2015.
|
| 268 |
+
|
| 269 |
+
Richard Stallman. Using and porting the GNU Compiler Collection. M.I.T. Artificial Intelligence Laboratory, 2001.
|
| 270 |
+
|
| 271 |
+
J. Strong, J. Wegstein, A. Tritter, J. Olsztyn, O. Mock, and T. Steel. The problem of programming communication with changing machines: A proposed solution. Commun. ACM, 1(8):12–18, aug 1958. ISSN 0001-0782. doi: 10.1145/368892.368915. URL https://doi.org/10.1145/ 368892.368915.
|
| 272 |
+
|
| 273 |
+
Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks In Advances in neural information processing systems, pages 3104–3112, 2014.
|
| 274 |
+
|
| 275 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pages 5998–6008, 2017.
|
| 276 |
+
|
| 277 |
+
Yue Wang, Weishi Wang, Shafiq Joty, and Steven CH Hoi. Codet5: Identifier-aware unified pretrained encoder-decoder models for code understanding and generation. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 8696–8708, 2021.
|
| 278 |
+
|
| 279 |
+
Justin D Weisz, Michael Muller, Stephanie Houde, John Richards, Steven I Ross, Fernando Martinez, Mayank Agarwal, and Kartik Talamadupula. Perfection not required? human-ai partnerships in code translation. In 26th International Conference on Intelligent User Interfaces, pages 402–412, 2021.
|
| 280 |
+
|
| 281 |
+
Justin D Weisz, Michael Muller, Steven I Ross, Fernando Martinez, Stephanie Houde, Mayank Agarwal, Kartik Talamadupula, and John T Richards. Better together? an evaluation of AIsupported code translation. In 27th International Conference on Intelligent User Interfaces, pages 369–391, 2022.
|
| 282 |
+
|
| 283 |
+
# A FULL SCORES TABLE
|
| 284 |
+
|
| 285 |
+
Table 3: Results on unsupervised code translation. The metric shown is the computational accuracy for a single generation $( \mathbf { C A @ 1 } )$ , measuring the translation correctness using unit tests. It is the full version of Table 2. The models were all trained with the same budget. As in Table 2, all these methods except for the IR pivot also use the three objectives defined in TransCoder: MLM, DAE and Back-Translation (BT). Although it is not the case for every language pair, TransCoder-IR, which uses the TLM, TAE, and MT objectives outperforms other methods on average. TransCoder-ST (Roziere et al., 2022) uses a parallel dataset generated with automated unit tests and outperforms other methods for $\mathbf { C } + + \mathbf { J a v a }$ . Their method is orthogonal to ours, and we could also improve our performance with similar methods.
|
| 286 |
+
|
| 287 |
+
<table><tr><td colspan="6">C++ →Go C++→Java C++→Rust Go →C++ Go →Java Go →Rust</td></tr><tr><td>Baseline TransCoder</td><td>57.7</td><td>63.3</td><td>18.2</td><td>56.1</td><td>46.9</td><td>23.3</td></tr><tr><td>TransCoder-ST</td><td>1</td><td>68.0</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>Pivot</td><td>16.1</td><td>22.0</td><td>14.0</td><td>30.5</td><td>26.5</td><td>2.7</td></tr><tr><td>TLM</td><td>61.8</td><td>62.5</td><td>18.2</td><td>57.6</td><td>56.4</td><td>22.2</td></tr><tr><td>TAE</td><td>57.7</td><td>62.5</td><td>21.7</td><td>63.0</td><td>54.7</td><td>23.8</td></tr><tr><td>TLM+TAE</td><td>58.2</td><td>63.3</td><td>19.2</td><td>55.2</td><td>57.0</td><td>22.8</td></tr><tr><td>MT</td><td>56.8</td><td>60.6</td><td>19.2</td><td>60.3</td><td>53.8</td><td>18.0</td></tr><tr><td>TLM+MT</td><td>58.6</td><td>58.5</td><td>19.7</td><td>57.3</td><td>54.1</td><td>23.8</td></tr><tr><td>TAE+MT</td><td>61.4</td><td>60.2</td><td>21.7</td><td>55.5</td><td>53.8</td><td>22.2</td></tr><tr><td>TLM+TAE+MT</td><td>55.9</td><td>62.9</td><td>24.8</td><td>61.8</td><td>55.7</td><td>22.2</td></tr><tr><td colspan="7">Java →C++ Java→Go Java→Rust Rust →C++ Rust →Go Rust → Java</td></tr><tr><td>Baseline TransCoder</td><td>77.9</td><td>35.9</td><td>9.6</td><td>22.4</td><td>43.2</td><td>23.4</td></tr><tr><td>TransCoder-ST</td><td>84.6</td><td>1</td><td>1</td><td>-</td><td>1</td><td>1</td></tr><tr><td>Pivot</td><td>19.5</td><td>9.4</td><td>6.7</td><td>22.0</td><td>8.9</td><td>18.1</td></tr><tr><td>TLM</td><td>80.9</td><td>31.8</td><td>6.6</td><td>25.9</td><td>30.0</td><td>37.5</td></tr><tr><td>TAE</td><td>80.3</td><td>38.6</td><td>6.6</td><td>16.6</td><td>38.1</td><td>20.6</td></tr><tr><td>TLM+TAE</td><td>82.2</td><td>24.6</td><td>8.6</td><td>30.4</td><td>31.0</td><td>43.3</td></tr><tr><td>MT</td><td>76.2</td><td>50.9</td><td>12.6</td><td>16.6</td><td>39.1</td><td>21.3</td></tr><tr><td>TLM+MT</td><td>77.9</td><td>52.7</td><td>10.1</td><td>19.2</td><td>30.0</td><td>24.1</td></tr><tr><td>TAE+MT</td><td>77.5</td><td>33.6</td><td>6.1</td><td>30.0</td><td>36.6</td><td>33.7</td></tr><tr><td>TLM+TAE+MT</td><td>74.5</td><td>49.6</td><td>17.2</td><td>26.5</td><td>49.2</td><td>30.2</td></tr></table>
|
| 288 |
+
|
| 289 |
+
B BEAM SIZE EVALUATION
|
| 290 |
+
|
| 291 |
+
Table 4: Results on unsupervised code translation with different beam sizes. The metric shown is still the computational accuracy for a single generation $( \mathbf { C A @ 1 } )$ . BS N refers to beam search decoding with beam size N, and returning only the top element of the beam. Using beam search improves the average performance of every model. BS N means that the model is evaluated with beam size N. When the beam size is not given, we use greedy decoding. Surprisingly, beam size 5 outperforms beam size 10. Our method using intermediate representations still outperforms the baseline with beam size 5 and 10 in average. With the baseline, we obtain average $\mathrm { C A @ 1 }$ scores of 45.3 with beam size 5 and 44.0 with beam size 10. Our method yields $\mathrm { C A @ 1 }$ scores of 47.8 with beam size 5 and 46.8 with beam size 10.
|
| 292 |
+
|
| 293 |
+
<table><tr><td></td><td>C++ →Go</td><td>C++→→Java</td><td>C++→Rust</td><td>Go →C++</td><td>Go→ Java</td><td>Go →Rust</td></tr><tr><td>Baseline TransCoder</td><td>57.7</td><td>63.3</td><td>18.2</td><td>56.1</td><td>46.9</td><td>23.3</td></tr><tr><td>Baseline TransCoder (BS 5)</td><td>65.5</td><td>67.6</td><td>28.3</td><td>52.1</td><td>59.3</td><td>24.3</td></tr><tr><td>Baseline TransCoder (BS 10)</td><td>65.0</td><td>68.7</td><td>27.8</td><td>52.1</td><td>57.0</td><td>23.8</td></tr><tr><td>TLM+ TAE+ MT</td><td>55.9</td><td>62.9</td><td>24.8</td><td>61.8</td><td>55.7</td><td>22.2</td></tr><tr><td>TLM + TAE + MT (BS 5)</td><td>61.4</td><td>66.6</td><td>30.8</td><td>57.3</td><td>59.0</td><td>30.2</td></tr><tr><td>TLM + TAE + MT (BS 10)</td><td>61.4</td><td>67.4</td><td>29.3</td><td>56.4</td><td>59.0</td><td>29.1</td></tr><tr><td></td><td>Java → C++</td><td>Java →Go</td><td>Java→Rust</td><td>Rust -→ C++</td><td>Rust →Go</td><td>Rust → Java</td></tr><tr><td>Baseline TransCoder</td><td>77.9</td><td>35.9</td><td>9.6</td><td>22.4</td><td>43.2</td><td>23.4</td></tr><tr><td>Baseline TransCoder (BS 5)</td><td>82.9</td><td>45.5</td><td>10.1</td><td>25.2</td><td>54.8</td><td>27.5</td></tr><tr><td>Baseline TransCoder (BS 10)</td><td>80.9</td><td>46.4</td><td>7.6</td><td>23.6</td><td>51.8</td><td>23.0</td></tr><tr><td>TLM+ TAE + MT</td><td>74.5</td><td>49.6</td><td>17.2</td><td>26.5</td><td>49.2</td><td>30.2</td></tr><tr><td>TLM + TAE + MT (BS 5)</td><td>76.4</td><td>57.7</td><td>20.2</td><td>26.8</td><td>52.3</td><td>34.7</td></tr><tr><td>TLM + TAE + MT (BS 10)</td><td>77.7</td><td>57.3</td><td>18.2</td><td>26.2</td><td>51.8</td><td>28.2</td></tr></table>
|
| 294 |
+
|
| 295 |
+
# C PIVOT METHOD DETAILS
|
| 296 |
+
|
| 297 |
+
As mentioned in Section 3.3, IR generated from different languages contain slight variations and can be seen as dialects of the same language. In practice, these variations prevent us from simply using our best decompilation model to generate source code in another language than the one used to generate the IR. Although we prompt the model to generate code in the target language with language embeddings, it learns to focus on the particularities of each dialect and ignores the language embeddings. Therefore, it generates code in the source language, which results in a computational accuracy score of 0 for translation.
|
| 298 |
+
|
| 299 |
+
One way to solve this issue is to use one decoder per target language. Then, the model is able to generate code in the target language. However, this method still performs poorly due to the small differences between the IR dialects. The method we tested that performed the best, and which is reported in Table 2, uses back-translation to make the model to translate from any IR dialect to any language. This model is also grounded by supervised translation steps making it generate IR from code and code from IR. In practice, we create new language embeddings for every IR dialect (i.e. $\mathrm { I R - C + + }$ , IR-Go, IR-Java, IR-Rust) for depending on the source language. At training time, we make the model generate noisy translations in the IR-Go, IR-Java and IR-Rust “languages” for every $\mathrm { C } { + } { + }$ sequence, and train it to re-generate the $\mathrm { C } { + } { + }$ sequence from the noisy translation. To allow the model to generate good training data for $\scriptstyle { \mathrm { I R - X } } \to { \mathbf { C } } + +$ , we also generate noisy translations in Go, Java, and Rust for every IR generated from $\mathrm { C } { + } { + }$ in our dataset and train the model to retrieve the IR. Using our parallel code//IR dataset, we also train the model to translate between $\mathrm { C } { + + }$ and IR- $C + +$ sequences. We do the same for every language and alternate between them.
|
| 300 |
+
|
| 301 |
+
Table 5: Performance of LLVM IRs Decompilation. This table shows the computational accuracy $( \mathbf { C A @ 1 } )$ of our neural decompiler and the RetDec $\mathrm { C } { + + }$ rule-based decompiler. Our neural decompiler outperforms RedDec on $\mathrm { C } { + + }$ and is more broadly applicable.
|
| 302 |
+
|
| 303 |
+
<table><tr><td></td><td>C++</td><td>Go</td><td>Java</td><td>Rust</td></tr><tr><td>Baseline - RetDec</td><td>68.8</td><td>一</td><td></td><td></td></tr><tr><td>Separate Decoders</td><td>52.7</td><td>42.2</td><td>60.1</td><td>19.5</td></tr><tr><td>Shared Decoder</td><td>77.9</td><td>70.1</td><td>82.2</td><td>61.0</td></tr></table>
|
| 304 |
+
|
| 305 |
+

|
| 306 |
+
Figure 5: Code simplification examples with Decompilation / Pivot. Since the LLVM IR is optimized, functions that are semantically equivalent after optimization map to the same IR. In the first example, it allows to remove useless code by decompiling the generated LLVM IR. In the second example, the simplification allows to find a bug: the $\&$ operator has precedence over $= =$ in $\mathrm { C } { + } { + }$ , causing this function to always evaluate to false. It is not obvious when looking at the input code, but becomes clear with the IR and simplified $\mathrm { C } { + + }$ code. In the third example, it replaces a bitwise operation by a more straightforward multiplication. In all examples, we can run the compiler again to check that the IR of the decompiled code is exactly the same as that of the input. It guarantees that the input and simplified code have the same semantics.
|
| 307 |
+
|
| 308 |
+

|
| 309 |
+
Figure 6: Java to Rust translation examples. In the first example, the IR allows the model to understand that the Java bitwise complement operator \~ should be replaced by ! in Rust. Also, it allows the model to translate the type correctly in both examples and avoids unnecessary casts. The IR allows the model to generate the right types (e.g. i32 instead of $\mathtt { u } 3 2$ when translating int) and operator (e.g. ! instead of $\tilde { }$ in Rust).
|
| 310 |
+
Figure 7: Rust to Go translation example. This function performs binary search to find the insertion index for an element in an ordered vector. The model translates types, function definitions, variable definitions, and while loops correctly.
|
| 311 |
+
|
| 312 |
+
// Rust
|
| 313 |
+
pub fn binary_search(nums: Vec<i32>, target: i32,
|
| 314 |
+
) -> i32 { if nums.is_empty() { return 0 } if target $<$ nums[0] { return 0 } let mut left $\qquad = \quad 0$ ; let mut right $=$ nums.len() - 1; while left $< =$ right { let mid $=$ left $^ +$ (right - left) / 2; if nums[mid] $= =$ target { return mid as i32; } else if nums[mid] $<$ target { left $=$ mid $^ + 1$ ; } else { right $=$ mid - 1; } } return left as i32;
|
| 315 |
+
}
|
| 316 |
+
// Go
|
| 317 |
+
func binarySearch(nums[] int, target int) int { if len(nums) $\scriptstyle = = 0$ { return 0 } if target $<$ nums[0] { return 0 } left: $\qquad = \quad 0$ right: $=$ len(nums) - 1 for left $< =$ right { mid: $=$ left $^ +$ (right - left) / 2 if nums[mid] $= =$ target { return mid } else if nums[mid] $<$ target { left $=$ mid $^ + 1$ else { right $=$ mid - 1 } } return left
|
| 318 |
+
}
|
| 319 |
+
// Go
|
| 320 |
+
func pairsInSortedRotated(arr[] int, n int, x int)
|
| 321 |
+
int { var i int for $\mathrm { ~ \\\small ~ \frac ~ { ~ i ~ } ~ } = \mathrm { ~ \small ~ 0 ~ }$ ; $\mathrm { ~ i ~ } ~ < \mathrm { ~ n ~ } ~ - ~ 1$ ; i++{ if arr[i] $\mathrm { ~ \gamma ~ > ~ } \mathrm { a r r } [ \mathrm { ~ i ~ \Gamma ~ + ~ }$ 1] { break } } var l int $= ( \frac { \mathrm { ~ i ~ \hbar ~ } } { 1 } + \mathrm { ~ 1 ~ } ) \frac { \circ } { \circ } \mathrm { ~ n ~ }$ var r int $\qquad = \quad \\\\\\\\\perp$ var cnt int $\qquad = \quad 0$ for l != r { if arr[l] $^ +$ arr[r] == x { cnt++ $\mathbf { i } \notin \mathbb { R } ^ { } 2 \ : \equiv \ : \ : ( \mathbf { r } _ { } \mathrm { ~ \ j ~ - ~ \frac ~ { ~ 1 ~ } ~ { ~ 1 ~ } ~ + ~ \eta ~ } _ { } \mathtt { n } ) \notin \mathbb { R } \ : \ : \{ \ :$ { return cnt } l = (l + 1) % n r = (r - 1 + n) % n } else if arr[l] + arr[r] < x { $1 = ( 1 + 1 ) \frac { 2 } { 0 } \pi$ } else { r = (n + r - 1) % n } } return cnt
|
| 322 |
+
}
|
| 323 |
+
// C++
|
| 324 |
+
int pairsInSortedRotated(int arr[], int n, int x)
|
| 325 |
+
{ int i; for $( \mathrm { ~ i ~ ~ } \ = \ \mathrm { ~ 0 ~ } ; \ \mathrm { ~ i ~ } \ < \ \mathrm { ~ n ~ ~ - ~ } \ \mathrm { ~ 1 ~ } ; \ \mathrm { ~ i ~ } \ + + )$ { if (arr $[ \pm ] >$ arr $[ { \mathrm { ~ i ~ \phi ~ } } + { \mathrm { ~ 1 ~ } } ]$ ) break; } int $1 = ( \dot { \bf ~ 1 } + \dot { \bf ~ 1 } ) \frac { \ d s } { \ d s } \mathrm { ~ n ~ } ;$ int $\mathrm { ~ \bf ~ r ~ } = \mathrm { ~ \bf ~ i ~ } ;$ ; int cnt $\qquad = \quad 0$ ; while $( \underline { { { 1 } } } \quad : = \quad \underline { { { { \bf r } } } } )$ ) { if (arr [l] + arr $[ { \boldsymbol { \textbf { r } } } ] \ \mathbf { \Sigma } = = { \boldsymbol { \textbf { x } } } )$ ) { cnt $^ { + + }$ ; $\begin{array} { c c c c c c c c c } { { \lfloor \pm } } & { { ( 1 } } & { { = = } } & { { ( \tt { r } } } & { { - } } & { { 1 } } & { { + } } & { { \tt { n } ) } } & { { \tt { \& } } } & { { \tt { n } ) } } & { { } } & { { } } \end{array}$ return cnt; $1 = ( 1 + 1 ) \frac { 2 } { 9 } \pi ;$ $\begin{array} { r c c c c l } { \texttt { r } = } & { ( \texttt { r } - } & { \texttt { l } + } & { \texttt { n } ) } & { \frac { \circ } { \circ } } & { \mathtt { n } } & { ; } \end{array}$ } else $\begin{array} { r } { \mathrm { i } \texttt { i f } \left( \mathrm { a r r } \left[ \mathrm { \texttt { l } } \right] \ + \ \mathrm { a r r } \left[ \mathrm { \texttt { r } } \right] \ < \ \textbf { x } \right) \ \mathrm { ~ \texttt { l } ~ = ~ \textbf { ( } \mathrm { 1 ~ \texttt { + } ~ 1 ~ } ) ~ \ \frac { \circ } { \circ } ~ \ n ~ } ; } \end{array}$ else $\texttt { r } = \texttt { ( n + r - l ) } \texttt { \frac { e } { s } n }$ ; } return cnt;
|
| 326 |
+
|
| 327 |
+

|
| 328 |
+
Figure 9: Rust to Go translation example. We call S1 the string n1 repeated s1 times and S2 the string n2 repeated $_ { \textrm { S 2 } }$ times. This function finds the largest number of repetitions of S2 appearing in any subset of S1. The model translates the types correctly, understands that casting vector indices to unsigned int (i.e. with as usize) is not required in Go, and correctly translates other Rust constructs to Go.
|
| 329 |
+
|
| 330 |
+
# F DATASET SIZE DETAILS
|
| 331 |
+
|
| 332 |
+
Table 6: Dataset details: number of tokens in our function-level dataset. This dataset contains only functions defined outside of classes and static functions.
|
| 333 |
+
|
| 334 |
+
<table><tr><td></td><td>Numberof tokens</td><td>Number of sentences</td></tr><tr><td>Monolingual data</td><td></td><td></td></tr><tr><td>C++</td><td>2.33B</td><td>6.6M</td></tr><tr><td>Go</td><td>1.9B</td><td>9.4M</td></tr><tr><td>Java</td><td>1.5B</td><td>7.8M</td></tr><tr><td>Rust</td><td>130.0M</td><td>576.3K</td></tr><tr><td>Code /IR Parallel Data</td><td></td><td></td></tr><tr><td>C++-IR</td><td>946.7M</td><td>343.9K</td></tr><tr><td>Go-IR</td><td>971.8M</td><td>384.4K</td></tr><tr><td>Java-IR</td><td>1.7B</td><td>2.2M</td></tr><tr><td>Rust-IR</td><td>77.7M</td><td>19.4K</td></tr></table>
|
| 335 |
+
|
| 336 |
+
# G ADDITIONAL ABLATIONS
|
| 337 |
+
|
| 338 |
+
Training on IRs with different objectives. We perform some additional ablations to determine whether our performance improvements come from training on IRs or from our TLM, TAE and MT objectives. When training a model with the three objectives of TransCoder (i.e. MLM, DAE and BT) and considering the IR as an extra language, we obtain an average computational accuracy of 37.4, which is lower than that of our baseline TransCoder. As the structure of the IR is not similar to that of any of our source languages, there is not much to gain from adding the IR as an extra language. Moreover, the model is wasting some time to compute the AE and BT objectives for the IR which can be better spent on the source languages. It confirms that our objectives are required to map IRs and their corresponding source code to similar representations in embedding space.
|
| 339 |
+
|
| 340 |
+
Language ablation: no Java. As Rust and Go are more similar to Java than to $\mathrm { C } { + + }$ , we also train a baseline model on $\mathrm { C } { + } { + }$ , Go and Rust only to evaluate whether including Java hurts the translation performance. We observed similar performance for $\mathbf { C } \mathbf { + } \mathbf { + } \mathbf { G } \mathbf { o }$ . However, we also observe a clear decrease in performance in the very low data regime (i.e. when translating to or from Rust). The computational accuracy for Rust $ \mathbf { C } + +$ goes down from $2 2 . 4 \%$ to $2 0 . 1 \%$ and it goes down from $4 3 . 1 \bar { 5 } \%$ to $3 2 . 5 \%$ for Rust $ \mathrm { G o }$ .
|
| 341 |
+
|
| 342 |
+
# H WORD EMBEDDINGS
|
| 343 |
+
|
| 344 |
+
We notice that our method generates improved word embeddings. It is visible when looking at the cosine similarity for embeddings of rust types and their equivalents in $\mathrm { C } { + } { + }$ . For instance, Figure 10 shows that the embedding of $\hphantom { 0 } \mathrm { { 3 2 } }$ from our model leveraging LLVM IRs is most similar to uint32 (with a cosine similarity of 0.4869). uint, which is also a correct translation, comes in $1 1 ^ { t h }$ position with a cosine similarity (0.3716). In contrast, $\hphantom { 0 } \mathrm { { 3 2 } }$ has a similarity of only 0.2828 with int. This token, which would be an incorrect translation, comes only in $2 9 ^ { t h }$ position.
|
| 345 |
+
|
| 346 |
+
The baseline model, which does not use the IR, learns similar representations for rust types since they appear in similar contexts. Hence, its embedding of $\hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom { 0 } \hphantom \hphantom { 0 } \hphantom { 0 } \hphantom \hphantom { 0 } \hphantom \hphantom { 0 } \hphantom \hphantom { 0 } \hphantom \hphantom \hphantom { 0 } \hphantom \hphantom \hphantom \hphantom { 0 } \hphantom \hphantom \hphantom \hphantom \hphantom \end \hphantom \hphantom \hphantom \hphantom \hphantom \hphantom \hphantom \hphantom \hphantom \hphantom \hphantom \hphantom \hphantom \hphantom \hphantom \hphantom \end f$ is most similar to other rust types tokens such as $\mathtt { \small u 6 4 }$ , i32 or u16. uint32 comes only in fourth position with a cosine similarity of 0.4218. Moreover, uint and int have almost the same cosine similarities with $\hphantom { 0 } \mathrm { { 3 2 } }$ with the baseline model. It causes the model to often confuse unsigned and signed integer types, and to incorrectly translate u32 into int instead of uint.
|
| 347 |
+
|
| 348 |
+

|
| 349 |
+
Figure 10: Token similarities. Rank and token similarity with $\mathtt { u } 3 2$ for our model (right) and the baseline model (left). Our model generates embeddings that better capture token semantics.
|
| 350 |
+
|
| 351 |
+
# I ANALYSIS OF ERROR TYPES
|
| 352 |
+
|
| 353 |
+
Table 7: Rust error types. To validate our intuition on the usefulness of the IR representations to decrease the number of type-related errors (see Fig.1 or Fig.6), we perform an in-depth analysis of the types of errors encountered for the Java Rust direction. Here we count the total number of errors (there can be several for a single translation). We notice that the number of type-related errors (excluding E0433, E0425 and Others) decreases by $24 \%$ (609 vs. 463) and the number of mismatched types decreases by $49 \%$ .
|
| 354 |
+
|
| 355 |
+
<table><tr><td>Error Code</td><td>Error Description</td><td>Baseline (Transcoder)</td><td>TLM + TAE + MT</td></tr><tr><td>E0308</td><td>Mismatched Type</td><td>414</td><td>210</td></tr><tr><td>E0412</td><td>Type Does Not Exist</td><td>15</td><td>3</td></tr><tr><td>E0277</td><td>Type has Missing Trait</td><td>180</td><td>250</td></tr><tr><td>E0425</td><td>Undefined Variable</td><td>18</td><td>27</td></tr><tr><td>E0433</td><td>Use of Undefined Crate,Module or Type</td><td>15</td><td>32</td></tr><tr><td>丨</td><td>Others</td><td>28</td><td>33</td></tr><tr><td>TOTAL</td><td></td><td>670</td><td>555</td></tr></table>
|
md/dev/_keb_XuP5oI/_keb_XuP5oI.md
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Generative Neural Articulated Radiance Fields
|
| 2 |
+
|
| 3 |
+
Alexander W. Bergman∗ Stanford University awb@stanford.edu
|
| 4 |
+
|
| 5 |
+
Petr Kellnhofer∗ TU Delft p.kellnhofer@tudelft.nl
|
| 6 |
+
|
| 7 |
+
Wang Yifan∗ Stanford University yifan.wang@stanford.edu
|
| 8 |
+
|
| 9 |
+
Eric R. Chan∗ Stanford University erchan@stanford.edu
|
| 10 |
+
|
| 11 |
+
Gordon Wetzstein Stanford University gordonwz@stanford.edu
|
| 12 |
+
|
| 13 |
+
David B. Lindell University of Toronto Vector Institute lindell@cs.toronto.edu computationalimaging.org/publications/gnarf/
|
| 14 |
+
|
| 15 |
+
# Abstract
|
| 16 |
+
|
| 17 |
+
Unsupervised learning of 3D-aware generative adversarial networks (GANs) using only collections of single-view 2D photographs has very recently made much progress. These 3D GANs, however, have not been demonstrated for human bodies and the generated radiance fields of existing frameworks are not directly editable, limiting their applicability in downstream tasks. We propose a solution to these challenges by developing a 3D GAN framework that learns to generate radiance fields of human bodies or faces in a canonical pose and warp them using an explicit deformation field into a desired body pose or facial expression. Using our framework, we demonstrate the first high-quality radiance field generation results for human bodies. Moreover, we show that our deformation-aware training procedure significantly improves the quality of generated bodies or faces when editing their poses or facial expressions compared to a 3D GAN that is not trained with explicit deformations.
|
| 18 |
+
|
| 19 |
+
# 1 Introduction
|
| 20 |
+
|
| 21 |
+
Unsupervised learning of 3D-aware generative adversarial networks (GANs) using large-scale datasets of unstructured single-view images is an emerging research area. Such 3D GANs have recently been demonstrated to enable photorealistic and multi-view consistent generation of radiance fields representing human faces [1–7]. These approaches, however, have not been shown to work with human bodies, partly because learning the body pose distribution is much more challenging given the significantly higher diversity in articulations compared to facial expressions.
|
| 22 |
+
|
| 23 |
+
Yet, generative 3D models of photorealistic humans have significant utility in a wide range of applications, including visual effects, computer vision, and virtual or augmented reality. In these scenarios, it is critical that the generated people are editable to support interactive applications, which is not necessarily the case for existing 3D GANs. While variations of linear blend skinning [8] have been adopted to articulate radiance fields for single-scene scenarios [9–21], it is unclear how to efficiently apply such deformation methods to generative models.
|
| 24 |
+
|
| 25 |
+
With our work, dubbed generative neural articulated radiance fields or GNARF, we propose solutions to both of these challenges. Firstly, we demonstrate generation of high-quality 3D (i.e., multi-view consistent and geometry aware) human bodies using a GAN that is trained in an unsupervised manner on datasets containing single-view images. To this end, we adopt the recently proposed tri-plane feature representation [1], which is extremely efficient for training and rendering radiance fields, while being compatible with conventional 2D CNN–based generators, such as StyleGAN [22]. While this framework has been successfully demonstrated for faces in prior work, we are the first to adapt it to generating radiance fields of full human bodies. Secondly, we tackle the editability of the generated radiance fields by introducing an explicit radiance field deformation step as part of our GAN training procedure. This step ensures that the generator synthesizes radiance fields of people in a canonical body pose, which is then explicitly warped according to the body pose distribution of the training data. We show that this new approach generates high-quality, editable, multi-view-consistent human bodies and that our approach can also be applied to editing faces, increasing the controllability of existing generative models for this task (see Fig. 1).
|
| 26 |
+
|
| 27 |
+

|
| 28 |
+
Figure 1: Our method, GNARF, maps a latent space to radiance fields representing human identities. These generated humans can then be animated and rendered from novel views. Qualitative results for our method trained on the $\mathrm { A I S T + + }$ dataset [23] are shown here.
|
| 29 |
+
|
| 30 |
+
To summarize, the contributions of our approach are:
|
| 31 |
+
|
| 32 |
+
• We present a 3D-aware GAN framework for the generation of editable radiance fields of human bodies. To our knowledge, this is the first approach of its kind. • Our framework introduces an efficient neural representation for articulated objects, including bodies and heads, that combines the recently proposed tri-plane feature volume representation with an explicit feature volume deformation that is guided by a template shape. • We demonstrate high-quality results for unconditional generation and animation of human bodies using the SURREAL and $\mathrm { A I S T + + }$ datasets and faces using the FFHQ dataset.
|
| 33 |
+
|
| 34 |
+
# 2 Related Work
|
| 35 |
+
|
| 36 |
+
Articulated 3D Representations. Parametric shape templates are one of the most common types of articulated 3D representations adopted in recent neural scene representation and rendering approaches. These templates, including faces [24, 25], bodies [26], hands [27], or a combination of these parts [28], and even animals [29], have been widely utilized for pose estimation and reconstruction, e.g. [30–34]. Volume deformation is also commonly used in computer graphics, for example using mean value coordinates (MVC) [35] or biharmonic coordinates [36] for shape deformation and editing [37–41]. GNARF combines parametric template shapes, such as FLAME [25] for heads and SMPL [26] for bodies, with an intuitive surface-driven volume deformation approach that is both computationally efficient and qualitatively comparable to or better than both skinning and MVC-based deformation. This provides intuitive editing control for articulated radiance field deformation.
|
| 37 |
+
|
| 38 |
+
Neural Radiance Fields. Coordinate networks, also known as neural fields [42], have emerged as a powerful tool that enable differentiable representations of 3D scenes [43–56] and learning viewdependent neural radiance fields [57–83]. While initial proposals have focused on static scenarios, recent work has demonstrated successful representations of dynamic scenes [84–91]. Articulated neural radiance fields further extend these approaches by providing editability for neural representations of human heads [92–97] and bodies [9–21, 98, 99] or animals [100], often by deforming the underlying radiance fields using traditional 3D morphable models or skeleton-based parameterizations, or alternatively conditioning the radiance field decoder with pose-related parameters. A more detailed survey of static, dynamic, and articulated neural radiance fields can be found in the recent state-of-the-art report by Tewari et al. [101]. Note that all of these techniques are supervised with scene-specific multi-image data and focus on representing, i.e., “overfitting”, a single scene. Therefore, it is not easily possible to train these models using unstructured 2D image data and then apply them to generate and edit new and unseen objects or humans.
|
| 39 |
+
|
| 40 |
+
Generative 3D-aware Radiance Fields. Building on the success of 2D image-based GANs [22, 102–104], recent efforts have focused on training 3D-aware multi-view consistent GANs from collections of single-view 2D images in an unsupervised manner. Achieving this challenging goal requires a combination of a neural scene representation and differentiable rendering algorithm. Recent work in this domain builds on representations using meshes [105, 106], dense [107–112] or sparse [113] voxel grids, multiple planes [2], fully implicit networks [3–7], or a combination of lowresolution voxel grids combined with 2D CNN-based image upsampling layers [114, 115]. Our 3D GAN architecture is most closely related to the recent work by Chan et al. [1], which uses an efficient tri-plane-based volume representation combined with neural volume rendering. We extend this work by including an explicit deformation field in our GAN architecture to model diverse articulations, which allows the generator to synthesize radiance fields of human bodies or heads in a canonical pose while being supervised by 2D image collections that contain arbitrary pose distributions. Explicitly disentangling radiance field generation and deformation enables us to drastically improve the quality of generated human bodies and faces when their poses or facial expressions are edited.
|
| 41 |
+
|
| 42 |
+
HeadNeRF [116] is related to our approach in that they generate 3D heads conditioned on various attributes. Both HeadNeRF and GNARF condition on identity and facial expression independently, with the former also conditioning on illumination and albedo. However, to disentangle individual attributes they need to acquire training images of the same person performing various expressions in different lighting conditions. In contrast, and similar to other 3D GANs, our approach only requires single-view images of different people and can therefore work with readily available 2D image collections. The recent work by Grigorev et al. [117] also generates human bodies. However, their work proposes a 2D GAN that generates textures which are used in combination with a standard articulated template mesh whereas we aim at generating and editing radiance fields using a 3D GAN. The concurrent work of Noguchi et al. [118] is closest to ours as the method also includes a radiance field deformation step in a tri-plane-based 3D GAN. Our evaluation shows superior generation quality and, more importantly, while their approach ties the network architecture to the specific choice of skeleton, our surface-driven volume deformation is agnostic to the particular choice of template and can be used with human bodies, faces, or other object types.
|
| 43 |
+
|
| 44 |
+
# 3 Generative Articulated Neural Radiance Fields
|
| 45 |
+
|
| 46 |
+
GNARF is a novel general framework to train 3D-aware GANs for deformable objects that have a parametric template mesh, e.g. human bodies and faces. It builds on the efficient tri-plane feature representation [1] for the generated neural radiance field, but additionally applies an explicit deformation which alleviates the requirement for the generator to learn a complicated distribution of articulations. As a result, the generator automatically learns to generate radiance fields of objects in the canonical pose, which are then warped explicitly to produce target body poses and facial expressions in a fully controllable and interpretable manner.
|
| 47 |
+
|
| 48 |
+
# 3.1 Modeling Articulated Radiance Fields
|
| 49 |
+
|
| 50 |
+
We first discuss our approach to modeling and rendering articulated radiance fields, before describing how this is integrated into the 3D GAN in Sec. 3.2.
|
| 51 |
+
|
| 52 |
+
Scene representation. To represent an object, we leverage the recently proposed tri-plane feature representation [1]. This representation uses three axis-aligned 2D feature planes, each with resolution $N \times N \times C$ , where $N$ and $C$ denote the spatial resolution and number of channels. The feature of any
|
| 53 |
+
|
| 54 |
+

|
| 55 |
+
Figure 2: Illustration of the GNARF pipeline, including the StyleGAN2 generator, the tri-plane feature representation, feature volume deformation, neural volume rendering, image super-resolution as well as camera view and body-pose conditioned dual discrimination. The resolution of intermediate data and the final image is indicated for experiments with the $\mathrm { A I S T + + }$ dataset.
|
| 56 |
+
|
| 57 |
+
3D point $\mathbf { x } \in \mathbb { R } ^ { 3 }$ is queried by projecting $\mathbf { X }$ onto the planes, retrieving three feature vectors via bilinear interpolation, and aggregating the vectors by summation, i.e., $F \left( \mathbf { x } \right) = F _ { x y } \left( \mathbf { x } \right) + F _ { y z } \left( \mathbf { x } \right) + F _ { x z } \left( \mathbf { x } \right)$ where $F _ { i j } : \mathbb { R } ^ { 3 } \mapsto \mathbb { R } ^ { C }$ is a function mapping 3D coordinates to features on the $i j$ plane via projection and interpolation.
|
| 58 |
+
|
| 59 |
+
Articulated deformation. We use the deformation function $D : \mathbb { R } ^ { 3 } \mapsto \mathbb { R } ^ { 3 }$ (detailed later) to warp a coordinate $\mathbf { x }$ from the target (deformed) space into the canonical space. Using a small multilayer perceptron MLP : $\mathbb { R } ^ { C } \mapsto \breve { \mathbb { R } } ^ { 4 }$ , we convert the deformed 3D feature volume into a neural field of spatially varying RGB colors c and volumetric densities $\sigma$ as
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
\left( \mathbf { c } \left( \mathbf { x } \right) , \sigma \left( \mathbf { x } \right) \right) = \mathrm { M L P } \left( \left( F _ { x y } \circ D \right) \left( \mathbf { x } \right) + \left( F _ { y z } \circ D \right) \left( \mathbf { x } \right) + \left( F _ { x z } \circ D \right) \left( \mathbf { x } \right) \right) .
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
There are many possible choices for how to specify the deformation field in an intuitive manner. For example, linear blend skinning can be used to deform the entire volume “rigged” by a skeleton (see e.g. [8]). While skinning is popular for human body articulations, it cannot explain subtle deformation due to varying facial expressions. Another option is to use the object-specific template mesh as a cage and apply cage-based deformation for the entire volume using mean value coordinates (MVC) [35]. However, the high computational cost of evaluating MVCs on the full-resolution grid (see Tab. 1) is prohibitive for GAN training and, more critically, this approach generally leads to severe artifacts when the template mesh (accidentally) includes self-intersections (see supplement).
|
| 66 |
+
|
| 67 |
+
To alleviate these problems, we use an intuitive surface-driven deformation method, which we label as the Surface Field (SF) method. This method only requires canonical and target template meshes with correspondences, which are readily available for faces [25] and bodies [26]. These template shapes, in turn, can be driven using skeletons, manual editing, or using keypoints or landmarks that could be detected in and transfered from videos of other people. Therefore, the SF method is generally sufficient to apply to different body parts and it can be intuitively edited in a number of ways, resulting in accurate volume deformation for our class of volumetric models.
|
| 68 |
+
|
| 69 |
+
The SF approach assigns each 3D coordinate $\mathbf { x }$ to its nearest triangle $t _ { \mathbf { x } } ^ { \mathrm { D } } = [ \mathbf { v } _ { 0 } , \mathbf { v } _ { 1 } , \mathbf { v } _ { 2 } ] \in \mathbb { R } ^ { 3 \times 3 }$ on the target (deformed) mesh. We compute the barycentric coordinates $[ u , v , w ]$ of the coordinate projected onto this triangle and find the corresponding triangle on the canonical mesh $t _ { \mathbf { x } } ^ { \mathrm { C } }$ and its normal ${ \mathbf { n } } _ { t _ { \mathrm { x } } } ^ { \mathrm { C } }$ The deformed coordinate can then be computed as
|
| 70 |
+
|
| 71 |
+
$$
|
| 72 |
+
D \left( \mathbf { x } \right) = t _ { \mathbf { x } } ^ { \mathrm { C } } \cdot \left[ \boldsymbol { u } , \boldsymbol { v } , \boldsymbol { w } \right] ^ { \mathsf { T } } + \left. \mathbf { x } - t _ { \mathbf { x } } ^ { \mathrm { D } } \cdot \left[ \boldsymbol { u } , \boldsymbol { v } , \boldsymbol { w } \right] ^ { \mathsf { T } } , \mathbf { n } _ { t _ { \mathbf { x } } } ^ { \mathrm { D } } \right. \mathbf { n } _ { t _ { \mathbf { x } } } ^ { \mathrm { C } } ,
|
| 73 |
+
$$
|
| 74 |
+
|
| 75 |
+
The SF approach is very fast to compute and mitigates artifacts from self-intersections of the template shape, thereby combining the benefits of linear blend skinning and MVC-based approaches for the task of radiance field deformation.
|
| 76 |
+
|
| 77 |
+
Rendering deformed radiance fields. We render the radiance field using (neural) volume rendering [62, 119]. For this purpose, the aggregated feature $F ( \mathbf { r } )$ of a ray $\mathbf { r }$ is computed by integrating the volumetric features f and density $\sigma$ as
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
\mathbf { F } ( \mathbf { r } ) = \int _ { t _ { n } } ^ { t _ { f } } T \left( t \right) \sigma \left( \mathbf { r } ( t ) \right) \mathbf { f } \left( \mathbf { r } ( t ) \right) \mathrm { d } t , \quad T \left( t \right) = \exp \left( - \int _ { t _ { n } } ^ { t _ { f } } \sigma \left( \mathbf { r } \left( s \right) \right) \mathrm { d } s \right) ,
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
where $t _ { n }$ and $t _ { f }$ indicate near and far bounds along the ray $\mathbf { r } ( t ) = \mathbf { o } + t \mathbf { d }$ pointing from its origin o into direction d. The volume rendering equation (eq. 3) is typically approximated using numerical methods, such as the quadrature rule [119].
|
| 84 |
+
|
| 85 |
+
# 3.2 3D GAN Framework
|
| 86 |
+
|
| 87 |
+
An overview of our 3D pipeline is shown in Fig. 2. Several components, including the StyleGAN generator, the tri-plane representation, the volume rendering, the CNN-based image super-resolution module, and (dual) discrimination are directly adopted from the EG3D framework [1].
|
| 88 |
+
|
| 89 |
+
Instead of directly generating the radiance field with the target body pose or facial expression, however, GNARF is unique in generating the radiance field in a canonical pose and then applying the deformation field discussed in the previous section to warp the feature volume. We additionally remove the pose conditioning on the generator, and only use camera pose and body pose conditioning in the discriminator. This removes the ability for the generator to incorporate any knowledge about the final view or pose in the canonical radiance field generation, ensuring that the generated results will be robustly animatable beyond just the image rendered at training time. Thus, the generator depends only on the latent code controlling identity, which is input into a StyleGAN2 generator. This architectural choice takes advantage of the state-of-the-art 2D generative model architectures by using them to generate the tri-plane 3D representation. The discriminator having access to the camera and body poses ensure that the GAN learns to generate warping accurate to a target pose rather than just being in the correct distribution. Finally, we adopt a radiance field rendering strategy which samples along each ray inside of an expanded template mesh. This ensures that the integration samples are taken in regions of the radiance field with the most detail and not taken in empty space, simultaneously improving the quality of the generated results and speeding up training.
|
| 90 |
+
|
| 91 |
+
Additional implementation details, source code, and pre-trained models can be found in the supplement or on our website.
|
| 92 |
+
|
| 93 |
+
# 4 Experiments
|
| 94 |
+
|
| 95 |
+
We first evaluate the proposed deformation field by overfitting a single representation on a single dynamic full body scene. Then we apply this deformation method in a GAN training pipeline for both bodies $\mathrm { \Delta A I S T + + }$ [23] and SURREAL [120]) and faces (FFHQ) [104]. Training details and hyper-parameters are discussed in the supplement.
|
| 96 |
+
|
| 97 |
+
$\mathrm { A I S T + + }$ is a large dataset consisting of 10.1M images capturing 30 performers in dance motion. Each frame is annotated with a ground truth camera and fitted SMPL body model. SURREAL contains 6M images of synthetic humans created using SMPL body models in various poses rendered in indoor scenes. FFHQ is a large dataset of high-resolution images of human faces collected from Flickr. All images have licenses that allow free use, redistribution, and adaptation for non-commencial use.
|
| 98 |
+
|
| 99 |
+
# 4.1 Single-scene Overfitting
|
| 100 |
+
|
| 101 |
+
We compare the proposed surface-driven deformation method, SF, with two alternative methods, MVC and skinning, in a single-scene overfitting task. MVCs require a set of weights (called the mean value coordinates) to be computed w.r.t. every vertex of the target mesh $\mathcal { M } ^ { \mathrm { D } }$ for every sample point. The sample point is then deformed into the canonical pose by linearly combining the vertices of the canonical mesh $\mathcal { M } ^ { \mathrm { C } }$ with these computed weights. In skinning, the sampling points are deformed to the canonical pose by the rigid transformation of the closest bone as measured by point to line-segment distance. We find this simplified definition of skinning effective in avoiding blending between two topologically distant body parts (e.g., hand and pelvis) if the starting pose brings them to a geometric proximity.
|
| 102 |
+
|
| 103 |
+
We select a multi-view video sequence from the $\mathrm { A I S T + + }$ dataset [23] and optimize tri-plane features in the canonical pose using a subset of the views and frames for supervision. We then evaluate the quality of the estimated radiance field warped into these training views and poses but also into held-out test views and poses. We apply several modifications to the tri-plane architecture to reduce overfitting; details regarding these changes as well as the selection of training and evaluation views are provided in the supplemental material.
|
| 104 |
+
|
| 105 |
+
<table><tr><td rowspan="2"></td><td colspan="3">Training images</td><td colspan="3">Test images</td><td rowspan="2">Run time [ms] ↓</td></tr><tr><td>PSNR ↑</td><td>SSIM↑</td><td>LPIPS↓</td><td>PSNR ↑</td><td>SSIM↑</td><td>LPIPS↓</td></tr><tr><td>Skinning</td><td>18.8</td><td>0.942</td><td>0.060</td><td>17.9</td><td>0.940</td><td>0.067</td><td>95.6</td></tr><tr><td>MVC [35]</td><td>18.1</td><td>0.937</td><td>0.067</td><td>17.2</td><td>0.934</td><td>0.074</td><td>0.2 (3782.1)</td></tr><tr><td>Surface Field</td><td>19.0</td><td>0.943</td><td>0.058</td><td>18.0</td><td>0.940</td><td>0.065</td><td>31.6</td></tr></table>
|
| 106 |
+
|
| 107 |
+
Table 1: Single-scene overfitting. We evaluate three deformation approaches for the task of estimating a single radiance field in a canonical body pose supervised by a video sequence showing a person from different views and in different poses. The SF approach achieves the best quality for both training and unseen test images while being the fastest. Note that the MVC method is only faster than SF when using precomputed grid at the cost of significantly lower deformation accuracy (the runtime without such approximation is reported in parentheses). The timings are measured to deform a single feature volume on an RTX3090 graphics processing unit.
|
| 108 |
+
|
| 109 |
+

|
| 110 |
+
Figure 3: Qualitative comparison of generated target poses using our model vs. warping a pre-trained EG3D model on the $\mathrm { A I S T + + }$ dataset.
|
| 111 |
+
|
| 112 |
+
To speed up MVC and SF computation, we decimate the source and deformed SMPL mesh using Quadric Error Metric Decimation [121] in the Open3D library [122] from the original 13,776 faces to 1,376 faces, while tracking the correspondence between the source and deformed meshes. Nonetheless computing MVC for each deformed pose is still prohibitively expensive for online training (3.7 s per example). We thus precompute the deformation for training and test body poses on a fixed $1 6 ^ { 3 }$ grid and retrieve the deformation for arbitrary sampling points using trilinear interpolation.
|
| 113 |
+
|
| 114 |
+
As shown in Tab. 1, our SF method outperforms the others for both training and test images. MVC performs worst, partially due to the grid approximation, which is essential in practice. The skinning method is comparable to SF in terms of image quality but it is $3 \times$ slower. Moreover, skinning cannot sufficiently deform subtle facial expressions. Therefore, the SF approach is the most flexible among these deformation methods by being compatible with different human body parts while also offering computational and memory efficiency.
|
| 115 |
+
|
| 116 |
+
# 4.2 Human Body Generation and Animation
|
| 117 |
+
|
| 118 |
+
We now use our SF approach as the deformation method for feature volumes generated by GNARF. Our method is trained and evaluated on the captured $\mathrm { A I S T + + }$ [23] and the synthetic SURREAL [120] datasets. For both datasets, our method generates high-quality multi-view consistent human bodies in diverse poses that closely match the target pose.
|
| 119 |
+
|
| 120 |
+
Baselines & Evaluation. Because GNARF is the first method to learn a generative model of radiance fields representing bodies, we propose a baseline where we use the original EG3D trained without deformation to generate a feature volume (not in the canonical pose) then warp it into various target poses during inference time using the proposed SF deformation method. Without the feature volume deformation, the generator is forced to learn to model both identity and pose in its latent space. As a result, the tri-plane features no longer represent a human body in a consistent canonical pose, but rather match the distribution of poses in the dataset. The animation of generated bodies is similar to our proposed approach, except that the generated (arbitrarily posed) human body is used as the canonical pose, for which we obtain a SMPL mesh by applying the human shape reconstruction method SPIN [31]. Additionally, we included the concurrent work ENARF-GAN and its variant ENARF-VAE [118] in the evaluation whenever a fair and standardized comparison is possible.
|
| 121 |
+
|
| 122 |
+
<table><tr><td rowspan="2"></td><td colspan="2">AIST++ @256²</td><td colspan="3">SURREAL @128²</td></tr><tr><td>FID (50k)↓</td><td>PCKh@0.5↑</td><td>FID (10k)↓</td><td>FID (50k)↓</td><td>PCKh@0.5 个</td></tr><tr><td>ENARF-VAE [118]*</td><td></td><td></td><td>63.0</td><td></td><td></td></tr><tr><td>ENARF-GAN [118]*</td><td></td><td></td><td>21.3</td><td></td><td>0.966</td></tr><tr><td>EG3D (no warping)</td><td>8.3</td><td></td><td>14.3</td><td>13.3</td><td></td></tr><tr><td>EG3D (+ pose est. & re-warping)</td><td>66.5</td><td>0.855</td><td>163.9</td><td>162.2</td><td>0.348</td></tr><tr><td>GNARF</td><td>7.9</td><td>0.980</td><td>4.7</td><td>5.7</td><td>0.999</td></tr></table>
|
| 123 |
+
|
| 124 |
+
Table 2: Quantitative evaluation of our GAN trained on SURREAL [120] and $\mathrm { A I S T + + }$ [23]. Our method only considers foreground images (backgrounds masked). ∗Metrics provided by authors of [118] after standardizing the evaluation protocol, which may differ from initial values in their original report.
|
| 125 |
+
|
| 126 |
+
We compare FID scores to evaluate the quality and diversity of generated images as well as the Percentage of Correct Keypoints (PCK) metric to evaluate the quality of the animation. PCK computes the percentage of 2D keypoints detected on a generated rendered image that are within an error threshold (half the size of the head in the case of $\operatorname { P C K h } @ 0 . 5 )$ of keypoints on a ground truth image in the same pose and view. We use an off-the-shelf body keypoint estimator [123] trained on MPII [124] publically available on the MMPose Project [125] to estimate keypoints from a corresponding ground truth and generated image.
|
| 127 |
+
|
| 128 |
+
$\mathbf { A I S T + + }$ . $\mathrm { A I S T + + }$ is a challenging dataset as the body poses are extremely diverse. We collect 30 frames per video as our training data after filtering out frames whose camera distance is above a threshold or the human bounding box is partially outside the image. Then we extract the human body by cropping a $6 0 0 \times 6 0 0$ patch centered at the pelvis joint, and resize these frames to $2 5 6 \times 2 5 6$ . Since this dataset does not provide ground truth segmentation masks, we use a pre-trained segmentation model [126] to remove backgrounds to stabilize the GAN training. To speed up training, we use GAN transfer learning [127]. Rather than initializing our network weights randomly, we begin training from a pre-trained EG3D [1] model. Fine-tuning allows for quicker convergence and saves computational resources during training.
|
| 129 |
+
|
| 130 |
+
As shown in Tab. 2, we can see that our method outperforms the naive reanimation of EG3D by a large margin (see the 4th row vs. the 5th row). Furthermore, our animated method also generates better images than the EG3D baseline that does not support animations. This is likely due to GNARF allowing the generator to focus on generating a specific identity in a canonical pose instead of learning both identity and complex pose distribution in a combined latent space. Similarly, our model enables high-quality re-animation, as demonstrated by the $\operatorname { P C K h } @ 0 . 5$ metric. In Fig. 3, our method produces significantly better qualitative results than those generated by the baseline. The baseline results using re-warped EG3D are significantly degraded, since it is difficult to accurately estimate the SMPL mesh from the generated images, which we use as the canonical pose in the deformation function. Additionally, floating artifacts which exist in the radiance field outside of camera views and make no difference in the conventionally rendered images become visible after being warped can cause false occlusions. In Fig. 1, we show that our method generates bodies in a canonical pose with diverse identities. Additionally, we show that by changing the SMPL parameters, we can drive each radiance field to a desired target pose and render at an arbitrary novel view.
|
| 131 |
+
|
| 132 |
+

|
| 133 |
+
Figure 4: Example of generated humans in canonical pose and in target pose using model trained on SURREAL dataset.
|
| 134 |
+
|
| 135 |
+
SURREAL. We also test our method on the SURREAL dataset. The training data is extracted from the first frame of each video in SURREAL’s training split. Each frame is cropped based on the provided segmentation mask from head-to-toe, and resized to $1 2 8 \times 1 2 8$ . We filter out the backgrounds and set them to be black. The SURREAL dataset provides ground truth SMPL parameters and camera intrinsics and extrinsics for each frame. Similarly to $\mathrm { A I S T + + }$ , we use transfer learning from a pre-trained EG3D model at the appropriate resolution.
|
| 136 |
+
|
| 137 |
+
<table><tr><td></td><td>FID (500)↓</td><td>FID (50k)↓</td><td>AED↓</td><td>APD↓</td><td>ID-Consistency ↑</td></tr><tr><td>EG3D (+3DMM est.& re-warping)</td><td>22.9</td><td>11.6</td><td>0.29</td><td>0.028</td><td>0.81</td></tr><tr><td>PIRenderer[129]</td><td>64.4</td><td>丨</td><td>0.28</td><td>0.040</td><td>0.70</td></tr><tr><td>3D GAN inversion [130]</td><td>31.2</td><td>一</td><td>0.36</td><td>0.039</td><td>0.73</td></tr><tr><td>GNARF</td><td>17.9</td><td>6.6</td><td>0.23</td><td>0.025</td><td>0.80</td></tr></table>
|
| 138 |
+
|
| 139 |
+
Table 3: Quantitative comparison on FFHQ dataset [104].
|
| 140 |
+
|
| 141 |
+

|
| 142 |
+
Figure 5: Deformation fidelity on FFHQ dataset. We plot the target and detected facial landmarks in blue and green, respectively, to visualize the expression fidelity. PIRender [129] and 3D GAN inversion [130] both show large discrepancy to the target face, while the baseline EG3D has strong artifacts from warping (right). Our generated results show high visual quality and they align accurately with the driving deformation.
|
| 143 |
+
|
| 144 |
+
In Tab. 2, we see that our method trained with deformation produces improved FID scores as the version trained without SF feature volume deformation (5th vs 3rd row). Attempting to deform generated radiance fields results in an immense degradation in quality, shown by both the FID and $\operatorname { P C K h } @ 0 . 5$ metrics (4th row).
|
| 145 |
+
|
| 146 |
+
Additional qualitative results and evaluations are included on the website.
|
| 147 |
+
|
| 148 |
+
# 4.3 Human Face Generation and Editing
|
| 149 |
+
|
| 150 |
+
Thanks to the surface-driven deformation method, SF, our method can directly utilize expressive parametric face models to drive subtle deformations. We use the FLAME [25] head model and apply the state-of-the-art facial reconstruction method DECA [128] to estimate the flame parameters (100D identity vectors, 6D joint position vectors and 50D expression vectors) from the training dataset. Since DECA does not account for eyeball movement, we remove the eyeballs from the original FLAME template. Additionally, we add triangles to close the holes at the neck and mouth area in the FLAME template, which improves the consistency of the SF deformation. These preprocessing steps produce a mesh with 3,741 vertices and 7,478 faces. Finally we apply the same decimation method as in the body experiments to obtain a coarse mesh (2,500 triangles), which we use during the GAN training for faster SF deformation.
|
| 151 |
+
|
| 152 |
+
To train GNARF, we start with a conventional EG3D model pre-trained using the FFHQ dataset (see [1] for details on the training details and data processing). We then fine-tune this model using the proposed framework, which includes the SF deformation module. Note that we apply a global scaling and translation to the FLAME template mesh to roughly align it to the faces generated by the pre-trained EG3D model.
|
| 153 |
+
|
| 154 |
+
For evaluation, our first baseline is the original EG3D model with re-warping at inference time, as described in Sec. 4.2. We also include two state-of-the-art facial reenactment methods, PIRenderer [129] and 3D GAN inversion [130]. Several metrics are used by our quantitative evaluation. FID (500) follows the evaluation protocol of Lin et al. [130], where the ground truth dataset consists of 500 randomly sampled identities and the test dataset is constructed by animating the ground truth using randomly sampled target poses. FID (50k) follows the protocol in EG3D, where the entire FFHQ dataset is treated as the ground truth and the test dataset includes $5 0 \mathrm { k }$ generated images using randomly sampled latent vectors, camera poses and FLAME facial parameters. Following [130], we evaluate the fidelity of the animation with the Average Expression Distance (AED) and the Average
|
| 155 |
+
|
| 156 |
+

|
| 157 |
+
Figure 6: Qualitative results on FFHQ dataset. We show each identity in their canonical (left) and a different (right) expression from two different camera poses. Our method shows excellent multi-view consistency.
|
| 158 |
+
|
| 159 |
+
Pose Distance (APD) computed using DECA estimation, as well as the identity consistency based on a face recognition model [131].
|
| 160 |
+
|
| 161 |
+
As shown in Tab. 3, our method is superior to the baseline methods in both FIDs and in the edited fidelity, and comparable to the baseline EG3D in terms of identity consistency. The advantage of our method in editing ability is clearly demonstrated in Fig. 5: our method reproduces the target expression more accurately when compared to the face reenactment methods and mitigates the warping artifacts present in the baseline EG3D. In Fig. 6, we further demonstrate the quality of our results. Notice that even though the FLAME model does not include teeth, the SF deformation guides the neural radiance field to construct teeth consistently at the correct location.
|
| 162 |
+
|
| 163 |
+
# 5 Discussion
|
| 164 |
+
|
| 165 |
+
Limitations and future work. Our work is not without limitations. The level of detail in the generated bodies, for example, is relatively low. This is partly due to the limited resolution of the training data in the SURREAL and $\mathrm { A I S T + + }$ datasets, but also due to the limited resolution that the tri-plane representation offers for any one body part, such as the face. An interesting avenue of future work could include the exploration of adaptive radiance field resolution for human bodies, allocating more resolution to salient parts (see e.g. [132]). The image quality of the generated bodies is currently on par with simpler approaches that only need to generate an RGB texture on the SMPL mesh [117]. Yet, details in faces and hair cannot be handled by a texture-generating approach and we expect the quality of generative radiance fields to surpass that of simpler alternatives with increasing and perhaps adaptive radiance field resolutions. Another bottleneck of our current framework is the challenge of being able to work with large-scale datasets showing a diversity of visible humans. In-the-wild datasets, such as MSCOCO [133], do contain this diversity but also contain a significant amount of occlusion and detailed backgrounds, requiring the generator to spend capacity on modeling the distribution of backgrounds and occlusions themselves. An interesting avenue of future work consists of explicitly modeling occlusion and background in the GAN training pipeline independently from identity and pose. Currently, the background is not modeled in the generative framework and requires pre-processing of the dataset to separate foreground from background. Additionally, pose estimation from in-the-wild images is still not very accurate, degrading the quality of our deformation function. On the other hand, large-scale custom curated datasets such as the one used in InsetGAN [132] are not publicly available. Finally, the deformation we use as part of the 3D GAN training is limiting in several ways: it does not allow for topology changes, it does not prevent solid parts like teeth or eyeglasses from being stretched, and the deformation quality degrades for points far from the surface. In general, using the surface of a parametric mesh to guide an volume may not be the optimal choice for more complex volumetric scenes. More advanced deformation methods, perhaps including kinematic constraints, could be an interesting direction of future research.
|
| 166 |
+
|
| 167 |
+
Ethical considerations. GANs could be misused for generating edited imagery of real people. Such misuse of image synthesis techniques poses a societal threat, and we do not condone using our work with the intent of spreading disinformation. We also recognize a potential lack of diversity in our results, stemming from implicit biases of the datasets we process.
|
| 168 |
+
|
| 169 |
+
Conclusion. Our work takes important steps towards photorealistic 3D-aware image synthesis of articulated human bodies and faces with applications in visual effects, virtual or augmented reality, and teleconferencing among others.
|
| 170 |
+
|
| 171 |
+
# Acknowledgments and Disclosure of Funding
|
| 172 |
+
|
| 173 |
+
Alexander W. Bergman was supported by a Stanford Graduate Fellowship. Gordon Wetzstein was supported by NSF Award 1839974, Samsung, Stanford HAI, and a PECASE from the ARO. We thank Connor Lin for helping standardize comparisons to [130]. We thank Atsuhiro Noguchi and the authors of [118] for helping in standardization of the comparisons of our methods.
|
| 174 |
+
|
| 175 |
+
# References
|
| 176 |
+
|
| 177 |
+
[1] Eric R. Chan, Connor Z. Lin, Matthew A. Chan, Koki Nagano, Boxiao Pan, Shalini De Mello, Orazio Gallo, Leonidas Guibas, Jonathan Tremblay, Sameh Khamis, Tero Karras, and Gordon Wetzstein. Efficient geometry-aware 3D generative adversarial networks. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022. [2] Yu Deng, Jiaolong Yang, Jianfeng Xiang, and Xin Tong. Gram: Generative radiance manifolds for 3d-aware image generation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 178 |
+
[3] 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.
|
| 179 |
+
[4] Eric R Chan, Marco Monteiro, Petr Kellnhofer, Jiajun Wu, and Gordon Wetzstein. pi-GAN: Periodic implicit generative adversarial networks for 3D-aware image synthesis. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021. [5] 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 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 180 |
+
[6] 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.
|
| 181 |
+
[7] Jingxiang Sun, Xuan Wang, Yong Zhang, Xiaoyu Li, Qi Zhang, Yebin Liu, and Jue Wang. Fenerf: Face editing in neural radiance fields. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 182 |
+
[8] Alec Jacobson, Zhigang Deng, Ladislav Kavan, and JP Lewis. Skinning: Real-time shape deformation. In ACM SIGGRAPH 2014 Courses, 2014.
|
| 183 |
+
[9] Sida Peng, Yuanqing Zhang, Yinghao Xu, Qianqian Wang, Qing Shuai, Hujun Bao, and Xiaowei Zhou. Neural body: Implicit neural representations with structured latent codes for novel view synthesis of dynamic humans. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 184 |
+
[10] Sida Peng, Junting Dong, Qianqian Wang, Shangzhan Zhang, Qing Shuai, Xiaowei Zhou, and Hujun Bao. Animatable neural radiance fields for modeling dynamic human bodies. In IEEE International Conference on Computer Vision (ICCV), 2021.
|
| 185 |
+
[11] Shih-Yang Su, Frank Yu, Michael Zollhöfer, and Helge Rhodin. A-nerf: Articulated neural radiance fields for learning human shape, appearance, and pose. In Advances in Neural Information Processing Systems (NeurIPS), 2021.
|
| 186 |
+
[12] Hongyi Xu, Thiemo Alldieck, and Cristian Sminchisescu. H-nerf: Neural radiance fields for rendering and temporal reconstruction of humans in motion. In Advances in Neural Information Processing Systems (NeurIPS), 2021.
|
| 187 |
+
[13] Atsuhiro Noguchi, Xiao Sun, Stephen Lin, and Tatsuya Harada. Neural articulated radiance field. In IEEE International Conference on Computer Vision (ICCV), 2021.
|
| 188 |
+
[14] Youngjoong Kwon, Dahun Kim, Duygu Ceylan, and Henry Fuchs. Neural human performer: Learning generalizable radiance fields for human performance rendering. In Advances in Neural Information Processing Systems (NeurIPS), 2021.
|
| 189 |
+
[15] Haotong Lin, Sida Peng, Zhen Xu, Hujun Bao, and Xiaowei Zhou. Efficient neural radiance fields with learned depth-guided sampling. arXiv preprint arXiv:2112.01517, 2021.
|
| 190 |
+
[16] Tao Hu, Tao Yu, Zerong Zheng, He Zhang, Yebin Liu, and Matthias Zwicker. Hvtr: Hybrid volumetrictextural rendering for human avatars. arXiv preprint arXiv:2112.10203, 2021.
|
| 191 |
+
[17] Lingjie Liu, Marc Habermann, Viktor Rudnev, Kripasindhu Sarkar, Jiatao Gu, and Christian Theobalt. Neural actor: Neural free-view synthesis of human actors with pose control. ACM Transactions on Graphics (SIGGRAPH ASIA), 2021.
|
| 192 |
+
[18] Tianhan Xu, Yasuhiro Fujita, and Eiichi Matsumoto. Surface-aligned neural radiance fields for controllable 3d human synthesis. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 193 |
+
[19] Fuqiang Zhao, Wei Yang, Jiakai Zhang, Pei Lin, Yingliang Zhang, Jingyi Yu, and Lan Xu. Humannerf: Efficiently generated human radiance field from sparse inputs. arXiv preprint arXiv:2112.02789, 2021.
|
| 194 |
+
[20] Chung-Yi Weng, Brian Curless, Pratul P. Srinivasan, Jonathan T. Barron, and Ira KemelmacherShlizerman. Humannerf: Free-viewpoint rendering of moving people from monocular video. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 195 |
+
[21] Boyi Jiang, Yang Hong, Hujun Bao, and Juyong Zhang. Selfrecon: Self reconstruction your digital avatar from monocular video. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 196 |
+
[22] Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of StyleGAN. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
|
| 197 |
+
[23] Ruilong Li, Shan Yang, David A Ross, and Angjoo Kanazawa. AI choreographer: Music conditioned 3D dance generation with ais $^ { + + }$ . In IEEE International Conference on Computer Vision (ICCV), 2021.
|
| 198 |
+
[24] Volker Blanz and Thomas Vetter. A morphable model for the synthesis of 3D faces. In Proceedings of SIGGRAPH, 1999.
|
| 199 |
+
[25] Tianye Li, Timo Bolkart, Michael. J. Black, Hao Li, and Javier Romero. Learning a model of facial shape and expression from 4D scans. ACM Transactions on Graphics (SIGGRAPH ASIA), 36(6):194:1–194:17, 2017.
|
| 200 |
+
[26] Matthew Loper, Naureen Mahmood, Javier Romero, Gerard Pons-Moll, and Michael J. Black. SMPL: A skinned multi-person linear model. ACM Transactions on Graphics (SIGGRAPH ASIA), 34(6):248:1– 248:16, 2015.
|
| 201 |
+
[27] Javier Romero, Dimitrios Tzionas, and Michael J. Black. Embodied hands: Modeling and capturing hands and bodies together. ACM Transactions on Graphics (SIGGRAPH ASIA), 36(6), November 2017.
|
| 202 |
+
[28] Georgios Pavlakos, Vasileios Choutas, Nima Ghorbani, Timo Bolkart, Ahmed A. A. Osman, Dimitrios Tzionas, and Michael J. Black. Expressive body capture: 3D hands, face, and body from a single image. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
|
| 203 |
+
[29] Silvia Zuffi, Angjoo Kanazawa, David W Jacobs, and Michael J Black. 3D menagerie: Modeling the 3D shape and pose of animals. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
|
| 204 |
+
[30] Angjoo Kanazawa, Michael J Black, David W Jacobs, and Jitendra Malik. End-to-end recovery of human shape and pose. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
|
| 205 |
+
[31] Nikos Kolotouros, Georgios Pavlakos, Michael J Black, and Kostas Daniilidis. Learning to reconstruct 3D human pose and shape via model-fitting in the loop. In IEEE International Conference on Computer Vision (ICCV), 2019.
|
| 206 |
+
[32] Soubhik Sanyal, Timo Bolkart, Haiwen Feng, and Michael J Black. Learning to regress 3D face shape and expression from an image without 3D supervision. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
|
| 207 |
+
[33] Shunsuke Saito, Tomas Simon, Jason Saragih, and Hanbyul Joo. PIFuHD: Multi-level pixel-aligned implicit function for high-resolution 3D human digitization. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
|
| 208 |
+
[34] Muhammed Kocabas, Nikos Athanasiou, and Michael J Black. Vibe: Video inference for human body pose and shape estimation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
|
| 209 |
+
[35] Tao Ju, Scott Schaefer, and Joe Warren. Mean value coordinates for closed triangular meshes. In Proceedings of SIGGRAPH. 2005.
|
| 210 |
+
[36] Pushkar Joshi, Mark Meyer, Tony DeRose, Brian Green, and Tom Sanocki. Harmonic coordinates for character articulation. ACM Transactions on Graphics (SIGGRAPH), 26(3), 2007.
|
| 211 |
+
[37] Wang Yifan, Noam Aigerman, Vladimir G Kim, Siddhartha Chaudhuri, and Olga Sorkine-Hornung. Neural cages for detail-preserving 3D deformations. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
|
| 212 |
+
[38] Minhyuk Sung, Zhenyu Jiang, Panos Achlioptas, Niloy J. Mitra, and Leonidas J. Guibas. DeformSyncNet: Deformation transfer via synchronized shape deformation spaces. ACM Transactions on Graphics (ToG), 39(6), 2020.
|
| 213 |
+
[39] Tomas Jakab, Richard Tucker, Ameesh Makadia, Jiajun Wu, Noah Snavely, and Angjoo Kanazawa. Keypointdeformer: Unsupervised 3D keypoint discovery for shape control. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 214 |
+
[40] Minghua Liu, Minhyuk Sung, Radomir Mech, and Hao Su. Deepmetahandles: Learning deformation meta-handles of 3D meshes with biharmonic coordinates. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 215 |
+
[41] Boyang Deng, JP Lewis, Timothy Jeruzalski, Gerard Pons-Moll, Geoffrey Hinton, Mohammad Norouzi, and Andrea Tagliasacchi. Neural articulated shape approximation. In European Conference on Computer Vision (ECCV), 2020.
|
| 216 |
+
[42] Yiheng Xie, Towaki Takikawa, Shunsuke Saito, Or Litany, Shiqin Yan, Numair Khan, Federico Tombari, James Tompkin, Vincent Sitzmann, and Srinath Sridhar. Neural fields in visual computing and beyond. In Computer Graphics Forum, volume 41, pages 641–676, 2022.
|
| 217 |
+
[43] SM Ali Eslami, Danilo Jimenez Rezende, Frederic Besse, Fabio Viola, Ari S Morcos, Marta Garnelo, Avraham Ruderman, Andrei A Rusu, Ivo Danihelka, Karol Gregor, et al. Neural scene representation and rendering. Science, 2018.
|
| 218 |
+
[44] Jeong Joon Park, Peter Florence, Julian Straub, Richard Newcombe, and Steven Lovegrove. DeepSDF: Learning continuous signed distance functions for shape representation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
|
| 219 |
+
[45] Lars Mescheder, Michael Oechsle, Michael Niemeyer, Sebastian Nowozin, and Andreas Geiger. Occupancy networks: Learning 3D reconstruction in function space. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
|
| 220 |
+
[46] Mateusz Michalkiewicz, Jhony K Pontes, Dominic Jack, Mahsa Baktashmotlagh, and Anders Eriksson. Implicit surface representations as layers in neural networks. In IEEE International Conference on Computer Vision (ICCV), 2019.
|
| 221 |
+
[47] Zhiqin Chen and Hao Zhang. Learning implicit fields for generative shape modeling. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
|
| 222 |
+
[48] Matan Atzmon and Yaron Lipman. SAL: Sign agnostic learning of shapes from raw data. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
|
| 223 |
+
[49] Amos Gropp, Lior Yariv, Niv Haim, Matan Atzmon, and Yaron Lipman. Implicit geometric regularization for learning shapes. In International Conference on Machine Learning (ICML), 2020.
|
| 224 |
+
[50] Chiyu Jiang, Avneesh Sud, Ameesh Makadia, Jingwei Huang, Matthias Nießner, and Thomas Funkhouser. Local implicit grid representations for 3D scenes. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
|
| 225 |
+
[51] Thomas Davies, Derek Nowrouzezahrai, and Alec Jacobson. Overfit neural networks as a compact shape representation. arXiv preprint arXiv:2009.09808, 2020.
|
| 226 |
+
[52] Rohan Chabra, Jan Eric Lenssen, Eddy Ilg, Tanner Schmidt, Julian Straub, Steven Lovegrove, and Richard Newcombe. Deep local shapes: Learning local SDF priors for detailed 3D reconstruction. In European Conference on Computer Vision (ECCV), 2020.
|
| 227 |
+
[53] Songyou Peng, Michael Niemeyer, Lars Mescheder, Marc Pollefeys, and Andreas Geiger. Convolutional occupancy networks. In European Conference on Computer Vision (ECCV), 2020.
|
| 228 |
+
[54] Towaki Takikawa, Joey Litalien, Kangxue Yin, Karsten Kreis, Charles Loop, Derek Nowrouzezahrai, Alec Jacobson, Morgan McGuire, and Sanja Fidler. Neural geometric level of detail: Real-time rendering with implicit 3D shapes. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 229 |
+
[55] Vincent Sitzmann, Julien N.P. Martel, Alexander W. Bergman, David B. Lindell, and Gordon Wetzstein. Implicit neural representations with periodic activation functions. In Advances in Neural Information Processing Systems (NeurIPS), 2020.
|
| 230 |
+
[56] Julien N.P. Martel, David B. Lindell, Connor Z. Lin, Eric R. Chan, Marco Monteiro, and Gordon Wetzstein. ACORN: Adaptive coordinate networks for neural representation. ACM Transactions on Graphics (SIGGRAPH), 2021.
|
| 231 |
+
[57] Vincent Sitzmann, Michael Zollhöfer, and Gordon Wetzstein. Scene representation networks: Continuous 3D-structure-aware neural scene representations. In Advances in Neural Information Processing Systems (NeurIPS), 2019.
|
| 232 |
+
[58] Vincent Sitzmann, Justus Thies, Felix Heide, Matthias Nießner, Gordon Wetzstein, and Michael Zollhöfer. DeepVoxels: Learning persistent 3D feature embeddings. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
|
| 233 |
+
[59] Shunsuke Saito, Zeng Huang, Ryota Natsume, Shigeo Morishima, Angjoo Kanazawa, and Hao Li. PIFu: Pixel-aligned implicit function for high-resolution clothed human digitization. In IEEE International Conference on Computer Vision (ICCV), 2019.
|
| 234 |
+
[60] Shichen Liu, Shunsuke Saito, Weikai Chen, and Hao Li. Learning to infer implicit surfaces without 3D supervision. arXiv preprint arXiv:1911.00767, 2019.
|
| 235 |
+
[61] Stephen Lombardi, Tomas Simon, Jason Saragih, Gabriel Schwartz, Andreas Lehrmann, and Yaser Sheikh. Neural volumes: Learning dynamic renderable volumes from images. ACM Transactions on Graphics (SIGGRAPH), 2019.
|
| 236 |
+
[62] 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 European Conference on Computer Vision (ECCV), 2020.
|
| 237 |
+
[63] Ricardo Martin-Brualla, Noha Radwan, Mehdi S. M. Sajjadi, Jonathan T. Barron, Alexey Dosovitskiy, and Daniel Duckworth. NeRF in the wild: Neural radiance fields for unconstrained photo collections. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 238 |
+
[64] Michael Niemeyer, Lars Mescheder, Michael Oechsle, and Andreas Geiger. Differentiable volumetric rendering: Learning implicit 3d representations without 3d supervision. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
|
| 239 |
+
[65] Pratul P. Srinivasan, Boyang Deng, Xiuming Zhang, Matthew Tancik, Ben Mildenhall, and Jonathan T. Barron. NeRV: Neural reflectance and visibility fields for relighting and view synthesis. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 240 |
+
[66] Kai Zhang, Gernot Riegler, Noah Snavely, and Vladlen Koltun. Nerf $^ { + + }$ : Analyzing and improving neural radiance fields. arXiv preprint arXiv:2010.07492, 2020.
|
| 241 |
+
[67] Thomas Neff, Pascal Stadlbauer, Mathias Parger, Andreas Kurz, Joerg H. Mueller, Chakravarty R. Alla Chaitanya, Anton S. Kaplanyan, and Markus Steinberger. DONeRF: Towards Real-Time Rendering of Compact Neural Radiance Fields using Depth Oracle Networks. Computer Graphics Forum, 40(4), 2021.
|
| 242 |
+
[68] Shaohui Liu, Yinda Zhang, Songyou Peng, Boxin Shi, Marc Pollefeys, and Zhaopeng Cui. DIST: Rendering deep implicit signed distance function with differentiable sphere tracing. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
|
| 243 |
+
[69] Matthew Tancik, Pratul P. Srinivasan, Ben Mildenhall, Sara Fridovich-Keil, Nithin Raghavan, Utkarsh Singhal, Ravi Ramamoorthi, Jonathan T. Barron, and Ren Ng. Fourier features let networks learn high frequency functions in low dimensional domains. In Advances in Neural Information Processing Systems (NeurIPS), 2020.
|
| 244 |
+
[70] Lior Yariv, Yoni Kasten, Dror Moran, Meirav Galun, Matan Atzmon, Ronen Basri, and Yaron Lipman. Multiview neural surface reconstruction by disentangling geometry and appearance. In Advances in Neural Information Processing Systems (NeurIPS), 2020.
|
| 245 |
+
[71] David B Lindell, Julien NP Martel, and Gordon Wetzstein. AutoInt: Automatic integration for fast neural volume rendering. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 246 |
+
[72] Lingjie Liu, Jiatao Gu, Kyaw Zaw Lin, Tat-Seng Chua, and Christian Theobalt. Neural sparse voxel fields. In Advances in Neural Information Processing Systems (NeurIPS), 2020.
|
| 247 |
+
[73] Yue Jiang, Dantong Ji, Zhizhong Han, and Matthias Zwicker. SDFDiff: Differentiable rendering of signed distance fields for 3D shape optimization. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
|
| 248 |
+
[74] Terrance DeVries, Miguel Angel Bautista, Nitish Srivastava, Graham W. Taylor, and Joshua M. Susskind. Unconstrained scene generation with locally conditioned radiance fields. arXiv preprint arXiv:2104.00670, 2021.
|
| 249 |
+
[75] Petr Kellnhofer, Lars Jebe, Andrew Jones, Ryan Spicer, Kari Pulli, and Gordon Wetzstein. Neural lumigraph rendering. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 250 |
+
[76] Christian Reiser, Songyou Peng, Yiyi Liao, and Andreas Geiger. KiloNeRF: Speeding up neural radiance fields with thousands of tiny MLPs. In IEEE International Conference on Computer Vision (ICCV), 2021.
|
| 251 |
+
[77] Michael Oechsle, Songyou Peng, and Andreas Geiger. UNISURF: Unifying neural implicit surfaces and radiance fields for multi-view reconstruction. In IEEE International Conference on Computer Vision (ICCV), 2021.
|
| 252 |
+
[78] Alex Yu, Ruilong Li, Matthew Tancik, Hao Li, Ren Ng, and Angjoo Kanazawa. PlenOctrees for real-time rendering of neural radiance fields. In IEEE International Conference on Computer Vision (ICCV), 2021.
|
| 253 |
+
[79] Peter Hedman, Pratul P. Srinivasan, Ben Mildenhall, Jonathan T. Barron, and Paul Debevec. Baking neural radiance fields for real-time view synthesis. In IEEE International Conference on Computer Vision (ICCV), 2021.
|
| 254 |
+
[80] Stephan J Garbin, Marek Kowalski, Matthew Johnson, Jamie Shotton, and Julien Valentin. FastNeRF: High-fidelity neural rendering at 200fps. arXiv preprint arXiv:2103.10380, 2021.
|
| 255 |
+
[81] Matthew Tancik, Vincent Casser, Xinchen Yan, Sabeek Pradhan, Ben Mildenhall, Pratul P. Srinivasan, Jonathan T. Barron, and Henrik Kretzschmar. Block-nerf: Scalable large scene neural view synthesis. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 256 |
+
[82] Thomas Müller, Alex Evans, Christoph Schied, and Alexander Keller. Instant neural graphics primitives with a multiresolution hash encoding. ACM Transactions on Graphics (SIGGRAPH), 41(4):102:1–102:15, 2022.
|
| 257 |
+
[83] Ayush Tewari, Ohad Fried, Justus Thies, Vincent Sitzmann, Stephen Lombardi, Kalyan Sunkavalli, Ricardo Martin-Brualla, Tomas Simon, Jason Saragih, Matthias Nießner, et al. State of the art on neural rendering. Eurographics Association, 2020.
|
| 258 |
+
[84] Albert Pumarola, Enric Corona, Gerard Pons-Moll, and Francesc Moreno-Noguer. D-NeRF: Neural radiance fields for dynamic scenes. arXiv preprint arXiv:2011.13961, 2020.
|
| 259 |
+
[85] Zhengqi Li, Simon Niklaus, Noah Snavely, and Oliver Wang. Neural scene flow fields for space-time view synthesis of dynamic scenes. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 260 |
+
[86] Wenqi Xian, Jia-Bin Huang, Johannes Kopf, and Changil Kim. Space-time neural irradiance fields for free-viewpoint video. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 261 |
+
[87] Keunhong Park, Utkarsh Sinha, Jonathan T. Barron, Sofien Bouaziz, Dan B Goldman, Steven M. Seitz, and Ricardo Martin-Brualla. Nerfies: Deformable neural radiance fields. IEEE International Conference on Computer Vision (ICCV), 2021.
|
| 262 |
+
[88] Keunhong Park, Utkarsh Sinha, Peter Hedman, Jonathan T. Barron, Sofien Bouaziz, Dan B Goldman, Ricardo Martin-Brualla, and Steven M. Seitz. Hypernerf: A higher-dimensional representation for topologically varying neural radiance fields. ACM Transactions on Graphics (SIGGRAPH ASIA), 40(6), 2021.
|
| 263 |
+
[89] Edgar Tretschk, Ayush Tewari, Vladislav Golyanik, Michael Zollhöfer, Christoph Lassner, and Christian Theobalt. Non-rigid neural radiance fields: Reconstruction and novel view synthesis of a dynamic scene from monocular video. In IEEE International Conference on Computer Vision (ICCV), 2021.
|
| 264 |
+
[90] Chen Gao, Ayush Saraf, Johannes Kopf, and Jia-Bin Huang. Dynamic view synthesis from dynamic monocular video. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 265 |
+
[91] Stephen Lombardi, Tomas Simon, Gabriel Schwartz, Michael Zollhoefer, Yaser Sheikh, and Jason Saragih. Mixture of volumetric primitives for efficient neural rendering. ACM Transactions on Graphics (ToG), 40 (4), 2021.
|
| 266 |
+
[92] Guy Gafni, Justus Thies, Michael Zollhöfer, and Matthias Nießner. Dynamic neural radiance fields for monocular 4d facial avatar reconstruction. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 267 |
+
[93] Ziyan Wang, Timur Bagautdinov, Stephen Lombardi, Tomas Simon, Jason Saragih, Jessica Hodgins, and Michael Zollhofer. Learning compositional radiance fields of dynamic human heads. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 268 |
+
[94] Yudong Guo, Keyu Chen, Sen Liang, Yongjin Liu, Hujun Bao, and Juyong Zhang. Ad-nerf: Audio driven neural radiance fields for talking head synthesis. In IEEE International Conference on Computer Vision (ICCV), 2021.
|
| 269 |
+
[95] Yufeng Zheng, Victoria Fernández Abrevaya, Marcel C. Bühler, Xu Chen, Michael J. Black, and Otmar Hilliges. I M Avatar: Implicit morphable head avatars from videos. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 270 |
+
[96] Kacper Kania, Kwang Moo Yi, Marek Kowalski, Tomasz Trzcinski, and Andrea Tagliasacchi. CoNeRF: ´ Controllable Neural Radiance Fields. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 271 |
+
[97] Yiyu Zhuang, Hao Zhu, Xusen Sun, and Xun Cao. Mofanerf: Morphable facial neural radiance field. arXiv preprint arXiv:2112.02308, 2021.
|
| 272 |
+
[98] Wei Jiang, Kwang Moo Yi, Golnoosh Samei, Oncel Tuzel, and Anurag Ranjan. Neuman: Neural human radiance field from a single video. In European Conference on Computer Vision (ECCV), 2022.
|
| 273 |
+
[99] Markus Knoche, István Sárándi, and Bastian Leibe. Reposing humans by warping 3D features. In CVPR Workshop on Towards Human-Centric Image/Video Synthesis, 2020.
|
| 274 |
+
[100] Gengshan Yang, Minh Vo, Neverova Natalia, Deva Ramanan, Vedaldi Andrea, and Joo Hanbyul. Banmo: Building animatable 3D neural models from many casual videos. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 275 |
+
[101] Ayush Tewari, Justus Thies, Ben Mildenhall, Pratul Srinivasan, Edgar Tretschk, Yifan Wang, Christoph Lassner, Vincent Sitzmann, Ricardo Martin-Brualla, Stephen Lombardi, Tomas Simon, Christian Theobalt, Matthias Niessner, Jonathan T. Barron, Gordon Wetzstein, Michael Zollhoefer, and Vladislav Golyanik. Advances in neural rendering. In Computer Graphics Forum, volume 41, pages 703–735, 2022.
|
| 276 |
+
[102] Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In International Conference on Learning Representations (ICLR), 2016.
|
| 277 |
+
[103] Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of GANs for improved quality, stability, and variation. In International Conference on Learning Representations (ICLR), 2018.
|
| 278 |
+
[104] Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
|
| 279 |
+
[105] Attila Szabó, Givi Meishvili, and Paolo Favaro. Unsupervised generative 3D shape learning from natural images. arXiv preprint arXiv:1910.00287, 2019.
|
| 280 |
+
[106] Yiyi Liao, Katja Schwarz, Lars Mescheder, and Andreas Geiger. Towards unsupervised learning of generative models for 3D controllable image synthesis. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
|
| 281 |
+
[107] Matheus Gadelha, Subhransu Maji, and Rui Wang. 3D shape induction from 2D views of multiple objects. In International Conference on 3D Vision, 2017.
|
| 282 |
+
[108] Jun-Yan Zhu, Zhoutong Zhang, Chengkai Zhang, Jiajun Wu, Antonio Torralba, Joshua B. Tenenbaum, and William T. Freeman. Visual object networks: Image generation with disentangled 3D representations. In Advances in Neural Information Processing Systems (NeurIPS), 2018.
|
| 283 |
+
[109] Philipp Henzler, Niloy J Mitra, and Tobias Ritschel. Escaping Plato’s cave: 3D shape from adversarial rendering. In IEEE International Conference on Computer Vision (ICCV), 2019.
|
| 284 |
+
[110] Thu Nguyen-Phuoc, Chuan Li, Lucas Theis, Christian Richardt, and Yong-Liang Yang. HoloGAN: Unsupervised learning of 3D representations from natural images. In IEEE International Conference on Computer Vision (ICCV), 2019.
|
| 285 |
+
[111] Thu Nguyen-Phuoc, Christian Richardt, Long Mai, Yong-Liang Yang, and Niloy Mitra. BlockGAN: Learning 3D object-aware scene representations from unlabelled images. In Advances in Neural Information Processing Systems (NeurIPS), 2020.
|
| 286 |
+
[112] Yinghao Xu, Sida Peng, Ceyuan Yang, Yujun Shen, and Bolei Zhou. 3D-aware image synthesis via learning structural and textural representations. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 287 |
+
[113] Zekun Hao, Arun Mallya, Serge Belongie, and Ming-Yu Liu. GANcraft: Unsupervised 3D neural rendering of minecraft worlds. In IEEE International Conference on Computer Vision (ICCV), 2021.
|
| 288 |
+
[114] Michael Niemeyer and Andreas Geiger. GIRAFFE: Representing scenes as compositional generative neural feature fields. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 289 |
+
[115] Jiatao Gu, Lingjie Liu, Peng Wang, and Christian Theobalt. StyleNeRF: A style-based 3D-aware generator for high-resolution image synthesis. arXiv preprint arXiv:2110.08985, 2021.
|
| 290 |
+
[116] Yang Hong, Bo Peng, Haiyao Xiao, Ligang Liu, and Juyong Zhang. Headnerf: A real-time nerf-based parametric head model. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 291 |
+
[117] Artur Grigorev, Karim Iskakov, Anastasia Ianina, Renat Bashirov, Ilya Zakharkin, Alexander Vakhitov, and Victor Lempitsky. Stylepeople: A generative model of fullbody human avatars, 2021.
|
| 292 |
+
[118] Atsuhiro Noguchi, Xiao Sun, Stephen Lin, and Tatsuya Harada. Unsupervised learning of efficient geometry-aware neural articulated representations. arXiv preprint arXiv:2204.08839, 2022.
|
| 293 |
+
[119] N. Max. Optical models for direct volume rendering. IEEE Transactions on Visualization and Computer Graphics (TVCG), 1995.
|
| 294 |
+
[120] Gül Varol, Javier Romero, Xavier Martin, Naureen Mahmood, Michael J. Black, Ivan Laptev, and Cordelia Schmid. Learning from synthetic humans. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
|
| 295 |
+
[121] Michael Garland and Paul S Heckbert. Surface simplification using quadric error metrics. In Proceedings of SIGGRAPH, 1997.
|
| 296 |
+
[122] Qian-Yi Zhou, Jaesik Park, and Vladlen Koltun. Open3D: A modern library for 3D data processing. arXiv:1801.09847, 2018.
|
| 297 |
+
[123] Ke Sun, Bin Xiao, Dong Liu, and Jingdong Wang. Deep high-resolution representation learning for human pose estimation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
|
| 298 |
+
[124] Mykhaylo Andriluka, Leonid Pishchulin, Peter Gehler, and Bernt Schiele. 2d human pose estimation: New benchmark and state of the art analysis. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2014.
|
| 299 |
+
[125] MMPose Contributors. Openmmlab pose estimation toolbox and benchmark. https://github.com/ open-mmlab/mmpose, 2020.
|
| 300 |
+
[126] Valentin Bazarevsky, Ivan Grishchenko, Karthik Raveendran, Tyler Zhu, Fan Zhang, and Matthias Grundmann. Blazepose: On-device real-time body pose tracking. arXiv preprint arXiv:2006.10204, 2020.
|
| 301 |
+
[127] Yaxing Wang, Chenshen Wu, Luis Herranz, Joost van de Weijer, Abel Gonzalez-Garcia, and Bogdan Raducanu. Transferring gans: generating images from limited data. In European Conference on Computer Vision (ECCV), 2018.
|
| 302 |
+
[128] Yao Feng, Haiwen Feng, Michael J Black, and Timo Bolkart. Learning an animatable detailed 3D face model from in-the-wild images. ACM Transactions on Graphics (SIGGRAPH), 40(4):1–13, 2021.
|
| 303 |
+
[129] Yurui Ren, Ge Li, Yuanqi Chen, Thomas H Li, and Shan Liu. Pirenderer: Controllable portrait image generation via semantic neural rendering. In IEEE International Conference on Computer Vision (ICCV), 2021.
|
| 304 |
+
[130] Connor Z. Lin, David B. Lindell, Eric R. Chan, and Gordon Wetzstein. 3D GAN inversion for controllable portrait image animation. arXiv preprint arXiv:2203.13441, 2022.
|
| 305 |
+
[131] Jiankang Deng, Jia Guo, Niannan Xue, and Stefanos Zafeiriou. ArcFace: Additive angular margin loss for deep face recognition. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
|
| 306 |
+
[132] Anna Frühstück, Krishna Kumar Singh, Eli Shechtman, Niloy J Mitra, Peter Wonka, and Jingwan Lu. Insetgan for full-body image generation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 307 |
+
[133] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft COCO: Common objects in context. In European Conference on Computer Vision (ECCV), 2014.
|
| 308 |
+
|
| 309 |
+
# Checklist
|
| 310 |
+
|
| 311 |
+
1. For all authors...
|
| 312 |
+
|
| 313 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 314 |
+
(b) Did you describe the limitations of your work? [Yes] See Section 5.
|
| 315 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 5.
|
| 316 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 317 |
+
|
| 318 |
+
2. If you are including theoretical results...
|
| 319 |
+
|
| 320 |
+
(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]
|
| 321 |
+
|
| 322 |
+
3. If you ran experiments...
|
| 323 |
+
|
| 324 |
+
(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] We plan to release the code completely, but have not yet with submission. Details on the architecture, training, and data are available in the supplemental material.
|
| 325 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See supplemental document and sections 4.2 and 4.3.
|
| 326 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] GNARF models require a significant amount of computational resources (see supplemental document), and thus averaging training over many seeds would be computationally infeasible. However, we evaluate our trained models with a large number of generated images, demonstrating the robustness of our method.
|
| 327 |
+
(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 supplemental document.
|
| 328 |
+
|
| 329 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 330 |
+
|
| 331 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 332 |
+
(b) Did you mention the license of the assets? [Yes] See Section 4.
|
| 333 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 334 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 335 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 336 |
+
|
| 337 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 338 |
+
|
| 339 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 340 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 341 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/aBsCjcPu_tE/aBsCjcPu_tE.md
ADDED
|
@@ -0,0 +1,645 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SDEDIT: GUIDED IMAGE SYNTHESIS AND EDITING WITH STOCHASTIC DIFFERENTIAL EQUATIONS
|
| 2 |
+
|
| 3 |
+
Chenlin Meng1 Yutong $\mathbf { H e } ^ { 1 }$ Yang Song1 Jiajun Wu1 Jun-Yan Zhu2 Stefano Ermon1 1Stanford University 2Carnegie Mellon University
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Guided image synthesis enables everyday users to create and edit photo-realistic images with minimum effort. The key challenge is balancing faithfulness to the user inputs (e.g., hand-drawn colored strokes) and realism of the synthesized images. Existing GAN-based methods attempt to achieve such balance using either conditional GANs or GAN inversions, which are challenging and often require additional training data or loss functions for individual applications. To address these issues, we introduce a new image synthesis and editing method, Stochastic Differential Editing (SDEdit), based on a diffusion model generative prior, which synthesizes realistic images by iteratively denoising through a stochastic differential equation (SDE). Given an input image with user guide in a form of manipulating RGB pixels, SDEdit first adds noise to the input, then subsequently denoises the resulting image through the SDE prior to increase its realism. SDEdit does not require task-specific training or inversions and can naturally achieve the balance between realism and faithfulness. SDEdit outperforms state-of-the-art GAN-based methods by up to $9 8 . 0 9 \%$ on realism and $9 1 . 7 2 \%$ on overall satisfaction scores, according to a human perception study, on multiple tasks, including stroke-based image synthesis and editing as well as image compositing.
|
| 8 |
+
|
| 9 |
+

|
| 10 |
+
Figure 1: Stochastic Differential Editing (SDEdit) is a unified image synthesis and editing framework based on stochastic differential equations. SDEdit allows stroke painting to image, image compositing, and stroke-based editing without task-specific model training and loss functions.
|
| 11 |
+
|
| 12 |
+
# 1 INTRODUCTION
|
| 13 |
+
|
| 14 |
+
Modern generative models can create photo-realistic images from random noise (Karras et al., 2019; Song et al., 2021), serving as an important tool for visual content creation. Of particular interest is guided image synthesis and editing, where a user specifies a general guide (such as coarse colored strokes) and the generative model learns to fill in the details (see Fig. 1). There are two natural desiderata for guided image synthesis: the synthesized image should appear realistic as well as be faithful to the user-guided input, thus enabling people with or without artistic expertise to produce photo-realistic images from different levels of details.
|
| 15 |
+
|
| 16 |
+
Existing methods often attempt to achieve such balance via two approaches. The first category leverages conditional GANs (Isola et al., 2017; Zhu et al., 2017), which learn a direct mapping from original images to edited ones. Unfortunately, for each new editing task, these methods require data collection and model re-training, both of which could be expensive and time-consuming. The second category leverages GAN inversions (Zhu et al., 2016; Brock et al., 2017; Abdal et al., 2019; Gu et al., 2020; Wu et al., 2021; Abdal et al., 2020), where a pre-trained GAN is used to invert an input image to a latent representation, which is subsequently modified to generate the edited image. This procedure involves manually designing loss functions and optimization procedures for different image editing tasks. Besides, it may sometimes fail to find a latent code that faithfully represents the input (Bau et al., 2019b).
|
| 17 |
+
|
| 18 |
+
To balance realism and faithfulness while avoiding the previously mentioned challenges, we introduce SDEdit, a guided image synthesis and editing framework leveraging generative stochastic differential equations (SDEs; Song et al., 2021). Similar to the closely related diffusion models (SohlDickstein et al., 2015; Ho et al., 2020), SDE-based generative models smoothly convert an initial Gaussian noise vector to a realistic image sample through iterative denoising, and have achieved unconditional image synthesis performance comparable to or better than that of GANs (Dhariwal & Nichol, 2021). The key intuition of SDEdit is to “hijack” the generative process of SDE-based generative models, as illustrated in Fig. 2. Given an input image with user guidance input, such as a stroke painting or an image with stroke edits, we can add a suitable amount of noise to smooth out undesirable artifacts and distortions (e.g., unnatural details at stroke pixels), while still preserving the overall structure of the input user guide. We then initialize the SDE with this noisy input, and progressively remove the noise to obtain a denoised result that is both realistic and faithful to the user guidance input (see Fig. 2).
|
| 19 |
+
|
| 20 |
+
Unlike conditional GANs, SDEdit does not require collecting training images or user annotations for each new task; unlike GAN inversions, SDEdit does not require the design of additional training or task-specific loss functions. SDEdit only uses a single pretrained SDE-based generative model trained on unlabeled data: given a user guide in a form of manipulating RGB pixels, SDEdit adds Gaussian noise to the guide and then run the reverse SDE to synthesize images. SDEdit naturally finds a trade-off between realism and faithfulness: when we add more Gaussian noise and run the SDE for longer, the synthesized images are more realistic but less faithful. We can use this observation to find the right balance between realism and faithfulness.
|
| 21 |
+
|
| 22 |
+
We demonstrate SDEdit on three applications: stroke-based image synthesis, stroke-based image editing, and image compositing. We show that SDEdit can produce realistic and faithful images from guides with various levels of fidelity. On stroke-based image synthesis experiments, SDEdit outperforms state-of-the-art GAN-based approaches by up to $9 8 . 0 9 \%$ on realism score and $9 1 . 7 2 \%$ on overall satisfaction score (measuring both realism and faithfulness) according to human judgements. On image compositing experiments, SDEdit achieves a better faithfulness score and outperforms the baselines by up to $8 3 . { \bar { 7 } } 3 \%$ on overall satisfaction score in user studies. Our code and models will be available upon publication.
|
| 23 |
+
|
| 24 |
+
# 2 BACKGROUND: IMAGE SYNTHESIS WITH STOCHASTIC DIFFERENTIAL EQUATIONS (SDES)
|
| 25 |
+
|
| 26 |
+
Stochastic differential equations (SDEs) generalize ordinary differential equations (ODEs) by injecting random noise into the dynamics. The solution of an SDE is a time-varying random variable (i.e., stochastic process), which we denote as $\mathbf { x } ( t ) \in \mathbb { R } ^ { d }$ , where $t \in [ 0 , 1 ]$ indexes time. In image synthesis (Song et al., 2021), we suppose that $\mathbf { x } ( 0 ) \sim p _ { 0 } = p _ { \mathrm { d a t a } }$ represents a sample from the data distribution and that a forward SDE produces ${ \bf x } ( t )$ for $t \in ( 0 , 1 ]$ via a Gaussian diffusion. Given ${ \mathbf x } ( 0 ) , { \mathbf x } ( t )$ is distributed as a Gaussian distribution:
|
| 27 |
+
|
| 28 |
+
$$
|
| 29 |
+
{ \bf x } ( t ) = \alpha ( t ) { \bf x } ( 0 ) + \sigma ( t ) { \bf z } , \quad { \bf z } \sim \mathcal { N } ( { \bf 0 } , I ) ,
|
| 30 |
+
$$
|
| 31 |
+
|
| 32 |
+

|
| 33 |
+
Figure 2: Synthesizing images from strokes with SDEdit. The blue dots illustrate the editing process of our method. The green and blue contour plots represent the distributions of images and stroke paintings, respectively. Given a stroke painting, we first perturb it with Gaussian noise and progressively remove the noise by simulating the reverse SDE. This process gradually projects an unrealistic stroke painting to the manifold of natural images.
|
| 34 |
+
|
| 35 |
+
where $\sigma ( t ) : [ 0 , 1 ] \to [ 0 , \infty )$ is a scalar function that describes the magnitude of the noise $\mathbf { z }$ , and $\alpha ( t ) : [ 0 , 1 ] [ 0 , 1 ]$ is a scalar function that denotes the magnitude of the data ${ \bf x } ( 0 )$ . The probability density function of ${ \bf x } ( t )$ is denoted as $p _ { t }$ .
|
| 36 |
+
|
| 37 |
+
Two types of SDE are usually considered: the Variance Exploding SDE (VE-SDE) has $\alpha ( t ) = 1$ for all $t$ and $\sigma ( 1 )$ being a large constant so that $p _ { 1 }$ is close to $\mathcal { N } ( \bar { \mathbf { 0 } } , \sigma ^ { 2 } ( \mathbf { 1 } ) \mathbf { I } )$ ; whereas the Variance Preserving (VP) SDE satisfies $\alpha ^ { 2 } ( t ) + \sigma ^ { 2 } ( t ) = \bar { 1 }$ for all $t$ with $\alpha ( t ) 0$ as $t \to 1$ so that $p _ { 1 }$ equals to $\mathcal { N } ( \mathbf { 0 } , \bar { \mathbf { I } } )$ . Both VE and VP SDE transform the data distribution to random Gaussian noise as $t$ goes from 0 to 1. For brevity, we discuss the details based on VE-SDE for the remainder of the main text, and discuss the VP-SDE procedure in Appendix C. Though possessing slightly different forms and performing differently depending on the image domain, they share the same mathematical intuition.
|
| 38 |
+
|
| 39 |
+
Image synthesis with VE-SDE. Under these definitions, we can pose the image synthesis problem as gradually removing noise from a noisy observation ${ \bf x } ( t )$ to recover ${ \bf x } ( 0 )$ . This can be performed via a reverse SDE (Anderson, 1982; Song et al., 2021) that travels from $t = 1$ to $t = 0$ , based on the knowledge about the noise-perturbed score function $\nabla _ { \mathbf { x } } \log p _ { t } ( \mathbf { x } )$ . For example, the sampling procedure for VE-SDE is defined by the following (reverse) SDE:
|
| 40 |
+
|
| 41 |
+
$$
|
| 42 |
+
\mathrm { d } \mathbf { x } ( t ) = \left[ - \frac { \mathrm { d } [ \sigma ^ { 2 } ( t ) ] } { \mathrm { d } t } \nabla _ { \mathbf { x } } \log p _ { t } ( \mathbf { x } ) \right] \mathrm { d } t + \sqrt { \frac { \mathrm { d } [ \sigma ^ { 2 } ( t ) ] } { \mathrm { d } t } } \mathrm { d } \bar { \mathbf { w } } ,
|
| 43 |
+
$$
|
| 44 |
+
|
| 45 |
+
where $\bar { \bf w }$ is a Wiener process when time flows backwards from $t = 1$ to $t = 0$ . If we set the initial conditions $\mathbf { x } ( 1 ) \sim p _ { 1 } = \mathcal { N } ( \mathbf { 0 } , \sigma ^ { 2 } ( \mathbf { 1 } ) \mathbf { I } )$ , then the solution to ${ \bf x } ( 0 )$ will be distributed as $p _ { \mathrm { d a t a } }$ . In practice, the noise-perturbed score function can be learned through denoising score matching (Vincent, 2011). Denote the learned score model as $s _ { \theta } ( \mathbf { x } ( t ) , t )$ , the learning objective for time $t$ is:
|
| 46 |
+
|
| 47 |
+
$$
|
| 48 |
+
L _ { t } = \mathbb { E } _ { \mathbf { x } ( 0 ) \sim p _ { \mathrm { d a t a } } , \mathbf { z } \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } ) } [ \| \sigma _ { t } s _ { \theta } ( \mathbf { x } ( t ) , t ) - \mathbf { z } \| _ { 2 } ^ { 2 } ] ,
|
| 49 |
+
$$
|
| 50 |
+
|
| 51 |
+
where $p _ { \mathrm { d a t a } }$ is the data distribution and ${ \bf x } ( t )$ is defined as in Equation 1. The overall training objective is a weighted sum over $t$ of each individual learning objective $L _ { t }$ , and various weighting procedures have been discussed in Ho et al. (2020); Song et al. (2020; 2021).
|
| 52 |
+
|
| 53 |
+
With a parametrized score model $s _ { \theta } ( \mathbf { x } ( t ) , t )$ to approximate $\nabla _ { \mathbf { x } } \log p _ { t } ( \mathbf { x } )$ , the SDE solution can be approximated with the Euler-Maruyama method; an update rule from $( t + \Delta t )$ to $t$ is
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
\mathbf { x } ( t ) = \mathbf { x } ( t + \Delta t ) + ( \sigma ^ { 2 } ( t ) - \sigma ^ { 2 } ( t + \Delta t ) ) s _ { \theta } ( \mathbf { x } ( t ) , t ) + \sqrt { \sigma ^ { 2 } ( t ) - \sigma ^ { 2 } ( t + \Delta t ) } \mathbf { z } .
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
where $\mathbf { z } \ \sim \ \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ . We can select a particular discretization of the time interval from 1 to $0$ , initialize $\mathbf { x } ( 0 ) \sim \mathcal { N } ( \mathbf { 0 } , \sigma ^ { 2 } ( \mathbf { 1 } ) \mathbf { I } )$ and iterate via Equation 4 to produce an image ${ \bf x } ( 0 )$ .
|
| 60 |
+
|
| 61 |
+
# 3 GUIDED IMAGE SYNTHESIS AND EDITING WITH SDEDIT
|
| 62 |
+
|
| 63 |
+
In this section, we introduce SDEdit and describe how we can perform guided image synthesis and editing through an SDE model pretrained on unlabeled images.
|
| 64 |
+
|
| 65 |
+

|
| 66 |
+
(b) We illustrate synthesized images of SDEdit with various $t _ { 0 }$ initializations. $t _ { 0 } = 0$ indicates the guide itself, whereas $t _ { 0 } = 1$ indicates a random sample.
|
| 67 |
+
|
| 68 |
+
(a) KID and $L _ { 2 }$ norm squared plot with respect to $t _ { 0 }$ .
|
| 69 |
+
|
| 70 |
+

|
| 71 |
+
Figure 3: Trade-off between faithfulness and realism for stroke-based generation on LSUN. As $t _ { 0 }$ increases, the generated images become more realistic while less faithful. Given an input, SDEdit aims at generating an image that is both faithful and realistic, which means that we should choose $t _ { 0 }$ appropriately $( t _ { 0 } \in [ 0 . 3 , 0 . 6 ]$ in this example).
|
| 72 |
+
|
| 73 |
+
Setup. The user provides a full resolution image $\mathbf { x } ^ { ( g ) }$ in a form of manipulating RGB pixels, which we call a “guide”. The guide may contain different levels of details; a high-level guide contains only coarse colored strokes, a mid-level guide contains colored strokes on a real image, and a low-level guide contains image patches on a target image. We illustrate these guides in Fig. 1, which can be easily provided by non-experts. Our goal is to produce full resolution images with two desiderata:
|
| 74 |
+
|
| 75 |
+
Realism. The image should appear realistic (e.g., measured by humans or neural networks).
|
| 76 |
+
|
| 77 |
+
Faithfulness. The image should be similar to the guide $\mathbf { x } ^ { ( g ) }$ (e.g., measured by $L _ { 2 }$ distance).
|
| 78 |
+
|
| 79 |
+
We note that realism and faithfulness are not positively correlated, since there can be realistic images that are not faithful (e.g., a random realistic image) and faithful images that are not realistic (e.g., the guide itself). Unlike regular inverse problems, we do not assume knowledge about the measurement function (i.e., the mapping from real images to user-created guides in RBG pixels is unknown), so techniques for solving inverse problems with score-based models (Dhariwal & Nichol, 2021; Kawar et al., 2021) and methods requiring paired datasets (Isola et al., 2017; Zhu et al., 2017) do not apply here.
|
| 80 |
+
|
| 81 |
+
Procedure. Our method, SDEdit, uses the fact that the reverse SDE can be solved not only from $t _ { 0 } = 1$ , but also from any intermediate time $t _ { 0 } ~ \in ~ ( 0 , 1 )$ – an approach not studied by previous SDE-based generative models. We need to find a proper initialization from our guides from which we can solve the reverse SDE to obtain desirable, realistic, and faithful images. For any given guide $\mathbf { x } ^ { ( g ) }$ , we define the SDEdit procedure as follows:
|
| 82 |
+
|
| 83 |
+
Sample $\mathbf { x } ^ { ( g ) } ( t _ { 0 } ) \sim \mathcal { N } ( \mathbf { x } ^ { ( g ) } ; \sigma ^ { 2 } ( t _ { 0 } ) \mathbf { I } )$ , then produce ${ \bf x } ( 0 )$ by iterating Equation 4.
|
| 84 |
+
|
| 85 |
+
We use $\mathrm { S D E d i t } ( \mathbf { x } ^ { ( g ) } ; t _ { 0 } , \theta )$ to denote the above procedure. Essentially, SDEdit selects a particular time $t _ { 0 }$ , add Gaussian noise of standard deviation $\sigma ^ { 2 } ( t _ { 0 } )$ to the guide $\mathbf { x } ^ { ( g ) }$ and then solves the corresponding reverse SDE at $t = 0$ to produce the synthesized ${ \bf x } ( 0 )$ .
|
| 86 |
+
|
| 87 |
+
Apart from the discretization steps taken by the SDE solver, the key hyperparameter for SDEdit is $t _ { 0 }$ , the time from which we begin the image synthesis procedure in the reverse SDE. In the following, we describe a realism-faithfulness trade-off that allows us to select reasonable values of $t _ { 0 }$ .
|
| 88 |
+
|
| 89 |
+
Realism-faithfulness trade-off. We note that for properly trained SDE models, there is a realismfaithfulness trade-off when choosing different values of $t _ { 0 }$ . To illustrate this, we focus on the LSUN dataset, and use high-level stroke paintings as guides to perform stroke-based image generation. We provide experimental details in Appendix D.2. We consider different choices of $t _ { 0 } \in [ 0 , 1 ]$ for the same input. To quantify realism, we adopt neural methods for comparing image distributions, such as the Kernel Inception Score (KID; Binkowski et al. ´ , 2018). If the KID between synthesized images and real images are low, then the synthesized images are realistic. For faithfulness, we measure the squared $L _ { 2 }$ distance between the synthesized images and the guides $\mathbf { x } ^ { ( g ) }$ . From Fig. 3, we observe increased realism but decreased faithfulness as $t _ { 0 }$ increases.
|
| 90 |
+
|
| 91 |
+
The realism-faithfulness trade-off can be interpreted from another angle. If the guide is far from any realistic images, then we must tolerate at least a certain level of deviation from the guide (nonfaithfulness) in order to produce a realistic image. This is illustrated in the following proposition.
|
| 92 |
+
|
| 93 |
+

|
| 94 |
+
Figure 4: SDEdit generates more realistic and faithful images than state-of-the-art GAN-based models on stroke-based generation (LSUN bedroom). The guide in the first two rows are created by human and the ones in the last two rows are simulated by algorithm.
|
| 95 |
+
|
| 96 |
+
Proposition 1. Assume that $\begin{array} { r } { \left\| s _ { \theta } ( \mathbf { x } , t ) \right\| _ { 2 } ^ { 2 } \leq C } \end{array}$ for all $\mathbf { x } \in \mathcal { X }$ and $t \in [ 0 , 1 ]$ . Then for all $\delta \in ( 0 , 1 )$ with probability at least $( 1 - \delta )$ ,
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
\left\| \mathbf { x } ^ { ( g ) } - \mathrm { S D E d i t } ( \mathbf { x } ^ { ( g ) } ; t _ { 0 } , \theta ) \right\| _ { 2 } ^ { 2 } \leq \sigma ^ { 2 } ( t _ { 0 } ) ( C \sigma ^ { 2 } ( t _ { 0 } ) + d + 2 \sqrt { - d \cdot \log \delta } - 2 \log \delta )
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
where d is the number of dimensions of $\mathbf { x } ^ { ( g ) }$ .
|
| 103 |
+
|
| 104 |
+
We provide the proof in Appendix A. On a high-level, the difference from the guides and the synthesized images can be decomposed into the outputs of the score and random Gaussian noise; both would increase as $t _ { 0 }$ increases, and thus the difference becomes greater. The above proposition suggests that for the image to be realistic with high probability, we must have a large enough $t _ { 0 }$ . On the flip side, if $t _ { 0 }$ is too large, then the faithfulness to the guide deteriorates, and SDEdit will produce random realistic images (with the extreme case being unconditional image synthesis).
|
| 105 |
+
|
| 106 |
+
Choice of $t _ { 0 }$ . We note that the quality of the guide may affect the overall quality of the synthesized image. For reasonable guides, we find that $t _ { 0 } \in [ 0 . 3 , 0 . 6 ]$ works well. However, if the guide is an image with only white pixels, then even the closest “realistic” samples from the model distribution can be quite far, and we must sacrifice faithfulness for better realism by choosing a large $t _ { 0 }$ . In interactive settings (where user draws a sketch-based guide), we can initialize $t _ { 0 } \in [ 0 . 3 , 0 . 6 ]$ , synthesize a candidate with SDEdit, and ask the user whether the sample should be more faithful or more realistic; from the responses, we can obtain a reasonable $t _ { 0 }$ via binary search. In large-scale non-interactive settings (where we are given a set of produced guides), we can perform a similar binary search on a randomly selected image to obtain $t _ { 0 }$ and subsequently fix $t _ { 0 }$ for all guides in the same task. Although different guides could potentially have different optimal $t _ { 0 }$ , we empirically observe that the shared $t _ { 0 }$ works well for all reasonable guides in the same task.
|
| 107 |
+
|
| 108 |
+
Detailed algorithm and extensions. We present the general algorithm for VE-SDE in Algorithm 1. Due to space limit, we describe our detailed algorithm for VP-SDE in Appendix C. Essentially, the algorithm is an Euler-Maruyama method for solving $\mathrm { S D E d i t } ( \mathbf { x } ^ { ( g ) } ; t _ { 0 } , \theta )$ . For cases where we wish to keep certain parts of the synthesized images to be identical to that of the guides, we can also introduce an additional channel that masks out parts of the image we do not wish to edit. This is a slight modification to the SDEdit procedure mentioned in the main text, and we discuss the details in Appendix C.2.
|
| 109 |
+
|
| 110 |
+
Algorithm 1 Guided image synthesis and editing with SDEdit (VE-SDE)
|
| 111 |
+
|
| 112 |
+
<table><tr><td>Require: x(g) (guide),to (SDE hyper-parameter),N (total denoising steps) △t←</td></tr><tr><td>z ~ N(0,1) X←x+σ(to)z</td></tr><tr><td>forn←N to1do</td></tr><tr><td>t←to z ~ N(0,I)</td></tr><tr><td>∈←√σ²(t)-σ²(t-△t)</td></tr><tr><td>X←x+ε²s(x,t)+εz</td></tr><tr><td>end for</td></tr><tr><td>Return X</td></tr></table>
|
| 113 |
+
|
| 114 |
+
# 4 RELATED WORK
|
| 115 |
+
|
| 116 |
+
Conditional GANs. Conditional GANs for image editing (Isola et al., 2017; Zhu et al., 2017; Jo & Park, 2019; Liu et al., 2021) learn to directly generate an image based on a user input, and have demonstrated success on a variety of tasks including image synthesis and editing (Portenier et al., 2018; Chen & Koltun, 2017; Dekel et al., 2018; Wang et al., 2018; Park et al., 2019; Zhu et al., 2020b; Jo & Park, 2019; Liu et al., 2021), inpainting (Pathak et al., 2016; Iizuka et al., 2017; Yang et al., 2017; Liu et al., 2018), photo colorization (Zhang et al., 2016; Larsson et al., 2016; Zhang et al., 2017; He et al., 2018), semantic image texture and geometry synthesis (Zhou et al., 2018; Guerin et al. ´ , 2017; Xian et al., 2018). They have also achieved strong performance on image editing using user sketch or color (Jo & Park, 2019; Liu et al., 2021; Sangkloy et al., 2017). However, conditional models have to be trained on both original and edited images, thus requiring data collection and model re-training for new editing tasks. Thus, applying such methods to on-the-fly image manipulation is still challenging since a new model needs to be trained for each new application. Unlike conditional GANs, SDEdit only requires training on the original image. As such, it can be directly applied to various editing tasks at test time as illustrated in Fig. 1.
|
| 117 |
+
|
| 118 |
+
GANs inversion and editing. Another mainstream approach to image editing involves GAN inversion (Zhu et al., 2016; Brock et al., 2017), where the input is first projected into the latent space of an unconditional GAN before synthesizing a new image from the modified latent code. Several methods have been proposed in this direction, including fine-tuning network weights for each image (Bau et al., 2019a; Pan et al., 2020; Roich et al., 2021), choosing better or multiple layers to project and edit (Abdal et al., 2019; 2020; Gu et al., 2020; Wu et al., 2021), designing better encoders (Richardson et al., 2021; Tov et al., 2021), modeling image corruption and transformations (Anirudh et al., 2020; Huh et al., 2020), and discovering meaningful latent directions (Shen et al., 2020; Goetschalckx et al., 2019; Jahanian et al., 2020; Hark ¨ onen et al. ¨ , 2020). However, these methods need to define different loss functions for different tasks. They also require GAN inversion, which can be inefficient and inaccurate for various datasets (Huh et al., 2020; Karras et al., 2020b; Bau et al., 2019b; Xu et al., 2021).
|
| 119 |
+
|
| 120 |
+
Other generative models. Recent advances in training non-normalized probabilistic models, such as score-based generative models (Song & Ermon, 2019; 2020; Song et al., 2021; Ho et al., 2020; Song et al., 2020; Jolicoeur-Martineau et al., 2021) and energy-based models (Ackley et al., 1985; Gao et al., 2017; Du & Mordatch, 2019; Xie et al., 2018; 2016; Song & Kingma, 2021), have achieved comparable image sample quality as GANs. However, most of the prior works in this direction have focused on unconditional image generation and density estimation, and state-of-theart techniques for image editing and synthesis are still dominated by GAN-based methods. In this work, we focus on the recently emerged generative modeling with stochastic differential equations (SDE), and study its application to controllable image editing and synthesis tasks. A concurrent work (Choi et al., 2021) performs conditional image synthesis with diffusion models, where the conditions can be represented as the known function of the underlying true image.
|
| 121 |
+
|
| 122 |
+

|
| 123 |
+
Figure 5: SDEdit can generate realistic, faithful and diverse images for a given stroke input drawn by human.
|
| 124 |
+
|
| 125 |
+
# 5 EXPERIMENTS
|
| 126 |
+
|
| 127 |
+
In this section, we show that SDEdit is able to outperform state-of-the-art GAN-based models on stroke-based image synthesis and editing as well as image compositing. Both SDEdit and the baselines use publicly available pre-trained checkpoints. Based on the availability of open-sourced SDE checkpoints, we use VP-SDE for experiments on LSUN datasets, and VE-SDE for experiments on CelebA-HQ.
|
| 128 |
+
|
| 129 |
+
<table><tr><td>Baselines</td><td>Faithfulness score (L2)↓</td><td>SDEdit ismore realistic (MTurk)↑</td><td>SDEdit is more satisfactory (Mturk) 个</td></tr><tr><td>In-domain GAN-1</td><td>101.18</td><td>94.96%</td><td>89.48%</td></tr><tr><td>In-domain GAN-2</td><td>57.11</td><td>97.87%</td><td>89.51%</td></tr><tr><td>StyleGAN2-ADA</td><td>68.12</td><td>98.09%</td><td>91.72%</td></tr><tr><td>e4e</td><td>53.76</td><td>80.34%</td><td>75.43%</td></tr><tr><td>SDEdit</td><td>32.55</td><td>1</td><td>1</td></tr></table>
|
| 130 |
+
|
| 131 |
+
Table 1: SDEdit outperforms all the GAN baselines on stroke-based generation on LSUN (bedroom). The input strokes are created by human users. The rightmost two columns stand for the percentage of MTurk workers that prefer SDEdit to the baseline for pairwise comparison.
|
| 132 |
+
|
| 133 |
+
Evaluation metrics. We evaluate the editing results based on realism and faithfulness. To quantify realism, we use Kernel Inception Score (KID) between the generated images and the target realistic image dataset (details in Appendix D.2), and pairwise human evaluation between different approaches with Amazon Mechanical Turk (MTurk). To quantify faithfulness, we report the $L _ { 2 }$ distance summed over all pixels between the guide and the edited output image normalized to [0,1]. We also consider LPIPS (Zhang et al., 2018) and MTurk human evaluation for certain experiments. To quantify the overall human satisfaction score (realism $^ +$ faithfulness), we leverage MTurk human evaluation to perform pairwise comparsion between the baselines and SDEdit (see Appendix F).
|
| 134 |
+
|
| 135 |
+
# 5.1 STROKE-BASED IMAGE SYNTHESIS
|
| 136 |
+
|
| 137 |
+
Given an input stroke painting, our goal is to generate a realistic and faithful image when no paired data is available. We consider stroke painting guides created by human users (see Fig. 5). At the same time, we also propose an algorithm to automatically simulate user stroke paintings based on a source image (see Fig. 4), allowing us to perform large scale quantitative evaluations for SDEdit. We provide more details in Appendix D.2.
|
| 138 |
+
|
| 139 |
+
Baselines. For comparison, we choose three state-of-the-art GAN-based image editing and synthesis methods as our baselines. Our first baseline is the image projection method used in StyleGAN2- ADA1 (Karras et al., 2020a), where inversion is done in the $W ^ { + }$ space of StyleGANs by minimizing the perceptual loss. Our second baseline is in-domain $\mathrm { G A N } ^ { 2 }$ (Zhu et al., 2020a), where inversion is accomplished by running optimization steps on top of an encoder. Specifically, we consider two versions of the in-domain GAN inversion techniques: the first one (denoted as In-domain GAN-1)
|
| 140 |
+
|
| 141 |
+

|
| 142 |
+
Figure 6: Stroke-based image editing with SDEdit on LSUN bedroom, CelebA-HQ, and LSUN church datasets. For comparison, we show the results of GAN baselines, where results for LSUN bedroom and CelebA-HQ are obtained by in-domain GAN (the leftmost 5 panels), and results for LSUN church are from StyleGAN2-ADA (the rightmost 3 panels). We observe that SDEdit is able to produce more faithful and realistic editing compared to the baselines.
|
| 143 |
+
|
| 144 |
+
only uses the encoder to maximize the inversion speed, whereas the second (denoted as In-domain GAN-2) runs additional optimization steps to maximize the inversion accuracy. Our third baseline is $\mathrm { e } 4 \mathrm { e } ^ { 3 }$ (Tov et al., 2021), whose encoder objective is explicitly designed to balance between perceptual quality and editability by encouraging to invert images close to $W$ space of a pretrained StyleGAN model.
|
| 145 |
+
|
| 146 |
+
Results. We present qualitative comparison results in Fig. 4. We observe that all baselines struggle to generate realistic images based on stroke painting inputs whereas SDEdit successfully generates realistic images that preserve semantics of the input stroke painting. As shown in Fig. 5, SDEdit can also synthesize diverse images for the same input. We present quantitative comparison results using user-created stroke guides in Table 1 and algorithm-simulated stroke guides in Table 2. We report the $L _ { 2 }$ distance for faithfulness comparison, and leverage MTurk (see Appendix F) or KID scores for realism comparison. To quantify the overall human satisfaction score (faithfulness $^ +$ realism), we ask a different set of MTurk workers to perform another 3000 pair
|
| 147 |
+
|
| 148 |
+
<table><tr><td rowspan="2">Methods</td><td colspan="2">LSUN Bedroom</td><td colspan="2">LSUN Church</td></tr><tr><td>L2↓</td><td>KID↓</td><td>L2↓</td><td>KID↓</td></tr><tr><td>In-domain GAN-1</td><td>105.23</td><td>0.1147</td><td>1</td><td>=</td></tr><tr><td>In-domain GAN-2</td><td>76.11</td><td>0.2070</td><td></td><td>=</td></tr><tr><td>StyleGAN2-ADA</td><td>74.03</td><td>0.1750</td><td>72.41</td><td>0.1544</td></tr><tr><td>e4e</td><td>52.40</td><td>0.0464</td><td>68.53</td><td>0.0354</td></tr><tr><td>SDEdit (ours)</td><td>36.76</td><td>0.0030</td><td>37.67</td><td>0.0156</td></tr></table>
|
| 149 |
+
|
| 150 |
+
Table 2: SDEdit outperforms all the GAN baselines on both faithfulness and realism for strokebased image generation. The input strokes are generated with the stroke-simulation algorithm. KID is computed using the generated images and the corresponding validation sets (see Appendix D.2).
|
| 151 |
+
|
| 152 |
+
wise comparisons between the baselines and SDEdit based on both faithfulness and realism. We observe that SDEdit outperforms GAN baselines on all the evaluation metrics, beating the baselines by more than $80 \%$ on realism scores and $75 \%$ on overall satisfaction scores. We provide more experimental details in Appendix C and more results in Appendix E.
|
| 153 |
+
|
| 154 |
+
# 5.2 FLEXIBLE IMAGE EDITING
|
| 155 |
+
|
| 156 |
+
In this section, we show that SDEdit is able to outperform existing GAN-based models on image editing tasks. We focus on LSUN (bedroom, church) and CelebA-HQ datasets, and provide more details on the experimental setup in the Appendix D.
|
| 157 |
+
|
| 158 |
+
Stroke-based image editing. Given an image with stroke edits, we want to generate a realistic and faithful image based on the user edit. We consider the same GAN-based baselines (Zhu et al., 2020a; Karras et al., 2020a; Tov et al., 2021) as our previous experiment. As shown in Fig. 6,
|
| 159 |
+
|
| 160 |
+

|
| 161 |
+
Figure 7: SDEdit is able to achieve realistic while more faithful editing results compared to traditional blending and recent GAN-based approaches for image compositing on CelebA-HQ. Quantitative results are reported in Table 3.
|
| 162 |
+
|
| 163 |
+
<table><tr><td>Methods</td><td>L2↓ (faithfulness)</td><td>SDEdit more realistic (Mturk) ↑</td><td>SDEdit more satisfactory (Mturk) ↑</td><td>LPIPS (masked) ↓</td></tr><tr><td>Laplacian Blending</td><td>68.45</td><td>75.27%</td><td>83.73%</td><td>0.09</td></tr><tr><td>Poisson Blending</td><td>63.04</td><td>75.60%</td><td>82.18%</td><td>0.05</td></tr><tr><td>In-domain GAN</td><td>36.67</td><td>53.08%</td><td>73.53%</td><td>0.23</td></tr><tr><td>StyleGAN2-ADA</td><td>69.38</td><td>74.12%</td><td>83.43%</td><td>0.21</td></tr><tr><td>e4e</td><td>53.90</td><td>43.67%</td><td>66.00%</td><td>0.33</td></tr><tr><td>SDEdit (ours)</td><td>21.70</td><td>1</td><td>1</td><td>0.03</td></tr></table>
|
| 164 |
+
|
| 165 |
+
Table 3: Image compositing experiments on CelebA-HQ. The middle two columns indicate the percentage of MTurk workers that prefer SDEdit. We also report the masked LPIPS distance between edited and unchanged images to quantify undesired changes outside the masks. We observe that SDEdit is able to achieve realistic editing while being more faithful than the baselines, beating the baseline by up to $8 3 . 7 3 \%$ on overall satisfaction score by human evaluators.
|
| 166 |
+
|
| 167 |
+
results generated by the baselines tend to introduce undesired modifications, occasionally making the region outside the stroke blurry. In contrast, SDEdit generates image edits that are both realistic and faithful to the input, while avoiding making undesired modifications. We provide extra results in Appendix E.
|
| 168 |
+
|
| 169 |
+
Image compositing. We focus on compositing images on the CelebA-HQ dataset (Karras et al., 2017). Given an image randomly sampled from the dataset, we ask users to specify how they want the edited image to look like using pixel patches copied from other reference images as well as the pixels they want to perform modifications (see Fig. 7). We compare our method with traditional blending algorithms (Burt & Adelson, 1987; Perez et al. ´ , 2003) and the same GAN baselines considered previously. We perform qualitative comparison in Fig. 7. For quantitative comparison, we report the $L _ { 2 }$ distance to quantify faithfulness. To quantify realism, we ask MTurk workers to perform 1500 pairwise comparisons between the baselines and SDEdit. To quantify user satisfaction score (faithfulness $^ +$ realism), we ask different workers to perform another 1500 pairwise comparisons against SDEdit. To quantify undesired changes (e.g. change of identity), we follow Bau et al. (2020) to compute masked LPIPS (Zhang et al., 2018). As evidenced in Table 3, we observe that SDEdit is able to generate both faithful and realistic images with much better LPIPS scores than the baselines, outperforming the baselines by up to $8 3 . 7 3 \%$ on overall satisfaction score and $7 5 . 6 0 \%$ on realism. Although our realism score is marginally lower than e4e, images generated by SDEdit are more faithful and more satisfying overall. We present more experiment details in Appendix D.
|
| 170 |
+
|
| 171 |
+
# 6 CONCLUSION
|
| 172 |
+
|
| 173 |
+
We propose Stochastic Differential Editing (SDEdit), a guided image editing and synthesis method via generative modeling of images with stochastic differential equations (SDEs) allowing for balanced realism and faithfulness. Unlike image editing techniques via GAN inversion, our method does not require task-specific optimization algorithms for reconstructing inputs, and is particularly suitable for datasets or tasks where GAN inversion losses are hard to design or optimize. Unlike conditional GANs, our method does not require collecting new datasets for the “guide” images or re-training models, both of which could be expensive or time-consuming. We demonstrate that SDEdit outperforms existing GAN-based methods on a variety of image synthesis and editing tasks.
|
| 174 |
+
|
| 175 |
+
Acknowledgments. The authors would like to thank Kristy Choi for proofreading. This research was in part supported by NSF (#1651565, #1522054, #1733686), ONR (N00014-19-1-2145), AFOSR (FA9550-19-1-0024), ARO (W911NF-15-1-0479), Autodesk, Google, Bosch, Stanford Institute for Human-Centered AI (HAI), Stanford Center for Integrated Facility Engineering (CIFE), Amazon Research Award (ARA), and Amazon AWS. Yang Song is supported by the Apple PhD Fellowship in AI/ML. J.-Y. Zhu is partly supported by Naver Corporation.
|
| 176 |
+
|
| 177 |
+
# ETHICS STATEMENT
|
| 178 |
+
|
| 179 |
+
In this work, we propose SDEdit, which is a new image synthesis and editing methods based on generative stochastic differential equations (SDEs). In our experiments, all the considered datasets are open-sourced and publicly available, being used under permission. Similar to commonly seen deep-learning based image synthesis and editing algorithms, our method has both positive and negative societal impacts depending on the applications and usages. On the positive side, SDEdit enables everyday users with or without artistic expertise to create and edit photo-realistic images with minimum effort, lowering the barrier to entry for visual content creation. On the other hand, SDEdit can be used to generate high-quality edited images that are hard to be distinguished from real ones by humans, which could be used in malicious ways to deceive humans and spread misinformation. Similar to commonly seen deep-learning models (such as GAN-based methods for face-editing), SDEdit might be exploited by malicious users with potential negative impacts. In our code release, we will explicitly specify allowable uses of our system with appropriate licenses.
|
| 180 |
+
|
| 181 |
+
We also notice that forensic methods for detecting fake machine-generated images mostly focus on distinguishing samples generated by GAN-based approaches. Due to the different underlying nature between GANs and generative SDEs, we observe that state-of-the-art approaches for detecting fake images generated by GANs (Wang et al., 2020) struggle to distinguish fake samples generated by SDE-based models. For instance, on the LSUN bedroom dataset, it only successfully detects less than $3 \%$ of SDEdit-generated images whereas being able to distinguish up to $9 3 \%$ on GAN-based generation. Based on these observations, we believe developing forensic methods for SDE-based models is also critical as SDE-based methods become more prevalent.
|
| 182 |
+
|
| 183 |
+
For human evaluation experiments, we leveraged Amazon Mechanical Turk (MTurk). For each worker, the evaluation HIT contains 15 pairwise comparison questions for comparing edited images. The reward per task is kept as $0 . 2 \mathbb { S }$ . Since each task takes around 1 minute, the wage is around $1 2 \$ 1$ per hour. We provide more details on Human evaluation experiments in Appendix F. We also note that the bias of human evaluators (MTurk workers) and the bias of users (through the input “guidance”) could potentially affect the evaluation metrics and results used to track the progress towards guided image synthesis and editing.
|
| 184 |
+
|
| 185 |
+
# REPRODUCIBILITY STATEMENT
|
| 186 |
+
|
| 187 |
+
1. Our code is released at https://github.com/ermongroup/SDEdit.
|
| 188 |
+
2. We use open source datasets and SDE checkpoints on the corresponding datasets. We did
|
| 189 |
+
not train any SDE models.
|
| 190 |
+
3. Proofs are provided in Appendix A.
|
| 191 |
+
4. Extra details on SDEdit and pseudocode are provided in Appendix C.
|
| 192 |
+
5. Details on experimental settings are provided in Appendix D.
|
| 193 |
+
6. Extra experimental results are provided in Appendix E.
|
| 194 |
+
7. Details on human evaluation are provided in Appendix F.
|
| 195 |
+
|
| 196 |
+
# REFERENCES
|
| 197 |
+
|
| 198 |
+
Rameen Abdal, Yipeng Qin, and Peter Wonka. Image2stylegan: How to embed images into the stylegan latent space? In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 4432–4441, 2019.
|
| 199 |
+
|
| 200 |
+
Rameen Abdal, Yipeng Qin, and Peter Wonka. Image2stylegan $^ { + + }$ : How to edit the embedded images? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8296–8305, 2020.
|
| 201 |
+
|
| 202 |
+
David H Ackley, Geoffrey E Hinton, and Terrence J Sejnowski. A learning algorithm for boltzmann machines. Cognitive science, 9(1):147–169, 1985.
|
| 203 |
+
|
| 204 |
+
Brian DO Anderson. Reverse-time diffusion equation models. Stochastic Processes and their Applications, 12 (3):313–326, 1982.
|
| 205 |
+
|
| 206 |
+
Rushil Anirudh, Jayaraman J Thiagarajan, Bhavya Kailkhura, and Peer-Timo Bremer. Mimicgan: Robust projection onto image manifolds with corruption mimicking. International Journal of Computer Vision, pp. 1–19, 2020.
|
| 207 |
+
|
| 208 |
+
David Bau, Hendrik Strobelt, William Peebles, Jonas Wulff, Bolei Zhou, Jun-Yan Zhu, and Antonio Torralba. Semantic photo manipulation with a generative image prior. ACM SIGGRAPH, 38(4):1–11, 2019a.
|
| 209 |
+
|
| 210 |
+
David Bau, Jun-Yan Zhu, Jonas Wulff, William Peebles, Hendrik Strobelt, Bolei Zhou, and Antonio Torralba. Seeing what a gan cannot generate. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 4502–4511, 2019b.
|
| 211 |
+
|
| 212 |
+
David Bau, Steven Liu, Tongzhou Wang, Jun-Yan Zhu, and Antonio Torralba. Rewriting a deep generative model. In European Conference on Computer Vision (ECCV), 2020.
|
| 213 |
+
|
| 214 |
+
Mikołaj Binkowski, Danica J Sutherland, Michael Arbel, and Arthur Gretton. Demystifying mmd gans. ´ arXiv preprint arXiv:1801.01401, 2018.
|
| 215 |
+
|
| 216 |
+
Andrew Brock, Theodore Lim, James M Ritchie, and Nick Weston. Neural photo editing with introspective adversarial networks. In International Conference on Learning Representations (ICLR), 2017.
|
| 217 |
+
|
| 218 |
+
Peter J Burt and Edward H Adelson. The laplacian pyramid as a compact image code. In Readings in computer vision, pp. 671–679. Elsevier, 1987.
|
| 219 |
+
|
| 220 |
+
Qifeng Chen and Vladlen Koltun. Photographic image synthesis with cascaded refinement networks. In IEEE International Conference on Computer Vision (ICCV), 2017.
|
| 221 |
+
|
| 222 |
+
Jooyoung Choi, Sungwon Kim, Yonghyun Jeong, Youngjune Gwon, and Sungroh Yoon. Ilvr: Conditioning method for denoising diffusion probabilistic models. arXiv preprint arXiv:2108.02938, 2021.
|
| 223 |
+
|
| 224 |
+
Tali Dekel, Chuang Gan, Dilip Krishnan, Ce Liu, and William T Freeman. Sparse, smart contours to represent and edit images. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
|
| 225 |
+
|
| 226 |
+
Prafulla Dhariwal and Alex Nichol. Diffusion models beat gans on image synthesis. arXiv preprint arXiv:2105.05233, 2021.
|
| 227 |
+
|
| 228 |
+
Yilun Du and Igor Mordatch. Implicit generation and generalization in energy-based models. arXiv preprint arXiv:1903.08689, 2019.
|
| 229 |
+
|
| 230 |
+
Ruiqi Gao, Yang Lu, Junpei Zhou, Song-Chun Zhu, and Ying Nian Wu. Learning energy-based models as generative convnets via multi-grid modeling and sampling. arXiv e-prints, pp. arXiv–1709, 2017.
|
| 231 |
+
|
| 232 |
+
Lore Goetschalckx, Alex Andonian, Aude Oliva, and Phillip Isola. Ganalyze: Toward visual definitions of cognitive image properties. In IEEE International Conference on Computer Vision (ICCV), 2019.
|
| 233 |
+
|
| 234 |
+
Jinjin Gu, Yujun Shen, and Bolei Zhou. Image processing using multi-code gan prior. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
|
| 235 |
+
|
| 236 |
+
Eric Gu ´ erin, Julie Digne, ´ Eric Galin, Adrien Peytavie, Christian Wolf, Bedrich Benes, and Benoundefinedt ´ Martinez. Interactive example-based terrain authoring with conditional generative adversarial networks. ACM Transactions on Graphics (TOG), 36(6), 2017.
|
| 237 |
+
|
| 238 |
+
Erik Hark ¨ onen, Aaron Hertzmann, Jaakko Lehtinen, and Sylvain Paris. Ganspace: Discovering interpretable¨ gan controls. In Advances in Neural Information Processing Systems, 2020.
|
| 239 |
+
|
| 240 |
+
Mingming He, Dongdong Chen, Jing Liao, Pedro V Sander, and Lu Yuan. Deep exemplar-based colorization. ACM Transactions on Graphics (TOG), 37(4):1–16, 2018.
|
| 241 |
+
|
| 242 |
+
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. arXiv preprint arXiv:2006.11239, 2020.
|
| 243 |
+
|
| 244 |
+
Minyoung Huh, Richard Zhang, Jun-Yan Zhu, Sylvain Paris, and Aaron Hertzmann. Transforming and projecting images into class-conditional generative networks. In European Conference on Computer Vision (ECCV), 2020.
|
| 245 |
+
|
| 246 |
+
Satoshi Iizuka, Edgar Simo-Serra, and Hiroshi Ishikawa. Globally and locally consistent image completion. ACM Transactions on Graphics (TOG), 36(4):107, 2017.
|
| 247 |
+
|
| 248 |
+
Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
|
| 249 |
+
|
| 250 |
+
Ali Jahanian, Lucy Chai, and Phillip Isola. On the”steerability” of generative adversarial networks. In International Conference on Learning Representations (ICLR), 2020.
|
| 251 |
+
|
| 252 |
+
Youngjoo Jo and Jongyoul Park. Sc-fegan: Face editing generative adversarial network with user’s sketch and color. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 1745–1753, 2019.
|
| 253 |
+
|
| 254 |
+
Alexia Jolicoeur-Martineau, Remi Pich ´ e-Taillefer, Ioannis Mitliagkas, and Remi Tachet des Combes. Adversar- ´ ial score matching and improved sampling for image generation. In International Conference on Learning Representations, 2021.
|
| 255 |
+
|
| 256 |
+
Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. arXiv preprint arXiv:1710.10196, 2017.
|
| 257 |
+
|
| 258 |
+
Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
|
| 259 |
+
|
| 260 |
+
Tero Karras, Miika Aittala, Janne Hellsten, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Training generative adversarial networks with limited data. arXiv preprint arXiv:2006.06676, 2020a.
|
| 261 |
+
|
| 262 |
+
Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of stylegan. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020b.
|
| 263 |
+
|
| 264 |
+
Bahjat Kawar, Gregory Vaksman, and Michael Elad. Snips: Solving noisy inverse problems stochastically. arXiv preprint arXiv:2105.14951, 2021.
|
| 265 |
+
|
| 266 |
+
Gustav Larsson, Michael Maire, and Gregory Shakhnarovich. Learning representations for automatic colorization. In European Conference on Computer Vision (ECCV), 2016.
|
| 267 |
+
|
| 268 |
+
Beatrice Laurent and Pascal Massart. Adaptive estimation of a quadratic functional by model selection. Annals of Statistics, pp. 1302–1338, 2000.
|
| 269 |
+
|
| 270 |
+
Guilin Liu, Fitsum A Reda, Kevin J Shih, Ting-Chun Wang, Andrew Tao, and Bryan Catanzaro. Image inpainting for irregular holes using partial convolutions. In European Conference on Computer Vision (ECCV), 2018.
|
| 271 |
+
|
| 272 |
+
Hongyu Liu, Ziyu Wan, Wei Huang, Yibing Song, Xintong Han, Jing Liao, Bin Jiang, and Wei Liu. Deflocnet: Deep image editing via flexible low-level controls. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10765–10774, 2021.
|
| 273 |
+
|
| 274 |
+
Xingang Pan, Xiaohang Zhan, Bo Dai, Dahua Lin, Chen Change Loy, and Ping Luo. Exploiting deep generative prior for versatile image restoration and manipulation. In European Conference on Computer Vision, 2020.
|
| 275 |
+
|
| 276 |
+
Taesung Park, Ming-Yu Liu, Ting-Chun Wang, and Jun-Yan Zhu. Semantic image synthesis with spatiallyadaptive normalization. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
|
| 277 |
+
|
| 278 |
+
Deepak Pathak, Philipp Krahenbuhl, Jeff Donahue, Trevor Darrell, and Alexei A Efros. Context encoders: Feature learning by inpainting. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
|
| 279 |
+
|
| 280 |
+
Patrick Perez, Michel Gangnet, and Andrew Blake. Poisson image editing. In ´ ACM SIGGRAPH, pp. 313–318, 2003.
|
| 281 |
+
|
| 282 |
+
Tiziano Portenier, Qiyang Hu, Attila Szabo, Siavash Arjomand Bigdeli, Paolo Favaro, and Matthias Zwicker. ´ Faceshop: Deep sketch-based face image editing. ACM Transactions on Graphics (TOG), 37(4), 2018.
|
| 283 |
+
|
| 284 |
+
Elad Richardson, Yuval Alaluf, Or Patashnik, Yotam Nitzan, Yaniv Azar, Stav Shapiro, and Daniel Cohen-Or. Encoding in style: a stylegan encoder for image-to-image translation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021.
|
| 285 |
+
|
| 286 |
+
Daniel Roich, Ron Mokady, Amit H Bermano, and Daniel Cohen-Or. Pivotal tuning for latent-based editing of real images. arXiv preprint arXiv:2106.05744, 2021.
|
| 287 |
+
|
| 288 |
+
Patsorn Sangkloy, Jingwan Lu, Chen Fang, Fisher Yu, and James Hays. Scribbler: Controlling deep image synthesis with sketch and color. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
|
| 289 |
+
|
| 290 |
+
Yujun Shen, Jinjin Gu, Xiaoou Tang, and Bolei Zhou. Interpreting the latent space of gans for semantic face editing. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
|
| 291 |
+
|
| 292 |
+
Jascha Sohl-Dickstein, Eric A Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. arXiv preprint arXiv:1503.03585, 2015.
|
| 293 |
+
|
| 294 |
+
Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv preprint arXiv:2010.02502, 2020.
|
| 295 |
+
|
| 296 |
+
Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. In Advances in Neural Information Processing Systems (NeurIPS), 2019.
|
| 297 |
+
|
| 298 |
+
Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. arXiv preprint arXiv:2006.09011, 2020.
|
| 299 |
+
|
| 300 |
+
Yang Song and Diederik P Kingma. How to train your energy-based models. arXiv preprint arXiv:2101.03288, 2021.
|
| 301 |
+
|
| 302 |
+
Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations (ICLR), 2021.
|
| 303 |
+
|
| 304 |
+
Omer Tov, Yuval Alaluf, Yotam Nitzan, Or Patashnik, and Daniel Cohen-Or. Designing an encoder for stylegan image manipulation. ACM Transactions on Graphics (TOG), 40(4):1–14, 2021.
|
| 305 |
+
|
| 306 |
+
Pascal Vincent. A connection between score matching and denoising autoencoders. Neural computation, 23 (7):1661–1674, 2011.
|
| 307 |
+
|
| 308 |
+
Sheng-Yu Wang, Oliver Wang, Richard Zhang, Andrew Owens, and Alexei A Efros. Cnn-generated images are surprisingly easy to spot...for now. In CVPR, 2020.
|
| 309 |
+
|
| 310 |
+
Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. High-resolution image synthesis and semantic manipulation with conditional gans. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
|
| 311 |
+
|
| 312 |
+
Zongze Wu, Dani Lischinski, and Eli Shechtman. Stylespace analysis: Disentangled controls for stylegan image generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021.
|
| 313 |
+
|
| 314 |
+
Wenqi Xian, Patsorn Sangkloy, Varun Agrawal, Amit Raj, Jingwan Lu, Chen Fang, Fisher Yu, and James Hays. Texturegan: Controlling deep image synthesis with texture patches. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
|
| 315 |
+
|
| 316 |
+
Jianwen Xie, Yang Lu, Song-Chun Zhu, and Yingnian Wu. A theory of generative convnet. In International Conference on Machine Learning, pp. 2635–2644. PMLR, 2016.
|
| 317 |
+
|
| 318 |
+
Jianwen Xie, Yang Lu, Ruiqi Gao, and Ying Nian Wu. Cooperative learning of energy-based model and latent variable model via mcmc teaching. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
|
| 319 |
+
|
| 320 |
+
Yinghao Xu, Yujun Shen, Jiapeng Zhu, Ceyuan Yang, and Bolei Zhou. Generative hierarchical features from synthesizing images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4432–4442, 2021.
|
| 321 |
+
|
| 322 |
+
Chao Yang, Xin Lu, Zhe Lin, Eli Shechtman, Oliver Wang, and Hao Li. High-resolution image inpainting using multi-scale neural patch synthesis. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
|
| 323 |
+
|
| 324 |
+
Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. In European Conference on Computer Vision (ECCV), 2016.
|
| 325 |
+
|
| 326 |
+
Richard Zhang, Jun-Yan Zhu, Phillip Isola, Xinyang Geng, Angela S Lin, Tianhe Yu, and Alexei A Efros. Real-time user-guided image colorization with learned deep priors. ACM Transactions on Graphics (TOG), 9(4), 2017.
|
| 327 |
+
|
| 328 |
+
Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In CVPR, 2018.
|
| 329 |
+
|
| 330 |
+
Yang Zhou, Zhen Zhu, Xiang Bai, Dani Lischinski, Daniel Cohen-Or, and Hui Huang. Non-stationary texture synthesis by adversarial expansion. ACM Transactions on Graphics (TOG), 37(4), 2018.
|
| 331 |
+
|
| 332 |
+
Jiapeng Zhu, Yujun Shen, Deli Zhao, and Bolei Zhou. In-domain gan inversion for real image editing. In European Conference on Computer Vision (ECCV), 2020a.
|
| 333 |
+
|
| 334 |
+
Jun-Yan Zhu, Philipp Krahenb ¨ uhl, Eli Shechtman, and Alexei A Efros. Generative visual manipulation on the ¨ natural image manifold. In European Conference on Computer Vision (ECCV), 2016.
|
| 335 |
+
|
| 336 |
+
Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In IEEE International Conference on Computer Vision (ICCV), 2017.
|
| 337 |
+
|
| 338 |
+
Peihao Zhu, Rameen Abdal, Yipeng Qin, and Peter Wonka. Sean: Image synthesis with semantic regionadaptive normalization. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020b.
|
| 339 |
+
|
| 340 |
+
# A PROOFS
|
| 341 |
+
|
| 342 |
+
Proposition 1. Assume that $\begin{array} { r } { \left\| s _ { \theta } ( \mathbf { x } , t ) \right\| _ { 2 } ^ { 2 } \leq C } \end{array}$ for all $\mathbf { x } \in \mathcal { X }$ and $t \in [ 0 , 1 ]$ . Then for all $\delta \in ( 0 , 1 )$ with probability at least $( 1 - \delta )$ ,
|
| 343 |
+
|
| 344 |
+
$$
|
| 345 |
+
\left\| \mathbf { x } ^ { ( g ) } - \mathrm { S D E d i t } ( \mathbf { x } ^ { ( g ) } ; t _ { 0 } , \theta ) \right\| _ { 2 } ^ { 2 } \leq \sigma ^ { 2 } ( t _ { 0 } ) ( C \sigma ^ { 2 } ( t _ { 0 } ) + d + 2 \sqrt { - d \cdot \log \delta } - 2 \log \delta )
|
| 346 |
+
$$
|
| 347 |
+
|
| 348 |
+
where $d$ is the number of dimensions of $\mathbf { x } ^ { ( g ) }$ .
|
| 349 |
+
|
| 350 |
+
Proof. Denote $\mathbf { x } ^ { ( g ) } ( 0 ) = \mathrm { S D E d i t } ( \mathbf { x } ^ { ( g ) } ; t , \theta )$ , then
|
| 351 |
+
|
| 352 |
+
$$
|
| 353 |
+
\begin{array} { r l } & { \left\| \mathbf { x } ^ { ( g ) } ( t _ { 0 } ) - \mathbf { x } ^ { ( g ) } ( 0 ) \right\| _ { 2 } ^ { 2 } = \left\| \int _ { t _ { 0 } } ^ { 0 } \frac { \mathrm { d } \mathbf { x } ^ { ( g ) } ( t ) } { \mathrm { d } t } \mathrm { d } t \right\| _ { 2 } ^ { 2 } } \\ & { \qquad = \left\| \int _ { t _ { 0 } } ^ { 0 } \left[ - \frac { \mathrm { d } [ \sigma ^ { 2 } ( t ) ] } { \mathrm { d } t } s _ { \theta } ( \mathbf { x } , t ; \theta ) \right] \mathrm { d } t + \sqrt { \frac { \mathrm { d } [ \sigma ^ { 2 } ( t ) ] } { \mathrm { d } t } } \mathrm { d } \mathbf { \overline { { w } } } \right\| _ { 2 } ^ { 2 } } \\ & { \qquad \leq \left\| \int _ { t _ { 0 } } ^ { 0 } \left[ - \frac { \mathrm { d } [ \sigma ^ { 2 } ( t ) ] } { \mathrm { d } t } s _ { \theta } ( \mathbf { x } , t ; \theta ) \right] \mathrm { d } t \right\| _ { 2 } ^ { 2 } + \left\| \int _ { t _ { 0 } } ^ { 0 } \sqrt { \frac { \mathrm { d } [ \sigma ^ { 2 } ( t ) ] } { \mathrm { d } t } } \mathrm { d } \mathbf { \overline { { w } } } \right\| _ { 2 } ^ { 2 } } \end{array}
|
| 354 |
+
$$
|
| 355 |
+
|
| 356 |
+
From the assumption over $s _ { \theta } ( \mathbf { x } , t ; \theta )$ , the first term is not greater than
|
| 357 |
+
|
| 358 |
+
$$
|
| 359 |
+
C \left\| \int _ { t _ { 0 } } ^ { 0 } \left[ - \frac { \mathrm { d } [ \sigma ^ { 2 } ( t ) ] } { \mathrm { d } t } \right] \mathrm { d } t \right\| _ { 2 } ^ { 2 } = C \sigma ^ { 4 } ( t _ { 0 } ) ,
|
| 360 |
+
$$
|
| 361 |
+
|
| 362 |
+
where equality could only happen when each score output has a squared $L _ { 2 }$ norm of $C$ and they are linearly dependent to one other. The second term is independent to the first term as it only concerns random noise; this is equal to the squared $L _ { 2 }$ norm of a random variable from a Wiener process at time $t = 0$ , with marginal distribution being $\boldsymbol \epsilon \sim \mathcal { N } ( \mathbf 0 , \sigma ^ { 2 } ( t _ { 0 } ) \mathbf I )$ (this marginal does not depend on the discretization steps in Euler-Maruyama). The squared $L _ { 2 }$ norm of $\epsilon$ divided by $\sigma ^ { 2 } ( t _ { 0 } ) ^ { }$ is a $\chi ^ { 2 }$ -distribution with $d$ -degrees of freedom. From Laurent & Massart (2000), Lemma 1, we have the following one-sided tail bound:
|
| 363 |
+
|
| 364 |
+
$$
|
| 365 |
+
\operatorname* { P r } ( \| \epsilon \| _ { 2 } ^ { 2 } / \sigma ^ { 2 } ( t _ { 0 } ) \geq d + 2 \sqrt { d \cdot - \log \delta } - 2 \log \delta ) \leq \exp ( \log \delta ) = \delta .
|
| 366 |
+
$$
|
| 367 |
+
|
| 368 |
+
Therefore, with probability at least $( 1 - \delta )$ , we have that:
|
| 369 |
+
|
| 370 |
+
$$
|
| 371 |
+
\begin{array} { r } { \Big \| \mathbf { x } ^ { ( g ) } ( t _ { 0 } ) - \mathbf { x } ^ { ( g ) } ( 0 ) \Big \| _ { 2 } ^ { 2 } \leq \sigma ^ { 2 } ( t _ { 0 } ) ( C \sigma ^ { 2 } ( t _ { 0 } ) + d + 2 \sqrt { - d \cdot \log \delta } - 2 \log \delta ) , } \end{array}
|
| 372 |
+
$$
|
| 373 |
+
|
| 374 |
+
completing the proof.
|
| 375 |
+
|
| 376 |
+
# B EXTRA ABLATION STUDIES
|
| 377 |
+
|
| 378 |
+
In this section, we perform extra ablation studies and analysis for SDEdit.
|
| 379 |
+
|
| 380 |
+
# B.1 ANALYSIS ON THE QUALITY OF USER GUIDE
|
| 381 |
+
|
| 382 |
+
As discussed in Section 3, if the guide is far from any realistic images (e.g., random noise or has an unreasonable composition) , then we must tolerate at least a certain level of deviation from the guide (non-faithfulness) in order to produce a realistic image.
|
| 383 |
+
|
| 384 |
+
For practical applications, we perform extra ablation studies on how the quality of guided stroke would affect the results in Fig. 8, Fig. 9 and Table 4. Specifically, in Fig. 8 we consider stroke input of 1) a human face with limited detail for a CelebA-HQ model, 2) a human face with spikes for a CelebA-HQ model, 3) a building with limited detail for a LSUN-church model, 4) a horse for a LSUN-church model. We observe that SDEdit is in general tolerant to different kinds of user inputs. In Table 4, we quantitatively analyze the effect of user guide quality using simulated stroke paintings as input. Described in Appendix D.2, the human-stroke-simulation algorithm uses different numbers of colors to generate stroke guides with different levels of detail. We compare SDEdit with baselines qualitatively in Fig. 9 and quantitatively in Table 4. Similarly, we observe that SDEdit has a high tolerance to input guides and consistently outperforms the baselines across all setups in this experiment.
|
| 385 |
+
|
| 386 |
+

|
| 387 |
+
Figure 8: Analysis on the quality of user guide for stoke-based image synthesis. We observe that SDEdit is in general tolerant to different kinds of user inputs.
|
| 388 |
+
|
| 389 |
+

|
| 390 |
+
Figure 9: Analysis on the quality of user guide for stoke-based image synthesis. We observe that SDEdit is in general tolerant to different kinds of user inputs.
|
| 391 |
+
|
| 392 |
+
<table><tr><td rowspan="2"># of colors</td><td colspan="2">StyleGAN2-ADA</td><td colspan="2">e4e</td><td colspan="2">SDEdit (Ours)</td></tr><tr><td>KID↓</td><td>L2√</td><td>KID↓</td><td>L2√</td><td>KID↓</td><td>L2√</td></tr><tr><td>3</td><td>0.1588</td><td>67.22</td><td>0.0379</td><td>70.73</td><td>0.0233</td><td>36.00</td></tr><tr><td>6</td><td>0.1544</td><td>72.41</td><td>0.0354</td><td>68.53</td><td>0.0156</td><td>37.67</td></tr><tr><td>16</td><td>0.0923</td><td>69.52</td><td>0.0319</td><td>68.20</td><td>0.0135</td><td>37.70</td></tr><tr><td>30</td><td>0.0911</td><td>67.11</td><td>0.0304</td><td>68.66</td><td>0.0128</td><td>37.42</td></tr><tr><td>50</td><td>0.0922</td><td>65.28</td><td>0.0307</td><td>68.80</td><td>0.0126</td><td>37.40</td></tr></table>
|
| 393 |
+
|
| 394 |
+
Table 4: We compare SDEdit with baselines quantitatively on LSUN-church dataset on strokebased generation. “# of colors” denotes the number of colors used to generate the synthetic stroke paintings, with fewer colors corresponding to a less accurate and less detailed input guide (see Fig. 9). We observe that SDEdit consistently achieves more realistic and more faithful outputs and outperforms the baselines across all setups.
|
| 395 |
+
|
| 396 |
+
# B.2 FLEXIBLE IMAGE EDITING WITH SDEDIT
|
| 397 |
+
|
| 398 |
+
In this section, we perform extra image editing experiments including editing closing eyes Fig. 10, opening mouth, and changing lip color Fig. 11. We observe that SDEdit can still achieve reasonable editing results, which shows that SDEdit is capable of flexible image editing tasks.
|
| 399 |
+
|
| 400 |
+

|
| 401 |
+
Figure 10: Flexible image editing on closing eyes with SDEdit.
|
| 402 |
+
|
| 403 |
+

|
| 404 |
+
Figure 11: Flexible image editing on mouth with SDEdit.
|
| 405 |
+
|
| 406 |
+
# B.3 ANALYSIS ON $t _ { 0 }$
|
| 407 |
+
|
| 408 |
+
In this section, we provide extra analysis on the effect of $t _ { 0 }$ (see Fig. 12). As illustrated in Fig. 3, we can tune $t _ { 0 }$ to tradeoff between faithfulness and realism—with a smaller $t _ { 0 }$ corresponding to a more faithful but less realistic generated image. If we want to keep the brown stroke in Fig. 12, we can reduce $t _ { 0 }$ to increase its faithfulness which could potentially decrease its realism. Additional analysis can be found in Appendix D.2.
|
| 409 |
+
|
| 410 |
+

|
| 411 |
+
Figure 12: Extra analysis on $t _ { 0 }$ . As $t _ { 0 }$ increases, the generated images become more realistic while less faithful.
|
| 412 |
+
|
| 413 |
+
# B.4 EXTRA COMPARISON WITH OTHER BASELINES
|
| 414 |
+
|
| 415 |
+
We perform extra comparison with SC-FEGAN (Jo & Park, 2019) in Fig. 13. We observe that SDEdit is able to have more realistic results than SC-FEGAN (Jo & Park, 2019) when using the same stroke input guide. We also present results for SC-FEGAN (Jo & Park, 2019) where we use extra sketch together with stroke as the input guide (see Fig. 14). We observe that SDEdit is still able to outperform SC-FEGAN in terms of realism even when SC-FEGAN is using both sketch and stroke as the input guide.
|
| 416 |
+
|
| 417 |
+

|
| 418 |
+
Figure 13: Comparison with SC-FEGAN (Jo & Park, 2019) on stroke-based image synthesis and editing. We observe that SDEdit is able to generate more realistic results than SC-FEGAN.
|
| 419 |
+
|
| 420 |
+

|
| 421 |
+
Figure 14: Stroke-based editing for SC-FEGAN (Jo & Park, 2019) using both stroke and extra sketch as the input guide. We observe that SDEdit still outperforms SC-FEGAN using only stroke as the input guide.
|
| 422 |
+
|
| 423 |
+
# B.5 COMPARISON WITH SONG ET AL. (2021)
|
| 424 |
+
|
| 425 |
+
Methods proposed by Song et al. (2021) introduce an extra noise-conditioned classifier for conditional generation and the performance of the classifier is critical to the conditional generation performance. Their settings are more similar to regular inverse problems where the measurement function is known, which is discussed in Section 3. Since we do not have a known “measurement” function for user-generated guides, their approach cannot be directly applied to user-guided image synthesis or editing in the form of manipulating pixel RGB values. To deal with this limitation, SDEdit initializes the reverse SDE based on user input and modifies $t _ { 0 }$ accordingly—an approach different from Song et al. (2021) (which always have the same initialization). This technique allows SDEdit to achieve faithful and realistic image editing or generation results without extra task-specific model learning (e.g., an additional classifier in Song et al. (2021)).
|
| 426 |
+
|
| 427 |
+
For practical applications, we compare with Song et al. (2021) on stroke-based image synthesis and editing where we do not learn an extra noise-conditioned classifier (see Fig. 15). In fact, we are also unable to learn the noise-conditioned classifier since we do not have a known “measurement” function for user-generated guides and we only have one random user input guide instead of a dataset of input guide. We observe that this application of Song et al. (2021) fails to generate faithful results by performing random inpainting (see Fig. 15). SDEdit, on the other hand, generates both realistic and faithful images without learning extra task-specific models (e.g., an additional classifier) and can be directly applied to pretrained SDE-based generative models, allowing for guided image synthesis and editing using SDE-based models. We believe this shows the novelty and contribution of SDEdit.
|
| 428 |
+
|
| 429 |
+

|
| 430 |
+
Figure 15: Comparison with Song et al. (2021) on stroke-based image synthesis and editing. We observe that SDEdit is able to generate more faithful results than Song et al. (2021) without training an extra task-specific model (e.g., an additional classifier).
|
| 431 |
+
|
| 432 |
+
# C DETAILS ON SDEDIT
|
| 433 |
+
|
| 434 |
+
C.1 DETAILS ON THE VP AND VE SDES
|
| 435 |
+
|
| 436 |
+
We follow the definitions of VE and VP SDEs in Song et al. (2021), and adopt the same settings therein.
|
| 437 |
+
|
| 438 |
+
VE-SDE In particular, for the VE SDE, we choose
|
| 439 |
+
|
| 440 |
+
$$
|
| 441 |
+
\sigma ( t ) = \left\{ { \begin{array} { l l } { 0 , \qquad t = 0 } \\ { \sigma _ { \mathrm { m i n } } \biggl ( { \frac { \sigma _ { \mathrm { m a x } } } { \sigma _ { \mathrm { m i n } } } } \biggr ) ^ { t } , \qquad t > 0 } \end{array} } \right.
|
| 442 |
+
$$
|
| 443 |
+
|
| 444 |
+
where $\sigma _ { \mathrm { m i n } } = 0 . 0 1$ and $\sigma _ { \mathrm { m a x } } = 3 8 0$ , 378, 348, 1348 for LSUN churches, bedroom, FFHQ/CelebAHQ $2 5 6 \times 2 5 6$ , and FFHQ $1 0 2 4 \times 1 0 2 4$ datasets respectively.
|
| 445 |
+
|
| 446 |
+
VP-SDE For the VP SDE, it takes the form of
|
| 447 |
+
|
| 448 |
+
$$
|
| 449 |
+
\mathrm { d } { \mathbf { x } } ( t ) = - \frac { 1 } { 2 } \beta ( t ) { \mathbf { x } } ( t ) \mathrm { d } t + \sqrt { \beta ( t ) } \mathrm { d } { \mathbf { w } } ( t ) ,
|
| 450 |
+
$$
|
| 451 |
+
|
| 452 |
+
where $\beta ( t )$ is a positive function. In experiments, we follow Song et al. (2021); Ho et al. (2020); Dhariwal & Nichol (2021) and set
|
| 453 |
+
|
| 454 |
+
$$
|
| 455 |
+
\beta ( t ) = \beta _ { \mathrm { m i n } } + t ( \beta _ { \mathrm { m a x } } - \beta _ { \mathrm { m i n } } ) ,
|
| 456 |
+
$$
|
| 457 |
+
|
| 458 |
+
For SDE trained by Song et al. (2021); Ho et al. (2020) we use $\beta _ { \mathrm { m i n } } = 0 . 1$ and $\beta _ { \mathrm { m a x } } = 2 0$ ; for SDE trained by Dhariwal & Nichol (2021), the model learns to rescale the variance based on the same choices of $\beta _ { \mathrm { m i n } }$ and $\beta _ { \mathrm { m a x } }$ . We always have $p _ { 1 } ( \mathbf { x } ) \approx \mathcal { N } ( \mathbf { 0 } , I )$ under these settings.
|
| 459 |
+
|
| 460 |
+
Solving the reverse VP SDE is similar to solving the reverse VE SDE. Specifically, we follow the iteration rule below:
|
| 461 |
+
|
| 462 |
+
$$
|
| 463 |
+
\mathbf { x } _ { n - 1 } = \frac { 1 } { \sqrt { 1 - \beta ( t _ { n } ) \Delta t } } ( \mathbf { x } _ { n } + \beta ( t _ { n } ) \Delta t s _ { \theta } ( \mathbf { x } ( t _ { n } ) , t _ { n } ) ) + \sqrt { \beta ( t _ { n } ) \Delta t } \mathbf { z } _ { n } ,
|
| 464 |
+
$$
|
| 465 |
+
|
| 466 |
+
where $\mathbf { x } _ { N } \sim \mathcal { N } ( \mathbf { 0 } , I )$ , $\mathbf { z } _ { n } \sim \mathcal { N } ( \mathbf { 0 } , I )$ and $n = N , N - 1 , \cdots , 1$
|
| 467 |
+
|
| 468 |
+
In generation the process detailed in Algorithm 1 can also be repeated for $K$ number of times as detailed in Algorithm 2. Note that Algorithm 1 is a special case of Algorithm 2: when $K = 1$ , we recover Algorithm 1. For VE-SDE, Algorithm 2 converts a stroke painting to a photo-realistic image, which typically modifies all pixels of the input. However, in cases such as image compositing and stroke-based editing, certain regions of the input are already photo-realistic and therefore we hope to leave these regions intact. To represent a specific region, we use a binary mask $\Omega \in \{ 0 , 1 \} ^ { C \times \hat { H } \times W }$ that evaluates to 1 for editable pixels and 0 otherwise. We can generalize Algorithm 2 to restrict editing in the region defined by $\pmb { \Omega }$ .
|
| 469 |
+
|
| 470 |
+
For editable regions, we perturb the input image with the forward SDE and generate edits by reversing the SDE, using the same procedure in Algorithm 2. For uneditable regions, we perturb it as usual but design the reverse procedure carefully so that it is guaranteed to recover the input. Specifically, suppose $\mathbf { x } \in \mathbb { R } ^ { C \times H \times \mathbf { \bar { W } } }$ is an input image of height $H$ , width $W$ , and with $C$ channels. Our algorithm first perturbs $\mathbf { x } ( 0 ) = \mathbf { x }$ with an SDE running from $t = 0$ till $t = t _ { 0 }$ to obtain $\mathbf { x } ( t _ { 0 } )$ . Afterwards, we denoise $\mathbf { x } ( t _ { 0 } )$ with separate methods for $\Omega \odot \mathbf { x } ( t )$ and $( \mathbf { 1 } - \Omega ) \odot \mathbf { x } ( t )$ , where $\odot$ denotes the element-wise product and $0 \leq t \leq t _ { 0 }$ . For $\Omega { \odot } \mathbf { x } ( t )$ , we simulate the reverse SDE (Song et al., 2021) and project the results by element-wise multiplication with $\pmb { \Omega }$ . For $( \mathbf { 1 } - \Omega ) \odot \mathbf { x } ( t )$ , we set it to $( \mathbf { 1 } - \pmb { \Omega } ) \odot ( \mathbf { x } + \sigma ( t ) \mathbf { z } )$ , where $\mathbf { z } \sim \mathcal { N } ( \mathbf { 0 } , I )$ . Here we gradually reduce the noise magnitude according to $\sigma ( t )$ to make sure $\Omega \odot \mathbf { x } ( t )$ and $( \mathbf { 1 } - \Omega ) \odot \mathbf { x } ( \bar { t } )$ have comparable amount of noise. Moreover, since $\boldsymbol { \sigma } ( t ) 0$ as $t 0$ , this ensures that $( \mathbf { 1 } - \Omega ) \odot \mathbf { x } ( t )$ converges to $\left( \mathbf { 1 } - \pmb { \Omega } \right) \odot \mathbf { x }$ , keeping the uneditable part of $\mathbf { x }$ intact. The complete SDEdit method (for VE-SDEs) is given in Algorithm 3. We provide algorithm for VP-SDEs in Algorithm 4 and the corresponding masked version in Algorithm 5.
|
| 471 |
+
|
| 472 |
+
With different inputs to Algorithm 3 or Algorithm 5, we can perform multiple image synthesis and editing tasks with a single unified approach, including but not limited to the following:
|
| 473 |
+
|
| 474 |
+
• Stroke-based image synthesis: We can recover Algorithm 2 or Algorithm 4 by setting all entries in $\pmb { \Omega }$ to 1.
|
| 475 |
+
• Stroke-based image editing: Suppose $\mathbf { x } ^ { ( g ) }$ is an image marked by strokes, and $\pmb { \Omega }$ masks the part that are not stroke pixels. We can reconcile the two parts of $\mathbf { x } ^ { ( g ) }$ with Algorithm 3 to obtain a photo-realistic image.
|
| 476 |
+
• Image compositing: Suppose $\mathbf { x } ^ { ( g ) }$ is an image superimposed by elements from two images, and $\pmb { \Omega }$ masks the region that the users do not want to perform editing, we can perform image compositing with Algorithm 3 or Algorithm 5.
|
| 477 |
+
|
| 478 |
+
# Algorithm 2 Guided image synthesis and editing (VE-SDE)
|
| 479 |
+
|
| 480 |
+
Require: $\mathbf { x } ^ { ( g ) }$ (guide), $t _ { 0 }$ (SDE hyper-parameter), $N$ (total denoising steps), $K$ (total repeats) $\begin{array} { r } { \dot { \Delta { t } } \frac { { t } _ { 0 } } { N } } \end{array}$ for $k \gets 1$ to $K$ do $\mathbf { z } \sim \mathcal { N } ( \mathbf { 0 } , I )$ $\mathbf { x } \mathbf { x } + \sigma ( t _ { 0 } ) \mathbf { z }$ for $n \gets N$ to 1 do t ← t0 nN z ∼ N (0, I) ϵ ← pσ2(t) − σ2(t − ∆t) x ← x + ϵ2sθ(x, t) + ϵz end for end for Return x
|
| 481 |
+
|
| 482 |
+
Require: $\mathbf { x } ^ { ( g ) }$ (guide), $\pmb { \Omega }$ (mask for edited regions), $t _ { 0 }$ (SDE hyper-parameter), $N$ (total denoising steps), $K$ (total repeats) $\begin{array} { r } { \Delta i \dot { } \frac { t _ { 0 } } { N } } \end{array}$ x0 ← x for $k \gets 1$ to $K$ do $\mathbf { z } \sim \mathcal { N } ( \mathbf { 0 } , I )$ $\mathbf { x } \gets ( \mathbf { 1 } - \pmb { \Omega } ) \odot \mathbf { x } _ { 0 } + \pmb { \Omega } \odot \mathbf { x } + \sigma ( t _ { 0 } ) \mathbf { z }$ for $n \gets N$ to 1 do t ← t0 nN z ∼ N (0, I) $\epsilon \sqrt { \sigma ^ { 2 } ( t ) - \sigma ^ { 2 } ( t - \Delta t ) }$ x ← (1 − Ω) ⊙ (x0 + σ(t)z) + Ω ⊙ (x + ϵ2sθ(x, t) + ϵz) end for end for Return x
|
| 483 |
+
|
| 484 |
+
# Algorithm 4 Guided image synthesis and editing (VP-SDE)
|
| 485 |
+
|
| 486 |
+
R $\mathbf { x } ^ { ( g ) }$ (guide), $t _ { 0 }$ (SDE hyper-parameter), $N$ (total denoising steps), $K$ (total repeats)
|
| 487 |
+
$\begin{array} { r } { \dot { \Delta { t } } \frac { { t } _ { 0 } } { N } } \end{array}$
|
| 488 |
+
$\begin{array} { r } { \alpha ( t _ { 0 } ) \stackrel { - } { } \prod _ { n = 1 } ^ { N } ( 1 - \beta ( \frac { n t _ { 0 } } { N } ) \Delta t ) } \end{array}$
|
| 489 |
+
for $k \gets 1$ to $K$ do z ∼ N (0, I) $\mathbf { x } \gets \sqrt { \alpha ( t _ { 0 } ) } \mathbf { x } + \sqrt { 1 - \alpha ( t _ { 0 } ) } \mathbf { z }$ for $n \gets N$ to 1 do t ← t0 nN z ∼ N (0, I) x ← √ 11−β(t)∆t (x + β(t)∆tsθ(x, t)) + pβ(t)∆t z end for
|
| 490 |
+
end for
|
| 491 |
+
Return x
|
| 492 |
+
|
| 493 |
+
$$
|
| 494 |
+
\begin{array} { r l } & { \mathbf { x _ { 0 } } ^ { * } < \mathbf { x } } \\ & { { \boldsymbol { \alpha } } ( t _ { 0 } ) { \boldsymbol { \epsilon } } - \prod _ { i = 1 } ^ { N } ( 1 - \beta ( \frac { \mathrm { i } t _ { 0 } } { N } ) \Delta t ) } \\ & { \mathrm { f o r } k 1 \mathbf { t _ { 0 } } K \mathbf { d _ { 0 } } } \\ & { \mathbf { z } \sim \mathcal { N } ( \mathbf { 0 } , T ) } \\ & { \mathbf { x } [ ( 1 - \Omega ) \odot \sqrt { \alpha ( l _ { 0 } ) } \mathbf { x } _ { 0 } + \Omega \odot \sqrt { \alpha ( l _ { 0 } ) } \mathbf { x } + \sqrt { 1 - \alpha ( l _ { 0 } ) } \mathbf { z } ] } \\ & { \mathbf { f o r } n \neq - N \mathbf { t _ { 0 } } \mathbf { \epsilon } \mathbf { u _ { 0 } } } \\ & { \mathbf { \epsilon } t t _ { 0 } \frac { N } { N } } \\ & { \mathbf { z } \sim \mathcal { N } ( 0 , T ) } \\ & { { \boldsymbol { \alpha } } ( t ) \prod _ { i = 1 } ^ { N } ( 1 - \beta ( \frac { \mathrm { i } t _ { 0 } } { N } ) \Delta t ) } \\ & { \mathbf { x } \{ ( 1 - \Omega ) \odot ( \sqrt { \alpha ( t ) } \mathbf { x _ { 0 } } + \sqrt { 1 - \alpha ( t ) } \mathbf { z } ) + \Omega \odot [ \frac { 1 } { \sqrt { 1 - \beta ( t ) \Delta t } } ( \mathbf { x } + \beta ( t ) \Delta t s _ { \theta } ( \mathbf { x } , t ) ) + } \\ & { \sqrt { \beta ( t ) \Delta t } \mathbf { z } ] \} } \end{array}
|
| 495 |
+
$$
|
| 496 |
+
|
| 497 |
+
# D EXPERIMENTAL SETTINGS
|
| 498 |
+
|
| 499 |
+
# D.1 IMPLEMENTATION DETAILS
|
| 500 |
+
|
| 501 |
+
Below, we add additional implementation details for each application. We use publicly available pretrained SDE checkpoints provided by Song et al.; Ho et al.; Dhariwal & Nichol. Our code will be publicly available upon publication.
|
| 502 |
+
|
| 503 |
+
Stroke-based image synthesis. In this experiment, we use $K = 1 , N = 5 0 0 , t _ { 0 } = 0 . 5$ , for SDEdit (VP). We find that $K = 1$ to 3 work reasonably well, with larger $K$ generating more realistic images but at a higher computational cost.
|
| 504 |
+
|
| 505 |
+
For StyleGAN2-ADA, in-domain GAN and $\mathtt { e 4 e }$ , we use the official implementation with default parameters to project each input image into the latent space, and subsequently use the obtained latent code to produce stroke-based image samples.
|
| 506 |
+
|
| 507 |
+
Stroke-based image editing. We use $K = 1$ in the experiment for SDEdit (VP). We use $t _ { 0 } = 0 . 5$ , $N = 5 0 0$ for SDEdit (VP), and $t _ { 0 } = 0 . 4 5$ , $N = 1 0 0 0$ for SDEdit (VE).
|
| 508 |
+
|
| 509 |
+
Image compositing. We use CelebA-HQ $2 5 6 \times 2 5 6 )$ (Karras et al., 2017) for image compositing experiments. More specifically, given an image from CelebA-HQ, the user will copy pixel patches from other reference images, and also specify the pixels they want to perform modifications, which will be used as the mask in Algorithm 3. In general, the masks are simply the pixels the users have copied pixel patches to. We focus on editing hairstyles and adding glasses. We use an SDEdit model pretrained on FFHQ (Karras et al., 2019). We use $t _ { 0 } = 0 . 3 5$ , $N = 7 0 0$ , $K = 1$ for SDEdit (VE). We present more results in Appendix E.2.
|
| 510 |
+
|
| 511 |
+
# D.2 SYNTHESIZING STROKE PAINTING
|
| 512 |
+
|
| 513 |
+
Human-stroke-simulation algorithm We design a human-stroke-simulation algorithm in order to perform large scale quantitative analysis on stroke-based generation. Given a $2 5 6 \times 2 5 6$ image, we first apply a median filter with kernel size 23 to the image, then reduce the number of colors to 6 using the adaptive palette. We use this algorithm on the validation set of LSUN bedroom and LSUN church outdoor, and subset of randomly selected 6000 images in the CelebA $( 2 5 6 \times 2 5 6 )$ ) test set to produce the stroke painting inputs for Fig. 3a, Table 2 and Table 5. Additionally Fig. 30, Fig. 31 and Fig. 32 show examples of the ground truth images, synthetic stroke paintings, and the corresponding generated images by SDEdit. The simulated stroke paintings resemble the ones drawn by humans and SDEdit is able to generate high quality images based on this synthetic input, while the baselines fail to obtain comparable results.
|
| 514 |
+
|
| 515 |
+
KID evaluation KID is calculated between the real image from the validation set and the generated images using synthetic stroke paintings (based on the validation set), and the squared $L _ { 2 }$ distance is calculated between the simulated stroke paintings and the generated images.
|
| 516 |
+
|
| 517 |
+
Realism-faithfulness trade-off To search for the sweet spot for realism-faithfulness trade-off as presented in Figure 3a, we select 0.01 and every 0.1 interval from 0.1 to 1 for $t _ { 0 }$ and generate images for the LSUN church outdoor dataset. We apply the human-stroke-simulation algorithm on the original LSUN church outdoor validation set and generate one stroke painting per image to produce the same input stroke paintings for all choices of $t _ { 0 }$ . As shown in Figure 33, this algorithm is sufficient to simulate human stroke painting and we can also observe the realism-faithfulness trade-off given the same stroke input. KID is calculated between the real image from the validation set and the generated images, and the squared $L _ { 2 }$ distance is calculated between the simulated stroke paintings and the generated images.
|
| 518 |
+
|
| 519 |
+
# D.3 TRAINING AND INFERENCE TIME
|
| 520 |
+
|
| 521 |
+
We use open source pretrained SDE models provided by Song et al.; Ho et al.; Dhariwal & Nichol. In general, VP and VE have comparable speeds, and can be slower than encoder-based GAN inversion methods. For scribble-based generation on $2 5 6 \times 2 5 6$ images, SDEdit takes 29.1s to generate one image on one 2080Ti GPU. In comparison, StyleGAN2-ADA (Karras et al., 2020a) takes around 72.8s and In-domain GAN 2 (Zhu et al., 2020a) takes 5.2s using the same device and setting. We note that our speed is in general faster than optimization-based GAN inversions while slower than encoder-based GAN inversions. The speed of SDEdit could be improved by recent works on faster SDE sampling.
|
| 522 |
+
|
| 523 |
+
# E EXTRA EXPERIMENTAL RESULTS
|
| 524 |
+
|
| 525 |
+
# E.1 EXTRA RESULTS ON LSUN DATASETS
|
| 526 |
+
|
| 527 |
+
Stroke-based image generation. We present more SDEdit (VP) results on LSUN bedroom in Fig. 21. We use $t _ { 0 } = 0 . 5$ , $N = 5 0 0$ , and $K = 1$ . We observe that, SDEdit is able to generate realistic images that share the same structure as the input paintings when no paired data is provided.
|
| 528 |
+
|
| 529 |
+
Stroke-based image editing. We present more SDEdit (VP) results on LSUN bedroom in Fig. 22. SDEdit generates image edits that are both realistic and faithful to the user edit, while avoids making undesired modifications on pixels not specified by users. See Appendix D for experimental settings.
|
| 530 |
+
|
| 531 |
+
# E.2 EXTRA RESULTS ON FACE DATASETS
|
| 532 |
+
|
| 533 |
+
Stroke-based image editing. We provide intermediate step visualizations for SDEdit in Fig. 23. We present extra SDEdit results on CelebA-HQ in Fig. 24. We also presents results on CelebA-HQ $( 1 0 2 4 \times 1 0 2 4 )$ in Fig. 29. SDEdit generates images that are both realistic and faithful (to the user edit), while avoids introducing undesired modifications on pixels not specified by users. We provide experiment settings in Appendix D.
|
| 534 |
+
|
| 535 |
+
Image compositing. We focus on editing hair styles and adding glasses. We present more SDEdit (VE) results on CelebA-HQ $( 2 5 6 \times 2 5 6 )$ in Fig. 25, Fig. 26, and Fig. 27. We also presents results on CelebA-HQ $( 1 0 2 4 \times 1 0 2 4 )$ in Fig. 28. We observe that SDEdit can generate both faithful and realistic edited images. See Appendix D for experiment settings.
|
| 536 |
+
|
| 537 |
+
Attribute classification with stroke-based generation. In order to further evaluate how the models convey user intents with high level user guide, we perform attribute classification on stroke-based generation for human faces. We use the human-stroke-simulation algorithm on a subset of randomly selected 6000 images from CelebA $( 2 5 6 \times 2 5 6 )$ test set to create the stroke inputs, and apply Microsoft Azure Face $\mathrm { A P I ^ { 4 } }$ to detect fine-grained face attributes from the generated images. We choose gender and glasses to conduct binary classification, and hair color to perform multi-class classification on the images. Images where no face is detected will be counted as providing false and to the classification problems. Table 5 shows the classification accuracy, and SDEdit (VP) outperforms all other baselines in all attributes of choice.
|
| 538 |
+
|
| 539 |
+
# .3 CLASS-CONDITIONAL GENERATION WITH STROKE PAINTING
|
| 540 |
+
|
| 541 |
+
In addition to user guide, SDEdit is able to also leverage other auxiliary information and models to obtain further control of the generation. Following Song et al. (2021) and Dhariwal & Nichol (2021), we present an extra experiment on class-conditional generation with SDEdit. Given a timedependent classifier $p _ { t } ( \mathbf { y } \mid \mathbf { x } )$ , for SDEdit (VE) one can solve the reverse SDE:
|
| 542 |
+
|
| 543 |
+
$$
|
| 544 |
+
\mathrm { d } \mathbf { x } ( t ) = \left[ - \frac { \mathrm { d } [ \sigma ^ { 2 } ( t ) ] } { \mathrm { d } t } ( \nabla _ { \mathbf { x } } \log p _ { t } ( \mathbf { x } ) + \nabla _ { \mathbf { x } } \log p _ { t } ( \mathbf { y _ { \tau } } | \mathbf { x } ) ) \right] \mathrm { d } t + \sqrt { \frac { \mathrm { d } [ \sigma ^ { 2 } ( t ) ] } { \mathrm { d } t } } \mathrm { d } \bar { \mathbf { w } }
|
| 545 |
+
$$
|
| 546 |
+
|
| 547 |
+
and use the same sampling procedure defined in Section 3.
|
| 548 |
+
|
| 549 |
+

|
| 550 |
+
Figure 16: Post-processing samples from GANs by masking out undesired changes, yet the artifacts are strong at the boundaries even with blending.
|
| 551 |
+
|
| 552 |
+
<table><tr><td>Methods</td><td>Gender</td><td>Glasses</td><td>Hair - Blond</td><td>Hair- Black</td><td>Hair - Grey</td></tr><tr><td>In-domain GAN 1</td><td>0.5232</td><td>0.6355</td><td>0.5527</td><td>0.5722</td><td>0.5398</td></tr><tr><td>In-domain GAN 2</td><td>0.0202</td><td>0.0273</td><td>0.1806</td><td>0.3158</td><td>0.0253</td></tr><tr><td>StyleGAN2-ADA</td><td>0.0127</td><td>0.0153</td><td>0.1720</td><td>0.3105</td><td>0.0145</td></tr><tr><td>e4e</td><td>0.6175</td><td>0.6623</td><td>0.6731</td><td>0.6510</td><td>0.7233</td></tr><tr><td>SDEdit (ours)</td><td>0.8147</td><td>0.9232</td><td>0.8487</td><td>0.7490</td><td>0.8928</td></tr></table>
|
| 553 |
+
|
| 554 |
+
Table 5: Attribute classification results with simulated stroke inputs on CelebA. SDEdit (VP) outperforms all baseline methods in all attribute selected in the experiment. Details can be found in Appendix E.2.
|
| 555 |
+
|
| 556 |
+
For SDEdit (VP), we follow the class guidance setting in Dhariwal & Nichol (2021) and solve:
|
| 557 |
+
|
| 558 |
+
$$
|
| 559 |
+
\mathsf { c } _ { n - 1 } = \frac { 1 } { \sqrt { 1 - \beta ( t _ { n } ) \Delta t } } ( \mathbf { x } _ { n } + \beta ( t _ { n } ) \Delta t s _ { \theta } ( \mathbf { x } ( t _ { n } ) , t _ { n } ) ) + \beta ( t _ { n } ) \Delta t \nabla _ { \mathbf { x } } \log p _ { t } ( \mathbf { y } \mid \mathbf { x } _ { n } ) + \sqrt { \beta ( t _ { n } ) \Delta t } \mathbf { z } _ { n } ,
|
| 560 |
+
$$
|
| 561 |
+
|
| 562 |
+
Fig. 34 shows the ImageNet $2 5 6 \times 2 5 6 )$ ) class-conditional generation results using SDEdit (VP). Given the same stroke inputs, SDEdit is capable of generating diverse results that are consistent with the input class labels.
|
| 563 |
+
|
| 564 |
+
# E.4 EXTRA DATASETS
|
| 565 |
+
|
| 566 |
+
We present additional stroke-based image synthesis results on LSUN cat and horse dataset for SDEdit (VP). Fig. 35 presents the image generation results based on input stroke paintings with various levels of details. We can observe that SDEdit produce images that are both realistic and faithful to the stroke input on both datasets. Notice that for coarser guide (e.g. the third row in Fig. 35), we choose to slightly sacrifice faithfulness in order to obtain more realistic images by selecting a larger $t _ { 0 } = 0 . 6$ , while all the other images in Fig. 35 are generated with $t _ { 0 } = 0 . 5$ .
|
| 567 |
+
|
| 568 |
+
# E.5 EXTRA RESULTS ON BASELINES
|
| 569 |
+
|
| 570 |
+
SDEdit preserves the un-masked regions automatically, while GANs do not. We tried postprocessing samples from GANs by masking out undesired changes, yet the artifacts are strong at the boundaries. We further tried blending on GANs (GAN blending) with StyleGAN2-ADA, but the artifacts are still distinguishable (see Fig. 16).
|
| 571 |
+
|
| 572 |
+
# F HUMAN EVALUATION
|
| 573 |
+
|
| 574 |
+
# F.1 STROKE-BASED IMAGE GENERATION
|
| 575 |
+
|
| 576 |
+
Specifically, we synthesize a total of 400 bedroom images from stroke paintings for each method. To quantify sample quality, we ask the workers to perform a total of 1500 pairwise comparisons against SDEdit to determine which image sample looks more realistic. Each evaluation HIT contains 15 pairwise comparisons against SDEdit, and we perform 100 such evaluation tasks. The reward per task is kept as $0 . 2 5$ . Since each task takes around 1 min, the wage is around $1 2 \$ 1$ per hour. For each question, the workers will be shown two images: one generated image from SDEdit and the other
|
| 577 |
+
|
| 578 |
+
# About this HIT:
|
| 579 |
+
|
| 580 |
+

|
| 581 |
+
Figure 17: The instruction shown to MTurk workers for pairwise comparison.
|
| 582 |
+
|
| 583 |
+

|
| 584 |
+
Figure 18: The UI shown to MTurk workers for pairwise comparison.
|
| 585 |
+
|
| 586 |
+
from the baseline model using the same input. The instruction is: “Which image do you think is more realistic” (see Fig. 17 and Fig. 18).
|
| 587 |
+
|
| 588 |
+
To quantify user satisfactory score (faithfulness+realism), we ask a different set of workers to perform another 3000 pairwise comparisons against SDEdit. For each question, the workers will be shown three images: the input stroke painting (guide), one generated image from SDEdit based on the stroke input, and the other from the baseline model using the same input. Each evaluation HIT contains 15 pairwise comparisons against SDEdit, and we perform 200 such evaluation tasks. The reward per task is kept as $0 . 2 \mathbb { S }$ . Since each task takes around $1 \ \mathrm { m i n }$ , the wage is around $1 2 \$ 1$ per hour. The instruction is: “Given the input painting, how would you imagine this image to look like in reality? Choose the image that looks more reasonable to you. Your selection should based on how realistic and less blurry the image is, and whether it shares similarities with the input” (see Fig. 19 and Fig. 20).
|
| 589 |
+
|
| 590 |
+

|
| 591 |
+
Figure 19: The instruction shown to MTurk workers for pairwise comparison.
|
| 592 |
+
|
| 593 |
+

|
| 594 |
+
Figure 20: The UI shown to MTurk workers for pairwise comparison.
|
| 595 |
+
|
| 596 |
+
# F.2 IMAGE COMPOSITING ON CELEBA-HQ
|
| 597 |
+
|
| 598 |
+
To quantitatively evaluate our results, we generate 936 images based on the user inputs. To quantify realism, we ask MTurk workers to perform 1500 pairwise comparisons against SDEdit pre-trained on FFHQ (Karras et al., 2019) to determine which image sample looks more realistic. Each evaluation HIT contains 15 pairwise comparisons against SDEdit, and we perform 100 such evaluation tasks. The reward per task is kept as $0 . 2 \mathbb { S }$ . Since each task takes around $1 \ \mathrm { m i n }$ , the wage is around $1 2 \$ 1$ per hour. For each question, the workers will be shown two images: one generated image from SDEdit and the other from the baseline model using the same input. The instruction is: “Which image do you think was more realistic?”.
|
| 599 |
+
|
| 600 |
+
To quantify user satisfactory score (faithfulness $^ +$ realism), we ask different workers to perform another 1500 pairwise comparisons against SDEdit pre-trained on FFHQ to decide which generated image matches the content of the inputs more faithfully. Each evaluation HIT contains 15 pairwise comparisons against SDEdit, and we perform 100 such evaluation tasks. The reward per task is kept as $0 . 2 5$ . Since each task takes around $1 \ \mathrm { m i n }$ , the wage is around $1 2 \$ 1$ per hour. For each question, the workers will be shown two images: one generated image from SDEdit and the other from the baseline model using the same input. The instruction is: “Which is a better polished image for the input? An ideal polished image should look realistic, and matches the input in visual appearance (e.g., they look like the same person, with matched hairstyles and similar glasses)”.
|
| 601 |
+
|
| 602 |
+

|
| 603 |
+
Figure 21: Stroke-based image generation on bedroom images with SDEdit (VP) pretrained on LSUN bedroom.
|
| 604 |
+
|
| 605 |
+

|
| 606 |
+
Figure 22: Stroke-based image editing on bedroom images with SDEdit (VP) pretrained on LSUN bedroom. SDEdit generates image edits that are both realistic and faithful (to the user edit), while avoids making undesired modifications on pixels not specified by users
|
| 607 |
+
|
| 608 |
+

|
| 609 |
+
Figure 23: Stroke-based image editing. (a) Given an image, users will first modify the image using stroke, and provide a mask which describes the pixels covered by stroke. (b) The edited image will then be fed into SDEdit. SDEdit will first perturb the image with an SDE, and then simulate the reverse SDE (see Algorithm 5). (c) We provide visualization of the intermediate steps of reversing SDE used in SDEdit.
|
| 610 |
+
|
| 611 |
+

|
| 612 |
+
Figure 24: Stroke-based image editing on CelebA-HQ images with SDEdit. SDEdit generates image edits that are both realistic and faithful (to the user edit), while avoids making undesired modifications on pixels not specified by users.
|
| 613 |
+
|
| 614 |
+

|
| 615 |
+
Figure 25: Image compositing on CelebA-HQ images with SDEdit. We edit the images to have brown hair. The model is pretrained on FFHQ.
|
| 616 |
+
|
| 617 |
+

|
| 618 |
+
Figure 26: Image compositing on CelebA-HQ images with SDEdit. We edit the images to wear glasses. The model is pretrained on FFHQ.
|
| 619 |
+
|
| 620 |
+

|
| 621 |
+
Figure 27: Image compositing on CelebA-HQ images with SDEdit. We edit the images to have blond hair. The model is pretrained on FFHQ.
|
| 622 |
+
|
| 623 |
+

|
| 624 |
+
Figure 28: Image compositing results with SDEdit (VE) on CelebA-HQ (resolution $1 0 2 4 \times 1 0 2 4 ,$ . The SDE model is pretrained on FFHQ.
|
| 625 |
+
|
| 626 |
+

|
| 627 |
+
Figure 29: Stroke-based image editing results with SDEdit (VE) on CelebA-HQ (resolution $1 0 2 4 \times 1 0 2 4 ,$ ). The SDE model is pretrained on FFHQ.
|
| 628 |
+
|
| 629 |
+

|
| 630 |
+
Figure 30: Stroke-based image generation with simulated stroke paintings inputs on bedroom images with SDEdit (VP) pretrained on LSUN bedroom dataset.
|
| 631 |
+
|
| 632 |
+

|
| 633 |
+
Figure 31: Stroke-based image generation with simulated stroke paintings inputs on church images with SDEdit (VP) pretrained on LSUN church outdoor dataset.
|
| 634 |
+
|
| 635 |
+

|
| 636 |
+
Figure 32: Stroke-based image generation with simulated stroke paintings inputs on human face images with SDEdit (VP) pretrained on CelebA dataset.
|
| 637 |
+
|
| 638 |
+

|
| 639 |
+
Figure 33: Trade-off between faithfulness and realism shown with stroke-based image generation with simulated stroke painting inputs on church images with SDEdit (VP) pretrained on LSUN church outdoor dataset.
|
| 640 |
+
|
| 641 |
+

|
| 642 |
+
Figure 34: Class-conditional image generation from stroke paintings with different class labels by SDEdit (VP) pretrained on ImageNet.
|
| 643 |
+
|
| 644 |
+

|
| 645 |
+
Figure 35: Stroke-based image generation with stroke inputs on cat and horse images with SDEdit (VP) pretrained on LSUN cat and horse dataset. Notice that for coarser guide (e.g. the third row), we choose to slightly sacrifice faithfulness in order to obtain more realistic images by selecting a larger $t _ { 0 } = 0 . 6$ , while all the other images are generated with $t _ { 0 } = 0 . 5$ .
|
md/dev/e2TBb5y0yFf/e2TBb5y0yFf.md
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Large Language Models are Zero-Shot Reasoners
|
| 2 |
+
|
| 3 |
+
Takeshi Kojima The University of Tokyo t.kojima@weblab.t.u-tokyo.ac.jp
|
| 4 |
+
|
| 5 |
+
Shixiang Shane Gu Google Research, Brain Team
|
| 6 |
+
|
| 7 |
+
Machel Reid Google Research∗
|
| 8 |
+
|
| 9 |
+
Yutaka Matsuo The University of Tokyo
|
| 10 |
+
|
| 11 |
+
Yusuke Iwasawa The University of Tokyo
|
| 12 |
+
|
| 13 |
+
# Abstract
|
| 14 |
+
|
| 15 |
+
Pretrained large language models (LLMs) are widely used in many sub-fields of natural language processing (NLP) and generally known as excellent few-shot learners with task-specific exemplars. Notably, chain of thought (CoT) prompting, a recent technique for eliciting complex multi-step reasoning through step-bystep answer examples, achieved the state-of-the-art performances in arithmetics and symbolic reasoning, difficult system-2 tasks that do not follow the standard scaling laws for LLMs. While these successes are often attributed to LLMs’ ability for few-shot learning, we show that LLMs are decent zero-shot reasoners by simply adding “Let’s think step by step” before each answer. Experimental results demonstrate that our Zero-shot-CoT, using the same single prompt template, significantly outperforms zero-shot LLM performances on diverse benchmark reasoning tasks including arithmetics (MultiArith, GSM8K, AQUA-RAT, SVAMP), symbolic reasoning (Last Letter, Coin Flip), and other logical reasoning tasks (Date Understanding, Tracking Shuffled Objects), without any hand-crafted few-shot examples, e.g. increasing the accuracy on MultiArith from $1 7 . 7 \%$ to $78 . 7 \%$ and GSM8K from $1 0 . 4 \%$ to $4 0 . 7 \%$ with large-scale InstructGPT model (text-davinci002), as well as similar magnitudes of improvements with another off-the-shelf large model, 540B parameter PaLM. The versatility of this single prompt across very diverse reasoning tasks hints at untapped and understudied fundamental zero-shot capabilities of LLMs, suggesting high-level, multi-task broad cognitive capabilities may be extracted by simple prompting. We hope our work not only serves as the minimal strongest zero-shot baseline for the challenging reasoning benchmarks, but also highlights the importance of carefully exploring and analyzing the enormous zero-shot knowledge hidden inside LLMs before crafting finetuning datasets or few-shot exemplars.
|
| 16 |
+
|
| 17 |
+
# 1 Introduction
|
| 18 |
+
|
| 19 |
+
Scaling up the size of language models has been key ingredients of recent revolutions in natural language processing (NLP) [Vaswani et al., 2017, Devlin et al., 2019, Raffel et al., 2020, Brown et al., 2020, Thoppilan et al., 2022, Rae et al., 2021, Chowdhery et al., 2022]. The success of large language models (LLMs) is often attributed to (in-context) few-shot or zero-shot learning. It can solve various tasks by simply conditioning the models on a few examples (few-shot) or instructions describing the task (zero-shot). The method of conditioning the language model is called “prompting” [Liu et al., 2021b], and designing prompts either manually [Schick and Schütze, 2021, Reynolds and McDonell, 2021] or automatically [Gao et al., 2021, Shin et al., 2020] has become a hot topic in NLP.
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Example inputs and outputs of GPT-3 with (a) standard Few-shot ([Brown et al., 2020]), (b) Few-shot-CoT ([Wei et al., 2022]), (c) standard Zero-shot, and (d) ours (Zero-shot-CoT). Similar to Few-shot-CoT, Zero-shot-CoT facilitates multi-step reasoning (blue text) and reach correct answer where standard prompting fails. Unlike Few-shot-CoT using step-by-step reasoning examples per task, ours does not need any examples and just uses the same prompt “Let’s think step by step” across all tasks (arithmetic, symbolic, commonsense, and other logical reasoning tasks).
|
| 23 |
+
|
| 24 |
+
In contrast to the excellent performance of LLMs in intuitive and single-step system-1 [Stanovich and West, 2000] tasks with task-specific few-shot or zero-shot prompting [Liu et al., 2021b], even language models at the scale of 100B or more parameters had struggled on system-2 tasks requiring slow and multi-step reasoning [Rae et al., 2021]. To address this shortcoming, Wei et al. [2022], Wang et al. [2022] have proposed chain of thought prompting (CoT), which feed LLMs with the step-by-step reasoning examples rather than standard question and answer examples (see Fig. 1-a). Such chain of thought demonstrations facilitate models to generate a reasoning path that decomposes the complex reasoning into multiple easier steps. Notably with CoT, the reasoning performance then satisfies the scaling laws better and jumps up with the size of the language models. For example, when combined with the 540B parameter PaLM model [Chowdhery et al., 2022], chain of thought prompting significantly increases the performance over standard few-shot prompting across several benchmark reasoning tasks, e.g., GSM8K $( 1 7 . 9 \% \to 5 8 . 1 \%$ .
|
| 25 |
+
|
| 26 |
+
While the successes of CoT prompting [Wei et al., 2022], along those of many other task-specific prompting work [Gao et al., 2021, Schick and Schütze, 2021, Liu et al., 2021b], are often attributed to LLMs’ ability for few-shot learning [Brown et al., 2020], we show that LLMs are decent zero-shot reasoners by adding a simple prompt, Let’s think step by step, to facilitate step-by-step thinking before answering each question (see Figure 1). Despite the simplicity, our Zero-shot-CoT successfully generates a plausible reasoning path in a zero-shot manner and reaches the correct answer in a problem where the standard zero-shot approach fails. Importantly, our Zero-shot-CoT is versatile and task-agnostic, unlike most prior task-specific prompt engineering in the forms of examples (few-shot) or templates (zero-shot) [Liu et al., 2021b]: it can facilitate step-by-step answers across various reasoning tasks, including arithmetic (MultiArith [Roy and Roth, 2015], GSM8K [Cobbe et al., 2021], AQUA-RAT [Ling et al., 2017], and SVAMP [Patel et al., 2021]), symbolic reasoning (Last letter and Coin flip), commonsense reasoning (CommonSenseQA [Talmor et al., 2019] and Strategy QA [Geva et al., 2021]), and other logical reasoning tasks (Date understanding and Tracking Shuffled Objects from BIG-bench [Srivastava et al., 2022]) without modifying the prompt per task.
|
| 27 |
+
|
| 28 |
+
We empirically evaluate Zero-shot-CoT against other prompting baselines in Table 2. While our Zero-shot-CoT underperforms Few-shot-CoT with carefully-crafted and task-specific step-by-step examples, Zero-shot-CoT achieves enormous score gains compared to the zero-shot baseline, e.g. from $1 7 . 7 \%$ to $78 . 7 \%$ on MultiArith and from $1 0 . 4 \%$ to $4 0 . 7 \%$ on GSM8K with large-scale InstructGPT model (text-davinci-002). We also evaluate Zero-shot-CoT with another off-the-shelf large model, 540B parameter PaLM, showing similar magnitudes of improvements on MultiArith and GSM8K. Importantly, with our single fixed prompt, zero-shot LLMs have a significantly better scaling curve comparable to that of the few-shot CoT baseline. We also show that besides Few-shot-CoT requiring human engineering of multi-step reasoning prompts, their performance deteriorates if prompt example question types and task question type are unmatched, suggesting high sensitivity to per-task prompt designs. In contrast, the versatility of this single prompt across diverse reasoning tasks hints at untapped and understudied zero-shot fundamental capabilities of LLMs, such as higher-level broad cognitive capabilities like generic logical reasoning [Chollet, 2019]. While the vibrant field of LLMs started out from the premise of excellent few-shot learners [Brown et al., 2020], we hope our work encourages more research into uncovering high-level and multi-task zero-shot capabilities hidden inside those models.
|
| 29 |
+
|
| 30 |
+
# 2 Background
|
| 31 |
+
|
| 32 |
+
We briefly review the two core preliminary concepts that form the basis of this work: the advent of large language models (LLMs) and prompting, and chain of thought (CoT) prompting for multi-step reasoning.
|
| 33 |
+
|
| 34 |
+
Large language models and prompting A language model (LM), is a model that looks to estimate the probability distribution over text. Recently, scaling improvements through larger model sizes (from a few million [Merity et al., 2016] to hundreds of millions [Devlin et al., 2019] to hundreds of billions [Brown et al., 2020] parameters) and larger data (e.g. webtext corpora [Gao et al., 2020]) have enabled pre-trained large language models (LLMs) to be incredibly adept at many downstream NLP tasks. Besides the classic “pre-train and fine-tune” paradigm [Liu et al., 2021b], models scaled to $1 0 0 \mathrm { B } +$ parameters exhibit properties conducive to few-shot learning [Brown et al., 2020], by way of in context learning, where one can use a text or template known as a prompt to strongly guide the generation to output answers for desired tasks, thus beginning an era of “pre-train and prompt” [Liu et al., 2021a]. In work, we call such prompts with explicit conditioning on few task examples as few-shot prompts, and other template-only prompts as zero-shot prompts.
|
| 35 |
+
|
| 36 |
+
Chain of thought prompting Multi-step arithmetic and logical reasoning benchmarks have particularly challenged the scaling laws of large language models [Rae et al., 2021]. Chain of thought (CoT) prompting [Wei et al., 2022], an instance of few-shot prompting, proposed a simple solution by modifying the answers in few-shot examples to step-by-step answers, and achieved significant boosts in performance across these difficult benchmarks, especially when combined with very large language models like PaLM [Chowdhery et al., 2022]. The top row of Figure 1 shows standard few-shot prompting against (few-shot) CoT prompting. Notably, few-shot learning was taken as a given for tackling such difficult tasks, and the zero-shot baseline performances were not even reported in the original work [Wei et al., 2022]. To differentiate it from our method, we call Wei et al. [2022] as Few-shot-CoT in this work.
|
| 37 |
+
|
| 38 |
+
# 3 Zero-shot Chain of Thought
|
| 39 |
+
|
| 40 |
+
We propose Zero-shot-CoT, a zero-shot template-based prompting for chain of thought reasoning. It differs from the original chain of thought prompting [Wei et al., 2022] as it does not require step-by-step few-shot examples, and it differs from most of the prior template prompting [Liu et al., 2021b] as it is inherently task-agnostic and elicits multi-hop reasoning across a wide range of tasks with a single template. The core idea of our method is simple, as described in Figure 1: add Let’s think step by step, or a a similar text (see Table 4), to extract step-by-step reasoning.
|
| 41 |
+
|
| 42 |
+
# 3.1 Two-stage prompting
|
| 43 |
+
|
| 44 |
+
While Zero-shot-CoT is conceptually simple, it uses prompting twice to extract both reasoning and answer, as explained in Figure 2. In contrast, the zero-shot baseline (see the bottom-left in Figure 1) already uses prompting in the form of “The answer is”, to extract the answers in correct formats. Few-shot prompting, standard or CoT, avoids needing such answer-extraction prompting by explicitly designing the few-shot example answers to end in such formats (see the top-right and top-left in Figure 1). In summary, Few-shot-CoT [Wei et al., 2022] requires careful human engineering of a few prompt examples with specific answer formats per task, while Zero-shot-CoT requires less engineering but requires prompting LLMs twice.
|
| 45 |
+
|
| 46 |
+

|
| 47 |
+
Figure 2: Full pipeline of Zero-shot-CoT as described in $\ S 3$ : we first use the first “reasoning” prompt to extract a full reasoning path from a language model, and then use the second “answer” prompt to extract the answer in the correct format from the reasoning text.
|
| 48 |
+
|
| 49 |
+
1st prompt: reasoning extraction In this step we first modify the input question x into a prompt $\mathbf { x } ^ { \prime }$ using a simple template “Q: [X]. A: [T]”, where [X] is an input slot for $\mathbf { x }$ and [T] is an slot for hand-crafted trigger sentence t that would extract chain of though to answer the question x. For example, if we use “Let’s think step by step” as a trigger sentence, the prompt $\mathbf { x } ^ { \prime }$ would be “Q: [X]. A: Let’s think step by step.”. See Table 4 for more trigger examples. Prompted text $\mathbf { x } ^ { \prime }$ is then fed into a language model and generate subsequent sentence z. We can use any decoding strategy, but we used greedy decoding throughout the paper for the simplicity.
|
| 50 |
+
|
| 51 |
+
2nd prompt: answer extraction In the second step, we use generated sentence $\mathbf { z }$ along with prompted sentence $\mathbf { x } ^ { \prime }$ to extract the final answer from the language model. To be concrete, we simply concatenate three elements as with $^ { 6 6 } [ \mathbb { X } ^ { \prime } ]$ [Z] [A]”: $[ \mathbb { X } ^ { \prime } ]$ for 1st prompt $\mathbf { x } ^ { \prime }$ , [Z] for sentence $\mathbf { z }$ generated at the first step, and [A] for a trigger sentence to extract answer. The prompt for this step is self-augmented, since the prompt contains the sentence $\mathbf { z }$ generated by the same language model. In experiment, we use slightly different answer trigger depending on the answer format. For example, we use “Therefore, among A through E, the answer is” for multi-choice QA, and “Therefore, the answer (arabic numerals) is” for math problem requiring numerical answer. See Appendix A.5 for the lists of answer trigger sentences. Finally, the language model is fed the prompted text as input to generate sentences $\hat { \mathbf { y } }$ and parse the final answer. See “Answer Cleansing” at $\ S 4$ for the parser details.
|
| 52 |
+
|
| 53 |
+
# 4 Experiment
|
| 54 |
+
|
| 55 |
+
Tasks and datasets We evaluate our proposal on 12 datasets from four categories of reasoning tasks: arithmetic, commonsense, symbolic, and other logical reasoning tasks. See Appendix A.2 for the detailed description of each datasets.
|
| 56 |
+
|
| 57 |
+
For arithmetic reasoning, we consider the following six datasets: (1) SingleEq [Koncel-Kedziorski et al., 2015], (2) AddSub [Hosseini et al., 2014], (3) MultiArith [Roy and Roth, 2015], (4) AQUARAT [Ling et al., 2017], (5) GSM8K [Cobbe et al., 2021], and (6) SVAMP [Patel et al., 2021]. The first three are from the classic Math World Problem Repository [Koncel-Kedziorski et al., 2016], and the last three are from more recent benchmarks. SingleEq and AddSub contain easier problems, which do not require multi-step calculation to solve the tasks. MultiArith, AQUA-RAT, GSM8k, and SVAMP are more challenging datasets that require multi-step reasoning to solve.
|
| 58 |
+
|
| 59 |
+
For commonsense reasoning, we use CommonsenseQA [Talmor et al., 2019] and StrategyQA [Geva et al., 2021]. CommonsenseQA asks questions with complex semantics that often require reasoning based on prior knowledge [Talmor et al., 2019]. StrategyQA requires models to infer an implicit multi-hop reasoning to answer questions [Geva et al., 2021].
|
| 60 |
+
|
| 61 |
+
For symbolic reasoning, we use Last Letter Concatenation and Coin Flip [Wei et al., 2022]. Last letter Concatenation asks the model to concatenate the last letters of each word. We used randomly selected four names for each sample. Coin Flip asks the model to answer whether a coin is still heads up after people either flip or do not flip the coin. We created samples of four times flip or not flip trials. Although these tasks are easy for humans, LMs typically exhibit a flat scaling curve.
|
| 62 |
+
|
| 63 |
+
For other logical reasoning tasks, we choose two evaluation sets from the BIG-bench effort [Srivastava et al., 2022]: Date Understanding 2 and Tracking Shuffled Objects. Date Understanding asks models to infer the date from a context. Tracking Shuffled Objects tests a model’s ability to infer the final state of objects given its initial state and a sequence of object shuffling. We used a dataset of tracking three shuffled objects for our experiment.
|
| 64 |
+
|
| 65 |
+
Models We experiment with 17 models in total. Main experiments are conducted with InstructGPT3 [Ouyang et al., 2022] (text-ada/babbage/curie/davinci-001 and text-davinci-002)3, original GPT3 [Brown et al., 2020] (ada, babbage, curie, and davinci)4, and PaLM [Chowdhery et al., 2022] (8B, 62B, and 540B). In addition, we used GPT-2[Radford et al., 2019], GPT-Neo[Black et al., 2021], GPT-J[Wang and Komatsuzaki, 2021], T0 [Sanh et al., 2022], and OPT [Zhang et al., 2022] for model scaling study. The size of LMs ranges from 0.3B to 540B. We include both standard (e.g. GPT-3 and OPT), and instruction following variants (e.g. Instruct-GPT3 and T0). See Appendix A.3 for model description details. Unless otherwise stated, we use text-davinci-002 throughout the experiments.
|
| 66 |
+
|
| 67 |
+
Baselines We compare our Zero-shot-CoT mainly to standard Zero-shot prompting to verify the effectiveness of its chain of thought reasoning. For Zero-shot experiments, similar answer prompts as Zero-shot-CoT are used as default. See Appendix A.5 for detail. To better evaluate the zero-shot ability of LLMs on reasoning tasks, we also compare our method to Few-shot and Few-shot-CoT baselines from [Wei et al., 2022], using the same in-context examples. Throughout the experiments, we use greedy decoding across all the methods. For the zero-shot approaches, the results are therefore deterministic. For the few-shot approaches, since the order of in-context examples could affect the results [Lu et al., 2022], we run each experiment only once with a fixed seed across all methods and datasets, for fair comparisons with the zero-shot methods. Wei et al. [2022] showed that the order of examples did not cause large variance in CoT experiments.
|
| 68 |
+
|
| 69 |
+
Answer cleansing After the model outputs a text by answer extraction (see $\ S \ O 3$ and Figure 2), our method picks up only the part of the answer text that first satisfies the answer format. For example, if the answer prompting outputs “probably 375 and $3 7 6 ^ { \circ }$ on arithmetic tasks, we extract the first number $\mathbf { \bar { \Psi } } ^ { 6 6 } 3 7 5 ^ { , 9 }$ and set it as the model prediction. In the case of multiple-choice, the first large letter we encounter is set as the prediction. See Appendix A.6 for more detail. Standard Zero-shot method follows the same idea. For Few-shot and Few-shot-CoT methods, we follow [Wang et al., 2022] and first extract the answer text after "The answer is " from the model output, and apply the same answer cleansing to parse the answer text. If “The answer is” is not found in the model output, we search from the back of the text and set the first text that satisfies the answer format as the prediction.
|
| 70 |
+
|
| 71 |
+
# 4.1 Results
|
| 72 |
+
|
| 73 |
+
Zero-shot-CoT vs. Zero-shot Table 1 summarize accuracy of our method (Zero-shot-CoT) and standard zero-shot prompting (Zero-shot) for each dataset. Zero-shot-CoT substantially outperforms four out of six arithmetic reasoning tasks (MultiArith, GSM8K, AQUA, SVAMP), all symbolic reasoning, and all other logical reasoning tasks (from BIG-bench [Srivastava et al., 2022]). For example, Zero-shot-CoT achieves score gains from $1 7 . 7 \%$ to $78 . 7 \%$ on MultiArith and from $1 0 . 4 \%$ to $4 0 . 7 \%$ on GSM8K. Our method gives on-par performances for the remaining two arithmetic reasoning tasks (SingleEq and AddSub), which is expected since they do not require multi-step reasoning.
|
| 74 |
+
|
| 75 |
+
Table 1: Accuracy comparison of Zero-shot-CoT with Zero-shot on each tasks. The values on the left side of each task are the results of using answer extraction prompts depending on answer format as described at $\ S \ O 3$ . The values on the right side are the result of additional experiment where standard answer prompt "The answer is" is used for answer extraction. See Appendix A.5 for detail setups.
|
| 76 |
+
|
| 77 |
+
<table><tr><td rowspan="2"></td><td colspan="6">Arithmetic</td></tr><tr><td>SingleEq</td><td>AddSub</td><td>MultiArith</td><td>GSM8K</td><td>AQUA</td><td>SVAMP</td></tr><tr><td>zero-shot</td><td>74.6/78.7</td><td>72.2/77.0</td><td>17.7/22.7</td><td>10.4/12.5</td><td>22.4/22.4</td><td>58.8/58.7</td></tr><tr><td>zero-shot-cot</td><td>78.0/78.7</td><td>69.6/74.7</td><td>78.7/79.3</td><td>40.7/40.5</td><td>33.5/31.9</td><td>62.1/63.7</td></tr><tr><td rowspan="3"></td><td>Common Sense</td><td></td><td>Other Reasoning Tasks</td><td></td><td></td><td>Symbolic Reasoning</td></tr><tr><td>Common SenseQA</td><td>Strategy QA</td><td>Date Understand</td><td>Shuffled Objects</td><td>Last Letter (4 words)</td><td>Coin Flip (4 times)</td></tr><tr><td>68.8/72.6</td><td>12.7/54.3</td><td>49.3/33.6</td><td>31.3/29.7</td><td>0.2/-</td><td>12.8/53.8</td></tr><tr><td>zero-shot zero-shot-cot</td><td>64.6/64.0</td><td>54.8/52.3</td><td>67.5/61.8</td><td>52.4/52.9</td><td>57.6/-</td><td>91.4/87.8</td></tr></table>
|
| 78 |
+
|
| 79 |
+
Table 2: Comparison with baseline methods using accuracies on MultiArith and GSM8K. text-davinci002 is used as the model if not specified. We used the same 8 examples as described in [Wei et al., 2022] for Few-shot and Few-shot-CoT settings. $( ^ { * } 1 )$ To verify the variance of changing examples, we report two results for 4-shot-cot by splitting the eight examples into two groups. $( ^ { * } 2 )$ We insert “Let’s think step by step.” at the beginning of answer part of each exemplars for Few-shot-CoT to test performance gains. Further experiment results with PaLM are found at Appendix D
|
| 80 |
+
|
| 81 |
+
<table><tr><td></td><td>MultiArith</td><td>GSM8K</td></tr><tr><td>Zero-Shot</td><td>17.7</td><td>10.4</td></tr><tr><td>Few-Shot (2 samples)</td><td>33.7</td><td>15.6</td></tr><tr><td>Few-Shot (8 samples)</td><td>33.8</td><td>15.6</td></tr><tr><td>Zero-Shot-CoT</td><td>78.7</td><td>40.7</td></tr><tr><td>Few-Shot-CoT (2 samples)</td><td>84.8</td><td>41.3</td></tr><tr><td>Few-Shot-CoT (4 samples : First) (*1)</td><td>89.2</td><td>-</td></tr><tr><td>Few-Shot-CoT (4 samples : Second) (*1)</td><td>90.5</td><td>-</td></tr><tr><td>Few-Shot-CoT(8 samples)</td><td>93.0</td><td>48.7</td></tr><tr><td>Zero-Plus-Few-Shot-CoT (8 samples) (*2)</td><td>92.8</td><td>51.5</td></tr><tr><td>Finetuned GPT-3 175B [Wei et al.,2022]</td><td>、</td><td>33</td></tr><tr><td>Finetuned GPT-3 175B + verifier [Wei et al.,2022]</td><td>=</td><td>55</td></tr><tr><td>PaLM 540B: Zero-Shot</td><td>25.5</td><td>12.5</td></tr><tr><td>PaLM 540B: Zero-Shot-CoT</td><td>66.1</td><td>43.0</td></tr><tr><td>PaLM 540B: Zero-Shot-CoT+ self consistency</td><td>89.0</td><td>70.1</td></tr><tr><td>PaLM 540B:Few-Shot [Wei et al.,2022]</td><td>-</td><td>17.9</td></tr><tr><td>PaLM 540B:Few-Shot-CoT[Wei et al.,2022]</td><td></td><td>56.9</td></tr><tr><td>PaLM 540B: Few-Shot-CoT+ self consistency [Wang et al.,2022]</td><td>=</td><td>74.4</td></tr></table>
|
| 82 |
+
|
| 83 |
+
In commonsense reasoning tasks, Zero-shot-CoT does not provide performance gains. It is expected as Wei et al. [2022] also reports that even Few-shot-CoT does not provide performance gains on Lambda (135B), but does improve StrategyQA when combined with substantially larger PaLM (540B) model, which may also apply for ours. More importantly, we observe that many generated chain of thought themselves are surprisingly logically correct or only contains human-understandable mistakes (See Table 3), suggesting that Zero-shot-CoT does elicit for better commonsense reasoning even when the task metrics do not directly reflect it. We provide samples generated by Zero-shot-CoT for each dataset in Appendix B.
|
| 84 |
+
|
| 85 |
+

|
| 86 |
+
Figure 3: Model scale study with various types of models. S: text-ada-001, M: text-babbage-001, L: text-curie-001, XL: text-davinci-002. See Appendix A.3 and E for the detail.
|
| 87 |
+
|
| 88 |
+
Table 3: Examples generated by Zero-Shot-CoT on CommonsenseQA for Error Analysis.
|
| 89 |
+
|
| 90 |
+
<table><tr><td>Example 1 (Reasoning is correct.)</td><td>Example 2 (Model cannot choose only one.)</td></tr><tr><td>Q: Where is a well used toy car likely to be found? Answer Choices: (A) child's room (B) boy's bed- room (C) own home (D) toy store (E) house A: Let's think step by step.A toy car is likely to be found in a child's room.A child's room is likely to be found in a house. Therefore, a toy car is likely to be found in a house. Therefore,among A through E, the answer is E. X (GT : A, Zero-shot: A)</td><td>Q:What would be necessary for getting in shape? Answer Choices: (A) good health (B) exercise (C) muscle tone (D) sweat (E) feel better A: Let's think step by step. In order to get in shape, you need to be able to do three things: 1.Exercise regularly 2.Eat a healthy diet 3.Get enough sleep If you can do all three of those things,then you will</td></tr></table>
|
| 91 |
+
|
| 92 |
+
Comparison with other baselines Table 2 compares the performances on two arithmetic reasoning benchmarks (MultiArith and GSM8K) across Zero-shot-CoT and baselines. The large gap between standard prompting (1st block) and chain of thought prompting (2nd block) suggests that these tasks are difficult without eliciting multi-step reasoning. Major improvements are confirmed on both Instruct GPT-3 (text-davinci-002) and PaLM (540B) models (4th block). While Zero-shot-CoT naturally underperforms Few-shot-CoT, it substantially outperforms standard Few-shot prompting with even 8 examples per task. For GSM8K, Zero-shot-CoT with Instruct GPT-3 (text-davinci-002) also outperforms finetuned GPT-3 and standard few-shot prompting with large models (PaLM, 540B), reported in Wei et al. [2022] (3rd and 4th block). See App. D for more experiment results with PaLM.
|
| 93 |
+
|
| 94 |
+
Does model size matter for zero-shot reasoning? Figure 3 compares performance of various language models on MultiArith / GSM8K. Without chain of thought reasoning, the performance does not increase or increases slowly as the model scale is increased, i.e., the curve is mostly flat. In contrast, the performance drastically increases with chain of thought reasoning, as the model size gets bigger, for Original/Instruct GPT-3 and PaLM. When the model size is smaller, chain of thought reasoning is not effective. This result aligns with the few-shot experiment results in Wei et al. [2022]. Appendix E shows extensive experiment results using wider variety of language models, including GPT-2, GPT-Neo, GPT-J, T0, and OPT. We also manually investigated the quality of generated chain of thought, and large-scale models clearly demonstrate better reasoning (See Appendix B for the sampled outputs for each model).
|
| 95 |
+
|
| 96 |
+
Error Analysis To better understand the behavior of Zero-shot-CoT, we manually investigated randomly selected examples generated by Instruct-GPT3 with Zero-shot-CoT prompting. See Appendix C for examples, where some of the observations include: (1) In commonsense reasoning (CommonsenseQA), Zero-shot-CoT often produces flexible and reasonable chain of thought even when the final prediction is not correct. Zero-shot-CoT often output multiple answer choices when the model find it is difficult to narrow it down to one (see Table 3 for examples). (2) In arithmetic reasoning (MultiArith), Zero-shot-CoT and Few-shot-CoT show substantial differences regarding the error patterns. First, Zero-shot-CoT tends to output unnecessary steps of reasoning after getting the correct prediction, which results in changing the prediction to incorrect one. Zero-shot-CoT also sometimes does not start reasoning, just rephrasing the input question. In contrast, Few-shot-CoT tend to fail when generated chain of thought include ternary operation, e.g. $( 3 + 2 ) * 4$ .
|
| 97 |
+
|
| 98 |
+
Table 4: Robustness study against template measured on the MultiArith dataset with text-davinci-002. $( ^ { * } 1 )$ This template is used in Ahn et al. [2022] where a language model is prompted to generate step-by-step actions given a high-level instruction for controlling robotic actions. $( ^ { * } 2 )$ This template is used in Reynolds and McDonell [2021] but is not quantitatively evaluated.
|
| 99 |
+
|
| 100 |
+
<table><tr><td>No.</td><td>Category</td><td>Template</td><td>Accuracy</td></tr><tr><td>1</td><td>instructive</td><td>Let's think step by step.</td><td>78.7</td></tr><tr><td>2</td><td></td><td>First,(*1)</td><td>77.3</td></tr><tr><td>3</td><td></td><td>Let's think about this logically.</td><td>74.5</td></tr><tr><td>4</td><td></td><td>Let's solve this problem by splitting it into steps. (*2)</td><td>72.2</td></tr><tr><td>5</td><td></td><td>Let's be realistic and think step by step.</td><td>70.8</td></tr><tr><td>6</td><td></td><td>Let's think like a detective step by step.</td><td>70.3</td></tr><tr><td>7</td><td></td><td>Let's think</td><td>57.5</td></tr><tr><td>8</td><td></td><td>Before we dive into the answer,</td><td>55.7</td></tr><tr><td>9</td><td></td><td>The answer is after the proof.</td><td>45.7</td></tr><tr><td>10</td><td>misleading</td><td>Don't think. Just feel.</td><td>18.8</td></tr><tr><td>11</td><td></td><td>Let's think step by step but reach an incorrect answer.</td><td>18.7</td></tr><tr><td>12</td><td></td><td>Let's count the number of "a" in the question.</td><td>16.7</td></tr><tr><td>13</td><td></td><td>By using the fact that the earth is round,</td><td>9.3</td></tr><tr><td>14</td><td>irrelevant</td><td>By the way, I found a good restaurant nearby.</td><td>17.5</td></tr><tr><td>15</td><td></td><td>Abrakadabra!</td><td>15.5</td></tr><tr><td>16</td><td></td><td>It's a beautiful day.</td><td>13.1</td></tr><tr><td>1</td><td></td><td>(Zero-shot)</td><td>17.7</td></tr></table>
|
| 101 |
+
|
| 102 |
+
Table 5: Robustness study of Few-shot-CoT against examples. When the examples are from entirely different tasks, the performance generally becomes worse, but when the answer formats are matched (i.e. CommonsenseQA to AQUA-RAT, multiple-choice), the performance loss is less severe. †CommonsenseQA samples are used in this variation
|
| 103 |
+
|
| 104 |
+
<table><tr><td></td><td>Zero-shot</td><td>Few-shot-CoT +</td><td>Zero-shot-CoT</td><td>Few-shot-CoT</td></tr><tr><td>AQUA-RAT</td><td>22.4</td><td>31.9</td><td>33.5</td><td>39.0</td></tr><tr><td>MultiArith</td><td>17.7</td><td>27.0</td><td>78.7</td><td>88.2</td></tr></table>
|
| 105 |
+
|
| 106 |
+
How does prompt selection affect Zero-shot-CoT? We validate the robustness of Zero-shot-CoT against input prompts. Table 4 summarizes performance using 16 different templates with three categories. Specifically, following Webson and Pavlick [2022], the categories include instructive (encourage reasoning), misleading (discourage reasoning or encouraging reasoning but in a wrong way), and irrelevant (nothing to do with reasoning). The results indicate that the performance is improved if the text is written in a way that encourages chain of thought reasoning, i.e., the templates are within "instructive" category. However, the difference in accuracy is significant depending on the sentence. In this experiment, "Let’s think step by step." achieves the best results. Interestingly, it is found that different templates encourage the model to express reasoning quite differently (see Appendix B for sample outputs by each template). In contrast, when we use misleading or irrelevant templates, the performance does not improve. It remains an open question how to automatically create better templates for Zero-shot-CoT.
|
| 107 |
+
|
| 108 |
+
How does prompt selection affect Few-shot-CoT? Table 5 shows the performance of Fewshot-CoT when using examples from different datasets: CommonsenseQA to AQUA-RAT and CommonsenseQA to MultiArith. The domains are different in both cases, but the answer format is the same in the former. Surprisingly, the chain of thought examples from different domains (common sense to arithmetic) but with the same answer (multiple-choice) format provide substantial performance gain over Zero-shot (to AQUA-RAT), measured relative to the possible improvements from Zero-shot-CoT or Few-shot-CoT. In contrast, the performance gain becomes much less when using examples with different answer types (to MultiArith), confirming prior work [Min et al., 2022] that suggests LLMs mostly leverage the few-shot examples to infer the repeated format rather than the task itself in-context. Nevertheless, for both cases the results are worse than Zero-shot-CoT, affirming the importance of task-specific sample engineering in Few-shot-CoT.
|
| 109 |
+
|
| 110 |
+
# 5 Discussion and Related Work
|
| 111 |
+
|
| 112 |
+
Table 6: Summary of related work on arithmetic/commonsense reasoning tasks. Category denotes the training strategy. CoT denotes whether to output chain of thought. Task column lists the tasks that are performed in corresponding papers. AR: Arithmetic Reasoning, CR: Commonsense Reasoning.
|
| 113 |
+
|
| 114 |
+
<table><tr><td>Method</td><td>Category</td><td>CoT</td><td>Task</td><td>Model</td></tr><tr><td>Rajani et al. [2019]</td><td>Fine-Tuning</td><td>√</td><td>CR</td><td>GPT</td></tr><tr><td>Cobbe et al. [2021]</td><td>Fine-Tuning</td><td>√</td><td>AR</td><td>GPT-3</td></tr><tr><td>Zelikman et al. [2022]</td><td>Fine-Tuning</td><td>√</td><td>AR,CR</td><td>GPT-3, etc</td></tr><tr><td>Nye et al. [2022]</td><td>Fine-Tuning5</td><td>√</td><td>AR</td><td>Transformer(Decoder)</td></tr><tr><td>Brown et al. [2020]</td><td>Few/Zero-Shot</td><td></td><td>CR</td><td>GPT-3</td></tr><tr><td>Smith et al. [2022]</td><td>Few/Zero-Shot</td><td></td><td>AR,CR</td><td>MT-NLG</td></tr><tr><td>Rae et al. [2021]</td><td>Few-Shot</td><td></td><td>AR,CR</td><td>Gopher</td></tr><tr><td>Wei et al. [2022]</td><td>Few-Shot</td><td>√</td><td>AR,CR</td><td>PaLM, LaMBDA, GPT-3</td></tr><tr><td>Wang et al. [2022]</td><td>Few-Shot</td><td>√</td><td>AR,CR</td><td>PaLM, etc</td></tr><tr><td>Chowdhery et al. [2022]</td><td>Few-Shot</td><td>√</td><td>AR,CR</td><td>PaLM</td></tr><tr><td>Shwartz et al. [2020]</td><td>Zero-Shot</td><td>√</td><td>CR</td><td>GPT-2, etc</td></tr><tr><td>Reynolds and McDonell [2021]</td><td>Zero-Shot</td><td>√</td><td>AR</td><td>GPT-3</td></tr><tr><td>Zero-shot-CoT(Ours)</td><td>Zero-Shot</td><td>√</td><td>AR,CR</td><td>PaLM, Instruct-GPT3, GPT-3, etc</td></tr></table>
|
| 115 |
+
|
| 116 |
+
Reasoning Ability of LLMs Several studies have shown that pre-trained models usually are not good at reasoning [Brown et al., 2020, Smith et al., 2022, Rae et al., 2021], but its ability can be substantially increased by making them produce step-by-step reasoning, either by fine-tuning [Rajani et al., 2019, Cobbe et al., 2021, Zelikman et al., 2022, Nye et al., 2022] or few-shot prompting [Wei et al., 2022, Wang et al., 2022, Chowdhery et al., 2022] (See Table 6 for summary of related work). Unlike most prior work, we focus on zero-shot prompting and show that a single fixed trigger prompt substantially increases the zero-shot reasoning ability of LLMs across a variety of tasks requiring complex multi-hop thinking (Table 1), especially when the model is scaled up (Figure 3). It also generates reasonable and understandable chain of thought across diverse tasks (Appendix B), even when the final prediction is wrong (Appendix C). Similar to our work, Reynolds and McDonell [2021] demonstrate a prompt, “Let’s solve this problem by splitting it into steps”, would facilitate the multi-step reasoning in a simple arithmetic problem. However, they treated it as a task-specific example and did not evaluate quantitatively on diverse reasoning tasks against baselines. Shwartz et al. [2020] propose to decompose a commonsense question into a series of information seeking question, such as “what is the definition of [X]”. It does not require demonstrations but requires substantial manual prompt engineering per each reasoning task. Our results strongly suggest that LLMs are decent zero-shot reasoners, while prior work [Wei et al., 2022] often emphasize only few-shot learning and task-specific in-context learning, e.g. no zero-shot baselines were reported. Our method does not require time-consuming fine-tuning or expensive sample engineering, and can be combined with any pre-trained LLM, serving as the strongest zero-shot baseline for all reasoning tasks.
|
| 117 |
+
|
| 118 |
+
Zero-shot Abilities of LLMs Radford et al. [2019] show that LLMs have excellent zero-shot abilities in many system-1 tasks, including reading comprehension, translation, and summarization.
|
| 119 |
+
|
| 120 |
+
Sanh et al. [2022], Ouyang et al. [2022] show that such zero-shot abilities of LLMs can be increased by explicitly fine-tuning models to follow instructions. Although these work focus on the zero-shot performances of LLMs, we focus on many system-2 tasks beyond system-1 tasks, considered a grand challenge for LLMs given flat scaling curves. In addition, Zero-shot-CoT is orthogonal to instruction tuning; it increases zero-shot performance for Instruct GPT3, vanilla GPT3, and PaLM (See Figure 3).
|
| 121 |
+
|
| 122 |
+
From Narrow (task-specific) to Broad (multi-task) Prompting Most prompts are task-specific. While few-shot prompts are naturally so due to task-specific in-context samples [Brown et al., 2020, Wei et al., 2022], majority of zero-shot prompts have also focused on per-task engineering (of templates) [Liu et al., 2021b, Reynolds and McDonell, 2021]. Borrowing terminologies from Chollet [2019] which builds on hierarchical models of intelligence [McGrew, 2005, Johnson and Bouchard Jr, 2005], these prompts are arguably eliciting “narrow generalization” or task-specific skills from LLMs. On the other hand, our method is a multi-task prompt and elicits “broad generalization” or broad cognitive abilities in LLMs, such as logical reasoning or system-2 itself. We hope our work can serve as a reference for accelerating not just logical reasoning research with LLMs, but also discovery of other broad cognitive capabilities within LLMs.
|
| 123 |
+
|
| 124 |
+
Training Dataset Details A limitation of the work is the lack of public information on the details of training datasets used for LLMs, e.g. 001 vs 002 for GPT models, original GPT3 vs InstructGPT [Ouyang et al., 2022], and data for PaLM models [Chowdhery et al., 2022]. However, big performance increases from Zero-shot to Zero-shot-CoT in all recent large models (InstructGPT 001 or 002, Original GPT3, and PaLM) and consistent improvements in both arithmetic and nonarithmetic tasks suggest that the models are unlikely simply memorizing, but instead capturing a task-agnostic multi-step reasoning capability for generic problem solving. While most results are based on InstructGPT since it is the best performing open-access LLM, key results are reproduced on PaLM, and dataset details in InstructGPT (Appendix A, B, and F in Ouyang et al. [2022]) also confirm that it is not specially engineered for multi-step reasoning.
|
| 125 |
+
|
| 126 |
+
Limitation and Social Impact Our work is based on prompting methods for large language models. LLMs have been trained on large corpora from various sources on the web (also see “Training Dataset Details”), and have shown to capture and amplify biases found in the training data. Prompting is a method that looks to take advantage of the patterns captured by language models conducive to various tasks, and therefore it has the same shortcomings. This being said, our approach is a more direct way to probe complex reasoning inside pre-trained LLMs, removing the confounding factor of in-context learning in prior few-shot approaches, and can lead to more unbiased study of biases in LLMs.
|
| 127 |
+
|
| 128 |
+
# 6 Conclusion
|
| 129 |
+
|
| 130 |
+
We have proposed Zero-shot-CoT, a single zero-shot prompt that elicits chain of thought from large language models across a variety of reasoning tasks, in contrast to the few-shot (in-context) approach in previous work that requires hand-crafting few-shot examples per task. Our simple method not only is the minimalist and strongest zero-shot baseline for difficult multi-step system-2 reasoning tasks that long evaded the scaling laws of LLMs, but also encourages the community to further discover similar multi-task prompts that elicit broad cognitive abilities instead of narrow task-specific skills.
|
| 131 |
+
|
| 132 |
+
# Acknowledgements
|
| 133 |
+
|
| 134 |
+
This work has been supported by the Mohammed bin Salman Center for Future Science and Technology for Saudi-Japan Vision 2030 at The University of Tokyo (MbSC2030). Computational resource of AI Bridging Cloud Infrastructure (ABCI) provided by National Institute of Advanced Industrial Science and Technology (AIST) was used for experiments other than PaLM. We also thank Jason Wei and Denny Zhou for discussions and support on running PaLM experiments, and Sharan Narang and Aakanksha Chowdhery for generic support on PaLM infrastructures.
|
| 135 |
+
|
| 136 |
+
# References
|
| 137 |
+
|
| 138 |
+
Michael Ahn, Anthony Brohan, Noah Brown, Yevgen Chebotar, Omar Cortes, Byron David, Chelsea Finn, Keerthana Gopalakrishnan, Karol Hausman, Alex Herzog, Daniel Ho, Jasmine Hsu, Julian
|
| 139 |
+
|
| 140 |
+
Ibarz, Brian Ichter, Alex Irpan, Eric Jang, Rosario Jauregui Ruano, Kyle Jeffrey, Sally Jesmonth, Nikhil J Joshi, Ryan Julian, Dmitry Kalashnikov, Yuheng Kuang, Kuang-Huei Lee, Sergey Levine, Yao Lu, Linda Luu, Carolina Parada, Peter Pastor, Jornell Quiambao, Kanishka Rao, Jarek Rettinghouse, Diego Reyes, Pierre Sermanet, Nicolas Sievers, Clayton Tan, Alexander Toshev, Vincent Vanhoucke, Fei Xia, Ted Xiao, Peng Xu, Sichun Xu, and Mengyuan Yan. Do as i can, not as i say: Grounding language in robotic affordances, 2022. URL https://arxiv.org/abs/ 2204.01691.
|
| 141 |
+
|
| 142 |
+
Sid Black, Leo Gao, Phil Wang, Connor Leahy, and Stella Biderman. GPT-Neo: Large Scale Autoregressive Language Modeling with Mesh-Tensorflow, March 2021. URL https://doi. org/10.5281/zenodo.5297715.
|
| 143 |
+
|
| 144 |
+
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 H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin, editors, Advances in NeurIPS, volume 33, pages 1877–1901. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/file/ 1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf.
|
| 145 |
+
|
| 146 |
+
François Chollet. On the measure of intelligence. arXiv preprint arXiv:1911.01547, 2019. URL https://arxiv.org/abs/1911.01547.
|
| 147 |
+
|
| 148 |
+
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.
|
| 149 |
+
|
| 150 |
+
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. URL https://arxiv.org/ abs/2110.14168.
|
| 151 |
+
|
| 152 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of NAACL, pages 4171–4186, 2019. URL https://aclanthology.org/N19-1423.
|
| 153 |
+
|
| 154 |
+
Leo Gao, Stella Biderman, Sid Black, Laurence Golding, Travis Hoppe, Charles Foster, Jason Phang, Horace He, Anish Thite, Noa Nabeshima, Shawn Presser, and Connor Leahy. The pile: An 800gb dataset of diverse text for language modeling. arXiv preprint arXiv: Arxiv-2101.00027, 2020.
|
| 155 |
+
|
| 156 |
+
Tianyu Gao, Adam Fisch, and Danqi Chen. Making pre-trained language models better few-shot learners. In Proceedings of ACL-IJCNLP, pages 3816–3830, 2021. URL https://aclanthology. org/2021.acl-long.295.
|
| 157 |
+
|
| 158 |
+
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. TACL, 9:346–361, 2021. URL https://aclanthology.org/2021.tacl-1.21/.
|
| 159 |
+
|
| 160 |
+
Mohammad Javad Hosseini, Hannaneh Hajishirzi, Oren Etzioni, and Nate Kushman. Learning to solve arithmetic word problems with verb categorization. In EMNLP, volume 523533. Citeseer, 2014. URL https://aclanthology.org/D14-1058/.
|
| 161 |
+
|
| 162 |
+
Wendy Johnson and Thomas J Bouchard Jr. The structure of human intelligence: It is verbal, perceptual, and image rotation (vpr), not fluid and crystallized. Intelligence, 33(4):393–416, 2005.
|
| 163 |
+
|
| 164 |
+
Rik Koncel-Kedziorski, Hannaneh Hajishirzi, Ashish Sabharwal, Oren Etzioni, and Siena Dumas Ang. Parsing algebraic word problems into equations. TACL, 3:585–597, 2015. URL https: //aclanthology.org/Q15-1042.
|
| 165 |
+
|
| 166 |
+
Rik Koncel-Kedziorski, Subhro Roy, Aida Amini, Nate Kushman, and Hannaneh Hajishirzi. MAWPS: A math word problem repository. In Proceedings of NAACL, pages 1152–1157, 2016. URL https://aclanthology.org/N16-1136.
|
| 167 |
+
|
| 168 |
+
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 ACL, pages 158–167, 2017. URL https://aclanthology.org/P17-1015.
|
| 169 |
+
|
| 170 |
+
Jiachang Liu, Dinghan Shen, Yizhe Zhang, Bill Dolan, Lawrence Carin, and Weizhu Chen. What makes good in-context examples for gpt-3? arXiv preprint arXiv:2101.06804, 2021a. URL https://arxiv.org/abs/2101.06804.
|
| 171 |
+
|
| 172 |
+
Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. Pre-train, prompt, and predict: A systematic survey of prompting methods in natural language processing. arXiv preprint arXiv:2107.13586, 2021b. URL https://arxiv.org/abs/2107. 13586.
|
| 173 |
+
|
| 174 |
+
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. In Proceedings of ACL, pages 8086–8098, 2022. URL https://aclanthology.org/2022.acl-long.556.
|
| 175 |
+
|
| 176 |
+
Kevin S McGrew. The cattell-horn-carroll theory of cognitive abilities: Past, present, and future. 2005.
|
| 177 |
+
|
| 178 |
+
Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. arXiv preprint arXiv: Arxiv-1609.07843, 2016. URL https://arxiv.org/abs/1609. 07843.
|
| 179 |
+
|
| 180 |
+
Sewon Min, Xinxi Lyu, Ari Holtzman, Mikel Artetxe, Mike Lewis, Hannaneh Hajishirzi, and Luke Zettlemoyer. Rethinking the role of demonstrations: What makes in-context learning work? arXiv preprint arXiv:2202.12837, 2022. URL https://arxiv.org/pdf/2202.12837.pdf.
|
| 181 |
+
|
| 182 |
+
Maxwell 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. In Deep Learning for Code Workshop, 2022. URL https://openreview.net/forum? id=HBlx2idbkbq.
|
| 183 |
+
|
| 184 |
+
Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, 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, 2022. URL https://arxiv.org/abs/2203.02155.
|
| 185 |
+
|
| 186 |
+
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 NeurIPS, 32:8026–8037, 2019. URL https://papers.nips.cc/paper/2019/hash/ bdbca288fee7f92f2bfa9f7012727740-Abstract.html.
|
| 187 |
+
|
| 188 |
+
Arkil Patel, Satwik Bhattamishra, and Navin Goyal. Are NLP models really able to solve simple math word problems? In Proceedings of NAACL, pages 2080–2094, 2021. URL https:// aclanthology.org/2021.naacl-main.168.
|
| 189 |
+
|
| 190 |
+
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, page 9, 2019. URL http://www. persagen.com/files/misc/radford2019language.pdf.
|
| 191 |
+
|
| 192 |
+
Jack W. Rae, Sebastian Borgeaud, Trevor Cai, Katie Millican, Jordan Hoffmann, Francis Song, John Aslanides, Sarah Henderson, Roman Ring, Susannah Young, Eliza Rutherford, Tom Hennigan, Jacob Menick, Albin Cassirer, Richard Powell, George van den Driessche, Lisa Anne Hendricks, Maribeth Rauh, Po-Sen Huang, Amelia Glaese, Johannes Welbl, Sumanth Dathathri, Saffron Huang, Jonathan Uesato, John Mellor, Irina Higgins, Antonia Creswell, Nat McAleese, Amy Wu, Erich Elsen, Siddhant Jayakumar, Elena Buchatskaya, David Budden, Esme Sutherland, Karen Simonyan, Michela Paganini, Laurent Sifre, Lena Martens, Xiang Lorraine Li, Adhiguna Kuncoro, Aida Nematzadeh, Elena Gribovskaya, Domenic Donato, Angeliki Lazaridou, Arthur Mensch, Jean-Baptiste Lespiau, Maria Tsimpoukelli, Nikolai Grigorev, Doug Fritz, Thibault Sottiaux, Mantas Pajarskas, Toby Pohlen, Zhitao Gong, Daniel Toyama, Cyprien de Masson d’Autume, Yujia Li, Tayfun Terzi, Vladimir Mikulik, Igor Babuschkin, Aidan Clark, Diego de Las Casas, Aurelia Guy, Chris Jones, James Bradbury, Matthew Johnson, Blake Hechtman, Laura Weidinger, Iason Gabriel, William Isaac, Ed Lockhart, Simon Osindero, Laura Rimell, Chris Dyer, Oriol Vinyals, Kareem Ayoub, Jeff Stanway, Lorrayne Bennett, Demis Hassabis, Koray Kavukcuoglu, and Geoffrey Irving. Scaling language models: Methods, analysis & insights from training gopher, 2021. URL https://arxiv.org/abs/2112.11446.
|
| 193 |
+
|
| 194 |
+
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. JMLR, 21(140):1–67, 2020. URL http://jmlr.org/papers/v21/20-074.html.
|
| 195 |
+
|
| 196 |
+
Nazneen Fatema Rajani, Bryan McCann, Caiming Xiong, and Richard Socher. Explain yourself! leveraging language models for commonsense reasoning. In Proceedings of ACL, pages 4932–4942, 2019. URL https://aclanthology.org/P19-1487.
|
| 197 |
+
|
| 198 |
+
Laria Reynolds and Kyle McDonell. Prompt programming for large language models: Beyond the few-shot paradigm. In Extended Abstracts of the 2021 CHI Conference on Human Factors in Computing Systems, pages 1–7, 2021. URL https://arxiv.org/pdf/2102.07350.pdf.
|
| 199 |
+
|
| 200 |
+
Subhro Roy and Dan Roth. Solving general arithmetic word problems. In Proceedings of EMNLP, pages 1743–1752, 2015. URL https://aclanthology.org/D15-1202.
|
| 201 |
+
|
| 202 |
+
Victor Sanh, Albert Webson, Colin Raffel, Stephen Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Arun Raja, Manan Dey, M Saiful Bari, Canwen Xu, Urmish Thakker, Shanya Sharma Sharma, Eliza Szczechla, Taewoon Kim, Gunjan Chhablani, Nihal Nayak, Debajyoti Datta, Jonathan Chang, Mike Tian-Jian Jiang, Han Wang, Matteo Manica, Sheng Shen, Zheng Xin Yong, Harshit Pandey, Rachel Bawden, Thomas Wang, Trishala Neeraj, Jos Rozen, Abheesht Sharma, Andrea Santilli, Thibault Fevry, Jason Alan Fries, Ryan Teehan, Teven Le Scao, Stella Biderman, Leo Gao, Thomas Wolf, and Alexander M Rush. Multitask prompted training enables zero-shot task generalization. In ICLR, 2022. URL https://openreview.net/forum?id $\equiv$ 9Vrb9D0WI4.
|
| 203 |
+
|
| 204 |
+
Timo Schick and Hinrich Schütze. It’s not just size that matters: Small language models are also fewshot learners. In Proceedings of NAACL, pages 2339–2352, 2021. URL https://aclanthology. org/2021.naacl-main.185.
|
| 205 |
+
|
| 206 |
+
Taylor Shin, Yasaman Razeghi, Robert L. Logan IV, Eric Wallace, and Sameer Singh. AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated Prompts. In Proceedings of EMNLP, pages 4222–4235, 2020. URL https://aclanthology.org/2020. emnlp-main.346.
|
| 207 |
+
|
| 208 |
+
Vered Shwartz, Peter West, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. Unsupervised commonsense question answering with self-talk. In Proceedings of EMNLP, pages 4615–4629, 2020. URL https://aclanthology.org/2020.emnlp-main.373.
|
| 209 |
+
|
| 210 |
+
Shaden Smith, Mostofa Patwary, Brandon Norick, Patrick LeGresley, Samyam Rajbhandari, Jared Casper, Zhun Liu, Shrimai Prabhumoye, George Zerveas, Vijay Korthikanti, Elton Zhang, Rewon Child, Reza Yazdani Aminabadi, Julie Bernauer, Xia Song, Mohammad Shoeybi, Yuxiong He, Michael Houston, Saurabh Tiwary, and Bryan Catanzaro. Using deepspeed and megatron to train megatron-turing nlg 530b, a large-scale generative language model, 2022. URL https: //arxiv.org/abs/2201.11990.
|
| 211 |
+
|
| 212 |
+
Aarohi Srivastava, Abhinav Rastogi, Abhishek Rao, Abu Awal Md Shoeb, Abubakar Abid, Adam Fisch, Adam R Brown, Adam Santoro, Aditya Gupta, Adrià Garriga-Alonso, et al. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models. arXiv preprint arXiv:2206.04615, 2022. URL https://arxiv.org/abs/2206.04615.
|
| 213 |
+
|
| 214 |
+
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.
|
| 215 |
+
|
| 216 |
+
Alon Talmor, Jonathan Herzig, Nicholas Lourie, and Jonathan Berant. Commonsenseqa: A question answering challenge targeting commonsense knowledge. In Proceedings of NAACL-HLT, pages 4149–4158, 2019. URL https://aclanthology.org/N19-1421/.
|
| 217 |
+
|
| 218 |
+
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, Vincent Zhao, Yanqi Zhou, Chung-Ching Chang, Igor Krivokon, Will Rusch, Marc Pickett, Pranesh Srinivasan, Laichee Man, Kathleen 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, 2022. URL https: //arxiv.org/abs/2201.08239.
|
| 219 |
+
|
| 220 |
+
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. Von Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in NeurIPS, 2017. URL https://proceedings.neurips.cc/paper/2017/file/ 3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf.
|
| 221 |
+
|
| 222 |
+
Ben Wang and Aran Komatsuzaki. GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/mesh-transformer-jax, May 2021.
|
| 223 |
+
|
| 224 |
+
Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022. URL https://arxiv.org/abs/2203.11171.
|
| 225 |
+
|
| 226 |
+
Albert Webson and Ellie Pavlick. Do prompt-based models really understand the meaning of their prompts? In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2300–2344. Association for Computational Linguistics, July 2022. URL https://aclanthology.org/2022.naacl-main. 167.
|
| 227 |
+
|
| 228 |
+
Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models, 2022. URL https: //arxiv.org/abs/2201.11903.
|
| 229 |
+
|
| 230 |
+
Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander Rush. Transformers: State-of-the-art natural language processing. In Proceedings of EMNLP, 2020. URL https://aclanthology.org/ 2020.emnlp-demos.6.
|
| 231 |
+
|
| 232 |
+
Eric Zelikman, Yuhuai Wu, and Noah D. Goodman. Star: Bootstrapping reasoning with reasoning, 2022. URL https://arxiv.org/abs/2203.14465.
|
| 233 |
+
|
| 234 |
+
Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, et al. Opt: Open pre-trained transformer language models. arXiv preprint arXiv:2205.01068, 2022. URL https://arxiv.org/abs/2205.01068.
|
| 235 |
+
|
| 236 |
+
# Checklist
|
| 237 |
+
|
| 238 |
+
1. For all authors...
|
| 239 |
+
|
| 240 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 241 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 242 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes]
|
| 243 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 244 |
+
|
| 245 |
+
2. If you are including theoretical results...
|
| 246 |
+
|
| 247 |
+
(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]
|
| 248 |
+
|
| 249 |
+
3. If you ran experiments...
|
| 250 |
+
|
| 251 |
+
(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]
|
| 252 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 253 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] Our paper mainly used GPT-3 API with greedy decoding, and there are no randomness for the experiments.
|
| 254 |
+
(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]
|
| 255 |
+
|
| 256 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 257 |
+
|
| 258 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 259 |
+
(b) Did you mention the license of the assets? [Yes]
|
| 260 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
|
| 261 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes]
|
| 262 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes]
|
| 263 |
+
|
| 264 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 265 |
+
|
| 266 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 267 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 268 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/eHrqmewX1B-/eHrqmewX1B-.md
ADDED
|
@@ -0,0 +1,393 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CAN WIKIPEDIA HELP OFFLINE REINFORCEMENT LEARNING?
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Fine-tuning reinforcement learning (RL) models has been challenging because of a lack of large scale off-the-shelf datasets as well as high variance in transferability among different environments. Recent work has looked at tackling offline RL from the perspective of sequence modeling with improved results as result of the introduction of the Transformer architecture. However, when the model is trained from scratch, it suffers from slow convergence speeds. In this paper, we look to take advantage of this formulation of reinforcement learning as sequence modeling and investigate the transferability of pre-trained sequence models on other domains (vision, language) when finetuned on offline RL tasks (control, games). To this end, we also propose techniques to improve transfer between these domains. Results show consistent performance gains in terms of both convergence speed and reward on a variety of environments, accelerating training by $3 { - } 6 \mathbf { x }$ and achieving stateof-the-art performance in a variety of tasks using Wikipedia-pretrained and GPT2 language models. We hope that this work not only brings light to the potentials of leveraging generic sequence modeling techniques and pre-trained models for RL, but also inspires future work on sharing knowledge between generative modeling tasks of completely different domains.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Large pre-trained language models have shown impressive performance in natural language (Devlin et al., 2019; Radford et al., 2018) and vision (Dosovitskiy et al., 2021) tasks. Furthermore, Transformer-based autoregressive language models (Vaswani et al., 2017; Baevski & Auli, 2019; Radford et al., 2019) have shown to be powerful sources of zero-shot and few-shot performance (Brown et al., 2020), with notable rapid adaptation in low resource settings, demonstrating their easy adaptability and transferability to a number of tasks in their respective domains. Adapting autoregressive language models has also been extended to the multimodal setting (Tsimpoukelli et al., 2021) for tasks such as visual question answering.
|
| 12 |
+
|
| 13 |
+
Concurrently, offline reinforcement learning (RL) has been seen as analogous to sequence modeling (Chen et al., 2021; Janner et al., 2021; Furuta et al., 2021), framed as simply supervised learning to fit return-augmented trajectories in an offline dataset. This relaxation, doing away with many of the complexities commonly associated with reinforcement learning (Watkins & Dayan, 1992; Kakade, 2001), allows us to take advantage of techniques popularized in sequence modeling tasks for RL.
|
| 14 |
+
|
| 15 |
+
Pre-training, particularly, is an essential technique for alleviating higher compute costs from using more expressive models such as Transformers. However, such concept is still relatively fresh in RL (Singh et al., 2020; Tirumala et al., 2020), due to the difficulty in parameterizing different scenes and tasks through a single network (Wang et al., 2018b; Jiang et al., 2019; Zeng et al., 2020) as well as the lack of large off-the-shelf datasets for pre-training (Cobbe et al., 2020; Zhu et al., 2020; Yu et al., 2020). Adopting pre-training as a default option for recent Transformer-based methods (Chen et al., 2021; Janner et al., 2021; Furuta et al., 2021) appears far away – if we only look within RL.
|
| 16 |
+
|
| 17 |
+
Unified under the umbrella of sequence modeling, we look at whether Transformer-based pre-trained language models are able to be adapted to standard offline reinforcement learning tasks that have no relations to language. Given the setting of having a single model pre-trained on natural language to finetune on each offline RL task individually, we demonstrate drastic improvements in convergence speeds and final policy performances. We also consider further techniques (e.g. extension of positional embeddings, embedding similarity encouragement) in order to better take advantage of the features learned by the pre-trained language model and demonstrate greater improvements.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Adapting pre-trained language models (e.g. from Wikipedia) to offline RL (e.g. in continuous control and games).
|
| 21 |
+
|
| 22 |
+
We demonstrate that pre-training on autoregressively modeling natural language provides consistent performance gains when compared to the Decision Transformer (Chen et al., 2021) on both the popular OpenAI Gym (Brockman et al., 2016) and Atari (Bellemare et al., 2013) offline RL benchmarks. We also note a significantly faster convergence speed, with a $3 { - } 6 \mathbf { x }$ improvement over a vanilla Decision Transformer turning hours of training to tens of minutes, indicating long-term computational efficiency benefits on language pre-training.
|
| 23 |
+
|
| 24 |
+
Our findings allude to the potential impact of large scale pre-training for reinforcement learning, given its surprising efficacy when transferring from a distant sequence modeling domain such as natural language. Notably, unlike other work on multi-task offline RL, our model provides consistent results in terms of both reward and convergence regardless of environment and setting, indicating a forseeable future where everyone should use a pre-trained language model for offline RL.
|
| 25 |
+
|
| 26 |
+
# 2 BACKGROUND
|
| 27 |
+
|
| 28 |
+
Offline Reinforcement Learning We consider a standard Markov Decision Process (MDP) with state space $s \in S$ and action space $a \in { \mathcal { A } }$ , specified by a initial state distribution $p ( s _ { 1 } )$ , a dynamics distribution $p ( s _ { t + 1 } | s _ { t } , a _ { t } )$ , and a scalar reward function $r ( s , a )$ . The goal of reinforcement learning (RL) is to find the optimal policy $\pi ^ { * } ( a | s )$ which maximizes the $\gamma$ -discounted expected return as the agent interacts in the environment,
|
| 29 |
+
|
| 30 |
+
$$
|
| 31 |
+
\operatorname* { m a x } _ { \pi } \mathbb { E } _ { s _ { 1 : \infty } , a _ { 1 : \infty } \sim p , \pi } \left[ \sum _ { t = 1 } ^ { \infty } \gamma ^ { t } r ( s _ { t } , a _ { t } ) \right]
|
| 32 |
+
$$
|
| 33 |
+
|
| 34 |
+
In offline RL, the objective remains the same, but has to be optimized with no interactive data collection on a fixed set of trajectories $\tau _ { i }$ , each of the form below with horizon $N$ ,
|
| 35 |
+
|
| 36 |
+
$$
|
| 37 |
+
\tau = ( r _ { 1 } , s _ { 1 } , a _ { 1 } , r _ { 2 } , s _ { 2 } , a _ { 2 } , \ldots , r _ { N } , s _ { N } , a _ { N } ) .
|
| 38 |
+
$$
|
| 39 |
+
|
| 40 |
+
Common approaches include value-based or model-based objectives with regularization (Fujimoto et al., 2019; Levine et al., 2020), and more recently, direct generative modeling of these trajectories conditioned on hindsight returns (Chen et al., 2021; Janner et al., 2021; Furuta et al., 2021).
|
| 41 |
+
|
| 42 |
+
Transformer model In this subsection, we briefly review the Transformer architecture (Vaswani et al., 2017) used to model sequences. The Transformer is comprised of stacks of identical Transformer layers. Each of these layers takes in a set of $n$ -dimensional vectors that are fed through the two main building blocks: a multi-head self-attention sublayer and a feedfoward MLP as shown below:
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
\begin{array} { c } { \displaystyle { \mathrm { A t t e n t i o n } ( x ) = \mathrm { s o f t m a x } \big ( \frac { Q ( x ) K ( x ) ^ { \top } } { \sqrt { n } } \big ) V ( x ) } } \\ { \displaystyle \mathrm { F e e d f o r w a r d } ( x ) = L _ { 2 } \big ( g ( L _ { 1 } ( x ) ) \big ) } \end{array}
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
where $Q , K$ and $V$ represent linear projections that parameterize the projection of input $x$ into the query, key and value spaces; while $L _ { 1 }$ , $L _ { 2 }$ and $g$ represent the first linear projection, second linear projection, and activation function that comprise the feedforward MLP. This is followed by a residual connection (He et al., 2015) and layer normalization (Ba et al., 2016).
|
| 49 |
+
|
| 50 |
+
Autoregressive Language Model Pre-training Although there are now multiple techniques for language model pre-training (e.g. masked language modeling; Devlin et al., 2019), we will review autoregressive language modeling given its correspondence with the sequence modeling objective we employ for our offline reinforcement learning tasks.
|
| 51 |
+
|
| 52 |
+
Given a sequence $\mathbf { x } = [ \mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } , \ldots \mathbf { x } _ { N } ]$ comprised of tokens $\mathbf { x } _ { i }$ , we look to model the likelihood of the sequence $P ( \mathbf { x } )$ by way of modeling the probability of predicting each token $\mathbf { x } _ { i }$ in a step-by-step or autoregressive fashion (commonly left-to-right). Naturally, it follows that each token’s prediction will be conditioned on all the previous elements in the sequence $\mathbf { x } _ { < i }$ as shown below (Bengio et al., 2001):
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
P ( \mathbf { x } ) = \prod _ { i = 1 } ^ { N } p ( \mathbf { x } _ { i } | \mathbf { x } _ { i - 1 } , \mathbf { x } _ { i - 2 } , . . . , \mathbf { x } _ { 1 } )
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
# 3 METHODOLOGY
|
| 59 |
+
|
| 60 |
+
In this section we discuss our proposed methodology and techniques to better adapt pre-trained language models to model trajectories, as in the case of offline RL tasks with minimal modification to architecture and objectives shown in Figure 2.
|
| 61 |
+
|
| 62 |
+
# 3.1 MODELING
|
| 63 |
+
|
| 64 |
+
Following (Chen et al., 2021), we model trajectories autoregressively by representing them in the following manner:
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
\mathbf { t } = ( \hat { R } _ { 1 } , s _ { 1 } , a _ { 1 } , \hat { R } _ { 2 } , s _ { 2 } , a _ { 2 } , \dots , \hat { R } _ { N } , s _ { N } , a _ { N } )
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+
ry re $\mathbf { t }$ is modeled analogously to sequence resent the returns-to-go, state and acti $\mathbf { x }$ as shown in in E for each timestep uationgiven and tim ${ \hat { R } } _ { i } =$ $\textstyle \sum _ { t = i } ^ { N } r _ { t } , { \dot { s } } _ { i } , a _ { i }$ $i$ $N$
|
| 71 |
+
|
| 72 |
+
# 3.2 TECHNIQUES
|
| 73 |
+
|
| 74 |
+
Encouraging similarity between language representations and offline RL input representations We find the issue of lack of alignment between state, action and reward input representations and language representations — partially holding back further extraction of the capabilities of the language model. To this end, we use a similarity-based objective in order to maximize the similarity between the set of language embeddings $E \doteq [ E _ { 1 } , \ldots \bar { , } E _ { V } ]$ with vocabulary size $V$ and the set of input representations $I = I _ { 1 } , \dots , I _ { 3 N }$ . The input representations are parameterized by linear projections $L _ { r } , L _ { a } , L _ { s }$ corresponding to the target reward projection, action projection and state projection, respectively.
|
| 75 |
+
|
| 76 |
+
Given the following cosine similarity function:
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\mathcal { C } ( z _ { 1 } , z _ { 2 } ) = \frac { z _ { 1 } } { \| z _ { 1 } \| _ { 2 } } \cdot \frac { z _ { 2 } } { \| z _ { 2 } \| _ { 2 } }
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
we compute the negative (as we use gradient descent to optimize this objective) of the sum of the maximum similarity value for each embedding $E _ { 1 } , \dots , E _ { j } , \dots , E _ { V }$ and each input representation $I _ { 0 } , \ldots , I _ { i } , \ldots , I _ { N }$ as follows: 1
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\mathcal { L } _ { \mathrm { c o s } } = - \sum _ { i = 0 } ^ { 3 N } \operatorname* { m a x } _ { j } \mathcal { C } ( I _ { i } , E _ { j } )
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
This allows us to encourage the input embeddings to become more similar to their language counterparts. However, due to computational cost of computing this loss for large values of $V$ , we propose to use $K$ -means clustering over the embeddings to reduce the size of $V$ to number of clusters $K$ . We then treat the cluster centers akin to the original embeddings in order to compute our loss. Furthermore, we optimize this computation with vectorization.
|
| 89 |
+
|
| 90 |
+
Language model co-training We also experiment with continuing to train jointly on language modeling and trajectory modeling. This allows us to encouraging the model’s transformer backbone to be able to handle both language and trajectories simultaneously. We refer to the standard negative log likelihood loss over each predicted token used for this objective as $\mathcal { L } _ { L M }$ .
|
| 91 |
+
|
| 92 |
+
# 3.3 FINAL OBJECTIVE
|
| 93 |
+
|
| 94 |
+
We now combine the objectives into the final objective ${ \mathcal { L } } = { \mathcal { L } } _ { \mathrm { M S E } } + \lambda _ { 1 } { \mathcal { L } } _ { \mathrm { c o s } } + \lambda _ { 2 } { \mathcal { L } } _ { \mathrm { L M } }$ . Where $\mathcal { L } _ { \mathrm { M S E } }$ represents the mean squared error loss (calculated between the predicted continuous actions, and the continuous actions contained in the dataset) used for the primary trajectory modeling objective (Chen et al., 2021), $\mathcal { L } _ { \mathrm { L M } }$ represents the negative log likelihood-based token prediction language modeling objective, and $\lambda _ { 1 } , \lambda _ { 2 }$ represent hyperparameters to control the weight of the cosine similarity loss and language modeling loss, respectively.
|
| 95 |
+
|
| 96 |
+
# 4 EXPERIMENTS
|
| 97 |
+
|
| 98 |
+
<table><tr><td>Game</td><td>ChibiT</td><td>GPT2</td><td>DT</td><td>CQL</td><td>QR-DQN</td><td>REM</td><td>BC</td></tr><tr><td>Breakout</td><td>280.3 ± 63.7</td><td>287.8 ± 78.5</td><td>267.5</td><td>211.1</td><td>21.1</td><td>32.1</td><td>138.9</td></tr><tr><td>Qbert</td><td>22.3 ± 9.3</td><td>22.5 ± 12.8</td><td>15.4</td><td>104.2</td><td>1.7</td><td>1.4</td><td>17.3</td></tr><tr><td>Pong</td><td>112.3 ± 7.2</td><td>111.0 ± 5.7</td><td>106.1</td><td>111.9</td><td>20.0</td><td>39.1</td><td>85.2</td></tr><tr><td>Seaquest</td><td>2.9 ± 0.3</td><td>3.0± 0.2</td><td>2.5</td><td>1.7</td><td>1.4</td><td>1.0</td><td>2.1</td></tr></table>
|
| 99 |
+
|
| 100 |
+
Table 1: Gamer-normalized scores for the $1 \%$ DQN-replay Atari dataset. We report the mean and variance across three seeds. Highest mean scores are highlighted in bold.
|
| 101 |
+
|
| 102 |
+
Table 2: Results for D4RL datasets3. We report the mean and variance for three seeds. Language model pre-trainined models are consistently better than the Decision Transformer, and outperform/are competitive other baselines.
|
| 103 |
+
|
| 104 |
+
<table><tr><td>Dataset</td><td>Environment</td><td>ChibiT</td><td>GPT2</td><td>CLIP</td><td>iGPT</td><td>DT</td><td>CQL</td><td>TD3+BC</td><td>BRAC-v</td><td>AWR</td><td>BC</td></tr><tr><td rowspan="3">Medium Expert</td><td>HalfCheetah</td><td>91.7 ± 1.1</td><td>91.8 ± 0.5</td><td>91.3 ± 0.4</td><td>1.9 ± 0.1</td><td>86.8</td><td>62.4</td><td>90.7</td><td>41.9</td><td>52.7</td><td>59.9</td></tr><tr><td>Hopper</td><td>110.0 ± 1.2</td><td>110.9 ± 1.6</td><td>110.2± 0.1</td><td>6.9 ±3.7</td><td>107.6</td><td>111.0</td><td>98.0</td><td>0.8</td><td>27.1</td><td>79.6</td></tr><tr><td>Walker</td><td>108.4±0.2</td><td>108.9 ± 0.3</td><td>108.5 ±0.6</td><td>0.5±0.7</td><td>108.1</td><td>98.7</td><td>110.1</td><td>81.6</td><td>53.8</td><td>36.6</td></tr><tr><td rowspan="3">Medium</td><td>HalfCheetah</td><td>43.3 ± 0.1</td><td>42.8 ± 0.1</td><td>42.3± 0.2</td><td>1.5 ± 0.1</td><td>42.6</td><td>44.4</td><td>48.3</td><td>46.3</td><td>37.4</td><td>43.1</td></tr><tr><td>Hopper</td><td>82.1±4.6</td><td>79.1 ± 1.1</td><td>66.9 ±0.9</td><td>5.7 ± 1.5</td><td>67.6</td><td>58.0</td><td>59.3</td><td>31.1</td><td>35.9</td><td>63.9</td></tr><tr><td>Walker</td><td>77.8 ± 0.1</td><td>78.3 ± 1.5</td><td>74.1 ± 0.9</td><td>0.4± 0.4</td><td>74.0</td><td>79.2</td><td>83.7</td><td>81.1</td><td>17.4</td><td>77.3</td></tr><tr><td rowspan="3">Medium Replay</td><td>HalfCheetah</td><td>39.7±0.5</td><td>40.3±2.3</td><td>37.9 ± 0.2</td><td>1.6 ± 0.1</td><td>36.6</td><td>46.2</td><td>44.6</td><td>47.7</td><td>40.3</td><td>4.3</td></tr><tr><td>Hopper</td><td>81.3 ± 5.0</td><td>94.4±2.5</td><td>85.8 ±0.3</td><td>5.7 ±0.9</td><td>82.7</td><td>48.6</td><td>60.9</td><td>0.6</td><td>28.4</td><td>27.6</td></tr><tr><td>Walker</td><td>71.3 ± 2.0</td><td>72.7 ± 1.2</td><td>69.9 ±0.3</td><td>9.1 ± 7.7</td><td>66.6</td><td>26.7</td><td>81.8</td><td>0.9</td><td>15.5</td><td>36.9</td></tr><tr><td colspan="2">Average (All Settings)</td><td>78.3</td><td>80.1</td><td>76.3</td><td>3.7</td><td>74.7</td><td>63.9</td><td>75.3</td><td>36.9</td><td>34.3</td><td>46.4</td></tr></table>
|
| 105 |
+
|
| 106 |
+
# 4.1 MODELS
|
| 107 |
+
|
| 108 |
+
Pre-trained Models We use the popular GPT2-small model to benchmark the impact of languageonly pre-training. For direct comparison with the Decision Transformer (Chen et al., 2021), we also pre-train a language model with the same parameter count on the popular language modeling Wikitext-103 dataset (Merity et al., 2016), consisting of over 100 million tokens from full Wikipedia articles. We refer to this model as ChibiT.4 Note that when we transfer a pre-trained model towards trajectory modeling on an offline RL dataset, we transfer all the Transformer layers and positional embeddings, while replacing the language token embeddings with the projections of the action, state and reward representations.
|
| 109 |
+
|
| 110 |
+
To explore the effect of pre-training on vision datasets, we also study CLIP (Radford et al., 2021) and ImageGPT (Chen et al., 2020). CLIP is comprised of an image encoder and a text encoder, and trained to predict which caption matches with which image. While the text encoder is an autoregressive Transformer, the image encoder is a Vision Transformer, which is not autoregressive. Therefore, for the autoregressive setup of offline reinforcement learning, we use the pre-trained text encoder as our initializer, while discarding the image encoder part. ImageGPT is based on the same Transformer architecture as GPT2, but instead of language, it is trained on images unrolled into long sequences of pixels in an autoregressive manner.
|
| 111 |
+
|
| 112 |
+
RL Baselines In addition to benchmarking our pre-trained language models, we compare to popular state-of-the-art offline RL algorithms as follows: Decision Transformer (DT) (Chen et al., 2021), CQL (Kumar et al., 2020), $\mathrm { T D } 3 { + } \mathrm { B C }$ (Fujimoto & Gu, 2021), BRAC (Wu et al., 2019), and AWR baselines (Peng et al., 2019).
|
| 113 |
+
|
| 114 |
+
Hyperparameters We use the following hyperparameters for our language model pre-training: the architecture is the same as that of (Chen et al., 2021) (128 model dim, 1 attention head, 3 layers), learning rate of 3e-4, a batch size 65536 tokens, for 6 hours (80000 steps), using a warmup schedule over the first 10000. We the same byte-pair encoding (BPE; Sennrich et al., 2016; Kudo & Richardson, 2018) as that used by GPT-2 (Radford et al., 2019). For our offline RL tasks, we follow the hyperparameters used by (Chen et al., 2021). For our additional objectives, we decay $\lambda _ { 1 } , \lambda _ { 2 }$ , to reach 0.0 each after 5000 steps. We tune initial values of $\lambda _ { 1 }$ for values of $\{ 0 . 1 , 0 . 2 \}$ and $\lambda _ { 2 }$ for values of $\{ 0 . 0 , 0 . 2 , 0 . 4 \}$ . We include additional details in the appendix.
|
| 115 |
+
|
| 116 |
+
We benchmark our models against the D4RL offline RL benchmark datasets ( $\mathrm { F u }$ et al., 2020) for the OpenAI Gym MuJoCo (Brockman et al., 2016) and Atari (Bellemare et al., 2013) tasks.
|
| 117 |
+
|
| 118 |
+
# 4.2 ATARI
|
| 119 |
+
|
| 120 |
+
We run our ChibiT and GPT2 models on the challenging Atari dataset (Bellemare et al., 2013). We use the four Atari tasks evaluated in (Agarwal et al., 2020), namely Breakout, Qbert, Pong and Seaquest. Baseline numbers used are provided by (Chen et al., 2021) for behavior cloning and Decision Transformer models, while CQL, REM, and QR-QDN baseline numbers are provided by (Kumar et al., 2020; Agarwal et al., 2020). Following (Hafner et al., 2021), we normalize scores based on that of a professional gamer on the evaluation set.
|
| 121 |
+
|
| 122 |
+
We show results in Table 1. It can be seen that ChibiT and GPT2 results consistently improve over/match a strong vanilla Decision Transformer baseline. Our models are competitive with the Decision Transformer on all four games and competitive with CQL on $3 / 4$ games.
|
| 123 |
+
|
| 124 |
+
# 4.3 GYM
|
| 125 |
+
|
| 126 |
+
In this section, we consider results on the OpenAI Gym tasks (HalfCheetah, Walker2d, and Hopper) from the D4RL benchmark (Fu et al., 2020).
|
| 127 |
+
|
| 128 |
+
We train our models for a total of 100k timesteps and evaluate every 5000 timesteps, with each evaluation consisting of 10 episodes. Baseline results are obtained directly from the D4RL paper (Fu et al., 2020) and Decision Transformer results are directly taken from (Chen et al., 2021). Similarly, following $\mathrm { F u }$ et al., 2020), we compute the normalized score over returns, computed by taking $1 0 0 \times { \frac { \mathsf { s c o r e - r a n d o m } \mathsf { s c o r e } } { \mathsf { e x p e r t } \ s \mathsf { c o r e } \ - \mathsf { \tau - \tau - r a n d o m } \ s \mathsf { c o r e } } }$ .
|
| 129 |
+
|
| 130 |
+
We show results comparing ChibiT, GPT2, and CLIP with state-of-the-art offline RL algorithms in Table 2. Pre-training improves the Decision Transformer by large margins in an overwhelming majority of tasks, clearly demonstrating that language pre-training improves over random initialization using sequence modeling techniques in terms of reward. We also take note of the minimal difference between ChibiT, CLIP, and GPT2, showing that that at this scale, improvements on offline RL are not necessarily strongly correlated with model size as has been shown on both large-scale vision and language tasks. We note that CLIP, while improving over a vanilla DT model, is often slightly less competitive that our pure language modeling objectives. Our ChibiT and GPT2 models achieve and average performance of 78.3 and 80.1, respectively, showing strong competitiveness on all settings with all baselines. These pre-trained language models acheive state-of-the-art results by outperforming the strong Decision Transformer and $\mathrm { T D } 3 { + } \mathrm { B C }$ baselines by a significant 3.0-5.4 points.
|
| 131 |
+
|
| 132 |
+

|
| 133 |
+
Figure 2: Attention analysis. We visualize early, middle and last attention weights computed by GPT-2, iGPT, and randomly initialized DT models on Hopper-medium to study how pre-training on different modalities affects how the model attends to previous timesteps. The $\mathbf { X }$ -axis represents keys (representations that are being “looked at”) while the y-axis represents queries (i.e. representations that are “looking at” other representations) for a given timestep. Ligher colors represent higher attention weights, while darker colors represent lower weights.
|
| 134 |
+
|
| 135 |
+
# 5 ANALYSIS
|
| 136 |
+
|
| 137 |
+
In this section, we look at more fine-grained details and properties of various aspects of adapting pre-trained language models to offline RL tasks with ablations on OpenAI Gym.
|
| 138 |
+
|
| 139 |
+
Convergence Speed We evaluate time-to-convergence of GPT2, ChibiT and DT using the our implementations of the former two and the author-provided implementation of the latter.
|
| 140 |
+
|
| 141 |
+
Results are reported in Table 3. We find that pre-training on language allows us to speed up the training process of Transformer-based offline RL models, measured in wall-clock time. Convergence is defined as the point where average performance attains a score within 2 (normalized score) of the best score.
|
| 142 |
+
|
| 143 |
+
Interestingly, we also find that GPT2, despite its larger model size at 84M model parameters, still manages to train faster than DT. This points towards potential benefits of pre-training at scale and increased efficiency during finetuning. We run experiments on a single NVIDIA V100 16GB GPU and an Intel Xeon Gold 6148 Processor.
|
| 144 |
+
|
| 145 |
+
Language initialization versus vision initialization As we establish that Transformers pre-trained on language data are surprisingly effective for accelerating training convergence time on offline reinforcement learning tasks, it is tempting to ask if this phenomenon is inherent to language pre-training or does it extend to vision pre-training as well. To answer this question, we compare two GPT models, ImageGPT-small (iGPT) and GPT2-small (GPT2), pre-trained on language and vision data, respectively. Since Transformer architectures are domain-agnostic, these models can be trained
|
| 146 |
+
|
| 147 |
+
<table><tr><td>Model</td><td>Walker2d</td><td>HalfCheetah</td><td>Hopper</td></tr><tr><td>DT (GitHub)</td><td>3h14m</td><td>3h23m</td><td>2h47m</td></tr><tr><td>ChibiT (ours)</td><td>43m</td><td>48m</td><td>36m</td></tr><tr><td>GPT2 (ours)</td><td>1h27m</td><td>1h32m</td><td>1h2m</td></tr></table>
|
| 148 |
+
|
| 149 |
+
Table 3: Training time comparison (measured in hours and minutes on a single V100 GPU on the medium-expert setting) between the Decision Transformer and two pre-trained models: ChibiT and GPT2 on OpenAI gym tasks. Note that GPT2 is 144x larger than the other models with 84M model parameters.
|
| 150 |
+
|
| 151 |
+
on 1D sequences of any form. Hence, we can compare GPT2, which was pre-trained on many sequences of discrete language tokens, and iGPT, which was pre-trained on autoregressive image generation at the pixel level (note that both models were trained on $\sim 1 0 ^ { 1 0 }$ tokens). Given the results in Table 2 for iGPT, we found that the model had extremely low returns, and did not reach convergence. Notably, on some seeds, the model even performed worse than a random score after training on Walker medium, with a normalized score of $- 0 . 1$ , in contrast with GPT-2 pre-training which gives us an average increase of 5.1 points (measured in terms of normalized reward) over the Decision Transformer.
|
| 152 |
+
|
| 153 |
+

|
| 154 |
+
Figure 3: Comparison of Average Medium-Expert reward for various model sizes on OpenAI Gym.
|
| 155 |
+
|
| 156 |
+
Table 4: Experiment on increased context length with pre-trained models on the medium setting
|
| 157 |
+
|
| 158 |
+
<table><tr><td>Model</td><td> Avg. Reward</td></tr><tr><td>ChibiT (context = 20)</td><td>67.7</td></tr><tr><td>ChibiT (context = 60)</td><td>67.3</td></tr><tr><td>DT (context = 20)</td><td>61.4</td></tr><tr><td>DT (context = 60)</td><td>61.2</td></tr></table>
|
| 159 |
+
|
| 160 |
+
Furthermore, when we turn our attention to the difference between GPT2 and CLIP, we see that GPT2, which is based on pure-language based pre-training, performs better. While the text encoder of CLIP is also an autoregressive Transformer pre-trained on text, the objective of CLIP is different from GPT2 in that the former attempts to match text with a corresponding image, while the latter is pre-trained on pure autoregressive language modeling. Given this, we hypothesize that generative (versus discriminative) training objective is more useful for transfer to a generative task.
|
| 161 |
+
|
| 162 |
+
We believe that this alludes to underlying similarities between language modeling and trajectory modeling, whereas a large difference between image modeling and trajectory modeling. Perhaps this can be attributed to the “natural” sequential nature of language and trajectories, versus the forced $2 \mathrm { D } { } 1 \mathrm { D }$ nature that was used to pre-train iGPT.
|
| 163 |
+
|
| 164 |
+
Attention Analysis To further understand the discrepancy between language-based and visionbased pre-training, we visualize attention weights, extracted from GPT2 and iGPT after fine-tuning on Hopper medium, as an example offline RL task. As a reference, we also extract attention weights from randomly initialized networks of Decision Transformers. In Figure 4.2, we plot the attention weights averaged over all attention heads in each model, and present the visualizations for early, middle, and last layers, respectively. Due to the autoregressive nature of our task, attention weights in the upper right triangle are masked out, so that the model can only attend to past sequences.
|
| 165 |
+
|
| 166 |
+
As a general trend, we see that in earlier layers GPT2 and the randomly initialized model tend to attend to positions with multiples of 3 timesteps behind the current position. This indicates that actions attend to previous actions, states attend to previous states, and returns-to-go attend to previous returns-to-go. Constrasted with this, iGPT’s attention is less interpretable, however showing a notably stronger recency bias. In the middle layers, DT continues the trends of its early layers, whereas iGPT tends to fixate on a single state (given the overwhelming brightness of timestep 2), GPT2 starts showing a stronger preference for previous returns to go (given that lighter colors are consistently timestep 1, 4, etc...). Finally, in the models’ last layer, while iGPT and random initialization tend to exhibit a behaviour closer to mean pooling over all previous inputs, GPT’s final prediction seems to be heavily reliant on the initial returns-to-go. This perhaps indicates that goal conditioning is stronger in GPT2.
|
| 167 |
+
|
| 168 |
+
How important is the model size of Transformer? We explore how pre-training changes the impact on model size for these offline RL tasks. We train randomly initialized models with various parameter counts (approx. 600K, 3M, 18M, 84M) as well as language-pre-trained models on WikiText-103 with the same parameter counts. Exact hyperparameters for this experiment are given in the Appendix.5
|
| 169 |
+
|
| 170 |
+
Table 5: Experiment on freezing model weights versus finetuning them on OpenAI Gym.
|
| 171 |
+
|
| 172 |
+
<table><tr><td>Model</td><td>HalfCheetah</td><td>Walker2d</td><td>Hopper</td></tr><tr><td>ChibiT (FT)</td><td>43.3 ±0.1</td><td>77.8±0.1</td><td>82.1 ± 4.6</td></tr><tr><td>ChibiT (Frozen)</td><td>26.4 ± 1.2</td><td>63.3± 2.7</td><td>57.7 ± 7.0</td></tr></table>
|
| 173 |
+
|
| 174 |
+
Table 6: Ablation of our proposed techniques
|
| 175 |
+
|
| 176 |
+
<table><tr><td>Model</td><td>HalfCheetah</td><td>Walker2d</td><td>Hopper</td></tr><tr><td>ChibiT</td><td>43.3 ± 0.1</td><td>77.8 ± 0.1</td><td>82.1 ± 4.6</td></tr><tr><td>ChibiT(w/o Lcos)</td><td>43.1 ± 0.1</td><td>77.2 ± 1.3</td><td>80.9 ± 1.1</td></tr><tr><td>ChibiT (w/o LLM)</td><td>43.3± 0.2</td><td>77.6± 0.2</td><td>81.4 ± 5.2</td></tr><tr><td>ChibiT(rand. pos. emb.)</td><td>43.0± 0.4</td><td>76.5 ± 1.2</td><td>78.4± 2.0</td></tr></table>
|
| 177 |
+
|
| 178 |
+
We visualize the average (over Hopper, Walker2d, and HalfCheetah) of Medium-Expert results in Figure 3. Unsurprisingly, we observe that a randomly initialized Decision Transformer, tends to have lower relative returns as parameter sizes increase likely due to overfitting on finite data. Interestingly, however, pre-trained language models tend to increase performance as parameter count increases, despite diminishing returns with increasing parameter count. Nonetheless, this is exciting as it demonstrates that even language pre-training may be beneficial at scale, especially for larger and more diverse offline RL datasets in the future.
|
| 179 |
+
|
| 180 |
+
Context length We try various context lengths with pre-training and not pre-training: context $= 2 0$ (following (Chen et al., 2021)) and context $= 6 0$ . Results are shown in Table 4. It can be seen that additional context does not seem to help even when pre-training on long range language modeling, perhaps alluding to the limited utility of long-range context for the OpenAI Gym tasks.
|
| 181 |
+
|
| 182 |
+
Can we freeze model parameters? We also look at how ChibiT performs when model weights (transformer blocks: self-attention and feedforward) are frozen with only action, state and return projections $L _ { a } , L _ { s } , L _ { r }$ being trained. Previous work (Tsimpoukelli et al., 2021; Lu et al., 2021) has demonstrated how frozen language models have the capability to extend to the vision domain with respectable performance, which we aim to test with this experiment. We show results on Table 5 on the D4RL medium setting in OpenAI Gym. When freezing model weights, performance is underwhelming with performance drastically reducing as much as ${ \sim } 4 0 \%$ . We conjecture this is due to our tasks being complex generative modeling as opposed to discriminative classification (Lu et al., 2021), where the output distribution is of a higher dimension — hence the need for more intensive finetuning.
|
| 183 |
+
|
| 184 |
+
Ablation of proposed techniques We perform an ablation study of our proposed auxiliary techniques and compare the impact of including and not including pre-trained positional embeddings. Results are shown in Table 6. It can be seen that the combination of our objectives are able to increase performance consistently. We also note that the removal of pre-trained positional embeddings results in the largest average decrease in performance over ChibiT, alluding to the fact that this positional information is important and transferable to offline RL.
|
| 185 |
+
|
| 186 |
+
# 6 RELATED WORK
|
| 187 |
+
|
| 188 |
+
Transformer Pre-training Pre-training Transformer-based models (Vaswani et al., 2017) was initially proposed by (Radford et al., 2018) with their Generative Pre-trained Transformer (GPT). They performed autoregressive language modeling on a relatively large dataset, showing promising initial success not only on its ability to scale to large models sizes, but also for its impressive performance when fine-tuning on task-specific natural language understanding (NLU; Wang et al., 2018a) datasets. BERT (Devlin et al., 2019), extended this pre-train finetune paradigm with their masked language modeling objective. Furthermore, recently this paradigm has extended to computer vision with the Vision Transformer (ViT; Dosovitskiy et al., 2021) and iGPT (Chen et al., 2020) .
|
| 189 |
+
|
| 190 |
+
Sequence Modeling for Offline RL Offline RL became popular starting from a simple observation that many performant off-policy algorithms (Mnih et al., 2015; Lillicrap et al., 2015; Gu et al., 2016; Haarnoja et al., 2018; Fujimoto et al., 2018) fail to learn in a fully off-policy, i.e. offline, batch setting (Fujimoto et al., 2019). Numerous algorithmic work ensued (Wu et al., 2019; Jaques et al., 2020; Ghasemipour et al., 2021; Kumar et al., 2020; Fujimoto & Gu, 2021) with various applications (Jaques et al., 2020; Chebotar et al., 2021). Building on reward-conditioned imitation learning (Srivastava et al., 2019; Kumar et al., 2019), Transformers (Parisotto et al., 2020) have been recently adopted for replacing offline RL with sequence modeling (Chen et al., 2021; Janner et al., 2021; Furuta et al., 2021). Despite initial successes, many techniques popular in language modeling have yet to be experimented in these offline RL benchmarks, and our work constitutes an initial step toward bridging the two communities.
|
| 191 |
+
|
| 192 |
+
Pre-training for RL Contrary to language or vision (Devlin et al., 2019; Dosovitskiy et al., 2021), successes in deep RL have largely focused on isolated tasks/ domains (Mnih et al., 2015; Silver et al., 2016; Gu et al., 2017; Kalashnikov et al., 2018; Vinyals et al., 2019). Pre-training results are often limited to vision or language processing (Yen-Chen et al., 2020; Lynch & Sermanet, 2021) or specially-crafted domains (Singh et al., 2020; Tirumala et al., 2020). Arguably, a fundamental bottleneck for pre-training in RL is the difficulty in reusing a single network across vastly different tasks, observation spaces, action spaces, rewards, scenes, and agent morphologies. Preliminary work explored various aspects of this problem through graph neural networks for morphology generalization (Wang et al., 2018b; Pathak et al., 2019; Chen et al., 2018; Kurin et al., 2020), language for universal reward specification (Jiang et al., 2019; Lynch & Sermanet, 2021; Shridhar et al., 2022), and object-centric action spaces (Zeng et al., 2020; Shridhar et al., 2022; Noguchi et al., 2021). Our work is orthogonal to these as we essentially amortize RL algorithm itself, expressed as sequence modeling with Transformer, instead of specific RL domain information, and can be combined with domain-specific pre-training techniques (Yen-Chen et al., 2020; Lynch & Sermanet, 2021; Banino et al., 2021) effortlessly.
|
| 193 |
+
|
| 194 |
+
Adapting language models to new modalities and domains Within language modeling recently there has been interest in adaptation of pre-trained language models by way of continued pre-training (Gururangan et al., 2020). Furthermore, (Tsimpoukelli et al., 2021) looked at adapting frozen language models for few-shot question answering by adding an auxiliary vision encoder. Other (concurrrent) work has proposed using language as a semantically meaningful way of communicating between modalities directly using frozen pre-trained language models for planning (Zeng et al., 2022; Li et al., 2022; Huang et al., 2022). More related to our work is that of (Lu et al., 2021), where they look at adapting frozen language models to various tasks such as image classification. Concurrent work (Reed et al., 2022) has looked at multi-tasking using generic sequence modeling for transformer-based RL agents, while other concurrent work has shown that language pre-training is helpful for in-context learning as a result of having a long-tailed distribution (Chan et al., 2022). Our work extends on the spirit of these works by adapting language models to a new domain of RL, however, as far was we know, we are the first to propose leveraging a generative model (in language) for generation in another domain (RL) as opposed to a discriminatory task such as classification.
|
| 195 |
+
|
| 196 |
+
# 7 CONCLUSION
|
| 197 |
+
|
| 198 |
+
We investigate how pre-trained models can improve generic offline RL problems, recently casted as sequence modeling. To our surprise, we discover that fine-tuning from a Wikipedia-trained small transformer (ChibiT) or a GPT2 model outperforms the basic Decision Transformer (DT) and other RL-based offline baselines by a large margin in terms of policy performance and convergence, establishing state-of-the-art scores on the competitive D4RL benchmark in both Gym and Atari and cutting down the DT training time by 3-6x. We perform extensive ablation studies and analyses, and found how language pre-training (as opposed to vision pre-training), model size, and fine-tuning (as opposed to freezing parameters) play critical roles in the final performances. We hope our work can accelerate the adoption of pre-training in RL and leads to more interest in applying other sequence modeling techniques from language and vision into RL.
|
| 199 |
+
|
| 200 |
+
Beyond RL, our work constitutes the first successful transfer, to the best of our knowledge, of a pre-trained generative model in one domain (language) to a generative modeling task in a completely different domain (RL on continuous control and games). This hints at some underlying universal structure across sequence modeling domains, and could perhaps lead to unified generative modeling pre-training for better transferability among them. In future work, we look to investigate in more depth which properties of language structure are useful for reinforcement learning and sequence modeling in other domains, and whether previous work studying language structure (Hupkes et al., 2019) does indeed relate to compositional generalization of neural networks.
|
| 201 |
+
|
| 202 |
+
# REFERENCES
|
| 203 |
+
|
| 204 |
+
Rishabh Agarwal, Dale Schuurmans, and Mohammad Norouzi. An optimistic perspective on offline reinforcement learning, 2020.
|
| 205 |
+
|
| 206 |
+
Rishabh Agarwal, Max Schwarzer, Pablo Samuel Castro, Aaron C. Courville, and Marc G. Bellemare. Deep reinforcement learning at the edge of the statistical precipice. In Marc’Aurelio Ranzato, Alina Beygelzimer, Yann N. Dauphin, Percy Liang, and Jennifer Wortman Vaughan (eds.), Advances in Neural Information Processing Systems 34: Annual Conference on Neural Information Processing Systems 2021, NeurIPS 2021, December 6-14, 2021, virtual, pp. 29304–29320, 2021. URL https://proceedings.neurips.cc/paper/2021/hash/ f514cec81cb148559cf475e7426eed5e-Abstract.html.
|
| 207 |
+
|
| 208 |
+
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E. Hinton. Layer normalization. arXiv preprint arXiv: Arxiv-1607.06450, 2016.
|
| 209 |
+
|
| 210 |
+
Alexei Baevski and Michael Auli. Adaptive input representations for neural language modeling. In International Conference on Learning Representations, 2019. URL https://openreview. net/forum?id ${ . } = { }$ ByxZX20qFQ.
|
| 211 |
+
|
| 212 |
+
Andrea Banino, Adrià Puidomenech Badia, Jacob Walker, Tim Scholtes, Jovana Mitrovic, and Charles Blundell. Coberl: Contrastive bert for reinforcement learning. arXiv preprint arXiv: Arxiv-2107.05431, 2021.
|
| 213 |
+
|
| 214 |
+
M. G. Bellemare, Y. Naddaf, J. Veness, and M. Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47:253–279, jun 2013.
|
| 215 |
+
|
| 216 |
+
Yoshua Bengio, Réjean Ducharme, and Pascal Vincent. A neural probabilistic language model. In T. Leen, T. Dietterich, and V. Tresp (eds.), Advances in Neural Information Processing Systems, volume 13. MIT Press, 2001. URL https://proceedings.neurips.cc/paper/2000/ file/728f206c2a01bf572b5940d7d9a8fa4c-Paper.pdf.
|
| 217 |
+
|
| 218 |
+
Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym, 2016.
|
| 219 |
+
|
| 220 |
+
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, 2020.
|
| 221 |
+
|
| 222 |
+
Stephanie C. Y. Chan, Adam Santoro, Andrew K. Lampinen, Jane X. Wang, Aaditya Singh, Pierre H. Richemond, Jay McClelland, and Felix Hill. Data distributional properties drive emergent few-shot learning in transformers. arXiv preprint arXiv: Arxiv-2205.05055, 2022.
|
| 223 |
+
|
| 224 |
+
Yevgen Chebotar, Karol Hausman, Yao Lu, Ted Xiao, Dmitry Kalashnikov, Jake Varley, Alex Irpan, Benjamin Eysenbach, Ryan Julian, Chelsea Finn, et al. Actionable models: Unsupervised offline reinforcement learning of robotic skills. arXiv preprint arXiv:2104.07749, 2021.
|
| 225 |
+
|
| 226 |
+
Lili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee, Aditya Grover, Michael Laskin, Pieter Abbeel, Aravind Srinivas, and Igor Mordatch. Decision transformer: Reinforcement learning via sequence modeling. arXiv preprint arXiv: Arxiv-2106.01345, 2021.
|
| 227 |
+
|
| 228 |
+
Mark Chen, Alec Radford, Rewon Child, Jeffrey Wu, Heewoo Jun, David Luan, and Ilya Sutskever. Generative pretraining from pixels. In Hal Daumé III and Aarti Singh (eds.), Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pp. 1691–1703. PMLR, 13–18 Jul 2020. URL https://proceedings. mlr.press/v119/chen20s.html.
|
| 229 |
+
|
| 230 |
+
Tao Chen, Adithyavairavan Murali, and Abhinav Gupta. Hardware conditioned policies for multirobot transfer learning. arXiv preprint arXiv:1811.09864, 2018.
|
| 231 |
+
|
| 232 |
+
Karl Cobbe, Chris Hesse, Jacob Hilton, and John Schulman. Leveraging procedural generation to benchmark reinforcement learning. In International conference on machine learning, pp. 2048–2056. PMLR, 2020.
|
| 233 |
+
|
| 234 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding, 2019.
|
| 235 |
+
|
| 236 |
+
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, 2021.
|
| 237 |
+
|
| 238 |
+
Justin Fu, Aviral Kumar, Ofir Nachum, George Tucker, and Sergey Levine. D4rl: Datasets for deep data-driven reinforcement learning. arXiv preprint arXiv: Arxiv-2004.07219, 2020.
|
| 239 |
+
|
| 240 |
+
Scott Fujimoto and Shixiang Shane Gu. A minimalist approach to offline reinforcement learning. arXiv preprint arXiv:2106.06860, 2021.
|
| 241 |
+
|
| 242 |
+
Scott Fujimoto, Herke Hoof, and David Meger. Addressing function approximation error in actorcritic methods. In International Conference on Machine Learning, pp. 1587–1596. PMLR, 2018.
|
| 243 |
+
|
| 244 |
+
Scott Fujimoto, David Meger, and Doina Precup. Off-policy deep reinforcement learning without exploration. In International Conference on Machine Learning, pp. 2052–2062. PMLR, 2019.
|
| 245 |
+
|
| 246 |
+
Hiroki Furuta, Yutaka Matsuo, and Shixiang Shane Gu. Generalized decision transformer for offline hindsight information matching. arXiv preprint arXiv:2111.10364, 2021.
|
| 247 |
+
|
| 248 |
+
Seyed Kamyar Seyed Ghasemipour, Dale Schuurmans, and Shixiang Shane Gu. Emaq: Expected-max q-learning operator for simple yet effective offline and online rl. In International Conference on Machine Learning, pp. 3682–3691. PMLR, 2021.
|
| 249 |
+
|
| 250 |
+
Shixiang Gu, Timothy Lillicrap, Ilya Sutskever, and Sergey Levine. Continuous deep q-learning with model-based acceleration. In International conference on machine learning, pp. 2829–2838. PMLR, 2016.
|
| 251 |
+
|
| 252 |
+
Shixiang Gu, Ethan Holly, Timothy Lillicrap, and Sergey Levine. Deep reinforcement learning for robotic manipulation with asynchronous off-policy updates. In 2017 IEEE international conference on robotics and automation (ICRA), pp. 3389–3396. IEEE, 2017.
|
| 253 |
+
|
| 254 |
+
Suchin Gururangan, Ana Marasovic, Swabha Swayamdipta, Kyle Lo, Iz Beltagy, Doug Downey, and ´ Noah A. Smith. Don’t stop pretraining: Adapt language models to domains and tasks, 2020.
|
| 255 |
+
|
| 256 |
+
Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In International conference on machine learning, pp. 1861–1870. PMLR, 2018.
|
| 257 |
+
|
| 258 |
+
Danijar Hafner, Timothy Lillicrap, Mohammad Norouzi, and Jimmy Ba. Mastering atari with discrete world models, 2021.
|
| 259 |
+
|
| 260 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. arXiv preprint arXiv: Arxiv-1512.03385, 2015.
|
| 261 |
+
|
| 262 |
+
Wenlong Huang, Pieter Abbeel, Deepak Pathak, and Igor Mordatch. Language models as zeroshot planners: Extracting actionable knowledge for embodied agents. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvári, Gang Niu, and Sivan Sabato (eds.), International Conference on Machine Learning, ICML 2022, 17-23 July 2022, Baltimore, Maryland, USA, volume 162 of Proceedings of Machine Learning Research, pp. 9118–9147. PMLR, 2022. URL https://proceedings.mlr.press/v162/huang22a.html.
|
| 263 |
+
|
| 264 |
+
Dieuwke Hupkes, Verna Dankers, Mathijs Mul, and Elia Bruni. Compositionality decomposed: how do neural networks generalise? arXiv preprint arXiv: Arxiv-1908.08351, 2019.
|
| 265 |
+
|
| 266 |
+
Michael Janner, Qiyang Li, and Sergey Levine. Reinforcement learning as one big sequence modeling problem. arXiv preprint arXiv:2106.02039, 2021.
|
| 267 |
+
|
| 268 |
+
Natasha Jaques, Judy Hanwen Shen, Asma Ghandeharioun, Craig Ferguson, Agata Lapedriza, Noah Jones, Shixiang Shane Gu, and Rosalind Picard. Human-centric dialog training via offline reinforcement learning. arXiv preprint arXiv:2010.05848, 2020.
|
| 269 |
+
|
| 270 |
+
Yiding Jiang, Shixiang Gu, Kevin Murphy, and Chelsea Finn. Language as an abstraction for hierarchical deep reinforcement learning. arXiv preprint arXiv:1906.07343, 2019.
|
| 271 |
+
|
| 272 |
+
Sham M Kakade. A natural policy gradient. Advances in neural information processing systems, 14, 2001.
|
| 273 |
+
|
| 274 |
+
Dmitry Kalashnikov, Alex Irpan, Peter Pastor, Julian Ibarz, Alexander Herzog, Eric Jang, Deirdre Quillen, Ethan Holly, Mrinal Kalakrishnan, Vincent Vanhoucke, et al. Qt-opt: Scalable deep reinforcement learning for vision-based robotic manipulation. arXiv preprint arXiv:1806.10293, 2018.
|
| 275 |
+
|
| 276 |
+
Taku Kudo and John Richardson. Sentencepiece: A simple and language independent subword tokenizer and detokenizer for neural text processing, 2018.
|
| 277 |
+
|
| 278 |
+
Aviral Kumar, Xue Bin Peng, and Sergey Levine. Reward-conditioned policies. arXiv preprint arXiv:1912.13465, 2019.
|
| 279 |
+
|
| 280 |
+
Aviral Kumar, Aurick Zhou, George Tucker, and Sergey Levine. Conservative q-learning for offline reinforcement learning. arXiv preprint arXiv:2006.04779, 2020.
|
| 281 |
+
|
| 282 |
+
Vitaly Kurin, Maximilian Igl, Tim Rocktäschel, Wendelin Boehmer, and Shimon Whiteson. My body is a cage: the role of morphology in graph-based incompatible control. arXiv preprint arXiv:2010.01856, 2020.
|
| 283 |
+
|
| 284 |
+
Sergey Levine, Aviral Kumar, George Tucker, and Justin Fu. Offline reinforcement learning: Tutorial, review, and perspectives on open problems. arXiv preprint arXiv:2005.01643, 2020.
|
| 285 |
+
|
| 286 |
+
Shuang Li, Xavier Puig, Yilun Du, Clinton Wang, Ekin Akyürek, Antonio Torralba, Jacob Andreas, and Igor Mordatch. Pre-trained language models for interactive decision-making. ArXiv, abs/2202.01771, 2022.
|
| 287 |
+
|
| 288 |
+
Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015.
|
| 289 |
+
|
| 290 |
+
Kevin Lu, Aditya Grover, Pieter Abbeel, and Igor Mordatch. Pretrained transformers as universal computation engines, 2021.
|
| 291 |
+
|
| 292 |
+
Corey Lynch and Pierre Sermanet. Language conditioned imitation learning over unstructured data. Proceedings of Robotics: Science and Systems. doi, 10, 2021.
|
| 293 |
+
|
| 294 |
+
Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models, 2016.
|
| 295 |
+
|
| 296 |
+
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. nature, 518(7540):529–533, 2015.
|
| 297 |
+
|
| 298 |
+
Yuki Noguchi, Tatsuya Matsushima, Yutaka Matsuo, and Shixiang Shane Gu. Tool as embodiment for recursive manipulation. arXiv preprint arXiv:2112.00359, 2021.
|
| 299 |
+
|
| 300 |
+
Emilio Parisotto, Francis Song, Jack Rae, Razvan Pascanu, Caglar Gulcehre, Siddhant Jayakumar, Max Jaderberg, Raphaël Lopez Kaufman, Aidan Clark, Seb Noury, Matthew Botvinick, Nicolas Heess, and Raia Hadsell. Stabilizing transformers for reinforcement learning. In Hal Daumé III and Aarti Singh (eds.), Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pp. 7487–7498. PMLR, 13–18 Jul 2020. URL https://proceedings.mlr.press/v119/parisotto20a.html.
|
| 301 |
+
|
| 302 |
+
Deepak Pathak, Chris Lu, Trevor Darrell, Phillip Isola, and Alexei A Efros. Learning to control self-assembling morphologies: a study of generalization via modularity. arXiv preprint arXiv:1902.05546, 2019.
|
| 303 |
+
|
| 304 |
+
Xue Bin Peng, Aviral Kumar, Grace Zhang, and Sergey Levine. Advantage-weighted regression: Simple and scalable off-policy reinforcement learning. arXiv preprint arXiv: Arxiv-1910.00177, 2019.
|
| 305 |
+
|
| 306 |
+
Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Suskeveter. Improving language understanding by generative pre-training. 2018.
|
| 307 |
+
|
| 308 |
+
Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019.
|
| 309 |
+
|
| 310 |
+
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 ICML, 2021.
|
| 311 |
+
|
| 312 |
+
Scott Reed, Konrad Zolna, Emilio Parisotto, Sergio Gomez Colmenarejo, Alexander Novikov, Gabriel Barth-Maron, Mai Gimenez, Yury Sulsky, Jackie Kay, Jost Tobias Springenberg, Tom Eccles, Jake Bruce, Ali Razavi, Ashley D. Edwards, Nicolas Manfred Otto Heess, Yutian Chen, Raia Hadsell, Oriol Vinyals, Mahyar Bordbar, and Nando de Freitas. A generalist agent. ArXiv, abs/2205.06175, 2022.
|
| 313 |
+
|
| 314 |
+
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), pp. 1715–1725, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/P16-1162. URL https://aclanthology. org/P16-1162.
|
| 315 |
+
|
| 316 |
+
Mohit Shridhar, Lucas Manuelli, and Dieter Fox. Cliport: What and where pathways for robotic manipulation. In Conference on Robot Learning, pp. 894–906. PMLR, 2022.
|
| 317 |
+
|
| 318 |
+
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.
|
| 319 |
+
|
| 320 |
+
Avi Singh, Huihan Liu, Gaoyue Zhou, Albert Yu, Nicholas Rhinehart, and Sergey Levine. Parrot: Data-driven behavioral priors for reinforcement learning. arXiv preprint arXiv:2011.10024, 2020.
|
| 321 |
+
|
| 322 |
+
Rupesh Kumar Srivastava, Pranav Shyam, Filipe Mutz, Wojciech Jaskowski, and Jürgen Schmidhuber. ´ Training agents using upside-down reinforcement learning. arXiv preprint arXiv:1912.02877, 2019.
|
| 323 |
+
|
| 324 |
+
Dhruva Tirumala, Alexandre Galashov, Hyeonwoo Noh, Leonard Hasenclever, Razvan Pascanu, Jonathan Schwarz, Guillaume Desjardins, Wojciech Marian Czarnecki, Arun Ahuja, Yee Whye Teh, et al. Behavior priors for efficient reinforcement learning. arXiv preprint arXiv:2010.14274, 2020.
|
| 325 |
+
|
| 326 |
+
Maria Tsimpoukelli, Jacob Menick, Serkan Cabi, S. M. Ali Eslami, Oriol Vinyals, and Felix Hill. Multimodal few-shot learning with frozen language models, 2021.
|
| 327 |
+
|
| 328 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need, 2017.
|
| 329 |
+
|
| 330 |
+
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.
|
| 331 |
+
|
| 332 |
+
Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. arXiv preprint arXiv: Arxiv-1804.07461, 2018a.
|
| 333 |
+
|
| 334 |
+
Tingwu Wang, Renjie Liao, Jimmy Ba, and Sanja Fidler. Nervenet: Learning structured policy with graph neural networks. In International Conference on Learning Representations, 2018b.
|
| 335 |
+
|
| 336 |
+
Christopher JCH Watkins and Peter Dayan. Q-learning. Machine learning, 8(3-4):279–292, 1992.
|
| 337 |
+
|
| 338 |
+
Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. Huggingface’s transformers: State-of-the-art natural language processing, 2020.
|
| 339 |
+
|
| 340 |
+
Yifan Wu, George Tucker, and Ofir Nachum. Behavior regularized offline reinforcement learning. arXiv preprint arXiv:1911.11361, 2019.
|
| 341 |
+
|
| 342 |
+
Lin Yen-Chen, Andy Zeng, Shuran Song, Phillip Isola, and Tsung-Yi Lin. Learning to see before learning to act: Visual pre-training for manipulation. In 2020 IEEE International Conference on Robotics and Automation (ICRA), pp. 7286–7293. IEEE, 2020.
|
| 343 |
+
|
| 344 |
+
Tianhe Yu, Deirdre Quillen, Zhanpeng He, Ryan Julian, Karol Hausman, Chelsea Finn, and Sergey Levine. Meta-world: A benchmark and evaluation for multi-task and meta reinforcement learning. In Conference on Robot Learning, pp. 1094–1100. PMLR, 2020.
|
| 345 |
+
|
| 346 |
+
Andy Zeng, Pete Florence, Jonathan Tompson, Stefan Welker, Jonathan Chien, Maria Attarian, Travis Armstrong, Ivan Krasin, Dan Duong, Vikas Sindhwani, et al. Transporter networks: Rearranging the visual world for robotic manipulation. arXiv preprint arXiv:2010.14406, 2020.
|
| 347 |
+
|
| 348 |
+
Andy Zeng, Maria Attarian, Brian Ichter, Krzysztof Choromanski, Adrian Wong, Stefan Welker, Federico Tombari, Aveek Purohit, Michael Ryoo, Vikas Sindhwani, Johnny Lee, Vincent Vanhoucke, and Pete Florence. Socratic models: Composing zero-shot multimodal reasoning with language. arXiv preprint arXiv: Arxiv-2204.00598, 2022.
|
| 349 |
+
|
| 350 |
+
Yuke Zhu, Josiah Wong, Ajay Mandlekar, and Roberto Martín-Martín. robosuite: A modular simulation framework and benchmark for robot learning. arXiv preprint arXiv:2009.12293, 2020.
|
| 351 |
+
|
| 352 |
+
# A APPENDIX
|
| 353 |
+
|
| 354 |
+
A.1 HYPERPARAMETERS & TRAINING DETAILS
|
| 355 |
+
Table 7: Hyperparameters used for OpenAI Gym
|
| 356 |
+
|
| 357 |
+
<table><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td>#Layers</td><td>3</td></tr><tr><td># Attention Heads</td><td>1</td></tr><tr><td>Activation fn.</td><td>ReLU</td></tr><tr><td>Batch size</td><td>64</td></tr><tr><td>Context Return-to-go conditioning</td><td>20</td></tr><tr><td></td><td>6000 HalfCheetah 3600 Hopper 5000 Walker</td></tr><tr><td>Dropout</td><td>0.2</td></tr><tr><td>Learning rate</td><td>1e-4</td></tr><tr><td>LR Warmup</td><td>5000 steps</td></tr><tr><td>K for GPT2</td><td>500</td></tr><tr><td>K for ChibiT</td><td>1000</td></tr><tr><td>入1</td><td>0.1</td></tr><tr><td>入2</td><td>0.2</td></tr><tr><td>Hopper 入1</td><td>0.2</td></tr></table>
|
| 358 |
+
|
| 359 |
+
On choosing the value of $K$ We base the choice of the value of $K$ based on GPU memory constraints. For $K = 1 0 0 0$ and $K = 5 0 0$ , we find that they perform similarly in practice (both time and performance wise), albeit $K = 1 0 0 0$ performing slightly better performance wise. However the memory requirements of $K = 1 0 0 0$ tend to double – which often leads to OOM errors on a our NVIDIA V100 16GB GPUs for GPT-2 (motivating our reason to use $K = 5 0 0$ for GPT-2 and $K = 1 0 0 0$ for ChibiT).
|
| 360 |
+
|
| 361 |
+
Other implementation details Pre-trained models are trained with and taken from the HuggingFace Transformers library (Wolf et al., 2020). The model code for our GPT2 model is gpt2, CLIP is openai/clip-vit-base-patch32, and iGPT openai/imagegpt-small.
|
| 362 |
+
|
| 363 |
+
Table 8: Model parameter counts and number of unique pre-training tokens
|
| 364 |
+
|
| 365 |
+
<table><tr><td>Model</td><td>Parameter Count</td><td>Num.Tokens</td></tr><tr><td>DT</td><td>596K</td><td></td></tr><tr><td>ChibiT</td><td>596K</td><td>107</td></tr><tr><td>iGPT</td><td>84M</td><td>1010</td></tr><tr><td>GPT-2</td><td>84M</td><td>1010</td></tr><tr><td>CLIP</td><td>38M</td><td>1010</td></tr></table>
|
| 366 |
+
|
| 367 |
+
Language Model Pre-training with larger sizes For our large sized pre-trained models in our model scale experiments, we use the following dimensions:
|
| 368 |
+
|
| 369 |
+
<table><tr><td>Param. Count</td><td>Model Dim.</td><td>Num. Heads</td><td>Num. Layers</td></tr><tr><td>3M</td><td>256</td><td>4</td><td>4</td></tr><tr><td>18M</td><td>512</td><td>8</td><td>6</td></tr><tr><td>84M</td><td>768</td><td>12</td><td>12</td></tr></table>
|
| 370 |
+
|
| 371 |
+
Table 9: Parameter count for various pre-trained models used in our model scale experiments.
|
| 372 |
+
|
| 373 |
+
# B ATTENTION VISUALIZATION
|
| 374 |
+
|
| 375 |
+
We visualize the attention weights with a temperature of 0.1 to improve visual interpretation.
|
| 376 |
+
|
| 377 |
+
C REPRODUCTION OF DT RESULTS VERSUS DT RESULTS IN (CHEN ET AL., 2021)
|
| 378 |
+
|
| 379 |
+
We re-run the results in (Chen et al., 2021) and include them for reference in Table 10.
|
| 380 |
+
|
| 381 |
+
<table><tr><td>Dataset</td><td>Environment</td><td>DT</td><td>DT(ours)</td></tr><tr><td rowspan="3">Medium Expert</td><td>HalfCheetah</td><td>86.8 ± 1.3</td><td>86.5 ± 0.8</td></tr><tr><td>Hopper</td><td>107.6 ± 1.8</td><td>107.4 ± 2.0</td></tr><tr><td>Walker</td><td>108.1 ± 0.2</td><td>108.4± 0.1</td></tr><tr><td rowspan="3">Medium</td><td>HalfCheetah</td><td>42.6 ± 0.1</td><td>42.1 ± 0.3</td></tr><tr><td>Hopper</td><td>67.6 ± 1.0</td><td>68.1± 3.1</td></tr><tr><td>Walker</td><td>74.0 ± 1.4</td><td>74.4 ± 1.9</td></tr><tr><td rowspan="3">Medium Replay</td><td>HalfCheetah</td><td>36.6 ± 0.8</td><td>36.2 ± 1.4</td></tr><tr><td>Hopper</td><td>82.7 ± 7.0</td><td>80.4 ± 6.3</td></tr><tr><td>Walker</td><td>66.6 ± 3.0</td><td>67.0± 2.4</td></tr><tr><td colspan="2">Average (All Settings)</td><td>74.7</td><td>74.5</td></tr></table>
|
| 382 |
+
|
| 383 |
+
Table 10: Re-implementation of Decision Transformer using their codebasea
|
| 384 |
+
|
| 385 |
+
# D PERFORMANCE PROFILES
|
| 386 |
+
|
| 387 |
+
We compute statistical significance tests using rliable (Agarwal et al., 2021) on OpenAI Gym. Specifically, as we are only comparing two algorithms DT (Chen et al., 2021) and ChibiT, we only plot performance profiles and the boostrapped confidence interval measure.
|
| 388 |
+
|
| 389 |
+

|
| 390 |
+
Figure 4: Performance profiles on D4RL datasets. Yellow colors represent ChibiT and blue colors represent Decision Transformer (DT). We report the profiles based on score distributions over 10 runs using different random seeds. Language model pre-trained models are consistently better than DT.
|
| 391 |
+
|
| 392 |
+

|
| 393 |
+
Figure 5: Bootstrapped confidence intervals (CIs) on D4RL datasets.Yellow colors represent ChibiT and blue colors represent Decision Transformer (DT). We report the intervals based on score distributions over 10 runs using different random seeds. Language model pre-trained models are consistently better than DT.
|
md/dev/ePhEbo039l/ePhEbo039l.md
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Focal Modulation Networks
|
| 2 |
+
|
| 3 |
+
Jianwei Yang, Chunyuan Li, Xiyang Dai, Jianfeng Gao {jianwyan,chunyl,xidai,jfgao}@microsoft.com
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
We propose focal modulation networks (FocalNets in short), where self-attention (SA) is completely replaced by a focal modulation module for modeling token interactions in vision. Focal modulation comprises three components: $( i )$ hierarchical contextualization, implemented using a stack of depth-wise convolutional layers, to encode visual contexts from short to long ranges, $( i i )$ gated aggregation to selectively gather contexts for each query token based on its content, and $( i i i )$ element-wise modulation or affine transformation to fuse the aggregated context into the query. Extensive experiments show FocalNets outperform the state-of-the-art SA counterparts (e.g., Swin and Focal Transformers) with similar computational cost on the tasks of image classification, object detection, and semantic segmentation. Specifically, FocalNets with tiny and base size achieve ${ \bf 8 2 . 3 \% }$ and $8 3 . 9 \%$ top-1 accuracy on ImageNet-1K. After pretrained on ImageNet22K, it attains $8 6 . 5 \%$ and $\mathbf { 8 7 . 3 \% }$ top-1 accuracy when finetuned with resolution $2 2 4 ^ { 2 }$ and $3 8 4 ^ { 2 }$ , respectively. When transferred to downstream tasks, FocalNets exhibit clear superiority. For object detection with Mask R-CNN, FocalNet base trained with $1 \times$ outperforms the Swin counterpart by 2.1 points and already surpasses Swin trained with $3 \times$ schedule $( 4 9 . 0 \nu . s . 4 8 . 5 )$ . For semantic segmentation with UPerNet, FocalNet base at single-scale outperforms Swin by 2.4, and beats Swin at multi-scale $( { \pmb 5 0 . 5 \nu . s . 4 9 . 7 } )$ . Using large FocalNet and mask2former, we achieve 58.5 mIoU for ADE20K semantic segmentation, and 57.9 PQ for COCO Panoptic Segmentation. These results render focal modulation a favorable alternative to SA for effective and efficient visual modeling. Code is available at: https://github.com/microsoft/FocalNet.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Transformers [66], originally proposed for natural language processing (NLP), have become a prevalent architecture in computer vision since the seminal work of Vision Transformer (ViT) [19]. Its promise has been demonstrated in various vision tasks including image classification [63, 69, 74, 46, 87, 65], object detection [3, 97, 93, 15], segmentation [67, 72, 13], and beyond [38, 91, 4, 9, 68, 36]. In Transformers, the self-attention (SA) is arguably the key to its success which enables inputdependent global interactions, in contrast to convolution operation which constrains interactions in a local region with a shared kernel. Despite this advantages, the efficiency of SA has been a concern due to its quadratic complexity over the number of visual tokens, especially for high-resolution inputs. To address this, many works have proposed SA variants through token coarsening [69], window attention [46, 65, 87], dynamic token selection [51, 81, 50], or the hybrid [79, 14]. Meanwhile, a number of models have been proposed by augmenting SA with (depth-wise) convolutions to capture long-range dependencies with a good awareness of local structures [74, 22, 78, 20, 18, 35, 7, 17].
|
| 12 |
+
|
| 13 |
+
In this work, we aim at answering the fundamental question: Is there a better way than (hybrid) SA to model input-dependent long-range interactions? We start with an analysis on the current advanced designs for SA. In Fig. 1(a), we show a window-wise attention between the red query token and the surrounding orange tokens proposed in Swin Transformer [46]. With a simple window-shift strategy, Swin attains superior performance to ResNets across various vision tasks. To enlarge the receptive field, focal attention [79] is proposed to additionally aggregate summarized visual tokens far away to capture coarse-grained, long-range visual dependencies, as shown in Fig. 1(b). To produce the outputs, both methods involve heavy interactions (green arrows) followed by equally heavy aggregations (purple arrows) between the query and a large number of spatially distributed tokens (context features), which are extracted via either window partition or unfolding. In this work, we take an alternative way by first aggregating contexts around each query and then modulating the query with the aggregated context. This alteration still enables input-dependent token interaction, but significantly eases the process by decoupling the aggregation from individual queries, hence making the interactions light-weight upon a couple of features. As shown in Fig. 1(c), we can simply apply query-agnostic aggregations (e.g., depth-wise convolution) to generate summarized tokens at different levels of granularity. Afterwards, these summarized contexts are selectively aggregated depending on the query content, and finally fused into the query vector. We call this new token interaction mechanism focal modulation, with which we replace SA in Transformers to build a simpler and attention-free architecture, called Focal Modulation Network, or FocalNet in short.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Illustrative comparison among (a) Window-wise Self-Attention (SA) [46], (b) Focal Attention (FA) [79] and (c) the proposed Focal Modulation. Given the query token , window-wise SA captures spatial context from its surrounding tokens , FA additionally uses far-away summarized tokens , and Focal Modulation first encodes spatial context at different levels of granularity into summarized tokens ( ), which are then adaptively fused into the query token depending on the query content. Green and purple arrows represent the attention interactions and query-dependent aggregations, respectively (we do not draw all arrows for clarity). Both window-wise self-attention and focal attention involve heavy interaction and aggregation operations, while our focal modulation turn both of them light-weight. Figures better viewed in color.
|
| 17 |
+
|
| 18 |
+
Finally, extensive experiments on image classification, object detection and segmentation, show that our FocalNets consistently and significantly outperform the SoTA SA counterparts with comparable costs. Notably, our FocalNet achieves $8 2 . 3 \%$ and $8 3 . 9 \%$ top-1 accuracy using tiny and base model size, but with comparable and doubled throughput than Swin and Focal Transformer, respectively. When pretrained on ImageNet-22K, our FocalNets achieve $8 6 . 5 \%$ and $\mathbf { 8 7 . 3 \% }$ in $2 2 4 ^ { 2 }$ and $3 8 4 ^ { \bar { 2 } }$ resolution, respectively, which are comparable or better than Swin at similar cost. The advantage is particularly significant when transferred to dense prediction tasks. For object detection on COCO [42], our FocalNets with tiny and base model size achieve 46.1 and 49.0 box mAP on Mask R-CNN $1 \times$ , surpassing Swin with $3 \times$ schedule (46.0 and 48.5 box mAP). For semantic segmentation on ADE20k [95], our FocalNet with base model size achieves 50.5 mIoU at single-scale evaluation, outperforming Swin at multi-scale evaluation $( 4 9 . 7 \ \mathrm { m I o U } )$ ). Using the pretrained large FocalNet, we achieve 58.5 mIoU for ADE20K semantic segmentation, and $5 7 . 9 \ \mathrm { P Q }$ for COCO Panoptic Segmentation based on Mask2former [12]. Furthermore, we apply our focal modulation to monolithic ViT and clearly demonstrate superior performance across different model sizes.
|
| 19 |
+
|
| 20 |
+
# 2 Related Work
|
| 21 |
+
|
| 22 |
+
Self-attentions. Transformer [66] is first introduced to vision in Vision Transformer (ViT) [19] by splitting an image into a sequence of visual tokens. The self-attention (SA) strategy in ViTs has demonstrated superior performance to modern convolutional neural networks (ConvNets) such as ResNet [27] when trained with optimized recipes [19, 63]. Afterwards, multi-scale architectures [5, 69, 78], light-weight convolution layers [74, 22, 39], local self-attention mechanisms [46, 87, 14, 79] and learnable attention weights [84] have been proposed to boost the performance and support high-resolution input. More comprehensive surveys are covered in [34, 24, 34]. Our focal modulation significantly differs from SA by first aggregating the contexts from different levels of granularity and then modulating individual query tokens, rendering an attention-free mechanism for token interactions. For context aggregation, our method is inspired by focal attention proposed in [79]. However, the context aggregation for focal modulation is performed at each query location instead of target location, followed by a modulation rather than an attention. These differences in mechanism lead to significant improvement of efficiency and performance as well. Another closely related work is Poolformer [83] which uses a pooling to summarize the local context and a simple subtraction to adjust the individual inputs. Though achieving decent efficiency, Poolformer lags behind popular vision transformers like Swin on performance. As we will show later, capturing local structures at different levels is essential for performance.
|
| 23 |
+
|
| 24 |
+
MLP architectures. Visual MLPs can be categorized into two groups: $( i )$ Global-mixing MLPs, such as MLP-Mixer [60] and ResMLP [62], perform global communication among visual tokens through spatial-wise projections augmented by various techniques, such as gating, routing, and Fourier transforms [44, 49, 58, 59]. (ii) Local-mixing MLPs sample nearby tokens for interactions, using spatial shifting, permutation, and pseudo-kernel mixing [82, 29, 41, 8, 23]. Recently, MixShift-MLP [92] exploits both local and global interactions with MLPs, in a similar spirit of focal attention [79]. Both MLP architectures and our focal modulation network are attention-free. However, focal modulation with multi-level context aggregation naturally captures the structures in both shortand long-range, and thus achieves much better accuracy-efficiency trade-off.
|
| 25 |
+
|
| 26 |
+
Convolutions. ConvNets have been the primary driver of the renaissance of deep neural networks in computer vision. The field has evolved rapidly since the emerge of VGG [52], InceptionNet [56] and ResNet [27]. Representative works that focus on the efficiency of ConvNets are MobileNet [30], ShuffleNet [90] and EfficientNet [57]. Another line of works aimed at integrating global context to compensate ConvNets such as SE-Net [32], Non-local Network [71], GCNet [2], LR-Net [31] and C3Net [80], etc. Introducing dynamic operation is another way to augment ConvNets as demonstrated in Involution [37] and DyConv [10]. Recently, ConvNets strike back from two aspects: (i) convolution layers are integrated to SA and bring significant gains [74, 22, 39, 20] or the vice versa [64]; $( i i )$ ResNets have closed the gap to ViTs using similar data augmentation and regularization strategies [73], and replacing SA with (dynamic) depth-wise convolution [25, 47] can also slightly surpass Swin. Our focal modulation network also exploits depth-wise convolution as the micro-architecture but goes beyond by introducing a multi-level context aggregation and input-dependent modulation. We will show this new module significantly outperforms raw convolution networks.
|
| 27 |
+
|
| 28 |
+
# 3 Focal Modulation Network
|
| 29 |
+
|
| 30 |
+
# 3.1 From Self-Attention to Focal Modulation
|
| 31 |
+
|
| 32 |
+
Given a visual feature map $\mathbf { X } \in \mathbb { R } ^ { H \times W \times C }$ as input, a generic encoding process generates for each visual token (query) $\bar { \pmb { x } } _ { i } \in \mathbb { R } ^ { C }$ a feature representation $\boldsymbol { y } _ { i } \in \mathbb { R } ^ { C }$ via the interaction $\tau$ with its surroundings $\mathbf { X }$ (e.g., neighboring tokens) and aggregation $\mathcal { M }$ over the contexts.
|
| 33 |
+
|
| 34 |
+
Self-attention. The self-attention modules use a late aggregation procedure formulated as
|
| 35 |
+
|
| 36 |
+
$$
|
| 37 |
+
\pmb { y } _ { i } = \mathcal { M } _ { 1 } ( \mathcal { T } _ { 1 } ( \pmb { x } _ { i } , \mathbf { X } ) , \mathbf { X } ) ,
|
| 38 |
+
$$
|
| 39 |
+
|
| 40 |
+
where the aggregation $\mathcal { M } _ { 1 }$ over the contexts $\mathbf { X }$ is performed after the attention scores between query and target are computed via interaction $\mathcal { T } _ { 1 }$ .
|
| 41 |
+
|
| 42 |
+
Focal modulation. In contrast, focal modulation generates refined representation $\mathbf { \nabla } _ { \mathbf { \boldsymbol { y } } _ { i } }$ using an early aggregation procedure formulated as
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
\mathbf { \boldsymbol { y } } _ { i } = \mathcal { T } _ { 2 } ( \mathcal { M } _ { 2 } ( i , \mathbf { \boldsymbol { X } } ) , \mathbf { \boldsymbol { x } } _ { i } ) ,
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
where the context features are first aggregated using $\mathcal { M } _ { 2 }$ at each location $i$ , then the query interacts with the aggregated feature based on $\mathcal { T } _ { 2 }$ to form $\mathbf { \nabla } _ { \mathbf { \boldsymbol { y } } _ { i } }$ .
|
| 49 |
+
|
| 50 |
+
Comparing Eq. (1) and Eq. (2), we see that $( i )$ the context aggregation of focal modulation $\mathcal { M } _ { 2 }$ amortizes the computation of contexts via a shared operator (e.g., depth-wise convolution), while $\mathcal { M } _ { 1 }$ in SA is more computationally expensive as it requires summing over non-shareable attention scores for different queries; $( i i )$ the interaction $\mathcal { T } _ { 2 }$ is a lightweight operator between a token and its context, while $\mathcal { T } _ { 1 }$ involves computing token-to-token attention scores, which has quadratic complexity.
|
| 51 |
+
|
| 52 |
+
Based on Eq. (2), we instantiate our focal modulation to
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
\mathbf { \mathscr { y } } _ { i } = q ( \mathbf { \mathscr { x } } _ { i } ) \odot m ( i , \mathbf { X } ) ,
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+

|
| 59 |
+
Figure 2: Left: Comparing SA (a) and focal modulation (b) side by side. Right: Detailed illustration of context aggregation in focal modulation (c).
|
| 60 |
+
|
| 61 |
+
where $q ( \cdot )$ is a query projection function and $\odot$ is the element-wise multiplication. $m ( \cdot )$ is a context aggregation function, whose output is called modulator. Fig. 2(a) and (b) compare self-attention and focal modulation. The proposed focal modulation has the following favorable properties:
|
| 62 |
+
|
| 63 |
+
• Translation invariance. Since $q ( \cdot )$ and $m ( \cdot )$ are always centered at the query token $i$ and no positional embedding is used, the modulation is invariant to translation of input feature map $\mathbf { X }$ . • Explicit input-dependency. The modulator is computed via $m ( \cdot )$ by aggregating the local features around target location $i$ , hence our focal modulation is explicitly input-dependent. • Spatial- and channel-specific. The target location $i$ as a pointer for $m ( \cdot )$ enables spatial-specific modulation. The element-wise multiplication enables channel-specific modulation. • Decoupled feature granularity. $q ( \cdot )$ preserve the finest information for individual tokens, while $m ( \cdot )$ extracts the coarser context. They are decoupled but combined through modulation.
|
| 64 |
+
|
| 65 |
+
In what follows, we describe in detail the implementation of $m ( \cdot )$ in Eq. (3).
|
| 66 |
+
|
| 67 |
+
# 3.2 Context Aggregation via $m ( \cdot )$
|
| 68 |
+
|
| 69 |
+
It has been proved that both short- and long-range contexts are important for visual modeling [79, 18, 47]. However, a single aggregation with larger receptive field is not only computationally expensive in time and memory, but also undermines the local fine-grained structures which are particularly useful for dense prediction tasks. Inspired by [79], we propose a multi-scale hierarchical context aggregation. As depicted in Fig. 2 (c), the aggregation procedure consists of two steps: hierarchical contextualization to extract contexts from local to global ranges at different levels of granularity and gated aggregation to condense all context features at different granularity levels into the modulator.
|
| 70 |
+
|
| 71 |
+
Step 1: Hierarchical Contextualization. Given input feature map $\mathbf { X }$ , we first project it into a new feature space with a linear layer $\mathbf { Z } ^ { 0 } = f _ { z } ( \mathbf { X } ) \in \bar { \mathbb { R } } ^ { H \times W \times C }$ . Then, a hierarchical presentation of contexts is obtained using a stack of $L$ depth-wise convolutions. At focal level $\ell \in \{ 1 , . . . , L \}$ , the output $\mathbf { Z } ^ { \ell }$ is derived by:
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
\begin{array} { r } { \mathbf { Z } ^ { \ell } = f _ { a } ^ { \ell } ( \mathbf { Z } ^ { \ell - 1 } ) \triangleq \mathsf { G e L U } ( \mathsf { D W } \mathbf { - C o n v } ( \mathbf { Z } ^ { \ell - 1 } ) ) \in \mathbb { R } ^ { H \times W \times C } , } \end{array}
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
where $f _ { a } ^ { \ell }$ is the contextualization function at the $\ell$ -th level, implemented via a depth-wise convolution DW-Conv with kernel size $k ^ { \ell }$ followed by a GeLU activation function [28]. The use of depth-wise convolution for hierarchical contextualization of Eq. (4) is motivated by its desirable properties. Compared to pooling [83, 32], depth-wise convolution is learnable and structure-aware. In contrast to regular convolution, it is channel-wise and thus computationally much cheaper.
|
| 78 |
+
|
| 79 |
+
Hierarchical contextualization of Eq. (4) generates $L$ levels of feature maps. At level $\ell$ , the effective receptive field is $\begin{array} { r } { r ^ { \ell } = 1 + \sum _ { i = 1 } ^ { \ell } ( k ^ { \ell } - 1 ) } \end{array}$ , which is much larger than the kernel size $k ^ { \ell }$ . To capture global context of the whole input, which could be high-resolution, we apply a global average pooling on the $L$ -th level feature map $\begin{array} { r } { \dot { \mathbf Z } ^ { L + 1 } = \mathsf { A v g } \ – \mathsf { P o o l } ( \mathbf Z ^ { \tilde { L } } ) } \end{array}$ . Thus, we obtain in total $( L + 1 )$ feature maps $\{ \mathbf { Z } ^ { \ell } \} _ { \ell = 1 } ^ { L + 1 }$ , which collectively capture short- and long-range contexts at different levels of granularity.
|
| 80 |
+
|
| 81 |
+

|
| 82 |
+
Figure 3: Visualization of gating values $\mathbf { G }$ in Eq. (5) at last layer of our FocalNet $L = 3$ ) pretrained on ImageNet-1K. The columns from left to right are input images, gating maps at focal level 1,2,3 and global level.
|
| 83 |
+
|
| 84 |
+

|
| 85 |
+
Figure 4: Visualization of modulator values (corresponding to the right side of $\odot$ in Eq. (6)) at the last layer in FocalNet. The original modulator map is upsampled for display.
|
| 86 |
+
|
| 87 |
+
# Step 2: Gated Aggregation.
|
| 88 |
+
|
| 89 |
+
In this step, the $( L + 1 )$ feature maps obtained via hierarchical contextualization are condensed into a modulator. In an image, the relation between a visual token (query) and its surrounding contexts often depends on the content itself. For example, the model might rely on local fine-grained features for encoding the queries of salient visual objects, but mainly global coarse-grained features for the queries of background scenes. Based on this intuition, we use a gating mechanism to control how much to aggregate from different levels for each query. Specifically, we use a linear layer to obtain a spatial- and level-aware gating weights $\mathbf { G } = f _ { g } ( \bar { \mathbf { X } } ) \in \mathbb { R } ^ { \bar { H } \times W \times ( L + 1 ) }$ . Then, we perform a weighted sum through an element-wise multiplication to obtain a single feature map ${ \bf Z } ^ { o u t }$ which has the same size as the input $\mathbf { X }$ ,
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
\mathbf { Z } ^ { o u t } = \sum _ { \ell = 1 } ^ { L + 1 } \mathbf { G } ^ { \ell } \odot \mathbf { Z } ^ { \ell } \in \mathbb { R } ^ { H \times W \times C }
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
where $\mathbf { G } ^ { \ell } \in \mathbb { R } ^ { H \times W \times 1 }$ is a slice of $\mathbf { G }$ for the level $\ell$ . When visualizing these gating maps in Fig. 3, we surprisingly find our FocalNet indeed learns gathering the context from different focal levels adaptively as we expect. As we can see, for a token on a small object, it focuses more on the fine-grained local structure at low focal level, while a token in a uniform background needs to be aware of much larger contexts from higher levels. Until now, all the aggregation is spatial. To enable the communication across different channels, we use another linear layer $h ( . )$ to obtain the modulator map $\mathbf { M } = h ( \mathbf { Z } ^ { o u t } ) \in \mathbb { R } ^ { H \times W \times C }$ . In Fig. 4, we visualize the magnitude of modulator M at the last layer of our FocalNet. Interestingly, the modulators automatically pay more attention to the objects inducing the category, which implies a simple way of interpreting FocalNets.
|
| 96 |
+
|
| 97 |
+
Focal Modulation. Given the implementation of $m ( \cdot )$ as described above, focal modulation of Eq.(3) can be rewritten at the token level as
|
| 98 |
+
|
| 99 |
+
$$
|
| 100 |
+
{ \pmb y } _ { i } = q ( { \pmb x } _ { i } ) \odot h ( \sum _ { \ell = 1 } ^ { L + 1 } { \pmb g } _ { i } ^ { \ell } \cdot { \pmb z } _ { i } ^ { \ell } )
|
| 101 |
+
$$
|
| 102 |
+
|
| 103 |
+
where $\mathbf { \Delta } _ { \mathbf { \boldsymbol { g } } _ { i } ^ { \ell } }$ and $ { \boldsymbol { z } } _ { i } ^ { \ell }$ are the gating value and visual feature at location $i$ of $\mathbf { G } ^ { \ell }$ and $\mathbf { Z } ^ { \ell }$ , respectively. We summarize the proposed focal modulation in Pytorch-style pseudo code in Algorithm 1. As we can see, it can be easily implemented with a few convolution and linear layers.
|
| 104 |
+
|
| 105 |
+
# 3.3 Complexity
|
| 106 |
+
|
| 107 |
+
In focal modulation as Eq. (6), there are mainly three linear projections $q ( \cdot ) , h ( \cdot )$ , and $f _ { z } ( \cdot )$ for $\mathbf { Z } ^ { 0 }$ . Besides, it requires a lightweight linear function $f _ { g } ( \cdot )$ for gating and $L$ depth-wise convolution $f _ { a } ^ { \{ 1 , \dots , L \} }$ for hierarchical contextualization. Therefore, the overall number of learnable parameters is $\begin{array} { r } { 3 C ^ { 2 } + C ( L + 1 ) + C \sum _ { \ell } ( k ^ { \ell } ) ^ { 2 } } \end{array}$ . Since $L$ and $( k ^ { \ell } ) ^ { 2 }$ are typically much smaller than $C$ , the model size is mainly determined by the first term as we will show in Sec. 4. Regarding the time complexity, besides the linear projections and the depth-wise convolution layers, the element-wise multiplications introduce $\mathcal { O } ( C ( \bar { L ^ { } } + \bar { 2 } ) )$ for each visual token. Hence, the total complexity for a feature map is $\mathcal { O } ( H W \times ( 3 C ^ { 2 } + C ( 2 L + 3 ) + C \textstyle \sum _ { \ell } ( k ^ { \ell } ) ^ { 2 } ) )$ . For comparison, a window-wise attention in Swin Transformer with window size $w$ is $\mathcal { O } ( H W \times ( 3 C ^ { 2 } + 2 C w ^ { 2 } ) )$ , where $w$ is the window size.
|
| 108 |
+
|
| 109 |
+
# Algorithm 1: Pseudo code for Focal Modulation.
|
| 110 |
+
|
| 111 |
+
# Input/output shape: (B, H, W, C); Batchsize B; Feature map height H, width W, dim C
|
| 112 |
+
# Focal levels: L; Conv kernel size at level $\ell$ : $\mathtt { k } ^ { \ell }$
|
| 113 |
+
1 def init( ):
|
| 114 |
+
2 pj_in, pj_cxt $=$ Linear(C, $2 * \texttt { C } + \texttt { ( L + 1 ) }$ ), Conv2d(C, C, 1)
|
| 115 |
+
3 hc_layers $=$ [Sequential(Conv2d(C, C, $\mathbf { k } ^ { \ell }$ , group $\mathsf { \Omega } _ { \mathsf { S } } { = } \mathsf { C } \mathrm { \Omega } ,$ ), GeLU()) for ℓ in range(L)]
|
| 116 |
+
4 pj_out $=$ Sequential(Linear(C, C), Dropout())
|
| 117 |
+
5 def forward $( \mathbf { x } , \mathbf { m } { = } 0 )$ :
|
| 118 |
+
6 x = pj_in $\mathbf { \Psi } ( \mathbf { x } )$ .permute(0, 3, 1, 2)
|
| 119 |
+
7 q, z, gate $=$ split(x, (C, C, L+1), 1)
|
| 120 |
+
8 for $\ell$ in range(L):
|
| 121 |
+
9 $z =$ hc_layers[ℓ] $\left( z \right)$ # Eq.(4), hierarchical contextualization
|
| 122 |
+
10 $\texttt { m } = \texttt { m } + \texttt { z } *$ gate[:, $\ell : \ell + 1 ]$ # Eq.(5), gated aggregation
|
| 123 |
+
11 m = m + GeLU(z.mean(dim=(2,3))) $^ *$ gate[:,L:]
|
| 124 |
+
12 x = q \* pj_cxt(m) # Eq.(6), focal modulation
|
| 125 |
+
13 return pj_out( $\textbf { x }$ .permute(0, 2, 3, 1) )
|
| 126 |
+
|
| 127 |
+
# 3.4 Network Architectures
|
| 128 |
+
|
| 129 |
+
We use the same stage layouts and hidden dimensions as in Swin [46] and Focal Transformers [79], but replace the SA modules with the focal modulation modules. We thus construct a series of Focal Modulation Network (FocalNet) variants. In FocalNets, we only need to specify the number of focal levels $( L )$ and the kernel size $( k ^ { \ell } )$ at each level. For simplicity, we gradually increase the kernel size by 2 from lower focal levels to higher ones, i.e., $k ^ { \ell } = k ^ { \ell - 1 } + \widecheck { 2 }$ . To match the complexities of Swin and Focal Transformers, we design a small receptive field (SRF) and a large receptive field (LRF) version for each of the four layouts by using 2 and 3 focal levels, respectively. We use non-overlapping convolution layers for patch embedding at the beginning (kernel $\mathrm { s i z e { = } 4 \times 4 }$ stride ${ : = } 4$ ) and between two stages (kernel $\mathrm { s i z e { = } 2 \times 2 }$ , stride $^ { = 2 }$ ), respectively.
|
| 130 |
+
|
| 131 |
+
# 4 Experiment
|
| 132 |
+
|
| 133 |
+
# 4.1 Image Classification
|
| 134 |
+
|
| 135 |
+
We compare different methods on ImageNet-1K classification [16]. Following the recipes in [63, 46, 79], we train FocalNet-T, FocalNet-S and FocalNet-B with ImageNet-1K training set and report Top-1 accuracy $( \% )$ on the validation set. Training details are described in the appendix.
|
| 136 |
+
|
| 137 |
+
To verify the effectiveness of FocalNet, we compare it with three groups of methods based on ConvNets, Transformers and MLPs. The results are reported in Table 1. We see that FocalNets outperform the conventional CNNs (e.g., ResNet [27] and the augmented version [73]), MLP architectures such as MLP-Mixer [61] and gMLP [43], and Transformer architectures DeiT [63] and PVT [69]. In particular, we compare FocalNets against Swin and Focal Transformers which use the same architecture to verify FocalNet’s stand-alone effectiveness at the bottom part. We see that FocalNets with small receptive fields (SRF) achieve consistently better performance than Swin Transformer but with similar model size, FLOPs and throughput. For example, the tiny FocalNet improves Top-1 accuracy by $0 . 9 \%$ over Swin-Tiny. To compare with Focal Transformers (FocalAtt), we change to large receptive fields (LRF) though it is still much smaller than the one used in FocalAtt. Focal modulation outperforms the strong and sophisticatedly designed focal attention across all model sizes. More importantly, its run-time speed is much higher than FocalAtt by getting rid of many time-consuming operations like rolling and unfolding.
|
| 138 |
+
|
| 139 |
+
Model augmentation. We investigate whether some commonly used techniques for vision transformers can also improve our FocalNets. First, we study the effect of using overlapped patch embedding for downsampling [22]. Following [74], we change the kernel size and stride from $( 4 , 4 )$ to $( 7 , 4 )$ for patch embedding at the beginning, and $( 2 , 2 )$ to $( 3 , 2 )$ for later stages. The comparisons are reported in Table 2. Overlapped patch embedding improves the performance for models of all sizes, with slightly increased computational complexity and time cost. Second, we make our FocalNets deeper but thinner as in [18, 96]. In Table 3, we change the depth layout of our FocalNet-T from 2-2-6-2 to 3-3-16-3, and FocalNet-S/B from 2-2-18-2 to 4-4-28-4. Meanwhile, the hidden dimension at first stage is reduced from 96, 128 to 64, 96, respectively. These changes lead to smaller model sizes and fewer FLOPs, but higher time cost due to the increased number of sequential blocks. It turns out that going deeper improves the performance of FocalNets significantly. These results demonstrate that the commonly used model augmentation techniques developed for vision transformers can be easily adopted to improve the performance of FocalNets.
|
| 140 |
+
|
| 141 |
+
<table><tr><td>Model</td><td>#Params.FLOPs Throughput Top-1 (M)</td><td>(G)</td><td>(imgs/s)</td><td>(%)</td></tr><tr><td></td><td>25.0</td><td>4.1</td><td>1294</td><td>76.2</td></tr><tr><td>ResNet-50 [27]</td><td>45.0</td><td>7.9</td><td>745</td><td>77.4</td></tr><tr><td>ResNet-101 [27]</td><td>60.0</td><td>11.0</td><td>522</td><td>78.3</td></tr><tr><td>ResNet-152 [27] ResNet-50-SB[73]</td><td>25.0</td><td>4.1</td><td>1294</td><td>79.8</td></tr><tr><td>ResNet-101-SB[73]</td><td>45.0</td><td>7.9</td><td>745</td><td>81.3</td></tr><tr><td>ResNet-152-SB [73]</td><td>60.0</td><td>11.6</td><td>522</td><td>81.8</td></tr><tr><td>DW-Net-T[25]</td><td>24.2</td><td>3.8</td><td>1030</td><td>81.2</td></tr><tr><td>DW-Net-B [25]</td><td>74.3</td><td>12.9</td><td>370</td><td>83.2</td></tr><tr><td>Mixer-B/16 [61]</td><td></td><td></td><td></td><td></td></tr><tr><td>gMLP-S[43]</td><td>59.9 19.5</td><td>12.7 4.5</td><td>455</td><td>76.4</td></tr><tr><td>gMLP-B [43]</td><td>73.4</td><td>15.8</td><td>785</td><td>79.6 81.6</td></tr><tr><td>ResMLP-S24[62]</td><td>30.0</td><td>6.0</td><td>301</td><td>79.4</td></tr><tr><td>ResMLP-B24 [62]</td><td>129.1</td><td>23.0</td><td>871 61</td><td>81.0</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>DeiT-Small/16 [63]</td><td>22.1</td><td>4.6</td><td>939</td><td>79.9</td></tr><tr><td>DeiT-Base/16 [63]</td><td>86.6</td><td>17.5</td><td>291</td><td>81.8</td></tr><tr><td>PVT-Small [69]</td><td>24.5</td><td>3.8</td><td>794</td><td>79.8</td></tr><tr><td>PVT-Medium [69]</td><td>44.2</td><td>6.7</td><td>517</td><td>81.2</td></tr><tr><td>PVT-Large [69]</td><td>61.4</td><td>9.8</td><td>352</td><td>81.7</td></tr><tr><td>PoolFormer-m36 [83]</td><td>56.2</td><td>8.8</td><td>463</td><td>82.1</td></tr><tr><td>PoolFormer-m48 [83]</td><td>73.5</td><td>11.6</td><td>347</td><td>82.5</td></tr><tr><td>Swin-Tiny [46]</td><td>28.3</td><td>4.5</td><td>760</td><td>81.2</td></tr><tr><td>FocalNet-T (SRF)</td><td>28.4</td><td>4.4</td><td>743</td><td>82.1</td></tr><tr><td>Swin-Small [46]</td><td>49.6</td><td>8.7</td><td>435</td><td>83.1</td></tr><tr><td>FocalNet-S (SRF)</td><td>49.9</td><td>8.6</td><td>434</td><td>83.4</td></tr><tr><td>Swin-Base [46]</td><td>87.8</td><td>15.4</td><td>291</td><td>83.5</td></tr><tr><td>FocalNet-B (SRF)</td><td>88.1</td><td>15.3</td><td>280</td><td>83.7</td></tr><tr><td>FocalAtt-Tiny [79]</td><td>28.9</td><td>4.9</td><td>319</td><td>82.2</td></tr><tr><td>FocalNet-T (LRF)</td><td>28.6</td><td>4.5</td><td>696</td><td>82.3</td></tr><tr><td>FocalAtt-Small</td><td>51.1</td><td>9.4</td><td>192</td><td>83.5</td></tr><tr><td>FocalNet-S (LRF)</td><td>50.3</td><td>8.7</td><td>406</td><td>83.5</td></tr><tr><td>FocalAtt-Base [79]</td><td>89.8</td><td>16.4</td><td>138</td><td>83.8</td></tr><tr><td>FocalNet-B (LRF)</td><td>88.7</td><td>15.4</td><td>269</td><td>83.9</td></tr></table>
|
| 142 |
+
|
| 143 |
+
Table 1: ImageNet-1K classification comparison.
|
| 144 |
+
|
| 145 |
+
Table 2: Effect of overlapped patch embedding.
|
| 146 |
+
|
| 147 |
+
<table><tr><td>Model</td><td>Overlapped #Params.FLOPs Throughput Top-1 PatchEmbed</td><td>(M)</td><td>(G)</td><td>(imgs/s)</td><td>(%)</td></tr><tr><td>FocalNet-T (SRF)</td><td></td><td>28.4</td><td>4.4</td><td>743</td><td>82.1</td></tr><tr><td>FocalNet-T (SRF)</td><td>√</td><td>30.4</td><td>4.4</td><td>730</td><td>82.4</td></tr><tr><td>FocalNet-S (SRF)</td><td></td><td>49.9</td><td>8.6</td><td>434</td><td>83.4</td></tr><tr><td>FocalNet-S (SRF)</td><td>√</td><td>51.8</td><td>8.6</td><td>424</td><td>83.4</td></tr><tr><td>FocalNet-B (SRF)</td><td></td><td>88.1</td><td>15.3</td><td>286</td><td>83.7</td></tr><tr><td>FocalNet-B (SRF)</td><td>√</td><td>91.6</td><td>15.3</td><td>278</td><td>84.0</td></tr></table>
|
| 148 |
+
|
| 149 |
+
Table 3: Effect of deeper and thinner networks.
|
| 150 |
+
|
| 151 |
+
<table><tr><td>Model</td><td>Depth</td><td></td><td>Dim.#Params.FLOPs Throughput Top-1</td><td></td><td></td><td></td></tr><tr><td>FocalNet-T (SRF)</td><td>2-2-6-2</td><td>96</td><td>28.4</td><td>4.4</td><td>743</td><td>82.1</td></tr><tr><td>FocalNet-T (SRF)</td><td>3-3-16-3</td><td>64</td><td>25.1</td><td>4.0</td><td>663</td><td>82.7</td></tr><tr><td>FocalNet-S (SRF)</td><td>2-2-18-2</td><td>96</td><td>49.9</td><td>8.6</td><td>434</td><td>83.4</td></tr><tr><td>FocalNet-S (SRF)</td><td>4-4-28-4</td><td>64</td><td>38.2</td><td>6.4</td><td>440</td><td>83.5</td></tr><tr><td>FocalNet-B (SRF)</td><td>2-2-18-2</td><td>128</td><td>88.1</td><td>15.3</td><td>280</td><td>83.7</td></tr><tr><td>FocalNet-B (SRF)</td><td>4-4-28-4</td><td>96</td><td>85.1</td><td>14.3</td><td>247</td><td>84.1</td></tr></table>
|
| 152 |
+
|
| 153 |
+
<table><tr><td>Model</td><td>Img. Size #Params FLOPs Throughput Top-1</td><td></td><td></td><td></td><td></td></tr><tr><td>ResNet-101x3 [27]</td><td>384²</td><td>388.0</td><td>204.6</td><td>-</td><td>84.4</td></tr><tr><td>ResNet-152x4 [27]</td><td>480²</td><td>937.0</td><td>840.5</td><td>-</td><td>85.4</td></tr><tr><td>ViT-B/16[19]</td><td>3842</td><td>86.0</td><td>55.4</td><td>99</td><td>84.0</td></tr><tr><td>ViT-L/16[19]</td><td>3842</td><td>307.0</td><td>190.7</td><td>30</td><td>85.2</td></tr><tr><td>Swin-Base [46]</td><td>2242/2242</td><td>88.0</td><td>15.4</td><td>291</td><td>85.2</td></tr><tr><td>FocalNet-B</td><td>2242/224²</td><td>88.1</td><td>15.3</td><td>280</td><td>85.6</td></tr><tr><td>Swin-Base [46]</td><td>3842/3842</td><td>88.0</td><td>47.1</td><td>91</td><td>86.4</td></tr><tr><td>FocalNet-B</td><td>2242/3842</td><td>88.1</td><td>44.8</td><td>94</td><td>86.5</td></tr><tr><td>Swin-Large [46]</td><td>2242/224²</td><td>196.5</td><td>34.5</td><td>155</td><td>86.3</td></tr><tr><td>FocalNet-L</td><td>2242/224²</td><td>197.1</td><td>34.2</td><td>144</td><td>86.5</td></tr><tr><td>Swin-Large [46]</td><td>3842/3842</td><td>196.5</td><td>104.0</td><td>49</td><td>87.3</td></tr><tr><td>FocalNet-L</td><td>2242/3842</td><td>197.1</td><td>100.6</td><td>50</td><td>87.3</td></tr></table>
|
| 154 |
+
|
| 155 |
+
Table 4: ImageNet-1K finetuning results with models pretrained on ImageNet-22K. Numbers before and after $" / "$ are resolutions used for pretraining and finetuning, respectively.
|
| 156 |
+
|
| 157 |
+
ImageNet-22K pretraining. We investigate the effectiveness of FocalNets when pretrained on ImageNet-22K which contains $1 4 . 2 \mathbf { M }$ images and 21K categories. Training details are described in the appendix. We report the results in Table 4. Though FocalNet-B/L are both pretrained with $2 2 4 \times 2 2 4$ resolution and directly transferred to target domain with $3 8 4 \times 3 8 4$ image size, we can see that they consistently outperform Swin Transformers.
|
| 158 |
+
|
| 159 |
+
# 4.2 Detection and Segmentation
|
| 160 |
+
|
| 161 |
+
Object detection and instance segmentation. We make comparisons on object detection with COCO 2017 [42]. We choose Mask R-CNN [26] as the detection method and use FocalNet-T/S/B pretrained on ImageNet-1K as the backbones. All models are trained on the $1 1 8 \mathrm { k }$ training images and evaluated on 5K validation images. We use two standard training recipes, $1 \times$ schedule with 12 epochs and $3 \times$ schedule with 36 epochs. Following [46], we use the same multi-scale training strategy by randomly resizing the shorter side of an image to [480, 800]. Similar to [79], we increase the kernel size $k ^ { \ell }$ by 6 for context aggregation at all focal levels to adapt to higher input resolutions. Instead of up-sampling the relative position biases as in [79], FocalNets uses simple zero-padding for the extra kernel parameters. This expanding introduces negligible overhead but helps extract longer range contexts. For training, we use AdamW [48] as the optimizer with initial learning rate $1 0 ^ { - 4 }$ and weight decay 0.05. All models are trained with batch size 16. We set the stochastic drop rates to 0.1, 0.2, 0.3 in $1 \times$ and 0.3, 0.5, 0.5 in $3 \times$ training schedule for FocalNet-T/S/B, respectively.
|
| 162 |
+
|
| 163 |
+
The results are shown in Table 5. We measure both box and mask mAP, and report the results for both small and large receptive field models. Comparing with Swin Transformer, FocalNets improve the box mAP $( \mathsf { A P } ^ { b } )$ by 2.2, 1.5 and 1.9 in $1 \times$ schedule for tiny, small and base models, respectively. In $3 \times$ schedule, the improvements are still consistent and significant. Remarkably, the $1 \times$ performance of FocalNet-T/B (45.9/48.8) rivals Swin-T/B (46.0/48.5) trained with $3 \times$ schedule. When comparing with FocalAtt [79], FocalNets with large receptive fields consistently outperform under all settings and cost much less FLOPs. For instance segmentation, we observe the similar trend as that of object detection for FocalNets. To further verify the generality of FocalNets, we train three detection models, Cascade Mask R-CNN [1], Sparse RCNN [55] and ATSS [88] with FocalNet-T as the backbone. We train all models with $3 \times$ schedule, and report the box mAPs in Table 6. As we can see, FocalNets bring clear gains to all three detection methods over the previous SoTA methods.
|
| 164 |
+
|
| 165 |
+
<table><tr><td rowspan="2">Backbone</td><td colspan="3">#Params FLOPs</td><td colspan="5">Mask R-CNN 1x</td><td colspan="6">Mask R-CNN 3x</td></tr><tr><td>(M)</td><td>(G)</td><td>APb</td><td>AP</td><td>AP5</td><td>Apm</td><td>AP</td><td>APm</td><td>APb</td><td>AP</td><td>AP5</td><td>Apm</td><td>AP</td><td>AP</td></tr><tr><td>ResNet50 [27]</td><td>44.2</td><td>260</td><td>38.0</td><td>58.6</td><td>41.4</td><td>34.4</td><td>55.1</td><td>36.7</td><td>|41.0</td><td>61.7</td><td>44.9</td><td>37.1</td><td>58.4</td><td>40.1</td></tr><tr><td>PVT-Small[69]</td><td>44.1</td><td>245</td><td>40.4</td><td>62.9</td><td>43.8</td><td>37.8</td><td>60.1</td><td>40.3</td><td>43.0</td><td>65.3</td><td>46.9</td><td>39.9</td><td>62.5</td><td>42.8</td></tr><tr><td>Twins-SVT-S[14]</td><td>44.0</td><td>228</td><td>43.4</td><td>66.0</td><td>47.3</td><td>40.3</td><td>63.2</td><td>43.4</td><td>46.8</td><td>69.2</td><td>51.2</td><td>42.6</td><td>66.3</td><td>45.8</td></tr><tr><td>Swin-Tiny[46]</td><td>47.8</td><td>264</td><td>43.7</td><td>66.6</td><td>47.7</td><td>39.8</td><td>63.3</td><td>42.7</td><td>46.0</td><td>68.1</td><td>50.3</td><td>-41.6</td><td>65.1</td><td>44.9</td></tr><tr><td>FocalNet-T (SRF)</td><td>48.6</td><td>267</td><td>45.9 (+2.2)</td><td>68.3</td><td>50.1</td><td>41.3</td><td>65.0</td><td>44.3</td><td>47.6 (+1.6)</td><td>69.5</td><td>52.0</td><td>42.6</td><td>66.5</td><td>45.6</td></tr><tr><td>FocalAtt-Tiny [79]</td><td>48.8</td><td>291</td><td>44.8</td><td>67.7</td><td>49.2</td><td>41.0</td><td>64.7</td><td>44.2</td><td>47.2</td><td>69.4</td><td>51.9</td><td>42.7</td><td>66.5</td><td>45.9</td></tr><tr><td>FocalNet-T (LRF)</td><td>48.9</td><td>268</td><td>46.1 (+1.3)</td><td>68.2</td><td>50.6</td><td>41.5</td><td>65.1</td><td>44.5</td><td>48.0 (+0.8)</td><td>69.7</td><td>53.0</td><td>42.9</td><td>66.5</td><td>46.1</td></tr><tr><td>ResNet101[27]</td><td>63.2</td><td>336</td><td>40.4</td><td>61.1</td><td>44.2</td><td>36.4</td><td>57.7</td><td>38.8</td><td>42.8</td><td>63.2</td><td>47.1</td><td>38.5</td><td>60.1</td><td>41.3</td></tr><tr><td>ResNeXt101-32x4d [77]</td><td>62.8</td><td>340</td><td>41.9</td><td>62.5</td><td>45.9</td><td>37.5</td><td>59.4</td><td>40.2</td><td>44.0</td><td>64.4</td><td>48.0</td><td>39.2</td><td>61.4</td><td>41.9</td></tr><tr><td>PVT-Medium [69]</td><td>63.9</td><td>302</td><td>42.0</td><td>64.4</td><td>45.6</td><td>39.0</td><td>61.6</td><td>42.1</td><td>44.2</td><td>66.0</td><td>48.2</td><td>40.5</td><td>63.1</td><td>43.5</td></tr><tr><td>Twins-SVT-B[14]</td><td>76.3</td><td>340</td><td>45.2</td><td>67.6</td><td>49.3</td><td>41.5</td><td>64.5</td><td>44.8</td><td>48.0</td><td>69.5</td><td>52.7</td><td>43.0</td><td>66.8</td><td>46.6</td></tr><tr><td>Swin-Small [46]</td><td>69.1</td><td>354</td><td>46.5</td><td>68.7</td><td>51.3</td><td>42.1</td><td>65.8</td><td>45.2</td><td>48.5</td><td>-70.2</td><td>53.5</td><td>43.3</td><td>67.3</td><td>46.6</td></tr><tr><td>FocalNet-S (SRF)</td><td>70.8</td><td>356</td><td>48.0 (+1.5)</td><td>69.9</td><td>52.7</td><td>42.7</td><td>66.7</td><td>45.7</td><td>48.9 (+0.4)</td><td>70.1</td><td>53.7</td><td>43.6</td><td>67.1</td><td>47.1</td></tr><tr><td>FocalAtt-Small [79]</td><td>71.2</td><td>401</td><td>47.4</td><td>69.8</td><td>51.9</td><td>42.8</td><td>66.6</td><td>46.1</td><td>48.8</td><td>70.5</td><td>53.6</td><td>43.8</td><td>67.7</td><td>47.2</td></tr><tr><td>FocalNet-S (LRF)</td><td>72.3</td><td>365</td><td>48.3 (+0.9)</td><td>70.5</td><td>53.1</td><td>43.1</td><td>67.4</td><td>46.2</td><td>49.3 (+0.5)</td><td>70.7</td><td>54.2</td><td>43.8</td><td>67.9</td><td>47.4</td></tr><tr><td>ResNeXt101-64x4d [77]</td><td>102.0</td><td>493</td><td>42.8</td><td>63.8</td><td>47.3</td><td>38.4</td><td>60.6</td><td>41.3</td><td>44.4</td><td>64.9</td><td>48.8</td><td>39.7</td><td>61.9</td><td>42.6</td></tr><tr><td>PVT-Large[69]</td><td>81.0</td><td>364</td><td>42.9</td><td>65.0</td><td>46.6</td><td>39.5</td><td>61.9</td><td>42.5</td><td>44.5</td><td>66.0</td><td>48.3</td><td>40.7</td><td>63.4</td><td>43.7</td></tr><tr><td>Twins-SVT-L[14]</td><td>119.7</td><td>474</td><td>45.9</td><td>-</td><td></td><td>41.6</td><td>-</td><td></td><td></td><td>-</td><td>-</td><td>-</td><td>1</td><td>-</td></tr><tr><td>Swin-Base[46]</td><td>107.1</td><td>497</td><td>46.9</td><td>69.2</td><td>51.6</td><td>42.3</td><td>66.0</td><td>45.5</td><td>48.5</td><td>69.8</td><td>53.2</td><td>43.4</td><td>66.8</td><td>46.9</td></tr><tr><td>FocalNet-B (SRF)</td><td>109.4</td><td>496</td><td>48.8 (+1.9)</td><td>70.7</td><td>53.5</td><td>43.3</td><td>67.5</td><td>46.5</td><td>49.6 (+1.1)</td><td>70.6</td><td>54.1</td><td>44.1</td><td>68.0</td><td>47.2</td></tr><tr><td>FocalAtt-Base [79]</td><td>110.0</td><td>533</td><td>47.8</td><td>70.2</td><td>52.5</td><td>43.2</td><td>67.3</td><td>46.5</td><td>49.0</td><td>70.1</td><td>53.6</td><td>43.7</td><td>67.6</td><td>47.0</td></tr><tr><td>FocalNet-B (LRF)</td><td>111.4</td><td>507</td><td>49.0 (+1.2)</td><td>70.9</td><td>53.9</td><td>43.5</td><td>67.9</td><td>46.7</td><td>49.8 (+0.8)</td><td>70.9</td><td>54.6</td><td>44.1</td><td>68.2</td><td>47.2</td></tr></table>
|
| 166 |
+
|
| 167 |
+
Table 5: COCO object detection and instance segmentation results with Mask R-CNN [26].
|
| 168 |
+
|
| 169 |
+
<table><tr><td>Method</td><td>Backbone</td><td>#Param.FLOPs</td><td></td><td>Apb</td><td>AP</td><td>AP5</td></tr><tr><td rowspan="5"></td><td>R-50[27]</td><td>82.0</td><td>739</td><td>46.3</td><td>64.3</td><td>50.5</td></tr><tr><td>DW-Net-T [25]</td><td>82.0</td><td>730</td><td>49.9</td><td>68.6</td><td>54.3</td></tr><tr><td>C.Mask R-CNN[1] Swin-T[46]</td><td>85.6</td><td>742</td><td>50.5</td><td>69.3</td><td>54.9</td></tr><tr><td>FocalNet-T (SRF)</td><td>86.4</td><td>746</td><td>51.5</td><td>70.1</td><td>55.8</td></tr><tr><td>FocalAtt-T[79] FocalNet-T (LRF)</td><td>86.7 87.1</td><td>770 751</td><td>51.5</td><td>70.6</td><td>55.9</td></tr><tr><td rowspan="5">Sparse R-CNN [55]</td><td>R-50 [27]</td><td>106.1</td><td></td><td> 51.5</td><td>70.3</td><td>56.0</td></tr><tr><td>Swin-T [46]</td><td>109.7</td><td>166</td><td>44.5</td><td>63.4</td><td>48.2</td></tr><tr><td></td><td></td><td>172</td><td>47.9</td><td>67.3</td><td>52.3</td></tr><tr><td>FocalNet-T (SRF) FocalAtt-T [79]</td><td>110.5</td><td>172</td><td>49.6</td><td>69.1</td><td>54.2</td></tr><tr><td>FocalNet-T (LRF)</td><td>110.8 111.2</td><td>196 178</td><td>49.0 49.9</td><td>69.1 69.6</td><td>53.2 54.4</td></tr><tr><td rowspan="5">ATSS [88]</td><td>R-50[27]</td><td>32.1</td><td>205</td><td>43.5</td><td>61.9</td><td>47.0</td></tr><tr><td>Swin-T[46]</td><td>35.7</td><td>212</td><td>47.2</td><td></td><td></td></tr><tr><td>FocalNet-T (SRF)</td><td>36.5</td><td>215</td><td>49.2</td><td>66.5</td><td>51.3</td></tr><tr><td>FocalAtt-T [79]</td><td>36.8</td><td>239</td><td>49.5</td><td>68.1</td><td>54.2</td></tr><tr><td>FocalNet-T (LRF)</td><td>37.2</td><td>220</td><td>49.6 (</td><td>68.8 68.7</td><td>53.9 54.5</td></tr></table>
|
| 170 |
+
|
| 171 |
+
Table 6: A comparison of models with different object detection methods, trained using the $3 \times$ schedule.
|
| 172 |
+
|
| 173 |
+
<table><tr><td rowspan=1 colspan=2>Backbone Crop Size #Param.FLOPs mIoU+MS</td></tr><tr><td rowspan=1 colspan=1>ResNet-101 [27]Twins-SVT-L [14]DW-Net-T[25]DW-Net-B [25]</td><td rowspan=1 colspan=1>512 86 102944.9 :512 133 - 48.850.2512 56 928 45.5 -512 132 924 48.3 -</td></tr><tr><td rowspan=1 colspan=1>Swin-T [46]</td><td rowspan=1 colspan=1>512 60 941 44.545.8</td></tr><tr><td rowspan=1 colspan=1>FocalNet-T (SRF)</td><td rowspan=1 colspan=1>512 61 944 46.547.2</td></tr><tr><td rowspan=1 colspan=1>FocalAtt-T [79]</td><td rowspan=1 colspan=1>512 62 998 45.847.0</td></tr><tr><td rowspan=1 colspan=1>FocalNet-T (LRF)</td><td rowspan=1 colspan=1>512 61 949 46.847.8</td></tr><tr><td rowspan=1 colspan=1>Swin-S [46]</td><td rowspan=1 colspan=1>512 81 103847.649.5</td></tr><tr><td rowspan=1 colspan=1>FocalNet-S (SRF)</td><td rowspan=1 colspan=1>512 83 103549.350.1</td></tr><tr><td rowspan=1 colspan=1>FocalAtt-S [79]</td><td rowspan=1 colspan=1>512 85 113048.050.0</td></tr><tr><td rowspan=1 colspan=1>FocalNet-S (LRF)</td><td rowspan=1 colspan=1>512 84 104449.150.1</td></tr><tr><td></td><td rowspan=1 colspan=1>512 121 118848.149.7</td></tr><tr><td rowspan=1 colspan=1>FocalNet-B (SRF)</td><td rowspan=1 colspan=1>512 124 118050.251.1</td></tr><tr><td rowspan=1 colspan=1>FocalAtt-B [79]</td><td rowspan=1 colspan=1>512 126 135449.050.5</td></tr><tr><td rowspan=1 colspan=1>FocalNet-B (LRF)</td><td rowspan=1 colspan=1>512 126 119250.551.4</td></tr></table>
|
| 174 |
+
|
| 175 |
+
Table 7: Semantic segmentation on ADE20K [95]. All models are trained with UperNet [75]. MS means multi-scale evaluation.
|
| 176 |
+
|
| 177 |
+
Semantic segmentation. We benchmark FocalNets on semantic segmentation, a dense prediction task that requires fine-grained understanding and long-range interactions. We use ADE20K [95] for our experiments and follow [46] to use UperNet [75] as the segmentation method. With FocalNetT/S/B trained on ImageNet-1K as the backbones, we train UperNet for 160k iterations with input resolution $5 1 2 \times 5 1 2$ and batch size 16. For comparisons, we report both single- and multi-scale (MS) mIoU. Table 7 shows the results with different backbones. FocalNet outperforms Swin and Focal Transformer significantly under all settings. Even for the base models, FocalNet (SRF) exceeds Swin Transformer by 2.1 and 1.4 at single- and multi-scale, respectively. Compared with Focal Transformer, FocalNets outperform Focal Transformer, with a larger gain than that of Swin Transformer, and consume much less FLOPs. These results demonstrate the superiority of FocalNets on the pixel-level dense prediction tasks, in addition to the instance-level object detection task.
|
| 178 |
+
|
| 179 |
+
Given the superior results for FocalNets on segmentation tasks shown in Table 7, we further investigate its effectiveness while scaling up. Particularly, to fairly compare with Swin-L pretrained on ImageNet22K with $3 8 4 \times 3 8 4$ , we also pretrain our FocalNet-L on ImageNet-22K with $3 8 4 \times 3 8 4$ with 3 focal levels and kernel sizes [3, 5, 7]. We use Mask2former [12] for semantic segmentation on ADE20K and panoptic segmentation on COCO. As shown in Table 8, FocalNet-L achieves superior performance to
|
| 180 |
+
|
| 181 |
+
<table><tr><td>Backbone</td><td>Method</td><td>#Param</td><td>mIoU</td><td>+MS</td></tr><tr><td>HRNet-w48 [54]</td><td>OCRNet [85]</td><td>71M</td><td>45.7</td><td>-</td></tr><tr><td>ResNeSt-200 [86]</td><td>DLab.v3+ [6]</td><td>88M</td><td>48.4</td><td>-</td></tr><tr><td>Swin-B[46]</td><td>UperNet [75]</td><td>121M</td><td>48.1</td><td>49.7</td></tr><tr><td>Twins-SVT-L [14]</td><td>UperNet [75]</td><td>133M</td><td>48.8</td><td>50.2</td></tr><tr><td>MiT-B5 [76]</td><td>SegFormer [76]</td><td>85M</td><td>51.0</td><td>51.8</td></tr><tr><td>ViT-L/16 [19]</td><td>SETR [94]</td><td>308M</td><td>50.3</td><td>-</td></tr><tr><td>Swin-L† [46]</td><td>UperNet [75]</td><td>234M</td><td>52.1</td><td>53.5</td></tr><tr><td>ViT-L/16 [19]</td><td>Segmenter [53]</td><td>334M</td><td>51.8</td><td>53.6</td></tr><tr><td>Swin-L† [46]</td><td>K-Net [89]</td><td></td><td>=</td><td>54.3</td></tr><tr><td>Swin-L† [46]</td><td>PatchDiverse [21]</td><td>234M</td><td>53.1</td><td>54.4</td></tr><tr><td>VOLO-D5 [84]</td><td>UperNet [75]</td><td></td><td>-</td><td>54.3</td></tr><tr><td>Focal-L†</td><td>UperNet [75]</td><td>240M</td><td>54.0</td><td>55.4</td></tr><tr><td>CSwin-L†</td><td>UperNet [75]</td><td>208M</td><td>54.0</td><td>55.7</td></tr><tr><td>BEIT-L+</td><td>UperNet [75]</td><td>441M</td><td>56.7</td><td>57.0</td></tr><tr><td>Swinv2-G‡ [45]</td><td>UperNet [75]</td><td>>3.0B</td><td>59.1</td><td></td></tr><tr><td>ViT-Adapter-Lf [11]</td><td>Mask2Former[12]</td><td>568M</td><td>58.3</td><td>59.0</td></tr><tr><td>Swin-Lt</td><td>Mask2Former [12]</td><td>216M</td><td>56.4</td><td>57.7</td></tr><tr><td>Swin-L-FaPNt</td><td>Mask2Former [12]</td><td>=</td><td>56.1</td><td>57.3</td></tr><tr><td>Swin-L-SeMask† [33]</td><td>Mask2Former [12]</td><td></td><td>57.0</td><td>58.2</td></tr><tr><td>FocalNet-L† (Ours)</td><td>Mask2Former [12]</td><td>218M</td><td>57.3</td><td>58.5</td></tr></table>
|
| 182 |
+
|
| 183 |
+
Table 8: Systematic comparisons of semantic segmentation on ADE20K validation set. † indicates pretraining with ImageNet-22K and ‡ means using extra data additionally.
|
| 184 |
+
|
| 185 |
+
<table><tr><td>Backbone</td><td>Method</td><td>#Param.</td><td>PQ</td><td>AP</td><td>mloU</td></tr><tr><td>ResNet-50 [27]</td><td>DETR [3]</td><td>-</td><td>43.4</td><td>=</td><td>:</td></tr><tr><td>ResNet-50 [27]</td><td>K-Net [89]</td><td>·</td><td>47.1</td><td>=</td><td>=</td></tr><tr><td>ResNet-50 [27]</td><td>Panoptic SegFormer [40]</td><td>47M</td><td>50.0</td><td>=</td><td>·</td></tr><tr><td>ResNet-50 [27]</td><td>Mask2Former [12]</td><td>44M</td><td>51.9</td><td>41.7</td><td>62.4</td></tr><tr><td>PVTv2-B5 [70]</td><td>Panoptic SegFormer [40]</td><td>101M</td><td>54.1</td><td>=</td><td>-</td></tr><tr><td>Swin-T[46]</td><td>MaskFormer [13]</td><td>42M</td><td>47.7</td><td>33.6</td><td>60.4</td></tr><tr><td>Swin-B [46]</td><td>MaskFormer [13]</td><td>102M</td><td>51.1</td><td>37.8</td><td>62.6</td></tr><tr><td>Swin-T[46]</td><td>Mask2Former [12]</td><td>47M</td><td>53.2</td><td>43.3</td><td>63.2</td></tr><tr><td>Swin-B [46]</td><td>Mask2Former [12]</td><td>107M</td><td>55.1</td><td>45.2</td><td>65.1</td></tr><tr><td>Swin-L† [46]</td><td>MaskFormer [13]</td><td>212M</td><td>52.7</td><td>40.1</td><td>64.8</td></tr><tr><td>Swin-L† [46]</td><td>Panoptic SegFormer [40]</td><td>·</td><td>55.8</td><td>-</td><td>·</td></tr><tr><td>Swin-L† [46]</td><td>Mask2Former [13] (200 queries)</td><td>216M</td><td>57.8</td><td>48.6</td><td>67.4</td></tr><tr><td>Focal-Lt (Ours)</td><td>Mask2Former [13] (200 queries)</td><td>226M</td><td>57.9</td><td>48.4</td><td>67.3</td></tr></table>
|
| 186 |
+
|
| 187 |
+
Table 9: Panoptic segmentation on COCO [42]. † means pretraining with ImageNet-22K. All models evaluated on minival with single-scale. PQ, AP and mIoU are three metrics for measuring the panoptic segmentation, instance segmentation and semantic segmentation, respectively.
|
| 188 |
+
|
| 189 |
+
<table><tr><td>Model</td><td>Formula</td><td>#Param. FLOPs Throughput Top-1</td><td></td><td></td></tr><tr><td>FocalNet-T (LRF)</td><td>y=q(wi)Oh∑ g5)</td><td>28.6</td><td>4.49</td><td>696</td><td>82.3</td></tr><tr><td>→ Depth-width ConvNet</td><td>yi=q(GeLU(h(z)))</td><td>28.6</td><td>4.47</td><td>738</td><td>81.6 (-0.7)</td></tr><tr><td>→Pooling Aggregator</td><td>=()Av</td><td>28.3</td><td>4.37</td><td>676</td><td>80.5 (-1.8)</td></tr><tr><td>→Global Pooling Aggregator</td><td>y=q(xi)h(gAvg-Pool(f(X)))</td><td>28.3</td><td>4.36</td><td>883</td><td>75.7 (-6.7)</td></tr><tr><td></td><td></td><td>28.6</td><td>4.61</td><td>456</td><td>81.5 (-0.8)</td></tr><tr><td></td><td>→Mult-scale Self-Atento(Qatery=HA(i+1),f,=Ientity</td><td>28.6</td><td>7.26</td><td>448</td><td>80.8 (-1.5)</td></tr><tr><td>→Sliding-window Self-Attention</td><td>y=MHSA(x,N(xi)),N(xi)|=77-1</td><td>28.3</td><td>4.49</td><td>103</td><td>81.5 (-0.8)</td></tr></table>
|
| 190 |
+
|
| 191 |
+
Table 10: Performance for different FocalNet model variants.
|
| 192 |
+
|
| 193 |
+
Swin-L with similar model size and same pretraining data. We note that the methods in gray font like Swinv2-G and ViT-Adapter-L achieve better performance but use much more parameters and training data. We leave the further scaling-up of our FocalNets as future work. In Table 9, we compare different models for panoptic segmentation on COCO with 133 categories. Our FocalNet-L slightly outperforms Swin-L on PQ, rendering a new state-of-the-art for panoptic segmentation. These results clearly demonstrate the effectiveness of our FocalNets for various segmentation tasks.
|
| 194 |
+
|
| 195 |
+
# 4.3 Network Inspection
|
| 196 |
+
|
| 197 |
+
Model Variants. We compare in Table 10 six different model variants derived from FocalNet.
|
| 198 |
+
|
| 199 |
+
• Depth-wise ConvNet. It feeds the feature vectors at the top level $L$ to a two-layer MLP. The resultant model is close to DW-Net [25]. Although it can achieve $8 1 . 6 \%$ , surpassing Swin $( 8 1 . 3 \% )$ , it underperforms FocalNet by $0 . 7 \%$ . FocalNet uses depth-wise convolutions as a component but differently for aggregating contexts, which is then used to modulate each individual tokens.
|
| 200 |
+
|
| 201 |
+
• Pooling Aggregator. It replaces the depth-wise convolution module with average pooling, and is similar to MetaFormer [83] in terms of token aggregation. Average pooling has slightly lower complexity but leads to a significant drop of accuracy by $1 . 8 \%$ . Compared with depth-wise convolution, pooling is permutation-invariant and thus incapable of capturing visual structures.
|
| 202 |
+
|
| 203 |
+
• Global Pooling Aggregator. It removes local aggregations at all levels and only keeps the global one $( \mathbf { Z } ^ { L + 1 } )$ . This variant resembles SENet [32]. It turns out that global context alone is insufficient for visual modeling, leading to a significant $6 . 7 \%$ drop.
|
| 204 |
+
|
| 205 |
+
• Multi-scale Self-Attention. Given the summarized tokens at different levels, a straightforward way to combine them is performing a SA among all of them. We have developed two SA methods: computing $ { \boldsymbol { q } } , { \boldsymbol { k } } , { \boldsymbol { v } }$ before and after aggregation, respectively. Both methods result in visible performance drop and increase the run time latency, compared to FocalNet.
|
| 206 |
+
|
| 207 |
+
• Sliding-window Self-Attention. Finally, we apply a sliding-window SA for each visual token within a window. Since it involves dense interactions for each fine-grained tokens, the time and memory cost explodes, and the performance is worse than FocalNet.
|
| 208 |
+
|
| 209 |
+
<table><tr><td>Model</td><td>FLOPs Throughput Top-1</td><td></td><td></td><td>AP</td><td>Apm</td></tr><tr><td>FocalNet-T (LRF)</td><td>4.48</td><td>696</td><td>82.3</td><td>46.2</td><td>41.6</td></tr><tr><td>Additive</td><td>4.49</td><td>670</td><td>81.5 (-0.8)</td><td>45.6 (-0.6)</td><td>41.1 (-0.5)</td></tr><tr><td>No global pool</td><td>4.48</td><td>683</td><td>82.0 (-0.3)</td><td>45.8 (-0.4)</td><td>41.2 (-0.4)</td></tr><tr><td>Top-only</td><td>4.49</td><td>698</td><td>81.9 (0.4)</td><td>45.7 (-0.5)</td><td>41.2 (-0.4)</td></tr><tr><td>No gating</td><td>4.48</td><td>707</td><td>81.9 (-0.4)</td><td>45.6 (-0.6)</td><td>41.1 (-0.5)</td></tr></table>
|
| 210 |
+
|
| 211 |
+
Table 11: Component analysis for focal modulation. Four separate changes are made to the original FocalNet. Throughput is reported on image classification. All variants have almost the same size (28.6M) as the default model.
|
| 212 |
+
|
| 213 |
+
<table><tr><td>Levels (Kernels)</td><td>Receptive Field</td><td colspan="4">#Param.FLOPs Throughput Top-1</td></tr><tr><td>2(3-5) 3 (3-5-7)</td><td>7</td><td>28.4</td><td>4.41</td><td>743</td><td>82.1</td></tr><tr><td>0(n/a)</td><td>13</td><td>28.6</td><td>4.49</td><td>696</td><td>82.3</td></tr><tr><td></td><td>0</td><td>28.3</td><td>4.35</td><td>883</td><td>75.7</td></tr><tr><td>1(3)</td><td>3</td><td>28.3</td><td>4.37</td><td>815</td><td>82.0</td></tr><tr><td>4 (3-5-7-9)</td><td>21</td><td>29.0</td><td>4.59</td><td>592</td><td>82.2</td></tr><tr><td>1(13)</td><td>13</td><td>28.8</td><td>4.59</td><td>661</td><td>81.9</td></tr></table>
|
| 214 |
+
|
| 215 |
+
Table 12: Model performance with number of focal levels $L$ . “Receptive Field” refers to effective receptive field at the top level regardless of the global average pooling.
|
| 216 |
+
|
| 217 |
+
Component Analysis. Here we ablate FocalNet to study the relative contribution of each component. The result is reported in Table 11, where we investigate the impact of the following model architecture changes on model performance:
|
| 218 |
+
|
| 219 |
+
• Replacing Multiplication with Addition: we change the element-wise multiplication to addition in Eq. (6), which converts the modulator into a bias term. This leads to $0 . 7 \%$ accuracy drop, which indicates that element-wise multiplication is a more powerful way of modulation than addition. • No Global Aggregation: we remove the top global average pooling in focal modulation. It hurts the performance by $0 . 3 \%$ . Even though the hierarchical aggregation already covers a relatively large receptive field, global information $( \mathbf { Z } ^ { L + 1 } )$ is still useful for capturing global context. • Top-only Aggregation: Instead of aggregating the feature maps from all focal levels, we only use the top level map. In this case, the features at lower levels that are more “local” and “finegrained” are completely discarded. This change leads to $0 . 4 \%$ performance drop, which verifies our hypothesis that features at different levels and spatial scopes compensate each other. • None-gating Aggregation: We remove the gating mechanism when aggregating the multiple levels of feature maps. This causes $0 . 4 \%$ drop. As we discussed earlier, the dependencies between visual token (query) and its surroundings differ based on the query content. The proposed gating mechanism helps the model to adaptively learn where and how much to gather.
|
| 220 |
+
|
| 221 |
+
In Table 12, we study the effect of varying the focal level (i.e. the number of depth-wise convolution layers $L$ ). In our experiments reported above, the results show that large receptive field in general achieves better performance (LRF v.s. SRF). Here, we investigate by further altering $L$ . In additional to setting $L = 2$ and 3, we also try $L = 0$ , $L = 1$ , and $L = 4$ . Accordingly, increasing $L$ brings slight improvement and finally reaches a plateau. Surprisingly, a single level with kernel size 3 can already obtain a decent performance. When we increase the single-level kernel size from 3 to 13, there is a slight $0 . 1 \%$ drop, and a $0 . 4 \%$ gap to the one with three levels but same size of receptive field (second row). This indicates that simply increasing the receptive field does not necessarily improve the performance, and a hierarchical aggregation for both fine- and coarse-grained contexts is crucial.
|
| 222 |
+
|
| 223 |
+
At last, we study whether our focal modulation can fit the monolithic architectures like ViTs. We replace all SA modules in ViTs with focal modulation to construct monolithic FocalNet-T/S/B. We use patch size 16 and three focal levels with kernel sizes 3,5 and 7, so that the effective receptive field is close to the global SA in ViT. As shown in Table 13, FocalNets consistently outperform ViTs, with comparable FLOPs and inference speed.
|
| 224 |
+
|
| 225 |
+
<table><tr><td>Model</td><td>Dim #Param.FLOPs Th.(imgs/s) Top-1</td><td></td><td></td><td></td></tr><tr><td>ViT-T/16</td><td>192</td><td>5.7</td><td>2834</td><td>72.2</td></tr><tr><td>FocalNet-T/16</td><td>192</td><td>1.3 5.9 1.1</td><td>2334</td><td>74.1 (+1.9)</td></tr><tr><td>ViT-S/16</td><td>384 22.1</td><td>4.6</td><td>1060</td><td>79.9</td></tr><tr><td>FocalNet-S/16</td><td>384 22.4</td><td>4.3</td><td>920</td><td>80.9 (+1.0)</td></tr><tr><td>ViT-B/16</td><td>768 86.6</td><td>17.6</td><td>330</td><td>81.8</td></tr><tr><td>FocalNet-B/16</td><td>768 87.2</td><td>16.9</td><td>300</td><td>82.4 (+0.6)</td></tr></table>
|
| 226 |
+
|
| 227 |
+
Table 13: Comparisons between FocalNet and ViT both with monolithic architectures.
|
| 228 |
+
|
| 229 |
+
# 5 Conclusion
|
| 230 |
+
|
| 231 |
+
We have proposed focal modulation, a new mechanism that enables input-dependent token interactions for visual modeling. It consists of a hierarchical contextualization to gather for each query token its contexts from short- to long-ranges, a gated aggregation to adaptively gather contexts based on the query content, followed by a simple modulation. With focal modulation, we built a series of simple attention-free Focal Modulation Networks (FocalNets). Extensive experiments show that FocalNets significantly outperform the SoTA SA counterparts (e.g., Swin and Focal Transformer) with similar time-/memory-cost on the tasks of image classification, object detection and semantic segmentation.
|
| 232 |
+
|
| 233 |
+
References
|
| 234 |
+
[1] Zhaowei Cai and Nuno Vasconcelos. Cascade r-cnn: Delving into high quality object detection. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 6154–6162, 2018.
|
| 235 |
+
[2] Yue Cao, Jiarui Xu, Stephen Lin, Fangyun Wei, and Han Hu. Gcnet: Non-local networks meet squeezeexcitation networks and beyond. In Proceedings of the IEEE/CVF International Conference on Computer Vision Workshops, pages 0–0, 2019.
|
| 236 |
+
[3] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In European Conference on Computer Vision, pages 213–229. Springer, 2020.
|
| 237 |
+
[4] Shuning Chang, Pichao Wang, Fan Wang, Hao Li, and Jiashi Feng. Augmented transformer with adaptive graph for temporal action proposal generation. arXiv preprint arXiv:2103.16024, 2021.
|
| 238 |
+
[5] Chun-Fu Chen, Quanfu Fan, and Rameswar Panda. Crossvit: Cross-attention multi-scale vision transformer for image classification, 2021.
|
| 239 |
+
[6] Liang-Chieh Chen, Yukun Zhu, George Papandreou, Florian Schroff, and Hartwig Adam. Encoder-decoder with atrous separable convolution for semantic image segmentation. In Proceedings of the European conference on computer vision (ECCV), pages 801–818, 2018.
|
| 240 |
+
[7] Qiang Chen, Qiman Wu, Jian Wang, Qinghao Hu, Tao Hu, Errui Ding, Jian Cheng, and Jingdong Wang. Mixformer: Mixing features across windows and dimensions. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5249–5259, 2022.
|
| 241 |
+
[8] Shoufa Chen, Enze Xie, Chongjian Ge, Ding Liang, and Ping Luo. CycleMLP: A mlp-like architecture for dense prediction. arXiv preprint arXiv:2107.10224, 2021.
|
| 242 |
+
[9] Xin Chen, Bin Yan, Jiawen Zhu, Dong Wang, Xiaoyun Yang, and Huchuan Lu. Transformer tracking. arXiv preprint arXiv:2103.15436, 2021.
|
| 243 |
+
[10] Yinpeng Chen, Xiyang Dai, Mengchen Liu, Dongdong Chen, Lu Yuan, and Zicheng Liu. Dynamic convolution: Attention over convolution kernels. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11030–11039, 2020.
|
| 244 |
+
[11] Zhe Chen, Yuchen Duan, Wenhai Wang, Junjun He, Tong Lu, Jifeng Dai, and Yu Qiao. Vision transformer adapter for dense predictions. arXiv preprint arXiv:2205.08534, 2022.
|
| 245 |
+
[12] Bowen Cheng, Ishan Misra, Alexander G Schwing, Alexander Kirillov, and Rohit Girdhar. Maskedattention mask transformer for universal image segmentation. arXiv preprint arXiv:2112.01527, 2021.
|
| 246 |
+
[13] Bowen Cheng, Alex Schwing, and Alexander Kirillov. Per-pixel classification is not all you need for semantic segmentation. Advances in Neural Information Processing Systems, 34, 2021.
|
| 247 |
+
[14] Xiangxiang Chu, Zhi Tian, Yuqing Wang, Bo Zhang, Haibing Ren, Xiaolin Wei, Huaxia Xia, and Chunhua Shen. Twins: Revisiting spatial attention design in vision transformers. arXiv preprint arXiv:2104.13840, 2021.
|
| 248 |
+
[15] Zhigang Dai, Bolun Cai, Yugeng Lin, and Junying Chen. Up-detr: Unsupervised pre-training for object detection with transformers. arXiv preprint arXiv:2011.09094, 2020.
|
| 249 |
+
[16] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248–255. Ieee, 2009.
|
| 250 |
+
[17] Mingyu Ding, Bin Xiao, Noel Codella, Ping Luo, Jingdong Wang, and Lu Yuan. Davit: Dual attention vision transformers. arXiv preprint arXiv:2204.03645, 2022.
|
| 251 |
+
[18] Xiaoyi Dong, Jianmin Bao, Dongdong Chen, Weiming Zhang, Nenghai Yu, Lu Yuan, Dong Chen, and Baining Guo. Cswin transformer: A general vision transformer backbone with cross-shaped windows. arXiv preprint arXiv:2107.00652, 2021.
|
| 252 |
+
[19] 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.
|
| 253 |
+
[20] Peng Gao, Jiasen Lu, Hongsheng Li, Roozbeh Mottaghi, and Aniruddha Kembhavi. Container: Context aggregation network. arXiv preprint arXiv:2106.01401, 2021.
|
| 254 |
+
[21] Chengyue Gong, Dilin Wang, Meng Li, Vikas Chandra, and Qiang Liu. Vision transformers with patch diversification, 2021.
|
| 255 |
+
[22] Jianyuan Guo, Kai Han, Han Wu, Chang Xu, Yehui Tang, Chunjing Xu, and Yunhe Wang. Cmt: Convolutional neural networks meet vision transformers. arXiv preprint arXiv:2107.06263, 2021.
|
| 256 |
+
[23] Jianyuan Guo, Yehui Tang, Kai Han, Xinghao Chen, Han Wu, Chao Xu, Chang Xu, and Yunhe Wang. Hire-mlp: Vision mlp via hierarchical rearrangement. arXiv preprint arXiv:2108.13341, 2021.
|
| 257 |
+
[24] Kai Han, Yunhe Wang, Hanting Chen, Xinghao Chen, Jianyuan Guo, Zhenhua Liu, Yehui Tang, An Xiao, Chunjing Xu, Yixing Xu, et al. A survey on visual transformer. arXiv preprint arXiv:2012.12556, 2020.
|
| 258 |
+
[25] Qi Han, Zejia Fan, Qi Dai, Lei Sun, Ming-Ming Cheng, Jiaying Liu, and Jingdong Wang. Demystifying local vision transformer: Sparse connectivity, weight sharing, and dynamic weight. arXiv preprint arXiv:2106.04263, 2021.
|
| 259 |
+
[26] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In Proceedings of the IEEE international conference on computer vision, pages 2961–2969, 2017.
|
| 260 |
+
[27] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
|
| 261 |
+
[28] Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016.
|
| 262 |
+
[29] Qibin Hou, Zihang Jiang, Li Yuan, Ming-Ming Cheng, Shuicheng Yan, and Jiashi Feng. Vision permutator: A permutable mlp-like architecture for visual recognition. arXiv preprint arXiv:2106.12368, 2021.
|
| 263 |
+
[30] Andrew G Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017.
|
| 264 |
+
[31] Han Hu, Zheng Zhang, Zhenda Xie, and Stephen Lin. Local relation networks for image recognition. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 3464–3473, 2019.
|
| 265 |
+
[32] Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 7132–7141, 2018.
|
| 266 |
+
[33] Jitesh Jain, Anukriti Singh, Nikita Orlov, Zilong Huang, Jiachen Li, Steven Walton, and Humphrey Shi. Semask: Semantically masked transformers for semantic segmentation. arXiv preprint arXiv:2112.12782, 2021.
|
| 267 |
+
[34] Salman Khan, Muzammal Naseer, Munawar Hayat, Syed Waqas Zamir, Fahad Shahbaz Khan, and Mubarak Shah. Transformers in vision: A survey. arXiv preprint arXiv:2101.01169, 2021.
|
| 268 |
+
[35] Youngwan Lee, Jonghee Kim, Jeffrey Willette, and Sung Ju Hwang. Mpvit: Multi-path vision transformer for dense prediction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 7287–7296, 2022.
|
| 269 |
+
[36] Bing Li, Cheng Zheng, Silvio Giancola, and Bernard Ghanem. Sctn: Sparse convolution-transformer network for scene flow estimation. arXiv preprint arXiv:2105.04447, 2021.
|
| 270 |
+
[37] Duo Li, Jie Hu, Changhu Wang, Xiangtai Li, Qi She, Lei Zhu, Tong Zhang, and Qifeng Chen. Involution: Inverting the inherence of convolution for visual recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12321–12330, 2021.
|
| 271 |
+
[38] Xiangyu Li, Yonghong Hou, Pichao Wang, Zhimin Gao, Mingliang Xu, and Wanqing Li. Trear: Transformer-based rgb-d egocentric action recognition. arXiv preprint arXiv:2101.03904, 2021.
|
| 272 |
+
[39] Yawei Li, Kai Zhang, Jiezhang Cao, Radu Timofte, and Luc Van Gool. Localvit: Bringing locality to vision transformers. arXiv preprint arXiv:2104.05707, 2021.
|
| 273 |
+
[40] Zhiqi Li, Wenhai Wang, Enze Xie, Zhiding Yu, Anima Anandkumar, Jose M. Alvarez, Tong Lu, and Ping Luo. Panoptic segformer: Delving deeper into panoptic segmentation with transformers, 2021.
|
| 274 |
+
[41] Dongze Lian, Zehao Yu, Xing Sun, and Shenghua Gao. As-mlp: An axial shifted mlp architecture for vision. arXiv preprint arXiv:2107.08391, 2021.
|
| 275 |
+
[42] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft COCO: Common objects in context. In ECCV, 2014.
|
| 276 |
+
[43] Hanxiao Liu, Zihang Dai, David So, and Quoc Le. Pay attention to mlps. Advances in Neural Information Processing Systems, 34, 2021.
|
| 277 |
+
[44] Hanxiao Liu, Zihang Dai, David R So, and Quoc V Le. Pay attention to MLPs. arXiv preprint arXiv:2105.08050, 2021.
|
| 278 |
+
[45] Ze Liu, Han Hu, Yutong Lin, Zhuliang Yao, Zhenda Xie, Yixuan Wei, Jia Ning, Yue Cao, Zheng Zhang, Li Dong, et al. Swin transformer v2: Scaling up capacity and resolution. arXiv preprint arXiv:2111.09883, 2021.
|
| 279 |
+
[46] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. arXiv preprint arXiv:2103.14030, 2021.
|
| 280 |
+
[47] Zhuang Liu, Hanzi Mao, Chao-Yuan Wu, Christoph Feichtenhofer, Trevor Darrell, and Saining Xie. A convnet for the 2020s. arXiv preprint arXiv:2201.03545, 2022.
|
| 281 |
+
[48] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
|
| 282 |
+
[49] Yuxuan Lou, Fuzhao Xue, Zangwei Zheng, and Yang You. Sparse-mlp: A fully-mlp architecture with conditional computation. arXiv preprint arXiv:2109.02008, 2021.
|
| 283 |
+
[50] Lingchen Meng, Hengduo Li, Bor-Chun Chen, Shiyi Lan, Zuxuan Wu, Yu-Gang Jiang, and Ser-Nam Lim. Adavit: Adaptive vision transformers for efficient image recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12309–12318, 2022.
|
| 284 |
+
[51] Yongming Rao, Wenliang Zhao, Benlin Liu, Jiwen Lu, Jie Zhou, and Cho-Jui Hsieh. Dynamicvit: Efficient vision transformers with dynamic token sparsification. Advances in neural information processing systems, 34:13937–13949, 2021.
|
| 285 |
+
[52] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
|
| 286 |
+
[53] Robin Strudel, Ricardo Garcia, Ivan Laptev, and Cordelia Schmid. Segmenter: Transformer for semantic segmentation. arXiv preprint arXiv:2105.05633, 2021.
|
| 287 |
+
[54] Ke Sun, Bin Xiao, Dong Liu, and Jingdong Wang. Deep high-resolution representation learning for human pose estimation. In CVPR, 2019.
|
| 288 |
+
[55] Peize Sun, Rufeng Zhang, Yi Jiang, Tao Kong, Chenfeng Xu, Wei Zhan, Masayoshi Tomizuka, Lei Li, Zehuan Yuan, Changhu Wang, et al. Sparse r-cnn: End-to-end object detection with learnable proposals. arXiv preprint arXiv:2011.12450, 2020.
|
| 289 |
+
[56] Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1–9, 2015.
|
| 290 |
+
[57] Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In International Conference on Machine Learning, pages 6105–6114. PMLR, 2019.
|
| 291 |
+
[58] Chuanxin Tang, Yucheng Zhao, Guangting Wang, Chong Luo, Wenxuan Xie, and Wenjun Zeng. Sparse mlp for image recognition: Is self-attention really necessary? arXiv preprint arXiv:2109.05422, 2021.
|
| 292 |
+
[59] Yehui Tang, Kai Han, Jianyuan Guo, Chang Xu, Yanxi Li, Chao Xu, and Yunhe Wang. An image patch is a wave: Phase-aware vision mlp. arXiv preprint arXiv:2111.12294, 2021.
|
| 293 |
+
[60] Ilya Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, et al. MLP-mixer: An all-mlp architecture for vision. arXiv preprint arXiv:2105.01601, 2021.
|
| 294 |
+
[61] Ilya O Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Andreas Steiner, Daniel Keysers, Jakob Uszkoreit, et al. Mlp-mixer: An all-mlp architecture for vision. Advances in Neural Information Processing Systems, 34, 2021.
|
| 295 |
+
[62] Hugo Touvron, Piotr Bojanowski, Mathilde Caron, Matthieu Cord, Alaaeldin El-Nouby, Edouard Grave, Armand Joulin, Gabriel Synnaeve, Jakob Verbeek, and Hervé Jégou. ResMLP: Feedforward networks for image classification with data-efficient training. arXiv preprint arXiv:2105.03404, 2021.
|
| 296 |
+
[63] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020.
|
| 297 |
+
[64] Hugo Touvron, Matthieu Cord, Alaaeldin El-Nouby, Piotr Bojanowski, Armand Joulin, Gabriel Synnaeve, and Hervé Jégou. Augmenting convolutional networks with attention-based aggregation. arXiv preprint arXiv:2112.13692, 2021.
|
| 298 |
+
[65] Ashish Vaswani, Prajit Ramachandran, Aravind Srinivas, Niki Parmar, Blake Hechtman, and Jonathon Shlens. Scaling local self-attention for parameter efficient visual backbones. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12894–12904, 2021.
|
| 299 |
+
[66] 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.
|
| 300 |
+
[67] Huiyu Wang, Yukun Zhu, Hartwig Adam, Alan Yuille, and Liang-Chieh Chen. Max-deeplab: End-to-end panoptic segmentation with mask transformers. arXiv preprint arXiv:2012.00759, 2020.
|
| 301 |
+
[68] Ning Wang, Wengang Zhou, Jie Wang, and Houqaing Li. Transformer meets tracker: Exploiting temporal context for robust visual tracking. arXiv preprint arXiv:2103.11681, 2021.
|
| 302 |
+
[69] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. arXiv preprint arXiv:2102.12122, 2021.
|
| 303 |
+
[70] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pvt v2: Improved baselines with pyramid vision transformer. Computational Visual Media, 8(3):415–424, 2022.
|
| 304 |
+
[71] Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 7794–7803, 2018.
|
| 305 |
+
[72] Yuqing Wang, Zhaoliang Xu, Xinlong Wang, Chunhua Shen, Baoshan Cheng, Hao Shen, and Huaxia Xia. End-to-end video instance segmentation with transformers. arXiv preprint arXiv:2011.14503, 2020.
|
| 306 |
+
[73] Ross Wightman, Hugo Touvron, and Hervé Jégou. Resnet strikes back: An improved training procedure in timm. arXiv preprint arXiv:2110.00476, 2021.
|
| 307 |
+
[74] Haiping Wu, Bin Xiao, Noel Codella, Mengchen Liu, Xiyang Dai, Lu Yuan, and Lei Zhang. Cvt: Introducing convolutions to vision transformers. arXiv preprint arXiv:2103.15808, 2021.
|
| 308 |
+
[75] Tete Xiao, Yingcheng Liu, Bolei Zhou, Yuning Jiang, and Jian Sun. Unified perceptual parsing for scene understanding. In Proceedings of the European Conference on Computer Vision (ECCV), pages 418–434, 2018.
|
| 309 |
+
[76] Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M. Alvarez, and Ping Luo. Segformer: Simple and efficient design for semantic segmentation with transformers, 2021.
|
| 310 |
+
[77] Saining Xie, Ross Girshick, Piotr Dollár, Zhuowen Tu, and Kaiming He. Aggregated residual transformations for deep neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1492–1500, 2017.
|
| 311 |
+
[78] Weijian Xu, Yifan Xu, Tyler Chang, and Zhuowen Tu. Co-scale conv-attentional image transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 9981–9990, 2021.
|
| 312 |
+
[79] Jianwei Yang, Chunyuan Li, Pengchuan Zhang, Xiyang Dai, Bin Xiao, Lu Yuan, and Jianfeng Gao. Focal self-attention for local-global interactions in vision transformers. arXiv preprint arXiv:2107.00641, 2021.
|
| 313 |
+
[80] Jianwei Yang, Zhile Ren, Chuang Gan, Hongyuan Zhu, and Devi Parikh. Cross-channel communication networks. In Proceedings of the 33rd International Conference on Neural Information Processing Systems, pages 1297–1306, 2019.
|
| 314 |
+
[81] Hongxu Yin, Arash Vahdat, Jose M Alvarez, Arun Mallya, Jan Kautz, and Pavlo Molchanov. A-vit: Adaptive tokens for efficient vision transformer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10809–10818, 2022.
|
| 315 |
+
[82] Tan Yu, Xu Li, Yunfeng Cai, Mingming Sun, and Ping Li. $S ^ { 2 }$ -MLPv2: Improved spatial-shift mlp architecture for vision. arXiv preprint arXiv:2108.01072, 2021.
|
| 316 |
+
[83] Weihao Yu, Mi Luo, Pan Zhou, Chenyang Si, Yichen Zhou, Xinchao Wang, Jiashi Feng, and Shuicheng Yan. Metaformer is actually what you need for vision. arXiv preprint arXiv:2111.11418, 2021.
|
| 317 |
+
[84] Li Yuan, Qibin Hou, Zihang Jiang, Jiashi Feng, and Shuicheng Yan. Volo: Vision outlooker for visual recognition. arXiv preprint arXiv:2106.13112, 2021.
|
| 318 |
+
[85] Yuhui Yuan, Xilin Chen, and Jingdong Wang. Object-contextual representations for semantic segmentation. arXiv preprint arXiv:1909.11065, 2019.
|
| 319 |
+
[86] Hang Zhang, Chongruo Wu, Zhongyue Zhang, Yi Zhu, Haibin Lin, Zhi Zhang, Yue Sun, Tong He, Jonas Mueller, R Manmatha, et al. Resnest: Split-attention networks. arXiv preprint arXiv:2004.08955, 2020.
|
| 320 |
+
[87] Pengchuan Zhang, Xiyang Dai, Jianwei Yang, Bin Xiao, Lu Yuan, Lei Zhang, and Jianfeng Gao. Multiscale vision longformer: A new vision transformer for high-resolution image encoding. arXiv preprint arXiv:2103.15358, 2021.
|
| 321 |
+
[88] Shifeng Zhang, Cheng Chi, Yongqiang Yao, Zhen Lei, and Stan Z Li. Bridging the gap between anchorbased and anchor-free detection via adaptive training sample selection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9759–9768, 2020.
|
| 322 |
+
[89] Wenwei Zhang, Jiangmiao Pang, Kai Chen, and Chen Change Loy. K-net: Towards unified image segmentation, 2021.
|
| 323 |
+
[90] Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, and Jian Sun. Shufflenet: An extremely efficient convolutional neural network for mobile devices. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 6848–6856, 2018.
|
| 324 |
+
[91] Jiaojiao Zhao, Xinyu Li, Chunhui Liu, Shuai Bing, Hao Chen, Cees GM Snoek, and Joseph Tighe. Tuber: Tube-transformer for action detection. arXiv preprint arXiv:2104.00969, 2021.
|
| 325 |
+
[92] Huangjie Zheng, Pengcheng He, Weizhu Chen, and Mingyuan Zhou. Mixing and shifting: Exploiting global and local dependencies in vision mlps. arXiv preprint arXiv:2202.06510, 2022.
|
| 326 |
+
[93] Minghang Zheng, Peng Gao, Xiaogang Wang, Hongsheng Li, and Hao Dong. End-to-end object detection with adaptive clustering transformer. arXiv preprint arXiv:2011.09315, 2020.
|
| 327 |
+
[94] Sixiao Zheng, Jiachen Lu, Hengshuang Zhao, Xiatian Zhu, Zekun Luo, Yabiao Wang, Yanwei Fu, Jianfeng Feng, Tao Xiang, Philip HS Torr, et al. Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. arXiv preprint arXiv:2012.15840, 2020.
|
| 328 |
+
[95] Bolei Zhou, Hang Zhao, Xavier Puig, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Scene parsing through ade20k dataset. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 633–641, 2017.
|
| 329 |
+
[96] Daquan Zhou, Yujun Shi, Bingyi Kang, Weihao Yu, Zihang Jiang, Yuan Li, Xiaojie Jin, Qibin Hou, and Jiashi Feng. Refiner: Refining self-attention for vision transformers. arXiv preprint arXiv:2106.03714, 2021.
|
| 330 |
+
[97] Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. arXiv preprint arXiv:2010.04159, 2020.
|
md/dev/eYciPrLuUhG/eYciPrLuUhG.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/ek9a0qIafW/ek9a0qIafW.md
ADDED
|
@@ -0,0 +1,454 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DIFFERENTIABLE PROMPT MAKES PRE-TRAINED LANGUAGE MODELS BETTER FEW-SHOT LEARNERS
|
| 2 |
+
|
| 3 |
+
Ningyu Zhang1,2,3∗ Luoqiu $\mathbf { L i } ^ { 1 , 3 * }$ Xiang Chen1,3 Shumin Deng1,3 Zhen $\mathbf { B } \mathbf { i } ^ { 2 , 3 }$ Chuanqi Tan5 Fei Huang5 Huajun Chen1,3,4†
|
| 4 |
+
|
| 5 |
+
1College of Computer Science and Technology, Zhejiang University
|
| 6 |
+
2School of Software Technology, Zhejiang University
|
| 7 |
+
3Alibaba-Zhejiang University Joint Research Institute of Frontier Technologies
|
| 8 |
+
4Hangzhou Innovation Center, Zhejiang University
|
| 9 |
+
5Alibaba Group
|
| 10 |
+
{zhangningyu,3160102409,xiang chen,231sm,bizhen zju}@zju.edu.cn,
|
| 11 |
+
{chuanqi.tcq,f.huang}@alibaba-inc.com
|
| 12 |
+
|
| 13 |
+
# ABSTRACT
|
| 14 |
+
|
| 15 |
+
Large-scale pre-trained language models have contributed significantly to natural language processing by demonstrating remarkable abilities as few-shot learners. However, their effectiveness depends mainly on scaling the model parameters and prompt design, hindering their implementation in most real-world applications. This study proposes a novel pluggable, extensible, and efficient approach named DifferentiAble pRompT (DART), which can convert small language models into better few-shot learners. The main principle behind this approach involves reformulating potential natural language processing tasks into the task of a pre-trained language model and differentially optimizing the prompt template as well as the target label with backpropagation. Furthermore, the proposed approach can be: (i) Plugged to any pre-trained language models; (ii) Extended to widespread classification tasks. A comprehensive evaluation of standard NLP tasks demonstrates that the proposed approach achieves a better few-shot performance1.
|
| 16 |
+
|
| 17 |
+
# 1 INTRODUCTION
|
| 18 |
+
|
| 19 |
+
The pre-train—fine-tune paradigm has become the de facto standard for natural language processing (NLP), and has achieved excellent results in several benchmarks (Devlin et al., 2019; Liu et al., 2019; Lewis et al., 2020; Dong et al., 2019; Bao et al., 2020a). The success of these pioneers seems to suggest that large-scale pre-trained models are always nothing short of a panacea for boosting machine intelligence. However, supervised fine-tuning is still prone to labeled data in practice and faces unignorable challenges owing to the variations of domains, language, and tasks. These drawbacks lead to the research of an important technique, few-shot learning, which can significantly improve the learning capabilities of machine intelligence and practical adaptive applications by accessing only a small number of labeled examples.
|
| 20 |
+
|
| 21 |
+
The GPT-3 model, introduced by Brown et al. (2020), exhibits impressive few-shot learning capabilities. Given a natural language prompt and 16 labeled samples as demonstrations in the contextual input, GPT-3 achieves $80 \%$ of the SOTA results. However, GPT-3 is a fully dense transformer model with 175B parameters, which makes it challenging to deploy in most real-world applications.
|
| 22 |
+
|
| 23 |
+
Recently, an emerging fine-tuning methodology has arisen to equip smaller language models (LMs) with few-shot capabilities: adapting the pre-trained LM directly as a predictor through completion of a cloze task (Schick & Schutze (2021; 2020); Gao et al. (2020); Liu et al. (2021c)), which treats ¨ the downstream task as a (masked) language modeling problem. These prompts can be used in finetuning to provide the classifier with additional task information, especially in the low-data regime.
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
Figure 1: The architecture of DifferentiAble pRompT (DART) model comparing with MLM pretraining and conventional fine-tuning, where $T _ { i }$ and $Y _ { i }$ are unused or special tokens in the vocabulary. We leverage a few parameters within the language model as the template and label tokens and optimize them via backpropagation without introducing additional parameters apart from the model.
|
| 27 |
+
|
| 28 |
+
Notably, Scao & Rush (2021) observe that prompting can often compensate for hundreds of data points on average across multiple classification tasks. However, determining the appropriate prompts requires domain expertise, and handcrafting a high-performing prompt often requires impractically large validation sets (Perez et al. (2021)). Recent studies (Lu et al. (2021); Zhao et al. (2021)) have reported that the manual prompt format can be sub-optimal, which would result in the accuracy varying from random guess performance to near the state-of-the-art. Therefore, previous approaches have attempted to search for discrete prompt tokens automatically. However, it is non-trivial for widespread classification tasks to obtain an optimized prompt template and target label token. For example, specific classification tasks such as relation extraction with the label of alternate name and country o f birth cannot specify a single label token in the vocabulary.
|
| 29 |
+
|
| 30 |
+
In this paper, we propose a novel DifferentiAble pRompT (DART) fine-tuning approach, which is model-agnostic, parameter-efficient. As illustrated in Figure 1, the key idea is to leverage a few parameters (unused tokens) in the language model, which serve as the template and label tokens, and to optimize them in the continuous space using backpropagation. Subsequently, we introduce differentiable prompt learning to obtain optimized prompt templates as well as labels. Since fine-tuning with limited samples can be affected by instability (Dodge et al. (2020); Zhang et al. (2021)), we propose an optimization algorithm to jointly learning templates as well as labels. We further introduce an auxiliary fluency constraint object to ensure the association among the prompt embeddings.
|
| 31 |
+
|
| 32 |
+
We conduct extensive experiments on $1 5 \mathrm { N L P }$ datasets. With only a few training samples across all the tasks, our approach (DART) can obtain a better performance. Notably, absolute performance improvement of up to $2 3 . 2 8 \%$ , over the conventional fine-tuning, is obtained on average in the setting of $K = 8$ (and $1 . 5 5 \%$ for fully supervised settings) on relation extraction datasets with complex label semantics. Our approach can be applied to real-world classification tasks without the high cost of collecting and annotating a large amount of data. The main contributions of this study are as follows:
|
| 33 |
+
|
| 34 |
+
• We propose a new simple framework for few-shot learning, which is pluggable, extensible, and efficient. To the best of our knowledge, optimizing label tokens in continuous space is also a new branch of research that has not been explored in language model prompting.
|
| 35 |
+
|
| 36 |
+
• A systematic evaluation of $1 5 \mathrm { N L P }$ tasks shows that the simple-yet-effective method contributes towards improvements across all these tasks. Remarkably, given only 8 labeled samples per class, our proposed approach can achieve $90 \%$ performance of the SOTA results (full dataset).
|
| 37 |
+
|
| 38 |
+
# 2 RELATED WORK
|
| 39 |
+
|
| 40 |
+
Language Model Prompting. The language model prompting has emerged with the introduction of GPT-3 (Brown et al. (2020)), which demonstrates excellent few-shot performance (Liu et al. (2021b)). However, GPT-3 is not designed for fine-tuning; it mainly relies on the handcraft prompt (in-context learning (Liu et al. (2021a); Zhao et al. (2021); Ding et al. (2021); Min et al. (2021))). Thus, recent studies (Qin & Eisner (2021); Hambardzumyan et al. (2021); Chen et al. (2021)) conducted in this field have been focused on automatically searching the prompts. Schick & Schutze (2021; ¨ 2020) propose the PET, which reformulates the NLP tasks as cloze-style questions and performs gradient-based fine-tuning. Tam et al. (2021) improve the PET with a denser supervision object during fine-tuning. Shin et al. (2020) propose the AUTOPROMPT to create prompts for a diverse set of tasks based on a gradient-guided search. Han et al. (2021) propose an approach called PTR, which leverages logic rules to construct prompts with sub-prompts for many-class text classification. Wang et al. (2021) reformulate potential NLP task into an entailment one, and then fine-tune the model with few-shot samples. Hu et al. (2021) propose an approach to incorporate external knowledge graph into the verbalizer with calibration. Additionally, Gao et al. (2020) present LM-BFF—better few-shot fine-tuning of language models, which leverages T5 (Raffel et al. (2020)) to generate templates and search label tokens in the vocabulary. However, the utilization of the generative model and the label search with validation is computation-intensive. Moreover, the prompt search over discrete space is sub-optimal due to the continuous nature of neural networks.
|
| 41 |
+
|
| 42 |
+
To overcome these limitations, Liu et al. (2021c) propose P-tuning, which employs trainable continuous prompt embeddings learned by an LSTM. Zhong et al. (2021) propose an effective continuous method called OPTIPROMPT to optimize prompts for factual probing. Liu et al. (2021c) propose prefix-tuning, which keeps language model parameters frozen but optimizes a small continuous taskspecific vector for natural language generation tasks. Lester et al. (2021) propose a mechanism for learning “soft prompts” to condition frozen language models to perform downstream tasks. However, these approaches still have to optimize the external parameters (e.g., LSTM in P-tuning) and are prone to complex label space.
|
| 43 |
+
|
| 44 |
+
Conversely, this study aims to develop a novel few-shot learning framework based on pre-trained language models which can reduce the prompt engineering (including templates and labels) and external parameter optimization. Furthermore, the proposed approach only leverages the noninvasive modification of the model, which can be plugged into any pre-trained language model and extended to the widespread classification task.
|
| 45 |
+
|
| 46 |
+
Few-shot Learning. Few-shot learning can significantly improve the learning capabilities for machine intelligence and practical adaptive applications by accessing only a small number of labeled examples (Zhang et al. (2020)). The proposed approach corresponds to the other few-shot NLP methods, including: (1) Meta-learning (Yu et al. (2018); Bao et al. (2020b); Bansal et al. (2020); Deng et al. (2020b;a); Yu et al. (2020)), in which the quantities of the auxiliary tasks are optimized. (2) Intermediate training (Phang et al. (2018); Yin et al. (2020)), which supplements the pre-trained LMs with further training on the data-rich supervised tasks. (3) Semi-supervised learning (Miyato et al. (2017); Xie et al. (2020)), which leverages unlabeled samples. The proposed approach focuses on a more realistic few-shot setting (the number of labeled instances per class can be any variable).
|
| 47 |
+
|
| 48 |
+
# 3 BACKGROUND
|
| 49 |
+
|
| 50 |
+
Let $X _ { \mathrm { i n } } = \{ x _ { 1 } , x _ { 2 } , . . . , x _ { L } \}$ be a sentence, where $x _ { i }$ is the $i ^ { t h }$ token in the input sentence and $L$ is the number of tokens. Specifically, $X _ { \mathrm { i n } }$ is converted to a fixed token sequence $\tilde { X } _ { \mathrm { i n } }$ and then mapped to a sequence of hidden vectors $\{ \mathbf { h } _ { k } \in \mathbb { R } ^ { d } \}$ . Given the input sequence, $\tilde { X } _ { \mathrm { i n } } = [ \mathbb { C } \mathrm { L S } ] X _ { \mathrm { i n } } [ \mathrm { S E P } ]$ , the conventional fine-tuning approaches leverage a generic head layer over [CLS] embeddings (e.g., an MLP layer) to predict an output class. For the prompt-based method, a task-specific pattern string (template $\mathcal { T }$ ) is designed to coax the model into producing a textual output corresponding to a given class (label token ${ \mathcal { M } } ( Y ) _ { , }$ )—we refer to these two things together as a prompt. Specifically, $X _ { \mathrm { p r o m p t } }$ containing one [MASK] token is directly tasked with the MLM input as:
|
| 51 |
+
|
| 52 |
+
$$
|
| 53 |
+
X _ { \mathrm { p r o m p t } } = [ \mathrm { C L S } ] X _ { \mathrm { i n } } \ [ \mathrm { S E P } ] \mathcal { T } \ [ \mathrm { S E P } ]
|
| 54 |
+
$$
|
| 55 |
+
|
| 56 |
+
When the prompt is fed into the MLM, the model can obtain the probability distribution $p \big ( \mathrm { [ M A S K ] } \big | ( X _ { \mathrm { p r o m p t } } )$ of the candidate class, $y \in Y$ as:
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
p ( y | X _ { \mathrm { p r o m p t } } ) = \sum _ { w \in \mathcal { V } _ { y } } p ( \mathrm { \ p A S K } ] = w | X _ { \mathrm { p r o m p t } } )
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
where $w$ represents the $w ^ { t h }$ label token of class $y$
|
| 63 |
+
|
| 64 |
+
# 4 OUR APPROACH
|
| 65 |
+
|
| 66 |
+
# 4.1 MOTIVATION
|
| 67 |
+
|
| 68 |
+
It can be observed from the previous empirical findings (Gao et al. (2020); Scao & Rush (2021)) that an optimal prompt is necessary for the improvement of the pre-trained language models for the few-shot learners. Since templates with discrete tokens may be sub-optimal and are insufficient to represent a specific class2, this study proposes DifferentiAble pRompT, referred to as DART, which can reduce the requirement of prompt engineering in order to improve the applicability of the proposed method in various domains.
|
| 69 |
+
|
| 70 |
+
# 4.2 DIFFERENTIABLE TEMPLATE OPTIMIZATION
|
| 71 |
+
|
| 72 |
+
Since the language tokens are discrete variables, finding the optimal prompts with token searching is non-trivial and may easily fall into the local minima. To overcome these limitations, we utilize pseudo tokens to construct templates and then optimize them with backpropagation. Specifically, given the template, $\mathcal { T } = \{ [ \mathrm { T } _ { 0 : i } ]$ ,[MASK], $\big [ \mathrm { T } _ { i + 1 : j } \big ] \big \}$ , which varies from the traditional discrete prompts, satisfying $[ \mathrm { T } _ { i } ] \in \mathcal { V }$ and map $\mathcal { T }$ into:
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
\left\{ \mathbf { w } ( [ \mathrm { T } _ { 0 : i } ] ) , \mathbf { w } ( \mathrm { [ M A S K ] } ) , \mathbf { w } ( [ \mathrm { T } _ { i + 1 : m } ] ) \right\}
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
DART considers $[ \mathrm { T } _ { i } ]$ as pseudo tokens and maps the template as follows:
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\{ h _ { 0 } , . . . , h _ { i } , \mathbf { w } ( \mathrm { ~ [ M A S K ~ ] ~ } ) , h _ { i + 1 } , . . . , h _ { m } \}
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
where $h _ { i } ( 0 \leq i \leq j )$ are trainable parameters. Differentiable template optimization can obtain expressive templates beyond the original vocabulary $\mathcal { V }$ . Lastly, the templates, $h _ { i }$ , are differentially optimized by:
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
\hat { h } _ { 0 : m } = \underset { h } { \arg \operatorname* { m i n } } \mathcal { L } \left( X _ { \mathrm { p r o m p t } } , y \right)
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
Note that the values of the prompt embeddings, $h _ { i }$ , must be co-dependent with each other rather than independent. Unlike $\mathrm { \bf P }$ -tuning (Liu et al. (2021c)), which utilizes a bidirectional LSTM, DART leverages an auxiliary fluency constraint objective to associate the prompt embeddings with each other, thus stimulating the model to focus on context representation learning.
|
| 91 |
+
|
| 92 |
+
# 4.3 DIFFERENTIABLE LABEL OPTIMIZATION
|
| 93 |
+
|
| 94 |
+
Prompt-based fine-tuning requires filling in one word, and the masked word prediction is mapped to a verbalizer, which produces a class (i.e., ”Yes”: True. ”No”: False). For each class $c \in Y$ , the previous approaches such as LM-BFF (Gao et al. (2020)) estimate the conditional likelihood of the initial $\mathcal { L }$ on a pruned set $\mathcal { V } ^ { c } \subset \mathcal { V }$ of the top $k$ vocabulary words.
|
| 95 |
+
|
| 96 |
+
However, the brute-forcing label searching: (1) is computationally intensive and tedious because the $\mathcal { D } _ { \mathrm { d e v } }$ is generally very large, requiring multiple rounds of evaluation. (2) has poor scalability with an increase in the class numbers (many classification datasets have more than 100 classes), the number of searches may be $k ^ { C }$ ( $C$ represents the total number of classes), which is exponential and thus intractable. Additionally, the labels of classes contain rich, complex semantic knowledge, and one discrete token may be insufficient to represent this information.
|
| 97 |
+
|
| 98 |
+
Specifically, with the labels, $Y = \{ Y _ { 1 } , Y _ { 2 } , . . , Y _ { m } \}$ , different from the previous approach which converts the class type $Y _ { i }$ into a variable number of label tokens $\{ . . . , \nu _ { 1 } , . . . , \nu _ { k } , . . . \}$ , DART maps the $Y _ { j }$ to a continuous vocabulary space as follows:
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
\begin{array} { r } { \mathcal { M } ( Y _ { j } ) = \{ h _ { m + j } \} , } \end{array}
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
where $m$ is the number of trainable embedding in template. To avoid optimizing any external parameters, $\{ h _ { 1 } , . . . , h _ { m } , . . , h _ { m + n } \}$ is replaced with unused tokens (e.g., [unused1] or special tokens in vocabulary) in $\mathcal { V }$ to generate $\mathcal { V } ^ { \prime }$ , as shown in Figure 1.
|
| 105 |
+
|
| 106 |
+
# 4.4 TRAINING OBJECTIVES
|
| 107 |
+
|
| 108 |
+
Since the pseudo tokens in the prompt template must be co-dependent with each other, we introduce an auxiliary fluency constraint training without optimizing any other parameters inspired by Liu et al. (2021c); Tam et al. (2021). Overall, there are two objectives: the class discrimination objective $\mathcal { L } _ { C }$ and the fluency constraint objective $\mathcal { L } _ { F }$ .
|
| 109 |
+
|
| 110 |
+
Class Discrimination Object The class discrimination objective is the main objective that aims to classify the sentences. As shown in Figure 1, given $( X _ { \mathrm { i n } } , \mathcal { T } )$ , we can generate $X _ { \mathrm { p r o m p t } }$ as:
|
| 111 |
+
|
| 112 |
+
$$
|
| 113 |
+
\mathcal { L } _ { C } = \mathrm { C E } \big ( g ( y | X _ { \mathrm { p r o m p t } } ) \big ) .
|
| 114 |
+
$$
|
| 115 |
+
|
| 116 |
+
where CE is the cross-entropy loss function, $\mathcal { L } _ { C }$ represents the class discrimination loss.
|
| 117 |
+
|
| 118 |
+
Fluency Constraint Object To ensure the association among the template tokens and to maintain the ability of language understanding inherited from the PLMs, we leverage a fluency constraint object with the MLM. As shown in Figure 1, one token in the input sentence is randomly masked, and the masked language prediction is conducted. $x$ and $x ^ { \prime }$ are the original and masked sequences, respectively. Let $x ^ { m }$ be the target token that has been masked out in $x ^ { \prime }$ , and $g ( x ^ { m } | x ^ { \prime } , y )$ is maximized as follows3:
|
| 119 |
+
|
| 120 |
+
$$
|
| 121 |
+
h ( x ^ { m } | x ^ { \prime } , y ) = \frac { \exp ( \mathbb { [ } f ( x ^ { \prime } , y ) \mathbb { ] } | _ { x ^ { m } } ) } { \sum _ { \nu ^ { \prime } \in \mathcal { V } ^ { \prime } } \exp ( \mathbb { [ } f ( x ^ { \prime } , y ) \mathbb { ] } | _ { \nu ^ { \prime } } ) }
|
| 122 |
+
$$
|
| 123 |
+
|
| 124 |
+
$$
|
| 125 |
+
\mathcal { L } _ { F } = \sum _ { m \in M } \mathrm { B C E } \big ( h ( x ^ { m } | x ^ { \prime } , y ) \big ) .
|
| 126 |
+
$$
|
| 127 |
+
|
| 128 |
+
By optimizing $\mathcal { L } _ { F }$ , the language model can obtain a better contextual representation with a rich association among the template tokens. We have the following training object:
|
| 129 |
+
|
| 130 |
+
$$
|
| 131 |
+
\boldsymbol { \mathcal { L } } = \boldsymbol { \mathcal { L } } \boldsymbol { c } + \boldsymbol { \lambda } \boldsymbol { \mathcal { L } } _ { F } ,
|
| 132 |
+
$$
|
| 133 |
+
|
| 134 |
+
where $\lambda$ is the hyper-parameter. Lastly, we introduce the overall optimization procedure of DART. To mitigate the instability of the few-shot fine-tuning, we jointly optimize templates and labels. Note that our approach can reuse the same transformer architecture (rather than additional LSTM) so that it enjoys the beauty of simplicity for prompt-tuning.
|
| 135 |
+
|
| 136 |
+
Table 1: Our main results with RoBERTa-large. †: the full training set is used. $\ddagger$ : no training examples are used. Otherwise, we use $K = 1 6$ (# examples per class). We report mean (and standard deviation) performance over 5 different splits. Majority: majority class “GPT- $3 ^ { \circ }$ in-context learning: using the in-context learning proposed in with RoBERTa-large (no parameter updates); LM-BFF: we report the performance in Gao et al. (2020). full: fine-tuning using full training set.
|
| 137 |
+
|
| 138 |
+
<table><tr><td>Model</td><td>SST-2 (acc)</td><td>MR (acc)</td><td>CR (acc)</td><td>Subj (acc)</td><td>TREC (acc)</td></tr><tr><td>Majority†</td><td>50.9</td><td>50.0</td><td>50.0</td><td>50.0</td><td>18.8</td></tr><tr><td>Prompt-based zero-shot*</td><td>83.6</td><td>80.8</td><td>79.5</td><td>51.4</td><td>32.0</td></tr><tr><td>“GPT-3”in-context learning</td><td>84.8 (1.3)</td><td>80.5 (1.7)</td><td>87.4 (0.8)</td><td>53.6 (1.0)</td><td>26.2 (2.4)</td></tr><tr><td>Fine-tuning</td><td>81.4 (3.8)</td><td>76.9 (5.9)</td><td>75.8 (3.2)</td><td>90.8 (1.8)</td><td>88.8 (2.1)</td></tr><tr><td>LM-BFF</td><td>92.3 (1.0)</td><td>85.5 (2.8)</td><td>89.0 (1.4)</td><td>91.2 (1.1)</td><td>88.2 (2.0)</td></tr><tr><td>P-Tuning</td><td>92.2 (0.4)</td><td>86.7 (1.2)</td><td>91.8 (1.1)</td><td>90.3 (2.2)</td><td>86.3 (4.5)</td></tr><tr><td>DART</td><td>93.5 (0.5)</td><td>88.2 (1.0)</td><td>91.8 (0.5)</td><td>90.7 (1.4)</td><td>87.1(3.8)</td></tr><tr><td>Fine-tuning (full)+</td><td>95.0</td><td>90.8</td><td>89.4</td><td>97.0</td><td>97.4</td></tr><tr><td>Model</td><td>MNLI (acc)</td><td>SNLI(acc)</td><td>QNLI (acc)</td><td>MRPC (F1)</td><td>QQP (F1)</td></tr><tr><td>Majorityt</td><td>32.7</td><td>33.8</td><td>49.5</td><td>81.2</td><td>0.0</td></tr><tr><td>Prompt-based zero-shot*</td><td>50.8</td><td>49.5</td><td>50.8</td><td>61.9</td><td>49.7</td></tr><tr><td>“GPT-3” in-context learning</td><td>52.0 (0.7)</td><td>47.1 (0.6)</td><td>53.8 (0.4)</td><td>45.7 (6.0)</td><td>36.1 (5.2)</td></tr><tr><td>Fine-tuning</td><td>45.8 (6.4)</td><td>48.4 (4.8)</td><td>60.2 (6.5)</td><td>76.6 (2.5)</td><td>60.7 (4.3)</td></tr><tr><td>LM-BFF</td><td>68.3 (2.5)</td><td>77.1 (2.1)</td><td>68.3 (7.4)</td><td>76.2 (2.3)</td><td>67.0 (3.0)</td></tr><tr><td>P-Tuning</td><td>61.5 (2.1)</td><td>72.3 (3.0)</td><td>64.3 (2.8)</td><td>74.5 (7.6)</td><td>65.6 (3.0)</td></tr><tr><td>DART</td><td>67.5 (2.6)</td><td>75.8 (1.6)</td><td>66.7 (3.7)</td><td>78.3 (4.5)</td><td>67.8 (3.2)</td></tr><tr><td>Fine-tuning (full)+</td><td>89.8</td><td>92.6</td><td>93.3</td><td>91.4</td><td>81.7</td></tr></table>
|
| 139 |
+
|
| 140 |
+
# 5 EXPERIMENTS
|
| 141 |
+
|
| 142 |
+
In this section, we detail the comprehensive experimental results conducted on classification tasks. The promising results demonstrate that our proposed DART substantially outperforms the conventional fine-tuning method, thus, making pre-trained language models better few-shot learners.
|
| 143 |
+
|
| 144 |
+
# 5.1 DATASET STATISTICS
|
| 145 |
+
|
| 146 |
+
We conduct a comprehensive study across $1 5 \mathrm { N L P }$ tasks, which covers sentiment analysis, natural language inference, paraphrases, sentence similarity, relation extraction, and event extraction (We only report event argument extraction performance). The evaluation consisted of 10 popular sentence classification datasets (SST-2, MR, CR, Subj, TREC, MNLI, SNLI, QNLI, MRPC, QQP).To further evaluate the effectiveness of the proposed approach with complex label space, we conduct experiments on the relation extraction and event extraction datasets, including SemEval-2010 Task 8 (Hendrickx et al., 2010), TACRED-Revisit (Alt et al. (2020)), Wiki $8 0 ^ { 4 }$ (Han et al., 2019), ChemProt (Kringelum et al., 2016), and $\mathrm { A C E } { - } 2 0 0 5 ^ { 5 }$ .
|
| 147 |
+
|
| 148 |
+
# 5.2 SETTINGS
|
| 149 |
+
|
| 150 |
+
The proposed model is implemented using Pytorch (Paszke et al. (2019)). Our experiments are conducted with the same setting following LM-BFF ( Gao et al. (2020)), which measures the average performance with a fixed set of seeds, $S _ { \mathrm { s e e d } }$ , across five different sampled $\mathcal { D } _ { \mathrm { t r a i n } }$ for each task. We utilize a grid search over multiple hyperparameters and select the best result as measured on $\mathcal { D } _ { \mathrm { d e v } }$ for each set $\left\{ \mathcal { D } _ { \operatorname { t r a i n } } ^ { s } , \mathcal { D } _ { \operatorname { d e v } } \right\} , s \in \mathcal { S } _ { \mathrm { s e e d } }$ . We employ AdamW as the optimizer. We conduct experiments with a RoBERTa-large (Liu et al. (2019)) on classification tasks for a fair comparison with LM-BFF. We leverage an uncased BERT-large (Devlin et al. (2019)) for relation extraction datasets, except that we use SCIBERT (Beltagy et al. (2019)) for the ChemProt dataset. We follow Soares et al. (2019) and use special entity markers uniformly to highlight the entity mentions for relation extraction.
|
| 151 |
+
|
| 152 |
+
Table 2: Results on RE dataset WiKi80 (accuracy), while other datasets (micro $\mathrm { F } _ { 1 }$ ). We use $K = 8 , 1 6 , 3 2$ (# examples per class). Full represents the full training set is used.
|
| 153 |
+
|
| 154 |
+
<table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>K=8</td><td rowspan=1 colspan=1>K=16</td><td rowspan=1 colspan=1>K=32</td><td rowspan=1 colspan=1>Full</td></tr><tr><td rowspan=1 colspan=1>SemEval</td><td rowspan=1 colspan=1>Fine-tuningLM-BFFDART</td><td rowspan=1 colspan=1>26.343.251.8 (+25.5)</td><td rowspan=1 colspan=1>43.862.067.2 (+23.4)</td><td rowspan=1 colspan=1>64.272.977.3 (+13.1)</td><td rowspan=1 colspan=1>87.888.089.1 (+1.3)</td></tr><tr><td rowspan=1 colspan=1>TACRED-Revisit</td><td rowspan=1 colspan=1>Fine-tuningLM-BFFDART</td><td rowspan=1 colspan=1>7.421.025.8 (+18.4)</td><td rowspan=1 colspan=1>15.523.730.1 (+14.6)</td><td rowspan=1 colspan=1>25.827.131.8 (+6.0)</td><td rowspan=1 colspan=1>75.076.477.8 (+2.8)</td></tr><tr><td rowspan=1 colspan=1>WiKi80</td><td rowspan=1 colspan=1>Fine-tuningLM-BFFDART</td><td rowspan=1 colspan=1>46.366.568.5 (+22.2)</td><td rowspan=1 colspan=1>60.373.575.2 (+14.9)</td><td rowspan=1 colspan=1>70.078.179.4 (+9.4)</td><td rowspan=1 colspan=1>87.586.288.1 (+0.6)</td></tr><tr><td rowspan=1 colspan=1>ChemProt</td><td rowspan=1 colspan=1>Fine-tuningLM-BFFDART</td><td rowspan=1 colspan=1>30.255.057.2 (+27.0)</td><td rowspan=1 colspan=1>41.556.160.8 (+19.3)</td><td rowspan=1 colspan=1>52.560.063.1 (+10.6)</td><td rowspan=1 colspan=1>79.579.181.0 (+1.5)</td></tr></table>
|
| 155 |
+
|
| 156 |
+
Table 3: Ablation of DART with different components on SemEval. ( $\mathrm { F T = }$ Fine tuning)
|
| 157 |
+
|
| 158 |
+
<table><tr><td>Method</td><td>K=8</td><td>K=16</td><td>K=32</td><td>Full</td></tr><tr><td>Conventional FT</td><td>26.3</td><td>43.8</td><td>64.2</td><td>87.8</td></tr><tr><td>DART</td><td>51.8</td><td>67.2</td><td>77.3</td><td>89.1</td></tr><tr><td>-fluency constraint object</td><td>50.3 (-1.5)</td><td>66.1 (-1.1)</td><td>76.0 (-1.3)</td><td>88.2 (-0.9)</td></tr><tr><td>-differentiable template</td><td>49.8 (-2.0)</td><td>66.3 (-0.9)</td><td>76.2 (-1.1)</td><td>88.4 (-0.7)</td></tr><tr><td>-differentiable label</td><td>47.5 (-4.3)</td><td>62.5 (-4.7)</td><td>73.7 (-0.6)</td><td>87.8 (-1.3)</td></tr></table>
|
| 159 |
+
|
| 160 |
+
# 5.3 MAIN RESULTS
|
| 161 |
+
|
| 162 |
+
As shown in Table 1, we observe that our approach obtains better performance than conventional fine-tuning and achieves comparable results with LM-BFF. Note that DART can reduce the prompt engineering without external models (e.g., T5 in LM-BFF) to generate templates that are readily easy to adapt to other datasets. DART can obtain $1 1 . 3 \%$ improvement with only 16 training samples per class on the MR dataset, comparable with LM-BFF, which leverages T5 to generate appropriate prompts. These results indicate that DART can better stimulate potential ability and makes the pretrained language model a better few-shot learner. We also notice that DART yields better performance than P-tuning, which indicates that label optimization is beneficial.
|
| 163 |
+
|
| 164 |
+
For the classification tasks with the complex label space, as shown in Table 2 and Figure 2(a), we observe that DART outperforms the conventional fine-tuning approach as well as LM-BFF with a large margin on relation extraction and event extraction datasets in both the few-shot and fully supervised settings. The proposed approach achieves an improvement of $2 . 8 \%$ of the absolute performance on the TACRED-Revisit dataset with full supervision and yields $1 8 . 4 \%$ gains with only 8 training samples per class. These findings also indicate that more relevant templates and labels can be determined without expert intervention, making it possible to generalize the proposed approach to other domains. We attribute the significant improvements to the fact that, unlike the GLUE datasets containing small categories, in relation extraction and event extraction tasks, the datasets consist of a large number of classes with complex label space, making it more challenging to obtain suitable label tokens. Furthermore, we notice that the improvement decays slowly when $K$ becomes larger (i.e., from 8 to 32). Our approach is a simple yet effective fine-tuning paradigm that can reduce prompt engineering within the complex label space, thus, making it possible to be an appropriate plug-in for some SOTA models.
|
| 165 |
+
|
| 166 |
+
# 5.4 ABLATION STUDY
|
| 167 |
+
|
| 168 |
+
We conduct an ablation study to validate the effectiveness of the components in the proposed approach. We observe that DART exhibits a performance decay in the absence of any one of the modules, i.e., fluency constraint object, differentiable template, or differentiable label, demonstrating that all the modules are advantageous. Furthermore, we notice that differentiable label optimization is more sensitive to performance and is highly beneficial for DART, especially for low-resource settings. Since the proposed approach is the first approach that utilizes the differentiable label optimization, these findings illustrate that a suitable label token is important.
|
| 169 |
+
|
| 170 |
+

|
| 171 |
+
Figure 2: (a) Few-shot results using the ACE-2005. We used $\mathrm { K } = 4$ , 8, 16, and 32 (# examples per class) with BERT. $\mathrm { F T = }$ Fine-tuning) (b) BERT-large vs. GPT-2-medium results for the SemEval. Moreover, for lower K, our method consistently outperforms conventional fine-tuning.
|
| 172 |
+
|
| 173 |
+
# 5.5 ANALYSIS AND DISCUSSION
|
| 174 |
+
|
| 175 |
+
CAN DART BE APPLIED TO OTHER PRE-TRAINED LMS?
|
| 176 |
+
|
| 177 |
+
To evaluate whether the proposed approach can be applied to other LMs, we conduct experiments using GPT-2-medium6 . From Figure 2(b), we observe that DART with GPT-2-medium yields better performance than the conventional fine-tuning approach. Furthermore, we notice that DART with GPT-2-medium can achieve performance on par with BERT-large, as observed by Liu et al. (2021c), indicating that the potential of GPT-style architectures for natural language understanding has been underestimated.
|
| 178 |
+
|
| 179 |
+
WHY DO DIFFERENTIABLE PROMPTS YIELD BETTER PERFORMANCE?
|
| 180 |
+
|
| 181 |
+
To further analyze why our differentiable prompts method yields better performance compared with prompts with fixed templates and label tokens, we visualize the representation of masked tokens in the CR dataset during different training steps (from left to right) as shown in Figure 3 (fixed) and 4 (differentiable), respectively. While both methods learn separable hidden states, differentiable prompts’ representation is relatively more compact while the representation generated from fixed prompts is more scattered. This observation of differentiable prompts generating more discriminative representations than the fixed prompts method is supported by an indicator $R _ { D }$ , the ratio between average intra-class and average inter-class distance. We believe the main reason behind its better performance lies in the more discriminative representation of the differentiable method. More details can be found in Appendix A.6.
|
| 182 |
+
|
| 183 |
+
WHAT EXACTLY IS OPTIMIZED PROMPT?
|
| 184 |
+
|
| 185 |
+
Since prompt templates and label tokens in the proposed approach are mapped as $\{ h _ { 1 } , . . . , h _ { m } , . . , h _ { m + n } \}$ , we further analyze what exactly optimized label learned. We conduct a nearest-neighbor vocabulary embedding search to project the Top-3 optimized pseudo-label tokens in $\mathcal { V }$ to a readable natural language.We use $t$ -SNE (Van der Maaten & Hinton (2008)) with normalization to visualize labels on Wiki80 dataset. For example, “military branch” refers to as red $\star$ in Figure 5 represents the relation type, which is learned by optimizing the pseudo label in the continuous space, and the “volunteered”, “corporal” and “buddies”, refers to as • are the tokens closest to the label. This finding indicates that the differentiable method generates better semantic representation.
|
| 186 |
+
|
| 187 |
+

|
| 188 |
+
Figure 3: Visualization of masked tokens’ representation in different training steps (with training 10, 30, 50, 70 steps from left to right) with fixed prompts.
|
| 189 |
+
|
| 190 |
+

|
| 191 |
+
Figure 4: Visualization of masked tokens’ representation in different training steps (with training 10, 30, 50, 70 steps from left to right) with differentiable prompts.
|
| 192 |
+
|
| 193 |
+
# DART V.S. CONVENTIONAL FINE-TUNING
|
| 194 |
+
|
| 195 |
+
The ability of DART to perform few-shot learning can be attributed to the label and being a true language understanding task, that once the model is capable of performing it correctly, it can easily apply this knowledge to other tasks that are framed as such. Superficially, (i) DART does not optimize any new parameters; however, conventional fine-tuning should learn an explicit classifier head over [CLS] embeddings, which may fail in the low-data regime. (ii) DART has the same task setting as large-scale language model pre-training.
|
| 196 |
+
|
| 197 |
+
# 6 CONCLUSION AND FUTURE WORK
|
| 198 |
+
|
| 199 |
+

|
| 200 |
+
Figure 5: A 3D visualization of several label representations learned in DART.
|
| 201 |
+
|
| 202 |
+
This paper presents DART, a simple yet effective finetuning approach that improves the fast-shot learning pretrained language model. The proposed approach can produce satisfactory improvements in the few-shot scenarios when compared to the conventional finetuning approaches. The proposed method is also pluggable for other language models (e.g., BART) and can be extended to other tasks, such as intent detection and sentiment analysis. Intuitively, the results obtained in this study can be used to stimulate future research directions in the few-shot or lifelong learning for NLP.
|
| 203 |
+
|
| 204 |
+
# ACKNOWLEDGMENTS
|
| 205 |
+
|
| 206 |
+
We want to express gratitude to the anonymous reviewers for their hard work and kind comments. This work is funded by National Key R&D Program of China (Funding No.SQ2018YFC000004), NSFCU19B2027/NSFC91846204, Zhejiang Provincial Natural Science Foundation of China (No. LGG22F030011), Ningbo Natural Science Foundation (2021J190), and Yongjiang Talent Introduction Programme (2021A-156-G).
|
| 207 |
+
|
| 208 |
+
# REPRODUCIBILITY STATEMENT
|
| 209 |
+
|
| 210 |
+
Our code is available in https://github.com/zjunlp/DART for reproducibility. Hyperparameters are provided in the Appendix A.1.
|
| 211 |
+
|
| 212 |
+
# REFERENCES
|
| 213 |
+
|
| 214 |
+
Christoph Alt, Aleksandra Gabryszak, and Leonhard Hennig. TACRED revisited: A thorough evaluation of the TACRED relation extraction task. In Dan Jurafsky, Joyce Chai, Natalie Schluter, and Joel R. Tetreault (eds.), Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pp. 1558–1569. Association for Computational Linguistics, 2020. doi: 10.18653/v1/2020.acl-main.142. URL https://doi. org/10.18653/v1/2020.acl-main.142.
|
| 215 |
+
|
| 216 |
+
Trapit Bansal, Rishikesh Jha, and Andrew McCallum. Learning to few-shot learn across diverse natural language classification tasks. In Donia Scott, Nuria Bel, and Chengqing Zong (eds.), ´ Proceedings of the 28th International Conference on Computational Linguistics, COLING 2020, Barcelona, Spain (Online), December 8-13, 2020, pp. 5108–5123. International Committee on Computational Linguistics, 2020. doi: 10.18653/v1/2020.coling-main.448. URL https://doi. org/10.18653/v1/2020.coling-main.448.
|
| 217 |
+
|
| 218 |
+
Hangbo Bao, Li Dong, Furu Wei, Wenhui Wang, Nan Yang, Xiaodong Liu, Yu Wang, Jianfeng Gao, Songhao Piao, Ming Zhou, and Hsiao-Wuen Hon. Unilmv2: Pseudo-masked language models for unified language model pre-training. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18 July 2020, Virtual Event, volume 119 of Proceedings of Machine Learning Research, pp. 642–652. PMLR, 2020a. URL http://proceedings.mlr. press/v119/bao20a.html.
|
| 219 |
+
|
| 220 |
+
Yujia Bao, Menghua Wu, Shiyu Chang, and Regina Barzilay. Few-shot text classification with distributional signatures. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020b. URL https:// openreview.net/forum?id $=$ H1emfT4twB.
|
| 221 |
+
|
| 222 |
+
Iz Beltagy, Kyle Lo, and Arman Cohan. Scibert: A pretrained language model for scientific text. In Kentaro Inui, Jing Jiang, Vincent Ng, and Xiaojun Wan (eds.), 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, pp. 3613–3618. Association for Computational Linguistics, 2019. doi: 10.18653/v1/D19-1371. URL https://doi.org/10.18653/v1/D19-1371.
|
| 223 |
+
|
| 224 |
+
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 (eds.), 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/ 1457c0d6bfcb4967418bfb8ac142f64a-Abstract.html.
|
| 225 |
+
|
| 226 |
+
Xiang Chen, Ningyu Zhang, Xin Xie, Shumin Deng, Yunzhi Yao, Chuanqi Tan, Fei Huang, Luo Si, and Huajun Chen. Knowledge-aware prompt-tuning with synergistic optimization for relation extraction. arXiv preprint arXiv:2104.07650, 2021.
|
| 227 |
+
|
| 228 |
+
Shumin Deng, Ningyu Zhang, Jiaojian Kang, Yichi Zhang, Wei Zhang, and Huajun Chen. Metalearning with dynamic-memory-based prototypical network for few-shot event detection. In James Caverlee, Xia (Ben) Hu, Mounia Lalmas, and Wei Wang (eds.), WSDM ’20: The Thirteenth ACM International Conference on Web Search and Data Mining, Houston, TX, USA, February 3-7, 2020, pp. 151–159. ACM, 2020a. doi: 10.1145/3336191.3371796. URL https://doi.org/10. 1145/3336191.3371796.
|
| 229 |
+
|
| 230 |
+
Shumin Deng, Ningyu Zhang, Zhanlin Sun, Jiaoyan Chen, and Huajun Chen. When low resource NLP meets unsupervised language model: Meta-pretraining then meta-learning for few-shot text classification (student abstract). In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020, The Thirty-Second Innovative Applications of Artificial Intelligence Conference, IAAI 2020, The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020, pp. 13773–13774. AAAI Press, 2020b. URL https://aaai.org/ojs/index.php/AAAI/article/view/7158.
|
| 231 |
+
|
| 232 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. In Jill Burstein, Christy Doran, and Thamar Solorio (eds.), Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pp. 4171– 4186. Association for Computational Linguistics, 2019. doi: 10.18653/v1/n19-1423. URL https://doi.org/10.18653/v1/n19-1423.
|
| 233 |
+
|
| 234 |
+
Ning Ding, Yulin Chen, Xu Han, Guangwei Xu, Pengjun Xie, Hai-Tao Zheng, Zhiyuan Liu, Juanzi Li, and Hong-Gee Kim. Prompt-learning for fine-grained entity typing. arXiv preprint arXiv:2108.10604, 2021.
|
| 235 |
+
|
| 236 |
+
Jesse Dodge, Gabriel Ilharco, Roy Schwartz, Ali Farhadi, Hannaneh Hajishirzi, and Noah A. Smith. Fine-tuning pretrained language models: Weight initializations, data orders, and early stopping. CoRR, abs/2002.06305, 2020. URL https://arxiv.org/abs/2002.06305.
|
| 237 |
+
|
| 238 |
+
Li Dong, Nan Yang, Wenhui Wang, Furu Wei, Xiaodong Liu, Yu Wang, Jianfeng Gao, Ming Zhou, and Hsiao-Wuen Hon. Unified language model pre-training for natural language understanding and generation. In Hanna M. Wallach, Hugo Larochelle, Alina Beygelzimer, Florence d’Alche-Buc, Emily B. Fox, and Roman Garnett (eds.), ´ Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pp. 13042–13054, 2019. URL https://proceedings.neurips.cc/paper/2019/hash/ c20bb2d9a50d5ac1f713f8b34d9aac5a-Abstract.html.
|
| 239 |
+
|
| 240 |
+
Tianyu Gao, Adam Fisch, and Danqi Chen. Making pre-trained language models better few-shot learners. CoRR, abs/2012.15723, 2020. URL https://arxiv.org/abs/2012.15723.
|
| 241 |
+
|
| 242 |
+
Karen Hambardzumyan, Hrant Khachatrian, and Jonathan May. WARP: word-level adversarial reprogramming. CoRR, abs/2101.00121, 2021. URL https://arxiv.org/abs/2101. 00121.
|
| 243 |
+
|
| 244 |
+
Xu Han, Tianyu Gao, Yuan Yao, Deming Ye, Zhiyuan Liu, and Maosong Sun. Opennre: An open and extensible toolkit for neural relation extraction. In Sebastian Pado and Ruihong Huang (eds.), ´ 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, pp. 169–174. Association for Computational Linguistics, 2019. doi: 10.18653/v1/D19-3029. URL https://doi.org/10. 18653/v1/D19-3029.
|
| 245 |
+
|
| 246 |
+
Xu Han, Weilin Zhao, Ning Ding, Zhiyuan Liu, and Maosong Sun. PTR: prompt tuning with rules for text classification. CoRR, abs/2105.11259, 2021. URL https://arxiv.org/abs/2105. 11259.
|
| 247 |
+
|
| 248 |
+
Iris Hendrickx, Su Nam Kim, Zornitsa Kozareva, Preslav Nakov, Diarmuid O S ´ eaghdha, Sebastian ´ Pado, Marco Pennacchiotti, Lorenza Romano, and Stan Szpakowicz. Semeval-2010 task 8: Multi- ´ way classification of semantic relations between pairs of nominals. In Katrin Erk and Carlo Strapparava (eds.), Proceedings of the 5th International Workshop on Semantic Evaluation, SemEval@ACL 2010, Uppsala University, Uppsala, Sweden, July 15-16, 2010, pp. 33–38. The Association for Computer Linguistics, 2010. URL https://www.aclweb.org/anthology/S10-1006/.
|
| 249 |
+
|
| 250 |
+
Shengding Hu, Ning Ding, Huadong Wang, Zhiyuan Liu, Juanzi Li, and Maosong Sun. Knowledgeable prompt-tuning: Incorporating knowledge into prompt verbalizer for text classification. CoRR, abs/2108.02035, 2021. URL https://arxiv.org/abs/2108.02035.
|
| 251 |
+
|
| 252 |
+
Jens Kringelum, Sonny Kim Kjærulff, Søren Brunak, Ole Lund, Tudor I. Oprea, and Olivier Taboureau. Chemprot-3.0: a global chemical biology diseases mapping. Database J. Biol. Databases Curation, 2016, 2016. doi: 10.1093/database/bav123. URL https://doi.org/ 10.1093/database/bav123.
|
| 253 |
+
|
| 254 |
+
Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. CoRR, abs/2104.08691, 2021. URL https://arxiv.org/abs/2104.08691.
|
| 255 |
+
|
| 256 |
+
Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. BART: denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. In Dan Jurafsky, Joyce Chai, Natalie Schluter, and Joel R. Tetreault (eds.), Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pp. 7871–7880. Association for Computational Linguistics, 2020. doi: 10.18653/v1/2020.acl-main.703. URL https://doi.org/10.18653/v1/2020.acl-main.703.
|
| 257 |
+
|
| 258 |
+
Jiachang Liu, Dinghan Shen, Yizhe Zhang, Bill Dolan, Lawrence Carin, and Weizhu Chen. What makes good in-context examples for gpt-3? CoRR, abs/2101.06804, 2021a. URL https: //arxiv.org/abs/2101.06804.
|
| 259 |
+
|
| 260 |
+
Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. Pre-train, prompt, and predict: A systematic survey of prompting methods in natural language processing. CoRR, abs/2107.13586, 2021b. URL https://arxiv.org/abs/2107.13586.
|
| 261 |
+
|
| 262 |
+
Xiao Liu, Yanan Zheng, Zhengxiao Du, Ming Ding, Yujie Qian, Zhilin Yang, and Jie Tang. GPT understands, too. CoRR, abs/2103.10385, 2021c. URL https://arxiv.org/abs/2103. 10385.
|
| 263 |
+
|
| 264 |
+
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, 2019. URL http://arxiv.org/abs/1907.11692.
|
| 265 |
+
|
| 266 |
+
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. CoRR, abs/2104.08786, 2021. URL https://arxiv.org/abs/2104.08786.
|
| 267 |
+
|
| 268 |
+
Sewon Min, Mike Lewis, Hannaneh Hajishirzi, and Luke Zettlemoyer. Noisy channel language model prompting for few-shot text classification. CoRR, abs/2108.04106, 2021. URL https: //arxiv.org/abs/2108.04106.
|
| 269 |
+
|
| 270 |
+
Takeru Miyato, Andrew M. Dai, and Ian J. Goodfellow. Adversarial training methods for semisupervised text classification. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net, 2017. URL https://openreview.net/forum?id $=$ r1X3g2_xl.
|
| 271 |
+
|
| 272 |
+
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 Hanna M. Wallach, Hugo Larochelle, Alina Beygelzimer, Florence d’Alche-Buc, Emily B. Fox, and Roman Garnett (eds.), ´ Advances in
|
| 273 |
+
|
| 274 |
+
Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pp. 8024–8035, 2019. URL https://proceedings.neurips.cc/paper/2019/hash/ bdbca288fee7f92f2bfa9f7012727740-Abstract.html.
|
| 275 |
+
|
| 276 |
+
Ethan Perez, Douwe Kiela, and Kyunghyun Cho. True few-shot learning with language models. arXiv preprint arXiv:2105.11447, 2021.
|
| 277 |
+
|
| 278 |
+
Jason Phang, Thibault Fevry, and Samuel R. Bowman. Sentence encoders on stilts: Supplementary ´ training on intermediate labeled-data tasks. CoRR, abs/1811.01088, 2018. URL http://arxiv. org/abs/1811.01088.
|
| 279 |
+
|
| 280 |
+
Guanghui Qin and Jason Eisner. Learning how to ask: Querying lms with mixtures of soft prompts. CoRR, abs/2104.06599, 2021. URL https://arxiv.org/abs/2104.06599.
|
| 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-totext transformer. J. Mach. Learn. Res., 21:140:1–140:67, 2020. URL http://jmlr.org/ papers/v21/20-074.html.
|
| 283 |
+
|
| 284 |
+
Teven Le Scao and Alexander M. Rush. How many data points is a prompt worth? CoRR, abs/2103.08493, 2021. URL https://arxiv.org/abs/2103.08493.
|
| 285 |
+
|
| 286 |
+
Timo Schick and Hinrich Schutze. It’s not just size that matters: Small language models are also ¨ few-shot learners. CoRR, abs/2009.07118, 2020. URL https://arxiv.org/abs/2009. 07118.
|
| 287 |
+
|
| 288 |
+
Timo Schick and Hinrich Schutze. Exploiting cloze-questions for few-shot text classification and ¨ natural language inference. In Paola Merlo, Jorg Tiedemann, and Reut Tsarfaty (eds.), ¨ Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, EACL 2021, Online, April 19 - 23, 2021, pp. 255–269. Association for Computational Linguistics, 2021. URL https://www.aclweb.org/anthology/2021.eacl-main. $2 0 /$ .
|
| 289 |
+
|
| 290 |
+
Taylor Shin, Yasaman Razeghi, Robert L. Logan IV, Eric Wallace, and Sameer Singh. Autoprompt: Eliciting knowledge from language models with automatically generated prompts. In Bonnie Webber, Trevor Cohn, Yulan He, and Yang Liu (eds.), Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, EMNLP 2020, Online, November 16-20, 2020, pp. 4222–4235. Association for Computational Linguistics, 2020. doi: 10.18653/v1/2020. emnlp-main.346. URL https://doi.org/10.18653/v1/2020.emnlp-main.346.
|
| 291 |
+
|
| 292 |
+
Livio Baldini Soares, Nicholas FitzGerald, Jeffrey Ling, and Tom Kwiatkowski. Matching the blanks: Distributional similarity for relation learning. In Anna Korhonen, David R. Traum, and Llu´ıs Marquez (eds.), \` Proceedings of the 57th Conference of the Association for Computational Linguistics, ACL 2019, Florence, Italy, July 28- August 2, 2019, Volume 1: Long Papers, pp. 2895–2905. Association for Computational Linguistics, 2019. doi: 10.18653/v1/p19-1279. URL https://doi.org/10.18653/v1/p19-1279.
|
| 293 |
+
|
| 294 |
+
Derek Tam, Rakesh R. Menon, Mohit Bansal, Shashank Srivastava, and Colin Raffel. Improving and simplifying pattern exploiting training. CoRR, abs/2103.11955, 2021. URL https://arxiv. org/abs/2103.11955.
|
| 295 |
+
|
| 296 |
+
Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(11), 2008.
|
| 297 |
+
|
| 298 |
+
Sinong Wang, Han Fang, Madian Khabsa, Hanzi Mao, and Hao Ma. Entailment as few-shot learner. CoRR, abs/2104.14690, 2021. URL https://arxiv.org/abs/2104.14690.
|
| 299 |
+
|
| 300 |
+
Qizhe Xie, Zihang Dai, Eduard H. Hovy, Thang Luong, and Quoc Le. Unsupervised data augmentation for consistency training. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin (eds.), 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/44feb0096faa8326192570788b38c1d1-Abstract.html.
|
| 301 |
+
|
| 302 |
+
Wenpeng Yin, Nazneen Fatema Rajani, Dragomir R. Radev, Richard Socher, and Caiming Xiong. Universal natural language processing with limited annotations: Try few-shot textual entailment as a start. In Bonnie Webber, Trevor Cohn, Yulan He, and Yang Liu (eds.), Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, EMNLP 2020, Online, November 16-20, 2020, pp. 8229–8239. Association for Computational Linguistics, 2020. doi: 10.18653/v1/2020.emnlp-main.660. URL https://doi.org/10.18653/v1/2020. emnlp-main.660.
|
| 303 |
+
|
| 304 |
+
Haiyang Yu, Ningyu Zhang, Shumin Deng, Hongbin Ye, Wei Zhang, and Huajun Chen. Bridging text and knowledge with multi-prototype embedding for few-shot relational triple extraction. In Donia Scott, Nuria Bel, and Chengqing Zong (eds.), ´ Proceedings of the 28th International Conference on Computational Linguistics, COLING 2020, Barcelona, Spain (Online), December 8-13, 2020, pp. 6399–6410. International Committee on Computational Linguistics, 2020. doi: 10.18653/v1/2020. coling-main.563. URL https://doi.org/10.18653/v1/2020.coling-main.563.
|
| 305 |
+
|
| 306 |
+
Mo Yu, Xiaoxiao Guo, Jinfeng Yi, Shiyu Chang, Saloni Potdar, Yu Cheng, Gerald Tesauro, Haoyu Wang, and Bowen Zhou. Diverse few-shot text classification with multiple metrics. In Marilyn A. Walker, Heng Ji, and Amanda Stent (eds.), Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2018, New Orleans, Louisiana, USA, June 1-6, 2018, Volume 1 (Long Papers), pp. 1206–1215. Association for Computational Linguistics, 2018. doi: 10.18653/v1/n18-1109. URL https://doi.org/10.18653/v1/n18-1109.
|
| 307 |
+
|
| 308 |
+
Ningyu Zhang, Shumin Deng, Zhanlin Sun, Jiaoyan Chen, Wei Zhang, and Huajun Chen. Relation adversarial network for low resource knowledge graph completion. In Yennun Huang, Irwin King, Tie-Yan Liu, and Maarten van Steen (eds.), WWW ’20: The Web Conference 2020, Taipei, Taiwan, April 20-24, 2020, pp. 1–12. ACM / IW3C2, 2020. doi: 10.1145/3366423.3380089. URL https://doi.org/10.1145/3366423.3380089.
|
| 309 |
+
|
| 310 |
+
Tianyi Zhang, Felix Wu, Arzoo Katiyar, Kilian Q Weinberger, and Yoav Artzi. Revisiting fewsample $\{ { \mathrm { b e r t } } \}$ fine-tuning. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ cO1IH43yUF.
|
| 311 |
+
|
| 312 |
+
Tony Z. Zhao, Eric Wallace, Shi Feng, Dan Klein, and Sameer Singh. Calibrate before use: Improving few-shot performance of language models. CoRR, abs/2102.09690, 2021. URL https:// arxiv.org/abs/2102.09690.
|
| 313 |
+
|
| 314 |
+
Zexuan Zhong, Dan Friedman, and Danqi Chen. Factual probing is[mask]: Learning vs. learning to recall. In North American Association for Computational Linguistics (NAACL), 2021.
|
| 315 |
+
|
| 316 |
+
# A APPENDIX
|
| 317 |
+
|
| 318 |
+
Our code is available in the supplementary materials for reproducibility. This section contains details about the training procedures and hyperparameters for each of the datasets. We utilize Pytorch (Paszke et al., 2019) to conduct experiments with 1 Nvidia 3090 GPUs. All optimizations are performed with the AdamW optimizer with a linear warmup of learning rate over the first $10 \%$ of gradient updates to a maximum value, then linear decay over the remainder of the training. Gradients are clipped if their norm exceeds 1.0, and weight decay on all non-bias parameters is set to 0.01. Early stopping is adopted to reduce over-fitting on the training set.
|
| 319 |
+
|
| 320 |
+
We follow LM-BFF (Gao et al., 2020) to measure the average performance of models trained on 5 different randomly sampled $\mathcal { D } _ { \mathrm { t r a i n } }$ and $\mathcal { D } _ { \mathrm { d e v } }$ splits, and perform grid search for optimal hyper-parameter combinations on each split, including learning-rate, weight decay, and batch size.
|
| 321 |
+
|
| 322 |
+
For P-tuning (Liu et al., 2021c), due to the limit of search space, we do not set anchor tokens in prompt tokens.
|
| 323 |
+
|
| 324 |
+
For DART, we adopt joint optimization to acquire optimal prompts and fine-tune over global parame ters. Note that we use base prompts as templates of pseudo tokens to accelerate convergence.
|
| 325 |
+
|
| 326 |
+
To compare fairly, we use RoBERTa-large (Liu et al., 2019) as pre-trained model for both DART and P-tuning framework, following LM-BFF (Gao et al., 2020). We also adopt the best discrete prompts together with label words in LM-BFF as base prompt settings for each framework, as stated below.
|
| 327 |
+
|
| 328 |
+
A.1 HYPER-PARAMETER SEARCH SPACE OF OUR METHOD IN GRID SEARCH
|
| 329 |
+
|
| 330 |
+
SST-2, MR, CR, Subj, TREC, QNLI, MRPC, QQP
|
| 331 |
+
|
| 332 |
+
The hyper-parameter search space is (the optimal set of parameters may vary across different tasks and data splits):
|
| 333 |
+
|
| 334 |
+
• learning rate [1e-5, 5e-5, 1e-4, 2e-4] • weight decay [0.0, 0.01, 0.05, 0.10] • number epochs [20,30] • batch size: [4, 8, 16, 24, 32] • max seq length: 128 • gradient accumulation steps: [1, 2]
|
| 335 |
+
|
| 336 |
+
MNLI, SNLI
|
| 337 |
+
|
| 338 |
+
The hyper-parameter search space is (the optimal set of parameters may vary across different tasks and data splits):
|
| 339 |
+
|
| 340 |
+
• learning rate [1e-5, 5e-5, 1e-4, 2e-4] • weight decay [0.0, 0.01, 0.05, 0.10] • number epochs [30,40]
|
| 341 |
+
• batch size: [4, 8, 16]
|
| 342 |
+
• max seq length: 256
|
| 343 |
+
• gradient accumulation steps: [1, 2]
|
| 344 |
+
|
| 345 |
+
# TACRED-Revisit, WiKi80, SemEval
|
| 346 |
+
|
| 347 |
+
The hyper-parameter search space are:
|
| 348 |
+
|
| 349 |
+
• learning rate [3e-5,5e-5,1e-5,5e-6]
|
| 350 |
+
• number epochs [20,30]
|
| 351 |
+
• batch size: 48
|
| 352 |
+
• max seq length: 128
|
| 353 |
+
• gradient accumulation steps: 2
|
| 354 |
+
|
| 355 |
+
# ChemProt
|
| 356 |
+
|
| 357 |
+
The hyper-parameter search space are:
|
| 358 |
+
|
| 359 |
+
• learning rate [3e-5,5e-5,1e-5,5e-6]
|
| 360 |
+
• number epochs [20,30]
|
| 361 |
+
• batch size: 48
|
| 362 |
+
• max seq length: 256
|
| 363 |
+
• gradient accumulation steps: 4
|
| 364 |
+
|
| 365 |
+
# DialogRE
|
| 366 |
+
|
| 367 |
+
The hyper-parameter search space is (the optimal set of parameters may vary across different tasks and data splits):
|
| 368 |
+
|
| 369 |
+
• learning rate [1e-5, 5e-5, 1e-4, 2e-4]
|
| 370 |
+
|
| 371 |
+
• weight decay [0.0, 0.10]
|
| 372 |
+
• number epochs [20,30,40]
|
| 373 |
+
• batch size: [4, 8]
|
| 374 |
+
• max seq length: 256
|
| 375 |
+
• gradient accumulation steps: [1, 2]
|
| 376 |
+
|
| 377 |
+
A.2 BASE PROMPT AND LABEL WORDS
|
| 378 |
+
|
| 379 |
+
# SST-2, MR, CR
|
| 380 |
+
|
| 381 |
+
• prompt template $( l e n g t h = 3$ ) [”text”, ”it”, ”was”, ”<mask>”, ”.”] • label words $\{ \ ' 0 ^ { \ast }$ : ”terrible”, ”1”: ”great”}
|
| 382 |
+
|
| 383 |
+
# Subj
|
| 384 |
+
|
| 385 |
+
• prompt template ${ l e n g t h = 3 }$ ) [”text”, ”This”, ”is”, ”<mask>”, ”.”] • label words $\{ \ ' 0 ^ { \ast }$ : ”incorrect”, ”1”: ”correct”}
|
| 386 |
+
|
| 387 |
+
# TREC
|
| 388 |
+
|
| 389 |
+
• prompt template $( l e n g t h = 1 $ ) [”<mask>”, ”:”, ”text”]
|
| 390 |
+
• label words $\{ \ ' 0 ^ { \ast }$ : ”Description”, ”1”:”Entity”,”2: ”Expression”,”3”: ”Human”,”4”: ”Location”,”5”:”Number”}
|
| 391 |
+
|
| 392 |
+
# MNLI, SNLI
|
| 393 |
+
|
| 394 |
+
• prompt template(length $= 2$ ) [”texta”, ”?”, ”<mask>”, ”,”, ”textb”] • label words {”contradiction”: ”No”,”entailment”: ”Yes”, ”neutral”: ”Maybe”}
|
| 395 |
+
|
| 396 |
+
QNLI
|
| 397 |
+
|
| 398 |
+
• prompt template $( l e n g t h = 2 )$ ) [”texta”, ”?”, ”<mask>”, ”,”, ”textb”] • label words {”not entailment”: ”No”,”entailment”: ”Yes”}
|
| 399 |
+
|
| 400 |
+
# MRPC, QQP
|
| 401 |
+
|
| 402 |
+
• prompt template(length $= 2$ ) [”texta”, ”?”, ”<mask>”, ”,”, ”textb”] • label words $\{ { } ^ { \ ' } 0 ^ { \ ' } \colon { } ^ { \ ' } \mathrm { N o } ^ { \ ' }$ , ”1”: ”Yes”}
|
| 403 |
+
|
| 404 |
+
# TACRED-Revisit, WiKi80, SemEval,DialogRE
|
| 405 |
+
|
| 406 |
+
• prompt template $\mathit { l e n g t h } = 3$ ) [”text”, Entity1, ”is”, ”the”, ”<mask>”, ”of”, Entity2] • label words {”country of origin”, ”participating team”, ”participant of”,...}
|
| 407 |
+
|
| 408 |
+
A.3 TEMPLATE LENGTH ANALYSIS
|
| 409 |
+
|
| 410 |
+
<table><tr><td>Model</td><td>Accuracy</td></tr><tr><td>DART (length = 2)</td><td>92.6 (0.6)</td></tr><tr><td>DART(length = 3)</td><td>93.5 (0.5)</td></tr><tr><td>DART (length = 5)</td><td>91.2 (1.1)</td></tr><tr><td>DART (length = 10)</td><td>90.6 (0.5)</td></tr><tr><td>Fine-tuning</td><td>81.4 (3.8)</td></tr></table>
|
| 411 |
+
|
| 412 |
+
Table 4: Few-shot performance on SST-2 task using templates with different length.
|
| 413 |
+
|
| 414 |
+
We define the length of a template as the number of tokens except for input sentence and <mask> token, and apply DART on templates with different length. The performance of a specific template length $l$ is derived by summarizing the averaging accuracy on each few-shot data splits, using template $T = t _ { 1 } , t _ { 2 } , . . . , t _ { l }$ . From the Table 4, we observe that for the SST-2 task, the model whose template length is three yield best performance; however, the overall impact of template length is rather insignificant as models with different template length obtain relatively similar performance.
|
| 415 |
+
|
| 416 |
+
A.4 PERFORMANCE ON FULL TRAINING SET
|
| 417 |
+
Table 5: Full training set results with RoBERTa-large. Fine-tuning: we reported same results as Gao et al. (2020). LM-BFF: we trained LM-BFF model (without demonstration) on full-training set.
|
| 418 |
+
|
| 419 |
+
<table><tr><td>Model</td><td> SST-2 (acc)</td><td>MR (acc)</td><td>CR (acc)</td><td>Subj (acc)</td><td>TREC (acc)</td></tr><tr><td>Fine-tuning</td><td>95.0</td><td>90.8</td><td>89.4</td><td>97.0</td><td>97.4</td></tr><tr><td>LM-BFF</td><td>94.9</td><td>91.9</td><td>92.4</td><td>96.9</td><td>97.3</td></tr><tr><td>DART</td><td>94.6</td><td>91.3</td><td>93.8</td><td>96.6</td><td>95.6</td></tr><tr><td>Model</td><td>MNLI (acc)</td><td> SNLI (acc)</td><td>QNLI (acc)</td><td>MRPC (F1)</td><td>QQP (F1)</td></tr><tr><td>Fine-tuning</td><td>89.8</td><td>92.6</td><td>93.3</td><td>91.4</td><td>81.7</td></tr><tr><td>LM-BFF</td><td>89.6</td><td>90.3</td><td>92.8</td><td>91.7</td><td>86.4</td></tr><tr><td>DART</td><td>87.3</td><td>89.5</td><td>92.3</td><td>90.4</td><td>89.5</td></tr></table>
|
| 420 |
+
|
| 421 |
+
We conduct experiments and report the performance of DART with full-sized training data of GLUE tasks. From Table 5, we notice that DART obtain better or comparable results compared with the standard fine-tuning and LM-BFF, indicating that prompt-based tuning methods benefit less from full-sized data.
|
| 422 |
+
|
| 423 |
+
# A.5 PERFORMANCE WITH CONSTRAINED LABEL TOKENS
|
| 424 |
+
|
| 425 |
+
We conduct a nearest neighbor vocabulary embedding search to project the best optimized differentialble label token to a readable natural token. Those tokens are chosen based on cosine-similarity between all tokens’ embedding and the optimized differentialble label token of DART. We list them in descending order with similarity scores (i.e., the token ‘great‘ is chosen as its cosine-similarity score with trained positive label embedding of DART is the highest among all tokens, and the token ‘terrible‘ is the most similar token with the trained negative label embedding; the other tokens are selected and listed in descending order with similarity scores). From Table 6, we observe that the performance of fixed prompt models is related to the similarity score of the chosen label token and that the DART model learns more semantic representation for label tokens, thus, yield best performance.
|
| 426 |
+
|
| 427 |
+
Table 6: Few-shot performance on CR task using constrained label tokens with DART.
|
| 428 |
+
|
| 429 |
+
<table><tr><td>Label tokens</td><td>Accuracy</td></tr><tr><td>differentiable token (DART)</td><td>91.8 (0.5)</td></tr><tr><td>great/terrible</td><td>91.5 (0.3)</td></tr><tr><td>fantastic/awful</td><td>91.0 (0.6)</td></tr><tr><td>amazing/horrible</td><td>90.2 (0.8)</td></tr><tr><td>good/bad</td><td>89.6 (0.5)</td></tr></table>
|
| 430 |
+
|
| 431 |
+

|
| 432 |
+
Figure 6: The $R _ { D }$ ratio curve on dev set of CR task of fixed prompt and differentiable prompt during training.
|
| 433 |
+
|
| 434 |
+
# A.6 MORE EXPERIMENTS
|
| 435 |
+
|
| 436 |
+
We numeralize our observation on representation of masked token with a ratio between the average intra-class distance and average inter-class distance of hidden state vectors as $\begin{array} { r } { R _ { D } = \frac { \bar { D } _ { i n t r a } } { \bar { D } _ { i n t e r } } } \end{array}$ D¯ intra , where:
|
| 437 |
+
|
| 438 |
+
$$
|
| 439 |
+
\begin{array} { r } { \bar { D } _ { i n t r a } = \displaystyle { \frac { 1 } { C } \sum _ { c = 1 } ^ { C } \bar { D } _ { i n t r a ( c ) } = \frac { 1 } { C } \sum _ { c = 1 } ^ { C } \frac { 1 } { N _ { c } } \sum _ { i = 1 } ^ { N _ { c } } \sum _ { j = 1 } ^ { N _ { c } } \mathrm { d i s t a n c e } \left( H _ { c } [ i ] , H _ { c } [ j ] \right) } ; } \\ { \bar { D } _ { i n t e r } = \displaystyle { \frac { 1 } { C ( C - 1 ) } \sum _ { c _ { 1 } = 1 } ^ { C } \sum _ { c _ { 2 } \neq c _ { 1 } } \bar { D } _ { i n t e r ( c _ { 1 } , c _ { 2 } ) } = \frac { 1 } { C ( C - 1 ) } \sum _ { c _ { 1 } = 1 } ^ { C } \sum _ { c _ { 2 } \neq c _ { 1 } } \sum _ { i = 1 } ^ { N _ { c _ { 1 } } N _ { c _ { 2 } } } \mathrm { d i s t a n c e } \left( H _ { c _ { 1 } } [ i ] , H _ { c _ { 2 } } [ j ] \right) } ; } \end{array}
|
| 440 |
+
$$
|
| 441 |
+
|
| 442 |
+
where distance is the euclidean metric between two vectors, and $H _ { c } [ i ]$ means the hidden state representation of masked token of $i$ -th sample from class $c$ . For discriminative representation, its average intra-class distance is low as data points within the same class tend to gather together, and its average inter-class distance is high as data points from different classes are separated, so its $R _ { D }$ ratio should be close to 0.
|
| 443 |
+
|
| 444 |
+
As is shown in Figure 6, the $R _ { D }$ ratio of the differentiable method grows lower than that of the fixed label method, which shows the hidden state representation trained in the differentiable method has better linear separability.
|
| 445 |
+
|
| 446 |
+
Note that in a masked language model, a linear transformation is performed on the hidden state representations, with a linear decoder sharing weights with the model’s word embeddings serving as the final token classifier. Hence it is evident that better linear separability of the representations leads to better performance. In our case, the differentiable method yields better performance due to its better linear separability.
|
| 447 |
+
|
| 448 |
+
# A.7 LIMITATIONS
|
| 449 |
+
|
| 450 |
+
Our work may fail when the distribution of the task corpus varies from that of the pre-training corpus. For example, a general pre-trained language model may be fine-tuned with more training instances in a specific domain (e.g., medical domain). This issue can be addressed by intermediate training (Phang et al., 2018; Yin et al., 2020; Zhao et al., 2021), and will be analyzed in the future work. Besides, our work also shows an instability associated with hyper-parameters which is also observed by Dodge et al. (2020); Zhang et al. (2021); Perez et al. (2021) as volatility of few-shot learning in NLP. Overall, however, we believe our work will inspire future work to few-shot settings with more practical applications to low-data settings, e.g., that involve low-resource languages or expert annotation.
|
| 451 |
+
|
| 452 |
+
# A.8 BROADER IMPACT
|
| 453 |
+
|
| 454 |
+
The pre-train-fine-tune approach has become the standard for natural language processing (NLP). However, supervised fine-tuning is still practically affected by labeled data. This study proposes a novel pluggable, extensible, and efficient approach named DifferntiAble pRompT (DART), which can convert small language models into better few-shot learners. We believe that our study makes a significant contribution to the literature because determining the appropriate prompts requires domain expertise, and handcrafting a high-performing prompt often requires impractically large validation sets, and these issues have been overcome with the use of the proposed method, which is model-agnostic, parameter-efficient. We experimentally verified our proposed approach on 13 standard NLP tasks, and it was seen to outperform several standard NLP platforms.
|
md/dev/gEZrGCozdqR/gEZrGCozdqR.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/gJcEM8sxHK/gJcEM8sxHK.md
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MAPPING LANGUAGE MODELS TO GROUNDED CON-CEPTUAL SPACES
|
| 2 |
+
|
| 3 |
+
Roma Patel & Ellie Pavlick
|
| 4 |
+
Department of Computer Science
|
| 5 |
+
Brown University
|
| 6 |
+
{romapatel,ellie pavlick}@brown.edu
|
| 7 |
+
|
| 8 |
+
# ABSTRACT
|
| 9 |
+
|
| 10 |
+
A fundamental criticism of text-only language models (LMs) is their lack of grounding—that is, the ability to tie a word for which they have learned a representation to its referent in the non-linguistic world. However, despite this limitation, large pre-trained LMs have been shown to have a remarkable grasp of the conceptual structure of language, as demonstrated by their ability to answer questions, generate fluent text, or make inferences about entities, objects, and properties that they have never physically observed. In this work we investigate the extent to which the rich conceptual structure that LMs learn indeed reflects the conceptual structure of the non-linguistic world—which is something that LMs have never observed. We do this by testing whether the LMs can learn to map an entire conceptual domain (e.g., direction or colour) onto a grounded world representation given only a small number of examples. For example, we show a model what the word “left” means using a textual depiction of a grid world, and assess how well it can generalise to related concepts, for example, the word “right”, in a similar grid world. We investigate a range of generative language models of varying sizes (including GPT-2 and GPT-3), and see that although the smaller models struggle to perform this mapping, the largest model can not only learn to ground the concepts that it is explicitly taught, but appears to generalise to several instances of unseen concepts as well. Our results suggest an alternative means of building grounded language models: rather than learning grounded representations “from scratch”, it is possible that large text-only models learn a sufficiently rich conceptual structure that could allow them to be grounded in a data-efficient way.
|
| 11 |
+
|
| 12 |
+
# 1 INTRODUCTION
|
| 13 |
+
|
| 14 |
+
Large pre-trained language models (LMs) trained on text corpora have shown remarkable progress on a range of natural language understanding tasks (Radford et al., 2019; Brown et al., 2020). Such models have demonstrated their ability to generate fluent dialogue (Brown et al., 2020), make commonsense inferences Zellers et al. (2019), and reconstruct taxonomies and word relations (Chen et al., 2020). However, it has been argued that true meaning cannot be learned from the form of language alone (i.e., from text) because it is a word’s use in the non-linguistic world that imparts it meaning (Bender & Koller, 2020; Bisk et al., 2020). For example, although LMs might learn from textual co-occurrences that the words north and south are opposites, the grounded meaning of these words, i.e., the direction that you should travel if you are told to go north, is something to which these models, by definition, do not have access during training.
|
| 15 |
+
|
| 16 |
+
While it is indisputable that text-only models do not learn representations of concepts that are grounded in the non-text world, it is possible for the structure of relations between concepts in text form to be identical to what a grounded model would learn. In principle, it is therefore possible for a text-only model’s conceptual space to be isomorphic to the “true” (i.e., grounded) conceptual space (Merrill et al., 2021). In this work, we investigate whether this is the case by asking whether models can learn to ground an entire domain (e.g., direction) after grounding only a subset of the points in that domain (e.g., left). Specifically, for generative LMs that have been trained only on large text corpora, we “orient” the models by showing them how some word forms (that they have learned during training) are used in simple text worlds—for example, what the direction north maps to in a textual representation of a grid world (see Figure 1). We then evaluate two types of generalisation. First $( \ S 3 . 1 )$ , we evaluate generalisation to unseen worlds. For example, if the model has seen several realisations of the word north in different grid worlds, can it correctly identify north in an unseen world (e.g., one of a different size or shape)? Second (§3.2), we evaluate generalisation to unseen but related concepts. For example, if the model has been shown grounded representations of north and east, can it correctly identify south and west, even though it was never shown them? We find that although the small language models (GPT-2 models that contain on the order of 100M parameters) cannot perform either generalisation well, the largest model (a GPT-3 model containing 175B parameters) can indeed learn groundings in the conceptual worlds we build. We analyse the predictions and errors made by models $( \ S 3 . 3 )$ and find that the errors made by the small models are often due to a failure to recognize the domain, and thus generating random words by default. In contrast, the errors made by the largest model are often intuitive, e.g., predicting in-domain concepts that are reasonable substitutes for the target (e.g., maroon versus dark red).
|
| 17 |
+
|
| 18 |
+
# 2 EXPERIMENTAL DESIGN
|
| 19 |
+
|
| 20 |
+
# 2.1 MODELS
|
| 21 |
+
|
| 22 |
+
We test five autoregressive Transformer language models (Vaswani et al., 2017) of varying size, specifically the GPT-2 (Radford et al., 2019) and GPT-3 (Brown et al., 2020) models. Our smallest model contains 124M parameters, and the others follow increasing model sizes (355M, 774M, 1.5B and 175B parameters). All models are pre-trained on differently filtered versions of the OpenAI Web-Text dataset Radford et al. (2019), composed of 40GB of English web text available on the internet. We generate up to 5 tokens per prompt and, to improve the robustness of our analyses, generate 3 samples per prompt. We use a temperature of 1 during generation and sample from the softmax probabilities produced at each time step using nucleus sampling (Holtzman et al., 2019) with $\mathrm { p } { = } 0 . 8 5$ . We include more detail on the models and their training data in Appendix A.
|
| 23 |
+
|
| 24 |
+
# 2.2 IN-CONTEXT LEARNING
|
| 25 |
+
|
| 26 |
+
Several studies (Brown et al., 2020; Reynolds & McDonell, 2021) have shown that instead of finetuning generative LMs–i.e., a process that updates parameters learned by the model during pretraining–it is possible to achieve competitive performance by giving the model a small number of training examples within the prompt. This is often referred to as “in-context learning” or “fewshot prompting”. Specifically, a prompt includes $n$ task examples that include a question prefix (e.g., “World:”) followed by the question, and an answer prefix (e.g., “Answer:”) followed by the answer to the question. After giving the model $n$ examples in this manner, the prompt ends with a new question and only an answer prefix after which the model is expected to generate an answer to the last question, following the prompt format it has seen. By enumerating over all questions in the test set, we can obtain a model-generated answer for every test set question that we wish to evaluate. There are no gradient updates to any model parameters using this approach.
|
| 27 |
+
|
| 28 |
+
# 2.3 GROUNDED CONCEPT DOMAINS
|
| 29 |
+
|
| 30 |
+
The models that we test, by construction, can receive only text inputs. Thus, we focus on a set of grounded domains for which it is possible to faithfully represent the grounded meaning in text form. We briefly describe these domains below, summarise them in Figure 1, and describe in detail, the prompt creation process for each generalisation task in Sections $\ S 3 . 2$ and $\ S 3 . 1$ . We discuss the possibility of expanding this set of concepts in future work in Section $\ S 4$ .
|
| 31 |
+
|
| 32 |
+
Spatial Terms We consider 6 spatial concepts: left, right, up, down, top, bottom. Each of the above concepts can be represented in a grid world using the position of a special character (here, a ‘1’) in the world. To do this, we create grid world environments of varying sizes (where the number of rows and columns ranges from 1 to 8), where each world consists of $^ { 6 } 0$ ’s and a single ‘1’.
|
| 33 |
+
|
| 34 |
+
Cardinal Directions We consider eight cardinal directions: north, south, east, west, northeast, northwest, southeast, southwest. These are similar to spatial terms, except that they include compositional terms (e.g., northeast). We use grid-worlds of the same format as spatial terms to represent these concepts.
|
| 35 |
+
|
| 36 |
+

|
| 37 |
+
Figure 1: Figure shows example worlds and groundings for three concept categories: colours, cardinal directions, and spatial terms. For each of the three domains, the left figure in each shows the full set of grounded concepts in the domain. To the right, we see example world representations with textual instantiations of the groundings that serve as prompts for language models.
|
| 38 |
+
|
| 39 |
+
Colour Terms We consider colour terms in a three-dimensional space, using a dataset of 367 RGB colours (Abdou et al., 2021) that contains colour names (e.g., red, cyan, forest green) each associated with an RGB code (e.g., $( 2 5 5 , 0 , 0 )$ ). Therefore, the world representation in this case is not a grid-world, but an RGB code associated with every colour name. Figure 1 shows example RGB codes and colours that serve as part of a prompt given to the models we test.
|
| 40 |
+
|
| 41 |
+
# 2.4 ROTATED WORLDS TO CONTROL FOR MEMORISATION
|
| 42 |
+
|
| 43 |
+
Motivation The GPT- $\mathbf { X }$ models that we use have been trained on the CommonCrawl corpus (Radford et al. (2019)), a collection of documents that contains web text freely available on the internet. Since we provide instantiations of grounded concepts in text form, it is very plausible that the domains described above have been encountered verbatim during training. For example, for spatial terms such as left, a model might have seen instances of matrices and linear algebra terms with the word left in close proximity; for colour terms, tables that map RGB colour codes to colour names are pervasive in web-text. We therefore include a control task in our experimental setup such that the model cannot succeed using simple memorisation. Rather, success on a task requires the model to truly perform a conceptual mapping between the ungrounded and grounded representations.
|
| 44 |
+
|
| 45 |
+
Isomorphism as a Control We use the concept of isomorphism to control for memorisation. Intuitively, imagine a situation where you are lost in the woods. Once pointed in the direction of north, you instantly know which way is south. However, this ability is not dependent on having been correctly pointed north–if someone were to incorrectly point east and tell you this was north, you would readily infer west to be south. This is because your reasoning depends on your knowledge of the relation between north and south, and between north and the world, rather than on having memorized the “true” grounding of each concept independently.
|
| 46 |
+
|
| 47 |
+
By the same logic, if a model is learning a grounding function, this should be dependent on the world in which it is being grounded. For example, in different worlds where the word red grounds to different points in space, the word blue, by analogy, shares a fixed conceptual relation to the word red. Therefore, it should ground in correspondingly equidistant ways in the two worlds. A model’s ability to learn two different grounding functions $f$ vs. $g$ , should not be dependent on what the actual points ground to, as long as the structural relations between concepts in the space are preserved. Further, this should hold for all such isomorphic transformations that preserve the structure of the space, and importantly, it should not hold for random perturbations that distort the structure of the space, since such distortions would break the assumption that the relation between red and blue in ungrounded space is analogous to that in grounded space.
|
| 48 |
+
|
| 49 |
+
Implementation In the colour domain, since colour concepts exist in a 3D world of RGB codes, we rotate each point around a fixed axis by a certain degree to create a new isomorphic world. We repeat this control three times (for $9 0 ^ { \circ }$ , $1 8 0 ^ { \circ }$ and $2 7 0 ^ { \circ }$ rotations) and average over the rotations in our evaluations. For cardinal directions, we rotate each cardinal concept by $9 0 °$ in two dimensions, and do this three times and average over rotations. Since the spatial terms exist as pairs, we simply swap the groundings of alternate terms (e.g., left and right). For random worlds that do not preserve Isomorphism and Rotated WorldsFINAL the structure between word forms, we randomly assign a concept name (e.g., red) to a point in the world, and we do this for all concept names and categories to obtain a random world for each. Figure 2 shows example transformations of colours on rotating by FINAL $9 0 °$ , as well as randomly rotating points.
|
| 50 |
+
|
| 51 |
+

|
| 52 |
+
Figure 2: Figure shows how colours and modifiers transform in rotated worlds. The leftmost figure shows a full 3-D colour space of 367 colours. The three figures on the right, show four sample colours in their original world, a world rotated by $9 0 °$ , and a randomly rotated world, showing how the structure of the space is preserved or distorted in isomorphic or random rotations respectively.
|
| 53 |
+
|
| 54 |
+
# 2.5 EVALUATIONS
|
| 55 |
+
|
| 56 |
+
Experimental Logic We report model performance in three settings: the original (“true”) world (e.g., that in which red maps to the actual RGB code for red), an average over three rotated worlds (e.g., worlds in which red maps to some other RGB code, but relations between colors are preserved), and a random world (in which relations between mappings are not preserved). If a model is performing the conceptual mapping in the desired way, we expect that performance should be high in the true world and that there should be no significant degradation in performance when moving to rotated worlds. We also expect that performance should be low in the random world.
|
| 57 |
+
|
| 58 |
+
Metrics When given a prompt, a generative LM is free to generate any number of tokens until having generated the EOS token that halts further generation. Since classification tasks usually correspond to labels that contain only a few words, the standard approach is to let the model generate an entire sequence of text and to then cut off the generation to the first $n$ tokens (where typically $n < 1 0 .$ ). From the prompting mechanism, the model should learn to follow the prompt format to generate one label (e.g., instead of every label in succession), and since it does not receive any gradient updates during this learning, there is no incentive for it to predict all related labels within a $n$ -token generation. We see that this is true in practice and show example generations in Appendix E. We set $n = 5$ and then report the following metrics.
|
| 59 |
+
|
| 60 |
+
TOP-1 ACCURACY If the ground-truth answer or any substring thereof lies in the generated answer (i.e., the first $n$ tokens of the full generation), the model gets perfect accuracy. If the ground-truth answer does not exist in the generated answer, or exists in the generation outside of the cutoff limit, the model gets a 0 accuracy. For example, for the ground truth answer deep tuscan red, if the model generated answer is tuscan red or red the model gets a perfect accuracy, but if the model generated answer is deep red or wine or vermilion, the model gets an accuracy of 0. We also compute the same metric using exact match (i.e., the model is only correct if it generates exactly deep tuscan red). We find the values are lower but the trends are the same; see Appendix ??..
|
| 61 |
+
|
| 62 |
+
TOP-3 ACCURACY This metric is analogous to Top-1 except that instead of only considering the most probable generation from the model, we collect the second and third most probable answer sequences as well. The model gets a perfect accuracy if the correct answer exists in any of the three generated answers. If the correct answer does not exist in any of the 3 generated answers, or exists in any of the generations outside of the cutoff limit, the model gets an accuracy of 0. Again, see Appendix ?? for results using exact match.
|
| 63 |
+
|
| 64 |
+
<table><tr><td colspan="4">Example Input (20 in-context-learning examples followed by prompt)</td><td colspan="2">Example Model Outputs</td></tr><tr><td>World:</td><td>World:</td><td>World:</td><td>World:</td><td>GPT-2 (124M)</td></tr><tr><td>[0.0.0.]</td><td>[0.0.0.]</td><td>[0.0.0.]</td><td>[1.0.]</td><td></td></tr><tr><td>[0.0.0.]</td><td>[0.0.0.]</td><td>[0.0.0.]</td><td>[0.0.]</td><td>world P=0.09</td></tr><tr><td>[0.0.1.]</td><td>[0.0.1.]</td><td>[0.0.1.]</td><td>[0.0.]</td><td>0.0.11 P=0.08</td></tr><tr><td>Answer:right</td><td>Answer:right</td><td>[0.0.0.]</td><td>[0.0.]</td><td>[0[0 P=0.01</td></tr><tr><td>World:</td><td></td><td>[0.0.0.]</td><td>[0.0.]</td><td></td></tr><tr><td></td><td>World:</td><td>Answer:right</td><td>Answer:left</td><td></td></tr><tr><td>[1.0.0.0.]</td><td>[0.0.]</td><td></td><td> World:</td><td>GPT-3 (175B)</td></tr><tr><td>Answer:left</td><td>[1.0.]</td><td>World:</td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>[1.0.0.0.]</td><td>left P=0.20</td></tr><tr><td>...13 more...</td><td>[0.0.] Answer:left</td><td>[0.1.0.0.] Answer:left</td><td>[0.0.0.0.] Answer:</td><td>right P=0.11</td></tr></table>
|
| 65 |
+
|
| 66 |
+
GROUNDING DISTANCE For analysis purposes (§3.3), we wish to assess how far off models are in cases where they are wrong. For this, we need to quantify the distance between the model’s predicted answer and the ground truth answer. For example, in the colour domain, the distance between two points can be computed as the Euclidean distance between two RGB codes. For every answer generated by the model (e.g., the word pink in the colour domain), if the answer is an acceptable grounded term that exists in the world, we can compute its distance to the true grounding (e.g., the colour red). However, if the generated answer was an unrelated word (e.g., the word cat) that does not exist in the same domain, no distance can be computed in the world. Therefore, we calculate a distance metric as the Euclidean distance between two points in space when the generated answer falls in the domain. When the generated answer does not fall in the domain, we set the distance to a number significantly higher than the largest distance between two in-domain concepts. We provide equations and details on calculation of this metric in Appendix C.
|
| 67 |
+
|
| 68 |
+
Baselines Given that the language models are free to generate any word that exists in their vocabulary as a potential answer, we choose two random baselines over vocabulary words against which to compare model performance. We use R-IV (i.e., random in-vocabulary) to denote a baseline that randomly selects from among all words in the model’s vocabulary. We use R-ID (i.e., random indomain) to denote a baseline that randomly selects from amongst only the in-domain words (e.g., from colour terms); this is 6, 8 and 367 words respectively for the spatial, cardinal and colour categories. Note that the generative LMs do not have such a domain restriction over words, as they are free to choose any token from the full vocabulary (like R-IV).
|
| 69 |
+
|
| 70 |
+
# 3 RESULTS
|
| 71 |
+
|
| 72 |
+
# 3.1 GENERALISATION TO UNSEEN WORLDS
|
| 73 |
+
|
| 74 |
+
Our first investigation looks into how well models generalise known concepts to unseen worlds. For example, if a model has seen a few examples of a concept (such as left) depicted in some grid worlds, can it correctly identify an instance of tleft in a different grid world (e.g., one with a different size or orientation)? Note that we can only conduct this type of evaluation in the spatial and cardinal domains, since, for the colour domain, there is only ever one world, with one grounding for each concept (e.g., the colour red has exactly one grounding to a 3-digit RGB code in a 3-D RGB space).
|
| 75 |
+
|
| 76 |
+
Data We create prompts that include 20 examples of grounded concepts in a set of grid worlds. For each domain (e.g., cardinal directions that contain 8 concepts, and spatial terms that contain 3 pairs of 2 concepts), we include a (roughly) equal sample of concepts among these 20 examples. Then, we append a held-out grid world to the end of the prompt and evaluate whether or not the models generate the correct concept label for these unseen worlds. Figure 3 shows example prompts
|
| 77 |
+
|
| 78 |
+
Top-1 Accuracy
|
| 79 |
+
|
| 80 |
+
<table><tr><td rowspan="2"></td><td>Spatial</td><td>Cardinal</td></tr><tr><td>Orig. Rot. Rand.</td><td>Orig. Rot. Rand.</td></tr><tr><td>R-IV R-ID 0.16</td><td>0.00 0.00 0.00</td><td>0.00 0.00 0.00</td></tr><tr><td>124 M 0.11</td><td>0.16 0.16</td><td>0.13 0.13 0.13</td></tr><tr><td>355 M 0.12</td><td>0.10 0.10</td><td>0.13 0.12 0.11</td></tr><tr><td>774 M 0.08</td><td>0.12 0.10</td><td>0.11 0.14 0.10</td></tr><tr><td>1.7 B 0.10</td><td>0.09 0.10</td><td>0.11 0.12 0.11</td></tr><tr><td></td><td>0.11 0.11</td><td>0.10 0.11 0.10</td></tr><tr><td>175 B 0.45</td><td>0.44 0.16</td><td>0.43 0.46 0.18</td></tr></table>
|
| 81 |
+
|
| 82 |
+
Top-3 Accuracy
|
| 83 |
+
|
| 84 |
+
<table><tr><td rowspan=1 colspan=1>Spatial Cardinal</td></tr><tr><td rowspan=1 colspan=1>Orig.Rot.Rand. Orig.Rot.Rand.</td></tr><tr><td rowspan=1 colspan=1>0.000.000.00 0.000.000.00</td></tr><tr><td rowspan=1 colspan=1>0.160.160.16 0.130.130.13</td></tr><tr><td rowspan=1 colspan=1>0.230.210.10 0.250.240.10</td></tr><tr><td rowspan=1 colspan=1>0.240.250.15 0.230.140.12</td></tr><tr><td rowspan=1 colspan=1>0.120.190.14 0.180.170.11</td></tr><tr><td rowspan=1 colspan=1>0.110.180.15 0.120.120.13</td></tr><tr><td rowspan=1 colspan=1>0.760.750.19 0.880.760.21</td></tr></table>
|
| 85 |
+
|
| 86 |
+
Table 1: Table shows evaluations for generalisation to unseen worlds. Rows show model sizes for GPT-2 models (124M to 1.5B) and the 175B GPT-3 model. Columns show metrics for the original, rotated and random worlds for each of the concept categories. We report both Top-1 and Top-3 accuracy in the first and second columns of each rotated world.
|
| 87 |
+
|
| 88 |
+
given to the model and example generations from three different models. We report results averaged over all generations in Table 1. In general, we see the desired trend in which model performance on the original and rotated worlds is well above that on the random world. We do not see consistent or significant performance degradation when moving from the original to the rotated world, suggesting performance is not due to simple memorisation. Comparing across models, we see that the smaller models struggle to even learn concepts that were taught to them in a few-shot manner. For example, for the spatial category, the performance of the smallest model is below that of a baseline which guesses randomly among in-domain words, suggesting the model even fails to learn the general domain of the task (discussed more in Section 3.3). In contrast, the largest model (GPT-3) has a $4 5 \%$ Top-1 accuracy and a $7 6 \%$ Top-3 accuracy for the spatial category.
|
| 89 |
+
|
| 90 |
+
# 3.2 GENERALIZATION TO UNSEEN CONCEPTS
|
| 91 |
+
|
| 92 |
+
Our primary interest here is in the model’s ability to map its ungrounded conceptual structure to a grounded world. Specifically, we want to see that the model is able to ground an entire conceptual domain when only taught how to ground a small subset of the points in that domain. To test this, we show models example concepts within a sub-space of the domain (e.g., north, east), while holding out other concepts (e.g., south, west). We then test them on instances of held-out concepts. Figure 6 depicts this setup in the colour domain: we train the model using primarily shades of red, but test on shades of blue.
|
| 93 |
+
|
| 94 |
+

|
| 95 |
+
Figure 4: Figure shows example worlds and groundings for the colour domain, where the prompt contains colours within a sub-space: i.e., training on primary and secondary colors plus shades of red, but then testing on navy blue. The left panel shows the full set of training examples the model sees. The right shows example outputs from the smallest and largest models, with the top three most probable words from each model along with the probability of that word.
|
| 96 |
+
|
| 97 |
+
Table 2: Table shows evaluations for generalisation to unseen concepts for the sub-space split of training/test data. Rows show model sizes for GPT-2 models (124M to 1.5B) and the 175B GPT-3 model. Columns show metrics for the original, rotated and random worlds for each of the concept categories. We report both Top-1 and Top-3 accuracy. R-IV refers to a random baseline that randomly selects a word out of the total vocabulary, R-ID refers to a baseline that randomly selects a word out of the set of words in the concept category.
|
| 98 |
+
|
| 99 |
+
<table><tr><td rowspan="3"></td><td></td><td colspan="3">Spatial</td><td colspan="3">Cardinal</td><td colspan="3">Colours</td></tr><tr><td></td><td>Original</td><td>Rotated</td><td>Random</td><td>Original</td><td>Rotated</td><td>Random</td><td>Original</td><td>Rotated</td><td>Random</td></tr><tr><td>R-IV R-ID</td><td>0.00 0.16</td><td>0.00 0.16</td><td>0.00 0.16</td><td>0.00 0.13</td><td>0.00 0.13</td><td>0.00 0.13</td><td>0.00 0.00</td><td>0.00 0.00</td><td>0.00 0.00</td></tr><tr><td rowspan="6">Top-1 Accuracy</td><td>124 M 355 M</td><td>0.10 0.10</td><td>0.11</td><td>0.04</td><td>0.11</td><td>0.10</td><td>0.05</td><td>0.08</td><td>0.09</td><td>0.03</td></tr><tr><td>774 M</td><td></td><td>0.10</td><td>0.04</td><td>0.10</td><td>0.11</td><td>0.06</td><td>0.06</td><td>0.07</td><td>0.04</td></tr><tr><td></td><td>0.09</td><td>0.11</td><td>0.03</td><td>0.13</td><td>0.12</td><td>0.08</td><td>0.11</td><td>0.09</td><td>0.01</td></tr><tr><td>1.5 B</td><td>0.14</td><td>0.14</td><td>0.12</td><td>0.13</td><td>0.14</td><td>0.10</td><td>0.10</td><td>0.09</td><td>0.06</td></tr><tr><td>175 B</td><td>0.28</td><td>0.27</td><td>0.13</td><td>0.30</td><td>0.29</td><td>0.08</td><td>0.23</td><td>0.21</td><td>0.11</td></tr><tr><td>R-IV</td><td>0.00</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="7">Top-3 Accuracy</td><td>R-ID</td><td></td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td></tr><tr><td></td><td>0.16</td><td>0.16</td><td>0.16</td><td>0.13</td><td>0.13</td><td>0.13</td><td>0.00</td><td>0.00</td><td>0.00</td></tr><tr><td>124M</td><td>0.13</td><td>0.12</td><td>0.07</td><td>0.09</td><td>0.09</td><td>0.08</td><td>0.06</td><td>0.05</td><td>0.04</td></tr><tr><td>355 M</td><td>0.24</td><td>0.17</td><td>0.15</td><td>0.19</td><td>0.17</td><td>0.10</td><td>0.14</td><td>0.11</td><td>0.12</td></tr><tr><td>774 M</td><td>0.19</td><td>0.24</td><td>0.12</td><td>0.17</td><td>0.15</td><td>0.11</td><td>0.15</td><td>0.16</td><td>0.14</td></tr><tr><td>1.5 B</td><td>0.32</td><td>0.29</td><td>0.20</td><td>0.21</td><td>0.20</td><td>0.14</td><td>0.19</td><td>0.18</td><td>0.16</td></tr><tr><td>175 B</td><td>0.64</td><td>0.65</td><td>0.21</td><td>0.60</td><td>0.61</td><td>0.09</td><td>0.34</td><td>0.36</td><td>0.13</td></tr></table>
|
| 100 |
+
|
| 101 |
+
Data To create sub-spaces for the colour domain, we create prompts that contain 3 primary, 3 secondary colours, and 57 other colours within a sub-space, determined in the following way. For a certain colour (e.g., red) we consider a sub-space in the world to be a space of colours that lies within a Euclidean distance of 150 from that colour. We create 6 such sub-spaces, centered around each of the primary and secondary colours, and report generalisation results averaged over the 6 sub-spaces. Figure 4 shows the sample of colours within a sub-space centered around the colour red, that serve as training samples within the prompt. For the cardinal directions, we show models examples of concepts in one sub-space of the world (e.g., north, east, northeast) and then test them on concepts in an entirely different sub-space (e.g., south, west, southwest). The training split therefore contains worlds annotated with one sub-space, and we test on the remaining held-out concepts. We do this for all sub-spaces and average over them.
|
| 102 |
+
|
| 103 |
+
We report results on all concept categories in Table 2. As before, we see that models do not appear to be exploiting simple memorisation (evidenced by similar performance in original vs. rotated worlds) and that only the largest models appear capable of getting reasonable performance on the task. That said, the largest GPT-3 model achieves impressive results given the difficulty of the task. For example, it achieves over $40 \%$ Top-1 accuracy in the color domain, which requires generating a label like violet despite having never seen such a label during training (Figure 4).
|
| 104 |
+
|
| 105 |
+
# 3.3 ERROR ANALYSIS
|
| 106 |
+
|
| 107 |
+
Given the results above, we investigate “how wrong” models are when they fail to produce the expected ground-truth label. One clear trend of the large model is the ability to generate “on topic” (i.e., in-domain) responses, regardless of whether or not those responses are correct. For example, if the expected response to an input is “left”, a model which produces right is wrong in a very different way than a model that produces nonsensical outputs such as “[0[0” or function words such as “the” (see Figure 3). We see that the largest 175B parameter model almost always produces in-domain answers. We evaluate this by checking whether the generation lies in the set of related words for that category (e.g., all colours, spatial, or cardinal words, respectively). We see that the smaller models fail to do this. That is, their generations tend to be unrelated words that might have had high prominence (e.g., function words). On evaluating accuracy of generations being “in-domain”, we see that the smallest model has only a $5 3 \%$ accuracy while the largest has a $9 8 \%$ accuracy of generating in-domain answers.
|
| 108 |
+
|
| 109 |
+
Second, we evaluate grounded distance (§2.5) to measure the degree of correctness of responses. In the colour domain, the colours dark red and wine are close enough in space that they might be intuitive alternate answers for one another. However, our top-1 and top-3 metrics only assess string matches and do not account for this. Thus, we look at the distance between the colour denoted by the predicted label (when it exists, i.e., when the model generated a legitimate colour name) and the colour the model was asked to label. The lower this distance is, the “less wrong” the model’s prediction is.
|
| 110 |
+
|
| 111 |
+
Table 3 reports evaluations measured by grounding distance for the colour domain. For every test instance, we compute the distance between the model predicted grounding and the true grounding as defined in Equation C.3. We then average over all computed distances to report one number that tells us how close, on average, model predictions are to the true grounding in the world. We show example visualisations of colours in RGB space that lie within a certain distance threshold of each other. We see, for the largest model, the distances between model-predicted groundings from the true grounding are significantly lower than random. Such a result suggests that the model’s errors are often justifiable and the scores given by our string-matching metrics might be an underestimate of the model’s true performance.
|
| 112 |
+
|
| 113 |
+
Table 3: Table shows average distance (lower is better) between model-predicted groundings and true groundings in the world, averaged over all instances in the test set. We see that the largest model has an average distance of predictions significantly lower than random
|
| 114 |
+
|
| 115 |
+
<table><tr><td></td><td>124M</td><td>355M</td><td>774M</td><td>1.5B</td><td>175B</td></tr><tr><td>C</td><td>328.3</td><td>309.5</td><td>209.6</td><td>190.7</td><td>96.3</td></tr><tr><td>R-IV</td><td>334.9</td><td>334.9</td><td>334.9</td><td>334.9</td><td>334.9</td></tr><tr><td>R-ID</td><td>174.9</td><td>174.9</td><td>174.9</td><td>174.9</td><td>174.9</td></tr></table>
|
| 116 |
+
|
| 117 |
+
Table 4: Table shows example model predictions (from the GPT-3 model) and distances from the true groundings in RGB space. The first column shows the true concept while the second column shows model predictions and their distances from the true concept.
|
| 118 |
+
|
| 119 |
+
<table><tr><td>True G</td><td>Predicted G&Distance</td></tr><tr><td>dark red</td><td>wine (76.5),light crimson (208.1)</td></tr><tr><td>light green</td><td>dark slate gray (144.7) beige (l26.6),light sea green (129.7) cerulean (185.7), violet (262.6)</td></tr></table>
|
| 120 |
+
|
| 121 |
+
# 4 DISCUSSION
|
| 122 |
+
|
| 123 |
+
Our empirical results suggest that very large LMs (specifically, GPT-3), even when trained only on text, learn a conceptual space that can, at least in some settings, be “grounded” using only a small number of training examples. The fact that these models succeed even in isomorphic rotated worlds suggests that these models are not succeeding via naive memorisation. Rather, this suggests that they may be exploiting something about the conceptual structure of the space learned from text in order to map onto a new space that was not explicitly encountered during training.
|
| 124 |
+
|
| 125 |
+
A major limitation of our approach is that there are some grounded concepts (e.g., visual and sensory inputs) that cannot be easily encoded in text form. By construction, the LMs that we use are restricted to text-only inputs, thus our focus is on domains (e.g., colours and directions) that have a well-defined textual representation. This is only a small set of all the potential grounded concepts we would wish to teach LMs. Although many forms of data can be coerced into text format (e.g., we represent color using discrete digits to represent RGB space), complex concepts may loose fundamental aspects of their meaning when represented in this way. For example, for color, a coarse-grained notion of numeric proximity, derivable from text (Wallace et al., 2019; Naik et al., 2019), may be sufficient to differentiate the concepts we explore, but for more complex visual inputs (e.g., the output of a CNN image encoder), a text-based numeric representation is unlikely to capture the necessary degree of nuance. Future work would need to consider ways of adapting GPT-3-like models to accept non-textual inputs while still exploiting the text-based conceptual structure.
|
| 126 |
+
|
| 127 |
+
If such limitations were addressed, our results are suggestive of a potentially promising way in which text-only training could support general purpose, grounded models of meaning. Specifically, our results imply that the conceptual space a model learns from text might be nearly isomorphic to what it would learn from interacting in a grounded world, and that models can be taught to map between those conceptual spaces without requiring explicit grounding for every concept. This is exciting, as domain-general text corpora are readily available, while domain general multimodal corpora–e.g., containing sufficient information on abstract concepts such as emotions (happy) or time (used to)–might be difficult or impossible to collect. If models like GPT-3 could be adapted to receive non-text prompts (as discussed above), our results suggest that the rich conceptual structure such models learn from text could be bootstrapped into powerful grounded models of language.
|
| 128 |
+
|
| 129 |
+
# 5 RELATED WORK
|
| 130 |
+
|
| 131 |
+
There is a significant amount of work that focuses on understanding how LMs represent and reason about concepts, as well as work that directly attempts to build models that take text inputs and ground them to elements in the world. We situate our work within these two bodies of literature: one that investigates how LMs understand linguistic phenomena and word meaning, and another, that attempts to situate language in models of the world. We describe each body of work below.
|
| 132 |
+
|
| 133 |
+
Meaning and Understanding in LMs With the advent of large LMs of increasing orders of magnitude, there has been speculation on the capabilities of such models, and whether they truly understand the meaning of the words they are learning representations for. Several works that attempt to probe linguistic phenomena in LMs, show that the representations learned by such models encode syntactic dependencies and coreference information (Tenney et al., 2019) and word-sense information (Chen et al., 2020). Work that investigates the ability of models to form word associations (Hwang et al., 2020), finds that large LMs can indeed perform such a task; suggesting that pretrained LMs not only recognize that entities are related, but can differentiate how they are related. Especially relevant to our work is recent work that investigates alignment of language models to colours (Abdou et al., 2021) or state changes (Li et al., 2021). Our work is complementary to this prior work, and we specifically ask whether the text space can be reliably mapped onto the grounded space.
|
| 134 |
+
|
| 135 |
+
Natural Language Grounding There is an increasing amount of work, usually at the intersection of NLP and fields like vision and reinforcement learning, that aims to use natural language to instruct agents about aspects of the world. In the case of vision, this could be to learn correspondences between language descriptions and pixels in an image (Eichenberg et al., 2021; Tsimpoukelli et al., 2021), or in the case of RL, to build agents that understand natural language instructions in order to take actions in a world that follow the instruction—for example to navigate to a goal (Artzi & Zettlemoyer, 2013; Patel et al.), or to solve tasks in different languages (Ku et al., 2020). Most of these tasks focus on training LMs from scratch, however usually with inputs that contain both textual information as well as grounded world information. Our work is different in that we attempt to take an LM that was previously trained only on text, and attempt to teach it a concept in the world without re-training it. With only a few samples of what the concept grounds to, we investigate how well large LMs can use the structure of language and associations between word forms in order to generalise to grounded concepts.
|
| 136 |
+
|
| 137 |
+
# 6 CONCLUSION
|
| 138 |
+
|
| 139 |
+
This work investigates the extent to which large language models, trained only on text can be taught to map previously learned word forms onto conceptual worlds. We investigate several generative language models in colour and direction domains, represented as discrete grid worlds given to the model as text input. With only a few examples of such grounded instances, although smaller models struggle to generalise from text to grounded concepts, we see that the largest model does indeed learn the space of concepts that we test it on. We analyse where models fail and see that the smallest models often produce random, unrelated outputs, but the errors made by the largest model are quite intuitive, for example, predicting colours very close in space to the true grounding. We discuss the limitations of focusing on text-only inputs to teach models grounded concepts, as well as the implications of such work for allowing large language models to be mapped, in a data-efficient way, to the grounded world.
|
| 140 |
+
|
| 141 |
+
# REFERENCES
|
| 142 |
+
|
| 143 |
+
Mostafa Abdou, Artur Kulmizev, Daniel Hershcovich, Stella Frank, Ellie Pavlick, and Anders Søgaard. Can language models encode perceptual structure without grounding? a case study in color, 2021.
|
| 144 |
+
|
| 145 |
+
Yoav Artzi and Luke Zettlemoyer. Weakly supervised learning of semantic parsers for mapping instructions to actions. Transactions of the Association for Computational Linguistics, 1:49–62, 2013. doi: 10.1162/tacl a 00209. URL https://aclanthology.org/Q13-1005.
|
| 146 |
+
|
| 147 |
+
Emily M. Bender and Alexander Koller. Climbing towards NLU: On meaning, form, and understanding in the age of data. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 5185–5198, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.463. URL https://www.aclweb.org/ anthology/2020.acl-main.463.
|
| 148 |
+
|
| 149 |
+
Yonatan Bisk, Ari Holtzman, Jesse Thomason, Jacob Andreas, Yoshua Bengio, Joyce Chai, Mirella Lapata, Angeliki Lazaridou, Jonathan May, Aleksandr Nisnevich, Nicolas Pinto, and Joseph Turian. Experience grounds language. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 8718–8735, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.703. URL https://aclanthology.org/2020.emnlp-main.703.
|
| 150 |
+
|
| 151 |
+
Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
|
| 152 |
+
|
| 153 |
+
Catherine Chen, Kevin Lin, and Dan Klein. Constructing taxonomies from pretrained language models. arXiv preprint arXiv:2010.12813, 2020.
|
| 154 |
+
|
| 155 |
+
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.
|
| 156 |
+
|
| 157 |
+
Constantin Eichenberg, Sidney Black, Samuel Weinbach, Letitia Parcalabescu, and Anette Frank. Magma–multimodal augmentation of generative models through adapter-based finetuning. arXiv preprint arXiv:2112.05253, 2021.
|
| 158 |
+
|
| 159 |
+
Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. arXiv preprint arXiv:1904.09751, 2019.
|
| 160 |
+
|
| 161 |
+
Jena D Hwang, Chandra Bhagavatula, Ronan Le Bras, Jeff Da, Keisuke Sakaguchi, Antoine Bosselut, and Yejin Choi. Comet-atomic 2020: On symbolic and neural commonsense knowledge graphs. arXiv preprint arXiv:2010.05953, 2020.
|
| 162 |
+
|
| 163 |
+
Alexander Ku, Peter Anderson, Roma Patel, Eugene Ie, and Jason Baldridge. Room-Across-Room: Multilingual vision-and-language navigation with dense spatiotemporal grounding. In Conference on Empirical Methods for Natural Language Processing (EMNLP), 2020.
|
| 164 |
+
|
| 165 |
+
Belinda Z. Li, Maxwell Nye, and Jacob Andreas. Implicit representations of meaning in neural 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), pp. 1813–1827, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.143. URL https://aclanthology.org/ 2021.acl-long.143.
|
| 166 |
+
|
| 167 |
+
William Merrill, Yoav Goldberg, Roy Schwartz, and Noah A Smith. Provable limitations of acquiring meaning from ungrounded form: What will future language models understand? arXiv preprint arXiv:2104.10809, 2021.
|
| 168 |
+
|
| 169 |
+
Aakanksha Naik, Abhilasha Ravichander, Carolyn Rose, and Eduard Hovy. Exploring numeracy in word embeddings. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 3374–3380, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1329. URL https://www.aclweb.org/anthology/ P19-1329.
|
| 170 |
+
|
| 171 |
+
Roma Patel, Stefanie Tellex, and Ellie Pavlick. Learning to ground language to temporal logical form.
|
| 172 |
+
|
| 173 |
+
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
|
| 174 |
+
|
| 175 |
+
Laria Reynolds and Kyle McDonell. Prompt programming for large language models: Beyond the few-shot paradigm. In Extended Abstracts of the 2021 CHI Conference on Human Factors in Computing Systems, pp. 1–7, 2021.
|
| 176 |
+
|
| 177 |
+
Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. arXiv preprint arXiv:1508.07909, 2015.
|
| 178 |
+
|
| 179 |
+
Ian Tenney, Patrick Xia, Berlin Chen, Alex Wang, Adam Poliak, R Thomas McCoy, Najoung Kim, Benjamin Van Durme, Sam Bowman, Dipanjan Das, and Ellie Pavlick. What do you learn from context? probing for sentence structure in contextualized word representations. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum? id=SJzSgnRcKX.
|
| 180 |
+
|
| 181 |
+
Maria Tsimpoukelli, Jacob Menick, Serkan Cabi, SM Eslami, Oriol Vinyals, and Felix Hill. Multimodal few-shot learning with frozen language models. Advances in Neural Information Processing Systems, 34, 2021.
|
| 182 |
+
|
| 183 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. arXiv preprint arXiv:1706.03762, 2017.
|
| 184 |
+
|
| 185 |
+
Eric Wallace, Yizhong Wang, Sujian Li, Sameer Singh, and Matt Gardner. Do NLP models know numbers? probing numeracy in embeddings. 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), pp. 5307–5315, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1534. URL https://www. aclweb.org/anthology/D19-1534.
|
| 186 |
+
|
| 187 |
+
Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, et al. Huggingface’s transformers: ´ State-of-the-art natural language processing. arXiv preprint arXiv:1910.03771, 2019.
|
| 188 |
+
|
| 189 |
+
Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. Hellaswag: Can a machine really finish your sentence? In ACL, 2019.
|
| 190 |
+
|
| 191 |
+
# APPENDIX
|
| 192 |
+
|
| 193 |
+
We provide, as supplementary material, additional information about the data generation, models used, examples of model generations, as well as additional results across all models.
|
| 194 |
+
|
| 195 |
+
# A MODELLING DETAILS
|
| 196 |
+
|
| 197 |
+
We use a GPT-3 model Brown et al. (2020) and four GPT-2 Radford et al. (2019) models from the Hugging Face Transformer Wolf et al. (2019) library. Each of these is a pretrained autoregressive transformer model, trained on the OpenAI WebText corpus, containing around 8 million documents. The top 15 domains by volume in WebText are: Google, Archive, Blogspot, GitHub, NYTimes, Wordpress, Washington Post, Wikia, BBC, The Guardian, eBay, Pastebin, CNN, Yahoo!, and the Huffington Post. Individual model parameters and layers are shown in Table 5. The pretrained models use byte-pair encoding (BPE) tokens Sennrich et al. (2015) to represent frequent symbol sequences in the text, and this tokenisation is performed on all new input prompts to generate text from the model. We report the hyperparameters used by the pretrained model in Table 6.
|
| 198 |
+
|
| 199 |
+
Table 5: Table shows model architecture details for the GPT-3 and four GPT-2 models we use.
|
| 200 |
+
|
| 201 |
+
<table><tr><td>Parameters</td><td>Layers</td></tr><tr><td>124M</td><td>12</td></tr><tr><td>355M</td><td>24</td></tr><tr><td>774M</td><td>36</td></tr><tr><td>1.5B</td><td>48</td></tr><tr><td>175B</td><td>96</td></tr></table>
|
| 202 |
+
|
| 203 |
+
Table 6: Table shows model architecture details for the models we use.
|
| 204 |
+
|
| 205 |
+
<table><tr><td>Hyperparameter</td><td>Selection</td></tr><tr><td>number of samples</td><td>3</td></tr><tr><td>nucleas sampling p</td><td>0.85</td></tr><tr><td>temperature</td><td>1</td></tr><tr><td>max length</td><td>5</td></tr></table>
|
| 206 |
+
|
| 207 |
+
# B DATA GENERATION
|
| 208 |
+
|
| 209 |
+
In this section we describe how we create prompt data for the concept categories we wish to evaluate. We describe what the “worlds” look like for each category, as well as detail on the generation of such worlds and division into train and test splits, for colours in Section B.1 and for both spatial and cardinal concepts in Section B.2.
|
| 210 |
+
|
| 211 |
+
# B.1 COLOUR CONCEPTS
|
| 212 |
+
|
| 213 |
+
We draw from an existing dataset containing RGB codes associated with colour names, for 367 colours. In this concept category, a grounded realisation of a colour in the world, is simply its RGB code i.e., the point that it grounds to in 3-dimensional colour space. Therefore, all grounded examples in prompts follow the format of RGB: (x, y, z) followed by Colour: concept name , where the items in red are replaced with instances of RGB codes and names from the dataset of colours we useAbdou et al. (2021). This gives us a total of 367 samples of RGB codes paired with colour names. We create training and testing splits for different generalisation evaluations in the following way.
|
| 214 |
+
|
| 215 |
+
# B.1.1 GENERALISATION TO UNSEEN CONCEPTS
|
| 216 |
+
|
| 217 |
+
Random Split We create prompts to perform this experiment in two ways. The first, as reported in $\ S 3 . 2$ , creates a “train split” i.e., samples within the prompt, by first selecting the 3 primary and 3 secondary colours to always be in the prompt. We then sample 64 other colours from the set of colours to be part of the train split. The prompt therefore contains 70 samples of the question and answer prefixes followed the RGB codes and colour names. For every sample in the test set, we create a new prompt that appends a question prefix and the RGB code of that sample to the end of the prompt, followed by the answer prefix (with no answer). For each prompt, the model is then required to generate an answer. Figure 6 shows the random sample of colours in the prompt and we report results on these in Appendix Table F.1.
|
| 218 |
+
|
| 219 |
+
Sub-space Split We then perform another experiment to evaluate a models ability to learn concepts within a sub-space, and generalise to a whole new sub-space. Here, the prompt contains 3 primary and 3 secondary colours, as well as 57 other colours that we select in the following way. For each of the 6 primary and secondary colours, we consider a sub-space in the world to be a space of colours that lies within a Euclidean distance of 150 from that colour.1 Since the model has seen the 6 primary and secondary colours, as well as a certain space of the colour world, we wish to evaluate how well the model can generalise to a new sub-space of the world, by using the colour word-form associations. We then report generalisation results averaged over the 6 sub-spaces. Figure 4 shows the sample of colours within a sub-space centered around the colour red, that serve as training samples within the prompt. We report results on these in the main paper in Table 2.
|
| 220 |
+
|
| 221 |
+
# B.2 SPATIAL AND CARDINAL CONCEPTS
|
| 222 |
+
|
| 223 |
+
We consider a “world” to be a 2D matrix filled with 0s and containing exactly one 1, where the position of the 1 (i.e., the determining object) refers to the concept of interest (for e.g., a spatial location like “left” or a cardinal direction like “north”. We create grid worlds filled with 0s and one 1, of row and column ranges from $( 1 , 8 )$ giving us 672 total grid worlds.2 For each grid world, all grounded examples follow the format of World: [1. 0. 0. 0.] followed by Direction: concept name . where the items in red are replaced with instances of different grid worlds and corresponding concepts, based on the location of the 1. We create training and testing splits for different generalisation evaluations in the following way.
|
| 224 |
+
|
| 225 |
+
# B.2.1 GENERALISATION TO UNSEEN WORLDS
|
| 226 |
+
|
| 227 |
+
Our primary investigation here is to assess whether the models can generalise to new worlds that differ in size, or location of the determining object. Each of the 672 worlds we create differs from one another in either aspect i.e., either the size of the world is different, or, when worlds are of the same size, the location of the 1 is in a different position. Therefore, we randomly sample 20 worlds that contain instances of concepts to serve as part of the prompt. The prompt therefore contains a question prefix followed by the grid world on a new line, followed by the answer prefix and the concept name. We ensure that there is a roughly equal distribution of concepts in the train split (e.g., if there are 8 concepts split over 20 samples, we ensure that 2 of each concept exist in the prompt, and then fill the remainder of the prompt by randomly sampling from the concepts). We then create a new prompt for every sample in the test set by appending the world representation and answer prefix to the end. We report results on this in the main paper in Table 1.
|
| 228 |
+
|
| 229 |
+
# B.2.2 GENERALISATION TO UNSEEN CONCEPTS
|
| 230 |
+
|
| 231 |
+
Since we wish to assess a model’s ability to generalise to new concepts, here, we hold out concepts in the test set. Specifically, for every domain contain $n$ concepts (e.g., 8 for cardinal directions), the train split contains an equal distribution of $n - 1$ concepts. We then test on samples that contain the last held-out concept, as well as the seen concepts, to assess how well the model has learned seen concepts, and generalises to unseen concepts. We report results on this in Appendix Table 14, and Figure 7 shows an example split of data that is held-out during test time. We note that this is a random split, unlike the sub-space split that specifically holds out a set of colours based on Euclidean distance.
|
| 232 |
+
|
| 233 |
+
# B.2.3 GENERALISATION TO SUB-SPACES
|
| 234 |
+
|
| 235 |
+
Similar to the colours, for the cardinal directions, we also report in the main paper, results on a subspace generalisation task. Specifically, we show models examples of concepts in one sub-space of the world (e.g., north, east, northeast) and then test them on concepts in a different sub-space (e.g., south, west, southwest). We do this for all sub-spaces and average over them. As seen in Table 11, we see that the largest model can perform this task to some degree, achieving a $6 0 \%$ accuracy.
|
| 236 |
+
|
| 237 |
+
# B.2.4 GENERALISATION TO COMPOSITIONS
|
| 238 |
+
|
| 239 |
+
Here, we specifically test model performance when holding out any instance of compositions of directions. Therefore, the training split contains examples of worlds annotated with the concepts north, south, east, west, and the test split contains examples of compositions of concepts i.e., northeast, southeast, northwest, southwest. We report results in Table 10, and we see that here, even the largest model fails to perform the task. This means that when models have never seen any instance of a composition, they do not perform these compositions themselves, however, as seen in Table
|
| 240 |
+
|
| 241 |
+
10, and earlier results, when the training data contains some examples of compositions, models can indeed generalise to completely new compositions.
|
| 242 |
+
|
| 243 |
+
Table 7: Table shows the grounded concepts we aim to teach language models. The first column shows the category of related concepts that models might have learnt relational meaning for, the second shows the number of such terms within each category, and the third shows example words.
|
| 244 |
+
|
| 245 |
+
<table><tr><td>Grounded Concept</td><td>Size</td><td>Example words</td></tr><tr><td>Cardinal directions</td><td>4</td><td>north,south,east,west</td></tr><tr><td>+ compositions</td><td>4</td><td>northeast, southeast, northwest, southwest</td></tr><tr><td>Spatial directions</td><td>8</td><td>left, right, up, down,top,bottom,above,below</td></tr><tr><td>Colours</td><td>107</td><td>red, blue,yellow, green,violet,aqua, wine,charcoal,brass,cobalt..</td></tr><tr><td>+ antique modifier</td><td>4</td><td>antique brass,antique fuchsia,antique ruby,antique white</td></tr><tr><td>+ baby modifier</td><td>3735</td><td>baby blue,baby blue eyes,babypink</td></tr><tr><td>+bright modifier</td><td></td><td>bright cerulean,bright green,bright lavender, bright maroon</td></tr><tr><td>+ burnt modifier</td><td></td><td>burnt orange,burnt sienna,burnt umber</td></tr><tr><td>+ copper modifier</td><td></td><td>copper crayola,copper penny,copper red,copper rose,pale copper</td></tr><tr><td>+dark modifier</td><td>43</td><td>dark blue,dark brown,dark byzantium,dark cerulean,dark chestnut..</td></tr><tr><td>+ deep modifier</td><td>17</td><td>deep carmine,deep carmine pink,deep carrot orange,deep cerise.</td></tr><tr><td>+electric modifier</td><td>14</td><td>electric blue,electric crimson, electric cyan,electric indigo..</td></tr><tr><td>+ fluorescent modifier</td><td></td><td>fluorescent orange,fluorescent pink,fluorescent yellow</td></tr><tr><td>+ french modifier</td><td>36</td><td>french beige,french blue,french lilac,french lime,french raspberry..</td></tr><tr><td>+ light modifier</td><td>24</td><td>light apricot, light blue,light brown, light carmine pink,light coral..</td></tr><tr><td>+mediummodifier</td><td>21</td><td>medium aquamarine,medium blue,medium carmine..</td></tr><tr><td>+old modifier</td><td>5</td><td>old gold,old lace,old lavender,old mauve,old rose</td></tr><tr><td>+ pale modifier</td><td>20</td><td>pale aqua, pale blue,pale brown, pale carmine,pale cerulean..</td></tr><tr><td>+ pastel modifier</td><td>16</td><td>dark pastel blue,dark pastel green,dark pastel purple,dark pastel red..</td></tr><tr><td>+persian modifier</td><td></td><td>persian blue,persian green, persian indigo,persian orange</td></tr><tr><td>+rich modifier</td><td>97</td><td>rich black,rich brilliant lavender,rich carmine,rich lavender..</td></tr><tr><td>+rose modifier</td><td>12</td><td>copper rose,french rose,old rose,persian rose,rose bonbon</td></tr><tr><td>+royal modifier</td><td>6</td><td>royal azure,royal blue web,royal fuchsia, royal purple, royal yellow</td></tr><tr><td>+vivid modifier</td><td>5</td><td>vivid auburn,vivid burgundy,vivid cerise,vivid tangerine,vivid violet</td></tr></table>
|
| 246 |
+
|
| 247 |
+
# C EVALUATION METRICS
|
| 248 |
+
|
| 249 |
+
In this section we describe our evaluation metrics in detail, with examples of how certain generations might be scored by each metric.
|
| 250 |
+
|
| 251 |
+
# C.1 SUBSTRING MATCH
|
| 252 |
+
|
| 253 |
+
For every test instance, there is exactly one string answer that is correct (for e.g., the words “left” or “northeast” or “electric blue”). However, language models are free to generate any number of tokens given a prompt—i.e., they might generate exactly one token, or up to a 100 tokens for any given prompt. We consider the first 5 tokens generated by the model to be the generated answer— and consider a substring match metric to be one that looks at whether or not the model generated answer lies in the ground truth answer. To make this clearer, we provide examples below, denoting a model-generated answer in blue and the ground-truth answer in green. By the substring metric, electric green for electric blue would give an accuracy of 0, however electric or green would give an accuracy of 1. In practice, we do not see (the large) models generate half-answers (e.g,. simply saying electric). Similarly green for dark green has an accuracy of 1, but dark pink for dark green would have an accuracy of 0.
|
| 254 |
+
|
| 255 |
+

|
| 256 |
+
Figure 5: Figure shows performance curves of models on increasing the number of samples in a prompt. From left to right, we see the 124M, 355M, 774M, 1.5B and 175B parameter models, on increasing the number of samples given to the model to the maximum prompt size. We see that only 5 samples are not enough for models to learn the task, but past a certain threshold (20 samples), models do not have a significant increase in performance on the same test set.
|
| 257 |
+
|
| 258 |
+
# C.2 EXACT MATCH
|
| 259 |
+
|
| 260 |
+
For this metric, the model only gets a perfect accuracy if the model generated answer exactly matches the ground-truth answer (after stripping both for any trailing whitespaces). Therefore saying green for dark green , or electric green for light electric green would have an accuracy of 0.
|
| 261 |
+
|
| 262 |
+
# C.3 GROUNDING DISTANCE
|
| 263 |
+
|
| 264 |
+
Equation C.3 shows our calculation of distances in the world. For a certain concept category $C$ (for example, all colour names existing in the dataset), let $c _ { 1 }$ be the model predicted concept name and $c _ { 2 }$ be the true grounding. The grounding distance is the Euclidean distance between the two points when the predicted concept does exist in the space of concepts in the world, and is set to an arbitrarily high number (here, 500, which is higher than the maximum distance between any two points in space) when the predicted concept is some other word does not fall in the concept category.
|
| 265 |
+
|
| 266 |
+
$$
|
| 267 |
+
\mathbf { d } ( \mathbf { c } _ { 1 } , c _ { 2 } ) = \left\{ \begin{array} { r l r } { \sqrt { ( c _ { 1 x } - c _ { 2 x } ) ^ { 2 } + ( c _ { 1 y } - c _ { 2 y } ) ^ { 2 } + ( c _ { 1 z } - c _ { 2 z } ) ^ { 2 } } } & { \mathrm { f o r } } & { c _ { 1 } \in C } \\ { 5 0 } & { \mathrm { f o r } } & { c _ { 1 } \notin C } \end{array} \right.
|
| 268 |
+
$$
|
| 269 |
+
|
| 270 |
+
# D PROMPT SIZE
|
| 271 |
+
|
| 272 |
+
The size of the input prompt to a model depends on its maximum content length, which is a hyperparameter fixed before training the model to completion. The question-answer pairs that we use to teach models grounded concepts differ in their lengths based on the concept category. For example, since the spatial and cardinal concepts require grid worlds that could be up to 10 rows and columns wide, a prompt for these categories might contain a fewer number of samples. Since the colour groundings are 3-digit RGB codes, a larger number of samples can be given in a prompt. We report accuracy curves of models when given an increasing number of samples in the prompt in Appendix D. We see that past 20 samples for spatial terms, and 60 samples for colours, models have no significant increase in performance. When we report results in Tables ?? and Table 1, we report numbers for a fixed number of samples in a prompt (e.g., 20 vs. 60 respectively) for all models.
|
| 273 |
+
|
| 274 |
+
Interestingly, once we get past a certain number of prompts, there is no significant increase in model performance on the task. This result hints at two things. First, the larger models seem to learn a task, and generalise to new samples, with only a small number of sample when fine-tuned in a few-shot prompting regime. This seems to hold for the smaller models as well i.e., although they do not learn the task well, increasing the number of samples within a prompt does not significantly increase model performance. Second, the significant difference in performance based on model size hints at the fact that the limiting factor for good performance is the number of parameters of a model. More concretely, the generalisation extent of each model seems to max out at some number of input prompts, with a trend of increasing performance on increasing model size. Therefore, a larger model (than the ones we have here) might be required in order to achieve better grounded generalisation.
|
| 275 |
+
|
| 276 |
+
# E MODEL GENERATIONS
|
| 277 |
+
|
| 278 |
+
We show example generations from the model in Table 8.
|
| 279 |
+
|
| 280 |
+
<table><tr><td>Category</td><td>Prompt</td><td>True</td><td>124M</td><td>355M</td><td>774M</td><td>1.5B</td><td>175B</td></tr><tr><td rowspan="4">Cardinal</td><td>World: [0. 0. 0. 0.] [0. 0. 0. 0.]</td><td>southeast</td><td>world</td><td>direction</td><td>the</td><td>south</td><td>southeast</td></tr><tr><td>[0. 0. 0. 1.]</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>World: [0. 0. 1. 0.] [0. 0. 0. 0.]</td><td>north</td><td>the</td><td>direction</td><td>world</td><td>south</td><td>north</td></tr><tr><td>World: [1. 0. 0. 0.]</td><td>left</td><td>the</td><td>world</td><td>an</td><td>left</td><td>left</td></tr><tr><td rowspan="4"></td><td>[0. 0. 0. 0.]</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>[0. 0. 0. 0.]</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>World: [0. 1.]</td><td>right</td><td>and</td><td>world</td><td>to</td><td>world</td><td>right</td></tr><tr><td>[0. 0.] [0.0.]</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="2">Colour</td><td>[0. 0.]</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RGB: (123,0, 43)</td><td>light blue</td><td>color</td><td>the</td><td>rgb</td><td>red</td><td>blue</td></tr><tr><td rowspan="2"></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RGB: (3,43,100)</td><td> magenta</td><td>hex</td><td>red</td><td>color</td><td>green</td><td>red</td></tr></table>
|
| 281 |
+
|
| 282 |
+
Table 8: Table shows example generations from each of the models, cut off for the first five words. The first column shows the concept category while the second column shows the last portion of the prompt given to each model, for which they are required to generate an answer. The last 6 columns show the ground-truth answer, and predicted answers from each of the models respectively.
|
| 283 |
+
|
| 284 |
+
# F PRE-TRAINING DATA
|
| 285 |
+
|
| 286 |
+
# F.1 WHAT HAVE MODELS SEEN IN THEIR TRAINING DATA THAT MIGHT BE RELATED TO GROUNDING?
|
| 287 |
+
|
| 288 |
+
Pre-trained language models have been trained on large text corpora available on the internet—a diverse source of information that covers many domains. There is speculation, that the remarkable generalisation performance of these models stems from having seen instances of the task or related information at some point in their training data. However, this data has not been made public, which makes this a hypothesis that is hard to confirm. In our domain of grounded concepts as well, it is unclear what aspects of similar data the model might have had access to during training, or what inductive biases from certain types of data it might have learnt, that allow it good performance on grounded tasks. We attempt to assess this in the following way. We consider all the concept words in every concept category, and all the world representations, and consider these the prompts for the models. For each word, we wish to assess the distribution of text generated, which should, in some sense, reflect the distribution of text seen during training. For example, or the world representations (i.e., a 2D array), we assess how often the model might use a spatial or cardinal term when simply prompted with an array, thus giving us insights into how often the training data might have contain such an array in close proximity to such a word. Similarly, for the colour domain, we evaluate how often the model predicts a correct colour name when prompted with an RGB code. We see that when models are simply prompted with a world representation, they tend to generate similarlooking world representations, instead of conceptual words (such as “left”) that might be associated with it. When prompted with RGB codes, the GPT-3 model only has a $7 . 3 \%$ accuracy of correctly generating the corresponding colour name in a 5-token sequence after the prompt.
|
| 289 |
+
|
| 290 |
+
<table><tr><td rowspan="3"></td><td rowspan="2"></td><td colspan="3">Cardinal</td><td rowspan="2"></td><td colspan="3">Cardinal</td></tr><tr><td>Original</td><td>Rotated</td><td>Random</td><td>Original</td><td>Rotated</td><td>Random</td></tr><tr><td rowspan="6"></td><td>R R*</td><td>0.00</td><td>0.00 0.13</td><td>0.00</td><td>R R*</td><td>0.00 0.13</td><td>0.00</td><td>0.00</td></tr><tr><td></td><td>0.13</td><td></td><td>0.13</td><td></td><td></td><td>0.13</td><td>0.13</td></tr><tr><td>124 M</td><td>0.03</td><td>0.02</td><td>0.02</td><td>124 M</td><td>0.11</td><td>0.10</td><td>0.05</td></tr><tr><td>355M</td><td>0.03</td><td>0.04</td><td>0.03</td><td>355M</td><td>0.10</td><td>0.11</td><td>0.06</td></tr><tr><td>774 M</td><td>0.04</td><td>0.03</td><td>0.02</td><td>774 M</td><td>0.13</td><td>0.12</td><td>0.08</td></tr><tr><td>1.5 B</td><td>0.07</td><td>0.06</td><td>0.05</td><td>1.5 B</td><td>0.13</td><td>0.14</td><td>0.10</td></tr><tr><td rowspan="7">Top-3</td><td>175 B</td><td>0.12</td><td>0.11</td><td>0.10</td><td>175 B</td><td>0.30</td><td>0.29</td><td>0.08</td></tr><tr><td>R-IV R-ID</td><td>0.00</td><td>0.00</td><td>0.00</td><td>R-IV</td><td>0.00</td><td>0.00</td><td>0.00</td></tr><tr><td></td><td>0.13</td><td>0.13</td><td>0.13</td><td>R-ID</td><td>0.13</td><td>0.13</td><td>0.13</td></tr><tr><td>124 M</td><td>0.03</td><td>0.04</td><td>0.04</td><td>124M</td><td>0.09</td><td>0.09</td><td>0.08</td></tr><tr><td>355M</td><td>0.06</td><td>0.05</td><td>0.04</td><td>355 M</td><td>0.19</td><td>0.17</td><td>0.10</td></tr><tr><td>774 M</td><td>0.05</td><td>0.07</td><td>0.05</td><td>774M</td><td>0.17</td><td>0.15</td><td>0.11</td></tr><tr><td>1.5 B</td><td>0.11</td><td>0.10</td><td>0.07</td><td>1.5 B</td><td>0.21</td><td>0.20</td><td></td></tr><tr><td></td><td>175 B</td><td>0.23</td><td>0.21</td><td>0.17</td><td>175 B</td><td>0.60</td><td>0.61</td><td>0.14 0.09</td></tr></table>
|
| 291 |
+
|
| 292 |
+
Table 9: Table shows evaluations in the cardinal directions domain, where we show models examples of single directions (north, south, east, west) and test them on compositions of directions (northeast, southeast, northwest, southwest) that were never seen before. Rows show model sizes for GPT-2 models (124M to 1.5B) and the 175B GPT-3 model. Columns show metrics for the original, rotated and random worlds for each of the concept categories. We see that all models fail on this task i.e., when they have never seen compositions of terms before, they never predict them at test-time.
|
| 293 |
+
|
| 294 |
+
Table 10: In this table, we show models examples of concepts within a sub-space (north, east, northeast) and test them on concepts in a different sub-space (south, west, southwest) that were never seen before. Rows show model sizes for GPT-2 models (124M to 1.5B) and the 175B GPT-3 model. Columns show metrics for the original, rotated and random worlds for each of the concept categories. We see that the largest model can indeed perform on this task i.e., even on only having seen a sub-space of the world (along with compositions) it can generalise to a new sub-space and compositions.
|
| 295 |
+
|
| 296 |
+
# G EXPERIMENTS WITH MASKED LANGUAGE MODELS
|
| 297 |
+
|
| 298 |
+
The results in the main paper focus on GPT-2 and GPT-3 language models i.e., autoregressive left-toright language models that show impressive capabilities for in-context learning. Here, we provide comparisons to a masked language model, specifically a BERT model (Devlin et al., 2018). For our implementation we use a BERT-base model containing 110 million parameters. Similar to the GPT- $\mathbf { X }$ experiments for in-context learning with prompts, we ”teach” the BERT model the space on concepts in the following way.
|
| 299 |
+
|
| 300 |
+
• BERT zero-shot (no-context) In this setting, for every sample in the test set (e.g., an RGB colour), we create an input prompt that masks the name of the colour, and ask the model to fill in the colour name. The prompt, therefore, would look like RGB: (255, 0, 0) Colour: <mask>. For the same test set, we evaluate the Top-1 and Top-3 accuracy of the model filling in the mask with the correct colour, using the same substring-match metric.
|
| 301 |
+
• BERT zero-shot (in-context) In this setting, we add several samples into the context of the model, and ask the model to fill in the masked token with the colour name, for all samples in the test set. Since the context-width of BERT is smaller than the GPT models, we can only include a smaller number of samples (around 7).
|
| 302 |
+
|
| 303 |
+
Table 11: Table shows evaluations for generalisation to unseen concepts for a random split of training/test data. Rows show model sizes for GPT-2 models (124M to 1.5B) and the 175B GPT-3 model. Columns show metrics for the original, rotated and random worlds for each of the concept categories. We report both Top-1 and Top-3 accuracy. R-IV refers to a random baseline that randomly selects a word out of the total vocabulary, R-ID refers to a baseline that randomly selects a word out of the set of words in the concept category.
|
| 304 |
+
|
| 305 |
+
<table><tr><td rowspan="3"></td><td></td><td colspan="3">Spatial</td><td colspan="3">Cardinal</td><td colspan="3">Colours</td></tr><tr><td></td><td>Original</td><td>Rotated</td><td>Random</td><td>Original</td><td>Rotated</td><td>Random</td><td>Original</td><td>Rotated</td><td>Random</td></tr><tr><td>R-IV R-ID</td><td>0.00 0.16</td><td>0.00 0.16</td><td>0.00 0.16</td><td>0.00 0.13</td><td>0.00 0.13</td><td>0.00 0.13</td><td>0.00 0.00</td><td>0.00 0.00</td><td>0.00 0.00</td></tr><tr><td rowspan="6">Top-1 Accuracy</td><td>124 M 355 M</td><td>0.10 0.10</td><td>0.11</td><td>0.04</td><td>0.10</td><td>0.10</td><td>0.03</td><td>0.09</td><td>0.09</td><td>0.10</td></tr><tr><td>774 M</td><td></td><td>0.11</td><td>0.06</td><td>0.08</td><td>0.07</td><td>0.03</td><td>0.13</td><td>0.12</td><td>0.10</td></tr><tr><td></td><td>0.09</td><td>0.11</td><td>0.03</td><td>0.10</td><td>0.09</td><td>0.01</td><td>0.11</td><td>0.12</td><td>0.09</td></tr><tr><td>1.5 B</td><td>0.14</td><td>0.14</td><td>0.12</td><td>0.13</td><td>0.12</td><td>0.11</td><td>0.16</td><td>0.15</td><td>0.11</td></tr><tr><td>175 B</td><td>0.28</td><td>0.27</td><td>0.13</td><td>0.29</td><td>0.28</td><td>0.15</td><td>0.42</td><td>0.41</td><td>0.14</td></tr><tr><td>R-IV</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="7">Top-3 Accuracy</td><td>R-ID</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td></tr><tr><td></td><td>0.16</td><td>0.16</td><td>0.16</td><td>0.13</td><td>0.13</td><td>0.13</td><td>0.00</td><td>0.00</td><td>0.00</td></tr><tr><td>124M</td><td>0.13</td><td>0.12</td><td>0.07</td><td>0.10</td><td>0.10</td><td>0.08</td><td>0.16</td><td>0.14</td><td>0.10</td></tr><tr><td>355 M</td><td>0.24</td><td>0.17</td><td>0.15</td><td>0.20</td><td>0.18</td><td>0.13</td><td>0.25</td><td>0.24</td><td>0.10</td></tr><tr><td>774 M</td><td>0.19</td><td>0.24</td><td>0.12</td><td>0.21</td><td>0.21</td><td>0.17</td><td>0.23</td><td>0.19</td><td>0.11</td></tr><tr><td>1.5 B</td><td>0.32</td><td>0.29</td><td>0.20</td><td>0.29</td><td>0.27</td><td>0.20</td><td>0.29</td><td>0.32</td><td>0.23</td></tr><tr><td>175 B</td><td>0.64</td><td>0.65</td><td>0.21</td><td>0.63</td><td>0.64</td><td>0.16</td><td>0.63</td><td>0.62</td><td>0.12</td></tr></table>
|
| 306 |
+
|
| 307 |
+
<table><tr><td colspan="2"></td><td colspan="3">Spatial</td><td colspan="3">Cardinal</td><td colspan="3">Colours</td></tr><tr><td rowspan="7">Top-1</td><td></td><td>Original</td><td>Rotated</td><td>Random</td><td>Original</td><td>Rotated</td><td>Random</td><td>Original</td><td>Rotated</td><td>Random</td></tr><tr><td>R-IV R-ID</td><td>0.00 0.16</td><td>0.00 0.16</td><td>0.00 0.16</td><td>0.00 0.13</td><td>0.00 0.13</td><td>0.00 0.13</td><td>0.00 0.00</td><td>0.00 0.00</td><td>0.00 0.00</td></tr><tr><td>124 M</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.01</td><td>0.00</td><td>0.00</td><td>1.00</td><td>0.00</td><td>1.00</td></tr><tr><td>355M</td><td>0.00</td><td>0.01</td><td>0.00</td><td>0.02</td><td>0.02</td><td>0.01</td><td>0.02</td><td>0.03</td><td>0.01</td></tr><tr><td>774 M</td><td>0.00</td><td>0.00</td><td>0.01</td><td>0.00</td><td>0.01</td><td>0.00</td><td>0.02</td><td>0.01</td><td>0.01</td></tr><tr><td>1.5 B</td><td>0.01</td><td>0.00</td><td>0.01</td><td>0.01</td><td>0.03</td><td>0.00</td><td>0.04</td><td>0.02</td><td>0.00</td></tr><tr><td>175 B</td><td>0.12</td><td>0.14</td><td>0.07</td><td>0.14</td><td>0.15</td><td>0.06</td><td>0.19</td><td>0.18</td><td>0.08</td></tr><tr><td rowspan="7">Top-3 Accuracy</td><td>R-IV</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>R-ID</td><td>0.00 0.16</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td></tr><tr><td></td><td></td><td>0.16</td><td>0.16</td><td>0.13</td><td>0.13</td><td>0.13</td><td>0.00</td><td>0.00</td><td>0.00</td></tr><tr><td>124 M</td><td>0.01</td><td>0.00</td><td>0.01</td><td>0.00</td><td>0.02</td><td>0.00</td><td>0.03</td><td>0.03</td><td>0.01</td></tr><tr><td>355 M</td><td>0.04</td><td>0.03</td><td>0.00</td><td>0.04</td><td>0.04</td><td>0.01</td><td>0.07</td><td>0.05</td><td>0.03</td></tr><tr><td>774 M</td><td>0.05</td><td>0.04</td><td>0.04</td><td>0.03</td><td>0.04</td><td>0.00</td><td>0.05</td><td>0.05</td><td>0.02</td></tr><tr><td>1.5 B 175 B</td><td>0.09 0.24</td><td>0.09 0.25</td><td>0.07 0.09</td><td>0.07 0.21</td><td>0.05 0.23</td><td>0.01 0.13</td><td>0.10 0.36</td><td>0.09 0.36</td><td>0.04 0.11</td></tr></table>
|
| 308 |
+
|
| 309 |
+
Table 12: Table shows evaluations for generalisation to unseen concepts using an exact substringmatch evaluation criteria. Rows show model sizes for GPT-2 models (124M to 1.5B) and the 175B GPT-3 model. Columns show metrics for the original, rotated and random worlds for each of the concept categories. We report both Top-1 and Top-3 accuracy. R-IV refers to a random baseline that randomly selects a word out of the total vocabulary, R-ID refers to a baseline that randomly selects a word out of the set of words in the concept category. This table is equivalent to Table F.1, except using an exact-match metric instead of substring-match.
|
| 310 |
+
|
| 311 |
+
This table is equivalent to Table 1, except using an exact-match metric instead of substring-match.
|
| 312 |
+
|
| 313 |
+
• BERT zero-shot (fine-tuned) In this setting, we fine-tune the BERT model on 67 samples (the same number of samples that the GPT models got as input in a prompt) and then report performance when tested on all the colours in the test set.
|
| 314 |
+
|
| 315 |
+
Table 13 shows results of the BERT models when tested on a held-out sub-space of colours and Table 14 shows results when tested on a randomly held-out split of colours.
|
| 316 |
+
|
| 317 |
+
<table><tr><td rowspan="5">R R* 124 M Top-1 355M Accuracy 774M</td><td rowspan="5"></td><td colspan="3">Colour</td></tr><tr><td>Original</td><td>Rotated</td><td>Random</td></tr><tr><td>0.00</td><td>0.00</td><td>0.00</td></tr><tr><td>0.13</td><td>0.13</td><td>0.13</td></tr><tr><td>0.08</td><td>0.09</td><td>0.03</td></tr><tr><td rowspan="7">1.5 B 175 B BERT fine-tuned R-IV R-ID</td><td>0.06 0.11</td><td>0.07</td><td>0.04</td></tr><tr><td>0.10</td><td>0.09</td><td>0.01</td></tr><tr><td>0.23</td><td>0.09 0.21</td><td>0.06 0.11</td></tr><tr><td>BERT zero-shot (no-context) 0.09</td><td>0.08</td><td>0.08</td></tr><tr><td>BERT zero-shot (in-context) 0.08</td><td>0.07</td><td>0.05</td></tr><tr><td>0.10</td><td>0.09</td><td>0.07</td></tr><tr><td>0.00</td><td></td><td></td></tr><tr><td rowspan="7">Top-3 Accuracy 175 B</td><td></td><td>0.13</td><td>0.00 0.13</td><td>0.00 0.13</td></tr><tr><td>124 M</td><td>0.06</td><td>0.05</td><td>0.04</td></tr><tr><td>355M 774 M</td><td>0.14</td><td>0.11</td><td>0.12</td></tr><tr><td>1.5 B</td><td>0.15</td><td>0.16</td><td>0.14</td></tr><tr><td></td><td>0.19</td><td>0.18</td><td>0.16</td></tr><tr><td></td><td>0.34</td><td>0.36</td><td>0.13</td></tr><tr><td>BERT zero-shot (no-context)</td><td>0.10</td><td>0.09</td><td>0.06</td></tr><tr><td>BERT</td><td>zero-shot (in-context)</td><td>0.11</td><td>0.09</td><td>0.07</td></tr><tr><td>BERT fine-tuned</td><td>0.11</td><td></td><td>0.10</td><td>0.09</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 318 |
+
|
| 319 |
+
Table 13: Table shows evaluations for the BERT model when tested in 3 different ways. in the colour domain, where we show models examples of colours in a sub-space (e.g., all colours in a sphere of Euclidean distance 150 from red) and test them on different subspaces i.e., all remaining colours. Rows show model sizes for GPT-2 models (124M to 1.5B) and the 175B GPT-3 model. Columns show metrics for the original, rotated and random worlds for each of the concept categories.
|
| 320 |
+
|
| 321 |
+

|
| 322 |
+
Figure 6: Figure shows example worlds and groundings for the colour domain. The left panel shows example RGB codes and associated colour names, while the right shows example outputs from the smallest and largest models, with the top three most probable words from each model along with the probability of that word. When computing Top-1 vs. Top-3 accuracy, we consider only the first vs. all 3 outputs respectively.
|
| 323 |
+
|
| 324 |
+
Colour
|
| 325 |
+
|
| 326 |
+
<table><tr><td rowspan="3">Top-1 Accuracy</td><td></td><td>Original</td><td>Colour Rotated</td><td>Random</td></tr><tr><td>R R*</td><td>0.00</td><td>0.00</td><td>0.00</td></tr><tr><td>124 M 355 M 774 M</td><td>0.00 0.09 0.13 0.11</td><td>0.00 0.09 0.12 0.12</td><td>0.00 0.10 0.10 0.09</td></tr><tr><td rowspan="8">Top-3 Accuracy</td><td>1.5 B 175 B BERT zero-shot (no-context) BERT zero-shot (in-context) BERT fine-tuned</td><td>0.16 0.42 0.03 0.04</td><td>0.15 0.41 0.05 0.05</td><td>0.11 0.14 0.04 0.05</td></tr><tr><td>R-IV</td><td>0.08 0.00</td><td>0.09 0.00</td><td>0.10 0.00</td></tr><tr><td>R-ID 124 M 355M</td><td>0.00 0.16 0.25</td><td>0.00 0.14 0.24</td><td>0.00 0.10</td></tr><tr><td>774M 1.5 B</td><td>0.23 0.29</td><td>0.19 0.32</td><td>0.10 0.11 0.23</td></tr><tr><td>175 B</td><td>0.63</td><td>0.63</td><td>0.12</td></tr><tr><td>BERT2 zero-shot (no-context)</td><td>0.10</td><td>0.09</td><td>0.09</td></tr><tr><td>BERT zero-shot (in-context)</td><td>0.09</td><td>0.09</td><td>0.07</td></tr><tr><td>BERT fine-tuned</td><td>0.10</td><td>0.11</td><td>0.09</td></tr></table>
|
| 327 |
+
|
| 328 |
+
Table 14: Table shows evaluations for the BERT model when tested in 3 different ways. in the colour domain, where we show models examples of colours from a random split of 70 colours and test them on all remaining colours. Rows show model sizes for GPT-2 models (124M to 1.5B), the 175B GPT-3 model, and the BERT-base model when given samples in 3 different ways. Columns show metrics for the original, rotated and random worlds for each of the concept categories.
|
| 329 |
+
|
| 330 |
+
<table><tr><td rowspan="3"></td><td></td><td colspan="3">Spatial</td><td colspan="3">Cardinal</td><td colspan="3">Colours</td></tr><tr><td></td><td>Original</td><td>Rotated</td><td>Random</td><td>Original</td><td>Rotated</td><td>Random</td><td>Original</td><td>Rotated</td><td>Random</td></tr><tr><td>R-IV R-ID</td><td>0.00 0.16</td><td>0.00 0.16</td><td>0.00 0.16</td><td>0.00 0.13</td><td>0.00 0.13</td><td>0.00 0.13</td><td>0.00 0.00</td><td>0.00 0.00</td><td>0.00 0.00</td></tr><tr><td rowspan="8">Top-1 Accuracy</td><td>124 M</td><td>0.00</td><td>0.01</td><td>0.00</td><td>0.01</td><td>0.00</td><td>0.00</td><td>0.02</td><td>0.01</td><td>1.00</td></tr><tr><td>355 M</td><td>0.02</td><td>0.01</td><td>0.00</td><td>0.03</td><td>0.02</td><td>0.01</td><td>0.03</td><td>0.03</td><td>0.01</td></tr><tr><td>774 M</td><td>0.02</td><td>0.02</td><td>0.01</td><td>0.03</td><td>0.02</td><td>0.00</td><td>0.07</td><td>0.06</td><td>0.03</td></tr><tr><td>1.5 B 175 B</td><td>0.06</td><td>0.07</td><td>0.03</td><td>0.07</td><td>0.07</td><td>0.05</td><td>0.09</td><td>0.09</td><td>0.05</td></tr><tr><td></td><td>0.09</td><td>0.09</td><td>0.04</td><td>0.10</td><td>0.09</td><td>0.05</td><td>0.19</td><td>0.20</td><td>0.08</td></tr><tr><td>R-IV</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td></td><td></td><td></td><td></td></tr><tr><td>R-ID</td><td>0.16</td><td>0.16</td><td>0.16</td><td>0.13</td><td>0.13</td><td>0.00 0.13</td><td>0.00 0.00</td><td>0.00 0.00</td><td>0.00 0.00</td></tr><tr><td>124M</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="7">Top-3 Accuracy</td><td></td><td>0.01</td><td>0.01</td><td>0.00</td><td>0.02</td><td>0.03</td><td>0.01</td><td>0.05</td><td>0.05</td><td>0.02</td></tr><tr><td>355 M</td><td>0.04</td><td>0.04</td><td>0.02</td><td>0.03</td><td>0.04</td><td>0.02</td><td>0.06</td><td>0.05</td><td>0.04</td></tr><tr><td>774 M</td><td>0.04</td><td>0.05</td><td>0.04</td><td>0.03</td><td>0.04</td><td>0.00</td><td>0.10</td><td>0.09</td><td>0.03</td></tr><tr><td>1.5 B</td><td>0.09</td><td>0.09</td><td>0.04</td><td>0.09</td><td>0.10</td><td>0.05</td><td>0.12</td><td>0.11</td><td></td></tr><tr><td>175 B</td><td>0.30</td><td>0.31</td><td>0.10</td><td>0.35</td><td>0.32</td><td></td><td></td><td></td><td>0.06</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td>0.13</td><td>0.26</td><td>0.25</td><td>0.10</td></tr></table>
|
| 331 |
+
|
| 332 |
+
Table 15: Table shows evaluations for generalisation to unseen concepts using an exact substringmatch evaluation criteria. Rows show model sizes for GPT-2 models (124M to 1.5B) and the 175B GPT-3 model. Columns show metrics for the original, rotated and random worlds for each of the concept categories. We report both Top-1 and Top-3 accuracy. R-IV refers to a random baseline that randomly selects a word out of the total vocabulary, R-ID refers to a baseline that randomly selects a word out of the set of words in the concept category. This table is equivalent to Table 2, except using an exact-match metric instead of substring-match.
|
| 333 |
+
|
| 334 |
+
Top-1 Accuracy
|
| 335 |
+
Top-3 Accuracy
|
| 336 |
+
|
| 337 |
+
<table><tr><td></td><td colspan="3">Spatial</td><td colspan="3">Cardinal</td><td colspan="3">Spatial</td><td colspan="3">Cardinal</td></tr><tr><td></td><td>Orig.</td><td>Rot.1</td><td>Rand.</td><td>Orig.</td><td>Rot.</td><td>Rand.</td><td>Orig.</td><td>Rot.</td><td>Rand.</td><td>Orig.</td><td>Rot.1</td><td>Rand.</td></tr><tr><td>R-IV</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td><td>0.00</td></tr><tr><td>R-ID</td><td>0.16</td><td>0.16</td><td>0.16</td><td>0.13</td><td>0.13</td><td>0.13</td><td>0.16</td><td>0.16</td><td>0.16</td><td>0.13</td><td>0.13</td><td>0.13</td></tr><tr><td>124 M</td><td>0.02</td><td>0.02</td><td>0.02</td><td>0.03</td><td>0.03</td><td>0.02</td><td>0.03</td><td>0.02</td><td>0.01</td><td>0.02</td><td>0.02</td><td>0.01</td></tr><tr><td>355 M</td><td>0.03</td><td>0.02</td><td>0.03</td><td>0.03</td><td>0.03</td><td>0.02</td><td>0.04</td><td>0.05</td><td>0.04</td><td>0.04</td><td>0.03</td><td>0.03</td></tr><tr><td>774 M</td><td>0.07</td><td>0.05</td><td>0.06</td><td>0.06</td><td>0.07</td><td>0.04</td><td>0.09</td><td>0.07</td><td>0.05</td><td>0.08</td><td>0.08</td><td>0.04</td></tr><tr><td>1.5 B</td><td>0.10</td><td>0.11</td><td>0.11</td><td>0.07</td><td>0.08</td><td>0.06</td><td>0.08</td><td>0.07</td><td>0.07</td><td>0.09</td><td>0.08</td><td>0.08</td></tr><tr><td>175 B</td><td>0.39</td><td>0.39</td><td>0.13</td><td>0.38</td><td>0.39</td><td>0.14</td><td>0.49</td><td>0.50</td><td>0.15</td><td>0.58</td><td>0.59</td><td>0.18</td></tr></table>
|
| 338 |
+
|
| 339 |
+
Table 16: Table shows evaluations for generalisation to unseen worlds. Rows show model sizes for GPT-2 models (124M to 1.5B) and the 175B GPT-3 model. Columns show metrics for the original, rotated and random worlds for each of the concept categories. We report both Top-1 and Top-3 accuracy in the first and second columns of each rotated world. This table is equivalent to Table 1, except using an exact-match metric instead of substring-match.
|
md/dev/lYNSvp51a7/lYNSvp51a7.md
ADDED
|
@@ -0,0 +1,412 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Lift Yourself Up: Retrieval-augmented Text Generation with Self-Memory
|
| 2 |
+
|
| 3 |
+
Xin Cheng1 Di Luo2 Xiuying Chen3 Lemao Liu4 Dongyan Zhao1 Rui Yan2
|
| 4 |
+
|
| 5 |
+
1 Peking University 2 Remin University of China 3 KAUST 4 Tencent AI Lab chengxin1998@stu.pku.edu.cn
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
With direct access to human-written reference as memory, retrieval-augmented generation has achieved much progress in a wide range of text generation tasks. Since better memory would typically prompt better generation (we define this as primal problem). The traditional approach for memory retrieval involves selecting memory that exhibits the highest similarity to the input. However, this method is constrained by the quality of the fixed corpus from which memory is retrieved. In this paper, by exploring the duality of the primal problem: better generation also prompts better memory, we propose a novel framework, Selfmem, which addresses this limitation by iteratively employing a retrieval-augmented generator to create an unbounded memory pool and using a memory selector to choose one output as memory for the subsequent generation round. This enables the model to leverage its own output, referred to as self-memory, for improved generation. We evaluate the effectiveness of Selfmem on three distinct text generation tasks: neural machine translation, abstractive text summarization, and dialogue generation, under two generation paradigms: fine-tuned small model and few-shot LLM. Our approach achieves state-of-the-art results in four directions in JRC-Acquis translation dataset, 50.3 ROUGE-1 in XSum, and 62.9 ROUGE-1 in BigPatent, demonstrating the potential of self-memory in enhancing retrieval-augmented generation models. Furthermore, we conduct thorough analyses of each component in the Selfmem framework to identify current system bottlenecks and provide insights for future research1.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
In recent years, retrieval-augmented text generation has attracted growing interest across various fields, including neural machine translation[28, 17, 2], dialogue response generation[81, 6, 46], and language modeling[36, 77, 19]. This innovative generation paradigm initially equips a fine-tuned small model or a large language model (LLM) with access to an external database (typically the training corpus) using information retrieval techniques. Subsequently, the generation process is conducted based on both the input text and the retrieved memory.
|
| 14 |
+
|
| 15 |
+
In this paradigm, the guiding principle for memory retrieval is to find the memory that exhibits the highest similarity to the current input [36, 96, 49]. This aligns with the human intuition that a more similar demonstration sample typically offers more hints. As demonstrated in Figure 1, for a retrieval-augmented translation model, the memory similarity alone exhibits a strong correlation with the final translation quality, regardless of other factors that may influence translation quality (e.g., polysemy, morphology, and coreference). We define this as the primal problem: better memory prompts better generation. Consequently, numerous studies have focused on how to retrieve better memory, ranging from sparse retrieval to dense retrieval [10, 63], from a fixed retriever to a learnable retriever [41, 8], and from sentence-level memory to more fine-grained token-level memory [36, 35].
|
| 16 |
+
|
| 17 |
+
However, a fundamental limitation exists in all previous works: the memory is retrieved from a fixed corpus and is constrained by the corpus’s quality. Due to the finite retrieval space, bounded memory significantly restricts the potential of memory-augmented generation models [97]. In this paper, we explore the duality of the primal problem, which posits that better generation also prompts better memory. We propose a novel framework called Selfmem, which iteratively employs a retrieval-augmented generator to create an unbounded memory pool and uses a memory selector to choose one output as memory for the subsequent generation round. By combining the primal and dual problem, a retrievalaugmented generation model can elevate itself using its own output, referred to as self-memory. The key insight behind Selfmem is that the text more closely resembling the data distribution during inference is not the training data [87], but the model’s own output.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Relation between memory and hypothesis on JRC-Acquis E $_ { 1 \mathrm { D e } }$ dataset. The hypothesis is generated by a retrievalaugmented translator whose memory is retrieved from the training set. The $\mathbf { X }$ -axis represents the similarity between memory and the reference.
|
| 21 |
+
|
| 22 |
+
Selfmem consists of two complementary components:
|
| 23 |
+
|
| 24 |
+
a retrieval-augmented generator and a memory selector. The generator operates under two distinct paradigms: fine-tuning a small model or few-shot prompting an LLM. For the former, we train the generator with labeled data and retrieved memory, while for the latter, we employ a fixed black-box LLM exclusively for inference alongside retrieved in-context learning samples. We then use the generator’s output to train a memory selector based on a specific performance metric. By simply replacing the retrieved memory with unbounded generated memory, we achieve higher-quality generation output (primal problem), which subsequently serves as memory for the next round after being refined by the memory selector (dual problem).
|
| 25 |
+
|
| 26 |
+
To evaluate the efficacy of the Selfmem, we carry out comprehensive experiments in three distinct text generation tasks: neural machine translation, abstractive text summarization, and dialogue generation. We witness substantial enhancements over robust baselines, attaining state-of-the-art outcomes in JRC-Acquis (four directions), XSum (50.3 ROUGE-1), and BigPatent (62.9 ROUGE-1). To gain deeper insights into the Selfmem, we meticulously investigate each crucial component and pinpoint the existing system bottleneck to guide future research endeavors.
|
| 27 |
+
|
| 28 |
+
# 2 Related Work
|
| 29 |
+
|
| 30 |
+
# 2.1 Retrieval-augmented Text Generation
|
| 31 |
+
|
| 32 |
+
Since the world is not a snapshot once the training corpus is collected, we can never expect an ever-large model to capture everything in its parameters, even for LLMs like GPT-4 [62]. Therefore, it is crucial to equip these models with an external memory bank to store additional knowledge or useful demonstration examples for solving various NLP tasks[41, 78, 95].
|
| 33 |
+
|
| 34 |
+
In the translation domain, retrieval techniques have long been employed by the localization industry to enhance human translators’ productivity and consistency even before the advent of machine translation [94]. Early works on machine translation primarily focused on utilizing memory for statistical machine translation (SMT) systems [80, 50]. For neural machine translation (NMT), [28] were the first to use search engines to retrieve memory from the training set and incorporate it with an external memory network. Subsequent research explored various aspects of retrievalaugmented NMT, such as memory encoding methods [92, 93, 31], joint training of retrievers and generators with monolingual data [8], memory granularity [35], and memory diversity [17]. For few-shot LLM generation, strategies for in-context example selection have been proposed to improve translation quality [2]. Furthermore, in-context machine translation has been shown to be effective for on-the-fly adaptation [79]. For dialogue response generation tasks, employing exemplar/template retrieval as an intermediate step has proven advantageous for generating informative responses [89, 91, 6, 7]. In-context learning example retrieval also aids in controllable dialogue [46]. Other applications include abstractive summarization [64, 14, 18, 15], code generation [30], paraphrase generation [34, 83], language modeling [36, 105], counterfactual data generation [24], open domain question answering [12, 33] and semantic parsing [99].
|
| 35 |
+
|
| 36 |
+
# 2.2 Neural Text Reranking
|
| 37 |
+
|
| 38 |
+
By alleviating the discrepancy between training and inference (i.e., exposure bias) and directly optimizing desired metrics, two-stage reranking methods have facilitated significant progress in various text generation tasks. In machine translation, pioneering works by [75] and [61] introduced and popularized discriminative reranking for SMT. In the context of NMT, research has focused on two primary reranking approaches: generative reranking [56, 32, 88] and discriminative reranking [39, 71, 23]. For syntactic parsing, [21] were the first to employ a two-stage reranking method to select outputs from a base parser, while [11] introduced a maximum entropy reranker. In text summarization, RefSum [53] proposed a second-stage summarization framework to address train-test distribution mismatches. SimCLS [54] used pairwise Learning To Rank (LTR) to select candidates with the highest matching scores. SummaReranker [68] adopted a multi-task mixture-of-experts framework to leverage different metrics capturing various aspects of generated candidates. BRIO [55] reused the base model for a second round of fine-tuning with both cross-entropy loss and a candidate-level ranking loss. JGR [76] employed an alternate training paradigm to train the generator and reranker.
|
| 39 |
+
|
| 40 |
+
A key limitation of these reranking methods is that they only represent a one-way process, wherein the selected candidates become the system’s final output. In contrast, our framework innovatively utilizes the chosen candidates as memory for the subsequent generation round of a retrieval-augmented generator, which can produce better candidates with enhanced memory.
|
| 41 |
+
|
| 42 |
+
# 3 Methods
|
| 43 |
+
|
| 44 |
+
In this section, we begin with a motivating experiment on generation as memory $( \ S 3 . 1 )$ . Then, we introduce Selfmem, a framework comprising a retrieval-augmented generator $( \ S 3 . 2 )$ and a memory selector $( \ S \ 3 . 3 )$ . The complete framework and algorithm are illustrated in Figure 2 and Algorithm 1.
|
| 45 |
+
|
| 46 |
+
# 3.1 Generation as Memory
|
| 47 |
+
|
| 48 |
+
The primary motivation behind our framework stems from the observation that the memory, which is more similar in distribution to the data during inference, is not the training data (38.89 BLEU, as shown in the first row of Table 1). Instead, it is the model’s own output (58.58 BLEU) within the unbounded generation space. One interesting exploration involves directly utilizing the generated output as memory in relation to the primal problem: better memory prompts better generation.
|
| 49 |
+
|
| 50 |
+
We conduct experiments on the JRC-Acquis En De dataset. The first row in Table 1 represents conventional retrieval-augmented training with retrieved memory and achieves a 58.58 BLEU score. However, directly incorporating beam output of this trained model as memory (Beam) back into the generation model does not yield any improvements (row 2), despite its higher similarity to the reference compared to the retrieved ones. We hypothesize two potential reasons for this: (1) the retrieval-augmented generator may not generalize effectively in this context due to the
|
| 51 |
+
|
| 52 |
+
Table 1: Experiments on the relation between memory quality and the final hypothesis quality, measured by the BLEU score with ground truth translation. The retrieval-augmented translator keeps fixed while the memory is obtained from different sources.
|
| 53 |
+
|
| 54 |
+
<table><tr><td>Memory Source</td><td>Memory Quality</td><td>Hypothesis Quality</td></tr><tr><td>Retrieval</td><td>38.89</td><td>58.58</td></tr><tr><td>Beam</td><td>58.58</td><td>58.43</td></tr><tr><td>Reference</td><td>100</td><td>90.43</td></tr><tr><td>Random</td><td>1.14</td><td>49.08</td></tr></table>
|
| 55 |
+
|
| 56 |
+
memory distribution shift (from 38.89 to 58.58), and (2) the beam memory does not offer any information gain compared to the retrieved one, even it exhibits more overlap with the references.
|
| 57 |
+
|
| 58 |
+
To investigate the first hypothesis, we conduct experiments under the oracle and random scenarios by using the reference as memory (Reference) and randomly sampled sentences as memory (Random). The result is shown in Table 1 and it illustrates that a retrieval-augmented generator (trained with retrieved memory) has already learned to discriminate between different memories in both oracle and random scenarios, without updating the model weights.
|
| 59 |
+
|
| 60 |
+

|
| 61 |
+
Figure 2: Overall framework. There are two components in Selfmem, a retrieval-augmented generator (a) and a memory selector (b). For the primal problem, (a) takes source and memory as input to generate candidates for (b). For the dual problem, (b) takes as input source and generated candidates to select memory for (a).
|
| 62 |
+
|
| 63 |
+
To evaluate the second conjecture, we first define the token sets of the reference, retrieved memory, and beam memory as $\mathcal { R } , \mathcal { M }$ , and $\boldsymbol { B }$ , respectively. The overlap token set, denoted by $\mathcal { O }$ , is defined as the tokens that overlap with the references in the beam memory but not in the retrieved memory, which is represented as $\mathcal { R } \cap \mathcal { B } - \mathcal { R } \cap \mathcal { M } .$ $\mathcal { O }$ is considered as the additional information provided by the beam memory. Inspired by the confidence analysis of NMT model [58], we compute the set confidence score, $\psi ( \cdot )$ , as follows:
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
\psi ( \cdot ) = { \frac { 1 } { | \cdot | } } \sum _ { y ^ { i } \in \cdot } p ( y _ { i } | x , y _ { < i } )
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+
where $p ( y _ { i } | x , y _ { < i } )$ is defined by the generation model. $\psi ( \cdot )$ measures the confidence with which the generation model generates the tokens. The value of $\psi ( \mathcal { R } )$ is 0.58, while that of $\mathcal { O }$ is 0.76, indicating that the generator is relatively confident in generating tokens in $\mathcal { O }$ , and therefore does not need to resort to external memory [38]. Beam search ranks generated candidates based on $p ( y | x )$ , where the selected memory falls within the confidence region of the generator and consequently provides no information gain. This observation motivates us to select memory according to metrics other than $p ( y | x )$ in the memory selector (§3.3).
|
| 70 |
+
|
| 71 |
+
# 3.2 Retrieval-augmented Generator
|
| 72 |
+
|
| 73 |
+
Given a text pair $( x , y )$ , where $x = \{ \mathbf { x } _ { 1 } , . . . , \mathbf { x } _ { | x | } \}$ is the source, $y = \{ \mathbf { y } _ { 1 } , . . . , \mathbf { y } _ { | y | } \}$ is the target. They could be (document, summary) in summarization, (context, response) in dialogue generation or (source, target) in machine translation. The retrieval-augmented generation would first use $x$ to retrieve memory $m$ from datastore $\mathbb { D }$ . Then the generator $G _ { \xi } ( x , m )$ , parameterized by $\xi$ , would take both $x$ and $m$ as input to generate the target sentence $y$ . In this paper, following standard practice, we choose the training set as $\mathbb { D } = \{ ( x ^ { i } , y ^ { i } ) \} _ { i = 1 } ^ { | \mathbb { D } | }$ . For LLM as $G _ { \xi }$ , we use the standard in-context learning format to give $( x , y )$ as demonstration example. For tunable generator $G _ { \xi }$ , we only keep the target side of top- $\mathbf { \xi } _ { l }$ retrieval results as memory and we consider two commonly used architectures: Joint-Encoder [29, 87, 41] and Dual-Encoder [92, 8, 17].
|
| 74 |
+
|
| 75 |
+
Joint-Encoder This architecture is the standard encoder-decoder-based model [3, 84]. The input is the concatenation of $x$ and $m$ . The encoder would first map the input into the hidden states $H$ :
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
H = { \mathrm { E n c o d e r } } ( x \ [ { \mathrm { S E P } } ] \ m )
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
And the decoder would incorporate $H$ by attention mechanism and generate tokens in an autoregressive manner:
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
h ^ { i } = \mathrm { D e c o d e r } ( \mathrm { C r o s s A t t n } ( H ) , y _ { < i } ) \quad P _ { G _ { \xi } } ( \cdot | x , y _ { < i } ) = \mathrm { S o f t m a x } ( h ^ { i } )
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
Dual-Encoder Instead of treating $x$ and $m$ as a long sequence, this architecture has two encoders, one for $x$ and the other for $m$ . Their outputs are sequentially attended by the decoder with dual cross attention as in [17]:
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
\begin{array} { c } { H _ { x } = \mathrm { S o u r c e E n c o d e r } ( x ) \quad H _ { m } = \mathrm { M e m o r y E n c o d e r } ( m ) } \\ { h ^ { i } = \mathrm { D e c o d e r } ( \mathrm { C r o s s A t t n } ( H _ { x } , H _ { m } ) , y _ { < i } ) } \end{array}
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
We use Transformer [84] as the building block for both architectures and optimize $G _ { \xi }$ with NLL loss:
|
| 94 |
+
|
| 95 |
+
$$
|
| 96 |
+
\mathcal { L } _ { \mathrm { n l l } } = - \sum _ { t = 1 } ^ { | y | } \log P _ { G _ { \xi } } ( y _ { t } | x , m , y _ { < t } )
|
| 97 |
+
$$
|
| 98 |
+
|
| 99 |
+
# 3.3 Memory Selector
|
| 100 |
+
|
| 101 |
+
The role of memory selector $S _ { \theta } ( x , c )$ , parameterized by $\theta$ , is to select one candidate $c$ from the candidate pool $\mathbb { C }$ generated by $G _ { \xi }$ based on a specific metric $\Delta ( \cdot , \cdot )$ . The chosen candidate $c$ is then utilized as memory $m$ for the subsequent generation round of $G _ { \xi }$ . As discussed in $\ S 3 . 1$ , using $p _ { G _ { \xi } } ( y | x )$ as the metric $\Delta ( \cdot , \cdot )$ would result in falling into the confidence region of $G _ { \xi }$ , leading to no information gain. Moreover, a larger value of $p _ { G _ { \xi } } ( y | x )$ does not necessarily guarantee improved generation quality [59]. Consequently, we define $\Delta ( \cdot , \cdot )$ as model-free metrics that are widely employed for assessing generation quality, such as BLEU for Neural Machine Translation (NMT) and ROUGE for Summarization. Our memory selector takes the concatenation of the source $x$ and candidate $c _ { i }$ as input, and produces a multinomial distribution $p _ { S _ { \theta } } ( \cdot | x )$ over $\mathbb { C }$ .
|
| 102 |
+
|
| 103 |
+
In this paper, we focus on the role of the memory selector, $S _ { \theta } ( x , c )$ , which is parameterized by $\theta$ . The objective of this selector is to choose a single candidate $c$ from the candidate pool $\mathbb { C }$ , generated by $G _ { \xi }$ , based on a specific metric, $\Delta ( \cdot , \cdot )$ .
|
| 104 |
+
|
| 105 |
+
$$
|
| 106 |
+
p _ { S _ { \theta } } ( c _ { i } | x ) = \frac { \exp ( S _ { \theta } ( x \left[ \mathrm { S E P } \right] c _ { i } ) ) } { \sum _ { j = 1 } ^ { | \mathbb { C } | } \exp ( S _ { \theta } ( x \left[ \mathrm { S E P } \right] c _ { j } ) ) }
|
| 107 |
+
$$
|
| 108 |
+
|
| 109 |
+
In accordance with [39], the training goal for $S _ { \theta }$ is to minimize the discrepancy between the $S _ { \theta }$ ’s predictions and the scores determined by $\Delta ( \cdot , \cdot )$ . This divergence is quantified using the KullbackLeibler (KL) divergence.
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
\mathcal { L } _ { \mathrm { k l } } = - \sum _ { i = 1 } ^ { | \mathbb { C } | } p _ { M } ( c _ { i } ) \mathrm { l o g } p _ { S _ { \theta } } ( c _ { i } | x ) \quad \mathrm { w h e r e } \quad p _ { M } ( c _ { i } ) = \frac { \exp ( \Delta ( c _ { i } , y ) / \tau ) } { \sum _ { j = 1 } ^ { | \mathbb { C } | } \exp ( \Delta ( c _ { j } , y ) / \tau ) }
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
$\tau$ is the temperature to control the smoothness of the distribution. At inference, the output of the $S _ { \theta }$ is a $\operatorname { r g m a x } _ { c _ { i } \in \mathbb { C } } { \dot { p } } _ { S _ { \theta } } ( c _ { i } | x )$ .
|
| 116 |
+
|
| 117 |
+
# 3.4 Combine Generator and Selector
|
| 118 |
+
|
| 119 |
+
We define two generation modes for $G _ { \xi }$ . The first mode, referred to as the hypothesis mode, generates a single output for each input, which is utilized for system evaluation. The second mode, known as the candidate mode, produces $_ \mathrm { N }$ outputs for a given input, and is employed for training $S _ { \theta }$ as well as memory selection. By integrating two modes together, we present the complete framework of our proposed model, Selfmem, as illustrated in Algorithm 1.
|
| 120 |
+
|
| 121 |
+
# 4 Experimental Setup
|
| 122 |
+
|
| 123 |
+
# 4.1 Dataset
|
| 124 |
+
|
| 125 |
+
We assess the performance of Selfmem on three generation tasks, utilizing a total of seven datasets. Translation. We evaluate our framework on JRC-Acquis datasets [82], a collection of parallel
|
| 126 |
+
|
| 127 |
+
Require: a dataset $\mathbb { D }$ , a retriever $R$ , a memory selection metric $\Delta ( \cdot , \cdot )$ , a retrieval-augmented
|
| 128 |
+
generator $G _ { \xi }$ , and a memory selector $S _ { \theta }$
|
| 129 |
+
1: retrieve memory $\mathbb { M }$ in $\mathbb { D }$ with $R$
|
| 130 |
+
2: train $G _ { \xi }$ with $\mathbb { D }$ and $\mathbb { M }$ (if not LLM)
|
| 131 |
+
3: use $G _ { \xi }$ to generate candidate pool $\mathbb { C }$ with $\mathbb { M }$ in candidate mode
|
| 132 |
+
4: train ${ \check { S } } _ { \theta }$ on $\mathbb { C }$ with $\Delta ( \cdot , \cdot )$
|
| 133 |
+
5: while not converged in the validation set do
|
| 134 |
+
6: $S _ { \theta }$ selects memory from $\mathbb { C }$ as $\mathbb { M }$
|
| 135 |
+
7: $G _ { \xi }$ generates candidate pool $\mathbb { C }$ with $\mathbb { M }$ in candidate mode
|
| 136 |
+
8: end while
|
| 137 |
+
9: $G _ { \xi }$ generates the final hypothesis with $\mathbb { M }$ in hypothesis mode
|
| 138 |
+
|
| 139 |
+
legislative text of European Union Law. It is the benchmark dataset used in translation memoryaugmented NMT task [28, 92, 8, 17]. We choose 4 translation directions, namely, Spanish English $( { \mathrm { E s } } { \mathrm { E n } } )$ , German English $( \mathrm { D e } \mathrm { E n } $ ). Summarization. We evaluate on 2 summarization datasets: 1) XSum [60], extreme summarization, a single-document summarization dataset with highly abstractive articles from British Broadcasting Corporation. 2) BigPatent [73], consisting of 1.3 million records of U.S. patent documents along with human-written abstractive summaries. Dialogue. We experiment on DailyDialog [44], which contains multi-turn dialogs on daily life topics and is used by [13, 4, 103]. The detailed statistics for these datasets can be found in the Appendix A.
|
| 140 |
+
|
| 141 |
+
# 4.2 Implementation Details
|
| 142 |
+
|
| 143 |
+
We utilize the BM25 algorithm [70] for retrieval purposes. For all tasks, the candidate generation method consists of beam search with a beam width of 50. The number of iterations is determined by the performance on the validation set. For translation, we follow the approach of [93, 8, 17], employing a randomly initialized Transformerbase architecture as $G _ { \xi }$ for trainable small model and XGLM [48] for LLM in-context learning. Evaluation metrics include BLEU, TER, and ${ \mathrm { c h r F } } + +$ obtained from SACREBLEU[66]. The memory selector $S _ { \theta }$ utilizes an XLM- ${ \bf R } _ { b a s e }$ [22] as backbone, with BLEU serving as $\Delta ( \cdot , \cdot )$ . For summarization, we initialize $G _ { \xi }$ with $\mathrm { B A R T _ { b a s e } } [ 4 0 ]$ for BigPatent and employ BRIO [55] for XSum. The evaluation metric comprises ROUGE (R1/2/L) [47]. For dialogue generation, $\mathbf { B A R T _ { b a s e } }$ serves as the backbone for $G _ { \xi }$ . Our dialogue system is evaluated using BLEU (B-1/2) and Distinct (D-1/2) scores [43]. For both dialogue and summarization tasks, we adhere to the methods of [54, 26], adopting $\mathrm { R o B E R T a _ { b a s e } }$ [52] as the backbone for $S _ { \theta }$ The linear combination of $_ { \mathrm { B - } 1 / 2 }$ is chosen as $\Delta ( \cdot , \cdot )$ for Dialogue Generation, while $\mathrm { \mathbf { R } } \mathrm { - } 1 / 2 / \mathrm { L }$ is used for Summarization, following [76]. For further implementation details, please refer to the Appendix B and Appendix C for evaluation metrics.
|
| 144 |
+
|
| 145 |
+
# 5 Experimental Results
|
| 146 |
+
|
| 147 |
+
# 5.1 Machine Translation
|
| 148 |
+
|
| 149 |
+
We select four translation directions and experiment with two generation paradigms: trainable small models and few-shot prompted LLMs [85, 20]. For trainable models, we explore two architectures (joint and dual, as detailed in $\ S 3 . 2 \AA$ . The baselines comprise two types of translation systems: one being the vanilla sequence-to-sequence model [3, 84] without memory augmentation, and the other consisting of retrieval-augmented translation models focusing on memory encoding [28, 92], memory construction [101], memory retrieval [8], and memory diversity [17]. Based on the experimental results2 shown in Table 2, Selfmem significantly enhances the performance of $G _ { \xi }$ across four translation datasets and two different architectures. This is noteworthy, given that the parameters of the $G _ { \xi }$ remain fixed, with the only variable being the input memory. This finding is consistent with the primal problem which posits that improved memory typically leads to better generation results.
|
| 150 |
+
|
| 151 |
+
Table 2: Results of translation task on JRC-Acquis measured by BLEU. Models denoted by the same symbol $\times$ and $\dagger .$ ) have the same parameters and only differ in memory as input. The bolded numbers show the SOTA performance and the underlined numbers show the second-best result. $^ *$ denotes the system is significantly better than baselines with $p$ -value $< 0 . 0 5$ tested by [37].
|
| 152 |
+
|
| 153 |
+
<table><tr><td rowspan="2">System</td><td colspan="2">Es-→En</td><td colspan="2">En→Es</td><td colspan="2">De-→En</td><td colspan="2">En→De</td></tr><tr><td>Dev</td><td>Test</td><td>Dev</td><td>Test</td><td>Dev</td><td>Test</td><td>Dev</td><td>Test</td></tr><tr><td colspan="9">None Memory</td></tr><tr><td>RNNsearch [3]</td><td>55.02</td><td>59.34</td><td>50.54</td><td>50.48</td><td>50.20</td><td>49.74</td><td>44.94</td><td>43.98</td></tr><tr><td>Transformer [84]</td><td>64.08</td><td>64.63</td><td>62.02</td><td>61.80</td><td>60.18</td><td>60.16</td><td>54.65</td><td>55.43</td></tr><tr><td colspan="9">Retrieval Memory</td></tr><tr><td>SEG-NMT[28]</td><td>60.28</td><td>59.34</td><td>57.62</td><td>57.27</td><td>55.63</td><td>55.33</td><td>49.26</td><td>48.80</td></tr><tr><td>NMT-pieces [101]</td><td>63.97</td><td>64.30</td><td>61.50</td><td>61.56</td><td>60.10</td><td>60.26</td><td>55.54</td><td>55.14</td></tr><tr><td>G-TFM [92]</td><td>66.37</td><td>66.21</td><td>62.50</td><td>62.76</td><td>61.85</td><td>61.72</td><td>57.43</td><td>56.88</td></tr><tr><td>MonoNMT[8]</td><td>67.73</td><td>67.42</td><td>64.18</td><td>63.86</td><td>64.48</td><td>64.62</td><td>58.77</td><td>58.42</td></tr><tr><td>CMM[17]</td><td>67.48</td><td>67.76</td><td>63.84</td><td>64.04</td><td>64.22</td><td>64.33</td><td>58.94</td><td>58.69</td></tr><tr><td>Transformerdual*</td><td>66.87</td><td>67.12</td><td>63.14</td><td>63.54</td><td>64.09</td><td>63.36</td><td>58.69</td><td>58.06</td></tr><tr><td>Transformerunit</td><td>67.74</td><td>67.32</td><td>63.93</td><td>64.12</td><td>64.50</td><td>64.40</td><td>58.16</td><td>58.58</td></tr><tr><td colspan="9">Self-Memory</td></tr><tr><td>Transformerdual*</td><td>68.63*</td><td>69.20*</td><td>64.12*</td><td>64.67*</td><td>65.06*</td><td>64.98*</td><td>59.26*</td><td>59.49*</td></tr><tr><td>Transformerunit</td><td>68.26*</td><td>68.80*</td><td>66.07*</td><td>65.94*</td><td>65.32*</td><td>65.65*</td><td>59.88*</td><td>60.11*</td></tr></table>
|
| 154 |
+
|
| 155 |
+
Table 3: Comparison between retrieval memory and self-memory. The quality of memory and hypothesis is measured by the n-gram overlap with reference (BLEU). All experiments are conducted with Transforme $\mathbf { \dot { j } } \mathbf { o } \mathbf { \dot { i } } \mathbf { n } \mathbf { t }$ on JRC-Acquis.
|
| 156 |
+
|
| 157 |
+
<table><tr><td rowspan="2"></td><td colspan="2">Retrieval</td><td colspan="2">Self</td></tr><tr><td>memory</td><td>hypothesis</td><td> memory</td><td>hypothesis</td></tr><tr><td rowspan="2">En-De</td><td>→</td><td>38.89</td><td>58.58</td><td>57.92</td><td>60.11</td></tr><tr><td>↑</td><td>42.56</td><td>64.40</td><td>64.32</td><td>65.65</td></tr><tr><td rowspan="2">En-Es</td><td>→</td><td>40.67</td><td>64.12</td><td>63.57</td><td>65.94</td></tr><tr><td>↑</td><td>43.05</td><td>67.32</td><td>67.78</td><td>68.80</td></tr></table>
|
| 158 |
+
|
| 159 |
+
The dual problem is revealed in Table 3. Self-memory, which essentially represents the model’s own output, exhibits greater similarity with the ground truth and serves as a more effective memory for generating the final output. This observation highlights a key distinction between Selfmem and previous reranking works [39, 68]. Reranking aims to select candidates of higher quality than the beam output, whereas in Selfmem, the chosen candidates serve as memory for the retrieval-augmented generator and do not necessarily need to surpass the quality of the beam hypotheses.
|
| 160 |
+
|
| 161 |
+
Table 4: Evaluation results of in-context learning with self-memory.
|
| 162 |
+
|
| 163 |
+
<table><tr><td rowspan="2" colspan="2"></td><td colspan="3">XGLM-1.7B</td><td colspan="3">XGLM-4.5B</td><td colspan="3">XGLM-7.5B</td></tr><tr><td>Random</td><td>kNN</td><td>Self</td><td>Random</td><td>kNN</td><td>Self</td><td>Random</td><td>kNN</td><td>Self</td></tr><tr><td rowspan="2">En-De</td><td>↑</td><td>11.51</td><td>37.87</td><td>40.94</td><td>17.51</td><td>37.60</td><td>38.25</td><td>18.48</td><td>47.82</td><td>48.32</td></tr><tr><td></td><td>27.42</td><td>51.00</td><td>51.88</td><td>30.62</td><td>48.12</td><td>48.36</td><td>33.03</td><td>55.65</td><td>55.12</td></tr><tr><td rowspan="2">En-Es</td><td>→</td><td>23.87</td><td>46.20</td><td>48.56</td><td>31.83</td><td>48.37</td><td>49.17</td><td>29.97</td><td>53.86</td><td>54.32</td></tr><tr><td>↑</td><td>25.29</td><td>51.55</td><td>53.13</td><td>32.16</td><td>48.55</td><td>49.22</td><td>35.22</td><td>57.25</td><td>57.56</td></tr></table>
|
| 164 |
+
|
| 165 |
+
In Table 4, we present the results of LLM with self-memory. We employ XGLM [48] as our backbone generator, with three different sizes ranging from 1.7B to 7.5B. We utilize the recommended prompt as described in [48]. We select three in-context learning examples and report the average scores from three separate runs, taking into account the sensitivity of example selection in ICL [49]. From the table, we first observe a general trend where few-shot translation performance improves as the size of the model increases. Furthermore, we find that more similar translation demonstrations significantly enhance performance across all model sizes (from random, kNN to Self). This suggests that demonstration examples in in-context learning not only act as triggers for model ability but also adhere to the primal problem, where better demonstration example leads to better generation. Also, by comparing the results in Table 2 and Table 4, we can conclude that the cross-lingual LLM with designed examples still falls short of the supervised baselines in this task.
|
| 166 |
+
|
| 167 |
+
# 5.2 Summarization
|
| 168 |
+
|
| 169 |
+
In this paper, we compare the performance of our trainable model with those of REINA [87], PEGASUS [100], and BART [40]. The results are presented in Table5. Initially, it can be observed that memory has varying impacts on different datasets. The enhancement brought by memory in the BigPatent dataset is significantly larger than that in the XSum dataset. This can be attributed to the inherent characteristics of the BigPatent dataset, which consists of official patent documents that exhibit considerable similarity. Consequently, this greatly improves the summarization quality in accordance with the primal problem. Furthermore, we discovered that self-memory substantially enhances the performance of both BRIO $( + 1 . 2 { \ R } 1 )$ and BART $( + 1 8 . 5 \mathrm { R } 1 ) $ ), achieving state-of-the-art results on both datasets. We selected these baselines for a fair comparison, as they share the same base generator. Due to space constraints, additional comparisons and the confidence region of the SOTA model can be found in the Appendix E.
|
| 170 |
+
|
| 171 |
+
Table 5: Results of summarization task on XSum and BigPatent measured by ROUGE.
|
| 172 |
+
|
| 173 |
+
<table><tr><td>System</td><td>Memory</td><td>R-1</td><td>R-2</td><td>R-L</td></tr><tr><td></td><td>XSum</td><td></td><td></td><td></td></tr><tr><td>PEGASUS</td><td>None</td><td>47.2</td><td>24.6</td><td>39.3</td></tr><tr><td>BRIO</td><td>None</td><td>49.1</td><td>25.6</td><td>40.4</td></tr><tr><td>REINA (PG)</td><td>Retrieval</td><td>48.2</td><td>26.0</td><td>40.2</td></tr><tr><td>REINA (B)</td><td>Retrieval</td><td>43.2</td><td>21.0</td><td>35.5</td></tr><tr><td>REINA (L)</td><td>Retrieval</td><td>46.5</td><td>24.1</td><td>38.6</td></tr><tr><td>BRIOdual*</td><td>Retrieval</td><td>48.6</td><td>26.1</td><td>40.6</td></tr><tr><td>BRIOjoint</td><td>Retrieval</td><td>49.5</td><td>26.5</td><td>41.2</td></tr><tr><td>BRIOdual*</td><td>Self</td><td>49.2</td><td>26.2</td><td>40.8</td></tr><tr><td>BRIOjointt</td><td>Self</td><td>50.3</td><td>26.7</td><td>41.6</td></tr></table>
|
| 174 |
+
|
| 175 |
+
<table><tr><td>System</td><td>Memory</td><td>R-1</td><td>R-2</td><td>R-L</td></tr><tr><td></td><td>BigPatent</td><td></td><td></td><td></td></tr><tr><td>PEGASUS</td><td>None</td><td>53.6</td><td>33.2</td><td>43.2</td></tr><tr><td>BART</td><td>None</td><td>44.4</td><td>21.3</td><td>31.0</td></tr><tr><td>REINA (B)</td><td>Retrieval</td><td>59.5</td><td>42.6</td><td>50.6</td></tr><tr><td>REINA (L)</td><td>Retrieval</td><td>60.7</td><td>43.3</td><td>51.3</td></tr><tr><td>REINA (PG)</td><td>Retrieval</td><td>44.6</td><td>21.5</td><td>33.3</td></tr><tr><td>BARTdual*</td><td>Retrieval</td><td>57.4</td><td>43.3</td><td>49.7</td></tr><tr><td>BARTjointt</td><td>Retrieval</td><td>59.6</td><td>43.4</td><td>51.0</td></tr><tr><td>BARTdual*</td><td>Self</td><td>61.2</td><td>44.6</td><td>52.3</td></tr><tr><td>BARTjoint</td><td>Self</td><td>62.9</td><td>48.1</td><td>59.6</td></tr></table>
|
| 176 |
+
|
| 177 |
+
# 5.3 Dialogue Generation
|
| 178 |
+
|
| 179 |
+
As demonstrated in Table 6, the self-memory significantly enhances the performance of the retrievalaugmented generator for dialogue generation tasks. By optimizing memory using BLEU as $\Delta ( \cdot , \cdot )$ , the self-memory improves the B-1,2 score over retrieved memory by $3 . 0 8 \ \mathrm { B } \cdot 1$ and $0 . 6 \ \mathbf { B } { - } 2$ on $\mathbf { B A R T _ { j o i n t } }$ . Intriguingly, although Selfmem surpasses the baselines in terms of $_ { \mathrm { B - } 1 / 2 }$ , it falls behind in D-1 and D-2, which can be attributed to the trade-off between BLEU score and Distinct score when evaluating a dialogue system [104]. To address this issue, we opt for D-1,2 as $\Delta ( \cdot , \cdot )$ when optimizing $S _ { \theta }$ , denoted as $\mathbf { B A R T } _ { \mathrm { j o i n t } } \dagger ( \mathbf { D } )$ . The results in Table 6 highlight the remarkable flexibility of Selfmem by directly optimizing memory to achieve the desired attributes for diverse and informative dialogue.
|
| 180 |
+
|
| 181 |
+
# 6 Further Analysis
|
| 182 |
+
|
| 183 |
+
To gain a deeper insight into Selfmem, we first examine the impact of each key component, namely $G _ { \xi }$ and $S _ { \theta }$ . Subsequently, we perform a detailed token-level analysis of the generated output concerning their frequency in the training set. Experiments are conducted on the JRC-Acquis En De dataset. We also include latency analysis and human evaluation on Appendix F and G.
|
| 184 |
+
|
| 185 |
+
Tuning $S _ { \theta }$ We explored various $S _ { \theta }$ by direct selection from the candidate pool based on gold rankings. As shown in Figure 3a, both architectures with enhanced $S _ { \theta }$ significantly outperform the current SOTA performance (60.11 BLEU). Moreover, we assessed the candidate pool quality during this iterative process using an oracle $S _ { \theta }$ , as displayed in Figure 3b. A clear pattern emerges in this boxplot, revealing improvements in the oracle, quartile, average, and minimum scores of the candidate pool. These two experiments jointly clarify the Selfmem’s underlying intuition: a retrieval-augmented generator profits from superior memory, which can be chosen from its own unbounded output, and subsequently, the generator with improved memory produces a higher-quality candidate pool for the next selection round. Consequently, the model lift itself up.
|
| 186 |
+
|
| 187 |
+
Table 6: Results of dialogue generation task on DailyDialog measured by B-1/2 and D-1/2. $\mathbf { B A R T _ { j o i n t } }$ (D) denotes the metric $\Delta ( \cdot , \cdot )$ for $S _ { \theta }$ is the average of D-1 and D-2.
|
| 188 |
+
|
| 189 |
+
<table><tr><td>System</td><td>Memory</td><td>B-1</td><td>B-2</td><td>D-1</td><td>D-2</td></tr><tr><td>NCM [86]</td><td>None</td><td>33.60</td><td>26.80</td><td>3.00</td><td>12.80</td></tr><tr><td>iVAE [25]</td><td>None</td><td>30.90</td><td>24.90</td><td>2.90</td><td>25.00</td></tr><tr><td>PLATO-2 [5]</td><td>None</td><td>34.80</td><td>25.12</td><td>3.54</td><td>25.11</td></tr><tr><td>DialoFlow [45]</td><td>None</td><td>36.17</td><td>27.67</td><td>4.56</td><td>27.12</td></tr><tr><td>BART</td><td>None</td><td>20.72</td><td>11.36</td><td>3.92</td><td>19.44</td></tr><tr><td>BARTdual*</td><td>Retrieval</td><td>29.50</td><td>21.89</td><td>4.74</td><td>26.01</td></tr><tr><td>BARTjointt</td><td>Retrieval</td><td>36.72</td><td>31.55</td><td>6.13</td><td>35.65</td></tr><tr><td>BARTdual*</td><td>Self</td><td>33.43</td><td>22.85</td><td>4.66</td><td>26.16</td></tr><tr><td>BARTjoint</td><td>Self</td><td>39.80</td><td>32.15</td><td>5.84</td><td>32.16</td></tr><tr><td>BARTjoint † (D)</td><td>Self</td><td>36.92</td><td>32.09</td><td>9.12</td><td>37.05</td></tr></table>
|
| 190 |
+
|
| 191 |
+

|
| 192 |
+
Figure 3: (a) shows generation quality in the iteration process with different $S _ { \theta }$ in both trainable generator architectures. (b) shows candidates quality in the iteration process with an oracle $S _ { \theta }$ .
|
| 193 |
+
|
| 194 |
+
Tuning $G _ { \xi }$ As discussed in $\ S 3 . 1$ , we demonstrated that a trained retrieval-augmented generator, with fixed parameters, possesses the ability to distinguish between "good" and "bad" memory. This observation not only justifies our decision to maintain a fixed generator within our framework but also implies that the $G _ { \xi }$ is not the current bottleneck of the Selfmem.
|
| 195 |
+
|
| 196 |
+

|
| 197 |
+
Figure 4: 1-gram F1 score sorted by training corpus frequency.
|
| 198 |
+
|
| 199 |
+
Frequency Analysis We conduct a comprehensive tokenlevel analysis by computing the 1-gram F1 scores for generated translations and subsequently categorizing the tokens based on their frequency in the training set. The results are depicted in Figure 4. A noticeable pattern emerges, suggesting that the more frequently a model encounters a token during training, the higher the accuracy of the generated output [102]. Moreover, our findings indicate that retrievalaugmented models, particularly those incorporating self-memory augmentation, exhibit superio performance in handling long-tail inputs which are challenges for parametric models [67, 57].
|
| 200 |
+
|
| 201 |
+
# 7 Conclusion
|
| 202 |
+
|
| 203 |
+
For the first time, we investigate the fundamental limitation of bounded memory in the current retrieval-augmented literature. We combine the primal and dual problems together and propose Selfmem, a general framework for retrieval-augmented text generation by uplifting generation model with its own output. We conduct comprehensive experiments across various text generation tasks and different generation paradigms, including trainable small model and few-shot prompted LLM. We surpass strong baselines and improve the state-of-the-art performance in serval datasets. We also meticulously investigate each crucial component and pinpoint the existing system bottleneck to guide future research endeavors.
|
| 204 |
+
|
| 205 |
+
# Limitations
|
| 206 |
+
|
| 207 |
+
We discuss the limitations of our framework as follows:
|
| 208 |
+
|
| 209 |
+
(1) Although Selfmem greatly improves the generation quality compared with other retrievalaugmented generation models, it requires more computational resources with respect to the memory selection process. For large dataset with long context (e.g., BigPatent), it would become a more crucial problem considering the quadratic time complexity of transformer architecture.
|
| 210 |
+
|
| 211 |
+
(2) This paper proposes a general idea for the retrieval-augmented generation. But we only experiment with transformer-based architecture for both generator and memory selector and the architecture of generator and memory selector keeps the same across all text generation tasks. We believe the task-specific design for the model architecture, training objective and generation methods in different text generation scenarios would further improve the performance.
|
| 212 |
+
|
| 213 |
+
# Acknowledgement
|
| 214 |
+
|
| 215 |
+
This work was supported by the National Key Research and Development Program of China (No.2021YFC3340304) and National Natural Science Foundation of China (NSFC Grant No.62122089). We appreciate the anonymous reviewers for their helpful comments. Dongyan Zhao and Rui Yan are the corresponding authors.
|
| 216 |
+
|
| 217 |
+
# References
|
| 218 |
+
|
| 219 |
+
[1] Armen Aghajanyan, Anchit Gupta, Akshat Shrivastava, Xilun Chen, Luke Zettlemoyer, and Sonal Gupta. Muppet: Massive multi-task representations with pre-finetuning. In Proc. of EMNLP, 2021.
|
| 220 |
+
[2] Sweta Agrawal, Chunting Zhou, Mike Lewis, Luke Zettlemoyer, and Marjan Ghazvininejad. In-context examples selection for machine translation. CoRR, 2022.
|
| 221 |
+
[3] Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In Proc. of ICLR, 2015.
|
| 222 |
+
[4] Siqi Bao, Huang He, Fan Wang, Hua Wu, and Haifeng Wang. PLATO: pre-trained dialogue generation model with discrete latent variable. In Proc. of ACL, 2020.
|
| 223 |
+
[5] Siqi Bao, Huang He, Fan Wang, Hua Wu, Haifeng Wang, Wenquan Wu, Zhen Guo, Zhibin Liu, and Xinchao Xu. PLATO-2: Towards building an open-domain chatbot via curriculum learning. In Proc. of ACL Findings, 2021.
|
| 224 |
+
[6] Deng Cai, Yan Wang, Wei Bi, Zhaopeng Tu, Xiaojiang Liu, Wai Lam, and Shuming Shi. Skeleton-to-response: Dialogue generation guided by retrieval memory. In Proc. of NAACL, 2019.
|
| 225 |
+
[7] Deng Cai, Yan Wang, Wei Bi, Zhaopeng Tu, Xiaojiang Liu, and Shuming Shi. Retrieval-guided dialogue response generation via a matching-to-generation framework. In Proc. of EMNLP, 2019.
|
| 226 |
+
[8] Deng Cai, Yan Wang, Huayang Li, Wai Lam, and Lemao Liu. Neural machine translation with monolingual translation memory. In Proc. of ACL, 2021.
|
| 227 |
+
[9] Chris Callison-Burch, Miles Osborne, and Philipp Koehn. Re-evaluating the role of Bleu in machine translation research. In Proc. of EACL, 2006.
|
| 228 |
+
[10] Qian Cao and Deyi Xiong. Encoding gated translation memory into neural machine translation. In Proc. of EMNLP, 2018.
|
| 229 |
+
[11] Eugene Charniak and Mark Johnson. Coarse-to-fine n-best parsing and maxent discriminative reranking. In Proc. of ACL, 2005.
|
| 230 |
+
[12] Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. Reading wikipedia to answer open-domain questions. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1870–1879, 2017.
|
| 231 |
+
[13] Wei Chen, Yeyun Gong, Song Wang, Bolun Yao, Weizhen Qi, Zhongyu Wei, Xiaowu Hu, Bartuer Zhou, Yi Mao, Weizhu Chen, Biao Cheng, and Nan Duan. Dialogved: A pre-trained latent variable encoder-decoder model for dialog response generation. In Proc. of ACL, 2022.
|
| 232 |
+
[14] Xiuying Chen, Hind Alamro, Mingzhe Li, Shen Gao, Rui Yan, Xin Gao, and Xiangliang Zhang. Target-aware abstractive related work generation with contrastive learning. In Proc. of SIGIR, 2022.
|
| 233 |
+
[15] Xiuying Chen, Mingzhe Li, Shen Gao, Xin Cheng, Qiang Yang, Qishen Zhang, Xin Gao, and Xiangliang Zhang. A topic-aware summarization framework with different modal side information. Proc. of SIGIR, 2023.
|
| 234 |
+
[16] Xiuying Chen, Mingzhe Li, Xin Gao, and Xiangliang Zhang. Towards improving faithfulness in abstractive summarization. In Proc. of NeurIPS, 2022.
|
| 235 |
+
[17] Xin Cheng, Shen Gao, Lemao Liu, Dongyan Zhao, and Rui Yan. Neural machine translation with contrastive translation memories. In Proc. of EMNLP, 2022.
|
| 236 |
+
[18] Xin Cheng, Shen Gao, Yuchi Zhang, Yongliang Wang, Xiuying Chen, Mingzhe Li, Dongyan Zhao, and Rui Yan. Towards personalized review summarization by modeling historical reviews from customer and product separately. arXiv preprint arXiv:2301.11682, 2023.
|
| 237 |
+
[19] Xin Cheng, Yankai Lin, Xiuying Chen, Dongyan Zhao, and Rui Yan. Decouple knowledge from paramters for plug-and-play language modeling. In Findings of the Association for Computational Linguistics: ACL 2023, pages 14288–14308, Toronto, Canada, July 2023. Association for Computational Linguistics.
|
| 238 |
+
[20] Xin Cheng, Xun Wang, Tao Ge, Si-Qing Chen, Furu Wei, Dongyan Zhao, and Rui Yan. Scale: Synergized collaboration of asymmetric language translation engines, 2023.
|
| 239 |
+
[21] Michael Collins and Terry Koo. Discriminative reranking for natural language parsing. Comput. Linguistics, 2005.
|
| 240 |
+
[22] 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 Proc. of ACL, 2020.
|
| 241 |
+
[23] Yuntian Deng, Anton Bakhtin, Myle Ott, Arthur Szlam, and Marc’Aurelio Ranzato. Residual energy-based models for text generation. In Proc. of ICLR, 2020.
|
| 242 |
+
[24] Tanay Dixit, Bhargavi Paranjape, Hannaneh Hajishirzi, and Luke Zettlemoyer. CORE: A retrieve-then-edit framework for counterfactual data generation. In Proc. of EMNLP Findings, 2022.
|
| 243 |
+
[25] Le Fang, Chunyuan Li, Jianfeng Gao, Wen Dong, and Changyou Chen. Implicit deep latent variable models for text generation. In Proc. of EMNLP, 2019.
|
| 244 |
+
|
| 245 |
+
[26] Jiazhan Feng, Chongyang Tao, Zhen Li, Chang Liu, Tao Shen, and Dongyan Zhao. Reciprocal learning of knowledge retriever and response ranker for knowledge-grounded conversations. In Proc. of COLING, 2022.
|
| 246 |
+
|
| 247 |
+
[27] Tingchen Fu, Xueliang Zhao, Chongyang Tao, Ji-Rong Wen, and Rui Yan. There are a thousand hamlets in a thousand people’s eyes: Enhancing knowledge-grounded dialogue with personal memory. In Proc. of ACL, 2022.
|
| 248 |
+
[28] Jiatao Gu, Yong Wang, Kyunghyun Cho, and Victor O. K. Li. Search engine guided neural machine translation. In Proc. of AAAI, 2018.
|
| 249 |
+
[29] Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. Retrieval augmented language model pre-training. In Proc. of ICML, 2020.
|
| 250 |
+
[30] Tatsunori B. Hashimoto, Kelvin Guu, Yonatan Oren, and Percy Liang. A retrieve-and-edit framework for predicting structured outputs. In Proc. of NeurIPS, 2018.
|
| 251 |
+
[31] Qiuxiang He, Guoping Huang, Qu Cui, Li Li, and Lemao Liu. Fast and accurate neural machine translation with translation memory. In Proc. of ACL, 2021.
|
| 252 |
+
[32] Kenji Imamura and Eiichiro Sumita. Ensemble and reranking: Using multiple models in the NICT-2 neural machine translation system at WAT2017. In Proceedings of the 4th Workshop on Asian Translation, WAT@IJCNLP 2017, Taipei, Taiwan, November 27- December 1, 2017, 2017.
|
| 253 |
+
[33] Gautier Izacard and Edouard Grave. Leveraging passage retrieval with generative models for open domain question answering. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 874–880, Online, April 2021. Association for Computational Linguistics.
|
| 254 |
+
[34] Amirhossein Kazemnejad, Mohammadreza Salehi, and Mahdieh Soleymani Baghshah. Paraphrase generation by learning how to edit from samples. In Proc. of ACL, 2020.
|
| 255 |
+
[35] Urvashi Khandelwal, Angela Fan, Dan Jurafsky, Luke Zettlemoyer, and Mike Lewis. Nearest neighbor machine translation. In Proc. of ICLR, 2021.
|
| 256 |
+
[36] Urvashi Khandelwal, Omer Levy, Dan Jurafsky, Luke Zettlemoyer, and Mike Lewis. Generalization through memorization: Nearest neighbor language models. In Proc. of ICLR, 2020.
|
| 257 |
+
[37] Philipp Koehn. Statistical significance tests for machine translation evaluation. In Proc. of EMNLP, 2004.
|
| 258 |
+
[38] Ankit Kumar, Ozan Irsoy, Peter Ondruska, Mohit Iyyer, James Bradbury, Ishaan Gulrajani, Victor Zhong, Romain Paulus, and Richard Socher. Ask me anything: Dynamic memory networks for natural language processing. In Proc. of ICML, 2016.
|
| 259 |
+
[39] Ann Lee, Michael Auli, and Marc’Aurelio Ranzato. Discriminative reranking for neural machine translation. In Proc. of ACL, 2021.
|
| 260 |
+
[40] Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. BART: denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. In Proc. of ACL, 2020.
|
| 261 |
+
[41] Patrick S. H. Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, Sebastian Riedel, and Douwe Kiela. Retrieval-augmented generation for knowledge-intensive NLP tasks. In Proc. of NeurIPS, 2020.
|
| 262 |
+
[42] Jinpeng Li, Yingce Xia, Rui Yan, Hongda Sun, Dongyan Zhao, and Tie-Yan Liu. Stylized dialogue generation with multi-pass dual learning. In Proc. of NeurIPS, 2021.
|
| 263 |
+
[43] Jiwei Li, Michel Galley, Chris Brockett, Jianfeng Gao, and Bill Dolan. A diversity-promoting objective function for neural conversation models. In Proc. of NAACL, 2016.
|
| 264 |
+
[44] Yanran Li, Hui Su, Xiaoyu Shen, Wenjie Li, Ziqiang Cao, and Shuzi Niu. Dailydialog: A manually labelled multi-turn dialogue dataset. In Proceedings of the Eighth International Joint Conference on Natural Language Processing, IJCNLP 2017, Taipei, Taiwan, November 27 - December 1, 2017 - Volume 1: Long Papers, 2017.
|
| 265 |
+
[45] Zekang Li, Jinchao Zhang, Zhengcong Fei, Yang Feng, and Jie Zhou. Conversations are not flat: Modeling the dynamic information flow across dialogue utterances. In Proc. of ACL, 2021.
|
| 266 |
+
[46] Zekun Li, Wenhu Chen, Shiyang Li, Hong Wang, Jing Qian, and Xifeng Yan. Controllable dialogue simulation with in-context learning. In Proc. of EMNLP Findings, 2022.
|
| 267 |
+
[47] Chin-Yew Lin. ROUGE: A package for automatic evaluation of summaries. In Text Summarization Branches Out, 2004.
|
| 268 |
+
[48] Xi Victoria Lin, Todor Mihaylov, Mikel Artetxe, Tianlu Wang, Shuohui Chen, Daniel Simig, Myle Ott, Naman Goyal, Shruti Bhosale, Jingfei Du, Ramakanth Pasunuru, Sam Shleifer, Punit Singh Koura, Vishrav Chaudhary, Brian O’Horo, Jeff Wang, Luke Zettlemoyer, Zornitsa Kozareva, Mona T. Diab, Veselin Stoyanov, and Xian Li. Few-shot learning with multilingual generative language models. In Proc. of EMNLP, 2022.
|
| 269 |
+
[49] Jiachang Liu, Dinghan Shen, Yizhe Zhang, Bill Dolan, Lawrence Carin, and Weizhu Chen. What makes good in-context examples for gpt-3? In Proceedings of Deep Learning Inside Out: The 3rd Workshop on Knowledge Extraction and Integration for Deep Learning Architectures, DeeLIO@ACL 2022, Dublin, Ireland and Online, May 27, 2022, 2022.
|
| 270 |
+
[50] Lemao Liu, Hailong Cao, Taro Watanabe, Tiejun Zhao, Mo Yu, and Conghui Zhu. Locally training the log-linear model for SMT. In Proc. of EMNLP, 2012.
|
| 271 |
+
[51] Yang Liu and Mirella Lapata. Text summarization with pretrained encoders. In Proc. of EMNLP, 2019.
|
| 272 |
+
[52] 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, 2019.
|
| 273 |
+
[53] Yixin Liu, Zi-Yi Dou, and Pengfei Liu. Refsum: Refactoring neural summarization. In Proc. of NAACL, 2021.
|
| 274 |
+
[54] Yixin Liu and Pengfei Liu. Simcls: A simple framework for contrastive learning of abstractive summarization. In Proc. of ACL, 2021.
|
| 275 |
+
[55] Yixin Liu, Pengfei Liu, Dragomir R. Radev, and Graham Neubig. BRIO: bringing order to abstractive summarization. In Proc. of ACL, 2022.
|
| 276 |
+
[56] Yuchen Liu, Long Zhou, Yining Wang, Yang Zhao, Jiajun Zhang, and Chengqing Zong. A comparable study on model averaging, ensembling and reranking in NMT. In Proc. of NLPCC, 2018.
|
| 277 |
+
[57] Alexander Long, Wei Yin, Thalaiyasingam Ajanthan, Vu Nguyen, Pulak Purkait, Ravi Garg, Alan Blair, Chunhua Shen, and Anton van den Hengel. Retrieval augmented classification for long-tail visual recognition. In Proc. of CVPR, 2022.
|
| 278 |
+
[58] Yu Lu, Jiali Zeng, Jiajun Zhang, Shuangzhi Wu, and Mu Li. Learning confidence for transformer-based neural machine translation. In Proc. of ACL, 2022.
|
| 279 |
+
[59] Clara Meister, Ryan Cotterell, and Tim Vieira. If beam search is the answer, what was the question? In Proc. of EMNLP, 2020.
|
| 280 |
+
[60] Shashi Narayan, Shay B. Cohen, and Mirella Lapata. Don’t give me the details, just the summary! topic-aware convolutional neural networks for extreme summarization. In Proc. of EMNLP, 2018.
|
| 281 |
+
[61] Franz Josef Och, Daniel Gildea, Sanjeev Khudanpur, Anoop Sarkar, Kenji Yamada, Alexander M. Fraser, Shankar Kumar, Libin Shen, David Smith, Katherine Eng, Viren Jain, Zhen Jin, and Dragomir R. Radev. A smorgasbord of features for statistical machine translation. In Proc. of NAACL, 2004.
|
| 282 |
+
[62] OpenAI. GPT-4 technical report. CoRR, 2023.
|
| 283 |
+
[63] Md. Rizwan Parvez, Wasi Uddin Ahmad, Saikat Chakraborty, Baishakhi Ray, and Kai-Wei Chang. Retrieval augmented code generation and summarization. In Proc. of EMNLP Findings, 2021.
|
| 284 |
+
[64] Hao Peng, Ankur P. Parikh, Manaal Faruqui, Bhuwan Dhingra, and Dipanjan Das. Text generation with exemplar-based adaptive decoding. In Proc. of NAACL, 2019.
|
| 285 |
+
[65] Jonathan Pilault, Raymond Li, Sandeep Subramanian, and Chris Pal. On extractive and abstractive neural document summarization with transformer language models. In Proc. of EMNLP, 2020.
|
| 286 |
+
[66] Matt Post. A call for clarity in reporting BLEU scores. In Proceedings of the Third Conference on Machine Translation: Research Papers, WMT 2018, Belgium, Brussels, October 31 - November 1, 2018, 2018.
|
| 287 |
+
[67] Vikas Raunak, Siddharth Dalmia, Vivek Gupta, and Florian Metze. On long-tailed phenomena in neural machine translation. In Proc. of EMNLP Findings, 2020.
|
| 288 |
+
[68] Mathieu Ravaut, Shafiq R. Joty, and Nancy F. Chen. Summareranker: A multi-task mixture-ofexperts re-ranking framework for abstractive summarization. In Proc. of ACL, 2022.
|
| 289 |
+
[69] Mathieu Ravaut, Shafiq R. Joty, and Nancy F. Chen. Towards summary candidates fusion. CoRR, 2022.
|
| 290 |
+
[70] Stephen E. Robertson and Hugo Zaragoza. The probabilistic relevance framework: BM25 and beyond. Found. Trends Inf. Retr., 2009.
|
| 291 |
+
[71] Julian Salazar, Davis Liang, Toan Q. Nguyen, and Katrin Kirchhoff. Masked language model scoring. In Proc. of ACL, 2020.
|
| 292 |
+
[72] Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In Proc. of ACL, 2016.
|
| 293 |
+
[73] Eva Sharma, Chen Li, and Lu Wang. BIGPATENT: A large-scale dataset for abstractive and coherent summarization. In Proc. of ACL, 2019.
|
| 294 |
+
[74] Noam Shazeer and Mitchell Stern. Adafactor: Adaptive learning rates with sublinear memory cost. In Proc. of ICML, 2018.
|
| 295 |
+
[75] Libin Shen, Anoop Sarkar, and Franz Josef Och. Discriminative reranking for machine translation. In Proc. of NAACL, 2004.
|
| 296 |
+
[76] Weizhou Shen, Yeyun Gong, Yelong Shen, Song Wang, Xiaojun Quan, Nan Duan, and Weizhu Chen. Joint generator-ranker learning for natural language generation. CoRR, 2022.
|
| 297 |
+
[77] Weijia Shi, Sewon Min, Michihiro Yasunaga, Minjoon Seo, Rich James, Mike Lewis, Luke Zettlemoyer, and Wen tau Yih. Replug: Retrieval-augmented black-box language models, 2023.
|
| 298 |
+
[78] Weijia Shi, Sewon Min, Michihiro Yasunaga, Minjoon Seo, Rich James, Mike Lewis, Luke Zettlemoyer, and Wen-tau Yih. REPLUG: retrieval-augmented black-box language models. CoRR, 2023.
|
| 299 |
+
[79] Suzanna Sia and Kevin Duh. In-context learning as maintaining coherency: A study of on-the-fly machine translation using large language models. CoRR, 2023.
|
| 300 |
+
|
| 301 |
+
[80] Michel Simard and Pierre Isabelle. Phrase-based machine translation in a computer-assisted translation environment. In Proceedings of Machine Translation Summit XII: Papers, MTSummit 2009, Ottawa, Canada, August 26-30, 2009, 2009.
|
| 302 |
+
|
| 303 |
+
[81] Yiping Song, Rui Yan, Xiang Li, Dongyan Zhao, and Ming Zhang. Two are better than one: An ensemble of retrieval- and generation-based dialog systems. CoRR, 2016.
|
| 304 |
+
|
| 305 |
+
[82] Ralf Steinberger, Bruno Pouliquen, Anna Widiger, Camelia Ignat, Tomaz Erjavec, Dan Tufis, and Dániel Varga. The jrc-acquis: A multilingual aligned parallel corpus with $^ { 2 0 + }$ languages. In Proc. of LREC, 2006.
|
| 306 |
+
|
| 307 |
+
[83] Yixuan Su, David Vandyke, Simon Baker, Yan Wang, and Nigel Collier. Keep the primary, rewrite the secondary: A two-stage approach for paraphrase generation. In Proc. of ACL Findings, 2021.
|
| 308 |
+
|
| 309 |
+
[84] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Proc. of NeurIPS, 2017.
|
| 310 |
+
|
| 311 |
+
[85] David Vilar, Markus Freitag, Colin Cherry, Jiaming Luo, Viresh Ratnakar, and George Foster. Prompting palm for translation: Assessing strategies and performance, 2023.
|
| 312 |
+
|
| 313 |
+
[86] Oriol Vinyals and Quoc V. Le. A neural conversational model. CoRR, 2015.
|
| 314 |
+
|
| 315 |
+
[87] Shuohang Wang, Yichong Xu, Yuwei Fang, Yang Liu, Siqi Sun, Ruochen Xu, Chenguang Zhu, and Michael Zeng. Training data is more valuable than you think: A simple and effective method by retrieving from training data. In Proc. of ACL, 2022.
|
| 316 |
+
|
| 317 |
+
[88] Yuguang Wang, Shanbo Cheng, Liyang Jiang, Jiajun Yang, Wei Chen, Muze Li, Lin Shi, Yanfeng Wang, and Hongtao Yang. Sogou neural machine translation systems for WMT17. In Proceedings of the Second Conference on Machine Translation, WMT 2017, Copenhagen, Denmark, September 7-8, 2017, 2017.
|
| 318 |
+
|
| 319 |
+
[89] Jason Weston, Emily Dinan, and Alexander H. Miller. Retrieve and refine: Improved sequence generation models for dialogue. In Proceedings of the 2nd International Workshop on SearchOriented Conversational AI, SCAI@EMNLP 2018, Brussels, Belgium, October 31, 2018, 2018.
|
| 320 |
+
|
| 321 |
+
[90] Wenhao Wu, Wei Li, Xinyan Xiao, Jiachen Liu, Ziqiang Cao, Sujian Li, Hua Wu, and Haifeng Wang. BASS: boosting abstractive summarization with unified semantic graph. In Proc. of ACL, 2021.
|
| 322 |
+
|
| 323 |
+
[91] Yu Wu, Furu Wei, Shaohan Huang, Yunli Wang, Zhoujun Li, and Ming Zhou. Response generation by context-aware prototype editing. In Proc. of AAAI, 2019.
|
| 324 |
+
|
| 325 |
+
[92] Mengzhou Xia, Guoping Huang, Lemao Liu, and Shuming Shi. Graph based translation memory for neural machine translation. In Proc. of AAAI, 2019.
|
| 326 |
+
|
| 327 |
+
[93] Jitao Xu, Josep Maria Crego, and Jean Senellart. Boosting neural machine translation with similar translations. In Proc. of ACL, 2020.
|
| 328 |
+
|
| 329 |
+
[94] Masaru Yamada. The effect of translation memory databases on productivity. Translation research projects, 2011.
|
| 330 |
+
|
| 331 |
+
[95] Michihiro Yasunaga, Armen Aghajanyan, Weijia Shi, Rich James, Jure Leskovec, Percy Liang, Mike Lewis, Luke Zettlemoyer, and Wen-tau Yih. Retrieval-augmented multimodal language modeling. CoRR, 2022.
|
| 332 |
+
|
| 333 |
+
[96] Dani Yogatama, Cyprien de Masson d’Autume, and Lingpeng Kong. Adaptive semiparametric language models. Trans. Assoc. Comput. Linguistics, 2021.
|
| 334 |
+
|
| 335 |
+
[97] Wenhao Yu, Dan Iter, Shuohang Wang, Yichong Xu, Mingxuan Ju, Soumya Sanyal, Chenguang Zhu, Michael Zeng, and Meng Jiang. Generate rather than retrieve: Large language models are strong context generators, 2023.
|
| 336 |
+
|
| 337 |
+
[98] Manzil Zaheer, Guru Guruganesh, Kumar Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, and Amr Ahmed. Big bird: Transformers for longer sequences. In Proc. of NeurIPS, 2020.
|
| 338 |
+
|
| 339 |
+
[99] Yury Zemlyanskiy, Michiel de Jong, Joshua Ainslie, Panupong Pasupat, Peter Shaw, Linlu Qiu, Sumit Sanghai, and Fei Sha. Generate-and-retrieve: Use your predictions to improve retrieval for semantic parsing. In Proceedings of the 29th International Conference on Computational Linguistics, pages 4946–4951, Gyeongju, Republic of Korea, October 2022. International Committee on Computational Linguistics.
|
| 340 |
+
|
| 341 |
+
[100] Jingqing Zhang, Yao Zhao, Mohammad Saleh, and Peter J. Liu. PEGASUS: pre-training with extracted gap-sentences for abstractive summarization. In Proc. of ICML, 2020.
|
| 342 |
+
|
| 343 |
+
[101] Jingyi Zhang, Masao Utiyama, Eiichiro Sumita, Graham Neubig, and Satoshi Nakamura. Guiding neural machine translation with retrieved translation pieces. In Proc. of NAACL, 2018.
|
| 344 |
+
|
| 345 |
+
[102] Tong Zhang, Wei Ye, Baosong Yang, Long Zhang, Xingzhang Ren, Dayiheng Liu, Jinan Sun, Shikun Zhang, Haibo Zhang, and Wen Zhao. Frequency-aware contrastive learning for neural machine translation. In Proc. of AAAI, 2022.
|
| 346 |
+
|
| 347 |
+
[103] Xueliang Zhao, Lemao Liu, Tingchen Fu, Shuming Shi, Dongyan Zhao, and Rui Yan. Towards efficient dialogue pre-training with transferable and interpretable latent structure. CoRR, 2022.
|
| 348 |
+
|
| 349 |
+
[104] Yinhe Zheng, Zikai Chen, Rongsheng Zhang, Shilei Huang, Xiaoxi Mao, and Minlie Huang. Stylized dialogue response generation using stylized unpaired texts. In Proc. of AAAI, 2021.
|
| 350 |
+
|
| 351 |
+
[105] Zexuan Zhong, Tao Lei, and Danqi Chen. Training language models with memory augmentation. CoRR, 2022.
|
| 352 |
+
|
| 353 |
+
# A Dataset Details
|
| 354 |
+
|
| 355 |
+
Table 7: Dataset statistics for three tasks.
|
| 356 |
+
|
| 357 |
+
<table><tr><td>Task</td><td>Dataset</td><td>#Train</td><td>#Dev</td><td>#Test</td></tr><tr><td rowspan="2">Translation</td><td>JRC (en ←→ de)</td><td>663,487</td><td>2,454</td><td>2,483</td></tr><tr><td>JRC (en ←→ es)</td><td>653,127</td><td>2,533</td><td>2,596</td></tr><tr><td rowspan="2">Summarization</td><td>BigPatent</td><td>1,207,222</td><td>67,068</td><td>67,072</td></tr><tr><td>XSum</td><td>204,045</td><td>11,332</td><td>11,334</td></tr><tr><td>Dialogue</td><td>DailyDialog</td><td>87,170</td><td>8,069</td><td>7,740</td></tr></table>
|
| 358 |
+
|
| 359 |
+
# B Self Memory Details
|
| 360 |
+
|
| 361 |
+
For machine translation tasks, following [93, 8, 17] we use randomly initialize Transformerbase architecture [84] as $G _ { \xi }$ . We use the joint-bpe algorithm [72] and share the parameters between the memory encoder and source encoder for dual encoder architecture. The hyper-parameter setting follows [17] with dropout 0.1, label smoothing 0.1, gradient clipping 1.0, Adafactor [74], warm-up steps 4000, maximum learning rate $4 . 4 \mathrm { e } { - 2 }$ and training epochs 30 for total. The evaluation metrics are BLEU, TER and ${ \mathrm { c h r F } } + +$ from SACREBLEU [66]. The backbone of memory selector $S _ { \theta }$ is XLM- $. { \bf R } _ { b a s e }$ [22] with BLEU as $\Delta ( \cdot , \cdot )$ . The hyper-parameter setting for $S _ { \theta }$ follows [39] with $\tau 0 . 5$ , minmax normalization for candidates ranking, Adam optimizer with max learning rate 5e-5 and polynomial decay scheduler, and classifier dropout 0.2.
|
| 362 |
+
|
| 363 |
+
For Summarization, we init the $G _ { \xi }$ with $\mathbf { B A R T _ { b a s e } }$ [40] for BigPatent following [87] and state-of-theart BRIO [55] for XSum. Optimization is based on Adafactor with a maximum learning rate of 5e-3, warm-up steps 10000 and gradient clipping value 1.0. The maximum input length is 512 for XSum and 1024 for BigPatent. The evaluation metric is Rouge (R-1/2/L) [47].
|
| 364 |
+
|
| 365 |
+
For Dialogue Generation, we use $\mathbf { B A R T _ { b a s e } }$ as the backbone for $G _ { \xi }$ on DailyDialog. We tune the hyper-parameters from learning rate $\{ 5 \mathrm { e } { - } 3 , 1 \mathrm { e } { - } 3 , 4 \mathrm { e } { - } 4 \}$ and set dropout 0.1, batch size 64, label smoothing factor 0.1, maximum input length 120 for DailyDialog. Following [4, 13], we evaluate our dialogue system with BLEU (B-1/2) and Distinct (D-1,2) [43]. For both Summarization and Dialogue Generation task, we follow [54, 26] and adopt $\mathrm { R o B E R T a _ { b a s e } }$ [52] as the backbone for $S _ { \theta }$ . We choose the linear combination of B-1/2 as $\Delta ( \cdot , \cdot )$ for Dialogue Generation and R-1/2/L for Summarization following [76]. We tune the hyper-parameters $\tau$ from $\{ 0 . 0 8 , 0 . 2 , 0 . 5 , 0 . 8 \}$ , learning rate from {5e-5,7e-5,2e-4}. The maximum input length for $S _ { \theta }$ is 512 and we truncate tokens from the longer input of source and candidate.
|
| 366 |
+
|
| 367 |
+
# C Evaluation Details
|
| 368 |
+
|
| 369 |
+
Machine Translation We evaluate our MT system with BLEU, TER and ${ \mathrm { c h r F } } + +$ from SACREBLEU3 [66]. The signatures for BLEU, TER and ${ \mathrm { c h r F } } + +$ are shown in Table 8.
|
| 370 |
+
|
| 371 |
+
Table 8: Signature from SACREBLEU.
|
| 372 |
+
|
| 373 |
+
<table><tr><td>[c]Signature</td></tr><tr><td>nrefs:1lcase:mixedleff:noltok:13alsmooth:explversion:2.0.0</td></tr><tr><td>nrefs:1lcase:lcltok:tercomlnorm:nolpunct:yeslasian:nolversion:2.0.0</td></tr><tr><td>nrefs:1lcase:mixedleff:yeslnc:6lnw:2lspace:nolversion:2.0.0</td></tr></table>
|
| 374 |
+
|
| 375 |
+
Summarization We evaluate our Summarization system with standard ROUGE [47] Perl package4 for evaluation. Following [55], we use PTB tokenizer5 for tokenization. And the parameters for ROUGE are " $\mathsf { \Pi } _ { - \mathrm { c } } ^ { \prime } 9 5 \mathsf { \Pi } _ { - \mathrm { r } } 1 0 0 0 \mathsf { \Pi } _ { - \mathrm { n } } 2 \mathsf { \Pi } _ { - \mathrm { m } } \mathsf { " }$ .
|
| 376 |
+
|
| 377 |
+
Dialogue Generation Following [27], we evaluate our dialogue system with NLTK BLEU 6 with space as tokenizer and smoothing method1. The Distinction score is from [42].
|
| 378 |
+
|
| 379 |
+
# D More results on translation tasks
|
| 380 |
+
|
| 381 |
+
Table 9: Evaluation results on JRC-Acquis En De measured by BLEU, TER and ${ \mathrm { c h r F } } + +$
|
| 382 |
+
|
| 383 |
+
<table><tr><td>System</td><td>Memory</td><td>BLEU 个</td><td>chrF++ 个</td><td>TER</td></tr><tr><td>Transformer</td><td>None</td><td>55.43</td><td>70.31</td><td>36.35</td></tr><tr><td>Transformerdual</td><td>Retrieval</td><td>58.06</td><td>71.58</td><td>35.41</td></tr><tr><td>Transformerjoint</td><td>Retrieval</td><td>58.58</td><td>72.22</td><td>34.39</td></tr><tr><td>Transformerdual</td><td>Self</td><td>59.49</td><td>72.62</td><td>34.04</td></tr><tr><td>Transformerjoint</td><td>Self</td><td>60.11</td><td>73.25</td><td>32.62</td></tr></table>
|
| 384 |
+
|
| 385 |
+
# E More Summarization Baselines
|
| 386 |
+
|
| 387 |
+
In this Table 10, we include more baselines on the benchmark dataset XSum and BigPatent. We also report the confidence region of SOTA model for XSum and BigPatent as shown in Table 11.
|
| 388 |
+
|
| 389 |
+
Table 10: More baselines on XSum and BigPatent.
|
| 390 |
+
|
| 391 |
+
<table><tr><td>System</td><td>R-1</td><td>R-2</td><td>R-L</td></tr><tr><td></td><td>XSum</td><td></td><td></td></tr><tr><td>[51]</td><td>38.8</td><td>16.5</td><td>31.3 37.3</td></tr><tr><td>[40]</td><td>45.1</td><td>22.3</td><td>39.3</td></tr><tr><td>[100]</td><td>47.2</td><td>24.6</td><td>39.4</td></tr><tr><td>[54] [55]</td><td>47.6 49.1</td><td>24.6</td><td>40.4</td></tr><tr><td>[87](PG)</td><td>48.2</td><td>25.6</td><td>40.2</td></tr><tr><td>[87](B)</td><td>43.1</td><td>26.0</td><td>35.5</td></tr><tr><td></td><td></td><td>21.0</td><td>38.6</td></tr><tr><td>[87](L)</td><td>46.5</td><td>24.1</td><td>40.0</td></tr><tr><td>[68]</td><td>48.1</td><td>25.0</td><td>38.8</td></tr><tr><td>[69]</td><td>47.1</td><td>24.1</td><td></td></tr><tr><td>[16]</td><td>47.8</td><td>25.0</td><td>39.7</td></tr><tr><td>Selfmem</td><td>50.3</td><td>26.7</td><td>41.6</td></tr></table>
|
| 392 |
+
|
| 393 |
+
<table><tr><td> System</td><td>R-1 R-2</td><td>R-L</td></tr><tr><td></td><td>BigPatent</td><td></td></tr><tr><td>[100]</td><td>53.6 33.1</td><td>42.3</td></tr><tr><td>[40] 44.4</td><td>21.3</td><td>31.0</td></tr><tr><td>[98] 60.6</td><td>42.5</td><td>50.0</td></tr><tr><td>[65]</td><td>38.7 12.3</td><td>34.1</td></tr><tr><td>[90] 45.0</td><td>20.3</td><td>39.2</td></tr><tr><td>[1] 52.3</td><td>33.5</td><td>42.8</td></tr><tr><td>[87] (B) 59.5</td><td>42.6</td><td>50.6</td></tr><tr><td>[87] (L) 60.7</td><td>43.3</td><td>51.3</td></tr><tr><td>[87] (PG) 44.6</td><td>21.5</td><td>33.3</td></tr><tr><td>Selfmem</td><td>62.9 48.1</td><td>59.6</td></tr></table>
|
| 394 |
+
|
| 395 |
+
# F Empirical analysis of latency
|
| 396 |
+
|
| 397 |
+
In Table 12, we present empirical results of Selfmem latency, measured in seconds. We compare Selfmem with a retrieval-augmented baseline model across various datasets and computational platforms, including CPU and CUDA. The number of iterations for Selfmem is set to one. All experiments are conducted on the same device, equipped with one NVIDIA A100 GPU and one AMD EPYC 7V13 64-Core Processor.
|
| 398 |
+
|
| 399 |
+
Table 11: Confidence region for SOTA model in XSum and BigPatent.
|
| 400 |
+
|
| 401 |
+
<table><tr><td> System</td><td>ROUGE-1/2/L</td><td>95 % -conf.int</td></tr><tr><td></td><td>XSum</td><td></td></tr><tr><td rowspan="4">BRIOjoint</td><td>50.3</td><td>0.49986 - 0.50602</td></tr><tr><td>26.7</td><td>0.26300 - 0.26989</td></tr><tr><td>41.6</td><td>0.41231 - 0.41900</td></tr><tr><td>BigPatent</td><td></td></tr><tr><td rowspan="3">BARTjoint</td><td>62.9</td><td>0.62664 - 0.63080</td></tr><tr><td>48.1</td><td>0.47783 - 0.48333</td></tr><tr><td>59.6</td><td>0.59401 - 0.59847</td></tr></table>
|
| 402 |
+
|
| 403 |
+
Table 12: Generation Latency analysis.
|
| 404 |
+
|
| 405 |
+
<table><tr><td colspan="2"></td><td>NMT</td><td> XSum</td><td>BigPatent</td><td>DailyDialog</td></tr><tr><td colspan="2">Average Input Length</td><td>87</td><td>512</td><td>1024</td><td>71</td></tr><tr><td colspan="2">Average :Output Length</td><td>44</td><td>75</td><td>127</td><td>16</td></tr><tr><td colspan="2">Retrieval-augmented Baseline</td><td>CPU 0.97</td><td>1.79</td><td>3.16</td><td>0.32</td></tr><tr><td rowspan="5">Selfmem</td><td>Candidate Generation Memory</td><td>3.20</td><td>7.50</td><td>15.00</td><td>1.02</td></tr><tr><td>Selection</td><td>0.50</td><td>0.52</td><td>0.95</td><td>0.14</td></tr><tr><td>Hypothesis Generation</td><td>0.97</td><td>1.79</td><td>3.00</td><td>0.32</td></tr><tr><td>×4.80</td><td></td><td>×5.47</td><td>×6.04</td><td>×4.63</td></tr><tr><td colspan="2">CUDA</td><td></td><td></td><td></td></tr><tr><td colspan="2">Retrieval-augmented Baseline</td><td>0.29</td><td>0.44</td><td>0.75</td><td>0.10</td></tr><tr><td rowspan="3">Selfmem</td><td>Candidate Generation Memory Hypothesis Generation</td><td>0.51</td><td>1.00</td><td>1.72</td><td>0.18</td></tr><tr><td>Selection</td><td>0.01</td><td>0.01</td><td>0.01</td><td>0.01</td></tr><tr><td>0.29 ×2.76</td><td></td><td>0.44 ×2.99</td><td>0.75 ×3.35</td><td>0.10 ×2.91</td></tr></table>
|
| 406 |
+
|
| 407 |
+
# G Human and GPT-4 Evaluation
|
| 408 |
+
|
| 409 |
+
We employ both human annotators and GPT-4 (gpt-4-0314) annotators to perform pairwise ranking of the output generated by Selfmem and baseline systems. For GPT-4 annotators, we utilize the prompt from Alpaca Eval 7. We randomly select 50 samples for translation tasks and 20 samples for summarization and dialogue tasks. The win rate of Selfmem versus retrieval-augmented baselines is depicted in Figure 1.
|
| 410 |
+
|
| 411 |
+

|
| 412 |
+
Figure 5: Human and GPT-4 evaluation results.
|
md/dev/ldRb12nMfLQ/ldRb12nMfLQ.md
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# A DEEP CONJUGATE DIRECTION METHOD FOR ITERATIVELY SOLVING LINEAR SYSTEMS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
We present a novel deep learning approach to approximate the solution of large, sparse, symmetric, positive-definite linear systems of equations. These systems arise from many problems in applied science, e.g., in numerical methods for partial differential equations. Algorithms for approximating the solution to these systems are often the bottleneck in problems that require their solution, particularly for modern applications that require many millions of unknowns. Indeed, numerical linear algebra techniques have been investigated for many decades to alleviate this computational burden. Recently, data-driven techniques have also shown promise for these problems. Motivated by the conjugate gradients algorithm that iteratively selects search directions for minimizing the matrix norm of the approximation error, we design an approach that utilizes a deep neural network to accelerate convergence via data-driven improvement of the search directions. Our method leverages a carefully chosen convolutional network to approximate the action of the inverse of the linear operator up to an arbitrary constant. We train the network using unsupervised learning with a loss function equal to the $L ^ { 2 }$ difference between an input and the system matrix times the network evaluation, where the unspecified constant in the approximate inverse is accounted for. We demonstrate the efficacy of our approach on spatially discretized Poisson equations with millions of degrees of freedom arising in computational fluid dynamics applications. Unlike state-of-the-art learning approaches, our algorithm is capable of reducing the linear system residual to a given tolerance in a small number of iterations, independent of the problem size. Moreover, our method generalizes effectively to various systems beyond those encountered during training.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
In this work, we consider sparse linear systems that arise from discrete Poisson equations in incompressible flow applications (Chorin, 1967; Fedkiw et al., 2001; Bridson, 2008). We use the notation
|
| 12 |
+
|
| 13 |
+
$$
|
| 14 |
+
\mathbf { A } { \boldsymbol { \mathbf { \mathit { x } } } } = \mathbf { \mathit { b } }
|
| 15 |
+
$$
|
| 16 |
+
|
| 17 |
+
where the dimension $n$ of the matrix $A \in \mathbb { R } ^ { n \times n }$ and the vector $b \in \mathbb { R } ^ { n }$ correlate with spatial fidelity of the computational domain. The appropriate numerical linear algebra technique depends on the nature of the problem. Direct solvers that utilize matrix factorizations (QR, Cholesky, etc. Trefethen & Bau (1997)) have optimal approximation error, but their computational cost is $\operatorname { \dot { O } } ( n ^ { 3 } )$ and they typically require dense storage, even for sparse $\pmb { A }$ . Although Fast Fourier Transforms (Nussbaumer, 1981) can be used in limited instances (periodic boundary conditions, etc.), iterative techniques are most commonly adopted for these systems given their sparsity. Many applications with strict performance constraints (e.g., real-time fluid simulation) utilize basic iterations (Jacobi, Gauss-Seidel, successive over relaxation (SOR), etc.) given limited computational budget (Saad, 2003). However, large approximation errors must be tolerated since iteration counts are limited by the performance constraints. This is particularly problematic since the wide elliptic spectrum of these matrices (a condition that worsens with increased spatial fidelity/matrix dimension) leads to poor conditioning and iteration counts. Iterative techniques can achieve sub-quadratic convergence if their iteration count does not grow excessively with problem size $n$ since each iteration generally requires $O ( n )$ floating point operations for sparse matrices. Discrete elliptic operators are typically symmetric positive (semi) definite and the preconditioned conjugate gradients method (PCG) can be used to minimize iteration counts (Saad, 2003; Hestenes & Stiefel, 1952; Stiefel, 1952). Preconditioners $_ { r }$ for PCG must simultaneously: be symmetric positive definite (SPD) (and therefore admit factorization ${ \boldsymbol { P } } = { \boldsymbol { F } } ^ { 2 }$ ), improve the condition number of the preconditioned system $F A F y = F b$ , and be computationally cheap to construct and apply; accordingly, designing specialized preconditioners for particular classes of problems is somewhat of an art. Incomplete Cholesky preconditioners (ICPCG) (Kershaw, 1978) use a sparse approximation to the Cholesky factorization and significantly reduce iteration counts in practice; however, their inherent data dependency prevents efficient parallel implementation. Nonetheless, these are very commonly adopted for Poisson equations arising in incompressible flow (Fedkiw et al., 2001; Bridson, 2008). Multigrid (Brandt, 1977) and domain decomposition (Saad, 2003) preconditioners greatly reduce iterations counts, but they must be updated (with non-trivial cost) each time the problem changes (e.g., in computational domains with time varying boundaries) and/or for different hardware platforms. In general, choice of an optimal preconditioner for discrete elliptic operators is an open area of research.
|
| 18 |
+
|
| 19 |
+
Recently, data-driven approaches that leverage deep learning techniques have shown promise for solving linear systems. Various researchers have investigated machine learning estimation of multigrid parameters (Greenfeld et al., 2019; Grebhahn et al., 2016; Luz et al., 2020). Others have developed machine learning methods to estimate preconditioners (Gotz & Anzt, 2018; Stanaityte, 2020; ¨ Ichimura et al., 2020) and initial guesses for iterative methods (Luna et al., 2021; Um et al., 2020; Ackmann et al., 2020). Tompson et al. (2017) and Yang et al. (2016) develop non-iterative machine learning approximations of the inverse of discrete Poisson equations from incompressible flow. We leverage deep learning and develop a novel version of conjugate gradients iterative method for approximating the solution of SPD linear systems which we call the deep conjugate direction method (DCDM). CG iteratively adds $\pmb { A }$ -conjugate search directions while minimizing the matrix norm of the error. We use a convolutional neural network (CNN) as an approximation of the inverse of the matrix in order to generate more efficient search directions. We only ask that our network approximate the inverse up to an unknown scaling since this decreases the degree of nonlinearity and since it does not affect the quality of the search direction (which is scale independent). The network is similar to a preconditioner, but it is not a linear function, and our modified conjugate gradients approach is designed to accommodate this nonlinearity. We use unsupervised learning to train our network with a loss function equal to the $L ^ { 2 }$ difference between an input vector and a scaling of $\pmb { A }$ times the output of our network. To account for this unknown scaling during training, we choose the scale of the output of the network by minimizing the matrix norm of the error. Our approach allows for efficient training and generalization to problems unseen (matrices $\pmb { A }$ and right-hand sides $^ { b }$ ). We benchmark our algorithm using the ubiquitous pressure Poisson equation (discretized on regular voxelized domains) and compare against FluidNet (Tompson et al., 2017), which is the state of the art learning-based method for these types of problems. Unlike the non-iterative approaches of Tompson et al. (2017) and Yang et al. (2016), our method can reduce the linear system residuals arbitrarily. We showcase our approach with examples that have over 16 million degrees of freedom.
|
| 20 |
+
|
| 21 |
+
# 2 RELATED WORK
|
| 22 |
+
|
| 23 |
+
Several papers have focused on enhancing the solution of linear systems (arising from discretized PDEs) using learning. For instance, Gotz & Anzt (2018) generate sparsity patterns for block-Jacobi ¨ preconditioners using convolutional neural networks, and Stanaityte (2020) use a CNN to predict non-zero patterns for ILU-type preconditioners for the Navier-Stokes equations (though neither work designs fundamentally new preconditioners). Ichimura et al. (2020) develop a neural-network based preconditioner where the network is used to predict approximate Green’s functions (which arise in the analytical solution of certain PDEs) that in turn yield an approximate inverse of the linear system. Hsieh et al. (2019) learn an iterator that solves linear systems, performing competitively with classical solvers like multigrid-preconditioned MINRES (Paige & Saunders, 1975). Luz et al. (2020) and Greenfeld et al. (2019) use machine learning to estimate algebraic multigrid (AMG) parameters. They note that AMG approaches rely most fundamentally on effectively chosen (problem-dependent) prolongation sparse matrices and that numerous methods have attempted to automatically create them from the matrix $\pmb { A }$ . They train a graph neural network to learn (in an unsupervised fashion) a mapping from matrices $\pmb { A }$ to prolongation operators. Grebhahn et al. (2016) note that geometric multigrid solver parameters can be difficult to choose to guarantee parallel performance on different hardware platforms. They use machine learning to create a code generator to help achieve this.
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
Figure 1: (a) We illustrate a sample flow domain $\Omega \subset ( 0 , 1 ) ^ { 2 }$ (in 2D for ease of illustration) with internal boundaries (blue lines). (b) We voxelize the domain with a regular grid: white cells represent interior/fluid, and blue cells represent boundary conditions. (c) We train using matrix $A ^ { ( 0 , 1 ) ^ { d } }$ from a discretized domain with no interior boundary conditions, where $d$ is the dimension. This creates linear system with $n = ( n _ { c } + 1 ) ^ { d }$ unknowns where $n _ { c }$ is the number of grid cells on each direction. (d) We illustrate the non-zero entries in an example matrix $A ^ { \Omega }$ from the voxelized and labeled (white vs. blue) grid for three example interior cells (green, purple, and brown). Each case illustrates the non-zero entries in the row associated with the example cell. All entries in rows corresponding to boundary/blue cells are zero.
|
| 27 |
+
|
| 28 |
+
Several works consider accelerating the solution of linear systems by learning an initial guess that is close to the true solution or otherwise helpful to descent algorithms for finding the true solution. In order to solve the discretized Poisson equation, Luna et al. (2021) accelerate the convergence of GMRES (Saad & Schultz, 1986) with an initial guess that is learned in real-time (i.e., as a simulation code runs) with no prior data. Um et al. (2020) train a network (incorporating differentiable physics, based on the underlying PDEs) in order to produce high-quality initial guesses for a CG solver. In a somewhat similar vein, Ackmann et al. (2020) use a simple feedforward neural network to predict pointwise solution components, which accelerates the conjugate residual method used to solve a relatively simple shallow-water model (a more sophisticated network and loss function are needed to handle more general PDEs and larger-scale problems).
|
| 29 |
+
|
| 30 |
+
At least two papers (Ruelmann et al., 2018; Sappl et al., 2019) have sought to learn a mapping between a matrix and an associated sparse approximate inverse. In their investigation, Ruelmann et al. (2018) propose training a neural network using matrix-inverse pairs as training data. Although straightforward to implement, the cost of generating training data, let alone training the network, is prohibitive for large-scale 3D problems. Sappl et al. (2019) seek to learn a mapping between linear system matrices and sparse (banded) approximate inverses. Their loss function is the condition number of the product of the system matrix and the approximate inverse; the minimum value of the condition number is one, which is achieved exactly when an exact inverse is obtained. Although this framework is quite simple, evaluating the condition number of a matrix is asymptotically costly, and in general, the inverse of a sparse matrix can be quite dense. Accordingly, the method is not efficient or accurate enough for the large-scale 3D problems that arise in real-world engineering problems.
|
| 31 |
+
|
| 32 |
+
Most relevant to the present work is FluidNet (Tompson et al., 2017). FluidNet develops a highlytailored CNN architecture that is used to predict the solution of a linear projection operation (specifically, for the discrete Poisson equation) given a matrix and right-hand side. The authors demonstrate fluid simulations where the linear solve is replaced by evaluating their network. Because their network is relatively lightweight and is only evaluated once per time step, their simulations run efficiently. However, their design allows the network only one opportunity to reduce the residual for the linear solve; in practice, we observe that FluidNet is able to reduce the residual by no more than about one order of magnitude. However, in computer graphics applications, at least four orders of magnitude in residual reduction are usually required for visual fidelity, while in scientific and engineering applications, practitioners prefer solutions that reduce the residual by eight or more orders of magnitude (i.e., to within machine precision). Accordingly, FluidNet’s lack of convergence stands in stark contrast to classical, convergent methods like CG. Our method resolves this gap.
|
| 33 |
+
|
| 34 |
+
# 3 MOTIVATION: INCOMPRESSIBLE FLOW
|
| 35 |
+
|
| 36 |
+
We demonstrate the efficacy of our approach with the linear systems that arise in incompressible flow applications. Specifically, we use our algorithm to solve the discrete Poisson equations in
|
| 37 |
+
|
| 38 |
+
regular-grid-based discretization of the pressure projection equations that arise in Chorin’s splitting technique (Chorin, 1967) for the inviscid, incompressible Euler equations. These equations are
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
\rho \left( \frac { \partial \pmb { u } } { \partial t } + \frac { \partial \pmb { u } } { \partial \pmb { x } } \pmb { u } \right) + \nabla p = \pmb { f } ^ { e x t } , \qquad \nabla \cdot \pmb { u } = 0
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
where $\textbf { \em u }$ is fluid velocity, $p$ is pressure, $\rho$ is density, and $f ^ { e x t }$ accounts for external forces like gravity. The equations are assumed at all positions $_ { \textbf { \em x } }$ in the spatial fluid flow domain $\Omega$ and for time $t > 0$ . The left term in Equation 2 enforces conservation of momentum in the absence of viscosity, and the second part enforces incompressibility and conservation of mass. These equations are subject to initial conditions $\rho ( \pmb { x } , 0 ) = \rho ^ { 0 }$ and ${ \pmb u } ( { \pmb x } , 0 ) = { \pmb u } ^ { 0 } ( { \pmb x } )$ as well as boundary conditions ${ \pmb u } ( { \pmb x } , t ) \cdot { \pmb n } ( { \pmb x } ) = u ^ { \partial \Omega } ( { \pmb x } , t )$ on the boundary of the domain ${ \pmb x } \in \partial \Omega$ (where $\textbf { \em n }$ is the unit outward pointing normal at position $_ { \textbf { \em x } }$ on the boundary). Equation 2 is discretized in both time and space. Temporally, we split the advection $\frac { \partial \pmb { u } } { \partial t } + \frac { \partial \pmb { u } } { \partial \pmb { x } } \pmb { u } = 0$ and body forces terms $\rho \frac { \partial \pmb { u } } { \partial t } = \pmb { f } ^ { e x t }$ , and finally enforce incompressibility via the pressure projection $\frac { \partial \pmb { u } } { \partial t } + \frac { 1 } { \rho } \nabla p = \pmb { 0 }$ such that $\nabla \cdot \pmb { u } = 0$ ; this is the standard advection-projection scheme proposed by Chorin (1967). Using finite differences in time, we can summarize this as
|
| 45 |
+
|
| 46 |
+
$$
|
| 47 |
+
\begin{array} { l } { \displaystyle \rho ^ { 0 } \left( \frac { \pmb { u } ^ { * } - \pmb { u } ^ { n } } { \Delta t } + \frac { \partial \pmb { u } ^ { n } } { \partial \pmb { x } } \pmb { u } ^ { n } \right) = \pmb { f } ^ { e x t } } \\ { \displaystyle - \nabla \cdot \frac { 1 } { \rho ^ { 0 } } \nabla p ^ { n + 1 } = - \nabla \cdot \pmb { u } ^ { * } } \\ { \displaystyle \qquad - \frac { 1 } { \rho ^ { 0 } } \nabla p ^ { n + 1 } \cdot \pmb { n } = \frac { 1 } { \Delta t } \left( \pmb { u } ^ { \partial \Omega } - \pmb { u } ^ { * } \cdot \pmb { n } \right) . } \end{array}
|
| 48 |
+
$$
|
| 49 |
+
|
| 50 |
+
For the spatial discretization, we use a regular marker-and-cell (MAC) grid (Harlow & Welch, 1965) with cubic voxels whereby velocity components are stored on the face of voxel cells, and scalar quantities (e.g., pressure $p$ or density $\rho \mathrm { \hbar }$ ) are stored at voxel centers. We use backward semiLagrangian advection (Fedkiw et al., 2001; Gagniere et al., 2020) for Equation 3. All spatial partial derivatives are approximated using finite differences. Equations 4 and 5 describe the pressure Poisson equation with Neumann conditions on the boundary of the flow domain. We discretize the left hand side of Equation 4 using a standard 7-point finite difference stencil. The right-hand side is discretized using the MAC grid discrete divergence finite difference stencils as well as contributions from the boundary condition terms in Equation 5. We refer the reader to Bridson (2008) for more in-depth implementation details. Equation 5 is discretized by modifying the Poisson stencil to enforce Neumann boundary conditions. We do this using a simple labeling of the voxels in the domain. For simplicity, we assume $\Omega \subset ( 0 , 1 ) ^ { 3 }$ is a subset of the unit cube, potentially with internal boundaries. We label cells in the domain as either liquid or boundary. This simple classification is enough to define the Poisson discretizations (with appropriate Neumann boundary conditions at domain boundaries) that we focus on in the present work; we illustrate the details in Figure 1. We use the following notation to denote the discrete Poisson equations associated with Equations 4–5:
|
| 51 |
+
|
| 52 |
+
$$
|
| 53 |
+
\begin{array} { r } { { \cal A } ^ { \Omega } { \boldsymbol x } = { \boldsymbol b } ^ { \nabla \cdot { \boldsymbol u } ^ { * } } + { \boldsymbol b } ^ { u ^ { \partial \Omega } } , } \end{array}
|
| 54 |
+
$$
|
| 55 |
+
|
| 56 |
+
where $A ^ { \Omega }$ is the discrete Poisson matrix associated with the voxelized domain, $_ { \textbf { \em x } }$ is the vector of unknown pressure, and $\mathbf { \delta } _ { b } \nabla \cdot \mathbf { u } ^ { * }$ and b u ∂ Ω are the right-hand side terms from Equations 4 and 5, respectively. We define a special case of the matrix involved in this discretization to be the Poisson matrix $A ^ { ( 0 , 1 ) ^ { 3 } }$ associated with $\Omega = ( 0 , 1 ) ^ { 3 }$ , i.e., a full fluid domain with no internal boundaries. We use this matrix for training, yet demonstrate that our network generalizes to all other matrices arising from more complicated flow domains.
|
| 57 |
+
|
| 58 |
+
# 4 DEEP CONJUGATE DIRECTION METHOD
|
| 59 |
+
|
| 60 |
+
We present our method for the deep learning acceleration of iterative approximations to the solution of linear systems of the form seen in Equation 6. We first discuss relevant details of the conjugate gradients (CG) method, particularly line search and $\pmb { A }$ -orthogonal search directions. We then present a deep learning technique for improving the quality of these search directions that ultimately reduces iteration counts required to achieve satisfactory residual reduction. Lastly, we outline the training procedures for our deep convolutional neural network.
|
| 61 |
+
|
| 62 |
+
Our approach iteratively improves approximations to the solution $_ { \textbf { \em x } }$ of Equation 6. We build on the method of CG, which requires the matrix $A ^ { \Omega }$ in Equation 6 to be SPD. SPD matrices $A ^ { \Omega }$ give rise to the matrix norm $\| \pmb { y } \| _ { A ^ { \Omega } } = \sqrt { \pmb { y } ^ { T } A ^ { \Omega } \pmb { y } }$ . CG can be derived in terms of iterative line search improvement based on optimality in this norm. That is, an iterate $\pmb { x } _ { k - 1 } \approx \pmb { x }$ is updated in search direction $\scriptstyle d _ { k }$ by a step size $\alpha _ { k }$ that is chosen to minimize the matrix norm of the error:
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\alpha _ { k } = \underset { \alpha } { \arg \operatorname* { m i n } } \frac { 1 } { 2 } \left\| \pmb { x } - ( \pmb { x } _ { k - 1 } + \alpha \pmb { d } _ { k } ) \right\| _ { \pmb { A } ^ { \Omega } } ^ { 2 } = \frac { { \pmb { r } } _ { k - 1 } ^ { T } { \pmb { d } _ { k } } } { { \pmb { d } } _ { k } ^ { T } { \pmb { A } } ^ { \Omega } { \pmb { d } _ { k } } } ,
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
where $\pmb { r } _ { k - 1 } = \pmb { b } - \pmb { A } ^ { \Omega } \pmb { x } _ { k - 1 }$ is the $( k - 1 ) ^ { \mathrm { t h } }$ residual and $^ { b }$ is the right-hand side in Equation 6. Different search directions result in different algorithms. A natural choice is the negative gradient of the matrix norm of the error (evaluated at the current iterate), since this will point in the direction of steepest decrease $\begin{array} { r } { \pmb { d } _ { k } = - \frac { 1 } { 2 } \nabla \left\| \pmb { x } _ { k - 1 } \right\| _ { \pmb { A } ^ { \Omega } } ^ { 2 } = \pmb { r } _ { k - 1 } } \end{array}$ . This is the gradient descent method (GD). Unfortunately, this approach requires many iterations in practice. A more effective strategy is to choose directions that are $\pmb { A }$ -orthogonal (i.e., ${ \bf \Phi } _ { { \bf i } } ^ { T } { \bf A } ^ { \Omega } { \bf d } _ { j } = \mathrm { ~ ~ \dot { ~ } { ~ 0 ~ } ~ }$ for $i \neq j$ ). With this choice, the search directions form a basis for $\mathbb { R } ^ { n }$ so that the initial error can be written as $\begin{array} { r } { \pmb { e } _ { 0 } = \pmb { x } - \pmb { x } _ { 0 } = \sum _ { i = 1 } ^ { n } e _ { i } \pmb { d } _ { i } } \end{array}$ , where $e _ { i }$ are the components of the initial error written in the basis. Furthermore, when the search directions are $\pmb { A }$ -orthogonal, the optimal step sizes $\alpha _ { k }$ at each iteration satisfy
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
\alpha _ { k } = \frac { r _ { k - 1 } ^ { T } d _ { k } } { d _ { k } ^ { T } A ^ { \Omega } d _ { k } } = \frac { d _ { k } ^ { T } A ^ { \Omega } e _ { k - 1 } } { d _ { k } ^ { T } A ^ { \Omega } d _ { k } } = \frac { d _ { k } ^ { T } A ^ { \Omega } \left( \sum _ { i = 1 } ^ { n } e _ { i } d _ { i } - \sum _ { j = 1 } ^ { k - 1 } \alpha _ { j } d _ { j } \right) } { d _ { k } ^ { T } A ^ { \Omega } d _ { k } } = e _ { k } .
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
That is, the optimal step sizes are chosen to precisely eliminate the components of the error on the basis defined by the search directions. Thus, convergence is determined by the (at most $n$ ) non-zero components $e _ { i }$ in the initial error. Although rounding errors prevent this from happening exactly in practice, this property greatly reduces the number of required iterations (Golub & Loan, 2012).
|
| 75 |
+
|
| 76 |
+
CG can be viewed as a modification of GD where the search direction is chosen as the component of the residual (equivalently, the negative gradient of the matrix norm of the error) that is $\pmb { A }$ -orthogonal to all previous search directions:
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\pmb { d } _ { k } = \pmb { r } _ { k - 1 } - \sum _ { i = 1 } ^ { k - 1 } h _ { i k } \pmb { d } _ { i } , \qquad h _ { i k } = \frac { { d } _ { i } ^ { T } { \pmb { A } } ^ { \Omega } \pmb { r } _ { k - 1 } } { { d } _ { i } ^ { T } { \pmb { A } } ^ { \Omega } \pmb { d } _ { i } } .
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
In practice, $h _ { i k } = 0$ for $i < k - 1$ , and this iteration can therefore be performed without the need to store all previous search directions $\mathbf { \mathbf { { \alpha } } } d _ { i }$ and without the need for computing all previous $h _ { i k }$ .
|
| 83 |
+
|
| 84 |
+
While the residual is a natural choice for generating $\pmb { A }$ -orthogonal search directions (since it points in the direction of the steepest local decrease), it is not the optimal search direction. If $\scriptstyle d _ { k }$ is parallel to $( A ^ { \Omega } ) ^ { - 1 } r _ { k - 1 }$ , then $\scriptstyle { \mathbf { { \mathit { x } } } } _ { k }$ will be equal to $_ { \textbf { \em x } }$ since $\alpha _ { k }$ (computed from Equation 7) will step directly to the solution. We can see this by considering the residual and its relation to the search direction:
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
\begin{array} { r } { r _ { k } = b - A ^ { \Omega } x _ { k } = b - A ^ { \Omega } x _ { k - 1 } - \alpha _ { k } A ^ { \Omega } d _ { k } = r _ { k - 1 } - \alpha _ { k } A ^ { \Omega } d _ { k } . } \end{array}
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
In light of this, we use deep learning to create an approximation $f ( c , r )$ to $( A ^ { \Omega } ) ^ { - 1 } r$ , where $^ c$ denotes the network weights and biases. This is analogous to using a preconditioner in PCG; however, our network is not SPD (nor even a linear function). We simply use this data-driven approach as our means of generating better search directions $\scriptstyle d _ { k }$ . Furthermore, we only need to approximate a vector parallel to $( A ^ { \Omega } ) ^ { - 1 } r$ since the step size $\alpha _ { k }$ will account for any scaling in practice. In other words, $f ( c , r ) \approx s _ { r } ( A ^ { \Omega } ) ^ { - 1 } r$ , where the scalar $s _ { r }$ is not defined globally; it only depends on $\pmb { r }$ , and the model does not learn it. Lastly, as with CG, we enforce $\pmb { A }$ -orthogonality, yielding search directions
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\pmb { d } _ { k } = \pmb { f } ( \pmb { c } , \pmb { r } _ { k - 1 } ) - \sum _ { i = 1 } ^ { k - 1 } h _ { i k } \pmb { d } _ { i } , \qquad h _ { i k } = \frac { \pmb { f } ( \pmb { c } , \pmb { r } _ { k - 1 } ) ^ { T } \pmb { A } ^ { \Omega } \pmb { d } _ { i } } { \pmb { d } _ { i } ^ { T } \pmb { A } ^ { \Omega } \pmb { d } _ { i } } .
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
We summarize our approach in Algorithm 1. Note that we introduce the variable $i _ { \mathrm { s t a r t } }$ . To guarantee $\pmb { A }$ -orthogonality between all search directions, we must have $i _ { \mathrm { s t a r t } } = 1$ . However, this requires storing all prior search directions, which can be costly. We found that using $i _ { \mathrm { s t a r t } } = k - 2$ worked nearly as well as $i _ { \mathrm { s t a r t } } = 1$ in practice (in terms of our ability to iteratively reduce the residual of the system). We demonstrate this in Figure 4c.
|
| 97 |
+
|
| 98 |
+
# 5 MODEL ARCHITECTURE, DATASETS, AND TRAINING
|
| 99 |
+
|
| 100 |
+
Efficient performance of our method requires effective training of our deep convolutional network for weights and biases $^ c$ such that $f ( c , r ) { \overset { \cdot } { \approx } } s _ { r } ( A ^ { \Omega } ) ^ { - 1 } r$ (for arbitrary scalar $s _ { r }$ ). We design a model architecture, loss function, and unsupervised training approach to achieve this. Our approach has modest training requirements and allows for effective residual reduction while generalizing well to problems not seen in the training data.
|
| 101 |
+
|
| 102 |
+
# 5.1 LOSS FUNCTION AND UNSUPERVISED LEARNING
|
| 103 |
+
|
| 104 |
+
Although we generalize to arbitrary matrices $A ^ { \Omega }$ from Equation 6 that correspond to domains $\Omega \subset ( 0 , 1 ) ^ { 3 }$ that have internal boundaries (see Figure 1), we train using just the matrix $A ^ { ( 0 , 1 ) ^ { 3 } }$ from the full cube domain $( 0 , 1 ) ^ { 3 }$ . In contrast, other similar approaches (Tompson et al., 2017; Yang et al., 2016) train using matrices $A ^ { \Omega }$ and right-hand sides $\pmb { b } ^ { \nabla \cdot \pmb { u } ^ { * } } + \overline { { \pmb { b } } } ^ { u ^ { \partial \Omega } }$ that arise from flow in many domains with internal boundaries. We train our network by minimiz
|
| 105 |
+
|
| 106 |
+
# Algorithm 1 DCDM
|
| 107 |
+
|
| 108 |
+
1: $\pmb { r } _ { 0 } = \pmb { b } - \pmb { A } ^ { \Omega } \pmb { x } _ { 0 }$
|
| 109 |
+
2: $k = 1$
|
| 110 |
+
3: while $\| r _ { k - 1 } \| \ge \epsilon$ do
|
| 111 |
+
4: dk = f (c, rk−1∥rk−1∥ )
|
| 112 |
+
5: for $i _ { \mathrm { s t a r t } } \le i < k$ do
|
| 113 |
+
6: hik = dT AΩdi dT AΩdi
|
| 114 |
+
7: dk-=hikdi
|
| 115 |
+
8: end for
|
| 116 |
+
9: $\begin{array} { r l } & { \alpha _ { k } = \frac { r _ { k - 1 } ^ { T } d _ { k } } { d _ { k } ^ { T } A ^ { \Omega } d _ { k } } } \\ & { x _ { k } = x _ { k - 1 } + \alpha _ { k } d _ { k } } \\ & { r _ { k } = b - A ^ { \Omega } x _ { k } } \\ & { k = k + 1 } \end{array}$
|
| 117 |
+
10:
|
| 118 |
+
11:
|
| 119 |
+
12:
|
| 120 |
+
13: end while
|
| 121 |
+
|
| 122 |
+
ing the L2 difference ∥r−αA(0,1)3 f (c, r)∥2, where α = rT f(c,r)f(c,r)T A(0,1)3 f(c,r) f rom Equation 7. This choice of $\alpha$ accounts for the unknown scaling in the approximation of $f ( c , r )$ to $\left( A ^ { ( 0 , 1 ) ^ { 3 } } \right) ^ { - 1 } r$ . We use an unsupervised approach and train the model by minimizing
|
| 123 |
+
|
| 124 |
+
$$
|
| 125 |
+
\begin{array} { r } { \mathrm { L o s s } ( \pmb { f } , \pmb { c } , \mathscr { D } ) = \frac { 1 } { | \mathscr { D } | } \sum _ { r \in \mathscr { D } } \| \pmb { r } - \frac { r ^ { T } f ( \pmb { c } , r ) } { \pmb { f } ( \pmb { c } , r ) ^ { T } \pmb { A } ^ { ( 0 , 1 ) ^ { 3 } } \pmb { f } ( \pmb { c } , r ) } \pmb { A } ^ { ( 0 , 1 ) ^ { 3 } } \pmb { f } ( \pmb { c } , r ) \| _ { 2 } } \end{array}
|
| 126 |
+
$$
|
| 127 |
+
|
| 128 |
+
for given dataset $\mathcal { D }$ consisting of training vectors $b ^ { i }$ . In Algorithm 1, the normalized residuals $\frac { \boldsymbol { r } _ { k } } { \| \boldsymbol { r } _ { k } \| }$ are passed as inputs to the model. Unlike in e.g. FluidNet (Tompson et al., 2017), only the first residual $\frac { r _ { 0 } } { \Vert r _ { 0 } \Vert }$ is directly related to the problem-dependent original right-hand side $^ { b }$ . Hence we consider a broader range of training vectors than those expected in a given problem of interest, e.g., incompressible flows. We observe that generally the residuals $\mathbf { \nabla } r _ { k }$ in Algorithm 1 are skewed to the lower end of the spectrum of the matrix $A ^ { \Omega }$ . Since $A ^ { \Omega }$ is a discretized elliptic operator, lower end modes are of lower frequency of spatial oscillation. We create our training vectors $\mathbf { \boldsymbol { b } } ^ { i } \in \mathcal { D }$ using $m \ll n$ approximate eigenvectors of the training matrix $A ^ { ( 0 , 1 ) ^ { 3 } }$ . We use the Rayleigh-Ritz method to create approximate eigenvectors $\pmb q _ { i }$ , $0 \leq i < m$ . This approach allows us to effectively approximate the full spectrum of $A ^ { ( 0 , 1 ) ^ { 3 } }$ without computing the full eigendecomposition, which can be expensive $( { \cal O } ( \bar { n } ^ { 3 } ) )$ at high resolution. We found that using $m \ : = \ : 1 0 0 0 0$ worked well in practice. The Rayleigh-Ritz vectors are orthonormal and satisfy $Q _ { m } ^ { T } A ^ { ( 0 , 1 ) ^ { 3 } } Q _ { m } = \Lambda _ { m }$ , where $\pmb { \Lambda } _ { m }$ is a diagonal matrix with nondecreasing diagonal entries $\lambda _ { i }$ referred to as Ritz values (approximate eigenvalues) and $\pmb { Q } _ { m } = [ \pmb { q } _ { 0 } , \pmb { q } _ { 1 } , \dots , \pmb { q } _ { m - 1 } ] \in \mathbb { R } ^ { n \times m }$ . We pick $\begin{array} { r } { \pmb { b } ^ { i } = \frac { \sum _ { j = 0 } ^ { m - 1 } c _ { j } ^ { i } \pmb { q } _ { j } } { \left\| \sum _ { j = 0 } ^ { m - 1 } c _ { j } ^ { i } \pmb { q } _ { j } \right\| } } \end{array}$ , where the coefficients $c _ { j } ^ { i }$ are picked from a standard normal distribution
|
| 129 |
+
|
| 130 |
+
$$
|
| 131 |
+
c _ { j } ^ { i } = \left\{ { \begin{array} { l l } { 0 \cdot \mathcal { N } ( 0 , 1 ) } & { { \mathrm { i f ~ } } \tilde { j } \leq j \leq { \frac { m } { 2 } } + \theta } \\ { \mathcal { N } ( 0 , 1 ) } & { { \mathrm { o t h e r w i s e } } } \end{array} } \right.
|
| 132 |
+
$$
|
| 133 |
+
|
| 134 |
+
where $\theta$ is a small number (we used $\theta = 5 0 0$ ), and $\tilde { j }$ is the first index that $\lambda _ { \tilde { j } } ^ { - } > 0$ . This choice creates $9 0 \%$ of $\mathbf { \nabla } _ { b } i$ from the lower end of the spectrum, with the remaining $1 0 \%$ from the higher end. The Riemann-Lebesgue Lemma states the Fourier spectrum of a continuous function will decay at infinity, so this specific choice of $b _ { i }$ ’s is reasonable for the training set. In practice, we also observed that the right-hand sides of the pressure system that arose in flow problems (in the empty domain) tended to be at the lower end of the spectrum. Notably, even though this dataset only uses RayleighRitz vectors from the training matrix $A ^ { ( 0 , 1 ) ^ { 3 } }$ , our network can be effectively generalized to flows in irregular domains, e.g., smoke flow past a rotating box and flow past a bunny (see Figure 3).
|
| 135 |
+
|
| 136 |
+
We generate the Rayleigh-Ritz vectors by first tridiagonalizing the training matrix $A ^ { ( 0 , 1 ) ^ { 3 } }$ with Lanczos iterations (Lanczos, 1950) to form $\pmb { T } ^ { m } = \pmb { Q } _ { m } ^ { L } ^ { T } \pmb { A } ^ { ( 0 , 1 ) ^ { 3 } } \pmb { Q } _ { m } ^ { L } \in \mathbb { R } ^ { m \times m }$ . We then diagonalize $\pmb { T } ^ { m } = \hat { \pmb { Q } } ^ { T } \pmb { \Lambda } _ { m } \hat { \pmb { Q } }$ . While costly, we note that this algorithm is performed on the comparably small $m \times m$ matrix $\mathbf { T } ^ { m }$ (rather than on the $A ^ { ( 0 , 1 ) ^ { 3 } } \in \mathbb { R } ^ { n \times n } ,$ ). This yields the Rayleigh-Ritz vectors as the columns of $Q _ { m } = Q _ { m } ^ { L } \hat { Q }$ . The Lanczos vectors are the columns of the matrix $Q _ { m } ^ { L }$ and satisfy a three-term recurrence whereby the next Lanczos vector can be computed from the previous two as
|
| 137 |
+
|
| 138 |
+
$$
|
| 139 |
+
\beta _ { j } \pmb { q } _ { j + 1 } ^ { L } = \pmb { A } ^ { ( 0 , 1 ) ^ { 3 } } \pmb { q } _ { j } ^ { L } - \beta _ { j - 1 } \pmb { q } _ { j - 1 } ^ { L } - \alpha _ { j } \pmb { q } _ { j } ^ { L } ,
|
| 140 |
+
$$
|
| 141 |
+
|
| 142 |
+
where $\alpha _ { j }$ and $\beta _ { j }$ are diagonal and subdiagonal entries of $\pmb { T } ^ { k }$ . $\beta _ { j }$ is computed so that $\pmb q _ { j + 1 } ^ { L }$ is a unit vector, and $\alpha _ { j + 1 } = \pmb { q } _ { j + 1 } ^ { T } \pmb { A } ^ { ( 0 , 1 ) ^ { 3 } } \pmb { q } _ { j + 1 }$ . We initialize the iteration with a random $\pmb { q } _ { 0 } ^ { L } \in \mathrm { s p a n } ( \pmb { A } ^ { ( 0 , 1 ) ^ { 3 } } )$ . The Lanczos algorithm can be viewed as a modified Gram-Schmidt technique to create an orthonormal basis for the Krylov space associated with $\pmb q _ { 0 } ^ { L }$ and $A ^ { ( 0 , 1 ) ^ { 3 } }$ , and it therefore suffers from rounding error sensitivities manifested as loss of orthonormality with vectors that do not appear in the recurrence. We found that the simple strategy described in Paige (1971) of orthogonalizing each iterate with all previous Lanczos vectors to be sufficient for our training purposes. Dataset creation takes 5–7 hours for a $6 4 ^ { 3 }$ computational grid, and 2–2.5 days for a $\boldsymbol { 1 2 8 ^ { \overline { { 3 } } } }$ grid.
|
| 143 |
+
|
| 144 |
+
# 5.2 MODEL ARCHITECTURE
|
| 145 |
+
|
| 146 |
+

|
| 147 |
+
Figure 2: Model architecture for training with $A ^ { ( 0 , 1 ) ^ { 3 } }$ on a $1 2 8 ^ { 3 }$ grid.
|
| 148 |
+
|
| 149 |
+
The internal structure of our CNN architecture for a $1 2 8 ^ { 3 }$ grid is shown in Figure 2. It consists of a series of convolutional layers with residual connections. The upper left of Figure 2 ( $K$ Residual Blocks) shows our use of multiple blocks of residually connected layers. Notably, within each block, the first layer directly affects the last layer with an addition operator.All non-input or output convolutions use a $3 \times 3 \times 3$ filter, and all layers consist of 16 feature maps. In the middle of the first level, a layer is downsampled (via the average pool
|
| 150 |
+
|
| 151 |
+
ing operator with $( 2 \times 2 \times 2 )$ pool size) and another set of convolutional layers is applied with residual connection blocks. The last layer in the second level is upscaled and added to the layer that is downsampled. The last layer in the network is dense with a linear activation function. The activation functions in all convolutional layers are ReLU, except for the first convolution, which uses a linear activation function.
|
| 152 |
+
|
| 153 |
+
Initially we tried a simple deep feedforward convolutional network with residual connections (motivated by He et al. (2016)). Although such a simple model works well for DCDM, it requires high number of layers, which results in higher training and inference times. We found that creating parallel layers of CNNs with downsampling reduced the number of layers required. In summary, our goal was to first identify the simplest network architecture that provided adequate accuracy for our target problems, and subsequently, we sought to make architectural changes to minimize training and inference time; further optimizations are possible.
|
| 154 |
+
|
| 155 |
+
Differing resolutions use differing numbers of convolutions, but the fundamental structure remains the same. More precisely, the number of residual connections is changed for different resolutions. For example, a $6 \dot { 4 } ^ { 3 }$ grid uses one residual block on the left, two on the right on the upper level, and three on the lower level. Furthermore, the weights trained on a lower resolution grid can be used effectively with higher resolutions. Figure 4d shows convergence results for a $2 \mathrm { { 5 6 ^ { 3 } } }$ grid, using a model trained for a $6 4 ^ { 3 }$ grid and a $1 2 \bar { 8 } ^ { 3 }$ grid. The model that we use for $2 5 6 ^ { 3 }$ grids in our final examples was trained on a $1 2 8 ^ { 3 }$ grid; however, as the shown in the figure, even training with a $6 4 ^ { 3 }$ grid allows for efficient residual reduction. Table 1 shows results for three different resolutions, where DCDM uses $6 4 ^ { 3 }$ and $1 2 8 ^ { 3 }$ trained models. This approach makes the number of parameters in the model independent of the spatial fidelity of the problem.
|
| 156 |
+
|
| 157 |
+
# 5.3 TRAINING
|
| 158 |
+
|
| 159 |
+
Using the procedure explained in Section 5.1, we create the training dataset ${ \mathcal { D } } \in \mathsf { s p a n } ( A ^ { ( 0 , 1 ) ^ { 3 } } ) \cap { \mathcal { S } } ^ { n - 1 }$ of size 20000 generated from 10000 Rayleigh-Ritz vectors. We train our model with TensorFlow (Abadi et al., 2015) on a single NVIDIA RTX A6000 GPU with 48GB memory. Training is done with standard deep learning techniques—more precisely, back-propagation and the ADAM optimizer (Kingma & Ba, 2015) (with starting learning rate 0.0001). Training takes approximately 10 minutes and 1 hour per epoch for grid resolutions $6 4 ^ { 3 }$ and $\mathrm { \dot { 1 } 2 8 ^ { 3 } }$ , respectively. We trained our model for 50 epochs; however, the model from the thirty
|
| 160 |
+
|
| 161 |
+

|
| 162 |
+
Figure 3: DCDM for simulating a variety of incompressible flow examples. Left: smoke plume at $t \ =$ 6.67, 13.33, 20 seconds. Middle: smoke passing bunny at $t = 5 , 1 0 , 1 5$ seconds. Right: smoke passing a spinning box (time-dependent Neumann boundary conditions) at $t = 2 . 6 7 , 6 , 9 . 3 3$ seconds.
|
| 163 |
+
|
| 164 |
+
first epoch was optimal for $6 4 ^ { 3 }$ , and the model from the third epoch was optimal for $1 2 8 ^ { 3 }$
|
| 165 |
+
|
| 166 |
+
# 6 RESULTS AND ANALYSIS
|
| 167 |
+
|
| 168 |
+
We demonstrate DCDM on three increasingly difficult examples and provide numerical evidence for the efficient convergence of our method. All examples were run on a workstation with dual AMD EPYC 75F3 processors and 512GB RAM.
|
| 169 |
+
|
| 170 |
+
Figure 3 showcases DCDM for incompressible smoke simulations. In each simulation, inlet boundary conditions are set in a circular portion of the bottom of the cubic domain, whereby smoke flows around potential obstacles and fills the domain. We show a smoke plume (no obstacles), flow past a complex static geometry (the Stanford bunny), and flow past a dynamic geometry (a rotating cube). Visually plausible and highly-detailed results are achieved for each simulation (see supplementary material for larger videos). The plume example uses a computational grid with resolution $1 2 8 ^ { 3 }$ , while the other two uses grids with resolution $2 5 6 ^ { 3 }$ (representing over 16 million unknowns). For each linear solve, DCDM was run until the residual was reduced by four orders of magnitude.
|
| 171 |
+
|
| 172 |
+
Table 1: Timing and iteration comparison for different methods on the bunny example. DCDM- $\{ 6 4 , 1 2 8 \}$ calls a model whose parameters trained over a $\{ 6 4 ^ { 3 } , 1 2 8 ^ { 3 } \}$ grid. All computations are done using only CPUs; model inference does not use GPUs.
|
| 173 |
+
|
| 174 |
+
For the bunny example, Figures 4a–b demonstrate how residuals decrease over the course of a linear solve, comparing DCDM with other methods. Figure 4a shows the mean results (with standard deviations) over the course of 400 simulation frames, while in Figure 4b, we illustrate behavior on a particular frame (frame 150). For
|
| 175 |
+
|
| 176 |
+
<table><tr><td></td><td colspan="2">64 Grid</td><td colspan="2">1283 Grid</td><td colspan="2">2563 Grid</td></tr><tr><td>Method</td><td>tr</td><td>nr</td><td>tr</td><td>nr</td><td>tr</td><td>nr</td></tr><tr><td>DCDM-64</td><td>2.71s</td><td>16</td><td>22s</td><td>27</td><td>261s</td><td>58</td></tr><tr><td>DCDM-128</td><td>5.37s</td><td>19</td><td>26s</td><td>24</td><td>267s</td><td>44</td></tr><tr><td>CG</td><td>1.77s</td><td>168</td><td>26s</td><td>465</td><td>1548s</td><td>1046</td></tr><tr><td>Deflated PCG</td><td>771.6s</td><td>117</td><td>3700s</td><td>277</td><td>21030s</td><td>489</td></tr></table>
|
| 177 |
+
|
| 178 |
+
FluidNet, we use the implementation provided by fluidnetsc22 (2022). This implementation includes pre-trained models that we use without modification. In both subfigures, it is evident that the FluidNet residual never changes, since the method is not iterative; FluidNet reduces the initial residual by no more than one order of magnitude. On the other hand, with DCDM, we can continually reduce the residual (e.g., by four orders of magnitude) as we apply more iterations of our method, just as with classical CG. In Figure 4b, we also visualize the convergence of three other classical methods, CG, Deflated PCG (Saad et al., 2000), and incomplete Cholesky preconditioned CG (ICPCG)); clearly, DCDM reduces the residual in the fewest number of iterations (e.g., approximately one order of magnitude fewer iterations than ICPCG). Since FluidNet is not an iterative method and lacks a notion of residual reduction, we treat $r _ { 0 }$ for FluidNet as though an initial guess of zero is used (as is done in our solver).
|
| 179 |
+
|
| 180 |
+

|
| 181 |
+
Figure 4: Convergence data for the bunny example. (a) Mean and std. dev. (over all 400 frames in the simulation) of residual reduction during linear solves (with $1 2 8 ^ { 3 }$ and $2 5 6 ^ { 3 }$ grids) using FluidNet (FN) and DCDM. (b) Residual plots with CG, ICPCG, Deflated PCG, FN, and DCDM at frame 150. Dashed and solid lines represent results for $1 2 8 ^ { 3 }$ and $2 5 6 ^ { 3 }$ , respectively. (c) Decrease in residuals with varying degrees of $\pmb { A }$ -orthogonalization $( i _ { s } ~ = ~ i _ { \mathrm { s t a r t } } )$ . (d) Reduction in residuals when the network is trained with a $6 4 ^ { 3 }$ or $1 \bar { 2 } 8 ^ { 3 }$ grid for the $2 5 6 ^ { 3 }$ grid simulation shown in Figure 3 Middle.
|
| 182 |
+
|
| 183 |
+
To clarify these results, Table 1 reports convergence statistics for DCDM compared to standard iterative techniques CG and Deflated PCG. For all $6 4 ^ { 3 }$ , $1 2 8 ^ { 3 }$ , and $2 5 6 ^ { 3 }$ grids with the bunny example, we measure the time $t _ { r }$ and the number of iterations $n _ { r }$ required to reduce the initial residual on a particular time step of the simulation by four orders of magnitude. DCDM achieves the desired results in by far the fewest number of iterations at all resolutions. At $2 5 6 ^ { 3 }$ , DCDM performs approximately 6 times faster than CG, suggesting a potentially even wider performance advantage at higher resolutions. Inference is the dominant cost in an iteration of DCDM; the other linear algebra computations in an iteration of DCDM are comparable to those in CG. The nice result of our method is that despite the increased time per iteration, the number of required iterations is reduced so drastically that DCDM materially outperforms classical methods like CG. Although ICPCG successfully reduces number of iterations $^ { 4 \mathrm { ~ b ~ } }$ , we found the runtime to scale prohibitively with grid resolution, so we exclude it from comparison in table 1. Notably, even though Deflated PCG and DCDM are based on approximate Ritz vectors, DCDM performs far better, indicating the value of using a neural network.
|
| 184 |
+
|
| 185 |
+
# 7 CONCLUSIONS
|
| 186 |
+
|
| 187 |
+
We presented DCDM, incorporating CNNs into a CG-style algorithm that yields efficient, convergent behavior for solving linear systems. Our method is evaluated on linear systems with over 16 million degrees of freedom and converges to a desired tolerance in merely tens of iterations. Furthermore, despite training the underlying network on domains without obstacles, our network is able to successfully predict search directions that enable efficient linear solves on domains with complex and dynamic geometries. Moreover, the training data for our network does not require running fluid simulations or solving linear systems ahead of time; our Rayleigh-Ritz vector approach enables us to quickly generate very large training datasets, unlike approaches seen in other works.
|
| 188 |
+
|
| 189 |
+
Our network was designed for and trained exclusively using data related to the discrete Poisson matrix, which likely limits the generalizability of our present model. However, we believe our method is readily applicable to other classes of PDEs (or general problems with graph structure) that give rise to large, sparse, symmetric linear systems. We note that our method is unlikely to work well for matrices that have high computational cost to evaluate $A * x$ (such as dense matrices), since training relies on efficient $\boldsymbol { A } * \boldsymbol { x }$ evaluations. An interesting question to consider is how well our method and current models would apply to discrete Poisson matrices arising from non-uniform grids, e.g., quadtrees or octrees (Losasso et al., 2004).
|
| 190 |
+
|
| 191 |
+
REFERENCES
|
| 192 |
+
M. Abadi, A. Agarwal, P. Barham, E. Brevdo, Z. Chen, C. Citro, G. S. Corrado, A. Davis, J. Dean, M. Devin, S. Ghemawat, I. Goodfellow, A. Harp, G. Irving, M. Isard, Y. Jia, R. Jozefowicz, L. Kaiser, M. Kudlur, J. Levenberg, D. Mane, R. Monga, S. Moore, D. Murray, C. Olah, ´ M. Schuster, J. Shlens, B. Steiner, I. Sutskever, K. Talwar, P. Tucker, V. Vanhoucke, V. Vasudevan, F. Viegas, O. Vinyals, P. Warden, M. Wattenberg, M. Wicke, Y. Yu, and X. Zheng. ´ TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL https: //www.tensorflow.org/. Software available from tensorflow.org.
|
| 193 |
+
J. Ackmann, P. D. Duben, T. N. Palmer, and P. K. Smolarkiewicz. Machine-learned preconditioners ¨ for linear solvers in geophysical fluid flows. arXiv preprint arXiv:2010.02866, 2020.
|
| 194 |
+
A. Brandt. Multi-level adaptive solutions to boundary-value problems. Math Comp, 31(138):333– 390, 1977.
|
| 195 |
+
R. Bridson. Fluid simulation for computer graphics. Taylor & Francis, 2008.
|
| 196 |
+
A. Chorin. A numerical method for solving incompressible viscous flow problems. J Comp Phys, 2 (1):12–26, 1967.
|
| 197 |
+
R. Fedkiw, J. Stam, and H. Jensen. Visual simulation of smoke. In SIGGRAPH, pp. 15–22. ACM, 2001.
|
| 198 |
+
fluidnetsc22. fluidnetsc22/fluidnet sc22: v0.0.1, April 2022. URL https://doi.org/10. 5281/zenodo.6424901. doi: 10.5281/zenodo.6424901, URL: https://doi.org/10. 5281/zenodo.6424901.
|
| 199 |
+
S. Gagniere, D. Hyde, A. Marquez-Razon, C. Jiang, Z. Ge, X. Han, Q. Guo, and J. Teran. A hybrid Lagrangian/Eulerian collocated velocity advection and projection method for fluid simulation. Computer Graphics Forum, 39(8):1–14, 2020. doi: https://doi.org/10.1111/cgf.14096.
|
| 200 |
+
G. Golub and C. Van Loan. Matrix computations, volume 3. JHU Press, 2012.
|
| 201 |
+
M. Gotz and H. Anzt. Machine learning-aided numerical linear algebra: Convolutional neural net- ¨ works for the efficient preconditioner generation. In 2018 IEEE/ACM 9th Workshop on Latest Advances in Scalable Algorithms for Large-Scale Systems (scalA), pp. 49–56. IEEE, 2018.
|
| 202 |
+
A. Grebhahn, N. Siegmund, H. Kostler, and S. Apel. Performance prediction of multigrid-solver ¨ configurations. In Software for Exascale Computing-SPPEXA 2013-2015, pp. 69–88. Springer, 2016.
|
| 203 |
+
D. Greenfeld, M. Galun, R. Basri, I. Yavneh, and R. Kimmel. Learning to optimize multigrid PDE solvers. In Int Conf Mach Learn, pp. 2415–2423. PMLR, 2019.
|
| 204 |
+
F. Harlow and E. Welch. Numerical calculation of time dependent viscous flow of fluid with a free surface. Phys Fluid, 8(12):2182–2189, 1965.
|
| 205 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770–778, 2016. doi: 10.1109/CVPR.2016.90.
|
| 206 |
+
M. R. Hestenes and E. Stiefel. Methods of conjugate gradients for solving linear systems. Journal of research of the National Bureau of Standards, 49(6):409, 1952.
|
| 207 |
+
J.-T. Hsieh, S. Zhao, S. Eismann, L. Mirabella, and S. Ermon. Learning neural PDE solvers with convergence guarantees, 2019. URL https://arxiv.org/abs/1906.01200.
|
| 208 |
+
T. Ichimura, K. Fujita, M. Hori, L. Maddegedara, N. Ueda, and Y. Kikuchi. A fast scalable iterative implicit solver with Green’s function-based neural networks. In 2020 IEEE/ACM 11th Workshop on Latest Advances in Scalable Algorithms for Large-Scale Systems (ScalA), pp. 61–68, 2020. doi: 10.1109/ScalA51936.2020.00013.
|
| 209 |
+
D. Kershaw. The incomplete Cholesky conjugate gradient method for the iterative solution of systems of linear equations. J Comp Phys, 26(1):43–65, 1978.
|
| 210 |
+
D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2015.
|
| 211 |
+
C. Lanczos. An iteration method for the solution of the eigenvalue problem of linear differential and integral operators. 1950.
|
| 212 |
+
F. Losasso, F. Gibou, and R. Fedkiw. Simulating water and smoke with an octree data structure. ACM Trans. Graph., 23(3):457–462, 2004.
|
| 213 |
+
K. Luna, K. Klymko, and J. P. Blaschke. Accelerating GMRES with deep learning in real-time, 2021. URL https://arxiv.org/abs/2103.10975.
|
| 214 |
+
I. Luz, M. Galun, H. Maron, R. Basri, and I. Yavneh. Learning algebraic multigrid using graph neural networks. In Int Conf Mach Learn, pp. 6489–6499. PMLR, 2020.
|
| 215 |
+
H. Nussbaumer. The fast Fourier transform. In Fast Fourier Transform and Convolution Algorithms, pp. 80–111. Springer, 1981.
|
| 216 |
+
C. C. Paige. The computation of eigenvalues and eigenvectors of very large sparse matrices. PhD thesis, University of London, 1971.
|
| 217 |
+
C. C. Paige and M. A. Saunders. Solution of sparse indefinite systems of linear equations. SIAM journal on numerical analysis, 12(4):617–629, 1975.
|
| 218 |
+
H. Ruelmann, M. Geveler, and S. Turek. On the prospects of using machine learning for the numerical simulation of PDEs: Training neural networks to assemble approximate inverses, 2018. URL http://dx.doi.org/10.17877/DE290R-18778.
|
| 219 |
+
Y. Saad. Iterative Methods for Sparse Linear Systems. Society for Industrial and Applied Mathematics, USA, 2nd edition, 2003. ISBN 0898715342.
|
| 220 |
+
Y. Saad and M. Schultz. GMRES: A generalized minimal residual algorithm for solving nonsymmetric linear systems. SIAM J Sci Stat Comp, 7(3):856–869, 1986.
|
| 221 |
+
Y. Saad, M. Yeung, J. Erhel, and F. Guyomarc’h. A deflated version of the conjugate gradient algorithm. SIAM Journal on Scientific Computing, 21:1909–1926, 2000.
|
| 222 |
+
J. Sappl, L. Seiler, M. Harders, and W. Rauch. Deep learning of preconditioners for conjugate gradient solvers in urban water related problems, 2019. URL https://arxiv.org/abs/ 1906.06925.
|
| 223 |
+
R. Stanaityte. ILU and Machine Learning Based Preconditioning For The Discretized Incompressible Navier-Stokes Equations. PhD thesis, University of Houston, 2020.
|
| 224 |
+
E. Stiefel. Uber einige methoden der relaxationsrechnung. ¨ Zeitschrift fur angewandte Mathematik ¨ und Physik ZAMP, 3(1):1–33, 1952.
|
| 225 |
+
J. Tompson, K. Schlachter, P. Sprechmann, and K. Perlin. Accelerating Eulerian fluid simulation with convolutional networks. In D. Precup and Y. Teh (eds.), Proc 34th Int Conf Mach Learn, volume 70 of Proc Mach Learn Res, pp. 3424–3433. PMLR, 06–11 Aug 2017.
|
| 226 |
+
L. Trefethen and D. Bau. Numerical Linear Algebra, volume 50. SIAM, 1997.
|
| 227 |
+
K. Um, R. Brand, Y. Fei, P. Holl, and N. Thuerey. Solver-in-the-loop: Learning from differentiable physics to interact with iterative PDE-solvers. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 6111–6122. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/ paper/2020/file/43e4e6a6f341e00671e123714de019a8-Paper.pdf.
|
| 228 |
+
C. Yang, X. Yang, and X. Xiao. Data-driven projection method in fluid simulation. Comp Anim Virt Worlds, 27(3-4):415–424, 2016.
|
md/dev/nId8ZtIXub/nId8ZtIXub.md
ADDED
|
@@ -0,0 +1,486 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OBSERVATION-CENTRIC SORT: RETHINKING SORT FOR ROBUST MULTI-OBJECT TRACKING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Recent advances in object detection and re-identification have greatly improved the performance of Multi-Object Tracking (MOT) methods, but progress in motion modeling has been limited. The motion model is a key component of many MOT methods and is commonly used to predict an object’s future position. However, mainstream motion models in MOT naively assume that object motion is linear. They rely on detections on each frame as the observation value to supervise motion models. However, in practice, the observations can be noisy and even missing, especially in crowded scenes, which greatly degrade the performance of existing MOT methods. In this work, we show that a simple filtering-based motion model can still obtain state-of-the-art tracking performance if proper care is given to missing observations and noisy estimates. We emphasize the role of observations when recovering tracks from being lost and reducing the error accumulated by the assumption of linear motion when the target is lost. In contrast to the popular motion-based method SORT, which is estimation-centric, we name our method Observation-Centric SORT (OC-SORT). It remains simple, online, and real-time but improves robustness over occlusion and non-linear motion. It achieves stateof-the-art on multiple MOT benchmarks, including MOT17, MOT20, KITTI, head tracking, and especially DanceTrack where the object motion is highly non-linear.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
We aim to develop a motion model-based multi-object tracking (MOT) method that is robust to occlusion. Most existing motion model-based algorithms assume that the tracking targets have a constant velocity, which is called linear motion assumption. This assumption breaks in many practical scenarios, but it still works because when the interval between time steps is small enough, the motion in this short period can be reasonably approximated as linear. In this work, we are motivated by the fact that most of the errors from motion model-based tracking methods occur when occlusion and non-linear motion happen together. To mitigate the adverse effects caused thereby, we first rethink current motion models and recognize some limitations. Then, we propose to address them for more robust tracking performance, especially in occlusions.
|
| 12 |
+
|
| 13 |
+
As the main branch of motion model-based tracking, filtering-based methods assume a motion function to predict the state of objects on future time steps, which are called state “estimations”. Besides estimations, they leverage an observation model, such as an object detector, to derive the state “observations” of target objects. Observations usually serve as the auxiliary information to adjust the parameters in filters and the trajectories are still extended by the state estimations. Among this line of works, the most widely used one is SORT [ 4], which uses a Kalman filter (KF) to estimate object states. We argue that estimations are more likely to be unreliable under occlusion compared to the observations from modern detectors. Therefore, we present a different perspective that, instead of being centric to estimations, we put observations in a more important role in prolonging tracks.
|
| 14 |
+
|
| 15 |
+
We begin with rethinking SORT and recognizing its three limitations: (1) although the high frame rate is the key to approximating the object motion as linear, it also amplifies the model’s sensitivity to the noise of state estimations. Specifically, between consecutive frames of a high frame-rate video, we demonstrate that the noise of displacement of the object can be of the same magnitude as the actual object displacement, leading to the estimated object velocity by KF suffering from a large variance. (2) The noise of state estimations by KF is further accumulated through the time when there is no observation matched to existing trajectories. We prove that the error accumulation of object position estimations by KF is of square-order with respect to the time of the target’s being untracked. (3) Given the development of modern detectors, single-frame detections usually have lower noise than the state estimations propagated along time steps. However, SORT is designed centric to the state estimations and observation is not necessary for updating KF parameters.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Samples from the results on DanceTrack[54]. SORT and OC-SORT use the same detection results. On the third frame, SORT encounters an ID switch for the backflip target while ours not.
|
| 19 |
+
|
| 20 |
+
To relieve the negative effect of these limitations, we propose two main innovations in this work: (1) we design a module to use object state observations to reduce the accumulated error during the track’s being lost in a backtrack fashion. We name it Observation-centric Online Smoothing (OOS). To be precise, on the time step that an inactive (untracked) track is re-associated with an observation, we first build a virtual trajectory by interpolating from the current step back to the previous step at which this object becomes untracked. Along this virtual trajectory, we recalculate the parameters of KF to reduce the accumulated error during the period of being untracked. (2) Under the assumption of linear motion, we have not just the speed consistency but also the direction consistency. So we incorporate the direction consistency of tracks in the cost matrix for the association. This new term suggests under the linear motion assumption, the object should move in constant momentum. So we name it Observation-Centric Momentum (OCM). We also provide analytical justification for the noise of velocity direction estimation in practice.
|
| 21 |
+
|
| 22 |
+
The proposed method, named as Observation-Centric SORT or OC-SORT in short, remains simple, online, real-time and significantly improves robustness over occlusion and non-linear motion. Our contributions are summarized as the following: (1) we recognize, analytically and empirically, three limitations of SORT: sensitivity to the noise of state estimations, error accumulation over time, and being estimation-centric; (2) we propose OC-SORT for robust tracking under occlusion and non-linear motion with two main innovations: OOS and OCM. (3) our OC-SORT achieves new state-of-the-art performance on modern MOT benchmarks.
|
| 23 |
+
|
| 24 |
+
# 2 RELATED WORKS
|
| 25 |
+
|
| 26 |
+
Motion Models. Many recent MOT algorithms [4,10,62,71,68] use motion models. Typically, these motion models use Bayesian estimation [34] to predict the next state by maximizing a posterior estimation. As one of the most classic motion models, the Kalman filter (KF) [ 30] is a recursive Bayes filter that follows a typical predict-update cycle. The true state is assumed to be an unobserved Markov process, and the measurements are observations of a hidden Markov model [43]. Given that the linear motion assumption limits KF, follow-up works like Extended KF [51] and Unscented KF [28] were proposed to handle non-linear motion with first-order and third-order Taylor approximation. However, they still rely on approximating the Gaussian prior assumed by KF. On the other hand, particle filters [22] deal with a non-linear motion by sampling-based posterior estimation but require exponential order of computation. In Bayesian Estimation, filtering uses only past data, while the process of smoothing requires data points on both past and future time steps to adjust the data on a step in between. Fixed-lag smoother [1] and fixed-interval smoother [5,16,45] are studied to improve sequential data fitting after having built the whole trajectory. Though such smoothers are popular in general Bayesian Estimation, it can be hardly applied in video object tracking because they typically require the state on future steps to gain a better estimation on a previous time step, thus making the process not online anymore. Our proposed online smoothing is to discard accumulated error on historical steps and keeps our method an online algorithm.
|
| 27 |
+
|
| 28 |
+
Multi-object Tracking is traditionally approached from probabilistic perspectives, e. g. joint probabilistic association [2]. And modern video object tracking is usually built upon modern object detectors [46,48,70]. SORT [4] adopts the Kalman filter for motion-based multi-object tracking given observations from deep detectors. DeepSORT [62] further introduces deep visual features [50,23] into object association in the framework of SORT. Re-id-based object association[62,41,69] has also become popular since then but falls short when scenes are crowded and objects are represented coarsely (e.g bounding boxes), or object appearance is not distinguishable. More recently, transformers [57] have been introduced to MOT [38,67,53] to learn deep representations from both visual information and object trajectories. However, their performance still has a significant gap between state-of-the-art tracking-by-detection methods in terms of accuracy and speed.
|
| 29 |
+
|
| 30 |
+
# 3 RETHINKING SORT
|
| 31 |
+
|
| 32 |
+
In this section, we review SORT [ 4] and Kalman filter. We recognize some of their limitations, which become significant with occlusion or non-linear object motion and motivate our study.
|
| 33 |
+
|
| 34 |
+
# 3.1 BACKGROUND
|
| 35 |
+
|
| 36 |
+
Kalman filter (KF) [ 30] is a linear estimator for dynamical systems discretized in the time domain. KF only requires the state estimations on the previous time step and the current measurement (observation) to estimate the target state on the next time step. The filter maintains two variables, the posterior state estimate $\mathbf { x }$ , and the posterior estimate covariance matrix $\mathbf { P }$ of the state. In the task of object tracking, we describe the KF process with the state transition model $\mathbf { F }$ , the observation model $\mathbf { H }$ , the process noise $\mathbf { Q }$ and the observation noise $\mathbf { R }$ . At each step $t$ , given observations $\mathbf { z } _ { t }$ , KF works in an alternation of “predict” and “update” stages:
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
\begin{array} { r } { \left\{ \begin{array} { l l } { \hat { \mathbf { x } } _ { t \mid t - 1 } = \mathbf { F } _ { t } \hat { \mathbf { x } } _ { t - 1 \mid t - 1 } , } \\ { \mathbf { P } _ { t \mid t - 1 } = \mathbf { F } _ { t } \mathbf { P } _ { t - 1 \mid t - 1 } \mathbf { F } _ { t } ^ { \top } + \mathbf { Q } _ { t } ^ { ~ , ~ ( \mathrm { u p d a t e } ) } } \end{array} \right. \left\{ \begin{array} { l l } { \mathbf { K } _ { t } = \mathbf { P } _ { t \mid t - 1 } \mathbf { H } _ { t } ^ { \top } \left( \mathbf { H } _ { t } \mathbf { P } _ { t \mid t - 1 } \mathbf { H } _ { t } ^ { \top } + \mathbf { R } _ { t } \right) ^ { - 1 } , } \\ { \hat { \mathbf { x } } _ { t \mid t } = \hat { \mathbf { x } } _ { t \mid t - 1 } + \mathbf { K } _ { t } ( \mathbf { z } _ { t } - \mathbf { H } _ { t } \hat { \mathbf { x } } _ { t \mid t - 1 } ) , } \\ { \mathbf { P } _ { t \mid t } = \left( \mathbf { I } - \mathbf { K } _ { t } \mathbf { H } _ { t } \right) \mathbf { P } _ { t \mid t - 1 } } \end{array} \right. } \end{array}
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
In practice, observations are often absent on some time steps, e. g. the target object is occluded in multi-object tracking. In such cases, we cannot update the KF parameters by the update operation as in Eq. 1 anymore. To address this, a way is to use the estimations $\hat { \mathbf { x } } _ { t \mid t - 1 }$ directly as posterior. The philosophy is to trust estimations when no observations are available to supervise them. However, we will see that this estimation-centric mechanism can cause trouble for MOT.
|
| 43 |
+
|
| 44 |
+
SORT [ 4] is a multi-object tracker built upon KF. The KF’s state $\mathbf { x }$ in SORT is defined as $\mathbf { x } =$ $[ u , v , s , \bar { r } , \dot { u } , \dot { v } , \dot { s } ] ^ { \top }$ , where $( u , v )$ is the 2D coordinates of the object center in the image. $s$ is the bounding box scale (area) and $r$ is the bounding box aspect ratio. The aspect ratio $r$ is assumed to be constant. The other three variables, ${ \dot { u } } , { \dot { v } }$ and $\dot { s }$ are the corresponding time derivatives. The observation is a bounding box $\mathbf { z } = [ u , v , w , h , c ] ^ { \top }$ with object center position $( u , v )$ , object width $w$ and height $h$ and the detection confidence $c$ respectively. SORT assumes linear motion of the target:
|
| 45 |
+
|
| 46 |
+
$$
|
| 47 |
+
u _ { t + 1 } = u _ { t } + { \dot { u } } _ { t } \Delta t , \quad v _ { t + 1 } = v _ { t } + { \dot { v } } _ { t } \Delta t .
|
| 48 |
+
$$
|
| 49 |
+
|
| 50 |
+
When the time difference between two steps is constant during the transition, e. g. , the video frame rate is constant, we can set $\Delta t = 1$ . When the video frame rate is high, SORT works well even when the object motion is non-linear globally, (e. g. dancing, fencing, wrestling) because the motion of the target object can be well approximated as linear within short time intervals.
|
| 51 |
+
|
| 52 |
+
# 3.2 LIMITATIONS OF SORT
|
| 53 |
+
|
| 54 |
+
In this section, we identify three main limitations of SORT which are connected. This analysis lays the foundation of our proposed method.
|
| 55 |
+
|
| 56 |
+
# 3.2.1 SENSITIVE TO STATE NOISE
|
| 57 |
+
|
| 58 |
+
Now we prove that SORT is sensitive to the noise from KF’s state estimations. To begin with, it is reasonable to assume that the estimated object center position follows $u \sim \mathcal N ( \mu _ { u } , \sigma _ { u } ^ { 2 } )$ and $v \sim \mathcal { N } ( \mu _ { v } , \sigma _ { v } ^ { 2 } )$ , where $( \mu _ { u } , \mu _ { v } )$ is the underlying true position. Then, if we assume that the state noises are independent on different steps, by Eq.2, the estimated object speed between two time steps, $t \longrightarrow t + \Delta t$ , is
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
\dot { u } = \frac { u _ { t + \Delta t } - u _ { t } } { \Delta t } , \qquad \dot { v } = \frac { v _ { t + \Delta t } - v _ { t } } { \Delta t } ,
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+

|
| 65 |
+
Figure 2: The pipeline of our proposed OC-SORT. The red boxes are detections, orange boxes are active tracks, blue boxes are untracked tracks, dashed boxes are the estimates from KF. During association OCM is used to add the velocity consistency cost. The target $\# 1$ is lost on the frame $_ { \mathrm { t + l } }$ because of occlusion. But on the next frame, it is recovered by referring to its observation of the frame t by OCR. It being re-tracked triggers OOS from t to $_ { \mathrm { t } + 2 }$ for the parameters of its KF.
|
| 66 |
+
|
| 67 |
+
making the noise of estimated speed $\begin{array} { r } { \delta _ { \dot { u } } \sim \mathcal { N } ( 0 , \frac { 2 \sigma _ { u } ^ { 2 } } { ( \Delta t ) ^ { 2 } } ) } \end{array}$ , $\begin{array} { r } { \delta _ { \dot { v } } \sim \mathcal { N } ( 0 , \frac { 2 \sigma _ { v } ^ { 2 } } { ( \Delta t ) ^ { 2 } } ) } \end{array}$ Therefore, estimating the speed between consecutive frames, i. e. $\Delta t = \dot { 1 }$ , maximizes the noise.
|
| 68 |
+
|
| 69 |
+
Moreover, for most multi-object tracking scenarios, the target object displacement is only a few pixels between consecutive frames. For instance, the average displacement is 1.93 pixels and 0.65 pixels along the image width and height for the MOT17 [40] training dataset. In such a case, even if the estimated position has a shift of only a single pixel, it causes a significant variation in the estimated speed. In general, the variance of the speed estimation can be of the same magnitude as the speed itself or even greater. In most cases, this will not make a massive impact as the shift is only of few pixels from the ground truth on the next time step, and the observations, whose variance is independent of time period, will be able to supervise the state estimations from the KF motion model. However, we will see that the sensitivity introduces significant problems in practice because of the error accumulation across multiple time steps when no observation is available for KF update.
|
| 70 |
+
|
| 71 |
+
# 3.2.2 TEMPORAL ERROR MAGNIFICATION
|
| 72 |
+
|
| 73 |
+
For analysis above in Eq. 3, we assume the noise of object state is i.i.d on different time steps. This is reasonable for object detections but not for the estimations from KF. This is because KF’s estimations always rely on its estimations on previous time steps. The effect is usually minor because KF can use observation to supervise the state estimations in the update stage to avoid its parameters deviating from the true value too far away. However, when no observations are provided to KF, it cannot use observation to supervise the update of its parameters anymore. It simply uses its own priori state estimation $\hat { \mathbf { x } } _ { t \mid t - 1 }$ to replace $\mathbf { z } _ { t }$ during update. Consider a track is occluded on the time steps between $t$ and $t { + } T$ and the noise of speed estimate follows $\delta _ { \dot { u } _ { t } } \sim \mathcal { N } ( 0 , 2 \sigma _ { u } ^ { 2 } ) , \delta _ { \dot { v } _ { t } } \sim \mathcal { N } ( 0 , 2 \sigma _ { v } ^ { 2 } )$ for SORT. Till the step $t + T$ , state estimation would be
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
u _ { t + T } = u _ { t } + T \dot { u } _ { t } , \qquad v _ { t + T } = v _ { t } + T \dot { v } _ { t } ,
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
whose noise follows $\delta _ { u _ { t + T } } \sim \mathcal { N } ( 0 , 2 T ^ { 2 } \sigma _ { u } ^ { 2 } )$ and $\delta _ { v _ { t + T } } \sim \mathcal { N } ( 0 , 2 T ^ { 2 } \sigma _ { v } ^ { 2 } )$ . So without the supervision from observation, the estimates from the linear motion assumption of KF result in a square-order error accumulation with respect to time. Given $\sigma _ { v }$ and $\sigma _ { u }$ is of the same magnitude as object displacement between consecutive frames, the noise of final object position $\left( u _ { t + T } , v _ { t + T } \right)$ is of the same magnitude as the object size. For instance, the size of pedestrians close to the camera on MOT17 is around $5 0 \times 3 0 0$ pixels. So even assuming the variance of position estimates to be around 1 pixel, 10-frame occlusion can accumulate a shift of final position estimates as large as the object size. Such error magnification leads to a major accumulation of errors when the scenes are crowded.
|
| 80 |
+
|
| 81 |
+
# 3.2.3 ESTIMATION-CENTRIC
|
| 82 |
+
|
| 83 |
+
The aforementioned limitations come from a fundamental property of SORT that KF is designed to be estimation-centric. The external observations serve only to assist in the propagation of KF trajectory. A key difference between state estimates and observations is that we can assume that the observations by a object detector in each frame are affected by i.i.d. noise $\delta _ { \mathbf { z } } \sim \mathcal { N } ( 0 , { \sigma ^ { \prime } } ^ { 2 } )$ . Modern object detectors use object visual features [50,48], which are ignored by KF when making estimates, making it safe to assume $\sigma ^ { \prime } < \sigma _ { u }$ and $\sigma ^ { \prime } < \sigma _ { v }$ . Additionally, the variance of detections will not be accumulated over time which happens to KF’s estimates. Therefore, a robust multi-object tracker under occlusion should give more importance to the observations than the KF’s state estimates.
|
| 84 |
+
|
| 85 |
+

|
| 86 |
+
Figure 3: Example of how Observation-centric Online Smoothing reduces the error accumulation when a track is broken. The target is occluded between the second and the third time step and the tracker finds it back at the third step. Yellow boxes are the state observations by the detector. White stars are the estimated centers without OOS. Yellow stars are the estimated centers fixed by OOS. The gray star on the fourth step is the estimated center without OOS and fails to match observations.
|
| 87 |
+
|
| 88 |
+
# 4 OBSERVATION-CENTRIC SORT
|
| 89 |
+
|
| 90 |
+
In this section, we introduce the proposed Observation-Centric Sort (OC-SORT). To address the limitations of SORT discussed above, we use the momentum of the object moving into the association stage and develop a pipeline with less noise and more robustness over occlusion and non-linear motion. The key is to design the tracker as observation-centric instead of estimation-centric. If a track is recovered from being untracked, we use an Observation-centric Online Smoothing (OOS) strategy to counter the accumulated error during the untracked period. OC-SORT also adds an Observation-Centric Momentum (OCM) term in the association cost. Please refer to Algorithm 1 in Appendix for the pseudo-code of OC-SORT. The pipeline is shown in Fig. 2.
|
| 91 |
+
|
| 92 |
+
# 4.1 OBSERVATION-CENTRIC ONLINE SMOOTHING (OOS)
|
| 93 |
+
|
| 94 |
+
In practice, even if an object can be associated again by SORT after a period of being untracked, it is probably lost again because its KF parameters have already deviated far away from the correct due to the temporal error magnification. To alleviate this problem, we propose Observation-centric Online Smoothing (OOS) to reduce the accumulated error. Once a track is associated with an observation again after a period of being untracked, we would backtrack the period of being lost and re-calculate the parameters of KF along a virtual trajectory during this period. This virtual trajectory is generated with the help of state observations before and after the untracked period. For example, by denoting the last observation before being untracked as $\mathbf { z } _ { t _ { 1 } }$ and the observation triggering the re-association as $\mathbf { z } _ { t _ { 2 } }$ , the virtual trajectory is denoted as
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\begin{array} { r } { \hat { \mathbf { z } } _ { t } = T r a j _ { \mathrm { v i r t u a l } } ( \mathbf { z } _ { t _ { 1 } } , \mathbf { z } _ { t _ { 2 } } , t ) , t _ { 1 } < t < t _ { 2 } . } \end{array}
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
Along this virtual trajectory, we can start from the state at $t _ { 1 }$ to backtrack and refresh the filter parameters by alternating between the stages of prediction and update (Eq. 1). Given the supervision of the states on the virtual trajectory, the error raised in state estimation would not be accumulated anymore. The refreshed state estimations along the virtual trajectory follow $\hat { \mathbf { x } } _ { t } = \mathbf { F } _ { t } \hat { \mathbf { x } } _ { t - 1 } + \mathbf { K } _ { t } \big ( \hat { \mathbf { z } } _ { t } -$ $\mathbf { H } _ { t } \mathbf { F } _ { t } \hat { \mathbf { x } } _ { t - 1 } ,$ ). And other KF parameters are updated correspondingly. This operation is not Bayesian smoothing [ 5,16,45], which is widely used for offline data series post-processing, as it only uses data up to the current time step and does not change previous tracking results. Furthermore, it performs on observations instead of filter parameters directly. To stress on the fundamental difference of our designed process from offline smoothing, we call it “online smoothing”.
|
| 101 |
+
|
| 102 |
+
# 4.2 OBSERVATION-CENTRIC MOMENTUM (OCM)
|
| 103 |
+
|
| 104 |
+
The linear motion model assumes a consistent velocity. However, this assumption often does not hold due to the non-linear motion of objects and state noise. In a reasonably short time, we can approximate the motion as linear but the noise still prevents us from leveraging the consistency of
|
| 105 |
+
|
| 106 |
+
velocity direction. We propose a way to reduce the noise and add the velocity consistency (momentum) term in association. Given $N$ existing tracks and $M$ detections, the association cost is
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
\begin{array} { r } { C ( \hat { \mathbf { X } } , \mathbf { Z } ) = C _ { \mathrm { I o U } } ( \hat { \mathbf { X } } , \mathbf { Z } ) + \lambda C _ { v } ( \hat { \mathbf { X } } , \mathbf { Z } , \mathbf { V } ) , } \end{array}
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+
where $\hat { \mathbf { X } } \in \mathbb { R } ^ { N \times 7 }$ and $\mathbf { Z } \in \mathbb { R } ^ { M \times 5 }$ are the sets of object state estimates and observations. $\mathbf { V } \in \mathbb { R } ^ { N }$ contains the directions of existing tracks calculated by two previous observations of time difference $\Delta t$ . $C _ { \mathrm { I o U } } ( \cdot , \cdot )$ calculates the negative pairwise IoU (Intersection over Union) and $C _ { v } ( \cdot , \cdot )$ calculates the consistency of i) track directions and ii) direction formed by a track’s historical observation and the new observations. In our implementation, we use the difference of trajectory direction in radians, namely $\Delta \theta$ , as the term $C _ { v }$ . $\theta$ is calculated by linking observations on two time steps. The detailed discussion about this is provided in Appendix A. $\lambda$ is a weighting factor. We use observations on a track for direction calculation to avoid error accumulation in state estimations, but there is still a choice about which two observations we should choose.
|
| 113 |
+
|
| 114 |
+
We now analyze the relation between the variance of direction estimation and the choice of time steps. Assuming we calculate the trajectory direction by observations on two steps, $t _ { 1 }$ and $t _ { 2 }$ , on which the underlying true object positions are $( \mu _ { u _ { t _ { 1 } } } , \mu _ { v _ { t _ { 1 } } } )$ and $( \mu _ { { u _ { t } } _ { 2 } } , \mu _ { { v _ { t } } _ { 2 } } )$ . And the estimations of positions as $( u _ { t _ { 1 } } , v _ { t _ { 1 } } )$ and $( u _ { t _ { 2 } } , v _ { t _ { 2 } } )$ . The movement direction is $\begin{array} { r } { \theta = { a r c t a n } ( \frac { \mu _ { v _ { t _ { 1 } } } - \mu _ { v _ { t _ { 2 } } } } { \mu _ { u _ { t _ { 1 } } } - \mu _ { u _ { t _ { 2 } } } } ) } \end{array}$ ( µvt1 −µvt2 ). Noting $w = u _ { t _ { 1 } } - u _ { t _ { 2 } }$ , $y = v _ { t _ { 1 } } - v _ { t _ { 2 } }$ , and $\begin{array} { r } { z = \frac { y } { w } } \end{array}$ , under the assumptions of noise assumption mentioned before, we can derive a closed-form probability density function of the distribution of $z$ as
|
| 115 |
+
|
| 116 |
+
$$
|
| 117 |
+
p ( z ) = \frac { g ( z ) e ^ { \frac { g ( z ) ^ { 2 } - \alpha r ( z ) ^ { 2 } } { 2 \beta ^ { 2 } r ( z ) ^ { 2 } } } } { \sqrt { 2 \pi } \sigma _ { w } \sigma _ { y } r ( z ) ^ { 3 } } \left[ \Phi \left( \frac { g ( z ) } { \beta r ( z ) } \right) - \Phi \left( - \frac { g ( z ) } { \beta r ( z ) } \right) \right] + \frac { \beta e ^ { - 2 \alpha / \beta } } { \pi \sigma _ { w } \sigma _ { y } r ( z ) ^ { 2 } } ,
|
| 118 |
+
$$
|
| 119 |
+
|
| 120 |
+
which is explained in detail in Appendix A. By analyzing the property of this distribution, we reach a conclusion that, under the linear-motion model, the scale of noise $z$ ’s estimation is negatively correlated to the time difference between the two observation points, i. e. $\Delta t = t _ { 2 } - t _ { 1 }$ (see Appendix A for more details). But, on the other hand, the trajectory can only be approximated as linear within a short time interval, so the time difference should be held not too large to avoid the collapse of linear approximation. This requires a trade-off in practice.
|
| 121 |
+
|
| 122 |
+
Besides OOS and OCM, we also find it empirically helpful to check a track’s last presence when re-covering it from being lost. We thus propose a heuristic Observation-Centric Recovery (OCR) technique here as a secondary module. Once a track is still untracked after the normal association stage, OCR asks to associate the last observation of this track to the observations on the new-coming step to handle the case of an object stopping or being occluded for a short time interval.
|
| 123 |
+
|
| 124 |
+
# 5 EXPERIMENTS
|
| 125 |
+
|
| 126 |
+
# 5.1 EXPERIMENTAL SETUP
|
| 127 |
+
|
| 128 |
+
Datasets. We evaluate our method on multiple multi-object tracking datasets including MOT17 [40], MOT20 [13], KITTI [20], DanceTrack [54] and HeadTrack [55] (in Appendix). MOT17 [40] and MOT20 [13] are for pedestrian tracking, where targets mostly move linearly, while scenes in MOT20 are more crowded. KITTI [20] is for pedestrian and car tracking with a relatively low frame rate of 10FPS. DanceTrack [54] is a recently proposed dataset for human tracking. In this dataset, object localization is easy, but the object motion is highly non-linear. Furthermore, the objects have a close appearance, severe occlusion, and frequent crossovers. Considering our goal is to improve tracking robustness in occlusion and non-linear object motion, we would emphasize the comparison between OC-SORT and previous methods on DanceTrack in the following experiments.
|
| 129 |
+
|
| 130 |
+
Implementations. For a fair comparison, we directly apply the object detections from existing baselines. For MOT17, MOT20, and DanceTrack, we use the publicly available YOLOX [19] detector weights by ByteTrack [68]. For KITTI [20], we use the detections from PermaTrack [56] publicly available in the official release. For OOS, we generate the virtual trajectory during occlusion with the constant-velocity assumption. Therefore, Eq. 5 is adopted as
|
| 131 |
+
|
| 132 |
+
$$
|
| 133 |
+
\hat { \mathbf { z } } _ { t } = \mathbf { z } _ { t _ { 1 } } + \frac { t - t _ { 1 } } { t _ { 2 } - t _ { 1 } } ( \mathbf { z } _ { t _ { 2 } } - \mathbf { z } _ { t _ { 1 } } ) , t _ { 1 } < t < t _ { 2 } .
|
| 134 |
+
$$
|
| 135 |
+
|
| 136 |
+
For OCM, the velocity direction is calculated using the observations three time steps apart, i. e. $\Delta t = 3$ . The direction difference is measured by the absolute difference of angles in radians. We set $\lambda = 0 . 2$ in Eq. 6. Following the common practice of SORT, we set the detection confidence threshold at 0.4 for MOT20 and 0.6 for other datasets. The IoU threshold during association is 0.3.
|
| 137 |
+
|
| 138 |
+
Metrics. We adopt HOTA [37] as the main metric as it maintains a better balance between the accuracy of object detection and association [37]. We also emphasize AssA and IDF1 to evaluate the association performance. Some other metrics we report, such as MOTA, are highly related to detection performance; this can lead to fair comparison only when all methods use the same detections for tracking– this setting is referred to as “public tracking”.
|
| 139 |
+
|
| 140 |
+
Table 1: Results on MOT17-test with the private detections. ByteTrack and ours share detections.
|
| 141 |
+
|
| 142 |
+
<table><tr><td>Tracker</td><td>HOTA↑</td><td>MOTA↑</td><td>IDF1个</td><td>FP(104↓</td><td>FN(104)↓</td><td>IDs↓</td><td>Frag↓</td><td>AssA↑</td><td>AssR个</td></tr><tr><td>FairMOT [69]</td><td>59.3</td><td>73.7</td><td>72.3</td><td>2.75</td><td>11.7</td><td>3,303</td><td>8.073</td><td>58.0</td><td>63.6</td></tr><tr><td>TransCt [66]</td><td>54.5</td><td>73.2</td><td>62.2</td><td>2.31</td><td>12.4</td><td>4,614</td><td>9,519</td><td>49.7</td><td>54.2</td></tr><tr><td>TransTrk[53]</td><td>54.1</td><td>75.2</td><td>63.5</td><td>5.02</td><td>8.64</td><td>3,603</td><td>4,872</td><td>47.9</td><td>57.1</td></tr><tr><td>GRTU[59]</td><td>62.0</td><td>74.9</td><td>75.0</td><td>3.20</td><td>10.8</td><td>1,812</td><td>1,824</td><td>62.1</td><td>65.8</td></tr><tr><td>QDTrack[41]</td><td>53.9</td><td>68.7</td><td>66.3</td><td>2.66</td><td>14.66</td><td>3,378</td><td>8.091</td><td>52.7</td><td>57.2</td></tr><tr><td>MOTR [67]</td><td>57.2</td><td>71.9</td><td>68.4</td><td>2.11</td><td>13.6</td><td>2,115</td><td>3,897</td><td>55.8</td><td>59.2</td></tr><tr><td>PermaTr[56]</td><td>55.5</td><td>73.8</td><td>68.9</td><td>2.90</td><td>11.5</td><td>3,699</td><td>6,132</td><td>53.1</td><td>59.8</td></tr><tr><td>TransMOT[1]</td><td>61.7</td><td>76.7</td><td>75.1</td><td>3.62</td><td>9.32</td><td>2.346</td><td>7,719</td><td>59.9</td><td>66.5</td></tr><tr><td>ByteTrack[68]</td><td>63.1</td><td>80.3</td><td>77.3</td><td>2.55</td><td>8.37</td><td>2,196</td><td>2,277</td><td>62.0</td><td>68.2</td></tr><tr><td>Ours</td><td>63.2</td><td>78.0</td><td>77.5</td><td>1.51</td><td>10.8</td><td>1,950</td><td>2.040</td><td>63.2</td><td>67.5</td></tr></table>
|
| 143 |
+
|
| 144 |
+
Table 2: Results on MOT20-test with private detections. ByteTrack and ours share detections.
|
| 145 |
+
|
| 146 |
+
<table><tr><td>Tracker</td><td>HOTA↑</td><td>MOTA↑</td><td>IDF1个</td><td>FP(104</td><td>FN(104↓</td><td>IDs↓</td><td>Frag↓</td><td>AssA↑</td><td>AssR↑</td></tr><tr><td>FairMOT[69]</td><td>54.6</td><td>61.8</td><td>67.3</td><td>10.3</td><td>8.89</td><td>5,243</td><td>7,874</td><td>54.7</td><td>60.7</td></tr><tr><td>TransCt[66]</td><td>43.5</td><td>58.5</td><td>49.6</td><td>6.42</td><td>14.6</td><td>4,695</td><td>9,581</td><td>37.0</td><td>45.1</td></tr><tr><td>Semi-TCL[35]</td><td>55.3</td><td>65.2</td><td>70.1</td><td>6.12</td><td>11.5</td><td>4,139</td><td>8,508</td><td>56.3</td><td>60.9</td></tr><tr><td>CSTrack [36]</td><td>54.0</td><td>66.6</td><td>68.6</td><td>2.54</td><td>14.4</td><td>3,196</td><td>7,632</td><td>54.0</td><td>57.6</td></tr><tr><td>GSDT[60]</td><td>53.6</td><td>67.1</td><td>67.5</td><td>3.19</td><td>13.5</td><td>3,131</td><td>9,875</td><td>52.7</td><td>58.5</td></tr><tr><td>TransMOT[1]</td><td>61.9</td><td>77.5</td><td>75.2</td><td>3.42</td><td>8.08</td><td>1,615</td><td>2,421</td><td>60.1</td><td>66.3</td></tr><tr><td>ByteTrack [68]</td><td>61.3</td><td>77.8</td><td>75.2</td><td>2.62</td><td>8.76</td><td>1,223</td><td>1,460</td><td>59.6</td><td>66.2</td></tr><tr><td>Ours</td><td>62.1</td><td>75.5</td><td>75.9</td><td>1.80</td><td>10.8</td><td>913</td><td>1,198</td><td>62.0</td><td>67.5</td></tr></table>
|
| 147 |
+
|
| 148 |
+
# 5.2 BENCHMARK RESULTS
|
| 149 |
+
|
| 150 |
+
Here we report the benchmark results on multiple datasets. We put all methods that use the shared detection results in a block at the bottom of each table.
|
| 151 |
+
|
| 152 |
+
MOT17 and MOT20. We report OC-SORT’s performance on MOT17 and MOT20 in Table 1 and Table 2 using private detections. To make a fair comparison, we use the same detection as ByteTrack [68]. OC-SORT achieves performance comparable to other state-of-the-art methods. Our gains are especially significant in MOT20 under severe pedestrian occlusion, setting a stateof-the-art HOTA of 62.1. As our method is designed to be simple for better generalization, we do not use adaptive detection thresholds as in ByteTrack. If we set the detection threshold adaptive as ByteTrack does, OC-SORT will achieve higher MOTA scores (80.5 on MOT17 and 78.1 on MOT20) but we prefer to maintain the implementation of OC-SORT clean and generalizable and share a same setting of hyper-parameters cross datasets. But we still inherit its linear interpolation for a fair comparison. To more clearly discard the variance from the detector, we also perform public tracking on MOT17 and MOT20, which is reported in Table 12 and Table 13 in Appendix C. OC-SORT still outperforms the existing state-of-the-art in public tracking settings.
|
| 153 |
+
|
| 154 |
+
DanceTrack. To evaluate OC-SORT under challenging non-linear object motion, we report results on the DanceTrack in Table 3. OC-SORT sets a new state-of-the-art, outperforming the baselines by a great margin under non-linear object motions. Although OC-SORT has better association performance, association metrics such as HOTA, IDF1, and AssA are still lower than the results on previous datasets. This suggests that the difficulty of tracking objects on DanceTrack is very challenging. We compare the tracking results of SORT and OC-SORT under extreme non-linear situations in Fig.1 and more samples are available in Fig. 6 in Appendix E. We also visualize the output trajectories by OC-SORT and SORT on randomly selected DanceTrack videos clips in Fig. 7 in Appendix E. As we focus on improving multi-object tracking in occlusion and non-linear motion cases, the results on DanceTrack are strong evidence of the efficiency of OC-SORT.
|
| 155 |
+
|
| 156 |
+
Table 3: Results on DanceTrack test set. Methods in the bottom block use the same detections.
|
| 157 |
+
|
| 158 |
+
<table><tr><td>Tracker</td><td>HOTA↑</td><td>DetA↑</td><td>AssA↑</td><td>MOTA↑</td><td>IDF1个</td></tr><tr><td>CenterTrack[71]</td><td>41.8</td><td>78.1</td><td>22.6</td><td>86.8</td><td>35.7</td></tr><tr><td>FairMOT[69]</td><td>39.7</td><td>66.7</td><td>23.8</td><td>82.2</td><td>40.8</td></tr><tr><td>QDTrack [41]</td><td>45.7</td><td>72.1</td><td>29.2</td><td>83.0</td><td>44.8</td></tr><tr><td>TransTrk[53]</td><td>45.5</td><td>75.9</td><td>27.5</td><td>88.4</td><td>45.2</td></tr><tr><td>TraDes [63]</td><td>43.3</td><td>74.5</td><td>25.4</td><td>86.2</td><td>41.2</td></tr><tr><td>MOTR[67]</td><td>54.2</td><td>73.5</td><td>40.2</td><td>79.7</td><td>51.5</td></tr><tr><td>SORT[4]</td><td>47.9</td><td>72.0</td><td>31.2</td><td>91.8</td><td>50.8</td></tr><tr><td>DeepSORT[62]</td><td>45.6</td><td>71.0</td><td>29.7</td><td>87.8</td><td>47.9</td></tr><tr><td>ByteTrack[68]</td><td>47.3</td><td>71.6</td><td>31.4</td><td>89.5</td><td>52.5</td></tr><tr><td>Ours</td><td>54.6</td><td>80.4</td><td>40.2</td><td>89.6</td><td>54.6</td></tr><tr><td>Ours + Linear Interp</td><td>54.9</td><td>81.9</td><td>40.4</td><td>92.2</td><td>54.9</td></tr></table>
|
| 159 |
+
|
| 160 |
+
Table 4: Results on KITTI test set. HP indicates adding the lost detections during initializing tracks. Our method uses the same detections as PermaTr[56]
|
| 161 |
+
|
| 162 |
+
<table><tr><td></td><td colspan="4"></td><td colspan="5"></td></tr><tr><td>Tracker</td><td>HOTA↑</td><td>MOTA↑</td><td>AssA↑</td><td>IDs↓</td><td>Frag↓</td><td>HOTA↑</td><td>MOTA↑</td><td>AssA↑</td><td>IDs↓</td><td>Frag↓</td></tr><tr><td>IMMDp[64]</td><td>68.66</td><td>82.75</td><td>69.76</td><td>211</td><td>181</td><td>-</td><td>-</td><td></td><td>-</td><td>-</td></tr><tr><td>SMAT[21]</td><td>71.88</td><td>83.64</td><td>72.13</td><td>198</td><td>294</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>TrackMPNN [44]</td><td>72.30</td><td>87.33</td><td>70.63</td><td>481</td><td>237</td><td>39.40</td><td>52.10</td><td>35.45</td><td>626</td><td>669</td></tr><tr><td>MPNTrack[6]</td><td>-</td><td></td><td>=</td><td>-</td><td></td><td>45.26</td><td>46.23</td><td>47.28</td><td>397</td><td>1,078</td></tr><tr><td>CenterTr[71]</td><td>73.02</td><td>88.83</td><td>71.18</td><td>254</td><td>227</td><td>40.35</td><td>53.84</td><td>36.93</td><td>425</td><td>618</td></tr><tr><td>LGM[58]</td><td>73.14</td><td>87.60</td><td>72.31</td><td>448</td><td>164</td><td>-</td><td>-</td><td>-</td><td></td><td>1</td></tr><tr><td>TuSimple[10]</td><td>71.55</td><td>86.31</td><td>71.11</td><td>292</td><td>218</td><td>45.88</td><td>57.61</td><td>47.62</td><td>246</td><td>651</td></tr><tr><td>PermaTr[56]</td><td>77.42</td><td>90.85</td><td>77.66</td><td>275</td><td>271</td><td>47.43</td><td>65.05</td><td>43.66</td><td>483</td><td>703</td></tr><tr><td>Ours</td><td>74.64</td><td>87.81</td><td>74.52</td><td>257</td><td>318</td><td>52.95</td><td>62.00</td><td>57.81</td><td>181</td><td>598</td></tr><tr><td>Ours + HP</td><td>76.54</td><td>90.28</td><td>76.39</td><td>250</td><td>280</td><td>54.69</td><td>65.14</td><td>59.08</td><td>184</td><td>609</td></tr></table>
|
| 163 |
+
|
| 164 |
+
Table 5: Ablation study on MOT17 val set and DanceTrack-val set.
|
| 165 |
+
|
| 166 |
+
<table><tr><td></td><td>1</td><td colspan="2"></td><td colspan="2">MOT17-val</td><td colspan="2"></td><td colspan="2">DanceTrack-val</td><td></td></tr><tr><td>0OS</td><td>OCM</td><td>OCR</td><td>HOTA↑</td><td>AssA↑</td><td>MOTA↑</td><td>IDF1个</td><td>HOTA↑</td><td>AssA↑</td><td>MOTA↑</td><td>IDF1个</td></tr><tr><td></td><td></td><td></td><td>64.9</td><td>66.8</td><td>74.6</td><td>76.9</td><td>47.8</td><td>31.0</td><td>88.2</td><td>48.3</td></tr><tr><td></td><td></td><td></td><td>66.3</td><td>68.0</td><td>74.7</td><td>77.2</td><td>48.5</td><td>32.2</td><td>87.2</td><td>49.8</td></tr><tr><td></td><td>√</td><td></td><td>66.4</td><td>69.0</td><td>74.6</td><td>77.8</td><td>52.1</td><td>35.0</td><td>87.3</td><td>50.6</td></tr><tr><td>>>></td><td></td><td>√</td><td>66.5</td><td>68.9</td><td>74.9</td><td>77.7</td><td>52.1</td><td>35.3</td><td>87.3</td><td>51.6</td></tr></table>
|
| 167 |
+
|
| 168 |
+
Table 6: Ablation study on the trajectory hypothesis used in OOS.
|
| 169 |
+
|
| 170 |
+
<table><tr><td></td><td colspan="4">MOT17-val</td><td colspan="4">DanceTrack-val</td></tr><tr><td></td><td>HOTA↑</td><td>AssA↑</td><td>MOTA↑</td><td>IDF1个</td><td>HOTA↑</td><td>AssA↑</td><td>MOTA↑</td><td>IDF1个</td></tr><tr><td>Const. Speed</td><td>66.5</td><td>68.9</td><td>74.9</td><td>77.7</td><td>52.1</td><td>35.3</td><td>87.3</td><td>51.6</td></tr><tr><td>GPR</td><td>63.1</td><td>65.2</td><td>74.0</td><td>75.7</td><td>49.5</td><td>33.7</td><td>86.7</td><td>49.6</td></tr><tr><td>Linear Regression</td><td>64.3</td><td>66.5</td><td>74.2</td><td>76.0</td><td>49.3</td><td>33.4</td><td>86.2</td><td>49.2</td></tr><tr><td>Const. Acceleration</td><td>66.2</td><td>67.9</td><td>74.7</td><td>77.4</td><td>51.3</td><td>34.8</td><td>87.0</td><td>50.9</td></tr></table>
|
| 171 |
+
|
| 172 |
+
KITTI. In Table 4 we report the results on the KITTI dataset. For a fair comparison, we adopt the detector weights by PermaTr [56] and report its performance in the table as well. Then, we run OC-SORT given the shared detections. As initializing SORT’s track requires continuous tracking across several frames (“minimum hits”), we observe that the results not recorded during the track initialization make a significant difference. To address this, we do offline head padding (HP) postprocessing by writing these entries back after finishing the online tracking stage. The results on KITTI show an essential shortcoming of OC-SORT that it highly relies on the IoU matching for the association. As a result, when the object velocity is high or the frame rate is low, the IoU of object bounding boxes between consecutive frames can be very low or even zero. This phenomenon poses a significant challenge to our method. But still, in contrast to the baseline car tracking performance, OC-SORT improves pedestrian tracking performance to a new state-of-the-art.
|
| 173 |
+
|
| 174 |
+
We believe that the results shown on multiple benchmarks have demonstrated the efficiency of our proposed OC-SORT. We note that we use a shared parameter stack for different datasets, and carefully tuning the parameters might further boost the performance. For example, the adaptive detection threshold is proven useful in previous work [68]. Besides the association performance discussed above, we also care about the inference speed of tracking algorithms. As different methods report results on different detectors and running environments, it is hard to compare them directly. Therefore, we only report the inference speed of OC-SORT. Given off-the-shelf detections, the association stage of OC-SORT runs at 793 FPS on an Intel i9-9980XE CPU $\textcircled { a } \ 3 . 0 0 \mathrm { G H z }$ .
|
| 175 |
+
|
| 176 |
+
# 5.3 ABLATION STUDY
|
| 177 |
+
|
| 178 |
+
Component Ablation. We ablate the contribution of proposed modules in OC-SORT on the validation sets of MOT17 and DanceTrack in Table 5. The splitting of MOT17 follows a popular convention [71]. The results demonstrate the efficiency of the proposed modules in OC-SORT.
|
| 179 |
+
|
| 180 |
+
Table 7: Influence of choice of $\Delta t$ for estimating direction in OCM.
|
| 181 |
+
|
| 182 |
+
<table><tr><td>一</td><td colspan="4">MOT17-val</td><td colspan="4">DanceTrack-val</td></tr><tr><td></td><td>HOTA↑</td><td>AssA↑</td><td>MOTA↑</td><td>IDF1个</td><td>HOTA↑</td><td>AssA↑</td><td>MOTA↑</td><td>IDF1个</td></tr><tr><td>△t=1</td><td>66.1</td><td>67.5</td><td>74.9</td><td>76.9</td><td>51.3</td><td>34.3</td><td>87.1</td><td>51.3</td></tr><tr><td>△t=2</td><td>66.3</td><td>68.0</td><td>75.0</td><td>77.3</td><td>52.2</td><td>35.4</td><td>87.2</td><td>51.4</td></tr><tr><td>△t=3</td><td>66.5</td><td>68.9</td><td>74.9</td><td>77.7</td><td>52.1</td><td>35.3</td><td>87.3</td><td>51.6</td></tr><tr><td>△t=6</td><td>66.0</td><td>67.5</td><td>74.6</td><td>76.9</td><td>52.1</td><td>35.4</td><td>87.4</td><td>51.8</td></tr></table>
|
| 183 |
+
|
| 184 |
+
Virtual Trajectory in OOS. For simplicity, we follow the naive hypothesis of constant speed in Eq 8 to generate virtual trajectory in OOS. There are other alternatives like constant acceleration, regression-based fitting such as Linear Regression (LR) or Gaussian Process Regression (GPR), and Near Constant Acceleration Model (NCAM) [27]. The results of comparing these choices are shown in Table 6. For GPR, we use the RBF kernel [9] $\begin{array} { r } { k ( \mathbf { x } , \mathbf { x } ^ { \prime } ) = \exp { \left( - \frac { \vert \vert \mathbf { x } - \bar { \mathbf { x } } ^ { \prime } \vert \vert ^ { 2 } } { 5 0 } \right) } } \end{array}$ . We provide more studies on the kernel configuration in Appendix B. The results show that local hypotheses such as Constant Speed/Acceleration perform much better than global hypotheses such as LR and GPR. This is probably because, as virtual trajectory generation happens in an online fashion, it is hard to get a reliable fit using only limited data points on historical time steps.
|
| 185 |
+
|
| 186 |
+
$\Delta t$ in OCM. As discussed in Section 4, there is a trade-off when choosing the time difference $\Delta t$ in OCM. A large $\Delta t$ has better robustness over the noise under the linear motion assumption. However, in practice, a large $\Delta t$ is likely to discourage approximating object motion as linear. Therefore, we study the influence of varying $\Delta t$ in Table 7. Our results agree with our analysis that increasing $\Delta t$ from $\Delta t = 1$ can boost the association performance. It is believed to be effective in relieving the impact of noise on direction estimation. Keeping increasing $\Delta t$ higher than the bottleneck instead hurts the performance because of the difficulty of maintaining the approximation of linear motion.
|
| 187 |
+
|
| 188 |
+
# 5.4 LIMITATIONS
|
| 189 |
+
|
| 190 |
+
Our experiments reveal some limitations of OC-SORT. For example, when the video has a low frame rate or the object motion is fast, such as cars in KITTI, the proposed method falls short in matching objects by only using IoU and trajectory direction consistency. Nevertheless, SORT also has the same limitation. Adding other cues such as center distance [71] or appearance similarity has been demonstrated [ 62] efficient to solve this.
|
| 191 |
+
|
| 192 |
+
# 6 CONCLUSION
|
| 193 |
+
|
| 194 |
+
We analyze the popular motion-based SORT tracker and point out its intrinsic limitations from the use of the Kalman filter. These limitations play significant roles to hurt tracking accuracy when the tracker fails to gain observations for supervision - likely caused by unreliable detectors, occlusion, or fast and non-linear target object motion. To address these issues, we propose Observation-Centric SORT (OC-SORT). OC-SORT is more robust to occlusion and non-linear object motion while still being simple, online, and real-time. Our proposed method is motivated by both analytical and empirical findings and focuses on leveraging observations more confidently in the interaction with Kalman filter. In our experiments on multiple popular tracking datasets, OC-SORT significantly outperforms the state of the art. Our gains are especially significant for multi-object tracking under severe occlusion and on objects with dramatic non-linear motion.
|
| 195 |
+
|
| 196 |
+
# REFERENCES
|
| 197 |
+
|
| 198 |
+
[1] Brian DO Anderson and John B Moore. Optimal filtering. Courier Corporation, 2012. 2 [2] Yaakov Bar-Shalom, Fred Daum, and Jim Huang. The probabilistic data association filter. IEEE Control Systems Magazine, 29(6):82–100, 2009. 2
|
| 199 |
+
|
| 200 |
+
[3] Sumit Basu, Irfan Essa, and Alex Pentland. Motion regularization for model-based head tracking. In Proceedings of 13th International Conference on Pattern Recognition, volume 3, pp. 611–616. IEEE, 1996. 18
|
| 201 |
+
|
| 202 |
+
[4] Alex Bewley, Zongyuan Ge, Lionel Ott, Fabio Ramos, and Ben Upcroft. Simple online and realtime tracking. In 2016 IEEE international conference on image processing (ICIP), pp. 3464–3468. IEEE, 2016. 1, 2, 3, 8
|
| 203 |
+
|
| 204 |
+
[5] Gerald J Bierman. Factorization methods for discrete sequential estimation. Courier Corporation, 2006. 2, 5
|
| 205 |
+
|
| 206 |
+
[6] Guillem Braso and Laura Leal-Taix ´ e. Learning a neural solver for multiple object tracking. In ´ Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6247–6257, 2020. 8, 18
|
| 207 |
+
|
| 208 |
+
[7] Jinkun Cao, Hongyang Tang, Hao-Shu Fang, Xiaoyong Shen, Cewu Lu, and Yu-Wing Tai. Cross-domain adaptation for animal pose estimation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 9498–9507, 2019. 18
|
| 209 |
+
|
| 210 |
+
[8] Ming-Fang Chang, John Lambert, Patsorn Sangkloy, Jagjeet Singh, Slawomir Bak, Andrew Hartnett, De Wang, Peter Carr, Simon Lucey, Deva Ramanan, et al. Argoverse: 3d tracking and forecasting with rich maps. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8748–8757, 2019. 18
|
| 211 |
+
|
| 212 |
+
[9] Yin-Wen Chang, Cho-Jui Hsieh, Kai-Wei Chang, Michael Ringgaard, and Chih-Jen Lin. Training and testing low-degree polynomial data mappings via linear svm. Journal of Machine Learning Research, 11(4), 2010. 9
|
| 213 |
+
|
| 214 |
+
[10] Wongun Choi. Near-online multi-target tracking with aggregated local flow descriptor. In Proceedings of the IEEE international conference on computer vision, pp. 3029–3037, 2015. 2, 8
|
| 215 |
+
|
| 216 |
+
[11] Peng Chu, Jiang Wang, Quanzeng You, Haibin Ling, and Zicheng Liu. Transmot: Spatialtemporal graph transformer for multiple object tracking. arXiv preprint arXiv:2104.00194, 2021. 7
|
| 217 |
+
|
| 218 |
+
[12] Peng Dai, Renliang Weng, Wongun Choi, Changshui Zhang, Zhangping He, and Wei Ding. Learning a proposal classifier for multiple object tracking. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2443–2452, 2021. 18
|
| 219 |
+
|
| 220 |
+
[13] Patrick Dendorfer, Hamid Rezatofighi, Anton Milan, Javen Shi, Daniel Cremers, Ian Reid, Stefan Roth, Konrad Schindler, and Laura Leal-Taixe. Mot20: A benchmark for multi object ´ tracking in crowded scenes. arXiv preprint arXiv:2003.09003, 2020. 6, 19
|
| 221 |
+
|
| 222 |
+
[14] David Duvenaud. Automatic model construction with Gaussian processes. PhD thesis, University of Cambridge, 2014. 17
|
| 223 |
+
|
| 224 |
+
[15] Hao-Shu Fang, Jinkun Cao, Yu-Wing Tai, and Cewu Lu. Pairwise body-part attention for recognizing human-object interactions. In Proceedings of the European conference on computer vision (ECCV), pp. 51–67, 2018. 18
|
| 225 |
+
|
| 226 |
+
[16] D Fraser and J Potter. The optimum linear smoother as a combination of two optimum linear filters. IEEE Transactions on automatic control, 14(4):387–390, 1969. 2, 5
|
| 227 |
+
|
| 228 |
+
[17] Juergen Gall, Angela Yao, Nima Razavi, Luc Van Gool, and Victor Lempitsky. Hough forests for object detection, tracking, and action recognition. IEEE transactions on pattern analysis and machine intelligence, 33(11):2188–2202, 2011. 18
|
| 229 |
+
|
| 230 |
+
[18] Damien Garreau, Wittawat Jitkrittum, and Motonobu Kanagawa. Large sample analysis of the median heuristic. arXiv preprint arXiv:1707.07269, 2017. 18
|
| 231 |
+
|
| 232 |
+
[19] Zheng Ge, Songtao Liu, Feng Wang, Zeming Li, and Jian Sun. Yolox: Exceeding yolo series in 2021. arXiv preprint arXiv:2107.08430, 2021. 6, 19
|
| 233 |
+
|
| 234 |
+
[20] Andreas Geiger, Philip Lenz, Christoph Stiller, and Raquel Urtasun. Vision meets robotics: The kitti dataset. The International Journal of Robotics Research, 32(11):1231–1237, 2013. 6 [21] Nicolas Franco Gonzalez, Andres Ospina, and Philippe Calvez. Smat: Smart multiple affinity metrics for multiple object tracking. In International Conference on Image Analysis and Recognition, pp. 48–62. Springer, 2020. 8
|
| 235 |
+
|
| 236 |
+
[22] Fredrik Gustafsson, Fredrik Gunnarsson, Niclas Bergman, Urban Forssell, Jonas Jansson, Rickard Karlsson, and P-J Nordlund. Particle filters for positioning, navigation, and tracking. IEEE Transactions on signal processing, 50(2):425–437, 2002. 2
|
| 237 |
+
|
| 238 |
+
[23] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016. 3
|
| 239 |
+
|
| 240 |
+
[24] David V Hinkley. On the ratio of two correlated normal random variables. Biometrika, 56(3): 635–639, 1969. 15
|
| 241 |
+
|
| 242 |
+
[25] Andrea Hornakova, Roberto Henschel, Bodo Rosenhahn, and Paul Swoboda. Lifted disjoint paths with application in multiple object tracking. In International Conference on Machine Learning, pp. 4364–4375. PMLR, 2020. 18
|
| 243 |
+
|
| 244 |
+
[26] Andrea Hornakova, Timo Kaiser, Paul Swoboda, Michal Rolinek, Bodo Rosenhahn, and Roberto Henschel. Making higher order mot scalable: An efficient approximate solver for lifted disjoint paths. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 6330–6340, 2021. 18
|
| 245 |
+
|
| 246 |
+
[27] Andrew H Jazwinski. Stochastic processes and filtering theory. Courier Corporation, 2007. 9 [28] Simon J Julier and Jeffrey K Uhlmann. New extension of the kalman filter to nonlinear systems. In Signal processing, sensor fusion, and target recognition VI, volume 3068, pp. 182–193. International Society for Optics and Photonics, 1997. 2, 16
|
| 247 |
+
|
| 248 |
+
[29] Simon J Julier and Jeffrey K Uhlmann. Unscented filtering and nonlinear estimation. Proceedings of the IEEE, 92(3):401–422, 2004. 16
|
| 249 |
+
|
| 250 |
+
[30] Rudolf Emil Kalman et al. Contributions to the theory of optimal control. Bol. soc. mat. mexicana, 5(2):102–119, 1960. 2, 3, 16
|
| 251 |
+
|
| 252 |
+
[31] Kris M Kitani, Brian D Ziebart, James Andrew Bagnell, and Martial Hebert. Activity forecasting. In European conference on computer vision, pp. 201–214. Springer, 2012. 18
|
| 253 |
+
|
| 254 |
+
[32] Jonathan Ko and Dieter Fox. Gp-bayesfilters: Bayesian filtering using gaussian process prediction and observation models. Autonomous Robots, 27(1):75–90, 2009. 16
|
| 255 |
+
|
| 256 |
+
[33] Parth Kothari, Sven Kreiss, and Alexandre Alahi. Human trajectory forecasting in crowds: A deep learning perspective. IEEE Transactions on Intelligent Transportation Systems, 2021. 18 [34] Erich L Lehmann and George Casella. Theory of point estimation. Springer Science & Business Media, 2006. 2
|
| 257 |
+
|
| 258 |
+
[35] Wei Li, Yuanjun Xiong, Shuo Yang, Mingze Xu, Yongxin Wang, and Wei Xia. Semi-tcl: Semisupervised track contrastive representation learning. arXiv preprint arXiv:2107.02396, 2021. 7
|
| 259 |
+
|
| 260 |
+
[36] Chao Liang, Zhipeng Zhang, Yi Lu, Xue Zhou, Bing Li, Xiyong Ye, and Jianxiao Zou. Rethinking the competition between detection and reid in multi-object tracking. arXiv preprint arXiv:2010.12138, 2020. 7
|
| 261 |
+
|
| 262 |
+
[37] Jonathon Luiten, Aljosa Osep, Patrick Dendorfer, Philip Torr, Andreas Geiger, Laura LealTaixe, and Bastian Leibe. Hota: A higher order metric for evaluating multi-object tracking.´ International journal of computer vision, 129(2):548–578, 2021. 7
|
| 263 |
+
|
| 264 |
+
[38] Tim Meinhardt, Alexander Kirillov, Laura Leal-Taixe, and Christoph Feichtenhofer. Trackformer: Multi-object tracking with transformers. arXiv preprint arXiv:2101.02702, 2021. 3, 18
|
| 265 |
+
|
| 266 |
+
[39] Stan Melax, Leonid Keselman, and Sterling Orsten. Dynamics based 3d skeletal hand tracking. In Proceedings of the ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games, pp. 184–184, 2013. 18
|
| 267 |
+
|
| 268 |
+
[40] Anton Milan, Laura Leal-Taixe, Ian Reid, Stefan Roth, and Konrad Schindler. Mot16: A ´ benchmark for multi-object tracking. arXiv preprint arXiv:1603.00831, 2016. 4, 6
|
| 269 |
+
|
| 270 |
+
[41] Jiangmiao Pang, Linlu Qiu, Xia Li, Haofeng Chen, Qi Li, Trevor Darrell, and Fisher Yu. Quasi-dense similarity learning for multiple object tracking. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 164–173, 2021. 3, 7, 8, 18
|
| 271 |
+
|
| 272 |
+
[42] Dezhi Peng, Zikai Sun, Zirong Chen, Zirui Cai, Lele Xie, and Lianwen Jin. Detecting heads using feature refine net and cascaded multi-scale architecture. arXiv preprint arXiv:1803.09256, 2018. 18
|
| 273 |
+
|
| 274 |
+
[43] Lawrence Rabiner and Biinghwang Juang. An introduction to hidden markov models. ieee assp magazine, 3(1):4–16, 1986. 2
|
| 275 |
+
|
| 276 |
+
[44] Akshay Rangesh, Pranav Maheshwari, Mez Gebre, Siddhesh Mhatre, Vahid Ramezani, and Mohan M Trivedi. Trackmpnn: A message passing graph neural architecture for multi-object tracking. arXiv preprint arXiv:2101.04206, 2021. 8
|
| 277 |
+
|
| 278 |
+
[45] Herbert E Rauch, F Tung, and Charlotte T Striebel. Maximum likelihood estimates of linear dynamic systems. AIAA journal, 3(8):1445–1450, 1965. 2, 5
|
| 279 |
+
|
| 280 |
+
[46] Joseph Redmon, Santosh Divvala, Ross Girshick, and Ali Farhadi. You only look once: Unified, real-time object detection. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 779–788, 2016. 2
|
| 281 |
+
|
| 282 |
+
[47] Steven Reece and Stephen Roberts. An introduction to gaussian processes for the kalman filter expert. In 2010 13th International Conference on Information Fusion, pp. 1–9. IEEE, 2010. 16
|
| 283 |
+
|
| 284 |
+
[48] Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. Advances in neural information processing systems, 28, 2015. 2, 5
|
| 285 |
+
|
| 286 |
+
[49] Toby Sharp, Cem Keskin, Duncan Robertson, Jonathan Taylor, Jamie Shotton, David Kim, Christoph Rhemann, Ido Leichter, Alon Vinnikov, Yichen Wei, et al. Accurate, robust, and flexible real-time hand tracking. In Proceedings of the 33rd annual ACM conference on human factors in computing systems, pp. 3633–3642, 2015. 18
|
| 287 |
+
|
| 288 |
+
[50] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. 3, 5
|
| 289 |
+
|
| 290 |
+
[51] Gerald L Smith, Stanley F Schmidt, and Leonard A McGee. Application of statistical filter theory to the optimal estimation of position and velocity on board a circumlunar vehicle. National Aeronautics and Space Administration, 1962. 2, 16
|
| 291 |
+
|
| 292 |
+
[52] Daniel Stadler and Jurgen Beyerer. Improving multiple pedestrian tracking by track management and occlusion handling. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10958–10967, 2021. 18
|
| 293 |
+
|
| 294 |
+
[53] Peize Sun, Jinkun Cao, Yi Jiang, Rufeng Zhang, Enze Xie, Zehuan Yuan, Changhu Wang, and Ping Luo. Transtrack: Multiple object tracking with transformer. arXiv preprint arXiv:2012.15460, 2020. 3, 7, 8
|
| 295 |
+
|
| 296 |
+
[54] Peize Sun, Jinkun Cao, Yi Jiang, Zehuan Yuan, Song Bai, Kris Kitani, and Ping Luo. Dancetrack: Multi-object tracking in uniform appearance and diverse motion. arXiv preprint arXiv:2111.14690, 2021. 2, 6, 19
|
| 297 |
+
|
| 298 |
+
[55] Ramana Sundararaman, Cedric De Almeida Braga, Eric Marchand, and Julien Pettre. Tracking pedestrian heads in dense crowd. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3865–3875, 2021. 6, 17, 18, 19
|
| 299 |
+
|
| 300 |
+
[56] Pavel Tokmakov, Jie Li, Wolfram Burgard, and Adrien Gaidon. Learning to track with object permanence. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 10860–10869, 2021. 6, 7, 8
|
| 301 |
+
|
| 302 |
+
[57] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. 3
|
| 303 |
+
|
| 304 |
+
[58] Gaoang Wang, Renshu Gu, Zuozhu Liu, Weijie Hu, Mingli Song, and Jenq-Neng Hwang. Track without appearance: Learn box and tracklet embedding with local and global motion patterns for vehicle tracking. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 9876–9886, 2021. 8
|
| 305 |
+
|
| 306 |
+
[59] Shuai Wang, Hao Sheng, Yang Zhang, Yubin Wu, and Zhang Xiong. A general recurrent tracking framework without real data. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 13219–13228, 2021. 7
|
| 307 |
+
|
| 308 |
+
[60] Yongxin Wang, Kris Kitani, and Xinshuo Weng. Joint object detection and multi-object tracking with graph neural networks. In 2021 IEEE International Conference on Robotics and Automation (ICRA), pp. 13708–13715. IEEE, 2021. 7
|
| 309 |
+
|
| 310 |
+
[61] Christopher Williams and Carl Rasmussen. Gaussian processes for regression. Advances in neural information processing systems, 8, 1995. 16
|
| 311 |
+
|
| 312 |
+
[62] Nicolai Wojke, Alex Bewley, and Dietrich Paulus. Simple online and realtime tracking with a deep association metric. In 2017 IEEE international conference on image processing (ICIP), pp. 3645–3649. IEEE, 2017. 2, 3, 8, 9
|
| 313 |
+
|
| 314 |
+
[63] Jialian Wu, Jiale Cao, Liangchen Song, Yu Wang, Ming Yang, and Junsong Yuan. Track to detect and segment: An online multi-object tracker. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 12352–12361, 2021. 8
|
| 315 |
+
|
| 316 |
+
[64] Yu Xiang, Alexandre Alahi, and Silvio Savarese. Learning to track: Online multi-object tracking by decision making. In Proceedings of the IEEE international conference on computer vision, pp. 4705–4713, 2015. 8
|
| 317 |
+
|
| 318 |
+
[65] Yuliang Xiu, Jiefeng Li, Haoyu Wang, Yinghong Fang, and Cewu Lu. Pose flow: Efficient online pose tracking. arXiv preprint arXiv:1802.00977, 2018. 18
|
| 319 |
+
|
| 320 |
+
[66] Yihong Xu, Yutong Ban, Guillaume Delorme, Chuang Gan, Daniela Rus, and Xavier AlamedaPineda. Transcenter: Transformers with dense queries for multiple-object tracking. arXiv preprint arXiv:2103.15145, 2021. 7, 18
|
| 321 |
+
|
| 322 |
+
[67] Fangao Zeng, Bin Dong, Tiancai Wang, Xiangyu Zhang, and Yichen Wei. Motr: End-to-end multiple-object tracking with transformer. arXiv preprint arXiv:2105.03247, 2021. 3, 7, 8
|
| 323 |
+
|
| 324 |
+
[68] Yifu Zhang, Peize Sun, Yi Jiang, Dongdong Yu, Zehuan Yuan, Ping Luo, Wenyu Liu, and Xinggang Wang. Bytetrack: Multi-object tracking by associating every detection box. arXiv preprint arXiv:2110.06864, 2021. 2, 6, 7, 8, 9
|
| 325 |
+
|
| 326 |
+
[69] Yifu Zhang, Chunyu Wang, Xinggang Wang, Wenjun Zeng, and Wenyu Liu. Fairmot: On the fairness of detection and re-identification in multiple object tracking. International Journal of Computer Vision, 129(11):3069–3087, 2021. 3, 7, 8, 17, 18, 19
|
| 327 |
+
|
| 328 |
+
[70] Xingyi Zhou, Dequan Wang, and Philipp Krahenb ¨ uhl. Objects as points. ¨ arXiv preprint arXiv:1904.07850, 2019. 2
|
| 329 |
+
|
| 330 |
+
[71] Xingyi Zhou, Vladlen Koltun, and Philipp Krahenb ¨ uhl. Tracking objects as points. In ¨ European Conference on Computer Vision, pp. 474–490. Springer, 2020. 2, 8, 9, 18
|
| 331 |
+
|
| 332 |
+
# A VELOCITY DIRECTION VARIANCE IN OCM
|
| 333 |
+
|
| 334 |
+
In this section, we work on the setting of linear motion with noisy states. We provide proof that the trajectory direction estimation has a smaller variance if the two states we use for the estimation have a larger time difference. We assume the motion model is $\mathbf { x } _ { t } = f ( t ) + \epsilon$ where $\epsilon$ is gaussian noise and the ground-truth center position of the target is $( \mu _ { u _ { t } } , \mu _ { v _ { t } } )$ at time step $t$ . Then, estimated on two steps $t _ { 1 }$ and $t _ { 2 }$ , the true motion direction between these two points is
|
| 335 |
+
|
| 336 |
+
$$
|
| 337 |
+
\theta = a r c t a n ( \frac { \mu _ { v _ { t _ { 1 } } } - \mu _ { v _ { t _ { 2 } } } } { \mu _ { u _ { t _ { 1 } } } - \mu _ { u _ { t _ { 2 } } } } ) ,
|
| 338 |
+
$$
|
| 339 |
+
|
| 340 |
+
which is a constant if our estimation incurs zero noise. And we have $\mu _ { v _ { t _ { 1 } } } - \mu _ { v _ { t _ { 2 } } } \propto t _ { 1 } - t _ { 2 }$ , $\mu _ { u _ { t _ { 1 } } } - \mu _ { u _ { t _ { 2 } } } \propto t _ { 1 } - t _ { 2 }$ . As the detection results do not suffer from the error accumulation due to propagating along Markov process as Kalman filter does, we can assume the states from observation suffers some i.i.d. noise, i.e., $u _ { t } \sim \mathcal { N } ( \mu _ { u _ { t } } , \sigma _ { u } ^ { 2 } )$ and $v _ { t } \sim \mathcal { N } ( \mu _ { v _ { t } } , \sigma _ { v } ^ { 2 } )$ . We now analyze the noise of the estimated $\begin{array} { r } { \tilde { \theta } = \frac { v _ { t _ { 1 } } - v _ { t _ { 2 } } } { u _ { t _ { 1 } } - u _ { t _ { 2 } } } } \end{array}$ by two observations on the trajectory. Because the function of arctan(·) is monotone over the whole real field, we can study $t a n \tilde { \theta }$ instead which simplifies the analysis. We denote $w = u _ { t _ { 1 } } - u _ { t _ { 2 } }$ , $y = v _ { t _ { 1 } } - v _ { t _ { 2 } }$ , and $\begin{array} { r } { z \ = \ \frac { y } { w } } \end{array}$ , first we can see that $y$ and $w$ jointly form a Gaussian distribution:
|
| 341 |
+
|
| 342 |
+
$$
|
| 343 |
+
\left[ \boldsymbol { y } \right] \sim \mathcal { N } \left( \left[ \begin{array} { l } { \mu _ { y } } \\ { \mu _ { w } } \end{array} \right] , \left[ \begin{array} { c c } { \sigma _ { y } ^ { 2 } } & { \rho \sigma _ { y } \sigma _ { w } } \\ { \rho \sigma _ { y } \sigma _ { w } } & { \sigma _ { w } ^ { 2 } } \end{array} \right] \right) ,
|
| 344 |
+
$$
|
| 345 |
+
|
| 346 |
+
where $\mu _ { y } = \mu _ { v _ { t _ { 1 } } } - \mu _ { v _ { t 2 } }$ , $\mu _ { w } = \mu _ { u _ { t _ { 1 } } } - \mu _ { u _ { t _ { 2 } } }$ , $\sigma _ { w } = \sqrt { 2 } \sigma _ { u }$ and $\sigma _ { y } = \sqrt { 2 } \sigma _ { v }$ , and $\rho$ is the correlation 1coefficient between $y$ and $w$ 1 2. We can actually derive a closed-form solution of the probability density function [ 24] of $z$ as
|
| 347 |
+
|
| 348 |
+
$$
|
| 349 |
+
\begin{array} { c c l } { p ( z ) = \displaystyle \frac { g ( z ) e ^ { \frac { g ( z ) ^ { 2 } - \alpha r ( z ) ^ { 2 } } { 2 \beta ^ { 2 } r ( z ) ^ { 2 } } } } { \sqrt { 2 \pi } \sigma _ { w } \sigma _ { y } r \left( z \right) ^ { 3 } } \left[ \Phi \left( \displaystyle \frac { g ( z ) } { \beta r ( z ) } \right) - \Phi \left( - \frac { g ( z ) } { \beta r ( z ) } \right) \right] } \\ { + \displaystyle \frac { \beta e ^ { - 2 \alpha / \beta } } { \pi \sigma _ { w } \sigma _ { y } r \left( z \right) ^ { 2 } } } \end{array}
|
| 350 |
+
$$
|
| 351 |
+
|
| 352 |
+
where
|
| 353 |
+
|
| 354 |
+
$$
|
| 355 |
+
\begin{array} { l } { { r ( z ) = \displaystyle { \sqrt { \frac { z ^ { 2 } } { \sigma _ { y } ^ { 2 } } - \frac { 2 \rho z } { \sigma _ { y } \sigma _ { w } } + \frac { 1 } { \sigma _ { w } ^ { 2 } } } } , \qquad } } \\ { { g ( z ) = \displaystyle { \frac { \mu _ { y } z } { \sigma _ { y } ^ { 2 } } - \frac { \rho ( \mu _ { y } + \mu _ { w } z ) } { \sigma _ { y } \sigma _ { w } } + \frac { \mu _ { w } } { \sigma _ { w } ^ { 2 } } } , \qquad } } \\ { { \alpha = \displaystyle { \frac { \mu _ { w } ^ { 2 } + \mu _ { y } ^ { 2 } } { \sigma _ { y } ^ { 2 } } - \frac { 2 \rho \mu _ { y } \mu _ { w } } { \sigma _ { w } \sigma _ { y } } } , \qquad \beta = \sqrt { 1 - \rho ^ { 2 } } } , } \end{array}
|
| 356 |
+
$$
|
| 357 |
+
|
| 358 |
+
and $\Phi$ is the cumulative distribution function of the standard normal. Without loss of generality, we can assume $\mu _ { w } > 0$ and $\mu _ { y } > 0$ because negative ground-truth displacements enjoy the same property. This solution has a good property that larger $\mu _ { w }$ or $\mu _ { y }$ makes the probability density at the true value, i.e. $\begin{array} { r } { \mu _ { z } = \frac { \mu _ { y } } { \mu _ { w } } } \end{array}$ , higher, and the tails decay more rapidly. So the estimation of arctanθ, also $\theta$ , has smaller noise when $\mu _ { w }$ or $\mu _ { y }$ is larger. Under the assumption of linear motion, we thus should select two observations with a large temporal difference to estimate the direction.
|
| 359 |
+
|
| 360 |
+
It is reasonable to assume the noise of detection along the u-axis and v-axis are independent so $\rho = 0$ . And when representing the center position in pixel, it is also moderate to assume $\sigma _ { w } = \sigma _ { y } = 1$ (also for the ease of presentation). Then, with different true value of $\begin{array} { r } { \mu _ { z } = \frac { \mu _ { y } } { \mu _ { w } } } \end{array}$ , the visualizations of $p ( z )$ over $z$ and $\mu _ { y }$ are shown in Figure 4. The visualization demonstrates our analysis above. Moreover, it shows that when the value of $\mu _ { y }$ or $\mu _ { w }$ is small, the cluster peak of the distribution at $\mu _ { z }$ is not significant anymore, as the noise $\sigma _ { y }$ and $\sigma _ { w }$ can be dominant. Considering the visualization shows that happens when $\mu _ { y }$ is close to $\sigma _ { y }$ , this can actually happen when we estimate the speed by observations from two consecutive frames because the variance of observation can be close to the absolute displacement of object motion. This makes another support to our analysis in the main paper about the sensitivity to state estimation noise.
|
| 361 |
+
|
| 362 |
+

|
| 363 |
+
Figure 4: The probability density of $z = t a n \theta$ under different true value of $z$ , i.e. $\begin{array} { r } { \mu _ { z } = \frac { \mu _ { y } } { \mu _ { w } } } \end{array}$ . We set $\mu _ { y }$ and $z$ as two variables. It shows that under different settings of true velocity direction when $\mu _ { y }$ is smaller, the probability of estimated value with a significant shift from the true value is higher. As $\mu _ { y }$ is proportional to the time difference of the two selected observations under linear motion assumption, it relates to the case that the two steps for velocity direction estimation has a shorter time difference.
|
| 364 |
+
|
| 365 |
+
Table 8: Ablation study about the interpolation post-processing.
|
| 366 |
+
|
| 367 |
+
<table><tr><td>一</td><td colspan="4">MOT17-val</td><td colspan="4">DanceTrack-val</td></tr><tr><td></td><td>HOTA↑</td><td>AssA↑</td><td>MOTA↑</td><td>IDF1个</td><td>HOTA↑</td><td>AssA↑</td><td>MOTA↑</td><td>IDF1个</td></tr><tr><td>w/o interpolation</td><td>66.5</td><td>68.9</td><td>74.9</td><td>77.7</td><td>52.1</td><td>35.3</td><td>87.3</td><td>51.6</td></tr><tr><td>Linear Interpolation</td><td>68.0</td><td>69.9</td><td>77.9</td><td>79.3</td><td>52.8</td><td>35.6</td><td>89.8</td><td>52.1</td></tr><tr><td>GPR Interpolation</td><td>65.2</td><td>67.0</td><td>72.9</td><td>75.9</td><td>51.6</td><td>35.0</td><td>86.1</td><td>51.2</td></tr></table>
|
| 368 |
+
|
| 369 |
+
# B INTERPOLATION BY GAUSSIAN PROGRESS REGRESSION
|
| 370 |
+
|
| 371 |
+
Interpolation as post-processing. Although we focus on developing an online tracking algorithm, we are also interested in whether post-process can further optimize the tracking results in diverse conditions. However, we emphasize that usually we only allow interpolation in video object tracking and this makes the process not online anymore. Moreover, interpolation is typically limited to fill the track states on frames where they are missing. As the contrary, the commonly used smoothing techniques in Bayesian estimation, such as fix-lag smoother and fix-interval smoother, are not allowed for object tracking because they require to modify the states already fixed in the tracks on previous time steps instead of just filling missing data points.
|
| 372 |
+
|
| 373 |
+
Despite the failure of GPR in online tracking in Table 6, we continue to study if GPR is better suited for interpolation in Table 8. We compare GPR with the widely-used linear interpolation. The maximum gap for interpolation is set as 20 frames and we use the same kernel for GPR as mentioned above. The results suggest that the GPR’s non-linear interpolation is simply not efficient. We think this is due to limited data points which results in an inaccurate fit of the object trajectory. Further, the variance in regressor predictions introduces extra noise. Although GPR interpolation decreases the performance on MOT17-val significantly, its negative influence on DanceTrack is relatively minor where the object motion is more non-linear. We believe how to fit object trajectory with non-linear hypothesis still requires more study.
|
| 374 |
+
|
| 375 |
+
From the analysis in the main paper, the failure of SORT can mainly result from occlusion (lack of observations) or the non-linear motion of objects (the break of the linear-motion assumption). So the question arises naturally whether we can extend SORT free of the linear-motion assumption or at least more robust when it breaks.
|
| 376 |
+
|
| 377 |
+
One way is to extend from KF to non-linear filters, such as EKF [30,51] and UKF [28]. However, for real-world online tracking, they can be hard to be adopted as they need knowledge about the motion pattern or still rely on the techniques fragile to non-linear patterns, such as linearization [ 29]. Another choice is to gain the knowledge beyond linearity by regressing previous trajectory, such as combing Gaussian Process (GP) [61,47,32]: given a observation $\mathbf { z } _ { \star }$ and a kernel function $k ( \cdot , \cdot )$ , GP defines gaussian functions with mean $\mu _ { \mathbf { z } _ { \star } }$ and variance $\Sigma _ { \mathbf { z } _ { \star } }$ as
|
| 378 |
+
|
| 379 |
+
$$
|
| 380 |
+
\begin{array} { r l } & { \mu _ { \mathbf { z } _ { \star } } = \mathbf { k } _ { \star } ^ { \top } [ \mathbf { K } + \sigma ^ { 2 } \mathbf { I } ] ^ { - 1 } \mathbf { y } , } \\ & { \Sigma _ { \mathbf { z } _ { \star } } = k ( \mathbf { z } _ { \star } , \mathbf { z } _ { \star } ) - \mathbf { k } _ { \star } ^ { \top } [ \mathbf { K } + \sigma ^ { 2 } \mathbf { I } ] ^ { - 1 } \mathbf { k } _ { \star } , } \end{array}
|
| 381 |
+
$$
|
| 382 |
+
|
| 383 |
+
Table 9: Ablation study about using Gaussian Process Regression for object trajectory interpolation. LI indicates Linear Interpolation, which is used to interpolate the trajectory before smoothing the trajectory by GPR. MT indicates Median Trick for kernel choice in regression. $L _ { \tau }$ is the length of trajectory.
|
| 384 |
+
|
| 385 |
+
<table><tr><td></td><td colspan="4"></td><td colspan="4">DanceTrack-val</td></tr><tr><td>Interpolation Method</td><td>HOTA</td><td>AssA</td><td>MOTA</td><td>IDF1</td><td>HOTA</td><td>AssA</td><td>MOTA</td><td>IDF1</td></tr><tr><td>w/o interpolation</td><td>66.5</td><td>68.9</td><td>74.9</td><td>77.7</td><td>52.1</td><td>35.3</td><td>87.3</td><td>51.6</td></tr><tr><td>Linear Interpolation</td><td>69.6</td><td>69.9</td><td>77.9</td><td>79.3</td><td>52.8</td><td>35.6</td><td>89.8</td><td>52.1</td></tr><tr><td>GPR Interp,l =1</td><td>66.2</td><td>67.6</td><td>74.3</td><td>76.6</td><td>51.8</td><td>35.0</td><td>86.6</td><td>50.8</td></tr><tr><td>GPR Interp,l =5</td><td>66.3</td><td>67.0</td><td>72.9</td><td>75.9</td><td>51.8</td><td>35.1</td><td>86.5</td><td>51.1</td></tr><tr><td>GPR Interp,l= LT</td><td>66.1</td><td>67.0</td><td>73.1</td><td>77.8</td><td>51.6</td><td>35.1</td><td>86.4</td><td>50.7</td></tr><tr><td>GPR Interp,l= 1000/LT</td><td>65.9</td><td>67.0</td><td>73.0</td><td>77.8</td><td>51.8</td><td>35.0</td><td>86.9</td><td>51.0</td></tr><tr><td>GPR Interp,l=MT(τ)</td><td>65.9</td><td>67.0</td><td>73.1</td><td>77.8</td><td>51.7</td><td>35.1</td><td>86.7</td><td>50.9</td></tr><tr><td>LI + GPR Smoothing,l =1</td><td>69.5</td><td>69.6</td><td>77.8</td><td>79.3</td><td>52.8</td><td>35.6</td><td>89.9</td><td>52.1</td></tr><tr><td>LI + GPR Smoothing,l =5</td><td>69.5</td><td>69.7</td><td>77.8</td><td>79.3</td><td>52.9</td><td>34.9</td><td>89.7</td><td>52.1</td></tr><tr><td>LI+ GPR Smoothing,l=LT</td><td>69.6</td><td>69.5</td><td>77.8</td><td>79.2</td><td>52.9</td><td>35.6</td><td>89.9</td><td>52.1</td></tr><tr><td>LI + GPR Smoothing,l = 1000/LT</td><td>69.5</td><td>69.9</td><td>77.8</td><td>79.3</td><td>53.0</td><td>35.6</td><td>89.9</td><td>52.1</td></tr><tr><td>LI+ GPR Smoothing,l = MT(𝜏)</td><td>69.5</td><td>69.6</td><td>77.8</td><td>79.3</td><td>52.8</td><td>35.6</td><td>89.8</td><td>52.1</td></tr></table>
|
| 386 |
+
|
| 387 |
+
where ${ \bf k } _ { \star }$ is the kernel matrix between the input and training data and $\mathbf { K }$ is the kernel matrix over training data, $\mathbf { y }$ is the output of data. In the main paper, we show a primary study of using Gaussian Process Regression (GPR) in the online generation of the virtual trajectory in OOS and offline interpolation. But neither of them successfully boosts the tracking performance. In this section, We investigate in detail the chance of combining GPR and SORT for multi-object tracking for interpolation as some designs are worth more study.
|
| 388 |
+
|
| 389 |
+
# B.1 CHOICE OF KERNEL FUNCTION IN GAUSSIAN PROCESS
|
| 390 |
+
|
| 391 |
+
The kernel function is a key variable of GPR. There is not a generally efficient guideline to choose the kernel for Gaussian Process Regression though some basic observations are available [14]. When there is no additional knowledge about the time sequential data to fit, the RBF kernel is one of the most common choices:
|
| 392 |
+
|
| 393 |
+
$$
|
| 394 |
+
k ( \mathbf { x } , \mathbf { x } ^ { \prime } ) = \sigma ^ { 2 } \mathbf { e x p } \left( - \frac { | | \mathbf { x } - \mathbf { x } ^ { \prime } | | ^ { 2 } } { 2 l ^ { 2 } } \right) ,
|
| 395 |
+
$$
|
| 396 |
+
|
| 397 |
+
where $l$ is the lengthscale of the data to be fit. It determines the length of the “wiggles” of the target function. $\sigma ^ { 2 }$ is the output variance that determines the average distance of the function away from its mean. This is usually just a scale factor [ 14]. GPR is considered sensitive to $l$ in some situations. So we conduct an ablation study over it in the offline interpolation to see if we can use GPR to outperform the linear interpolation widely used in multi-object tracking.
|
| 398 |
+
|
| 399 |
+
Table 10: Results on CroHD Head Tracking dataset[55]. Our method uses the detections from HeadHunter [55] or FairMOT [69] to generate new tracks.
|
| 400 |
+
|
| 401 |
+
<table><tr><td>Tracker</td><td>HOTA↑</td><td>MOTA↑</td><td>IDF1个</td><td>FP(104)</td><td>FN(104)↓</td><td>IDs↓</td><td>Frag↓</td></tr><tr><td>HeadHunter[55]</td><td>36.8</td><td>57.8</td><td>53.9</td><td>5.18</td><td>30.0</td><td>4,394</td><td>15,146</td></tr><tr><td>HeadHunter dets + OC-SORT</td><td>39.0</td><td>60.0</td><td>56.8</td><td>5.18</td><td>28.1</td><td>4,122</td><td>10,483</td></tr><tr><td>FairMOT[69]</td><td>43.0</td><td>60.8</td><td>62.8</td><td>11.8</td><td>19.9</td><td>12,781</td><td>41,399</td></tr><tr><td>FairMOT dets + OC-SORT</td><td>44.1</td><td>67.9</td><td>62.9</td><td>10.2</td><td>16.4</td><td>4,243</td><td>10,122</td></tr></table>
|
| 402 |
+
|
| 403 |
+
Table 11: Results on DanceTrack test set. “Ours (MOT17)” uses the YOLOX detector trained on MOT17-training set.
|
| 404 |
+
|
| 405 |
+
<table><tr><td>Tracker</td><td>HOTA↑</td><td>DetA↑</td><td>AssA↑</td><td>MOTA↑</td><td>IDF1个</td></tr><tr><td>SORT</td><td>47.9</td><td>72.0</td><td>31.2</td><td>91.8</td><td>50.8</td></tr><tr><td>Ours</td><td>55.1</td><td>80.3</td><td>38.0</td><td>89.4</td><td>54.2</td></tr><tr><td>Ours (MOT17)</td><td>48.6</td><td>71.0</td><td>33.3</td><td>84.2</td><td>51.5</td></tr></table>
|
| 406 |
+
|
| 407 |
+
Table 12: Results on MOT17 test set with the public detections. LI indicates Linear Interpolation.
|
| 408 |
+
|
| 409 |
+
<table><tr><td>Tracker</td><td>HOTA↑</td><td>MOTA↑</td><td>IDF1个</td><td>FP(104↓</td><td>FN(104)↓</td><td>IDs↓</td><td>Frag↓</td><td>AssA↑</td><td>AssR↑</td></tr><tr><td>CenterTrack[71]</td><td>-</td><td>61.5</td><td>59.6</td><td>1.41</td><td>20.1</td><td>2,583</td><td>-</td><td>-</td><td>=</td></tr><tr><td>QDTrack[41]</td><td>-</td><td>64.6</td><td>65.1</td><td>1.41</td><td>18.3</td><td>2.652</td><td>-</td><td>-</td><td>=</td></tr><tr><td>Lif-T[25]</td><td>51.3</td><td>60.5</td><td>65.6</td><td>1.50</td><td>20.7</td><td>1,189</td><td>3,476</td><td>54.7</td><td>59.0</td></tr><tr><td>TransCt[66] [38]</td><td>51.4</td><td>68.8</td><td>61.4</td><td>2.29</td><td>14.9</td><td>4,102</td><td>8.468</td><td>47.7</td><td>52.8</td></tr><tr><td>TrackFormer</td><td>-</td><td>62.5</td><td>60.7</td><td>3.28</td><td>17.5</td><td>2.540</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Ours</td><td>52.4</td><td>58.2</td><td>65.1</td><td>0.44</td><td>23.0</td><td>784</td><td>2.006</td><td>57.6</td><td>63.5</td></tr><tr><td>Ours + LI</td><td>52.9</td><td>59.4</td><td>65.7</td><td>0.66</td><td>22.2</td><td>801</td><td>1,030</td><td>57.5</td><td>63.9</td></tr></table>
|
| 410 |
+
|
| 411 |
+
Table 13: Results on MOT20 test set with the public detections. LI indicates Linear Interpolation.
|
| 412 |
+
|
| 413 |
+
<table><tr><td>Tracker</td><td>HOTA↑</td><td>MOTA↑</td><td>IDF1个</td><td>FP(104↓</td><td>FN(104↓</td><td>IDs↓</td><td>Frag↓</td><td>AssA↑</td><td>AssR↑</td></tr><tr><td>MPNTrack[6]</td><td>46.8</td><td>57.6</td><td>59.1</td><td>17.0</td><td>20.1</td><td>1,210</td><td>1,420</td><td>47.3</td><td>52.7</td></tr><tr><td>TransCt66]</td><td>43.5</td><td>61.0</td><td>49.8</td><td>4.92</td><td>14.8</td><td>4,493</td><td>8.950</td><td>36.1</td><td>44.5</td></tr><tr><td>ApLift[26]</td><td>46.6</td><td>58.9</td><td>56.5</td><td>1.77</td><td>19.3</td><td>2,241</td><td>2,112</td><td>45.2</td><td>48.1</td></tr><tr><td>TMOH[52]</td><td>48.9</td><td>60.1</td><td>61.2</td><td>3.80</td><td>16.6</td><td>2,342</td><td>4,320</td><td>48.4</td><td>52.9</td></tr><tr><td>LPC_MOT[12]</td><td>49.0</td><td>56.3</td><td>62.5</td><td>1.17</td><td>21.3</td><td>1,562</td><td>1,865</td><td>52.4</td><td>54.7</td></tr><tr><td>Ours</td><td>54.3</td><td>59.9</td><td>67.0</td><td>0.44</td><td>20.2</td><td>554</td><td>2.345</td><td>59.5</td><td>65.1</td></tr><tr><td>Ours + LI</td><td>55.2</td><td>61.7</td><td>67.9</td><td>0.57</td><td>19.2</td><td>508</td><td>805</td><td>59.8</td><td>65.9</td></tr></table>
|
| 414 |
+
|
| 415 |
+
# B.2 GPR FOR OFFLINE INTERPOLATION
|
| 416 |
+
|
| 417 |
+
In the main paper, we present the use of GPR in online virtual trajectory fitting (Table 8) and offline interpolation (Table 10) where we use $l ^ { 2 } = 2 5$ and $\sigma = 1$ for the kernel in Eq. 14. Further, we make a more thorough study of the setting of GPR. We follow the settings of experiments in the main paper that only trajectories longer than 30 frames are put into interpolation. And the interpolation is only applied to the gap shorter than 20 frames. We conduct the experiments on the validation set of MOT17 and DanceTrack.
|
| 418 |
+
|
| 419 |
+
For the value of $l$ , we try fixed values, i.e. $l = 1$ and $l = 5$ $( 2 l ^ { 2 } = 5 0 )$ ), value adaptive to trajectory length, i.e. $l = L _ { \tau }$ and $\dot { l } = 1 0 0 0 / L _ { \tau }$ , and the value output by Median Trick (MT) [18]. The training data is a series of quaternary $[ u , v , w , h ]$ , normalized to zero-mean before being fed into training. The results are shown in Table 9. Linear interpolation is simple but builds a strong baseline as it can stably improve the tracking performance concerning multiple metrics. Directly using GPR to interpolate the missing points hurts the performance and the results of GPR are not sensitive to the setting of $l$ .
|
| 420 |
+
|
| 421 |
+
There are two reasons preventing GPR from accurately interpolating missing segments. First, the trajectory is usually limited to at most hundreds of steps, providing very limited data points for GPR training to converge. Besides, the missing intermediate data points make the data series discontinuous, causing a huge challenge. We can fix the second issue by interpolating the trajectory with Linear Interpolation (LI) first and then smoothing the interpolated steps by GPR. This outperforms LI on DanceTrack but still regrades over LI on MOT17. This is likely promoted by the non-linear motion on DanceTrack. By fixing the missing data issue of GPR, GPR can have a more accurate trajectory fitting over LI for the non-linear trajectory cases. But considering the outperforming from GPR is still minor compared with the Linear Interpolation-only version and GPR requires much heavier computation overhead, we do not recommend using such a practice in most multi-object tracking tasks. More careful and deeper study is still required on this problem.
|
| 422 |
+
|
| 423 |
+
# C RESULTS ON MORE BENCHMARKS
|
| 424 |
+
|
| 425 |
+
Results on HeadTrack[55]. When considering tracking in the crowd, focusing on only a part of the object can be beneficial as it usually suffers less from occlusion than the full body. This line of study is conducted over hand tracking [39,49], human pose [65] and head tracking [55,3,42] for a while. Moreover, with the knowledge of more fine-grained part trajectory, it can be useful in downstream tasks, such as action recognition [ 15,17] and forecasting [ 31,7,33,8]. As we are interested in the multi-object tracking in the crowd, we also evaluate the proposed OC-SORT on a recently proposed human head tracking dataset CroHD [55]. To make a fair comparison on only the association performance, we adopt OC-SORT by directing using the detections from existing tracking algorithms. The results are shown in Table 10. The detections of FairMOT [69] and HeadHunter [55] are extracted from their tracking results downloaded from the official leaderboard 1. We use the same parameters for OC-SORT as on the other datasets we evaluate on. The results suggest a significant tracking performance improvement compared with the previous methods [55,69] for human body part tracking. But considering the tracking performance is still relatively low $\mathrm { \cdot \mathrm { H O T A } } { = } \tilde { 4 } 0 $ ) which is highly related to the tiny size of head targets. Some samples from the test set of HeadTrack are shown in the first two rows of Figure 5.
|
| 426 |
+
|
| 427 |
+

|
| 428 |
+
Figure 5: The visualization of the output of OC-SORT on randomly selected samples from the test set of HeadTrack [55] (the first two rows) and MOT20 [13] (the bottom row). These two datasets are both challenging because of the crowded scenes where pedestrians have heavy occlusion with each other. OC-SORT achieves superior performance on both datasets.
|
| 429 |
+
|
| 430 |
+
Public Tracking on MOT17 and MOT20. Although we use the same object detectors as baselines, there is still some variance in detections. Therefore, we also report with the public detections on MOT17/MOT20 in Table 12 and Table 13. OC-SORT still outperforms the existing state-ofthe-arts in the public tracking setting. And the outperforming of OC-SORT is more significant on MOT20 which has more severe occlusion scenes. Some samples from the test set of MOT20 are shown in the last row in Figure 5.
|
| 431 |
+
|
| 432 |
+
# D PSEUDO-CODE OF OC-SORT
|
| 433 |
+
|
| 434 |
+
The pseudo-code of OC-SORT is provided in Algorithm. 1 for reference.
|
| 435 |
+
|
| 436 |
+
# E MORE RESULTS ON DANCETRACK
|
| 437 |
+
|
| 438 |
+
To gain more intuition about the improvement of OC-SORT over SORT, we provide more comparisons. In Figure 6, we show more samples where SORT suffers from ID switch or Fragmentation caused by non-linear motion or occlusion but OC-SORT survives. Furthermore, in Figure 7, we show more samples of trajectory visualizations from SORT and OC-SORT on DanceTrack-val set.
|
| 439 |
+
|
| 440 |
+
As DanceTrack [54] is proposed to emphasize association algorithm so the object detection is relatively easy on it. We train to use the YOLOX [ 19] trained from the MOT17 training set to provide
|
| 441 |
+
|
| 442 |
+
Algorithm 1: Pseudo-code of OCSORT.
|
| 443 |
+
|
| 444 |
+
Input: Detections $\mathcal { Z } = \{ \mathbf { z } _ { k } ^ { i } | 1 \leq k \leq T , 1 \leq i \leq N _ { k } \}$ ; Kalman Filter KF; threshold to remove untracked tracks $t _ { \mathrm { e x p i r e } }$
|
| 445 |
+
|
| 446 |
+
Output: The set of tracks $\dot { \mathcal { T } } = \{ \tau _ { i } \}$
|
| 447 |
+
|
| 448 |
+
Initialization: $\tau \emptyset$ and KF;
|
| 449 |
+
|
| 450 |
+
2 for timestep $t \gets 1 : T$ do
|
| 451 |
+
|
| 452 |
+
$/ \star$ Step 1: match track prediction with observations \*/
|
| 453 |
+
3 $\mathbf { Z } _ { t } \gets [ \mathbf { z } _ { t } ^ { 1 } , . . . , \mathbf { z } _ { t } ^ { N _ { t } } ] ^ { \top } ~ / \star$ Obervations $\star /$
|
| 454 |
+
4 $\hat { \mathbf X } _ { t } \gets [ \hat { \mathbf x } _ { t } ^ { 1 } , . . . , \hat { \mathbf x } _ { t } ^ { | T | } ] ^ { \top }$ from $\tau \wedge \star$ Estimations by KF.predict \*/
|
| 455 |
+
5 $\mathbf { V } _ { t } \gets$ estimated velocity direction from $\tau$
|
| 456 |
+
6 $C _ { t } \gets C _ { \mathrm { I o U } } ( \hat { \mathbf { X } } _ { t } , \mathbf { Z } _ { t } ) + \lambda C _ { v } ( \hat { \mathbf { X } } _ { t } , \mathbf { Z } _ { t } , \mathbf { V } _ { t } ) / \star$ Cost Matrix with OCM term \*/
|
| 457 |
+
7 Linear assignment by Hungarians with cost $C _ { t }$
|
| 458 |
+
8 $\mathcal { T } _ { t } ^ { \mathrm { m a t c h e d } } $ tracks matched to an observation
|
| 459 |
+
9 $T _ { t } ^ { \mathrm { r e m a i n } } \gets$ tracks not matched to any observation
|
| 460 |
+
10 ${ \bf Z } _ { t } ^ { \mathrm { r e m a i n } } \gets$ observations not matched to any track
|
| 461 |
+
$/ \star$ Step 2: perform OCR to find lost tracks back \*/
|
| 462 |
+
11 $\mathbf { Z } ^ { T _ { t } ^ { \mathrm { r e m a i n } } } $ last matched observations of tracks in $\mathcal { T } _ { t } ^ { \mathrm { r } }$ emain
|
| 463 |
+
12 $C _ { t } ^ { \mathrm { r e m a i n } } \gets C _ { \mathrm { I o U } } ( \mathbf { Z } ^ { T _ { t } ^ { \mathrm { r e m a i n } } } , \mathbf { Z } _ { t } ^ { \mathrm { r e m a i n } } )$
|
| 464 |
+
13 Linear assignment by Hungarians with cost $C _ { t } ^ { \mathrm { r } \epsilon }$ emain
|
| 465 |
+
14 $\mathcal { T } _ { t } ^ { \mathrm { r e c o v e r y } } $ tracks from $\mathcal { T } _ { t } ^ { \mathrm { r e m a i n } }$ and matched to observations in $\mathbf { Z } ^ { \mathcal { T } _ { t } ^ { \mathrm { r } } }$ emain
|
| 466 |
+
15 ${ \bf Z } _ { t } ^ { \mathrm { u n m a t c h e d } } $ observations from $\mathbf { Z } ^ { \mathcal { T } _ { t } ^ { \mathrm { r e m a i n } } }$ that are still unmatched to tracks
|
| 467 |
+
16 17 T unmatchedt T matchedt tracks frT matchedt , $\mathcal { T } _ { t } ^ { \mathrm { r e c o v e r y } } \}$ $\mathcal { T } _ { t } ^ { \mathrm { r e m a i n } }$ that are still unmatched to observations
|
| 468 |
+
|
| 469 |
+
$/ \star$ Step 3: update status of matched tracks \*/
|
| 470 |
+
for $\tau$ in T matched do if τ.track $e d = F a l s e$ then $/ \star$ Perform OOS for track from untracked to tracked \*/ $\mathbf { z } _ { t ^ { \prime } } ^ { \tau } , t ^ { \prime } \gets$ The last observation matched to $\tau$ and the time step Rollback KF parameters to $t ^ { \prime }$ $/ \star$ Generate virtual observation trajectory \*/ $\hat { \mathbf { Z } } _ { t } ^ { \tau } \gets [ \hat { \mathbf { z } } _ { t ^ { \prime } + 1 } ^ { \tau } , . . . , \hat { \mathbf { z } } _ { t - 1 } ^ { \tau } ]$ Online smooth KF parameters along $\hat { \mathbf { Z } } _ { t } ^ { \tau }$ end τ.tracked = T rue τ.untracked = 0 Append the new matched associated observation $\mathbf { z } _ { t } ^ { \tau }$ to $\tau$ ’s observation history Update KF parameters for $\tau$ by $\mathbf { z } _ { t } ^ { \tau }$
|
| 471 |
+
|
| 472 |
+
# end
|
| 473 |
+
|
| 474 |
+
/\* Step 4: initialize new tracks and remove expired track $\star /$ 30 $\tau _ { t } ^ { n e w } \gets$ new tracks generated from $\mathbf { Z } _ { t } ^ { \mathrm { u } }$ nmatched 31 for $\tau$ in T unmatchedt do 32 τ.tracked = F alse 33 τ.untracked = τ.untracked + 1 34 end 35 ${ \mathcal { T } } _ { t } ^ { \mathrm { r e s e r v e d } } \{ \tau \vert \tau \in { \mathcal { T } } _ { t } $ unmatched and τ.untacked $< t _ { \mathrm { e x p i r e } } \} \ / \star$ remove expired unmatched tracks \*/ 36 T ← {T newt , T matchedt , T reservedt } /\* Conclude \*/ 37 end 38 T ← Postprocess(T ) /\* [Optional] offline post-processing \*/ 39 Return: $\tau$
|
| 475 |
+
|
| 476 |
+
detections on DanceTrack and find the tracking performance of OC-SORT is already higher than the baselines. The results are shown in Table 11.
|
| 477 |
+
|
| 478 |
+
# F REPRODUCIBILITY STATEMENT
|
| 479 |
+
|
| 480 |
+
We include the source code, training, and inference scripts as well as the pretrained weights in the supplementary materials to re-produce all the results we report in this paper.
|
| 481 |
+
|
| 482 |
+

|
| 483 |
+
Figure 6: More samples where SORT suffers from the fragmentation and ID switch of tracks from occlusion or non-linear motion but OC-SORT survives. To be precise, the issue happens on the objects by SORT at: (a) $\# 3 2 2 \to \# 3 2 4$ ; (c) ID switch between $\# 6 7 2$ and $\# 6 7 3$ , later #673 being lost; (e) $\# 7 6 0 \to \# 7 6 1$ ; (g) $\# 8 7 1 \to \# 8 7 2$ ; (i) $\# 1 0 6 3 \to \# 1 0 9 0$ , then ID switch with $\# 1 0 8 1$ ; (l) $\# 1 2 9 5 $ $\# 1 3 0 4$ . We select samples from diverse scenes, including street dance, classic dance and gymnastics. Best viewed in color and zoomed in.
|
| 484 |
+
|
| 485 |
+

|
| 486 |
+
Figure 7: Randomly selected object trajectories on the videos from Dance-val set. The black cross indicates the ground truth trajectory. The red dots indicate the trajectory output by OC-SORT and associated to the selected GT trajectory. The green triangles indicate the trajectory output by SORT and associated to the selected GT trajectory. SORT and OC-SORT use the same hyperparameters and detections. Trajectories are sampled at the first 100 frames of each video sequence.
|
md/dev/nVV6S2sb_UL/nVV6S2sb_UL.md
ADDED
|
@@ -0,0 +1,393 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Securing Secure Aggregation: Mitigating Multi-Round Privacy Leakage in Federated Learning
|
| 2 |
+
|
| 3 |
+
# Abstract
|
| 4 |
+
|
| 5 |
+
Secure aggregation is a critical component in federated learning (FL), which enables the server to learn the aggregate model of the users without observing their local models. Conventionally, secure aggregation algorithms focus only on ensuring the privacy of individual users in a single training round. We contend that such designs can lead to significant privacy leakages over multiple training rounds, due to partial user selection/participation at each round of FL. In fact, we show that the conventional random user selection strategies in FL may lead to leaking users’ individual models within a number of rounds that is linear in the number of users. To address this challenge, we introduce a secure aggregation framework, MultiRoundSecAgg, with multi-round privacy guarantees. In particular, we introduce a new metric to quantify the privacy guarantees of FL over multiple training rounds, and develop a structured user selection strategy that guarantees the long-term privacy of each user (over any number of training rounds). Our framework also carefully accounts for the fairness and the average number of participating users at each round. Our experiments on MNIST, CIFAR-10 and CIFAR-100 datasets in the IID and the non-IID settings demonstrate the performance improvement over the baselines, both in terms of privacy protection and test accuracy.
|
| 6 |
+
|
| 7 |
+
# 18 1 Introduction
|
| 8 |
+
|
| 9 |
+
19 Federated learning (FL) enables collaborative
|
| 10 |
+
20 training of machine learning models over the
|
| 11 |
+
21 data collected and stored locally by multiple
|
| 12 |
+
22 data-owners. The training in FL is typically
|
| 13 |
+
23 coordinated by a central server who maintains a
|
| 14 |
+
24 global model that is updated locally by the users.
|
| 15 |
+
25 The local updates are then aggregated by the
|
| 16 |
+
26 server to update the global model. Throughout
|
| 17 |
+
27 the training process, the users never share their
|
| 18 |
+
28 data with the server, i.e., the data is always kept
|
| 19 |
+
29 on device, rather, they only share their local
|
| 20 |
+
30 updates. However, as has been shown recently,
|
| 21 |
+
31 the local models may still reveal substantial
|
| 22 |
+
32 information about the local datasets, and the
|
| 23 |
+
33 private training data can be reconstructed from
|
| 24 |
+
34 the local models through inference or inversion
|
| 25 |
+
35 attacks (see e.g., [11, 26, 42, 12]).
|
| 26 |
+
36 To prevent such information leakage, secure aggregation protocols are proposed (e.g., [4, 31, 15,
|
| 27 |
+
37 40, 2, 38, 30]) to protect the privacy of the local models, both from the server and the other users,
|
| 28 |
+
38 while still allowing the server to learn their aggregate. More specifically, the secure aggregation
|
| 29 |
+
39 protocols ensure that, at any given round, the server can only learn the aggregate model of the users,
|
| 30 |
+
40 and beyond that no further information is revealed about the individual model.
|
| 31 |
+
41 Secure aggregation protocols, however, only ensure the privacy of the individual users in a single
|
| 32 |
+
42 training round, and do not consider their privacy over multiple training rounds [4, 2, 31, 32]. On
|
| 33 |
+
43 the other hand, due to partial user selection [7, 5, 6, 28], the server may be able to reconstruct the
|
| 34 |
+
44 individual models of some users using the aggregated models from the previous rounds. In fact, we
|
| 35 |
+
45 show that after a sufficient number of rounds, all local models can be recovered with a high accuracy
|
| 36 |
+
46 if the server uniformly chooses a random subset of the users to participate at every round. As shown
|
| 37 |
+
47 in Fig.1, performing model inversion attack [12] with the recovered local models yields reconstructed
|
| 38 |
+
48 images with a similar quality as the original images.
|
| 39 |
+
|
| 40 |
+

|
| 41 |
+
Figure 1: A qualitative comparison of the reconstructed images in two settings is shown. The first setting corresponds to the case that model privacy with random user selection (e.g., FedAvg [25]) is protected by conventional secure aggregation schemes as [4] at each round. In the second setting, our proposed method ensures the long-term privacy of individual models over any number of rounds, and hence model inversion attack cannot work well. This reconstruction process is described in detail in Appendix H.
|
| 42 |
+
|
| 43 |
+
Contributions. As such motivated, we study long-term user privacy in FL. Specifically, our 50 contributions are as follows.
|
| 44 |
+
|
| 45 |
+
1. We introduce a new metric to capture long-term privacy guarantees for secure aggregation protocols in FL for the first time. This long-term privacy requires that the server cannot reconstruct any individual model using the aggregated models from any number of training rounds. Using this metric, we show that the conventional random selection schemes can result in leaking the local models after a sufficient number of rounds, even if secure aggregation is employed at each round.
|
| 46 |
+
|
| 47 |
+
2. We propose Multi-RoundSecAgg, a privacy-preserving structured user selection strategy that ensures the long-term privacy of the individual users over any number of training rounds. This strategy also takes into account the fairness of the selection process and the average number of participating users at each round.
|
| 48 |
+
|
| 49 |
+
3. We demonstrate that Multi-RoundSecAgg creates a trade-off between the long-term privacy guarantee and the average number of participating users. In particular, as the average number of participating users increases, the long-term privacy guarantee becomes weaker.
|
| 50 |
+
|
| 51 |
+
4. We provide the convergence analysis of Multi-RoundSecAgg, which shows that the long-term privacy guarantee and the average number of participating users control the convergence rate. The convergence rate is maximized when the average number of participating users is maximized. (e.g., the random user selection strategy maximizes the average number of participating users at the expense of not providing long-term privacy guarantees). As we require stronger long-term privacy guarantees, the average number of participating users decreases and a larger number of training rounds is required to achieve the same level of accuracy as the random selection strategy.
|
| 52 |
+
|
| 53 |
+
5. Finally, our experiments in both IID and non-IID settings on MNIST, CIFAR-10 and CIFAR-100 datasets demonstrate that Multi-RoundSecAgg achieves almost the same test accuracy compared to the random selection scheme while providing better long-term privacy guarantees.
|
| 54 |
+
|
| 55 |
+
# 73 2 Related Work
|
| 56 |
+
|
| 57 |
+
74 The underlying principle of the secure aggregation protocol in [4] is that each pair of users exchange a
|
| 58 |
+
75 pairwise secret key which they can use to mask their local models before sharing them with the server.
|
| 59 |
+
76 The pairwise masks cancel out when the server aggregates the masked models, allowing the server to
|
| 60 |
+
77 aggregate the local models. These masks also ensure that the local models are kept private, i.e., no
|
| 61 |
+
78 further information is revealed beyond the aggregate of the local models. This protocol, however,
|
| 62 |
+
79 incurs a significant communication cost due to exchanging and reconstructing the pairwise keys.
|
| 63 |
+
80 Recently, several works have developed computation and communication-efficient protocols [31, 15,
|
| 64 |
+
81 2, 35, 8, 10, 38], which are complementary to and can be combined with our work. Another line of
|
| 65 |
+
82 work focused on designing partial user selection strategies to overcome the communication bottleneck
|
| 66 |
+
83 in FL while speeding up the convergence by selecting the users based on their local loss [7, 5, 6, 28].
|
| 67 |
+
84 Previous works, either on secure aggregation or on partial user selection, however, do not consider
|
| 68 |
+
85 mitigating the potential privacy leakage as a result of partial user participation and the server observing
|
| 69 |
+
86 the aggregated models across multiple training rounds. While [27] pointed out to the privacy leakage
|
| 70 |
+
87 of secure aggregation, mitigating this leakage has not been considered and our work is the first secure
|
| 71 |
+
88 aggregation protocol to address this challenge.
|
| 72 |
+
|
| 73 |
+
Differential privacy (DP), in which each user adds artificial noises to the local models, can be one of the potential solution to protect the privacy leakage over the multiple rounds [9, 1, 37, 3, 16]. In DP, however, the privacy guarantee sacrifices the model performance, which is known as a privacy-utility trade-off. It is worth noting that secure aggregation and DP are complementary, i.e., all the benefits of DP can be applied to our approach by adding noise to the local models [3]. In this paper, our objective is to understand the secure aggregation itself.
|
| 74 |
+
|
| 75 |
+
# 95 3 System Model
|
| 76 |
+
|
| 77 |
+
96 In this section, we first describe the basic federated learning model in Section 3.1. Next, we introduce
|
| 78 |
+
97 the multi-round secure aggregation problem for federated learning and define the key metrics to
|
| 79 |
+
98 evaluate the performance of a multi-round secure aggregation protocol in Section 3.2.
|
| 80 |
+
100 We consider a cross-device federated learning setup consisting of a server and $N$ users. User $i \in [ N ]$
|
| 81 |
+
101 has a local dataset $\mathcal { D } _ { i }$ consisting of $m _ { i } = | \mathcal { D } _ { i } |$ data samples. The users are connected to each other
|
| 82 |
+
102 through the server, i.e., all communications between the users goes through the server [24, 4, 17].
|
| 83 |
+
103 The goal is to collaboratively learn a global model $_ x$ with dimension $d$ , using the local datasets that
|
| 84 |
+
104 are generated, stored, and processed locally by the users. The training task can be represented by
|
| 85 |
+
105 minimizing a global loss function,
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
\operatorname* { m i n } _ { x } L ( x ) { \mathrm { ~ s . t . ~ } } L ( x ) = { \frac { 1 } { \sum _ { i = 1 } ^ { N } w _ { i } } } \sum _ { i = 1 } ^ { N } w _ { i } L _ { i } ( x ) ,
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
106 where $L _ { i }$ is the loss function of user $i$ and $w _ { i } \geq 0$ is a weight parameter assigned to user $i$ to specify
|
| 92 |
+
107 the relative impact of that user. A common choice for the weight parameters is $w _ { i } = m _ { i }$ [17]. We
|
| 93 |
+
108 define the optimal model parameters $x ^ { * }$ and $\boldsymbol { x } _ { i } ^ { * }$ as $x ^ { * } = \arg \operatorname* { m i n } _ { x \in \mathbb { R } ^ { d } } L ( x )$ and $\begin{array} { r } { \boldsymbol { x } _ { i } ^ { * } = \arg \operatorname* { m i n } _ { \boldsymbol { x } \in \mathbb { R } ^ { d } } L _ { i } ( \boldsymbol { x } ) } \end{array}$ .
|
| 94 |
+
109 Federated Averaging with Partial User Participation. To solve (1), the most common algorithm
|
| 95 |
+
110 is the FedAvg (federated averaging) algorithm [24]. FedAvg is an iterative algorithm, where the model
|
| 96 |
+
111 training is done by repeatedly iterating over individual local updates. At the beginning of training
|
| 97 |
+
112 round $t$ , the server sends the current state of the global model, denoted by $x ^ { ( t ) }$ , to the users. Each
|
| 98 |
+
113 round consists of two phases, local training and aggregation. In the local training phase, user $i \in [ N ]$
|
| 99 |
+
114 updates the global model by carrying out $E \left( \geq 1 \right)$ local stochastic gradient descent (SGD) steps and
|
| 100 |
+
115 sends the updated local model $x _ { i } ^ { ( t ) }$ to the server. One of key features of cross-device FL is partial
|
| 101 |
+
116 device participation. Due to various reasons such as unreliable wireless connectivity, or battery issues,
|
| 102 |
+
117 at any given round, only a fraction of the users are available to participate in the protocol. We refer
|
| 103 |
+
118 to such users as available users throughout the paper. In the aggregation phase, the server selects
|
| 104 |
+
119 $K \leq N$ users among the available users if this is possible and aggregates their local updates. The
|
| 105 |
+
120 server updates the global model as follows
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
\pmb { x } ^ { ( t + 1 ) } = \sum _ { i \in S ^ { ( t ) } } w _ { i } ^ { \prime } \pmb { x } _ { i } ^ { ( t ) } = \mathbf { X } ^ { ( t ) ^ { \top } } \pmb { p } ^ { ( t ) } ,
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
where 121 ${ \mathbf { } } S ^ { ( t ) }$ is the set of participating users at round $t$ , $\begin{array} { r } { w _ { i } ^ { \prime } = \frac { w _ { i } } { \sum _ { i \in S ^ { ( t ) } } w _ { i } } } \end{array}$ , and ${ \pmb p } ^ { ( t ) } \in \{ 0 , 1 \} ^ { N }$ is the
|
| 112 |
+
122 corresponding characteristic vector. That is, $\pmb { p } ^ { ( t ) }$ denotes a participation vector at round $t$ whose $i$ -th
|
| 113 |
+
123 entry is 0 when user $i$ is not selected and 1 otherwise. $\mathbf { X } ^ { ( t ) }$ denotes the concatenation of the weighted
|
| 114 |
+
124 local models at round $t$ , i.e., $\mathbf { X } ^ { ( t ) } = \left[ w _ { 1 } ^ { \prime } x _ { 1 } ^ { ( t ) } , \ldots , w _ { N } ^ { \prime } x _ { N } ^ { ( t ) } \right] ^ { \top } \in \mathbb { R } ^ { N \times d }$ . Finally, the server broadcasts
|
| 115 |
+
125 the updated global model $x ^ { ( t + 1 ) }$ to the users for the next round.
|
| 116 |
+
|
| 117 |
+
Threat Model. Similar to the prior works on secure aggregation as [4, 15, 31], we consider the honest-but-curious model. All participants follow the protocol honestly in this model, but try to learn as much as possible about the users. At each round, the privacy of individual model $x _ { i } ^ { ( t ) }$ in (2) is protected by secure aggregation such that the server only learns the aggregated model $\textstyle \sum _ { i \in S ^ { ( t ) } } w _ { i } ^ { \prime } x _ { i } ^ { ( t ) }$
|
| 118 |
+
|
| 119 |
+
# 3.2 Multi-round Secure Aggregation
|
| 120 |
+
|
| 121 |
+
32 Conventional secure aggregation protocols only consider the privacy guarantees over a single training 33 round. While secure aggregation protocols have provable privacy guarantees at any single round, 4 in the sense that no information is leaked beyond the aggregate model at each round, the privacy 35 guarantees do not extend to attacks that span multiple training rounds. Specifically, by using the 36 aggregate models and participation information across multiple rounds, an individual model may be reconstructed. For instance, consider the following user participation strategy across three training 38 rounds, $\pmb { p } ^ { ( 1 ) } = [ 1 , 1 , 0 ] ^ { \top }$ , $\pmb { p } ^ { ( 2 ) } = [ 0 , 1 , 1 ] ^ { \top }$ , and $\pmb { p } ^ { ( 3 ) } = [ 1 , \bar { 0 } , 1 ] ^ { \top }$ . Assume a scenario where the local 9 updates do not change significantly over time (e.g., models start to converge, or the server fixes the global model over consecutive rounds), i.e., $x _ { i } = x _ { i } ^ { ( t ) }$ for all $i \in [ 3 ]$ and $t \in [ 3 ]$ . Then, the server can single out individual model, e.g., $\pmb { x } _ { 1 } = ( \pmb { x } ^ { ( 1 ) } + \pmb { x } ^ { ( 3 ) } - \pmb { x } ^ { ( 2 ) } ) / 2$ . Similarly, the server can single out all 2 individual models $x _ { i }$ , even if a secure aggregation protocol is employed at each round.
|
| 122 |
+
|
| 123 |
+
143 In this paper, we study secure aggregation protocols with long-term privacy guarantees (which we
|
| 124 |
+
144 term multi-round secure aggregation) for the cross-device FL setup which has not been studied before.
|
| 125 |
+
145 We assume that user $i \in [ N ]$ drops from the protocol at each round with probability $p _ { i }$ . $\mathcal { U } ^ { ( t ) }$ denotes
|
| 126 |
+
146 the index set of available users at round $t$ and ${ \pmb u } ^ { ( t ) } \in \{ 0 , 1 \} ^ { N }$ is a vector indicating the available users
|
| 127 |
+
147 such that $\{ { \pmb u } ^ { ( t ) } \} _ { j } = \mathbb { 1 } \{ j \in { \mathcal { U } } ^ { ( t ) } \}$ , where $\{ \pmb { u } \} _ { j }$ is $j$ -th entry of $\pmb { u }$ and $\mathbb { 1 } \{ \cdot \}$ is the indicator function.
|
| 128 |
+
148 The server selects $K$ users from $\mathcal { U } ^ { ( t ) }$ , if $\vert \mathcal { U } ^ { ( t ) } \vert \ge K$ , based on the history of selected users in previous
|
| 129 |
+
149 rounds. If $\vert \mathcal { U } ^ { ( t ) } \vert < K$ , the server skips this round. The local models of the selected users are then
|
| 130 |
+
150 aggregated via a secure aggregation protocol (i.e., by communicating masked models), at the end of
|
| 131 |
+
151 which the server learns the aggregate of the local models of the selected users. Our goal is to design a
|
| 132 |
+
152 user selection algorithm $\mathcal { A } ^ { ( \bar { t } ) ^ { } } : \{ 0 , 1 \} ^ { t \times N } \times \{ 0 , 1 \} ^ { N } \to \{ 0 , 1 \} ^ { N } ,$ ,
|
| 133 |
+
|
| 134 |
+
$$
|
| 135 |
+
\begin{array} { r } { \mathcal { A } ^ { ( t ) } \big ( \mathbf { P } ^ { ( t ) } , \boldsymbol { u } ^ { ( t ) } \big ) = \boldsymbol { p } ^ { ( t ) } \ \mathrm { s u c h ~ t h a t } \ \| \boldsymbol { p } ^ { ( t ) } \| _ { 0 } \in \{ 0 , K \} , } \end{array}
|
| 136 |
+
$$
|
| 137 |
+
|
| 138 |
+
153 to prevent the potential information leakage over multiple rounds, where $\pmb { p } ^ { ( t ) } \in \{ 0 , 1 \} ^ { N }$ is the
|
| 139 |
+
154 participation vector defined in (2), $\| { \boldsymbol { x } } \| _ { 0 }$ denotes the $L _ { 0 }$ -“norm” of a vector $_ x$ and $K$ denotes the
|
| 140 |
+
155 number of selected users. We note that $\mathcal { A } ^ { ( t ) }$ can be a random function. $\mathbf { P } ^ { ( t ) }$ is a matrix representing
|
| 141 |
+
156 the user participation information up to round $t$ , and is termed the participation matrix, given by
|
| 142 |
+
|
| 143 |
+
$$
|
| 144 |
+
\mathbf { P } ^ { ( t ) } = \left[ { p ^ { ( 0 ) } , p ^ { ( 1 ) } , \ldots , p ^ { ( t - 1 ) } } \right] ^ { \top } \in \{ 0 , 1 \} ^ { t \times N } .
|
| 145 |
+
$$
|
| 146 |
+
|
| 147 |
+
157 Key Metrics. A multi-round secure aggregation protocol can be represented by $\mathcal { A } = \{ \mathcal { A } ^ { ( t ) } \} _ { t \in [ J ] }$
|
| 148 |
+
158 where $\mathcal { A } ^ { ( t ) }$ is the user selection algorithm at round $t$ defined in (3) and $J$ is the total number of rounds.
|
| 149 |
+
159 The inputs of $\mathcal { A } ^ { ( t ) }$ are a random vector $\mathbf { \Omega } _ { \pmb { u } } ( t )$ , which indicates the available users at round $t$ , and the
|
| 150 |
+
160 participation matrix $\mathbf { P } ^ { ( t ) }$ defined in (4) which can be a random matrix. Given the participation matrix
|
| 151 |
+
161 $\bar { \mathbf { p } } ( J )$ , we evaluate the performance of the corresponding multi-round secure aggregation protocol
|
| 152 |
+
162 through the following metrics.
|
| 153 |
+
|
| 154 |
+
1. Multi-round Privacy Guarantee. The secure aggregation protocols ensure that the server can only learn the sum of the local models of some users in each single round, but they do not consider what the server can learn over the long run. Our multi-round privacy definition extends the guarantees of the secure aggregation protocols from one round to all rounds by requiring that the server can only learn a sum of the local models even if the server exploits the aggregate models of all rounds. That is, our multi-round privacy guarantee is a natural extension of the privacy guarantee provided by the secure aggregation protocols considering a single training round.
|
| 155 |
+
|
| 156 |
+
170 Specifically, a multi-round privacy guarantee $T$ requires that any non-zero partial sum of the
|
| 157 |
+
171 local models that the server can reconstruct, through any linear combination $\mathbf { X } ^ { \top } \mathbf { P } ^ { ( J ) ^ { \top } } z$ , where
|
| 158 |
+
172 $z \in \mathbb { R } ^ { J } \setminus \{ \mathbf { 0 } \}$ , must be of the form1
|
| 159 |
+
|
| 160 |
+
$$
|
| 161 |
+
{ { \bf X } ^ { \top } { \bf P } ^ { ( J ) } } ^ { \top } z = \sum _ { i \in [ n ] } a _ { i } \sum _ { j \in S _ { i } } x _ { j } = a _ { 1 } \sum _ { j \in S _ { 1 } } x _ { j } + a _ { 2 } \sum _ { j \in S _ { 2 } } x _ { j } + \cdot \cdot \cdot + a _ { n } \sum _ { j \in S _ { n } } x _ { j } ,
|
| 162 |
+
$$
|
| 163 |
+
|
| 164 |
+
where $| S _ { i } | \ge T , a _ { i } \ne 0 , \forall i \in [ n ]$ and $n \in \mathbb { Z } ^ { + }$ . Here all the sets $S _ { i }$ , the number of sets $n$ , and each $a _ { i }$ could all depend on $z$ . In equation (5), we consider the worst-case scenario, where the local models do not change over the rounds. That is, $\mathbf { X } ^ { ( t ) } = \mathbf { X }$ , $\forall t \in [ J ]$ . Intuitively, this guarantee ensures that the best that the server can do is to reconstruct a partial sum of $T$ local models which corresponds to the case where $n = 1$ . When $T \geq 2$ , this condition implies that the server cannot get any user model from the aggregate models of all training rounds (the best it can obtain is the sum of two local models).
|
| 165 |
+
|
| 166 |
+
Remark 1. (Weaker Privacy Notion). It is worth noting that, a weaker privacy notion would require that $\Vert \mathbf { P } ^ { ( J ) ^ { \top } } z \Vert _ { 0 } \geq T$ when $\mathbf { P } ^ { ( J ) ^ { \top } } z \neq \mathbf { 0 }$ . When $T = 2$ , this definition requires that the server cannot reconstruct any individual model (the best it can do is to obtain a linear combination of two local models). This notion, however, allows constructions in the form of $a x _ { i } + b x _ { j }$ for any $a , b \in \mathbb { R } \setminus \{ 0 \}$ . When $a \gg b$ , however, this is almost the same as recovering $x _ { i }$ perfectly, hence this privacy criterion is weaker than that of (5).
|
| 167 |
+
|
| 168 |
+
Remark 2. (Multi-round Privacy of Random Selection). In Section 6, we empirically show that a random selection strategy in which $K$ available users are selected uniformly at random at each round does not ensure multi-round privacy even with respect to the weaker definition of Remark 1. Specifically, the local models can be reconstructed within a number of rounds that is linear in $N$ . We also show theoretically in Appendix $_ \mathrm { H }$ that when $\operatorname* { m i n } ( N - K , K ) \ge c N$ , where $c > 0$ is a constant, then the probability that the server can reconstruct all local models after $N$ rounds is
|
| 169 |
+
|
| 170 |
+
192 193 scheme in which the users are selected in an i.i.d fashion according to Bern( 𝐾𝑁 (1−𝑝) ) at least $1 - 2 e ^ { - c ^ { \prime } N }$ for a constant $c ^ { \prime }$ that depends on $c$ . Finally, we show that a random selection reveals all
|
| 171 |
+
194 local models after $N$ rounds with probability that converges to 1 exponentially fast.
|
| 172 |
+
|
| 173 |
+
Remark 3. (Worst-Case Assumption). In (5), we considered the worst-case assumption where the models do not change over time. When the local models change over rounds, the multi-round privacy guarantee becomes even stronger as the number of unknowns increases. In Fig. 1 and Appendix H, we empirically show that the conventional secure aggregation schemes leak extensive information of training data even in the realistic settings where the models change over the rounds.
|
| 174 |
+
|
| 175 |
+
0 2. Aggregation Fairness Gap. The average aggregation fairness gap quantifies the largest gap
|
| 176 |
+
1 between any two users in terms of the expected relative number of rounds each user has participated
|
| 177 |
+
02 in training. Formally, the average aggregation fairness gap is defined as follows
|
| 178 |
+
|
| 179 |
+
$$
|
| 180 |
+
F = \operatorname* { m a x } _ { i \in [ N ] } \operatorname* { l i m } _ { J \infty } \underset { J } { \operatorname* { s u p } } \frac { 1 } { J } \mathbb { E } \bigg [ \sum _ { t = 0 } ^ { J - 1 } \mathbb { 1 } \big \{ \{ p ^ { ( t ) } \} _ { i } = 1 \big \} \bigg ] - \operatorname* { m i n } _ { i \in [ N ] } \operatorname* { l i m } _ { J \infty } \frac { 1 } { J } \mathbb { E } \bigg [ \sum _ { t = 0 } ^ { J - 1 } \mathbb { 1 } \big \{ \{ p ^ { ( t ) } \} _ { i } = 1 \big \} \bigg ] ,
|
| 181 |
+
$$
|
| 182 |
+
|
| 183 |
+
203 where $\{ \pmb { p } ^ { ( t ) } \} _ { i }$ is $i$ -th entry of the vector $\pmb { p } ^ { ( t ) }$ and the expectation is over the randomness of the user
|
| 184 |
+
204 selection algorithm $\mathcal { A }$ and the user availability. The main intuition behind this definition is that
|
| 185 |
+
205 when $F = 0$ , all users participate on average on the same number of rounds. This is important to
|
| 186 |
+
206 take the different users into consideration equally and our experiments show that the accuracy of
|
| 187 |
+
207 the schemes with small $F$ are much higher than the schemes with high $F$ .
|
| 188 |
+
|
| 189 |
+
8 3. Average Aggregation Cardinality. The aggregation cardinality quantifies the expected number of models to be aggregated per round. Formally, it is defined as
|
| 190 |
+
|
| 191 |
+
$$
|
| 192 |
+
C = \operatorname* { l i m } _ { J \infty } \operatorname* { i n f } _ { } \frac { \mathbb { E } \big [ \sum _ { t = 0 } ^ { J - 1 } \| p ^ { ( t ) } \| _ { 0 } \big ] } { J } ,
|
| 193 |
+
$$
|
| 194 |
+
|
| 195 |
+
where the expectation is over the randomness in $\mathcal { A }$ and the user availability. Intuitively, less number of rounds are needed to converge as more users participate in the training. In fact, as we show in Section 5.2, $C$ directly controls the convergence rate.
|
| 196 |
+
|
| 197 |
+
# 3.3 Baseline Schemes
|
| 198 |
+
|
| 199 |
+
In this subsection, we introduce three baseline schemes for multi-round secure aggregation.
|
| 200 |
+
|
| 201 |
+
5 Random Selection. In this scheme, at each round, the server selects $K$ users at random from the set
|
| 202 |
+
6 of available users if this is possible.
|
| 203 |
+
|
| 204 |
+
Random Weighted Selection. This scheme is a modified version of random selection to reduce $F$ when the dropout probabilities of the users are not equal. Specifically, $K$ users are selected at random from the available users with the minimum frequency of participation in the previous rounds.
|
| 205 |
+
|
| 206 |
+
User Partitioning (Grouping). In this scheme, the users are partitioned into $G = N / K$ equal-sized groups denoted as $\mathcal { G } _ { 1 } , \mathcal { G } _ { 2 } , \cdots , \mathcal { G } _ { G }$ . At each round, the server selects one of the groups if none of the users in this group has dropped out. If multiple groups are available, to reduce the aggregation fairness gap, the server selects a group including a user with the minimum frequency of participation in previous rounds. If no group is available, the server skips this round.
|
| 207 |
+
|
| 208 |
+
# 225 4 Proposed Scheme: Multi-RoundSecAgg
|
| 209 |
+
|
| 210 |
+
In this section, we present Multi-RoundSecAgg, which has two components as follows.
|
| 211 |
+
|
| 212 |
+
• The first component designs a family of sets of users that satisfy the multi-round privacy requirement. The inputs of the first component are the number of users $( N )$ , the number of selected users at each round $( K )$ , and the desired multi-round privacy guarantee $( T )$ . The output is a family of sets of $K$ users satisfying the multi-round privacy guarantee $T$ , termed as a privacy-preserving family. This family is represented by a matrix $\mathbf { B }$ , where the rows are the characteristic vectors of these user sets. • The second component selects a set from this designed family to satisfy the fairness guarantee. The inputs to the second component are the family $\mathbf { B }$ , the set of available users at round $t$ , $\mathcal { U } ^ { ( t ) }$ , and the frequency of participation of each user. The output is the set of users that will participate at round $t$ .
|
| 213 |
+
|
| 214 |
+
235 We now describe these two components in detail.
|
| 215 |
+
|
| 216 |
+
Component 1 (Batch Partitioning (BP) of the users to guarantee multi-round privacy). The first component designs a family of $R _ { \mathrm { B P } }$ sets, where $R _ { \mathrm { B P } }$ is the size of the set, satisfying the multiround privacy requirement $T$ . We denote the $R _ { \mathrm { B P } } \times N$ binary matrix corresponding to these sets by $\mathbf { B } = [ \pmb { b } _ { 1 } , \cdots , \pmb { b } _ { R _ { \mathrm { B P } } } ] ^ { \top }$ , where $\| \pmb { b } _ { i } \| _ { 0 } = K , \forall i \in \mathrm { ~ [ } R _ { \mathrm { B P } } ]$ . That is, the rows of $\mathbf { B }$ are the characteristic vectors of those sets. The main idea of our scheme is to restrict certain sets of users of size $T$ , denoted as batches, to either participate together or not participate at all. This guarantees a multi-round privacy $T$ as we show in Section 5.
|
| 217 |
+
|
| 218 |
+
To construct a family of sets with this property, the users are first partitioned into $N / T$ batches. At any given round, either all or none of the users of a particular batch participate in training. The server can choose $K / T$ batches to participate in training, provided that all users in any given selected batch are available. Since there are $\binom { N / T } { K / T }$ possible sets with this property, then the size of this privacy-preserving family of sets is given by $R _ { \mathrm { B P } } { \stackrel { \mathrm { d e f } } { = } } { \binom { N / T } { K / T } } ^ { 2 }$ .
|
| 219 |
+
|
| 220 |
+
In the extreme case of $T = 1$ , this strategy specializes to random selection where the server can choose any $K$ possible users. In the other extreme case of $T = K$ , this strategy specializes to the partitioning strategy where there are $N / K$ possible sets. We next provide an example to illustrate the construction of $\mathbf { B }$ .
|
| 221 |
+
|
| 222 |
+
Example 1 $( N = 8 , K = 4 , T = 2 )$ . In this example, the users are partitioned into 4 batches as $\mathcal { G } _ { 1 } = \{ 1 , 2 \} , \mathcal { G } _ { 2 } = \{ 3 , 4 \} , \mathcal { G } _ { 3 } =$
|
| 223 |
+
|
| 224 |
+
$$
|
| 225 |
+
\mathbf B = \left[ \begin{array} { l l l l l l l l } { 1 } & { 1 } & { 1 } & { 1 } & { 1 } & { 0 } & { 0 } & { 0 } \\ { 1 } & { 1 } & { 0 } & { 0 } & { 1 } & { 1 } & { 1 } & { 0 } & { 0 } \\ { 1 } & { 1 } & { 0 } & { 0 } & { 0 } & { 0 } & { 1 } & { 1 } & { 1 } \\ { 0 } & { 0 } & { 1 } & { 1 } & { 1 } & { 1 } & { 1 } & { 1 } & { 0 } \\ { 0 } & { 0 } & { 1 } & { 1 } & { 1 } & { 0 } & { 0 } & { 1 } & { 1 } \\ { 0 } & { 0 } & { 0 } & { 0 } & { 0 } & { 1 } & { 1 } & { 1 } & { 1 } \end{array} \right]
|
| 226 |
+
$$
|
| 227 |
+
|
| 228 |
+
Figure 2: Example of our construction with $N = 8$ , $K = 4$ and $T = 2$ .
|
| 229 |
+
|
| 230 |
+
$\{ 5 , 6 \}$ and $\mathcal { G } _ { 4 } = \{ 7 , 8 \}$ as given in Fig. 2. The server can choose any two batches out of these 4 batches, hence we have $\begin{array} { r } { R _ { B P } = { \binom { 4 } { 2 } } = 6 } \end{array}$ possible sets. This ensures a multi-round privacy $T = 2$ .
|
| 231 |
+
|
| 232 |
+
Component 2 (Available batch selection to guarantee fairness). At round $t$ , user $i \in [ N ]$ is
|
| 233 |
+
availaof useround rticipate round , and th n the protocolis denoted by frequencies o $1 - p _ { i } \in ( 0 , 1 ]$ ncy of participationof available users at, the server selects $i$ $t$ $\begin{array} { r } { f _ { i } ^ { ( t ) } { \stackrel { \mathrm { d e f } } { = } } \sum _ { j = 0 } ^ { t - 1 } { \mathbb { 1 } } \left\{ \{ p ^ { ( j ) } \} _ { i } = 1 \right\} } \end{array}$ $t$ $\mathcal { U } ^ { ( t ) }$ $\boldsymbol { f } ^ { ( t - 1 ) } = ( f _ { 1 } ^ { ( t - 1 ) } , \cdot \cdot \cdot , f _ { N } ^ { ( t - 1 ) } )$
|
| 234 |
+
$K$ users. To do so, the server first finds the submatrix of $\mathbf { B }$ denoted by $\mathbf { B } ^ { ( t ) }$ corresponding to $\mathcal { U } ^ { ( t ) }$ .
|
| 235 |
+
Specifically, the $i .$ -th row of $\mathbf { B }$ denoted by $ { \boldsymbol { b } } _ { i } ^ { \top }$ is included in $\mathbf { B } ^ { ( t ) }$ provided that $\operatorname { s u p p } ( b _ { \mathrm { i } } ) \subseteq \mathcal { U } ^ { ( t ) }$ . If
|
| 236 |
+
$\mathbf { B } ^ { ( t ) }$ is an empty matrix, then the server skips this round. Otherwise, the server selects a row from $\mathbf { B } ^ { ( t ) }$
|
| 237 |
+
uniformly at random if $p _ { i } = p , \forall i \in [ N ]$ . If the users have different $p _ { i }$ , the server selects a row from
|
| 238 |
+
$\mathbf { B } ^ { ( t ) }$ that includes the user with the minimum frequency of participation $\ell _ { \mathrm { m i n } } ^ { ( t - 1 ) } \stackrel { \mathrm { d e f } } { = } \mathrm { a r g } \operatorname* { m i n } _ { i \in \mathcal { U } ^ { ( t ) } } f _ { i } ^ { ( t - 1 ) }$ (𝑡 ) 𝑓 (𝑡 −1)𝑖 .
|
| 239 |
+
If there are many such rows, then the server selects one of them uniformly at random.
|
| 240 |
+
|
| 241 |
+
Remark 4. (Necessity of the Second Component). The second component is necessary to guarantee that the aggregation fairness gap goes to zero as we show in Theorem 1 and Section 6.
|
| 242 |
+
|
| 243 |
+
Overall, the algorithm first designs a privacy-preserving family of sets to ensure the multi-round privacy guarantee $T$ . Then specific sets are selected from this family to ensure fairness. We describe the two components of Multi-RoundSecAgg in detail in Algorithm 1 and Algorithm 2 in Appendix D.
|
| 244 |
+
|
| 245 |
+
# 5 Theoretical Results
|
| 246 |
+
|
| 247 |
+
In this section, we provide the theoretical guarantees of Multi-RoundSecAgg in Section 5.1 and the convergence analysis of Multi-RoundSecAgg in Section 5.2.
|
| 248 |
+
|
| 249 |
+
# 5.1 Theoretical Guarantees of Multi-RoundSecAgg
|
| 250 |
+
|
| 251 |
+
In this subsection, we establish the theoretical guarantees of Multi-RoundSecAgg in terms of the multi-round privacy guarantee, the aggregation fairness gap and the average aggregation cardinality.
|
| 252 |
+
|
| 253 |
+
78 Theorem 1. Multi-RoundSecAgg with parameters $N , K , T$ ensures a multi-round privacy guarantee
|
| 254 |
+
79 of 𝑇, an aggregation fairness gap $F = 0$ , and an average aggregation cardinality given by
|
| 255 |
+
|
| 256 |
+
$$
|
| 257 |
+
C = K \left( 1 - \sum _ { i = N / T - K / T + 1 } ^ { N / T } { \binom { N / T } { i } } q ^ { i } ( 1 - q ) ^ { N / T - i } \right) ,
|
| 258 |
+
$$
|
| 259 |
+
|
| 260 |
+
1 We provide the proof of Theorem 1 in Appendix A.
|
| 261 |
+
|
| 262 |
+
Remark 5. (Trade-off between “Multi-round Privacy Guarantee” and “Average Aggregation Cardinality”). Theorem 1 indicates a trade-off between the multi-round privacy and the average aggregation cardinality since as $T$ increases, $C$ decreases which slows down the convergence as we show in Sec. 5.2. We show this trade-off in Fig. 3.
|
| 263 |
+
|
| 264 |
+
Remark 6. (Necessity of Batch Partitioning (BP)). We show that any strategy that satisfies the privacy guarantee in Equation (5) must have a batch partitioning structure, and for given $N , K , T , K \le N / 2$ , the largest number of distinct user sets in any strategy is at most $\binom { N / T } { K / T }$ , which is achieved in our design in Section 4. We provide the proof in Appendix C.
|
| 265 |
+
|
| 266 |
+
Remark 7. (Non-linear Reconstructions of Aggregated Models). The privacy criterion in Eq. (5) considers linear reconstructions of the aggregated models. One may also consider more general non-linear reconstructions. The long-term privacy guarantees of batch partitioning hold even under such reconstructions as the users in the same batch always participate together or do not participate at all. Hence, the server cannot separate individual models within the same batch even through non-linear operations.
|
| 267 |
+
|
| 268 |
+
# 5.2 Convergence Analysis of Multi-RoundSecAgg
|
| 269 |
+
|
| 270 |
+
For convergence analysis of Multi-RoundSecAgg, we first introduce a few common assumptions [23, 39].
|
| 271 |
+
|
| 272 |
+
Assumption 1. $L _ { 1 } , \dots , L _ { N }$ in (1) are all $\rho$ -smooth: for all a, $\pmb { b } \in \mathbb { R } ^ { d }$ and $i \in [ N ]$ , $L _ { i } ( a ) \leq L _ { i } ( b ) + ( a -$ $\begin{array} { r } { \pmb { b } ) ^ { \top } \nabla L _ { i } ( \pmb { b } ) + \frac { \rho } { 2 } \| \pmb { a } - \pmb { b } \| ^ { 2 } } \end{array}$ .
|
| 273 |
+
|
| 274 |
+
Assumption 2. $L _ { 1 } , \dots , L _ { N }$ in (1) are all $\mu$ -strongly convex: for all $a , b \in \mathbb { R } ^ { d }$ and $i \in [ N ]$ , $L _ { i } ( a ) \ \geq$ $\begin{array} { r } { L _ { i } ( b ) + ( a - b ) ^ { \top } \nabla L _ { i } ( b ) + \frac { \mu } { 2 } \| a - b \| ^ { 2 } } \end{array}$ .
|
| 275 |
+
|
| 276 |
+

|
| 277 |
+
Figure 3: An illustration of the trade-off between the multi-round privacy guarantee $T$ and the average aggregation cardinality $C$ . In this example, $N = 1 2 0$ and $K = 1 2$ .
|
| 278 |
+
|
| 279 |
+
Assumption 3. Let $\xi _ { i } ^ { ( t ) }$ be a sample uniformly selected from the dataset $\mathcal { D } _ { i }$ . The variance of the stochastic gradients at each user is bounded, i.e., $\mathbb { E } \| \nabla L _ { i } ( { \boldsymbol x } _ { i } ^ { ( t ) } , { \boldsymbol \xi } _ { i } ^ { ( t ) } ) - \nabla L _ { i } ( { \boldsymbol x } _ { i } ^ { ( t ) } ) \| ^ { 2 } \leq \sigma _ { i } ^ { 2 }$ for $i \in [ N ]$
|
| 280 |
+
|
| 281 |
+
Assumption 4. The expected squared norm of the stochastic gradients is uniformly bounded, i.e., $\mathbb { E } \| \nabla L _ { i } \bar { ( } x _ { i } ^ { ( t ) } , \xi _ { i } ^ { ( t ) } ) \| ^ { 2 } \le \bar { G } ^ { 2 }$ for all $i \in [ N ]$ .
|
| 282 |
+
|
| 283 |
+
We now state the convergence guarantees of Multi-RoundSecAgg.
|
| 284 |
+
|
| 285 |
+
Theorem 2. Consider a $F L$ setup with $N$ users to train a machine learning model from (1). Assume $K$ users are selected by Multi-RoundSecAgg with average aggregation cardinality $C$ defined in (7) to update the global model from (2), and all users have the same dropout rate, hence Multi-RoundSecAgg selects a random set of $K$ users uniformly from the set of available user sets at each round. Then, the following is satisfied
|
| 286 |
+
|
| 287 |
+
$$
|
| 288 |
+
\mathbb { E } [ L ( x ^ { ( J ) } ) ] - L ^ { * } \leq \frac { \rho } { \gamma + \frac { C } { K } E J - 1 } \left( \frac { 2 ( \alpha + \beta ) } { \mu ^ { 2 } } + \frac { \gamma } { 2 } \mathbb { E } \| x ^ { ( 0 ) } - x ^ { * } \| ^ { 2 } \right) ,
|
| 289 |
+
$$
|
| 290 |
+
|
| 291 |
+
$$
|
| 292 |
+
\begin{array} { r } { \alpha = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \sigma _ { i } ^ { 2 } + 6 \rho \Gamma + 8 ( E - 1 ) ^ { 2 } G ^ { 2 } , \beta = \frac { 4 ( N - K ) E ^ { 2 } G ^ { 2 } } { K ( N - 1 ) } , \Gamma = L ^ { * } - \sum _ { i = 1 } ^ { N } L _ { i } ^ { * } , a n d \gamma = \operatorname* { m a x } \left\{ \frac { 8 \rho } { \mu } , E \right\} } \end{array}
|
| 293 |
+
$$
|
| 294 |
+
|
| 295 |
+
316 We provide the proof of Theorem 2 in Appendix B.
|
| 296 |
+
|
| 297 |
+
Remark 8. (The average aggregation cardinality controls the convergence rate.) Theorem 2 shows how the average aggregation cardinality affects the convergence. When the average aggregation cardinality is maximized, i.e., $C = K$ , the convergence rate in Theorem 2 equals that of the random selection algorithm provided in Theorem 3 of [23]. In (8), we have the additional term $E$ (number of local epochs) in front of $J$ compared to Theorem 3 of [23] as we use global round index $t$ instead of using step index of local SGD. As the average aggregation cardinality decreases, a greater number of training rounds is required to achieve the same level of accuracy.
|
| 298 |
+
|
| 299 |
+
324 Remark 9. (General Convex and Non-Convex Convergence Rates). Theorem 2 considers the
|
| 300 |
+
325 strongly-convex case, but we consider the general convex and the non-convex cases in Appendix I.
|
| 301 |
+
|
| 302 |
+
Remark 10. (Different Dropout Rates). When the dropout probabilities of the users are not the same, characterizing the convergence guarantees of Multi-RoundSecAgg is challenging. This is due to the fact that batch selection based on the frequency of participation breaks the conditional unbiasedness of the user selection, which is required for the convergence guarantee. In experiments, however, we empirically show that Multi-RoundSecAgg guarantees the convergence with different dropout rates.
|
| 303 |
+
|
| 304 |
+
# 6 Experiments
|
| 305 |
+
|
| 306 |
+
Our experiments consist of two parts. We first numerically demonstrate the performance of MultiRoundSecAgg compared to the baselines of Section 3.3 in terms of the key metrics of Section 3.2. Next, we implement convolutional neural networks (CNNs) for image classification with MNIST [21], CIFAR-10, and CIFAR-100 [20] to investigate how the key metrics affect the test accuracy.
|
| 307 |
+
|
| 308 |
+
Setup. We consider a FL setting with $N = 1 2 0$ users, where the server aims to choose $K = 1 2$ users at every round. We study two settings for partitioning the CIFAR-100 dataset across the users.
|
| 309 |
+
|
| 310 |
+
• IID Setting. 50000 training samples are shuffled and partitioned uniformly across $N = 1 2 0$ users. • Non-IID Setting. We distribute the dataset using a Dirichlet distribution [13], which samples $\mathbf { d } _ { c } \sim \mathrm { D i r } ( \beta = 0 . 5 )$ which specifying the prior class distribution over 100 classes, and allocate a portion $d _ { c , i }$ of the class $c$ to user $i$ . The parameter $\beta$ controls the heterogeneity of the distributions at each user, where $\beta \to \infty$ results in IID setting.
|
| 311 |
+
|
| 312 |
+
We implement a VGG-11 [29], which is sufficient for our needs, as our goal is to evaluate various schemes, not to achieve the best accuracy. The hyperparameters are provided in Appendix F.
|
| 313 |
+
|
| 314 |
+
Modeling dropouts. To model heterogeneous system, users have different dropout probability $p _ { i }$ selected from $\{ 0 . 1 , 0 . 2 , 0 . 3 , 0 . 4 , 0 . 5 \}$ . At each round, user $i \in [ N ]$ drops with probability $p _ { i }$ .
|
| 315 |
+
|
| 316 |
+
Implemented Schemes. For the benchmarks, we implement the three baselines introduced in Sec. 3.3, referred to as Random, Weighted Random, and Partition. For Multi-RoundSecAgg, we construct three privacypreserving families with different target multi-round privacy guarantees, $T = 6$ , $T = 4$ , and $T = 3$ which we refer to as Multi-RoundSecAgg $( T \ = \ 6 )$ ), MultiRoundSecAgg $( T = 4 )$ ), and Multi-RoundSecAgg $( T =$
|
| 317 |
+
|
| 318 |
+
<table><tr><td>Scheme</td><td>Family size (= R)</td></tr><tr><td>Random selection</td><td>~1016</td></tr><tr><td>Weighted random selection</td><td>~1016</td></tr><tr><td>User partition</td><td>10</td></tr><tr><td>Multi-RoundSecAgg,T=6</td><td>190</td></tr><tr><td>Multi-RoundSecAgg,T=4</td><td>4060</td></tr><tr><td>Multi-RoundSecAgg,T=3</td><td>91389</td></tr></table>
|
| 319 |
+
|
| 320 |
+
Table 1: Family size with $N = 1 2 0$ , $K = 1 2$
|
| 321 |
+
|
| 322 |
+
3), respectively. One can view the Random and Partition as extreme cases of Multi-RoundSecAgg with $T = 1$ and $T = K$ , respectively. Table 1 summarizes the family size $R$ defined in Section 4.
|
| 323 |
+
|
| 324 |
+
Key Metrics. To numerically demonstrate the performance of the six schemes in terms of the key metrics defined in Sec. 3.2, at each round, we measure the following metrics.
|
| 325 |
+
|
| 326 |
+
• For the multi-round privacy guarantee, we measure the number of models in the partial sum that the server can reconstruct, which is given by $\begin{array} { r } T ^ { ( t ) } : = \operatorname* { m i n } _ { z \in \mathbb { R } ^ { J } \} \| z ^ { \top } { \bf P } ^ { ( t ) } \| _ { 0 } } \end{array}$ , s.t. $\bar { \mathbf { P } ^ { ( t ) } } ^ { \top } z \neq \mathbf { 0 }$ . This corresponds to the weaker privacy definition of Remark 1. We use this weaker privacy definition as the random selection and the random weighted selection strategies provide the worst privacy guarantee even with this weaker definition, as demonstrated later. On the other hand, MultiRoundSecAgg provides better privacy guarantees with both the strong and the weaker definitions. • For the aggregation fairness gap, we measure the instantaneous fairness gap, $\begin{array} { r l } { F ^ { ( t ) } } & { { } : = } \end{array}$ max𝑖 ∈ [ 𝑁 ] 𝐹 (𝑡)𝑖 − $\begin{array} { r } { \operatorname* { m a x } _ { i \in [ N ] } \bar { F _ { i } ^ { ( t ) } } - \operatorname* { m i n } _ { i \in [ N ] } F _ { i } ^ { ( t ) } } \end{array}$ where $\begin{array} { r } { F _ { i } ^ { ( t ) } = \frac { 1 } { t + 1 } \sum _ { l = 0 } ^ { t } \mathbb { 1 } \big \{ \{ p ^ { ( l ) } \} _ { i } = 1 \big \} } \end{array}$ .
|
| 327 |
+
|
| 328 |
+
• We measure the instantaneous aggregation cardinality as $\begin{array} { r } { C ^ { ( t ) } : = \frac { 1 } { t + 1 } \sum _ { l = 0 } ^ { t } \| \pmb { p } ^ { ( l ) } \| _ { 0 } } \end{array}$
|
| 329 |
+
|
| 330 |
+
We demonstrate these key metrics in Figure 4. We make the following key observations.
|
| 331 |
+
|
| 332 |
+
• Multi-RoundSecAgg achieves better multi-round privacy guarantee than both the random selection and random weighted selection strategies, while user partitioning achieves the best multi-round privacy guarantee, $T = K = 1 2$ . However, the partitioning strategy has the worst aggregation cardinality, which results in the lowest convergence rate as demonstrated later.
|
| 333 |
+
|
| 334 |
+
• Figure 5 demonstrates the trade-off between the multi-round privacy guarantee $T$ and the average aggregation cardinality $C$ . Interestingly, Multi-RoundSecAgg when $T = 3$ or $T = 4$ achieves better multi-round privacy guarantee than both the random selection and the weighted random selection strategies while achieving almost the same average aggregation cardinality.
|
| 335 |
+
|
| 336 |
+

|
| 337 |
+
Figure 4: The key metrics with $N = 1 2 0$ (number of users), $K = 1 2$ (number of selected users at each round).
|
| 338 |
+
|
| 339 |
+

|
| 340 |
+
Figure 5: Trade-off between multi-round privacy and average aggregation cardinality with $N =$ 120, $K = 1 2$ .
|
| 341 |
+
|
| 342 |
+

|
| 343 |
+
Figure 6: Training rounds versus test accuracy of VGG11 in [29] on the CIFAR-100 with $N = 1 2 0$ and $K = 1 2$ .
|
| 344 |
+
|
| 345 |
+
Remark 11. (Multi-round Privacy of Random and Weighted Random). The multi-round privacy guarantees of Random and Weighted Random drop sharply as shown in Fig. 4(a) as the participating matrix $\mathbf { P } ^ { ( t ) } \in \{ 0 , 1 \} ^ { t \times N }$ becomes full rank with high probability when $t \geq N$ , and hence the server can reconstruct the individual models by utilizing a pseudo inversion of the matrix $\mathbf { P } ^ { ( t ) }$ . More precisely, Theorem 3 in Appendix H shows this thresholding phenomenon, where the probability that the server can reconstruct individual models after certain number of rounds converges to 1 exponentially fast.
|
| 346 |
+
|
| 347 |
+
Key Metrics versus Test Accuracy. To investigate how the key metrics affect the test accuracy, we measure the test accuracy of the six schemes in the two settings, the IID and the non-IID settings. Our results are demonstrated in Figure 6. We make the following key observations.
|
| 348 |
+
|
| 349 |
+
• In the IID setting, the Multi-RoundSecAgg schemes show test accuracies that are comparable to the random selection and random weighted selection schemes while the Multi-RoundSecAgg schemes provide higher levels of privacy. Specifically, the Multi-RoundSecAgg schemes achieve $T = 3 , 4 , 6$ based on the privacy-preserving family design while the random selection and random weighted selection schemes have $T = 1$ , i.e., the server can learn an individual local model. • In the non-IID setting, Multi-RoundSecAgg not only outperforms the random selection scheme but also achieves a smaller aggregation fairness gap as demonstrated in Fig. 4(b). • In both IID and non-IID settings, the user partitioning scheme has the worst accuracy as its average aggregation cardinality is much smaller than the other schemes as demonstrated in Fig. 4(c).
|
| 350 |
+
|
| 351 |
+
We also implement additional experiments on MNIST and CIFAR-10 datasets in Appendix E and present ablation study for various settings of $( N , K , T )$ in Appendix G
|
| 352 |
+
|
| 353 |
+
# 7 7 Conclusion
|
| 354 |
+
|
| 355 |
+
Partial user participation may breach user privacy in federated learning, even if secure aggregation is employed at every training round. To address this challenge, we introduced the notion of long-term privacy, which ensures that the privacy of individual models are protected over all training rounds. We developed Multi-RoundSecAgg, a structured user selection strategy that guarantees long-term privacy while taking into account the fairness in user selection and average number of participating users, and showed that Multi-RoundSecAgg provides a trade-off between long-term privacy and average number of participating users (hence the convergence rate). Our experiments on the CIFAR-100, CIFAR-10, and MNIST datasets on both the IID and non-IID settings show that Multi-RoundSecAgg achieves comparable accuracy to the random selection strategy (which does not ensure long-term privacy), while ensuring long-term privacy guarantees.
|
| 356 |
+
|
| 357 |
+
References
|
| 358 |
+
[1] Martin Abadi, Andy Chu, Ian Goodfellow, H Brendan McMahan, Ilya Mironov, Kunal Talwar, and Li Zhang. Deep learning with differential privacy. In Proceedings of the 2016 ACM SIGSAC conference on computer and communications security, pages 308–318, 2016.
|
| 359 |
+
[2] James Henry Bell, Kallista A Bonawitz, Adrià Gascón, Tancrède Lepoint, and Mariana Raykova. Secure single-server aggregation with (poly) logarithmic overhead. In Proceedings of the 2020 ACM SIGSAC Conference on Computer and Communications Security, pages 1253–1269, 2020.
|
| 360 |
+
[3] Kallista Bonawitz, Peter Kairouz, Brendan McMahan, and Daniel Ramage. Federated learning and privacy: Building privacy-preserving systems for machine learning and data science on decentralized data. Queue, 19(5):87–114, 2021.
|
| 361 |
+
[4] Keith Bonawitz, Vladimir Ivanov, Ben Kreuter, Antonio Marcedone, H Brendan McMahan, Sarvar Patel, Daniel Ramage, Aaron Segal, and Karn Seth. Practical secure aggregation for privacy-preserving machine learning. In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security, pages 1175–1191, 2017.
|
| 362 |
+
[5] Wenlin Chen, Samuel Horvath, and Peter Richtarik. Optimal client sampling for federated learning. arXiv preprint arXiv:2010.13723, 2020.
|
| 363 |
+
[6] Yae Jee Cho, Samarth Gupta, Gauri Joshi, and Osman Yagan. Bandit-based communication- ˘ efficient client selection strategies for federated learning. arXiv preprint arXiv:2012.08009, 2020.
|
| 364 |
+
[7] Yae Jee Cho, Jianyu Wang, and Gauri Joshi. Client selection in federated learning: Convergence analysis and power-of-choice selection strategies. arXiv preprint arXiv:2010.01243, 2020.
|
| 365 |
+
[8] Beongjun Choi, Jy-yong Sohn, Dong-Jun Han, and Jaekyun Moon. Communicationcomputation efficient secure aggregation for federated learning. arXiv preprint arXiv:2012.05433, 2020.
|
| 366 |
+
[9] Cynthia Dwork, Aaron Roth, et al. The algorithmic foundations of differential privacy. Foundations and Trends® in Theoretical Computer Science, 9(3–4):211–407, 2014.
|
| 367 |
+
[10] Ahmed Roushdy Elkordy and A Salman Avestimehr. Secure aggregation with heterogeneous quantization in federated learning. arXiv preprint arXiv:2009.14388, 2020.
|
| 368 |
+
[11] Matt Fredrikson, Somesh Jha, and Thomas Ristenpart. Model inversion attacks that exploit confidence information and basic countermeasures. In Proceedings of the 22nd ACM SIGSAC Conference on Computer and Communications Security, pages 1322–1333, 2015.
|
| 369 |
+
[12] Jonas Geiping, Hartmut Bauermeister, Hannah Dröge, and Michael Moeller. Inverting gradients– how easy is it to break privacy in federated learning? arXiv preprint arXiv:2003.14053, 2020.
|
| 370 |
+
[13] Tzu-Ming Harry Hsu, Hang Qi, and Matthew Brown. Measuring the effects of non-identical data distribution for federated visual classification. arXiv preprint arXiv:1909.06335, 2019.
|
| 371 |
+
[14] Vishesh Jain, Ashwin Sah, and Mehtaab Sawhney. Singularity of discrete random matrices ii. arXiv preprint arXiv:2010.06554, 2020.
|
| 372 |
+
[15] Swanand Kadhe, Nived Rajaraman, O Ozan Koyluoglu, and Kannan Ramchandran. Fastsecagg: Scalable secure aggregation for privacy-preserving federated learning. arXiv preprint arXiv:2009.11248, 2020.
|
| 373 |
+
[16] Peter Kairouz, H Brendan McMahan, Brendan Avent, Aurélien Bellet, Mehdi Bennis, Arjun Nitin Bhagoji, Kallista Bonawitz, Zachary Charles, Graham Cormode, Rachel Cummings, et al. Advances and open problems in federated learning. Foundations and Trends® in Machine Learning, 14(1–2):1–210, 2021.
|
| 374 |
+
[17] Peter Kairouz, H Brendan McMahan, Brendan Avent, Aurélien Bellet, Mehdi Bennis, Arjun Nitin Bhagoji, Keith Bonawitz, Zachary Charles, Graham Cormode, Rachel Cummings, et al. Advances and open problems in federated learning. arXiv preprint arXiv:1912.04977, 2019.
|
| 375 |
+
[18] Sai Praneeth Karimireddy, Satyen Kale, Mehryar Mohri, Sashank Reddi, Sebastian Stich, and Ananda Theertha Suresh. Scaffold: Stochastic controlled averaging for federated learning. In International Conference on Machine Learning, pages 5132–5143. PMLR, 2020.
|
| 376 |
+
[19] Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (bit): General visual representation learning. In Computer Vision– ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part V 16, pages 491–507. Springer, 2020.
|
| 377 |
+
[20] Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
|
| 378 |
+
[21] Yann LeCun, Corinna Cortes, and CJ Burges. MNIST handwritten digit database. http://yann. lecun. com/exdb/mnist, 2010.
|
| 379 |
+
[22] Yann LeCun, Patrick Haffner, Léon Bottou, and Yoshua Bengio. Object recognition with gradient-based learning. In Shape, contour and grouping in computer vision, pages 319–345. Springer, 1999.
|
| 380 |
+
[23] Xiang Li, Kaixuan Huang, Wenhao Yang, Shusen Wang, and Zhihua Zhang. On the convergence of fedavg on non-iid data. In International Conference on Learning Representations, 2019.
|
| 381 |
+
[24] H Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. Communication-efficient learning of deep networks from decentralized data. In Int. Conf. on Artificial Int. and Stat. (AISTATS), pages 1273–1282, 2017.
|
| 382 |
+
[25] H Brendan McMahan, Daniel Ramage, Kunal Talwar, and Li Zhang. Learning differentially private recurrent language models. Int. Conf. on Learning Representations (ICLR), 2018.
|
| 383 |
+
[26] Milad Nasr, Reza Shokri, and Amir Houmansadr. Comprehensive privacy analysis of deep learning: Passive and active white-box inference attacks against centralized and federated learning. In 2019 IEEE symposium on security and privacy $( S P )$ , pages 739–753. IEEE, 2019.
|
| 384 |
+
[27] Balázs Pejó and Gergely Biczók. Quality inference in federated learning with secure aggregation. arXiv preprint arXiv:2007.06236, 2020.
|
| 385 |
+
[28] Monica Ribero and Haris Vikalo. Communication-efficient federated learning via optimal client sampling. arXiv preprint arXiv:2007.15197, 2020.
|
| 386 |
+
[29] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
|
| 387 |
+
[30] Jinhyun So, Ramy E Ali, Ba¸sak Güler, and A Salman Avestimehr. Secure aggregation for buffered asynchronous federated learning. arXiv preprint arXiv:2110.02177, 2021.
|
| 388 |
+
[31] Jinhyun So, Ba¸sak Güler, and A Salman Avestimehr. Turbo-aggregate: Breaking the quadratic aggregation barrier in secure federated learning. IEEE Journal on Selected Areas in Information Theory, 2(1):479–489, 2021.
|
| 389 |
+
[32] Jinhyun So, Corey J Nolet, Chien-Sheng Yang, Songze Li, Qian Yu, Ramy E Ali, Basak Guler, and Salman Avestimehr. Lightsecagg: a lightweight and versatile design for secure aggregation in federated learning. Proceedings of Machine Learning and Systems, 4:694–720, 2022.
|
| 390 |
+
[33] Sebastian U Stich. Local sgd converges fast and communicates little. arXiv preprint arXiv:1805.09767, 2018.
|
| 391 |
+
[34] Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In International Conference on Machine Learning, pages 6105–6114. PMLR, 2019.
|
| 392 |
+
|
| 393 |
+
[35] Minxue Tang, Xuefei Ning, Yitu Wang, Yu Wang, and Yiran Chen. Fedgp: Correlation-based 0 active client selection for heterogeneous federated learning. arXiv preprint arXiv:2103.13822, 1 2021. [36] Tuan Tran. The smallest singular value of random combinatorial matrices. arXiv preprint 3 arXiv:2007.06318, 2020. [37] Kang Wei, Jun Li, Ming Ding, Chuan Ma, Howard H Yang, Farhad Farokhi, Shi Jin, Tony QS 5 Quek, and H Vincent Poor. Federated learning with differential privacy: Algorithms and 6 performance analysis. IEEE Transactions on Information Forensics and Security, 15:3454– 7 3469, 2020. 8 [38] Chien-Sheng Yang, Jinhyun So, Chaoyang He, Songze Li, Qian Yu, and Salman Avestimehr. 09 Lightsecagg: Rethinking secure aggregation in federated learning. arXiv preprint 0 arXiv:2109.14236, 2021. [39] Hao Yu, Sen Yang, and Shenghuo Zhu. Parallel restarted sgd with faster convergence and less 2 communication: Demystifying why model averaging works for deep learning. In Proceedings 3 of the AAAI Conference on Artificial Intelligence, volume 33, pages 5693–5700, 2019. [40] Yizhou Zhao and Hua Sun. Information theoretic secure aggregation with user dropouts. arXiv 5 preprint arXiv:2101.07750, 2021. [41] Yue Zhao, Meng Li, Liangzhen Lai, Naveen Suda, Damon Civin, and Vikas Chandra. Federated 7 learning with non-iid data. arXiv preprint arXiv:1806.00582, 2018. [42] Ligeng Zhu and Song Han. Deep leakage from gradients. In Federated Learning, pages 17–31. 9 Springer, 2020.
|
md/dev/ppJuFSOAnM/ppJuFSOAnM.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/qY1hlv7gwg/qY1hlv7gwg.md
ADDED
|
@@ -0,0 +1,566 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SELECTIVE ANNOTATION MAKES LANGUAGE MODELS BETTER FEW-SHOT LEARNERS
|
| 2 |
+
|
| 3 |
+
Hongjin $\mathbf { S } \mathbf { u } ^ { \pmb { \ A } }$ Jungo Kasai♣♢ Chen Henry ${ \bf W } { \bf u } ^ { \heartsuit }$ Weijia $\mathbf { S h i ^ { \alpha } }$ Tianlu Wang♦ Jiayi $\mathbf { X i n } ^ { \bullet }$ Rui Zhang⋆ Mari Ostendorf♣ Luke Zettlemoyer♣♦ Noah A. Smith♣♢ Tao $\mathbf { Y } \mathbf { u } ^ { \pmb { \triangle } \pmb { \alpha } }$ ♠The University of Hong Kong ♣University of Washington ♢Allen Institute for AI ♡Carnegie Mellon University ⋆Penn State University ♦Meta AI
|
| 4 |
+
|
| 5 |
+
{hjsu,tyu}@cs.hku.hk, henrychenwu@cmu.edu, ostendor@uw.edu {jkasai,swj0419,lsz,nasmith}@cs.washington.edu
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Many recent approaches to natural language tasks are built on the remarkable abilities of large language models. Large language models can perform in-context learning, where they learn a new task from a few task demonstrations, without any parameter updates. This work examines the implications of in-context learning for the creation of datasets for new natural language tasks. Departing from recent in-context learning methods, we formulate an annotation-efficient, two-step framework: selective annotation that chooses a pool of examples to annotate from unlabeled data in advance, followed by prompt retrieval that retrieves task examples from the annotated pool at test time. Based on this framework, we propose an unsupervised, graph-based selective annotation method, vote- $k$ , to select diverse, representative examples to annotate. Extensive experiments on 10 datasets (covering classification, commonsense reasoning, dialogue, and text/code generation) demonstrate that our selective annotation method improves the task performance by a large margin. On average, vote- $k$ achieves a $1 2 . 9 \% / 1 1 . 4 \%$ relative gain under an annotation budget of 18/100, as compared to randomly selecting examples to annotate. Compared to state-of-the-art supervised finetuning approaches, it yields similar performance with $1 0 \mathrm { - } 1 0 0 \times$ less annotation cost across 10 tasks. We further analyze the effectiveness of our framework in various scenarios: language models with varying sizes, alternative selective annotation methods, and cases where there is a test data domain shift. We hope that our studies will serve as a basis for data annotations as large language models are increasingly applied to new tasks.1
|
| 10 |
+
|
| 11 |
+

|
| 12 |
+
Figure 1: Left: Our two-step framework for in-context learning. Instead of assuming access to large labeled data, we first select a small number of (diverse and representative) unlabeled examples to annotate before test time. At test time, we retrieve in-context examples from the small annotated pool. Right: In-context learning performance over varying annotation budgets averaged over three representative tasks (HellaSwag commonsense reasoning, MRPC paraphrase detection, and MWOZ dialogue state tracking). Here we experiment with GPT-J and Codex-davinci-002. Two selective annotation methods are presented: random selection and our vote- $k$ method. We observe that an appropriate selective annotation method largely improves the in-context learning performance with smaller variance over random selection under varying annotation budgets.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
Much recent work builds approaches to natural language tasks on the impressive abilities of large language models (e.g., GPT-3; Brown et al., 2020). Large language models can perform downstream tasks by conditioning generation on a few task demonstrations, thereby avoiding the need for any parameter updates. This new, few-shot learning paradigm is called in-context learning and has become an attractive alternative to supervised finetuning (Liu et al., 2021). In this work, we study the implications of this remarkable capability of large language models for dataset creation and annotation. We extensively examine how to reduce the manual annotation cost while retaining high in-context learning performance.
|
| 17 |
+
|
| 18 |
+
Although in-context learning was originally proposed for few-shot learning, recent works show that retrieving prompts from a large set of annotated examples is necessary to achieve good performances (Liu et al., 2022; Rubin et al., 2022). In particular, they show that the performance substantially improves when similar examples (under some embedding function) are retrieved as in-context examples specifically for each test input (Liu et al., 2022). Each test sample only requires a few in-context examples in its prompt. Different test instances, however, require different in-context examples with their associated annotations, necessitating a large set of annotated examples.
|
| 19 |
+
|
| 20 |
+
Distinct from these recent efforts, we establish a two-step framework to better understand and improve the annotation efficiency (Fig. 1): the first step is selective annotation that picks a small number of instances to get annotated before test time, followed by prompt retrieval that retrieves in-context examples for each test instance from the annotated data. The total annotation budget is the number of examples selected and annotated in the first step. The second step is bounded by the number of examples that can fit as input to a language model. Based on this framework, we propose an unsupervised, graph-based selective annotation method, named vote- $k$ , that selects diverse and representative instances to be annotated.
|
| 21 |
+
|
| 22 |
+
Our extensive experiments over 10 datasets across diverse tasks (covering classification, commonsense reasoning, dialogue, and text/code generation; see Tab. 2) demonstrate that our graph-based selective annotation method, vote- $k$ (§2.1), substantially improves the in-context learning performance by balancing the diversity and representativeness of annotated samples. For instance, vote- $k$ , combined with similarity-based prompt retrieval (Liu et al., 2022; Rubin et al., 2022), achieves a $1 1 . 4 \%$ relative gain under a budget of 100 annotated examples and a $1 2 . 9 \%$ relative gain when only 18 examples are annotated; 18 samples can fit into language models’ input, meaning the prompt retrieval step is not needed. Moreover, the improvement is consistent across language models with varying sizes (2B-175B parameters) (§4.2). This finding is in contrast with finetuning, where we cannot see the effectiveness of selective annotation over random baseline, due to outliers (Karamcheti et al., 2021) or training instability (D’Arcy & Downey, 2022). We hypothesize that in-context learning with similarity-based prompt retrieval is more robust to small annotation sizes and outliers because only the most similar examples are retrieved for each test instance. Indeed, we observe that random prompt retrieval fails to benefit from selective annotation (§4.4), providing support for our hypothesis.
|
| 23 |
+
|
| 24 |
+
Besides performance comparisons within a fixed annotation budget, we show that selective annotation provides better few-shot performance with $5 . 1 0 0 \times$ less annotation cost for new natural language tasks. In-context learning with 18 examples selected by vote- $k$ achieves higher performance than 100 randomly selected examples on 6 out of the 10 tasks. It also outperforms strong finetuning methods by a large margin (Fig. 2) and requires $1 0 \mathrm { - } 1 0 0 \times$ less annotations for similar performance (§4.1). We observe that in-context learning quickly (100 or 300 samples are annotated) converges to decent performance when vote- $k$ selective annotation is applied. These results suggest that large language models do not require large annotated datasets (e.g., 10K) due to their ability to adapt to new tasks through simple prompting.
|
| 25 |
+
|
| 26 |
+
Selective annotation also makes in-context learning much more stable. In real-world scenarios, even collecting unlabeled data is non-trivial and introduces randomness. We simulate such randomness in our experimental setting by subsampling the original unlabeled data multiple times. Our results suggest that vote- $k$ selective annotation largely reduces the variance of in-context learning even in this setting (Tab. 2). Further analysis shows larger improvements when there is a domain shift between training and test data (e.g., text from different Amazon users; Koh et al., 2021; $\ S 4 . 3$ ). Finally, when compared with previous selective annotation methods designed for supervised training/finetuning, we demonstrate that vote- $k$ selective annotation consistently improves the performance (§4.5). As in-context learning has been applied to increasingly more natural language processing applications, we hope that our annotation-efficient framework will provide useful guidance for both researchers and practitioners.
|
| 27 |
+
|
| 28 |
+
# 2 SELECTIVE ANNOTATION FOR IN-CONTEXT LEARNING
|
| 29 |
+
|
| 30 |
+
In-context learning only requires a few annotated examples per test instance (few-shot learning), while avoiding expensive finetuning on the whole training data. It is, however, often assumed that all annotated training data are available for prompt retrieval (e.g., Liu et al., 2022; Rubin et al., 2022). Yet the implied total annotation costs are hardly discussed in previous work. We develop a better practice for few-shot learning with large language models by carefully studying the total annotation cost required for in-context learning. We also study how examples should be selected to annotate, in order to make in-context learning perform better for new tasks. We formulate a general framework (Fig. 1 left) that consists of two steps: selective annotation $( \ S 2 . 1 )$ and prompt retrieval (§2.2).
|
| 31 |
+
|
| 32 |
+
# 2.1 SELECTIVE ANNOTATION
|
| 33 |
+
|
| 34 |
+
The first step chooses examples to annotate before test time. This process thus determines the total annotation budget. This selective annotation process is largely ignored in the recent literature for in-context learning. We will demonstrate, however, that the annotation cost can be substantially reduced by choosing a small set of diverse, representative examples, while retaining the downstream performance (§3). Formally, given a set of unlabeled samples $\mathcal { X } = \{ x _ { i } \} _ { i = 1 } ^ { N }$ , selective annotation aims at selecting a subset ${ \mathcal { L } } \subset { \mathcal { X } }$ to be annotated, where $| { \mathcal { L } } | = M$ is the annotation budget. We discuss our vote- $k$ selective annotation method and other selective annotation baselines below.
|
| 35 |
+
|
| 36 |
+
Vote- $k$ The goal of selective annotation for in-context learning is to select diverse and representative examples; representativeness will help many test instances to find similar demonstrations, while diversity increases the total coverage. We develop vote- $k$ , a graph-based method that promotes both diversity and representativeness. A detailed algorithm can be found in Appendix G. We first compute a vector representation for each unlabeled training instance using Sentence-BERT (Reimers & Gurevych, 2019) by averaging the resulting vectors over the text input words.2 We then use the embedding vectors to create a directed graph $G = ( V , E )$ where the vertices $V$ are the unlabeled instances $\mathcal { X }$ as defined above. For each vertex $v \in V$ , we create an edge to its $k$ nearest vertices in terms of the cosine similarity between the embeddings. Now let $\mathcal { L }$ and $\mathcal { U }$ denote the sets of already chosen (i.e., labeled) samples and remaining samples, respectively. Initially, ${ \mathcal { L } } = \emptyset$ . Every vertex $u \in \mathcal { U }$ is scored by a modified degree:
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
\operatorname { s c o r e } ( u ) = \sum _ { \substack { v \in \{ v | ( v , u ) \in E , v \in \mathcal { U } \} } } s ( v ) , \quad \mathrm { w h e r e } s ( v ) = \rho ^ { - | \{ \ell \in \mathcal { L } | ( v , \ell ) \in E \} | } , \quad \rho > 1
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
where $s$ discounts $v$ that is close to the already selected instances, thereby encouraging diversity. In every iteration, we take arg $\operatorname* { m a x } _ { u \in \mathcal { U } } \mathrm { s c o r e } ( u )$ and move it from $\mathcal { U }$ to $\mathcal { L }$ . We run $M / 1 0$ of these iterations; after this process, the current labeled $\mathcal { L }$ has $M / 1 0$ samples (up to Line 7 in Algorithm 1). Subsequently, we use $\mathcal { L }$ as the in-context learning examples for large language model, e.g.,GPT-J (Wang $\&$ Komatsuzaki, 2021), and generate a prediction for every instance in $\mathcal { U }$ . We then compute the average log probability over the generation output as the model’s confidence score (Line 8 to Line 10 in Algorithm 1). We then partition $\mathcal { U }$ into $M$ equal-sized buckets, based on their confidence scores (e.g., if $M = 1 0 0$ , we group the unlabeled instances by percentile). We add to $\mathcal { L }$ the example with the maximum score from each of the first $9 M / 1 0$ buckets (discarding the $M / 1 0$ buckets with the most confident examples), resulting in $| { \mathcal { L } } | = M$ (Line 11 to Line 15 in Algorithm 1). This further encourages diversity by selecting instances with varying confidence scores from in-context learning. We tuned $k$ and $\rho$ in our preliminary experiments, and found that $k = 1 5 0$ and $\rho { = } 1 0$ perform well across many datasets.3 We will explore other selective annotation methods from prior work on active learning or coreset selection (§4.5) and see that vote- $k$ outperforms these alternative methods.
|
| 43 |
+
|
| 44 |
+
Random and Other Selective Annotation Methods To quantify the effect of selective annotation, we also provide random and other baselines. For randomly-selected annotation, we conduct experiments three times and report the average score. We will show that these baselines substantially underperform the vote- $k$ method (§3.3), demonstrating the importance of the selective annotation step to reduce the total annotation cost.
|
| 45 |
+
|
| 46 |
+
# 2.2 PROMPT RETRIEVAL
|
| 47 |
+
|
| 48 |
+
Once we have a set of annotated examples $\mathcal { L }$ from selective annotation, we retrieve a few examples from the annotated set as in-context examples for each test instance. Following recent work (Liu et al., 2022), we will compute embeddings for all annotated samples using Sentence-BERT and find the most similar examples to each test instance in terms of cosine similarity.
|
| 49 |
+
|
| 50 |
+
# 3 EXPERIMENTS
|
| 51 |
+
|
| 52 |
+
We conduct extensive experiments over 10 diverse datasets, spanning 9 distinct tasks, and show a better approach to few-shot learning than previously considered. In general, we find that the first step of selective annotation is particularly crucial to reduce the amount of required annotation.
|
| 53 |
+
|
| 54 |
+
# 3.1 DATASETS AND TASKS
|
| 55 |
+
|
| 56 |
+
We use 10 diverse NLP datasets across 9 tasks that are listed in Table 1. These datasets involve different task formulations, thereby allowing for extensive evaluations in varying scenarios. Some of those are included in the widely-used GLUE benchmark (Wang et al., 2019). Appendix A illustrates details of the 10 datasets with examples.
|
| 57 |
+
|
| 58 |
+
For each dataset, we use the standard train/dev./test split available from the Transformers library (Wolf et al., 2020). In the selective annotation step, we remove all labels in the training data. For the datasets that have test data available publicly, we use the the test data for evaluation (SST-5, XSUM, MWoZ, and DBpedia). For the others, we follow prior work (e.g., Jiang et al., 2020; Lan et al., 2020; Gao et al., 2021) and use the dev. data for evaluation.4 We evaluate the methods by accuracy for all classification and multiple-choice selection datasets, joint accuracy (Budzianowski et al., 2018) for MWoZ, test suite accuracy (Zhong et al., 2020) for GeoQuery, exact matching (Rajpurkar et al., 2016) for NQ, and ROUGE-L (Lin, 2004) for XSum.
|
| 59 |
+
|
| 60 |
+
Table 1: All the 10 datasets and the in-context learning models used in our experiments. GPT-J and Codex-davinci-002 are used by default. Other in-context learning models are explored in analysis.
|
| 61 |
+
|
| 62 |
+
<table><tr><td></td><td>Dataset</td><td>Task</td><td>In-Context Learning Models</td></tr><tr><td rowspan="5">Classification</td><td>MRPC (Dolan et al.,2004)</td><td>Paraphrase Detection</td><td>GPT-Neo, GPT-J, GPT-3</td></tr><tr><td>SST-5 (Socher et al.,2013)</td><td>Sentiment Analysis</td><td>GPT-J</td></tr><tr><td>DBpedia (Lehmann et al., 2015)</td><td>Topic Classification</td><td>GPT-J</td></tr><tr><td>MNLI(Williams et al., 2018)</td><td>Natural Language Inference</td><td>GPT-J</td></tr><tr><td>RTE (Bentivogli et al.,2009)</td><td>Natural Language Inference</td><td>GPT-J</td></tr><tr><td></td><td>Multiple-Choice HellaSwag (Zellers et al.,2019)</td><td>Commonsense Reasoning</td><td>OPT, GPT-Neo, GPT-J, GPT-3</td></tr><tr><td>Dialogue</td><td>MWoZ 2.4(Budzianowski et al.,2018)</td><td>Dialogue State Tracking</td><td>Codex-{cushman,davinci-002}</td></tr><tr><td rowspan="3">Generation</td><td>GeoQuery (Zelle & Mooney,1996)</td><td>Semantic Parsing</td><td>Codex-davinci-002</td></tr><tr><td>NQ (Kwiatkowski et al.,2019)</td><td>Open-Domain QA</td><td>Codex-davinci-002</td></tr><tr><td>XSUM (Narayan et al.,2018)</td><td>Summarization</td><td>GPT-J</td></tr></table>
|
| 63 |
+
|
| 64 |
+
Measuring Stability Given a set of unlabeled data, our vote- $k$ selective annotation algorithm is deterministic, without any randomness. However, we note that in real scenarios, even getting unlabeled samples is not trivial, and getting unlabeled samples can be a process with large variance. To simulate this real setting, we perform selective annotation from 3K instances that are randomly subsampled from the original training data for each task. For each experiment, we repeat this subsampling three times, and results are averaged over the three trials. We will find that vote- $k$ still substantially improves stability over alternative selective annotation methods.
|
| 65 |
+
|
| 66 |
+
# 3.2 IN-CONTEXT LEARNING MODELS
|
| 67 |
+
|
| 68 |
+
We mainly perform experiments using GPT-J with 6B parameters (Wang & Komatsuzaki, 2021) due to our computational budget. The exceptions are the MWoZ, GeoQuery, and NQ datasets, where we use Codex-davinci-002 (Chen et al., 2021),5 a variant of GPT-3 finetuned on code data from the web. Codex is particularly effective for structured prediction such as semantic parsing, and we found it is indeed effective on three datasets (MWoZ, GeoQuery, and NQ) in our preliminary experiments. We will explore the effectiveness of selective annotation on the largest publically available language models, OPT-175B (Zhang et al., 2022) for HellaSwag (Fig. 4) and Codex-davinci-002 for MWoZ, over varying annotation budgets. We will also explore other language models with different sizes for three representative tasks (HellaSwag, MWoZ, and SST-5) in $\ S 4 . 2$ : GPT-3 with 175B (Brown et al., 2020) and GPT-Neo with 2.7B parameters (Black et al., 2021). Our later experiments will show the same patterns among selective annotation methods over these different language models. For the classification and multiple-choice tasks, we compute the average log score for each choice and choose the maximum one. For generation tasks, we simply perform beam-search decoding.
|
| 69 |
+
|
| 70 |
+
See Appendix B for our in-context learning prompt templates for all 10 datasets. For every test instance, we feed as much retrieved samples as possible into the language model until the maximum token length is reached. On average, the number of samples $N$ fed into the language model is 13.4 across different experiments. The in-context examples are concatenated in the ascending order of the similarity so that more similar examples benefit from the recency bias (Lu et al., 2022).
|
| 71 |
+
|
| 72 |
+
# 3.3 MAIN RESULTS
|
| 73 |
+
|
| 74 |
+
<table><tr><td colspan="2">Method</td><td colspan="5">Classification</td><td>Multi-Choice</td><td>Dialogue</td><td colspan="3">Generation</td></tr><tr><td>C</td><td>Selection</td><td>MRPC SST-5 MNLI DBpedia RTE</td><td></td><td></td><td></td><td></td><td>HSwag</td><td>MWoZ</td><td>GeoQ</td><td>NQ</td><td>XSum</td></tr><tr><td>100</td><td>Random</td><td>63.5</td><td>44.2</td><td>37.4</td><td>89.8</td><td>51.5</td><td>65.2</td><td>47.2</td><td>78.6</td><td>30.8</td><td>15.3</td></tr><tr><td>100</td><td>Vote-k</td><td>70.7</td><td>53.0</td><td>47.3</td><td>93.4</td><td>55.5</td><td>70.7</td><td>51.4</td><td>82.8</td><td>33.6</td><td>17.2</td></tr><tr><td>100</td><td>△ Absolute gain</td><td>+7.2</td><td>+8.8</td><td>+9.9</td><td>+3.6</td><td>+4.0</td><td>+5.5</td><td>+4.2</td><td>+4.2</td><td>+2.8</td><td>+1.9</td></tr><tr><td>18</td><td>Random</td><td>59.6</td><td>39.8</td><td>36.7</td><td>77.6</td><td>50.4</td><td>62.5</td><td>33.6</td><td>62.429.8</td><td></td><td>13.6</td></tr><tr><td>18</td><td>Vote-k</td><td>64.2</td><td>47.6</td><td>41.0</td><td>87.1</td><td>54.3</td><td>67.4</td><td>42.8</td><td>72.5</td><td>32.3</td><td>15.2</td></tr><tr><td>18</td><td>△ Absolute gain</td><td>+4.8</td><td>+7.8</td><td>+4.3</td><td>+9.5</td><td>+3.9</td><td>+4.9</td><td>+8.8</td><td>+9.9 +2.5</td><td></td><td>+1.6</td></tr></table>
|
| 75 |
+
|
| 76 |
+
Table 2: In-context learning results with randomly-selected and vote- $k$ selective annotation methods on all 10 datasets, with an annotation budget of 100 or 18. There is no prompt retrieval step when only 18 samples are annotated since all annotated samples can fit into the in-context learning model’s input. Across the board, selective annotation with vote- $k$ substantially outperforms the randomly-selected annotation baseline for in-context learning. Further, vote- $k$ largely reduces the variance over three trials (see the min and max results in Appendix C), making in-context learning more stable.
|
| 77 |
+
|
| 78 |
+
Seen in Table 2 are our results from all 10 diverse datasets with the annotation budgets of $| { \mathcal { L } } | \in$ $\{ 1 8 , 1 0 0 \}$ . 18 is chosen so that all annotated examples can be fit to the prompt for the language models without prompt retrieval. Over all datasets, vote- $k$ selective annotation outperforms the random baseline by a large margin $5 . 2 \%$ absolute gain and $1 1 . 4 \%$ relative gain on average) when the annotation budget is 100. Even when only 18 examples are annotated and fixed as the in-context examples for all testing instances (no prompt retrieval step), in-context learning with vote- $k$ still improves the randomly-selected annotation baseline $5 . 8 \%$ absolute gain and $12 . 9 \%$ relative gain on average). Particularly noteworthy is that in-context learning with 18 examples selected by vote- $k$ achieves higher performance than the one with 100 randomly selected examples on 6 out of 10 tasks. Moreover, vote- $k$ is a deterministic selective annotation method, conditioned on a set of unlabeled samples. Therefore, the variance of vote- $k$ comes solely from how the unlabeled samples are collected, largely improving the robustness of in-context learning. We therefore recommend that researchers and practitioners use selective annotation (e.g., our vote- $k$ method) to better benefit from the few-shot learning capability of large language models with stability. Our later experiments will also illustrate that vote- $k$ consistently outperforms alternative selective annotation methods (§4.5).
|
| 79 |
+
|
| 80 |
+
# 4 ANALYSIS
|
| 81 |
+
|
| 82 |
+
Our extensive experiments demonstrated that selective annotation is important for the success of in-context learning. Here we conduct detailed analysis to provide further guidance for researchers and practitioners of few-shot in-context learning. We analyze selective annotation for in-context learning from a variety of perspectives: comparisons to finetuning methods (§4.1), varying language model sizes $( \ S 4 . 2 )$ , test data domain shifts (§4.3), prompt retrieval methods $( \ S 4 . 4 )$ , and alternative selective annotation methods (§4.5).
|
| 83 |
+
|
| 84 |
+
# 4.1 IN-CONTEXT LEARNING VS. FINETUNING
|
| 85 |
+
|
| 86 |
+

|
| 87 |
+
Figure 2: Comparisons between the in-context learning and finetuning paradigms over varying annotation budgets on three representative tasks: HellaSwag commonsene reasoning, MRPC paraphrase detection, and MWoZ dialogue state tracking. Four configurations are presented: finetuning with examples that are randomly selected to annotate (FT-random) or selected by our vote- $k$ selective annotation method $\{ \ S 2 . 1$ ; FT-vote- $k$ ) and in-context learning with randomly-selected annotation (ICLrandom) or vote- $k$ selection (ICL-vote- $k$ ). See $\ S 4 . 1$ for experimental details. Selective annotation largely improves the in-context learning performance compared to randomly-selected annotation even when the annotation budget is 18. In-context learning with wisely-selected labeled samples is a much better few-shot practice than a strong finetuning method.
|
| 88 |
+
|
| 89 |
+
As discussed earlier, in-context learning is an alternative learning paradigm to conventional finetuning. Through the lens of our two-step framework, we observed that selective annotation and prompt retrieval are key to the success of in-context learning. A new question now arises: how does incontext learning compare with finetuning under limited annotation budgets? We empirically compare the two paradigms in this section.
|
| 90 |
+
|
| 91 |
+
We experiment with three representative tasks: MRPC (classification), HellaSwag (multiple-choice), and MWoZ (dialogue). Strong, state-of-the-art pretrained models are used for finetuning: large-sized RoBERTa (Liu et al., 2019) for MRPC and HellaSwag and DS2-T5 (Shin et al., 2022) for MWoZ. In-context learning uses GPT-J for MRPC, GPT-J and OPT 175B (Fig 4) for HellaSwag, and Codexdavinci-002 for MWoZ. Note that we do not aim to conduct head-to-head comparisons with exactly the same pretrained model; finetuning a large left-to-right language model (e.g., GPT-J and GPT-3) is computationally (and thus financially) infeasible in many cases. Here we examine the two paradigms from the practical perspective and benefit from the advantage of in-context learning, which requires no parameter updates of massive language models.
|
| 92 |
+
|
| 93 |
+
Fig. 2 compares the two paradigms across varying annotation sizes $\left. 1 8 , 1 0 0 , 3 0 0 , 8 0 0 \right. \mathrm { , }$ . Over all three tasks, we observe that in-context learning with vote- $k$ selection outperforms the finetuning performance of state-of-the-art pretrained language models. Specifically, we find that to achieve similar performance to vote- $k$ with $| \mathcal { L } | = 1 8$ or 100, finetuning requires 1000 annotated examples for HellaSwag and 800 for MWoZ $\mathbf { \left( 1 0 . 1 0 0 \times \right. }$ annotation cost). Note that the in-context learning performance usually converges when 100 or 300 examples are carefully selected and annotated, suggesting that a large annotated dataset is unnecessary for in-context learning to achieve strong performance. Interestingly, selective annotation helps in-context learning, but not finetuning. This result is consistent with recent work showing that many active learning algorithms perform similarly to random baseline, when pretrained language models are finetuned (Karamcheti et al., 2021; D’Arcy & Downey, 2022). They proposed that it might be due to outliers and the instability of finetuning on a limited number of annotated samples. We hypothesize that in-context learning with similarity-based prompt retrieval is more robust to outliers and small annotation sizes because only the most similar examples are retrieved for each test instance. We find two pieces of evidence for this hypothesis. First, $\ S 4 . 4$ shows that random (as opposed to similarity-based) prompt retrieval does not benefit from vote- $k$ selective annotation. Second, in Appendix E, we show that explicitly removing outliers also helps finetuning to benefit from vote- $k$ .
|
| 94 |
+
|
| 95 |
+
# 4.2 LANGUAGE MODELS WITH VARIOUS SIZES
|
| 96 |
+
|
| 97 |
+

|
| 98 |
+
Figure 3: Comparisons of various models with 100 annotated examples. Vote- $k$ selective annotation consistently improves in-context learning with pretrained language models of varying sizes.
|
| 99 |
+
|
| 100 |
+
Fig. 3 shows performance with varying sizes of language models (GPT-Neo 2B, Black et al., 2021; GPT-J 6B, Wang & Komatsuzaki, 2021; GPT-3, Brown et al., 2020) on HellaSwag commonsense reasoning, SST-5 sentiment analysis, and MWoZ dialogue state tracking. In general, when a smaller model is used, the performance gap between random and vote- $k$ selection is larger. In the HellaSwag task, vote- $k$ outperforms randomly-selected annotation by $7 . 5 \%$ using GPT-Neo, but only $2 . 6 \%$ using GPT-3. Nonetheless, we see consistent performance gains from vote- $k$ selection over varying sizes.
|
| 101 |
+
|
| 102 |
+
# 4.3 EFFECTS OF DOMAIN SHIFT
|
| 103 |
+
|
| 104 |
+
Recent work observed that when a large, pretrained language model is finetuned, the performance gain from active learning is limited (D’Arcy & Downey, 2022), but it can be larger if there is a domain shift between training and evaluation (Tamkin et al., 2022). We have demonstrated that selective annotation consistently improves in-context learning, but here we explore cases of domain shifts.
|
| 105 |
+
|
| 106 |
+
<table><tr><td colspan="2">Method</td><td colspan="2">CivilComments</td><td colspan="2">Amazon</td></tr><tr><td>L</td><td>Selection</td><td>Random</td><td>Domain</td><td>Random</td><td>Domain</td></tr><tr><td>100</td><td>Random</td><td>73.8</td><td>66.8</td><td>50.3</td><td>30.7</td></tr><tr><td>100</td><td>Vote-k</td><td>79.3</td><td>76.7</td><td>56.3</td><td>39.0</td></tr><tr><td>100</td><td>△ Absolute gain</td><td>+5.5</td><td>+9.9</td><td>+6.0</td><td>+8.3</td></tr></table>
|
| 107 |
+
|
| 108 |
+
Table 3: Effects of domain shift. Random splits and domain splits are compared (Koh et al., 2021).
|
| 109 |
+
|
| 110 |
+
Following Tamkin et al. (2022), we use two natural language datasets from the WILDS benchmark (Koh et al., 2021): CivilComments (toxicity classification; Borkan et al., 2019) and Amazon (review classification; Ni et al., 2019). Each comes with both a random split and a domain split: the former splits data randomly and the latter is based on the domains (demographic identities for CivilComments and users for Amazon), simulating cases where a model is deployed in a new scenario unseen during annotations. Similar to $\ S 3 . 3$ , we conduct experiments with GPT-J under two settings: random/vote- $k$ selective annotation, followed by similarity-based prompt retrieval. Both selective annotation and prompt retrieval are conducted on the source domain.
|
| 111 |
+
|
| 112 |
+
Tab. 3 shows our results. We see that the gain from vote- $k$ is more pronounced under the domain splits: e.g., 9.9 vs. 5.5 accuracy point improvements on CivilComments. This suggests that selective annotation and prompt retrieval are particularly crucial when there is a domain shift in the evaluation data, as in many realistic scenarios (Koh et al., 2021; Longpre et al., 2022).
|
| 113 |
+
|
| 114 |
+
4.4 RANDOM PROMPT RETRIEVAL
|
| 115 |
+
|
| 116 |
+
<table><tr><td colspan="3">Method</td><td colspan="3">Dataset</td></tr><tr><td>|C|</td><td>Selection</td><td>Retrieval</td><td>HellaSwag</td><td>SST-5</td><td>MWoZ</td></tr><tr><td>100</td><td>Vote-k</td><td>Similar</td><td>70.7</td><td>53.0</td><td>51.4</td></tr><tr><td>100</td><td>Random</td><td>Similar</td><td>65.2</td><td>44.2</td><td>47.2</td></tr><tr><td>100</td><td>Vote-k</td><td>Random</td><td>62.5</td><td>41.6</td><td>35.6</td></tr><tr><td>100</td><td>Random</td><td>Random</td><td>63.2</td><td>40.6</td><td>43.8</td></tr></table>
|
| 117 |
+
|
| 118 |
+
Table 4: Comparison of random and similar prompt retrieval. Random retrieval fails to benefit from diverse and representative annotated examples from vote- $k$ .
|
| 119 |
+
|
| 120 |
+
We have performed similarity-based prompt retrieval so far. Here we experiment with a random baseline for the prompt retrieval step to quantify the effect of prompt retrieval (Tab. 4). Interestingly, when random prompt retrieval is performed, vote- $k$ does not necessarily improve upon the randomlyselected annotation baseline: e.g., 62.5 vs. 63.2 on HellaSwag and 35.7 vs. 43.8 on MWoZ. This suggests that random prompt retrieval fails to benefit from diverse, representative 100 samples, selected by vote- $k$ selective annotation. Combining selective annotation and prompt retrieval is thus crucial for the success of in-context learning.
|
| 121 |
+
|
| 122 |
+
4.5 ALTERNATIVE SELECTIVE ANNOTATION METHODS
|
| 123 |
+
|
| 124 |
+
<table><tr><td></td><td>Random</td><td>MFL</td><td>K-means</td><td>Diversity</td><td>Least-conf</td><td>Conf-only</td><td>Fast vote-k</td><td>Vote-k</td></tr><tr><td>HellaSwag</td><td>65.2</td><td>66.5</td><td>67.6</td><td>68.2</td><td>68.4</td><td>68.6</td><td>69.5</td><td>70.7</td></tr><tr><td>SST-5</td><td>44.2</td><td>45.6</td><td>47.2</td><td>48.5</td><td>46.2</td><td>48.3</td><td>51.9</td><td>53.0</td></tr><tr><td>MWoZ</td><td>47.2</td><td>48.3</td><td>48.8</td><td>49.2</td><td>49.4</td><td>49.2</td><td>50.2</td><td>51.4</td></tr></table>
|
| 125 |
+
|
| 126 |
+
Table 5: Comparisons of various selective annotation methods with 100 annotated examples. Performance is averaged over three random trials. Vote- $k$ outperforms all the other selective annotation methods. Fast vote- $k$ , a faster version of voke- $\mathbf { \nabla } \cdot \mathbf { k }$ without the need for confidence score computations, can achieve similar performance to vote- $k$ while being more computationally efficient.
|
| 127 |
+
|
| 128 |
+
Here we explore six additional methods for selective annotation:
|
| 129 |
+
|
| 130 |
+
• Maximizing facility location (MFL; Lin & Bilmes, 2009) aims at optimizing the representativeness of the selected samples. Since this objective satisfies the submodular objective, maximization can be approximated via a greedy algorithm (see Appendix G.2).
|
| 131 |
+
• K-means (Lloyd, 1982) groups examples into $k$ clusters, and selects the centroid example from each cluster.
|
| 132 |
+
• Diversity focuses on maximizing the diversity of the embeddings for selected examples in the first step (Appendix G.3).
|
| 133 |
+
• Least-conf (Lewis & Gale, 1994) iteratively adds least-confident examples to the annotated set.
|
| 134 |
+
• Conf-only is ablations that apply confidence-based stratification similar to vote- $k$ , but examples are sampled randomly from each group without graph-based scoring.
|
| 135 |
+
• Fast vote- $k$ is a fast, efficient alternative to our vote- $k$ method $( \ S 2 . 1 )$ that does not use confidence scores. It picks $M$ samples with the largest vote- $k$ scores. It avoids using the pretrained language model to compute a confidence score for every instance, resulting in a $^ { 1 0 + }$ times speedup.
|
| 136 |
+
|
| 137 |
+
Notice that MFL, diversity, and least-confidence do not have hyperparameters other than the annotation budget. As shown in Tab. 5, vote- $k$ outperforms all the other methods. It is noteworthy, however, that fast vote- $k$ can achieve similar performance to vote- $k$ . Fast vote- $k$ is thus an attractive method for researchers and practitioners with a limited computational budget. Like vote- $k$ , MFL also optimizes representativeness and Diversity also optimizes diversity. In particular, MFL defines representativeness as a sum over distances from the selected examples to all other examples, and Diversity defines diversity as the distances between selected examples. Since they do not significantly outperform randomly-selected annotation, we conjecture that jointly optimize diversity and representativeness is needed for selective annotation. Moreover, the way vote- $k$ defines and diversity are also different from the baselines: vote- $k$ defines representativeness as the number of neighbors during similarity-based prompt retrieval, which is effectively tailored to in-context learning; vote- $k$ directly optimizes for the diversity of selected samples using the in-context learning model’s prediction confidence.
|
| 138 |
+
|
| 139 |
+
# 5 RELATED WORK
|
| 140 |
+
|
| 141 |
+
In-Context Learning In-context learning with large language models has recently received an increasing amount of interest, partly due to its flexibility and sample efficiency (Liu et al., 2021). Several recent works proposed methods to improve in-context learning in many aspects: e.g., metatraining (Chen et al., 2022; Min et al., 2022b), task instructions (Efrat & Levy, 2020; Mishra et al., 2022; Wei et al., 2021; Sanh et al., 2022), or task formulation (Holtzman et al., 2021; Zhao et al., 2021; Min et al., 2022a). In this paradigm, the choice of in-context (i.e., demonstration) examples has been shown crucial (Liu et al., 2022; Rubin et al., 2022; Lu et al., 2022), while recent work raised questions as to the degree to which correct labels are necessary (Min et al., 2022c). This work proposes an annotation-efficient in-context learning framework by focusing on the choice of examples and its implications on the annotation cost.
|
| 142 |
+
|
| 143 |
+
Active Learning Active learning aims to enable machine learning models to achieve similar or greater performance with fewer labeled training instances (Cohn et al., 1994; Settles, 2009). Our selective annotation step for in-context learning shares the same goal of reducing the annotation cost. Most active learning methods involve iterative parameter updates (e.g., Wang et al., 2017; Kasai et al., 2019), which are computationally expensive for large language models used in in-context learning. Similar to our vote- $k$ algorithm, Lin & Bilmes (2009) used the facility location objective to optimize representativeness. We observed that this objective largely underperforms vote- $k$ for in-context learning, probably due to the fact the vote- $k$ (1) is effectively tailored to the prompt retrieval step of in-context learning and (2) directly optimizes the diversity of selected samples (see $\ S 4 . 5 )$ . More recently, the effectiveness of active learning has been questioned when large-scale pretrained models are finetuned for various tasks (Karamcheti et al., 2021; D’Arcy & Downey, 2022). Our experiments (§3) showed that selective annotation helps reduce the annotation cost of in-context learning, departing from the recent observations on finetuning with active learning. We hypothesize that it is because in-context learning with similarity-based prompt retrieval is more robust to outliers since each test instance only retrieves its most similar examples. This is supported by $\ S 4 . 4$ , where random prompt retrieval does not benefit from selective annotation.
|
| 144 |
+
|
| 145 |
+
# 6 CONCLUSION
|
| 146 |
+
|
| 147 |
+
Much recent work illustrated the ability of large language models to adapt to new tasks simply from a few demonstration examples. We presented in-depth studies on the implications of this ability for dataset annotation through the lens of selective annotation and introduced an annotation-efficient practice. The best selective annotation method explored in this paper, our vote- $k$ method, selects diverse, representative examples to annotate. In terms of the task performance, vote- $k$ improves the performance on 10 diverse tasks by a large margin. Moreover, vote- $k$ selective annotation yields similar performance to state-of-the-art supervised finetuning with $1 0 \mathrm { - } 1 0 0 \times$ less annotation cost. We further show that the effectiveness of vote- $k$ is consistent with different language model sizes and domain shifts between training and test data. We hope that our findings will help researchers and practitioners efficiently design new natural language tasks and beyond.
|
| 148 |
+
|
| 149 |
+
# ACKNOWLEDGEMENTS
|
| 150 |
+
|
| 151 |
+
We thank Sewon Min, Pradeep Dasigi, Yanda Chen, Yushi Hu, Alisa Liu, and the ARK group at UW for their helpful feedback on this work.
|
| 152 |
+
|
| 153 |
+
# REFERENCES
|
| 154 |
+
|
| 155 |
+
Luisa Bentivogli, Ido Dagan, Hoa Trang Dang, Danilo Giampiccolo, and Bernardo Magnini. The fifth PASCAL recognizing textual entailment challenge. In Proc. of TAC, 2009. URL https://tac.nist.gov/publications/2009/additional.papers/ RTE5_overview.proceedings.pdf.
|
| 156 |
+
Sid Black, Leo Gao, Phil Wang, Connor Leahy, and Stella Biderman. GPT-Neo: Large Scale Autoregressive Language Modeling with Mesh-Tensorflow, 2021. URL https://zenodo. org/record/5551208.
|
| 157 |
+
Daniel Borkan, Lucas Dixon, Jeffrey Sorensen, Nithum Thain, and Lucy Vasserman. Nuanced metrics for measuring unintended bias with real data for text classification. In Companion Proceedings of WWW, 2019. URL https://doi.org/10.1145/3308560.3317593.
|
| 158 |
+
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 Proc. of NeurIPS, 2020. URL https://proceedings.neurips.cc/paper/2020/file/ 1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf.
|
| 159 |
+
Paweł Budzianowski, Tsung-Hsien Wen, Bo-Hsiang Tseng, Inigo Casanueva, Stefan Ultes, Osman ˜ Ramadan, and Milica Gasiˇ c. MultiWOZ - a large-scale multi-domain Wizard-of-Oz dataset for ´ task-oriented dialogue modelling. In Proc. of EMNLP, 2018. URL https://arxiv.org/ abs/1810.00278.
|
| 160 |
+
Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harrison Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, Dave Cummings, Matthias Plappert, Fotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William Hebgen Guss, Alex Nichol, Alex Paino, Nikolas Tezak, Jie Tang, Igor Babuschkin, Suchir Balaji, Shantanu Jain, William Saunders, Christopher Hesse, Andrew N. Carr, Jan Leike, Joshua Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew Knight, Miles Brundage, Mira Murati, Katie Mayer, Peter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. Evaluating large language models trained on code, 2021. URL https://arxiv.org/abs/2107.03374.
|
| 161 |
+
Yanda Chen, Ruiqi Zhong, Sheng Zha, George Karypis, and He He. Meta-learning via language model in-context tuning. In Proc. of ACL, May 2022. URL https://arxiv.org/abs/ 2110.07814.
|
| 162 |
+
David A. Cohn, Les E. Atlas, and Richard E. Ladner. Improving generalization with active learning. Machine Learning, 1994. URL https://doi.org/10.1007/BF00993277.
|
| 163 |
+
Mike D’Arcy and Doug Downey. Limitations of active learning with deep transformer language models, 2022. URL https://openreview.net/forum?id $= 1$ Q8OjAGkxwP5.
|
| 164 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proc. of NAACL, 2019. URL https://arxiv.org/abs/810.04805.
|
| 165 |
+
|
| 166 |
+
Bill Dolan, Chris Quirk, and Chris Brockett. Unsupervised construction of large paraphrase corpora: Exploiting massively parallel news sources. In Proc. of COLING, 2004. URL https:// aclanthology.org/C04-1051.
|
| 167 |
+
|
| 168 |
+
Avia Efrat and Omer Levy. The Turking test: Can language models understand instructions?, 2020. URL https://arxiv.org/abs/2010.11982.
|
| 169 |
+
|
| 170 |
+
Tianyu Gao, Adam Fisch, and Danqi Chen. Making pre-trained language models better few-shot learners. In Proc. of ACL, 2021. URL https://aclanthology.org/2021.acl-long. 295.
|
| 171 |
+
|
| 172 |
+
Ari Holtzman, Peter West, Vered Shwartz, Yejin Choi, and Luke Zettlemoyer. Surface form competition: Why the highest probability answer isn’t always right. In Proc. of EMNLP, 2021. URL https://arxiv.org/abs/2104.08315.
|
| 173 |
+
|
| 174 |
+
Haoming Jiang, Pengcheng He, Weizhu Chen, Xiaodong Liu, Jianfeng Gao, and Tuo Zhao. SMART: Robust and efficient fine-tuning for pre-trained natural language models through principled regularized optimization. In Proc. of ACL, 2020. URL https://aclanthology.org/2020. acl-main.197.
|
| 175 |
+
|
| 176 |
+
Siddharth Karamcheti, Ranjay Krishna, Li Fei-Fei, and Christopher Manning. Mind your outliers! investigating the negative impact of outliers on active learning for visual question answering. In Proc. of ACL, 2021. URL https://arxiv.org/abs/2107.02331.
|
| 177 |
+
|
| 178 |
+
Jungo Kasai, Kun Qian, Sairam Gurajada, Yunyao Li, and Lucian Popa. Low-resource deep entity resolution with transfer and active learning. In Proc. of ACL, 2019. URL https://arxiv. org/abs/1906.08042.
|
| 179 |
+
|
| 180 |
+
Pang Wei Koh, Shiori Sagawa, Henrik Marklund, Sang Michael Xie, Marvin Zhang, Akshay Balsubramani, Weihua Hu, Michihiro Yasunaga, Richard Lanas Phillips, Irena Gao, Tony Lee, Etienne David, Ian Stavness, Wei Guo, Berton Earnshaw, Imran Haque, Sara M Beery, Jure Leskovec, Anshul Kundaje, Emma Pierson, Sergey Levine, Chelsea Finn, and Percy Liang. WILDS: A benchmark of in-the-wild distribution shifts. In Proc. of ICML, 2021. URL https://proceedings.mlr.press/v139/koh21a.html.
|
| 181 |
+
|
| 182 |
+
Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, et al. Natural questions: a benchmark for question answering research. TACL, 2019. URL https://research. google/pubs/pub47761/.
|
| 183 |
+
|
| 184 |
+
Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. ALBERT: A lite BERT for self-supervised learning of language representations. In Proc. of ICLR, 2020. URL https://arxiv.org/abs/1909.11942.
|
| 185 |
+
|
| 186 |
+
Jens Lehmann, Robert Isele, Max Jakob, Anja Jentzsch, Dimitris Kontokostas, Pablo N. Mendes, Sebastian Hellmann, Mohamed Morsey, Patrick van Kleef, Soren Auer, and Christian Bizer. ¨ DBpedia - a large-scale, multilingual knowledge base extracted from wikipedia. Semantic Web, 2015. URL http://svn.aksw.org/papers/2013/SWJ_DBpedia/public.pdf.
|
| 187 |
+
|
| 188 |
+
David D Lewis and William A Gale. A sequential algorithm for training text classifiers. In SIGIR’94, pp. 3–12. Springer, 1994.
|
| 189 |
+
|
| 190 |
+
Chin-Yew Lin. ROUGE: A package for automatic evaluation of summaries. In Proc. of Text Summarization Branches Out, 2004. URL https://www.aclweb.org/anthology/ W04-1013/.
|
| 191 |
+
|
| 192 |
+
Hui-Ching Lin and Jeff A. Bilmes. How to select a good training-data subset for transcription: submodular active selection for sequences. In Proc. of INTERSPEECH, 2009. URL https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1. 1.149.6843&rep $\underline { { \underline { { \mathbf { \Pi } } } } } =$ rep1&type $=$ pdf.
|
| 193 |
+
|
| 194 |
+
Jiachang Liu, Dinghan Shen, Yizhe Zhang, Bill Dolan, Lawrence Carin, and Weizhu Chen. What makes good in-context examples for GPT-3? In Proc. of DeeLIO 2022, 2022. URL https: //arxiv.org/abs/2101.06804.
|
| 195 |
+
|
| 196 |
+
Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. Pre-train, prompt, and predict: A systematic survey of prompting methods in natural language processing, 2021. URL https://arxiv.org/abs/2107.13586.
|
| 197 |
+
|
| 198 |
+
Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke S. Zettlemoyer, and Veselin Stoyanov. RoBERTa: A robustly optimized bert pretraining approach, 2019. URL https://arxiv.org/abs/1907.11692.
|
| 199 |
+
|
| 200 |
+
Stuart Lloyd. Least squares quantization in pcm. IEEE transactions on information theory, 28(2): 129–137, 1982.
|
| 201 |
+
|
| 202 |
+
Shayne Longpre, Julia Reisler, Edward Greg Huang, Yi Lu, Andrew Frank, Nikhil Ramesh, and Chris DuBois. Active learning over multiple domains in natural language tasks, 2022. URL https://arxiv.org/abs/2202.00254.
|
| 203 |
+
|
| 204 |
+
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. In Proc. of ACL, 2022. URL https://arxiv.org/abs/2104.08786.
|
| 205 |
+
|
| 206 |
+
Katerina Margatina, Giorgos Vernikos, Lo¨ıc Barrault, and Nikolaos Aletras. Active learning by acquiring contrastive examples. arXiv preprint arXiv:2109.03764, 2021.
|
| 207 |
+
|
| 208 |
+
Sewon Min, Mike Lewis, Hannaneh Hajishirzi, and Luke Zettlemoyer. Noisy channel language model prompting for few-shot text classification. In Proc. of ACL, 2022a. URL https://arxiv. org/abs/2108.04106.
|
| 209 |
+
|
| 210 |
+
Sewon Min, Mike Lewis, Luke Zettlemoyer, and Hannaneh Hajishirzi. MetaICL: Learning to learn in context. In Proc. of NAACL, 2022b. URL https://arxiv.org/abs/2110.15943.
|
| 211 |
+
|
| 212 |
+
Sewon Min, Xinxi Lyu, Ari Holtzman, Mikel Artetxe, Mike Lewis, Hannaneh Hajishirzi, and Luke Zettlemoyer. Rethinking the role of demonstrations: What makes in-context learning work?, 2022c. URL https://arxiv.org/abs/2202.12837.
|
| 213 |
+
|
| 214 |
+
Swaroop Mishra, Daniel Khashabi, Chitta Baral, and Hannaneh Hajishirzi. Cross-task generalization via natural language crowdsourcing instructions. In Proc. of ACL, 2022. URL https://arxiv. org/abs/2104.08773.
|
| 215 |
+
|
| 216 |
+
Shashi Narayan, Shay B. Cohen, and Mirella Lapata. Don’t give me the details, just the summary! topic-aware convolutional neural networks for extreme summarization. In Proc. of EMNLP, 2018. URL https://arxiv.org/abs/1808.08745.
|
| 217 |
+
|
| 218 |
+
Jianmo Ni, Jiacheng Li, and Julian McAuley. Justifying recommendations using distantly-labeled reviews and fine-grained aspects. In Proc. of EMNLP, 2019. URL https://aclanthology. org/D19-1018.
|
| 219 |
+
|
| 220 |
+
Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. SQuAD: $^ { 1 0 0 , 0 0 0 + }$ questions for machine comprehension of text. In Proc. of EMNLP, 2016. URL https://arxiv.org/ abs/1606.05250.
|
| 221 |
+
|
| 222 |
+
Nils Reimers and Iryna Gurevych. Sentence-BERT: Sentence embeddings using Siamese BERTnetworks. In Proc. of EMNLP, 2019. URL https://aclanthology.org/D19-1410.
|
| 223 |
+
|
| 224 |
+
Ohad Rubin, Jonathan Herzig, and Jonathan Berant. Learning to retrieve prompts for in-context learning. In Proc. of NAACL, 2022. URL https://arxiv.org/abs/2112.08633.
|
| 225 |
+
|
| 226 |
+
Victor Sanh, Albert Webson, Colin Raffel, Stephen H. Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, Manan Dey, M. Saiful Bari, Canwen Xu, Urmish Thakker, Shanya Sharma, Eliza Szczechla, Taewoon Kim, Gunjan Chhablani, Nihal V. Nayak, Debajyoti Datta, Jonathan Chang, Mike Tian-Jian Jiang, Han Wang, Matteo Manica, Sheng Shen, Zheng Xin Yong, Harshit Pandey, Rachel Bawden, Thomas Wang, Trishala Neeraj, Jos Rozen, Abheesht Sharma, Andrea Santilli, Thibault Fevry, Jason Alan Fries, Ryan Teehan, Stella ´ Biderman, Leo Gao, Tali Bers, Thomas Wolf, and Alexander M. Rush. Multitask prompted training enables zero-shot task generalization. In Proc. of ICLR, 2022. URL https://arxiv.org/ abs/2110.08207.
|
| 227 |
+
|
| 228 |
+
Burr Settles. Active learning literature survey. Computer sciences technical report, University of Wisconsin–Madison, 2009. URL https://burrsettles.com/pub/settles. activelearning.pdf.
|
| 229 |
+
|
| 230 |
+
Jamin Shin, Hangyeol Yu, Hyeongdon Moon, Andrea Madotto, and Juneyoung Park. Dialogue summaries as dialogue states (ds2), template-guided summarization for few-shot dialogue state tracking. In ACL FINDINGS, 2022.
|
| 231 |
+
|
| 232 |
+
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 Proc. of EMNLP, 2013. URL https://aclanthology.org/D13-1170.
|
| 233 |
+
|
| 234 |
+
Alex Tamkin, Dat Nguyen, Salil Deshpande, Jesse Mu, and Noah D. Goodman. Active learning helps pretrained models learn the intended task, 2022. URL https://doi.org/10.48550/ arXiv.2204.08491.
|
| 235 |
+
|
| 236 |
+
Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-SNE. Journal of Machine Learning Research, 9:2579–2605, 2008. URL http://www.jmlr.org/papers/v9/ vandermaaten08a.html.
|
| 237 |
+
|
| 238 |
+
Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In Proc. of ICLR., 2019. URL https://arxiv.org/abs/1804.07461.
|
| 239 |
+
|
| 240 |
+
Ben Wang and Aran Komatsuzaki. GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/mesh-transformer-jax, 2021.
|
| 241 |
+
|
| 242 |
+
Keze Wang, Dongyu Zhang, Ya Li, Ruimao Zhang, and Liang Lin. Cost-effective active learning for deep image classification. TCSVT, 2017.
|
| 243 |
+
|
| 244 |
+
Jason Wei, Maarten Bosma, Vincent Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M. Dai, and Quoc V. Le. Finetuned language models are zero-shot learners. In Proc. of ICLR, 2021. URL https://arxiv.org/abs/2109.01652.
|
| 245 |
+
|
| 246 |
+
Adina Williams, Nikita Nangia, and Samuel Bowman. A broad-coverage challenge corpus for sentence understanding through inference. In NAACL, 2018. URL https://arxiv.org/ abs/1704.05426.
|
| 247 |
+
|
| 248 |
+
Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander Rush. HuggingFace’s transformers: State-of-theart natural language processing. In Proc. of EMNLP: System Demonstrations, October 2020. URL https://aclanthology.org/2020.emnlp-demos.6.
|
| 249 |
+
|
| 250 |
+
John M. Zelle and Raymond J. Mooney. Learning to parse database queries using inductive logic programming. In Proc. of AAAI, 1996. URL http://www.aaai.org/Library/AAAI/ 1996/aaai96-156.php.
|
| 251 |
+
|
| 252 |
+
Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. HellaSwag: Can a machine really finish your sentence? In Proc. of ACL, 2019. URL https://arxiv.org/abs/1905. 07830.
|
| 253 |
+
|
| 254 |
+
Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, Todor Mihaylov, Myle Ott, Sam Shleifer, Kurt Shuster, Daniel Simig, Punit Singh Koura, Anjali Sridhar, Tianlu Wang, and Luke Zettlemoyer. Opt: Open pre-trained transformer language models. ArXiv, abs/2205.01068, 2022.
|
| 255 |
+
|
| 256 |
+
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.), Proc. of ICML, 2021. URL https://arxiv.org/abs/2102.09690.
|
| 257 |
+
|
| 258 |
+
Ruiqi Zhong, Tao Yu, and Dan Klein. Semantic evaluation for text-to-SQL with distilled test suites. In Proc. of EMNLP, 2020. URL https://arxiv.org/abs/2010.02840.
|
| 259 |
+
|
| 260 |
+
Table 6: All of the 10 datasets with examples used in our experiments. The 10 datasets span various formations, including classification (SST-5, Socher et al., 2013; MRPC, Dolan et al., 2004), multiple-choice selection (HellaSwag, Zellers et al., 2019), and code/text generation (MWoZ 2.4, Budzianowski et al., 2018; GeoQuery, Zelle & Mooney, 1996; NQ, Kwiatkowski et al., 2019).
|
| 261 |
+
|
| 262 |
+
<table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>Task</td><td rowspan=1 colspan=1>Examples</td></tr><tr><td rowspan=1 colspan=1>HellaSwag</td><td rowspan=1 colspan=1>CommonsenseReasoning</td><td rowspan=1 colspan=1>A woman is outside with a bucket and a dog. The dog is runningaround trying to avoid a bath.She..A)rinses the bucket off with soap and blow dry the dog's head.B) uses a hose to keep it from geting soapy.√C) gets the dog wet, then it runs away again.D) gets into a bath tub with the dog.</td></tr><tr><td rowspan=1 colspan=1>MRPC</td><td rowspan=1 colspan=1>ParaphraseDetection</td><td rowspan=1 colspan=1>Sales rose 37 per cent year-on-year to 1.76bn, beating expectations.Sales for the quarter beat expectations, rising 37 percentyear-on-year to 1.76 billion euros.→√Paraphrase</td></tr><tr><td rowspan=1 colspan=1>SST-5</td><td rowspan=1 colspan=1>Sentiment Analysis</td><td rowspan=1 colspan=1>A warm, funny, engaging film.-PositiveSuffers from the lack of a compelling narrative.-→Negative</td></tr><tr><td rowspan=1 colspan=1>MWoZ 2.4</td><td rowspan=1 colspan=1>Dialogue StateTracking</td><td rowspan=1 colspan=1>I am looking for ALexender b&bDialogue state:alexander bed and breakfast</td></tr><tr><td rowspan=1 colspan=1>GeoQuery</td><td rowspan=1 colspan=1>Semantic Parsing</td><td rowspan=1 colspan=1>What is the area of California?SELECT state.area FROM state WHERE state.state_name='california'</td></tr><tr><td rowspan=1 colspan=1>DBpedia</td><td rowspan=1 colspan=1>Topic Classification</td><td rowspan=1 colspan=1>The keeled box turtle (Cuora mouhotii syn.Pyxidea mouhotii) is aspecies of turtle in the family Geoemydidae. It is native to Asiawhere it occurs in China India Laos Burma Vietnam Thailand andBhutan. Other common names include keel-backed terrapin and jagged-shelled turtle.Topic:animal</td></tr><tr><td rowspan=1 colspan=1>MNLI</td><td rowspan=1 colspan=1>Natural LanguageInference</td><td rowspan=1 colspan=1>The F/A-18-E/F program eliminated over 40 percent of the partsused to build predecessor aircraft to make the design more robust formanufacturing and identified critical manufacturing processes,bringing them under control before the start of production. The newdesign with robustness also increased the safety of machines.→√neutral</td></tr><tr><td rowspan=1 colspan=1>RTE</td><td rowspan=1 colspan=1>Natural LanguageInference</td><td rowspan=1 colspan=1>Judie Vivian,chief executive at ProMedica,a medical servicecompany that helps sustain the 2-year-old Vietnam Heart Institute inHo Chi Minh City (formerly Saigon), said that so far about 1,500children have received treatment. The previous name of Ho ChiMinh City was Saigon.→√entailment</td></tr><tr><td rowspan=1 colspan=1>NaturalQuestions</td><td rowspan=1 colspan=1>Open-Domain QA</td><td rowspan=1 colspan=1>when wasmusic first played on the radio→√1917</td></tr><tr><td rowspan=1 colspan=1>XSUM</td><td rowspan=1 colspan=1>Summarization</td><td rowspan=1 colspan=1>Bliss said there was a shortage of neonatal nurses and doctors, andsafety standards were not being met..... Dr Jenny Calvert, of theWales Neonatal Network,said they are working to further developmedical training in neonatology to help recruit more trainee doctors.Summary: Neonatal services across Wales are overstretched andunderpressurewith the safetyof vulnerable babiesat risk,according to a charity.</td></tr></table>
|
| 263 |
+
|
| 264 |
+
# Appendices
|
| 265 |
+
|
| 266 |
+
A DATASETS AND TASKS
|
| 267 |
+
|
| 268 |
+
# B PROMPT TEMPLATES
|
| 269 |
+
|
| 270 |
+
# B.1 HELLASWAG
|
| 271 |
+
|
| 272 |
+
# Input:
|
| 273 |
+
|
| 274 |
+
The topic is Grooming dog. Two women attempt to wash two dogs. they get in the tub with the dogs and do shampoo, soap, and then rinse the dogs. ...
|
| 275 |
+
|
| 276 |
+
The topic is Bathing dog. A couple is outside with a bucket and a dog. The dog is running around trying to avoid a bath. they
|
| 277 |
+
|
| 278 |
+
#
|
| 279 |
+
|
| 280 |
+
get the dog wet, then it runs away again.
|
| 281 |
+
|
| 282 |
+
# B.2 MRPC
|
| 283 |
+
|
| 284 |
+
# Input:
|
| 285 |
+
|
| 286 |
+
Are the following two sentences ’equivalent’ or ’not equivalent’?
|
| 287 |
+
|
| 288 |
+
This was around the time Congress was debating a resolution granting the President broad authority to wage war ..
|
| 289 |
+
|
| 290 |
+
Within four days , the House and Senate overwhelmingly endorsed a resolution granting the president authority to go to war .. answer:not equivalent
|
| 291 |
+
|
| 292 |
+
Are the following two sentences ’equivalent’ or ’not equivalent’?
|
| 293 |
+
|
| 294 |
+
Kerry last month outlined a U.N. resolution authorizing a military force under U.S. command and transferring responsibility to the United Nations for the political and humanitarian efforts ..
|
| 295 |
+
|
| 296 |
+
Kerry outlined last month a UN resolution authorizing a military force under US command and transferring responsibility for political and humanitarian efforts to the UN ..
|
| 297 |
+
|
| 298 |
+
answer:
|
| 299 |
+
|
| 300 |
+
# Output:
|
| 301 |
+
|
| 302 |
+
equivalent
|
| 303 |
+
|
| 304 |
+
# B.3 SST5
|
| 305 |
+
|
| 306 |
+
#
|
| 307 |
+
|
| 308 |
+
How do you feel about the following sentence?
|
| 309 |
+
the movie ’s blatant derivativeness is one reason it ’s so lackluster . answer:negative
|
| 310 |
+
|
| 311 |
+
How do you feel about the following sentence?
|
| 312 |
+
|
| 313 |
+
the movie ’s something-borrowed construction feels less the product of loving , well integrated homage and more like a mere excuse for the wan , thinly sketched story .
|
| 314 |
+
|
| 315 |
+
answer:
|
| 316 |
+
|
| 317 |
+
#
|
| 318 |
+
|
| 319 |
+
negative
|
| 320 |
+
|
| 321 |
+
# B.4 MULTIWOZ
|
| 322 |
+
|
| 323 |
+
# Input:
|
| 324 |
+
|
| 325 |
+
CREATE TABLE hotel(
|
| 326 |
+
name text,
|
| 327 |
+
internet text CHECK (internet IN (dontcare, yes, no))
|
| 328 |
+
)
|
| 329 |
+
/\*
|
| 330 |
+
4 example rows:
|
| 331 |
+
SELECT $\star$ FROM hotel LIMIT 4;
|
| 332 |
+
name pricerange type parking book_number_of_days book_day book_people area stars internet
|
| 333 |
+
a and b guest house moderate guest house dontcare 3 friday 5 east 4 yes ...
|
| 334 |
+
/\*
|
| 335 |
+
-- Using valid SQLite, answer the following multi-turn conversational questions for the tables provided above.
|
| 336 |
+
Example #1
|
| 337 |
+
[context] hotel-area: west, hotel-stars: 3, hotel-internet: yes
|
| 338 |
+
[system] the hobsons house is available in that area
|
| 339 |
+
Q: [user] that sounds like it will work . can i book that for 3 nights starting wednesday ?
|
| 340 |
+
SQL: SELECT $\star$ FROM hotel WHERE book_day $=$ wednesday AND book_people $\ c = ~ 1$ AND book_number_of_days $\quad = \ 3$ AND name $=$ hobsons house;
|
| 341 |
+
Example $\# 2 2$
|
| 342 |
+
[context] hotel-parking: yes, hotel-pricerange: moderate, hotel-type: guest house, hotel-stars: 4
|
| 343 |
+
[system] there are 9 in the area . i recommend the warkworth house Q: [user] can you book that 1 for 4 nights starting on wednesday ? SQL: SELECT $\star$ FROM
|
| 344 |
+
|
| 345 |
+
# Output:
|
| 346 |
+
|
| 347 |
+
hotel WHERE book_day $=$ wednesday AND book_number_of_days $\qquad = \quad 4$ AND name $=$ warkworth house;
|
| 348 |
+
|
| 349 |
+
# B.5 GEOQUERY
|
| 350 |
+
|
| 351 |
+
# Input:
|
| 352 |
+
|
| 353 |
+
CREATE TABLE "border_info" ("state_name" text, "border" text)
|
| 354 |
+
/\*
|
| 355 |
+
state_name border alabama tennessee alabama georgia alabama florida
|
| 356 |
+
\*/
|
| 357 |
+
-- Using valid SQLite, answer the following questions for the tables
|
| 358 |
+
provided above.
|
| 359 |
+
-- which state has the longest river
|
| 360 |
+
SELECT RIVERalias0.TRAVERSE FROM RIVER AS RIVERalias0 WHERE RIVERalias0.
|
| 361 |
+
LENGTH $=$ ( SELECT MAX( RIVERalias1.LENGTH ) FROM RIVER AS RIVERalias1 ) ;
|
| 362 |
+
-- what is the longest river in the state with the highest point
|
| 363 |
+
SELECT
|
| 364 |
+
|
| 365 |
+
# Output:
|
| 366 |
+
|
| 367 |
+
RIVERalias0.RIVER_NAME FROM HIGHLOW AS HIGHLOWalias0 , RIVER ASRIVERalias0 WHERE HIGHLOWalias0.HIGHEST_ELEVATION $=$ ( SELECT MAX(HIGHLOWalias1.HIGHEST_ELEVATION ) FROM HIGHLOW AS HIGHLOWalias1 ) ANDRIVERalias0.TRAVERSE $=$ HIGHLOWalias0.STATE_NAME ORDER BY RIVERalias0.LENGTH DESC LIMIT 1 ;
|
| 368 |
+
|
| 369 |
+
# B.6 DBPEDIA
|
| 370 |
+
|
| 371 |
+
# Input:
|
| 372 |
+
|
| 373 |
+
title: Cupressus funebris; content: Cupressus funebris (Chinese Weeping Cypress) is a species of cypress native to southwestern and central China. It may also occur naturally in Vietnam.
|
| 374 |
+
plant
|
| 375 |
+
|
| 376 |
+
title: Keeled box turtle; content: The keeled box turtle (Cuora mouhotii syn. Pyxidea mouhotii) is a species of turtle in the family Geoemydidae. It is native to Asia where it occurs in China India Laos Burma Vietnam Thailand and Bhutan. Other common names include keel-backed terrapin and jagged-shelled turtle.
|
| 377 |
+
|
| 378 |
+
#
|
| 379 |
+
|
| 380 |
+
animal
|
| 381 |
+
|
| 382 |
+
# B.7 MNLI
|
| 383 |
+
|
| 384 |
+
# Input:
|
| 385 |
+
|
| 386 |
+
Ideally, the design fixes for the failures should be corrected prior to manufacturing production units.. Based on that information, is the claim The fixes should be addressed before they reach the assembly line if this was a smart plan. "True", "False", or "Inconclusive"?
|
| 387 |
+
answer:Inconclusive
|
| 388 |
+
|
| 389 |
+
The F/A-18-E/F program eliminated over 40 percent of the parts used to build predecessor aircraft to make the design more robust for manufacturing and identified critical manufacturing processes, bringing them under control before the start of production.. Based on that information, is the claim The new design with robustness also increased the safety of machines. "True", "False", or "Inconclusive"? answer:
|
| 390 |
+
|
| 391 |
+
#
|
| 392 |
+
|
| 393 |
+
Inconclusive
|
| 394 |
+
|
| 395 |
+
# B.8 RTE
|
| 396 |
+
|
| 397 |
+
# Input:
|
| 398 |
+
|
| 399 |
+
After giving nearly 5,000 people a second chance at life, doctors are celebrating the 25th anniversary of Britian’s first heart transplant which was performed at Cambridgeshire’s Papworth Hospital in 1979..\par question: The first heart transplant in Britian was performed in 1979.. True or False?
|
| 400 |
+
answer:True
|
| 401 |
+
|
| 402 |
+
Judie Vivian, chief executive at ProMedica, a medical service company that helps sustain the 2-year-old Vietnam Heart Institute in Ho Chi Minh City (formerly Saigon), said that so far about 1,500 children have received treatment..
|
| 403 |
+
|
| 404 |
+
question: The previous name of Ho Chi Minh City was Saigon.. True or
|
| 405 |
+
|
| 406 |
+
False? answer:
|
| 407 |
+
|
| 408 |
+
#
|
| 409 |
+
|
| 410 |
+
True
|
| 411 |
+
|
| 412 |
+
# B.9 NATURAL QUESTION
|
| 413 |
+
|
| 414 |
+
# Input:
|
| 415 |
+
|
| 416 |
+
Write an answer: who invented the radio during the industrial revolution
|
| 417 |
+
other
|
| 418 |
+
Guglielmo Marconi, 1st Marquis of Marconi
|
| 419 |
+
Write an answer: when was music first played on the radio
|
| 420 |
+
|
| 421 |
+
#
|
| 422 |
+
|
| 423 |
+
other 1917
|
| 424 |
+
|
| 425 |
+
# B.10 XSUM
|
| 426 |
+
|
| 427 |
+
# Input:
|
| 428 |
+
|
| 429 |
+
Write a short summary
|
| 430 |
+
Health Minister Mark Drakeford said the money would be used to improve areas of concern, including out-of-hours help and access to psychological treatment.
|
| 431 |
+
|
| 432 |
+
money won’t get the help they need in a timely fashion," she said. TL;DR: An extra [Unicode token]7.6m a year will be invested to improve mental health services for children and young people in Wales.
|
| 433 |
+
|
| 434 |
+
Bliss said there was a shortage of neonatal nurses and doctors, and safety standards were not being met.
|
| 435 |
+
|
| 436 |
+
Dr Jenny Calvert, of the Wales Neonatal Network, said they are working to further develop medical training in neonatology to help recruit more trainee doctors.
|
| 437 |
+
TL;DR:
|
| 438 |
+
|
| 439 |
+
#
|
| 440 |
+
|
| 441 |
+
Neonatal services across Wales are overstretched and under pressure with the safety of vulnerable babies at risk, according to a charity.
|
| 442 |
+
|
| 443 |
+
# C DETAILED MAIN RESULTS
|
| 444 |
+
|
| 445 |
+
This section provides a detailed version of our main results in Table 2, where the maximum performance and minimum performances among the three trials are reported. Results are shown in Table 7 and Table 8.
|
| 446 |
+
|
| 447 |
+
Table 7: Main result Table 2 with the mean/max/min results reported across three trials
|
| 448 |
+
|
| 449 |
+
<table><tr><td colspan="2">Method</td><td colspan="5">Classification</td></tr><tr><td>|L|</td><td>Selection</td><td>MRPC</td><td>SST-5</td><td>MNLI</td><td>DBpedia</td><td>RTE</td></tr><tr><td>100</td><td>Random</td><td>63.5/66.0/60.5 44.2/47.3/41.8</td><td></td><td>37.4/41.0/33.28</td><td>89.8/91.0/88.3 51.5/53.9/48.4</td><td></td></tr><tr><td>100</td><td>Vote-k</td><td>70.7/72.3/69.1</td><td>53.0/54.7/51.2</td><td>47.3/50.0/44.5</td><td>93.4/94.1/92.6</td><td>55.5/57.0/53.9</td></tr><tr><td>18</td><td>Random</td><td>59.6/64.8/52.7</td><td>39.8/46.1/37.13</td><td>36.7/40.6/30.9</td><td>77.6/82.0/71.9</td><td>50.4/53.5/45.7</td></tr><tr><td>18</td><td>Vote-k</td><td>64.2/67.6/59.0</td><td>47.6/50.0/44.5</td><td>41.0/44.5/37.1</td><td>87.1/90.6/85.2</td><td>54.3/56.2/51.6</td></tr></table>
|
| 450 |
+
|
| 451 |
+
Table 8: Main result Table 2 with the mean/max/min results reported across three trials.
|
| 452 |
+
|
| 453 |
+
<table><tr><td colspan="2">Method</td><td>Multi-Choice</td><td>Dialogue</td><td colspan="3">Generation</td></tr><tr><td>|C|</td><td>Selection</td><td>HSwag</td><td>MWoZ</td><td>GeoQ</td><td>NQ</td><td>XSum</td></tr><tr><td>100</td><td>Random</td><td>65.2/66.4/63.3</td><td>47.2/49.2/44.5</td><td></td><td></td><td>78.6/80.5/77.3 30.8/32.8/28.1 15.3/16.4/14.8</td></tr><tr><td>100</td><td>Vote-k</td><td>70.7/71.5/69.5</td><td>51.4/53.1/49.6</td><td></td><td></td><td>82.8/83.6/82.0 33.6/35.2/31.6 17.2/17.6/16.4</td></tr><tr><td>18</td><td>Random</td><td>62.5/66.4/57.4</td><td>33.6/39.5/25.0</td><td></td><td></td><td>62.4/65.2/57.8 29.8/31.6/26.6 13.6/14.5/12.5</td></tr><tr><td>18</td><td>Vote-k</td><td>67.4/71.1/64.8</td><td>42.8/47.7/40.2</td><td>72.5/74.2/69.5 32.3/33.6/30.1 15.2/16.0/14.5</td><td></td><td></td></tr></table>
|
| 454 |
+
|
| 455 |
+
# D EVALUATE HELLASWAG ON OPT-175B MODEL
|
| 456 |
+
|
| 457 |
+
Here we show that vote- $k$ also improves model performance for OPT-175B
|
| 458 |
+
|
| 459 |
+

|
| 460 |
+
Figure 4: OPT-175B performance of ICL-random and ICL-vote- $k$ on HellaSwag
|
| 461 |
+
|
| 462 |
+
# E REMOVING OUTLIERS FOR FINETUNING
|
| 463 |
+
|
| 464 |
+
Here we show that explicitly removing outliers also helps finetuning to benefit from vote- $k$ .
|
| 465 |
+
|
| 466 |
+
# F DIVERSITY AND REPRESENTATIVENESS OF SELECTED SAMPLES
|
| 467 |
+
|
| 468 |
+
We hypothesized that both representativeness and diversity are crucial for selective annotation $( \ S 2 . 1 )$ . Here we evaluate the diversity and representativeness of samples that are selected by different methods,
|
| 469 |
+
|
| 470 |
+
<table><tr><td></td><td colspan="2"></td><td colspan="2">Outliers not removed 10% outliers removed</td></tr><tr><td></td><td>FT-random FT-vote-k FT-random FT-vote-k</td><td></td><td></td><td></td></tr><tr><td>HellaSwag</td><td>55.6</td><td>53.5</td><td>56.8</td><td>59.6</td></tr><tr><td>MRPC</td><td>56.3</td><td>55.6</td><td>57.9</td><td>60.4</td></tr></table>
|
| 471 |
+
|
| 472 |
+
Table 9: Effects of vote- $k$ in finetuning(FT) with annotation budget of 100. $10 \%$ outliers removed means that we removed $10 \%$ of examples farthest to the training data, measured by average cosine similarity. The selection is conducted after example removal. After removing outliers, vote- $k$ selection improves the model few-shot performance.
|
| 473 |
+
|
| 474 |
+
using the methods from prior work on active learning (Margatina et al., 2021); their measures of diversity and representativeness use token overlap or embedding cosine similarities. As shown in Table 10, K-means improves both the diversity and the representativeness, as compared to random selection, while vote- $k$ further improves it.
|
| 475 |
+
|
| 476 |
+
<table><tr><td>Method</td><td colspan="3">DIV-I</td><td colspan="3">DIV-F</td><td colspan="3">REPR.</td></tr><tr><td>Selection</td><td>HellaSwag</td><td>SST-5</td><td>MWoZ</td><td>HellaSwag</td><td>SST-5</td><td>MWoZ</td><td>HellaSwag</td><td>SST-5</td><td>MWoZ</td></tr><tr><td>Random</td><td>0.1820.007</td><td>0.0990.003</td><td>0.3680.008</td><td>0.4150.008</td><td>0.3170.004</td><td>0.6750.006</td><td>0.5580.007</td><td>0.4240.003</td><td>0.6960.004</td></tr><tr><td>K-means</td><td>0.1840.006</td><td>0.1020.002 0.3720.003</td><td></td><td>0.4170.006</td><td>0.3170.002</td><td>:0.6760.004</td><td>0.5590.005</td><td>0.4230.002</td><td>:0.6980.003</td></tr><tr><td>Vote-k</td><td>0.191</td><td>0.108</td><td>0.379</td><td>0.425</td><td>0.321</td><td>0.683</td><td>0.565</td><td>0.426</td><td>0.702</td></tr></table>
|
| 477 |
+
|
| 478 |
+
Table 10: DIV-I refers to diversity in input space, which measures the diversity of selected data in the input feature space, i.e., raw text; DIV-F refers to diversity in feature space, which measures the diversity in the dense feature space, i.e., sentence embeddings; REPR. refers to representativeness, which measures the representativeness of selected data. Subscripts stand for standard deviation.
|
| 479 |
+
|
| 480 |
+
# G DETAILS OF SELECTIVE ANNOTATION METHODS
|
| 481 |
+
|
| 482 |
+
In this section, we provide details of selective annotation methods used in Section 4.5.
|
| 483 |
+
|
| 484 |
+
G.1 VOTE- $k$ SELECTIVE ANNOTATION
|
| 485 |
+
|
| 486 |
+
Algorithm 1 describes the vote- $k$ selective annotation method introduced in Section 2.1.
|
| 487 |
+
|
| 488 |
+
# G.2 GREEDY ALGORITHM FOR MAXIMIZING FACILITY LOCATION
|
| 489 |
+
|
| 490 |
+
Lin & Bilmes (2009) proposed to maximize the facility location objective to optimize representativeness of the selected samples. Since this objective satisfies the submodular property, they applied a greedy algorithm as an approximation. Algorithm 2 describes the selective annotation method adapted from this greedy algorithm.
|
| 491 |
+
|
| 492 |
+
# G.3 EMBEDDING DIVERSITY
|
| 493 |
+
|
| 494 |
+
This method aims to find diverse samples to annotate using embedding vectors. We first compute a vector representation for each unlabeled training instance by Sentence-BERT (Reimers & Gurevych, 2019), which is a variant of BERT (Devlin et al., 2019), finetuned to detect paraphrases.6 For instance, consider an example from SST-5 sentiment analysis in Table 6:A very well-made, funny and entertaining picture. We simply run Sentence-BERT on this text input and average the resulting vectors over the words to obtain a vector representation.
|
| 495 |
+
|
| 496 |
+
Once embeddings are computed for all training data, we use them to find a diverse set of training instances. The intuition here is that a diverse set of annotated examples facilitates the subsequent prompt retrieval step since similar in-context examples can be found for many test instances. To find
|
| 497 |
+
|
| 498 |
+
# Algorithm 1 Voke-k Selective Annotation
|
| 499 |
+
|
| 500 |
+
1: Input: $\mathcal { X } = \{ x _ { i } \} _ { i = 1 } ^ { N }$ : a set of unlabeled samples; $M$ : the number of samples to be selected; LM: inference
|
| 501 |
+
language model.
|
| 502 |
+
2: Initialization: $\mathcal { L } = \emptyset$ , $\mathcal { U } = \mathcal { X }$ . $G = ( V , E )$ , where $V = \mathcal { X }$ and $( u , v ) \in E$ if $v$ is one of $u$ ’s $k$ neares
|
| 503 |
+
vertices in terms of the cosine similarity between the embeddings.
|
| 504 |
+
3: while $| { \mathcal { L } } | < M / 1 0$ do
|
| 505 |
+
4: $\begin{array} { r l } & { u ^ { * } = \arg \operatorname* { m a x } _ { u \in \mathcal { U } } \sum _ { v \in \{ v | ( v , u ) \in E , v \in \mathcal { U } \} } s ( v ) , \quad \mathrm { w h e r e ~ } s ( v ) = \rho ^ { - | \{ \ell \in \mathcal { L } | ( v , \ell ) \in E \} | } , \quad \rho > 1 } \\ & { \mathcal { L } = \mathcal { L } \cup \{ u ^ { * } \} } \\ & { \mathcal { U } = \mathcal { U } \setminus \{ u ^ { * } \} } \end{array}$
|
| 506 |
+
5:
|
| 507 |
+
6:
|
| 508 |
+
7: end while
|
| 509 |
+
8: for $u$ in $\mathcal { U }$ do $\triangleright$ Compute the confidence score of each instance.
|
| 510 |
+
9: $\begin{array} { r } { \mathrm { s c o r e } ( u ) = \frac { 1 } { \mathbf { q } } \sum _ { t } \mathrm { l o g } \hat { p ( } q _ { t } | \mathbf { q } _ { < t } , \mathbf { z } ; \boldsymbol { \Theta } ) } \end{array}$ , where $p$ is LM prediction function and $\Theta$ is LM parameters
|
| 511 |
+
10: end for
|
| 512 |
+
11: for $j = 1 , \dots , 9 / 1 0 M$ do
|
| 513 |
+
12: $\mathcal { U } _ { j } = \mathrm { i n d i c e s } [ ( j - 1 ) | \mathcal { U } | / M : j | \mathcal { U } | / M ]$ ▷ Divide the examples by confidence score.
|
| 514 |
+
13: $\begin{array} { r } { u ^ { * } = \arg \operatorname* { m a x } _ { u \in \mathcal { U } _ { j } } \sum _ { v \in \{ v | ( v , u ) \in E , v \in \mathcal { U } _ { j } \} } s ( v ) } \end{array}$ , where $s ( v ) \stackrel { \textstyle \cdot } { = } \rho ^ { - | \{ \ell \in \mathcal { L } | ( v , \ell ) \in E \} | } , \quad \rho > 1$
|
| 515 |
+
14: $\mathcal { L } = \mathcal { L } \cup \{ u ^ { * } \}$
|
| 516 |
+
15: end for
|
| 517 |
+
16: Return: $\mathcal { L }$ : selected samples.
|
| 518 |
+
|
| 519 |
+
# Algorithm 2 Greedy Algorithm for Facility Location Objective
|
| 520 |
+
|
| 521 |
+
1: Input: $\mathcal { U } = \{ x _ { i } \} _ { i = 1 } ^ { N }$ : a set of unlabeled samples; $M$ : the number of samples to be selected.
|
| 522 |
+
2: Initialization: $\mathcal { L } = \emptyset , \mathcal { U } = V . \forall i , \rho _ { i } = - 1$ : maximum similarity of $x _ { i }$ to selected samples.
|
| 523 |
+
3: while $| { \mathcal { L } } | < M$ do
|
| 524 |
+
4: $\begin{array} { r } { u ^ { * } = \arg \operatorname* { m a x } _ { u \in \mathcal { U } } \sum _ { i = 1 } ^ { N } \left( \operatorname* { m a x } \left\{ 0 , \cos ( x _ { i } , x _ { u } ) - \rho _ { i } \right\} \right) } \end{array}$
|
| 525 |
+
5: $\mathcal { L } = \mathcal { L } \cup \{ u ^ { * } \}$
|
| 526 |
+
6: $\mathcal { U } = \mathcal { U } \setminus \{ u ^ { * } \}$
|
| 527 |
+
7: ∀i, $\rho _ { i } = \operatorname* { m a x } \left\{ \rho _ { i } , \cos ( x _ { i } , x _ { u ^ { * } } ) \right\}$ // update maximum similarity of each $x _ { i }$ to selected samples
|
| 528 |
+
8: end while
|
| 529 |
+
9: Return: $\mathcal { L }$ : selected samples.
|
| 530 |
+
|
| 531 |
+
a set of diverse embeddings, we take a simple, iterative approach: in every iteration, we choose an instance furthest from the already chosen ones. Specifically, let $\mathcal { L }$ and $\mathcal { U }$ denote the sets of already chosen (i.e., labeled) samples and unlabeled samples, respectively. Suppose also that $M$ is the target number of labeled examples (i.e., the annotation budget). Then, in every iteration, we choose the unlabeled sample that has the largest total cosine distance from $\mathcal { L }$ : arg $\begin{array} { r } { \operatorname* { m i n } _ { u \in \mathcal { U } } \sum _ { \ell \in \mathcal { L } } c o s ( u , \ell ) } \end{array}$ . Here we abuse $u$ and $\ell$ to mean both the instances and their embedding vectors from Sentence-BERT. The first labeled sample is randomly selected from the 3K unlabeled examples $( \ S 3 . 1 )$ , and the iterative process continues until $| { \mathcal { L } } | = M$ .
|
| 532 |
+
|
| 533 |
+
# H LABEL DISTRIBUTION IN SELECTIVE ANNOTATION
|
| 534 |
+
|
| 535 |
+
We calculate the ratio between the numbers of the most frequent class and the least frequent class in the selected 100 instances. For example, 53.3 in the Ori. (original dataset) column indicates that the original dataset contains 53.3 times more examples with the most frequent label than those with the least frequent label. As shown in Table 11, with random selection, the ratio is similar to the original dataset. With selective annotation, the imbalance problem is significantly alleviated.
|
| 536 |
+
|
| 537 |
+
# I T-SNE VISUALIZATION OF SELECTIVE ANNOTATION
|
| 538 |
+
|
| 539 |
+
We compare examples from selective annotation and full training data using the t-SNE visualization van der Maaten & Hinton (2008). As shown in Figure 5, vote- $k$ selects diverse (better coverage) and representative (excluding outliers) instances from the task space across datasets.
|
| 540 |
+
|
| 541 |
+
<table><tr><td></td><td>Ori. Random MFL K-means Diversity 1</td><td></td><td></td><td></td><td></td><td>Least-conf Conf-only Fast vote-k Vote-k</td><td></td><td></td><td></td></tr><tr><td>Amazon</td><td>53.3</td><td>59.0</td><td>55.0</td><td>52.0</td><td>20.5</td><td>48.0</td><td>26.5</td><td>14.0</td><td>11.0</td></tr><tr><td>CivilComments</td><td>7.8</td><td>11.5</td><td>9.0</td><td>7.3</td><td>5.7</td><td>15.7</td><td>6.7</td><td>5.3</td><td>4.6</td></tr></table>
|
| 542 |
+
|
| 543 |
+
Table 11: The ratio between the number of examples with the most frequent class and those with the least frequent class, when different selective annotation methods are applied to choose 100 instances. Ori. denotes the ratio in the original dataset. vote- $k$ significantly reduces the ratio and alleviates the label imbalance problem.
|
| 544 |
+
|
| 545 |
+

|
| 546 |
+
Figure 5: t-SNE visualization of the 100 randomly/vote- $k$ selected examples in the dataset space. vote- $k$ selects more diverse and representative examples, compared to random selection.
|
| 547 |
+
|
| 548 |
+
# J SIMILARITY BETWEEN CONTEXT EXAMPLES AND INPUT
|
| 549 |
+
|
| 550 |
+
We calculate the average cosine similarity between the context examples and the input text in three representative datasets, HellaSwag, SST-5 and MWoZ. As shown in the Table 12, without similaritybased retrieval in the second step, the context examples and input text are not very similar when the first step is vote- $k$ selection. We suspect the reason is that vote- $k$ selects diverse instances and random retrieval includes irrelevant examples in the prompt. This explains the poor performance of vote- $k$ with random retrieval in Table 4.
|
| 551 |
+
|
| 552 |
+
# K SELECTED EXAMPLES
|
| 553 |
+
|
| 554 |
+
In Table 1314, we provide a few examples from random selection and vote- $k$ selection, when the annotation size is 18.
|
| 555 |
+
|
| 556 |
+
Table 12: Average cosine similarity scores between the context examples and evaluation input. With similarity retrieval in the second step, vote- $k$ selection always helps to find more similar examples in the prompt.
|
| 557 |
+
|
| 558 |
+
<table><tr><td colspan="3">Method</td><td colspan="3">Dataset</td></tr><tr><td>C</td><td>Selection</td><td>Retrieval</td><td>HellaSwag</td><td>SST-5</td><td>MWoZ</td></tr><tr><td>100</td><td>Vote-k</td><td>Similar</td><td>0.3393</td><td>0.1747</td><td>0.4881</td></tr><tr><td>100</td><td>Random</td><td>Similar</td><td>0.3134</td><td>0.1535</td><td>0.2212</td></tr><tr><td>100</td><td>Vote-k</td><td>Random</td><td>0.0057</td><td>0.0570</td><td>0.0006</td></tr><tr><td>100</td><td>Random</td><td>Random</td><td>0.0180</td><td>0.0065</td><td>0.0016</td></tr></table>
|
| 559 |
+
|
| 560 |
+
Table 13: Demo examples in SST-5 from random selection and vote- $k$ selection. In general, vote- $k$ selects more diverse and representative instances, with a more balanced label distribution.
|
| 561 |
+
|
| 562 |
+
<table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>Randomly selected examples</td><td rowspan=1 colspan=1>Vote-k selected examples</td></tr><tr><td rowspan=1 colspan=1>SST-5</td><td rowspan=1 colspan=1>simple ,poignant and leavened with humor,it 's a film that affirms the nourishingaspects of love and companionship.→Positivethisisanicelyhandledaffair,afilmabouthuman darkness but etched with a light -lrb-yet unsentimental -rrb- touch .-Positivewhatis the filmmakers’point ?-→Neutralwhat really happened ?->Neutralan admirable,sometimes exceptionalfilm.-→Very Positive</td><td rowspan=1 colspan=1>take away the controversy,and it 's notmuch more watchable than a mexican soapopera.-Very Negativeany rock pile will do for a set .-→Negativea visual spectacle full of stunning imagesand effects .-Very Positivethe most consistently funny of the austinpowers films.-→Positiveoccasionally funny,sometimes inspiring,often boring .-→Neutral</td></tr></table>
|
| 563 |
+
|
| 564 |
+
Table 14: Demo examples in HellaSwag from random and vote- $k$ selection. In general, vote- $k$ selects more diverse and representative instances
|
| 565 |
+
|
| 566 |
+
<table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>Randomly selected examples</td><td rowspan=1 colspan=1>Vote-k selected examples</td></tr><tr><td rowspan=1 colspan=1>HellaSwag</td><td rowspan=1 colspan=1>A man is completing a rubiks cube. atimer..A) begins showing the amount of time itwill take it to complete the disk.B)is counting down on the side of thecube.√C) is sitting on the table next to him.D) goes hand at the end of the boardwhile the man continues to solve and figureout the cubes.A man is completing a rubiks cube.A timeris sitting on the table next to him. he...A) takes the cube and couches it for 10seconds.B) finishes the rubiks cube and sets itaside.C) starts hurting himself trying to solvethe rubiks cube.√D) sets the completed rubiks cube downon the table.A client tap with the finger inside a square.Then, the person stacks all the cards and puts the tokens inside the squares. thenpeople..√A) start to gamble,while the womandistribute the cards and pick up tokens.B) play hole dig while other peoplewatches.C) pass a disk on the tile tile.D) five card get tokens inside the square.After, the client shows with the hand, thenthe person make gestures with the handshowing the table.next the woman...√A) pick up the cards.B) change the angle of the arm and showsher knee cucumbers.C) puts brushes on sides of the table andopen the places one by one with the handgiving a thumbs up and different gestures tothe client.D) place the blindfold on the table, thenshe lay on her back.He takes a scour and begins to scour thewall paper. He uses a paint roller to soak thewall paper for easy removal. he..A) points to several things on the wall andsprays the wall paper.B) takes scissors and measures the wallpaper closely.√C) then demonstrates how steam can beused too to loosen the wall paper.D) wipes the wall paper down against thewall.</td><td rowspan=1 colspan=1>Mj's mommy is playing around with herhair smoothing it out. She goes to thebathroom with clips in her hair and gets outtreatments and shampoos.she..A) laughs until she is full of tears.B) puts a little blow dryer on her hair andturns it on over and over.√C) begins to apply the hair things to herhair and combing it out, she starts to parther hair and put in curlers.D) gets in the bathroom dynain her hairwith an iron in her shirt.The batter is fighing with the man and other people trye to calm him down. a lo ofpeople wearing black unifroms...√A)are running in the field fighting.B)are all sitting on the floor.C) are playing cornstarch ball againsteach other on the field.D)are cools the batter.A group of athletes row on canoes during arace in between buoys on a waterway. themen...A)pass over a wooden structure in theriver.B)paddle while crashing through endlesswaves in the river.√C) cross the final numbered buoys andglide while slowing down after the race.D) go over large cliffs into a lagoon.A pair of handlebars are detached from thebike and is laying down flat on a table. theman...A)unstraps the handlebars and puts themback up and begins to pedal of his bike.B) rolls them up and ties the handles witha pulley.C) then shows with his knife and begins toa process of cutting them in half and puttingthem back to the bike.√D) then picks up the handlebars and sticksthem back into the bike tightening themwith a key.A man is completing a rubiks cube.atimer..A) begins showing the amount of time itwill take it to complete the disk.B) is counting down on the side of thecube.√C) is sitting on the table next to him.D) goes hand at the end of the boardwhile the man continues to solve and figureout the cubes.</td></tr></table>
|
md/dev/rB6TpjAuSRy/rB6TpjAuSRy.md
ADDED
|
@@ -0,0 +1,454 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# COGVIDEO: LARGE-SCALE PRETRAINING FOR TEXTTO-VIDEO GENERATION VIA TRANSFORMERS
|
| 2 |
+
|
| 3 |
+
Wenyi $\mathbf { H o n g ^ { \dagger * } \mathbf { M i n g \mathbf { D i n g ^ { \dagger * } } } }$ Wendi Zheng† Xinghan Liu† Jie Tang†‡
|
| 4 |
+
|
| 5 |
+
†Tsinghua University $^ \ddag$ BAAI {hwy22@mails, dm18@mails, jietang@}.tsinghua.edu.cn
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Large-scale pretrained transformers have reached a milestone in text (GPT-3) and text-to-image (DALL-E and CogView) generation. However, its application to video generation still has several challenges: unaffordable huge computation cost and scarcity and weak relevance of the text-video datasets. In this work, we present CogVideo, a 9B-parameter transformer for text-to-video generation. The CogVideo model has been trained by inheriting a pretrained text-to-image model, CogView2, which significantly reduces the training cost and alleviates the problem of scarcity and weak relevance. We also propose a multi-frame-rate training strategy for better aligning text and video clips. CogVideo achieves state-of-the-art performance in machine evaluation and outperforms publicly available models by a large margin in human evaluation. Its codes and model are also publicly available at https://github.com/THUDM/CogVideo.
|
| 10 |
+
|
| 11 |
+

|
| 12 |
+
Figure 1: Samples generated by CogVideo. The actual text inputs are in Chinese. Each sample is a 4-second clip of 32 frames, and here we sample 8 frames uniformly for display purposes.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
Autoregressive transformers, e.g. DALL-E (Ramesh et al., 2021) and CogView (Ding et al., 2021), have revolutionized text-to-image generation. A few other works have also followed the framework to develop text-to-video transformers (Wu et al., 2021b; Ge et al., 2022), e.g. VideoGPT (Yan et al., 2021), and demonstrated its superiority over GAN-based methods (Clark et al., 2019; Tulyakov et al.,
|
| 17 |
+
|
| 18 |
+
2018). However, the performances are still far from satisfactory. Diffusion probabilistic models, e.g. Imagen (Saharia et al., 2022) and DALLE-2 (Ramesh et al., 2022), represent another line of research for text-to-image generation and video generation Ho et al. (2022). However, how to better incorporate the temporal information for text-to-video generation is still a challenge.
|
| 19 |
+
|
| 20 |
+
In this paper, we focus on designing an autoregressive model for text-to-video generation. The critical challenge in previous work is that the generated video frames tend to gradually deviate from the text prompt. This makes vanilla autoregressive models only good at synthesizing videos with regular (e.g. forward moving cars) or random patterns (e.g. speaking by random moving lips), but fail at text prompt such as “a lion is drinking water”. The main reason is that in the former case the first frame already provides sufficient information for the subsequent changes, while in the latter the model has to precisely understand the action “drink” in order to correctly generate the desired action — the lion lifts the glass to its lip, drinks and then puts down the glass.
|
| 21 |
+
|
| 22 |
+
Why could the autoregressive transformers well understand the text-image alignment, but struggle for the text-action alignment in videos? One fact is that the duration of videos varies a lot. Previous models split the video into many clips with a fixed number of frames for training (Wu et al., 2021b; Ge et al., 2022). Such treatment destroys the alignment between the text and its temporal counterparts in the video. If a “drinking” video is split into four individual clips of “holding a glass”, “lifting”, “drinking” and “putting down” with the same text “drinking”, the model will be confused to learn the precise meaning of drinking.
|
| 23 |
+
|
| 24 |
+
The other challenge is that the perfect aligned text-video data is scarce, compared to the easy-tocollect billions of text-image pairs (Ramesh et al., 2021). VATEX is probably the largest annotated text-video dataset (Wang et al., 2019). However, it has only 41,250 videos. The retrieval-based text-video pairs, e.g. Howto100M (Miech et al., 2019), are weakly relevant and most captions only describe the scene without temporal information.
|
| 25 |
+
|
| 26 |
+
Present Work. Here we present a large-scale pretrained text-to-video generative model, CogVideo, which is of 9.4 billion parameters and trained on 5.4 million text-video pairs. To reduce the computational cost, CogVideo has been developed to inherit the knowledge learned from a text-image pretraining model CogView2 (Ding et al., 2022). To ensure the alignment between text and its temporal counterparts in the video, we propose the multi-frame-rate training. The flexibility of the textual condition makes it possible to simply prepend a piece of text describing the frame rate to the original text prompt for modeling different frame rates. To keep the text-video alignment, we choose a proper frame rate description to include the complete action in each training sample. The frame rate token also controls the intensity of the changes throughout continuous frames in generation. We train a sequential generation model and a frame interpolation model. The former model generates key frames according to the text, and the latter recursively fills the middle frames by varying the frame rates to make the video coherent. As shown in Figure 1, CogVideo can generate high-resolution $( 4 8 0 \times 4 8 0 )$ videos. The human evaluation demonstrates that CogVideo outperforms most publicly available models by a large margin. Our main contributions include:
|
| 27 |
+
|
| 28 |
+
• We present CogVideo, which is the largest and open-source pretrained transformer for general text-to-video generation. CogVideo demonstrates state-of-the-art FVD on the UCF101 benchmark.
|
| 29 |
+
• We propose the multi-frame-rate training to better align text-clip pairs, which significantly improves the generation accuracy, in particular for movements of complex semantics. This training strategy offers CogVideo the capacity of controlling the intensity of changes during the generation.
|
| 30 |
+
We design dual-channel attention to elegantly and efficiently finetune a pretrained text-toimage generative model for text-to-video generation, avoiding the expensive full parameter pretraining from scratch.
|
| 31 |
+
|
| 32 |
+
# 2 RELATED WORK
|
| 33 |
+
|
| 34 |
+
# 2.1 VIDEO GENERATION
|
| 35 |
+
|
| 36 |
+
Video generation is a long-standing research topic. Most previous works focus on the next-frame prediction task — forecasting the future frames based on the first video frame. Early works, e.g.
|
| 37 |
+
|
| 38 |
+
CDNA (Finn et al., 2016) and PredRNN (Wang et al., 2017), leverage deterministic methods to directly predict the next frame via CNNs or RNNs. However, these deterministic models are unable to capture the stochastic temporal patterns and synthesize coherent complex scenes. Recently, generative models, especially Generative Adversarial Networks (Goodfellow et al., 2014) (GANs), begin to dominate the area as they can perform unconditional or class-conditional video synthesis without the first frames. VGAN (Vondrick et al., 2016) is the first one to use GAN for video generation. It decomposes video to a static background and a moving foreground, and then generates them with 2D and 3D convolutional networks respectively. TGAN(Saito et al., 2017) proposes to separately generate the temporal latent variables and spatial information, and MoCoGAN (Tulyakov et al., 2018) similarly decomposes the latent space into context and motion subspaces. DIGAN (Yu et al., 2022) applies implicit neural representations for video encoding. Recently, text-to-video generation emerges as a promising direction. The framework of VQVAE (van den Oord et al., 2017) and autoregressive transformers (Vaswani et al., 2017; Brown et al., 2020) quickly become the mainstream methods (Wu et al., 2021a;b; Ge et al., 2022). Ho et al. (2022) proposes a video diffusion model along with a gradient method recently for text-to-video generation. The previous methods are basically trained on a specific dataset, e.g. UCF-101 (Soomro et al., 2012), making the trained model domain-specific. Moreover, most of these models are not publicly available.
|
| 39 |
+
|
| 40 |
+
# 2.2 AUTOREGRESSIVE TRANSFORMER
|
| 41 |
+
|
| 42 |
+
Recent years have witnessed the autoregressive transformer emerging as a powerful generative model. The autoregressive models become the most prevalent framework for text generation (Sutskever et al., 2011). With its prominent capacity of fitting, transformer (Vaswani et al., 2017) gradually becomes a standard neural structure for text generation. Examples are GPT-3 (Brown et al., 2020) and GLM-130B (Zeng et al., 2023). In computer vision, van den Oord et al. (2017) first proposes to train a VQVAE to compress the image into a sequence of tokens from a learned dictionary, which can be then efficiently handled by the autoregressive model. VQ-GAN (Esser et al., 2020) learns a more semantic-aware dictionary for unconditional image generation. In the text-to-image generation, pretrained autoregressive transformers such as DALL-E (Ramesh et al., 2021) and CogView (Ding et al., 2021) have shown superiority in open-domain image generation. Besides the pure GPT-style generation, CogView2 (Ding et al., 2022) proposes a new language model CogLM for infilling in the image generation. Recent autoregressive transformers (Rakhimov et al., 2020; Yan et al., 2021; Wu et al., 2021a;b) have also shown their superiority in video generation. Among them, GODIVA (Wu et al., 2021a) and NÜWA (Wu et al., 2021b) focus on the open-domain text-to-video generation. However, they simply generate frames or frame blocks one by one in chronological order, and suffer from poor text-video alignment (Cf. $\ S \ O 1$ ).
|
| 43 |
+
|
| 44 |
+
Diffusion probabilistic models, e.g. Imagen (Saharia et al., 2022) and DALLE-2 (Ramesh et al., 2022), recently showed very promising results in text-to-image generation. However, in this paper we mainly focus on autoregressive models due to the sequential nature of temporal information.
|
| 45 |
+
|
| 46 |
+
# 3 METHOD
|
| 47 |
+
|
| 48 |
+
We first introduce multi-frame-rate training to better align text and video semantics $( \ S \ 3 . 1 )$ . To overcome the data scarcity and accelerate pretraining, we propose efficient dual-channel attention for video generation by inheriting knowledge from a pretrained text-image model $( \ S 3 . 2 )$ .
|
| 49 |
+
|
| 50 |
+
# 3.1 MULTI-FRAME-RATE TRAINING
|
| 51 |
+
|
| 52 |
+
Before the training, we first tokenize each frame into image tokens, a similar strategy also used in the framework of VQVAE (van den Oord et al., 2017).
|
| 53 |
+
|
| 54 |
+
Training. The key design here is that we add a variable frame-rate token to the text and sample frames at this frame rate to compose a fixed-length training sequence. The motivations are two folds:
|
| 55 |
+
|
| 56 |
+
1. Directly separating the long video into clips at a fixed frame rate often leads to semantic mismatching between clips and captions. The truncated clip might only contain incomplete actions, which do not correspond to the full text.
|
| 57 |
+
|
| 58 |
+

|
| 59 |
+
Figure 2: Multi-frame-rate generation framework in CogVideo. Input sequence includes frame rate, text, and frame tokens. [B] (Begin-of-image) is a separator token, inherited from CogView2. In stage 1, $T _ { s }$ frames are generated sequentially on the condition of frame rate and text. Then in stage 2, generated frames are re-input as bidirectional attention regions to recursively interpolate frames. The frame rate can be adjusted during both stages. Bidirectional attention regions are highlighted in blue , and unidirectional regions are highlighted in green .
|
| 60 |
+
|
| 61 |
+
2. The adjacent frames are usually very similar. A sudden change from the previous frame may incur a large loss. This will lead the models less inclined to explore the long-range correlation because simply copying the previous frame acts like a shortcut.
|
| 62 |
+
|
| 63 |
+
Therefore, for each training sample, we align the text and the frames by sampling videos at variable frame rates, so that videos of any length are evenly down-sampled to $T _ { s }$ frames. In practice, we set up a series of predefined frame rates, and select the lowest frame rate for each text-video pair at which we can sample at least $T _ { s }$ frames. For each video, the frame rate information is described in the form of text and prepended to the original text.
|
| 64 |
+
|
| 65 |
+
Although the above method improves the alignment of text and video, a side effect is that the generated video at a low frame rate could be incoherent due to the large changes between frames. We thus train another frame interpolation model to insert transition frames to the generated samples of the sequential generation model. Frame interpolation relies heavily on bidirectional information. However, previous transformers (Wu et al., 2021a; Yan et al., 2021; Wu et al., 2021b) are mostly unidirectional. To be aware of the bidirectional context, we adopt Cross-Modal General Language Model (CogLM) Ding et al. (2022) which unites bidirectional context-aware mask prediction and autoregressive generation by dividing tokens into unidirectional and bidirectional attention regions. A token in a unidirectional region can attend to the tokens in all bidirectional regions and previous unidirectional regions, while a token in bidirectional regions can only attend to the tokens in all bidirectional regions. As shown in Figure 2, (1) all frames in stage 1 and the 2nd, 4th frames in stage 2 are in the unidirectional region; (2) {Frame Rate}, {Text} and all other frames belong to the bidirectional region.
|
| 66 |
+
|
| 67 |
+
In this way, bidirectional attention context in text and given frames is fully exploited without interfering with auto-regressive frame prediction. The models of the two stages can also share the same structure and the training process only with different attention masks.
|
| 68 |
+
|
| 69 |
+
Generation. The multi-frame-rate generation is a hierarchical and recursive process, illustrated in Figure 2. Specifically, the generation pipeline consists of a sequential generation stage and a recursive interpolation stage:
|
| 70 |
+
|
| 71 |
+
1. Sequentially generates $T _ { s }$ key frames based on a low frame rate and text. The input sequence is [{Frame Rate} $\{ \mathtt { T e x t } $ } [B] {Frame1} ... {Frame $T _ { s } \} ]$ . In practice, we set $T _ { s } = 5$ and the minimum sampling frame rate to 1 frame per second (fps). The hyperparameters are determined by the memory of devices and the performance in small primary experiments.
|
| 72 |
+
|
| 73 |
+
2. Recursively interpolate frames based on the text, frame rate and known frames. In each round of interpolation, we split the generated frames into multiple $\lceil \frac { T _ { s } } { 2 } \rceil$ -frame blocks overlapping at the beginning and the end, and interpolate a frame between the successive frames in each block. The input sequence to CogLM is also [{Frame Rate}{Text} [B] {Frame1} {Frame $T _ { s } \bigr \} ]$ , where Frame $\begin{array} { r } { 2 i ( i = 1 , 2 , . . . , \lfloor \frac { T _ { s } } { 2 } \rfloor ) } \end{array}$ are to be autoregressively generated. By recursively doubling {Frame Rate}, we can conduct finer interpolation to generate videos of many frames.
|
| 74 |
+
|
| 75 |
+
# 3.2 DUAL-CHANNEL ATTENTION
|
| 76 |
+
|
| 77 |
+
Large-scale pretraining usually demands a large dataset. For the open-domain text-to-video generation, ideally we hope the dataset contains sufficient text-video pairs so as to infer both spatial and temporal correlation between video and text. However, it is rather expensive and time-consuming to collect high-quality text-video pairs. A compromise method is to leverage the image data to facilitate the learning of spatial semantics. Video Diffusion Model (Ho et al., 2022) and NÜWA (Wu et al., 2021b) try to add text-image pairs into text-video training, which helps achieve better results. However, adding image data will also significantly increase the training cost, especially in large-scale pretraining scenarios.
|
| 78 |
+
|
| 79 |
+
In this paper, we propose to inherit the learned knowledge from a pretrained text-to-image generation model rather than use the raw image data. Pretrained text-to-image models, e.g. CogView2 (Ding et al., 2022), already have a good command of the text-image relations. The coverage of the data used to train these models is also larger than that of videos.
|
| 80 |
+
|
| 81 |
+
How to train a video generation model on top of an image generation model? The proposed technique is dualchannel attention. As shown in Figure 3, we augment the original attention block (the spatial channel) with an additional cross-frame attention block (the temporal channel). The temporal channel is implemented by a 3D Swin attention (Liu et al., 2021). Besides the restriction of the receptive window, the temporal channel also follows the attention mask of CogLM. More specifically, during sequential generation, a token attends to the tokens in the previous frames and tokens before it in this frame; and during frame interpolation, the tokens additionally attend to the known frames.
|
| 82 |
+
|
| 83 |
+
We freeze all the parameters in the pretrained text-to-image model to preserve its learned knowledge, and finetune the parameters in the temporal channel attention block to learn the cross-frame information. Specifically, the dual-channel attention block with Sandwich-LN (Ding et al., 2021) can be formulated as
|
| 84 |
+
|
| 85 |
+

|
| 86 |
+
Figure 3: The dual-channel attention.The parameters in $\mathrm { C o g V i e w } 2$ are frozen.
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\begin{array} { r } { \begin{array} { r l } & { x = \alpha \cdot \mathrm { S p a t i a l A t t u } ( \mathrm { L a y e r N o r m } ( x _ { i n } ) ) + ( { \bf 1 } - \alpha ) \cdot \mathrm { T e m p o r a l A t t u } ( \mathrm { L a y e r N o r m } ( x _ { i n } ) ) , } \\ & { x _ { o u t } = x _ { i n } + \mathrm { L a y e r N o r m } ( x ) . } \end{array} } \end{array}
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
The inter-channel mixture factor $_ { \pmb { \alpha } }$ is a vector $\in \ ( 0 , 1 ) ^ { d }$ , where $d$ is the hidden size of the input feature $\pmb { x } _ { i n }$ . To restrict the range of $_ { \pmb { \alpha } }$ within $( 0 , 1 ) ^ { d }$ , we reparameterize it as $\pmb { \alpha } = \mathrm { s i g m o i d } ( \pmb { a } )$ , where $\pmb { a } \in \mathbb { R } ^ { d }$ is a learnable parameter. Thanks to the decomposition of attention channels in dual-channel attention, the computation procedure and hyper-parameters of each channel can be flexibly and independently adjusted under various tasks, as long as the outputs of both channels share the same hidden size. We initialize the temporal channel the same as the pretrained spatial channel so that the attention output $_ { \textbf { \em x } }$ is still in the original CogView2 feature space at the beginning of finetuning. A detailed analysis of the attention is in Appendix B.
|
| 93 |
+
|
| 94 |
+
As mentioned above, we adapt Swin Attention (Liu et al., 2021) for the temporal channel attention to reduce the time and memory overhead. An interesting finding is that, the Swin attention provides a chance for parallel generation in faraway regions of different frames, which further accelerates the autoregressive generation. Further details and acceleration results are illustrated in Appendix A.
|
| 95 |
+
|
| 96 |
+
# 4 PRETRAINING
|
| 97 |
+
|
| 98 |
+
Model. CogVideo consists of two models corresponding to two stages. The backbone of the model in each stage is a 48-layer Transformer with dual-channel attention, with 48 attention heads in each attention channel and a hidden size of 3,072. Each of the two models has 7.7 billion parameters, while 6 billion of them are shared between both models, which finally results in a total of 9.4 billion parameters in CogVideo. To avoid potential gradient explosion, we also use Sandwich LayerNorm and use PB-Relax for stabilizing training, as suggested in (Ding et al., 2021). Shifted window attention is adopted in the Stage 2 model with a window size of $1 0 \times 1 0$ .
|
| 99 |
+
|
| 100 |
+
Dataset. We pretrain our model on a dataset of 5.4 million text-video pairs with a resolution of $1 6 0 \times 1 6 0$ (can be upsampled to $4 8 0 \times 4 8 0$ further). The data is mainly crawled from the Internet, where each video has its matching caption. About $30 \%$ of the captions are in English, which have been translated into Chinese by machine translation. About $50 \%$ of the captions are sentences, while the others are made of phrases.
|
| 101 |
+
|
| 102 |
+
Pretraining. Sequences in both stages are of the length 2,065, consisting of 64 text tokens, 5 (frames) $\times 4 0 0$ (per frame) image tokens, and 1 separator token. Both text and images are tokenized using icetk1. The model in stage 1 is first pretrained for 76,000 iterations on video clips with a minimum frame rate of 0.25 fps, then trained for 15,000 iterations with a minimum frame rate of 1 fps. The model in stage 2 is pretrained for 78,500 iterations with frame rates of 2, 4, and 8 fps. Both models are trained in FP16 with batch si $\mathrm { z e } = 4 1 6$ , and optimized by Adam with max learning rate $= 2 \times 1 0 ^ { - 4 }$ , $\beta _ { 1 } = 0 . 9$ , $\beta _ { 2 } = 0 . 9 5$ , weight decay $= 1 \times 1 0 ^ { - 2 }$ .
|
| 103 |
+
|
| 104 |
+
# 5 EXPERIMENTS
|
| 105 |
+
|
| 106 |
+
# 5.1 MACHINE EVALUATION
|
| 107 |
+
|
| 108 |
+
Machine evaluation was conducted on two popular benchmarks for video generation, UCF101 (Soomro et al., 2012) and Kinetics-600 (Carreira et al., 2018). Following Rakhimov et al. (2020); Yu et al. (2022), we use Fréchet Video Distance (FVD) (Unterthiner et al., 2018) and Inception Score (IS) (Salimans et al., 2016) as evaluation metrics. IS is calculated based on the C3D model (Tran et al., 2015) which was first trained on the Sports-1M dataset (Karpathy et al., 2014) and then finetuned on the UCF101 dataset2. FVD is calculated based on I3D model (Carreira & Zisserman, 2017) trained on Kinetics-400, following previous works (Yu et al., 2022; Ge et al., $2 0 2 2 ) ^ { 3 }$ . As the low-level features brought by the image tokenizer (VQ-VAE) may increase the distribution difference between generated samples and ground truth, which is not the focus of this work, we also evaluate FVD using ground truth reconstructed by the tokenizer.
|
| 109 |
+
|
| 110 |
+
UCF-101 is a human action dataset consisting of 13,320 videos annotated with 101 action classes. Due to the gaps in image style and frame rate between CogVideo’s training set and UCF-101, we finetune CogVideo for 10,000 iterations with a batch size of 192. The model is trained on the whole dataset, following the setting of Clark et al. (2019), Yan et al. (2021), Tian et al. (2021), Yu et al. (2022). We use class labels as input text and generate samples according to the class distribution during inference. For a fair comparison with previous works, we follow Ge et al. (2022) to resize the original $1 6 0 \times 1 6 0$ CogVideo generation to $1 2 8 \times 1 2 8$ , and evaluate FVD and IS over 2,048 and
|
| 111 |
+
|
| 112 |
+

|
| 113 |
+
Figure 4: Human evaluation results. “CogVideo 1Stage” refers to generating videos sequentially by circularly reinserting the last frame into CogVideo’s Stage 1 model.
|
| 114 |
+
|
| 115 |
+
10,000 samples respectively. As shown in Table 1, our model achieves state-of-the-art FVD, and achieves higher IS than most baselines.
|
| 116 |
+
|
| 117 |
+
Kinetics-600 contains 600 classes of human action videos, with roughly 350,000 train and 50,000 test videos in total. We use the action category as input text, and finetune CogVideo on the training set for 12,000 iterations with a batch size of 640. Following the setup of Weissenborn et al. (2019); Rakhimov et al. (2020), we center-crop and downsample each frame to $6 4 \times 6 4$ to measure FVD. Results are shown in Table 2. Our result underperforms some methods on the FVD of this dataset. However, we find that our method achieves much better FVD with reconstructed ground truth, which verifies the guess that the FVD performance is greatly influenced by the low-level features from the VQVAE tokenizer, although this influence is hard to distinguish by eyes after resized to $6 4 \times 6 4$ according to the setting (Weissenborn et al., 2019). Unfortunately, none of those previous models or their evaluation codes on Kinetics is open-source, which prevents us from further analyzing the reasons.
|
| 118 |
+
|
| 119 |
+
# 5.2 HUMAN EVALUATION
|
| 120 |
+
|
| 121 |
+
To further evaluate CogVideo, we invite 90 anonymous evaluators to rate for CogVideo and other open-source baselines including the GAN-based model TGANv2 (Saito et al., 2020) and the GPTbased model VideoGPT (Yan et al., 2021). 30 classes in UCF101 are randomly picked as text conditions and 4 aspects are rated. For VideoGPT, we use the official unconditional pretrained model4. For TGANv2, we use the official source code to train an unconditional generation model under the same setting as that in Saito et al. (2020). To assign unconditionally generated samples into corresponding categories, we choose TSM (Lin et al., 2019) as the action recognition model for post-classification. We only keep the samples whose likelihood of a certain class is at least $80 \%$ . See Appendix C for further details.
|
| 122 |
+
|
| 123 |
+

|
| 124 |
+
(a) Finetune, dual-channel attention (b) Naive fullparameter finetune
|
| 125 |
+
Figure 5: Ablation study for dual-channel attention. The samples are generated with a given first frame, 1 fps. Dual-channel attention produces more accurate shapes. The three models are trained on a “fast setting” with fewer data, iterations and batch size than CogVideo described in $\ S 5 . 3 . 1$ .
|
| 126 |
+
|
| 127 |
+
Table 3: Ablation study for dual-channel attention on Kinetics-600. FVD is evaluated on generated 11-frame samples priming on 5 frames in a 5,000-sample subset of Kinetics-600’s test set.
|
| 128 |
+
|
| 129 |
+
<table><tr><td>Method</td><td>Initialization</td><td>Training Setting</td><td>FVD (↓)</td></tr><tr><td>Train from scratch</td><td>Random</td><td>full parameter training</td><td>166.13</td></tr><tr><td>Finetune (Naive)</td><td>CogView2</td><td>full parameter training</td><td>176.57</td></tr><tr><td>Finetune (Dual-Channel)</td><td>CogView2</td><td>only1 channel trained</td><td>124.92</td></tr><tr><td>Finetune (Dual-Channel)</td><td>CogVideo</td><td>only 1 channel trained</td><td>108.27</td></tr></table>
|
| 130 |
+
|
| 131 |
+
Results in Figure 4 show that CogVideo significantly outperforms baselines on multiple important aspects including frame texture, motion realism, and semantic relevance, and achieves the top score by the overall quality. $4 9 . 5 3 \%$ of evaluators choose CogVideo as the best method, while only $1 5 . 4 2 \%$ and $5 . 6 \%$ favor VideoGPT and TGANv2, respectively.
|
| 132 |
+
|
| 133 |
+
# 5.3 ABLATION STUDY
|
| 134 |
+
|
| 135 |
+
In this section, we conduct further studies on our two main technical contributions: dual-channel attention and multi-frame-rate training.
|
| 136 |
+
|
| 137 |
+
# 5.3.1 THE EFFECTIVENESS OF DUAL-CHANNEL ATTENTION
|
| 138 |
+
|
| 139 |
+
To verify the effectiveness of dual-channel attention, we conduct ablation studies on its two key components: (1) initializing with text-to-image pretrained model CogView2; (2) training temporal attention channel while freezing all other parameters. The former provides an initialization point with rich text-image knowledge, while the latter enforces preserving and exploiting that knowledge. Three settings are compared against (a) finetuning with dual-channel attention (the same way as CogVideo — initialized with CogView2 and only train temporal channel); (b) naïve full parameter finetune (initialize with CogView2 and remove temporal module, and apply full parameter finetuning); (c) training from scratch (randomly initialize and train all parameters).
|
| 140 |
+
|
| 141 |
+
First, we evaluate qualitatively on general-domain datasets. The models are trained on a 1 million subset of the pretraining dataset for 20,000 steps with a batch size of 256, where videos related to animals are removed to demonstrate the generalization ability. Generated samples are shown in Figure 5. Dual-channel attention outperforms the other settings with more accurate contours and details, such as the limbs of the “dancing lion” and the appearance of “sled dogs”, while training from scratch performs the worst. As there is no animal-related video in this train set, the results indicate that both finetuning with dual-channel attention and naïve full parameter finetuning can transfer the knowledge from the text-to-image model, while the former one can better preserve the knowledge and thereby enhance training efficiency and performance.
|
| 142 |
+
|
| 143 |
+
Second, we further test the aforementioned 3 settings on Kinetics-600 for quantitative evaluation. We additionally test finetuning CogVideo to verify the effect of video pretraining. Each model is trained on Kinetics-600 train set for 11,000 iterations with a batch size of 160. Results were shown in Table 3, from which we can see that finetuning CogVideo scores the best, and finetuning with dual-channel attention get better FVD than both naïve full parameter finetuning and training from scratch, which indicates the superiority of dual-channel attention.
|
| 144 |
+
|
| 145 |
+

|
| 146 |
+
Figure 6: The frame-rate token controls the intensity of change during generation. (The top 3 groups) Generating the following 4 frames with different frame-rate tokens. (The bottom 2 groups) 4-second clips generated with different frame-rate tokens in Stage 1 and then interpolated to 16 frames.
|
| 147 |
+
|
| 148 |
+
# 5.3.2 CASE STUDIES OF MULTI-FRAME-RATE TRAINING
|
| 149 |
+
|
| 150 |
+
Multi-frame-rate training strategy not only enables CogVideo to generate videos of multiple frame rates, but also helps better align texts and videos of varying lengths. To demonstrate its effectiveness, we compare the samples generated with different frame rates in Stage 1 in Figure 6.
|
| 151 |
+
|
| 152 |
+
First, we use the Stage 1 model to generate 4 following frames conditioning on the 1, 2, and 4 fps tokens. A lower frame rate corresponds to a longer time interval between neighboring frames. For example, in Figure 6 (top 3 groups) the water level rises faster and the posture of people changes more between adjacent frames with a lower frame rate. These results verify that multi-frame-rate training is able to control the intensity of the changes throughout continuous frames with the frame rate tokens.
|
| 153 |
+
|
| 154 |
+
In order to verify how the multi-frame-rate training help align videos and texts, we process samples generated as above to the same duration and frame rate. To be concrete, we first extend samples to 4 seconds by circularly reinserting the last frame into the Stage 1 model, then interpolate to 4 fps with the Stage 2 model. As shown in Figure 6 (the bottom 2 groups), samples generated with a relatively low frame rate in the first stage may have more precise modeling of longer-term movements, e.g. the periodicity of push-ups and the whole process of “lifting a glass, drinking, then putting it down”. On the other hand, CogVideo can generate realistic movements with a high frame rate in the first stage when only short-term dependency is needed, e.g. “talking”. In other words, a higher frame rate is better at capturing the action details and modeling short-term actions, and a lower frame rate is more capable of capturing global information in the time dimension and modeling long-term actions.
|
| 155 |
+
|
| 156 |
+
# 6 CONCLUSION AND LIMITATIONS
|
| 157 |
+
|
| 158 |
+
We present CogVideo, to the best of our knowledge, the largest and the first open-source pretrained transformer for text-to-video generation in the general domain. CogVideo exhibits a way to efficiently leverage the pretrained text-to-image generative model for a text-to-video generation without hurting its image generation capacity. With the proposed multi-frame-rate training framework, CogVideo is endowed with a better understanding of text-video relations and abilities to control the intensity of changes during generation. There are still several limitations in CogVideo, e.g. restriction on the length of the input sequence still exists due to the large scale of the model and limitation of GPU memory, and we leave them for future work.
|
| 159 |
+
|
| 160 |
+
# ACKNOWLEDGMENTS AND DISCLOSURE OF FUNDING
|
| 161 |
+
|
| 162 |
+
We would like to thank Zhao Xue, Shuai Zhao, Sha Yuan for their help in data collection, Weidong Guo, Fengyu Rao, Zhaoyang Zeng, Mingkang Tang, Zhuoyi Yang for their useful discussion, Hanxiao Qu for maintaining the machines and the computational resources supported by BAAI.
|
| 163 |
+
|
| 164 |
+
This research was supported by Natural Science Foundation of China for Distinguished Young Scholars 61825602.
|
| 165 |
+
|
| 166 |
+
# ETHICS STATEMENT
|
| 167 |
+
|
| 168 |
+
The primary goal of CogVideo is to advance research on video generation methods. Its ability of text-to-video generation has the potential for easing the effort of short video and digital art creation. While in the meantime, we are also aware of its possible ethical impact on society. it might be used for malicious purposes such as reinforcing social stereotypes, violating privacy, generating deceptive or harmful content, etc. In the following part, we discuss these issues and present possible solutions accordingly. Being aware of these ethical impacts, we set a license for CogVideo, which demands the users not to use CogVideo (or derivatives of the model) for any deeds that may violate laws or be harmful to the society.
|
| 169 |
+
|
| 170 |
+
Problem 1: Reinforcing social stereotypes. As mentioned in DALL-E2 (Ramesh et al., 2022) and Imagen (Saharia et al., 2022), visual generation models may inherit biases from their training data and reinforce social stereotypes. For example, if there are more male engineers than female engineers in the dataset, the pretrained model is inclined to generate males given input of “engineer”. This problem can be alleviated to some extent by both pre-processing and post-processing. For pre-processing, we can fuzzy search keywords related to fairness (such as gender, race, and age) during data collection, and adjust their proportion. For post-processing, although there are some researches on model post-processing for fairness, the methods for large pretrained model in the general domain is still an open problem. A simple solution is Word Replacement proposed in Ding et al. (2021), based on the observation that the biases in the generated images/videos often come along with fuzzy user input. To be concrete, we can train an additional name entity recognition model to find the words about humans, then directly add accurate descriptions (such as “white”, “black”, “Asian” or “male”, female”) before those words. The descriptions are sampled according to the real proportion in the world.
|
| 171 |
+
|
| 172 |
+
Problem 2: Violating privacy. Researchers have found that some private information contained in the dataset could be extracted from pretrained language models (Carlini et al., 2021). The same problem exists in multi-modal pretrained models. As the datasets are mainly collected from the websites, private information may be included such as the user’s image/video paired with their name. During data collection, we try to filter out data sources with such private information, though there inevitably remains a small number of videos of public figures.
|
| 173 |
+
|
| 174 |
+
Problem 3: Generating deceptive or harmful content. Although the generated videos still have a certain gap with real videos according to our human evaluation, we are conscious that pretrained models may generate realistic videos in the near future. Without adequate guardrails, such models could be used to intentionally misinform subjects and potentially empower information operations, or generate explicit content such as sexual and violent videos. During data collection, we manually filter out sources with inappropriate data including pornographic and violent content. We further filter out toxic texts using stop-word list and NSFW videos using models5. During the process we found that, in the original dataset, only $0 . 2 \%$ videos have NSFW value higher than 0.95 and only $0 . 5 \%$ captions contain stop words, while all of them are false positives according to manual inspection. During training, we choose to use $\mathrm { C o g V i e w } 2$ as our initialization, whose dataset doesn’t contain sexual or violent images. When developing API, we set restrictions to prevent users from inputting harmful text descriptions. Additional classifiers will be trained along with pretraining to discriminate the fakes generated by a specific model.
|
| 175 |
+
|
| 176 |
+
Last but not least, CogVideo is committed to promoting academic research and will never be put into commercial use. And we choose not to release datasets in order to further ensure copyright issues.
|
| 177 |
+
|
| 178 |
+
# REPRODUCIBILITY STATEMENT
|
| 179 |
+
|
| 180 |
+
We have paid great exertion to ensure reproducibility.
|
| 181 |
+
|
| 182 |
+
• Open-source. We create an anonymous repository https://anonymous.4open. science/r/CogVideo-anonymous-4148, containing codes for pretraining and inference. As pretraining requires huge computational costs (pretraining CogVideo takes 20 days on 104 A100 GPUs), we also release checkpoints to the public to further ensure reproducibility.
|
| 183 |
+
|
| 184 |
+
• Details of models and training procedure: introduced in $\ S 4$ . Also, all the details of the model (e.g. structures and settings) can be found in the released code.
|
| 185 |
+
|
| 186 |
+
• Dataset. A brief introduction can be found in $\ S 4$ . Here we provide more details about the data and the way to reproduce CogVideo. Our data is crawled from public video websites, where each video is paired with a caption (either in English or Chinese). We filter out videos longer than $6 0 \mathrm { s e c }$ , as it may cause too weak relevance between the video and captions. The data covers multiple domains including natural scenery $(42 \% )$ , daily activity $( 3 6 \% )$ , sports $( 5 \% )$ , animals $( 7 \% )$ , others $( 1 0 \% )$ (food, building, city, abstract art, etc.), and are mainly real videos (rather than artificial videos such as cartoon). The content and quality of crawled data are very similar to WebVid- $1 0 \mathbf { M } ^ { 6 }$ , a recently released general domain text-video dataset, thus one can refer to WebVid-10M for reproducing.
|
| 187 |
+
|
| 188 |
+
# REFERENCES
|
| 189 |
+
|
| 190 |
+
Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
|
| 191 |
+
|
| 192 |
+
Nicholas Carlini, Florian Tramer, Eric Wallace, Matthew Jagielski, Ariel Herbert-Voss, Katherine Lee, Adam Roberts, Tom Brown, Dawn Song, Ulfar Erlingsson, et al. Extracting training data from large language models. In 30th USENIX Security Symposium (USENIX Security 21), pp. 2633–2650, 2021.
|
| 193 |
+
|
| 194 |
+
Joao Carreira and Andrew Zisserman. Quo vadis, action recognition? a new model and the kinetics dataset. In proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6299–6308, 2017.
|
| 195 |
+
|
| 196 |
+
Joao Carreira, Eric Noland, Andras Banki-Horvath, Chloe Hillier, and Andrew Zisserman. A short note about kinetics-600. arXiv preprint arXiv:1808.01340, 2018.
|
| 197 |
+
|
| 198 |
+
Aidan Clark, Jeff Donahue, and Karen Simonyan. Adversarial video generation on complex datasets. arXiv preprint arXiv:1907.06571, 2019.
|
| 199 |
+
|
| 200 |
+
Ming Ding, Zhuoyi Yang, Wenyi Hong, Wendi Zheng, Chang Zhou, Da Yin, Junyang Lin, Xu Zou, Zhou Shao, Hongxia Yang, et al. Cogview: Mastering text-to-image generation via transformers. Advances in Neural Information Processing Systems, 34, 2021.
|
| 201 |
+
|
| 202 |
+
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.
|
| 203 |
+
|
| 204 |
+
Patrick Esser, Robin Rombach, and Björn Ommer. Taming transformers for high-resolution image synthesis. arXiv preprint arXiv:2012.09841, 2020.
|
| 205 |
+
|
| 206 |
+
Chelsea Finn, Ian Goodfellow, and Sergey Levine. Unsupervised learning for physical interaction through video prediction. Advances in neural information processing systems, 29, 2016.
|
| 207 |
+
|
| 208 |
+
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.
|
| 209 |
+
|
| 210 |
+
Ian J Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial networks. arXiv preprint arXiv:1406.2661, 2014.
|
| 211 |
+
|
| 212 |
+
Jonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J Fleet. Video diffusion models. arXiv preprint arXiv:2204.03458, 2022.
|
| 213 |
+
|
| 214 |
+
Andrej Karpathy, George Toderici, Sanketh Shetty, Thomas Leung, Rahul Sukthankar, and Li Fei-Fei. Large-scale video classification with convolutional neural networks. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pp. 1725–1732, 2014.
|
| 215 |
+
|
| 216 |
+
Ji Lin, Chuang Gan, and Song Han. Tsm: Temporal shift module for efficient video understanding. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 7083–7093, 2019.
|
| 217 |
+
|
| 218 |
+
Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 10012–10022, 2021.
|
| 219 |
+
|
| 220 |
+
Pauline Luc, Aidan Clark, Sander Dieleman, Diego de Las Casas, Yotam Doron, Albin Cassirer, and Karen Simonyan. Transformation-based adversarial video prediction on large-scale data. arXiv preprint arXiv:2003.04035, 2020.
|
| 221 |
+
|
| 222 |
+
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 Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 2630–2640, 2019.
|
| 223 |
+
|
| 224 |
+
Charlie Nash, João Carreira, Jacob Walker, Iain Barr, Andrew Jaegle, Mateusz Malinowski, and Peter Battaglia. Transframer: Arbitrary frame prediction with generative models. arXiv preprint arXiv:2203.09494, 2022.
|
| 225 |
+
|
| 226 |
+
Ruslan Rakhimov, Denis Volkhonskiy, Alexey Artemov, Denis Zorin, and Evgeny Burnaev. Latent video transformer. arXiv preprint arXiv:2006.10704, 2020.
|
| 227 |
+
|
| 228 |
+
Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. arXiv preprint arXiv:2102.12092, 2021.
|
| 229 |
+
|
| 230 |
+
Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
|
| 231 |
+
|
| 232 |
+
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, et al. Photorealistic text-to-image diffusion models with deep language understanding. arXiv preprint arXiv:2205.11487, 2022.
|
| 233 |
+
|
| 234 |
+
Masaki Saito, Eiichi Matsumoto, and Shunta Saito. Temporal generative adversarial nets with singular value clipping. In Proceedings of the IEEE international conference on computer vision, pp. 2830–2839, 2017.
|
| 235 |
+
|
| 236 |
+
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.
|
| 237 |
+
|
| 238 |
+
Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In Proceedings of the 30th International Conference on Neural Information Processing Systems, pp. 2234–2242, 2016.
|
| 239 |
+
|
| 240 |
+
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.
|
| 241 |
+
|
| 242 |
+
Ilya Sutskever, James Martens, and Geoffrey Hinton. Generating text with recurrent neural networks. In ICML’11, pp. 1017–1024, 2011.
|
| 243 |
+
|
| 244 |
+
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. arXiv preprint arXiv:2104.15069, 2021.
|
| 245 |
+
|
| 246 |
+
Du Tran, Lubomir Bourdev, Rob Fergus, Lorenzo Torresani, and Manohar Paluri. Learning spatiotemporal features with 3d convolutional networks. In Proceedings of the IEEE international conference on computer vision, pp. 4489–4497, 2015.
|
| 247 |
+
|
| 248 |
+
Sergey Tulyakov, Ming-Yu Liu, Xiaodong Yang, and Jan Kautz. Mocogan: Decomposing motion and content for video generation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1526–1535, 2018.
|
| 249 |
+
|
| 250 |
+
Thomas Unterthiner, Sjoerd van Steenkiste, Karol Kurach, Raphael Marinier, Marcin Michalski, and Sylvain Gelly. Towards accurate generative models of video: A new metric & challenges. arXiv preprint arXiv:1812.01717, 2018.
|
| 251 |
+
|
| 252 |
+
Aaron van den Oord, Oriol Vinyals, and Koray Kavukcuoglu. Neural discrete representation learning. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pp. 6309–6318, 2017.
|
| 253 |
+
|
| 254 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. arXiv preprint arXiv:1706.03762, 2017.
|
| 255 |
+
|
| 256 |
+
Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. Advances in neural information processing systems, 29, 2016.
|
| 257 |
+
|
| 258 |
+
Xin Wang, Jiawei Wu, Junkun Chen, Lei Li, Yuan-Fang Wang, and William Yang Wang. Vatex: A large-scale, high-quality multilingual dataset for video-and-language research. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 4581–4591, 2019.
|
| 259 |
+
|
| 260 |
+
Yunbo Wang, Mingsheng Long, Jianmin Wang, Zhifeng Gao, and Philip S Yu. Predrnn: Recurrent neural networks for predictive learning using spatiotemporal lstms. Advances in neural information processing systems, 30, 2017.
|
| 261 |
+
|
| 262 |
+
Dirk Weissenborn, Oscar Täckström, and Jakob Uszkoreit. Scaling autoregressive video models. arXiv preprint arXiv:1906.02634, 2019.
|
| 263 |
+
|
| 264 |
+
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.
|
| 265 |
+
|
| 266 |
+
Chenfei Wu, Jian Liang, Lei Ji, Fan Yang, Yuejian Fang, Daxin Jiang, and Nan Duan. N\" uwa: Visual synthesis pre-training for neural visual world creation. arXiv preprint arXiv:2111.12417, 2021b.
|
| 267 |
+
|
| 268 |
+
Wilson Yan, Yunzhi Zhang, Pieter Abbeel, and Aravind Srinivas. Videogpt: Video generation using vq-vae and transformers. arXiv preprint arXiv:2104.10157, 2021.
|
| 269 |
+
|
| 270 |
+
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. The International Conference on Learning Representations, 2022.
|
| 271 |
+
|
| 272 |
+
Aohan Zeng, Xiao Liu, Zhengxiao Du, Zihan Wang, Hanyu Lai, Ming Ding, Zhuoyi Yang, Yifan Xu, Wendi Zheng, Xiao Xia, et al. Glm-130b: An open bilingual pre-trained model. International Conference on Learning Representations, 2023.
|
| 273 |
+
|
| 274 |
+
# APPENDIX
|
| 275 |
+
|
| 276 |
+
# A SHIFTED WINDOW ATTENTION IN AUTO-REGRESSIVE GENERATION
|
| 277 |
+
|
| 278 |
+
To further alleviate the large time and memory overhead in the temporal channel during training and inference, we refer to Swin Attention Liu et al. (2021). The original Swin attention is only applied to non-autoregressive scenarios, we extend it to the autoregressive and temporal scenarios by applying an auto-regressive attention mask in the shifted windows.
|
| 279 |
+
|
| 280 |
+
An interesting finding is that, the Swin attention provides a chance for parallel generation in faraway regions of different frames, which further accelerates the auto-regressive generation. The dependence of the generation of a specific token relies on
|
| 281 |
+
|
| 282 |
+
• Auto-regressive mask. A token can only attend to previous frames or tokens before itself in the current frame.
|
| 283 |
+
• Shifted window. Only tokens within the distance of window size in both width and height dimensions can be directly attended to.
|
| 284 |
+
|
| 285 |
+

|
| 286 |
+
Figure 7: In 3D autoregressive swin attention (window size $2 \times 2$ as an example), the token in the red box can only attend to (either directly or indirectly) the yellow or green tokens. The gray tokens in the $i$ -th frame and the token in the red box can be generated in parallel.
|
| 287 |
+
|
| 288 |
+
As shown in Figure 7, we can start generating parts of the tokens in the following frames before finishing the generation of all the previous frames — they can work in parallel. Suppose $X , Y$ is the height and width of each frame, and $A _ { x }$ , $A _ { y }$ are the height and width of the shifted window. For two tokens at $( t _ { 1 } , x _ { 1 } , y _ { 1 } )$ and $( t _ { 2 } , x _ { 2 } , y _ { 2 } )$ , $t _ { 1 } < t _ { 2 }$ , the latter cannot attend to the former either directly or indirectly if
|
| 289 |
+
|
| 290 |
+
$$
|
| 291 |
+
( x _ { 1 } - x _ { 2 } ) Y + ( y _ { 1 } - y _ { 2 } ) \geq ( t _ { 2 } - t _ { 1 } + 1 ) ( A _ { x } Y + A _ { y } ) ,
|
| 292 |
+
$$
|
| 293 |
+
|
| 294 |
+
which means that the $i$ -th token in the $t$ -th frame can be generated with the $( i - A _ { x } Y - A _ { y } )$ -th token in the $( t + 1 )$ -th frame in parallel. In this way, we can generate $\lfloor \frac { X Y } { A _ { x } Y + A _ { y } } \rfloor$ tokens in parallel at most, thus greatly enhancing parallelism and accelerating inference compared to auto-regressive with standard attention which can only generate one token at a time.
|
| 295 |
+
|
| 296 |
+
To verify the acceleration effect provided by parallel generation, we generate 6 frames ( $3 2 \times 3 2$ tokens each frame) with varying shifted window sizes, and measure the time cost w/wo parallel generation. The effect of Swin attention equals to full attention when setting window size to 32. As shown in Figure 8, (1) Applying swin attention to auto-regressive generation accelerates inference. (2) Using parallel generation can further speed up inference without affecting generated videos, and achieves around $2 \times$ acceleration when window size $\leq 8$ .
|
| 297 |
+
|
| 298 |
+

|
| 299 |
+
Figure 8: Acceleration results of parallel generation in autoregressive generation with Swin attention.
|
| 300 |
+
|
| 301 |
+
# B ATTENTION ANALYSIS
|
| 302 |
+
|
| 303 |
+
To explore the attention mechanism of dual-channel attention, we visualize (1) the attention distribution in the temporal channel and (2) the mixture factor $\alpha$ controlling the ratio between the spatial and temporal channel in equation 1.
|
| 304 |
+
|
| 305 |
+
Figure 9 visualizes the distribution among frames and texts in sequential generation (Stage 1) with heat maps, where only 24 of 48 attention heads in 6 layers are shown for display purposes. The attention patterns can be broadly classified into the following categories:
|
| 306 |
+
|
| 307 |
+
• Most of the attention is on the text. E.g. the attention heads in violet .
|
| 308 |
+
|
| 309 |
+
• Most of the attention is on a certain frame. E.g. the attention heads in pink focus mainly on the previous frame; the attention heads in blue focus mainly on the first frame besides the text; the attention heads in yellow focus mostly on the frame itself.
|
| 310 |
+
|
| 311 |
+
• Attention is spread over several frames. E.g. the attention heads in green .
|
| 312 |
+
|
| 313 |
+

|
| 314 |
+
Figure 9: The attention distribution among frames and texts in sequential generation (Stage 1). Only 24 of 48 attention heads in 6 layers are selected for display purposes. Each attention head is visualized with a heat map of size $5 \times 6$ , where lighter color represents a larger value. The $5 \times 5$ block on the left indicates the sum of attention scores (after softmax) between each pair of frames, and the rightmost column indicates the sum of the attention score of each frame to text. That is to say, the grid in row i column j $( j \le 5 )$ represents $\textstyle \sum _ { x \in F _ { i } , y \in F _ { j } } \operatorname { a t t n } _ { x , y }$ , and the grid in row i column 6 represents $\textstyle \sum _ { x \in F _ { i } , y \in T } \mathrm { a t t n } _ { x , y }$ , where $F _ { i }$ , $T$ denotes the set of tokens in the i-th frame and text respectively, and $\arctan _ { x , y }$ denotes the attention score of token $\mathbf { X }$ to y.
|
| 315 |
+
|
| 316 |
+
Some attention heads exhibit a single pattern, while others may exhibit a mixture of them. Attention heads in the same layer tend to show similar patterns. In lower layers (e.g. layer 4, 12) the heads tend to allocate attention according to position, while in higher layers more attention is allocated to text (e.g. layer 44) or spread over multiple frames. One possible explanation is that there are more high-level features in higher layers such as video semantics, by which more frames and texts can interact with each other to make high-level feature analyses.
|
| 317 |
+
|
| 318 |
+
It is worth noting that many heads in the temporal channel do not allocate much attention to the frame itself, especially in higher layers, while attending to itself is important for inference. This shows that the CogVideo performs a certain degree of decoupling in the analysis of temporal and spatial features. While the spatial channel is in charge of feature analysis within the frame, the temporal channel can allocate more resources to explore relationships among different frames. We further illustrate this perspective with Figure 10, which shows that features calculated by CogView2 in the spatial channel are heavily relied on.
|
| 319 |
+
|
| 320 |
+

|
| 321 |
+
Figure 10: The mixture factor $\alpha$ controlling the ratio between the spatial and temporal channel in equation 1 in dual-channel attention. Only $\alpha$ in half of the layers are shown for display reasons. As $\alpha$ is a vector of dimension 3072, we show the mean and variance among all of its dimensions in this figure.
|
| 322 |
+
|
| 323 |
+
# C DETAILS ABOUT HUMAN EVALUATION
|
| 324 |
+
|
| 325 |
+
In this section, we introduce more details about human evaluation for measuring generation quality. The conduction of our human evaluation generally follows previous works including Ramesh et al. (2021); Ding et al. (2021)
|
| 326 |
+
|
| 327 |
+
We randomly extract 30 classes from UCF101 for video generation, using corresponding video samples in the dataset as ground truth items in the evaluation. Based on captions of selected classes, we generate video samples from models including TGANv2, VideoGPT, and our model, CogVideo. To further illustrate the effectiveness of hierarchical multi-frame-rate generation, we also include a 1-stage version of the CogVideo model which only uses the Stage 1 model and extends samples by circularly reinserting the last frame into the model. For TGANv2, we use the official source code to train an unconditional generation model under the same setting as that in Saito et al. (2020). For VideoGPT, we use the official unconditional pretrained model to generate samples. To assign unconditionally generated samples into corresponding categories, we choose TSMLin et al. (2019) as the action recognition model for post-classification. We only keep the samples whose likelihood of a certain class is at least $80 \%$ . A randomly selected subset of samples is displayed in Figure 11.
|
| 328 |
+
|
| 329 |
+
For each sample of the video mentioned above, we ask evaluators to give scores between 1 and 5 ( 5 indicates the best while 1 indicates the worst) from three aspects including frame texture, motion realism, and semantic relevance. Then the evaluators are required to give a general score of quality for each sample between 1 and 10, where a higher score indicates better quality. After video samples from each caption are evaluated, the evaluators are asked to select the best one from them. We show snapshots of the evaluation website in Figure 12.
|
| 330 |
+
|
| 331 |
+
Throughout the process of human evaluation, we invited nearly 100 anonymous evaluators, while 90 of them completed the whole evaluation and were counted in the final results. None of the questions in the evaluation have any time limit. We offer each evaluator 75 RMB as a reward for the evaluation. Results of the human evaluation, including the average score and standard deviation for each group, have already been introduced in Figure 4 in the main body. As ground truth samples take an absolute predominance in the best selection question, we have removed the part of ground truth samples in the selection pie plot for clearer model comparison.
|
| 332 |
+
|
| 333 |
+
# D GENERATED VIDEO SAMPLES
|
| 334 |
+
|
| 335 |
+
Thanks to the recursive interpolation model in Stage 2, CogVideo is able to generate relatively high-frame-rate videos, as shown in Figure 13. We provide further examples generated by CogVideo in Figure 14. The generated videos in mp4 format can be found in supplementary material, with the filename "CogVideo_samples.mp4". The length and the frame rate of provided videos are 4 seconds and 8 fps, respectively.
|
| 336 |
+
|
| 337 |
+

|
| 338 |
+
Figure 11: A subset of human evaluation samples. The captions are randomly selected from UCF-101. The original samples are clips of 16 frames, which are downsampled to 4 frames uniformly for display purposes.
|
| 339 |
+
|
| 340 |
+

|
| 341 |
+
Figure 12: Snapshots of the evaluation website.
|
| 342 |
+
|
| 343 |
+
A man is running in the sea.一个男人在海里跑步。
|
| 344 |
+
|
| 345 |
+

|
| 346 |
+
Figure 13: A 4-second video sample generated by CogVideo, which is firstly sequentially generated at 1 fps and then recursively interpolated for 3 iterations.
|
| 347 |
+
|
| 348 |
+
# E SUPPLEMENTAL HUMAN EVALUATION AND QUALITATIVE COMPARISON
|
| 349 |
+
|
| 350 |
+
In order to demonstrate CogVideo’s performance more thoroughly, we additionally conduct human evaluation to compare it with Video Diffusion Model (VDM)(Ho et al., 2022) and NUWA(Wu et al., 2021b). Considering both of them didn’t release codes or checkpoints (which is the reason for not including them in our original human evaluation), we evaluate on the 28 text prompts shown on the webpage of VDM and 6 prompts on the webpage of NUWA. We invite 21 anonymous evaluators to rate on 3 aspects with score 1-5 (5 indicates the best): overall quality, frame texture and content, and motion realism. The results are shown in Figure 15, indicating CogVideo gets better scores on all three metrics.
|
| 351 |
+
|
| 352 |
+

|
| 353 |
+
Figure 15: Supplemental human evaluation. (left) CogVideo vs VDM; (right) CogVideo vs NUWA.
|
| 354 |
+
|
| 355 |
+
We further provide the qualitative comparison with NUWA(Figure 16) and Video Diffusion Model(Figure 17). From the samples we can see that, CogVideo can generate more realistic and detailed objects, e.g. “ducks in a pond”(VDM), “running on the sea”(NUWA), “a man is folding a piece of yellow paper”(NUWA). CogVideo can also generate videos with better motion realism and semantic alignment. For example, 1) in “pouring coffee into coffee cup”(VDM), the liquid level keeps raising in CogVideo’s sample, while the liquid level sometimes drops in VDM’s sample. 2) in “sunset at sea”(VDM), CogVideo shows the whole process of sunset.
|
| 356 |
+
|
| 357 |
+
# F OUT OF DISTRIBUTION SAMPLES
|
| 358 |
+
|
| 359 |
+
While our training data only consists of real videos (rather than animations) and a small amount of abstract video (e.g. animation of abstract texture), CogVideo is capable of generating out-ofdistribution (OOD) videos.
|
| 360 |
+
|
| 361 |
+
• Videos not existing in the real world, such as animals acting like human beings. • Stylized videos such as watercolor painting and Chinese traditional drawing, while our dataset does not include any stylized videos.
|
| 362 |
+
|
| 363 |
+
Samples are shown in Figure 18. The out-of-distribution generation capability of CogVideo is two-folds:
|
| 364 |
+
|
| 365 |
+
• Frame-level: generate reasonable images not exisiting in the dataset. CogVideo losslessly inherits the OOD frame-level generation capability from CogView2 since it preserves all CogView2’ parameters, showing the superiority of dual channel attention. Video-level: given OOD frames, CogVideo is able to generate reasonable actions. For example, when giving an image of a cat with red hat playing the guitar, CogVideo can transfer the human hands to cat’s paws, and make it pluck the guitar strings.
|
| 366 |
+
|
| 367 |
+
We have to admit that, though, the success rate of extreme out-of-distribution generation is not very high, due to several reasons: 1) Generalization is too hard for extreme out-of-distribution cases, e.g. birds playing guitar. It’s difficult to relate birds’ wings to human arms. 2) The generalization capability is bounded by the image generation model, and sometimes even the first frame is in poor quality.
|
| 368 |
+
|
| 369 |
+
# G LIMITATIONS
|
| 370 |
+
|
| 371 |
+
Although CogVideo demonstrates state-of-the-art performance in text-to-video generation, it still has certain limitations and sometimes produces failure cases. The major limitations are summarized below. We further attach each of them with possible solutions. It is worth noting that, because CogVideo is based on autoregressive stochastic sampling, these text prompts can mostly yield good cases with multiple times of sampling.
|
| 372 |
+
|
| 373 |
+
1. The quality heavily relies on the first frame, thus CogVideo inherits limitations from autoregressive text-to-image generative model, including:
|
| 374 |
+
|
| 375 |
+
A) Unreasonable shape, which may exist throughout the video.
|
| 376 |
+
B) Text-content mismatching, especially when the text is complex. E.g. missing component, component mismatch, incorrect attributes binding.
|
| 377 |
+
C) If there are flaws in the first frame, sometimes CogVideo is not robust enough to self-recover, or even amplifies the flaws.
|
| 378 |
+
|
| 379 |
+
Increasing data and training for both the based image model (CogView2) and CogVideo may alleviate these problems. Leveraging pretrained text model can boost text understanding.
|
| 380 |
+
|
| 381 |
+
2. Slight temporal inconsistency (unnatural changes). Possible solutions include joint modeling multiple frames in super-resolution and increasing training time. 3. Slight blurry induced by VQ-VAE’s lossy compression. Our $4 8 0 \times 4 8 0$ pixel results are decoded from $6 0 \times 6 0$ tokens with VQ-VAE, thus may contain slight blur. One possible solution is to further train a super-resolution or deblur model on the pixel level.
|
| 382 |
+
|
| 383 |
+
阳光下,男孩在向日葵地里奔跑。
|
| 384 |
+
|
| 385 |
+
A boy is running in the sunflower field in the sunshine.
|
| 386 |
+
|
| 387 |
+
一个女人在街道上喝奶 茶。 A woman is drinking milk tea in the street.
|
| 388 |
+
|
| 389 |
+
伤心哭泣的女人。 A sad woman who is crying.
|
| 390 |
+
|
| 391 |
+
一对夫妻在吵架。
|
| 392 |
+
A couple are quarreling.
|
| 393 |
+
|
| 394 |
+
两个快乐的朋友在打视频 电话,谈笑风生。 Two happy friends are making video calls, talking and laughing.
|
| 395 |
+
|
| 396 |
+
一个男人背着包登山。 A man is hiking with a backpack.
|
| 397 |
+
|
| 398 |
+
一个男孩在海上冲浪。 A boy is surfing in the sea.
|
| 399 |
+
|
| 400 |
+
一个女人在海里骑马。 A woman is riding a horse in the sea.
|
| 401 |
+
|
| 402 |
+
一个男青年在喝咖啡。 A young man is drinking coffee.
|
| 403 |
+
|
| 404 |
+
一个男子在吃披萨。
|
| 405 |
+
A man is eating pizza. 一个愤怒的年轻女人在电 话里尖叫。
|
| 406 |
+
An angry young woman is screaming on the
|
| 407 |
+
phone. 一颗燃烧的心。
|
| 408 |
+
A burning heart.
|
| 409 |
+
|
| 410 |
+

|
| 411 |
+
Figure 14: Further samples generated by CogVideo. The actual text inputs are in Chinese. Each sample is a 4-second clip of 32 frames, and here we sample 9 frames uniformly for display purposes.
|
| 412 |
+
|
| 413 |
+
# Comparison with NUWA
|
| 414 |
+
|
| 415 |
+

|
| 416 |
+
Figure 16: Qualitative comparison with NUWA(Wu et al., 2021b). Samples of NUWA are obtained from the paper’s appendix. Samples of CogVideo generated by Stage 1 model, with frame rate of 1 fps.
|
| 417 |
+
|
| 418 |
+
# Comparison with Video Diffusion Model
|
| 419 |
+
|
| 420 |
+

|
| 421 |
+
Figure 17: Qualitative comparison with Video Diffusion Model(Ho et al., 2022). Samples of Video Diffusion Model are obtained from their official website https://video-diffusion. github.io. Samples of CogVideo generated by Stage 1 model, with frame rate of 1 fps.
|
| 422 |
+
|
| 423 |
+
A cat in red jacket and blue jeans is dancing,
|
| 424 |
+
|
| 425 |
+

|
| 426 |
+
|
| 427 |
+
A cat in red jacket and blue sunglasses is drinking tea from a bowl.
|
| 428 |
+
|
| 429 |
+

|
| 430 |
+
|
| 431 |
+
A cat in red hat is playing the guitar.
|
| 432 |
+
|
| 433 |
+

|
| 434 |
+
|
| 435 |
+
A cat is drawing on a drawing board.
|
| 436 |
+
|
| 437 |
+

|
| 438 |
+
|
| 439 |
+
People walking in the rain with unbrellas, Chinese traditional drawing.
|
| 440 |
+
|
| 441 |
+

|
| 442 |
+
|
| 443 |
+
People walking in the rain with unbrellas, watercolor painting.
|
| 444 |
+
|
| 445 |
+

|
| 446 |
+
Figure 18: Out of distribution samples generated by CogVideo.
|
| 447 |
+
|
| 448 |
+
A. Shape (prompt: drawing on paper with a pen)
|
| 449 |
+
|
| 450 |
+

|
| 451 |
+
C. Self-recovery (prompt: an oil painting of a couple in formal evening wear going home get caught in a heavy downpour with umbrellas)
|
| 452 |
+
|
| 453 |
+

|
| 454 |
+
Figure 19: Some failure cases generated by CogVideo.
|
md/dev/rTvH1_SRyXs/rTvH1_SRyXs.md
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Which Explanation Should I Choose? A Function Approximation Perspective to Characterizing Post Hoc Explanations
|
| 2 |
+
|
| 3 |
+
Tessa Han
|
| 4 |
+
Harvard University
|
| 5 |
+
Cambridge, MA
|
| 6 |
+
than@g.harvard.edu
|
| 7 |
+
|
| 8 |
+
Suraj Srinivas Harvard University Cambridge, MA ssrinivas@seas.harvard.edu
|
| 9 |
+
|
| 10 |
+
Himabindu Lakkaraju
|
| 11 |
+
Harvard University
|
| 12 |
+
Cambridge, MA
|
| 13 |
+
hlakkaraju@hbs.edu
|
| 14 |
+
|
| 15 |
+
# Abstract
|
| 16 |
+
|
| 17 |
+
A critical problem in the field of post hoc explainability is the lack of a common foundational goal among methods. For example, some methods are motivated by function approximation, some by game theoretic notions, and some by obtaining clean visualizations. This fragmentation of goals causes not only an inconsistent conceptual understanding of explanations but also the practical challenge of not knowing which method to use when.
|
| 18 |
+
|
| 19 |
+
In this work, we begin to address these challenges by unifying eight popular post hoc explanation methods (LIME, C-LIME, KernelSHAP, Occlusion, Vanilla Gradients, Gradients $\times$ Input, SmoothGrad, and Integrated Gradients). We show that these methods all perform local function approximation of the black-box model, differing only in the neighbourhood and loss function used to perform the approximation. This unification enables us to (1) state a no free lunch theorem for explanation methods, demonstrating that no method can perform optimally across all neighbourhoods, and (2) provide a guiding principle to choose among methods based on faithfulness to the black-box model. We empirically validate these theoretical results using various real-world datasets, model classes, and prediction tasks.
|
| 20 |
+
|
| 21 |
+
By bringing diverse explanation methods into a common framework, this work (1) advances the conceptual understanding of these methods, revealing their shared local function approximation objective, properties, and relation to one another, and (2) guides the use of these methods in practice, providing a principled approach to choose among methods and paving the way for the creation of new ones.
|
| 22 |
+
|
| 23 |
+
# 1 Introduction
|
| 24 |
+
|
| 25 |
+
As machine learning models become increasingly complex and are increasingly deployed in highstakes settings (e.g., medicine [1], law [2], and finance $\bar { \bigstar } \bar { \bigstar }$ ), there is a growing emphasis on understanding how models make predictions so that decision-makers (e.g., doctors, judges, and loan officers) can assess the extent to which they can trust model predictions. To this end, several post hoc explanation methods have been developed, including LIME [4], C-LIME [5], SHAP [6], Occlusion [7], Vanilla Gradients $\pmb { \mathbb { B } } \|$ , Gradient x Input [9], SmoothGrad [10], and Integrated Gradients [11]. However, different methods have different goals. Such differences lead to both conceptual and practical challenges to understanding and using explanation methods, thwarting progress in the field.
|
| 26 |
+
|
| 27 |
+
From a conceptual standpoint, the misalignment of goals among methods leads to an inconsistent view of explanations. What is an explanation? This is unclear as different methods have different notions of explanation. Depending on the method, explanations may be local function approximations (LIME and C-LIME), Shapley values (SHAP), raw gradients (Vanilla Gradients), raw gradients scaled by the input (Gradient x Input), de-noised gradients (SmoothGrad), or a straight-line path integral of gradients (Integrated Gradients). Furthermore, the lack of a common mathematical framework for studying these diverse methods prevents a systematic understanding of these methods and their properties. To address these challenges, this paper unifies diverse explanation methods under a common framework, showing that diverse methods share a common motivation of local function approximation, and uses the framework to investigate and evaluate properties of these methods.
|
| 28 |
+
|
| 29 |
+
From a practical standpoint, the misalignment of goals among methods leads to the disagreement problem $\mathbb { \lVert 1 2 \rVert }$ , the phenomenon that different methods provide disagreeing explanations for the same model prediction. Not only do different methods often generate disagreeing explanations in practice, but practitioners do not have a principled approach to select among explanations, resorting to ad hoc heuristics such as personal preference [12]. These findings prompt one to ask why explanation methods disagree and how to select among them in a principled manner. This paper addresses these questions, providing both an explanation for the disagreement problem and a principled approach to select among methods.
|
| 30 |
+
|
| 31 |
+
Thus, to address these conceptual and practical challenges, we study post hoc explanation methods from a function approximation perspective. We formalize a mathematical framework that unifies and characterizes diverse methods and that provides a principled approach to select among methods. Our work makes the following contributions:
|
| 32 |
+
|
| 33 |
+
1. We show that eight diverse, popular explanation methods (LIME, C-LIME, KernelSHAP, Occlusion, Vanilla Gradients, Gradient x Input, SmoothGrad, and Integrated Gradients) all perform local function approximation of the black-box model, differing only in the neighbourhoods and loss functions used to perform the approximation.
|
| 34 |
+
2. We introduce a no free lunch theorem for explanation methods which demonstrates that no single explanation method can perform local function approximation faithfully across all neighbourhoods, which in turn calls for a principled approach to select among methods.
|
| 35 |
+
3. To select among methods, we set forth a guiding principle based on function approximation, deeming a method to be effective if its explanation recovers the black-box model when the two are in the same model class (i.e., if the explanation perfectly approximates the black-box model when possible).
|
| 36 |
+
4. We empirically validate the theoretical results above using various real-world datasets, model classes, and prediction tasks.
|
| 37 |
+
|
| 38 |
+
# 2 Related Work
|
| 39 |
+
|
| 40 |
+
Post hoc explanation methods. Post hoc explanation methods can be classified based on model access (black-box model vs. access to model internals), explanation scope (global vs. local), search technique (perturbation-based vs. gradient-based), and basic unit of explanation (feature importance vs. rule-based). This paper focuses on local post hoc explanation methods based on feature importance. It analyzes four perturbation-based methods (LIME, C-LIME, KernelSHAP, and Occlusion) and four gradient-based methods (Vanilla Gradients, Gradient x Input, SmoothGrad, and Integrated Gradients).
|
| 41 |
+
|
| 42 |
+
Connections among post hoc explanation methods. Prior works have taken initial steps towards characterizing post hoc explanation methods and the connections among them. Agarwal et al. [5] proved that C-LIME and SmoothGrad converge to the same explanation in expectation. Lundberg and Lee $\textcircled { 6 }$ proposed a framework based on Shapley values to unify binary perturbation-based explanations. Covert et al. $\mathbb { \lVert 1 3 \rVert }$ found that many perturbation-based methods share the property of estimating feature importance based on the change in model behavior upon feature removal. In addition, Ancona et al. $[ \mathbb { 1 4 } ]$ analyzed four gradient-based explanation methods and the conditions under which they produce similar explanations. However, these analyses are based on mechanistic properties of methods (e.g., Shapley values or feature removal), are limited in scope (connecting only two methods, only perturbation-based methods, or only gradient-based methods), and do not inform when one method is preferable to another. In contrast, this paper formalizes a mathematical framework based on the concept of local function approximation, unifies eight diverse methods (spanning perturbation-based and gradient-based methods), and guides the use of these methods in practice.
|
| 43 |
+
|
| 44 |
+
Properties of post hoc explanation methods. Prior works have examined various properties of post hoc explanation methods, including faithfulness to the black-box model [15–17], robustness to adversarial attack [18–20, 15, 21], and fairness across subgroups $\pmb { \Vert 2 2 \Vert }$ This paper focuses on explanation faithfulness. Related works [15–17] assessed explanations generated by gradient-based methods, finding that they are not always faithful to the underlying model. Different from these works, this paper provides a framework for generating faithful explanations in the first place, theoretically characterizes the faithfulness of existing methods in different input domains, and provides a principled approach to select among methods and develop new ones based on explanation faithfulness.
|
| 45 |
+
|
| 46 |
+
# 3 Explanation as Local Function Approximation
|
| 47 |
+
|
| 48 |
+
In this section, we formalize the local function approximation framework and show its connection to existing explanation methods. We start by defining the notation used in the paper.
|
| 49 |
+
|
| 50 |
+
Notation. Let $f : \mathcal { X } \mathcal { Y }$ be the black-box function we seek to explain in a post hoc manner, with input domain $\mathcal { X }$ (e.g., $\mathcal { X } = \mathbb { R } ^ { d }$ or $\{ 0 , 1 \} ^ { d } )$ and output domain $\mathcal { V }$ (e.g., $\mathcal { V } = \mathbb { R }$ or $[ 0 , 1 ] )$ . Let $\mathcal { G } = \{ g : \mathcal { X } \mathcal { Y } \}$ be the class of interpretable models used to generate a local explanation for $f$ by selecting a suitable interpretable model $g \in { \mathcal { G } }$ .
|
| 51 |
+
|
| 52 |
+
We characterize locality around a point $\mathbf { x } _ { 0 } \in \mathcal { X }$ using a noise random variable $\xi$ which is sampled from distribution $\mathcal { Z }$ . Let $\mathbf { x } _ { \xi } = \mathbf { x } _ { 0 } \oplus \boldsymbol { \xi }$ be a perturbation of $\mathbf { x } _ { \mathrm { 0 } }$ generated by combining $\mathbf { x } _ { \mathrm { 0 } }$ and $\xi$ using a binary operator $\oplus$ (e.g., addition, multiplication). Lastly, let $\ell ( f , g , \dot { \mathbf { x } _ { 0 } } , \xi ) \in \mathbb { R } ^ { + }$ be the loss function (e.g., squared error, cross-entropy) measuring the distance between $f$ and $g$ over the noise random variable $\xi$ around $\mathbf { x } _ { \mathrm { 0 } }$ .
|
| 53 |
+
|
| 54 |
+
We now define the local function approximation framework.
|
| 55 |
+
|
| 56 |
+
Definition 1. Local function approximation $( L F A )$ of a black-box model $f$ on a neighbourhood distribution $\mathcal { Z }$ around $\mathbf { x } _ { \mathrm { 0 } }$ by an interpretable model class $\mathcal { G }$ and a loss function $\ell$ is given by
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
g ^ { * } = \underset { g \in \mathcal { G } } { \arg \operatorname* { m i n } } \ \underset { \xi \sim \mathcal { Z } } { \mathbb { E } } \ell ( f , g , \mathbf { x } _ { 0 } , \xi )
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
where a valid loss $\ell$ is such that ${ \mathbb E } _ { \xi \sim { \mathcal Z } } \ell ( f , g , \mathbf { x } _ { 0 } , \xi ) = 0 \iff f ( \mathbf { x } _ { \xi } ) = g ( \mathbf { x } _ { \xi } ) \forall \xi \sim { \mathcal Z }$
|
| 63 |
+
|
| 64 |
+
The LFA framework is a formalization of the function approximation perspective first introduced by LIME $\mathbb { \lVert }$ to motivate local explanations. Note that this conceptual framework is distinct from the algorithm introduced by LIME. We elaborate on this distinction below.
|
| 65 |
+
|
| 66 |
+
(1) The LFA framework requires that $f$ and $g$ share the same input domain $\mathcal { X }$ and output domain $\mathcal { V }$ , a fundamental prerequisite for function approximation. This implies, for example, that using an interpretable model $\mathbf { g }$ with binary inputs $( \mathcal { X } \overset { \cdot } { = } \lbrace 0 , 1 \rbrace ^ { d } )$ to approximate a black-box model $f$ with continuous inputs $\mathcal { X } = \mathbb { R } ^ { d }$ ), as proposed in LIME, is not true function approximation.
|
| 67 |
+
|
| 68 |
+
(2) By imposing a condition on the loss function, the LFA framework ensures model recovery under specific conditions: $g ^ { * }$ recovers $f$ (i.e., $g ^ { * } = f .$ ) through LFA when $f$ itself is of the interpretable model class $\mathcal { G }$ (i.e., $f \in { \mathcal { G } } ,$ and perturbations span the input domain of $f$ (i.e., domain $( \mathbf { x } ) = \mathcal { X }$ ). This is a key distinction between the LFA framework and LIME (which has no such requirement) and guides the characterization of explanation methods in Section §4.
|
| 69 |
+
|
| 70 |
+
(3) Efficiently minimizing Equation $^ 1$ requires following standard machine learning methodology of splitting the perturbation data into train / validation / test sets and tuning hyper-parameters on the validation set to ensure generalization. To our knowledge, implementations of LIME do not adopt this procedure, making it possible to overfit to a small number of perturbations.
|
| 71 |
+
|
| 72 |
+
The LFA framework is generic enough to accommodate a variety of explanation methods. In fact, we show that specific instances of this framework converge to existing methods, as summarized in Table 1. At a high level, existing methods use a linear model $g$ to locally approximate the black-box model $\overline { { f } }$ in different input domains (binary or continuous) over different local neighbourhoods specified by noise random variable $\xi$ (where $\xi$ is binary or continuous, drawn from a specified distribution, and combined additively or multiplicatively with point $\mathbf { x } _ { \mathrm { 0 } }$ ) using different loss functions (squared-error or gradient-matching loss). We discuss the details of these connections in the following sections.
|
| 73 |
+
|
| 74 |
+
<table><tr><td rowspan=1 colspan=1>Explanation Method</td><td rowspan=1 colspan=1>Local Neighbourhood Z around Xo</td><td rowspan=1 colspan=1>Loss Function l</td></tr><tr><td rowspan=1 colspan=1>C-LIMESmoothGradVanilla Gradients</td><td rowspan=1 colspan=1>Xo +ε; $(∈ Rd) ~ Normal(0,σ²)Xo +ξ; $(∈ Rd) ~ Normal(0,σ²)X0 +ξ; $(∈ Rd)~Normal(0,σ²),σ → 0</td><td rowspan=1 colspan=1>Squared ErrorGradient MatchingGradient Matching</td></tr><tr><td rowspan=1 colspan=1>Integrated GradientsGradients ×Input</td><td rowspan=1 colspan=1>gxo; $(∈ R)~ Uniform(0,1)£x0; ξ(∈ R) ~'Uniform(a,1),a→1</td><td rowspan=1 colspan=1>Gradient MatchingGradient Matching</td></tr><tr><td rowspan=1 colspan=1>LIMEKernelSHAPOcclusion</td><td rowspan=1 colspan=1>Xo ⊙ ξ; $(∈ {0,1}d)~ Exponential kernelX0 ε; ε(∈ {0,1}d)~ Shapley kernelXo ⊙ε; $(∈ {0,1}d) ~ Random one-hot vectors</td><td rowspan=1 colspan=1>Squared ErrorSquared ErrorSquared Error</td></tr></table>
|
| 75 |
+
|
| 76 |
+
Table 1: Correspondence of existing explanation methods to instances of the LFA framework. Existing methods perform LFA of a black-box model $f$ using the interpretable model class $\mathcal { G }$ of linear models where $g ( \mathbf { \dot { x } } ) = \mathbf { w } ^ { \top } \mathbf { x }$ over a local neighbourhood $\mathcal { Z }$ around point $\mathbf { x } _ { \mathrm { 0 } }$ based on a loss function $\ell$ . Exponential and Shapley kernels are defined in Appendix A.1.
|
| 77 |
+
|
| 78 |
+
# 3.1 LFA with Continuous Noise: Gradient-Based Explanation Methods
|
| 79 |
+
|
| 80 |
+
To connect gradient-based explanation methods to the LFA framework, we leverage the gradientmatching loss function $\ell _ { g m }$ . We define $\ell _ { g m }$ and show that it is a valid loss function for LFA.
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
\ell _ { g m } ( f , g , \mathbf { x } _ { 0 } , \xi ) = \| \nabla _ { \xi } f ( \mathbf { x } _ { 0 } \oplus \xi ) - \nabla _ { \xi } g ( \mathbf { x } _ { 0 } \oplus \xi ) \| _ { 2 } ^ { 2 }
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
This loss function has been previously used in the contexts of generative modeling (where it is dubbed score-matching) $\pmb { \left. \pmb { \mathscr { L } 3 } \right. }$ and model distillation $\boxed { 1 0 }$ . However, to our knowledge, its use in interpretability is novel.
|
| 87 |
+
|
| 88 |
+
Proposition 1. The gradient-matching loss function $\ell _ { g m }$ is a valid loss function for $L F A$ up to $a$ constant, i.e., $\mathbb { E } _ { \xi \sim \mathcal { Z } } \ell _ { g m } ( f , g , \mathbf { x } _ { 0 } , \xi ) = 0 \iff f ( \mathbf { x } _ { \xi } ) \breve { = } g ( \mathbf { x } _ { \xi } ) + C \forall \xi \sim \mathcal { Z }$ , where $C \in \mathbb { R }$ .
|
| 89 |
+
|
| 90 |
+
Proof. If $f ( \mathbf { x } _ { \xi } ) = g ( \mathbf { x } _ { \xi } )$ , then $\nabla _ { \xi } f ( { \bf x } _ { \xi } ) = \nabla _ { \xi } g ( { \bf x } _ { \xi } )$ and it follows from the definition of $\ell _ { g m }$ that $\ell _ { g m } = 0$ . Integrating $\begin{array} { r } { \nabla _ { \xi } f ( \mathbf { x } _ { \xi } ) = \mathbf { \bar { V } } _ { \xi } g ( \mathbf { x } _ { \xi } ) } \end{array}$ gives $f ( \mathbf { x } _ { \xi } ) = g ( \mathbf { x } _ { \xi } ) + C$ . □
|
| 91 |
+
|
| 92 |
+
Proposition $^ 1$ implies that, when using the linear model class $\mathcal { G }$ parameterized by $g ( \mathbf { x } ) = \mathbf { w } ^ { \top } \mathbf { x } + b$ to approximate $f , g ^ { * }$ recovers w but not $b$ . This can be fixed by setting $b = f ( 0 )$ .
|
| 93 |
+
|
| 94 |
+
Theorem 1. LFA with gradient-matching loss is equivalent to (1) SmoothGrad for additive continuous Gaussian noise, which converges to Vanilla Gradients in the limit of a small standard deviation for the Gaussian distribution; and (2) Integrated Gradients for multiplicative continuous Uniform noise, which converges to Gradient x Input in the limit of a small support for the Uniform distribution.
|
| 95 |
+
|
| 96 |
+
Proof Sketch. For SmoothGrad and Integrated Gradients, the idea is that these methods are exactly the first-order stationary points of the gradient-matching loss function under their respective noise distributions. In other words, the weights of the interpretable model $g$ that minimize the loss function is the explanation returned by each method. For Vanilla Gradients and Gradient x Input, the result is derived by taking the specified limits and using the Dirac delta function to calculate the limit. In the limit, the weights of the interpretable model $g$ converge to the explanation of each method. The full proof is in Appendix A.1.
|
| 97 |
+
|
| 98 |
+
Along with gradient-based methods, C-LIME (a perturbation-based method) is an instance of the LFA framework by definition, using the squared-error loss function. The analysis in this section characterizes methods that use continuous noise. It does not extend to binary or discrete noise methods because gradients and continuous random variables do not apply in these domains. In the next section, we discuss binary noise methods.
|
| 99 |
+
|
| 100 |
+
# 3.2 LFA with Binary Noise: LIME, KernelSHAP and Occlusion maps
|
| 101 |
+
|
| 102 |
+
Theorem 2. LFA with multiplicative binary noise and squared-error loss is equivalent to (1) LIME for noise sampled from an unnormalized exponential kernel over binary vectors; (2) KernelSHAP for noise sampled from an unnormalized Shapley kernel; and (3) Occlusion for noise in the form of one-hot vectors.
|
| 103 |
+
|
| 104 |
+
Proof Sketch. For LIME and KernelSHAP, the equivalence is mostly by definition: these methods have components that correspond to the interpretable model $g$ and the loss function $\ell$ of the LFA framework and we need only to determine the local neighbourhood $\mathcal { Z }$ . We define the local neighbourhood $\mathcal { Z }$ using each method’s weighting kernel. In this setup, the LFA framework yields the respective explanation methods in expectation via importance sampling. For Occlusion, the equivalence involves enumerating all perturbations, specifying an appropriate loss function, and computing the resulting stationary points of the loss function. The full proof is in Appendix A.1.
|
| 105 |
+
|
| 106 |
+
# 3.3 Which Methods Do Not Perform LFA?
|
| 107 |
+
|
| 108 |
+
Some popular explanation methods are not instances of the LFA framework due to their properties. These methods include guided backpropagation $\pmb { \Vert 2 4 \Vert }$ , DeconvNet $[ [ 2 5 ] ]$ , Grad-CAM $\bar { \textregistered 2 6 }$ , Grad$\mathrm { C A M + + }$ [27], FullGrad $\lVert \rVert$ , and DeepLIFT [9]. Further details are in Appendix A.2.
|
| 109 |
+
|
| 110 |
+
# 4 When Do Explanations Perform Model Recovery?
|
| 111 |
+
|
| 112 |
+
Having described the LFA framework and its connections to existing explanation methods, we now leverage this framework to analyze the performance of methods under different conditions. We introduce a no free lunch theorem for explanation methods, inspired by classical no free lunch theorems in learning theory and optimization. Then, we assess the ability of existing methods to perform model recovery based on which we provide recommendations for choosing among methods.
|
| 113 |
+
|
| 114 |
+
# 4.1 No Free Lunch Theorem for Explanation Methods
|
| 115 |
+
|
| 116 |
+
An important implication of the function approximation perspective is that no explanation can be optimal across all neighbourhoods because each explanation is designed to perform LFA in a specific neighbourhood. This is especially true for explanations of non-linear models. We formalize this intuition into the following theorem.
|
| 117 |
+
|
| 118 |
+
Theorem 3 (No Free Lunch for Explanation Methods). Consider explaining a black-box model $f$ around point $\mathbf { x } _ { \mathrm { 0 } }$ using an interpretable model $g$ from model class $\mathcal { G }$ and a valid loss function $\ell$ where the distance between $f$ and $\mathcal { G }$ is given by $\begin{array} { r } { d ( f , \mathcal { G } ) = \operatorname* { m i n } _ { g \in \mathcal { G } } \operatorname* { m a x } _ { \mathbf { x } \in \mathcal { X } } \ell ( f , g , 0 , \mathbf { x } ) . } \end{array}$ .
|
| 119 |
+
|
| 120 |
+
Then, for any explanation $g ^ { * }$ over a neighbourhood distribution $\begin{array} { r l r l } { \xi _ { 1 } } & { { } \sim } & { \mathcal { Z } _ { 1 } } \end{array}$ such that $\begin{array} { r } { \operatorname* { m a x } _ { \xi _ { 1 } } \ell ( f , g ^ { * } , \mathbf { x } _ { 0 } , \xi _ { 1 } ) \ \leq \ \epsilon , } \end{array}$ there always exists another neighbourhood $\xi _ { 2 } \ \sim \ \mathcal { Z } _ { 2 }$ such that $\begin{array} { r } { \operatorname* { m a x } _ { \xi _ { 2 } } \ell ( f , g ^ { * } , \mathbf { x } _ { 0 } , \xi _ { 2 } ) \geq d ( f , \mathcal { G } ) } \end{array}$ .
|
| 121 |
+
|
| 122 |
+
Proof Sketch. The idea is that, given an explanation obtained by using $g$ to approximate $f$ over a specific local neighbourhood $\mathcal { Z }$ , it is always possible to find a local neighbourhood over which this explanation does not perform well (i.e., does not perform faithful LFA). Thus, no single explanation method can perform well over all local neighbourhoods. The proof entails constructing an “adversarial” input for an explanation $g ^ { * }$ such that $g ^ { * }$ has a large loss for this input and then creating a neighbourhood that contains this adversarial input which will provably have a large loss. The magnitude of this loss is $d ( f , { \mathcal { G } } )$ , the distance between $f$ and the model class $\mathcal { G }$ , inspired by the Haussdorf distance. The proof is generic and makes no assumptions regarding the forms of $\ell$ , $\mathcal { G }$ or $\mathcal { Z } _ { 1 }$ . The full proof is in Appendix A.3.
|
| 123 |
+
|
| 124 |
+
Thus, an explanation on a finite $\mathcal { Z } _ { 1 }$ necessarily cannot approximate function behaviour at all other points, especially when $\mathcal { G }$ is less expressive than $f$ , which is indicated by a large value of $d ( f , { \mathcal { G } } )$ . Thus, in the general case, one cannot perform model recovery as $\mathcal { G }$ is less expressive than $f$ .
|
| 125 |
+
|
| 126 |
+
An important implication of Theorem $\textcircled { 3 }$ is that seeking to find the “best” explanation without specifying a corresponding neighbourhood is futile as no universal “best” explanation exists. Furthermore, once the neighbourhood is specified, the best explanation is exactly the one given by the corresponding instance of the LFA framework.
|
| 127 |
+
|
| 128 |
+
In the next section, we consider the special case when $d ( f , { \mathcal { G } } ) = 0$ (i.e., when $f \in { \mathcal { G } } ,$ ), where Theorem $\perp$ does not apply because the same explanation can be optimal for multiple neighbourhoods and model recovery is thus possible.
|
| 129 |
+
|
| 130 |
+
# 4.2 Characterizing Explanation Methods via Model Recovery
|
| 131 |
+
|
| 132 |
+
Next, we formally state the model recovery condition for explanation methods. Then, we use this condition as a guiding principle to choose among methods.
|
| 133 |
+
|
| 134 |
+
Definition 2 (Model Recovery: Guiding Principle). Given an instance of the LFA framework with a black-box model $f$ such that $f \in { \mathcal { G } }$ and a specific noise type (e.g., Gaussian, Uniform), an explanation method performs model recovery if there exists some noise distribution $\mathcal { Z }$ such that LFA returns $g ^ { * } = f$ .
|
| 135 |
+
|
| 136 |
+
In other words, when the black-box model $f$ itself is of the interpretable model class $G$ , there must exist some setting of the noise distribution (within the noise type specified in the instance of the LFA framework) that is able to recover the black-box model. Thus, in this special case, we require local function approximation to lead to global model recovery over all inputs. This criterion can be thought of as a “sanity check” for explanation methods to ensure that they remain faithful to the black-box model.
|
| 137 |
+
|
| 138 |
+
Next, we analyze the impact of the choice of perturbation neighbourhood $\mathcal { Z }$ , the binary operator $\oplus$ and the interpretable model class $\mathcal { G }$ on an explanation method’s ability to satisfy the model recovery guiding principle in different input domains $\mathcal { X }$ . Note that while we can choose ${ \mathcal { Z } } , \oplus .$ , and $\mathcal { G }$ , we cannot choose $\mathcal { X }$ , the input domain.
|
| 139 |
+
|
| 140 |
+
Which explanation should I choose for continuous $\mathcal { X } 2$ We now analyze the model recovery properties of existing explanation methods when the input domain is continuous. We consider methods based on additive continuous noise (SmoothGrad, Vanilla Gradients, and C-LIME), multiplicative continuous noise (Integrated Gradients and Gradient x Input), and multiplicative binary noise (LIME, KernelSHAP, and Occlusion). For these methods, we make the following remark regarding model recovery for the class of linear models.
|
| 141 |
+
|
| 142 |
+
Remark 1. For $\chi = \mathbb { R } ^ { d }$ and linear models $f$ and $g$ where $f ( \mathbf { x } ) = \mathbf { w } _ { f } ^ { \top } \mathbf { x }$ and $g ( \mathbf { x } ) = \mathbf { w } _ { g } ^ { \top } \mathbf { x } ,$ additive continuous noise methods recover f (i.e., ${ \pmb w } _ { g } = { \pmb w } _ { f }$ ) while multiplicative continuous and multiplicative binary noise methods do not and instead recover ${ \pmb w } _ { g } = { \pmb w } _ { f } \odot { \pmb x }$ .
|
| 143 |
+
|
| 144 |
+
This remark can be verified by directly evaluating the explanations (weights) of linear models, where the gradient exactly corresponds to the weights.
|
| 145 |
+
|
| 146 |
+
Note that the inability of multiplicative continuous noise methods to recover the black-box model is not due to the multiplicative nature of the noise, but due to the parameterization of the loss function. Specifically, these methods (implicitly) use the loss function $\ell ( \dot { f } , g , \mathbf { x } _ { 0 } , \xi ) = \| \nabla _ { \xi } f ( \mathbf { x } _ { \xi } ) - \nabla _ { \xi } g ( \xi ) \| _ { 2 } ^ { 2 }$ . Slightly changing the loss function to $\ell ( f , g , \mathbf { x } _ { 0 } , \xi ) = \| \nabla _ { \xi } f ( \mathbf { x } _ { \xi } ) - \nabla _ { \xi } g ( \mathbf { x } _ { \xi } ) \| _ { 2 } ^ { 2 }$ , i.e., replacing $g ( \xi )$ with $g ( \mathbf { x } _ { \xi } )$ , would enable $g ^ { * }$ to recover $f$ . This would change Integrated Gradients to $\textstyle \int _ { \alpha = 0 } ^ { 1 } \nabla _ { \alpha \mathbf { x } } f ( \alpha \mathbf { x } )$ (omitting the input multiplication term) and Gradient x Input to Vanilla Gradients.
|
| 147 |
+
|
| 148 |
+
A similar argument can be made for binary noise methods which parameterize the loss function as $\ell ( f , g , \mathbf { x } _ { 0 } , \xi \big ) = \| f ( \mathbf { x } _ { \xi } ) - g ( \xi ) \| ^ { 2 }$ . By changing the loss function to $\hat { \ell } ( f , g , \underline { { \mathbf { x } } } _ { 0 } , \xi ) = \| f ( \mathbf { x } _ { \xi } ) - g ( \mathbf { x } _ { \xi } ) \| ^ { 2 }$ , binary noise methods can recover $f$ for the case described in Remark $\nsupseteq$ However, binary noise methods for continuous domains are unreliable, as there are cases where, despite the modification to $\ell$ , model recovery is not guaranteed. The following is an example of this scenario.
|
| 149 |
+
|
| 150 |
+
Remark 2. For $\mathcal { X } = \mathbb { R } ^ { d }$ , periodic functions $f$ and $g$ where $\begin{array} { r } { f ( \mathbf { x } ) = \sum _ { i = 1 } ^ { d } \sin ( \mathbf { w } _ { f _ { i } } \odot \mathbf { x } _ { i } ) } \end{array}$ and $\begin{array} { r } { g ( \mathbf { x } ) = \sum _ { i = 1 } ^ { d } \sin ( \mathbf { w } _ { g _ { i } } \odot \mathbf { x } _ { i } ) , } \end{array}$ , and an integer $n$ , binary noise methods do not perform model recovery for $\begin{array} { r } { | w _ { f _ { i } } | \geq \frac { n \pi } { \mathbf { x } _ { 0 _ { i } } } } \end{array}$
|
| 151 |
+
|
| 152 |
+
This is because, for the conditions specified, $\sin ( { \bf w } _ { f _ { i } } { \bf x } _ { 0 _ { i } } ) = \sin ( \pm n \pi ) = \sin ( 0 ) = 0$ , i.e., $\sin ( \mathbf { w } _ { f _ { i } } \mathbf { x } _ { 0 _ { i } } )$ outputs zero for all binary perturbations, thereby preventing model recovery. In this case, the discrete nature of the noise makes model recovery impossible. In general, discrete noise is inadequate for the recovery of models with large frequency components.
|
| 153 |
+
|
| 154 |
+
Which explanation should I choose for binary $\mathcal { X } ?$ In the binary domain, continuous noise methods are invalid, restricting the choice of methods to binary noise methods. For reasons discussed above, methods with perturbation neighbourhoods characterized by multiplicative binary perturbations (e.g., LIME, KernelSHAP, and Occlusion) only enable $g ^ { * }$ to recover $f$ in the binary domain. Note that the sinusoidal example in Remark 2 does not apply in this regime due to the continuous nature of its domain.
|
| 155 |
+
|
| 156 |
+
Which explanation should I choose for discrete $\mathcal { X } 2$ In the discrete domain, continuous noise methods are also invalid. In addition, binary noise methods (e.g., LIME, KernelSHAP and Occlusion) cannot be used either because model recovery is not guaranteed in the sinusoidal case (Remark $\bigstar$ , following similar logic to that presented for continuous noise. Note that none of the existing methods in Table $\nsupseteq$ perform general discrete perturbations, suggesting that these methods are not suitable for the discrete domain. Thus, in the discrete domain, a user can apply the LFA framework to define a new explanation method, specifying an appropriate discrete noise type. In the next section, we discuss more broadly about how one can use the LFA framework to create novel explanation methods.
|
| 157 |
+
|
| 158 |
+
# 4.3 Designing Novel Explanations with LFA
|
| 159 |
+
|
| 160 |
+
The LFA framework not only unifies existing explanation methods but also guides the creation of new ones. To explain a given black-box model prediction using the LFA framework, a user must specify the (1) interpretable model class $\mathcal { G }$ , (2) neighbourhood distribution $\mathcal { Z }$ , (3) loss function $\ell$ and (4) binary operator $\oplus$ to combine the input and the noise. Specifying these four components completely specifies an instance of the LFA framework, thereby generating an explanation method tailored to a given context.
|
| 161 |
+
|
| 162 |
+
To illustrate this, consider a scenario in which a user seeks to create a sparse variant of SmoothGrad that yields non-zero gradients for only a small number of features (“SparseSmoothGrad”). Designing SparseSmoothGrad only requires the addition of a regularization term to the loss function used in the SmoothGrad instance of the LFA framework (e.g., $\bar { \ell } = \ell _ { S m o o t h G r a d } + \| \nabla _ { \xi } g ( \mathbf { x } _ { \xi } ) \| _ { 0 } )$ , at which point, sparse solvers may be employed to solve the problem. Note that, unlike SmoothGrad, SparseSmoothGrad does not have a closed form solution, but that is not an issue for the LFA framework. More generally, by allowing customization of (1), (2), (3), and (4), the LFA framework creates new explanation methods through “variations on a theme”.
|
| 163 |
+
|
| 164 |
+
We summarize Section $\ S \boxed { 4 }$ as a table in Appendix ${ \bf A . } 4$ and discuss the practical implications of Section §4 by providing the following recommendation for choosing among explanation methods.
|
| 165 |
+
|
| 166 |
+
Recommendation for choosing among explanation methods. In general, choose methods that satisfy the guiding principle of model recovery in the input domain in question. For continuous data, use additive continuous noise methods (e.g., SmoothGrad, Vanilla Gradients, C-LIME) or modified multiplicative continuous noise methods (e.g., Integrated Gradients, Gradient x Input) as described in Section $\ S 4 . 2 .$ For binary data, use binary noise methods (e.g., LIME, KernelSHAP, Occlusion). Given that methods that use discrete noise do not exist, in case of discrete data, design novel explanation methods using the LFA framework with discrete noise neighbourhoods. Within each input domain, choosing among appropriate methods boils down to determining the perturbation neighbourhood most suitable in the given context.
|
| 167 |
+
|
| 168 |
+
# 5 Empirical Evaluation
|
| 169 |
+
|
| 170 |
+
In this section, we present an empirical evaluation of the LFA framework. We first describe the experimental setup and then discuss three experiments and their findings.
|
| 171 |
+
|
| 172 |
+
# 5.1 Datasets, Models, and Metrics
|
| 173 |
+
|
| 174 |
+
Datasets. We experiment with two real-world datasets for two prediction tasks. The first dataset is the life expectancy dataset from the World Health Organization (WHO) [29]. It consists of countries’ demographic, economic, and health factors from 2000 to 2015, with 2,938 observations for 20 continuous features. We use this dataset to perform regression, predicting life expectancy. The other dataset is the home equity line of credit (HELOC) dataset from FICO $\bar { \mathbb { B } } \bar { 0 }$ . It consists of information on HELOC applications, with 9,871 observations for 24 continuous features. We use this dataset to perform classification, predicting whether an applicant made payments without being 90 days overdue. Additional dataset details are described in Appendix A.5.
|
| 175 |
+
|
| 176 |
+
Models. For each dataset, we train four models: a simple model (linear regression for the WHO dataset and logistic regression for the HELOC dataset) that can satisfy conditions of the guiding principle and three more complex models (neural networks of varying complexity) that are more reflective of real-world applications. Model architectures and performance are described in Appendix A.5.
|
| 177 |
+
|
| 178 |
+

|
| 179 |
+
Figure 1: Correspondence between existing explanation methods and instances of the LFA framework. (a) Heatmap of average L1 distance between pairs of explanations. Boxplots of L1 distance between explanations of (b) SmoothGrad and Vanilla Gradients and (c) Integrated Gradients and Gradient x Input. The lower the L1 distance, the more similar two explanations are. Results indicate that existing explanation methods are instances of the LFA framework.
|
| 180 |
+
|
| 181 |
+
Metrics. To measure the similarity between two vectors (e.g., between two sets of explanations or between an explanation and the true model weights), we use L1 distance and cosine distance. L1 distance ranges between $\lbrack 0 , \infty )$ and is 0 when two vectors are the same. Cosine distance ranges between [0, 2] and is 0 when the angle between two vectors is $0 ^ { \circ }$ (or $3 6 0 ^ { \circ }$ ). For both metrics, the lower the value, the more similar two given vectors are.
|
| 182 |
+
|
| 183 |
+
# 5.2 Experiments
|
| 184 |
+
|
| 185 |
+
Here, we describe the setup of the experiments, present results, and discuss their implications.
|
| 186 |
+
|
| 187 |
+
Experiment 1: Existing explanation methods are instances of the LFA framework. First, we compare existing methods with corresponding instances of the LFA framework to assess whether they generate the same explanations. To this end, we use seven methods to explain the predictions of black-box models for 100 randomly-selected test set points. For each method, explanations are computed using either the existing method (implemented by Meta’s Captum library $\pmb { \mathbb { B } } \pmb { \mathbb { 1 } } ) ,$ ) or the corresponding instance of the LFA framework (Table 1). The similarity of a given pair of explanations is measured using L1 distance and cosine distance.
|
| 188 |
+
|
| 189 |
+
The L1 distance values for a neural network with three hidden layers trained on the WHO dataset are shown in Figure $\bigstar$ In Figure 1a, lowest L1 distance values appear in the diagonal of the heatmap, indicating that explanations generated by existing methods and corresponding instances of the LFA framework are very similar. Figures 1b and 1c show that explanations generated by instances of the LFA framework corresponding to SmoothGrad and Integrated Gradients converge to those of Vanilla Gradients and Gradient x Input, respectively. Together, these results demonstrate that, consistent with the theoretical results derived in Section $\ S \boxed { 3 }$ existing methods are instances of the LFA framework. In addition, the clustering of the methods in Figure $\underline { \mathbb { I } } { \bf \AA }$ indicates that, consistent with the theoretical analysis in Section $\ S 4 ,$ for continuous data, SmoothGrad and Vanilla Gradients generate similar explanations while LIME, KernelSHAP, Occlusion, Integrated Gradients, and Gradient x Input generate similar explanations. We observe similar results across various datasets, models, and metrics (Appendix A.6.1).
|
| 190 |
+
|
| 191 |
+
Experiment 2: Some methods recover the underlying model while others do not (guiding principle). Next, we empirically assess which existing methods satisfy the guiding principle, i.e., which methods recover the black-box model $f$ when $f$ is of the interpretable model class $\mathcal { G }$ . We specify a setting in which $f$ and $g$ are of the same model class, generate explanations using each method, and assess whether $g$ recovers $f$ for each explanation. For the WHO dataset, we set $f$ and $g$ to be linear regression models and generate explanations for 100 randomly-selected test set points. Then, for each point, we compare $g$ ’s weights with $f$ ’s gradients alone or with $f$ ’s gradients multiplied by the input because, based on Section $\ S \boxed { 4 } ,$ some methods generate explanations on the scale of gradients while others on the scale of gradient-times-input. Note that, for linear regression, $f$ ’s gradients are $f$ ’s weights.
|
| 192 |
+
|
| 193 |
+

|
| 194 |
+
Figure 2: Analysis of model recovery. The lower the L1 distance, the more similar $g$ ’s weights are to (a) $f$ ’s weights or (b) $f$ ’s weights multiplied by the input. Results indicate that, for continuous data, additive continuous noise methods recover $f$ ’s weights, satisfying the guiding principle, while multiplicative binary and multiplicative continuous noise methods do not, recovering $f$ ’s weights multiplied by the input instead.
|
| 195 |
+
|
| 196 |
+

|
| 197 |
+
Figure 3: Perturbation tests perturbing bottom $k$ features using (a) binary or (b) continuous noise. The lower the curve, the better a method identifies unimportant features. Results illustrate the no free lunch theorem, i.e., no single method performs best across all neighborhoods.
|
| 198 |
+
|
| 199 |
+
Results are shown in Figure $\boxed { 2 }$ Consistent with Section $\ S \boxed { 4 } ,$ for continuous data, SmoothGrad and Vanilla Gradients recover the black-box model, thereby satisfying the guiding principle, while LIME, KernelSHAP, Occlusion, Integrated Gradients, and Gradient x Input do not. We observe similar results for the HELOC dataset using logistic regression models for $f$ and $g$ (Appendix A.6.2).
|
| 200 |
+
|
| 201 |
+
Experiment 3: No single method performs best across all neighbourhoods (no free lunch theorem). Lastly, we perform a set of experiments to illustrate the no free lunch theorem in Section $\ S 4 .$ We generate explanations for black-box model predictions for 100 randomly-selected test set points and evaluate the explanations using perturbation tests based on top- $k$ or bottom- $k$ features. For perturbation tests based on top- $k$ features, the setup is as follows. For a given data point, $k$ , and explanation, we identify the top- $k$ features and either replace them with zero (binary perturbation) or add Gaussian noise to them (continuous perturbation). Then, we calculate the absolute difference in model prediction before and after perturbation. For each point, we generate one binary perturbation (since such perturbations are deterministic) and 100 continuous perturbations (since such perturbations are random), computing the average absolute difference in model prediction for the latter. In this setup, methods that better identify important features yield larger changes in model prediction. For perturbation tests based on bottom- $k$ features, we follow the same procedure but perturb the bottom- $k$ features instead. In this setup, methods that better identify unimportant features yield smaller changes in model prediction.
|
| 202 |
+
|
| 203 |
+
Results of perturbation tests based on bottom- $k$ features performed on explanations for a neural network with three hidden layers trained on the WHO dataset are displayed in Figure $3 .$ Consistent with the no free lunch theorem in Section $\ S 4 ,$ LIME, KernelSHAP, Occlusion, Integrated Gradients, and Gradient x Input perform best on binary perturbation neighbourhoods (Figure $\textcircled { 3 } \textcircled { \times }$ while SmoothGrad and Vanilla Gradients perform best on continuous perturbation neighborhoods (Figure $^ { 3 \mathrm { b } ) }$ . We observe consistent results across perturbation test types (top- $k$ and bottom- $k$ ), datasets, and models (Appendix $\underline { { \sqrt { \mathrm { A } . 6 . 3 } } } )$ . These results have important implications: one should carefully consider the perturbation neighborhood not only when selecting a method to generate explanations but also when selecting a method to evaluate explanations. In fact, the type of perturbations used to evaluate explanations directly determines explanation method performance.
|
| 204 |
+
|
| 205 |
+
# 6 Conclusions and Future Work
|
| 206 |
+
|
| 207 |
+
In this work, we formalize the local function approximation (LFA) framework and demonstrate that eight popular explanation methods can be characterized as instances of this framework with different local neighbourhoods and loss functions. We also introduce the no free lunch theorem for explanation methods, showing that no single method can perform optimally across all neighbourhoods, and provide a guiding principle for choosing among methods.
|
| 208 |
+
|
| 209 |
+
The function approximation perspective captures the essence of an explanation – a simplification of the real world (i.e., a black-box model) that is nonetheless accurate enough to be useful (i.e., predict outcomes of a set of perturbations). When the real world is “simple”, an explanation should completely capture its behaviour, a hallmark expressed precisely by the guiding principle. When the requirements of two explanations are distinct (i.e., they are trained to predict different sets of perturbations), then the explanations are each accurate in their own domain and may disagree, a phenomenon captured by the no free lunch theorem.
|
| 210 |
+
|
| 211 |
+
Our work makes fundamental contributions. We unify popular explanation methods, bringing diverse methods into a common framework. Unification brings conceptual coherence and clarity: diverse explanation methods, even those seemingly unrelated to function approximation, perform LFA but differ in the way they perform it. Unification also enables theoretical simplicity: to study diverse explanation methods, instead of analyzing each method individually, one can simply analyze the LFA framework and apply the findings to each method. An example of this is the no free lunch theorem which holds true for all instances of the LFA framework. Furthermore, our work provides practical guidance by presenting a principled approach to select among methods and design new ones.
|
| 212 |
+
|
| 213 |
+
Our work also addresses key open questions in the field. In response to criticism about the lack of consensus in the field regarding the overarching goals of post hoc explainability $\lVert \overline { { 3 2 } } \rVert$ , our work points to function approximation as a principled goal. It also provides an explanation for the disagreement problem $\mathbb { \lVert \rVert }$ , i.e., why different methods generate different explanations for the same model prediction. According to the LFA framework, this disagreement occurs because different methods approximate the black-box model over different neighbourhoods using different loss functions.
|
| 214 |
+
|
| 215 |
+
Future research includes the following directions. First, we analyzed eight popular post hoc explanation methods and this analysis could be extended to other methods. Second, our work focuses on the faithfulness rather than interpretability of explanations. The latter is encapsulated in the “interpretable” model class $\mathcal { G }$ , which includes all the information about human preferences with regards to interpretability. However, it is unclear what constitutes an interpretable explanation and elucidating this takes not only conceptual understanding but also human-computer interaction research such as user studies. These are important directions for future research.
|
| 216 |
+
|
| 217 |
+
# Acknowledgements
|
| 218 |
+
|
| 219 |
+
The authors would like to thank the anonymous reviewers for their helpful feedback and the following funding agencies for supporting this work. This work is supported in part by NSF awards $\# \mathrm { I I S } .$ 2008461 and $\# \mathrm { I I S - } 2 0 4 0 9 8 9$ , and research awards from Google, JP Morgan, Amazon, Harvard Data Science Initiative, and $\scriptstyle \mathbf { D } \scriptscriptstyle \Im$ Institute at Harvard. H.L. would like to thank Sujatha and Mohan Lakkaraju for their continued support and encouragement. T.H. is supported in part by an NSF GRFP fellowship. The views expressed here are those of the authors and do not reflect the official policy or position of the funding agencies.
|
| 220 |
+
|
| 221 |
+
References
|
| 222 |
+
[1] Kun-Hsing Yu, Andrew L Beam, and Isaac S Kohane. Artificial intelligence in healthcare. Nature Biomedical Engineering, 2(10):719–731, 2018.
|
| 223 |
+
[2] Robert Walters and Marko Novak. Artificial intelligence and law. In Cyber Security, Artificial Intelligence, Data Protection & the Law, pages 39–69. Springer, 2021.
|
| 224 |
+
[3] Longbing Cao. AI in finance: Challenges, techniques, and opportunities. ACM Computing Surveys (CSUR), 55(3):1–38, 2022.
|
| 225 |
+
[4] Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. "Why should I trust you?" Explaining the predictions of any classifier. International Conference on Knowledge Discovery and Data Mining, 2016.
|
| 226 |
+
[5] Sushant Agarwal, Shahin Jabbari, Chirag Agarwal, Sohini Upadhyay, Steven Wu, and Himabindu Lakkaraju. Towards the unification and robustness of perturbation and gradient based explanations. International Conference on Machine Learning, 2021.
|
| 227 |
+
[6] Scott M. Lundberg and Su-In Lee. A unified approach to interpreting model predictions. Advances in Neural Information Processing Systems, 2017.
|
| 228 |
+
[7] Matthew Zeiler and Robert Fergus. Visualizing and understanding convolutional networks. arXiv:1311.2901, 2013.
|
| 229 |
+
[8] Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. Workshop at International Conference on Learning Representations, 2014.
|
| 230 |
+
[9] Avanti Shrikumar, Peyton Greenside, and Anshul Kundaje. Learning important features through propagating activation differences. International Conference on Machine Learning, 2017.
|
| 231 |
+
[10] Daniel Smilkov, Nikhil Thorat, Been Kim, Fernanda Viégas, and Martin Wattenberg. SmoothGrad: Removing noise by adding noise. arXiv:1706.03825, 2017.
|
| 232 |
+
[11] Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. International Conference on Machine Learning, 2017.
|
| 233 |
+
[12] Satyapriya Krishna\*, Tessa Han\*, Alex Gu, Javin Pombra, Shahin Jabbari, Steven Wu, and Himabindu Lakkaraju. The disagreement problem in explainable machine learning: A practitioner’s perspective. arXiv:2202.01602, 2022.
|
| 234 |
+
[13] Ian Covert, Scott Lundberg, and Su-In Lee. Explaining by removing: A unified framework for model explanation. Journal of Machine Learning Research, 2021.
|
| 235 |
+
[14] Marco Ancona, Enea Ceolini, Cengiz Öztireli, and Markus Gross. Towards better understanding of gradient-based attribution methods for deep neural networks. International Conference on Learning Representations, 2018.
|
| 236 |
+
[15] Julius Adebayo, Justin Gilmer, Michael Muelly, Ian Goodfellow, Moritz Hardt, and Been Kim. Sanity checks for saliency maps. Advances in Neural Information Processing Systems, 2018.
|
| 237 |
+
[16] Suraj Srinivas and François Fleuret. Knowledge transfer with Jacobian matching. International Conference on Machine Learning, 2018.
|
| 238 |
+
[17] Sara Hooker, Dumitru Erhan, Pieter-Jan Kindermans, and Been Kim. A benchmark for interpretability methods in deep neural networks. Advances in Neural Information Processing Systems, 2019.
|
| 239 |
+
[18] Amirata Ghorbani, Abubakar Abid, and James Zou. Interpretation of neural networks is fragile. AAAI Conference on Artificial Intelligence, 2019.
|
| 240 |
+
[19] Dylan Slack, Sophie Hilgard, Emily Jia, Sameer Singh, and Himabindu Lakkaraju. Fooling LIME and SHAP: Adversarial attacks on post hoc explanation methods. AAAI/ACM Conference on AI, Ethics, and Society, 2020.
|
| 241 |
+
[20] Ann-Kathrin Dombrowski, Maximilian Alber, Christopher Anders, Marcel Ackermann, KlausRobert Müller, and Pan Kessel. Explanations can be manipulated and geometry is to blame. Advances in Neural Information Processing Systems, 2019.
|
| 242 |
+
[21] David Alvarez-Melis and Tommi Jaakkola. On the robustness of interpretability methods. arXiv:1806.08049, 2018.
|
| 243 |
+
[22] Jessica Dai, Sohini Upadhyay, Ulrich Aivodji, Stephen Bach, and Himabindu Lakkaraju. Fairness via explanation quality: Evaluating disparities in the quality of post hoc explanations. AAAI/ACM Conference on AI, Society, and Ethics, 2022.
|
| 244 |
+
[23] Aapo Hyvärinen. Estimation of non-normalized statistical models by score matching. Journal of Machine Learning Research, 2005.
|
| 245 |
+
[24] Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. arXiv:1412.6806, 2015.
|
| 246 |
+
[25] Hyeonwoo Noh, Seunghoon Hong, and Bohyung Han. Learning deconvolution network for semantic segmentation. arXiv:1505.04366, 2015.
|
| 247 |
+
[26] Ramprasaath Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-CAM: Visual explanations from deep networks via gradient-based localization. IEEE International Conference on Computer Vision, 2017.
|
| 248 |
+
[27] Aditya Chattopadhay, Anirban Sarkar, Prantik Howlader, and Vineeth Balasubramanian. GradCAM $^ { + + }$ : Generalized gradient-based visual explanations for deep convolutional networks. IEEE Winter Conference on Applications of Computer Vision (WACV), 2018.
|
| 249 |
+
[28] Suraj Srinivas and François Fleuret. Full-gradient representation for neural network visualization. Advances in Neural Information Processing Systems, 2019.
|
| 250 |
+
[29] World Health Organization (WHO). Life expectancy dataset. Global Health Observatory Data Repository, 2018.
|
| 251 |
+
[30] FICO. Home equity line of credit (HELOC) dataset. Explainable Machine Learning Challenge, 2019.
|
| 252 |
+
[31] Narine Kokhlikyan, Vivek Miglani, Miguel Martin, Edward Wang, Bilal Alsallakh, Jonathan Reynolds, Alexander Melnikov, Natalia Kliushkina, Carlos Araya, Siqi Yan, and Orion ReblitzRichardson. Captum: A unified and generic model interpretability library for PyTorch, 2020.
|
| 253 |
+
[32] Zachary Lipton. The mythos of model interpretability: In machine learning, the concept of interpretability is both important and slippery. Queue, 2018.
|
| 254 |
+
[33] Weili Nie, Yang Zhang, and Ankit Patel. A theoretical explanation for perplexing behaviors of backpropagation-based visualizations. International Conference on Machine Learning, 2018.
|
| 255 |
+
[34] Suraj Srinivas and Francois Fleuret. Rethinking the role of gradient-based attribution methods for model interpretability. International Conference on Learning Representations, 2021.
|
| 256 |
+
[35] Sebastian Bach, Alexander Binder, Grégoire Montavon, Frederick Klauschen, Klaus-Robert Müller, and Wojciech Samek. On pixel-wise explanations for non-linear classifier decisions by layer-wise relevance propagation. PloS One, 2015.
|
| 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] See Abstract and Section §1.
|
| 263 |
+
(b) Did you describe the limitations of your work? [Yes] See Section §6.
|
| 264 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section §6.
|
| 265 |
+
|
| 266 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 267 |
+
|
| 268 |
+
2. If you are including theoretical results...
|
| 269 |
+
|
| 270 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Sections §3, §4, and Appendix.
|
| 271 |
+
(b) Did you include complete proofs of all theoretical results? [Yes] See Sections §3, §4, and Appendix.
|
| 272 |
+
|
| 273 |
+
3. If you ran experiments...
|
| 274 |
+
|
| 275 |
+
(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 include a zip file with the code in the supplementary material. The code can also be found at the following repository: https://github.com/AI4LIFE-GROUP/lfa.
|
| 276 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix.
|
| 277 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Figure 3 and Appendix.
|
| 278 |
+
(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.
|
| 279 |
+
|
| 280 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 281 |
+
|
| 282 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] See Section §5.
|
| 283 |
+
(b) Did you mention the license of the assets? [N/A]
|
| 284 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
|
| 285 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] We do not directly obtain data from individuals.
|
| 286 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] To our knowledge, the data contains no such information nor content. See Appendix.
|
| 287 |
+
|
| 288 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 289 |
+
|
| 290 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] We did not use crowdsourcing nor did we conduct research with human subjects.
|
| 291 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] We did not use crowdsourcing nor did we conduct research with human subjects.
|
| 292 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] We did not use crowdsourcing nor did we conduct research with human subjects.
|
md/dev/rY2wXCSruO/rY2wXCSruO.md
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DeepInteraction: 3D Object Detection via Modality Interaction
|
| 2 |
+
|
| 3 |
+
Zeyu Yang1 Jiaqi Chen1 Zhenwei Miao2 Wei Li3 Xiatian Zhu4 Li Zhang1∗ 1Fudan University 2Alibaba DAMO Academy $^ 3 { \cal S }$ -Lab, NTU 4University of Surrey https://github.com/fudan-zvg/DeepInteraction
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Existing top-performance 3D object detectors typically rely on the multi-modal fusion strategy. This design is however fundamentally restricted due to overlooking the modality-specific useful information and finally hampering the model performance. To address this limitation, in this work we introduce a novel modality interaction strategy where individual per-modality representations are learned and maintained throughout for enabling their unique characteristics to be exploited during object detection. To realize this proposed strategy, we design a DeepInteraction architecture characterized by a multi-modal representational interaction encoder and a multi-modal predictive interaction decoder. Experiments on the large-scale nuScenes dataset show that our proposed method surpasses all prior arts often by a large margin. Crucially, our method is ranked at the first position at the highly competitive nuScenes object detection leaderboard.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
3D object detection is critical for autonomous driving by localizing and recognizing decisionsensitive objects in a 3D world. For reliable object detection, LiDAR and camera sensors have been simultaneously deployed to provide point clouds and RGB images for more stronger perception. The two modalities exhibit naturally strong complementary effects due to their different perceiving characteristics. Point clouds offer necessary localization and geometry information at low resolution, whilst images give rich appearance information at high resolution. Therefore, information fusion across modalities becomes particularly crucial for strong 3D object detection performance.
|
| 12 |
+
|
| 13 |
+
Existing multi-modal 3D objection detection methods typically adopt a modality fusion strategy (Figure 1(a)) by combining individual per-modality representations into a single hybrid representation. For example, PointPainting [38] and its variants [39, 46, 43] aggregate category scores or semantic features from the image space into the 3D point cloud space. AutoAlign [10] and VFF [23] similarly integrate image representations into the 3D grid space. Latest alternatives [24, 30, 26] merge the image and point cloud features into a joint bird’s-eye view (BEV) representation. This fusion approach is, however, structurally restricted due to its intrinsic limitation of potentially dropping off a large fraction of modality-specific representational strengths due to largely imperfect information fusion into a unified representation.
|
| 14 |
+
|
| 15 |
+
To overcome the aforementioned limitations, in this work a novel modality interaction strategy (Figure 1(b)) for multi-modal 3D object detection is introduced. Our key idea is that, instead of deriving a fused single representation, we learn and maintain two modality-specific representations throughout to enable inter-modality interaction so that both information exchange and modalityspecific strengths can be achieved spontaneously. Our strategy is implemented by formulating a
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Schematic strategy comparison. (a) Existing multi-modality fusion based 3D detection: Fusing individual per-modality representations into a single hybrid representation and from which the detection results are further decoded. (b) Our multi-modality interaction based 3D detection: Maintaining two modality-specific representations throughout the whole pipeline with both representational interaction in the encoder and predictive interaction in the decoder.
|
| 19 |
+
|
| 20 |
+
DeepInteraction architecture. It starts by mapping 3D point clouds and 2D multi-view images into LiDAR BEV feature and image perspective feature with two separate feature backbones in parallel. Subsequently, an encoder interacts the two features for progressive information exchange and representation learning in a bilateral manner. To fully exploit per-modality representations, a decoder/head is further designed to conduct multi-modal predictive interaction in a cascaded manner.
|
| 21 |
+
|
| 22 |
+
Our contributions are summarized as follows: (i) We propose a novel modality interaction strategy for multi-modal 3D object detection, with the aim to resolve a fundamental limitation of previous modality fusion strategy in dropping the unique perception strengths per modality. (ii) To implement our proposed strategy, we formulate a DeepInteraction architecture with a multi-modal representational interaction encoder and a multi-modal predictive interaction decoder. (iii) Extensive experiments on the nuScenes dataset show that our DeepInteraction yields new state of the art for multi-modality 3D object detection and achieves the first position at the highly competitive nuScenes leaderboard.
|
| 23 |
+
|
| 24 |
+
# 2 Related work
|
| 25 |
+
|
| 26 |
+
3D object detection with single modality Automated driving vehicles are generally equipped with both LiDAR and multiple surround-view cameras. But many previous methods perform 3D object detection by exploiting data captured from only a single form of sensor. For camera-based 3D object detection, since depth information is not directly accessible from RGB images, some previous works [17, 40, 37] lift 2D features into a 3D space by conducting depth estimation, followed by performing object detection in the 3D space. Another line of works [41, 28, 25, 31, 19] resort to the detection Transformer [5] architecture. They leverage 3D object queries and 3D-2D correspondence to incorporate 3D computation into the detection pipelines. Despite the rapid progress of camerabased approaches, the state-of-the-art of 3D object detection is still dominated by LiDAR-based methods. Most of LiDAR-based detectors quantify point clouds into regular grid structures such as voxels [47, 44], pillars [22] or range images [2, 14, 6] before processing them. Due to the sampling characteristics of LiDAR, these grids are naturally sparse and hence fit the Transformer design. So a number of approaches [32, 13] have applied the Transformer for point cloud feature extraction. Differently, several methods use the Transformer decoder or its variants as their detection head [1, 42]. 3DETR [33] adopts a complete Transformer encoder-decoder architecture with less priori in design. Due to intrinsic limitations with either sensor, these methods are largely limited in performance.
|
| 27 |
+
|
| 28 |
+
Multi-modality fusion for 3D object detection Leveraging the perception data from both camera and LiDAR sensors usually leads to improved performance. This has emerged as a promising direction. Existing 3D detection methods typically perform multi-modal fusion at one of the three stages: raw input, intermediate feature, and object proposal. For example, PointPainting [38] is the pioneering input fusion method [39, 18, 46]. The main idea is to decorate the 3D point clouds with the category scores or semantic features from the 2D instance segmentation network. Whilst 4D-Net [35] placed the fusion module in the point cloud feature extractor for allowing the point cloud features to dynamically attend to the image features. ImVoteNet [36] injects visual information into a set of 3D seed points abstracted from raw point clouds. The proposal based fusion methods [21, 7] keep the feature extraction of two modalities independently and aggregate multi-modal features via proposals or queries at the detection head. The first two categories of methods take a unilateral fusion strategy with bias to 3D LiDAR modality due to the superiority of point clouds in distance and spatial perception. Instead, the last category fully ignores the intrinsic association between the two modalities in representation. As a result, all above previous methods fail to fully exploit both modalities, in particular their strong complementary nature. Besides, a couple of concurrent works have explored fusion of the two modalities in a shared representation space [30, 26]. They conduct view transformation in the same way [34] as in the camera-only approach. This design is however less effective in exploiting the spatial cues of point clouds during view transformation, potentially compromising the quality of camera BEV representation. This gives rise to an extra need of calibrating such misalignment in network capacity.
|
| 29 |
+
|
| 30 |
+

|
| 31 |
+
Figure 2: Illustration of the multi-modal representational interactions. Given two modality-specific representations, the image-to-LiDAR feature interaction (a) spread the visual signal in the image representation to the LiDAR BEV representation, and the LiDAR-to-image feature interaction $\mathbf { ( b ) }$ takes cross-modal relative contexts from LiDAR representation to enhance the image representations.
|
| 32 |
+
|
| 33 |
+
In this work, we address the aforementioned limitations in all previous solutions with a novel multi-modal interaction strategy. The key insight behind our approach is that we maintain two modality-specific feature representations and conduct representational and predictive interaction for maximally exploring their complementary benefits whilst preserving their respective strengths.
|
| 34 |
+
|
| 35 |
+
# 3 Method
|
| 36 |
+
|
| 37 |
+
We present a novel modality interaction framework, dubbed DeepInteraction, for multi-modal (3D point clouds and 2D multi-camera images) 3D object detection. In contrast to all prior arts, we learn two representations specific for 3D LiDAR and 2D image modalities respectively, whilst conducting multi-modal interaction through both model encoding and decoding. An overview of DeepInteraction is shown in Figure 1(b). It consists of two main components: An encoder with multi-modal representational interaction (Section 3.1), and a decoder with multi-modal predictive interaction (Section 3.2).
|
| 38 |
+
|
| 39 |
+
# 3.1 Encoder: Multi-modal representational interaction
|
| 40 |
+
|
| 41 |
+
Unlike conventional modality fusion strategy that often aggregates multi-modal inputs into a hybrid feature map, individual per-modality representations are learned and maintained via multi-modal representational interaction within our encoder. Specifically, our encoder is formulated as a multiinput-multi-output (MIMO) structure: Taking as input two modality-specific scene representations which are independently extracted by LiDAR and image backbones, and producing two refined representations as output. Overall, it is composed by stacking multiple encoder layers each with $( I )$ multi-modal representational interaction (MMRI), (II) intra-modal representational learning (IML), and (III) representational integration.
|
| 42 |
+
|
| 43 |
+
(I) Multi-modal representational interaction (MMRI) Each encoder layer takes the representations of two modalities, i.e., the image perspective representation $h _ { c }$ and the LiDAR BEV representation $h _ { p }$ , as input. Our multi-modal representational interaction aims to exchange the neighboring context in a bilateral cross-modal manner, as shown in Figure 2. It consists of two steps:
|
| 44 |
+
|
| 45 |
+
(i) Cross-modal correspondence mapping and sampling To define cross-modality adjacency, we first need to build the pixel-to-pixel(s) correspondence between the representations $h _ { p }$ and $h _ { c }$ . To that end, we construct dense mappings between the image coordinate frame $c$ and the BEV coordinate frame $p$ ${ \mathcal { M } } _ { p \to c }$ and $\mathcal { M } _ { c p . }$ ).
|
| 46 |
+
|
| 47 |
+
From image to LiDAR BEV coordinate frame $\mathcal { M } _ { c p } : \mathbb { R } ^ { 2 } 2 ^ { \mathbb { R } ^ { 2 } }$ (Figure 2(a)): We first project each point $( x , y , z )$ in 3D point cloud to multi-camera images to form a sparse depth map $d _ { s p a r s e }$ , followed by depth completion [20] leading to a dense depth map $d _ { d e n s e }$ . We further utilize $\pmb { d } _ { d e n s e }$ to back-project each pixel in the image space into the 3D point space. This results in the corresponding 3D coordinate the correspon $( x , y , z )$ , given an imV coordinate l . $( i , j )$ with depth denote the a $d _ { d e n s e } ^ { [ i , j ] }$ . Next, mappin $( x , y )$ $( i _ { p } , j _ { p } )$ $\dot { T } ( i , j ) = ( i _ { p } , j _ { p } )$ We obtain this correspondence via $( 2 \dot { k } + \dot { 1 } ) \times ( 2 k + 1 )$ sized neighbor sampling as $\begin{array} { r } { \mathcal { M } _ { c p } ( i , j ) = } \end{array}$ $\{ T ( i + \Delta i , j + \Delta j ) | \bar { \Delta } i$ , $\Delta j \in [ - k , + k ] \}$ .
|
| 48 |
+
|
| 49 |
+
From LiDAR BEV to image coordinate frame $\mathcal { M } _ { p c } : \mathbb { R } ^ { 2 } 2 ^ { \mathbb { R } ^ { 2 } }$ (Figure 2(b)): Given a coordinate $( i _ { p } , j _ { p } )$ in BEV, we first obtain the LiDAR points $\{ ( x , y , z ) \}$ within the pillar corresponding to $( i _ { p } , j _ { p } )$ Then we project these 3D points into camera image coordinate frame $\{ ( i , j ) \}$ according to the camera intrinsics and extrinsics. This correspondence is obtained as: $\mathcal { M } _ { p c } ( i _ { p } , j _ { p } ) = \{ ( i , j ) \}$ .
|
| 50 |
+
|
| 51 |
+
(ii) Attention-based feature interaction For an image feature point as query $\pmb q = { \pmb h } _ { c } ^ { [ i _ { c } , j _ { c } ] }$ , its crossmodality neighbors Nq, denoted as Nq = h[Mc→p(ic,jc)]p , are used as the key $\boldsymbol { k }$ and value $\textbf { { v } }$ for
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
f _ { \phi _ { c \to p } } ( \pmb { h } _ { c } , \pmb { h } _ { p } ) ^ { [ i , j ] } = \sum _ { \pmb { k } , \pmb { v } \in \mathcal { N } _ { q } } \mathrm { s o f t m a x } \left( \frac { \mathbf { q } \pmb { k } } { \sqrt { d } } \right) \pmb { v } ,
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
where $\mathbf { \delta } _ { h } [ i , j ]$ denotes indexing the element at location $( i , j )$ on the 2D representation $^ { h }$ . This is image-to-LiDAR representational interaction.
|
| 58 |
+
|
| 59 |
+
The other way around, given a LiDAR BEV feature point as query $\pmb q = { h _ { p } ^ { [ i _ { p } , j _ { p } ] } }$ , we similarly obtain its cross-modality neighbors as $\mathcal { N } _ { q } = h _ { c } ^ { [ \mathcal { M } _ { p c } ( i _ { p } , \bar { j _ { p } } ) ] }$ . The same process (Eq. (1)) is applied for realizing LiDAR-to-image representational interaction $f _ { \phi _ { p } c } ( h _ { c } , h _ { p } )$ .
|
| 60 |
+
|
| 61 |
+
${ \bf ( I I ) }$ Intra-modal representational learning (IML) Concurrently, we conduct intra-modal representational learning complementary to multi-modal interaction. The same local attention as defined in Eq. (1) is consistently applied. For either modality, we use a $k \times k$ grid neighborhood as the key and value. Formally, we denote $f _ { \phi _ { c } \to c } ( h _ { c } )$ for image representation and $f _ { \phi _ { p } p } ( h _ { p } )$ for LiDAR representation.
|
| 62 |
+
|
| 63 |
+
(III) Representational integration Each layer ends up by integrating the two outputs per modality:
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
\begin{array} { r l } & { h _ { p } ^ { \prime } = \mathrm { F F N } ( \mathrm { C o n c a t } ( \mathrm { F F N } ( \mathrm { C o n c a t } ( h _ { p } ^ { p p } , h _ { p } ^ { c p } ) ) , h _ { p } ) ) , } \\ & { h _ { c } ^ { \prime } = \mathrm { F F N } ( \mathrm { C o n c a t } ( \mathrm { F F N } ( \mathrm { C o n c a t } ( h _ { c } ^ { c c } , h _ { c } ^ { p c } ) ) , h _ { c } ) ) , } \end{array}
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+
where FFN specifies a feed-forward network, and Concat denotes element-wise concatenation.
|
| 70 |
+
|
| 71 |
+
# 3.2 Decoder: Multi-modal predictive interaction
|
| 72 |
+
|
| 73 |
+
Beyond considering the multi-modal interaction at the representation-level, we further introduce a decoder with multi-modal predictive interaction (MMPI) to maximize the complementary effects in prediction. As depicted in Figure 3(a), our core idea is to enhance the 3D object detection of one modality conditioned on the other modality. In particular, the decoder is built by stacking multiple multi-modal predictive interaction layers, within which predictive interactions are formulated in an alternative and progressive manner. Similar to the decoder of DETR [5], we cast the 3D object detection as a set prediction problem. Here, we define a set of $N$ object queries $\{ Q _ { n } \} _ { n = 1 } ^ { N }$ and the resulting $N$ object predictions $\{ ( b _ { n } , c _ { n } ) \} _ { n = 1 } ^ { N }$ , where $b _ { n }$ and $c _ { n }$ denote the predicted bounding box and category for the -th prediction.
|
| 74 |
+
|
| 75 |
+

|
| 76 |
+
Figure 3: Illustration of our multi-modal predictive interaction. Our predictive interaction decoder (a) generates predictions via (b) progressively interacting with two modality-specific representations.
|
| 77 |
+
|
| 78 |
+
Multi-modal predictive interaction layer (MMPI) For the $l$ -th decoding layer, the set prediction is computed by taking the object queries nQ(l−1)n oNn and the bounding box predictions $\left\{ \begin{array} { l l } { \mathbf { \bar { \phi } } _ { b _ { n } ^ { ( l - 1 ) } } \mathbf { \Phi } _ { \left\{ \begin{array} { l l } { \mathbf { \bar { \phi } } _ { n = 1 } } \end{array} \right. } } N \end{array} \right.$ =1from previous layer as inputs and enabling interaction with the intensified image $h _ { p } ^ { \prime }$ nor LiDAR $ { \boldsymbol { h } } _ { c } ^ { \prime }$ representations ${ \mathbf { } } ^ { \prime } { }$ if $l$ is odd, $h _ { p } ^ { \prime }$ if $l$ is even). We formulate the multi-modal predictive interaction layer (Figure 3(b)) for specific modality as follows:
|
| 79 |
+
|
| 80 |
+
(I) Multi-modal predictive interaction on image representation (MMPI-image) Taking as input 3D object proposals nb(l−1)n oNn= 1 and object queries nQ(l−1)n oNn=1 generated by the previous layer, this layer leverages the image representation $\pmb { h } _ { c } ^ { \prime }$ for further prediction refinement. To integrate the previous predictions nb(l−1)n oNn= , we first extract $N$ Region of Interest (RoI) [15] features $\left\{ R _ { n } \right\} _ { n = 1 } ^ { N }$ from the image representation $ { \boldsymbol { h } } _ { c } ^ { \prime }$ , where $\pmb { R } _ { n } \in \mathbb { R } ^ { S \times S \times C }$ is the extracted RoI feature for the $n$ -th query, $( S \times \bar { S } )$ is RoI size, and $C$ is the number of channels of RoI features. Specifically, for each 3D bounding box, we project it onto image representation $\pmb { h } _ { c } ^ { \prime }$ to get the 2D convex polygon and take the minimum axis-aligned circumscribed rectangle. We then design a multi-modal predictive interaction operator that map s nQ(l−1)n oN into the parameters of a series of $1 \times 1$ convolutions and then applies them consecutively to $\{ R _ { n } \} _ { n = 1 } ^ { N }$ ; The resulted interactive representation is further used to obtain the updated object query $\left\{ Q _ { n } ^ { l } \right\} _ { n = 1 } ^ { N }$ .
|
| 81 |
+
|
| 82 |
+
$\mathbf { \Pi } ^ { ( \mathbf { I I } ) }$ Multi-modal predictive interaction on LiDAR representation (MMPI-LiDAR) This layer shares the same design as the above except that it takes as input LiDAR representation instead. With regards to the RoI for LiDAR representation, we project the 3D bounding boxes from previous layer to the LiDAR BEV representation $h _ { p } ^ { \prime }$ and take the minimum axis-aligned rectangle. It is worth mentioning that due to the scale of objects in autonomous driving scenarios is usually tiny in the BEV coordinate frame, we enlarge the scale of the 3D bounding box by 2 times. The shape of RoI features cropped from the LiDAR BEV representation $h _ { p } ^ { \prime }$ is also set to be $S \times S \times C$ . Here $C$ is the $C$ is the number of channels of RoI features as well as the height of BEV representation. The multi-modal predictive interaction layer on LiDAR representation is stacked on the above image counterpart.
|
| 83 |
+
|
| 84 |
+
For object detection, a feed-forward network is appended on the $\left\{ Q _ { n } ^ { l } \right\} _ { n = 1 } ^ { N }$ for each multi-modal predictive interaction layer to infer the locations, dimensions, orientations and velocities. During training, the matching cost and loss function as [1] are applied.
|
| 85 |
+
|
| 86 |
+
# 4 Experiments
|
| 87 |
+
|
| 88 |
+
# 4.1 Experimental setup
|
| 89 |
+
|
| 90 |
+
Dataset We evaluate our approach on the nuScenes dataset [3]. It provides point clouds from 32-beam LiDAR and images with a resolution of $1 6 0 0 \times 9 0 0$ from 6 surrounding cameras. The total of 1000 scenes, where each sequence is roughly 20 seconds long and annotated every 0.5 second, is officially split into train/val/test set with 700/150/150 scenes. For the 3D object detection task, 1.4M objects in scenes are annotated with 3D bounding boxes and classified into 10 categories: car, truck, bus, trailer, construction vehicle, pedestrian, motorcycle, bicycle, barrier, and traffic cone.
|
| 91 |
+
|
| 92 |
+
Table 1: Comparison with state-of-the-art methods on the nuScenes test set. Metrics: $\mathrm { m A P ( \% ) }$ , $\mathrm { N D S } ( \% )$ . ‘L’ and $\cdot _ { \mathrm { { C } } } ,$ represent LiDAR and camera, respectively. $^ \dagger$ denotes test-time augmentation is used. $\ S$ denotes that test-time augmentation and model ensemble both are applied for testing.
|
| 93 |
+
|
| 94 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Modality</td><td colspan="2">Backbones</td><td colspan="2">validation</td><td colspan="2">test</td></tr><tr><td>Image</td><td>LiDAR</td><td>mAP↑</td><td>NDS↑</td><td>mAP个</td><td>NDS↑</td></tr><tr><td>BEVDet4D[17]</td><td>C</td><td>Swin-Base</td><td>1</td><td>42.1</td><td>54.5</td><td>45.1</td><td>56.9</td></tr><tr><td>BEVFormer [25]</td><td>C</td><td>V99</td><td></td><td>-</td><td>-</td><td>48.1</td><td>56.9</td></tr><tr><td>Ego3RT [31]</td><td>C</td><td>V99</td><td></td><td>47.8</td><td>53.4</td><td>42.5</td><td>47.9</td></tr><tr><td>PolarFormer [19]</td><td>C</td><td>V99</td><td>-</td><td>50.0</td><td>56.2</td><td>49.3</td><td>57.2</td></tr><tr><td>CenterPoint [45]</td><td>L</td><td>:</td><td>VoxelNet</td><td>59.6</td><td>66.8</td><td>60.3</td><td>67.3</td></tr><tr><td>Focals Conv [8]</td><td>L</td><td>1</td><td>VoxelNet-FocalsConv</td><td>61.2</td><td>68.1</td><td>63.8</td><td>70.0</td></tr><tr><td>Transfusion-L [1]</td><td>L</td><td>-</td><td>VoxelNet</td><td>65.1</td><td>70.1</td><td>65.5</td><td>70.2</td></tr><tr><td>LargeKernel3D [9]</td><td>L</td><td>1</td><td>VoxelNet-LargeKernel3D</td><td>63.3</td><td>69.1</td><td>65.3</td><td>70.5</td></tr><tr><td>FUTR3D [7]</td><td>L+C</td><td>R101</td><td>VoxelNet</td><td>64.5</td><td>68.3</td><td>-</td><td>1</td></tr><tr><td>PointAugmenting [39]t</td><td>L+C</td><td>DLA34</td><td>VoxelNet</td><td>1</td><td>1</td><td>66.8</td><td>71.0</td></tr><tr><td>MVP [46]</td><td>L+C</td><td>DLA34</td><td>VoxelNet</td><td>67.1</td><td>70.8</td><td>66.4</td><td>70.5</td></tr><tr><td>AutoAlignV2 [10]</td><td>L+C</td><td>CSPNet</td><td>VoxelNet</td><td>67.1</td><td>71.2</td><td>68.4</td><td>72.4</td></tr><tr><td>TransFusion [1]</td><td>L+C</td><td>R50</td><td>VoxelNet</td><td>67.5</td><td>71.3</td><td>68.9</td><td>71.6</td></tr><tr><td>BEVFusion [26]</td><td>L+C</td><td>Swin-Tiny</td><td>VoxelNet</td><td>67.9</td><td>71.0</td><td>69.2</td><td>71.8</td></tr><tr><td>BEVFusion [30]</td><td>L+C</td><td>Swin-Tiny</td><td>VoxelNet</td><td>68.5</td><td>71.4</td><td>70.2</td><td>72.9</td></tr><tr><td> DeepInteraction-base</td><td>L+C</td><td>R50</td><td>VoxelNet</td><td> 69.9</td><td>72.6</td><td>70.8</td><td>73.4</td></tr><tr><td>Focals Conv-F [8]t</td><td>L+C</td><td>R50</td><td>VoxelNet-FocalsConv</td><td>67.1</td><td>71.5</td><td>70.1</td><td>73.6</td></tr><tr><td>LargeKernel3D-F [9]t</td><td>L+C</td><td>R50</td><td>VoxelNet-LargeKernel</td><td>-</td><td>1</td><td>71.1</td><td>74.2</td></tr><tr><td> DeepInteraction-large†</td><td>L+C</td><td> Swin-Tiny</td><td>VoxelNet</td><td>72.6</td><td> 74.4</td><td>74.1</td><td>75.5</td></tr><tr><td>BEVFusion-e [30]8</td><td>L+C</td><td>Swin-Tiny</td><td>VoxelNet</td><td>73.7</td><td>74.9</td><td>75.0</td><td>76.1</td></tr><tr><td> DeepInteraction-eS</td><td>L+C</td><td> Swin-Tiny</td><td>VoxelNet</td><td>73.9</td><td>75.0</td><td>75.6</td><td>76.3</td></tr></table>
|
| 95 |
+
|
| 96 |
+
Metric Mean average precision (mAP) [12] and nuScenes detection score (NDS) [3] are used as the evaluation metric of 3D detection performance. The final mAP is computed by averaging over the distance thresholds of $0 . 5 \mathrm { m }$ , 1m, 2m, 4m across 10 classes. NDS is a weighted average of mAP and other attribute metrics, including translation, scale, orientation, velocity, and other box attributes.
|
| 97 |
+
|
| 98 |
+
# 4.2 Implementation details
|
| 99 |
+
|
| 100 |
+
Our implementation is based on the public code base mmdetection3d [11]. For the image branch backbone, we use a simple ResNet-50 [16] and initialize it from the instance segmentation model Cascade Mask $R$ -CNN [4] pretrained on COCO [27] and then nuImage [3], which is same as Transfusion [1]. To save the computation cost, we rescale the input image to 1/2 of its original size before feeding into the network, and freeze the weights of image branch during training. The voxel size is set to $( 0 . 0 7 5 m , 0 . 0 7 5 m , 0 . 2 m )$ , and the detection range is set to $[ - 5 4 m , 5 4 m ]$ for $X$ and $Y$ axis and $[ - 5 m , 3 m ]$ for $Z$ axis. The representational interaction encoder is composed by stacking two representational interaction layers. For the multi-modal predictive interaction decoder, we use 5 cascaded decoder layers. We set the query number to 200 for training and testing and use the same query initialization method as Transfusion [1]. The above configuration is termed DeepInteraction-base.
|
| 101 |
+
|
| 102 |
+
We also adopt another two widely used settings for online submission, i.e., test-time augmentation (TTA) and model ensemble. In the following, we refer to the two settings as DeepInteraction-large and DeepInteraction- $\ominus$ respectively. In particular, DeepInteraction-large uses Swin-Tiny [29] as image backbone, and doubles the number of channel for each convolution block in LiDAR backbone. The voxel size of DeepInteraction-large is set to $[ 0 . 5 m , 0 . 5 m , 0 . 2 m ]$ . Following the common practice, we use double flipping and rotation with yaw angles $[ 0 ^ { \circ } , \pm 6 . 2 5 ^ { \circ } , \pm 1 2 . 5 ^ { \circ } ]$ for test-time augmentation. DeepInteraction-e ensembles multiple DeepInteraction-large models with input LiDAR BEV grid size between $[ 0 . 5 m , 0 . 5 m ]$ and $[ 1 . 5 m , 1 . 5 m ]$ .
|
| 103 |
+
|
| 104 |
+

|
| 105 |
+
Figure 4: Qualitative results on nuScenes val set. In LiDAR BEV (right), green boxes are the ground-truth and blue boxes are the predictions. Best viewed when zooming in.
|
| 106 |
+
|
| 107 |
+
For data augmentation, following TransFusion [1] we adopt random rotation with a range of $r \in$ $[ - \pi / 4 , \pi / 4 ]$ , random scaling with a factor of $r ~ \in ~ [ 0 . 9 , 1 . 1 ]$ , random translation with standard deviation 0.5 in three axis, and random horizontal flipping. We also use the class-balanced resampling in CBGS [48] to balance the class distribution for nuScenes. Following [1], we adopt a two stage training recipe. We take TransFusion-L [1] as our LiDAR-only baseline. We use Adam optimizer with one-cycle learning rate policy, with max learning rate $1 \times \mathrm { { 1 0 ^ { - 3 } } }$ , weight decay 0.01 and momentum 0.85 to 0.95, following CBGS [48]. Our LiDAR-only baseline is trained for 20 epochs and LiDAR-image fusion for 6 epochs with batch size of 16 using 8 NVIDIA V100 GPUs.
|
| 108 |
+
|
| 109 |
+
# 4.3 Comparison to the state of the art
|
| 110 |
+
|
| 111 |
+
Performance We compare with state-of-the-art alternatives on the nuScenes test set. As shown in Table 1, DeepInteraction achieves new state-of-the-art performance under all settings. The base variant without TTA and model ensemble, DeepInteraction-base, with a simple ResNet-50 image backbone, surpasses all the prior arts as well as the concurrent work BEVFusion [30] even with a Swin-Tiny image backbone. DeepInteraction-large beats the closest rival LargeKernel3DF [9] with the same TTA and test time augmentation (single model) by a considerable margin. Our ensemble version DeepInteraction-e achieves the first rank among all the solutions on the nuScenes leaderboard. These results verify the performance advantages of our multi-modal interaction approach. Per-category results are shown in Appendix A.1. Qualitative results are provided in Figure 4 and Appendix A.4.
|
| 112 |
+
|
| 113 |
+
Run time We compare inference speed tested on NVIDIA V100, A6000 GPUs and A100 separately. As shown in Table 2, our method achieves the best performance while running faster than alternative painting-based [39] and query-based [7] fusion approaches. This validates superior trade-off between detection performance and inference speed achieved by our method. As found in [39], feature extraction for multi-view high resolution camera images contributes the most of overall latency in a multi-modal 3D detector. Indeed, from Table 3(c) we observe that increasing the number of decoder layers only brings negligible extra latency, which concurs with the same conclusion.
|
| 114 |
+
|
| 115 |
+
# 4.4 Ablations on the decoder
|
| 116 |
+
|
| 117 |
+
Multi-modal predictive interaction layer vs. DETR [5] decoder layer In Table 3(a) we evaluate the design of decoder layer by comparing our multi-modal predictive interaction (MMPI) with DETR [5] decoder layer. Note the DETR decoder layer means the conventional Transformer deocder layer is used to aggregate multi-modal information same as in Transfusion [1]. We further test a mixing design: using vanilla DETR decoder layer for aggregating features in LiDAR representation and our MMPI for aggregating features in image representation (second row). It is evident that MMPI
|
| 118 |
+
|
| 119 |
+
Table 2: Run time comparison. If not specified, the performance and efficiency are evaluated on the nuScenes val set.
|
| 120 |
+
|
| 121 |
+
<table><tr><td>Method</td><td>mAP(%)↑</td><td>NDS(%)↑</td><td>FPS(A100)↑</td><td>FPS(A6000)↑</td><td>FPS(V100)↑</td></tr><tr><td>PointAugmenting [39]</td><td>66.8 (Test)</td><td>71.0 (Test)</td><td>1.4</td><td>2.8</td><td>2.3</td></tr><tr><td>FUTR3D[7]</td><td>64.2</td><td>68.0</td><td>4.5</td><td>2.3</td><td>1.8</td></tr><tr><td>Transfusion [1]</td><td>67.5</td><td>71.3</td><td>6.2</td><td>5.5</td><td>3.8</td></tr><tr><td> DeepInteraction</td><td> 69.9</td><td>72.6</td><td>4.9</td><td>3.1</td><td>2.6</td></tr></table>
|
| 122 |
+
|
| 123 |
+
Table 3: Ablation studies on the decoder. The mAP and NDS are evaluated on the nuScenes val set.
|
| 124 |
+
|
| 125 |
+
<table><tr><td>LiDAR</td><td>Image</td><td>mAP</td><td>NDS</td></tr><tr><td>DETR [5]</td><td>DETR [5]</td><td>68.6</td><td rowspan="4">71.6 72.1</td></tr><tr><td>DETR [5]</td><td>MMPI</td><td>69.3</td></tr><tr><td>MMPI</td><td>MMPI</td><td>69.9 72.6</td></tr></table>
|
| 126 |
+
|
| 127 |
+
(a) The type of decoder layer.
|
| 128 |
+
|
| 129 |
+
<table><tr><td>Modality</td><td>mAP</td><td>NDS</td></tr><tr><td>Fully LiDAR</td><td>69.2</td><td>72.2</td></tr><tr><td>LiDAR-image alternating</td><td>69.9</td><td>72.6</td></tr></table>
|
| 130 |
+
|
| 131 |
+
(b) Single vs. multiple representations.
|
| 132 |
+
|
| 133 |
+
<table><tr><td rowspan=1 colspan=2>#of decoder layers</td><td rowspan=1 colspan=1>mAPNDS</td><td rowspan=1 colspan=1>FPS↑</td></tr><tr><td rowspan=2 colspan=2>1 (LiDAR-only)23</td><td rowspan=2 colspan=1>65.1 70.169.5 72.3</td><td rowspan=1 colspan=1>8.7</td></tr><tr><td rowspan=2 colspan=2>234</td><td rowspan=2 colspan=1>69.5 72.369.7 72.569.8 72.5</td><td rowspan=1 colspan=1>2.8</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.72.7</td></tr><tr><td rowspan=1 colspan=2>5</td><td rowspan=1 colspan=1>69.9 72.6</td><td rowspan=1 colspan=1>2.6</td></tr><tr><td rowspan=1 colspan=2>6</td><td rowspan=1 colspan=1>69.7 72.1</td><td rowspan=1 colspan=1>2.5</td></tr></table>
|
| 134 |
+
|
| 135 |
+
(c) The number of decoder layers.
|
| 136 |
+
|
| 137 |
+
<table><tr><td>Train</td><td>Inference</td><td>mAP</td><td>NDS</td></tr><tr><td></td><td>200</td><td>69.9</td><td>72.6</td></tr><tr><td>200</td><td>300</td><td>70.1</td><td>72.7</td></tr><tr><td></td><td>400</td><td>70.0</td><td>72.6</td></tr><tr><td rowspan="3">300</td><td>200</td><td>69.7</td><td>72.5</td></tr><tr><td>300</td><td>69.9</td><td>72.6</td></tr><tr><td>400</td><td>70.0</td><td>72.6</td></tr></table>
|
| 138 |
+
|
| 139 |
+
(d) The number of queries.
|
| 140 |
+
|
| 141 |
+
is significantly superior over DETR by improving $1 . 3 \%$ mAP and $1 . 0 \%$ NDS, with combinational flexibility in design.
|
| 142 |
+
|
| 143 |
+
How many representations/modalities? In Table 3(b), we evaluate the effect of using different numbers of representations/modalities in decoding. We compare our MMPI using both representations in an alternating manner with a variant using LiDAR representation in all decoder layers. It is observed that using both representations is beneficial, verifying our design consideration.
|
| 144 |
+
|
| 145 |
+
Number of decoder layers As shown in Table 3(c), increasing the number of decoder layers up to 5 layers can consistently improve the performance whilst introducing negligible latency. LiDAR-only denotes the Transfusion-L [1] baseline.
|
| 146 |
+
|
| 147 |
+
Number of queries Since our query embeddings are initialized in a non-parametric and inputdependent manner as in [1], the number of queries are adjustable during inference. In Table 3(d), we evaluate different combinations of query numbers for training and test. Overall, the performance is stable over different choices with 200/300 for training/test as the best setting.
|
| 148 |
+
|
| 149 |
+
# 4.5 Ablations on the encoder
|
| 150 |
+
|
| 151 |
+
Multi-modal representational interaction vs. fusion To precisely demonstrate the superiority of our multi-modal representational interaction, we compare a naive version of our DeepInteraction with conventional representational fusion strategy as presented in Transfusion [1]. We limit our DeepInteraction using the same number of encoder and decoder layers as [1] for a fair comparison. Table 4(c) shows that our representational interaction is clearly more effective.
|
| 152 |
+
|
| 153 |
+
Encoder design We ablate the design of our encoder with focus on multi-modal representational interaction (MMRI) and intra-modal representational learning (IML). We have a couple of observations from Table 4(a): (1) Our MMRI can significantly improve the performance over IML; (2) MMRI and IML can work well together for further performance gain. As seen from Table 4(b), stacking our encoder layers for iterative MMRI is beneficial.
|
| 154 |
+
|
| 155 |
+

|
| 156 |
+
Figure 5: Illustrations of the heatmaps predicted from BEV representations before and after representational interactions. All samples are from the nuScenes val split. (a) A case of the occluded tiny object. (b) A case of small object at long distance. (c) An example of two adjacent barriers which are connected together in LiDAR point clouds and thus it is difficult to have their instance-level understanding without the help of visual clues.
|
| 157 |
+
(c) Our representational interaction vs. conventional representational fusion (e.g., Transfusion [1]).
|
| 158 |
+
|
| 159 |
+
Qualitative results of representational interaction To gain more insight about the effect of our multi-modal representational interaction (MMRI), we visualize the heatmaps of challenging cases. We observe from Figure 5 that without the assistance of MMRI, some objects cannot be detected when using LiDAR only (the middle column). The locations of these objects are highlighted by red circles in the heatmap and white bounding boxes in the RGB image below.
|
| 160 |
+
|
| 161 |
+
Table 4: Ablation studies on the representational interaction encoder. The mAP and NDS are evaluated on the nuScenes val set.
|
| 162 |
+
|
| 163 |
+
<table><tr><td>IML</td><td>MMRI</td><td>mAP</td><td>NDS</td></tr><tr><td>√</td><td></td><td>68.1</td><td>71.9</td></tr><tr><td>厂</td><td>√</td><td>69.5</td><td>72.5</td></tr><tr><td></td><td>5</td><td>69.9</td><td>72.6</td></tr></table>
|
| 164 |
+
|
| 165 |
+
(a) Encoder design. IML: Intra-modal learning; MMRI: Multi-modal representational interaction.
|
| 166 |
+
|
| 167 |
+
<table><tr><td># of encoder layers</td><td>mAP</td><td>NDS</td></tr><tr><td>w/o</td><td>66.4</td><td>70.7</td></tr><tr><td>1</td><td>67.7</td><td>71.2</td></tr><tr><td>2</td><td>69.9</td><td>72.6</td></tr></table>
|
| 168 |
+
|
| 169 |
+
(b) The number of encoder layers.
|
| 170 |
+
|
| 171 |
+
<table><tr><td>Method</td><td>mAP</td><td>NDS</td></tr><tr><td>Representational fusion</td><td>67.5</td><td>71.3</td></tr><tr><td>Representational interaction (Ours)</td><td>68.7</td><td>71.9</td></tr></table>
|
| 172 |
+
|
| 173 |
+
Table 5: Evaluation on different LiDAR backbones. The mAP and NDS are evaluated on the nuScenes val set.
|
| 174 |
+
|
| 175 |
+
<table><tr><td>Methods</td><td>Modility</td><td>mAP</td><td>NDS</td></tr><tr><td>PointPillars [22] +Transfusion-L[1] +Transfusion [1]</td><td>L L L+C</td><td>46.2 54.5 58.3</td><td>59.1 62.7 64.5</td></tr><tr><td>+DeepInteraction</td><td>L+C</td><td>60.0</td><td>65.6</td></tr></table>
|
| 176 |
+
|
| 177 |
+
(a) Comparison between pillar-based methods.
|
| 178 |
+
|
| 179 |
+
<table><tr><td rowspan=1 colspan=1>Methods</td><td rowspan=1 colspan=1>Modility</td><td rowspan=1 colspan=1>mAP NDS</td></tr><tr><td rowspan=1 colspan=1>VoxelNet [47]+Transfusion-L[1]+Transfusion [1]</td><td rowspan=1 colspan=1>LLL+C</td><td rowspan=1 colspan=1>52.6 63.065.1 70.167.5 71.3</td></tr><tr><td rowspan=1 colspan=1>+DeepInteraction</td><td rowspan=1 colspan=1>L+C</td><td rowspan=1 colspan=1>69.9 72.6</td></tr></table>
|
| 180 |
+
|
| 181 |
+
(b) Comparison between voxel-based methods.
|
| 182 |
+
|
| 183 |
+
Table 6: Comparison with the LiDAR-only baseline Transfusion-L [1] on nuScenes val split.
|
| 184 |
+
|
| 185 |
+
<table><tr><td>Method</td><td>mAP</td><td>NDS</td><td>Car</td><td>Truck</td><td>C.V.</td><td>Bus</td><td>T.L.</td><td>B.R.</td><td>M.T.</td><td>Bike</td><td>Ped.</td><td>T.C.</td></tr><tr><td>Transfusion-L [1]</td><td>65.1</td><td>70.1</td><td>86.5</td><td>59.6</td><td>25.4</td><td>74.4</td><td>42.2</td><td>74.1</td><td>72.1</td><td>56.0</td><td>86.6</td><td>74.1</td></tr><tr><td> DeepInteraction</td><td> 69.9</td><td>72.6</td><td>88.5</td><td> 64.4</td><td>30.1</td><td>79.2</td><td> 44.6</td><td>76.4</td><td>79.0</td><td> 67.8</td><td>88.9</td><td>80.0</td></tr></table>
|
| 186 |
+
|
| 187 |
+
Concretely, the sample (a) suggests that camera information is helpful to recover partially obscured tiny objects with sparse observation in the point cloud. The sample (b) shows a representative case where some distant objects can be recognized successfully due to the help of visual information. From the sample (c), we observe that the centers of some barriers yield a more distinct activation in the heatmap after representational interaction. This is probably due to that it is too difficult to locate the boundaries of several consecutive barriers from LiDAR point clouds only.
|
| 188 |
+
|
| 189 |
+
# 4.6 Ablation on LiDAR backbones
|
| 190 |
+
|
| 191 |
+
We examine the generality of our framework with two different LiDAR backbones: PointPillars [22] and VoxelNet [47]. For PointPillars, we set the voxel size to $( 0 . 2 \mathrm { m } , \ 0 . 2 \mathrm { m } )$ while keeping the remaining settings same as DeepInteraction-base. For fair comparison, we use the same number of queries as TransFusion [1]. As shown in Table 5, due to the proposed multi-modal interaction strategy, DeepInteraction exhibits consistent improvements over LiDAR-only baseline using either backbone (by $5 . 5 \%$ mAP for voxel-based backbone, and $4 . 4 \%$ mAP for pillar-based backbone). This manifests the generality of our DeepInteraction across varying point cloud encoder.
|
| 192 |
+
|
| 193 |
+
# 4.7 Performance breakdown
|
| 194 |
+
|
| 195 |
+
To demonstrate more fine-grained performance analysis, we compare our DeepInteraction and our LiDAR-only baseline Transfusion [1] at the category level in terms of mAP on nuScenes val set. We can see from Table 6 that our fusion approach achieves remarkable improvements on all the categories, especially on tiny or rare object categories $+ 1 1 . 8 \%$ mAP for bicycle, $+ 6 . 9 \%$ mAP for motorcycle, and $+ 5 . 9 \%$ mAP for traffic cone).
|
| 196 |
+
|
| 197 |
+
# 5 Conclusion
|
| 198 |
+
|
| 199 |
+
In this work, we have presented a novel 3D object detection method DeepInteraction for exploring the intrinsic multi-modal complementary nature. This key idea is to maintain two modality-specific representations and establish interactions between them for both representation learning and predictive decoding. This strategy is designed particularly to resolve the fundamental limitation of existing unilateral fusion approaches that image representation are insufficiently exploited due to their auxiliary-source role treatment. Extensive experiments demonstrate our proposed DeepInteraction yields new state of the art on the nuScenes benchmark dataset and achieves the first position at the highly competitive nuScenes 3D object detection leaderboard.
|
| 200 |
+
|
| 201 |
+
Acknowledgement This work was supported in part by National Natural Science Foundation of China (Grant No. 6210020439), Lingang Laboratory (Grant No. LG-QS-202202-07), Natural Science Foundation of Shanghai (Grant No. 22ZR1407500), Science and Technology Innovation 2030 - Brain Science and Brain-Inspired Intelligence Project (Grant No. 2021ZD0200204) and Shanghai Municipal Science and Technology Major Project (Grant No. 2018SHZDZX01).
|
| 202 |
+
|
| 203 |
+
References
|
| 204 |
+
[1] Xuyang Bai, Zeyu Hu, Xinge Zhu, Qingqiu Huang, Yilun Chen, Hongbo Fu, and Chiew-Lan Tai. Transfusion: Robust lidar-camera fusion for 3d object detection with transformers. In CVPR, 2022. 2, 5, 6, 7, 8, 9, 10
|
| 205 |
+
[2] Alex Bewley, Pei Sun, Thomas Mensink, Dragomir Anguelov, and Cristian Sminchisescu. Range conditioned dilated convolutions for scale invariant 3d object detection. arXiv preprint, 2020. 2
|
| 206 |
+
[3] Holger Caesar, Varun Bankiti, Alex H Lang, Sourabh Vora, Venice Erin Liong, Qiang Xu, Anush Krishnan, Yu Pan, Giancarlo Baldan, and Oscar Beijbom. nuscenes: A multimodal dataset for autonomous driving. In CVPR, 2020. 5, 6
|
| 207 |
+
[4] Zhaowei Cai and Nuno Vasconcelos. Cascade r-cnn: high quality object detection and instance segmentation. IEEE TPAMI, 2019. 6
|
| 208 |
+
[5] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, 2020. 2, 4, 7, 8
|
| 209 |
+
[6] Yuning Chai, Pei Sun, Jiquan Ngiam, Weiyue Wang, Benjamin Caine, Vijay Vasudevan, Xiao Zhang, and Drago Anguelov. To the point: Efficient 3d object detection in the range image with graph convolution kernels. In CVPR, 2021. 2
|
| 210 |
+
[7] Xuanyao Chen, Tianyuan Zhang, Yue Wang, Yilun Wang, and Hang Zhao. Futr3d: A unified sensor fusion framework for 3d detection. arXiv preprint, 2022. 2, 6, 7, 8
|
| 211 |
+
[8] Yukang Chen, Yanwei Li, Xiangyu Zhang, Jian Sun, and Jiaya Jia. Focal sparse convolutional networks for 3d object detection. arXiv preprint, 2022. 6
|
| 212 |
+
[9] Yukang Chen, Jianhui Liu, Xiaojuan Qi, Xiangyu Zhang, Jian Sun, and Jiaya Jia. Scaling up kernels in 3d cnns. arXiv preprint, 2022. 6, 7
|
| 213 |
+
[10] Zehui Chen, Zhenyu Li, Shiquan Zhang, Liangji Fang, Qinghong Jiang, Feng Zhao, Bolei Zhou, and Hang Zhao. Autoalign: Pixel-instance feature aggregation for multi-modal 3d object detection. arXiv preprint, 2022. 1, 6
|
| 214 |
+
[11] MMDetection3D Contributors. MMDetection3D: OpenMMLab next-generation platform for general 3D object detection. https://github.com/open-mmlab/mmdetection3d, 2020. 6
|
| 215 |
+
[12] Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes (voc) challenge. IJCV, 2010. 6
|
| 216 |
+
[13] Lue Fan, Ziqi Pang, Tianyuan Zhang, Yu-Xiong Wang, Hang Zhao, Feng Wang, Naiyan Wang, and Zhaoxiang Zhang. Embracing single stride 3d object detector with sparse transformer. arXiv preprint, 2021. 2
|
| 217 |
+
[14] Lue Fan, Xuan Xiong, Feng Wang, Naiyan Wang, and ZhaoXiang Zhang. Rangedet: In defense of range view for lidar-based 3d object detection. In ICCV, 2021. 2
|
| 218 |
+
[15] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In ICCV, 2017. 5
|
| 219 |
+
[16] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. 6
|
| 220 |
+
[17] Junjie Huang, Guan Huang, Zheng Zhu, and Dalong Du. Bevdet: High-performance multicamera 3d object detection in bird-eye-view. arXiv preprint, 2021. 2, 6
|
| 221 |
+
[18] Tengteng Huang, Zhe Liu, Xiwu Chen, and Xiang Bai. Epnet: Enhancing point features with image semantics for 3d object detection. In ECCV, 2020. 2
|
| 222 |
+
[19] Yanqin Jiang, Li Zhang, Zhenwei Miao, Xiatian Zhu, Jin Gao, Weiming Hu, and Yu-Gang Jiang. Polarformer: Multi-camera 3d object detection with polar transformers. arXiv preprint, 2022. 2, 6
|
| 223 |
+
[20] Jason Ku, Ali Harakeh, and Steven L Waslander. In defense of classical image processing: Fast depth completion on the cpu. In CRV, 2018. 4
|
| 224 |
+
[21] Jason Ku, Melissa Mozifian, Jungwook Lee, Ali Harakeh, and Steven L Waslander. Joint 3d proposal generation and object detection from view aggregation. In IROS, 2018. 2
|
| 225 |
+
[22] Alex H Lang, Sourabh Vora, Holger Caesar, Lubing Zhou, Jiong Yang, and Oscar Beijbom. Pointpillars: Fast encoders for object detection from point clouds. In CVPR, 2019. 2, 10
|
| 226 |
+
[23] Yanwei Li, Xiaojuan Qi, Yukang Chen, Liwei Wang, Zeming Li, Jian Sun, and Jiaya Jia. Voxel field fusion for 3d object detection. In CVPR, 2022. 1
|
| 227 |
+
[24] Yingwei Li, Adams Wei Yu, Tianjian Meng, Ben Caine, Jiquan Ngiam, Daiyi Peng, Junyang Shen, Bo Wu, Yifeng Lu, Denny Zhou, et al. Deepfusion: Lidar-camera deep fusion for multi-modal 3d object detection. arXiv preprint, 2022. 1
|
| 228 |
+
[25] Zhiqi Li, Wenhai Wang, Hongyang Li, Enze Xie, Chonghao Sima, Tong Lu, Qiao Yu, and Jifeng Dai. Bevformer: Learning bird’s-eye-view representation from multi-camera images via spatiotemporal transformers. arXiv preprint, 2022. 2, 6
|
| 229 |
+
[26] Tingting Liang, Hongwei Xie, Kaicheng Yu, Zhongyu Xia, Zhiwei Lin, Yongtao Wang, Tao Tang, Bing Wang, and Zhi Tang. BEVFusion: A Simple and Robust LiDAR-Camera Fusion Framework. arXiv preprint, 2022. 1, 3, 6
|
| 230 |
+
[27] T. Y. Lin, M. Maire, S. Belongie, J. Hays, and C. L. Zitnick. Microsoft coco: Common objects in context. In ECCV, 2014. 6
|
| 231 |
+
[28] Yingfei Liu, Tiancai Wang, Xiangyu Zhang, and Jian Sun. Petr: Position embedding transformation for multi-view 3d object detection. arXiv preprint, 2022. 2
|
| 232 |
+
[29] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In ICCV, 2021. 6
|
| 233 |
+
[30] Zhijian Liu, Haotian Tang, Alexander Amini, Xingyu Yang, Huizi Mao, Daniela Rus, and Song Han. Bevfusion: Multi-task multi-sensor fusion with unified bird’s-eye view representation. arXiv preprint, 2022. 1, 3, 6, 7
|
| 234 |
+
[31] Jiachen Lu, Zheyuan Zhou, Xiatian Zhu, Hang Xu, and Li Zhang. Learning ego 3d representation as ray tracing. In ECCV, 2022. 2, 6
|
| 235 |
+
[32] Jiageng Mao, Yujing Xue, Minzhe Niu, Haoyue Bai, Jiashi Feng, Xiaodan Liang, Hang Xu, and Chunjing Xu. Voxel transformer for 3d object detection. In CVPR, 2021. 2
|
| 236 |
+
[33] Ishan Misra, Rohit Girdhar, and Armand Joulin. An End-to-End Transformer Model for 3D Object Detection. In ICCV, 2021. 2
|
| 237 |
+
[34] Jonah Philion and Sanja Fidler. Lift, splat, shoot: Encoding images from arbitrary camera rigs by implicitly unprojecting to 3d. In ECCV, 2020. 3
|
| 238 |
+
[35] AJ Piergiovanni, Vincent Casser, Michael S Ryoo, and Anelia Angelova. 4d-net for learned multi-modal alignment. In CVPR, 2021. 2
|
| 239 |
+
[36] Charles R Qi, Xinlei Chen, Or Litany, and Leonidas J Guibas. Imvotenet: Boosting 3d object detection in point clouds with image votes. In CVPR, 2020. 2
|
| 240 |
+
[37] Cody Reading, Ali Harakeh, Julia Chae, and Steven L. Waslander. Categorical depth distributionnetwork for monocular 3d object detection. In CVPR, 2021. 2
|
| 241 |
+
[38] Sourabh Vora, Alex H Lang, Bassam Helou, and Oscar Beijbom. Pointpainting: Sequential fusion for 3d object detection. In CVPR, 2020. 1, 2
|
| 242 |
+
[39] Chunwei Wang, Chao Ma, Ming Zhu, and Xiaokang Yang. Pointaugmenting: Cross-modal augmentation for 3d object detection. In CVPR, 2021. 1, 2, 6, 7, 8
|
| 243 |
+
[40] Yan Wang, Wei-Lun Chao, Divyansh Garg, Bharath Hariharan, Mark Campbell, and Kilian Weinberger. Pseudo-lidar from visual depth estimation: Bridging the gap in 3d object detection for autonomous driving. In CVPR, 2019. 2
|
| 244 |
+
[41] Yue Wang, Vitor Campagnolo Guizilini, Tianyuan Zhang, Yilun Wang, Hang Zhao, and Justin Solomon. Detr3d: 3d object detection from multi-view images via 3d-to-2d queries. In CoRL, 2022. 2
|
| 245 |
+
[42] Yue Wang and Justin M. Solomon. Object dgcnn: 3d object detection using dynamic graphs. In NeurIPS, 2021. 2
|
| 246 |
+
[43] Shaoqing Xu, Dingfu Zhou, Jin Fang, Junbo Yin, Bin Zhou, and Liangjun Zhang. FusionPainting: Multimodal fusion with adaptive attention for 3d object detection. ITSC, 2021. 1
|
| 247 |
+
[44] Yan Yan, Yuxing Mao, and Bo Li. Second: Sparsely embedded convolutional detection. Sensors, 2018. 2
|
| 248 |
+
[45] Tianwei Yin, Xingyi Zhou, and Philipp Krahenbuhl. Center-based 3d object detection and tracking. In CVPR, 2021. 6
|
| 249 |
+
[46] Tianwei Yin, Xingyi Zhou, and Philipp Krähenbühl. Multimodal virtual point 3d detection. NeurIPS, 2021. 1, 2, 6
|
| 250 |
+
[47] Yin Zhou and Oncel Tuzel. Voxelnet: End-to-end learning for point cloud based 3d object detection. In CVPR, 2018. 2, 10
|
| 251 |
+
[48] Benjin Zhu, Zhengkai Jiang, Xiangxin Zhou, Zeming Li, and Gang Yu. Class-balanced grouping and sampling for point cloud 3d object detection. arXiv preprint, 2019. 7
|
| 252 |
+
|
| 253 |
+
# Checklist
|
| 254 |
+
|
| 255 |
+
1. For all authors...
|
| 256 |
+
|
| 257 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] See Section 4.
|
| 258 |
+
(b) Did you describe the limitations of your work? [Yes] See supplementary material.
|
| 259 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] See supplementary material.
|
| 260 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 261 |
+
|
| 262 |
+
2. If you are including theoretical results...
|
| 263 |
+
|
| 264 |
+
(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]
|
| 265 |
+
|
| 266 |
+
3. If you ran experiments...
|
| 267 |
+
|
| 268 |
+
(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]
|
| 269 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 4.
|
| 270 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A]
|
| 271 |
+
(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.
|
| 272 |
+
|
| 273 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 274 |
+
|
| 275 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 276 |
+
(b) Did you mention the license of the assets? [N/A]
|
| 277 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 278 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 279 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 280 |
+
|
| 281 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 282 |
+
|
| 283 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 284 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 285 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/td6xbEOPLr/td6xbEOPLr.md
ADDED
|
@@ -0,0 +1,392 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# FATE: Fairness Attacks on Graph Learning
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 We study fairness attacks on graph learning to answer the following question: How
|
| 11 |
+
2 can we achieve poisoning attacks on a graph learning model to exacerbate the
|
| 12 |
+
3 bias? We answer this question via a bi-level optimization problem and propose a
|
| 13 |
+
4 meta learning-based attacking framework named FATE. The proposed framework
|
| 14 |
+
5 is broadly applicable with respect to various fairness definitions and graph learning
|
| 15 |
+
6 models,as well as arbitrary choices of manipulation operations.We further instanti
|
| 16 |
+
7 ate FATE to attack statistical parity and individual fairness on graph neural networks.
|
| 17 |
+
8 We conduct extensive experimental evaluations on real-world datasets in the task
|
| 18 |
+
9 of semi-supervised node classification. The experimental results demonstrate that
|
| 19 |
+
10 FATE could amplify the bias of graph neural networks with or without fairness
|
| 20 |
+
11 consideration while maintaining the utility on the downstream task.We hope this
|
| 21 |
+
12 paper provides insights into the adversarial robustness of fair graph learning and
|
| 22 |
+
13 can shed light on designing robust and fair graph learning in future studies.
|
| 23 |
+
|
| 24 |
+
# 141Introduction
|
| 25 |
+
|
| 26 |
+
15 Algorithmic fairness in graph learning has received much research attention [5,20,24]. Despite
|
| 27 |
+
16 its substantial progress,existing studies mostly assume the benevolence of input graphs and aim
|
| 28 |
+
17 to ensure that the bias would not be perpetuated or amplified in the learning process.However,
|
| 29 |
+
18 malicious activities in the real world are commonplace.For example,consider a financial fraud
|
| 30 |
+
19 detection system which utilizes a transaction network to classify whether a bank account is fraudulent
|
| 31 |
+
20 or not [49,45]. An adversary may manipulate the transaction network (e.g., malicious banker with
|
| 32 |
+
21 access to the transaction data,theft of bank accounts to make malicious transactions), so that the
|
| 33 |
+
22 graph-based fraud detection model would exhibit unfair classification results with respect to people
|
| 34 |
+
23 of different demographic groups. Consequently,a biased fraud detection model may infringe civil
|
| 35 |
+
24 liberty to certain financial activities and impact the well-being of an individual negatively [6]. It
|
| 36 |
+
25 would also make the graph learning model fail to provide the same quality of service to people of
|
| 37 |
+
26 certain demographic groups,causing the financial institutions to lose business in the communities
|
| 38 |
+
27 of the corresponding demographic groups. Thus, it is critical to understand how resilient a graph
|
| 39 |
+
28 learning model is with respect to adversarial attcks on fairness, which we term as fairness attacks.
|
| 40 |
+
29 To date,fairness attack has not been well studied. Sporadic literature often follows two strategies:
|
| 41 |
+
30 (1) adversarial data point injection, which is often designed for tabular data rather than graphs [38,
|
| 42 |
+
31 33,8,44] or (2) adversarial edge injection, which only atacks the group fairness of a graph neural
|
| 43 |
+
32 network [19]. It is thus crucial to study how to attck different fairness definitions for a variety of
|
| 44 |
+
33 graph learning models.
|
| 45 |
+
34 To achieve this goal, we study the Fairness attacks on graph learning (FATE) problem.We formulate
|
| 46 |
+
35 it as a bi-level optimization, where the lower-level problem optimizes a task-specific loss function
|
| 47 |
+
36 to make the fairness attacks deceptive and the upper-level problem leverages the supervision signal
|
| 48 |
+
37 to modify the input graph and maximize the bias function corresponding to a user-defined fairness
|
| 49 |
+
38 definition. To solve the bi-level optimization problem, we propose a meta learning-based solver
|
| 50 |
+
39 (FATE),whose key idea is to compute the meta-gradient of the upper-level bias function with respect
|
| 51 |
+
40 to the input graph to guide the fairness attacks. Compared with existing works,our proposed
|
| 52 |
+
41 FATE framework has two major advantages.First, it is capable of attacking any fairness definition
|
| 53 |
+
42 on any graph learning model,as long as the corresponding bias function and the task-specific loss
|
| 54 |
+
43 function are differentiable.Second, it is equipped with the ability for either continuous or discretized
|
| 55 |
+
44 poisoning atacks on the graph topology. We also briefly discuss its ability for poisoning attacks on
|
| 56 |
+
45 node features in a later section.
|
| 57 |
+
|
| 58 |
+
46The major contributions of this paper are summarized as follows.
|
| 59 |
+
|
| 60 |
+
17· Problem definition. We formally define the problem of fairness attacks on graph learning (the
|
| 61 |
+
18 FATE problem). Based on the definition, we formulate it as a bi-level optimization problem, whose
|
| 62 |
+
19 key idea is to maximize a bias function in the upper level while minimizing a task-specific loss
|
| 63 |
+
0 function for a graph learning task.
|
| 64 |
+
|
| 65 |
+
· Attacking framework. We propose an end-to-end attcking framework named FATE. It learns a perturbed graph topology via meta learning,such that the bias with respect to the learning results trained with the perturbed graph will be amplified.
|
| 66 |
+
|
| 67 |
+
· Empirical evaluation. We conduct experiments on three benchmark datasets to demonstrate the efficacy of our proposed FATE framework in amplifying the bias while being the most deceptive method (i.e.,achieving the highest micro F1 score) on semi-supervised node classification.
|
| 68 |
+
|
| 69 |
+
# 572Preliminaries and Problem Definition
|
| 70 |
+
|
| 71 |
+
A - Notations. Throughout the paper, we use bold upper-case letter for matrix (e.g.,A), bold lower-case letter for vector (e.g., x) and calligraphic letter for set (e.g., $\mathcal { G }$ ). We use superscript T to denote the transpose of a matrix/vector (e.g., $\mathbf { x } ^ { T }$ is the transpose of $\mathbf { x }$ ).Regarding matrix/vector indexing, we use conventions similar to NumPy in Python. For example, $\mathbf { A } [ i , j ]$ is the entry of $\mathbf { A }$ at the $i$ -th row and $j$ -th column; $\mathbf { x } [ i ]$ is the $i$ -th entry of x; $\mathbf { A } [ i , : ]$ and $\mathbf { A } [ j , : ]$ are the $i$ -th row and $j$ -th column of A, respectively.
|
| 72 |
+
|
| 73 |
+
4 B- Algorithmic fairness. The general principle of algorithmic fairness is to ensure the learning
|
| 74 |
+
5 results would not favor one side or another.1 Among several fairness definitions that follow this
|
| 75 |
+
6 principle, group fairness [16,18] and individual fairness[15] are the most widely studied ones. Group
|
| 76 |
+
7 fairness splits the entire population into multiple demographic groups by a sensitive attribute (e.g.,
|
| 77 |
+
8 gender) and ensure the parity of a statistical property among learning results of those groups.For
|
| 78 |
+
9 example,statistical parity,a classic group fairness definition, guarantees the statistical independence
|
| 79 |
+
70 between the learning results (e.g., predicted labels of a classification algorithm) and the sensitive
|
| 80 |
+
71 atribute [16]. Individual fairness suggests that similar individuals should be treated similarly. It is
|
| 81 |
+
2 often formulated as a Lipschitz inequality such that distance between the learning results of two data
|
| 82 |
+
73 points should be no larger than the difference between these two data points [15].
|
| 83 |
+
74 C- Problem definition. Existing work [19] for fairness attacks on graphs randomly injects adversar
|
| 84 |
+
75 ial edges so that the disparity between the learning results of two diferent demographic groups would
|
| 85 |
+
76 be amplified.However, it suffers from three major limitations.(1) First, it only attacks statistical
|
| 86 |
+
77 parity while overlooking other fairness definitions (e.g.,individual fairness [15]).(2) Second, it only
|
| 87 |
+
78 considers adversarial edge injection, excluding other manipulations like edge deletion or reweighting.
|
| 88 |
+
79 Hence, it is essential to investigate the possibility to attck other fairness definitions on real-world
|
| 89 |
+
80 graphs with an arbitrary choice of manipulation operations. (3) Third, it does not consider the utility
|
| 90 |
+
81 of graph learning models while achieving the fairness attacks,resulting in performance degradation
|
| 91 |
+
82 in the downstream tasks. However, an institution that applies the graph learning models are often
|
| 92 |
+
83 utility-maximizing [28,2]. Thus,a performance degradation in the utility would make the fairness
|
| 93 |
+
84 attacks not deceptive from the perspective of a utility-maximizing institution.
|
| 94 |
+
|
| 95 |
+
In this paper, we seek to overcome the aforementioned limitations.To be specific, given an input graph,an optimization-based graph learning model,and a user-defined fairness definition, we aim to learn a modified graph such that a bias function of the corresponding fairness definition would be maximized for effective fairness attacks, while minimizing the task-specific loss function with respect to the graph learning model for deceptive fairness attacks. Formally, we define the problem of fairness attacks on graph learning,which is referred to as the FATE problem.
|
| 96 |
+
|
| 97 |
+
92 Given: (1) An undirected graph $\mathcal { G } = \{ \mathbf { A } , \mathbf { X } \}$ ; (2) a task-specific loss function $l ( \mathcal { G } , \mathcal { V } , \Theta , \theta )$ where $\mathcal { V }$
|
| 98 |
+
93 is the graph learning results, $\Theta$ is the set of learnable variables and $\theta$ is the set of hyperparameters; (3)
|
| 99 |
+
94 a bias function $b ( \mathbf { Y } , \Theta ^ { * } , \mathbf { F } , \theta )$ where $\Theta ^ { * } = \arg \operatorname* { m i n } _ { \Theta } l ( \mathcal { G } , \mathcal { V } , \Theta , \theta )$ and $\mathbf { F }$ is the matrix that contains
|
| 100 |
+
95 auxiliary fairness-related information (e.g., sensitive attribute values of all nodes in $\mathcal { G }$ for group
|
| 101 |
+
96 fairness,pairwise node similarity matrix for individual fairness); (4) an integer budget $B$
|
| 102 |
+
97Find: a poisoned graph $\widetilde { \mathcal { G } } = \{ \widetilde { \bf A } , \widetilde { \bf X } \}$ which satisfies the following properties: (1) $d ( \mathcal { G } , \widetilde { \mathcal { G } } ) \leq B$
|
| 103 |
+
98 where $d ( \mathcal { G } , \widetilde { \mathcal { G } } )$ is the distance between the input graph $\mathcal { G }$ and the poisoned graph $\widetilde { \mathcal G }$ (e.g., $\| \mathbf { A } , \widetilde { \mathbf { A } } \| _ { 1 , 1 } )$
|
| 104 |
+
99 (2) the bias function $b \left( \mathbf { Y } , \Theta ^ { * } , \mathbf { F } \right)$ is maximized for effectiveness; (3) the task-specific loss function
|
| 105 |
+
00 $l \left( \widetilde { \mathcal { G } } , \mathcal { Y } , \Theta , \theta \right)$ is minimized for deceptiveness.
|
| 106 |
+
|
| 107 |
+
# 3Methodology
|
| 108 |
+
|
| 109 |
+
In this section, we first formulate Problem 1 as a bi-level optimization problem,followed by a generic meta learning-based solver named FATE.
|
| 110 |
+
|
| 111 |
+
# 3.1Problem Formulation
|
| 112 |
+
|
| 113 |
+
5 Given an input graph $\mathcal { G } = \{ { \bf A } , { \bf X } \}$ with adjacency matrix A and node feature matrix $\mathbf { X }$ , an attacker
|
| 114 |
+
6aims to learn a poisoned graph $\widetilde { \mathcal { G } } = \{ \widetilde { \bf A } , \widetilde { \bf X } \}$ such that the graph learning model will be maximally
|
| 115 |
+
7biased when trained on $\widetilde { \mathcal G }$ . In this work, we consider the following settings for the attacker.
|
| 116 |
+
08 The goal of the attacker. The atacker aims to amplify the bias of the graph learning results output
|
| 117 |
+
09 by a victim graph learning model. And the bias to be amplifed is a choice made by the attacker based
|
| 118 |
+
10on which fairness definition the attacker aims to attack.
|
| 119 |
+
111 The knowledge of the attacker. Following similar settings in [19], we assume the attacker has
|
| 120 |
+
112 access to the adjacency matrix,the feature matrix of the input graph,and the sensitive attribute of
|
| 121 |
+
113 all nodes in the graph. For a (semi-)supervised learning problem, we assume that the ground-truth
|
| 122 |
+
114 labels of the training nodes are also available to the atacker. For example,for a graph-based financial
|
| 123 |
+
115 fraud detection problem, the malicious banker may have access to the demographic information (i.e,
|
| 124 |
+
116 sensitive atribute)of the account holders and also know whether some bank accounts are fraudulent
|
| 125 |
+
117 or not, which are the ground-truth labels for training nodes.Similar to [51,52,19], the attacker has
|
| 126 |
+
118 no knowledge about the parameters of the victim model. Instead, the attcker will perform a gray-box
|
| 127 |
+
119 attack by attacking a surrogate graph learning model.
|
| 128 |
+
|
| 129 |
+
oThe capabilitiy of the attacker. The attacker is able to perturb up to $B$ edges/features in the graph 1 (i.e., $\| \mathbf { A } - \widetilde { \mathbf { A } } \| _ { 1 , 1 } \leq B$ 0r $\| \mathbf { X } - \widetilde { \mathbf { X } } \| _ { 1 , 1 } \leq B )$ :
|
| 130 |
+
|
| 131 |
+
122Based on that, we formulate Problem 1 as a bi-level optimization problem as follows.
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
\begin{array} { r l } & { \widetilde { \mathcal { G } } = \arg \operatorname* { m a x } _ { \mathcal { G } } b \left( \mathbf { Y } , \boldsymbol { \Theta } ^ { * } , \mathbf { F } \right) } \\ & { \quad \quad \mathrm { s . t . } \quad \boldsymbol { \Theta } ^ { * } = \arg \underset { \boldsymbol { \Theta } } { \operatorname* { m i n } } l \left( \mathcal { G } , \mathbf { Y } , \boldsymbol { \Theta } , \boldsymbol { \theta } \right) , d \left( \mathcal { G } , \widetilde { \mathcal { G } } \right) \leq B } \end{array}
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
123 where the lower-level problem learns an optimal surrogate graph learning model $\Theta ^ { * }$ by minimizing
|
| 138 |
+
124 $l \left( { \mathcal { G } } , \mathbf { Y } , \Theta , \theta \right)$ , the upper-level problem finds a poisoned graph $\widetilde { \mathcal { G } }$ that could maximize a bias function
|
| 139 |
+
125 $b \left( \mathbf { Y } , \Theta ^ { * } , \mathbf { F } \right)$ for the victim graph learning model and the distance between the input graph and the
|
| 140 |
+
126 poisoned graph $d \left( \mathcal { G } , \widetilde { \mathcal { G } } \right)$ is constrained to satisfy the seting about the budgeted attack. Note hat
|
| 141 |
+
127 Eq. (1) is applicable to attack any fairness definition on any graph learning model,as long as the bias
|
| 142 |
+
128 function $b \left( { \bar { \mathbf { Y } } } , \Theta ^ { * } , \mathbf { F } \right)$ and the loss function $l \left( { \mathcal { G } } , \mathbf { Y } , \Theta , \theta \right)$ are differentiable.
|
| 143 |
+
129 A -Lower-level optimization problem. A wide spectrum of graph learning models are essentially
|
| 144 |
+
130 solving an optimization problem. Take the graph convolutional network (GCN) [26] as an example.
|
| 145 |
+
131 It learns the node representation by aggregating information from its neighborhood, i.e., message
|
| 146 |
+
132 passing. Mathematically, for an $L$ -layer GCN,the hidden representation at $k$ -th layer can be
|
| 147 |
+
133 represented as $\mathbf { E } ^ { ( k ) } = \sigma \left( \widehat { \mathbf { A } } \mathbf { E } ^ { ( k - 1 ) } \mathbf { W } ^ { ( k ) } \right)$ where $\sigma$ is a nonlinearactivation function (e.g.,ReLU),
|
| 148 |
+
134 $\widehat { \mathbf { A } } = \mathbf { D } ^ { - 1 / 2 } \left( \mathbf { A } + \mathbf { I } \right) \mathbf { D } ^ { - 1 / 2 }$ with $\mathbf { D }$ being the degree matrix of $( \mathbf { A } + \mathbf { I } )$ and $\mathbf { W } ^ { ( k ) }$ is the learnable
|
| 149 |
+
135 weight matrix of the $k$ -th layer. Then the lower-level optimization problem aims to learn the set
|
| 150 |
+
136 of parameters $\boldsymbol { \Theta } ^ { * } = \{ \mathbf { W } ^ { ( k ) } | k = 1 , \dots , L \}$ that could minimize a task-specific loss function (e.g.,
|
| 151 |
+
137 cross-entropy loss for semi-supervised node classification). For more examples of graph learning
|
| 152 |
+
138 models from the optimization perspective, please refers to Appendix A.
|
| 153 |
+
|
| 154 |
+
B - Upper-level optimization problem. To atack the fairness aspect of a graph learning model, we aim to maximize a differentiable bias function $b \left( \mathbf { Y } , \Theta ^ { * } , \mathbf { F } \right)$ with respect to a user-defined fairness definition in the upper-level optimization problem. For example,for statistical parity[16], the fairnessrelated auxiliary information matrix $\mathbf { F }$ can be defined as the one-hot demographic membership matrix, where $\mathbf { F } [ i , j ] = 1$ if and only if node $i$ belongs to $j$ -th demographic group. Then the statistical parity is equivalent to the statistical independence between the learning results $\mathbf { Y }$ and $\mathbf { F }$ .Based on that, existing studies propose several differentiable measurements of the statistical dependence between $\mathbf { Y }$ and $\mathbf { F }$ as the bias function. For example, Bose et al. [5] use mutual information $I ( \mathbf { Y } ; \mathbf { F } )$ as the bias function; Prost et al. [35] define the bias function as the Maximum Mean Discrepancy MMD $( \mathsf { y } _ { 0 } , \mathsf { y } _ { 1 } )$ (202 between the learning results of two different demographic groups $\mathcal { V } _ { 0 }$ and $\mathcal { \mathrm { V } } _ { 1 }$ :
|
| 155 |
+
|
| 156 |
+
# 3.2The FATE Framework
|
| 157 |
+
|
| 158 |
+
150 To solve Eq.(1), we propose a generic attcking framework named FATE to learn the poisoned graph.
|
| 159 |
+
151 The key idea is to view Eq. (1) as a meta learning problem, which aims to find suitable hyperparameter
|
| 160 |
+
152 setings for a learning task [3],and treat the graph $\mathcal { G }$ as a hyperparameter. With that, we learn the
|
| 161 |
+
153 poisoned graph $\widetilde { \mathcal G }$ using the meta-gradient of the bias function $b \left( \mathbf { Y } , \Theta ^ { * } , \mathbf { F } \right)$ with respect to $\mathcal { G }$ . In the
|
| 162 |
+
154 following, we introduce two key parts of FATE in details, including meta-gradient computation and
|
| 163 |
+
155 graph poisoning with meta-gradient.
|
| 164 |
+
156 A -Meta-gradient computation. The key term to learn the poisoned graph is the meta-gradient of
|
| 165 |
+
157 the bias function with respect to the graph $\mathcal { G }$ . Before computing the meta-gradient, we assume that
|
| 166 |
+
158 the lower-level optimization problem converges in $T$ epochs. Thus,we first pre-train the lower-level
|
| 167 |
+
159 optimization problem by $T$ epochs to obtain the optimal model $\Theta ^ { * } = \Theta ^ { ( \bar { T } ) }$ before computing the
|
| 168 |
+
160 meta-gradient. The training of the lower-level optimization problem can also be viewed as a dynamic
|
| 169 |
+
161 system with the following updating rule
|
| 170 |
+
|
| 171 |
+
$$
|
| 172 |
+
\Theta ^ { ( t + 1 ) } = \operatorname { o p t } ^ { ( t + 1 ) } \left( \mathcal { G } , \Theta ^ { ( t ) } , \theta , \mathbf { Y } \right) , \forall t \in \{ 1 , \dots , T \}
|
| 173 |
+
$$
|
| 174 |
+
|
| 175 |
+
162 where $\Theta ^ { ( 1 ) }$ refers to $\Theta$ at initialization, $\mathrm { o p t } ^ { ( t + 1 ) } ( \cdot )$ is an optimizer that minimizes the lower-level
|
| 176 |
+
163 loss function $l \left( \mathcal { G } , \mathbf { Y } , \Theta ^ { \left( t \right) } , \theta \right)$ at $( t + 1 )$ -th epoch. From the perspective of the dynamic system,
|
| 177 |
+
164 by applying the chain rule and unrolling the training of lower-level problem with Eq.(2), the
|
| 178 |
+
165 meta-gradient $\nabla _ { \boldsymbol { \mathcal { G } } } b$ can be written as
|
| 179 |
+
|
| 180 |
+
$$
|
| 181 |
+
\nabla _ { \mathcal { G } } b = \nabla _ { \mathcal { G } } b \left( \mathbf { Y } , \boldsymbol { \Theta } ^ { ( T ) } , \mathbf { F } \right) + \sum _ { t = 0 } ^ { T - 2 } A _ { t } B _ { t + 1 } \dots B _ { T - 1 } \nabla _ { \boldsymbol { \theta } ^ { ( T ) } } b \left( \mathbf { Y } , \boldsymbol { \Theta } ^ { ( T ) } , \mathbf { F } \right)
|
| 182 |
+
$$
|
| 183 |
+
|
| 184 |
+
166 where $A _ { t } = \nabla _ { \mathcal { G } } \Theta ^ { ( t + 1 ) }$ and $B _ { t } = \nabla _ { \Theta ^ { ( t ) } } \Theta ^ { ( t + 1 ) }$ . However, Eq. (3) is computationally expensive in
|
| 185 |
+
167 both time and space. To further speed up the computation, we adopt a first-order approximation of
|
| 186 |
+
168 the meta-gradient [17] and simplify the meta-gradient as
|
| 187 |
+
|
| 188 |
+
$$
|
| 189 |
+
\nabla _ { \mathcal { G } } b \approx \nabla _ { \Theta ^ { ( T ) } } b \left( \mathbf { Y } , \Theta ^ { ( T ) } , \mathbf { F } \right) \cdot \nabla _ { \mathcal { G } } \Theta ^ { ( T ) }
|
| 190 |
+
$$
|
| 191 |
+
|
| 192 |
+
169 Since the input graph is undirected, the derivative of the symmetric adjacency matrix A can be
|
| 193 |
+
170computed as follows by applying the chain rule of a symmetric matrix [21].
|
| 194 |
+
|
| 195 |
+
$$
|
| 196 |
+
\nabla _ { \mathbf { A } } b \gets \nabla _ { \mathbf { A } } b + \left( \nabla _ { \mathbf { A } } b \right) ^ { T } - \mathrm { d i a g } \left( \nabla _ { \mathbf { A } } b \right)
|
| 197 |
+
$$
|
| 198 |
+
|
| 199 |
+
1For the node feature matrix $\mathbf { X }$ , its derivative is equal to the partial derivative $\nabla _ { \mathbf { X } } b$ since it is often an ‘2asymmetric matrix.
|
| 200 |
+
|
| 201 |
+
73B-Graph poisoning with meta-gradient. After computing the meta-gradient of the bias function
|
| 202 |
+
74 $\nabla _ { \boldsymbol { \mathcal { G } } } b$ , we aim to poison the input graph guided by $\nabla _ { \boldsymbol { \mathcal { G } } } b$ .We introduce two poisoning strategies: (1)
|
| 203 |
+
75 continuous poisoning and (2) discretized poisoning.
|
| 204 |
+
176 Continuous poisoning atack. The continuous poisoning attack is straightforward by reweighting
|
| 205 |
+
177 edges in the graph.We first compute the meta-gradient of the bias function $\nabla _ { \mathbf { A } } b$ ,then use it to poison
|
| 206 |
+
178 the input graph in a gradient descent-based updating rule as follows.
|
| 207 |
+
|
| 208 |
+
$$
|
| 209 |
+
\mathbf { A } \mathbf { A } - \eta \nabla _ { \mathbf { A } } b
|
| 210 |
+
$$
|
| 211 |
+
|
| 212 |
+
79where $\eta$ is a learning rate to control the magnitude of the poisoning attack. The learning rate should
|
| 213 |
+
80satisfy n≤V11 to ensure that constraint on the budgeted attack.
|
| 214 |
+
81Discretized poisoning attack. The discretized poisoning attack aims to select a set of edges to be
|
| 215 |
+
82added/deleted. It is guided by a poisoning preference matrix defined as follows.
|
| 216 |
+
|
| 217 |
+
$$
|
| 218 |
+
\nabla _ { \mathbf { A } } = ( \mathbf { 1 } - 2 \mathbf { A } ) \circ \nabla _ { \mathbf { A } } b
|
| 219 |
+
$$
|
| 220 |
+
|
| 221 |
+
183 where 1 is an all-one matrix with the same dimension as $\mathbf { A }$ and $\bigcirc$ denotes the Hadamard product.
|
| 222 |
+
184 A large positive $\nabla _ { \mathbf { A } } [ i , j ]$ indicates strong preference in adding an edge if nodes $i$ and $j$ are not
|
| 223 |
+
185 connected (i.e., positive $\dot { \nabla } _ { \mathbf { A } } b [ i , j ]$ ,positive $( \mathbf { 1 } - 2 \mathbf { A } ) [ i , j ] )$ or deleting an edge if nodes $i$ and $j$ are
|
| 224 |
+
186 connected (i.e., negative $\nabla _ { \mathbf { A } } b [ i , j ]$ ,negative $( \mathbf { 1 } - 2 \mathbf { A } ) [ i , j ] )$ . Then, a greedy selection strategy is
|
| 225 |
+
187 applied to find the set of edges $\mathcal { E } _ { \mathrm { a t t a c k } }$ to be added/deleted.
|
| 226 |
+
|
| 227 |
+
$$
|
| 228 |
+
\mathcal { E } _ { \mathrm { a t t a c k } } = \mathrm { t o p k } ( \nabla _ { \mathbf { A } } , \delta )
|
| 229 |
+
$$
|
| 230 |
+
|
| 231 |
+
188 where $\mathrm { t o p k } ( \nabla _ { \mathbf { A } } , \delta )$ selects $\delta$ entries with highest preference score in $\nabla _ { \mathbf { A } }$ . Note that, if we only want
|
| 232 |
+
189 to add edges without any deletion, all negative entries in $\nabla _ { \mathbf { A } } b$ should be zeroed out before computing
|
| 233 |
+
190 Eq. (7).Likewise,if edges are only expected to be deleted,all positive entries should be zeroed out.
|
| 234 |
+
91Remarks. Poisoning node feature matrix $\mathbf { X }$ follows the same steps as poisoning adjacency matrix A
|
| 235 |
+
92without applying Eq. (5).
|
| 236 |
+
193 C- Overal framework. FATE generally works as follows. (1) We first pre-train the surrogate graph
|
| 237 |
+
194 learning model and get the corresponding learning model $\Theta ^ { ( T ) }$ as well as the learning results $\bar { \mathbf { Y } } ^ { ( T ) }$
|
| 238 |
+
195 (2) Then we compute the meta gradient of the bias function using Eqs.(4) and (5). (3)Finall, we
|
| 239 |
+
196 perform the discretized poisoning attack (Eqs.(7) and (8)) or continuous poisoning attack (Eq (6)).
|
| 240 |
+
197 A detailed pseudo-code of FATE is provided in Appendix B.
|
| 241 |
+
198 D -Limitations. Since FATE leverages the meta-gradient to poison the input graph, it requires the
|
| 242 |
+
199 bias function $b \left( \mathbf { Y } , \Theta ^ { ( T ) } , \mathbf { F } \right)$ to be differentiable in order to calculate the meta-gradient $\nabla _ { \boldsymbol { \mathcal { G } } } b$ In
|
| 243 |
+
200 Sections 4 and 5, we present a carefully chosen bias function for FATE. And we leave it for future
|
| 244 |
+
201 work on exploring the ability of FATE in attcking other fairness definitions. Moreover, though the
|
| 245 |
+
202 meta-gradient can be efciently computed via auto-differentiation in many deep learning packages
|
| 246 |
+
203 (e.g., PyTorch², TensorFlow3), it requires $O ( n ^ { 2 } )$ space complexity to store the meta-gradient when
|
| 247 |
+
204 attacking fairness via edge flipping. It is still a challenging open problem on how to efficiently
|
| 248 |
+
205 compute the meta-gradient in terms of space. One possible remedy for discretized attck might be a
|
| 249 |
+
206 low-rank approximation on the perturbation matrix formed by $\mathcal { E } _ { \mathrm { a t t a c k } }$ . Since the difference between
|
| 250 |
+
207 the benign graph and poisoned graph are often small and budgeted $( d \left( \mathcal { G } , \widetilde { \mathcal { G } } \right) \leq B )$ , it is likely that
|
| 251 |
+
208 the edge manipulations may be around a few set of nodes,which makes the perturbation matrix to be
|
| 252 |
+
209 an (approximately) low-rank matrix.
|
| 253 |
+
|
| 254 |
+
# 4Instantiation #1: Statistical Parity on Graph Neural Networks
|
| 255 |
+
|
| 256 |
+
Here,we instantiate FATE framework by attacking statistical parity on graph neural networks in a binary node clasification problem with a binary sensitive attribute.We briefly discuss how to choose (1) the surrogate graph learning model used by the attacker, (2) the task-specific loss function in the lower-level optimization problem and (3) the bias function in the upper-level optimization problem.
|
| 257 |
+
|
| 258 |
+
A - Surrogate graph learning model. We assume that the surrogate model to be used by the attacker is a 2-layer linear GCN [47] with diferent hidden dimensions and model parameters at initialization.
|
| 259 |
+
|
| 260 |
+
B -Lower-level loss function. We consider a semi-supervised node classification task for the graph neural network to be attacked. Thus, the lower-level loss function is chosen as the cross entropy between the ground-truth label and the predicted label: $l \left( { \mathcal { G } } , \mathbf { Y } , \Theta , \theta \right) \ =$ Vn∑ieVi∑j=1yi,jlnyij,where Virain istheset of training nodes withground-truthlabels with $| \mathcal { V } _ { \mathrm { t r a i n } } |$ being its cardinality, $c$ is the number of classes, $y _ { i , j }$ is a binary indicator of whether node $i$ belongs to class $j$ and $\widehat { y } _ { i , j }$ is the prediction probability of node $i$ belonging to class $j$
|
| 261 |
+
|
| 262 |
+
C- Upper-level bias function.We aim to attack statistical parity in the upper-level problem, which asks for $\mathrm { P } \left[ \hat { y } = 1 \right] = \mathrm { P } \left[ \hat { y } = 1 | s = 1 \right]$ . Suppose $p \left( \widehat { y } \right)$ is the probability density function (PDF) of $\widehat { y } _ { i , 1 }$ (202
|
| 263 |
+
|
| 264 |
+
225 for any node $i$ and $p \left( \widehat { y } | s = 1 \right)$ is the PDF of $\widehat { y } _ { i , 1 }$ for any node $i$ belong to the demographic group
|
| 265 |
+
226 with sensitive attribute value $s = 1$ . We observe that $\mathrm { ~ P ~ } [ \hat { y } = 1 ]$ and I $\bar { \boldsymbol { \vert \hat { y } } } = 1 \boldsymbol { \vert s = 1 \vert }$ are equivalent
|
| 266 |
+
227 to the cumulative distribution functions (CDF) of $p \left( \widehat { y } < \frac { 1 } { 2 } \right)$ and $p$ $\begin{array} { r } { ( \widehat { y } < \frac { 1 } { 2 } | s = 1 ) } \end{array}$ ),respectively. To
|
| 267 |
+
228 estimate both $\mathrm { ~ P ~ } [ \hat { y } = 1 ]$ and $\mathrm { P } [ \hat { y } = 1 | s = 1 ]$ with a differentiable function,we first estimate their
|
| 268 |
+
229 probability density functions $\begin{array} { r } { ( p \left( \widehat { y } < \frac { 1 } { 2 } \right) } \end{array}$ and $p$ $\widehat { y } < \frac { 1 } { 2 } | s = 1 \big )$ ) with kernel density estimation (KDE,
|
| 269 |
+
230 Definition 1).
|
| 270 |
+
|
| 271 |
+
Definition1 (Kernel density estimation $I 7 J )$ Given a set of $n$ IID samples $\{ x _ { 1 } , \ldots , x _ { n } \}$ drawn from a distribution with an unknown probability density function $f$ ,the kernel density estimation of $f$ at point $\tau$ is defined as follows.
|
| 272 |
+
|
| 273 |
+
$$
|
| 274 |
+
{ \widetilde { f } } \left( \tau \right) = { \frac { 1 } { n a } } \sum _ { i = 1 } ^ { n } f _ { k } \left( { \frac { \tau - x _ { i } } { a } } \right)
|
| 275 |
+
$$
|
| 276 |
+
|
| 277 |
+
where $\widetilde { f }$ is the estimated probability density function, $f _ { k }$ is the kernel function and a is a non-negative bandwidth.
|
| 278 |
+
|
| 279 |
+
236 Moreover, we assume the kernel function in KDE is the Gaussan kernel $\begin{array} { r } { f _ { k } \left( x \right) = \frac { 1 } { \sqrt { 2 \pi } } e ^ { - x ^ { 2 } / 2 } } \end{array}$
|
| 280 |
+
237 However, computing the CDF of a Gaussian distribution is non-trivial. Following [9], we leverage a
|
| 281 |
+
238 tractable approximation of the Gaussian Q-function as follows.
|
| 282 |
+
|
| 283 |
+
$$
|
| 284 |
+
Q ( \tau ) = F _ { k } \left( \tau \right) = \int _ { \tau } ^ { \infty } f _ { k } ( x ) d x \approx e ^ { - \alpha \tau ^ { 2 } - \beta \tau - \gamma }
|
| 285 |
+
$$
|
| 286 |
+
|
| 287 |
+
239where $\textstyle f _ { k } ( x ) = = { \frac { 1 } { \sqrt { 2 \pi } } } e ^ { - x ^ { 2 } / 2 }$ is a Gausindstrtionithoean $\alpha = 0 . 4 9 2 0$ $\beta = 0 . 2 8 8 7$ ,
|
| 288 |
+
240 $\gamma = 1 . 1 8 9 3$ [30]. The overall workflow of estimating $\mathrm { ~ P ~ } [ \hat { y } = 1 ]$ is as follows.
|
| 289 |
+
|
| 290 |
+
· For any node $i$ , get its prediction probability $\widehat { y } _ { i , 1 }$ with respect to class 1; ·Estimate the CDF $\mathrm { ~ P ~ } [ \hat { y } = 1 ]$ using a Gaussian KDE with bandwidth $a$ by $\mathrm { ~ P ~ } [ \hat { y } = 1 ] =$ $\begin{array} { r } { \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \exp \left( - \alpha \left( \frac { 0 . 5 - \widehat y _ { i , 1 } } { a } \right) ^ { 2 } - \beta \left( \frac { 0 . 5 - \widehat y _ { i , 1 } } { a } \right) - \gamma \right) } \end{array}$ where $\alpha ~ = ~ 0 . 4 9 2 0$ , $\beta ~ = ~ 0 . 2 8 8 7$ $\gamma =$ 1.1893 and $\exp ( x ) = e ^ { x }$ :
|
| 291 |
+
|
| 292 |
+
Note that $\mathrm { P } [ \hat { y } = 1 | s = 1 ]$ can be estimated with a similar procedure with minor modifications. The only modifications needed are: (1) get the prediction probability of nodes with $s = 1$ and (2) compute the CDF using the Gaussian $\mathrm { Q }$ -function over nodes with $s = 1$ rather than all nodes in the graph.
|
| 293 |
+
|
| 294 |
+
# 5Instantiation #2: Individual Fairness on Graph Neural Networks
|
| 295 |
+
|
| 296 |
+
We provide another instantiation of FATE framework by attacking individual fairness on graph neural networks. Here, we consider the same surrogate graph learning model (i.e., 2-layer linear GCN) and the same lower-level loss function (i.e., cross entropy) as described in Section 4. To attack individual fairness,we define the upper-level bias function following the principles in [20]: the fairness-related auxiliary information matrix $\mathbf { F }$ is defined as the oracle symmetric pairwise node similarity matrix S (i.e., $\mathbf { F } = \mathbf { S } $ ),where ${ \bf S } [ i , j ]$ measures the similarity between node $i$ and node $j$ .Kang et al. [2O] define that the overall individual bias to be $\operatorname { T r } \left( \mathbf { Y } ^ { T } \mathbf { L } _ { \mathbf { S } } \mathbf { Y } \right)$ . Assuming that $\mathbf { Y }$ is the output of an optimization-based graph learning model, $\mathbf { Y }$ can be viewed as a function with respect to the input graph $\mathcal { G }$ , which makes $\mathbf { \dot { T r } } \left( \mathbf { Y } ^ { T } \mathbf { L } \mathbf { s } \mathbf { \check { Y } } \right)$ differentiable with respect to $\mathcal { G }$ . Thus, the bias function $b ( \cdot )$ can be naturally defined as the overall individual bias of the input graph $\mathcal { G }$ ,i.e., $b \left( \mathbf { Y } , \Theta ^ { * } , \mathbf { S } \right) = \mathrm { T r } \left( \mathbf { Y } ^ { T } \mathbf { L } _ { \mathbf { S } } \mathbf { Y } \right)$
|
| 297 |
+
|
| 298 |
+
# 6Experiments
|
| 299 |
+
|
| 300 |
+
# 6.1Attacking Statistical Parity on Graph Neural Networks
|
| 301 |
+
|
| 302 |
+
Settings.We compare FATE with 4 baseline methods,i.e.,Random,DICE [46], FA-GNN [19],under the same setting as in Section 4. That is,(1) the fairness definition to be attacked is statistical parity; (2) the downstream task is binary semi-supervised node classification with binary sensitive attributes. The experiments are conducted on 3 real-world datasets,i.e., Pokec-n, Pokec-z and Bail. Similar to existing works, we use the $5 0 \% / 2 5 \% / 2 5 \%$ splits for train/validation/test sets. For all baseline
|
| 303 |
+
|
| 304 |
+
Table 1: Effectiveness of attacking group fairness on GCN.FATE poisons the graph via both edge flipping (FATE-flip) and edge addition (FATE-add) while all other baselines poison the graph via edge addition. Higher is better $( \uparrow )$ for micro F1 score (Micro F1) and $\Delta _ { \mathrm { S P } }$ .Bold font indicates the success of fairness attack (i.e., $\Delta _ { \mathrm { S P } }$ is increased after fairness attack) with the highest micro F1 score. Underlined cell indicates the failure of fairness attack (i.e., $\Delta _ { \mathrm { S P } }$ is decreased after fairness attack).
|
| 305 |
+
|
| 306 |
+
<table><tr><td rowspan="2">Dataset</td><td rowspan="2">Ptb.</td><td colspan="2">Random MicroF1(↑)</td><td colspan="2">DICE</td><td colspan="2">FA-GNN</td><td colspan="2">FATE-flip</td><td colspan="2">FATE-add</td></tr><tr><td></td><td>△sP(↑)</td><td>Micro F1(↑)</td><td>△sP(↑)</td><td>MicroF1(↑)</td><td>△sP()</td><td>MicroF1(↑</td><td>△sP()</td><td>MicroF1(↑)</td><td>△sP(↑)</td></tr><tr><td rowspan="7">Pokec-n</td><td>0.00</td><td>67.5± 0.3</td><td>7.1 ± 0.4</td><td>67.5±0.3</td><td>7.1 ±0.4</td><td>67.5± 0.3</td><td>7.1 ±0.4</td><td>67.5± 0.3</td><td>7.1 ± 0.4</td><td>67.5± 0.3</td><td>7.1 ± 0.4</td></tr><tr><td>0.05</td><td>68.0±0.3</td><td>6.2±0.8</td><td>67.6±0.2</td><td>6.8±0.3</td><td>67.8±0.1</td><td>3.3±0.4</td><td>67.9 ±0.4</td><td>9.3 ±1.2</td><td>67.9 ±0.4</td><td>9.3 ±1.2</td></tr><tr><td>0.10</td><td>66.8±0.8</td><td>7.3±0.7</td><td>66.1 ± 0.5</td><td>6.6 ±1.1</td><td>66.0±0.2</td><td>11.5± 0.6</td><td>68.2±0.6</td><td>9.8±1.5</td><td>68.2±0.6</td><td>9.8±1.5</td></tr><tr><td>0.15</td><td>66.7 ± 0.4</td><td>8.1 ± 0.4</td><td>65.6±0.4</td><td>7.7±0.8</td><td>66.0 ±0.4</td><td>15.6 ±3.0</td><td>68.0±0.3</td><td>11.5 ± 1.0</td><td>68.0±0.3</td><td>11.5 ± 1.0</td></tr><tr><td>0.20</td><td>66.3±0.7</td><td>8.6±1.8</td><td>64.2 ± 0.4</td><td>3.4±0.9</td><td>65.8± 0.1</td><td>18.4±0.7</td><td>68.2±0.5</td><td>12.0 ±1.8</td><td>68.2±0.5</td><td>12.0 ± 1.8</td></tr><tr><td>0.25</td><td>66.2±0.6</td><td>8.5±0.8</td><td>63.4 ±0.2</td><td>6.3±0.8</td><td>66.6±0.2</td><td>23.3 ±0.5</td><td>68.3±0.4</td><td>12.1 ± 2.1</td><td>68.3±0.4</td><td>12.1 ± 2.1</td></tr><tr><td>0.00</td><td>68.4±0.4</td><td>6.6±0.9</td><td>68.4 ± 0.4</td><td>6.6±0.9</td><td>68.4±0.4</td><td>6.6±0.9</td><td>68.4± 0.4</td><td>6.6±0.9</td><td>68.4±0.4</td><td>6.6±0.9</td></tr><tr><td rowspan="7">Pokec-z</td><td>0.05</td><td>68.8±0.4</td><td>6.4±0.6</td><td>67.4 ±0.5</td><td>6.6±0.3</td><td>68.1±0.3</td><td>2.2 ±0.4</td><td>68.7±0.4</td><td>6.7 ± 1.4</td><td>68.7±0.4</td><td>6.7 ± 1.4</td></tr><tr><td>0.10</td><td>68.7±0.3</td><td>8.0±0.6</td><td>66.5±0.2</td><td>6.3±0.8</td><td>67.7±0.4</td><td>13.5± 0.9</td><td>68.7±0.6</td><td>7.5±0.7</td><td>68.7±0.6</td><td>7.5±0.7</td></tr><tr><td>0.15</td><td>67.9 ±0.3</td><td>9.1 ±0.8</td><td>65.9 ±0.8</td><td>5.5±1.3</td><td>66.6 ±0.4</td><td>16.9 ± 2.6</td><td>69.0±0.8</td><td>8.5 ± 1.1</td><td>69.0±0.8</td><td>8.5 ± 1.1</td></tr><tr><td>0.20</td><td>68.5 ±0.4</td><td>9.3 ±1.0</td><td>62.9 ±0.7</td><td>8.7 ±1.0</td><td>66.1±0.2</td><td>25.4 ± 1.3</td><td>68.5±0.6</td><td>8.8 ±1.1</td><td>68.5±0.6</td><td></td></tr><tr><td>0.25</td><td>68.3± 0.5</td><td>7.3 ±0.5</td><td>63.9 ±0.4</td><td>6.0 ± 1.0</td><td>65.5± 0.6</td><td>22.3 ± 2.8</td><td>68.5 ± 1.1</td><td>8.6±2.5</td><td>68.5 ± 1.1</td><td>8.8 ±1.1</td></tr><tr><td>0.00</td><td>93.1 ±0.2</td><td>8.0±0.2</td><td>93.1 ±0.2</td><td>8.0 ±0.2</td><td>93.1± 0.2</td><td>8.0±0.2</td><td>93.1 ±0.2</td><td></td><td></td><td>8.6±2.5</td></tr><tr><td>0.05</td><td></td><td>8.1±0.0</td><td>91.6 ± 0.2</td><td>8.5±0.1</td><td>91.7 ± 0.1</td><td>10.0 ± 0.4</td><td></td><td>8.0±0.2</td><td>93.1 ± 0.2</td><td>8.0±0.2</td></tr><tr><td rowspan="5">Bail</td><td>0.10</td><td>92.7±0.2 92.2±0.2</td><td>7.8±0.2</td><td>90.3 ±0.1</td><td>8.5±0.1</td><td>90.5±0.0</td><td>10.3 ± 0.4</td><td>92.6 ± 0.1 92.4±0.1</td><td>8.6±0.1</td><td>92.5 ± 0.1</td><td>8.6±0.1</td></tr><tr><td>0.15</td><td>91.9±0.2</td><td>7.8±0.1</td><td>89.2±0.1</td><td>7.7±0.1</td><td>90.0±0.2</td><td>8.4±0.2</td><td>92.2±0.2</td><td>8.9±0.1</td><td>92.4 ± 0.1</td><td>8.6 ±0.1</td></tr><tr><td></td><td>91.6 ±0.2</td><td>7.8±0.1</td><td>88.3±0.1</td><td>8.3±0.1</td><td>89.7 ±0.1</td><td>7.4 ±0.4</td><td>92.2±0.2</td><td>9.1 ± 0.1</td><td>92.3 ±0.1</td><td>9.1 ± 0.1</td></tr><tr><td>0.20 0.25</td><td>91.4±0.1</td><td>8.3±0.1</td><td>87.8±0.0</td><td>7.8 ±0.1</td><td>89.8±0.2</td><td>5.2±0.2</td><td>92.1±0.1</td><td>9.3±0.1 9.1±0.2</td><td>92.3 ±0.1</td><td>9.3±0.2</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>92.1 ± 0.1</td><td>9.1 ±0.3</td></tr></table>
|
| 307 |
+
|
| 308 |
+
267 methods,the victim models are set to GCN [26]. For each dataset, we use a fixed random seed to
|
| 309 |
+
268 learn the poisoned graph corresponding to each baseline method. Then we train the victim model 5
|
| 310 |
+
269 times with different random seeds.For fair comparison, we only attack the adjacency matrix in all
|
| 311 |
+
270 experiments. Please refer to Appendix C for detailed experimental settings.
|
| 312 |
+
|
| 313 |
+
Main results.For FATE, we conduct fairness attacks via both edge flipping (FATE-flip in Table 5) and edge addition (FATE-add in Table 1). For all other baseline methods, edges are only added. The effectiveness of fairness attacks on GCN are presented in Tables 5.From both tables, we have the following key observations: (1) FATE-flip and FATE-add are the only methods that consistently succeeds in fairness attcks,while allother baseline methods might fail in some cases (indicated by the underlined $\Delta _ { \mathrm { S P } }$ in both tables) because of the decrease in $\Delta _ { \mathrm { S P } }$ . (2)FATE-flip and FATE-add can not only amplify $\Delta _ { \mathrm { S P } }$ consistently, but also achieve the best micro F1 score on node classification, which makes FATE-flip and FATE-add more deceptive than all baseline methods. Notably,FATE-flip and FATE-add are able to even increase micro F1 score on alldatasets, while other baseline methods attck the graph neural networks at the expense of utility (micro F1 score). (3) Though FA-GNN could make the model more biased in some cases, it cannot guarantee consistent success in fairness attacks on all three datasets as shown by the underlined $\Delta _ { \mathrm { S P } }$ in both tables.All in all,our proposed FATE framework is the framework that consistently succeeds in fairness atacks while being the most deceptive (i.e., highest micro F1 score).
|
| 314 |
+
|
| 315 |
+
Effect of the perturbation rate.From Table 1,we have the following observations. First, $\Delta _ { \mathrm { S P } }$ tends to increase when the perturbation rate increases, which demonstrates the effectiveness of FATE-flip and FATE-add for attacking fairness. Though in some cases $\Delta _ { \mathrm { S P } }$ might have a marginal decrease, FATE-flip and FATE-add still successfully attack the fairness compared with GCN trained on the benign graph by being larger to the $\Delta _ { \mathrm { S P } }$ when perturbation rate (Ptb.) is O. Second,FATE-flip and FATE-add are deceptive, meaning that the micro F1 scores is close to or even higher than the micro F1 scores on the benign graph compared with the corresponding metrics trained . In summary, across different perturbation rates,FATE-flip and FATE-add are both effective,i.e.,amplifying more bias with higher perturbation rate,and deceptive,i.e., achieving similar or even higher micro F1 score.
|
| 316 |
+
|
| 317 |
+

|
| 318 |
+
Figure 1: Attacking statistical parity with FATE-flip. (a)Ratios of flipped edges that connect two nodes with same/different label or sensitive attribute (sens. atr.). (b) SL (abbreviation for same label) refers to the ratios of flipped edges whose two endpoints are both from the same class. SSA (abbreviation for same sensitive atribute)refers to the ratios of manipulated edges whose two endpoints are both from the same demographic group. Majority/minority classes are determined by spliting the training nodes based on their class labels. The protected group is the demographic group with fewer nodes.
|
| 319 |
+
|
| 320 |
+
294 Analysis on the manipulated edges.Here, we aim to characterize the properties of edges that are
|
| 321 |
+
295 flipped by FATE (i.e.,FATE-flip) in attcking statistical parity. The reason to only analyze FATE-flip is
|
| 322 |
+
296 that the majority of edges manipulated by FATE-flip on al three datasets is by addition (i.e., flipping
|
| 323 |
+
297 from non-existing to existing). Figure 1b suggests that, if the two endpoints of an manipulated edge
|
| 324 |
+
298 share the same class label or same sensitive attribute value,these two endpoints are most likely from
|
| 325 |
+
299 the minority class and protected group. Combining Figures la and 1b,FATE would significantly
|
| 326 |
+
300 increase the number of edges that are incident to nodes in the minority class and/or protected group.
|
| 327 |
+
|
| 328 |
+
More experimental results.Due to the space limitation, we defer more experimental results on atacking statistical parity on graph neural networks in Appendix D. More specifically, we present the performance evaluation under different metrics,i.e.,Macro F1 and AUC,as wellas the effectiveness of FATE with a different victim model, i.e., FairGNN[11], which ensures statistical parity.
|
| 329 |
+
|
| 330 |
+
# 6.2Attacking Individual Fairness on Graph Neural Networks
|
| 331 |
+
|
| 332 |
+
Settings.To showcase the ability of FATE on atacking the individual fairness (Section 5), we further compare FATE with the same set of baseline methods (Random, DICE [46],FA-GNN [19]) on the same set of datasets (Pokec-n, Pokec-z, Bail).We follow the setings as in Section 5. We use the $5 0 \% / 2 5 \% / 2 5 \%$ splits for train/validation/test sets with GCN [26] being the victim model. For each dataset, we use a fixed random seed to learn the poisoned graph corresponding to each baseline method.Then we train the victim model 5 times with different random seeds. And each entry in the oracle pairwise node similarity matrix is computed by the cosine similarity of the corresponding rows in the adjacency matrix. That is, ${ \bf S } [ i , j ] = \cos ^ { } ( { \bf A } [ i , : ] , A [ j , : ] )$ , where cos () is the function to compute cosine similarity. For fair comparison, we only attack the adjacency matrix in all experiments. Please refer to Appendix C for detailed experimental settings.
|
| 333 |
+
|
| 334 |
+
Main results. Similarly,we test FATE with both edge flipping (FATE-flip in Table 2) and edge addition (FATE-add in Table 2), while all other baseline methods only add edges.From Table 2, we have two key observations.(1)FATE-flip and FATE-add are effective: theyare the only methods that could consistently attack individual fairness whereas all other baseline methods mostly fail to attack individual fairness.(2) FATE-flip and FATE-add are deceptive: they achieve comparable or even better utility on all datasets compared with the utility on the benign graph. Hence,FATE framework is able to achieve effective and deceptive attacks to exacerbate individual bias.
|
| 335 |
+
|
| 336 |
+
Effect of the perturbation rate.From Table 2, we obtain similar observations as in Section 6.1 for Bail dataset. While for Pokec-n and Pokec-z, the correlation between the perturbation rate (Ptb.) and the individual bias is weaker. One possble reason is that: for Pokec-n and Pokec-z,the discrepancy between the oracle pairwise node similarity matrix and the benign graph is larger. Since the individual bias is computed using the oracle pairwise node similarity matrix rather than the benign/poisoned adjacency matrix, higher perturbation rate to poison the adjacency matrix may have less impact on the computation of individual bias.
|
| 337 |
+
|
| 338 |
+

|
| 339 |
+
Figure 2: Attcking individual fairness with FATE-flip. (a) Ratios of flipped edges that connect two nodes with same/different label. (b) Ratios of flipped edges whose two endpoints are both from the majority/minority class. Majority/minority classes are formed by splitting the training nodes based on their class labels.
|
| 340 |
+
|
| 341 |
+
30 Analysis on the manipulated edges. Similarly,since the majority of edges manipulated by FATE-flip
|
| 342 |
+
31 is through addition, we only analyze FATE-flip here.From Figure 2, we can find out that FATE will
|
| 343 |
+
32 manipulate edges from the same class (especially from the minority class). In this way,FATE would
|
| 344 |
+
33 find edges that could increase individual bias and improve the utility of the minority class in order to
|
| 345 |
+
34 make the fairness attack deceptive.
|
| 346 |
+
|
| 347 |
+
More experimental results. Due to the space limitation, we defer more experimental results on attacking individual fairness on graph neural networks in Appendix E.More specifically, we present the performance evaluation under different metrics,i.e., Macro F1 and AUC,as well as the effectiveness of FATE with a diferent victim model, i.e., InFoRM-GNN [20], which mitigates individual bias.
|
| 348 |
+
|
| 349 |
+
Table 2: Effectiveness of attcking individual fairness on GCN.FATE poisons the graph via both edge flipping (FATE-flip) and edge addition (FATE-add) while all other baselines poison the graph via edge addition.Higher is beter(↑) for micro F1 score (Micro F1) and InFoRM bias (Bias).Bold font indicates the success of fairness attack (i.e., bias is increased after attack) with the highest micro F1 score.Underlined cell indicates the failure of fairness attack (i.e., $\Delta _ { \mathrm { S P } }$ is decreased after attack).
|
| 350 |
+
|
| 351 |
+
<table><tr><td rowspan="2">Dataset</td><td rowspan="2">Ptb.</td><td colspan="2">Random</td><td colspan="2">DICE</td><td colspan="2">FA-GNN</td><td colspan="2">FATE-flip</td><td colspan="2">FATE-add</td></tr><tr><td>Micro F1(↑)</td><td>Bias(↑)</td><td>Micro F1(↑)</td><td>Bias(↑)</td><td>Micro F1(↑)</td><td>Bias(↑)</td><td>Micro F1(↑)</td><td>Bias(↑)</td><td>Micro F1(↑)</td><td>Bias (↑)</td></tr><tr><td rowspan="7">Pokec-n</td><td>0.00</td><td>67.5± 0.3</td><td>0.9±0.2</td><td>67.5±0.3</td><td>0.9±0.2</td><td>67.5±0.3</td><td>0.9±0.2</td><td>67.5±0.3</td><td>0.9±0.2</td><td>67.5±0.3</td><td>0.9±0.2</td></tr><tr><td>0.05</td><td>67.6±0.3</td><td>1.6 ±0.3</td><td>66.9 ±0.3</td><td>1.6 ± 0.2</td><td>67.8±0.5</td><td>1.9 ±0.2</td><td>67.8±0.3</td><td>1.2 ±0.4</td><td>67.6 ± 0.3</td><td>1.5 ± 0.6</td></tr><tr><td>0.10</td><td>67.2±0.5</td><td>1.4 ± 0.3</td><td>65.3±0.7</td><td>1.1 ± 0.1</td><td>67.4 ± 0.4</td><td>1.2 ±0.2</td><td>67.9 ±0.4</td><td>1.3 ± 0.3</td><td>67.7 ± 0.4</td><td>1.6 ± 0.4</td></tr><tr><td>0.15</td><td>67.2 ± 0.3</td><td>1.2 ± 0.4</td><td>63.9± 0.6</td><td>1.1 ± 0.2</td><td>66.1 ± 0.3</td><td>1.5±0.3</td><td>67.8±0.4</td><td>1.2 ± 0.2</td><td>67.6 ± 0.2</td><td>1.1 ±0.3</td></tr><tr><td>0.20</td><td>66.6±0.3</td><td>1.1 ±0.2</td><td>63.8± 0.1</td><td>0.8±0.1</td><td>65.7±0.6</td><td>1.5 ± 0.3</td><td>67.3 ± 0.4</td><td>1.1 ± 0.3</td><td>68.2± 1.0</td><td>1.7 ±0.8</td></tr><tr><td>0.25</td><td>66.7±0.3</td><td>1.3 ± 0.4</td><td>62.5± 0.4</td><td>0.6±0.0</td><td>65.2 ±0.5</td><td>1.3 ± 0.4</td><td>67.8±0.8</td><td>1.4 ±0.7</td><td>67.9±0.9</td><td>1.4±0.7</td></tr><tr><td>0.00</td><td>68.4 ± 0.4</td><td>2.6±0.7</td><td>68.4±0.4</td><td>2.6 ± 0.7</td><td>68.4 ± 0.4</td><td>2.6± 0.7</td><td>68.4 ± 0.4</td><td>2.6±0.7</td><td>68.4 ± 0.4</td><td>2.6±0.7</td></tr><tr><td rowspan="7">Pokec-z</td><td>0.05</td><td>69.0±0.4</td><td>3.4±0.5</td><td>67.1±0.5</td><td>2.7±1.0</td><td>68.1 ± 0.4</td><td>2.9±0.3</td><td>68.7±0.5</td><td>2.9 ±0.5</td><td>68.7± 0.4</td><td>3.1 ± 1.0</td></tr><tr><td>0.10</td><td>68.7 ±0.1</td><td>2.4 ±0.5</td><td>66.3± 0.6</td><td>1.7 ± 0.6</td><td>68.2 ±0.5</td><td>1.7 ± 0.5</td><td>69.0±0.6</td><td>2.9 ±0.6</td><td>69.0 ± 0.5</td><td>3.0±0.6</td></tr><tr><td>0.15</td><td>67.9 ±0.3</td><td>2.8±0.3</td><td>65.5±0.3</td><td>1.4 ± 0.3</td><td>67.0±0.5</td><td>1.3±0.2</td><td>68.6±0.5</td><td>2.9 ±0.6</td><td>69.0 ±0.7</td><td>2.7 ±0.4</td></tr><tr><td>0.20</td><td>67.9 ±0.3</td><td>2.2±0.6</td><td>64.2±0.4</td><td>0.7±0.3</td><td>66.1±0.1</td><td>1.6 ±0.5</td><td>68.8 ± 0.4</td><td>3.0 ± 0.4</td><td>69.2± 0.4</td><td>2.9 ±0.3</td></tr><tr><td>0.25</td><td>67.6±0.3</td><td>1.9±0.3</td><td>64.2±0.3</td><td>0.5±0.1</td><td>65.1±0.3</td><td>1.9 ±0.6</td><td>69.1 ±0.3</td><td>2.9±0.7</td><td>69.3±0.3</td><td>2.7±0.6</td></tr><tr><td>0.00</td><td>93.1±0.2</td><td>7.2 ±0.6</td><td>93.1 ± 0.2</td><td>7.2 ±0.6</td><td>93.1 ± 0.2</td><td>7.2 ±0.6</td><td>93.1 ± 0.2</td><td>7.2 ±0.6</td><td>93.1±0.2</td><td>7.2±0.6</td></tr><tr><td>0.05</td><td>92.1± 0.3</td><td>8.0±1.9</td><td>91.8±0.1</td><td>7.1 ± 1.1</td><td>91.2 ±0.2</td><td>5.6±0.7</td><td>93.0±0.3</td><td>7.8±1.0</td><td>92.9± 0.2</td><td>7.7±1.0</td></tr><tr><td rowspan="5">Bail</td><td>0.10</td><td>91.6 ± 0.1</td><td>7.3 ±1.2</td><td>90.3±0.1</td><td>6.1 ±0.6</td><td>90.3±0.1</td><td>5.1±0.4</td><td>93.0±0.1</td><td>8.0±0.7</td><td>92.9±0.2</td><td>7.9 ±0.8</td></tr><tr><td>0.15</td><td>91.3±0.1</td><td>6.5±0.9</td><td>89.4±0.0</td><td>4.8 ±0.1</td><td>89.8 ±0.1</td><td>5.2 ±0.1</td><td>93.1± 0.1</td><td>8.2 ±0.6</td><td>93.0±0.2</td><td>7.8 ±0.8</td></tr><tr><td>0.20</td><td>91.2 ±0.2</td><td>6.6±0.6</td><td>88.5±0.1</td><td>4.0±0.4</td><td>89.3 ± 0.1</td><td>5.3±0.4</td><td>93.1±0.1</td><td>7.9 ±0.6</td><td>93.1 ± 0.1</td><td>8.2±0.6</td></tr><tr><td>0.25</td><td>90.9 ±0.1</td><td>6.8±0.8</td><td>87.4±0.3</td><td>3.6±0.5</td><td>88.9 ±0.1</td><td>5.4±0.3</td><td>92.9 ±0.1</td><td>7.6±0.5</td><td>93.0±0.2</td><td>7.8 ±0.7</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></tr></table>
|
| 352 |
+
|
| 353 |
+
# 7Related Work
|
| 354 |
+
|
| 355 |
+
Algorithmic fairness on graphs aims to obtain debiased graph learning results such that a predefined fairness definition can be satisfied with respect to the nodes/edges in the graph. Several definitions of the fairness has been studied so far. Group fairness in graph embedding can be ensured via several ways,including adversarial learning-based methods [5,11],random walk-based methods [36,25] and dropout-based methods [39]. Individual fairness on graphs can be ensured via Lipschitz regularization [20] and learning-to-rank [13]. Other than the aforementioned two fairness definitions, several other fairness definitions are studied in the context of graph learning, including counterfactual fairness [1,31],degree fairness [42,24,29],dyadic fairness [32,27]and max-min fairness [37, 43]. For a comprehensive review of related works, please refer to existing surveys [50,10,14]and tutorials [22,23]. It should be noted that our work aims to attack fairness (i.e., making the model more biased) rather than ensuring fairness as in the aforementioned literature.
|
| 356 |
+
|
| 357 |
+
Adversarial attacks on graphs aim to exacerbate the utility of graph learning models by perturbing the input graph topology and/or node features. Several approaches have been proposed to attack graph learning models, including reinforcement learning [12], bi-level optimization [51, 52],projected gradient descent [40, 48] and edge rewiring/flipping [4,31]. Other than adversarial attacks that worsen the utility of a graph learning model,a few efforts have been made to attack the fairness of a machine learning model for IID tabular data via label flipping [33],adversarial data injection [38,8], adversarial sampling [44]. Different from [38,33,8,44], we aim to poison the input graph via structural modifications on the topology rather than injecting adversarial data sample(s). The most related work to our proposed method is by Hussain et al.[19], which degrade the group fairness of graph neural networks by randomly injecting edges for nodes in different demographic groups and with different class labels. In contrast,our proposed method could attck any fairness definition for any graph learning models via arbitrary edge manipulation operations, as long as the bias function and the utility loss are differentiable.
|
| 358 |
+
|
| 359 |
+
# 8Conclusion
|
| 360 |
+
|
| 361 |
+
We study the problem of fairness attacks on graph learning models, whose goal is to amplify the bias while maintaining the utility on the downstream task.We formally define the problem as a bi-level optimization problem, where the upper-level optimization problem maximizes the bias function with respect to a user-defined fairness definition and the lower-level optimization problem minimizes a task-specific loss function. We then propose a meta learning-based framework named FATE to poison the input graph using the meta-gradient of the bias function with respect to the input graph. We instantiate FATEby attcking statistical parity on graph neural networks in a binary node classification problem with binary sensitive attributes. Empirical evaluation demonstrates that FATE is effective (consistently amplifying bias) and deceptive (achieving the highest micro F1 score).
|
| 362 |
+
|
| 363 |
+
75References [1] Chirag Agarwal, Himabindu Lakkaraju, and Marinka Zitnik. Towards a unified framework for fair and stable graph representation learning. In Uncertainty in Artificial Intelligence, pages 2114-2124.PMLR,2021. [2] Joachim Baumann, Anik6 Hannak,and Christoph Heitz. Enforcing group fairness in algorithmic decision making: Utility maximization under suficiency. In 2O22 ACM Conference on Fairness, Accountability, and Transparency, pages 2315-2326, 2022. [3] Yoshua Bengio. Gradient-based optimization of hyperparameters. Neural computation, 12(8):1889-1900,2000. [4] Aleksandar Bojchevski and Stephan Gunnemann. Adversarial attacks on node embeddings via graph poisoning. In International Conference on Machine Learning, pages 695-7O4. PMLR, 2019. [5] Avishek Bose and William Hamilton. Compositional fairness constraints for graph embeddings. In International Conference on Machine Learning, pages 715-724. PMLR, 2019. [6] Consumer Financial Protection Bureau. CFPB targets unfair discrimination in consumerfinance. https://www.consumerfinance.gov/about-us/newsroom/ cfpb-targets-unfair-discrimination-in-consumer-finance/, 2022. [Online; accessed 13-April-2023]. [7] Yen-Chi Chen. A tutorial on kernel density estimation and recent advances. Biostatistics & Epidemiology,1(1):161-187, 2017. [8] Anshuman Chhabra, Adish Singla, and Prasant Mohapatra. Fairness degrading adversarial attacks against clustering algorithms. arXiv preprint arXiv:2110.12020, 2021. [9] Jaewoong Cho, Gyeongjo Hwang, and Changho Suh. A fair classifier using kernel density estimation. Advances in neural information processing systems, 33:15088-15099,2020. [10] Manvi Choudhary, Charlotte Laclau,and Christine Largeron. A survey on fairness for machine learning on graphs. arXiv preprint arXiv:2205.05396, 2022. [11] Enyan Dai and Suhang Wang. Say no to the discrimination: Learning fair graph neural networks with limited sensitive atribute information. In Proceedings of the 14th ACM International Conference on Web Search and Data Mining, pages 680-688, 2021. [12] Hanjun Dai, Hui Li, Tian Tian, Xin Huang,Lin Wang, Jun Zhu, and Le Song. Adversarial attack on graph structured data. In International conference on machine learning, pages 1115-1124. PMLR,2018. [13] Yushun Dong, Jian Kang, Hanghang Tong,and Jundong Li. Individual fairness for graph neural networks: A ranking based approach. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, pages 300-310, 2021.
|
| 364 |
+
10[14] Yushun Dong, Jing Ma, Chen Chen,and Jundong Li. Fairness in graph mining: A survey. arXiv preprint arXiv:2204.09888,2022. [15] Cynthia Dwork, Moritz Hardt, Toniann Pitass, Omer Reingold,and Richard Zemel. Fairness through awareness. In Proceedings of the 3rd innovations in theoretical computer science conference, pages 214-226,2012. [16]Michael Feldman, Sorelle A Friedler, John Moeller, Carlos Scheidegger, and Suresh Venkatasubramanian. Certifying and removing disparate impact. In proceedings of the 21th ACM SIGKDD international conference on knowledge discovery and data mining, pages 259-268, 2015.
|
| 365 |
+
19[17] Chelsea Finn,Pieter Abbeel,and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International conference on machine learning, pages 1126-1135. PMLR,2017.
|
| 366 |
+
[18] Moritz Hardt, Eric Price, and Nati Srebro. Equality of opportunity in supervised learning. Advances in neural information processing systems, 29,2016.
|
| 367 |
+
[19] Hussain Hussain,Meng Cao, Sandipan Sikdar,Denis Helic, Elisabeth Lex,Markus Strohmaier, and Roman Kern. Adversarial inter-group link injection degrades the fairness of graph neural networks. arXiv preprint arXiv:2209.05957,2022.
|
| 368 |
+
[20] Jian Kang, Jingrui He, Ross Maciejewski,and Hanghang Tong. Inform: Individual fairness on graph mining. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 379-389,2020.
|
| 369 |
+
[21] Jian Kang and Hanghang Tong. N2n: Network derivative mining. In Proceedings of the 28th ACM International Conference on Information and Knowledge Management, pages 861-870, 2019.
|
| 370 |
+
[22] Jian Kang and Hanghang Tong.Fair graph mining.In Proceedings ofthe 3Oth ACM International Conference on Information & Knowledge Management, pages 4849-4852,2021.
|
| 371 |
+
[23] Jian Kang and Hanghang Tong. Algorithmic fairness on graphs: Methods and trends. In Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pages 4798-4799,2022.
|
| 372 |
+
[24] Jian Kang, Yan Zhu, Yinglong Xia, Jiebo Luo,and Hanghang Tong. Rawlsgcn: Towards rawlsian difference principle on graph convolutional network. In Proceedings of the ACM Web Conference 2022, pages 1214-1225,2022.
|
| 373 |
+
[25] Ahmad Khajehnejad,Moein Khajehnejad, Mahmoudreza Babaei, Krishna P Gummadi,Adrian Weler, and Baharan Mirzasoleiman. Crosswalk: Fairness-enhanced node representation learning. In Proceedings of the AAAl Conference on Artificial Intelligence, volume 36, pages 11963-11970,2022.
|
| 374 |
+
[26] Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations,2017.
|
| 375 |
+
[27] Peizhao Li, Yifei Wang, Han Zhao, Pengyu Hong,and Hongfu Liu. On dyadic fairness: Exploring and mitigating bias in graph connections. In International Conference on Learning Representations,2021.
|
| 376 |
+
[28] Lydia TLiu, Sarah Dean, Esther Rolf, Max Simchowitz,and Moritz Hardt. Delayed impact of fair machine learning. In International Conference on Machine Learning, pages 3150-3158. PMLR,2018.
|
| 377 |
+
[29] Zemin Liu, Trung-Kien Nguyen, and Yuan Fang. On generalized degree fairness in graph neural networks. arXiv preprint arXiv:2302.03881,2023.
|
| 378 |
+
[30] Miguel López-Benitez and Fernando Casadevall. Versatile,accurate,and analytically tractable approximation for the gaussian q-function. IEEE Transactions on Communications,59(4):917- 922,2011.
|
| 379 |
+
[31] Yao Ma, Suhang Wang,Tyler Derr,Lingfei Wu,and Jiliang Tang. Graph adversarial attack via rewiring. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, pages 1161-1169,2021.
|
| 380 |
+
[32] Farzan Masrour, Tyler Wilson, Heng Yan, Pang-Ning Tan,and Abdol Esfahanian. Bursting the filter bubble: Fairness-aware network link prediction. In Proceedings of the AAAI conference on artificial intelligence, volume 34, pages 841-848,2020.
|
| 381 |
+
[33] Ninareh Mehrabi, Muhammad Naveed, Fred Morstatter, and Aram Galstyan.Exacerbating algorithmic bias through fairness attcks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 8930-8938,2021.
|
| 382 |
+
[34] Lawrence Page, Sergey Brin, Rajeev Motwani,and Terry Winograd. The pagerank citation ranking: Bringing order to the web. Technical report, Stanford InfoLab,1999.
|
| 383 |
+
169[35] Flavien Prost,Hai Qian, Qiuwen Chen,Ed HChi,Jilin Chen,and Alex Beutel. Toward a better trade-off between performance and fairness with kernel-based distribution matching. arXiv preprint arXiv:1910.11779,2019.
|
| 384 |
+
172[36] Tahleen Rahman, Bartlomiej Surma, Michael Backes,and Yang Zhang. Fairwalk: Towards fair graph embedding. In Proceedings of the 28th International Joint Conference on Artificial Intelligence, pages 3289-3295,2019.
|
| 385 |
+
175[37] Aida Rahmattalabi,Phebe Vayanos,Anthony Fulginiti,Eric Rice,Bryan Wilder,Amulya Yadav, and Milind Tambe. Exploring algorithmic fairness in robust graph covering problems. Advances in Neural Information Processing Systems,32, 2019. [38] David Solans, Battista Biggio,and Carlos Castillo. Poisoning attcks on algorithmic fairness. In Machine Learning and Knowledge Discovery in Databases: European Conference, ECML PKDD 2020, Ghent, Belgium, September 14-18,2020,Proceedings,Part I, pages 162-177. Springer, 2021. [39] Indro Spineli, Simone Scardapane, Amir Hussain,and Aurelio Uncini. Fairdrop: Biased edge dropout for enhancing fairness in graph representation learning. IEEE Transactions on Artificial Intelligence,3(3):344-354,2021. [40] Mingjie Sun, Jian Tang,Huichen Li,Bo Li, Chaowei Xiao, Yao Chen,and Dawn Song. Data poisoning attack against unsupervised node embedding methods. arXiv preprint arXiv:1810.12881, 2018. [41] Jian Tang, Meng Qu, Mingzhe Wang,Ming Zhang, Jun Yan,and Qiaozhu Mei. Line: Largescale information network embedding. In Proceedings of the 24th international conference on world wide web, pages 1067-1077,2015. [42] Xianfeng Tang, Huaxiu Yao, Yiwei Sun, Yiqi Wang, Jiliang Tang, Charu Aggarwal, Prasenjit Mitra, and Suhang Wang. Investigating and mitigating degree-related biases in graph convolutional networks. In Proceedings of the 29th ACM International Conference on Information & Knowledge Management, pages 1435-1444,2020. [43] Alan Tsang,Bryan Wilder, Eric Rice,Milind Tambe,and Yair Zick. Group-fairness in influence maximization. In Proceedings of the 28th International Joint Conference on Artificial Intelligence, pages 5997-6005,2019.
|
| 386 |
+
198[44] Minh-Hao Van, Wei Du, Xintao Wu,and Aidong Lu. Poisoning attacks on fair machine learning. In International Conference on Database Systems for Advanced Applications, pages 370-386. Springer, 2022. [45] Daixin Wang, Jianbin Lin, Peng Cui, Quanhui Jia, Zhen Wang, Yanming Fang, Quan Yu, Jun Zhou, Shuang Yang,and Yuan Qi. A semi-supervised graph atentive network for financial fraud detection. In 2019 IEEE International Conference on Data Mining (ICDM), pages 598-607. IEEE,2019.
|
| 387 |
+
505[46] Marcin Waniek, Tomasz_P Michalak,Michael J Wooldridge,and Talal Rahwan.Hiding individuals and communities in a social network. Nature Human Behaviour,2(2):139-147, 2018.
|
| 388 |
+
508[47] Felix Wu, Amauri Souza, Tianyi Zhang, Christopher Fifty, Tao Yu, and Kilian Weinberger. Simplifying graph convolutional networks. In International conference on machine learning, pages 6861-6871. PMLR,2019. [48] Kaidi Xu, Hongge Chen, Sijia Liu, Pin-Yu Chen, Tsui-Wei Weng,Mingyi Hong,and Xue Lin. Topology attack and defense for graph neural networks: An optimization perspective. In Proceedings of the 28th International Joint Conference on Artificial Intelligence, pages 3961-3967,2019.
|
| 389 |
+
;15[49] Si Zhang,Dawei Zhou, Mehmet Yigit Yildirim, Scot Alcorn,Jingrui He,Hasan Davulcu,and Hanghang Tong. Hidden: Hierarchical dense subgraph detection with application to financial fraud detection. In Proceedings of the 20l7 SIAM International Conference on Data Mining, pages 570-578. SIAM,2017.
|
| 390 |
+
[50] Wenbin Zhang, Jeremy C Weiss,Shuigeng Zhou, and Toby Walsh. Fairness amidst non-iid graph data: A literature review. arXiv preprint arXiv:2202.07170, 2022.
|
| 391 |
+
[51] Daniel Zügner, Amir Akbarnejad,and Stephan Gunnemann. Adversarial attacks on neural networks for graph data. In Proceedings of the 24th ACM SIGKDD international conference on knowledge discovery & data mining, pages 2847-2856,2018.
|
| 392 |
+
[52] Daniel Zügner and Stephan Gunnemann. Adversarial attcks on graph neural networks via meta learning. In International Conference on Learning Representations, 2019.
|
md/dev/uytgM9N0vlR/uytgM9N0vlR.md
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Does GNN Pretraining Help Molecular Representation?
|
| 2 |
+
|
| 3 |
+
Ruoxi Sun Google Cloud AI Research ruoxis@google.com
|
| 4 |
+
|
| 5 |
+
Hanjun Dai Google Research, Brain Team hadai@google.com
|
| 6 |
+
|
| 7 |
+
Adams Wei Yu Google Research, Brain Team adamsyuwei@google.com
|
| 8 |
+
|
| 9 |
+
# Abstract
|
| 10 |
+
|
| 11 |
+
Extracting informative representations of molecules using Graph neural networks (GNNs) is crucial in AI-driven drug discovery. Recently, the graph research community has been trying to replicate the success of self-supervised pretraining in natural language processing, with several successes claimed. However, we find the benefit brought by self-supervised pretraining on small molecular data can be negligible in many cases. We conduct thorough ablation studies on the key components of GNN pretraining, including pretraining objectives, data splitting methods, input features, pretraining dataset scales, and GNN architectures, to see how they affect the accuracy of the downstream tasks. Our first important finding is, self-supervised graph pretraining do not always have statistically significant advantages over non-pretraining methods in many settings. Secondly, although noticeable improvement can be observed with additional supervised pretraining, the improvement may diminish with richer features or more balanced data splits. Thirdly, hyper-parameters could have larger impacts on accuracy of downstream tasks than the choice of pretraining tasks, especially when the scales of downstream tasks are small. Finally, we provide our conjectures where the complexity of some pretraining methods on small molecules might be insufficient, followed by empirical evidences on different pretraining datasets.
|
| 12 |
+
|
| 13 |
+
# 1 Introduction
|
| 14 |
+
|
| 15 |
+
Graph neural networks (GNNs) , due to their effectiveness, have been adopted to model a wide range of structured data, such as social networks, road graphs, citation networks, etc. Molecule modeling is one of these important applications, where it serves as the foundation of biomedicine and nurturing techniques like novel drug discovery. However, labeling biomedical data are usually time-consuming and expensive and thus task-specific labels are extremely inadequate. This poses a big challenge to the field. Recently, inspired by the remarkable success of self-supervised pretraining from natural language processing [6, 2, 28] and computer vision domains [11, 5], researchers start trying to apply the pretrain-finetune paradigm to molecule modeling with GNN, hoping to boost the performance of various molecular tasks by pretraining the model on the enormous unlabeled data. For instance, many methods have been proposed [32, 29], where significant performance improvements are claimed by pretraining on large scale datasets [12, 22, 35–37]. Despite of the promising results, we find that reproducing some of these outstanding gains via graph pretraining can be non-trivial, and sometimes the improvement largely relies on the experimental setup and the extensive hyper-parameter tuning of downstream tasks, rather than the design of pretraining objectives. These observations motivate us to rethink the effectiveness of graph pretraining with unsupervised or self-supervised objectives, and investigate what factors would influence the effectiveness of self-supervised graph pretraining.
|
| 16 |
+
|
| 17 |
+
In this paper, we perform systematic studies to assess the performance of popular graph pretraining objectives on different types of datasets, and exploit various confounding components in experimental setup in deciding the performance of downstream tasks with or without pretraining. Here, we restrict our studies to small molecular graphs, as opposed to other application domains, such as social networks or citation graphs. The key insights and take-aways of this paper are:
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: A typical pipeline for graph pretraining and deployment for downstream applications.
|
| 21 |
+
|
| 22 |
+
• Among the pretraining tasks we evaluated, the self-supervised pretraining alone does not provide statistically significant improvements over non-pretrained methods on downstream tasks.
|
| 23 |
+
• When additional supervised pretraining step is conducted after self-supervised pretraining, we observe statistically significant improvements. However, the gain becomes marginal on some specific data splits or diminishes if richer features are introduced.
|
| 24 |
+
• Beyond data splits and hand-crafted features, the usefulness of graph pretraining is also sensitive to the experimental hyperparameters, such as learning rates and number of study repeats. Different setups can lead to opposite conclusions.
|
| 25 |
+
• In conclusion, different from the previous works, we do not observe clear and unconditional gains achieved by graph pretraining on molecular representation, indicating it is still too early to conclude graph pretraining is effective in molecular domain.
|
| 26 |
+
• We investigate the reason of above and hypothesize that the complexity of some pretraining methods on molecules is insufficient, leading to less transferable knowledge for downstream tasks.
|
| 27 |
+
|
| 28 |
+
Despite the overall negative results we obtained, the main goal of this paper is not to discourage the pretraining research for small molecules. Instead, we hope to raise the attention on different aspects of experiments and the role of simple hand-crafted features, so as to provide useful information for designing better pretraining approaches. Below we first introduce the background of GNN and its pretraining in Section 2, and then our experimental design and results in Section 3 and Section 4, respectively. Finally we conclude with our findings and the limitations in Section 5 and Section 6.
|
| 29 |
+
|
| 30 |
+
# 2 Preliminary
|
| 31 |
+
|
| 32 |
+
Table 1: Summary of Experiments. Table 12 and Table 13 are deferred to appendix due to space limit.
|
| 33 |
+
|
| 34 |
+
<table><tr><td rowspan=2 colspan=1></td><td rowspan=1 colspan=1>Pretrain Objective</td><td rowspan=1 colspan=1>GraphFeatures</td><td rowspan=1 colspan=1>DownstreamSplits</td><td rowspan=1 colspan=1>GNN Arch</td><td rowspan=1 colspan=1>PretrainDataset</td></tr><tr><td rowspan=1 colspan=1>Self-SupervisedSupervised</td><td rowspan=1 colspan=1>Rich Basic</td><td rowspan=1 colspan=1>Balanced Scaffold</td><td rowspan=1 colspan=1>GIN GraphSage</td><td rowspan=1 colspan=1>ZINC15 SAVI</td></tr><tr><td rowspan=1 colspan=1>Table 2</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>Table 3</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>Table4</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>Table 5</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>Table6</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>Table7</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>Table8</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>Table9</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>Table10</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>Table 11</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>Table12</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>Table13</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>
|
| 35 |
+
|
| 36 |
+
Graph Neural Networks (GNNs). Let $G = \{ V , E \}$ denote a molecule graph with $V$ as the set of nodes and $E$ as the set of edges. Given the node features $X _ { i }$ , most GNNs learn an embedding representation $h _ { i }$ for every node $i \in V$ by aggregating representations from connected nodes and
|
| 37 |
+
|
| 38 |
+
edges, denoted as graph convolution. These procedure repeats for $K$ times with the update equation as follows:
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
h _ { i } ^ { k } = \mathrm { U P D A T E } ( h _ { i } ^ { k - 1 } , \mathrm { A G G R E G A T E } ( \{ h _ { i } ^ { k - 1 } , h _ { j } ^ { k - 1 } , e _ { i j } \} : \forall j \in N ( i ) ) )
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
where $\mathcal { N } ( i )$ is the set of neighbor nodes of $i$ and $\begin{array} { r c l } { h _ { i } ^ { 0 } } & { = } & { X _ { i } } \end{array}$ . The representation for entire graph $G$ is then obtained by permutation-invariant transformation on node representation, $h _ { G } \ = \ \mathrm { \hat { R } E A D O U T } ( h _ { i } ^ { K } | i \ \in \ V )$ . In this paper we mainly study the GNNs that belong to this family, namely the WL-1 GNNs.
|
| 45 |
+
|
| 46 |
+
Finetune. After the pretraining, the pretrained model is used to finetune on the downstream tasks. For molecule property prediction tasks, the graph-level representation obtained from the pretrained model is connected to linear classifiers to predict downstream task labels. The fine-tuning is performed in an end-to-end manner, where both the pretrained GNN and the linear classifiers are trainable.
|
| 47 |
+
|
| 48 |
+
Graph pretraining objectives. The primary goal of pretraining is to learn representations with robust transferable knowledge of graphs from the abundant pretraining data and then generalize to downstream tasks with usually different supervision signals. Generally the pretraining objectives can be categorized into self-supervised and supervised ones. We present a brief overview of some representative objectives in the following sections.
|
| 49 |
+
|
| 50 |
+
# 2.1 Self-supervised (unsupervised) pretraining
|
| 51 |
+
|
| 52 |
+
In self-supervised pretraining, the pretraining objective is designed to learn self-generated targets from the structure of the molecules, such as the type of nodes and edges, prediction of local context, graph partition, node clustering, occurrence of some functional groups, and etc. The predictive target can be node/edge level or entire graph level. We present some representative ones below:
|
| 53 |
+
|
| 54 |
+
# 2.1.1 Node Prediction
|
| 55 |
+
|
| 56 |
+
Node prediction is a node-level classification task given the masked context of entire graph. Similar to Devlin et al. [6], some portion of node attributes are masked and replaced with mask-specified indicators in the node input feature. After graph convolution, the embedding output from GNN is used to predict the true attribute of the node, e.g. atom type in molecular graphs, through a linear classifier on top of the node embedding.
|
| 57 |
+
|
| 58 |
+
# 2.1.2 Context Prediction
|
| 59 |
+
|
| 60 |
+
Context prediction task is a sub-graph level task aiming at learning embedding that can represent the local subgraph surrounding a node. Generally it can be viewed as a masked task for substructure. Since it is essentially a structured prediction which can be difficult in general, Hu et al. [12] leverages the adversarial learning to teach the model to distinguish the positive sub-graph embedding from the negative ones. Rong et al. [22] instead builds a dictionary of structures that captures the property of sub-graphs (e.g. type and quantity of neighbour nodes and bonds), and turns it into a multi-class classification problem.
|
| 61 |
+
|
| 62 |
+
# 2.1.3 Motif Prediction
|
| 63 |
+
|
| 64 |
+
Motif prediction [22] is to predict the existence of functional groups, such as benzene ring or hydroxyl. The motifs are extracted automatically from RDKit [15] . The motif prediction task is formulated as a graph-level multi-label binary classification task, where the graph embedding is used to jointly predict the occurrence of these semantic functional motifs.
|
| 65 |
+
|
| 66 |
+
# 2.1.4 Contrastive learning
|
| 67 |
+
|
| 68 |
+
Graph contrastive learning is to maximize the agreement of two augmented views of the same graph, and minimize the agreement of different graphs. The optimization is conducted using contrastive loss in the latent embedding space [35, 10, 37, 29]. The augmentation function needs to transform graphs into realistic and novel augmentations without affecting semantic labels of the graphs. For example, the transformation can be small perturbations or modifications on node/edge embedding, drop of a few nodes or edges, and so on. These transformations enforce an underlying prior for contrastive learning, that is, local transformation does not change the semantic meaning of a graph.
|
| 69 |
+
|
| 70 |
+
Table 2: Self-supervised $^ +$ Rich feature $^ +$ Balanced Scaffold Split. No pretrain has an average value of $7 8 . 0 \%$ over all 5 datasets.
|
| 71 |
+
|
| 72 |
+
<table><tr><td>Methods</td><td>BBBP</td><td>BACE</td><td>TOX21</td><td>TOXCAST</td><td>SIDER</td><td>AVE GAIN</td></tr><tr><td>No pretrain</td><td>92.23(±3.07)</td><td>87.43(±1.63)</td><td>79.20(±1.99)</td><td>69.13(±0.55)</td><td>61.92(±0.89)</td><td>0(±1.626)</td></tr><tr><td>Node Prediction</td><td>92.24(±2.76)</td><td>87.32(±1.67)</td><td>79.57(±2.03)</td><td>69.77(±0.13)</td><td>61.62(±1.12)</td><td>0.122(±1.542)</td></tr><tr><td>Context Prediction</td><td>92.68(±1.19)</td><td>86.98(±1.26)</td><td>79.05(±2.51)</td><td>70.18(±0.44)</td><td>61.65(±0.77)</td><td>0.126(±1.234)</td></tr><tr><td>Motif Prediction</td><td>92.63(±1.19)</td><td>87.16(±1.66)</td><td>79.22(±2.38)</td><td>69.09(±0.07)</td><td>62.45(±1.25)</td><td>0.128(±1.310)</td></tr><tr><td>Contrastive learning</td><td>92.31(±1.58)</td><td>86.67(±2.40)</td><td>78.45(±2.44)</td><td>68.37(±0.80)</td><td>61.22(±1.20)</td><td>-0.578(±1.684)</td></tr></table>
|
| 73 |
+
|
| 74 |
+
# 2.2 Supervised pretraining
|
| 75 |
+
|
| 76 |
+
Supervised pretraining aims to learn domain-specific graph-level knowledge from specifically designed pretraining tasks. For molecular application, the supervised labels are generated from a diverse set of functional studies like biochemical assays. The pretrainning task is to perform multiple binary classification and jointly learn the supervised labels. Although the pretraining mainly refers to unsupervised or self-supervised methods as they are not limited by the requirement of supervised labels, supervised pretraining is still a great source to investigate the graph pretraining in general.
|
| 77 |
+
|
| 78 |
+
Table 3: Supervised $^ +$ Rich feature $^ +$ Balanced Scaffold. No pretrain has an average AUC of $7 8 . 0 \%$ .
|
| 79 |
+
|
| 80 |
+
<table><tr><td>Methods</td><td>BBBP</td><td>BACE</td><td>TOX21</td><td>TOXCAST</td><td>SIDER</td><td>AVE GAIN</td></tr><tr><td>No pretrain</td><td>92.23(±3.07)</td><td>87.43(±1.63)</td><td>79.2(±1.99)</td><td>69.13(±0.55)</td><td>61.92(±0.89)</td><td>0(±1.626)</td></tr><tr><td>Supervised</td><td>91.65(±2.11)</td><td>86.91(±1.86)</td><td>81.13(±2.39)</td><td>71.64(±0.46)</td><td>62.14(±1.13)</td><td>0.712(±1.590)</td></tr><tr><td>Masking Node + Supervised</td><td>93.43(±2.50)</td><td>86.90(±2.04)</td><td>81.93(±1.79)</td><td>71.66(±0.73)</td><td>62.68(±1.82)</td><td>1.338(±1.776)</td></tr><tr><td>Context Prediction + Supervised</td><td>92.27(±1.57)</td><td>88.72(±1.68)</td><td>81.71(±1.79)</td><td>72.19(±0.79)</td><td>63.21(±1.49)</td><td>1.638(±1.464)</td></tr></table>
|
| 81 |
+
|
| 82 |
+
# 3 Experiment framework
|
| 83 |
+
|
| 84 |
+
To investigate pretraining on graphs for molecule representations, we first revisit the typical pretraining-finetuning pipeline used in the literature. Figure 1 shows the overall procedure of deployment, with several design choices presented at each stage of the pipeline. Since different choices at each stage can lead to different performances on the downstream tasks, we investigate them one at a time while keeping others the unchanged. The design principle of our experiment framework is to analyze the effect of every stage in the pipeline as comprehensive as possible, while also keeping it tractable to avoid exponentially many experiments.
|
| 85 |
+
|
| 86 |
+
# 3.1 Design choices
|
| 87 |
+
|
| 88 |
+
We consider the design choices for the four pretraining objectives.
|
| 89 |
+
|
| 90 |
+
Pretraining objective In Section 2 we have provided a brief literature review over the pretraining methods for molecule representation. Here we categorize those pretraining by different principles, and present one well-recognized representative of each category. The representatives are selected because they have more desired properties, such as better performance, compared with their counterparts.
|
| 91 |
+
|
| 92 |
+
• Masking. We leverage the node prediction objective, which randomly masks $1 5 \%$ of the nodes’ feature and then ask GNN to make prediction on the node attributes of the masked ones. This strategy resembles the BERT pretraining [6] in natural language processing.
|
| 93 |
+
• Structured. Unlike text data where the topology is a sequence, the graph has rich structure information. Following Hu et al. [12], we use context prediction objective, which masks out the context from $k _ { 1 }$ -hops to $k _ { 2 }$ -hops and leverages adversarial training to predict the true context embeddings from the random context embeddings.
|
| 94 |
+
• Graph-level self-supervised. Following [22], GNN is asked to predict whether a motif is contained in a molecule. The motif can be extracted from the molecule with RDKit [15]. The motifs are 85 motifs 1 for multi-label classification.
|
| 95 |
+
|
| 96 |
+
Table 4: Self-supervised $^ +$ Rich feature $^ +$ Scaffold. No pretrain has an average ROC-AUC of $7 1 . 8 \%$ over all benckmark datasets.
|
| 97 |
+
|
| 98 |
+
<table><tr><td>Methods</td><td>BBBP</td><td>BACE</td><td>TOX21</td><td>TOXCAST</td><td>SIDER</td><td>AVE GAIN</td></tr><tr><td>No pretrain</td><td>74.83(±0.73)</td><td>80.10(±0.42)</td><td>75.86(±0.58)</td><td>65.95(±0.15)</td><td>62.30(±1.14)</td><td>0(±0.579)</td></tr><tr><td>Node Prediction</td><td>73.45(±0.27)</td><td>83.66(±0.75)</td><td>75.30(±0.37)</td><td>66.50(±0.06)</td><td>65.08(±0.12)</td><td>0.990(±0.323)</td></tr><tr><td>Context Prediction</td><td>74.10(±0.22)</td><td>81.87(±0.49)</td><td>75.37(±0.11)</td><td>66.86(±0.07)</td><td>62.84(±0.46)</td><td>0.400(±0.280)</td></tr><tr><td>Motif Prediction</td><td>73.65(±0.36)</td><td>80.58(±2.04)</td><td>74.55(±0.79)</td><td>65.63(±0.07)</td><td>64.05(±0.23)</td><td>-0.116(±0.766)</td></tr><tr><td>Contrastive learning</td><td>73.32(±2.38)</td><td>80.51(±0.80)</td><td>74.55(±0.22)</td><td>65.70(±0.09)</td><td>64.39(±0.63)</td><td>-0.114(±0.513)</td></tr></table>
|
| 99 |
+
|
| 100 |
+
Table 5: Supervised $^ +$ Self-supervised $^ +$ Rich feature $^ +$ Scaffold. No pretrain get $7 1 . 8 \%$ average ROC-AUC.
|
| 101 |
+
|
| 102 |
+
<table><tr><td>Methods</td><td>BBBP</td><td>BACE</td><td>TOX21</td><td>TOXCAST</td><td>SIDER</td><td>AVE GAIN</td></tr><tr><td>No pretrain</td><td>74.83(±0.73)</td><td>80.10(±0.42)</td><td>75.86(±0.58)</td><td>65.95(±0.15)</td><td>62.30(±1.14)</td><td>0(±0.604)</td></tr><tr><td>Supervised</td><td>72.79(± 0.7)</td><td>83.23(±0.67)</td><td>77.66(±0.08)</td><td>67.72(±0.13)</td><td>65.34(±0.17)</td><td>1.540(±0.350)</td></tr><tr><td>Masking Node+ Supervised</td><td>73.38(±0.55)</td><td>84.42(±0.27)</td><td>77.85(±0.24)</td><td>67.14(±0.28)</td><td>64.06(±0.28)</td><td>1.562(±0.324)</td></tr><tr><td>Context Prediction + Supervised</td><td>73.81(±0.52)</td><td>84.35(±0.93)</td><td>77.11(±0.14)</td><td>67.87(±0.08)</td><td>65.19(±0.17)</td><td>1.858(±0.368)</td></tr></table>
|
| 103 |
+
|
| 104 |
+
• Contrastive. We generate two views of the same graph by corrupting the input node features with Gaussian noise. We leverage the contrastive learning loss proposed in [35]: we maximize the consistency between positive pairs (from same graphs) and minimize that between negative pairs (from different graphs). In this paper, we restrict ourselves to this specific contrastive training method, however, various contrastive learning methods can be further explored.
|
| 105 |
+
|
| 106 |
+
• Graph-level supervised. Finally when applicable, we use the ChEMBL dataset with graph-level labels for graph-level supervised pretraining as Hu et al. [12].
|
| 107 |
+
|
| 108 |
+
The above are the design choices for pretraining objectives. Next, we consider other factors that influence graph-pretraining performance.
|
| 109 |
+
|
| 110 |
+
Graph Features Each molecule is represented by a graph with atoms as nodes and bonds as edges. In this paper we mainly consider the graph representations without the 3D information. For each molecule graph, chemical properties of nodes and edges are extracted to serve as node and edge features for the graph neural networks. Depending on how rich the features are, we categorize the design choices into two categories:
|
| 111 |
+
|
| 112 |
+
• Basic features. The basic set of features are the ones used in Hu et al. [12]. Specifically, the node features contain the atom type and the derived features, such as formal charge list, chirality list, etc. The edge features contain the bond types and the bond directions. These features are categorical, and thus will be encoded in a one-hot vector individually and then concatenated together to form the feature vector for node/edge representation.
|
| 113 |
+
|
| 114 |
+
• Rich features. The rich feature set is a superset of the basic features. In addition to the basic ones mentioned above, it comes with the additional node features such as hydrogen acceptor match, acidic match and bond features such as ring information. This set of features are used in Rong et al. [22]. Additionally and importantly, we follow their setting to incorporate additional 2d normalized rdNormalizedDescriptors features 2, which is used in the downstream tasks only and not in pretraining.
|
| 115 |
+
|
| 116 |
+
Please refer to the original papers for the full set of basic [12] and rich [22] features, respectively.
|
| 117 |
+
|
| 118 |
+
GNN Backbone The GNN architecture also plays a role in graph pretraining. In Hu et al. [12], the results show that pretraining on GNN variants like GIN [33] would improve the performance on downstream tasks, while the performance with architectures like GAT [27] would actually get worse performance with pretraining. As the GNNs based on 1-Weisfeiler-Lehman (WL) test have similar representation power [33] bounded by the Weisfeiler-Lehman isomorphism check [23], we consider the two representative GNN architectures, namely the GIN [33] and GraphSage [9]. They have shown benefits with graph pretraining in Hu et al. [12].
|
| 119 |
+
|
| 120 |
+
Pretraining dataset In natural language pretraining, researchers observed a significant performance boost due to self-supervised pretraining on large-scale data, that is, the larger the pretraining dataset is, the better the downstream performance it is [20]. Inspired by this success in natural language processing, we test the algorithms on two unlabeled pretraining datasets with different scales.
|
| 121 |
+
|
| 122 |
+
Table 6: Self-supervised $^ +$ Basic feature $^ +$ Balanced Scaffold. No pretrain has an average AUC of $7 6 . 7 \%$ over all 5 datasets.
|
| 123 |
+
|
| 124 |
+
<table><tr><td>Methods</td><td>BBBP</td><td>BACE</td><td>TOX21</td><td>TOXCAST</td><td>SIDER</td><td>AVEGAIN</td></tr><tr><td>No pretrain</td><td>91.46(± 0.85)</td><td>84.29(± 3.80)</td><td>78.35(± 0.95)</td><td>68.31(± 1.61)</td><td>61.15(± 2.46)</td><td>0(±1.934)</td></tr><tr><td>Node Prediction</td><td>91.23(± 1.51)</td><td>84.97(± 1.55)</td><td>77.77(± 1.23)</td><td>68.98(± 1.11)</td><td>61.20(± 0.41)</td><td>0.118(±1.162)</td></tr><tr><td>Context Prediction</td><td>92.13(± 1.04)</td><td>84.83(± 3.19)</td><td>78.79(± 2.52)</td><td>68.29(± 1.23)</td><td>62.32(± 2.99)</td><td>0.560(±2.194)</td></tr></table>
|
| 125 |
+
|
| 126 |
+
Table 7: Supervised $^ +$ Self-supervised $^ +$ Basic feature $^ +$ Balanced Scaffold. No pretrain has an average AUC of $7 6 . 7 \%$ .
|
| 127 |
+
|
| 128 |
+
<table><tr><td>Methods</td><td>BBBP</td><td>BACE</td><td>TOX21</td><td>TOXCAST</td><td>SIDER</td><td>AVE GAIN</td></tr><tr><td>No pretrain</td><td>91.46(± 0.85)</td><td>84.29(± 3.80)</td><td>78.35(± 0.95)</td><td>68.31(± 1.61)</td><td>61.15(± 2.46)</td><td>0(±1.934)</td></tr><tr><td>Supervised</td><td>90.70(± 0.74)</td><td>84.22(± 2.69)</td><td>80.45(± 1.47)</td><td>69.47(± 1.06)</td><td>63.38(± 1.44)</td><td>0.932(± 1.480)</td></tr><tr><td>Masking Node + Supervised</td><td>91.10(± 2.88)</td><td>85.54(± 4.57)</td><td>81.49(± 1.52)</td><td>70.77(± 1.00)</td><td>62.81(± 2.61)</td><td>1.630(± 2.516)</td></tr><tr><td>Context Prediction + Supervised</td><td>91.54(± 3.52)</td><td>85.71(± 2.92)</td><td>81.23(± 1.94)</td><td>71.36(± 1.05)</td><td>62.75(± 2.27)</td><td>1.806(± 2.340)</td></tr></table>
|
| 129 |
+
|
| 130 |
+
• ZINC15 [25]: ZINC15 contains 2 million molecules. This dataset was preprocessed following Hu et al. [12]. • SAVI [19]: The SAVI dataset contains about 1 billion molecules, which are significantly larger than ZINC15. To the best of our knowledge, it has never been used for pretraining tasks before. This dataset contains drug-like molecules synthesized by computer simulated reactions.
|
| 131 |
+
|
| 132 |
+
Additionaly, we used ChEMBL [8] as the supervised datasets. Different from the above ZINC15 and SAVI dataset which are only used for self-supervised pretraining, this dataset contains $5 0 0 \mathrm { k }$ drug-able molecules with 1,310 prediction target labels from bio-activity assays for drug discovery. Thus like in Hu et al. [12] we only leverage it for supervised pretraining.
|
| 133 |
+
|
| 134 |
+
Data split on downstream tasks The downstream tasks for molecular domain we used are 5 benchmark datasets from MoleculeNet [30] (See Appendix A.5 for more details). The train/valid/test sets are split with ratio 8:1:1. For molecule domain, the random split is not the most meaningful way to assess the performance, because the real-world scenarios often require generalization ability on out-of-distribution samples. So we consider the following ways to split the data:
|
| 135 |
+
|
| 136 |
+
• Scaffold Split [12, 21] This strategy first sorts the molecules according to the scaffold (e.g. molecule structure), and then partition the sorted list into train/valid/test splits consecutively. Therefore, the molecules in train and test sets are most different ones according to their molecule structure. Note this strategy would yield deterministic data splits.
|
| 137 |
+
• Balanced Scaffold Split [1, 22] This strategy introduces the randomness in the sorting and splitting stages above, thus one can run on splits with different random seeds and report the average performance to lower the evaluation variance.
|
| 138 |
+
|
| 139 |
+
We choose balanced scaffold as our major evaluation configuration, because it allows us to evaluate the algorithm on multiple data splits while maintaining the ability to evaluate out of distribution samples (e.g. assess generalization ability). Evaluating on one single split (such as scaffold split) can be subject to bias due to one specific split, leading to higher variance in evaluation.
|
| 140 |
+
|
| 141 |
+
# 3.2 Experiment protocol
|
| 142 |
+
|
| 143 |
+
As the total number of configurations for the entire pipeline can be combinatorially large which is not practical for us to exhaustively experiment with all of them, we design our protocol with a pairwise comparison principle. Specifically, we first anchor a vanilla configuration with a certain design choice of combination for each stage. To study the effect of each stage on the pretraining effectiveness, we vary the design choice one stage at a time compared to the vanilla configuration.
|
| 144 |
+
|
| 145 |
+
For all these experiments, to assess the effectiveness of graph pretraining, we report the ROC-AUC on downstream tasks as well as the relative average gain over all downstream datasets with and without pretraining. For each setting we will report the mean and standard deviation (in parenthesis) over three runs with different random seeds. We tune the model on downstream tasks with the validation set, and report the evaluation metric on the test set using the model with best validation performance. For each setup, we report the average performance obtained with three random seeds. We tune the learning rate in $\{ 1 e ^ { - 4 } , \dot { 5 } e ^ { - 4 } , 1 e ^ { - 3 } , 5 \bar { e } ^ { - \dot { 3 } } , 1 e ^ { - 2 } , 5 e ^ { - 2 } , 1 e ^ { - 1 } \}$ for each setup individually and select the one with best validation performance. For GNNs we fix the hidden dimension to 300 and number of layers to 5.
|
| 146 |
+
|
| 147 |
+
Table 8: Unsupervised $^ +$ Basic feature $^ +$ Scaffold. No pretrain has an average accuracy of $6 8 . 7 \%$ over all benckmark datasets.
|
| 148 |
+
|
| 149 |
+
<table><tr><td>Methods</td><td>BBBP</td><td>BACE</td><td>TOX21</td><td>TOXCAST</td><td>SIDER</td><td>AVE GAIN</td></tr><tr><td>No pretrain</td><td>69.62(± 1.05)</td><td>75.77(±4.29)</td><td>75.52(±0.67)</td><td>63.67(±0.32)</td><td>59.07(±1.13)</td><td>0(±1.492)</td></tr><tr><td>Node Prediction</td><td>68.70(±2.16)</td><td>76.95(±0.12)</td><td>75.88(±0.60)</td><td>64.11(±0.38)</td><td>61.29(±0.87)</td><td>0.656(±0.826)</td></tr><tr><td>Context Prediction</td><td>69.41(±1.44)</td><td>81.96(±0.72)</td><td>75.49(±0.75)</td><td>63.48(±0.31)</td><td>62.27(±0.90)</td><td>1.792(±0.824)</td></tr></table>
|
| 150 |
+
|
| 151 |
+
Table 9: Supervised $^ +$ Basic feature $^ +$ Scaffold. No pretrain has an average accuracy of $6 8 . 7 \%$ over all benckmark datasets.
|
| 152 |
+
|
| 153 |
+
<table><tr><td>Methods</td><td>BBBP</td><td>BACE</td><td>TOX21</td><td>TOXCAST</td><td>SIDER</td><td>AVE GAIN</td></tr><tr><td>No pretrain</td><td>69.62(± 1.05)</td><td>75.77(±4.29)</td><td>75.52(±0.67)</td><td>63.67(±0.32)</td><td>59.07(±1.13)</td><td>0(±1.492)</td></tr><tr><td>Supervised</td><td>68.96(±0.64)</td><td>76.30(±1.30)</td><td>76.64(±0.39)</td><td>66.07(±0.22)</td><td>61.97(±0.96)</td><td>1.258(±0.702)</td></tr><tr><td>Masking Node + Supervised</td><td>71.41(±0.67)</td><td>84.59(±0.35)</td><td>79.13(±0.29)</td><td>65.32(±0.37)</td><td>62.12(±0.19)</td><td>3.784(±0.374)</td></tr><tr><td>Context Prediction+ Supervised</td><td>69.63(±0.25)</td><td>83.34(±0.67)</td><td>78.11(±0.28)</td><td>66.15(±0.48)</td><td>63.48(±0.43)</td><td>3.412(±0.422)</td></tr></table>
|
| 154 |
+
|
| 155 |
+
# 4 Results
|
| 156 |
+
|
| 157 |
+
In this section, we present the results and discussions for a set of experiments designed with the protocols in Section 3.2. Table 1 summarizes the experimental configurations for each following table. We will elaborate on them in the following sections. Due to space limit, we defer our investigation on different GNN architectures to appendix (Section A.1).
|
| 158 |
+
|
| 159 |
+
# 4.1 Vanilla configuration
|
| 160 |
+
|
| 161 |
+
We choose the vanilla configuration with the settings from existing works [12, 22]. Specifically, we use the rich feature with GIN backbone, pretrained on ZINC15 when pretraining is applied, and evaluate on the Balanced Scaffold Split for downstream tasks. One important baseline is without pretraining. For the ease of comparison, we include the results without pretraining in each table.
|
| 162 |
+
|
| 163 |
+
# 4.2 Self-supervised pretraining objectives
|
| 164 |
+
|
| 165 |
+
We compare the results pretrained with different self-supervised pretraining objectives. As is presented in Section 3.1, we consider four representative types of pretraining objectives. For the ease of comparing the performance, we only consider one objective at a time, instead of mixing different pretraining objectives to obtain a multi-task pretrained model. Table 2 shows the performance on downstream molecule property prediction benchmarks with models initialized from different pretraining objectives. The relative average gain compared to the one without pretraining is not statistically significant, i.e., not larger than the standard deviations of multiple runs. All the four different objectives obtain similar gains/loses regardless of very different designs. To fully understand the effect of self-supervised pretraining on molecule representation, we further investigate the performance of different pretraining objectives in combination with other factors, such as input features or data splits, as described in the following sections.
|
| 166 |
+
|
| 167 |
+
# 4.3 Supervised pretraining objectives
|
| 168 |
+
|
| 169 |
+
In addition to the self-supervised objectives, we study the potential benefits with supervised pretraining. Unlike the self-supervised setting where the molecule graphs themselves are used for pretraining, the supervised pretraining requires extra cost of data labeling, and thus is not scalable for large scale pretraining. In this paper, we present the results with supervised pretraining alone, as well as the joint pretraining. e.g. pretrain with self-supervised objective and followed by supervised pretraining, in Table 3. We can see with the supervised pretraining, one can improve the downstream performance, which aligns with the observation from Hu et al. [12]. Our hypothesis is that, supervised pretraining is helpful when the pretraining tasks are closely aligned with the downstream tasks. In particular, the bio-activity labels provided by ChEMBL is highly related to the drug discovery purpose and drug discovery properties are the major topics evaluated in the downstream tasks. Therefore, the positive correlation between the pretraining supervision and downstream tasks contribute the most to the performance improvement of downstream tasks.
|
| 170 |
+
|
| 171 |
+
Table 10: Large scale pretraining data with balanced scaffold split. No pretraining gets an average AUC of $7 8 . 0 \%$ .
|
| 172 |
+
|
| 173 |
+
<table><tr><td>Methods</td><td>BBBP</td><td>BACE</td><td>TOX21</td><td>TOXCAST</td><td>SIDER</td><td>AVE GAIN</td></tr><tr><td>No pretrain</td><td>92.23(±3.07)</td><td>87.43(±1.63)</td><td>79.2(±1.99)</td><td>69.13(±0.55)</td><td>61.92(±0.89)</td><td>0(±1.626)</td></tr><tr><td>Node Prediction</td><td>92.33(±2.08)</td><td>87.22(±1.79)</td><td>79.12(±1.62)</td><td>69.47(±0.65)</td><td>61.24(±1.94)</td><td>-0.106(±1.616)</td></tr><tr><td>Context Prediction</td><td>93.32(±0.53)</td><td>87.77(±2.94)</td><td>79.18(±2.48)</td><td>70.13(±0.56)</td><td>62.24(±2.65)</td><td>0.546(±1.832)</td></tr><tr><td>MaskingNode+Supervised</td><td>93.23(±3.02)</td><td>86.39(±1.67)</td><td>81.89(±1.58)</td><td>71.77(±0.50)</td><td>63.73(±2.20)</td><td>1.420(±1.794)</td></tr><tr><td>Context Prediction + Supervised</td><td>92.55(±2.93)</td><td>87.76(±1.87)</td><td>82.19(±1.58)</td><td>72.91(±0.71)</td><td>62.44(±0.45)</td><td>1.588(±1.508)</td></tr></table>
|
| 174 |
+
|
| 175 |
+
# 4.4 Data split on downstream tasks
|
| 176 |
+
|
| 177 |
+
Molecular data is usually diverse and limited, so chemists are particularly interested in the generalization ability of GNNs on out of distribution data. Also due to the same reason (i.e. limited and diverse data), the variance in performance of different splits is significant, which poses challenges on robust evaluation. In vanilla configuration we use the balanced scaffold split, and here we show additional results with the scaffold split, which is a deterministic data split that makes the train/valid/test set differ from each other the most. Table 4 and Table 5 respectively present the results using scaffold split with self-supervised without and with additional supervised pretraining. Compared with Table 2 and Table 3, it is clear to see that Table 4 and Table 5 have significantly lower ROC-AUC. Specifically the AUC drops $6 . 2 \%$ on average for all benchmarks without pretraining. On the other hand, we can see if we compare Table 4 with Table 2, or Table 5 with Table 3 respectively, the gain of pretraining is more significant on the scaffold split. We speculate the reason for the improvement of scaffold split is that the initialization of neural network parameters (e.g. from pretraining) are typically critical for the out-of-distribution generalization (e.g. scaffold split). Similar observations have also been studied in the meta-learning literature [7]. Although the gain with supervised pretraining is significant in Table 5, the effect of self-supervised pretraining is mixed in Table 4. This indicates the effectiveness of self-supervised pretraining on scaffold split is not significant enough to claim “very helpful”.
|
| 178 |
+
|
| 179 |
+
# 4.5 Graph features
|
| 180 |
+
|
| 181 |
+
So far we have presented the results with rich features. Now we want to see how those basic features used in Hu et al. [12] affect the outcome. Table 6 and Table 7 show the test ROC-AUC $( \% )$ performance with basic features on the balanced scaffold splits using self-supervised or supervised pretraining objectives, respectively. Table 8 and Table 9 show the same results but on scaffold split.
|
| 182 |
+
|
| 183 |
+
In a nutshell, without pretraining, rich features lead to an average gain of $1 . 3 \%$ and $3 . 1 \%$ over basic features using balanced scaffold split and scaffold split, respectively. Specifically, it achieves $7 6 . 7 \%$ vs $7 8 . 0 \%$ for balanced scaffold split, and $6 8 . 7 \%$ vs $\bar { 7 } 1 . 8 \%$ on scaffold split. The gain brought by the rich features are more significant than the ones with different self-supervised pretraining objectives. Table 6 to Table 9 show that pretraining has more positive impact when basic features are used. In particular, the self-pretraining with context prediction shows significant gains especially in the scaffold split setting. However, the gain diminishes when careful feature engineering are applied to the downstream tasks (use rich feature in vanilla configuration). The supervised pretraining continues the significant gain under these settings, which shows the consistency and reliability of the situation with the labeled and downstream-task-aligned supervisions.
|
| 184 |
+
|
| 185 |
+
# 4.6 Pretraining datasets
|
| 186 |
+
|
| 187 |
+
As observed in natural language processing domain, more text pretraining data lead to better downstream performance. Intuitively this can be true for molecule representation domain as well, so we run a new set of experiments with the model pretrained on SAVI dataset, which is about 500 times larger than the ZINC15 dataset we used in the above result sections. We present the results pretrained on SAVI dataset using balanced scaffold split or scaffold split in Table 10 and Table 11, respectively. Other configurations are the same as the vanilla configuration.
|
| 188 |
+
|
| 189 |
+
Table 11: Large scale pretraining data with scaffold split. No pretraining gets an average AUC of $7 1 . 8 \%$ .
|
| 190 |
+
|
| 191 |
+
<table><tr><td>Methods</td><td>BBBP</td><td>BACE</td><td>TOX21</td><td>TOXCAST</td><td>SIDER</td><td>AVE GAIN</td></tr><tr><td>No pretrain</td><td>74.83(±0.73)</td><td>80.10(±0.42)</td><td>75.86(±0.58)</td><td>65.95(±0.15)</td><td>62.30(±1.14)</td><td>0(±0.604)</td></tr><tr><td>Node Prediction</td><td>73.81(±1.82)</td><td>81.90(±1.59)</td><td>74.94(±0.05)</td><td>66.95(±0.12)</td><td>62.93(±0.34)</td><td>0.298(±0.784)</td></tr><tr><td>Context Prediction</td><td>74.32(±0.85)</td><td>83.93(±0.24)</td><td>74.42(±0.19)</td><td>67.01(±0.29)</td><td>64.83(±0.45)</td><td>1.094(±0.404)</td></tr><tr><td>MaskingNode+Supervised</td><td>73.32(±0.60)</td><td>83.38(±1.05)</td><td>78.59(±0.09)</td><td>67.01(±0.18)</td><td>65.40(±0.12)</td><td>1.732(±0.408)</td></tr><tr><td>Context Prediction + Supervised</td><td>74.38(±0.93)</td><td>86.33(±0.16)</td><td>78.16(±0.25)</td><td>68.71(±0.07)</td><td>62.22(±0.48)</td><td>2.152(±0.378)</td></tr></table>
|
| 192 |
+
|
| 193 |
+
Compared with the performance on ZINC15, the SAVI pretraining data does not lead to a significant improvement either on balanced scaffold split (Table 2 vs Table 10) or scaffold split (Table 4 or Table 11). Similarly, the self-supervised pretraining objectives lead to negligible gain on downstream task performance, while the supervised one still achieves a clear gain.
|
| 194 |
+
|
| 195 |
+
As the result is counterintuitive, we further investigate the reason behind it by inspecting the pretraining performances with different training objectives on both ZINC15 and SAVI datasets. We plot the curve of accuracy growth with the number of training steps iterated. We can see from Figure 2 that in all settings the pretraining accuracy grows above $90 \%$ quickly after only 0.1 to $\phantom { - } 0 . 2 \mathbf { M }$ steps and also converges quickly. Given that the model gets very high accuracy without even going through 1 epoch of the SAVI dataset, it is expected that the larger training data like SAVI may not provide more learning signals for the model, and partially explains why more molecules wouldn’t help significantly in this case. Furthermore, these figures might suggest several reasons of why the self-supervised pretraining may not be very effective in some situations:
|
| 196 |
+
|
| 197 |
+
• Tasks are easy. Some of the self-pretraining tasks for molecules might be easy, so that model learns less useful information from pretraining. For example in the masked node prediction case, the model is expected to predict the atomic number from a vocabulary with less than 100 candidate atoms. Furthermore, due to the valence constraints, the graph topology may already exclude most of the wrong atoms. As a comparison, the vocabulary size for text pretraining may be $1 0 0 \mathrm { k }$ or even higher. Some structured prediction tasks like context prediction might be hard, but due to the difficulty of structured prediction itself and the proposal for high quality negative examples for contrastive learning, it can still be challenging for downstream task improvements. Other strategies like motif prediction can be achieved by subgraph matching, which can be easy for GNN that intrinsically does the graph isomorphism test.
|
| 198 |
+
|
| 199 |
+
• Data lacks diversity. Due to biophysical and functional requirements, molecules share many common sub-structures, e.g., functional motifs. Hence, molecules may not be as diversified as text data. This is why the model learns to generalize quickly within the training distribution.
|
| 200 |
+
|
| 201 |
+
• 2D Structure is not enough to infer functionality. Some important biophysical properties (such as 3D structure, chirality) are barely reflected in the 2D-feature-based pretraining (e.g., using smiles or 2D graph features). For example, the molecules with the same chemical formula and 2D feature, can have very different chirality, which leads to quite different toxicity [24] (e.g. flipped toxicity labels). This is not captured in the current GNN pretraining frameworks that we considered.
|
| 202 |
+
|
| 203 |
+
# 4.7 Hyper-parameters for downstream tasks
|
| 204 |
+
|
| 205 |
+
We also find that hyper-parameters for downstream tasks are critical for the their performance that their choices may change the conclusion of the effectiveness of pretraining in some settings. We can take the learning rate as an example. As the models initialized from scratch and pretraining may have different scales, the most suitable learning rate required for downstream tasks may also be different. Without tuning learning rate extensively, we may reach a misleading conclusion. In particular,
|
| 206 |
+
|
| 207 |
+

|
| 208 |
+
Figure 2: Pretraining accuracy on ZINC15 or SAVI datasets with node prediction or context prediction objectives.
|
| 209 |
+
|
| 210 |
+
when we adopt the default learning rate for reproducing the existing success of pretraining in Table 17 of Appendix A.4, we indeed observe the advantage of pretraining. However, if we follow our procedures (e.g. extensive search learning rate and averaging over three splits), the resulting Table 2 and Table 3 indicate no performance gain by pretraining. So we suggest that the evaluation of pretraining should consider the hyper-parameter tuning and averaging over different splits.
|
| 211 |
+
|
| 212 |
+
# 5 Summary and takeaways
|
| 213 |
+
|
| 214 |
+
Based on our experiments in Section 4, we present our takeaways by empirically summarizing our conjectures on when the pretraining would/would not help the molecular representation learning.
|
| 215 |
+
|
| 216 |
+
When pretraining might help We find it typically helps 1) if we can have the supervised pretraining with target labels that are aligned with the downstream tasks. However, getting large amount of high-quality and relevant supervision is not always feasible; 2) if the high quality hand-crafted features are absent. However, it seems that the gain obtained by self-supervised pretraining is not as significant as these high quality hand-crafted features based on our current studies; 3) if the downstream train, valid and test dataset distributions are substantially different.
|
| 217 |
+
|
| 218 |
+
When the gain diminishes? In some situations the gain of pretraining might diminish 1) if we already have the high quality hand-crafted features (e.g. rich features described in Section 3.1); 2) if we don’t have the highly relevant supervisions. As shown in Section 4.6, many self-supervised pretraining tasks might be too easy for the model to learn meaningful embedding; 3) if the downstream data splits are balanced; 4) if the self-supervised learning dataset lacks diversity, despite its scale.
|
| 219 |
+
|
| 220 |
+
Why pretraining may not help in some cases? In our paper we pretrained a GNN on a much larger dataset (SAVI) than before, hoping to replicate gain of pretraining like in NLP domain. However, we do not obtain the expected gain. The pretraining accuracy curve (Figure 2) provides some potential explanations of why pretraining may not work: some of the pretraining accuracy curve grows above $9 5 \% +$ quickly and converges fast, unlike pretraining in NLP which keeps growing to $\bar { 7 } 0 \%$ and hardly plateaus. This suggests that some of the pretraining methods like masked node label prediction might be easy (as the vocabulary size is much smaller compared to NLP) and therefore transfer less knowledge for downstream tasks.
|
| 221 |
+
|
| 222 |
+
# 6 Limitations of current study
|
| 223 |
+
|
| 224 |
+
Although we have tried our best to design a comprehensive study on the effectiveness of graph pretraining for molecular representation, there are still limitations we want to point out. Due to the limited time and resources we have, we are not able to fully cover the whole picture of the current pretraining paradigm in graph neural networks. Nevertheless, we list them here in hope of preventing the over-generalization of our conclusion.
|
| 225 |
+
|
| 226 |
+
• Distribution of graphs. Our study focuses on pretraining for small molecule graph inductive representation learning. Recently there are works on pretraining transductive representation learning [36] on large graphs [13], where our conclusion may not be directly extended to these cases. Graph architectures. GNN is a popular research field where many new architectures with probable expressiveness are/will be proposed. The results we have shown are on two representative 1-WL GNNs. It can be possible that the latest advances of deep GNN [17] and Transformer-based GNN [34, 3, 14] might yield different results. Learning objectives. Although we have presented results with different types of self-supervised losses, there are still many variants of each type that we did not explore, like different variants [26, 31] of contrastive learning. Also, multi-task learning of different self-supervised objectives might be another direction for further exploration. Downstream datasets. We obtained our conclusion mainly on the datasets from MoleculeNet [30]. Datasets like Alchemy [4] and drug-target Interaction [18] may show different results.
|
| 227 |
+
|
| 228 |
+
References
|
| 229 |
+
[1] Guy W Bemis and Mark A Murcko. The properties of known drugs. 1. molecular frameworks. Journal of medicinal chemistry, 39(15):2887–2893, 1996.
|
| 230 |
+
[2] Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
|
| 231 |
+
[3] Dexiong Chen, Leslie O’Bray, and Karsten Borgwardt. Structure-aware transformer for graph representation learning. In International Conference on Machine Learning, pages 3469–3489. PMLR, 2022.
|
| 232 |
+
[4] Guangyong Chen, Pengfei Chen, Chang-Yu Hsieh, Chee-Kong Lee, Benben Liao, Renjie Liao, Weiwen Liu, Jiezhong Qiu, Qiming Sun, Jie Tang, et al. Alchemy: A quantum chemistry dataset for benchmarking ai models. arXiv preprint arXiv:1906.09427, 2019.
|
| 233 |
+
[5] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pages 1597–1607. PMLR, 2020.
|
| 234 |
+
[6] 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.
|
| 235 |
+
[7] Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International Conference on Machine Learning, pages 1126–1135. PMLR, 2017.
|
| 236 |
+
[8] Anna Gaulton, Louisa J Bellis, A Patricia Bento, Jon Chambers, Mark Davies, Anne Hersey, Yvonne Light, Shaun McGlinchey, David Michalovich, Bissan Al-Lazikani, et al. Chembl: a large-scale bioactivity database for drug discovery. Nucleic acids research, 40(D1):D1100– D1107, 2012.
|
| 237 |
+
[9] William L Hamilton, Rex Ying, and Jure Leskovec. Representation learning on graphs: Methods and applications. arXiv preprint arXiv:1709.05584, 2017.
|
| 238 |
+
[10] Kaveh Hassani and Amir Hosein Khasahmadi. Contrastive multi-view representation learning on graphs. In International Conference on Machine Learning, pages 4116–4126. PMLR, 2020.
|
| 239 |
+
[11] Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross B. Girshick. Momentum contrast for unsupervised visual representation learning. In CVPR, pages 9726–9735, 2020.
|
| 240 |
+
[12] Weihua Hu, Bowen Liu, Joseph Gomes, Marinka Zitnik, Percy Liang, Vijay Pande, and Jure Leskovec. Strategies for pre-training graph neural networks. arXiv preprint arXiv:1905.12265, 2019.
|
| 241 |
+
[13] Ziniu Hu, Yuxiao Dong, Kuansan Wang, Kai-Wei Chang, and Yizhou Sun. Gpt-gnn: Generative pre-training of graph neural networks. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 1857–1867, 2020.
|
| 242 |
+
[14] Jinwoo Kim, Tien Dat Nguyen, Seonwoo Min, Sungjun Cho, Moontae Lee, Honglak Lee, and Seunghoon Hong. Pure transformers are powerful graph learners. arXiv preprint arXiv:2207.02505, 2022.
|
| 243 |
+
[15] G Landrum. Rdkit: Open-source cheminformatics software, 2016.
|
| 244 |
+
[16] P. Langley. Crafting papers on machine learning. In Pat Langley, editor, Proceedings of the 17th International Conference on Machine Learning (ICML 2000), pages 1207–1216, Stanford, CA, 2000. Morgan Kaufmann.
|
| 245 |
+
[17] Meng Liu, Hongyang Gao, and Shuiwang Ji. Towards deeper graph neural networks. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 338–348, 2020.
|
| 246 |
+
[18] Shengchao Liu, Hanchen Wang, Weiyang Liu, Joan Lasenby, Hongyu Guo, and Jian Tang. Pre-training molecular graph representation with 3d geometry. arXiv preprint arXiv:2110.07728, 2021.
|
| 247 |
+
[19] Hitesh Patel, Wolf Ihlenfeldt, Philip Judson, Yurii S Moroz, Yuri Pevzner, Megan Peach, Nadya Tarasova, and Marc Nicklaus. Synthetically accessible virtual inventory (savi). 2020.
|
| 248 |
+
[20] 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. arXiv preprint arXiv:1910.10683, 2019.
|
| 249 |
+
[21] Bharath Ramsundar, Peter Eastman, Patrick Walters, and Vijay Pande. Deep learning for the life sciences: applying deep learning to genomics, microscopy, drug discovery, and more. " O’Reilly Media, Inc.", 2019.
|
| 250 |
+
[22] Yu Rong, Yatao Bian, Tingyang Xu, Weiyang Xie, Ying Wei, Wenbing Huang, and Junzhou Huang. Self-supervised graph transformer on large-scale molecular data. arXiv preprint arXiv:2007.02835, 2020.
|
| 251 |
+
[23] Nino Shervashidze, Pascal Schweitzer, Erik Jan Van Leeuwen, Kurt Mehlhorn, and Karsten M Borgwardt. Weisfeiler-lehman graph kernels. Journal of Machine Learning Research, 12(9), 2011.
|
| 252 |
+
[24] Silas W Smith. Chiral toxicology: it’s the same thing. . . only different. Toxicological sciences, 110(1):4–30, 2009.
|
| 253 |
+
[25] Teague Sterling and John J Irwin. Zinc 15–ligand discovery for everyone. Journal of chemical information and modeling, 55(11):2324–2337, 2015.
|
| 254 |
+
[26] Mengying Sun, Jing Xing, Huijun Wang, Bin Chen, and Jiayu Zhou. Mocl: data-driven molecular fingerprint via knowledge-aware contrastive learning from molecular graph. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, pages 3585–3594, 2021.
|
| 255 |
+
[27] Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua ´ Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017.
|
| 256 |
+
[28] Jason Wei, Maarten Bosma, Vincent Y Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M Dai, and Quoc V Le. Finetuned language models are zero-shot learners. arXiv preprint arXiv:2109.01652, 2021.
|
| 257 |
+
[29] Lirong Wu, Haitao Lin, Zhangyang Gao, Cheng Tan, Stan Li, et al. Self-supervised on graphs: Contrastive, generative, or predictive. arXiv preprint arXiv:2105.07342, 2021.
|
| 258 |
+
[30] Zhenqin Wu, Bharath Ramsundar, Evan N Feinberg, Joseph Gomes, Caleb Geniesse, Aneesh S Pappu, Karl Leswing, and Vijay Pande. Moleculenet: a benchmark for molecular machine learning. Chemical science, 9(2):513–530, 2018.
|
| 259 |
+
[31] Jun Xia, Lirong Wu, Jintao Chen, Bozhen Hu, and Stan Z Li. Simgrace: A simple framework for graph contrastive learning without data augmentation. In Proceedings of the ACM Web Conference 2022, pages 1070–1079, 2022.
|
| 260 |
+
[32] Yaochen Xie, Zhao Xu, Jingtun Zhang, Zhengyang Wang, and Shuiwang Ji. Self-supervised learning of graph neural networks: A unified review. arXiv preprint arXiv:2102.10757, 2021.
|
| 261 |
+
[33] Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018.
|
| 262 |
+
[34] Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng, Guolin Ke, Di He, Yanming Shen, and Tie-Yan Liu. Do transformers really perform bad for graph representation? arXiv preprint arXiv:2106.05234, 2021.
|
| 263 |
+
[35] Yuning You, Tianlong Chen, Yongduo Sui, Ting Chen, Zhangyang Wang, and Yang Shen. Graph contrastive learning with augmentations. Advances in Neural Information Processing Systems, 33:5812–5823, 2020.
|
| 264 |
+
|
| 265 |
+
[36] Yuning You, Tianlong Chen, Zhangyang Wang, and Yang Shen. When does self-supervision help graph convolutional networks? In International Conference on Machine Learning, pages 10871–10880. PMLR, 2020.
|
| 266 |
+
|
| 267 |
+
[37] Yanqiao Zhu, Yichen Xu, Feng Yu, Qiang Liu, Shu Wu, and Liang Wang. Graph contrastive learning with adaptive augmentation. In Proceedings of the Web Conference 2021, pages 2069–2080, 2021.
|
| 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]
|
| 275 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] . Though not really apply.
|
| 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)? [No] . We will prepare code soon.
|
| 285 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 286 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 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]
|
| 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]
|
| 292 |
+
(b) Did you mention the license of the assets? [N/A]
|
| 293 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
|
| 294 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes]
|
| 295 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 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? [N/A]
|
| 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? [N/A]
|
md/dev/wtqb7pNL4e/wtqb7pNL4e.md
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Can ChatGPT Assess Human Personalities? A General Evaluation Framework
|
| 2 |
+
|
| 3 |
+
Haocong Rao1,2 Cyril Leung2,3 Chunyan Miao1,2∗ $^ { 1 }$ School of Computer Science and Engineering, Nanyang Technological University, Singapore 2LILY Research Centre, Nanyang Technological University, Singapore 3Department of Electrical and Computer Engineering The University of British Columbia, Canada {haocong001,ascymiao}@ntu.edu.sg {cleung}@ece.ubc.ca
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Large Language Models (LLMs) especially ChatGPT have produced impressive results in various areas, but their potential human-like psychology is still largely unexplored. Existing works study the virtual personalities of LLMs but rarely explore the possibility of analyzing human personalities via LLMs. This paper presents a generic evaluation framework for LLMs to assess human personalities based on Myers–Briggs Type Indicator (MBTI) tests. Specifically, we first devise unbiased prompts by randomly permuting options in MBTI questions and adopt the average testing result to encourage more impartial answer generation. Then, we propose to replace the subject in question statements to enable flexible queries and assessments on different subjects from LLMs. Finally, we re-formulate the question instructions in a manner of correctness evaluation to facilitate LLMs to generate clearer responses. The proposed framework enables LLMs to flexibly assess personalities of different groups of people. We further propose three evaluation metrics to measure the consistency, robustness, and fairness of assessment results from state-ofthe-art LLMs including ChatGPT and GPT-4. Our experiments reveal ChatGPT’s ability to assess human personalities, and the average results demonstrate that it can achieve more consistent and fairer assessments in spite of lower robustness against prompt biases compared with InstructGPT†.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Pre-trained Large Language Models (LLMs) have been widely used in many applications including translation, storytelling, and chatbots (Devlin et al., 2019; Raffel et al., 2020; Yang et al., 2022; Yuan et al., 2022; Ouyang et al., 2022; Bubeck et al.,
|
| 12 |
+
|
| 13 |
+
2023). ChatGPT (Ouyang et al., 2022) and its enhanced version GPT-4 are currently recognized as the most capable chatbots, which can perform context-aware conversations, challenge incorrect premises, and reject inappropriate requests with a vast knowledge base and human-centered finetuning. These advantages make them well-suited for a variety of real-world scenarios such as business consultation and educational services (Zhai, 2022; van Dis et al., 2023; Bubeck et al., 2023).
|
| 14 |
+
|
| 15 |
+
Recent studies have revealed that LLMs may possess human-like self-improvement and reasoning characteristics (Huang et al., 2022; Bubeck et al., 2023). The latest GPT series can pass over $90 \%$ of Theory of Mind (ToM) tasks with strong analysis and decision-making capabilities (Kosinski, 2023; Zhuo et al., 2023; Moghaddam and Honey, 2023). In this context, LLMs are increasingly assumed to have virtual personalities and psychologies, which plays an essential role in guiding their responses and interaction patterns (Jiang et al., 2022). Based on this assumption, a few works (Li et al., 2022; Jiang et al., 2022; Karra et al., 2022; Caron and Srivastava, 2022; Miotto et al., 2022) apply psychological tests such as Big Five Factors (Digman, 1990) to evaluate their pseudo personalities (e.g., behavior tendency), so as to detect societal and ethical risks (e.g., racial biases) in their applications.
|
| 16 |
+
|
| 17 |
+
Although existing works have investigated the personality traits of LLMs, they rarely explored whether LLMs can assess human personalities. This open problem can be the key to verifying the ability of LLMs to perform psychological (e.g., personality psychology) analyses and revealing their potential understanding of humans, i.e., “How do LLMs think about humans?”. Specifically, assessing human personalities from the point of LLMs (1) enables us to access the perception of LLMs on humans to better understand their potential response motivation and communication patterns (Jiang et al., 2020); (2) helps reveal whether LLMs possess biases on people so that we can optimize them (e.g., add stricter rules) to generate fairer contents; (3) helps uncover potential ethical and social risks (e.g., misinformation) of LLMs (Weidinger et al., 2021) which can affect their reliability and safety, thereby facilitating the development of more trustworthy and human-friendly LLMs.
|
| 18 |
+
|
| 19 |
+
To this end, we introduce the novel idea of letting LLMs assess human personalities, and propose a general evaluation framework (illustrated Fig. 1) to acquire quantitative human personality assessments from LLMs via Myers–Briggs Type Indicators (MBTI) (Myers and McCaulley, 1985). Specifically, our framework consists of three key components: (1) Unbiased prompts, which construct instructions of MBTI questions using randomlypermuted options and average testing results to achieve more consistent and impartial answers; (2) Subject-replaced query, which converts the original subject of the question statements into a target subject to enable flexible queries and assessments from LLMs; (3) Correctness-evaluated instruction, which re-formulates the question instructions for LLMs to analyze the correctness of the question statements, so as to obtain clearer responses. Based on the above components, the proposed framework re-formulates the instructions and statements of MBTI questions in a flexible and analyzable way for LLMs, which enables us to query them about human personalities. Furthermore, we propose three quantitative evaluation metrics to measure the consistency of LLMs’ assessments on the same subject, their assessment robustness against random perturbations of input prompts (defined as “prompt biases”), and their fairness in assessing subjects with different genders. In our work, we mainly focus on evaluating ChatGPT and two representative state-of-the-art LLMs (InstructGPT, GPT4) based on the proposed metrics. Experimental results showcase the ability of ChatGPT in analyzing personalities of different groups of people. This can provide valuable insights for the future exploration of LLM psychology, sociology, and governance.
|
| 20 |
+
|
| 21 |
+
Our contributions can be summarized as follows:
|
| 22 |
+
|
| 23 |
+
• We for the first time explore the possibility of assessing human personalities by LLMs, and propose a general framework for LLMs to conduct quantitative evaluations via MBTI.
|
| 24 |
+
|
| 25 |
+
• We devise unbiased prompts, subject-replaced queries, and correctness-evaluated instructions to encourage LLMs to perform a reliable flexible assessment of human personalities.
|
| 26 |
+
|
| 27 |
+
• We propose three evaluation metrics to measure the consistency, robustness, and fairness of LLMs in assessing human personalities.
|
| 28 |
+
|
| 29 |
+
• Our experiments show that both ChatGPT and its counterparts can independently assess human personalities. The average results demonstrate that ChatGPT and GPT-4 achieve more consistent and fairer assessments with less gender bias than InstructGPT, while their results are more sensitive to prompt biases.
|
| 30 |
+
|
| 31 |
+
# 2 Related Works
|
| 32 |
+
|
| 33 |
+
Personality Measurement. The commonly-used personality modeling schemes include the three trait personality measure (Eysenck, 2012), the Big Five personality trait measure (Digman, 1990), the Myers–Briggs Type Indicator (MBTI) (Myers, 1962; Myers and McCaulley, 1985), and the 16 Personality Factor questionnaire (16PF) (Schuerger, 2000). Five dimensions are defined in the Big Five personality traits measure (Digman, 1990) to classify major sources of individual differences and analyze a person’s characteristics. MBTI (Myers and McCaulley, 1985) identifies personality from the differences between persons on the preference to use perception and judgment. (Karra et al., 2022; Caron and Srivastava, 2022) leverage the Big Five trait theory to quantify the personality traits of language models, while (Jiang et al., 2022) further develops machine personality inventory to standardize this evaluation. In (Li et al., 2022), multiple psychological tests are combined to analyze the LLMs’ safety. Unlike existing studies that evaluate personalities of LLMs, our work is the first attempt to explore human personality analysis via LLMs.
|
| 34 |
+
|
| 35 |
+
Biases in Language Models. Most recent language models are pre-trained on the large-scale datasets or Internet texts that usually contains unsafe (e.g., toxic) contents, which may cause the model to generate biased answers that violate prevailing societal values (Bolukbasi et al., 2016; Sheng et al., 2019; Bordia and Bowman, 2019; Nadeem et al., 2021; Zong and Krishnamachari, 2022; Zhuo et al., 2023). (Bolukbasi et al., 2016) shows that biases in the geometry of wordembeddings can reflect gender stereotypes. The gender bias in word-level language models is quantitatively evaluated in (Bordia and Bowman, 2019).
|
| 36 |
+
|
| 37 |
+
In (Nadeem et al., 2021), the authors demonstrate that popular LLMs such as GPT-2 (Radford et al., 2019) possess strong stereotypical biases on gender, profession, race, and religion. To reduce such biases, many state-of-the-art LLMs such as ChatGPT apply instruction-finetuning with non-toxic corpora and instructions to improve their safety. (Zhuo et al., 2023) reveals that ChatGPT can generate socially safe responses with fewer biases than other LLMs under English lanuage settings. In contrast to previous works, our framework enables us to evaluate whether LLMs possess biased perceptions and assessments on humans (e.g., personalities), which helps us better understand the underlying reasons for the LLMs’ aberrant responses.
|
| 38 |
+
|
| 39 |
+

|
| 40 |
+
Figure 1: Overview of our framework: (a) The queried subject is replaced in the original statements of MBTI questions; (b) We construct correctness-evaluated instructions and (c) randomly permute options to build unbiased prompts with the subject-replaced statements (d), which are assessed by LLMs to infer the personality.
|
| 41 |
+
|
| 42 |
+
# 3 The Proposed Framework
|
| 43 |
+
|
| 44 |
+
# 3.1 Unbiased Prompt Design
|
| 45 |
+
|
| 46 |
+
LLMs are typically sensitive to prompt biases (e.g., varying word orders), which can significantly influence the coherence and accuracy of the generated responses especially when dealing with long text sequences (Zhao et al., 2021). To encourage more consistent and impartial answers, we propose to design unbiased prompts for the input questions. In particular, for each question in an independent testing (i.e., MBTI questionnaire), we randomly permute all available options (e.g., agree, disagree) in its instruction while not changing the question statement, and adopt the average results of multiple independent testings as the final result.
|
| 47 |
+
|
| 48 |
+
Formally, the instruction and statement for the $i ^ { t h }$ question are defined as $I _ { i }$ and $S _ { i }$ , where $i \in$ $\{ 1 , \cdots , n \}$ and $n$ is the total number of questions in the testing. We have $m$ available options $O _ { I } = \{ o _ { 1 } , o _ { 2 } , \cdots , o _ { m } \}$ in the instruction, which corresponds to $\{ A g r e e$ , Generally agree, Partially agree, Neither agree nor disagree, Partially disagree, Generally disagree, Disagree} including seven levels (i.e., $m = 7$ ) from agreement to disagreement in the MBTI questionnaire. We use $\Omega ( O _ { I } )$ to denote all possible permutations of options in $O _ { I }$ , and a random permutation can be represented as ${ \cal O } _ { \mathcal { R } } = \{ o _ { r _ { 1 } } , o _ { r _ { 2 } } , \cdots , o _ { r _ { m } } \} \in \Omega ( { \cal O } _ { I } )$ where $r _ { i } \in \{ 1 , 2 , \cdots , m \}$ , and $o _ { r _ { i } } \neq o _ { r _ { j } }$ iff $i \neq j$ Then, we utilize the randomly permuted options $O _ { \mathcal { R } }$ to construct the instruction $I _ { i }$ for the $i ^ { t h }$ question with:
|
| 49 |
+
|
| 50 |
+
Instruction: Do you $o _ { r _ { 1 } } , o _ { r _ { 2 } } , \cdots$ or $o _ { r _ { m } }$ with the following statement. Why?
|
| 51 |
+
|
| 52 |
+
We combine the above instruction and the question statement as the prompt to query LLMs. An example prompt for a question in the MBTI questionnaire is provided as follows.
|
| 53 |
+
|
| 54 |
+
Instruction: Do you disagree, agree, generally disagree, generally agree, neither agree nor disagree, partially disagree or partially agree with the following statement. Why?
|
| 55 |
+
|
| 56 |
+
Statement: You usually stay calm, even under a lot of pressure.
|
| 57 |
+
|
| 58 |
+
Answer: “As an AI language model, I do not have personal experiences or emotions, so I cannot agree or disagree with the statement. However, I can provide some general information on the topic. Some individuals are naturally more composed under pressure, while others may ......”
|
| 59 |
+
|
| 60 |
+
However, such a query, conducted in a selftesting manner, can only elicit neutral answers as shown above, since LLMs such as ChatGPT are trained to not possess personal thinking (e.g., emotions). This motivates us to propose the subjectreplaced query and correctness-evaluated instruction as illustrated below.
|
| 61 |
+
|
| 62 |
+
# 3.2 Subject-Replaced Query
|
| 63 |
+
|
| 64 |
+
As our goal is to let LLMs analyze human personalities instead of querying itself (i.e., self-reporting), we propose the subject-replaced query (SRQ) by converting the original subject (i.e., “You”) of each question into a specific subject-of-interest. For example, when we hope to let LLMs assess the general personality of men, we can replace the subject “You” with “Men”, and correspondingly change the pronoun “your” to “their” (see the example below). Original Statement: You spend a lot of your free time exploring various random topics that pique your interest.
|
| 65 |
+
|
| 66 |
+
SRQ Statement: Men spend a lot of their free time exploring various random topics that pique their interests.
|
| 67 |
+
|
| 68 |
+
In this way, we can request the LLMs to analyze and infer the choices/answers of a specific subject, so as to query LLMs about the personality of such subject based on a certain personality measure (e.g., MBTI). The proposed SRQ is general and scalable. By simply replacing the subject in the test (see Fig. 1), we can convert the original selfreport questionnaire into an analysis of expected subjects from the point of LLMs.
|
| 69 |
+
|
| 70 |
+
In our work, we choose large groups of people (e.g., “Men”, “Barbers”) instead of certain persons as the assessed subjects. First, as our framework only uses the subject name without extra personal information to construct MBTI queries, it is unrealistic to let LLMs assess the MBTI answers or personality of a certain person who is out of their learned knowledge. Second, the selected subjects are common in the knowledge base of LLMs and can test the basic personality assessment ability of LLMs, which is the main focus of our work. Moreover, subjects with different professions such as “Barbers” are frequently used to measure the bias in LLMs (Nadeem et al., 2021), thus we select such representative professions to better evaluate the consistency, robustness, and fairness of LLMs.
|
| 71 |
+
|
| 72 |
+
# 3.3 Correctness-Evaluated Instruction
|
| 73 |
+
|
| 74 |
+
Directly querying LLMs about human personalities with the original instruction can be intractable, as LLMs such as ChatGPT are trained to NOT possess personal emotions or beliefs. As shown in Fig. 2, they can only generate a neutral opinion when we query their agreement or disagreement, regardless of different subjects. To solve this challenge, we propose to convert the original agreement-measured instruction (i.e., querying degree of agreement) into correctness-evaluated instruction (CEI) by letting LLMs evaluate the correctness of the statement in questions. Specifically, we convert the original options $\{ A g r e e$ , Generally agree, Partially agree, Neither agree nor disagree, Partially disagree, Generally disagree, Disagree} into {Correct, Generally correct, Partially correct, Neither correct nor wrong, Partially wrong, Generally wrong, Wrong}, and then construct an unbiased prompt (see Sec. 3.1) based on the proposed CEI.
|
| 75 |
+
|
| 76 |
+
As shown in Fig. 2, using CEI enables ChatGPT to provide a clearer response to the question instead of giving a neutral response. Note that the CEI is essentially equivalent to the agreement-measured instruction and can be flexibly extended with other forms (e.g., replacing “correct” by “right”).
|
| 77 |
+
|
| 78 |
+

|
| 79 |
+
Figure 2: Comparison of answers generated by ChatGPT when adopting different types of instructions. Note that the agreement-measured instruction always leads to a neutral answer in practice.
|
| 80 |
+
|
| 81 |
+
# 3.4 The Entire Framework
|
| 82 |
+
|
| 83 |
+
The overview of our framework is shown in Fig. 1. Given the original statement $S _ { i }$ and instruction $I _ { i }$ of the $i ^ { t h }$ question, we construct the new statement $S _ { i } ^ { \prime }$ based on SRQ (Sec. 3.2) and the new instruction $I _ { i } ^ { \prime }$ based on CEI (Sec. 3.3), which are combined to construct the unbiased prompt $P _ { i }$ (Sec. 3.1). We query the LLM to obtain the answer $A _ { i }$ by
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
A _ { i } \sim { \mathcal { M } } _ { \tau } ( P _ { i } ) ,
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
where $\mathcal { M } _ { \tau }$ denotes the LLM trained with the temperature $\tau$ , $\mathcal { M } _ { \tau } ( P _ { i } )$ represents the answer sampling distribution of LLM conditioned on the input prompt $P _ { i }$ , $A _ { i }$ represents the most likely answer generated from $\mathcal { M } _ { \tau } ( P _ { i } )$ , $i \in \{ 1 , 2 , \cdots , n \}$ is the index of different questions, and $n$ is the number of all questions in MBTI. We adopt the default temperature used in training standard GPT models. The generated answer is further parsed with several simple rules, which ensures that it contains or can be transformed to an exact option. For instance, when we obtain the explicit option “generally incorrect”, the parsing rules can convert this answer to “generally wrong” to match the existing options.
|
| 90 |
+
|
| 91 |
+
We query the LLM with the designed prompt $P _ { i }$ (see Eq. 1) in the original order of the questionnaire to get all parsed answers. Based on the complete answers, we obtain the testing result (e.g., MBTI personality scores) of a certain subject from the view of LLM. Then, we independently repeat this process for multiple times, and average all results as the final result. It is worth noting that every question is answered only once in each independent testing, so as to retain a continuous testing context to encourage the coherence of LLM’s responses.
|
| 92 |
+
|
| 93 |
+
# 3.5 Evaluation Metrics
|
| 94 |
+
|
| 95 |
+
To systematically evaluate the ability of LLMs to assess human personalities, we propose three metrics in terms of consistency, robustness, and fairness as follows.
|
| 96 |
+
|
| 97 |
+
Consistency Scores. The personality results of the same subject assessed by an LLM should be consistent. For example, when we perform different independent assessments of a specific subject via the LLM, it is desirable to achieve an identical or highly similar assessment. Therefore, we propose to use the similarity between personality scores of all independent testing results and their final result (i.e., mean scores) to compute the consistency score of assessments.
|
| 98 |
+
|
| 99 |
+
Formally, we define $X ^ { i } = ( x _ { 1 } ^ { i } , x _ { 2 } ^ { i } , \cdot \cdot \cdot , x _ { k } ^ { i } )$ as the personality scores assessed by the LLM in the $i ^ { t h }$ independent testing, where $x _ { j } ^ { i } \in [ 0 , 1 0 0 ]$ is the score of the $j ^ { t h }$ personality dimension in the $i ^ { t h }$ testing, $j \in \{ 1 , 2 , \cdots , k \}$ , and $k$ is total number of personality dimensions. Taking the MBTI test as an example, $k = 5$ and $X ^ { i } = ( x _ { 1 } ^ { i } , x _ { 2 } ^ { i } , x _ { 3 } ^ { i } , x _ { 4 } ^ { i } , x _ { 5 } ^ { i } )$ represents extraverted, intuitive, thinking, judging, and assertive scores. The consistency score $s _ { c }$ can be computed by:
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
s _ { c } = \frac { \alpha } { \alpha + \frac { 1 } { N } \sum _ { i = 1 } ^ { N } D _ { E } ( X ^ { i } , \overline { { X } } ) } ,
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
where
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
D _ { E } ( X ^ { i } , { \overline { { X } } } ) = \| X ^ { i } - { \overline { { X } } } \| _ { 2 } .
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
In Eq. (2), $s _ { c } \in ( 0 , 1 ]$ , $\alpha$ is a positive constant to adjust the output magnitude, $D _ { E } ( X ^ { i } , { \overline { { X } } } )$ denotes the Euclidean distance between the $i ^ { t h }$ personality score $X ^ { i }$ and the mean score $\begin{array} { r } { \overline { { \boldsymbol X } } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } { \boldsymbol X ^ { i } } } \end{array}$ and $N$ is the total number of testings. $\| \cdot \| _ { 2 }$ denotes the $\ell _ { 2 }$ norm. Here we assume that each personality dimension corresponds to a different dimension in the Euclidean space, and the difference between two testing results can be measured by their Euclidean distance. We set $\alpha = 1 0 0$ to convert such Euclidean distance metric into a similarity metric with a range from 0 to 1. Intuitively, a smaller average distance between all testing results and the final average result can indicate a higher consistency score $s _ { c }$ of these assessments.
|
| 112 |
+
|
| 113 |
+
Robustness Scores. The assessments of the LLM should be robust to the random perturbations of input prompts (“prompt biases”) such as randomly-permuted options. Ideally, we expect that the LLM can classify the same subject as the same personality, regardless of option orders in the question instruction. We compute the similarity of average testing results between using fixed-order options (i.e., original order) and using randomlypermuted options to measure the robustness score of assessments, which is defined as
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
s _ { r } = { \frac { \alpha } { \alpha + D _ { E } ( \overline { { X ^ { \prime } } } , \overline { { X } } ) } } ,
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
where $\overline { { X ^ { \prime } } }$ and $\overline { { X } }$ represent the average testing results when adopting the original fixed-order options and randomly-permuted options, respectively. We employ the same constant $\alpha = 1 0 0$ used in Eq. (2). A larger similarity between ${ \overline { { X ^ { \prime } } } }$ and $\overline { { X } }$ with smaller distance leads to a higher $s _ { r }$ , which indicates that the LLM has higher robustness against prompt biases to achieve more similar results.
|
| 120 |
+
|
| 121 |
+
Fairness Scores. The assessments of the LLM on different groups of people should be unbiased and match prevailing societal values. For example, an LLM should NOT possess stereotypical biases on people with different genders, races, and religions. When not specifying backgrounds such as professions, a fair personality assessment on the general people such as the subjects “Men” or “Women” is supposed to be similar. Considering that races and religions are highly controversial topics and typically lack a universal standard to evaluate, we only analyze the fairness of LLMs’ assessment on different genders. We propose to use the assessment similarity of subjects with different genders to measure the fairness of assessments on genders. The fairness score is calculated by
|
| 122 |
+
|
| 123 |
+
$$
|
| 124 |
+
s _ { f } = { \frac { \alpha s _ { c } ^ { M } s _ { c } ^ { F } } { \alpha + D _ { E } ( \overline { { X ^ { M } } } , \overline { { X ^ { F } } } ) } } ,
|
| 125 |
+
$$
|
| 126 |
+
|
| 127 |
+
where $\overline { { X ^ { M } } }$ and $\overline { { X ^ { F } } }$ represent the average testing results of male (e.g., “Men”, “Boys”) and female subjects (e.g., “Women”, “Girls”), respectively.
|
| 128 |
+
|
| 129 |
+
Table 1: Personality types and scores assessed by InstructGPT, ChatGPT, and GPT-4 when we query different subjects. The score results are averaged from multiple independent testings. We present the assessed scores of five dimensions that dominate the personality types. Bold indicates the same personality role assessed from all LLMs, while the underline denotes the highest score among LLMs when obtaining the same assessed personality type.
|
| 130 |
+
|
| 131 |
+
<table><tr><td>LLM</td><td>Subject</td><td>People</td><td>Men</td><td>Women</td><td>Barbers</td><td>Accountants</td><td>Doctors</td><td>Artists</td><td>Mathematicians</td><td>Politicians</td></tr><tr><td rowspan="4">InstructGPT</td><td rowspan="4">Personality Types/Scores</td><td>E=64</td><td>E=66</td><td>E=66</td><td>E=53</td><td>I=53</td><td>E=52</td><td>E=59</td><td>I= 51</td><td>E=59</td></tr><tr><td>N= 65</td><td>N= 64</td><td>N= 71</td><td>N= 52</td><td>N= 52</td><td>N= 58</td><td>N= 69</td><td>N= 56</td><td>N= 62</td></tr><tr><td>T= 53</td><td>T=50</td><td>F= 55</td><td>F= 53</td><td>F=51</td><td>F= 54</td><td>F= 59</td><td>T= 54</td><td>T= 54</td></tr><tr><td>J= 62</td><td>J= 56</td><td>J= 61</td><td>J= 66</td><td>J= 72</td><td>J= 71</td><td>J= 60</td><td>J= 67</td><td>J= 59</td></tr><tr><td rowspan="3">Personality Role</td><td rowspan="3">T= 60</td><td>T= 62</td><td></td><td>T= 58</td><td>A= 53</td><td>T= 62</td><td>T= 53</td><td>A= 50</td><td>A= 52</td><td>T= 54</td></tr><tr><td>Commander</td><td>Commander</td><td>Protagonist</td><td>Protagonist</td><td>Adventurer</td><td>Protagonist</td><td>Protagonist</td><td>Architect</td><td>Commander</td></tr><tr><td>E=57</td><td>E= 55</td><td>E= 54</td><td>E=50</td><td>I=56</td><td>E= 54</td><td>E=58</td><td>I= 61</td><td>E=63</td></tr><tr><td rowspan="5">ChatGPT</td><td rowspan="5">Personality Types /Scores</td><td>N= 60</td><td>N= 52</td><td>N= 51</td><td>S= 51</td><td>S= 59</td><td>N= 52</td><td>N= 67</td><td>N= 54</td><td>N= 50</td></tr><tr><td>T=51</td><td>T= 52</td><td>T=51</td><td>T=53</td><td>T=60</td><td>F= 54</td><td>F= 60</td><td>T=64</td><td>T=58</td></tr><tr><td>J= 57</td><td>J= 54</td><td>J= 53</td><td>J= 56</td><td>J= 68</td><td>J= 64</td><td>P=58</td><td>J= 62</td><td>J= 56</td></tr><tr><td>T=59</td><td>T=51</td><td>A= 50</td><td>T=51</td><td>A=50</td><td>T= 56</td><td>T= 64</td><td>A=50</td><td>T= 59</td></tr><tr><td>Personality Commander</td><td>Commander</td><td>Commander</td><td>Executive</td><td>Logistician</td><td>Protagonist</td><td>Campaigner</td><td>Architect</td><td>Commander</td></tr><tr><td rowspan="5">GPT-4 Types /Scores</td><td rowspan="4">Role Personality</td><td>E=53</td><td>E=57</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>N= 61</td><td>N= 53</td><td>E= 61 N= 58</td><td>E=52 N= 50</td><td>I= 54 S= 55</td><td>E=54 N= 51</td><td>E=58 N= 67</td><td>I= 61</td><td>E=64</td></tr><tr><td>T= 54</td><td>T= 55</td><td>F= 58</td><td>T=51</td><td>T= 57</td><td>F= 55</td><td>F= 56</td><td>N= 56 T= 64</td><td>S=51 T= 57</td></tr><tr><td>J= 54</td><td>= 56</td><td>J= 57</td><td>J= 56</td><td>J= 68</td><td>J= 66</td><td>P=58</td><td>J= 64</td><td>J= 55</td></tr><tr><td></td><td>T= 68</td><td>T= 63</td><td>T= 61</td><td>A=51</td><td>A=50</td><td>T= 53</td><td>T= 63</td><td>T = 51</td><td></td></tr><tr><td></td><td>Personality Role</td><td>Commander</td><td>Commander</td><td>Protagonist</td><td>Commander</td><td>Logistician</td><td>Protagonist</td><td>Campaigner</td><td>Architect</td><td>T= 57 Executive</td></tr></table>
|
| 132 |
+
|
| 133 |
+

|
| 134 |
+
Figure 3: The most frequent option for each question in multiple independent testings of InstructGPT (Left), ChatGPT (Middle), and GPT-4 (Right) when we query the subject “People” (Top row),or “Artists” (Bottom row). “GC”, “PC”, “NCNW”, “PW”, and “GW” denote “Generally correct”, “Partially correct”, “Neither correct nor wrong”, “Partially wrong”, and “Generally wrong”.
|
| 135 |
+
|
| 136 |
+
Here we multiply their corresponding consistency scores sMc and s Fc since a higher assessment consistency of subjects can contribute more to their inherent similarity. A larger $s _ { f }$ indicates that the assessments on different genders are more fair with higher consistency and less bias.
|
| 137 |
+
|
| 138 |
+
# 4 Experimental Setups
|
| 139 |
+
|
| 140 |
+
GPT Models. InstructGPT (text-davinci-003 model) (Ouyang et al., 2022) is a fine-tuned series of GPT-3 (Brown et al., 2020) using reinforcement learning from human feedback (RLHF). Compared with InstructGPT, ChatGPT (gpt-3.5-turbo model) is trained on a more diverse range of internet text (e.g., social media, news) and can better and faster respond to prompts in a conversational manner. GPT-4 (gpt-4 model) (Bubeck et al., 2023) can be viewed as an enhanced version of ChatGPT, and it can solve more complex problems and support multi-modal chat with broader general knowledge and stronger reasoning capabilities.
|
| 141 |
+
|
| 142 |
+
Myers–Briggs Type Indicator. The Myers–Briggs Type Indicator (MBTI) (Myers and McCaulley, 1985) assesses the psychological preferences of individuals in how they perceive the world and make decisions via an introspective questionnaire, so as to identify different personality types based on five dichotomies1: (1) Extraverted versus Introverted (E vs. I); (2) Intuitive versus Observant (N vs. S); (3) Thinking versus Feeling (T vs. F); (4) Judging versus Prospecting (J vs. P); (5) Assertive versus Turbulent (A vs. T) (see Appendix C).
|
| 143 |
+
|
| 144 |
+
Implementation Details. The number of independent testings for each subject is set to $N = 1 5$ We evaluate the consistency and robustness scores of LLMs’ assessments on the general population (“People”, “Men”, “Women”) and specific professions following (Nadeem et al., 2021). The fairness score is measured based on two gender pairs, namely (“Men”, “Women”) and (“Boys”, “Girls”). More details are provided in the appendices.
|
| 145 |
+
|
| 146 |
+
# 5 Results and Analyses
|
| 147 |
+
|
| 148 |
+
We query ChatGPT, InstructGPT, and GPT-4 to assess the personalities of different subjects, and
|
| 149 |
+
|
| 150 |
+
Table 2: Consistency scores $( s _ { c } )$ and robustness scores $\left( s _ { r } \right)$ comparison between InstructGPT, ChatGPT, and GPT-4 in assessing different subjects. Bold shows the highest average scores among them.
|
| 151 |
+
|
| 152 |
+
<table><tr><td>Metric</td><td>LLM</td><td>People</td><td>Men</td><td>Women</td><td>Barbers</td><td>Accountants</td><td>Doctors</td><td>Artists</td><td>Mathematicians</td><td>Politicians</td><td>Average</td></tr><tr><td rowspan="3">Consistency Score</td><td>InstructGPT ChatGPT</td><td>0.916</td><td>0.888</td><td>0.905</td><td>0.898</td><td>0.925</td><td>0.901</td><td>0.900</td><td>0.897</td><td>0.914</td><td>0.905</td></tr><tr><td></td><td>0.907</td><td>0.895</td><td>0.913</td><td>0.922</td><td>0.932</td><td>0.922</td><td>0.918</td><td>0.932</td><td>0.919</td><td>0.918</td></tr><tr><td>GPT-4</td><td>0.936</td><td>0.927</td><td>0.911</td><td>0.909</td><td>0.928</td><td>0.916</td><td>0.927</td><td>0.922</td><td>0.911</td><td>0.921</td></tr><tr><td rowspan="2">Robustness</td><td>InstructGPT</td><td>0.936</td><td>0.924</td><td>0.944</td><td>0.925</td><td>0.965</td><td>0.936</td><td>0.936</td><td>0.956</td><td>0.952</td><td>0.942</td></tr><tr><td>ChatGPT</td><td>0.888</td><td>0.917</td><td>0.960</td><td>0.927</td><td>0.958</td><td>0.967</td><td>0.940</td><td>0.920</td><td>0.935</td><td>0.935</td></tr><tr><td>Score</td><td>GPT-4</td><td>0.970</td><td>0.893</td><td>0.885</td><td>0.965</td><td>0.961</td><td>0.980</td><td>0.928</td><td>0.934</td><td>0.905</td><td>0.936</td></tr></table>
|
| 153 |
+
|
| 154 |
+
Table 3: Fairness scores $( s _ { f } )$ comparison between InstructGPT, ChatGPT, and GPT-4 in assessing different gender pairs. Bold indicates the highest average score.
|
| 155 |
+
|
| 156 |
+
<table><tr><td>LLM</td><td>Menvs.Women</td><td>Boys vs. Girls</td><td>Average</td></tr><tr><td>InstructGPT</td><td>0.723</td><td>0.783</td><td>0.753</td></tr><tr><td>ChatGPT</td><td>0.796</td><td>0.756</td><td>0.776</td></tr><tr><td>GPT4</td><td>0.786</td><td>0.770</td><td>0.778</td></tr></table>
|
| 157 |
+
|
| 158 |
+
compare their assessment results in Table 1. The consistency, robustness, and fairness scores of their assessments are reported in Table 2 and 3.
|
| 159 |
+
|
| 160 |
+
# 5.1 Can ChatGPT Assess Human Personalities?
|
| 161 |
+
|
| 162 |
+
As shown in Fig. 3, most answers and their distributions generated by three LLMs are evidently different, which suggests that each model can be viewed as an individual to provide independent opinions in assessing personalities. Notably, ChatGPT and GPT-4 can respond to questions more flexibly (i.e., more diverse options and distributions) compared with InstructGPT. This is consistent with their property of being trained on a a wider range of topics, enabling them to possess stronger model capacity (e.g., reasoning ability) for better assessment.
|
| 163 |
+
|
| 164 |
+
Interestingly, in spite of possibly different answer distributions, the average results in Table 1 show that four subjects are assessed as the same personality types by all LLMs. This could suggest the inherent similarity of their personality assessment abilities. In most of these cases, ChatGPT tends to achieve medium personality scores, implying its more neutral assessment compared with other two LLMs. It is worth noting that some assessment results from ChatGPT and GPT-4 are close to our intuition: (1) Accountants are assessed as “Logistician” that is usually a reliable, practical and fact-minded individual. (2) Artists are classified as the type “ENFP-T” that often possesses creative and enthusiastic spirits. (3) Mathematicians are assessed to be the personality role "Architect" that are thinkers with profound ideas and strategic plans. To a certain extent, these results demonstrate their effectiveness on human personality assessment. Moreover, it is observed that “People” and “Men” are classified as leader roles (“Commander”) by all LLMs. We speculate that it is a result of the human-centered fine-tuning (e.g., reinforcement learning from human feedback (RLHF)), which encourages LLMs to follow the prevailing positive societal conceptions and values such as the expected relations between human and LLMs. In this context, the assessed personality scores in Table 1 can shed more insights on “how LLMs view humans” and serve as an indicator to better develop human-centered and socially-beneficial LLMs.
|
| 165 |
+
|
| 166 |
+
# 5.2 Is the Assessment Consistent, Robust and Fair?
|
| 167 |
+
|
| 168 |
+
As shown in Table 2, ChatGPT and GPT-4 achieve higher consistency scores than InstructGPT in most cases when assessing different subjects. This suggests that ChatGPT and GPT-4 can provide more similar and consistent personality assessment results under multiple independent testings. However, their average robustness scores are slightly lower than that of InstructGPT, which indicates that their assessments could be more sensitive to the prompt biases (e.g., changes of option orders). This might lead to their more diverse answer distributions in different testings as shown in Fig. 3. It actually verifies the necessity of the proposed unbiased prompts and the averaging of testing results to encourage more impartial assessments. As presented in Table 3, ChatGPT and GPT-4 show higher average fairness scores than InstructGPT when assessing different genders. This indicates that they are more likely to equally assess subjects with less gender bias, which is consistent with the finding of (Zhuo et al., 2023). In summary, although the assessments of ChatGPT and GPT-4 can be influenced by random input perturbations, their overall assessment results are more consistent and fairer compared with InstructGPT.
|
| 169 |
+
|
| 170 |
+
Table 4: Personality types and roles assessed by ChatGPT and GPT-4 when we query subjects with different income levels (low, middle, high), age levels (children, adolescents, adults, old adults) or different education levels (junior/middle/high school students, undergraduate/master/PhD students). The results are averaged from multiple independent testings. Bold indicates the same personality types/role assessed from all LLMs.
|
| 171 |
+
|
| 172 |
+
<table><tr><td rowspan=2 colspan=1>LLM</td><td rowspan=2 colspan=1>Background</td><td rowspan=1 colspan=3>Income Level</td><td rowspan=1 colspan=2>AgeLevel</td><td rowspan=1 colspan=2>evel</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>Edu</td><td rowspan=1 colspan=2>Education Level</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Low</td><td rowspan=1 colspan=1>Middle</td><td rowspan=1 colspan=1>High</td><td rowspan=1 colspan=1>Children</td><td rowspan=1 colspan=1>Adolescents</td><td rowspan=1 colspan=1>Adults</td><td rowspan=1 colspan=1>Old Adults</td><td rowspan=1 colspan=1>Junior</td><td rowspan=1 colspan=1>Middle</td><td rowspan=1 colspan=1>High</td><td rowspan=1 colspan=1>Undergraduate</td><td rowspan=1 colspan=1>Master</td><td rowspan=1 colspan=1>PhD</td></tr><tr><td rowspan=2 colspan=1>ChatGPT</td><td rowspan=1 colspan=1>PersonalityTypes</td><td rowspan=1 colspan=1>INFJ-T</td><td rowspan=1 colspan=1>ENFJ-T</td><td rowspan=1 colspan=1>ENTJ-T</td><td rowspan=1 colspan=1>ENFP-T</td><td rowspan=1 colspan=1>ENFP-T</td><td rowspan=1 colspan=1>ENTJ-T</td><td rowspan=1 colspan=1>INFJ-T</td><td rowspan=1 colspan=1>ESFP-T</td><td rowspan=1 colspan=1>ENFP-T</td><td rowspan=1 colspan=1>ENFJ-T</td><td rowspan=1 colspan=1>ENFJ-T</td><td rowspan=1 colspan=1>INTJ-T</td><td rowspan=1 colspan=1>INTJ-T</td></tr><tr><td rowspan=1 colspan=1>PersonalityRole</td><td rowspan=1 colspan=1>Advocate</td><td rowspan=1 colspan=1>Protagonist</td><td rowspan=1 colspan=1>Commander</td><td rowspan=1 colspan=1>Campaigner</td><td rowspan=1 colspan=1>Campaigner</td><td rowspan=1 colspan=1>Commander</td><td rowspan=1 colspan=1>Advocate</td><td rowspan=1 colspan=1>Entertainer</td><td rowspan=1 colspan=1>Campaigner</td><td rowspan=1 colspan=1>Protagonist</td><td rowspan=1 colspan=1>Protagonist</td><td rowspan=1 colspan=1>Architect</td><td rowspan=1 colspan=1>Architect</td></tr><tr><td rowspan=2 colspan=1>GPT-4</td><td rowspan=1 colspan=1>PersonalityTypes</td><td rowspan=1 colspan=1>ENFJ-T</td><td rowspan=1 colspan=1>ENFJ-T</td><td rowspan=1 colspan=1>ENTJ-T</td><td rowspan=1 colspan=1>ENFP-T</td><td rowspan=1 colspan=1>ENFP-T</td><td rowspan=1 colspan=1>ENTJ-T</td><td rowspan=1 colspan=1>ENFJ-T</td><td rowspan=1 colspan=1>ENTP-T</td><td rowspan=1 colspan=1>ENTP-T</td><td rowspan=1 colspan=1>ENTP-T</td><td rowspan=1 colspan=1>ENTJ-T</td><td rowspan=1 colspan=1>ENTJ-T</td><td rowspan=1 colspan=1>ENTJ-T</td></tr><tr><td rowspan=1 colspan=1>PersonalityRole</td><td rowspan=1 colspan=1>Protagonist</td><td rowspan=1 colspan=1>Protagonist</td><td rowspan=1 colspan=1>Commander</td><td rowspan=1 colspan=1>Campaigner</td><td rowspan=1 colspan=1>Campaigner</td><td rowspan=1 colspan=1>Commander</td><td rowspan=1 colspan=1>Protagonist</td><td rowspan=1 colspan=1>Debater</td><td rowspan=1 colspan=1>Debater</td><td rowspan=1 colspan=1>Debater</td><td rowspan=1 colspan=1>Commander</td><td rowspan=1 colspan=1>Commander</td><td rowspan=1 colspan=1>Commander</td></tr></table>
|
| 173 |
+
|
| 174 |
+

|
| 175 |
+
Figure 4: The most frequent option for each question in multiple independent testings of InstructGPT (Left), ChatGPT (Middle), GPT-4 (Right) when we query the subject “Artists” without using unbiased prompts. “W” denotes “Wrong”, and other legends are same as Fig. 3.
|
| 176 |
+
Figure 6: An example of uncertain answers generated from ChatGPT when querying a specific individual.
|
| 177 |
+
|
| 178 |
+

|
| 179 |
+
Figure 5: Personality scores of different subjects in five dimensions of MBTI results assessed from InstructGPT (Blue), ChatGPT (Orange), and GPT-4 (Green).
|
| 180 |
+
|
| 181 |
+
# 6 Discussions
|
| 182 |
+
|
| 183 |
+
Effects of Unbiased Prompts. Fig. 4 shows that using the same-order options leads to a higher frequency of the same option (i.e., more fixed answers) for many questions compared with employing unbiased prompts (see Fig. 3). This suggests the effectiveness and necessity of the proposed unbiased prompts, which introduce random perturbations into question inputs and average all testing results to encourage more impartial assessment.
|
| 184 |
+
|
| 185 |
+
Effects of Background Prompts. We show the effects of background prompts on LLM’s assessments by adding different income, age or education information of the subject. As shown in Table 4, “Middle-income people” is assessed as the type “ENFJ-T” that is slightly different from the type “ENTJ-T” of “People”. Interestingly, high education level subjects such as “Master” and “PhD” are
|
| 186 |
+
|
| 187 |
+
Statement: Taylor Swift spends a lot of her free time exploring various random topics that pique her interests.
|
| 188 |
+
|
| 189 |
+
Answer: It is neither correct nor wrong. Without more information on her personal lifeand interests,it is difficult to determine the full accuracy of the statement...
|
| 190 |
+
|
| 191 |
+
assessed as the “INTJ-T” or “ENTJ-T” type that often possesses strategic plans, profound ideas or rational minds, while junior/middle school students are classified to the types that are usually energetic or curious. This implies that ChatGPT and GPT-4 may be able to to understand different backgrounds of subjects, and an appropriate background prompt could facilitate reliable personality assessments.
|
| 192 |
+
|
| 193 |
+
Visualization of Different Assessments. Fig. 5 visualizes three subjects with different assessed types or scores. ChatGPT and GPT-4 achieve very close scores in each dimension despite different assessed types, which demonstrates their higher similarity in personality assessment abilities.
|
| 194 |
+
|
| 195 |
+
Assessment of Specific Individuals. Querying LLMs about the personality of a certain person might generate uncertain answers due to the insufficiency of personal backgrounds (e.g., behavior patterns) in its knowledge base (see Fig. 6). Considering the effects of background prompts, providing richer background information through subject-specific prompts or fine-tuning can help achieve a more reliable assessment. More results and analyses are provided in Appendix B.
|
| 196 |
+
|
| 197 |
+
# 7 Conclusion
|
| 198 |
+
|
| 199 |
+
This paper proposes a general evaluation framework for LLMs to assess human personalities via MBTI. We devise unbiased prompts to encourage LLMs to generate more impartial answers. The subject-replaced query is proposed to flexibly query personalities of different people. We further construct correctness-evaluated instructions to enable clearer LLM responses. We evaluate LLMs’ consistency, robustness, and fairness in personality assessments, and demonstrate the higher consistency and fairness of ChatGPT and GPT-4 than InstructGPT.
|
| 200 |
+
|
| 201 |
+
# 8 Acknowledgements
|
| 202 |
+
|
| 203 |
+
This research is supported by the National Research Foundation, Singapore under its AI Singapore Programme (AISG Award No: AISG2-PhD/2022-01- 034[T]).
|
| 204 |
+
|
| 205 |
+
# Limitations
|
| 206 |
+
|
| 207 |
+
While our study is a step toward the promising open direction of LLM-based human personality and psychology assessment, it possesses limitations and opportunities when applied to the real world. First, our work focuses on ChatGPT model series and the experiments are conducted on a limited number of LLMs. Our framework is also scalable to be applied to other LLMs such as LLaMA, while its performance remains to be further explored. Second, although most independent testings of the LLM under the same standard setting yield similar assessments, the experimental setting (e.g., hyper-parameters) or testing number can be further customized to test the reliability of LLMs under extreme cases. We will leverage the upcoming API that supports controllable hyper-parameters to better evaluate GPT models. Third, the representations of different genders might be insufficient. For example, the subjects “Ladies” and “Gentlemen” also have different genders, while they can be viewed as groups that differ from “Men” and “Women”. As the focus of this work is to devise a general evaluation framework, we will further explore the assessment of more diverse subjects in future works. Last, despite the popularity of MBTI in different areas, its scientific validity is still under exploration. In our work, MBTI is adopted as a representative personality measure to help LLMs conduct quantitative evaluations. We will explore other tests such as Big Five Inventory (BFI) (John et al., 1999) under our scalable framework.
|
| 208 |
+
|
| 209 |
+
# Ethics Considerations
|
| 210 |
+
|
| 211 |
+
Misuse Potential. Due to the exploratory nature of our study, one should not directly use, generalize or match the assessment results (e.g., personality types of different professions) with certain realworld populations. Otherwise, the misuse of the proposed framework and LLM’s assessments might lead to unrealistic conclusions and even negative societal impacts (e.g., discrimination) on certain groups of people. Our framework must not be used for any ethically questionable applications.
|
| 212 |
+
|
| 213 |
+
Biases. The LLMs used in our study are pretrained on the large-scale datasets or Internet texts that may contain different biases or unsafe (e.g., toxic) contents. Despite with human fine-tuning, the model could still generate some biased personality assessments that might not match the prevailing societal conceptions or values. Thus, the assessment results of LLMs via our framework must be further reviewed before generalization.
|
| 214 |
+
|
| 215 |
+
Broader Impact. Our study reveals the possibility of applying LLMs to automatically analyze human psychology such as personalities, and opens a new avenue to learn about their perceptions and assessments on humans, so as to better understand LLMs’ potential thinking modes, response motivations, and communication principles. This can help speed up the development of more reliable, human-friendly, and trustworthy LLMs, as well as facilitate the future research of AI psychology and sociology. Our work suggests that LLMs such as InstructGPT may have biases on different genders, which could incur societal and ethical risks in their applications. Based on our study, we advocate introducing more human-like psychology and personality testings into the design and training of LLMs, so as to improve model safety and user experience.
|
| 216 |
+
|
| 217 |
+
# References
|
| 218 |
+
|
| 219 |
+
Tolga Bolukbasi, Kai-Wei Chang, James Y Zou, Venkatesh Saligrama, and Adam T Kalai. 2016. Man is to computer programmer as woman is to homemaker? debiasing word embeddings. Advances in Neural Information Processing Systems (NeurIPS), 29. Shikha Bordia and Samuel Bowman. 2019. Identifying and reducing gender bias in word-level language models. In Proceedings of the North American Chapter of the Association for Computational Linguistics (NAACL): Student Research Workshop, pages 7–15. Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. 2020. Language models are few-shot learners. Advances in Neural Information Processing Systems (NeurIPS), 33:1877–1901.
|
| 220 |
+
|
| 221 |
+
Sébastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. 2023. Sparks of artificial general intelligence: Early experiments with GPT-4. arXiv preprint arXiv:2303.12712.
|
| 222 |
+
|
| 223 |
+
Graham Caron and Shashank Srivastava. 2022. Identifying and manipulating the personality traits of language models. arXiv preprint arXiv:2212.10276.
|
| 224 |
+
|
| 225 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. 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 (NAACL-HLT), pages 4171–4186.
|
| 226 |
+
|
| 227 |
+
John M Digman. 1990. Personality structure: Emergence of the five-factor model. Annual review of psychology, 41(1):417–440.
|
| 228 |
+
|
| 229 |
+
Hans Jurgen Eysenck. 2012. A model for personality. Springer Science & Business Media.
|
| 230 |
+
|
| 231 |
+
Jiaxin Huang, Shixiang Shane Gu, Le Hou, Yuexin Wu, Xuezhi Wang, Hongkun Yu, and Jiawei Han. 2022. Large language models can self-improve. arXiv preprint arXiv:2210.11610.
|
| 232 |
+
|
| 233 |
+
Guangyuan Jiang, Manjie Xu, Song-Chun Zhu, Wenjuan Han, Chi Zhang, and Yixin Zhu. 2022. MPI: Evaluating and inducing personality in pre-trained language models. arXiv preprint arXiv:2206.07550.
|
| 234 |
+
|
| 235 |
+
Zhengbao Jiang, Frank F Xu, Jun Araki, and Graham Neubig. 2020. How can we know what language models know? Transactions of the Association for Computational Linguistics, 8:423–438.
|
| 236 |
+
|
| 237 |
+
Oliver P John, Sanjay Srivastava, et al. 1999. The bigfive trait taxonomy: History, measurement, and theoretical perspectives.
|
| 238 |
+
|
| 239 |
+
Saketh Reddy Karra, Son Nguyen, and Theja Tulabandhula. 2022. AI personification: Estimating the personality of language models. arXiv preprint arXiv:2204.12000.
|
| 240 |
+
|
| 241 |
+
Michal Kosinski. 2023. Theory of mind may have spontaneously emerged in large language models. arXiv preprint arXiv:2302.02083.
|
| 242 |
+
|
| 243 |
+
Xingxuan Li, Yutong Li, Linlin Liu, Lidong Bing, and Shafiq Joty. 2022. Is GPT-3 a psychopath? evaluating large language models from a psychological perspective. arXiv preprint arXiv:2212.10529.
|
| 244 |
+
|
| 245 |
+
Marilù Miotto, Nicola Rossberg, and Bennett Kleinberg. 2022. Who is GPT-3? An exploration of personality, values and demographics. In Conference on Empirical Methods in Natural Language Processing (EMNLP) Workshop.
|
| 246 |
+
|
| 247 |
+
Shima Rahimi Moghaddam and Christopher J Honey. 2023. Boosting theory-of-mind performance in large language models via prompting. arXiv preprint arXiv:2304.11490.
|
| 248 |
+
|
| 249 |
+
Isabel Briggs Myers. 1962. The Myers-Briggs Type Indicator: Manual (1962).
|
| 250 |
+
|
| 251 |
+
Isabel Briggs Myers and Mary H. McCaulley. 1985. Manual: A guide to the development and use of the Myers-Briggs Type Indicator. Consulting Psychologists Press.
|
| 252 |
+
|
| 253 |
+
Moin Nadeem, Anna Bethke, and Siva Reddy. 2021. StereoSet: Measuring stereotypical bias in pretrained language models. In Proceedings of the Annual Meeting of the Association for Computational Linguistics and the International Joint Conference on Natural Language Processing (ACL-IJCNLP), pages 5356– 5371.
|
| 254 |
+
|
| 255 |
+
Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Gray, et al. 2022. Training language models to follow instructions with human feedback. In Advances in Neural Information Processing Systems (NeurIPS).
|
| 256 |
+
|
| 257 |
+
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. 2019. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9.
|
| 258 |
+
|
| 259 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. The Journal of Machine Learning Research, 21(1):5485–5551.
|
| 260 |
+
|
| 261 |
+
James M Schuerger. 2000. The sixteen personality factor questionnaire (16PF). Testing and assessment in counseling practice, pages 73–110.
|
| 262 |
+
|
| 263 |
+
Emily Sheng, Kai-Wei Chang, Prem Natarajan, and Nanyun Peng. 2019. The woman worked as a babysitter: On biases in language generation. 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), pages 3407–3412.
|
| 264 |
+
|
| 265 |
+
Eva AM van Dis, Johan Bollen, Willem Zuidema, Robert van Rooij, and Claudi L Bockting. 2023. ChatGPT: Five priorities for research. Nature, 614(7947):224–226.
|
| 266 |
+
|
| 267 |
+
Laura Weidinger, John Mellor, Maribeth Rauh, Conor Griffin, Jonathan Uesato, Po-Sen Huang, Myra Cheng, Mia Glaese, Borja Balle, Atoosa Kasirzadeh, et al. 2021. Ethical and social risks of harm from language models. arXiv preprint arXiv:2112.04359.
|
| 268 |
+
|
| 269 |
+
Zhengyuan Yang, Zhe Gan, Jianfeng Wang, Xiaowei Hu, Yumao Lu, Zicheng Liu, and Lijuan Wang. 2022.
|
| 270 |
+
|
| 271 |
+
An empirical study of GPT-3 for few-shot knowledgebased VQA. In Proceedings of the AAAI Conference on Artificial Intelligence (AAAI), volume 36, pages 3081–3089.
|
| 272 |
+
|
| 273 |
+
Ann Yuan, Andy Coenen, Emily Reif, and Daphne Ippolito. 2022. Wordcraft: Story writing with large language models. In 27th International Conference on Intelligent User Interfaces. ACM.
|
| 274 |
+
|
| 275 |
+
Xiaoming Zhai. 2022. ChatGPT user experience: Implications for education. Available at SSRN 4312418.
|
| 276 |
+
|
| 277 |
+
Zihao Zhao, Eric Wallace, Shi Feng, Dan Klein, and Sameer Singh. 2021. Calibrate before use: Improving few-shot performance of language models. In International Conference on Machine Learning (ICML), pages 12697–12706. PMLR.
|
| 278 |
+
|
| 279 |
+
Terry Yue Zhuo, Yujin Huang, Chunyang Chen, and Zhenchang Xing. 2023. Exploring AI ethics of ChatGPT: A diagnostic analysis. arXiv preprint arXiv:2301.12867.
|
| 280 |
+
|
| 281 |
+
Mingyu Zong and Bhaskar Krishnamachari. 2022. A survey on GPT-3. arXiv preprint arXiv:2212.00857.
|
md/dev/x1FgW3vSM6/x1FgW3vSM6.md
ADDED
|
@@ -0,0 +1,407 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Flag Aggregator: Distributed Training under Failures and Augmented Losses using Convex Optimization
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 Modern ML applications increasingly rely on complex deep learning models and
|
| 11 |
+
2 large datasets. There has been an exponential growth in the amount of computa
|
| 12 |
+
3 tion needed to train the largest models. Therefore, to scale computation and data,
|
| 13 |
+
4 these models are inevitably trained in a distributed manner in clusters of nodes,
|
| 14 |
+
5 and their updates are aggregated before being applied to the model. However, a
|
| 15 |
+
6 distributed setup is prone to Byzantine failures of individual nodes, components,
|
| 16 |
+
7 and software. With data augmentation added to these settings, there is a critical
|
| 17 |
+
8 need for robust and efficient aggregation systems. We define the quality of workers
|
| 18 |
+
9 as reconstruction ratios $\in ( 0 , 1 ]$ , and formulate aggregation as a Maximum Like
|
| 19 |
+
10 lihood Estimation procedure using Beta densities. We show that the Regularized
|
| 20 |
+
11 form of log-likelihood wrt subspace can be approximately solved using iterative
|
| 21 |
+
12 least squares solver, and provide convergence guarantees using recent Convex
|
| 22 |
+
13 Optimization landscape results. Our empirical findings demonstrate that our ap
|
| 23 |
+
14 proach significantly enhances the robustness of state-of-the-art Byzantine resilient
|
| 24 |
+
15 aggregators. We evaluate our method in a distributed setup with a parameter server,
|
| 25 |
+
16 and show simultaneous improvements in communication efficiency and accuracy
|
| 26 |
+
17 across various tasks.
|
| 27 |
+
|
| 28 |
+
# 18 1 Introduction
|
| 29 |
+
|
| 30 |
+
19 How to Design Aggregators? We consider the problem of designing aggregation functions that can
|
| 31 |
+
20 be written as optimization problems of the form,
|
| 32 |
+
|
| 33 |
+
$$
|
| 34 |
+
\ A ( g _ { 1 } , \ldots , g _ { p } ) \in \arg \operatorname* { m i n } _ { Y \in C } A _ { g _ { 1 } , \ldots , g _ { p } } ( Y ) ,
|
| 35 |
+
$$
|
| 36 |
+
|
| 37 |
+
21 where $\{ g _ { i } \} _ { i = 1 } ^ { p } \subseteq \mathbb { R } ^ { n }$ are given estimates of an unknown summary statistic used to compute the
|
| 38 |
+
22 Aggregator $Y ^ { * }$ . If we choose $A$ to be a quadratic function that decomposes over $g _ { i }$ ’s, and $C = \mathbb { R } ^ { n }$ ,
|
| 39 |
+
23 then we can see $\mathcal { A }$ is simply the standard mean operator. There is a mature literature of studying such
|
| 40 |
+
24 functions for various scientific computing applications [1]. More recently, from the machine learning
|
| 41 |
+
25 standpoint there has been a plethora of work [2, 3, 4, 5] on designing provably robust aggregators $\mathcal { A }$
|
| 42 |
+
26 for mean estimation tasks under various technical assumptions on the distribution or moments of $g _ { i }$
|
| 43 |
+
27 Distributed ML Use Cases. Consider training a model with a large dataset such as ImageNet-1K
|
| 44 |
+
28 [6] or its augmented version which would require data to be distributed over $p$ workers and uses
|
| 45 |
+
29 back propagation. Indeed, in this case, $g _ { i }$ ’s are typically the gradients computed by individual
|
| 46 |
+
30 workers at each iteration. In settings where the training objective is convex, the convergence and
|
| 47 |
+
31 generalization properties of distributed optimization can be achieved by defining $\mathcal { A }$ as a weighted
|
| 48 |
+
32 combination of gradients facilitated by a simple consensus matrix, even if some $g _ { i }$ ’s are noisy [7, 8].
|
| 49 |
+
33 In a distributed setup, as long as the model is convex we can simultaneously minimize the total
|
| 50 |
+
34 iteration or communication complexity to a significant extent i.e., it is possible to achieve convergence
|
| 51 |
+
35 and robustness under technical assumptions on the moments of (unknown) distribution from which
|
| 52 |
+
36 $g _ { i }$ ’s are drawn. However, it is still an open problem to determine the optimality of these procedures
|
| 53 |
+
37 in terms of either convergence or robustness [9, 10].
|
| 54 |
+
38 Potential Causes of Noise. When data is distributed among workers, hardware and software failures
|
| 55 |
+
39 in workers [11, 12, 13] can cause them to send incorrect gradients, which can significantly mislead
|
| 56 |
+
40 the model [14]. To see this, let’s consider a simple experiment with 15 workers, that $f$ of them
|
| 57 |
+
41 produce uniformly random gradients. Figure 2 shows that the model accuracy is heavily impacted
|
| 58 |
+
42 when $f > 0$ when mean is used to aggregate the gradients.
|
| 59 |
+
43 The failures can occur due to component or software failures and
|
| 60 |
+
44 their probability increases with the scale of the system [15, 16, 17].
|
| 61 |
+
45 Reliability theory is used to analyze such failures, see Chapter 9
|
| 62 |
+
46 in [18], but for large-scale training, the distribution of total system
|
| 63 |
+
47 failures is not independent over workers, making the total noise in
|
| 64 |
+
48 gradients dependent and a key challenge for large-scale training.
|
| 65 |
+
49 Moreover, even if there are no issues with the infrastructure, our
|
| 66 |
+
50 work is motivated by the prevalence of data augmentation, including
|
| 67 |
+
51 hand-chosen augmentations. Since number of parameters $n$ is often
|
| 68 |
+
52 greater than number of samples, data augmentation improves the
|
| 69 |
+
53 generalization capabilities of large-scale models under technical con
|
| 70 |
+
54 ditions [19, 20, 21]. In particular, Adversarial training is a common
|
| 71 |
+
55 technique that finds samples that are close to training samples but
|
| 72 |
+
56 classified as a different class at the current set of parameters, and
|
| 73 |
+
57 then use such samples for parameter update purposes [22]. Unfortunately, computing adversarial
|
| 74 |
+
58 samples is often difficult [23], done using randomized algorithms [24] and so may introduce depen
|
| 75 |
+
59 dent (across samples) noise themselves. In other words, using adversarial training paradigm, or the
|
| 76 |
+
60 so-called inner optimization can lead to noise in gradients, which can cause or simulate dependent
|
| 77 |
+
61 “Byzantine” failures in the distributed context.
|
| 78 |
+
62 Available Computational Solutions. Most existing open source implementations of $\mathcal { A }$ rely just
|
| 79 |
+
63 on (functions of) pairwise distances to filter gradients from workers using suitable neighborhood
|
| 80 |
+
64 based thresholding schemes, based on moment conditions [25, 26, 27]. While these may be a good
|
| 81 |
+
65 strategy when the noise in samples/gradients is somewhat independent, these methods are suboptimal
|
| 82 |
+
66 when the noise is dependent or nonlinear, especially when $n$ is large. Moreover, choosing discrete
|
| 83 |
+
67 hyperparameters such as number of neighbors is impractical in our use cases since they hamper
|
| 84 |
+
68 convergence of the overall training procedure. To mitigate the suboptimality of existing aggregation
|
| 85 |
+
69 schemes, we explicitly estimate a subspace $Y$ spanned by “most” of the gradient workers, and then
|
| 86 |
+
70 use this subspace to estimate that a sparse linear combination of $g _ { i }$ gradients, acheiving robustness.
|
| 87 |
+
71 We present a new optimization based formulation for generalized gradient aggregation purposes in
|
| 88 |
+
72 the context of distributed training of deep learning architectures, as shown in Figure 1.
|
| 89 |
+
73 Summary of our Contributions. From the theoretical perspective, we present a simple Maximum
|
| 90 |
+
74 Likelihood Based estimation procedure for aggregation purposes, with novel regularization functions.
|
| 91 |
+
75 Algorithmically, we argue that any procedure used to solve Flag Optimization can be directly used to
|
| 92 |
+
76 obtain the optimal summary statistic $Y ^ { * }$ for our aggregation purposes. Experimentally, our results
|
| 93 |
+
77 show resilience against Byzantine attacks, encompassing physical failures, while effectively managing
|
| 94 |
+
78 the stochasticity arising from data augmentation schemes. In practice, we achieve a significantly
|
| 95 |
+
79 $( \approx 2 0 \% )$ ) better accuracy on standard datasets. Our implementation offers substantial advantages in
|
| 96 |
+
80 reducing communication complexity across diverse noise settings through the utilization of our novel
|
| 97 |
+
81 aggregation function, making it applicable in numerous scenarios.
|
| 98 |
+
|
| 99 |
+

|
| 100 |
+
Figure 1: Robust gradient aggregation in our distributed training framework. In our applications, each of the $p$ workers provides gradients computed using a random sample obtained from given training data, derived synthetic data from off-the-shelf Diffusion models, and random noise in each iteration. Our Flag Aggregator (FA) removes high frequency noise components by using few rounds of Singular Value Decomposition of the concatenated Gradient Matrix $G$ , and provides new update $Y ^ { * }$ .
|
| 101 |
+
|
| 102 |
+

|
| 103 |
+
Figure 2: Tolerance to $f$ Byzantine workers for a nonrobust aggregator (mean).
|
| 104 |
+
|
| 105 |
+
# 2 Robust Aggregators as Orthogonality Constrained Optimization
|
| 106 |
+
|
| 107 |
+
83 In this section, we first provide the basic intuition of our proposed approach to using subspaces for
|
| 108 |
+
84 aggregation purposes using linear algebra, along with connections of our approach standard eigende
|
| 109 |
+
85 composition based denoising approaches. We then present our overall optimization formulation in
|
| 110 |
+
86 two steps, and argue that it can be optimized using existing methods.
|
| 111 |
+
|
| 112 |
+
# 87 2.1 Optimal Subspace Hypothesis for Distributed Descent
|
| 113 |
+
|
| 114 |
+
We will use lowercase letters $y , g$ to denote vectors, and uppercase letters $Y , G$ to denote matrices. We will use boldfont 1 to denote the vector of all ones in appropriate dimensions.
|
| 115 |
+
|
| 116 |
+
is an orthogonal matrix representation of a subspace that gradients could live in such that $m \le p$ . Now, we may interpret each column of $Y$ as a basis function that act on $g _ { i } \in \mathbb { R } ^ { n }$ , i.e., $j$ −th coordinate of $( Y ^ { T } g ) _ { j }$ for $1 \leq j \leq m$ is the application of $j \mathrm { - t h }$ basis or column of $Y$ on $g$ . Recall that by definition of dot product, we have that if $Y _ { : , j } ~ \perp ~ x$ , then $( Y ^ { T } g ) _ { j }$ will be close to zero. Equivalently, if $g \in \mathsf { s p a n } ( Y )$ , then $( Y ^ { T } g ) ^ { T } Y ^ { T } g$ will be bounded away from zero, see Chapter 2 in [28]. Assuming that $G \in \mathbb { R } ^ { n \times p }$ is the gradient matrix of $p$ workers, $Y Y ^ { T } G \in { \overline { { \mathbb { R } } } } ^ { n \times p }$ is the reconstruction of $G$ using $Y$ as basis. That is, $i ^ { t h }$ column of $Y ^ { T } G$ specifies the amount of gradient from worker $i$ as a function of $Y$ , and high $l _ { 2 }$ norm of $Y ^ { \pi } g _ { i }$ implies that there is a basis in $Y$ such that $Y \ne g _ { i }$ . So it is easy to see that the average over columns of 03 $Y Y ^ { T } G$ would give the final gradient for update.
|
| 117 |
+
|
| 118 |
+

|
| 119 |
+
Figure 3: Distributions of Explained Variances on Minibatches
|
| 120 |
+
|
| 121 |
+
104 105 Explainedof gradient $g _ { i }$ riato $z _ { i }$ e of wusing $Y$ ker , th $i$ . n, $0 \leq \| z _ { i } \| _ { 2 } ^ { 2 } = z _ { i } ^ { T } z _ { i } \overset { } { = } ( Y ^ { T } g ) ^ { T } \dot { Y } ^ { T } g = g _ { i } ^ { \overline { { T } } } Y Y ^ { T } g _ { i }$ $z _ { i } = Y ^ { T } g _ { i } \in \mathbb { R } ^ { m }$ sformationis a scalar,
|
| 122 |
+
106 and so is equal to its trace tr $\left( g _ { i } ^ { T } Y Y ^ { T } g _ { i } \right)$ . Moreover, when $Y$ is orthogonal, we have $0 \leq \| z _ { i } \| _ { 2 } =$
|
| 123 |
+
107 $\| Y ^ { T } g _ { i } \| _ { 2 } \leq \| Y \| _ { 2 } \| g _ { i } \| _ { 2 } \leq \| g _ { i } \| _ { 2 }$ since the operator norm (or largest singular value) $\| Y \| _ { 2 }$ of $Y$ is at
|
| 124 |
+
108 most 1. Our main idea is to use $\| z _ { i } \| _ { 2 } ^ { 2 } , \| g _ { i } \| _ { 2 } ^ { 2 }$ to define the quality of the subspace $Y$ for aggregation,
|
| 125 |
+
109 as is done in some previous works for Robust Principal Component Estimation [29] – the quantity
|
| 126 |
+
110 $\| z _ { i } \| _ { 2 } ^ { 2 } / \| g _ { i } \| _ { 2 } ^ { 2 }$ is called as Explained/Expressed variance of subspace $Y$ wrt $i -$ th worker [30, 31] – we
|
| 127 |
+
111 refer to $\| z _ { i } \| _ { 2 } ^ { 2 } / \| g _ { i } \| _ { 2 } ^ { 2 }$ as the “value” of $i -$ th worker. In Figure 3, we can see from the spike near 1.0
|
| 128 |
+
112 that if we choose the subspace carefully (blue) as opposed to merely choosing the mean gradient
|
| 129 |
+
113 (with unit norm) of all workers, then we can increase the value of workers.
|
| 130 |
+
114 Advantages of Subspace based Aggregation. We can see that using subspace $Y$ , we can easily: 1.
|
| 131 |
+
115 handle different number of gradients from each worker, 2. compute gradient reconstruction ${ Y Y ^ { T } G }$
|
| 132 |
+
116 efficiently whenever $Y$ is constrained to be orthogonal $\begin{array} { r } { Y = \sum _ { i } y _ { i } y _ { i } ^ { T } } \end{array}$ where $y _ { i }$ is the $i -$ th column
|
| 133 |
+
117 of $Y$ , otherwise have to use eigendecomposition of $Y$ to measure explained variance which can
|
| 134 |
+
118 be time consuming. In (practical) distributed settings, the quality (or noise level) of gradients in
|
| 135 |
+
119 each worker may be different, and/or each worker may use a different batch size. In such cases,
|
| 136 |
+
120 handcrafted aggregation schemes may be difficult to maintain, and fine-tune. For these purposes with
|
| 137 |
+
121 an Orthogonal Subspace $Y$ , we can simply reweigh gradients of worker $i$ according to its noise level,
|
| 138 |
+
122 and/or use $g _ { i } \in \mathbb { R } ^ { n \times b _ { i } }$ where $b _ { i }$ is the batch size of $i -$ th worker with $\mathrm { t r } ( z _ { i } ^ { T } z _ { i } )$ instead.
|
| 139 |
+
123 Why is optimizing over subspaces called “Flag” Optimization? Recent optimization results
|
| 140 |
+
124 suggest that we can exploit the finer structure available in Flag Manifold to specify $Y$ more precisely
|
| 141 |
+
125 [32]. For example, $Y \in \mathbb { R } ^ { m \times n }$ can be parametrized directly as a subspace of dimension $m$ or
|
| 142 |
+
126 as a nested sequence of $Y _ { k } \ \in \ \mathbb { R } ^ { m _ { k } \times n } , \bar { k } \ = \ 1 , . . . , K$ where $m _ { k } < m _ { k + 1 } \leq p \leq n$ such that
|
| 143 |
+
127 $\mathsf { s p a n } ( Y _ { k } ) \subseteq \mathsf { s p a n } ( Y _ { k + 1 } )$ with $Y _ { K } \in \mathbb { R } ^ { m \times n }$ . When $m _ { k + 1 } = m _ { k } = 1$ , we have the usual (real)
|
| 144 |
+
128 Grassmanian Manifold (quotient of orthogonal group) whose coordinates can be used for optimization,
|
| 145 |
+
129 please see Section 5 in [33] for details. In fact, [34] used this idea to extend median in one-dimensional
|
| 146 |
+
130 vector spaces to different finite dimensional subspaces using the so-called chordal distance between
|
| 147 |
+
131 them. In our distributed training context, we use the explained variance of each worker instead. Here,
|
| 148 |
+
132 workers may specify dimensions along which gradient information is relevant for faster convergence
|
| 149 |
+
133 – an advantage currently not available in existing aggregation implementations – which may be used
|
| 150 |
+
134 for smart initialization also. We use “Flag” to emphasize this additional nested structure available in
|
| 151 |
+
135 our formulation for distributed training purposes.
|
| 152 |
+
|
| 153 |
+
# 2.2 Approximate Maximum Likelihood Estimation of Optimal Subspace
|
| 154 |
+
|
| 155 |
+
137 Now that we can evaluate a subspace $Y$ on individual gradients $g _ { i }$ , we now show that finding subspace
|
| 156 |
+
138 $Y$ can be formulated using standard maximum likelihood estimation principles [35]. Our formulation
|
| 157 |
+
139 reveals that regularization is critical for aggregation especially in distributed training. In order to
|
| 158 |
+
140 write down the objective function for finding optimal $Y$ , we proceed in the following two steps:
|
| 159 |
+
141 Step 1. Assume that each worker provides a single gradient for simplicity. Now, denoting the value of
|
| 160 |
+
142 information $v$ of worker $i$ by $\begin{array} { r } { v _ { i } = \frac { z _ { i } ^ { T } z _ { i } } { g _ { i } ^ { T } g _ { i } } } \end{array}$ , we have $v _ { i } \in [ 0 , 1 ]$ . Now by assuming that $v _ { i }$ ’s are observed
|
| 161 |
+
143 from Beta distribution with $\alpha = 1$ and $\begin{array} { r } { \beta = \frac { 1 } { 2 } } \end{array}$ (for simplicity), we can see that the likelihood $\mathbb { P } ( v _ { i } )$ is,
|
| 162 |
+
|
| 163 |
+
$$
|
| 164 |
+
\mathbb { P } ( v _ { i } ) : = \frac { ( 1 - v _ { i } ) ^ { - \frac { 1 } { 2 } } } { B ( 1 , \frac { 1 } { 2 } ) } = \frac { \left( 1 - \frac { z _ { i } ^ { T } z _ { i } } { g _ { i } ^ { T } g _ { i } } \right) ^ { - \frac { 1 } { 2 } } } { B ( 1 , \frac { 1 } { 2 } ) } ,
|
| 165 |
+
$$
|
| 166 |
+
|
| 167 |
+
144 where $B ( a , b )$ is the normalization constant. Then, the total log-likelihood of observing gradients $g _ { i }$
|
| 168 |
+
145 as a function of $Y$ (or $v _ { i }$ ’s) is given by taking the log of product of $\mathbb { P } ( v _ { i } )$ ’s as (ignoring constants),
|
| 169 |
+
|
| 170 |
+
$$
|
| 171 |
+
\log \left( \prod _ { i = 1 } ^ { p } \mathbb { P } ( v _ { i } ) \right) = \sum _ { i = 1 } ^ { p } \log { \left( \mathbb { P } ( v _ { i } ) \right) } = - \frac { 1 } { 2 } \sum _ { i = 1 } ^ { p } \log ( 1 - v _ { i } ) .
|
| 172 |
+
$$
|
| 173 |
+
|
| 174 |
+
147 146 Step 2. Now we use Taylor’s series with constant likelihoods $\log ( 1 - v _ { i } ) \approx a ( 1 - v _ { i } ) ^ { \frac { 1 } { a } } - a$ as follows: first, we know that $a > 0$ to approximate individual worker log- $\begin{array} { r } { \exp \left( \frac { \log ( v _ { i } ) } { a } \right) = v _ { i } ^ { \frac { 1 } { a } } } \end{array}$ = v 1ai . On
|
| 175 |
+
148 the other hand, using Taylor expansion of exp about the origin (so large $a > 1$ is better), we have that
|
| 176 |
+
149 $\begin{array} { r } { \exp \left( \frac { \log \left( v _ { i } \right) } { a } \right) \approx 1 + \frac { \log \left( v _ { i } \right) } { a } } \end{array}$ . Whence, we have that $\begin{array} { r } { 1 + \frac { \log ( v _ { i } ) } { a } \approx v _ { i } ^ { \frac { 1 } { a } } } \end{array}$ which immediately implies
|
| 177 |
+
150 that $\log ( v _ { i } ) \approx a v _ { i } ^ { \frac { 1 } { a } } - a$ . So, by substituting the Taylor series approximation of log in Equation 3, we
|
| 178 |
+
151 obtain the negative log-likelihood approximation to be minimized for robust aggregation purposes as,
|
| 179 |
+
|
| 180 |
+
$$
|
| 181 |
+
- \log \left( \prod _ { i = 1 } ^ { p } \mathbb { P } ( v _ { i } ) \right) \approx \frac { 1 } { 2 } \sum _ { i = 1 } ^ { p } \left( a \left( 1 - v _ { i } \right) ^ { \frac { 1 } { a } } - a \right) ,
|
| 182 |
+
$$
|
| 183 |
+
|
| 184 |
+
152 where $a > 1$ is a sufficiently large constant. In the above mentioned steps, the first step is standard.
|
| 185 |
+
153 Our key insight is using Taylor expansion in (4) with a sufficiently large $a$ to eliminate log optimization
|
| 186 |
+
154 which are known to be computationally expensive to solve, and instead solve smooth $\ell _ { a } , a > 1$ norm
|
| 187 |
+
155 based optimization problems which can be done efficiently by modifying existing procedures [36].
|
| 188 |
+
156 Extension to general beta distributions, and gradients $\alpha > 0 , \beta > 0 , g _ { i } \in \mathbb { R } ^ { n \times k }$ . Note that our
|
| 189 |
+
157 derivation in the above two steps can be extended to any beta shape parameters $\alpha > 0 , \beta > 0$ – there
|
| 190 |
+
158 will be two terms in the final negative log-likelihood expression in our formulation (4), one for each
|
| 191 |
+
159 $\alpha , \beta$ . Similarly, by simply using $\begin{array} { r } { v _ { i } = { \mathrm { t r } } \left( g _ { i } ^ { T } Y Y ^ { T } g _ { i } \right) } \end{array}$ to define value of worker $i$ in equation (2), and
|
| 192 |
+
160 then in our estimator in (4), we can easily handle multiple $k$ gradients from a single worker $i$ for $Y$ .
|
| 193 |
+
|
| 194 |
+
Input: Number of workers $p$ , loss functions $l _ { 1 } , l _ { 2 } , . . . , l _ { p }$ , per-worker minibatch size $B$ , learning rate schedule $\alpha _ { t }$ , initial parameters $w _ { 0 }$ , number of iterations T
|
| 195 |
+
|
| 196 |
+
Output: Updated parameters $w _ { T }$ from any worker
|
| 197 |
+
|
| 198 |
+
1 for $t = 1$ to $T$ do
|
| 199 |
+
|
| 200 |
+
2 for ${ \mathfrak { p } } = 1$ to a $p$ in paralleinibatch: $\begin{array} { r } { i _ { \mathfrak { p } , 1 , t } , i _ { \mathfrak { p } , 2 , t } , . . . , i _ { \mathfrak { p } , B , t } \quad g _ { \mathfrak { p } , t } \gets \frac { 1 } { B } \sum _ { b = 1 } ^ { B } \nabla l _ { i _ { \mathfrak { p } , b , t } } ( w _ { t - 1 } ) } \end{array}$
|
| 201 |
+
4 $G _ { t } \gets \{ g _ { 1 , t } , \cdots , g _ { p , t } \} / /$ Parameter Server receives gradients from $p$ workers
|
| 202 |
+
5 $\hat { Y } _ { t } \gets \mathrm { I R L S } ( \hat { G } _ { t } )$ with $\hat { G } _ { t } = G _ { t } + \lambda \nabla \mathcal { R } ( Y ) \mathbf { 1 } ^ { T } / /$ Do IRLS at the Parameter Server for $\hat { Y }$
|
| 203 |
+
6 Obtain gradient direction $d _ { t }$ : $d _ { t } = \frac { 1 } { p } \hat { Y } _ { t } \hat { Y } _ { t } ^ { T } G _ { t } { \bf 1 } / /$ Compute, Send $d _ { t }$ to all $p$ machines
|
| 204 |
+
7 for ${ \mathfrak { p } } = 1$ to p in parallel on machine $\mathfrak { p }$ do
|
| 205 |
+
8 update model: $w _ { t } w _ { t - 1 } - \alpha _ { t } \cdot d _ { t }$
|
| 206 |
+
|
| 207 |
+
9 Return $w _ { T }$
|
| 208 |
+
|
| 209 |
+
# 161 2.3 Flag Aggregator for Distributed Optimization
|
| 210 |
+
|
| 211 |
+
162 It is now easy to see that by choosing $a = 2$ , in equation (4), we obtain the negative loglikelihood
|
| 212 |
+
163 (ignoring constants) as $\textstyle \bigl ( \sum _ { i = 1 } ^ { p } \sqrt { 1 - g _ { i } ^ { T } Y Y ^ { T } g _ { i } } \bigr )$ showing that Flag Median can indeed be seen as
|
| 213 |
+
164 an Maximum Likelihood Estimator (MLE). In particular, Flag Median can be seen as an MLE of
|
| 214 |
+
165 Beta Distribution with parameters $\alpha = 1$ and $\beta = \textstyle { \frac { 1 } { 2 } }$ . Recent results suggest that in many cases, MLE
|
| 215 |
+
166 is ill-posed, and regularization is necessary, even when the likelihood distribution is Gaussian [37].
|
| 216 |
+
167 So, based on the Flag Median estimator for subspaces, we propose an optimization based subspace
|
| 217 |
+
168 estimator $Y ^ { * }$ for aggregation purposes. We formulate our Flag Aggregator (FA) objective function
|
| 218 |
+
169 with respect to $Y$ as a regularized sum of likelihood based (or data) terms in (4) using trace operators
|
| 219 |
+
170 $\operatorname { t r } ( \cdot )$ as the solution to the following constrained optimization problem:
|
| 220 |
+
|
| 221 |
+
$$
|
| 222 |
+
\operatorname* { m i n } _ { Y : Y ^ { T } Y = I } A ( Y ) : = \sum _ { i = 1 } ^ { p } \sqrt { \left( 1 - \frac { \mathrm { t r } \left( Y ^ { T } g _ { i } g _ { i } ^ { T } Y \right) } { \| g _ { i } \| _ { 2 } ^ { 2 } } \right) } + \lambda \mathcal { R } ( Y )
|
| 223 |
+
$$
|
| 224 |
+
|
| 225 |
+
171 where $\lambda > 0$ is a regularization hyperparameter. In our analysis, and implementation, we provide
|
| 226 |
+
172 support for two possible choices for $\mathcal { R } ( Y )$ :
|
| 227 |
+
|
| 228 |
+
(1) Mathematical norms: 173 $\mathcal { R } ( Y )$ can be a form of norm-based regularization other than $\| Y \| _ { \mathrm { F r o } } ^ { 2 }$ since 174 it is constant over the feasible set in (5). For example, it could be convex norm with efficient 175 subgradient oracle such as, i.e. element-wise: $\begin{array} { r } { \sum _ { i = 1 } ^ { n } { \stackrel { . } { \sum } } _ { j = 1 } ^ { m } \| Y _ { i j } \| _ { 1 } } \end{array}$ or $\textstyle \sum _ { i = 1 } ^ { m } \| Y _ { i , i } \| _ { 1 }$ ,
|
| 229 |
+
|
| 230 |
+
176 (2) Data-dependent norms: Following our subspace construction in Section 2.1, we may choose
|
| 231 |
+
177 $\begin{array} { r } { \mathcal { R } ( Y ) = \frac { 1 } { p - 1 } \sum _ { i , j = 1 , i \neq j } ^ { p } \sqrt { \left( 1 - \frac { \mathrm { t r } ( Y ^ { T } ( g _ { i } - g _ { j } ) ( g _ { i } - g _ { j } ) ^ { T } Y ) } { D _ { i j } ^ { 2 } } \right) } } \end{array}$ where $D _ { i j } ^ { 2 } = \| g _ { i } - g _ { j } \| _ { 2 } ^ { 2 }$ denotes the
|
| 232 |
+
178 distance between gradient vectors $g _ { i } , g _ { j }$ from workers $i , j$ . Intuitively, the pairwise terms in our
|
| 233 |
+
179 loss function (5) favors subspace $Y$ that also reconstructs the pairwise vectors $g _ { i } - g _ { j }$ that are close
|
| 234 |
+
180 to each other. So, by setting $\lambda = \Theta ( p )$ , that is, the pairwise terms dominate the objective function
|
| 235 |
+
181 in (5). Hence, $\lambda$ regularizes optimal solutions $Y ^ { * }$ of (5) to contain $g _ { i }$ ’s with low pairwise distance
|
| 236 |
+
182 in its span – similar in spirit to AggregaThor in [38].
|
| 237 |
+
183 Convergence of Flag Aggregator (FA) Algorithm 1. With these, we can state our main algorithmic
|
| 238 |
+
184 result showing that our FA (5) can be solved efficiently using standard convex optimization proof
|
| 239 |
+
185 techniques. In particular, in supplement, we present a smooth Semi-Definite Programming (SDP)
|
| 240 |
+
186 relaxation of FA in equation (5) using the Flag structure. This allows us to view the IRLS procedure
|
| 241 |
+
187 in 1 as solving the low rank parametrization of the smooth SDP relaxation, thus guaranteeing fast
|
| 242 |
+
188 convergence to second order optimal (local) solutions. Importantly, our SDP based proof works for
|
| 243 |
+
189 any degree of approximation of the constant $a$ in equation (4) and only relies on smoothness of the
|
| 244 |
+
190 loss function wrt $Y$ , although speed of convergence is reduced for higher values of $a \neq 2$ , see [39].
|
| 245 |
+
191 We leave determining the exact dependence of $a$ on rate of convergence for future work.
|
| 246 |
+
192 How is FA aggregator different from (Bulyan and Multi-Krum)? Bulyan is a strong Byzantine
|
| 247 |
+
193 resilient gradient aggregation rule for $p \geq 4 f + 3$ where $p$ is the total number of workers and $f$ is
|
| 248 |
+
194 the number of Byzantine workers. Bulyan is a two-stage algorithm. In the first stage, a gradient
|
| 249 |
+
195 aggregation rule $R$ like coordinate-wise median [40] or Krum [9] is recursively used to select
|
| 250 |
+
196 $\theta = p - 2 f$ gradients. The process uses $R$ to select gradient vector $g _ { i }$ which is closest to $R$ ’s output
|
| 251 |
+
197 (e.g. for Krum, this would be the gradient with the top score, and hence the exact output of $R$ ). The
|
| 252 |
+
198 chosen gradient is removed from the received set and added to the selection set $S$ repeatedly until
|
| 253 |
+
199 $| S | = \theta$ . The second stage produces the resulting gradient. If $\beta = \theta - 2 f$ , each coordinate would
|
| 254 |
+
200 be the average of $\beta$ -nearest to the median coordinate of the $\theta$ gradients in $S$ . In matrix terms, if we
|
| 255 |
+
201 consider $S \in \mathbb { R } ^ { p \times m }$ as a matrix with each column having one non-zero entry summing to 1, Bulyan
|
| 256 |
+
202 would return $\scriptstyle { \frac { 1 } { m } } \mathrm { R e L U } ( G S ) \mathbf { 1 } _ { m }$ , where $\mathbf { 1 } _ { m } \in \mathbb { R } ^ { m }$ is the vector of all ones, while FA would return
|
| 257 |
+
203 ${ \scriptstyle { \frac { 1 } { p } } } Y Y ^ { T } G \mathbf { 1 } _ { p }$ . Importantly, the gradient matrix is being right-multiplied in Bulyan, but left-multiplied
|
| 258 |
+
204 in FA, before getting averaged. While this may seem like a discrepancy, in supplement we show that
|
| 259 |
+
205 by observing the optimality conditions of (5) wrt $Y$ , we show that ${ \frac { 1 } { m } } { \dot { Y } } Y ^ { T } { \dot { G } }$ can be seen as a right
|
| 260 |
+
206 multiplication by a matrix parametrized by lagrangian multipliers associated with the orthogonality
|
| 261 |
+
207 constraints in (5). This means it should be possible to combine both approaches for faster aggregation.
|
| 262 |
+
|
| 263 |
+
# 208 3 Experiments
|
| 264 |
+
|
| 265 |
+
209 In this section, we conduct experiments to test our proposed FA in the context of distributed training
|
| 266 |
+
210 in two testbeds. First, to test the performance of our FA scheme solved using IRLS (Flag Mean) on
|
| 267 |
+
211 standard Byzantine benchmarks. Then, to evaluate the ability of existing state-of-the-art gradient
|
| 268 |
+
212 aggregators we augment data via two techniques that can be implemented with Sci-kit package.
|
| 269 |
+
213 Implementation Details. We implement FA in Pytorch [41], which is popular but does not support
|
| 270 |
+
214 Byzantine resilience natively. We adopt the parameter server architecture and employ Pytorch’s
|
| 271 |
+
215 distributed RPC framework with TensorPipe backend for machine-to-machine communication. We
|
| 272 |
+
216 extend Garfield’s Pytorch library [42] with FA and limit our IRLS convergence criteria to a small
|
| 273 |
+
217 error, $1 0 ^ { - 1 0 }$ , or 5 iterations of flag mean for SVD calculation. We set $m = \textstyle { \left\lceil { \frac { p + 1 } { 2 } } \right\rceil }$ .
|
| 274 |
+
|
| 275 |
+
# 3.1 Setup
|
| 276 |
+
|
| 277 |
+
Baselines: We compare FA to several existing aggregation rules: (1) coordinate-wise Trimmed Mean [40] (2) coordinate-wise Median [40] (3) mean-around-median (MeaMed) [43] (4) Phocas [44] (5) Multi-Krum [9] (6) Bulyan [45].
|
| 278 |
+
|
| 279 |
+
Accuracy: The fraction of correct predictions among all predictions, using the test dataset (top-1 cross-accuracy).
|
| 280 |
+
|
| 281 |
+
Testbed: We used 4 servers as our experimental platform. Each server has 2 Intel(R) Xeon(R) Gold 6240 18-core CPU $\textcircled { a } 2 . 6 0 \mathrm { G H z }$ with Hyper-Threading and 384GB of RAM. Servers have a Tesla V100 PCIe 32GB GPU and employ a Mellanox ConnectX-5 100Gbps NIC to connect to a switch. We use one of the servers as the parameter server and instantiate 15 workers on other servers, each hosting 5 worker nodes, unless specified differently in specific experiments. For the experiments designed to show scalability, we instantiate 60 workers.
|
| 282 |
+
|
| 283 |
+
Dataset and model: We focus on the image classification task since it is a widely used task for benchmarking in distributed training [46]. We train ResNet-18 [47] on CIFAR-10 [48] which has $6 0 , 0 0 0 3 2 \times 3 2$ color images in 10 classes. For the scalability experiment, we train a CNN with two convolutional layers followed by two fully connected layers on MNIST [49] which has $7 0 { , } 0 0 0 2 8 \times$ 28 grayscale images in 10 classes. We also run another set of experiments on Tiny ImageNet [50] in the supplement. We use SGD as the optimizer, and cross-entropy to measure loss. The batch size for each worker is 128 unless otherwise stated. Also, we use a learning decay strategy where we decrease the learning rate by a factor of 0.2 every 10 epochs.
|
| 284 |
+
|
| 285 |
+
Threat models: We evaluate FA under two classes of Byzantine workers. They can send uniformly random gradients that are representative of errors in the physical setting, or use non-linear augmented data described as below.
|
| 286 |
+
|
| 287 |
+
41 Evaluating resilience against nonlinear data augmentation: In order to induce Byzantine behavior
|
| 288 |
+
42 in our workers we utilize ODE solvers to approximately solve 2 non-linear processes, Lotka Volterra
|
| 289 |
+
243 [51] and Arnold’s Cat Map [52], as augmentation methods. Since the augmented samples are
|
| 290 |
+
244 deterministic, albeit nonlinear functions of training samples, the “noise” is dependent across samples.
|
| 291 |
+
|
| 292 |
+

|
| 293 |
+
Figure 4: Tolerance to the number of Byzantine workers for robust aggregators for batch size 128.
|
| 294 |
+
|
| 295 |
+
245 In Lotka Volterra, we use the following linear gradient transformation of 2D pixels:
|
| 296 |
+
|
| 297 |
+
$$
|
| 298 |
+
( x , y ) ( \alpha x - \beta x y , \delta x y - \gamma y ) ,
|
| 299 |
+
$$
|
| 300 |
+
|
| 301 |
+
where $\alpha , \beta , \gamma$ and $\delta$ are hyperparameters. We choose them to be ${ \frac { 2 } { 3 } } , \ { \frac { 4 } { 3 } }$ , $- 1$ and $- 1$ respectively.
|
| 302 |
+
|
| 303 |
+
247 Second, we use a nonsmooth transformation called Arnold’s Cat Map as a data augmentation scheme.
|
| 304 |
+
248 Once again, the map can be specified using a two-dimensional matrix as,
|
| 305 |
+
|
| 306 |
+
$$
|
| 307 |
+
( x , y ) \to \left( { \frac { 2 x + y } { N } } , { \frac { x + y } { N } } \right) \mod 1 ,
|
| 308 |
+
$$
|
| 309 |
+
|
| 310 |
+
249 where mod represents the modulus operation, $x$ and $y$ are the coordinates or pixels of images and $N$
|
| 311 |
+
250 is the height/width of images (assumed to be square). We also used a smooth approximation of the
|
| 312 |
+
251 Cat Map obtained by approximating the mod function as,
|
| 313 |
+
|
| 314 |
+
$$
|
| 315 |
+
( x , y ) \to { \frac { 1 } { n } } \left( { \frac { 2 x + y } { ( 1 + \exp ( - m \log ( \alpha _ { 1 } ) } } , { \frac { x + y } { ( 1 + \exp ( - m \log ( \alpha _ { 2 } ) } } \right) ,
|
| 316 |
+
$$
|
| 317 |
+
|
| 318 |
+
52 where $\textstyle \alpha _ { 1 } = { \frac { 2 x + y } { n } }$ , $\textstyle \alpha _ { 2 } = { \frac { x + y } { n } }$ , and $m$ is the degree of approximation, which we choose to be 0.95 in
|
| 319 |
+
253 our data augmentation experiments.
|
| 320 |
+
|
| 321 |
+
How to perform nonlinear data augmentation? In all three cases, we used SciPy’s [53] solve_ivp method to solve the differential equations, by using the LSODA solver. In addition to the setup described above, we also added a varying level of Gaussian noise to each of the training images. All the images in the training set are randomly chosen to be augmented with varying noise levels of the above mentioned augmentation schemes. We have provided the code that implements all our data augmentation schemes in the supplement zipped folder.
|
| 322 |
+
|
| 323 |
+
# 3.2 Results
|
| 324 |
+
|
| 325 |
+
Tolerance to the number of Byzantine workers: In this experiment, we show the effect of Byzantine behavior on the convergence of different gradient aggregation rules in comparison to FA. Byzantine workers send random gradients and we vary the number of them from 1 to 3. Figure 4 shows that for some rules, i.e. Trimmed Mean, the presence of even a single Byzantine worker has a catastrophic impact. For other rules, as the number of Byzantine workers increases, filtering out the outliers becomes more challenging because the amount of noise increases. Regardless, FA remains more robust compared to other approaches.
|
| 326 |
+
|
| 327 |
+
# 268 Marginal utility of larger batch sizes under a fixed noise level:
|
| 328 |
+
|
| 329 |
+
269 We empirically verified the batch size required to identify our optimal $Y ^ { * }$ - the FA matrix at each
|
| 330 |
+
270 iteration. In particular, we fixed the noise level to $f = 3$ Byzantine workers and varied batch sizes.
|
| 331 |
+
271 We show the results in Figure 5. Our results indicate that, in cases where a larger batch size is
|
| 332 |
+
272 a training requirement, FA achieves a significantly better accuracy compared to the existing
|
| 333 |
+
273 state of the art aggregators. This may be useful in some large scale vision applications, see [54, 55]
|
| 334 |
+
274 for more details. Empirically, we can already see that our spectral relaxation to identify gradient
|
| 335 |
+
275 subspace is effective in practice in all our experiments.
|
| 336 |
+
276 Tolerance to communication loss: To analyze the effect of unreliable communication channels
|
| 337 |
+
277 between the workers and the parameter server on convergence, we design an experiment where the
|
| 338 |
+
278 physical link between some of the workers and the parameter server randomly drops a percentage of
|
| 339 |
+
279 packets. Here, we set the loss rate of three links to $10 \%$ i.e., there are 3 Byzantine workers in our
|
| 340 |
+
280 setting. The loss is introduced using the netem queuing discipline in Linux designed to emulate the
|
| 341 |
+
281 properties of wide area networks [56]. The two main takeaways in Figure 6a are:
|
| 342 |
+
|
| 343 |
+

|
| 344 |
+
Figure 5: Marginal utility of larger batch sizes under a fixed noise level $f = 3$
|
| 345 |
+
|
| 346 |
+

|
| 347 |
+
Figure 6: We present results under two different gradient attacks. The attack in (a) corresponds to simply dropping $1 0 \%$ of gradients from $f$ workers. The attacks in (b)-(d) correspond to generic $f$ workers sending random gradient vectors, i.e. we simply fix noise level while adding more workers.
|
| 348 |
+
|
| 349 |
+
1. FA converges to a significantly higher accuracy than other aggregators, and thus is more robust to unreliable underlying network transports. 2. Considering time-to-accuracy for comparison, FA reaches a similar accuracy in less total number of training iterations, and thus is more robust to slow underlying network transports.
|
| 350 |
+
|
| 351 |
+
282 Analyzing the marginal utility of additional workers. To see the effect of adding more workers
|
| 352 |
+
283 to a fixed number of Byzantine workers, we ran experiments where we fixed $f$ , and increased $p$
|
| 353 |
+
284 Our experimental results shown in Figures 6b-6d indicate that our FA algorithm possesses strong
|
| 354 |
+
285 resilience property for reasonable choices of $p$ .
|
| 355 |
+
|
| 356 |
+
The effect of having augmented data during training in Byzantine workers: Figure 7 shows FA can handle nonlinear data augmentation in a much more stable fashion. Please see supplement for details on the level of noise, and exact solver settings that were used to obtain augmented images.
|
| 357 |
+
|
| 358 |
+
The effect of the regularization parameter in FA: The data-dependent regularization parameter $\lambda$ in FA provides flexibility in the loss function to cover aggregators that benefit from pairwise distances such as Bulyan and Multi-Krum. To verify whether varying $\lambda$ can interpolate Bulyan and Multi-Krum, we change $\lambda$ in Figure 8. We can see when FA improves or performs similarly for a range of $\lambda$ . Here, we set $p$ and $f$ to satisfy the strong Byzantine resilience condition of Bulyan, i.e, $p \geq 4 f + 3$ .
|
| 359 |
+
|
| 360 |
+
Scaling out to real-world situations with more workers: In distributed ML, $p$ and $f$ are usually large. To test high-dimensional settings commonly dealt in Semantic Vision with our FA, we used ResNet-18. Now, to specifically test the scalability of FA, we fully utilized our available GPU servers and set up to $p = 6 0$ workers (up to $f = 1 4$ Byzantine) with the MNIST dataset and a simple CNN with two convolutional layers followed by two fully connected layers (useful for simple detection). Figure 9 shows evidence that FA is feasible for larger setups.
|
| 361 |
+
|
| 362 |
+

|
| 363 |
+
Figure 7: Accuracy of us- Figure 8: CIFAR10 with Figure 9: Scaling FA to ing augmented data in $f =$ ResNet-18, $p \ = \ 7$ , and larger setups 3 workers
|
| 364 |
+
|
| 365 |
+

|
| 366 |
+
Figure 10: Wall clock time comparison
|
| 367 |
+
|
| 368 |
+
# 300 4 Discussion and Limitation
|
| 369 |
+
|
| 370 |
+
Is it possible to fully “offload” FA computation to switches? Recent work propose that aggregation be performed entirely on network infrastructure to alleviate any communication bottleneck that may arise [57, 58]. However, to the best of our knowledge, switches that are in use today only allow limited computation to be performed on gradient $g _ { i }$ as packets whenever they are transmitted [59, 60]. That is, programmability is restrictive at the moment— switches used in practice have no floating point, or loop support, and are severely memory/state constrained. Fortunately, solutions seem near. For instance, [61] have already introduced support for floating point arithmetic in programmable switches. We may use quantization approaches for SVD calculation with some accuracy loss [62] to approximate floating point arithmetic. Offloading FA to switches has great potential in improving its computational complexity because the switch would perform as a high-throughput streaming parameter server to synchronize gradients over the network. Considering that FA’s accuracy currently outperforms its competition in several experiments, an offloaded FA can reach their accuracy even faster or it could reach a higher accuracy in the same amount of time.
|
| 371 |
+
|
| 372 |
+
314 Potential Limitation. Because in every iteration of FA, we perform SVD, the complexity of the
|
| 373 |
+
315 algorithm would be $\begin{array} { r } { O ( n N _ { \delta } ( \sum _ { i = 1 } ^ { p } k _ { i } ) ^ { 2 } ) } \end{array}$ with $N _ { \delta }$ being the number of iterations for the algorithm.
|
| 374 |
+
316 Figure 10 show the wall clock time it takes for FA to reach a certain accuracy (10a) or epoch(10b)
|
| 375 |
+
317 compared to other methods under a fixed amount of random noise $f = 3$ with $p = 1 5$ workers.
|
| 376 |
+
318 Although the iteration complexity of FA is higher, here each iteration has a higher utility as reflected in
|
| 377 |
+
319 the time-to-accuracy measures. This makes FA comparable to others in a shorter time span, however,
|
| 378 |
+
320 if there is more wall clock time to spare, FA converges to a better state as shown in Figure 10c where
|
| 379 |
+
321 we let the same number of total iterations finish for all methods.
|
| 380 |
+
|
| 381 |
+
# 5 Conclusion
|
| 382 |
+
|
| 383 |
+
In this paper we proposed Flag Aggregator (FA) that can be used for robust aggregation of gradients in distributed training. FA is an optimization-based subspace estimator that formulates aggregation as a Maximum Likelihood Estimation procedure using Beta densities. We perform extensive evaluations of FA and show it can be effectively used in providing Byzantine resilience for gradient aggregation. Using techniques from convex optimization, we theoretically analyze FA and with tractable relaxations show its amenability to be solved by off-the-shelf solvers or first-order reweighing methods.
|
| 384 |
+
|
| 385 |
+
329 References [1] Michel Grabisch, Jean-Luc Marichal, Radko Mesiar, and Endre Pap. Aggregation functions, volume 127. Cambridge University Press, 2009. [2] Sivaraman Balakrishnan, Simon S. Du, Jerry Li, and Aarti Singh. Computationally efficient robust sparse estimation in high dimensions. In Satyen Kale and Ohad Shamir, editors, Proceedings of the 2017 Conference on Learning Theory, volume 65 of Proceedings of Machine Learning Research, pages 169–212. PMLR, 07–10 Jul 2017. URL https: //proceedings.mlr.press/v65/balakrishnan17a.html. [3] Ilias Diakonikolas, Daniel Kane, Sushrut Karmalkar, Eric Price, and Alistair Stewart. Outlierrobust high-dimensional sparse estimation via iterative filtering. Advances in Neural Information Processing Systems, 32, 2019. [4] Yu Cheng, Ilias Diakonikolas, Rong Ge, Shivam Gupta, Daniel M. Kane, and Mahdi Soltanolkotabi. Outlier-robust sparse estimation via non-convex optimization. Advances in Neural Information Processing Systems, 2022. [5] Ilias Diakonikolas, Daniel M. Kane, Sushrut Karmalkar, Ankit Pensia, and Thanasis Pittas. Robust sparse mean estimation via sum of squares. In Po-Ling Loh and Maxim Raginsky, editors, Proceedings of Thirty Fifth Conference on Learning Theory, volume 178 of Proceedings of Machine Learning Research, pages 4703–4763. PMLR, 02–05 Jul 2022. URL https: //proceedings.mlr.press/v178/diakonikolas22e.html. [6] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 115(3):211–252, 2015. doi: 10.1007/s11263-015-0816-y. [7] Konstantinos I Tsianos and Michael G Rabbat. Distributed strongly convex optimization. In 2012 50th Annual Allerton Conference on Communication, Control, and Computing (Allerton), pages 593–600. IEEE, 2012. [8] Tao Yang, Xinlei Yi, Junfeng Wu, Ye Yuan, Di Wu, Ziyang Meng, Yiguang Hong, Hong Wang, Zongli Lin, and Karl H Johansson. A survey of distributed optimization. Annual Reviews in Control, 47:278–305, 2019. [9] Peva Blanchard, El Mahdi El Mhamdi, Rachid Guerraoui, and Julien Stainer. Machine learning with adversaries: Byzantine tolerant gradient descent. In Proceedings of the 31st International Conference on Neural Information Processing Systems, NIPS’17, page 118–128. Curran Associates Inc., 2017. ISBN 9781510860964. [10] Sadegh Farhadkhani, Rachid Guerraoui, Nirupam Gupta, Rafael Pinot, and John Stephan. Byzantine machine learning made easy by resilient averaging of momentums. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvari, Gang Niu, and Sivan Sabato, editors, Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pages 6246–6283. PMLR, 17–23 Jul 2022. URL https://proceedings.mlr.press/v162/farhadkhani22a.html. [11] Leonardo Bautista-Gomez, Ferad Zyulkyarov, Osman Unsal, and Simon McIntosh-Smith. Unprotected computing: A large-scale study of dram raw error rate on a supercomputer. In $S C$ ’16: Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, pages 645–655, 2016. doi: 10.1109/SC.2016.54. [12] Bianca Schroeder and Garth A. Gibson. Disk failures in the real world: What does an mttf of 1,000,000 hours mean to you? In Proceedings of the 5th USENIX Conference on File and Storage Technologies, FAST ’07, page 1–es, USA, 2007. USENIX Association. [13] Phillipa Gill, Navendu Jain, and Nachiappan Nagappan. Understanding network failures in data centers: Measurement, analysis, and implications. SIGCOMM Comput. Commun. Rev., 41(4):350–361, aug 2011. ISSN 0146-4833. doi: 10.1145/2043164.2018477. URL https://doi.org/10.1145/2043164.2018477.
|
| 386 |
+
|
| 387 |
+
379 [14] Gilad Baruch, Moran Baruch, and Yoav Goldberg. A little is enough: Circumventing defenses for distributed learning. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/ file/ec1c59141046cd1866bbbcdfb6ae31d4-Paper.pdf. [15] Guosai Wang, Lifei Zhang, and Wei Xu. What can we learn from four years of data center hardware failures? In 2017 47th Annual IEEE/IFIP International Conference on Dependable Systems and Networks (DSN), pages 25–36, 2017. doi: 10.1109/DSN.2017.26. [16] Devesh Tiwari, Saurabh Gupta, James Rogers, Don Maxwell, Paolo Rech, Sudharshan Vazhkudai, Daniel Oliveira, Dave Londo, Nathan DeBardeleben, Philippe Navaux, Luigi Carro, and Arthur Bland. Understanding gpu errors on large-scale hpc systems and the implications for system design and operation. In 2015 IEEE 21st International Symposium on High Performance Computer Architecture (HPCA), pages 331–342, 2015. doi: 10.1109/HPCA.2015.7056044. [17] Bin Nie, Devesh Tiwari, Saurabh Gupta, Evgenia Smirni, and James H. Rogers. A large-scale study of soft-errors on gpus in the field. In 2016 IEEE International Symposium on High Performance Computer Architecture (HPCA), pages 519–530, 2016. doi: 10.1109/HPCA.2016. 7446091. [18] Sheldon M Ross. Introduction to probability models. Academic press, 2014. [19] Fanny Yang, Zuowen Wang, and Christina Heinze-Deml. Invariance-inducing regularization using worst-case transformations suffices to boost accuracy and spatial robustness. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/file/ 1d01bd2e16f57892f0954902899f0692-Paper.pdf. [20] Christina Heinze-Deml and Nicolai Meinshausen. Conditional variance penalties and domain shift robustness, 2017. URL https://arxiv.org/abs/1710.11469. [21] Saeid Motiian, Marco Piccirilli, Donald A. Adjeroh, and Gianfranco Doretto. Unified deep supervised domain adaptation and generalization. In IEEE International Conference on Computer Vision (ICCV), 2017. [22] Sravanti Addepalli, Samyak Jain, et al. Efficient and effective augmentation strategy for adversarial training. Advances in Neural Information Processing Systems, 35:1488–1501, 2022. [23] Eric Wong, Leslie Rice, and J Zico Kolter. Fast is better than free: Revisiting adversarial training. arXiv preprint arXiv:2001.03994, 2020. [24] Jeremy Cohen, Elan Rosenfeld, and Zico Kolter. Certified adversarial robustness via randomized smoothing. In international conference on machine learning, pages 1310–1320. PMLR, 2019. [25] Youssef Allouah, Rachid Guerraoui, Nirupam Gupta, Rafael Pinot, and John Stephan. Distributed learning with curious and adversarial machines. arXiv preprint arXiv:2302.04787, 2023. [26] Youssef Allouah, Sadegh Farhadkhani, Rachid Guerraoui, Nirupam Gupta, Rafaël Pinot, and John Stephan. Fixing by mixing: A recipe for optimal byzantine ml under heterogeneity. In International Conference on Artificial Intelligence and Statistics, pages 1232–1300. PMLR, 2023. [27] Sadegh Farhadkhani, Rachid Guerraoui, Nirupam Gupta, Rafael Pinot, and John Stephan. Byzantine machine learning made easy by resilient averaging of momentums. In International Conference on Machine Learning, pages 6246–6283. PMLR, 2022.
|
| 388 |
+
24 [28] P-A Absil. Optimization algorithms on matrix manifolds. Princeton University Press, 2008.
|
| 389 |
+
25 [29] John Wright, Arvind Ganesh, Shankar Rao, Yigang Peng, and Yi Ma. Robust principal component analysis: Exact recovery of corrupted low-rank matrices via convex optimization. Advances in neural information processing systems, 22, 2009.
|
| 390 |
+
8 [30] Matthias Hein and Thomas Bühler. An inverse power method for nonlinear eigenproblems with applications in 1-spectral clustering and sparse pca. Advances in neural information processing systems, 23, 2010. [31] Rudrasis Chakraborty, Soren Hauberg, and Baba C Vemuri. Intrinsic grassmann averages for online linear and robust subspace learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 6196–6204, 2017. [32] D. Monk. The geometry of flag manifolds. Proceedings of the London Mathematical Society, s3-9(2):253–286, 1959. doi: https://doi.org/10.1112/plms/s3-9.2.253. URL https: //londmathsoc.onlinelibrary.wiley.com/doi/abs/10.1112/plms/s3-9.2.253. [33] Ke Ye, Ken Sze-Wai Wong, and Lek-Heng Lim. Optimization on flag manifolds. Mathematical Programming, 194(1-2):621–660, 2022. [34] Nathan Mankovich, Emily J King, Chris Peterson, and Michael Kirby. The flag median and flagirls. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10339–10347, 2022.
|
| 391 |
+
2 [35] Kevin P Murphy. Probabilistic machine learning: an introduction. MIT press, 2022.
|
| 392 |
+
3 [36] Massimo Fornasier, Holger Rauhut, and Rachel Ward. Low-rank matrix recovery via iteratively reweighted least squares minimization. SIAM Journal on Optimization, 21(4):1614–1640, 2011. [37] Toni Karvonen and Chris J Oates. Maximum likelihood estimation in gaussian process regression is ill-posed. Journal of Machine Learning Research, 24(120):1–47, 2023. [38] Georgios Damaskinos, El-Mahdi El-Mhamdi, Rachid Guerraoui, Arsany Guirguis, and Sébastien Rouault. Aggregathor: Byzantine machine learning via robust gradient aggregation. Proceedings of Machine Learning and Systems, 1:81–106, 2019. [39] Yuxin Chen, Yuejie Chi, Jianqing Fan, Cong Ma, and Yuling Yan. Noisy matrix completion: Understanding statistical guarantees for convex relaxation via nonconvex optimization. SIAM journal on optimization, 30(4):3098–3121, 2020. [40] Dong Yin, Yudong Chen, Ramchandran Kannan, and Peter Bartlett. Byzantine-robust distributed learning: Towards optimal statistical rates. In Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pages 5650– 5659. PMLR, 10–15 Jul 2018. [41] 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, 2019. [42] Rachid Guerraoui, Arsany Guirguis, Jérémy Plassmann, Anton Ragot, and Sébastien Rouault. Garfield: System support for byzantine machine learning (regular paper). In 2021 51st Annual IEEE/IFIP International Conference on Dependable Systems and Networks (DSN), pages 39–51, 2021. doi: 10.1109/DSN48987.2021.00021. [43] Cong Xie, Oluwasanmi Koyejo, and Indranil Gupta. Generalized byzantine-tolerant sgd, 2018.
|
| 393 |
+
[44] Cong Xie, Oluwasanmi Koyejo, and Indranil Gupta. Phocas: dimensional byzantine-resilient stochastic gradient descent, 2018.
|
| 394 |
+
[45] El Mahdi El Mhamdi, Rachid Guerraoui, and Sébastien Rouault. The hidden vulnerability of distributed learning in Byzantium. In Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pages 3521–3530. PMLR, 10–15 Jul 2018.
|
| 395 |
+
474 [46] Trishul Chilimbi, Yutaka Suzue, Johnson Apacible, and Karthik Kalyanaraman. Project adam: Building an efficient and scalable deep learning training system. In Proceedings of the 11th USENIX Conference on Operating Systems Design and Implementation, OSDI’14, page 571–582, USA, 2014.
|
| 396 |
+
478 [47] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 770–778, 2016. doi: 10.1109/CVPR.2016.90.
|
| 397 |
+
481 [48] Alex Krizhevsky. Learning multiple layers of features from tiny images, 2009. URL https: //www.cs.toronto.edu/\~kriz/learning-features-2009-TR.pdf.
|
| 398 |
+
483 [49] Yann LeCun and Corinna Cortes. MNIST handwritten digit database, 2010. URL http: //yann.lecun.com/exdb/mnist/.
|
| 399 |
+
485 [50] Ya Le and Xuan S. Yang. Tiny imagenet visual recognition challenge, 2015.
|
| 400 |
+
486 [51] David Kelly. Rough path recursions and diffusion approximations. The Annals of Applied Probability, 26(1):425–461, 2016.
|
| 401 |
+
488 [52] Jianghong Bao and Qigui Yang. Period of the discrete arnold cat map and general cat map. Nonlinear Dynamics, 70(2):1365–1375, 2012.
|
| 402 |
+
490 [53] Fundamental algorithms for scientific computing in python. https://scipy.org/, 2023.
|
| 403 |
+
491 [54] Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter Tang. On large-batch training for deep learning: Generalization gap and sharp minima. In International Conference on Learning Representations, 2017. URL https://openreview. net/forum?id $\bar { }$ H1oyRlYgg. [55] Yang You, Jonathan Hseu, Chris Ying, James Demmel, Kurt Keutzer, and Cho-Jui Hsieh. Large-batch training for lstm and beyond. In Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, SC ’19, 2019.
|
| 404 |
+
498 [56] Kevin Hsieh, Aaron Harlap, Nandita Vijaykumar, Dimitris Konomis, Gregory R. Ganger, Phillip B. Gibbons, and Onur Mutlu. Gaia: Geo-distributed machine learning approaching lan speeds. In Proceedings of the 14th USENIX Conference on Networked Systems Design and Implementation, page 629–647, 2017.
|
| 405 |
+
502 [57] Amedeo Sapio, Marco Canini, Chen-Yu Ho, Jacob Nelson, Panos Kalnis, Changhoon Kim, Arvind Krishnamurthy, Masoud Moshref, Dan Ports, and Peter Richtárik. Scaling distributed machine learning with {In-Network} aggregation. In 18th USENIX Symposium on Networked Systems Design and Implementation (NSDI 21), pages 785–808, 2021. [58] ChonLam Lao, Yanfang Le, Kshiteej Mahajan, Yixi Chen, Wenfei Wu, Aditya Akella, and Michael Swift. $\{ \mathrm { A T P } \}$ : In-network aggregation for multi-tenant learning. In 18th USENIX Symposium on Networked Systems Design and Implementation (NSDI 21), pages 741–761, 2021. [59] Pat Bosshart, Glen Gibb, Hun-Seok Kim, George Varghese, Nick McKeown, Martin Izzard, Fernando Mujica, and Mark Horowitz. Forwarding metamorphosis: Fast programmable matchaction processing in hardware for sdn. In Proceedings of the ACM SIGCOMM 2013 Conference on SIGCOMM, SIGCOMM ’13, page 99–110, New York, NY, USA, 2013. Association for Computing Machinery. ISBN 9781450320566. doi: 10.1145/2486001.2486011. URL https: //doi.org/10.1145/2486001.2486011.
|
| 406 |
+
516 [60] N McKeown. Pisa: Protocol independent switch architecture. In P4 Workshop, 2015.
|
| 407 |
+
517 [61] Yifan Yuan, Omar Alama, Jiawei Fei, Jacob Nelson, Dan RK Ports, Amedeo Sapio, Marco Canini, and Nam Sung Kim. Unlocking the power of inline {Floating-Point} operations on programmable switches. In 19th USENIX Symposium on Networked Systems Design and Implementation (NSDI 22), pages 683–700, 2022.
|