ZHANGYUXUAN-zR commited on
Commit
87065e3
·
verified ·
1 Parent(s): aac2d0f

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +30 -0
  2. parse/dev/-70L8lpp9DF/-70L8lpp9DF.md +0 -0
  3. parse/dev/-70L8lpp9DF/-70L8lpp9DF_content_list.json +0 -0
  4. parse/dev/-70L8lpp9DF/-70L8lpp9DF_middle.json +0 -0
  5. parse/dev/-70L8lpp9DF/-70L8lpp9DF_model.json +0 -0
  6. parse/dev/0gouO5saq6K/0gouO5saq6K.md +324 -0
  7. parse/dev/0gouO5saq6K/0gouO5saq6K_content_list.json +1345 -0
  8. parse/dev/0gouO5saq6K/0gouO5saq6K_middle.json +0 -0
  9. parse/dev/0gouO5saq6K/0gouO5saq6K_model.json +0 -0
  10. parse/dev/2EufPS5ABlJ/2EufPS5ABlJ.md +0 -0
  11. parse/dev/2EufPS5ABlJ/2EufPS5ABlJ_content_list.json +0 -0
  12. parse/dev/2EufPS5ABlJ/2EufPS5ABlJ_middle.json +0 -0
  13. parse/dev/2EufPS5ABlJ/2EufPS5ABlJ_model.json +0 -0
  14. parse/dev/3RBY8fKjHeu/3RBY8fKjHeu_content_list.json +995 -0
  15. parse/dev/3RBY8fKjHeu/3RBY8fKjHeu_model.json +0 -0
  16. parse/dev/3mRwyG5one/3mRwyG5one.md +387 -0
  17. parse/dev/3mRwyG5one/3mRwyG5one_content_list.json +0 -0
  18. parse/dev/3mRwyG5one/3mRwyG5one_middle.json +0 -0
  19. parse/dev/3mRwyG5one/3mRwyG5one_model.json +0 -0
  20. parse/dev/45L_dgP48Vd/45L_dgP48Vd_middle.json +0 -0
  21. parse/dev/4oXTQ6m_ws8/4oXTQ6m_ws8.md +363 -0
  22. parse/dev/4oXTQ6m_ws8/4oXTQ6m_ws8_content_list.json +0 -0
  23. parse/dev/4oXTQ6m_ws8/4oXTQ6m_ws8_middle.json +0 -0
  24. parse/dev/4oXTQ6m_ws8/4oXTQ6m_ws8_model.json +0 -0
  25. parse/dev/5JdLZg346Lw/5JdLZg346Lw.md +681 -0
  26. parse/dev/5JdLZg346Lw/5JdLZg346Lw_content_list.json +0 -0
  27. parse/dev/5JdLZg346Lw/5JdLZg346Lw_middle.json +0 -0
  28. parse/dev/5JdLZg346Lw/5JdLZg346Lw_model.json +0 -0
  29. parse/dev/83LJRUzXWj/83LJRUzXWj_content_list.json +0 -0
  30. parse/dev/83LJRUzXWj/83LJRUzXWj_model.json +0 -0
  31. parse/dev/8qWazUd8Jm/8qWazUd8Jm.md +452 -0
  32. parse/dev/8qWazUd8Jm/8qWazUd8Jm_content_list.json +0 -0
  33. parse/dev/8qWazUd8Jm/8qWazUd8Jm_middle.json +0 -0
  34. parse/dev/8qWazUd8Jm/8qWazUd8Jm_model.json +0 -0
  35. parse/dev/B4tkwuzeiY/B4tkwuzeiY.md +520 -0
  36. parse/dev/Bl8CQrx2Up4/Bl8CQrx2Up4.md +393 -0
  37. parse/dev/Bl8CQrx2Up4/Bl8CQrx2Up4_content_list.json +0 -0
  38. parse/dev/Bq2-WN5csW/Bq2-WN5csW.md +423 -0
  39. parse/dev/Bq2-WN5csW/Bq2-WN5csW_content_list.json +1140 -0
  40. parse/dev/Bq2-WN5csW/Bq2-WN5csW_middle.json +0 -0
  41. parse/dev/Bq2-WN5csW/Bq2-WN5csW_model.json +0 -0
  42. parse/dev/CbsJ53LdKc/CbsJ53LdKc.md +281 -0
  43. parse/dev/CbsJ53LdKc/CbsJ53LdKc_content_list.json +1144 -0
  44. parse/dev/CbsJ53LdKc/CbsJ53LdKc_middle.json +0 -0
  45. parse/dev/CbsJ53LdKc/CbsJ53LdKc_model.json +0 -0
  46. parse/dev/CuV_qYkmKb3/CuV_qYkmKb3.md +0 -0
  47. parse/dev/CuV_qYkmKb3/CuV_qYkmKb3_content_list.json +0 -0
  48. parse/dev/CuV_qYkmKb3/CuV_qYkmKb3_middle.json +0 -0
  49. parse/dev/CuV_qYkmKb3/CuV_qYkmKb3_model.json +0 -0
  50. parse/dev/CzceR82CYc/CzceR82CYc_content_list.json +0 -0
.gitattributes CHANGED
@@ -16279,3 +16279,33 @@ parse/train/BJlBSkHtDS/BJlBSkHtDS_layout.pdf filter=lfs diff=lfs merge=lfs -text
16279
  parse/train/BJlBSkHtDS/BJlBSkHtDS_span.pdf filter=lfs diff=lfs merge=lfs -text
16280
  parse/train/BJlBSkHtDS/BJlBSkHtDS_origin.pdf filter=lfs diff=lfs merge=lfs -text
16281
  parse/train/IOqr2ZyXHz1/IOqr2ZyXHz1_span.pdf filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16279
  parse/train/BJlBSkHtDS/BJlBSkHtDS_span.pdf filter=lfs diff=lfs merge=lfs -text
16280
  parse/train/BJlBSkHtDS/BJlBSkHtDS_origin.pdf filter=lfs diff=lfs merge=lfs -text
16281
  parse/train/IOqr2ZyXHz1/IOqr2ZyXHz1_span.pdf filter=lfs diff=lfs merge=lfs -text
16282
+ parse/train/IOqr2ZyXHz1/IOqr2ZyXHz1_origin.pdf filter=lfs diff=lfs merge=lfs -text
16283
+ parse/train/IOqr2ZyXHz1/IOqr2ZyXHz1_layout.pdf filter=lfs diff=lfs merge=lfs -text
16284
+ parse/train/BJgklhAcK7/BJgklhAcK7_layout.pdf filter=lfs diff=lfs merge=lfs -text
16285
+ parse/train/BJgklhAcK7/BJgklhAcK7_origin.pdf filter=lfs diff=lfs merge=lfs -text
16286
+ parse/train/BJgklhAcK7/BJgklhAcK7_span.pdf filter=lfs diff=lfs merge=lfs -text
16287
+ parse/train/QWIvzSQaX5/QWIvzSQaX5_origin.pdf filter=lfs diff=lfs merge=lfs -text
16288
+ parse/train/Skgy464Kvr/Skgy464Kvr_origin.pdf filter=lfs diff=lfs merge=lfs -text
16289
+ parse/train/Skgy464Kvr/Skgy464Kvr_layout.pdf filter=lfs diff=lfs merge=lfs -text
16290
+ parse/train/Skgy464Kvr/Skgy464Kvr_span.pdf filter=lfs diff=lfs merge=lfs -text
16291
+ parse/train/EMHoBG0avc1/EMHoBG0avc1_span.pdf filter=lfs diff=lfs merge=lfs -text
16292
+ parse/train/EMHoBG0avc1/EMHoBG0avc1_origin.pdf filter=lfs diff=lfs merge=lfs -text
16293
+ parse/train/EMHoBG0avc1/EMHoBG0avc1_layout.pdf filter=lfs diff=lfs merge=lfs -text
16294
+ parse/train/SyxCqGbRZ/SyxCqGbRZ_span.pdf filter=lfs diff=lfs merge=lfs -text
16295
+ parse/train/SyxCqGbRZ/SyxCqGbRZ_origin.pdf filter=lfs diff=lfs merge=lfs -text
16296
+ parse/train/SyxCqGbRZ/SyxCqGbRZ_layout.pdf filter=lfs diff=lfs merge=lfs -text
16297
+ parse/train/ak06J5jNR4/ak06J5jNR4_origin.pdf filter=lfs diff=lfs merge=lfs -text
16298
+ parse/train/ak06J5jNR4/ak06J5jNR4_layout.pdf filter=lfs diff=lfs merge=lfs -text
16299
+ parse/train/ak06J5jNR4/ak06J5jNR4_span.pdf filter=lfs diff=lfs merge=lfs -text
16300
+ parse/train/rJUYGxbCW/rJUYGxbCW_span.pdf filter=lfs diff=lfs merge=lfs -text
16301
+ parse/train/rJUYGxbCW/rJUYGxbCW_origin.pdf filter=lfs diff=lfs merge=lfs -text
16302
+ parse/train/rJUYGxbCW/rJUYGxbCW_layout.pdf filter=lfs diff=lfs merge=lfs -text
16303
+ parse/train/SyjjD1WRb/SyjjD1WRb_layout.pdf filter=lfs diff=lfs merge=lfs -text
16304
+ parse/train/SyjjD1WRb/SyjjD1WRb_span.pdf filter=lfs diff=lfs merge=lfs -text
16305
+ parse/train/SyjjD1WRb/SyjjD1WRb_origin.pdf filter=lfs diff=lfs merge=lfs -text
16306
+ parse/train/rJgMlhRctm/rJgMlhRctm_origin.pdf filter=lfs diff=lfs merge=lfs -text
16307
+ parse/train/rJgMlhRctm/rJgMlhRctm_layout.pdf filter=lfs diff=lfs merge=lfs -text
16308
+ parse/train/rJgMlhRctm/rJgMlhRctm_span.pdf filter=lfs diff=lfs merge=lfs -text
16309
+ parse/train/SygONjRqKm/SygONjRqKm_layout.pdf filter=lfs diff=lfs merge=lfs -text
16310
+ parse/train/SygONjRqKm/SygONjRqKm_span.pdf filter=lfs diff=lfs merge=lfs -text
16311
+ parse/train/SygONjRqKm/SygONjRqKm_origin.pdf filter=lfs diff=lfs merge=lfs -text
parse/dev/-70L8lpp9DF/-70L8lpp9DF.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/-70L8lpp9DF/-70L8lpp9DF_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/-70L8lpp9DF/-70L8lpp9DF_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/-70L8lpp9DF/-70L8lpp9DF_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/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
+ ![](images/d4902c2fa4802fa58587f8fd9eb9ac51f6a1cadded1853aa04414ec7e5d40d9c.jpg)
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
+ ![](images/859fd1e48bffed07eace755fe2651e3b53451866eb9af087b83af8821ec21d62.jpg)
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
+ ![](images/59cf36da87bbfa95815ac554a9c04cd09962815a6dc82b5a4da632ac733bf60b.jpg)
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
+ ![](images/2f572e1921eab720c534e59f8a71678e6f42ac165680d516909beb9fb93535b7.jpg)
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
+ ![](images/e46e0219b3208000eeaf756c5c28b6e400f45e9cea6d8e8bf66529595adb08a8.jpg)
144
+
145
+ ![](images/856d3573874fc9658c6d11072bd29711ec7d2381d27d5c7b8f8ecd81467d579e.jpg)
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
+ ![](images/8feed4f8dab2d4154b17ad0ad18ddbe062a713669275d49fe5827cc63646fd4a.jpg)
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
+ ![](images/e4d7242c79f518d76828f0cc47c08ed6745a8cbb3945686538d16f2332e1bf3b.jpg)
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
+ ![](images/85c346ce0d2068a080918d00dd8d90e9c12adfe4904e722d05fd2641d6b49496.jpg)
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
+ ![](images/17c55a7243c390f84dfc606f91fe6c5aab9df04a0808a25838884f8a9c3ee1f5.jpg)
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]
parse/dev/0gouO5saq6K/0gouO5saq6K_content_list.json ADDED
@@ -0,0 +1,1345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Multi-Game Decision Transformers ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 281,
8
+ 122,
9
+ 717,
10
+ 147
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Kuang-Huei Lee∗ Ofir Nachum∗ Mengjiao Yang Lisa Lee ",
17
+ "bbox": [
18
+ 246,
19
+ 195,
20
+ 748,
21
+ 212
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "Daniel Freeman Winnie Xu Sergio Guadarrama Ian Fischer ",
28
+ "text_level": 1,
29
+ "bbox": [
30
+ 235,
31
+ 231,
32
+ 759,
33
+ 247
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "Eric Jang Henryk Michalewski Igor Mordatch∗ ",
40
+ "bbox": [
41
+ 297,
42
+ 267,
43
+ 696,
44
+ 282
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "Google Research ",
51
+ "bbox": [
52
+ 442,
53
+ 296,
54
+ 555,
55
+ 309
56
+ ],
57
+ "page_idx": 0
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "Abstract ",
62
+ "text_level": 1,
63
+ "bbox": [
64
+ 462,
65
+ 345,
66
+ 535,
67
+ 362
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "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 ",
74
+ "bbox": [
75
+ 233,
76
+ 380,
77
+ 767,
78
+ 574
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "1 Introduction ",
85
+ "text_level": 1,
86
+ "bbox": [
87
+ 174,
88
+ 604,
89
+ 310,
90
+ 622
91
+ ],
92
+ "page_idx": 0
93
+ },
94
+ {
95
+ "type": "text",
96
+ "text": "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. ",
97
+ "bbox": [
98
+ 174,
99
+ 638,
100
+ 825,
101
+ 763
102
+ ],
103
+ "page_idx": 0
104
+ },
105
+ {
106
+ "type": "text",
107
+ "text": "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. ",
108
+ "bbox": [
109
+ 174,
110
+ 770,
111
+ 825,
112
+ 853
113
+ ],
114
+ "page_idx": 0
115
+ },
116
+ {
117
+ "type": "image",
118
+ "img_path": "images/d4902c2fa4802fa58587f8fd9eb9ac51f6a1cadded1853aa04414ec7e5d40d9c.jpg",
119
+ "image_caption": [
120
+ "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. "
121
+ ],
122
+ "image_footnote": [],
123
+ "bbox": [
124
+ 181,
125
+ 93,
126
+ 818,
127
+ 222
128
+ ],
129
+ "page_idx": 1
130
+ },
131
+ {
132
+ "type": "text",
133
+ "text": "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. ",
134
+ "bbox": [
135
+ 173,
136
+ 327,
137
+ 825,
138
+ 439
139
+ ],
140
+ "page_idx": 1
141
+ },
142
+ {
143
+ "type": "text",
144
+ "text": "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). ",
145
+ "bbox": [
146
+ 174,
147
+ 445,
148
+ 825,
149
+ 515
150
+ ],
151
+ "page_idx": 1
152
+ },
153
+ {
154
+ "type": "text",
155
+ "text": "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. ",
156
+ "bbox": [
157
+ 173,
158
+ 520,
159
+ 825,
160
+ 632
161
+ ],
162
+ "page_idx": 1
163
+ },
164
+ {
165
+ "type": "text",
166
+ "text": "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. ",
167
+ "bbox": [
168
+ 173,
169
+ 638,
170
+ 825,
171
+ 722
172
+ ],
173
+ "page_idx": 1
174
+ },
175
+ {
176
+ "type": "image",
177
+ "img_path": "images/859fd1e48bffed07eace755fe2651e3b53451866eb9af087b83af8821ec21d62.jpg",
178
+ "image_caption": [
179
+ "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. "
180
+ ],
181
+ "image_footnote": [],
182
+ "bbox": [
183
+ 173,
184
+ 747,
185
+ 823,
186
+ 852
187
+ ],
188
+ "page_idx": 1
189
+ },
190
+ {
191
+ "type": "text",
192
+ "text": "2 Related Work ",
193
+ "text_level": 1,
194
+ "bbox": [
195
+ 174,
196
+ 89,
197
+ 321,
198
+ 106
199
+ ],
200
+ "page_idx": 2
201
+ },
202
+ {
203
+ "type": "text",
204
+ "text": "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. ",
205
+ "bbox": [
206
+ 174,
207
+ 119,
208
+ 825,
209
+ 272
210
+ ],
211
+ "page_idx": 2
212
+ },
213
+ {
214
+ "type": "text",
215
+ "text": "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. ",
216
+ "bbox": [
217
+ 174,
218
+ 279,
219
+ 825,
220
+ 362
221
+ ],
222
+ "page_idx": 2
223
+ },
224
+ {
225
+ "type": "text",
226
+ "text": "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]. ",
227
+ "bbox": [
228
+ 173,
229
+ 367,
230
+ 825,
231
+ 479
232
+ ],
233
+ "page_idx": 2
234
+ },
235
+ {
236
+ "type": "text",
237
+ "text": "3 Method ",
238
+ "text_level": 1,
239
+ "bbox": [
240
+ 174,
241
+ 497,
242
+ 271,
243
+ 515
244
+ ],
245
+ "page_idx": 2
246
+ },
247
+ {
248
+ "type": "text",
249
+ "text": "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. ",
250
+ "bbox": [
251
+ 174,
252
+ 529,
253
+ 825,
254
+ 587
255
+ ],
256
+ "page_idx": 2
257
+ },
258
+ {
259
+ "type": "text",
260
+ "text": "3.1 Reinforcement Learning as Sequence Modeling ",
261
+ "text_level": 1,
262
+ "bbox": [
263
+ 174,
264
+ 602,
265
+ 542,
266
+ 617
267
+ ],
268
+ "page_idx": 2
269
+ },
270
+ {
271
+ "type": "text",
272
+ "text": "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: ",
273
+ "bbox": [
274
+ 173,
275
+ 627,
276
+ 825,
277
+ 683
278
+ ],
279
+ "page_idx": 2
280
+ },
281
+ {
282
+ "type": "equation",
283
+ "img_path": "images/426397ac1924f7dac298cec6075a5de5884150841b5d32f5584f2dfe3fcd033a.jpg",
284
+ "text": "$$\nx = \\langle . . . , { \\bf o } _ { 1 } ^ { t } , . . . , { \\bf o } _ { M } ^ { t } , \\hat { R } ^ { t } , a ^ { t } , r ^ { t } , . . . \\rangle\n$$",
285
+ "text_format": "latex",
286
+ "bbox": [
287
+ 380,
288
+ 689,
289
+ 616,
290
+ 708
291
+ ],
292
+ "page_idx": 2
293
+ },
294
+ {
295
+ "type": "text",
296
+ "text": "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. ",
297
+ "bbox": [
298
+ 174,
299
+ 713,
300
+ 825,
301
+ 771
302
+ ],
303
+ "page_idx": 2
304
+ },
305
+ {
306
+ "type": "text",
307
+ "text": "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). ",
308
+ "bbox": [
309
+ 174,
310
+ 777,
311
+ 825,
312
+ 849
313
+ ],
314
+ "page_idx": 2
315
+ },
316
+ {
317
+ "type": "text",
318
+ "text": "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. ",
319
+ "bbox": [
320
+ 176,
321
+ 856,
322
+ 823,
323
+ 911
324
+ ],
325
+ "page_idx": 2
326
+ },
327
+ {
328
+ "type": "image",
329
+ "img_path": "images/59cf36da87bbfa95815ac554a9c04cd09962815a6dc82b5a4da632ac733bf60b.jpg",
330
+ "image_caption": [
331
+ "Figure 3: An overview of our decision transformer architecture. "
332
+ ],
333
+ "image_footnote": [],
334
+ "bbox": [
335
+ 246,
336
+ 87,
337
+ 756,
338
+ 258
339
+ ],
340
+ "page_idx": 3
341
+ },
342
+ {
343
+ "type": "text",
344
+ "text": "",
345
+ "bbox": [
346
+ 174,
347
+ 310,
348
+ 825,
349
+ 366
350
+ ],
351
+ "page_idx": 3
352
+ },
353
+ {
354
+ "type": "text",
355
+ "text": "3.2 Tokenization ",
356
+ "text_level": 1,
357
+ "bbox": [
358
+ 174,
359
+ 382,
360
+ 302,
361
+ 397
362
+ ],
363
+ "page_idx": 3
364
+ },
365
+ {
366
+ "type": "text",
367
+ "text": "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 ",
368
+ "bbox": [
369
+ 174,
370
+ 409,
371
+ 825,
372
+ 464
373
+ ],
374
+ "page_idx": 3
375
+ },
376
+ {
377
+ "type": "text",
378
+ "text": "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. ",
379
+ "bbox": [
380
+ 174,
381
+ 470,
382
+ 825,
383
+ 540
384
+ ],
385
+ "page_idx": 3
386
+ },
387
+ {
388
+ "type": "text",
389
+ "text": "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. ",
390
+ "bbox": [
391
+ 174,
392
+ 546,
393
+ 825,
394
+ 616
395
+ ],
396
+ "page_idx": 3
397
+ },
398
+ {
399
+ "type": "text",
400
+ "text": "3.3 Training Dataset ",
401
+ "text_level": 1,
402
+ "bbox": [
403
+ 174,
404
+ 633,
405
+ 330,
406
+ 648
407
+ ],
408
+ "page_idx": 3
409
+ },
410
+ {
411
+ "type": "text",
412
+ "text": "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. ",
413
+ "bbox": [
414
+ 174,
415
+ 660,
416
+ 825,
417
+ 715
418
+ ],
419
+ "page_idx": 3
420
+ },
421
+ {
422
+ "type": "text",
423
+ "text": "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. ",
424
+ "bbox": [
425
+ 174,
426
+ 722,
427
+ 825,
428
+ 763
429
+ ],
430
+ "page_idx": 3
431
+ },
432
+ {
433
+ "type": "text",
434
+ "text": "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. ",
435
+ "bbox": [
436
+ 174,
437
+ 770,
438
+ 825,
439
+ 811
440
+ ],
441
+ "page_idx": 3
442
+ },
443
+ {
444
+ "type": "text",
445
+ "text": "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. ",
446
+ "bbox": [
447
+ 176,
448
+ 818,
449
+ 823,
450
+ 847
451
+ ],
452
+ "page_idx": 3
453
+ },
454
+ {
455
+ "type": "text",
456
+ "text": "",
457
+ "bbox": [
458
+ 173,
459
+ 90,
460
+ 825,
461
+ 174
462
+ ],
463
+ "page_idx": 4
464
+ },
465
+ {
466
+ "type": "text",
467
+ "text": "3.4 Expert Action Inference ",
468
+ "text_level": 1,
469
+ "bbox": [
470
+ 174,
471
+ 190,
472
+ 382,
473
+ 205
474
+ ],
475
+ "page_idx": 4
476
+ },
477
+ {
478
+ "type": "text",
479
+ "text": "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]. ",
480
+ "bbox": [
481
+ 173,
482
+ 215,
483
+ 825,
484
+ 286
485
+ ],
486
+ "page_idx": 4
487
+ },
488
+ {
489
+ "type": "text",
490
+ "text": "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: ",
491
+ "bbox": [
492
+ 174,
493
+ 291,
494
+ 825,
495
+ 333
496
+ ],
497
+ "page_idx": 4
498
+ },
499
+ {
500
+ "type": "equation",
501
+ "img_path": "images/6ac10784e780e195274419dbe08cf4f833234e7e3688132ac93d285f9253f03c.jpg",
502
+ "text": "$$\nP ( \\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 } ) )\n$$",
503
+ "text_format": "latex",
504
+ "bbox": [
505
+ 305,
506
+ 338,
507
+ 692,
508
+ 357
509
+ ],
510
+ "page_idx": 4
511
+ },
512
+ {
513
+ "type": "text",
514
+ "text": "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 }$ : ",
515
+ "bbox": [
516
+ 173,
517
+ 361,
518
+ 830,
519
+ 391
520
+ ],
521
+ "page_idx": 4
522
+ },
523
+ {
524
+ "type": "equation",
525
+ "img_path": "images/8018654e3e99c447c81fe1f9e577c601ed3b069d85724595f058768d3ef601f2.jpg",
526
+ "text": "$$\nP ( { \\mathrm { e x p e r t } } ^ { t } | R ^ { t } , \\ldots ) \\equiv \\exp ( \\kappa R ^ { t } )\n$$",
527
+ "text_format": "latex",
528
+ "bbox": [
529
+ 395,
530
+ 395,
531
+ 602,
532
+ 415
533
+ ],
534
+ "page_idx": 4
535
+ },
536
+ {
537
+ "type": "text",
538
+ "text": "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. ",
539
+ "bbox": [
540
+ 173,
541
+ 426,
542
+ 825,
543
+ 511
544
+ ],
545
+ "page_idx": 4
546
+ },
547
+ {
548
+ "type": "image",
549
+ "img_path": "images/2f572e1921eab720c534e59f8a71678e6f42ac165680d516909beb9fb93535b7.jpg",
550
+ "image_caption": [
551
+ "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. "
552
+ ],
553
+ "image_footnote": [],
554
+ "bbox": [
555
+ 209,
556
+ 523,
557
+ 790,
558
+ 613
559
+ ],
560
+ "page_idx": 4
561
+ },
562
+ {
563
+ "type": "text",
564
+ "text": "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. ",
565
+ "bbox": [
566
+ 173,
567
+ 664,
568
+ 825,
569
+ 747
570
+ ],
571
+ "page_idx": 4
572
+ },
573
+ {
574
+ "type": "text",
575
+ "text": "4 Experiments ",
576
+ "text_level": 1,
577
+ "bbox": [
578
+ 174,
579
+ 766,
580
+ 312,
581
+ 784
582
+ ],
583
+ "page_idx": 4
584
+ },
585
+ {
586
+ "type": "text",
587
+ "text": "We formulate our experiments to answer a number of questions that are addressed in following sections: ",
588
+ "bbox": [
589
+ 173,
590
+ 797,
591
+ 826,
592
+ 825
593
+ ],
594
+ "page_idx": 4
595
+ },
596
+ {
597
+ "type": "text",
598
+ "text": "• 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? ",
599
+ "bbox": [
600
+ 215,
601
+ 835,
602
+ 764,
603
+ 888
604
+ ],
605
+ "page_idx": 4
606
+ },
607
+ {
608
+ "type": "text",
609
+ "text": "• 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? ",
610
+ "bbox": [
611
+ 217,
612
+ 92,
613
+ 805,
614
+ 145
615
+ ],
616
+ "page_idx": 5
617
+ },
618
+ {
619
+ "type": "text",
620
+ "text": "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. ",
621
+ "bbox": [
622
+ 173,
623
+ 155,
624
+ 823,
625
+ 184
626
+ ],
627
+ "page_idx": 5
628
+ },
629
+ {
630
+ "type": "text",
631
+ "text": "4.1 Setup",
632
+ "text_level": 1,
633
+ "bbox": [
634
+ 174,
635
+ 200,
636
+ 253,
637
+ 214
638
+ ],
639
+ "page_idx": 5
640
+ },
641
+ {
642
+ "type": "text",
643
+ "text": "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. ",
644
+ "bbox": [
645
+ 174,
646
+ 224,
647
+ 825,
648
+ 280
649
+ ],
650
+ "page_idx": 5
651
+ },
652
+ {
653
+ "type": "text",
654
+ "text": "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. ",
655
+ "bbox": [
656
+ 173,
657
+ 295,
658
+ 825,
659
+ 378
660
+ ],
661
+ "page_idx": 5
662
+ },
663
+ {
664
+ "type": "text",
665
+ "text": "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. ",
666
+ "bbox": [
667
+ 174,
668
+ 393,
669
+ 825,
670
+ 491
671
+ ],
672
+ "page_idx": 5
673
+ },
674
+ {
675
+ "type": "text",
676
+ "text": "4.2 Baseline Methods ",
677
+ "text_level": 1,
678
+ "bbox": [
679
+ 174,
680
+ 507,
681
+ 334,
682
+ 522
683
+ ],
684
+ "page_idx": 5
685
+ },
686
+ {
687
+ "type": "text",
688
+ "text": "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. ",
689
+ "bbox": [
690
+ 174,
691
+ 534,
692
+ 825,
693
+ 588
694
+ ],
695
+ "page_idx": 5
696
+ },
697
+ {
698
+ "type": "text",
699
+ "text": "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. ",
700
+ "bbox": [
701
+ 174,
702
+ 603,
703
+ 825,
704
+ 715
705
+ ],
706
+ "page_idx": 5
707
+ },
708
+ {
709
+ "type": "text",
710
+ "text": "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. ",
711
+ "bbox": [
712
+ 174,
713
+ 729,
714
+ 825,
715
+ 854
716
+ ],
717
+ "page_idx": 5
718
+ },
719
+ {
720
+ "type": "text",
721
+ "text": "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. ",
722
+ "bbox": [
723
+ 174,
724
+ 869,
725
+ 825,
726
+ 911
727
+ ],
728
+ "page_idx": 5
729
+ },
730
+ {
731
+ "type": "text",
732
+ "text": "",
733
+ "bbox": [
734
+ 173,
735
+ 90,
736
+ 825,
737
+ 204
738
+ ],
739
+ "page_idx": 6
740
+ },
741
+ {
742
+ "type": "text",
743
+ "text": "4.3 How do different online and offline methods perform in the multi-game regime? ",
744
+ "text_level": 1,
745
+ "bbox": [
746
+ 173,
747
+ 222,
748
+ 766,
749
+ 237
750
+ ],
751
+ "page_idx": 6
752
+ },
753
+ {
754
+ "type": "text",
755
+ "text": "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. ",
756
+ "bbox": [
757
+ 174,
758
+ 247,
759
+ 825,
760
+ 344
761
+ ],
762
+ "page_idx": 6
763
+ },
764
+ {
765
+ "type": "text",
766
+ "text": "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. ",
767
+ "bbox": [
768
+ 174,
769
+ 351,
770
+ 825,
771
+ 463
772
+ ],
773
+ "page_idx": 6
774
+ },
775
+ {
776
+ "type": "text",
777
+ "text": "4.4 How do different methods scale with model size? ",
778
+ "text_level": 1,
779
+ "bbox": [
780
+ 174,
781
+ 481,
782
+ 549,
783
+ 494
784
+ ],
785
+ "page_idx": 6
786
+ },
787
+ {
788
+ "type": "text",
789
+ "text": "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. ",
790
+ "bbox": [
791
+ 173,
792
+ 506,
793
+ 825,
794
+ 589
795
+ ],
796
+ "page_idx": 6
797
+ },
798
+ {
799
+ "type": "image",
800
+ "img_path": "images/e46e0219b3208000eeaf756c5c28b6e400f45e9cea6d8e8bf66529595adb08a8.jpg",
801
+ "image_caption": [],
802
+ "image_footnote": [],
803
+ "bbox": [
804
+ 570,
805
+ 613,
806
+ 816,
807
+ 787
808
+ ],
809
+ "page_idx": 6
810
+ },
811
+ {
812
+ "type": "image",
813
+ "img_path": "images/856d3573874fc9658c6d11072bd29711ec7d2381d27d5c7b8f8ecd81467d579e.jpg",
814
+ "image_caption": [
815
+ "(b) Scaling of IQM scores for all novel games after fine-tuning DT and CQL. "
816
+ ],
817
+ "image_footnote": [],
818
+ "bbox": [
819
+ 184,
820
+ 614,
821
+ 532,
822
+ 787
823
+ ],
824
+ "page_idx": 6
825
+ },
826
+ {
827
+ "type": "text",
828
+ "text": "(a) Scaling of IQM scores for all training games with different model sizes and architectures. ",
829
+ "bbox": [
830
+ 173,
831
+ 801,
832
+ 539,
833
+ 828
834
+ ],
835
+ "page_idx": 6
836
+ },
837
+ {
838
+ "type": "text",
839
+ "text": "Figure 5: How model performance scales with model size, on training set games and novel games. \n(Impala) indicates using the Impala CNN architecture. ",
840
+ "bbox": [
841
+ 173,
842
+ 837,
843
+ 826,
844
+ 866
845
+ ],
846
+ "page_idx": 6
847
+ },
848
+ {
849
+ "type": "text",
850
+ "text": "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. ",
851
+ "bbox": [
852
+ 173,
853
+ 883,
854
+ 823,
855
+ 911
856
+ ],
857
+ "page_idx": 6
858
+ },
859
+ {
860
+ "type": "text",
861
+ "text": "",
862
+ "bbox": [
863
+ 173,
864
+ 92,
865
+ 823,
866
+ 119
867
+ ],
868
+ "page_idx": 7
869
+ },
870
+ {
871
+ "type": "text",
872
+ "text": "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]. ",
873
+ "bbox": [
874
+ 174,
875
+ 126,
876
+ 825,
877
+ 209
878
+ ],
879
+ "page_idx": 7
880
+ },
881
+ {
882
+ "type": "text",
883
+ "text": "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. ",
884
+ "bbox": [
885
+ 173,
886
+ 215,
887
+ 823,
888
+ 243
889
+ ],
890
+ "page_idx": 7
891
+ },
892
+ {
893
+ "type": "text",
894
+ "text": "4.5 How effective are different methods at transfer to novel games? ",
895
+ "text_level": 1,
896
+ "bbox": [
897
+ 174,
898
+ 261,
899
+ 651,
900
+ 276
901
+ ],
902
+ "page_idx": 7
903
+ },
904
+ {
905
+ "type": "text",
906
+ "text": "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. ",
907
+ "bbox": [
908
+ 174,
909
+ 286,
910
+ 825,
911
+ 371
912
+ ],
913
+ "page_idx": 7
914
+ },
915
+ {
916
+ "type": "text",
917
+ "text": "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. ",
918
+ "bbox": [
919
+ 174,
920
+ 377,
921
+ 825,
922
+ 488
923
+ ],
924
+ "page_idx": 7
925
+ },
926
+ {
927
+ "type": "text",
928
+ "text": "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). ",
929
+ "bbox": [
930
+ 173,
931
+ 493,
932
+ 825,
933
+ 618
934
+ ],
935
+ "page_idx": 7
936
+ },
937
+ {
938
+ "type": "image",
939
+ "img_path": "images/8feed4f8dab2d4154b17ad0ad18ddbe062a713669275d49fe5827cc63646fd4a.jpg",
940
+ "image_caption": [
941
+ "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. "
942
+ ],
943
+ "image_footnote": [],
944
+ "bbox": [
945
+ 179,
946
+ 636,
947
+ 818,
948
+ 748
949
+ ],
950
+ "page_idx": 7
951
+ },
952
+ {
953
+ "type": "text",
954
+ "text": "4.6 Does multi-game decision transformer improve upon training data? ",
955
+ "text_level": 1,
956
+ "bbox": [
957
+ 176,
958
+ 843,
959
+ 683,
960
+ 858
961
+ ],
962
+ "page_idx": 7
963
+ },
964
+ {
965
+ "type": "text",
966
+ "text": "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. ",
967
+ "bbox": [
968
+ 174,
969
+ 869,
970
+ 825,
971
+ 911
972
+ ],
973
+ "page_idx": 7
974
+ },
975
+ {
976
+ "type": "text",
977
+ "text": "",
978
+ "bbox": [
979
+ 174,
980
+ 92,
981
+ 825,
982
+ 133
983
+ ],
984
+ "page_idx": 8
985
+ },
986
+ {
987
+ "type": "image",
988
+ "img_path": "images/e4d7242c79f518d76828f0cc47c08ed6745a8cbb3945686538d16f2332e1bf3b.jpg",
989
+ "image_caption": [
990
+ "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. "
991
+ ],
992
+ "image_footnote": [],
993
+ "bbox": [
994
+ 183,
995
+ 155,
996
+ 815,
997
+ 319
998
+ ],
999
+ "page_idx": 8
1000
+ },
1001
+ {
1002
+ "type": "image",
1003
+ "img_path": "images/85c346ce0d2068a080918d00dd8d90e9c12adfe4904e722d05fd2641d6b49496.jpg",
1004
+ "image_caption": [
1005
+ "4.7 Does optimal action inference improve upon behavior cloning? ",
1006
+ "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. "
1007
+ ],
1008
+ "image_footnote": [],
1009
+ "bbox": [
1010
+ 173,
1011
+ 434,
1012
+ 823,
1013
+ 633
1014
+ ],
1015
+ "page_idx": 8
1016
+ },
1017
+ {
1018
+ "type": "text",
1019
+ "text": "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. ",
1020
+ "bbox": [
1021
+ 174,
1022
+ 702,
1023
+ 825,
1024
+ 771
1025
+ ],
1026
+ "page_idx": 8
1027
+ },
1028
+ {
1029
+ "type": "text",
1030
+ "text": "4.8 Does training on expert and non-expert data bring benefits over expert-only training? ",
1031
+ "text_level": 1,
1032
+ "bbox": [
1033
+ 171,
1034
+ 787,
1035
+ 807,
1036
+ 804
1037
+ ],
1038
+ "page_idx": 8
1039
+ },
1040
+ {
1041
+ "type": "text",
1042
+ "text": "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. ",
1043
+ "bbox": [
1044
+ 174,
1045
+ 814,
1046
+ 825,
1047
+ 911
1048
+ ],
1049
+ "page_idx": 8
1050
+ },
1051
+ {
1052
+ "type": "text",
1053
+ "text": "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. ",
1054
+ "bbox": [
1055
+ 173,
1056
+ 90,
1057
+ 825,
1058
+ 133
1059
+ ],
1060
+ "page_idx": 9
1061
+ },
1062
+ {
1063
+ "type": "image",
1064
+ "img_path": "images/17c55a7243c390f84dfc606f91fe6c5aab9df04a0808a25838884f8a9c3ee1f5.jpg",
1065
+ "image_caption": [
1066
+ "Figure 9: Comparison of 40M transformer models trained on full data and only expert data. "
1067
+ ],
1068
+ "image_footnote": [],
1069
+ "bbox": [
1070
+ 181,
1071
+ 156,
1072
+ 818,
1073
+ 284
1074
+ ],
1075
+ "page_idx": 9
1076
+ },
1077
+ {
1078
+ "type": "text",
1079
+ "text": "5 Conclusion ",
1080
+ "text_level": 1,
1081
+ "bbox": [
1082
+ 173,
1083
+ 354,
1084
+ 299,
1085
+ 371
1086
+ ],
1087
+ "page_idx": 9
1088
+ },
1089
+ {
1090
+ "type": "text",
1091
+ "text": "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. ",
1092
+ "bbox": [
1093
+ 174,
1094
+ 388,
1095
+ 825,
1096
+ 597
1097
+ ],
1098
+ "page_idx": 9
1099
+ },
1100
+ {
1101
+ "type": "text",
1102
+ "text": "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. ",
1103
+ "bbox": [
1104
+ 174,
1105
+ 616,
1106
+ 825,
1107
+ 698
1108
+ ],
1109
+ "page_idx": 9
1110
+ },
1111
+ {
1112
+ "type": "text",
1113
+ "text": "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. ",
1114
+ "bbox": [
1115
+ 174,
1116
+ 718,
1117
+ 825,
1118
+ 815
1119
+ ],
1120
+ "page_idx": 9
1121
+ },
1122
+ {
1123
+ "type": "text",
1124
+ "text": "Acknowledgements ",
1125
+ "text_level": 1,
1126
+ "bbox": [
1127
+ 176,
1128
+ 839,
1129
+ 338,
1130
+ 856
1131
+ ],
1132
+ "page_idx": 9
1133
+ },
1134
+ {
1135
+ "type": "text",
1136
+ "text": "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. ",
1137
+ "bbox": [
1138
+ 176,
1139
+ 872,
1140
+ 825,
1141
+ 911
1142
+ ],
1143
+ "page_idx": 9
1144
+ },
1145
+ {
1146
+ "type": "text",
1147
+ "text": "References ",
1148
+ "text_level": 1,
1149
+ "bbox": [
1150
+ 174,
1151
+ 90,
1152
+ 266,
1153
+ 106
1154
+ ],
1155
+ "page_idx": 10
1156
+ },
1157
+ {
1158
+ "type": "text",
1159
+ "text": "[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. \n[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. \n[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. \n[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. \n[5] William H Alexander and Samuel J Gershman. Representation learning with reward prediction errors. arXiv preprint arXiv:2108.12402, 2021. \n[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. \n[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. \n[8] Osbert Bastani, Yewen Pu, and Armando Solar-Lezama. Verifiable reinforcement learning via policy extraction. Advances in neural information processing systems, 31, 2018. \n[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. \n[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. \n[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. \n[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. \n[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. \n[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. \n[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. \n[16] Giuseppe Cuccu, Julian Togelius, and Philippe Cudré-Mauroux. Playing atari with six neurons. arXiv preprint arXiv:1806.01363, 2018. \n[17] Rishabh Dabral, Ganesh Ramakrishnan, Preethi Jyothi, et al. Rudder: A cross lingual video and text retrieval dataset. arXiv preprint arXiv:2103.05457, 2021. \n[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. \n[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. \n[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. \n[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. \n[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. \n[23] Hiroki Furuta, Yutaka Matsuo, and Shixiang Shane Gu. Generalized decision transformer for offline hindsight information matching. arXiv preprint arXiv:2111.10364, 2021. \n[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. \n[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. \n[26] Agrim Gupta, Silvio Savarese, Surya Ganguli, and Li Fei-Fei. Embodied intelligence via learning and evolution. Nature communications, 12(1):1–12, 2021. \n[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. \n[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. \n[29] Danijar Hafner, Timothy P Lillicrap, Mohammad Norouzi, and Jimmy Ba. Mastering atari with discrete world models. In International Conference on Learning Representations, 2020. \n[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. \n[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. \n[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. \n[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. \n[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. \n[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. \n[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. \n[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. \n[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. \n[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. \n[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. \n[41] Aviral Kumar, Xue Bin Peng, and Sergey Levine. Reward-conditioned policies. arXiv preprint arXiv:1912.13465, 2019. \n[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. \n[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. \n[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. \n[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. \n[46] Kevin Lu, Aditya Grover, Pieter Abbeel, and Igor Mordatch. Pretrained transformers as universal computation engines. arXiv preprint arXiv:2103.05247, 2021. \n[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. \n[48] Corey Lynch and Pierre Sermanet. Language conditioned imitation learning over unstructured data. arXiv preprint arXiv:2005.07648, 2020. \n[49] Horia Mania, Aurelia Guy, and Benjamin Recht. Simple random search provides a competitive approach to reinforcement learning. arXiv preprint arXiv:1803.07055, 2018. \n[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. \n[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. \n[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. \n[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. \n[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. \n[55] Ofir Nachum and Mengjiao Yang. Provable representation learning for imitation with contrastive fourier features. Advances in Neural Information Processing Systems, 34, 2021. \n[56] Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. \n[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. \n[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. \n[59] Emilio Parisotto, Jimmy Lei Ba, and Ruslan Salakhutdinov. Actor-mimic: Deep multitask and transfer reinforcement learning. arXiv preprint arXiv:1511.06342, 2015. \n[60] Dean A Pomerleau. Efficient training of artificial neural networks for autonomous navigation. Neural computation, 3(1):88–97, 1991. \n[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. \n[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. \n[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. \n[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. \n[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. \n[66] Machel Reid, Yutaro Yamada, and Shixiang Shane Gu. Can wikipedia help offline reinforcement learning? arXiv preprint arXiv:2201.12122, 2022. \n[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. \n[68] Juergen Schmidhuber. Reinforcement learning upside down: Don’t predict rewards–just map them to actions. arXiv preprint arXiv:1912.02875, 2019. \n[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. \n[70] Ross D Shachter. Probabilistic inference and influence diagrams. Operations research, 36(4):589–604, 1988. \n[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. \n[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. \n[73] Emanuel Todorov. Linearly-solvable markov decision problems. Advances in neural information processing systems, 19, 2006. \n[74] Marc Toussaint. Robot trajectory optimization using approximate inference. In Proceedings of the 26th annual international conference on machine learning, pages 1049–1056, 2009. \n[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. \n[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. \n[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. \n[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. \n[79] Kevin Yang and Dan Klein. Fudge: Controlled text generation with future discriminators. arXiv preprint arXiv:2104.05218, 2021. \n[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. \n[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. \n[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. \n[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. \n[84] Qinqing Zheng, Amy Zhang, and Aditya Grover. Online decision transformer. arXiv preprint arXiv:2202.05607, 2022. ",
1160
+ "bbox": [
1161
+ 171,
1162
+ 95,
1163
+ 828,
1164
+ 917
1165
+ ],
1166
+ "page_idx": 10
1167
+ },
1168
+ {
1169
+ "type": "text",
1170
+ "text": "",
1171
+ "bbox": [
1172
+ 171,
1173
+ 68,
1174
+ 828,
1175
+ 915
1176
+ ],
1177
+ "page_idx": 11
1178
+ },
1179
+ {
1180
+ "type": "text",
1181
+ "text": "",
1182
+ "bbox": [
1183
+ 173,
1184
+ 49,
1185
+ 828,
1186
+ 916
1187
+ ],
1188
+ "page_idx": 12
1189
+ },
1190
+ {
1191
+ "type": "text",
1192
+ "text": "",
1193
+ "bbox": [
1194
+ 169,
1195
+ 63,
1196
+ 828,
1197
+ 917
1198
+ ],
1199
+ "page_idx": 13
1200
+ },
1201
+ {
1202
+ "type": "text",
1203
+ "text": "",
1204
+ "bbox": [
1205
+ 171,
1206
+ 90,
1207
+ 826,
1208
+ 428
1209
+ ],
1210
+ "page_idx": 14
1211
+ },
1212
+ {
1213
+ "type": "text",
1214
+ "text": "Checklist ",
1215
+ "text_level": 1,
1216
+ "bbox": [
1217
+ 174,
1218
+ 453,
1219
+ 254,
1220
+ 469
1221
+ ],
1222
+ "page_idx": 14
1223
+ },
1224
+ {
1225
+ "type": "text",
1226
+ "text": "1. For all authors... ",
1227
+ "bbox": [
1228
+ 214,
1229
+ 479,
1230
+ 339,
1231
+ 493
1232
+ ],
1233
+ "page_idx": 14
1234
+ },
1235
+ {
1236
+ "type": "text",
1237
+ "text": "(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] \n(b) Did you describe the limitations of your work? [Yes] See Section 5 \n(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 5 \n(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] ",
1238
+ "bbox": [
1239
+ 238,
1240
+ 497,
1241
+ 825,
1242
+ 603
1243
+ ],
1244
+ "page_idx": 14
1245
+ },
1246
+ {
1247
+ "type": "text",
1248
+ "text": "2. If you are including theoretical results... ",
1249
+ "bbox": [
1250
+ 214,
1251
+ 607,
1252
+ 493,
1253
+ 622
1254
+ ],
1255
+ "page_idx": 14
1256
+ },
1257
+ {
1258
+ "type": "text",
1259
+ "text": "(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] ",
1260
+ "bbox": [
1261
+ 238,
1262
+ 626,
1263
+ 736,
1264
+ 656
1265
+ ],
1266
+ "page_idx": 14
1267
+ },
1268
+ {
1269
+ "type": "text",
1270
+ "text": "3. If you ran experiments... ",
1271
+ "bbox": [
1272
+ 212,
1273
+ 661,
1274
+ 393,
1275
+ 675
1276
+ ],
1277
+ "page_idx": 14
1278
+ },
1279
+ {
1280
+ "type": "text",
1281
+ "text": "(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] \n(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] \n(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] \n(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] ",
1282
+ "bbox": [
1283
+ 238,
1284
+ 679,
1285
+ 825,
1286
+ 797
1287
+ ],
1288
+ "page_idx": 14
1289
+ },
1290
+ {
1291
+ "type": "text",
1292
+ "text": "4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... ",
1293
+ "bbox": [
1294
+ 217,
1295
+ 801,
1296
+ 825,
1297
+ 816
1298
+ ],
1299
+ "page_idx": 14
1300
+ },
1301
+ {
1302
+ "type": "text",
1303
+ "text": "(a) If your work uses existing assets, did you cite the creators? [Yes] \n(b) Did you mention the license of the assets? [N/A] \n(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] \n(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] ",
1304
+ "bbox": [
1305
+ 238,
1306
+ 820,
1307
+ 825,
1308
+ 912
1309
+ ],
1310
+ "page_idx": 14
1311
+ },
1312
+ {
1313
+ "type": "text",
1314
+ "text": "(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] ",
1315
+ "bbox": [
1316
+ 236,
1317
+ 92,
1318
+ 823,
1319
+ 119
1320
+ ],
1321
+ "page_idx": 15
1322
+ },
1323
+ {
1324
+ "type": "text",
1325
+ "text": "5. If you used crowdsourcing or conducted research with human subjects... ",
1326
+ "bbox": [
1327
+ 214,
1328
+ 123,
1329
+ 705,
1330
+ 138
1331
+ ],
1332
+ "page_idx": 15
1333
+ },
1334
+ {
1335
+ "type": "text",
1336
+ "text": "(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] \n(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] \n(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] ",
1337
+ "bbox": [
1338
+ 238,
1339
+ 142,
1340
+ 826,
1341
+ 232
1342
+ ],
1343
+ "page_idx": 15
1344
+ }
1345
+ ]
parse/dev/0gouO5saq6K/0gouO5saq6K_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/0gouO5saq6K/0gouO5saq6K_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/2EufPS5ABlJ/2EufPS5ABlJ.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/2EufPS5ABlJ/2EufPS5ABlJ_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/2EufPS5ABlJ/2EufPS5ABlJ_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/2EufPS5ABlJ/2EufPS5ABlJ_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/3RBY8fKjHeu/3RBY8fKjHeu_content_list.json ADDED
@@ -0,0 +1,995 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "DayDreamer: World Models for Physical Robot Learning ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 303,
8
+ 99,
9
+ 692,
10
+ 152
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Philipp Wu\\* ",
17
+ "text_level": 1,
18
+ "bbox": [
19
+ 282,
20
+ 176,
21
+ 372,
22
+ 191
23
+ ],
24
+ "page_idx": 0
25
+ },
26
+ {
27
+ "type": "text",
28
+ "text": "Alejandro Escontrela\\* Danijar Hafner\\* ",
29
+ "bbox": [
30
+ 406,
31
+ 176,
32
+ 718,
33
+ 190
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "Ken Goldberg Pieter Abbeel ",
40
+ "bbox": [
41
+ 383,
42
+ 203,
43
+ 614,
44
+ 218
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "University of California, Berkeley \\*Equal contribution ",
51
+ "bbox": [
52
+ 388,
53
+ 229,
54
+ 609,
55
+ 243
56
+ ],
57
+ "page_idx": 0
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "",
62
+ "bbox": [
63
+ 434,
64
+ 250,
65
+ 563,
66
+ 263
67
+ ],
68
+ "page_idx": 0
69
+ },
70
+ {
71
+ "type": "text",
72
+ "text": "Abstract: To solve tasks in complex environments, robots need to learn from experience. Deep reinforcement learning is a common approach to robot learning but requires a large amount of trial and error to learn, limiting its deployment in the physical world. As a consequence, many advances in robot learning rely on simulators. On the other hand, learning inside of simulators fails to capture the complexity of the real world, is prone to simulator inaccuracies, and the resulting behaviors do not adapt to changes in the world. The Dreamer algorithm has recently shown great promise for learning from small amounts of interaction by planning within a learned world model, outperforming pure reinforcement learning in video games. Learning a world model to predict the outcomes of potential actions enables planning in imagination, reducing the amount of trial and error needed in the real environment. However, it is unknown whether Dreamer can facilitate faster learning on physical robots. In this paper, we apply Dreamer to 4 robots to learn online and directly in the real world, without any simulators. Dreamer trains a quadruped robot to roll off its back, stand up, and walk from scratch and without resets in only 1 hour. We then push the robot and find that Dreamer adapts within 10 minutes to withstand perturbations or quickly roll over and stand back up. On two different robotic arms, Dreamer learns to pick and place objects from camera images and sparse rewards, approaching human-level teleoperation performance. On a wheeled robot, Dreamer learns to navigate to a goal position purely from camera images, automatically resolving ambiguity about the robot orientation. Using the same hyperparameters across all experiments, we find that Dreamer is capable of online learning in the real world, which establishes a strong baseline. We release our infrastructure for future applications of world models to robot learning. Videos are available on the project website: https://danijar.com/daydreamer ",
73
+ "bbox": [
74
+ 232,
75
+ 292,
76
+ 766,
77
+ 659
78
+ ],
79
+ "page_idx": 0
80
+ },
81
+ {
82
+ "type": "image",
83
+ "img_path": "images/17f2d11eee9937e70f62a1993623ebccd221887d067e71919c350fa57662f4d3.jpg",
84
+ "image_caption": [
85
+ "Figure 1: To study the applicability of Dreamer for sample-efficient robot learning, we apply the algorithm to learn robot locomotion, manipulation, and navigation tasks from scratch in the real world on 4 robots, without simulators. The tasks evaluate a diverse range of challenges, including continuous and discrete actions, dense and sparse rewards, proprioceptive and camera inputs, as well as sensor fusion of multiple input modalities. Learning successfully using the same hyperparameters across all experiments, Dreamer establishes a strong baseline for real world robot learning. "
86
+ ],
87
+ "image_footnote": [],
88
+ "bbox": [
89
+ 174,
90
+ 684,
91
+ 823,
92
+ 816
93
+ ],
94
+ "page_idx": 0
95
+ },
96
+ {
97
+ "type": "text",
98
+ "text": "1 Introduction ",
99
+ "text_level": 1,
100
+ "bbox": [
101
+ 174,
102
+ 90,
103
+ 310,
104
+ 106
105
+ ],
106
+ "page_idx": 1
107
+ },
108
+ {
109
+ "type": "text",
110
+ "text": "Teaching robots to solve complex tasks in the real world is a foundational problem of robotics research. Deep reinforcement learning (RL) offers a popular approach to robot learning that enables robots to improve their behavior over time through trial and error. However, current algorithms require too much interaction with the environment to learn successful behaviors. Recently, modern world models have shown great promise for data efficient learning in simulated domains and video games (Hafner et al., 2019; 2020). Learning world models from past experience enables robots to imagine the future outcomes of potential actions, reducing the amount of trial and error in the real environment needed to learn. ",
111
+ "bbox": [
112
+ 174,
113
+ 126,
114
+ 550,
115
+ 318
116
+ ],
117
+ "page_idx": 1
118
+ },
119
+ {
120
+ "type": "text",
121
+ "text": "While learning accurate world models can be challenging, they offer compelling properties for robot learning. By predicting future outcomes, world models allow for planning and behavior learning given only small amounts of real world interaction (Gal et al., 2016; Ebert et al., 2018). Moreover, world models summarize general dynamics knowledge about the environment that, once learned, could be reused for a wide range of downstream tasks (Sekar et al., 2020). World models also learn representations that fuse multiple sensor modalities and integrate them into latent states, reducing the need for sophisticated state estimators. Finally, world models generalize well from available offline data (Yu et al., 2021), which further accelerates learning in the real world. ",
122
+ "bbox": [
123
+ 174,
124
+ 330,
125
+ 549,
126
+ 536
127
+ ],
128
+ "page_idx": 1
129
+ },
130
+ {
131
+ "type": "image",
132
+ "img_path": "images/e30f877426a1aa2686b70c08629a56889403c96105b017890f8ea57b7982c4a2.jpg",
133
+ "image_caption": [
134
+ "Figure 2: Dreamer follows a simple pipeline for online learning on robot hardware without simulators. The current learned policy collects experience on the robot. This experience is added to the replay buffer. The world model is trained on replayed off-policy sequences through supervised learning. An actor critic algorithm optimizes a neural network policy from imagined rollouts in the latent space of the world model. We parallelize data collection and neural network learning. "
135
+ ],
136
+ "image_footnote": [],
137
+ "bbox": [
138
+ 562,
139
+ 128,
140
+ 826,
141
+ 294
142
+ ],
143
+ "page_idx": 1
144
+ },
145
+ {
146
+ "type": "text",
147
+ "text": "Despite the promises of world models, learning accurate world models for the real world is a open challenge. In this paper, we leverage recent advances of the Dreamer world model for training a variety of robots in the most straight-forward and fundamental problem setting: online reinforcement learning in the real world, without simulators or demonstrations. As shown in Figure 2, Dreamer learns a world model from a replay buffer of past experience, learns behaviors from rollouts imagined in the latent space of the world model, and continuously interacts with the environment to explore and improve its behaviors. Our aim is to push the limits of robot learning directly in the real world and offer a robust platform to enable future work that develops the benefits of world models for robot learning. The key contributions of this paper are summarized as follows: ",
148
+ "bbox": [
149
+ 173,
150
+ 549,
151
+ 825,
152
+ 683
153
+ ],
154
+ "page_idx": 1
155
+ },
156
+ {
157
+ "type": "text",
158
+ "text": "• Dreamer on Robots We apply Dreamer to 4 robots, demonstrating successful learning directly in the real world, without introducing new algorithms. The tasks cover a range of challenges, including different action spaces, sensory modalities, and reward structures. \n• Walking in 1 Hour We teach a quadruped from scratch in the real world to roll off its back, stand up, and walk in only 1 hour. Afterwards, we find that the robot adapts to being pushed within 10 minutes, learning to withstand pushes or quickly roll over and get back on its feet. \n• Visual Pick and Place We train robotic arms to pick and place objects from sparse rewards, which requires localizing objects from pixels and fusing images with proprioceptive inputs. The learned behavior outperforms model-free agents and approaches the performance of a human teleoperator using the same control interface as the robot. \n• Open Source We publicly release the software infrastructure for all our experiments, which supports different action spaces and sensory modalities, offering a flexible platform for future research of world models for robot learning in the real world. ",
159
+ "bbox": [
160
+ 173,
161
+ 698,
162
+ 826,
163
+ 905
164
+ ],
165
+ "page_idx": 1
166
+ },
167
+ {
168
+ "type": "image",
169
+ "img_path": "images/bbd9aa6b3f541685e1ecf9dd1c4451b92904b361a6547ee2e39414769cb64de4.jpg",
170
+ "image_caption": [
171
+ "Figure 3: Neural Network Training We leverage the Dreamer algorithm (Hafner et al., 2019; 2020) for fast robot learning in real world. Dreamer consists of two main neural network components, the world model and the policy. Left: The world model follows the structure of a deep Kalman filter that is trained on subsequences drawn from the replay buffer. The encoder fuses all sensory modalities into discrete codes. The decoder reconstructs the inputs from the codes, providing a rich learning signal and enabling human inspection of model predictions. A recurrent state-space model (RSSM) is trained to predict future codes given actions, without observing intermediate inputs. "
172
+ ],
173
+ "image_footnote": [],
174
+ "bbox": [
175
+ 169,
176
+ 65,
177
+ 826,
178
+ 272
179
+ ],
180
+ "page_idx": 2
181
+ },
182
+ {
183
+ "type": "text",
184
+ "text": "Right: The world model enables massively parallel policy optimization from imagined rollouts in the compact latent space using a large batch size, without having to reconstruct sensory inputs. Dreamer trains a policy network and value network from the imagined rollouts and a learned reward function. ",
185
+ "bbox": [
186
+ 174,
187
+ 381,
188
+ 826,
189
+ 438
190
+ ],
191
+ "page_idx": 2
192
+ },
193
+ {
194
+ "type": "text",
195
+ "text": "2 Approach ",
196
+ "text_level": 1,
197
+ "bbox": [
198
+ 174,
199
+ 448,
200
+ 289,
201
+ 465
202
+ ],
203
+ "page_idx": 2
204
+ },
205
+ {
206
+ "type": "text",
207
+ "text": "We leverage the Dreamer algorithm (Hafner et al., 2019; 2020) for online learning on physical robots, without the need for simulators. Figure 2 shows an overview of the approach. Dreamer learns a world model from a replay buffer of past experiences, uses an actor critic algorithm to learn behaviors from trajectories predicted by the learned model, and deploys its behavior in the environment to continuously grow the replay buffer. We decouple learning updates from data collection to meet latency requirements and to enable fast training without waiting for the environment. In our implementation, a learner thread continuously trains the world model and actor critic behavior, while an actor thread in parallel computes actions for environment interaction. ",
208
+ "bbox": [
209
+ 173,
210
+ 476,
211
+ 825,
212
+ 594
213
+ ],
214
+ "page_idx": 2
215
+ },
216
+ {
217
+ "type": "text",
218
+ "text": "World Model Learning The world model is a deep neural network that learns to predict the environment dynamics, as shown in Figure 3 (left). Because sensory inputs can be large images, we predict future representations rather than future inputs. This reduces accumulating errors and enables massively parallel training with a large batch size. Thus, the world model can be thought of as a fast simulator of the environment that the robot learns autonomously, starting from a blank slate and continuously improving its model as it explores the real world. The world model is based on the Recurrent State-Space Model (RSSM; Hafner et al., 2018), which consists of four components: ",
219
+ "bbox": [
220
+ 173,
221
+ 599,
222
+ 825,
223
+ 703
224
+ ],
225
+ "page_idx": 2
226
+ },
227
+ {
228
+ "type": "equation",
229
+ "img_path": "images/bd74dd0968c35c4dc8ffeba6cc51d9f109521ca66008a561e30a7fcccfe148a6.jpg",
230
+ "text": "$$\n{ \\begin{array} { r l r l } & { \\operatorname { e n c } _ { \\theta } { \\big ( } s _ { t } \\ { \\big | } \\ s _ { t - 1 } , a _ { t - 1 } , x _ { t } { \\big ) } } & & { { \\mathrm { D e c o d e r ~ N e t w o r k : } } \\quad \\operatorname* { d e c } _ { \\theta } { \\big ( } s _ { t } { \\big ) } \\approx x _ { t } } \\\\ & { \\operatorname { d y n } _ { \\theta } { \\big ( } s _ { t } \\ { \\big | } \\ s _ { t - 1 } , a _ { t - 1 } { \\big ) } } & & { { \\mathrm { R e w a r d ~ N e t w o r k : } } \\quad \\operatorname { r e w } _ { \\theta } { \\big ( } s _ { t + 1 } { \\big ) } \\approx r _ { t } } \\end{array} }\n$$",
231
+ "text_format": "latex",
232
+ "bbox": [
233
+ 328,
234
+ 708,
235
+ 787,
236
+ 747
237
+ ],
238
+ "page_idx": 2
239
+ },
240
+ {
241
+ "type": "text",
242
+ "text": "Physical robots are often equipped with multiple sensors of different modalities, such as proprioceptive joint readings, force sensors, and high-dimensional inputs such as RGB and depth camera images. The encoder network fuses all sensory inputs $x _ { t }$ together into the stochastic representations $z _ { t }$ . The dynamics model learns to predict the sequence of stochastic representations by using its recurrent state $h _ { t }$ . The decoder reconstructs the sensory inputs to provide a rich signal for learning representations and enables human inspection of model predictions. In our experiments, the robot has to discover task rewards by interacting with the real world, which the reward network learns to predict. Using manually specified rewards as a function of the decoded sensory inputs is also possible. We optimize all components of the world model jointly by stochastic backpropagation (Kingma and Welling, 2013; Rezende et al., 2014). ",
243
+ "bbox": [
244
+ 173,
245
+ 751,
246
+ 826,
247
+ 898
248
+ ],
249
+ "page_idx": 2
250
+ },
251
+ {
252
+ "type": "text",
253
+ "text": "Actor Critic Learning While the world model represents task-agnostic knowledge about the dynamics, the actor critic algorithm learns a behavior that is specific to the task at hand. As shown in Figure 3 (right), we learn behaviors from rollouts that are predicted in the latent space of the world model, without decoding observations. This enables massively parallel behavior learning with typical batch sizes of 16K on a single GPU. The actor critic algorithm consists of an actor network $\\pi ( a _ { t } | s _ { t } )$ and a critic network $v ( s _ { t } )$ . ",
254
+ "bbox": [
255
+ 173,
256
+ 90,
257
+ 825,
258
+ 180
259
+ ],
260
+ "page_idx": 3
261
+ },
262
+ {
263
+ "type": "text",
264
+ "text": "The role of the actor network is to learn a distribution over successful actions $a _ { t }$ for each latent model state $s _ { t }$ that maximizes the sum of future predicted task rewards. The critic network learns to predict the sum of future task rewards through temporal difference learning (Sutton and Barto, 2018). This allows the algorithm to take into account rewards beyond the planning horizon of $H = 1 6$ steps to learn long-term strategies. Given a predicted trajectory of model states, the critic is trained to regress the return of the trajectory. We compute $\\lambda$ -returns following Hafner et al. (2020; 2019): ",
265
+ "bbox": [
266
+ 173,
267
+ 188,
268
+ 825,
269
+ 277
270
+ ],
271
+ "page_idx": 3
272
+ },
273
+ {
274
+ "type": "equation",
275
+ "img_path": "images/bced559cf73caae8b60315e212417c82fda960dadfbf4c1dc28fc8ea7be19aee.jpg",
276
+ "text": "$$\nV _ { t } ^ { \\lambda } \\doteq r _ { t } + \\gamma \\Big ( ( 1 - \\lambda ) v ( s _ { t + 1 } ) + \\lambda V _ { t + 1 } ^ { \\lambda } \\Big ) , \\quad V _ { H } ^ { \\lambda } \\doteq v ( s _ { H } ) .\n$$",
277
+ "text_format": "latex",
278
+ "bbox": [
279
+ 305,
280
+ 281,
281
+ 691,
282
+ 309
283
+ ],
284
+ "page_idx": 3
285
+ },
286
+ {
287
+ "type": "text",
288
+ "text": "While the critic network is trained to regress the $\\lambda$ -returns, the actor network is trained to maximize them. Different gradient estimators are available for computing the policy gradient for optimizing the actor, such as Reinforce (Williams, 1992) and the reparameterization trick (Kingma and Welling, 2013; Rezende et al., 2014) that directly backpropagates return gradients through the differentiable dynamics network (Henaff et al., 2019). Following Hafner et al. (2020), we choose reparameterization gradients for continuous control tasks and Reinforce gradients for tasks with discrete actions. In addition to maximizing returns, the actor is also incentivized to maintain high entropy to prevent collapse to a deterministic policy and maintain some amount of exploration throughout training: ",
289
+ "bbox": [
290
+ 173,
291
+ 314,
292
+ 825,
293
+ 433
294
+ ],
295
+ "page_idx": 3
296
+ },
297
+ {
298
+ "type": "equation",
299
+ "img_path": "images/29586778ea39548465206a088f601c3e740302c103692a574d7a70d8188b3983.jpg",
300
+ "text": "$$\n\\begin{array} { r } { \\mathcal { L } ( \\pi ) \\doteq - \\operatorname { E } \\bigl [ \\sum _ { t = 1 } ^ { H } \\ln \\pi ( a _ { t } \\mid s _ { t } ) \\mathrm { s g } ( V _ { t } ^ { \\lambda } - v ( s _ { t } ) ) + \\eta \\mathrm { H } \\bigl [ \\pi ( a _ { t } \\mid s _ { t } ) \\bigr ] \\bigr ] } \\end{array}\n$$",
301
+ "text_format": "latex",
302
+ "bbox": [
303
+ 271,
304
+ 440,
305
+ 725,
306
+ 462
307
+ ],
308
+ "page_idx": 3
309
+ },
310
+ {
311
+ "type": "text",
312
+ "text": "We optimize the actor and critic using the Adam optimizer (Kingma and Ba, 2014). To compute the $\\lambda$ -returns, we use a slowly updated copy of the critic network as common in the literature (Mnih et al., 2015; Lillicrap et al., 2015). The actor and critic gradients do not affect the world model, as this would lead to incorrect and overly optimistic model predictions. The hyperparameters are listed in Appendix D. ",
313
+ "bbox": [
314
+ 174,
315
+ 465,
316
+ 825,
317
+ 540
318
+ ],
319
+ "page_idx": 3
320
+ },
321
+ {
322
+ "type": "text",
323
+ "text": "3 Experiments ",
324
+ "text_level": 1,
325
+ "bbox": [
326
+ 174,
327
+ 564,
328
+ 312,
329
+ 582
330
+ ],
331
+ "page_idx": 3
332
+ },
333
+ {
334
+ "type": "text",
335
+ "text": "We evaluate Dreamer on 4 robots, each with a different task, and compare its performance to appropriate algorithmic and human baselines. The experiments are representative of common robotic tasks, such as locomotion, manipulation, and navigation. The tasks pose a diverse range of challenges, including continuous and discrete actions, dense and sparse rewards, proprioceptive and image observations, and sensor fusion. The goal of the experiments is to evaluate whether the recent successes of learned world models enables sample-efficient robot learning directly in the real world. Specifically, we aim to answer the following research questions: ",
336
+ "bbox": [
337
+ 173,
338
+ 597,
339
+ 826,
340
+ 700
341
+ ],
342
+ "page_idx": 3
343
+ },
344
+ {
345
+ "type": "text",
346
+ "text": "• Does Dreamer enable robot learning directly in the real world, without simulators? • Does Dreamer succeed across various robot platforms, sensory modalities, and action spaces? • How does the data-efficiency of Dreamer compare to previous reinforcement learning algorithms? ",
347
+ "bbox": [
348
+ 173,
349
+ 712,
350
+ 826,
351
+ 767
352
+ ],
353
+ "page_idx": 3
354
+ },
355
+ {
356
+ "type": "text",
357
+ "text": "Implementation We build on the official implementation of DreamerV2 (Hafner et al., 2020). We develop an asynchronous actor and learner setup, which is essential in environments with high control rates, such as the quadruped, and also accelerates learning for slower environments, such as the robot arms. The actor thread computes online actions for the robot and sends trajectories of 128 time steps to the replay buffer. The learner thread samples data from the replay buffer, updates the world model, and optimizes the policy using imagination rollouts. Policy weights are synced from the learner to the actor every 20 seconds. We use an RSSM with 256 units to speed up the training computation. We use identical hyperparameters across all experiments, enabling off-the-shelf training on different robot embodiments. ",
358
+ "bbox": [
359
+ 173,
360
+ 779,
361
+ 826,
362
+ 911
363
+ ],
364
+ "page_idx": 3
365
+ },
366
+ {
367
+ "type": "image",
368
+ "img_path": "images/159d86a4fe017221206965fa98efc6ce35e16bebec7536f231b04a5fa470830b.jpg",
369
+ "image_caption": [
370
+ "Figure 4: A1 Quadruped Walking Starting from lying on its back with the feet in the air, Dreamer learns to roll over, stand up, and walk in 1 hour of real world training time, without simulators or resets. In contrast, SAC only learns to roll over but neither to stand up nor to walk. For SAC, we also had to help the robot out of a dead-locked leg configuration during training. On the right we show training curves for both SAC and Dreamer. The maximum reward is 14. The filled circles indicate times where the robot fell on its back, requiring the learning of a robust strategy for getting back up. After 1 hour of training, we start pushing the robot and find that it adapts its behavior within 10 minutes to withstand light pushes and quickly roll back on its feet for hard pushes. The graph shows a single training run with the shaded area indicating one standard deviation within each time bin. "
371
+ ],
372
+ "image_footnote": [],
373
+ "bbox": [
374
+ 173,
375
+ 71,
376
+ 818,
377
+ 180
378
+ ],
379
+ "page_idx": 4
380
+ },
381
+ {
382
+ "type": "text",
383
+ "text": "Baselines We compare to a strong learning algorithm for each of our experimental setups. The A1 quadruped robot uses continuous actions and low-dimensional inputs, allowing us to compare to SAC (Haarnoja et al., 2018a;b), a popular algorithm for data-efficient continuous control. For the visual pick and place experiments on the XArm and UR5 robots, inputs are images and proprioceptive readings and actions are discrete, suggesting algorithms from the DQN (Mnih et al., 2015) line of work as baselines. We choose Rainbow (Hessel et al., 2018) as a powerful representative of this category, an algorithm that combines many improvements of DQN. To input the proprioceptive readings, we concatenate them as broadcasted planes to the RGB channels of the image, a common practice in the literature (Schrittwieser et al., 2019). For the UR5, we additionally compare against PPO (Schulman et al., 2017), with similar modifications for fusing image and proprioceptive readings. In addition, we compare against a human operator controlling the robot arm through the robot control interface. For the Sphero navigation task, inputs are images and actions are continuous. The state-ofthe-art baseline in this category is DrQv2 (Yarats et al., 2021), which uses image augmentation to increase sample-efficiency. ",
384
+ "bbox": [
385
+ 173,
386
+ 338,
387
+ 826,
388
+ 545
389
+ ],
390
+ "page_idx": 4
391
+ },
392
+ {
393
+ "type": "text",
394
+ "text": "3.1 A1 Quadruped Walking ",
395
+ "text_level": 1,
396
+ "bbox": [
397
+ 174,
398
+ 559,
399
+ 382,
400
+ 574
401
+ ],
402
+ "page_idx": 4
403
+ },
404
+ {
405
+ "type": "text",
406
+ "text": "This high-dimensional continuous control task requires training a quadruped robot to roll over from its back, stand up, and walk forward at a fixed target velocity. Prior work in quadruped locomotion requires either extensive training in simulation under domain randomization, using recovery controllers to avoid unsafe states, or defining the action space as parameterized trajectory generators that restrict the space of motions (Rusu et al., 2016; Peng et al., 2018; Rudin et al., 2021; Lee et al., 2020; Yang et al., 2019). In contrast, we train in the end-to-end reinforcement learning setting directly on the robot, without simulators or resets. We use the Unitree A1 robot that consists of 12 direct drive motors. The motors are controlled at $2 0 \\mathrm { H z }$ via continuous actions that represent motor angles that are realized by a PD controller on the hardware. Actions are filtered with a Butterworth filter to protect the motor from high-frequency actions. The input consists of motor angles, orientations, and angular velocities. Due to space constraints, we manually intervene when the robot has reached the end of the available training area, without modifying the joint configuration or orientation that the robot is in. ",
407
+ "bbox": [
408
+ 174,
409
+ 579,
410
+ 549,
411
+ 768
412
+ ],
413
+ "page_idx": 4
414
+ },
415
+ {
416
+ "type": "image",
417
+ "img_path": "images/69e7a0dc11e3a7ecd812dec526777f2a39e7aed63605587ef789903e7f57fb8c.jpg",
418
+ "image_caption": [
419
+ "Figure 8: Within 10 minutes of perturbing the learned walking behavior, the robot adapts to withstanding pushes or quickly rolling over and back on its feet. "
420
+ ],
421
+ "image_footnote": [],
422
+ "bbox": [
423
+ 562,
424
+ 580,
425
+ 823,
426
+ 695
427
+ ],
428
+ "page_idx": 4
429
+ },
430
+ {
431
+ "type": "text",
432
+ "text": "",
433
+ "bbox": [
434
+ 174,
435
+ 770,
436
+ 825,
437
+ 843
438
+ ],
439
+ "page_idx": 4
440
+ },
441
+ {
442
+ "type": "text",
443
+ "text": "The reward function is the sum of five terms. An upright reward is computed from the base frame up vector $\\hat { z } ^ { T }$ , terms for matching the standing pose are computed from the joint angles of the hips, shoulders, and knees, and a forward velocity term is computed from the projected forward velocity $\\boldsymbol { s } _ { v } \\boldsymbol { x }$ and the total velocity $s _ { v }$ . Without the reward curriculum, the agent receives spurious reward values due to the velocity estimator’s dependence on foot-ground contact events. Each of the five terms is active while its preceding terms are satisfied to at least 0.7 and otherwise set to 0: ",
444
+ "bbox": [
445
+ 174,
446
+ 853,
447
+ 825,
448
+ 911
449
+ ],
450
+ "page_idx": 4
451
+ },
452
+ {
453
+ "type": "image",
454
+ "img_path": "images/69863294723843746383e47fe99dcd32744e499d1c526f51df4121c52ff99fe8.jpg",
455
+ "image_caption": [
456
+ "Figure 5: UR5 Multi Object Visual Pick and Place This task requires learning to locate three ball objects from third-person camera images, grasp them, and move them into the other bin. The arm is free to move within and above the bins and sparse rewards are given for grasping a ball and for dropping it in the opposite bin. The environment requires the world model to learn multi-object dynamics in the real world and the sparse reward structure poses a challenge for policy optimization. Dreamer overcomes the challenges of visual localization and sparse rewards on this task, learning a successful strategy within a few hours of autonomous operation. "
457
+ ],
458
+ "image_footnote": [],
459
+ "bbox": [
460
+ 173,
461
+ 73,
462
+ 815,
463
+ 179
464
+ ],
465
+ "page_idx": 5
466
+ },
467
+ {
468
+ "type": "text",
469
+ "text": "",
470
+ "bbox": [
471
+ 174,
472
+ 309,
473
+ 825,
474
+ 339
475
+ ],
476
+ "page_idx": 5
477
+ },
478
+ {
479
+ "type": "equation",
480
+ "img_path": "images/d59a106b3ad7e1f46762af4cb6c79589191a386db6dd18da2381b810f0e72627.jpg",
481
+ "text": "$$\n\\begin{array} { r l } { r ^ { \\mathrm { u p r } } \\doteq ( \\hat { z } ^ { T } [ 0 , 0 , 1 ] - 1 ) / 2 } & { { } r ^ { \\mathrm { h i p } } \\doteq 1 - \\frac 1 4 \\| q ^ { \\mathrm { h i p } } + 0 . 2 \\| _ { 1 } \\quad r ^ { \\mathrm { s h o u l d e r } } \\doteq 1 - \\frac 1 4 \\| q ^ { \\mathrm { s h o u l d e r } } + 0 . 2 \\| _ { 1 } } \\end{array}\n$$",
482
+ "text_format": "latex",
483
+ "bbox": [
484
+ 200,
485
+ 344,
486
+ 779,
487
+ 364
488
+ ],
489
+ "page_idx": 5
490
+ },
491
+ {
492
+ "type": "equation",
493
+ "img_path": "images/d3f8da6b396f76d54da62528b9e91defa6543c22e48371ec0f3e6d668424058f.jpg",
494
+ "text": "$$\n\\begin{array} { r l } { r ^ { \\mathrm { k n e e } } \\doteq 1 - \\frac 1 4 \\parallel q ^ { \\mathrm { k n e e } } - 1 . 0 \\parallel _ { 1 } } & { { } r ^ { \\mathrm { v e l o c i t y } } \\doteq 5 \\big ( \\operatorname* { m a x } ( 0 , ^ { \\mathcal { B } } v _ { x } ) / \\parallel ^ { \\mathcal { B } } v \\parallel _ { 2 } \\cdot \\mathrm { c l i p } ( ^ { \\mathcal { B } } v _ { x } / 0 . 3 , - 1 , 1 ) + 1 \\big ) } \\end{array}\n$$",
495
+ "text_format": "latex",
496
+ "bbox": [
497
+ 199,
498
+ 371,
499
+ 777,
500
+ 391
501
+ ],
502
+ "page_idx": 5
503
+ },
504
+ {
505
+ "type": "text",
506
+ "text": "As shown in Figure 4, after one hour of training, Dreamer learns to consistently flip the robot over from its back, stand up, and walk forward. In the first 5 minutes of training, the robot manages to roll off its back and land on its feet. 20 minutes later, it learns how to stand up on its feet. About 1 hour into training, the robot learns a pronking gait to walk forward at the desired velocity. After succeeding at this task, we tested the robustness of the algorithms by repeatedly knocking the robot off of its feet with a large pole, shown in Figure 8. Within 10 minutes of additional online learning, the robot adapts and withstand pushes or quickly rolls back on its feet. In comparison, SAC quickly learns to roll off its back but fails to stand up or walk given the small data budget. ",
507
+ "bbox": [
508
+ 173,
509
+ 396,
510
+ 826,
511
+ 515
512
+ ],
513
+ "page_idx": 5
514
+ },
515
+ {
516
+ "type": "text",
517
+ "text": "3.2 UR5 Multi-Object Visual Pick and Place ",
518
+ "text_level": 1,
519
+ "bbox": [
520
+ 173,
521
+ 525,
522
+ 495,
523
+ 540
524
+ ],
525
+ "page_idx": 5
526
+ },
527
+ {
528
+ "type": "text",
529
+ "text": "Common in warehouse and logistics environments, pick and place tasks require a robot manipulator to transport items from one bin into another. Figure 5 shows a successful pick and place cycle of this task. The task is challenging because of sparse rewards, the need to infer object positions from pixels, and the challenging dynamics of multiple moving objects. The sensory inputs consist of proprioceptive readings (joint angles, gripper position, end effector Cartesian position) and a 3rd person RGB image of the scene. Successfully grasping one of the 3 objects, detected by partial gripper closure, results in a $+ 1$ reward, releasing the object in the same bin gives a $- 1$ reward, and placing in the opposite bin gives a $+ 1 0$ reward. We control the UR5 robot from Universal Robotics at $2 \\ \\mathrm { H z }$ . Actions are discrete for moving the end effector in increments along X, Y, and $\\textsf { Z }$ axes and for toggling the gripper state. Movement in the Z axis is only enabled while holding an object and the gripper automatically opens once above the correct bin. We estimate human teleoperation performance by recording 3 demonstrators for 20 minutes each, controlling the UR5 with a joystick. ",
530
+ "bbox": [
531
+ 173,
532
+ 541,
533
+ 826,
534
+ 717
535
+ ],
536
+ "page_idx": 5
537
+ },
538
+ {
539
+ "type": "text",
540
+ "text": "Dreamer reaches an average pick rate of 2.5 objects per minute within 8 hours. The robot initially struggles to learn as the reward signal is very sparse, but begins to gradually improve after 2 hours of training. The robot first learns to localize the objects and toggles the gripper when near an object. Over time, grasping becomes precise and the robot learns to push objects out of corners. Figure 5 shows the learning curves of Dreamer compared to Rainbow DQN, PPO, and the human baseline. Both Rainbow DQN and PPO only learn the short-sighted behavior of grasping and immediately dropping objects in the same bin. In contrast, Dreamer approaches human-level teleoperation performance after 8 hours. We hypothesize that Rainbow DQN and PPO fail because they require larger amounts of experience, which is not feasible for us to collect in the real world. ",
541
+ "bbox": [
542
+ 173,
543
+ 722,
544
+ 825,
545
+ 856
546
+ ],
547
+ "page_idx": 5
548
+ },
549
+ {
550
+ "type": "text",
551
+ "text": "3.3 XArm Visual Pick and Place ",
552
+ "text_level": 1,
553
+ "bbox": [
554
+ 174,
555
+ 866,
556
+ 411,
557
+ 881
558
+ ],
559
+ "page_idx": 5
560
+ },
561
+ {
562
+ "type": "text",
563
+ "text": "While the UR5 robot is a high performance industrial robot, the XArm is an accessible low-cost 7 DOF manipulation, which we control at approximately $0 . 5 \\ : \\mathrm { H z }$ . Similar to Section 3.2, the task requires localizing and grasping a soft object and moving it from one bin to another and back, shown in Figure 6. We connect the object to the gripper with a string, which makes it less likely for the object to get stuck in corners at the cost of more complex dynamics. The sparse reward, discrete action space, and observation space match the UR5 setup except for the addition of depth image observations. ",
564
+ "bbox": [
565
+ 173,
566
+ 882,
567
+ 821,
568
+ 911
569
+ ],
570
+ "page_idx": 5
571
+ },
572
+ {
573
+ "type": "image",
574
+ "img_path": "images/dfce202941b6d7b7a3b4e91b152da625264b3b1c43837193ab53e137e11b01f3.jpg",
575
+ "image_caption": [
576
+ "Figure 6: XArm Visual Pick and Place The XArm is an affordable robot arm that operates slower than the UR5. To demonstrate successful learning on this robot, we use a third-person RealSense camera with RGB and depth modalities, as well as proprioceptive inputs for the robot arm, requiring the world model to learn sensor fusion. The pick and place task uses a soft object. While soft objects would be challenging to model accurately in a simulator, Dreamer avoids this issue by directly learning on the real robot without a simulator. While Rainbow and PPO using R3M visual embeddings converge to the local optimum of grasping and ungrasping the object in the same bin, Dreamer learns a successful pick and place policy from sparse rewards in under 10 hours. "
577
+ ],
578
+ "image_footnote": [],
579
+ "bbox": [
580
+ 174,
581
+ 66,
582
+ 816,
583
+ 172
584
+ ],
585
+ "page_idx": 6
586
+ },
587
+ {
588
+ "type": "text",
589
+ "text": "",
590
+ "bbox": [
591
+ 174,
592
+ 318,
593
+ 825,
594
+ 391
595
+ ],
596
+ "page_idx": 6
597
+ },
598
+ {
599
+ "type": "text",
600
+ "text": "Dreamer learns a policy that enables the XArm to achieve an average pick rate of 3.1 objects per minute in 10 hours of time, which is comparable to human performance on this task. Figure 6 shows that Dreamer learns to solve the task within 10 hours, whereas the Rainbow algorithm, a top model-free algorithm for discrete control from pixels, fails to learn. We additionally compare Dreamer against a PPO baseline that utilizes R3M (Nair et al., 2022) pretrained visual embeddings for the state, but notice no improvement in performance. Interestingly, we observed that Dreamer learns to sometimes use the string to pull the object out of a corner before grasping it, demonstrating multi-modal behaviors. Moreover, we observed that when lighting conditions change drastically (such as sharp shadows during sunrise), performance initially collapses but Dreamer then adapts to the changing conditions and exceeds its previous performance after a few hours of additional training, reported in Appendix A. ",
601
+ "bbox": [
602
+ 173,
603
+ 397,
604
+ 825,
605
+ 560
606
+ ],
607
+ "page_idx": 6
608
+ },
609
+ {
610
+ "type": "text",
611
+ "text": "3.4 Sphero Navigation ",
612
+ "text_level": 1,
613
+ "bbox": [
614
+ 174,
615
+ 570,
616
+ 343,
617
+ 585
618
+ ],
619
+ "page_idx": 6
620
+ },
621
+ {
622
+ "type": "text",
623
+ "text": "We evaluate Dreamer on a visual navigation task that requires maneuvering a wheeled robot to a fixed goal location given only RGB images as input. We use the Sphero Ollie robot, a cylindrical robot with two controllable motors, which we control through continuous torque commands at $2 \\ : \\mathrm { H z }$ Because the robot is symmetric and the robot only has access to image observations, it has to infer the heading direction from the history of observations. The robot is provided with a dense reward equal to the negative L2 distance, which is computed using a oracle vision pipeline that detects the Sphero’s position (this information is not provided to the agent). As the goal is fixed, after 100 environment steps, we end the episode and randomize the robot’s position through a sequence of high power random motor actions. ",
624
+ "bbox": [
625
+ 174,
626
+ 587,
627
+ 825,
628
+ 718
629
+ ],
630
+ "page_idx": 6
631
+ },
632
+ {
633
+ "type": "text",
634
+ "text": "In 2 hours, Dreamer learns to quickly and consistently navigate to the goal and stay near the goal for the remainder of the episode. As shown in Figure 7, Dreamer achieves an average distance to the goal of 0.15, measured in units of the area size and averaged across time steps. We find that DrQv2, a model-free algorithm specifically designed to continuous control from pixels, achieves similar performance. This result matches the simulated experiments of Yarats et al. (2021) that showed the two algorithms to perform similarly for continuous control tasks from images. ",
635
+ "bbox": [
636
+ 174,
637
+ 726,
638
+ 825,
639
+ 814
640
+ ],
641
+ "page_idx": 6
642
+ },
643
+ {
644
+ "type": "text",
645
+ "text": "4 Related Work ",
646
+ "text_level": 1,
647
+ "bbox": [
648
+ 174,
649
+ 829,
650
+ 321,
651
+ 845
652
+ ],
653
+ "page_idx": 6
654
+ },
655
+ {
656
+ "type": "text",
657
+ "text": "Existing work on robot learning commonly leverages large amounts of simulated experience before deploying to the real world (Rusu et al., 2016; Peng et al., 2018; OpenAI et al., 2018; Lee et al., 2020; Irpan et al., 2020; Kumar et al., 2021; Siekmann et al., 2021; Escontrela et al., 2022), leverage fleets of robots to collect experience datasets (Kalashnikov et al., 2018; Dasari et al., 2019; Kalashnikov et al., 2021; Ebert et al., 2021), or rely on external information such as human expert demonstrations or task priors to achieve sample-efficient learning (Xie et al., 2019; Schoettler et al., 2019; James et al., 2021; Shah and Levine, 2022; Bohez et al., 2022; Sivakumar et al., 2022). However, designing simulated tasks and collecting expert demonstrations is time-consuming. Moreover, many of these approaches require specialized algorithms for leveraging offline experience, demonstrations, or simulator inaccuracies. In contrast, our experiments show that learning end-to-end from rewards in the physical world is feasible for a diverse range of tasks through world models. ",
658
+ "bbox": [
659
+ 174,
660
+ 853,
661
+ 825,
662
+ 911
663
+ ],
664
+ "page_idx": 6
665
+ },
666
+ {
667
+ "type": "image",
668
+ "img_path": "images/372acb53fc3f9ab9f178baac319f8b0cb0c4ee1ca96f374bada7397c4ec23630.jpg",
669
+ "image_caption": [
670
+ "Figure 7: Sphero Navigation This task requires the Sphero robot to navigate to a goal location given a top-down RGB image as the only input. The task requires the robot to localize itself from raw pixels, to infer its orientation from the sequence of past images because it is ambiguous from a single image, and to control the robot from under-actuated motors that require building up momentum over time. Dreamer learns a successful policy on this task in under 2 hours. "
671
+ ],
672
+ "image_footnote": [],
673
+ "bbox": [
674
+ 173,
675
+ 73,
676
+ 813,
677
+ 179
678
+ ],
679
+ "page_idx": 7
680
+ },
681
+ {
682
+ "type": "text",
683
+ "text": "",
684
+ "bbox": [
685
+ 174,
686
+ 282,
687
+ 825,
688
+ 386
689
+ ],
690
+ "page_idx": 7
691
+ },
692
+ {
693
+ "type": "text",
694
+ "text": "Relatively few works have demonstrated end-to-end learning from scratch in the physical world. Visual Foresight (Finn et al., 2016; Finn and Levine, 2017; Ebert et al., 2018) learns a video prediction model to solve real world tasks by online planning, but is limited to short-horizon tasks and requires generating images during planning, making it computationally expensive. Yang et al. (2019; 2022) learn quadruped locomotion through a model-based approach by predicting foot placement and leveraging a domain-specific controller to achieve them. Ha et al. (2020) learn a quadruped walking policy by relying on a scripted reset policy, so the robot does not have to learn to stand up. SOLAR (Zhang et al., 2019) learns a latent dynamics model from images and demonstrates reaching and pushing with a robot arm. Nagabandi et al. (2019) learns manipulation policies by planning through a learned dynamics model from state observations. In comparison, our experiments show successful learning across 4 challenging robot tasks that cover a wide range of challenges and sensory modalities, with a single learning algorithm and hyperparameter setting. ",
695
+ "bbox": [
696
+ 174,
697
+ 398,
698
+ 825,
699
+ 575
700
+ ],
701
+ "page_idx": 7
702
+ },
703
+ {
704
+ "type": "text",
705
+ "text": "5 Discussion ",
706
+ "text_level": 1,
707
+ "bbox": [
708
+ 174,
709
+ 598,
710
+ 292,
711
+ 614
712
+ ],
713
+ "page_idx": 7
714
+ },
715
+ {
716
+ "type": "text",
717
+ "text": "We applied Dreamer to physical robot learning, finding that modern world models enable sampleefficient robot learning for a range of tasks, from scratch in the real world and without simulators. We also find that the approach is generally applicable in that it can solve robot locomotion, manipulation, and navigation tasks without changing hyperparameters. Dreamer taught a quadruped robot to roll off the back, stand up, and walk in 1 hour from scratch, which previously required extensive training in simulation followed by transfer to the real world or parameterized trajectory generators and given reset policies. We also demonstrate learning to pick and place objects from pixels and sparse rewards on two robot arms in 8–10 hours. ",
718
+ "bbox": [
719
+ 173,
720
+ 633,
721
+ 825,
722
+ 752
723
+ ],
724
+ "page_idx": 7
725
+ },
726
+ {
727
+ "type": "text",
728
+ "text": "Limitations While Dreamer shows promising results, learning on hardware over many hours creates wear on robots that may require human intervention or repair. Additionally, more work is required to explore the limits of Dreamer and our baselines by training for a longer time. Finally, we see tackling more challenging tasks, potentially by combining the benefits of fast real world learning with those of simulators, as an impactful future research direction. ",
729
+ "bbox": [
730
+ 174,
731
+ 766,
732
+ 825,
733
+ 839
734
+ ],
735
+ "page_idx": 7
736
+ },
737
+ {
738
+ "type": "text",
739
+ "text": "Acknowledgements We thank Stephen James and Justin Kerr for helpful suggestions and help with printing the protective shell of the quadruped robot. We thank Ademi Adeniji for help with setting up the XArm robot and Raven Huang for help with setting up the UR5 robot. This work was supported in part by an NSF Fellowship, NSF NRI #2024675, and the Vanier Canada Graduate Scholarship. ",
740
+ "bbox": [
741
+ 176,
742
+ 853,
743
+ 823,
744
+ 911
745
+ ],
746
+ "page_idx": 7
747
+ },
748
+ {
749
+ "type": "text",
750
+ "text": "References \nD. Hafner, T. Lillicrap, J. Ba, and M. Norouzi. Dream to control: Learning behaviors by latent imagination. arXiv preprint arXiv:1912.01603, 2019. \nD. Hafner, T. Lillicrap, M. Norouzi, and J. Ba. Mastering atari with discrete world models. arXiv preprint arXiv:2010.02193, 2020. \nY. Gal, R. McAllister, and C. E. Rasmussen. Improving pilco with bayesian neural network dynamics models. In Data-Efficient Machine Learning workshop, ICML, 2016. \nF. Ebert, C. Finn, S. Dasari, A. Xie, A. Lee, and S. Levine. Visual foresight: Model-based deep reinforcement learning for vision-based robotic control. arXiv preprint arXiv:1812.00568, 2018. \nR. Sekar, O. Rybkin, K. Daniilidis, P. Abbeel, D. Hafner, and D. Pathak. Planning to explore via selfsupervised world models. In International Conference on Machine Learning, pages 8583–8592. PMLR, 2020. \nT. Yu, A. Kumar, R. Rafailov, A. Rajeswaran, S. Levine, and C. Finn. Combo: Conservative offline model-based policy optimization. Advances in neural information processing systems, 34: 28954–28967, 2021. \nD. Hafner, T. Lillicrap, I. Fischer, R. Villegas, D. Ha, H. Lee, and J. Davidson. Learning latent dynamics for planning from pixels. arXiv preprint arXiv:1811.04551, 2018. \nD. P. Kingma and M. Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. \nD. J. Rezende, S. Mohamed, and D. Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014. \nR. S. Sutton and A. G. Barto. Reinforcement learning: An introduction. MIT press, 2018. \nR. J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992. \nM. Henaff, A. Canziani, and Y. LeCun. Model-predictive policy learning with uncertainty regularization for driving in dense traffic. arXiv preprint arXiv:1901.02705, 2019. \nD. P. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. \nV. Mnih, K. Kavukcuoglu, D. Silver, A. A. Rusu, J. Veness, M. G. Bellemare, A. Graves, M. Riedmiller, A. K. Fidjeland, G. Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015. \nT. P. Lillicrap, J. J. Hunt, A. Pritzel, N. Heess, T. Erez, Y. Tassa, D. Silver, and D. Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015. \nT. Haarnoja, A. Zhou, P. Abbeel, and S. Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. arXiv preprint arXiv:1801.01290, 2018a. \nT. Haarnoja, A. Zhou, K. Hartikainen, G. Tucker, S. Ha, J. Tan, V. Kumar, H. Zhu, A. Gupta, P. Abbeel, et al. Soft actor-critic algorithms and applications. arXiv preprint arXiv:1812.05905, 2018b. \nM. Hessel, J. Modayil, H. Van Hasselt, T. Schaul, G. Ostrovski, W. Dabney, D. Horgan, B. Piot, M. Azar, and D. Silver. Rainbow: Combining improvements in deep reinforcement learning. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018. \nJ. Schrittwieser, I. Antonoglou, T. Hubert, K. Simonyan, L. Sifre, S. Schmitt, A. Guez, E. Lockhart, D. Hassabis, T. Graepel, et al. Mastering atari, go, chess and shogi by planning with a learned model. arXiv preprint arXiv:1911.08265, 2019. \nJ. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017. \nD. Yarats, R. Fergus, A. Lazaric, and L. Pinto. Mastering visual continuous control: Improved data-augmented reinforcement learning. arXiv preprint arXiv:2107.09645, 2021. \nA. A. Rusu, M. Vecerik, T. Rothörl, N. Heess, R. Pascanu, and R. Hadsell. Sim-to-real robot learning from pixels with progressive nets, 2016. \nX. B. Peng, M. Andrychowicz, W. Zaremba, and P. Abbeel. Sim-to-real transfer of robotic control with dynamics randomization. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pages 1–8, May 2018. doi:10.1109/ICRA.2018.8460528. \nN. Rudin, D. Hoeller, P. Reist, and M. Hutter. Learning to walk in minutes using massively parallel deep reinforcement learning, 2021. \nJ. Lee, J. Hwangbo, L. Wellhausen, V. Koltun, and M. Hutter. Learning quadrupedal locomotion over challenging terrain. Science Robotics, 5(47), oct 2020. doi:10.1126/scirobotics.abc5986. URL https://doi.org/10.1126%2Fscirobotics.abc5986. \nY. Yang, K. Caluwaerts, A. Iscen, T. Zhang, J. Tan, and V. Sindhwani. Data efficient reinforcement learning for legged robots, 2019. \nS. Nair, A. Rajeswaran, V. Kumar, C. Finn, and A. Gupta. R3m: A universal visual representation for robot manipulation, 2022. \nOpenAI, M. Andrychowicz, B. Baker, M. Chociej, R. Jozefowicz, B. McGrew, J. Pachocki, A. Petron, M. Plappert, G. Powell, A. Ray, J. Schneider, S. Sidor, J. Tobin, P. Welinder, L. Weng, and W. Zaremba. Learning dexterous in-hand manipulation, 2018. \nA. Irpan, C. Harris, J. Ibarz, K. Rao, M. Khansari, and S. Levine. Rl-cyclegan: Improving deep-rl robotics with simulation-to-real. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR 2020), 2020. \nA. Kumar, Z. Fu, D. Pathak, and J. Malik. Rma: Rapid motor adaptation for legged robots, 2021. \nJ. Siekmann, K. Green, J. Warila, A. Fern, and J. Hurst. Blind bipedal stair traversal via sim-to-real reinforcement learning, 2021. \nA. Escontrela, X. B. Peng, W. Yu, T. Zhang, A. Iscen, K. Goldberg, and P. Abbeel. Adversarial motion priors make good substitutes for complex reward functions, 2022. \nD. Kalashnikov, A. Irpan, P. Pastor, J. Ibarz, A. Herzog, E. Jang, D. Quillen, E. Holly, M. Kalakrishnan, V. Vanhoucke, and S. Levine. Qt-opt: Scalable deep reinforcement learning for vision-based robotic manipulation, 2018. \nS. Dasari, F. Ebert, S. Tian, S. Nair, B. Bucher, K. Schmeckpeper, S. Singh, S. Levine, and C. Finn. Robonet: Large-scale multi-robot learning, 2019. \nD. Kalashnikov, J. Varley, Y. Chebotar, B. Swanson, R. Jonschkowski, C. Finn, S. Levine, and K. Hausman. Mt-opt: Continuous multi-task robotic reinforcement learning at scale, 2021. \nF. Ebert, Y. Yang, K. Schmeckpeper, B. Bucher, G. Georgakis, K. Daniilidis, C. Finn, and S. Levine. Bridge data: Boosting generalization of robotic skills with cross-domain datasets, 2021. \nA. Xie, F. Ebert, S. Levine, and C. Finn. Improvisation through physical understanding: Using novel objects as tools with visual foresight. arXiv preprint arXiv:1904.05538, 2019. \nG. Schoettler, A. Nair, J. Luo, S. Bahl, J. A. Ojea, E. Solowjow, and S. Levine. Deep reinforcement learning for industrial insertion tasks with visual inputs and natural rewards, 2019. \nS. James, K. Wada, T. Laidlow, and A. J. Davison. Coarse-to-fine q-attention: Efficient learning for visual robotic manipulation via discretisation, 2021. \nD. Shah and S. Levine. Viking: Vision-based kilometer-scale navigation with geographic hints, 2022. \nS. Bohez, S. Tunyasuvunakool, P. Brakel, F. Sadeghi, L. Hasenclever, Y. Tassa, E. Parisotto, J. Humplik, T. Haarnoja, R. Hafner, M. Wulfmeier, M. Neunert, B. Moran, N. Siegel, A. Huber, F. Romano, N. Batchelor, F. Casarini, J. Merel, R. Hadsell, and N. Heess. Imitate and repurpose: Learning reusable robot movement skills from human and animal behaviors, 2022. \nA. Sivakumar, K. Shaw, and D. Pathak. Robotic telekinesis: Learning a robotic hand imitator by watching humans on youtube, 2022. \nC. Finn, I. Goodfellow, and S. Levine. Unsupervised learning for physical interaction through video prediction. In Advances in neural information processing systems, pages 64–72, 2016. \nC. Finn and S. Levine. Deep visual foresight for planning robot motion. In Robotics and Automation (ICRA), 2017 IEEE International Conference on, pages 2786–2793. IEEE, 2017. \nY. Yang, T. Zhang, E. Coumans, J. Tan, and B. Boots. Fast and efficient locomotion via learned gait transitions. In Conference on Robot Learning, pages 773–783. PMLR, 2022. \nS. Ha, P. Xu, Z. Tan, S. Levine, and J. Tan. Learning to walk in the real world with minimal human effort. arXiv preprint arXiv:2002.08550, 2020. \nM. Zhang, S. Vikram, L. Smith, P. Abbeel, M. Johnson, and S. Levine. Solar: deep structured representations for model-based reinforcement learning. In International Conference on Machine Learning, 2019. \nA. Nagabandi, K. Konoglie, S. Levine, and V. Kumar. Deep dynamics models for learning dexterous manipulation, 2019. \nG. I. Parisi, R. Kemker, J. L. Part, C. Kanan, and S. Wermter. Continual lifelong learning with neural networks: A review. Neural Networks, 113:54–71, 2019. ISSN 0893-6080. \nT. Miki, J. Lee, J. Hwangbo, L. Wellhausen, V. Koltun, and M. Hutter. Learning robust perceptive locomotion for quadrupedal robots in the wild. Science Robotics, 7(62), jan 2022. doi:10.1126/ scirobotics.abk2822. \nL. Smith, J. C. Kew, X. B. Peng, S. Ha, J. Tan, and S. Levine. Legged robots that keep on learning: Fine-tuning locomotion policies in the real world, 2021. \nT.-Y. Yang, T. Zhang, L. Luu, S. Ha, J. Tan, and W. Yu. Safe reinforcement learning for legged locomotion, 2022. URL https://arxiv.org/abs/2203.02638. \nS. Ha, P. Xu, Z. Tan, S. Levine, and J. Tan. Learning to walk in the real world with minimal human effort, 2020. URL https://arxiv.org/abs/2002.08550. \nL. Smith, I. Kostrikov, and S. Levine. A walk in the park: Learning to walk in 20 minutes with model-free reinforcement learning, 2022. URL https://arxiv.org/abs/2208.07860. \nS. Levine, P. Pastor, A. Krizhevsky, J. Ibarz, and D. Quillen. Learning hand-eye coordination for robotic grasping with deep learning and large-scale data collection. The International Journal of Robotics Research, 37(4-5):421–436, 2018. \nL. Pinto and A. Gupta. Supersizing self-supervision: Learning to grasp from 50k tries and 700 robot hours, 2015. \nH. Ha and S. Song. Flingbot: The unreasonable effectiveness of dynamic manipulation for cloth unfolding. Conference on Robot Learning, 2021. \nS. James and A. J. Davison. Q-attention: Enabling efficient learning for vision-based robotic manipulation, 2021. \nE. Tzeng, C. Devin, J. Hoffman, C. Finn, P. Abbeel, S. Levine, K. Saenko, and T. Darrell. Adapting deep visuomotor representations with weak pairwise constraints, 2015. \nI. Akkaya, M. Andrychowicz, M. Chociej, M. Litwin, B. McGrew, A. Petron, A. Paino, M. Plappert, G. Powell, R. Ribas, et al. Solving rubik’s cube with a robot hand. arXiv preprint arXiv:1910.07113, 2019. \nM. P. Deisenroth, G. Neumann, J. Peters, et al. A survey on policy search for robotics. Foundations and Trends in Robotics, 2(1–2):1–142, 2013. \nK. Chua, R. Calandra, R. McAllister, and S. Levine. Deep reinforcement learning in a handful of trials using probabilistic dynamics models. In Advances in Neural Information Processing Systems, pages 4754–4765, 2018. \nA. Nagabandi, G. Yang, T. Asmar, R. Pandya, G. Kahn, S. Levine, and R. S. Fearing. Learning image-conditioned dynamics models for control of under-actuated legged millirobots, 2017. \nP. Becker-Ehmck, M. Karl, J. Peters, and P. van der Smagt. Learning to fly via deep model-based reinforcement learning. arXiv preprint arXiv:2003.08876, 2020. \nF. Deng, I. Jang, and S. Ahn. Dreamerpro: Reconstruction-free model-based reinforcement learning with prototypical representations. arXiv preprint arXiv:2110.14565, 2021. \nM. Okada and T. Taniguchi. Dreaming: Model-based reinforcement learning by latent imagination without reconstruction. In 2021 IEEE International Conference on Robotics and Automation (ICRA), pages 4209–4215. IEEE, 2021. \nH. Bharadhwaj, M. Babaeizadeh, D. Erhan, and S. Levine. Information prioritization through empowerment in visual model-based rl. arXiv preprint arXiv:2204.08585, 2022. \nK. Paster, L. E. McKinney, S. A. McIlraith, and J. Ba. Blast: Latent dynamics models from bootstrapping. In Deep RL Workshop NeurIPS 2021, 2021. \nK. Hsu, M. J. Kim, R. Rafailov, J. Wu, and C. Finn. Vision-based manipulators need to also see from their hands, 2022. URL https://arxiv.org/abs/2203.12677. ",
751
+ "bbox": [
752
+ 171,
753
+ 90,
754
+ 828,
755
+ 917
756
+ ],
757
+ "page_idx": 8
758
+ },
759
+ {
760
+ "type": "text",
761
+ "text": "",
762
+ "bbox": [
763
+ 168,
764
+ 55,
765
+ 828,
766
+ 920
767
+ ],
768
+ "page_idx": 9
769
+ },
770
+ {
771
+ "type": "text",
772
+ "text": "",
773
+ "bbox": [
774
+ 169,
775
+ 90,
776
+ 828,
777
+ 916
778
+ ],
779
+ "page_idx": 10
780
+ },
781
+ {
782
+ "type": "text",
783
+ "text": "",
784
+ "bbox": [
785
+ 168,
786
+ 85,
787
+ 828,
788
+ 647
789
+ ],
790
+ "page_idx": 11
791
+ },
792
+ {
793
+ "type": "text",
794
+ "text": "A Adaptation ",
795
+ "text_level": 1,
796
+ "bbox": [
797
+ 174,
798
+ 90,
799
+ 303,
800
+ 107
801
+ ],
802
+ "page_idx": 12
803
+ },
804
+ {
805
+ "type": "text",
806
+ "text": "Real world robot learning faces practical challenges such as changing environmental conditions and time varying dynamics. We found that Dreamer is able to adapt to the current environmental conditions with no change to the learning algorithm. This shows promise for using Dreamer in continual learning settings (Parisi et al., 2019). Adaptation of the quadruped to external perturbations is reported in Section 3.1 and Figure 8. ",
807
+ "bbox": [
808
+ 174,
809
+ 117,
810
+ 825,
811
+ 191
812
+ ],
813
+ "page_idx": 12
814
+ },
815
+ {
816
+ "type": "text",
817
+ "text": "The XArm, situated near large windows, is able to adapt and maintain performance under the presence of changing lighting conditions. The XArm experiments were conducted after sundown to keep the lighting conditions constant throughout training. Figure A.1 shows the learning curve of the XArm. As expected, the performance of the XArm drops during sunrise. However, the XArm is able to adapt to the change in lighting conditions in about 5 hours time and recover the original performance, which is faster than it would be to train from scratch. A careful inspection of the image observations at these times, as shown in Figure A.1, reveals that the robot received observations with strong light rays covering the scene which greatly differs from the original training observations. ",
818
+ "bbox": [
819
+ 173,
820
+ 196,
821
+ 826,
822
+ 315
823
+ ],
824
+ "page_idx": 12
825
+ },
826
+ {
827
+ "type": "image",
828
+ "img_path": "images/db6cf431ae9355646aa06c810c30e311d8db38009707b4dea4bad788085ac2bb.jpg",
829
+ "image_caption": [
830
+ "Figure A.1: The left two images are raw observations consumed by Dreamer. The leftmost image is an image observation as seen by the XArm at night, when it was trained. The next image shows an observation during sunrise. Despite the vast difference in pixel space, the XArm is able to recover, and then surpass, the original performance in approximately 5 hours. Even after 24 hours when the lighting shifts to night time conditions, the XArm is able to maintain performance. "
831
+ ],
832
+ "image_footnote": [],
833
+ "bbox": [
834
+ 173,
835
+ 327,
836
+ 813,
837
+ 440
838
+ ],
839
+ "page_idx": 12
840
+ },
841
+ {
842
+ "type": "text",
843
+ "text": "B Imagination ",
844
+ "text_level": 1,
845
+ "bbox": [
846
+ 174,
847
+ 545,
848
+ 310,
849
+ 563
850
+ ],
851
+ "page_idx": 12
852
+ },
853
+ {
854
+ "type": "image",
855
+ "img_path": "images/24fe88bf92baa43778d9defa3450750bc0d2c910fa9c12c5902630d7c2316e1e.jpg",
856
+ "image_caption": [
857
+ "Figure B.1: To introspect the policy, we can roll out trajectories in the latent space of Dreamer, then decode the images to visualize the intent of the actor network. Each row is an imagined trajectory, showing every 2nd frame. Top: Latent rollouts on the UR5 environment. Multiple objects introduce more visual complexity that the network has to model. Note the second trajectory, which shows a static orange ball becoming a green ball. Bottom: Latent rollouts on the XArm environment. "
858
+ ],
859
+ "image_footnote": [],
860
+ "bbox": [
861
+ 179,
862
+ 578,
863
+ 818,
864
+ 820
865
+ ],
866
+ "page_idx": 12
867
+ },
868
+ {
869
+ "type": "text",
870
+ "text": "C Detailed Related Work ",
871
+ "text_level": 1,
872
+ "bbox": [
873
+ 174,
874
+ 89,
875
+ 400,
876
+ 107
877
+ ],
878
+ "page_idx": 13
879
+ },
880
+ {
881
+ "type": "text",
882
+ "text": "RL for locomotion A common approach is to train RL agents from large amounts of simulated data under domain and dynamics randomization (Peng et al., 2018; Lee et al., 2020; Rudin et al., 2021; Siekmann et al., 2021; Escontrela et al., 2022; Miki et al., 2022; Kumar et al., 2021; Rusu et al., 2016; Bohez et al., 2022), then freezing the learned policy and deploying it to the real world. Smith et al. (2021) explored pre-training policies in simulation and fine-tuning them with real world data. Yang et al. (2019) investigate learning a dynamics model using a multi-step loss and using model predictive control to accomplish a specified task. Yang et al. (2022) train locomotion policies in the real world but require a recovery controller trained in simulation to avoid unsafe states. In contrast, we use no simulators or reset policies and directly train on the physical robot. While prior work in locomotion has successfully learned walking behaviors in the real world, these works generally required several domain-specific assumptions or pretraining with simulators. Ha et al. (2020) achieved successful walking on the Minitaur robot in 90 minutes. However, the authors manually programmed a reset policy that was used when the robot fell on its back, while in our work the robot must learn to flip over and stand up. Additionally, the Minitaur robot is simpler than the A1 as it has 8 actuators compared to 12 on the A1. In recent work, Smith et al. (2022) utilize a high update-to-data ratio (UTD) RL algorithm to learn walking from 20 minutes of robot training data. However, their work assumes the availability of a reset policy and therefore comprises of a different learning problem compared to the problem we tackle of learning to flip over and walk from scratch. Additionally, we show our approach generalizes to environments with image observations and sparse rewards. ",
883
+ "bbox": [
884
+ 173,
885
+ 117,
886
+ 825,
887
+ 397
888
+ ],
889
+ "page_idx": 13
890
+ },
891
+ {
892
+ "type": "text",
893
+ "text": "RL for manipulation Learning promises to enable robot manipulators to solve contact rich tasks in open real world environments. One class of methods attempts to scale up experience collection through a fleet of robots (Kalashnikov et al., 2018; 2021; Ebert et al., 2021; Dasari et al., 2019; Levine et al., 2018). In contrast, we only leverage one robot, but parallelize an agent’s experience by using the learned world model. Another common approach is to leverage expert demonstrations or other task priors (Pinto and Gupta, 2015; Ha and Song, 2021; Xie et al., 2019; Schoettler et al., 2019; Sivakumar et al., 2022). James and Davison (2021); James et al. (2021) leverages a few demonstrations to increase the sample-efficiency of Q learning by focusing the learner on important aspects of the scene. Other approaches, as in locomotion, first utilize a simulator, then transfer to the real world (Tzeng et al., 2015; Akkaya et al., 2019; OpenAI et al., 2018; Irpan et al., 2020). Our work focuses on single-robot environments where the agent must learn through a small amount of interaction with the world. Meanwhile, the Google Arm Farm line of work by Levine et al. leverages over $5 8 0 \\mathrm { k }$ grasp attempts gathered by 7 robots and collected over 4 months. We believe that a method such as Dreamer could benefit greatly from this scale of training data, however it is unlikely that works such as MT-OPT/QT-OPT Kalashnikov et al. (2018; 2021) would work well in the low data regime that Dreamer excels in. ",
894
+ "bbox": [
895
+ 173,
896
+ 404,
897
+ 825,
898
+ 638
899
+ ],
900
+ "page_idx": 13
901
+ },
902
+ {
903
+ "type": "text",
904
+ "text": "Model-based RL Due to its higher sample-efficiency over model-free methods, model-based RL is a promising approach to learning on real world robots (Deisenroth et al., 2013). A model based method first learns a dynamics model, which can then be used to plan actions (Nagabandi et al., 2019; Hafner et al., 2018; Chua et al., 2018; Nagabandi et al., 2017; Becker-Ehmck et al., 2020), or be used as a simulator to learn a policy network as in Dreamer (Hafner et al., 2019; 2020). One approach to tackle the high visual complexity of the world is to learn an action conditioned video prediction model (Finn and Levine, 2017; Ebert et al., 2018; Finn et al., 2016). One downside of this approach is the need to directly predict high dimensional observations, which can be computationally inefficient and easily drift. Dreamer learns a dynamics model in a latent space, allowing more efficient rollouts and avoids relying on high quality visual reconstructions for the policy. Another line of work proposes to learn latent dynamics models without having to reconstruct inputs (Deng et al., 2021; Okada and Taniguchi, 2021; Bharadhwaj et al., 2022; Paster et al., 2021), which we see as a promising approach for supporting moving view points in cluttered environments. ",
905
+ "bbox": [
906
+ 173,
907
+ 645,
908
+ 826,
909
+ 837
910
+ ],
911
+ "page_idx": 13
912
+ },
913
+ {
914
+ "type": "text",
915
+ "text": "D Hyperparameters ",
916
+ "text_level": 1,
917
+ "bbox": [
918
+ 173,
919
+ 89,
920
+ 359,
921
+ 108
922
+ ],
923
+ "page_idx": 14
924
+ },
925
+ {
926
+ "type": "table",
927
+ "img_path": "images/476b14497f73d983953dbe7a34cff454d210243e28b1aa97dafb54ae6a92e42f.jpg",
928
+ "table_caption": [],
929
+ "table_footnote": [],
930
+ "table_body": "<table><tr><td rowspan=1 colspan=1>Name</td><td rowspan=1 colspan=1>Symbol</td><td rowspan=1 colspan=1>Value</td></tr><tr><td rowspan=1 colspan=3>General</td></tr><tr><td rowspan=1 colspan=1>Replay capacity (FIFO)Start learningBatch sizeBatch lengthMLP sizeActivation</td><td rowspan=1 colspan=1>BT</td><td rowspan=1 colspan=1>10610432324× 512LayerNorm+ELU</td></tr><tr><td rowspan=1 colspan=3>World Model</td></tr><tr><td rowspan=1 colspan=1>RSSM sizeNumber of latentsClasses per latentKL balancing</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>51232320.8</td></tr><tr><td rowspan=1 colspan=3>Actor Critic</td></tr><tr><td rowspan=1 colspan=1>Imagination horizonDiscountReturn lambdaTarget update interval</td><td rowspan=1 colspan=1>H?</td><td rowspan=1 colspan=1>150.950.95100</td></tr><tr><td rowspan=1 colspan=3>All Optimizers</td></tr><tr><td rowspan=1 colspan=1>Gradient clippingLearning rateAdam epsilon</td><td rowspan=1 colspan=1>E</td><td rowspan=1 colspan=1>10010-410-6</td></tr></table>",
931
+ "bbox": [
932
+ 202,
933
+ 128,
934
+ 789,
935
+ 503
936
+ ],
937
+ "page_idx": 14
938
+ },
939
+ {
940
+ "type": "text",
941
+ "text": "E Environment and Hardware Details ",
942
+ "text_level": 1,
943
+ "bbox": [
944
+ 173,
945
+ 527,
946
+ 508,
947
+ 546
948
+ ],
949
+ "page_idx": 14
950
+ },
951
+ {
952
+ "type": "text",
953
+ "text": "For every robot setup that involved vision (UR5, XArm, Sphero), we used a RealSense D435 camera positioned to offer a fixed 3rd person view of the scene. ",
954
+ "bbox": [
955
+ 176,
956
+ 555,
957
+ 823,
958
+ 585
959
+ ],
960
+ "page_idx": 14
961
+ },
962
+ {
963
+ "type": "text",
964
+ "text": "A1 We used the A1 quadrupedal robot by Unitree. The RL policy outputs actions at a frequency that is too high for the PD controller to track, which we overcome by lowpass filtering the action sequence. The joint range allows the legs to self-collide with the body, which can be damaging to the motors and increase battery consumption. We limited the joint range to decrease self-collisions. Finally, the EKF velocity estimator relies on foot-ground contact events to prevent significant drift in the estimates, so we employ a curriculum reward function that does not reward the robot for forward velocity until the robot is upright with extended legs. We also designed a shell which we 3D printed in order to better protect the cables and hardware and provide a smoother rolling over. ",
965
+ "bbox": [
966
+ 173,
967
+ 590,
968
+ 825,
969
+ 709
970
+ ],
971
+ "page_idx": 14
972
+ },
973
+ {
974
+ "type": "text",
975
+ "text": "XArm & UR5 We utilized slanted bins to prevent objects from leaving the work area during the long-running pick and place experiments on the UR5, which is common practice Levine et al. (2018); Kalashnikov et al. (2018). We also added a partition behind the setup to keep the background constant. It would be interesting to study how a gripper-mounted camera would impact policy performance Hsu et al. (2022), however we report strong results without this design choice. For the XArm we use the uFactory xArm Gripper. For the UR5, we use the Robotiq 2F-85 parallel jaw gripper. The bin locations are predetermined and provided as part of the environment to prevent the robot from colliding with the bin. In addition, movement in the $\\textsf { Z }$ axis is only enabled while holding an object and the gripper automatically opens once above the other bin. ",
976
+ "bbox": [
977
+ 173,
978
+ 713,
979
+ 825,
980
+ 847
981
+ ],
982
+ "page_idx": 14
983
+ },
984
+ {
985
+ "type": "text",
986
+ "text": "Sphero We used a rectangular enclosure of $0 . 8 \\times 0 . 8 \\mathrm { { m ^ { 2 } } }$ to keep the sphero robot within the camera view. We used a simple OpenCV script to estimate the L2 distance between the Sphero and the goal position to provide a dense reward for policy optimization. This positional information was not provided to the agent, which it had to learn from the raw top-down images. ",
987
+ "bbox": [
988
+ 174,
989
+ 852,
990
+ 823,
991
+ 911
992
+ ],
993
+ "page_idx": 14
994
+ }
995
+ ]
parse/dev/3RBY8fKjHeu/3RBY8fKjHeu_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/3mRwyG5one/3mRwyG5one.md ADDED
@@ -0,0 +1,387 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DINO: DETR WITH IMPROVED DENOISING ANCHOR BOXES FOR END-TO-END OBJECT DETECTION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We present DINO (DETR with Improved deNoising anchOr boxes), a strong endto-end object detector. DINO improves over previous DETR-like models in performance and efficiency by using a contrastive way for denoising training, a look forward twice scheme for box prediction, and a mixed query selection method for anchor initialization. DINO achieves 49.4AP in 12 epochs and 51.3AP in 24 epochs on COCO with a ResNet-50 backbone and multi-scale features, yielding a significant improvement of $\mathbf { + 6 . 0 A P }$ and $+ 2 . 7 \mathbf { A P }$ , respectively, compared to DNDETR, the previous best DETR-like model. DINO scales well in both model size and data size. Without bells and whistles, after pre-training on the Objects365 dataset with a SwinL backbone, DINO obtains the best results on both COCO val2017 (63.2AP) and test-dev (63.3AP) with model size under 1 billion parameters. Compared to other models on the leaderboard, DINO achieves better results with smaller model size and pre-training data size. The code will be available.
8
+
9
+ ![](images/09292c7ac5626e70fb40266833b9aff30e1d4eb23022977f0ce894cdcfc56ca0.jpg)
10
+ Figure 1: AP on COCO compared with other detection models. (a) Comparison to models with a ResNet-50 backbone w.r.t. training epochs. Models marked with DC5 use a dilated larger resolution feature map. Other models use multi-scale features. (b) Comparison to SOTA models w.r.t. pretraining data size and model size. SOTA models are from the COCO test-dev leaderboard. In the legend we list the backbone pre-training data size (first number) and detection pre-training data size (second number). $^ *$ means the data size is not disclosed.
11
+
12
+ # 1 INTRODUCTION
13
+
14
+ Object detection is a fundamental task in computer vision. Remarkable progress has been accomplished by classical convolution-based object detection algorithms (Ren et al., 2017; Tian et al., 2019; Lin et al., 2020; Bochkovskiy et al., 2020; Ge et al., 2021). Despite that such algorithms normally include hand-designed components like anchor generation and non-maximum suppression (NMS), they yield the best detection models such as DyHead (Dai et al., 2021a), Swin (Liu et al., 2021b) and SwinV2 (Liu et al., 2021a) with $\mathrm { H T C + + }$ (Chen et al., 2019a), as evidenced on the COCO test-dev leaderboard (pap).
15
+
16
+ In contrast to classical detection algorithms, DETR (Carion et al., 2020) is a novel Transformerbased detection algorithm. It eliminates the need of hand-designed components and achieves comparable performance with optimized classical detectors like Faster RCNN (Ren et al., 2017). Different from previous detectors, DETR models object detection as a set prediction task and assigns labels by bipartite graph matching. It leverages learnable queries to probe the existence of objects and combine features from an image feature map like soft ROI pooling (Liu et al., 2022).
17
+
18
+ Despite its promising performance, it converges slow and the meaning of queries is unclear. To address such problems, many methods have been proposed, such as introducing deformable attention (Zhu et al., 2021), decoupling positional and content information (Meng et al., 2021), providing spatial priors (Gao et al., 2021; Yao et al., 2021; Wang et al., 2021), etc. Recently, DAB-DETR (Liu et al., 2022) proposes to formulate DETR queries as dynamic anchor boxes (DAB), which bridges the gap between classical anchor-based detectors and DETR-like ones. DN-DETR (Li et al., 2022) further accelerate convergence by introducing a denoising (DN) technique. These improvements promote the development of DETR-like models, while it remains not on the list of first-choice detectors in the field.
19
+
20
+ The best detection models nowadays are based on improved classical detectors like DyHead (Dai et al., 2021b) and HTC (Chen et al., 2019a). For example, the best result presented in SwinV2 (Liu et al., 2021a) was trained with the $\mathrm { H T C + + }$ (Chen et al., 2019a; Liu et al., 2021b) framework. Two main reasons contribute to the phenomenon: 1) Previous DETR-like models are inferior to the improved classical detectors. Most classical detectors have been well studied and highly optimized, leading to a better performance compared with the newly developed DETR-like models. 2) The performance of DETR-like model has not been tested on large backbone with large-scale pre-training data. We aim to address both concerns in this paper.
21
+
22
+ Specifically, by improving the denoising training, query initialization, and box prediction, we design a new DETR-like model based on DN-DETR, DAB-DETR, and Deformable DETR. We name our model as DINO (DETR with Improved deNoising anchOr box). As shown in Fig. 1, the comparison on COCO shows the superior performance of DINO. In particular, DINO demonstrates a strong performance, setting a new record of 63.3 AP for models with less than 1 billion parameters on the COCO test-dev leaderboard (pap).
23
+
24
+ As a DETR-like model, DINO contains a backbone, a multi-layer Transformer encoder, a multi-layer Transformer decoder, and multiple prediction heads. Following DAB-DETR, we formulate queries in decoder as dynamic anchor boxes and refine them step-by-step across decoder layers. Following DN-DETR, we add ground truth labels and boxes with noises into the Transformer decoder layers to help stabilize bipartite matching during training. We also adopt deformable attention (Zhu et al., 2021) for its computational efficiency. Moreover, we propose three new methods as follows. First, to reduce duplicate predictions, we propose a contrastive denoising training by adding both positive and negative samples of the same ground truth at the same time. After adding two different noises to the same ground truth box, we mark the box with a smaller noise as positive and the other as negative. The contrastive denoising training helps the model to predict more precise boxes and avoid duplicate outputs of the same target. Second, to overcome the shortsightedness of refining boxes in each decoder layer, which is a greedy way proposed in Deformable DETR, while keeping the advantages of fast convergence, we propose a new look forward twice scheme to correct the updated parameters with gradients from later layers. Third, the dynamic anchor box formulation of queries links DETR-like models with classical two-stage models. Hence we propose a mixed query selection method, which helps better initialize the queries. We select initial anchor boxes as positional queries from the output of the encoder, similar to (Zhu et al., 2021; Yao et al., 2021). However, we leave the content queries learnable queries aligned with CDN part where queries are also learnable queries which encourages the first decoder layer to focus on the spatial prior.
25
+
26
+ We validate the effectiveness of DINO with extensive experiments on the COCO (Lin et al., 2014) detection benchmarks. As shown in Fig. 1, DINO achieves 49.4AP in 12 epochs and 51.3AP in 24 epochs with ResNet-50 multi-scale features, yielding a significant improvement of $+ 6 . 0 \mathrm { A P }$ and $+ 2 . 7 \mathrm { A P }$ , respectively, compared to the previous best DETR-like model DN-DETR. In addition, DINO scales well in both model size and data size. After pre-training on the Objects365 (Shao et al., 2019) data set with a SwinL (Liu et al., 2021b) backbone, DINO achieves impressive results on both COCO val2017 (63.2AP) and test-dev (63.3AP) benchmarks, as shown in Table 4. Our DINO reduces the model size to 1/15 compared to SwinV2-G (Liu et al., 2021a). Moreover, DINO outperforms Florence (Yuan et al., 2021) with only 1/60 backbone pre-training dataset and 1/5 detection pre-training dataset.
27
+
28
+ To summarize, our contributions are three-fold. 1) We design a new end-to-end DETR-like object detector with several novel techniques, including contrastive denoising training, look forward twice, and mixed query selection for different parts of the DINO model. 2) We conduct intensive ablation studies to validate the effectiveness of different design choices in DINO. As a result, DINO achieves 49.4AP in 12 epochs and 51.3AP in 24 epochs with ResNet-50 and multi-scale features, significantly outperforming the previous best DETR-like model DN-DETR. 3) We show that, without bells and whistles, DINO can achieve the best performance on public benchmarks with model size under 1 billion parameters. After pre-training on the Objects365 (Shao et al., 2019) dataset with a SwinL (Liu et al., 2021b) backbone, DINO achieves 63.2AP on COCO val2017 and 63.3AP on COCO test-dev benchmarks.
29
+
30
+ # 2 RELATED WORK
31
+
32
+ Classical Object Detectors: Early convolution-based object detectors are either two-stage or onestage models, based on hand-crafted anchors or reference points. Two-stage models (Ren et al., 2015; He et al., 2017) usually use an region proposal network (RPN) (Ren et al., 2015) to propose potential boxes, which are then refined in the second stage. One-stage models (Redmon & Farhadi, 2017; 2018) directly output offsets relative to predefined anchors. Recently, some convolutionbased models such as $\mathrm { H T C + + }$ (Chen et al., 2019a) and Dyhead (Dai et al., 2021a) have achieved top performance on the COCO 2017 (Lin et al., 2014). The performance of convolution-based models, however, rely on the way they generate anchors and need hand-designed components like NMS.
33
+
34
+ DETR and Its Variants: Carion et al. (Carion et al., 2020) proposed a Transformer-based endto-end object detector named DETR (DEtection TRansformer) without using hand-designed components like anchor design and NMS. Many follow-up papers have attempted to address the slow training convergence issue of DETR introduced by decoder cross-attention. For instance, Dai et al. (Dai et al., 2021a) proposed a dynamic decoder to focus on important regions from multiple feature levels. Another line of works is towards a deeper understanding of decoder queries in DETR. Many papers associate queries with spatial position from different perspectives. Deformable DETR (Zhu et al., 2021) predicts 2D anchor points and designs a deformable attention module that only attends to certain sampling points around a reference point. DAB-DETR (Liu et al., 2022) further extends 2D anchor points to 4D anchor box coordinates to represent queries and dynamically update boxes in each decoder layer. Recently, DN-DETR (Li et al., 2022) introduces a denoising training method to speed up DETR training. It feeds noise-added ground-truth labels and boxes into the decoder and trains the model to reconstruct the original ones. Our work is based on DAB-DETR and DN-DETR, and also adopts deformable attention for its computational efficiency.
35
+
36
+ Large-scale Pre-training for Object Detection: The best performing detectors nowadays are mostly achieved with large backbones pre-trained on large-scale data. For example, Swin V2 (Liu et al., 2021a) extends its backbone size to 3.0 billion parameters and pre-trains its models with 70M privately collected images. Florence (Yuan et al., 2021) first pre-trains its backbone with 900M privately curated image-text pairs and then pre-trains its detector with 9M images with annotated or pseudo boxes. In contrast, DINO achieves better results with a publicly available SwinL (Liu et al., 2021b) backbone and a public dataset Objects365 (Shao et al., 2019) (1.7M annotated images) only.
37
+
38
+ # 3 DINO: DETR WITH IMPROVED DENOISING ANCHOR BOXES
39
+
40
+ # 3.1 PRELIMINARIES
41
+
42
+ As studied in Conditional DETR (Meng et al., 2021) and DAB-DETR (Liu et al., 2022), queries in DETR (Carion et al., 2020) are formed by two parts: a positional part and a content part, which are referred to as positional queries and content queries in this paper. DAB-DETR explicitly formulates each positional query in DETR as a 4D anchor box $( x , y , w , h )$ , where $x$ and $y$ are the center coordinates of the box and $w$ and $h$ correspond to its width and height. Such an explicit anchor box formulation makes it easy to dynamically refine anchor boxes layer by layer in the decoder.
43
+
44
+ DN-DETR (Li et al., 2022) introduces a denoising (DN) training method to accelerate the training convergence of DETR-like models. It shows that the slow convergence problem in DETR is caused by the instability of bipartite matching. To mitigate this problem, DN-DETR proposes to additionally feed noised ground-truth (GT) labels and boxes into the Transformer decoder and train the model to reconstruct the ground-truth ones. The noise $( \Delta x , \Delta y , \Delta w , \Delta h )$ is constrained by $\begin{array} { r } { | \Delta x | < \frac { \lambda w } { 2 } } \end{array}$ , $\begin{array} { r } { | \Delta y | < \frac { \lambda h } { 2 } } \end{array}$ , $| \Delta w | < \lambda w$ , and $| \Delta y | < \lambda h$ , where $( x , y , w , h )$ denotes a GT box and $\lambda ^ { 1 }$ is a hyper-parameter to control the scale of noise. Since DN-DETR view decoder queries as anchors, a noised GT box can be viewed as a special anchor with a GT box nearby as $\lambda$ is usually small. In addition to the orginal DETR queries, DN-DETR adds a DN part which feeds noised GT labels and boxes into the decoder to provide an auxiliary DN loss. The DN loss effectively stabilizes and speeds up the DETR training and can be plugged into any DETR-like models.
45
+
46
+ ![](images/d86496270b90288c296cdb39636814d2769f91dae43a238053cbfdd134e757ea.jpg)
47
+ Figure 2: The framework of our proposed DINO model. Our improvements are mainly in the Transformer encoder and decoder. The top-K encoder features in the last layer are selected to initialize the positional queries for the Transformer decoder. Our decoder also contains a Contrastive DeNoising (CDN) part with both positive and negative examples.
48
+
49
+ Deformable DETR (Zhu et al., 2021) is another early work to speed up the convergence of DETR. To compute deformable attention, it introduces the concept of reference point so that deformable attention can attend to a small set of key sampling points around a reference. The reference point concept makes it possible to develop several techniques to further improve the DETR performance. The first technique is query selection (or “two stage”), which selects features and reference boxes from the encoder as inputs to the decoder directly. The second technique is iterative bounding box refinement with a careful gradient detachment design between two decoder layers. We call this gradient detachment technique “look forward once” in our paper.
50
+
51
+ Following DAB-DETR and DN-DETR, DINO formulates the positional queries as dynamic anchor boxes and is trained with an extra DN loss. DINO additionally introduces three methods, which will be described in Sec. 3.3, Sec. 3.4, and Sec. 3.5, respectively.
52
+
53
+ # 3.2 MODEL OVERVIEW
54
+
55
+ As a DETR-like model, DINO is an end-to-end architecture which contains a backbone, a multilayer Transformer (Vaswani et al., 2017) encoder, a multi-layer Transformer decoder, and multiple prediction heads. The overall pipeline is shown in Fig. 2. Given an image, we extract multi-scale features with a backbone, and then feed them into the Transformer encoder with corresponding positional embeddings. After feature enhancement with the encoder layers, we propose a new mixed query selection strategy to initialize anchors as positional queries for the decoder. Note that this strategy does not initialize content queries but leaves them learnable. More details of mixed query selection are available in Sec. 3.5. With the initialized anchors and the learnable content queries, we use the deformable attention (Zhu et al., 2021) to combine the features of the encoder outputs and update the queries layer-by-layer. The final outputs are formed with refined anchor boxes and classification results predicted by refined content features. As in DN-DETR, we have an extra DN branch to perform denoising training. Beyond the standard DN method, we propose a new contrastive denoising training approach by taking into account hard negative samples, which will be presented in Sec. 3.3. To overcome the shortsightedness of the greedy way for box refinement in previous works, a novel look forward twice method is proposed to pass gradients between adjacent layers, which will be described in Sec. 3.4.
56
+
57
+ # 3.3 CONTRASTIVE DENOISING TRAINING
58
+
59
+ ![](images/13c20bfcfe457834257184103b729984c67cd3d9d423f0cfe2c264e9a4af6e82.jpg)
60
+ Figure 3: The structure of CDN group and a demonstration of positive and negative examples. Although both positive and negative examples are 4D anchors that can be represented as points in 4D space, we illustrate them as points in 2D space on concentric squares for simplicity. Assuming the square center is a GT box, points inside the inner square are regarded as a positive example and points between the inner square and the outer square are viewed as negative examples.
61
+
62
+ DN-DETR is effective in stabilizing training and accelerating convergence. With the help of DeNoising (DN) queries, it learns to make predictions based on noised Ground-Truth (GT) boxes, which leads to fast convergence. However, each DN query in DN-DETR is matched with a GT box and lacks the ability to predict background for “no object”. Since predicting background is also important for DETR-like model to reduce duplicate predictions, we propose a Contrastive DeNoising (CDN) approach to rejecting hard negative examples. To maximize the utilization of denoising queries, we also propose to use adaptive number of denoising groups.
63
+
64
+ Implementation: DN-DETR has a hyper-parameter $\lambda$ to control the noise scale. The generated noises are no larger than $\lambda$ as DN-DETR wants the model to reconstruct the ground truth (GT) from moderately noised queries. In our method, we have two hyper-parameters $\lambda _ { 1 }$ and $\lambda _ { 2 }$ , where $\lambda _ { 1 } < \lambda _ { 2 }$ . As shown in the concentric squares in Fig. 3, we generate two types of CDN queries: positive queries and negative queries. Positive queries within the inner square have a noise scale smaller than $\lambda _ { 1 }$ and are expected to reconstruct their corresponding ground truth boxes. Negative queries between the inner and outer squares have a noise scale larger than $\lambda _ { 1 }$ and smaller than $\lambda _ { 2 }$ . They are expected to predict “no object”. We usually adopt a small $\lambda _ { 2 }$ because hard negative samples closer to GT boxes can better help the model suppress duplicate predictions. As shown in Fig. 3, each CDN group has a set of positive queries and negative queries. If an image has $n$ GT boxes, a CDN group will have $2 \times n$ queries with each GT box generating both a positive and a negative queries. Similar to DN-DETR, we also use multiple CDN groups to improve the effectiveness of our method. The reconstruction losses are $l _ { 1 }$ and GIOU losses for box regression and focal loss (Lin et al., 2020) for classification. The loss to classify negative samples as background is also focal loss. Furthermore, to better utilize DN queries. We improve DN-DETR’s design of using a fixed number of denoising groups with an adaptive number of denoising groups. For each image, we fix the total number of denoising queries as $N$ . For an image with $n$ objects, the number of CDN groups is $\textstyle { \frac { N } { 2 n } }$ .
65
+
66
+ Analysis: The reason why CDN works is because it explicitly introduces hard negative examples that are very similar to positive example. Such negative examples encourage the model to learn subtle differences between positive and negative boxes for more precise box predictions. The ability to distinguish positive and negative example also enables the model to further reduce duplicate predictions on the basis of DETR. DETR eliminates the need of using NMS to suppress duplicate boxes. Instead, it relies on bipartite matching to pick up only one query for each GT box and suppress other queries by pushing them away or lowering their confidence. However, the suppressed queries are normally not hard negative. As a result, DETR cannot completely avoid duplicate boxes, especially for low confidence boxes. CDN addresses this issue by introducing explicitly designed negative queries, which further enhance the effect of bipartite matching on avoiding duplicate boxes. For example, on the COCO dataset, we compare CDN with its counterpart DN, both using 300 predictions. The numbers of duplicate predictions for each method are shown in Table 3.3. For all the thresholds from 0 to 0.3, CDN constantly predicts fewer duplicate boxes than DN.
67
+
68
+ <table><tr><td></td><td>Threshold</td><td>0.00</td><td>0.05</td><td>0.10</td><td>0.15</td><td>0.20</td><td>0.25</td><td>0.30</td></tr><tr><td>DN</td><td>total</td><td>292.65</td><td>158.51 31.53</td><td>59.91</td><td>24.16</td><td>10.26</td><td>3.94</td><td>0.52</td></tr><tr><td>CDN</td><td>duplicate total duplicate</td><td>67.91 292.65 53.72</td><td>164.62</td><td>9.63 60.21</td><td>3.53 23.45</td><td>1.30 9.90</td><td>0.53 3.83</td><td>0.26 0.62</td></tr></table>
69
+
70
+ Table 1: For a fair comparison, we only change CDN to DN and keep other hyper-parameters unchanged. For each model, we choose the top 300 predictions and filter them according to confidence scores with 7 thresholds from 0 to 0.3. For each threshold $t _ { i }$ , “total” and “duplicate” denote the numbers of total and duplicate predictions with scores greater than $t _ { i }$ , respectively. We view predictions with IoU $> 0 . 8$ as duplicate predictions.
71
+
72
+ ![](images/1832d565de87bfe4e2e84883e572bdc8c8adfdedc6c2d4ef16e0dff4ad4ca697.jpg)
73
+ Figure 4: (a)(b) Comparison of box update in Deformable DETR and our method. (c) APs of look forward once and look forward twice in each decoder layer. “LFO” and “LFT” denote look forward once and look forward twice, respectively.
74
+
75
+ # 3.4 LOOK FORWARD TWICE
76
+
77
+ We propose a new approach to improving box prediction in this section. The iterative box refinement in Deformable DETR blocks gradient back propagation to stabilize training. We name the method look forward once since the parameters of the $i$ -th decoder layer $L _ { i }$ are updated based on the auxiliary loss of boxes $b _ { i } ^ { ( p r e d ) }$ only, as shown in Fig 4 (a), where $b _ { i } ^ { ( p r e d ) }$ denotes the predicted boxes in $L _ { i }$ . Such a parameter update approach is a greedy method, in which each decoder layer approximates ground truth boxes individually while trying not to influence its previous layers by blocking gradient. Such a method stabilizes training and helps convergence in early training stages. However, it may lead to a sub optimal result. On the other hand, allowing gradient to propagate from all latter layers will make the model hard to converge. To address this issue, we propose to only allow $L _ { i - 1 }$ to be influenced by gradients from itself and $L _ { i }$ as shown in 4 (b). Since parameters in $L _ { i - 1 }$ are optimized to approximate ground truth boxes in both $L _ { i - 1 }$ and $L _ { i }$ , we name our method as look forward twice, which is more comprehensive compared with the look forward once method.
78
+
79
+ Implementation: We compare the implementations of look forward once (LFO) and look forward twice (LFT) as follows. Since LFO and LFT share the same process from $b _ { i - 1 } ^ { \prime }$ to $b _ { i } ^ { \prime }$ , we first show this process. Denote $b _ { i - 1 } ^ { \prime }$ and $b _ { i - 1 }$ as the boxes before and after stopping gradient. We have
80
+
81
+ $$
82
+ b _ { i - 1 } = \mathrm { s g } \left[ b _ { i - 1 } ^ { \prime } \right] ,
83
+ $$
84
+
85
+ where $\mathrm { s g } [ \cdot ]$ denotes stopping gradient. $b _ { i - 1 }$ is used as the input anchor box in $L _ { i }$ to obtain $\Delta { b } _ { i }$ as follows.
86
+
87
+ $$
88
+ \Delta b _ { i } = L _ { i } ( b _ { i - 1 } ; \theta _ { i } ) ,
89
+ $$
90
+
91
+ where $L _ { i }$ denotes the $i$ -th Decoder layer with $\theta _ { i }$ as its parameters. We ignore other inputs to $L _ { i }$ for simplicity. $b _ { i } ^ { \prime }$ is obtained as follows.
92
+
93
+ $$
94
+ b _ { i } ^ { \prime } = \sigma \left( \sigma ^ { - 1 } ( b _ { i - 1 } ) + \Delta b _ { i } \right) .
95
+ $$
96
+
97
+ where $\sigma ( \cdot )$ and $\sigma ^ { - 1 }$ denote the sigmoid and inverse sigmoid functions. Note that such a box update approach is to guarantee that the updated boxes have normalized $x , y , w , h$ values between 0 and 1. Equation 3 is marked with green line in Fig. 4(a) where gradients are propagated from $b _ { i } ^ { ( p r e d ) }$ to $\theta _ { i }$ through $\Delta { b } _ { i }$ . In LFO, the prediction $b _ { i } ^ { ( p r e d ) }$ is equal to $b _ { i } ^ { \prime }$ . While in LFT, we update box predictions $b _ { i } ^ { ( p r e d ) }$ based on $b _ { i - 1 } ^ { \prime }$ instead of $b _ { i - 1 }$ as follows.
98
+
99
+ $$
100
+ b _ { i } ^ { ( p r e d ) } = \sigma \left( \sigma ^ { - 1 } ( b _ { i - 1 } ^ { \prime } ) + \Delta b _ { i } \right) ,
101
+ $$
102
+
103
+ Equation 4 is marked with green line in Fig. 4(b). Similarly, $b _ { i + 1 } ^ { ( p r e d ) }$ is obtained as follows.
104
+
105
+ $$
106
+ b _ { i + 1 } ^ { ( p r e d ) } = \sigma \left( \sigma ^ { - 1 } ( b _ { i } ^ { \prime } ) + \Delta b _ { i + 1 } \right) = \sigma \left( \sigma ^ { - 1 } ( b _ { i - 1 } ^ { \prime } ) + \Delta b _ { i } + \Delta b _ { i + 1 } \right)
107
+ $$
108
+
109
+ Equation 5 is marked with red line in Fig. 4(b), where the gradients from $b _ { i + 1 } ^ { ( p r e d ) }$ are propagated to
110
+
111
+ Fig. 4 (c) shows a comparison of the performances of look forward once (LFO) and look forward twice (LFT) in different layers. For layer 0 to 2, LFO performs better than LFT. While LFT exceeds LFO in layer 3 to 6. This observation verifies our intuition that LFT sacrifices performance in early layers to achieve better final performance.
112
+
113
+ # 3.5 MIXED QUERY SELECTION
114
+
115
+ ![](images/1c7d2863f42f2e659cc24e717915aae607cf6cff84c46c9dd5bd1ef07d9c4631.jpg)
116
+ Figure 5: Comparison of three different query initialization methods. “static” means that queries will keep the same for different images in inference. A common implementation for these static queries is to make them learnable. Note that in (b) the selected reference points go through a positional encoding and linear transform to obtain the query embeddings as implemented in deformable DETR.
117
+
118
+ In DETR (Carion et al., 2020) and DN-DETR (Li et al., 2022), decoder queries are static embeddings without taking any encoder features from an individual image, as shown in Fig. 5 (a). They learn anchors or positional queries from training data and set the content queries as 0 vectors. Deformable DETR (Zhu et al., 2021) learns both the positional and content queries, which is another implementation of static query initialization. To further improve the performance, Deformable DETR (Zhu et al., 2021) has a query selection variant (or ”two-stage”). It selects positions with top $K$ classification scores as reference points and the content queries are linear transform of the positional embeddings of the reference points. In addition, features in the selected positions go through a classification head and a box head to calculate auxiliary loss. We call the implementation in Deformable DETR as vanilla query selection as shown in Fig. 5. Vanilla query selection helps the model converge especially in early training epochs. However, its content queries are not aligned with those in CDN part—the content queries in CDN part are learnable class embeddings. Therefore, we propose to use selected positions as anchors and learnable query embeddings as the content queries. We call our method as mixed query selection. We show in Table 5 that our simple and intuitive method achieves better result.
119
+
120
+ # 4 EXPERIMENTS
121
+
122
+ # 4.1 SETUP
123
+
124
+ Dataset and Backbone: We conduct evaluation on the COCO 2017 object detection dataset (Lin et al., 2014), which is split into train2017 and val2017 (also called minival). We report results with two different backbones: ResNet-50 (He et al., 2016) pre-trained on ImageNet-1k (Deng et al., 2009) and SwinL (Liu et al., 2021b) pre-trained on ImageNet-22k (Deng et al., 2009). DINO with ResNet-50 is trained on train2017 without extra data, while DINO with SwinL is first pretrained on Object365 (Shao et al., 2019) and then fine-tuned on train2017. We also report the test-dev results for DINO with SwinL.
125
+
126
+ Implementation Details: In appendix F, we provide implementation details, including all the hyperparameters and engineering techniques used in our models.
127
+
128
+ # 4.2 MAIN RESULTS
129
+
130
+ 12-epoch setting: With our improved anchor box denoising and training losses, the training process can be significantly accelerated. As shown in Table 2, we compare our method with strong baselines including both convolution-based methods (Ren et al., 2015; Chen et al., 2019a; Dai et al., 2021a) and DETR-like methods (Carion et al., 2020; Zhu et al., 2021; Dai et al., 2021b; Liu et al., 2022; Li et al., 2022). For a fair comparison, we report both GFLOPS and FPS tested on the same A100 NVIDIA GPU for all the models listed in Table 2. All methods except for DETR and DAB-DETR use multi-scale features. For those without multi-scale features, we report their results with ResNetDC5 which has a better performance for its use of a dilated larger resolution feature map. Since some methods adopt 5 scales of feature maps and some adopt 4, we report our results with both 4 and 5 scales of feature maps.
131
+
132
+ Table 2: Results for DINO and other detection models with the ResNet50 backbone on COCO val2017 trained with 12 epochs (the so called $1 \times$ setting). For models without multi-scale features, we test their GFLOPS and FPS for their best model ResNet-50-DC5. DINO uses 900 queries. † indicates models that use 900 queries or 300 queries with 3 patterns which has similar effect with 900 queries. Other DETR-like models except DETR (100 queries) uses 300 queries. ∗ indicates that they are tested using the mmdetection Chen et al. (2019b) framework.
133
+
134
+ <table><tr><td>Model</td><td>Epochs</td><td>AP</td><td>AP50</td><td>AP75</td><td>APs</td><td>APM</td><td>APL</td><td>GFLOPS</td><td>Params</td><td>FPS</td></tr><tr><td>Faster-RCNN(5scale) Ren et al. (2015)</td><td>12</td><td>37.9</td><td>58.8</td><td>41.1</td><td>22.4</td><td>41.1</td><td>49.1</td><td>207</td><td>40M</td><td>21*</td></tr><tr><td>DETR(DC5) Carion et al. (2020)</td><td>12</td><td>15.5</td><td>29.4</td><td>14.5</td><td>4.3</td><td>15.1</td><td>26.7</td><td>225</td><td>41M</td><td>20</td></tr><tr><td>Deformable DETR(4scale)Zhu et al.(2021)</td><td>12</td><td>41.1</td><td></td><td></td><td></td><td></td><td></td><td>196</td><td>40M</td><td>24</td></tr><tr><td>DAB-DETR(DC5)† Liu et al. (2022)</td><td>12</td><td>38.0</td><td>60.3</td><td>39.8</td><td>19.2</td><td>40.9</td><td>55.4</td><td>256</td><td>44M</td><td>17</td></tr><tr><td>Dynamic DETR(5scale) Dai et al.(2021b)</td><td>12</td><td>42.9</td><td>61.0</td><td>46.3</td><td>24.6</td><td>44.9</td><td>54.4</td><td></td><td>58M</td><td></td></tr><tr><td>Dynamic Head(5scale) Dai et al. (2021a)</td><td>12</td><td>43.0</td><td>60.7</td><td>46.8</td><td>24.7</td><td>46.4</td><td>53.9</td><td>1</td><td>一</td><td></td></tr><tr><td>HTC(5scale) Chen et al. (2019a)</td><td>12</td><td>42.3</td><td></td><td></td><td></td><td></td><td>一</td><td>441</td><td>80M</td><td>5*</td></tr><tr><td>DN-Deformable-DETR(4scale)† Li et al. (2022)</td><td>12</td><td>43.4</td><td>61.9</td><td>47.2</td><td>24.8</td><td>46.8</td><td>59.4</td><td>265</td><td>48M</td><td>23</td></tr><tr><td>DINO-4scale†</td><td>12</td><td>49.0(±5.6)</td><td>66.6</td><td>53.5</td><td>32.0(+7.2)</td><td>52.3</td><td>63.0</td><td>279</td><td>47M</td><td>24</td></tr><tr><td>DINO-5scale†</td><td>12</td><td>49.4(±6.0)</td><td>66.9</td><td>53.8</td><td>32.3(+7.5)</td><td>52.5</td><td>63.9</td><td>860</td><td>47M</td><td>10</td></tr></table>
135
+
136
+ <table><tr><td>Model</td><td>Epochs</td><td>AP</td><td>AP50</td><td>AP75</td><td>APs</td><td>APM</td><td>APL</td></tr><tr><td>Faster-RCNN Ren et al. (2015)</td><td>108</td><td>42.0</td><td>62.4</td><td>44.2</td><td>20.5</td><td>45.8</td><td>61.1</td></tr><tr><td>DETR(DC5) Zhu et al. (2021)</td><td>500</td><td>43.3</td><td>63.1</td><td>45.9</td><td>22.5</td><td>47.3</td><td>61.1</td></tr><tr><td>Deformable DETR Zhu et al. (2021)</td><td>50</td><td>46.2</td><td>65.2</td><td>50.0</td><td>28.8</td><td>49.2</td><td>61.7</td></tr><tr><td>SMCA-R Gao et al. (2021)</td><td>50</td><td>43.7</td><td>63.6</td><td>47.2</td><td>24.2</td><td>47.0</td><td>60.4</td></tr><tr><td>TSP-RCNN-R Sun et al.(2020)</td><td>96</td><td>45.0</td><td>64.5</td><td>49.6</td><td>29.7</td><td>47.7</td><td>58.0</td></tr><tr><td>Dynamic DETR(5scale) Dai et al. (2021a)</td><td>50</td><td>47.2</td><td>65.9</td><td>51.1</td><td>28.6</td><td>49.3</td><td>59.1</td></tr><tr><td>DAB-Deformable-DETR Liu et al. (2022)</td><td>50</td><td>46.9</td><td>66.0</td><td>50.8</td><td>30.1</td><td>50.4</td><td>62.5</td></tr><tr><td>DN-Deformable-DETR Li et al. (2022)</td><td>50</td><td>48.6</td><td>67.4</td><td>52.7</td><td>31.0</td><td>52.0</td><td>63.7</td></tr><tr><td>DINO-4scale</td><td>24</td><td>50.4(+1.8)</td><td>68.3</td><td>54.8</td><td>33.3</td><td>53.7</td><td>64.8</td></tr><tr><td>DINO-5scale</td><td>24</td><td>51.3(+2.7)</td><td>69.1</td><td>56.0</td><td>34.5</td><td>54.2</td><td>65.8</td></tr><tr><td>DINO-4scale</td><td>36</td><td>50.9(+2.3)</td><td>69.0</td><td>55.3</td><td>34.6</td><td>54.1</td><td>64.6</td></tr><tr><td>DINO-5scale</td><td>36</td><td>51.2(+2.6)</td><td>69.0</td><td>55.8</td><td>35.0</td><td>54.3</td><td>65.3</td></tr></table>
137
+
138
+ Table 3: Results for DINO and other detection models with the ResNet-50 backbone on COCO val2017 trained with more epochs (24, 36, or more).
139
+
140
+ As shown in Table 2, our method yields an improvement of $+ 5 . 6$ AP under the same setting using ResNet-50 with 4-scale feature maps and $+ 6 . 0$ AP with 5-scale feature maps. Our 4-scale model does not introduce much overhead in computation and the number of parameters. Moreover, our method performs especially well for small objects, gaining $+ 7 . 2$ AP with 4 scales and $+ 7 . 5$ AP with 5 scales.
141
+
142
+ Comparison with the best models with a ResNet-50 backbone: To validate the effectiveness of our method in improving both convergence speed and performance, we compare our method with several strong baselines using the same ResNet-50 backbone. Despite the most common 50-epoch setting, we adopt the 24 $( 2 \times )$ and 36 $( 3 \times )$ epoch settings since our method converges faster and yields only a smaller additional gain with 50-epoch training. The results in Table 3 show that, using only 24 epochs, our method achieves an improvement of $+ 1 . 8$ AP and $+ 2 . 7$ AP with 4 and 5 scales, respectively. Moreover, using 36 epochs in the $3 \times$ setting, the improvement increases to $+ 2 . 3$ and $+ 2 . 6$ AP with 4 and 5 scales, respectively. The convergence curve comparison is shown in Fig. 6. We also show our results using SwinL backbone without bells and whistles in Appendix B.
143
+
144
+ # 4.3 COMPARISON WITH SOTA MODELS
145
+
146
+ To compare with SOTA results, we use the publicly available SwinL (Liu et al., 2021b) backbone pre-trained on ImageNet-22K. We first pre-train DINO on the Objects365 (Shao et al., 2019) dataset and then fine-tune it on COCO. As shown in Table 4, DINO achieves the best results of 63.2AP and 63.3AP on COCO val2017 and test-dev with model size under 1 billion parameters, which demonstrate its strong scalability to larger model size and data size. Note that all the previous SOTA models in Table 4 do not use Transformer decoder-based detection heads $\mathrm { \Phi { H T C + + } }$ (Chen et al., 2019a) and DyHead (Dai et al., 2021a)). It is the first time that an end-to-end Transformer detector is established as a SOTA model on the leaderboard (pap). Compared with the previous SOTA
147
+
148
+ ![](images/cf40ec9c08f3c53c6f6a0d96f6dc993fb09e5b7d67171d840c5a56e27ec980a7.jpg)
149
+ Figure 6: Training convergence curves evaluated on COCO val2017 for DINO and two previous state-ofthe-art models with ResNet-50 using multi-scale features.
150
+
151
+ <table><tr><td>Method</td><td>Params</td><td>Backbone Pre-training Dataset</td><td>Detection Pre-training Dataset</td><td>Use Mask</td><td>End-to-end </td><td>val2017 (AP) w/o TTA</td><td>w/ TTA</td><td>test-dev (AP) w/o TTA w/ TTA</td></tr><tr><td>SwinL Liu et al. (2021b)</td><td>284M</td><td>IN-22K-14M</td><td>0365</td><td>√</td><td></td><td>58.0</td><td>57.7</td><td>58.7</td></tr><tr><td>DyHead Dai et al. (2021a)</td><td>≥ 284M</td><td>IN-22K-14M</td><td>Unknown*</td><td></td><td></td><td>58.4</td><td></td><td>60.6</td></tr><tr><td>Soft Teacher+SwinL Xu et al. (2021)</td><td>284M</td><td>IN-22K-14M</td><td>0365</td><td>√</td><td></td><td>60.7</td><td></td><td>61.3</td></tr><tr><td>GLIP Li et al. (2021)</td><td>≥ 284M</td><td>IN-22K-14M</td><td>FourODs Li et al. (2021),GoldG+ Kamath et al. (2021)</td><td></td><td></td><td>60.8</td><td></td><td>61.5</td></tr><tr><td>Florence-CoSwin-HYuan et al. (2021)</td><td>≥ 637M</td><td>FLD-900M Yuan et al. (2021)</td><td>FLD-9M Yuan et al. (2021)</td><td></td><td></td><td>62.0</td><td></td><td>62.4</td></tr><tr><td>SwinV2-G Liu et al. (2021a)</td><td>3.0B</td><td>IN-22K-ext-70M Liu et al. (2021a)</td><td>0365</td><td>√</td><td></td><td>62.5</td><td></td><td>63.1</td></tr><tr><td>DINO-SwinL(Ours)</td><td>218M</td><td>IN-22K-14M</td><td>0365</td><td></td><td>√</td><td>63.2</td><td>63.2</td><td>63.3</td></tr></table>
152
+
153
+ Table 4: Comparison of the best detection models on MS-COCO. Similar to DETR Carion et al. (2020), we use the term “end-to-end” to indicate if a model is free from hand-crafted components like RPN and NMS. The term “use mask” means whether a model is trained with instance segmentation annotations. We use the terms “IN” and $" \mathrm { O } 3 6 5 "$ to denote the ImageNet Deng et al. (2009) and Objects365 Shao et al. (2019) datasets, respectively. Note that $" \mathrm { O } 3 6 5 "$ is a subset of “FourODs” and “FLD-9M”. \* DyHead does not disclose the details of the datasets used for model pre-training.
154
+
155
+ models, we use a much smaller model size $( 1 / 1 5$ parameters compared with SwinV2-G (Liu et al., 2021a)), backbone pre-training data size $1 / 6 0$ images compared with Florence), and detection pretraining data size $\mathrm { { . 1 / 5 } }$ images compared with Florence), while achieving better results. In addition, our reported performance without test time augmentation (TTA) is a neat result without bells and whistles. These results effectively show the superior detection performance of DINO compared with traditional detectors.
156
+
157
+ # 4.4 ABLATION
158
+
159
+ <table><tr><td>#Row</td><td>QS</td><td>CDN</td><td>LFT</td><td>AP</td><td>AP50</td><td>AP75</td><td>APs</td><td>APM</td><td>APL</td></tr><tr><td>1.Optimized DN-Deformable DETR† Li et al. (2022)</td><td>No</td><td></td><td></td><td>46.3</td><td>63.8</td><td>50.3</td><td>28.2</td><td>49.6</td><td>61.7</td></tr><tr><td>2.Row1+CDN*</td><td>No</td><td>√</td><td></td><td>47.2</td><td>65.0</td><td>51.2</td><td>29.4</td><td>50.7</td><td>62.5</td></tr><tr><td>3.Row2+vanilla query selection Zhu et al. (2021)</td><td>Vanilla</td><td>√</td><td></td><td>47.8</td><td>65.6</td><td>52.5</td><td>31.1</td><td>51.1</td><td>62.5</td></tr><tr><td>4.Row2+mixed query selection</td><td>Mixed</td><td>√</td><td></td><td>48.6</td><td>66.0</td><td>52.9</td><td>31.3</td><td>51.9</td><td>62.7</td></tr><tr><td>5.DINO (ours,Row4+look forward twice)</td><td>Mixed</td><td>√</td><td>√</td><td>49.0</td><td>66.6</td><td>53.5</td><td>32.0</td><td>52.3</td><td>63.0</td></tr></table>
160
+
161
+ Table 5: Ablation comparison of the proposed algorithm components. We use the terms “QS”, “CDN”, and “LFT” to denote “Query Selection”, “Contrastive De-Noising Training”, and “Look Forward Twice”, respectively. † We propose an optimized DN-Deformable DETR with our technical improvements. The technical details are shown in Appendix A. ∗ We also use adaptive number of denoising groups here.
162
+
163
+ Effectiveness of New Algorithm Components: We validate the effectiveness of our proposed methods in Table 5. We build an optimized DN-Deformable DETR as our strong baseline, which performs better than the one in Table 2. We include all the pipeline optimization and engineering techniques (see section 4.1 and Appendix F) in the strong baseline. The result of the strong baseline is available in Table 5 Row 1. According to Table 5, our three new methods in DINO further improve the performance significantly even without considering any engineering techniques.
164
+
165
+ # 5 CONCLUSION
166
+
167
+ In this paper, we have presented a strong end-to-end Transformer detector DINO with contrastive denoising training, look forward twice, and mixed query selection, which significantly improves both the training efficiency and the final detection performance. As a result, DINO outperforms all previous ResNet-50-based models on COCO val2017 in both the 12-epoch and the 36-epoch settings using multi-scale features. Motivated by the improvement, we further explored to train DINO with a stronger backbone on a larger dataset and achieved a strong result, 63.3 AP on COCO 2017 test-dev. This result establishes DETR-like models as a mainstream detection framework, not only for its novel end-to-end detection optimization, but also for its superior performance.
168
+
169
+ # REFERENCES
170
+
171
+ Papers with code - coco test-dev benchmark (object detection). URL https:// paperswithcode.com/sota/object-detection-on-coco.
172
+
173
+ Alexey Bochkovskiy, Chien-Yao Wang, and Hong-Yuan Mark Liao. Yolov4: Optimal speed and accuracy of object detection. arXiv preprint arXiv:2004.10934, 2020.
174
+
175
+ 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, pp. 6154–6162, 2018.
176
+
177
+ 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, pp. 213–229. Springer, 2020.
178
+
179
+ Kai Chen, Jiangmiao Pang, Jiaqi Wang, Yu Xiong, Xiaoxiao Li, Shuyang Sun, Wansen Feng, Ziwei Liu, Jianping Shi, Wanli Ouyang, et al. Hybrid task cascade for instance segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4974–4983, 2019a.
180
+
181
+ Kai Chen, Jiaqi Wang, Jiangmiao Pang, Yuhang Cao, Yu Xiong, Xiaoxiao Li, Shuyang Sun, Wansen Feng, Ziwei Liu, Jiarui Xu, et al. Mmdetection: Open mmlab detection toolbox and benchmark. arXiv preprint arXiv:1906.07155, 2019b.
182
+
183
+ Tianqi Chen, Bing Xu, Chiyuan Zhang, and Carlos Guestrin. Training deep nets with sublinear memory cost. arXiv preprint arXiv:1604.06174, 2016.
184
+
185
+ Xiyang Dai, Yinpeng Chen, Bin Xiao, Dongdong Chen, Mengchen Liu, Lu Yuan, and Lei Zhang. Dynamic head: Unifying object detection heads with attentions. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7373–7382, 2021a.
186
+
187
+ Xiyang Dai, Yinpeng Chen, Jianwei Yang, Pengchuan Zhang, Lu Yuan, and Lei Zhang. Dynamic detr: End-to-end object detection with dynamic attention. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 2988–2997, October 2021b.
188
+
189
+ 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. Ieee, 2009.
190
+
191
+ Peng Gao, Minghang Zheng, Xiaogang Wang, Jifeng Dai, and Hongsheng Li. Fast convergence of detr with spatially modulated co-attention. arXiv preprint arXiv:2101.07448, 2021.
192
+
193
+ Zheng Ge, Songtao Liu, Feng Wang, Zeming Li, and Jian Sun. Yolox: Exceeding yolo series in 2021. arXiv preprint arXiv:2107.08430, 2021.
194
+
195
+ Agrim Gupta, Piotr Dollar, and Ross Girshick. Lvis: A dataset for large vocabulary instance seg- ´ mentation, 2019.
196
+
197
+ 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.
198
+
199
+ Kaiming He, Georgia Gkioxari, Piotr Dollar, and Ross Girshick. Mask r-cnn. In ´ Proceedings of the IEEE international conference on computer vision, pp. 2961–2969, 2017.
200
+
201
+ Aishwarya Kamath, Mannat Singh, Yann LeCun, Ishan Misra, Gabriel Synnaeve, and Nicolas Carion. Mdetr – modulated detection for end-to-end multi-modal understanding. arXiv: Computer Vision and Pattern Recognition, 2021.
202
+
203
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
204
+
205
+ Feng Li, Hao Zhang, Shilong Liu, Jian Guo, Lionel M Ni, and Lei Zhang. Dn-detr: Accelerate detr training by introducing query denoising. arXiv preprint arXiv:2203.01305, 2022.
206
+
207
+ Liunian Harold Li, Pengchuan Zhang, Haotian Zhang, Jianwei Yang, Chunyuan Li, Yiwu Zhong, Lijuan Wang, Lu Yuan, Lei Zhang, Jenq-Neng Hwang, et al. Grounded language-image pretraining. arXiv preprint arXiv:2112.03857, 2021.
208
+
209
+ 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 ´ European conference on computer vision, pp. 740–755. Springer, 2014.
210
+
211
+ Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense object detection. IEEE Transactions on Pattern Analysis and Machine Intelligence, 42(2):318– 327, 2020.
212
+
213
+ Shilong Liu, Feng Li, Hao Zhang, Xiao Yang, Xianbiao Qi, Hang Su, Jun Zhu, and Lei Zhang. DABDETR: Dynamic anchor boxes are better queries for DETR. arXiv preprint arXiv:2201.12329, 2022.
214
+
215
+ 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, 2021a.
216
+
217
+ 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, 2021b.
218
+
219
+ Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
220
+
221
+ Depu Meng, Xiaokang Chen, Zejia Fan, Gang Zeng, Houqiang Li, Yuhui Yuan, Lei Sun, and Jingdong Wang. Conditional detr for fast training convergence. arXiv preprint arXiv:2108.06152, 2021.
222
+
223
+ Paulius Micikevicius, Sharan Narang, Jonah Alben, Gregory Diamos, Erich Elsen, David Garcia, Boris Ginsburg, Michael Houston, Oleksii Kuchaiev, Ganesh Venkatesh, and Hao Wu. Mixed precision training, 2018.
224
+
225
+ Joseph Redmon and Ali Farhadi. Yolo9000: better, faster, stronger. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7263–7271, 2017.
226
+
227
+ Joseph Redmon and Ali Farhadi. Yolov3: An incremental improvement. arXiv preprint arXiv:1804.02767, 2018.
228
+
229
+ 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.
230
+
231
+ Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. IEEE Transactions on Pattern Analysis and Machine Intelligence, 39(6):1137–1149, 2017.
232
+
233
+ Hamid Rezatofighi, Nathan Tsoi, JunYoung Gwak, Amir Sadeghian, Ian Reid, and Silvio Savarese. Generalized intersection over union: A metric and a loss for bounding box regression. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 658–666, 2019.
234
+
235
+ Shuai Shao, Zeming Li, Tianyuan Zhang, Chao Peng, Gang Yu, Xiangyu Zhang, Jing Li, and Jian Sun. Objects365: A large-scale, high-quality dataset for object detection. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 8430–8439, 2019.
236
+
237
+ Zhiqing Sun, Shengcao Cao, Yiming Yang, and Kris Kitani. Rethinking transformer-based set prediction for object detection. arXiv preprint arXiv:2011.10881, 2020.
238
+
239
+ Zhi Tian, Chunhua Shen, Hao Chen, and Tong He. Fcos: Fully convolutional one-stage object detection. In 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 9627– 9636, 2019.
240
+
241
+ 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, pp. 5998–6008, 2017.
242
+ Yingming Wang, Xiangyu Zhang, Tong Yang, and Jian Sun. Anchor detr: Query design for transformer-based detector. arXiv preprint arXiv:2109.07107, 2021.
243
+ Mengde Xu, Zheng Zhang, Han Hu, Jianfeng Wang, Lijuan Wang, Fangyun Wei, Xiang Bai, and Zicheng Liu. End-to-end semi-supervised object detection with soft teacher. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 3060–3069, 2021.
244
+ Zhuyu Yao, Jiangbo Ai, Boxun Li, and Chi Zhang. Efficient detr: Improving end-to-end object detector with dense prior. arXiv preprint arXiv:2104.01318, 2021.
245
+ Lu Yuan, Dongdong Chen, Yi-Ling Chen, Noel Codella, Xiyang Dai, Jianfeng Gao, Houdong Hu, Xuedong Huang, Boxin Li, Chunyuan Li, et al. Florence: A new foundation model for computer vision. arXiv preprint arXiv:2111.11432, 2021.
246
+ Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. In ICLR 2021: The Ninth International Conference on Learning Representations, 2021.
247
+
248
+ # A OPTIMIZED DN-DEFORMABLE DETR
249
+
250
+ The optimized DN-Deformable DETR differs from the original DN-Deformable DETR in the following three parts. Firstly, the optimized DN-Deformable DETR adopts deformable attention in both encoder and decoder while the original one only adopts deformable attention in encoder. With deformable attention in decoder, the optimized one is able to use more decoder queries. For example, we use 900 here. Secondly, the optimized one use different weight for matcher and loss, while the original one follows DETR to use same weight for loss and matcher. For example, we use class weight 1.0 for loss and 2.0 for matcher. Finally, we set dropout rate to be 0. We find these three technical improvements can improve the performance.
251
+
252
+ # B RESULTS USING SWINL BACKBONE WITHOUT PRE-TRAINING ON OBJECT 365
253
+
254
+ We also evaluate our method on COCO val2017 with SwinL as backbone without pre-training on Object 365. The results are without any bells and whistles. We compare with other methods using Swin-L backbone.
255
+
256
+ Table 6: Results for DINO and other detection models with the SwinL backbone on COCO val2017.
257
+
258
+ <table><tr><td>Model</td><td>Epochs</td><td>AP</td><td>AP50</td><td>AP75</td><td>APs</td><td>APM</td><td>APL</td></tr><tr><td>Cascade Mask RCNN-SwinL Cai &amp; Vasconcelos (2018) HTC++-SwinL Chen et al. (2019a)</td><td>1 1</td><td>55.0</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>DINO-4scale-SwinL</td><td>36</td><td>57.1 58.0</td><td>1 76.7</td><td>1 63.4</td><td>一 41.3</td><td>1 61.9</td><td>1 73.7</td></tr><tr><td>DINO-5scale-SwinL</td><td>36</td><td>58.5</td><td>77.0</td><td>64.1</td><td>41.5</td><td>62.3</td><td>74.0</td></tr></table>
259
+
260
+ # C TEST TIME AUGMENTATIONS (TTA)
261
+
262
+ We aim to build an end-to-end detector that is free from hand-crafted components. However, to compare with traditional detection models, we also explore the use of TTA in DETR-like models. We only use it in our large model with the SwinL backbone. Our TTA does not obtain an inspiring gain compared with traditional detectors, but we hope our exploration may provide some insights for future studies.
263
+
264
+ We adopt multi-scale test and horizontal flip as TTA. However, the way of ensembling different augmentations in our method is different from that in traditional methods which usually output duplicate boxes. In traditional methods, the ensembling is done by first gathering predictions from all augmentations and ranked by a confidence score. Then, duplicate boxes are found and eliminated by NMS or box voting. The reason why predictions from all augmentations are gathered first is that duplicate boxes appear not only among different augmentations but also within one augmentation. This ensembling method decreases the performance for our method since DETR-like methods are not prone to output duplicate boxes since their set-based prediction loss inhibits duplicate predictions and ensembling may incorrectly remove true positive predictions (Carion et al., 2020). To address this issue, we designed a one-to-one ensembling method. Assume we have $n$ augmentations $A u g _ { 0 } , A u g _ { 1 } , . . . , A u g _ { n - 1 }$ , where $A u g _ { i }$ has predictions $\mathbf { O } ^ { i }$ and a pre-defined hyper-parameter weight $w ^ { i }$ . $\mathbf { O } ^ { i } = \left\{ \left( b _ { 0 } ^ { i } , l _ { 0 } ^ { i } , s _ { 0 } ^ { i } \right) , \left( b _ { 1 } ^ { i } , l _ { 1 } ^ { i } , s _ { 1 } ^ { i } \right) , . . . , \left( b _ { m - 1 } ^ { i } , l _ { m - 1 } ^ { i } , s _ { m - 1 } ^ { i } \right) \right\}$ where $b _ { j } ^ { i } , l _ { j } ^ { i }$ and ${ \bf \bar { \boldsymbol { s } } } _ { j } ^ { i }$ denote the $j$ -th boundbox, label and score, respectively. We let $A u g _ { 0 }$ be the main augmentation which is the most reliable one. For each prediction in ${ \bf O } ^ { 0 }$ , we select the prediction with the highest $I O U$ from predictions of each of other augmentations $\mathbf { O } ^ { 1 } , . . . , \mathbf { O } ^ { n - 1 }$ and make sure the $I O U$ is higher than a predefined threshold. Finally, we ensemble the selected boxes through weighted average as follows
265
+
266
+ $$
267
+ b = \frac { 1 } { \sum I ^ { i } } \sum _ { i = o } ^ { n - 1 } I ^ { i } w ^ { i } s _ { i d x ( i ) } ^ { i } b _ { i d x ( i ) } ^ { i }
268
+ $$
269
+
270
+ where $I ^ { i } = 1$ when there is at least one box in $\mathbf { O } ^ { i }$ with IOU higher than the threshold and $I ^ { i } = 0$ otherwise. $i d x ( i )$ denotes the index of the selected box in $\mathbf { O } ^ { i }$ .
271
+
272
+ # D TRAINING EFFICIENCY
273
+
274
+ We provide the GPU memory and training time for our base model in Table 7. All results are reported on 8 Nvidia A100 GPUs with ResNet-50 (He et al., 2016). The results demonstrate that our models are not only effective but also efficient for training.
275
+
276
+ <table><tr><td>Model</td><td>#images per GPU</td><td>Traning Time</td><td>GPU Mem.</td><td>Epoch</td><td>AP</td></tr><tr><td>Faster RCNN (Ren et al., 2015)*</td><td>8</td><td>~ 60min/ep</td><td>13GB</td><td>108</td><td>42.0</td></tr><tr><td>DETR(Carion et al.,2020)</td><td>8</td><td>~16min/ep</td><td>26GB</td><td>300</td><td>41.2</td></tr><tr><td>Deformable DETR (Zhu et al., 2021)*</td><td>2</td><td>~ 55min/ep</td><td>16GB</td><td>50</td><td>45.4</td></tr><tr><td>DINO(Ours)</td><td>2</td><td>~ 55min/ep</td><td>16GB</td><td>12</td><td>49.0</td></tr></table>
277
+
278
+ Table 7: Training efficieny for different models with ResNet-50 backbone. All models are trianed with 8 Nvidia A100 GPUs. All results are reported by us. \* The results of Faster RCNN are tested with the mmdetection framework. ⋆ We use the vanilla Deformable DETR without two-stage and bbox refinement during testing.
279
+
280
+ # E ADDITIONAL ANALYSIS ON OUR MODEL COMPONENTS
281
+
282
+ <table><tr><td rowspan=1 colspan=1>#Encoder/Decoder</td><td rowspan=1 colspan=1>6/6</td><td rowspan=1 colspan=1>4/6</td><td rowspan=1 colspan=1>3/6</td><td rowspan=1 colspan=1>2/6</td><td rowspan=1 colspan=1>6/4</td><td rowspan=1 colspan=1>6/2</td><td rowspan=1 colspan=1>2/4</td><td rowspan=1 colspan=1>2/2</td></tr><tr><td rowspan=1 colspan=1>AP</td><td rowspan=1 colspan=1>47.4</td><td rowspan=1 colspan=1>46.2</td><td rowspan=1 colspan=1>45.8</td><td rowspan=1 colspan=1>45.4</td><td rowspan=1 colspan=1>46.0</td><td rowspan=1 colspan=1>44.4</td><td rowspan=1 colspan=1>44.1</td><td rowspan=1 colspan=1>41.2</td></tr></table>
283
+
284
+ Table 8: Ablation on the numbers of encoder layers and decoder layers with the ResNet-50 backbone on COCO val2017. We use the 12-epoch setting and $1 0 0 \mathrm { D N }$ queries without negative samples here.
285
+
286
+ Analysis on the Number of Encoder and Decoder Layers: We also investigate the influence of varying numbers of encoder and decoder layers. As shown in Table 8, decreasing the number of decoder layers hurts the performance more significantly. For example, using the same 6 encoder layers while decreasing the number of decoder layers from 6 to 2 leads to a 3.0 AP drop. This performance drop is expected as the boxes are dynamically updated and refined through each decoder layer to get the final results. Moreover, we also observe that compared with other DETR-like models like Dynamic DETR (Dai et al., 2021a) whose performance drops by 13.8AP (29.1 vs 42.9) when decreasing the number of decoder layers to 2, the performance drop of DINO is much smaller. This is because our mixed query selection approach feeds the selected boxes from the encoder to enhance the decoder queries. Therefore, the decoder queries are well initialized and not deeply coupled with decoder layer refinement.
287
+
288
+ <table><tr><td rowspan=1 colspan=1>#Denoising query</td><td rowspan=1 colspan=1>100 CDN</td><td rowspan=1 colspan=1>1000 DN</td><td rowspan=1 colspan=1>200DN</td><td rowspan=1 colspan=1>100 DN</td><td rowspan=1 colspan=1>50 DN</td><td rowspan=1 colspan=1>10 DN</td><td rowspan=1 colspan=1>No DN</td></tr><tr><td rowspan=1 colspan=1>AP</td><td rowspan=1 colspan=1>47.9</td><td rowspan=1 colspan=1>47.6</td><td rowspan=1 colspan=1>47.4</td><td rowspan=1 colspan=1>47.4</td><td rowspan=1 colspan=1>46.7</td><td rowspan=1 colspan=1>46.0</td><td rowspan=1 colspan=1>45.1</td></tr></table>
289
+
290
+ Table 9: Ablation on number of denoising queries with the ResNet-50 backbone on COCO validation. Note that $1 0 0 { \mathrm { C N D } }$ query pairs contains 200 queries which are 100 positive and 100 negative queries.
291
+
292
+ Analysis on Query Denoising: We continue to investigate the influence of query denoising by varying the number of denoising queries. We use the optimized dynamic denoising group (detailed in Appendix F.1). As shown in Table 9, when we use less than 100 denoising queries, increasing the number can lead to a significant performance improvement. However, continuing to increase the DN number after 100 yields only a small additional or even worse performance improvement. We also analysis the effect of the number of encoder and decoder Layers in Appendix E.
293
+
294
+ # F MORE IMPLEMENTATION DETAILS
295
+
296
+ # F.1 ADAPTIVE DN GROUPS
297
+
298
+ In DN-DETR, all the GT objects (label+box) in one image are collected as one GT group for denoising. To improve the DN training efficiency, multiple noised versions of the GT group in an image are used during training. In DN-DETR, the number of groups is set to five or ten according to different model sizes. As DETR-like models adopt mini-batch training, the total number of DN queries for each image in one batch is padded to the largest one in the batch. Considering that the number of objects in one image in COCO dataset ranges from 1 to 80, this design is inefficient and results in excessive memory consumption. To address this problem, we propose to fix the number of DN queries and dynamically adjust the number of groups for each image according to its number of objects.
299
+
300
+ # F.2 LARGE-SCALE MODEL PRE-TRIANING
301
+
302
+ Objects365 (Shao et al., 2019) is a large-scale detection data set with over $1 . 7 M$ annotated images for training and 80, 000 annotated images for validation. To use the data more efficiently, We select the first 5, 000 out of 80, 000 validation images as our validation set and add the others to training. We pre-train DINO on Objects365 for 26 epochs using 64 Nvidia A100 GPUs and fine-tune the model on COCO for 18 epochs using 16 Nvidia A100 GPUS. Each GPU has a local batch size of 1 image only. In the fine-tuning stage, we enlarge the image size to $1 . 5 \times$ (i.e., with max size $1 2 0 0 \times 2 0 0 0 \textcircled { \cdot }$ ). This adds around 0.5 AP to the final result. To reduce the GPU memory usage, we leverage checkpointing (Chen et al., 2016) and mixed precision (Micikevicius et al., 2018) during training. Moreover, we use $1 0 0 0 \mathrm { D N }$ queries for this large model.
303
+
304
+ # F.3 OTHER IMPLEMENTATION DETAILS
305
+
306
+ # F.3.1 BASIC HYPER-PARAMETERS.
307
+
308
+ For hyper-parameters, as in DN-DETR, we use a 6-layer Transformer encoder and a 6-layer Transformer decoder and 256 as the hidden feature dimension. We set the initial learning rate (lr) as $1 \times 1 0 ^ { - 4 }$ and adopt a simple lr scheduler, which drops lr at the 11-th, 20-th, and 30-th epoch by multiplying 0.1 for the 12, 24, and 36 epoch settings with RestNet50, respectively. We use the AdamW (Kingma & Ba, 2014; Loshchilov & Hutter, 2017) optimizer with weight decay of $1 \times 1 0 ^ { - 4 }$ and train our model on Nvidia A100 GPUs with batch size 16. Since DN-DETR (Li et al., 2022) adopts 300 decoder queries and 3 patterns (Wang et al., 2021), we use $3 0 0 \times 3 = 9 0 0$ decoder queries with the same computation cost. Learning schedules of our DINO with SwinL are available in the appendix.
309
+
310
+ # F.3.2 LOSS FUNCTION.
311
+
312
+ We use the L1 loss and GIOU (Rezatofighi et al., 2019) loss for box regression and focal loss (Lin et al., 2020) with $\alpha = 0 . 2 5 , \gamma = 2$ for classification. As in DETR (Carion et al., 2020), we add auxiliary losses after each decoder layer. Similar to Deformable DETR (Zhu et al., 2021), we add extra intermediate losses after the query selection module, with the same components as for each decoder layer. We use the same loss coefficients as in DAB-DETR (Liu et al., 2022) and DNDETR (Li et al., 2022), that is, 1.0 for classification loss, 5.0 for L1 loss, and 2.0 for GIOU loss.
313
+
314
+ # F.3.3 DETAILED MODEL COMPONENTS.
315
+
316
+ We also optimize the detection pipeline used in DAB-DETR (Liu et al., 2022) and DN-DETR (Li et al., 2022). Following DN-Deformable-DETR (Li et al., 2022), we use the same multi-scale approach as in Deformable DETR (Zhu et al., 2021) and adopt the deformable attention. DN-DETR uses different prediction heads with unshared parameters in different decoder layers. In addition, we introduce dynamic denoising group to increase denoising training efficiency and alleviate memory overhead (see Appendix F.1). In this work, we find that using a shared prediction head will add additional performance improvement. This also leads to a reduction of about one million parameters.
317
+
318
+ Table 10: Hyper-parameters used in our models.
319
+
320
+ <table><tr><td rowspan=1 colspan=1>Item</td><td rowspan=1 colspan=1>Value</td></tr><tr><td rowspan=1 colspan=1>Ir</td><td rowspan=1 colspan=1>0.0001</td></tr><tr><td rowspan=1 colspan=1>lr_backbone</td><td rowspan=1 colspan=1>1e-05</td></tr><tr><td rowspan=1 colspan=1>weight_decay</td><td rowspan=1 colspan=1>0.0001</td></tr><tr><td rowspan=1 colspan=1>clip_max_norm</td><td rowspan=1 colspan=1>0.1</td></tr><tr><td rowspan=1 colspan=1>pe_temperature</td><td rowspan=1 colspan=1>20</td></tr><tr><td rowspan=1 colspan=1>enc_layers</td><td rowspan=1 colspan=1>6</td></tr><tr><td rowspan=1 colspan=1>dec_layers</td><td rowspan=1 colspan=1>6</td></tr><tr><td rowspan=1 colspan=1>dim_feedforward</td><td rowspan=1 colspan=1>2048</td></tr><tr><td rowspan=1 colspan=1>hidden_dim</td><td rowspan=1 colspan=1>256</td></tr><tr><td rowspan=1 colspan=1>dropout</td><td rowspan=1 colspan=1>0.0</td></tr><tr><td rowspan=1 colspan=1>nheads</td><td rowspan=1 colspan=1>8</td></tr><tr><td rowspan=1 colspan=1>num_queries</td><td rowspan=1 colspan=1>900</td></tr><tr><td rowspan=1 colspan=1>enc_n_points</td><td rowspan=1 colspan=1>4</td></tr><tr><td rowspan=1 colspan=1>dec_n_points</td><td rowspan=1 colspan=1>4</td></tr><tr><td rowspan=1 colspan=1>transformer_activation</td><td rowspan=1 colspan=1>&quot;relu&quot;</td></tr><tr><td rowspan=1 colspan=1>batch_norm_type</td><td rowspan=1 colspan=1>&quot;FrozenBatchNorm2d&quot;</td></tr><tr><td rowspan=1 colspan=1>set_cost_class</td><td rowspan=1 colspan=1>2.0</td></tr><tr><td rowspan=1 colspan=1>set_cost_bbox</td><td rowspan=1 colspan=1>5.0</td></tr><tr><td rowspan=1 colspan=1>set_cost_giou</td><td rowspan=1 colspan=1>2.0</td></tr><tr><td rowspan=1 colspan=1>cls_loss_coef</td><td rowspan=1 colspan=1>1.0</td></tr><tr><td rowspan=1 colspan=1>bbox_loss_coef</td><td rowspan=1 colspan=1>5.0</td></tr><tr><td rowspan=1 colspan=1>giou_loss_coef</td><td rowspan=1 colspan=1>2.0</td></tr><tr><td rowspan=1 colspan=1>focal_alpha</td><td rowspan=1 colspan=1>0.25</td></tr><tr><td rowspan=1 colspan=1>dn_box_noise_scale</td><td rowspan=1 colspan=1>0.4</td></tr><tr><td rowspan=1 colspan=1>dn_label_noise_ratio</td><td rowspan=1 colspan=1>0.5</td></tr></table>
321
+
322
+ In addition, we find the conditional queries (Meng et al., 2021) used in DAB-DETR does not suit our model and we do not include them in our final model.
323
+
324
+ # F.3.4 TRAINING AUGMENTATION.
325
+
326
+ We use the same random crop and scale augmentation during training following DETR (Carion et al., 2020). For example, we randomly resize an input image with its shorter side between 480 and 800 pixels and its longer side at most 1333. For DINO with SwinL, we pre-train the model using the default setting, but finetune using $1 . 5 \times$ larger scale (shorter side between 720 and 1200 pixels and longer side at most 2000 pixels) to compare with models on the leaderboard (pap). Without using any other tricks, we achieve the result of 63.1 on $\mathtt { v a l } 2 0 1 7$ and 63.2 on test-dev without test time augmentation (TTA) (see Appendix C), outperforming the previous state-of-the-art result 63.1 achieved by SwinV2 (Liu et al., 2021a) with a much neater solution.
327
+
328
+ # F.3.5 MULTI-SCALE SETTING.
329
+
330
+ For our 4-scale models, we extract features from stages 2, 3, and 4 of the backbone and add an extra feature by down-sampling the output of the stage 4. An additional feature map of the backbone stage 1 is used for our 5-scale models. For hyper-parameters, we set $\lambda _ { 1 } = 1 . 0$ and $\lambda _ { 2 } = 2 . 0$ and use 100 CDN pairs which contain 100 positive queries and 100 negative queries.
331
+
332
+ # F.4 DETAILED HYPER-PARAMETERS
333
+
334
+ We list the hyper-parameters for those who want to reproduce our results in Table 10.
335
+
336
+ Table 11: The inference speed and computation cost of our laege model.
337
+
338
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>#parameters</td><td rowspan=1 colspan=1>GFLOPs</td><td rowspan=1 colspan=1>FPs</td></tr><tr><td rowspan=1 colspan=1>DINO-Swin-L-4Scale</td><td rowspan=1 colspan=1>217.6</td><td rowspan=1 colspan=1>1284.5</td><td rowspan=1 colspan=1>8.1</td></tr><tr><td rowspan=1 colspan=1>DINO-Swin-L-5Scale</td><td rowspan=1 colspan=1>217.2</td><td rowspan=1 colspan=1>703.5</td><td rowspan=1 colspan=1>12.8</td></tr></table>
339
+
340
+ Table 12: The experiments of Look Forward Three (LF3) and Four times (LF4).
341
+
342
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>#epochs</td><td rowspan=1 colspan=1>AP</td><td rowspan=1 colspan=1>AP50</td><td rowspan=1 colspan=1>AP75</td><td rowspan=1 colspan=1>APs</td><td rowspan=1 colspan=1>APM</td><td rowspan=1 colspan=1>APL</td></tr><tr><td rowspan=1 colspan=1>DINO-LFT</td><td rowspan=1 colspan=1>12</td><td rowspan=1 colspan=1>49.0</td><td rowspan=1 colspan=1>66.6</td><td rowspan=1 colspan=1>53.5</td><td rowspan=1 colspan=1>32.0</td><td rowspan=1 colspan=1>52.3</td><td rowspan=1 colspan=1>63.0</td></tr><tr><td rowspan=1 colspan=1>DINO-LF3</td><td rowspan=1 colspan=1>12</td><td rowspan=1 colspan=1>48.3</td><td rowspan=1 colspan=1>65.5</td><td rowspan=1 colspan=1>52.7</td><td rowspan=1 colspan=1>31.2</td><td rowspan=1 colspan=1>51.7</td><td rowspan=1 colspan=1>62.5</td></tr><tr><td rowspan=1 colspan=1>DINO-LF4</td><td rowspan=1 colspan=1>12</td><td rowspan=1 colspan=1>48.2</td><td rowspan=1 colspan=1>65.4</td><td rowspan=1 colspan=1>52.9</td><td rowspan=1 colspan=1>30.4</td><td rowspan=1 colspan=1>51.8</td><td rowspan=1 colspan=1>62.9</td></tr></table>
343
+
344
+ # G INFERENCE SPEED AND GFLOPS
345
+
346
+ We list the inference cost of our 4-scale and 5-scale model with Swin-L backbones in Table 11. Note that our model for Table 4 is a 5-scale model.
347
+
348
+ # H WHY DINO IMPROVES AP ON SMALL OBJECTS BY LARGE
349
+
350
+ There are several reasons for the large AP improvement on small objects $( \mathsf { A P } _ { s } )$
351
+
352
+ 1. In Table 5, our optimized DN-Deformable DETR has $\mathsf { A P } _ { s }$ of 28.2 which is $+ 3 . 4$ higher than that of the original DN-Deformable DETR in Table 2. The original one uses dense attention in the decoder while the optimized one uses deformable attention which is better for local attention and therefore improves $\mathsf { A P } _ { s }$ . In addition, we fixed a problem in the original DN-Deformable DETR’s Transformer encoder—their deformable attention is not properly initialized using the initialization method in Deformable DETR. The Transformer encoder is a critical component that processes multi-scale image features and multi-scale image features are critical for small objects. Therefore, the optimized one has higher $\boldsymbol { \mathrm { A P } _ { s } }$ .
353
+ 2. In Table 5, we can see that CDN improves $\mathsf { A P } _ { s }$ by 1.2. By introducing negative noised queries, CDN encourages the model to pick up the anchor nearest to the center of a GT box to make predictions and explicitly suppresses farther anchors. Since small object detection is more sensitive to the quality of anchors, DINO with high-quality anchors can achieve better $\mathsf { A P } _ { s }$ .
354
+ 3. Query selection improves $\mathsf { A P } _ { s }$ by 1.9. Query selection provides high-quality anchor initialization which is especially beneficial to small objects. The reason is similar to reason 2 that small object detection is more sensitive to the quality of anchors.
355
+
356
+ # I MORE DETAILS ABOUT LOOK FORWARD TWICE (LFT)
357
+
358
+ We propose LFT because the original Look Forward Once scheme for box refinement is greedy, which will lead to sub-optimal results. We propose LFT to make the model far-sighted. But there is a trade-off. When we increase the number of layers to ”look forward”, the model becomes harder to converge. We conduct experiments of Look Forward Three and Four times as shown in Table 12. The results become worse when we continue to increase the number of layers to “look forward”.
359
+
360
+ Following is a detailed explanation of why LFT is worse than LFO in layers 0 to 2 but outperforms LFO in layers 3 to 6 as shown in Fig. 4.
361
+
362
+ There are actually three factors affecting the performance of layer $i$
363
+
364
+ 1. The performance of layer $i - 1$ . Since the predictions of layer $i$ are based on predictions of layer $i - 1$ , better predictions in layer $i - 1$ lead to better predictions in layer $i$ . 2. Whether allows gradients to backpropagate from layer $i$ to layer $i - 1$ . Allowing the gradient to propagate to layer $i - 1$ helps performance in layer $i$ .
365
+
366
+ 3. Whether allows gradients backpropagate from layer $i + 1$ to layer $i$ . Allowing gradient to propagate from layer $i + 1$ to layer $i$ jeopardizes performance in layer $i$ .
367
+
368
+ For layer 0, there is no layer $i - 1$ , so factors 1 and 2 do not affect the performance. According to factor 3, LFO is better than LFT.
369
+
370
+ For layers 1 to 5, LFO has an advantage in factor 3 and LFT has an advantage in factor 2. Because factor 2 affects the performance more than factor 3, The gap between LFT is narrowed down from layer 0 to 2 and LFT exceeds LFO in layer 3.
371
+
372
+ In the last layer (when $i = 6$ ), there is no layer $i + 1$ (factor 3 does not affect the result) and LFT has the advantage in both factors 1 and 2. Therefore, LFT exceeds LFO in the last layer.
373
+
374
+ # J VISUALIZATIONS
375
+
376
+ ![](images/6a36691552823614d7e3f1c95e109057b551e2e869c9fa7ce6b5cde1d89ee391.jpg)
377
+ Figure 7: Visualization of cases DINO outperforms DN-DETR.
378
+
379
+ We present a comparison of visualizations in Fig. 7. The results show that our DINO has better predictions than DN-DETR.
380
+
381
+ # K LVIS RESULTS
382
+
383
+ To evaluate DINO’s performance on other detection datasets, we conducted experiments on more challenging LVIS (Gupta et al., 2019) dataset.
384
+
385
+ Table 13: The results on LVIS val v1.0. ∗ denotes zero-shot results. † denotes DINO is trained for 12 epochs and is not fully conveged.
386
+
387
+ <table><tr><td rowspan=2 colspan=1>Model</td><td rowspan=2 colspan=1>Backbone</td><td rowspan=1 colspan=4>Val v1.0</td></tr><tr><td rowspan=1 colspan=1>AP</td><td rowspan=1 colspan=1>APr</td><td rowspan=1 colspan=1>APc</td><td rowspan=1 colspan=1>APf</td></tr><tr><td rowspan=1 colspan=1>Supervised-RFS (Gupta etal., 2019)</td><td rowspan=1 colspan=1>R50</td><td rowspan=1 colspan=1>25.4</td><td rowspan=1 colspan=1>12.3</td><td rowspan=1 colspan=1>24.3</td><td rowspan=1 colspan=1>32.4</td></tr><tr><td rowspan=1 colspan=1>MaskRCNN-LOCE (He et al., 2017)</td><td rowspan=1 colspan=1>R50</td><td rowspan=1 colspan=1>27.4</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>GLIP*(Li et al., 2021)</td><td rowspan=1 colspan=1>Swin-L</td><td rowspan=1 colspan=1>26.9</td><td rowspan=1 colspan=1>17.1</td><td rowspan=1 colspan=1>23.3</td><td rowspan=1 colspan=1>35.4</td></tr><tr><td rowspan=1 colspan=1>DINOt</td><td rowspan=1 colspan=1>R50</td><td rowspan=1 colspan=1>31.2</td><td rowspan=1 colspan=1>24.5</td><td rowspan=1 colspan=1>29.8</td><td rowspan=1 colspan=1>35.7</td></tr></table>
parse/dev/3mRwyG5one/3mRwyG5one_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/3mRwyG5one/3mRwyG5one_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/3mRwyG5one/3mRwyG5one_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/45L_dgP48Vd/45L_dgP48Vd_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/4oXTQ6m_ws8/4oXTQ6m_ws8.md ADDED
@@ -0,0 +1,363 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # THE ROLE OF IMAGENET CLASSES IN FRECHET ´ INCEPTION DISTANCE
2
+
3
+ Tuomas Kynka¨anniemi ¨
4
+ Aalto University
5
+ tuomas.kynkaanniemi@aalto.fi
6
+ Tero Karras
7
+ NVIDIA
8
+ tkarras@nvidia.com
9
+ Miika Aittala
10
+ NVIDIA
11
+ maittala@nvidia.com
12
+ Timo Aila
13
+ NVIDIA
14
+ taila@nvidia.com
15
+
16
+ Jaakko Lehtinen Aalto University & NVIDIA jlehtinen@nvidia.com
17
+
18
+ # ABSTRACT
19
+
20
+ Frechet Inception Distance (FID) is the primary metric for ranking models in data- ´ driven generative modeling. While remarkably successful, the metric is known to sometimes disagree with human judgement. We investigate a root cause of these discrepancies, and visualize what FID “looks at” in generated images. We show that the feature space that FID is (typically) computed in is so close to the ImageNet classifications that aligning the histograms of Top- $N$ classifications between sets of generated and real images can reduce FID substantially — without actually improving the quality of results. Thus, we conclude that FID is prone to intentional or accidental distortions. As a practical example of an accidental distortion, we discuss a case where an ImageNet pre-trained FastGAN achieves a FID comparable to StyleGAN2, while being worse in terms of human evaluation.
21
+
22
+ # 1 INTRODUCTION
23
+
24
+ Generative modeling has been an extremely active research topic in recent years. Many prominent model types, such as generative adversarial networks (GAN) (Goodfellow et al., 2014), variational autoencoders (VAE) (Kingma & Welling, 2014), autoregressive models (van den Oord et al., 2016b;a), flow models (Dinh et al., 2017; Kingma & Dhariwal, 2018) and diffusion models (SohlDickstein et al., 2015; Song & Ermon, 2019; Ho et al., 2020) have seen significant improvement. Additionally, these models have been applied to a rich set of downstream tasks, such as realistic image synthesis (Brock et al., 2019; Razavi et al., 2019; Esser et al., 2021; Karras et al., 2019; 2020b;a; 2021), unsupervised domain translation (Zhu et al., 2017; Choi et al., 2020; Kim et al., 2020), image super resolution (Ledig et al., 2017; Bell-Kligler et al., 2019; Saharia et al., 2021), image editing (Park et al., 2019; 2020; Huang et al., 2022) and generating images based on a text prompt (Ramesh et al., 2021; Nichol et al., 2022; Ramesh et al., 2022; Saharia et al., 2022).
25
+
26
+ Given the large number of applications and rapid development of the models, designing evaluation metrics for benchmarking their performance is an increasingly important topic. It is crucial to reliably rank models and pinpoint improvements caused by specific changes in the models or training setups. Ideally, a generative model should produce samples that are indistinguishable from the training set, while covering all of its variation. To quantitatively measure these aspects, numerous metrics have been proposed, including Inception Score (IS) (Salimans et al., 2016), Frechet Inception Dis- ´ tance (FID) (Heusel et al., 2017), Kernel Inception Distance (KID) (Binkowski et al., 2018), and Precision/Recall (Sajjadi et al., 2018; Kynka¨anniemi et al., 2019; Naeem et al., 2020). Among these ¨ metrics, FID continues to be the primary tool for quantifying progress.
27
+
28
+ The key idea in FID (Heusel et al., 2017) is to separately embed real and generated images to a vision-relevant feature space, and compute a distance between the two distributions, as illustrated in Figure 1. In practice, the feature space is the penultimate layer (pool3, 2048 features) of an ImageNet (Deng et al., 2009) pre-trained Inception-V3 classifier network (Szegedy et al., 2016), and the distance is computed as follows. The distributions of real and generated embeddings are separately approximated by multivariate Gaussians, and their alignment is quantified using the Frechet ´ (equivalently, the 2-Wasserstein or earth mover’s) distance (Dowson & Landau, 1982)
29
+
30
+ ![](images/75fd2412e138f4f98a15dbae2f6b9d917b48354f9edc07275e5e240c181da885.jpg)
31
+ Figure 1: Overview of the Frechet Inception Distance (FID) (Heusel et al., 2017). First, the real ´ and generated images are separately passed through a pre-trained classifier network, typically the Inception-V3 (Szegedy et al., 2016), to produce two sets of feature vectors. Then, both distributions of features are approximated with multivariate Gaussians, and FID is defined as the Frechet distance ´ between the two Gaussians. In Section 3, we will compute alternative FIDs in the feature spaces of logits and class probabilities, instead of the usual pre-logit space.
32
+
33
+ $$
34
+ \mathrm { F I D } \left( \mu _ { \mathrm { r } } , \Sigma _ { \mathrm { r } } , \mu _ { \mathrm { g } } , \Sigma _ { \mathrm { g } } \right) = \left\| \mu _ { \mathrm { r } } - \mu _ { \mathrm { g } } \right\| _ { 2 } ^ { 2 } + \mathrm { T r } \left( \Sigma _ { \mathrm { r } } + \Sigma _ { \mathrm { g } } - 2 \left( \Sigma _ { \mathrm { r } } \Sigma _ { \mathrm { g } } \right) ^ { \frac { 1 } { 2 } } \right) ,
35
+ $$
36
+
37
+ where $( \mu _ { \mathrm { r } } , \Sigma _ { \mathrm { r } } )$ , and $( \mu _ { \mathrm { g } } , \Sigma _ { \mathrm { g } } )$ denote the sample mean and covariance of the embeddings of the real and generated data, respectively, and $\operatorname { T r } ( \cdot )$ indicates the matrix trace. By measuring the distance between the real and generated embeddings, FID is a clear improvement over IS that ignores the real data altogether. FID has been found to correlate reasonably well with human judgments of the fidelity of generated images (Heusel et al., 2017; Xu et al., 2018; Lucic et al., 2018), while being conceptually simple and fast to compute.
38
+
39
+ Unfortunately, FID conflates the resemblance to real data and the amount of variation to a single value (Sajjadi et al., 2018; Kynka¨anniemi et al., 2019), and its numerical value is significantly af-¨ fected by various details, including the sample count (Binkowski et al., 2018; Chong & Forsyth, 2020), the exact instance of the feature network, and even low-level image processing (Parmar et al., 2022). Appendix A gives numerical examples of these effects. Furthermore, several authors (Karras et al., 2020b; Morozov et al., 2021; Nash et al., 2021; Borji, 2022; Alfarra et al., 2022) observe that there exists a discrepancy in the model ranking between human judgement and FID in nonImageNet data, and proceed to introduce alternative metrics. Complementary to these works, we focus on elucidating why these discrepancies exist and what exactly is the role of ImageNet classes.
40
+
41
+ The implicit assumption in FID is that the feature space embeddings have general perceptual relevance. If this were the case, an improvement in FID would indicate a corresponding perceptual improvement in the generated images. While feature spaces with approximately this property have been identified (Zhang et al., 2018), there are several reasons why we doubt that FID’s feature space behaves like this. First, the known perceptual feature spaces have very high dimensionality $( { \sim } 6 \mathbf { M } )$ , partially because they consider the spatial position of features in addition to their presence. Unfortunately, there may be a contradiction between perceptual relevance and distribution statistics. It is not clear how much perceptual relevance small feature spaces (2048D for FID) can have, but it is also hard to see how distribution statistics could be compared in high-dimensional feature spaces using a finite amount of data. Second, FID’s feature space is specialized to ImageNet classification, and it is thus allowed to be blind to any image features that fail to help with this goal. Third, FID’s feature space (“pre-logits”) is only one affine transformation away from the logits, from which a softmax produces the ImageNet class probabilities. We can thus argue that the features correspond almost directly to ImageNet classes (see Appendix B). Fourth, ImageNet classifiers are known to base their decisions primarily on textures instead of shapes (Geirhos et al., 2019; Hermann et al., 2020).
42
+
43
+ Together, these properties have important practical consequences that we set out to investigate. In Section 2 we use a gradient-based visualization technique, Grad-CAM (Selvaraju et al., 2017), to visualize what FID “looks at” in generated images, and observe that its fixation on the most prominent ImageNet classes makes it more interested in, for example, seat belts and suits, than the human faces in FFHQ (Karras et al., 2019). It becomes clear that when a significant domain gap exists between a dataset of interest and ImageNet, many of the activations related to ImageNet class templates are rather coincidental. We call such poorly fitting templates fringe features or fringe classes. As matching the distribution of such fringe classes between real and generated images becomes an obvious way of manipulating FID, we examine such “attacks” in detail in Section 3. The unfortunate outcome is that FID can be significantly improved – with hardly any improvement in the generated images – by selecting a subset of images that happen to match some number of fringe features with the real data. We conclude with an example of practical relevance in Section 4, showing that FID can be unreliable when ImageNet pre-trained discriminators (Sauer et al., 2021; Kumari et al., 2022) are used in GANs. Some of the improvement in FID comes from accidental leaking of ImageNet features, and the consequent better reproduction of ImageNet-like aspects in the real data. We hope that the new tools we provide open new opportunities to better understand the existing evaluation metrics and develop new ones in the future. Code is available at https://github.com/kynkaat/role-of-imagenet-classes-in-fid.
44
+
45
+ ![](images/c8d5fc42726051df23270c3455017ea5505a43813dd7fb6cf2be9368c44c91c5.jpg)
46
+ Figure 2: Visualizing which regions of an image FID is the most sensitive to. We augment the pre-computed feature statistics with a newly generated image, compute the FID, and use GradCAM (Selvaraju et al., 2017) to visualize the spatial importance in low-resolution feature maps that are subsequently upsampled to match the input resolution.
47
+
48
+ # 2 WHAT DOES FID LOOK AT IN AN IMAGE?
49
+
50
+ We will now inspect which parts of an image FID is the most sensitive to. We rely on GradCAM (Selvaraju et al., 2017) that has been extensively used for visualizing the parts of an image that contribute the most to the decisions of a classifier. We want to use it similarly for visualizing which parts of one generated image contribute the most to FID. A key challenge is that FID is defined only between large sets of images (50k), not for a single image. We address this difficulty by pre-computing the required statistics for a set of 49,999 generated images, and augmenting them with the additional image of interest. We then use Grad-CAM to visualize the parts of the image that have the largest influence on FID. We will first explain our visualization technique in more detail, followed by observations from individual images, and from aggregates of images.
51
+
52
+ Our visualization technique Figure 2 gives an outline of our visualization technique. Assume we have pre-computed the mean and covariance statistics $( \mu _ { \mathrm { r } } , \Sigma _ { \mathrm { r } } )$ and $( \mu _ { \mathrm { g } } , \Sigma _ { \mathrm { g } } )$ for 50,000 real and 49,999 generated images, respectively. These Gaussians are treated as constants in our visualization. Now, we want to update the statistics of the generated images by adding one new image. Computing the FID from the updated statistics allows us to visualize which parts of the added image influence it the most. Given an image, we feed it through the Inception-V3 network to get activations $A ^ { k }$ before the pool3 layer. The spatial resolution here is $8 \times 8$ and there are 2048 feature maps. The spatial averages of these feature maps correspond to the 2048-dimensional feature space where FID is calculated. We then update the pre-computed statistics $( \mu _ { \mathrm { g } } , \Sigma _ { \mathrm { g } } )$ by including the features $f$ of the new sample (Pebay, 2008): (µ′g = N−1N $\begin{array} { r } { ( \pmb { \mu } _ { \mathrm { g } } ^ { \prime } = \frac { N - 1 } { N } \pmb { \mu } _ { \mathrm { g } } + \frac { 1 } { N } \pmb { f } , \pmb { \Sigma } _ { \mathrm { g } } ^ { \prime } = \frac { N - 2 } { N - 1 } \pmb { \Sigma } _ { \mathrm { g } } + \frac { 1 } { N } ( \pmb { f } - \pmb { \mu } _ { \mathrm { g } } ) ^ { T } ( \pmb { f } - \pmb { \mu } _ { \mathrm { g } } ) ) } \end{array}$ . Here, $N = 5 0 , 0 0 0$ is the size of the updated set. To complete the forward pass, we evaluate FID using these modified statistics.
53
+
54
+ ![](images/17f9c6d4d92f31c1a7367318490a8d96fb04e42a85b052f83ef8535bf9e726af.jpg)
55
+ Figure 3: StyleGAN2 generated images along with heatmap visualizations of the image regions that FID considers important in FFHQ (top) and LSUN CAT (bottom). Yellow indicates regions that are more important and blue regions that are less important, i.e., modifying the content of the yellow regions affects FID most strongly. As many of the yellow areas are completely outside the intended subject, we sought an explanation from the ImageNet Top-3 class predictions. FID is very strongly focused on the area that corresponds to the predicted Top-1 class — whatever that may be. We discuss the qualitative difference between FFHQ and LSUN CAT in the main text.
56
+
57
+ In a backward pass, we first estimate the importance $\pmb { \alpha } _ { k }$ for each of the $k$ feature maps as
58
+
59
+ $$
60
+ \alpha _ { k } = \frac { 1 } { 8 \times 8 } \sum _ { i } \sum _ { j } \left. \frac { \partial \mathrm { F I D } ( \mu _ { \mathrm { r } } , \Sigma _ { \mathrm { r } } , \mu _ { \mathrm { g } } ^ { \prime } , \Sigma _ { \mathrm { g } } ^ { \prime } ) } { \partial A _ { i j } ^ { k } } \right. ^ { 2 }
61
+ $$
62
+
63
+ Then, an $8 \times 8$ -pixel spatial importance map is computed as a linear combination $\textstyle \sum _ { k } \alpha _ { k } A ^ { k }$ . Note that Selvaraju et al. (2017) originally suggested using a ReLU to only visualize the regions that have a positive effect on the probability of a given class; we do not employ this trick, since we are interested in visualizing both positive and negative effects on FID. Additionally, we upsample the importance map using Lanczos filtering to match the dimensions of the input image. Finally, we convert the values of the importance map to a heatmap visualization. See Appendix C for comparisons of our FID heatmaps and standard Grad-CAM.
64
+
65
+ Observations from individual images Figure 3 shows heatmaps of the most important regions for FID in FFHQ (Karras et al., 2019) and LSUN CAT (Yu et al., 2015). Given that in FFHQ the goal is to generate realistic human faces, the regions FID considers most important seem rather unproductive. They are typically outside the person’s face. To better understand why this might happen, recall that ImageNet does not include a “person” or a “face” category. Instead, some other fringe features (and thus classes) are necessarily activated for each generated image. Interestingly, we observe that the heatmaps seem to correspond very well with the areas that the image’s ImageNet Top-1 class prediction would occupy. Note that these ImageNet predictions were not used when computing the heatmap; they are simply a tool for understanding what FID was focusing on. As a low FID mandates that the distributions of the most prominent fringe classes are matched between real and generated images, one has to wonder how relevant it really is to match the distributions of “seat belt” or “oboe” in this dataset. In any case, managing to perform such matching would seem to open a possible loophole in FID; we will investigate this further in Section 3.
66
+
67
+ In contrast to human faces, ImageNet does include multiple categories of cats. This helps FID to much better focus on the subject matter in LSUN CAT, although some fringe features from the image background are still getting picked up, and a very low FID would require that “washbasin”, etc. are similarly detected in real and generated images.
68
+
69
+ ![](images/414e1d012b52a8307ff33c086b503af0298bd34dbba46f1fa06799136c1fea5a.jpg)
70
+ Figure 4: (a) Distribution of the ImageNet Top-1 classes, predicted by Inception-V3, for real and StyleGAN2 generated images in FFHQ. (b) Mean images and Grad-CAM heatmaps among all classes, and images classified as “bow tie”, “seat belt” and “mortarboard”. These were computed from generated images. Strikingly, when averaging over all classes, FID is the most sensitive to ImageNet objects that are located outside the face area.
71
+
72
+ Observations from aggregates of images Figure 4a shows the distribution of ImageNet Top-1 classifications for real and generated images in FFHQ. Typically, the predicted classes are accessories, but their presence might be correlated with persons in the images. In a further test, we calculated a heatmap of the average sensitivity over $5 0 \mathrm { k }$ generated images. Figure 4b shows average images and heatmaps for all classes, and for images that are classified to some specific class (e.g., “bow tie”). If we average over all classes, FID is the most sensitive to other areas of the image than the human face. If we compute a heatmap of the average sensitivity within a class, they highlight the regions where the corresponding ImageNet class is typically located in the images. Appendix C provides additional single image and average heatmaps. It also provides further validation that the image regions FID is the most sensitive to are correctly highlighted by our approach.
73
+
74
+ In related work, van Steenkiste et al. (2020) found that in images with multiple salient objects, FID focuses on only one of them and hypothesized that the metric could be easily fooled by a generative model that focuses on some image statistics (e.g., generating the correct number of objects) rather than content. They believe that this is because Inception-V3 is trained on a single object classification.
75
+
76
+ # 3 PROBING THE PERCEPTUAL NULL SPACE IN FID
77
+
78
+ Our findings with Grad-CAM raise an interesting question: to what extent could FID be improved by merely nudging the generator to produce images that get classified to the same ImageNet classes as the real data? As we are interested in a potential weakness in FID, we furthermore want this nudging to happen so that the generated results do not actually improve in any real sense. In our terminology, operations that change FID without changing the generated results in a perceptible way are exploiting the perceptual null space of FID.
79
+
80
+ We will first test a simple Top-1 (ImageNet classification) histogram matching between real and generated data. As this has only a modest impact on FID, we proceed to develop a more general distribution resampling method. This approach manages to reduce FID very significantly, indicating that there exists a large perceptual null space in FID. We then explore the role of other likely class labels, in addition to the Top-1 label, by aligning the Top- $N$ histograms. In Section 4 we observe that this theoretical weakness also has practical relevance.
81
+
82
+ In our experiments, we use StyleGAN2 auto-config trained in $2 5 6 \times 2 5 6$ resolution without adaptive discriminator augmentation (ADA). The only exception is AFHQ-V2 DOG, where we enable ADA and train in $5 1 2 \times 5 1 2$ resolution.1 Following standard practice, we compute FID against the training set, using $5 0 \mathrm { k }$ randomly chosen real and generated images and the official TensorFlow version of Inception-V3.2 A difference between our FIDs for StyleGAN2 and the ones reported by Karras et al. (2020a) is caused by the use of different training configurations.
83
+
84
+ Table 1: Results of Top-1 histogram matching. We compare the FID of randomly sampled images (FID) against ones that have been resampled to match the Top-1 histogram of the training data $\mathrm { ( F I D ^ { T o p - 1 } } \cdot$ ). The numbers represent averages over five FID evaluations. Additionally, we report the corresponding numbers by replacing the Inception-V3 feature space with ResNet-50 $\mathrm { ( F I D _ { R e s N e t - 5 0 } ) }$ , SwAV $\mathrm { ( F I D _ { S w A V } ) }$ , and CLIP features $\mathrm { ( F I D _ { C L I P } ) }$ . Note that we use these alternative feature spaces only when computing FID; the resampling is still done using Inception-V3. The numerical values between different features spaces are not comparable.
85
+
86
+ <table><tr><td>Dataset</td><td>FID</td><td>FIDTop-1</td><td>FIDResNet-50</td><td></td><td>FIDswAV</td><td>FIDSA</td><td>FIDcLIP</td><td>FIDCLI Top-1</td></tr><tr><td>FFHQ</td><td>5.30</td><td>4.70 (-11.3%)</td><td>6.11</td><td>5.59 (-8.5%)</td><td>1.42</td><td>1.41 (-0.7%)</td><td>2.76</td><td>2.74 (-0.7%)</td></tr><tr><td>LSUN CAT</td><td>8.25</td><td>7.37 (-10.7%)</td><td>12.33</td><td>11.29 (-8.4%)</td><td>2.99</td><td>2.96 (-1.0%)</td><td>8.94</td><td>8.83 (-1.2%)</td></tr><tr><td>LSUN CAR</td><td>5.65</td><td>5.17 (-8.5%)</td><td>8.79</td><td>8.51 (-3.2%)</td><td>2.39</td><td>2.38 (-0.4%)</td><td>7.75</td><td>7.73 (-0.3%)</td></tr><tr><td>LSUN PLACES</td><td>12.96</td><td>11.76 (-9.3%)</td><td>15.20</td><td>13.61 (-10.5%)</td><td>3.12</td><td>3.02 (-3.2%)</td><td>16.35</td><td>16.17 (-1.1%)</td></tr><tr><td>AFHQ-V2 DOG</td><td>10.25</td><td>9.39 (-8.4%)</td><td>13.71</td><td>13.19 (-3.8%)</td><td>2.78</td><td>2.77 (-0.4%)</td><td>4.25</td><td>4.16 (-2.1%)</td></tr></table>
87
+
88
+ Top-1 histogram matching Based on the Grad-CAM visualizations in Section 2, one might suspect that to achieve a low FID, it would be sufficient to match the Top-1 class histograms between the sets of real and generated images. We tested this hypothesis by computing the Top-1 histogram for $5 0 \mathrm { k }$ real images, and then sampling an equal number of unique generated images for each Top-1 class. This was done by looking at the class probabilities at the output of the Inception-V3 classifier (Figure 1), and discarding the generated images that fall into a bin that is already full. Over multiple datasets, this simple Top-1 histogram matching consistently improves FID, by $\sim 1 0 \%$ (Table 1).
89
+
90
+ Does this mean that the set of generated images actually improved? A genuine improvement should also be clearly visible in FIDs computed using alternative feature spaces. To this end, we calculated FIDs in the feature spaces of a ResNet-50 ImageNet classifier $( \mathrm { F I D } _ { \mathrm { R e s N e t } - 5 0 } )$ (He et al., 2016), selfsupervised SwAV classifier $\mathrm { ( F I D _ { S w A V } ) }$ (Caron et al., 2020; Morozov et al., 2021), and CLIP image encoder $\mathrm { ( F I D _ { C L I P } ) }$ (Radford et al., 2021; Sauer et al., 2021).3 Interestingly, $\mathrm { F I D } _ { \mathrm { R e s N e t - } 5 0 }$ drops almost as much as the original FID, even though the resampling was carried out with the Inception-V3 features. This makes sense because both feature spaces are necessarily very sensitive to the ImageNet classes. $\mathrm { F I D } _ { \mathrm { S w A V } }$ drops substantially less, probably because it was never trained to classify the ImageNet data. The muted decrease in $\mathrm { F I D } _ { \mathrm { C L I P } }$ is also in line with expectations because CLIP never saw ImageNet data; it was trained with a different task of matching images with captions. 4 We can thus conclude that the observed decrease in FID is closely related to the degree of ImageNet pre-training, and that the alternative feature spaces fail to confirm a clear increase in the result quality.
91
+
92
+ As a ten percent reduction in FID may not be significant enough for a human observer to draw reliable conclusions from the sets of generated images, we proceed to generalize the histogram matching to induce a much larger drop in FID.
93
+
94
+ Matching all fringe features We will now design a general technique for resampling the distribution of generated images, with the goal of approximately matching all fringe features. We will subsequently modify this approach to do Top- $. N$ histogram matching, as extending the simple “draw samples until it falls into the right bin”-approach for Top- $N$ would be computationally infeasible.
95
+
96
+ Our idea is to first generate a larger set of candidate images $5 \times$ oversampling), and then carefully select a subset of these candidates so that FID decreases. We approach this by directly optimizing FID as follows. First, we select a candidate set of 250k generated images and compute their Inception-V3 features. We then assign a non-negative scalar weight $w _ { i }$ to each generated image, and optimize the weights to minimize FID computed from weighted means and covariances of the generated images. After optimization, we use the weights as sampling probabilities and draw 50k random samples with replacement from the set of $2 5 0 \mathrm { k }$ candidate images. More precisely, we optimize
97
+
98
+ $$
99
+ \operatorname* { m i n } _ { \pmb { w } } \left( \left\| \pmb { \mu } _ { \mathrm { r } } - \pmb { \mu } _ { \mathrm { g } } ( \pmb { w } ) \right\| _ { 2 } ^ { 2 } + \operatorname { T r } \left( \pmb { \Sigma } _ { \mathrm { r } } + \pmb { \Sigma } _ { \mathrm { g } } ( \pmb { w } ) - 2 \left( \pmb { \Sigma } _ { \mathrm { r } } \pmb { \Sigma } _ { \mathrm { g } } ( \pmb { w } ) \right) ^ { \frac { 1 } { 2 } } \right) \right) ,
100
+ $$
101
+
102
+ where $\begin{array} { r } { \mu _ { \mathrm { g } } ( { \pmb w } ) = \frac { \sum _ { i } w _ { i } { \pmb f } _ { i } } { \sum _ { i } w _ { i } } } \end{array}$ and $\begin{array} { r l r } { \Sigma _ { \mathrm { g } } ( w ) } & { { } = } & { \frac { 1 } { \sum _ { i } w _ { i } } \sum _ { i } w _ { i } \left( f _ { i } - \mu _ { \mathrm { g } } ( w ) \right) ^ { T } \left( f _ { i } - \mu _ { \mathrm { g } } ( w ) \right) } \end{array}$ are the weighted mean and covariance of generated features $f _ { i }$ , respectively. In practice, we optimize the weights in Equation 3 via gradient descent. We parameterize the weights as $\log ( w _ { i } )$ to avoid negative values and facilitate easy conversion to probabilities. Note that we do not optimize the parameters of the generator network, only the sampling weights that are assigned to each generated image in the candidate set. Optimizing FID directly in this way is a form of adversarial attack, but not nearly as strong as modifying the images or the generator to directly attack the Inception-V3 network. In any case, our goal is only to elucidate the perceptual null space in FID, and we do not advocate this resampling step to improve the quality of models (Issenhuth et al., 2022; Humayun et al., 2022).
103
+
104
+ Table 2: Results of matching all fringe features. We compare the FID of randomly sampled images (FID) against ones that have been resampled to approximately match all fringe features with the training data $\mathrm { ( F I D ^ { P L } ) }$ ). The numbers represent averages over ten FID evaluations. $\mathrm { F I D } _ { \mathrm { R e s N e t - } 5 0 }$ , $\mathrm { F I D } _ { \mathrm { S w A V } }$ , $\mathrm { F I D } _ { \mathrm { C L I P } }$ match the descriptions in Table 1. The gray column $\mathrm { ( F I D ^ { L } ) }$ shows an additional experiment where the resampling is done using logits instead of the usual pre-logits.
105
+
106
+ <table><tr><td>Dataset</td><td>FID</td><td>FIDPL</td><td></td><td>FIDL</td><td>FIDResNet-50</td><td></td><td>FIDResNet-50</td><td>FIDswAV</td><td>FID5wAV</td><td></td><td>FIDcLIP</td><td>FIDCLIP</td></tr><tr><td>FFHQ</td><td>5.30</td><td>1.78 (-66.4%) 2.22 (-58.1%)</td><td></td><td></td><td></td><td>6.11</td><td>3.85 (-37.0%)</td><td></td><td>1.42</td><td>1.24 (-12.7%)</td><td>2.76</td><td>2.64 (-4.3%)</td></tr><tr><td>LSUN CAT</td><td>8.25</td><td>3.05 (-63.0%) 3.88 (-53.0%)</td><td></td><td></td><td></td><td>12.33</td><td>7.17 (-41.8%)</td><td></td><td>2.99</td><td>2.71 (-9.4%)</td><td>8.94</td><td>7.98 (-10.7%)</td></tr><tr><td>LSUN CAR</td><td>5.65</td><td>2.11 (-62.7%)</td><td></td><td>2.59 (-54.2%)</td><td></td><td>8.79</td><td>5.88 (-33.1%)</td><td></td><td>2.39</td><td>2.15 (-10.0%)</td><td>7.75</td><td>7.33 (-5.4%)</td></tr><tr><td>LSUN PLACES</td><td>12.96</td><td>3.59 (-72.3%) 4.43(-65.8%)</td><td></td><td></td><td></td><td>15.20</td><td>9.35 (-38.5%)</td><td></td><td>3.12</td><td>2.60 (-16.7%)</td><td>16.35</td><td>14.54 (−11.1%)</td></tr><tr><td>AFHQ-V2 DOG</td><td>10.25</td><td>5.92 (-42.2%) 6.27 (-38.8%)</td><td></td><td></td><td></td><td>13.71</td><td>11.38 (-17.1%)</td><td></td><td>2.78</td><td>2.62 (-5.8%)</td><td>4.25</td><td>4.04 (-4.9%)</td></tr></table>
107
+
108
+ ![](images/4e58f1d91cda2847754e370d87091c5a046a0706d0f33cce0408d88f27548fee.jpg)
109
+ Figure 5: Uncurated random StyleGAN2 samples from images with (a) the smallest $1 0 \%$ of weights and (b) the largest $1 0 \%$ of weights after optimizing the weights to improve FID. Both sets contain both realistic images and images with clear visual artifacts in roughly equal proportions. See Appendix D for a larger sample.
110
+
111
+ Table 2 shows that FIDs can be drastically reduced using this approach. An improvement by as much as $60 \%$ would be considered a major breakthrough in generative modeling, and it should be completely obvious when looking at the generated images. Yet, the uncurated grids in Appendix D fail to demonstrate an indisputable improvement. To confirm the visual result quantitatively, we again compute FIDs of the resampled distributions in the alternative feature spaces. We see a substantially smaller improvement in feature spaces that did not use ImageNet classifier pre-training. While it is possible that the generated results actually improved in some minor way, we can nevertheless conclude that a vast majority of the improvement in FID occurred in its perceptual null space, and that this null space is therefore quite large. In other words, FID can be manipulated to a great extent through the ImageNet classification probabilities, without meaningfully improving the generated results.
112
+
113
+ Figure 5 further shows images that obtain small and large weights in the optimization; it is not obvious that there is a visual difference between the sets, indicating that the huge improvement in FID $( - 6 6 . 4 \% )$ cannot be simply attributed to discarding images with clear artifacts. Appendix D also shows that the resampling fools KID just as thoroughly as FID, even though we do not directly optimize KID.
114
+
115
+ Finally, it makes only a small difference whether the weight optimization is done in the typical pre-logit space (denoted $\mathrm { F I D } ^ { \mathrm { P L } }$ ) or in the logit space $\mathrm { ( F I D ^ { L } ) }$ , confirming that these spaces encode approximately the same information. Figure 1 illustrates the difference between these spaces.
116
+
117
+ Top- $N$ histogram matching The drastic FID reduction observed in the previous section provides clues about the upper bound of the size of the perceptual null space. We will now further explore the nature of this null space by extending our resampling method to approximate Top- $N$ histogram matching. Then, by sweeping over $N$ , we can gain further insights to how important the top classification results are for FID.
118
+
119
+ ![](images/46fa363053dc4023ce6130a8893e63917cd49bbcde8fd9e80ade6fdf8df6ef87.jpg)
120
+ Figure 6: Softly matching Top-N class distributions in FFHQ through resampling. FID (solid curves, left-hand $y$ scale) decreases sharply with increasing number $N$ of classes included in the Top-N indicator vectors. At the same time, $\mathrm { F I D } _ { \mathrm { C L I P } }$ (dashed curves, right-hand $y$ scale) remains almost constant, indicating that the apparent improvements in FID are superfluous. The orange control curves have been computed from classes in the middle of the sorted probability vectors, indicating that the top classes indeed have a much stronger influence. As the numerical values of FID and $\mathrm { F I D } _ { \mathrm { C L I P } }$ are not comparable, the left and right $y$ axes have been normalized such that the relative changes are represented accurately.
121
+
122
+ We implement this by carrying out the weight optimization in the space of class probabilities (see Figure 1). We furthermore binarize the class probability vectors by identifying the $N$ classes with the highest probabilities and setting the corresponding entries to 1 and the rest to 0. These vectors now indicate, for each image, the Top- $N$ classes, while discarding their estimated probabilities. By matching the statistics of these indicator vectors between real and generated distributions, we optimize the co-occurrence of Top- $. N$ classes. The result of the weight optimization is therefore an approximation of Top- $N$ histogram matching. With $N = 1$ , the results approximately align with simple histogram matching (Table 1). Note that the binarization is done before the weight optimization begins, and thus we don’t need its (non-computable) gradients.
123
+
124
+ Figure 6 shows how FID (computed in the usual pre-logit space) changes as we optimize Top- $N$ histogram matching with increasing $N$ . We observe that even with small values of $N$ , FID improves rapidly, and converges to a value slightly higher than was obtained by optimizing the weights in the pre-logit space $\mathrm { \bar { F } I D } ^ { \mathrm { P L } }$ in Table 2). This demonstrates that FID is, to a significant degree, determined by the co-occurrence of top ImageNet classes. Furthermore, it illustrates that FID is the most interested in a handful of features whose only purpose is to help with ImageNet classification, not on some careful analysis of the whole image. As a further validation of this tendency, we also computed a similar optimization using binarized vectors computed using $N$ classes chosen from the middle5 of the sorted probabilities (orange curves in Figure 6). The results show that the top classes have a significantly higher influence on FID than those ranked lower by the Inception-V3 classifier. Finally, as before, we present a control $\mathrm { F I D } _ { \mathrm { C L I P } }$ (dashed curves) that shows that CLIP’s feature space is almost indifferent to the apparent FID improvements yielded by the better alignment of Top- $N$ ImageNet classes. Though we only present results for FFHQ here, qualitative behavior is similar for LSUN CAT/PLACES/CAR, and AFHQ-V2 DOG (see Appendix D).
125
+
126
+ # 4 PRACTICAL EXAMPLE: IMAGENET PRE-TRAINED GANS
127
+
128
+ Our experiments indicate that it is certainly possible that some models receive unrealistically low FID simply because they happen to reproduce the (inconsequential) ImageNet class distribution detected in the training data. Perhaps the most obvious way this could happen in practice is when ImageNet pre-training is used for a GAN discriminator (Sauer et al., 2021; Kumari et al., 2022). This approach has been observed to lead to much faster convergence and significant improvements in FID, but since the discriminator is readily sensitive to the ImageNet classes, maybe it also guides the generator to replicate them? Perhaps a part of the improvement is in the perceptual nullspace of FID?
129
+
130
+ ![](images/91a2ec519b05ed352478883f05d789f49594ee7435f4e870884f8e91fe910294.jpg)
131
+ Figure 7: Uncurated samples from (a) Projected FastGAN and (b) StyleGAN2. Both models achieve similar FID even though the Projected FastGAN samples contain more artifacts. In contrast, Projected FastGAN has significantly higher $\mathrm { F I D } _ { \mathrm { C L I P } }$ , consistent with the observed quality differential.
132
+
133
+ We study this in the same context as Sauer et al. (2021) by training a Projected FastGAN (Liu et al., 2021; Sauer et al., 2021) that uses an ImageNet pre-trained EfficientNet (Tan & Le, 2019) as a feature extractor of the discriminator, and compare it against StyleGAN2 in FFHQ.6
134
+
135
+ The human preference study conducted by Sauer et al. (2021) concludes that despite the dramatic improvements in FID, Projected FastGAN tends to generate lower quality and less diverse FFHQ samples than StyleGAN2. We verify this by comparing samples from Projected FastGAN and StyleGAN2 in a setup where FIDs are roughly comparable and the models reproduce a similar degree of variation as measured by Recall (Kynka¨anniemi et al., 2019). Visual inspection of uncurated sam- ¨ ples (Figure 7) indeed reveals that Projected FastGAN produces much more distortions in the human faces than StyleGAN2 (see Appendix E for larger image grids).
136
+
137
+ In this iso-FID comparison, $\mathrm { F I D } _ { \mathrm { C L I P } }$ agrees with human assessment – StyleGAN2 is rated significantly better than Projected FastGAN. It therefore seems clear that Projected FastGAN has lower FID than it should have, confirming that at least some of its apparent improvements are in the perceptual null space. We believe that the reason for this is the accidental leak of information from the pre-trained network, causing the model to replicate the ImageNet-like aspects in the training data more keenly. This observation does not mean that ImageNet pre-training is a bad idea, but it does mean that such pre-training can make FID unreliable in practice.
138
+
139
+ We suspect similar interference can happen when the ImageNet pre-trained classifiers are used to curate the training data (DeVries et al., 2020) or as a part of the sampling process (Watson et al., 2022).
140
+
141
+ # 5 CONCLUSIONS
142
+
143
+ The numerical values of FID have a number of important uses. Large values indicate training failures quite reliably, and FID appears highly dependable when monitoring the convergence of a training run. FID improvements obtained through hyperparameter sweeps or other trivial changes generally seem to translate to better (subjective) results, even when the distributions are well aligned.7 The caveats arise when two sufficiently different architectures and/or training setups are compared. If one of them is, for some reason, inclined to better reproduce the fringe features, it can lead to a much lower FIDs without a corresponding improvement in the human-observable quality.
144
+
145
+ Particular care should be exercised when introducing ImageNet pre-training to generative models (Sauer et al., 2021; 2022; Kumari et al., 2022), as it may compromise the validity of FID as a quality metric. This effect is difficult to quantify because the current widespread metrics (KID and Precision/Recall) also rely on the feature spaces of ImageNet classifiers. As a partial solution, the FID improvements should at least be verified using a non-ImageNet trained Frechet distance. Viable ´ alternative feature spaces include CLIP (Radford et al., 2021; Sauer et al., 2021), self-supervised SwAV (Caron et al., 2020; Morozov et al., 2021), and an uninitialized network (Naeem et al., 2020; Sauer et al., 2022). We hope that our methods help examine the properties of these feature spaces in future work.
146
+
147
+ # ACKNOWLEDGEMENTS
148
+
149
+ We thank Samuli Laine for helpful comments. This work was partially supported by the European Research Council (ERC Consolidator Grant 866435), and made use of computational resources provided by the Aalto Science-IT project and the Finnish IT Center for Science (CSC).
150
+
151
+ # REFERENCES
152
+
153
+ Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dandelion Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris ´ Olah, Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, Oriol Vinyals, Pete Warden, Martin Wat- ´ tenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-Scale Machine Learning on Heterogeneous Systems, 2015. URL https://www.tensorflow.org/.
154
+
155
+ Motasem Alfarra, Juan C. Perez, Anna Fr ´ uhst ¨ uck, Philip H. S. Torr, Peter Wonka, and Bernard ¨ Ghanem. On the Robustness of Quality Measures for GANs. In Proc. ECCV, 2022.
156
+
157
+ Sefi Bell-Kligler, Assaf Shocher, and Michal Irani. Blind Super-Resolution Kernel Estimation using an Internal-GAN. In Proc. NeurIPS, 2019.
158
+
159
+ Mikolaj Binkowski, Danica J. Sutherland, Michael Arbel, and A. Gretton. Demystifying MMD GANs. In Proc. ICLR, 2018.
160
+
161
+ Ali Borji. Pros and cons of GAN evaluation measures: New developments. Comput. Vis. Image Underst., 2022.
162
+
163
+ Andrew Brock, Jeff Donahue, and K. Simonyan. Large Scale GAN Training for High Fidelity Natural Image Synthesis. In Proc. ICLR, 2019.
164
+
165
+ Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. Unsupervised Learning of Visual Features by Contrasting Cluster Assignments. In Proc. NeurIPS, 2020.
166
+
167
+ Yunjey Choi, Youngjung Uh, Jaejun Yoo, and Jung-Woo Ha. StarGAN v2: Diverse Image Synthesis for Multiple Domains. In Proc. CVPR, 2020.
168
+
169
+ Min Jin Chong and D. Forsyth. Effectively Unbiased FID and Inception Score and Where to Find Them. In Proc. CVPR, 2020.
170
+
171
+ J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A Large-Scale Hierarchical Image Database. In Proc. CVPR, 2009.
172
+
173
+ Terrance DeVries, Michal Drozdzal, and Graham W Taylor. Instance Selection for GANs. In Proc. NeurIPS, 2020.
174
+
175
+ Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density Estimation using Real NVP. In Proc. ICLR, 2017.
176
+
177
+ D. Dowson and B. Landau. The Frechet distance between multivariate normal distributions. ´ Journal of Multivariate Analysis, 12:450–455, 1982.
178
+
179
+ Patrick Esser, Robin Rombach, and Bjorn Ommer. Taming Transformers for High-Resolution Image ¨ Synthesis. In Proc. CVPR, 2021.
180
+
181
+ Kenji Fukumizu, Arthur Gretton, Xiaohai Sun, and Bernhard Scholkopf. Kernel Measures of Con- ¨ ditional Dependence. In Proc. NIPS, 2007.
182
+
183
+ Robert Geirhos, Patricia Rubisch, Claudio Michaelis, Matthias Bethge, Felix Wichmann, and Wieland Brendel. ImageNet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness. In Proc. ICLR, 2019.
184
+
185
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative Adversarial Networks. In Proc. NIPS, 2014.
186
+ Arthur Gretton, Karsten M. Borgwardt, Malte J. Rasch, Bernhard Scholkopf, and Alexander Smola. ¨ A Kernel Two-Sample Test. Journal of Machine Learning Research, 2012.
187
+ Kaiming He, X. Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. In Proc. CVPR, 2016.
188
+ Katherine L. Hermann, Ting Chen, and Simon Kornblith. The Origins and Prevalence of Texture Bias in Convolutional Neural Networks. In Proc. NeurIPS, 2020.
189
+ 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. In Proc. NIPS, 2017.
190
+ Jonathan Ho, Ajay Jain, and P. Abbeel. Denoising Diffusion Probabilistic Models. In Proc. NeurIPS, 2020.
191
+ Xun Huang, Arun Mallya, Ting-Chun Wang, and Ming-Yu Liu. Multimodal Conditional Image Synthesis with Product-of-Experts GANs. In Proc. ECCV, 2022.
192
+ Ahmed Imtiaz Humayun, Randall Balestriero, and Richard Baraniuk. MaGNET: Uniform Sampling from Deep Generative Network Manifolds Without Retraining. In Proc. ICLR, 2022.
193
+ Thibaut Issenhuth, Ugo Tanielian, David Picard, and Jeremie Mary. Latent reweighting, an almost free improvement for GANs. In Proc. WACV, 2022.
194
+ Tero Karras, S. Laine, and Timo Aila. A Style-Based Generator Architecture for Generative Adversarial Networks. In Proc. CVPR, 2019.
195
+ Tero Karras, Miika Aittala, Janne Hellsten, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Training Generative Adversarial Networks with Limited Data. In Proc. NeurIPS, 2020a.
196
+ Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and Improving the Image Quality of StyleGAN. In Proc. CVPR, 2020b.
197
+ Tero Karras, Miika Aittala, Samuli Laine, Erik Hark ¨ onen, Janne Hellsten, Jaakko Lehtinen, and ¨ Timo Aila. Alias-Free Generative Adversarial Networks. In Proc. NeurIPS, 2021.
198
+ Junho Kim, Minjae Kim, Hyeonwoo Kang, and KwangHee Lee. U-GAT-IT: Unsupervised Generative Attentional Networks with Adaptive Layer-Instance Normalization for Image-to-Image Translation. In Proc. ICLR, 2020.
199
+ Diederik P. Kingma and Prafulla Dhariwal. Glow: Generative Flow with Invertible 1x1 Convolutions. In Proc. NeurIPS, 2018.
200
+ Diederik P. Kingma and Max Welling. Auto-Encoding Variational Bayes. In Proc. ICLR, 2014.
201
+ Nupur Kumari, Richard Zhang, Eli Shechtman, and Jun-Yan Zhu. Ensembling Off-the-shelf Models for GAN Training. In Proc. CVPR, 2022.
202
+ Tuomas Kynka¨anniemi, Tero Karras, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Improved ¨ Precision and Recall Metric for Assessing Generative Models. In Proc. NeurIPS, 2019.
203
+ Christian Ledig, Lucas Theis, Ferenc Huszar, Jose Caballero, Andrew P. Aitken, Alykhan Tejani, ´ J. Totz, Zehan Wang, and W. Shi. Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network. In Proc. CVPR, 2017.
204
+ Bingchen Liu, Yizhe Zhu, Kunpeng Song, and Ahmed Elgammal. Towards Faster and Stabilized GAN Training for High-fidelity Few-shot Image Synthesis. In Proc. ICLR, 2021.
205
+ Mario Lucic, Karol Kurach, Marcin Michalski, S. Gelly, and O. Bousquet. Are GANs Created Equal? A Large-Scale Study. In Proc. NeurIPS, 2018.
206
+
207
+ Stanislav Morozov, Andrey Voynov, and Artem Babenko. On Self-Supervised Image Representations for GAN Evaluation. In Proc. ICLR, 2021.
208
+
209
+ Muhammad Ferjad Naeem, Seong Joon Oh, Youngjung Uh, Yunjey Choi, and Jaejun Yoo. Reliable Fidelity and Diversity Metrics for Generative Models. In Proc. ICML, 2020.
210
+
211
+ Charlie Nash, Jacob Menick, S. Dieleman, and P. Battaglia. Generating Images with Sparse Representations. In Proc. ICML, 2021.
212
+
213
+ Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. GLIDE: Towards Photorealistic Image Generation and Editing with Text-Guided Diffusion Models. In Proc. ICML, 2022.
214
+
215
+ Taesung Park, Ming-Yu Liu, T. Wang, and Jun-Yan Zhu. Semantic Image Synthesis With SpatiallyAdaptive Normalization. In Proc. CVPR, 2019.
216
+
217
+ Taesung Park, Jun-Yan Zhu, O. Wang, Jingwan Lu, E. Shechtman, Alexei A. Efros, and Richard Zhang. Swapping Autoencoder for Deep Image Manipulation. In Proc. NeurIPS, 2020.
218
+
219
+ Gaurav Parmar, Richard Zhang, and Jun-Yan Zhu. On Aliased Resizing and Surprising Subtleties in GAN Evaluation. In Proc. CVPR, 2022.
220
+
221
+ 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 Proc. NeurIPS, 2019.
222
+
223
+ Philippe Pierre Pebay. Formulas for robust, one-pass parallel computation of covariances and arbitrary-order statistical moments. Technical Report SAND2008-6212, Sandia National Laboratories, 2008.
224
+
225
+ 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 Proc. ICML, 2021.
226
+
227
+ Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-Shot Text-to-Image Generation. In Proc. ICML, 2021.
228
+
229
+ Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical TextConditional Image Generation with CLIP Latents. CoRR, abs/2204.06125, 2022.
230
+
231
+ Ali Razavi, Aaron van den Oord, and Oriol Vinyals. Generating Diverse High-Fidelity Images with ¨ VQ-VAE-2. In Proc. NeurIPS, 2019.
232
+
233
+ Chitwan Saharia, Jonathan Ho, William Chan, Tim Salimans, David J Fleet, and Mohammad Norouzi. Image super-resolution via iterative refinement. arXiv preprint arXiv:2104.07636, 2021.
234
+
235
+ Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S. Sara Mahdavi, Rapha Gontijo Lopes, Tim Salimans, Jonathan Ho, David J Fleet, and Mohammad Norouzi. Photorealistic Text-to-Image Diffusion Models with Deep Language Understanding. CoRR, abs/2205.11487, 2022.
236
+
237
+ Mehdi S. M. Sajjadi, Olivier Bachem, Mario Lucic, Olivier Bousquet, and Sylvain Gelly. Assessing Generative Models via Precision and Recall. In Proc. NeurIPS, 2018.
238
+
239
+ Tim Salimans, I. Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved Techniques for Training GANs. In Proc. NIPS, 2016.
240
+
241
+ Axel Sauer, Kashyap Chitta, Jens Muller, and Andreas Geiger. Projected GANs Converge Faster. In ¨ In Proc. NeurIPS, 2021.
242
+
243
+ Axel Sauer, Katja Schwarz, and Andreas Geiger. StyleGAN-XL: Scaling StyleGAN to Large Diverse Datasets. In Proc. TOG, 2022.
244
+
245
+ Ramprasaath R. Selvaraju, Abhishek Das, Ramakrishna Vedantam, Michael Cogswell, Devi Parikh, and Dhruv Batra. Grad-CAM: Visual Explanations from Deep Networks via Gradient-Based Localization. In Proc. ICCV, 2017.
246
+ Jascha Sohl-Dickstein, Eric A. Weiss, Niru Maheswaranathan, and S. Ganguli. Deep Unsupervised Learning using Nonequilibrium Thermodynamics. In Proc. ICML, 2015.
247
+ Yang Song and Stefano Ermon. Generative Modeling by Estimating Gradients of the Data Distribution. In Proc. NeurIPS, 2019.
248
+ Christian Szegedy, V. Vanhoucke, S. Ioffe, Jonathon Shlens, and Z. Wojna. Rethinking the Inception Architecture for Computer Vision. In Proc. CVPR, 2016.
249
+ Mingxing Tan and Quoc V. Le. EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks. In Proc. ICML, 2019.
250
+ Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel Recurrent Neural Networks. ¨ In Proc. ICML, 2016a.
251
+ Aaron van den Oord, Nal Kalchbrenner, Oriol Vinyals, Lasse Espeholt, Alex Graves, and Koray ¨ Kavukcuoglu. Conditional Image Generation with PixelCNN Decoders. In Proc. NIPS, 2016b.
252
+ Sjoerd van Steenkiste, Karol Kurach, Jurgen Schmidhuber, and Sylvain Gelly. Investigating object ¨ compositionality in Generative Adversarial Networks. Neural Networks, 2020.
253
+ Daniel Watson, William Chan, Jonathan Ho, and Mohammad Norouzi. Learning Fast Samplers for Diffusion Models by Differentiating Through Sample Quality. In Proc. ICLR, 2022.
254
+ Qiantong Xu, Gao Huang, Yang Yuan, Chuan Guo, Yu Sun, Felix Wu, and Kilian Q. Weinberger. An Empirical Study on Evaluation Metrics of Generative Adversarial Networks. ArXiv, abs/1806.07755, 2018.
255
+ Fisher Yu, Ari Seff, Yinda Zhang, Shuran Song, Thomas Funkhouser, and Jianxiong Xiao. LSUN: Construction of a Large-scale Image Dataset using Deep Learning with Humans in the Loop. CoRR, abs/1506.03365, 2015.
256
+ Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The Unreasonable Effectiveness of Deep Features as a Perceptual Metric. In Proc. CVPR, 2018.
257
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks. In Proc. ICCV, 2017.
258
+
259
+ <table><tr><td>Sample size</td><td>FFHQ</td><td>LSUN Cat</td></tr><tr><td>5k+5k</td><td>11.65 ± 0.04</td><td>17.38 ± 0.13</td></tr><tr><td>10k+10k</td><td>8.31 ±0.06</td><td>12.42 ± 0.06</td></tr><tr><td>50k + 50k</td><td>5.30 ± 0.04</td><td>8.25 ±0.04</td></tr><tr><td>All + 50k</td><td>5.14 ± 0.04</td><td>7.83 ± 0.03</td></tr></table>
260
+
261
+ (a) Number of samples
262
+
263
+ <table><tr><td></td><td>FFHQ</td><td>LSUN Cat</td></tr><tr><td>TensorFlow</td><td>5.30 ± 0.04</td><td>8.25 ±0.04</td></tr><tr><td>PyTorch</td><td>3.69 ± 0.05</td><td>6.64 ± 0.03</td></tr></table>
264
+
265
+ # (b) Inception-V3 instance
266
+
267
+ Figure 8: FID is very sensitive to (a) the number samples (real $^ +$ generated) and (b) the exact instance of the Inception-V3 network. The tables report the mean $\pm$ standard deviation of FID for a given StyleGAN2 generator over ten evaluations with different random seeds.
268
+
269
+ # A NUMERICAL SENSITIVITY OF FID
270
+
271
+ Previous work has uncovered various details that have a surprisingly large effect on the exact value of FID (Binkowski et al., 2018; Lucic et al., 2018; Parmar et al., 2022; Chong & Forsyth, 2020). These observations are important to acknowledge because reproducing results from comparison methods is not always possible and one might be forced to resort to copying the reported FID results. In that case, even small differences in the FID evaluation protocol might cause erroneous rankings between models.
272
+
273
+ Number of samples and bias. FID depends strongly on the number of samples used in evaluation (Figure 8a). Therefore it is crucial to standardize to a specific number of real and generated samples (Binkowski et al., 2018).
274
+
275
+ Network architecture. FID is also very sensitive to the chosen feature network instance or type. Many deep learning frameworks (e.g. PyTorch (Paszke et al., 2019), Tensorflow (Abadi et al., 2015)) provide their own versions of the Inception-V3 network with distinct weights. Figure 8b shows that FID is surprisingly sensitive to the exact instance of the Inception-V3 network. The discrepancies are certainly large enough to confuse with state-of-the-art performance. In practice, the official Tensorflow network must be used for comparable results.8
276
+
277
+ Lucic et al. (2018) reported that the ranking of models with FID is not sensitive to the selected network architecture – it only has an effect on the absolute value range of FIDs, but the relative ordering of the models remains approximately the same. However, our tests with $\mathrm { F I D } _ { \mathrm { C L I P } }$ indicate that this observation likely holds only between different ImageNet classifier networks.
278
+
279
+ Image processing flaws. Before feeding images to the Inception-V3, they need to be resized to $2 9 9 \times 2 9 9$ resolution. Parmar et al. (2022) noted that the image resize functions of the most commonly used deep learning libraries (Paszke et al., 2019; Abadi et al., 2015) introduce aliasing artifacts due to poor pre-filtering. They demonstrate that this aliasing has a noticeable effect on FID.
280
+
281
+ ![](images/84471a69263f22a46c35e233924c64637ae50cfa6a0e25293bdd571cf0dfcd75.jpg)
282
+ Figure 9: We observe nearly perfect correlation between FIDs computed from pre-logit features and classification logits since these two are separated by only one affine transformation. Each point corresponds to a single StyleGAN2 training snapshot in $2 5 6 \times 2 5 6$ resolution.
283
+
284
+ ![](images/ca7120568f5118b1ac29fee75815aae84d3be4a3108cebd0e68492eba19ceff8.jpg)
285
+ Figure 10: (a) Adding Gaussian noise to regions that are important for FID (blue curve) leads to the larger increase compared to adding noise in unimportant regions. (b) Image showing regions FID considers as the most important and noise added to different regions at scale 0.05. We recommend zooming in (b) to better assess the noise.
286
+
287
+ # B CORRELATION BETWEEN PRE-LOGITS AND LOGITS FID
288
+
289
+ Figure 9 demonstrates that FIDs calculated from the pre-logits and logits are highly correlated. The high correlation is explained by the fact that these two spaces are separated by only one affine transformation and without any non-linearities. Note that this test is only a guiding experiment to help find out to what FID is sensitive to and it is not guaranteed to hold for different GAN architectures or training setups.
290
+
291
+ # C WHAT DOES FID LOOK AT IN AN IMAGE?
292
+
293
+ Validation of FID sensitivity heatmaps. To validate how reliably our sensitivity heatmaps highlight the most important regions for FID, we perform an additional experiment where we add Gaussian noise to either important or unimportant areas, while keeping the other clean without noise. To cancel out effects that may arise from adding different amounts of noise, measured in pixel area, we divide the pixels of the images equally between the important and unimportant regions.
294
+
295
+ Figure 10a shows FID when we add an increasing amount of Gaussian noise to different regions of the images and Figure 10b demonstrates the appearance of the noisy images. Adding noise everywhere in the image is an upper bound how greatly FID can increase in this test setup. Adding noise to the important regions leads to larger increase in FID, compared to adding noise to the unimportant regions.
296
+
297
+ Additional FID sensitivity heatmaps. Figure 11 presents more FID sensitivity heatmaps for individual StyleGAN2 generated images using FFHQ and LSUN CAT and their corresponding ImageNet Top-1 classifications in the top left corner. For both datasets the regions for which FID is the most sensitive to are highly localized and correlate strongly with the Top-1 class.
298
+
299
+ Figure 12 shows additional mean images and heatmaps for StyleGAN2 generated images for FFHQ that get classified to a certain class. On average FID is the most sensitive to the pixel locations where the Top-1 class is intuitively located and relatively insensitive to the human faces.
300
+
301
+ Comparison to Grad-CAM. Figures 13 and 14 compare our FID sensitivity heatmaps to standard Grad-CAM heatmaps (Selvaraju et al., 2017) for FFHQ and LSUN CAT, respectively. Grad-CAM heatmaps, computed using classification probabilities, highlight similar regions in the images as our FID sensitivity heatmaps, showing that the important regions for ImageNet classification overlap heavily with regions that are important for FID. Additionally, Figure 15 shows mean images and FID heatmaps, as well as mean Top-1 Grad-CAM heatmaps for StyleGAN2 generated FFHQ images.
302
+
303
+ ![](images/28ba9a401915264fce648e435c8cd3d9daf792c711cf060151b368d26bc23bda.jpg)
304
+ Figure 11: Heatmaps of the most important regions for FID for StyleGAN2 images in (a) FFHQ and (b) LSUN CAT, along with their Top-1 classification annotated in the top left corner of each image.
305
+
306
+ ![](images/c6c29e79d7d11bdaaec36cc1a809695505938f2c637e73ad6794450b23c51365.jpg)
307
+ Figure 12: Mean images and heatmaps of regions that are the most important for FID with StyleGAN2 images in FFHQ that get classified to some class, e.g., “lipstick”. The heatmaps highlight the regions of Top-1 classes that are typically located outside the face area.
308
+
309
+ ![](images/0ef7d2723f0fa07990dd87617d941ac5301e68adb20c130d2aff62f25714517f.jpg)
310
+ Figure 13: Comparison of our FID sensitivity heatmaps with standard Grad-CAM in FFHQ. The Grad-CAM heatmaps highlight the most important areas for Top-1, Top-2, and Top-3 classification. We also show an average Grad-CAM heatmap weighted according to the classification probabilities.
311
+
312
+ ![](images/4daeeca246da079301c1b5f581693770e7bc141ff4f93f77f979cc92f4aa329a.jpg)
313
+ Figure 14: Comparison of our FID sensitivity heatmaps with standard Grad-CAM in LSUN CAT. The Grad-CAM heatmaps highlight the most important areas for Top-1, Top-2, and Top-3 classification. We also show an average Grad-CAM heatmap weighted according to the classification probabilities.
314
+
315
+ ![](images/ca3de868d146bffc9eaaa7cbc5f4aec63ba57470000d893ba5eb2f1145e6a0f0.jpg)
316
+ Figure 15: Top: Average of StyleGAN2-generated FFHQ images whose Top-1 classification matches the given class, e.g., “bow tie”. Middle: Average heatmaps of regions that are the most important for FID. Bottom: Corresponding average Grad-CAM heatmaps computed for the Top-1 class.
317
+
318
+ # D PROBING THE PERCEPTUAL NULL SPACE IN FID
319
+
320
+ Pseudocode and implementation details. Algorithm 1 shows the pseudocode for our resampling method. Function OPTIMIZE-RESAMPLING-WEIGHTS optimizes the per-image sampling weights such that FID between real and weighted generated features is minimized. The inputs to the function are sets of features for real and generated images $ { \boldsymbol { F } } _ { \mathrm { r } }$ and $F _ { \mathrm { g } }$ , respectively, learning rate $\alpha$ and maximum number of iterations $T$ . Note that the features do not have to be the typical pre-logits features where standard FID is calculated; they can be, e.g., logits or binarized class probabilities. First, we calculate the statistics of real features (lines 3-4) and then initialize the per-image logparameterized weights $w _ { i }$ to zeros (line 7). Then, for $T$ iterations we calculate the weighted mean and covariance of generated features (lines 11-12) and update the weights via gradient descent to minimize FID (line 15). After optimization the log-parameterized weights can be transformed into sampling probabilities with $\begin{array} { r } { p _ { i } = \frac { e ^ { w _ { i } } } { \sum _ { j } e ^ { w _ { j } } } } \end{array}$ , where $p _ { i }$ is the probability of sampling ith feature. We sample with replacement according to these probabilities to calculate our resampled FIDs $\mathrm { ( F I D ^ { P L } }$ , FIDL, FIDPLCLIP) with 50k real and generated features.
321
+
322
+ In practice, we use features of $5 0 \mathrm { k }$ real and $2 5 0 \mathrm { k }$ generated images for all datasets, except for AFHQ-V2 DOG where we use 4678 real and $2 5 \mathrm { k }$ generated images. We use learning rate $\alpha = 1 0 . 0$ when optimizing pre-logits features and $\alpha = 5 . 0$ when optimizing logits or binarized class probabilities. We optimize the weights until convergence, which typically requires ${ \sim } 1 0 0 \mathrm { k }$ iterations. We select the weights that lead to the smallest FID with $5 0 \mathrm { k }$ real and $5 0 \mathrm { k }$ generated features that are sampled according to the optimized weights. In the optimization, we do not apply exponential moving average to the weights or learning rate decay. We use 32GB NVIDIA Tesla V100 GPU to run our resampling experiments. One weight optimization run with $5 0 \mathrm { k }$ real and $2 5 0 \mathrm { k }$ generated features takes approximately 48h where most the execution time goes into calculating the matrix square root in FID with eigenvalue decomposition. Code is available at https://github.com/kynkaat/role-of-imagenet-classes-in-fid.
323
+
324
+ Image grids for Top-1 matching and pre-logits resampling. Figure 16 shows uncurated image grids when we sample StyleGAN2 generated images randomly, after Top-1 histogram matching, and after matching all fringe features. Even though FID drops very significantly, the visual appearance of the generated images remains largely unchanged. $\mathrm { F I D } _ { \mathrm { C L I P } }$ also fails to confirm the improvement indicated by FID.
325
+
326
+ In Figure 17, we show a larger set of images that obtain a small or large weight after optimizing FID in the pre-logits feature space. A low FID after resampling cannot be attributed to simply removing images with clear visual artifacts.
327
+
328
+ Effect of pre-logits resampling on KID. Table 3 shows that resampling in the pre-logits feature space also strongly decreases Kernel Inception Distance (KID) (Binkowski et al., 2018), and a Kernel Inception Distance that is calculated using the radial basis function (RBF) kernel (RBF-KID). While the standard KID compares the first three moments (Binkowski et al., 2018), RBF-KID considers all moments, because the RBF kernel is a characteristic kernel (Gretton et al., 2012; Fukumizu et al., 2007). The metrics are computed in the same feature space as FID and therefore we hypothesize that they share approximately the same perceptual null space. To calculate RBF-KID, we used RBF scatter parameter $\textstyle { \dot { \gamma } } = { \frac { 1 } { d } }$ , where $d = 2 0 4 8$ is the dimensionality of Inception-V3 pre-logits. We experimented with different scatter parameter values $( \gamma \in \{ \frac { 1 } { 8 d } , \frac { 1 } { 4 d } , \frac { 1 } { 2 d } , \frac { 1 } { d } , \frac { 2 } { d } , \frac { 4 } { d } , \frac { 8 } { d } \} )$ and observed that they all lead to similar qualitative behavior.
329
+
330
+ Top- $N$ histogram matching. We show further results from approximate Top- $. N$ histogram matching in LSUN CAT/CAR/PLACES and AFHQ-V2 DOG in Figure 18. FID can be consistently improved by aligning the Top- $. N$ histograms of real and generated images. Furthermore, the largest decrease in FID can be obtained by including information of the most probable classes.
331
+
332
+ E PRACTICAL EXAMPLE: IMAGENET PRE-TRAINED GANS
333
+
334
+ Figure 19 shows larger image grids for StyleGAN2 and Projected FastGAN in FFHQ.
335
+
336
+ <table><tr><td>Algorithm1Resamplingalgorithmpseudocode.</td><td></td></tr><tr><td>2: Calculate feature statistics of reals.</td><td>1:function OPTIMIZE-RESAMPLING-WEIGHTS(F.,Fg,α,T)</td></tr><tr><td>3:</td><td>μ←∑ifi</td></tr><tr><td>4:</td><td>Σ←[F-1∑(fi-μ)T (f-μr)</td></tr><tr><td>5:</td><td></td></tr><tr><td>6:</td><td>Initialize log-parameterized per-image weights w to zeros.</td></tr><tr><td>7:</td><td>Wi=O,∀i</td></tr><tr><td>8:</td><td></td></tr><tr><td>9:</td><td>forTiterationsdo Compute weighted mean and covariance of generated features.</td></tr><tr><td>10:</td><td>Mewif</td></tr><tr><td>11:</td><td>μg(w)← ∑iewi</td></tr><tr><td>12:</td><td>∑g(w)← 1 Σiew(f-μg(w))T(f-μg(w)) ewi</td></tr><tr><td>13:</td><td></td></tr><tr><td>14:</td><td>Update the weights.</td></tr><tr><td>15:</td><td>w ←w-αVωFID(μr,Σr,μg(w),Σg(w))</td></tr><tr><td>16:</td><td></td></tr><tr><td>17:</td><td>return w</td></tr></table>
337
+
338
+ Table 3: Optimizing FID also decreases KID and RBF-KID significantly. We compare the KIDs of randomly sampled images (KID, RBF-KID) against KIDs computed by resampling according to the weights obtained from optimizing FID in the pre-logits features $( \mathrm { K I D } ^ { \mathrm { P L } }$ , RBF- ${ \bf K I D } ^ { \mathrm { P L } }$ ). The numbers represent averages over ten evaluations.
339
+
340
+ <table><tr><td>Dataset</td><td>FID</td><td>FIDPL</td><td>KIDx103</td><td>KIDPL×10³</td><td>RBF-KID×10³</td><td>RBF-KIDPL</td><td>×103</td></tr><tr><td>FFHQ</td><td>5.30</td><td>1.78 (-66.4%)</td><td>1.52</td><td>0.19 (-87.5%)</td><td>0.67</td><td>0.08</td><td>(-88.1%)</td></tr><tr><td>LSUN CAT</td><td>8.25</td><td>3.05 (-63.0%)</td><td>3.00</td><td>0.37 (-87.7%)</td><td>1.32</td><td>0.16</td><td>(-87.9%)</td></tr><tr><td>LSUN CAR</td><td>5.65</td><td>2.11 (-62.7%)</td><td>2.49</td><td>0.32 (-87.1%)</td><td>1.19</td><td>0.16</td><td>(-86.6%)</td></tr><tr><td>LSUN PLACES</td><td>12.96</td><td>3.59 (-72.3%)</td><td>7.43</td><td>0.31 (-95.8%)</td><td>3.04</td><td>0.14</td><td>(-95.4%)</td></tr><tr><td>AFHQ-V2 DOG</td><td>10.25</td><td>5.92 (-42.2%)</td><td>2.05</td><td>0.12 (-94.1%)</td><td>1.04</td><td>0.06</td><td>(-94.2%)</td></tr></table>
341
+
342
+ ![](images/180df2d75c15b20e19a5518000b8819e7cb552a3c3a177e7c3c2056d1c6bb89d.jpg)
343
+
344
+ ![](images/f6e3353ef66c0671f88862d4a01869795c0371c57cf6e5206ef99559817d7e16.jpg)
345
+ (a) Random sample (FID = 5.30, Recall = 0.46, FIDCLIP = 2.76)
346
+
347
+ ![](images/918b0a20737f549638046fd2da913160631827a4899bdae6dedb3ec9c6a10c06.jpg)
348
+ (b) Top-1 matching (FID = 4.70, Recall = 0.45, FIDCLIP = 2.74)
349
+ (c) Pre-logits resampling $\mathrm { ( F I D = 1 } . 7 8$ , Recall $= 0 . 4 0$ , $\mathrm { F I D } _ { \mathrm { C L I P } } = 2 . 6 4 )$
350
+ Figure 16: FID can be drastically reduced by using our resampling approach without improving the visual fidelity of the generated images in any obvious way. (a) Randomly sampled StyleGAN2 images (b) Randomly sampled StyleGAN2 images after Top-1 histogram matching (c) StyleGAN2 images sampled according to the weights obtained by matching all fringe features.
351
+
352
+ ![](images/259f97adac1f903e90a4524c7c090818029c038c413dcb9a91bb4a283188bdd9.jpg)
353
+
354
+ ![](images/b28a137da3c4fe29d34c9d053890b793d45da25528f010cb69cb4bfae93b3a8a.jpg)
355
+ (a) Images with small weights
356
+ (b) Images with large weights
357
+ Figure 17: Random StyleGAN2 images sampled among (a) the smallest $1 0 \%$ of weights and (b) the largest $1 0 \%$ of weights. Both sets contain realistic looking images and images with visual artifacts.
358
+
359
+ ![](images/efee409aea9c3a4290ddd906c1d4cf7813c7c2eff440b24ad4fcf9c9b363a7d3.jpg)
360
+ Figure 18: Additional results from aligning Top-N class histograms. For all datasets adding information from the Top-N ImageNet classes consistently leads to the largest decrease in FID while $\mathrm { F I D } _ { \mathrm { C L I P } }$ remains almost unchanged.
361
+
362
+ ![](images/d84821899828ba010d01a359f9c1589ff5d9cf4e9ef9b0e2206b0873fefe9bb4.jpg)
363
+ Figure 19: Uncurated samples of (a) Projected FastGAN and (b) StyleGAN2 generated images. While Projected FastGAN achieves a better FID, the samples contain more distortions and artifacts.
parse/dev/4oXTQ6m_ws8/4oXTQ6m_ws8_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/4oXTQ6m_ws8/4oXTQ6m_ws8_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/4oXTQ6m_ws8/4oXTQ6m_ws8_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/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
+ ![](images/cbfecf66d4231b1474ef37f12ecc35966bc58c44fae97bd5f6b32cf6e715a834.jpg)
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
+ ![](images/4434b07d285b71474958435f5c29cd95eb32c6d8d9bf5652b1355b9f0e51db64.jpg)
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
+ ![](images/5833e3538d0e527167b7efd48da71f8ec15a4a5d92084d3c1a00babc3b1297a3.jpg)
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
+ ![](images/a127e9dded7859d5c52d0a0a2f4cb98b5f84875ba393850a73840c9d0e35d3ec.jpg)
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
+ ![](images/fbc8c4a8cff1706eac1b10abd9f0bef76eedfb4dcb182d737ef4541fc8e1cd2a.jpg)
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 &amp;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 &amp; 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 &amp; 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 &amp; 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
+ ![](images/bf46dab0b96fceccd9c6ebafd5ba18282416c9b5c7c3747bf11242ff680d8486.jpg)
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
+ ![](images/ae012d3ed8a5dedaf8350ce4e8eeb16a02ec2a442095db0ef25e966d2951109a.jpg)
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
+ ![](images/f73c003af31ef0c5a6cfb953d3ee16c84f25a687f86ff47562472a0656f21f77.jpg)
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
+ ![](images/5fab36202edbe88955b0bea69916907438f9909074a9eedd3ebbce4e5cefa714.jpg)
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
+ ![](images/d652957a6cd086660171acd79747d650d09451ab354d6aaa14116d54d986c1a8.jpg)
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
+ ![](images/3b61d618e02a95f9a7aa40a4fe9a878eb6dd96d90c7c74303f6534408fd3b5ef.jpg)
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
+ ![](images/b78607ca40ae6794ac546e1ad66dea9ca5fa90a00dc6b4675c77bea1b7f23354.jpg)
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&amp;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&amp; 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
+ ![](images/0644d6a339bd15912a62f64d8d8fb7946a88b9eb5adb59688a43ca50f7ecc9ef.jpg)
639
+ Figure 13: Randomly generated MNIST, CIFAR10, and CelebA samples by our method (OTM).
640
+
641
+ ![](images/5badb97c43ff476b92f60a74efec5a0256d887085b1c77f371de805a738bdac8.jpg)
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
+ ![](images/12fc9a9eb5096eebee7c06512daee12085683cf09fa371d112661966d62171e0.jpg)
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
+ ![](images/50b5346ab79cdebabac399a1a9f267228f4ca3fab22f896358f5427d32799dec.jpg)
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
+ ![](images/f23315b2c6e136405e2e14abdb24960c9ea20eb8da4ceb76e23dcdd97b7ecd81.jpg)
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]
parse/dev/5JdLZg346Lw/5JdLZg346Lw_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/5JdLZg346Lw/5JdLZg346Lw_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/5JdLZg346Lw/5JdLZg346Lw_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/83LJRUzXWj/83LJRUzXWj_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/83LJRUzXWj/83LJRUzXWj_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/8qWazUd8Jm/8qWazUd8Jm.md ADDED
@@ -0,0 +1,452 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HOW FAITHFUL IS YOUR SYNTHETIC DATA? SAMPLE-LEVEL METRICS FOR EVALUATING AND AUDITING GENERATIVE MODELS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Devising domain- and model-agnostic evaluation metrics for generative models is an important and as yet unresolved problem. Most existing metrics, which were tailored solely to the image synthesis setup, exhibit a limited capacity for diagnosing the modes of failure of generative models across broader application domains. In this paper, we introduce a 3-dimensional metric, ( $\overset { \cdot } { \alpha }$ -Precision, $\beta$ -Recall, Authenticity), that characterizes the fidelity, diversity and generalization performance of any generative model in a domain-agnostic fashion. Our metric unifies statistical divergence measures with precision-recall analysis, enabling sample-level and distribution-level diagnoses of model fidelity and diversity. We introduce generalization as an additional dimension for model performance that quantifies the extent to which a model copies training data—a crucial performance indicator when modeling sensitive data with requirements on privacy. The three metric components correspond to (interpretable) probabilistic quantities, and are estimated via sample-level binary classification. The sample-level nature of our metric inspires a novel use case which we call model auditing, wherein we judge the quality of individual samples generated by a (black-box) model, discarding low-quality samples and hence improving the overall model performance in a post-hoc manner.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Intuitively, it would seem that evaluating the likelihood function of a generative model is all it takes to assess its performance. As it turns out, the problem of evaluating generative models is far more complicated. This is not only because state-of-the-art models, such as Variational Autoencoders (VAE) (Kingma & Welling (2013)) and Generative Adversarial Networks (GANs) (Goodfellow et al. (2014)), do not possess tractable likelihood functions, but also because the likelihood score itself is a flawed measure of performance—it scales badly in high dimensions, and it obscures distinct modes of model failure into a single uninterpretable score (Theis et al. (2015)). Absent domain-agnostic metrics, earlier work focused on crafting domain-specific scores, e.g., Inception score (Salimans et al. (2016)), with an exclusive emphasis on image data (Lucic et al. (2018)).
12
+
13
+ In this paper, we introduce an alternative approach to evaluating generative models, where instead of assessing the generative distribution by looking at all synthetic samples collectively to compute likelihood or divergence, we classify each sample individually as being of high or low quality. In this way, our metric comprises interpretable probabilistic quantities—resembling those used to evaluate discriminative models (e.g., AUC-ROC)—which describe the rate by which a model makes errors. When averaged over all samples, our sample-level scores reflect discrepancy between real and generative distributions in a way similar to statistical divergence measures (e.g., KL divergence, Frechet ´ distance (Heusel et al. (2017)), or maximum mean discrepancy (Sutherland et al. (2016)). In this sense, our metric enables diagnosing model performance on both the sample and distribution levels.
14
+
15
+ Our metric represents the performance of a generative model as a point in a 3-dimensional space— each dimension corresponds to a distinct quality of the model. These qualities are: Fidelity, Diversity and Generalization. Fidelity measures the quality of a model’s synthetic samples, and Diversity is the extent to which these samples cover the full variability of real samples, whereas Generalization quantifies the extent to which a model overfits (copies) training data.
16
+
17
+ ![](images/3eb77892fcfd949a5771099b197ce9ec4f62a744d13a768b34d3d837eabd0cd8.jpg)
18
+ Figure 1: Pictorial depiction for the proposed evaluation metrics. The blue and red spheres correspond to the $\alpha \cdot$ - and $\beta$ -supports of real and generative distributions, respectively. Blue and red points correspond to real and synthetic data. (a) Synthetic data falling outside the blue sphere will look unrealistic or noisy. (b) Overfitted models can generate ostensibly high-quality data samples that are “unauthentic” because they are copied from the training data. (c) High-quality data samples should reside inside the blue sphere. (d) Outliers do not count in the $\beta$ -Recall metric. (Here, $\alpha { = } \beta { = } 0 . 9$ , $\alpha$ -Precision $scriptstyle = 8 / 9$ , $\beta$ - $\operatorname { R e c a l l } = 4 / 9$ , and Authenticity $= 9 / 1 0 .$ )
19
+
20
+ How do we quantify the 3 dimensions of performance? We build on the precision-recall analysis framework proposed in (Sajjadi et al. (2018)), and introduce the $\alpha$ -Precision and $\beta$ -Recall metrics to quantify model Fidelity and Diversity, respectively. Both metrics assume that a fraction $1 - \alpha$ (or $1 - \beta )$ of the real (and synthetic) data are “outliers”, and $\alpha$ (or $\beta$ ) are “typical”. $\alpha \cdot$ -Precision is the fraction of synthetic samples that resemble the “most typical” $\alpha$ real samples, whereas $\beta$ -Recall is the fraction of real samples covered by the most typical $\beta$ synthetic samples. $\alpha$ -Precision and $\beta$ -Recall are evaluated for all $\alpha , \beta \in [ 0 , \bar { 1 } ]$ , providing entire precision and recall curves instead of single numbers. To compute both metrics, we embed the (real and synthetic) data into hyperspheres with most samples concentrated around the centers, i.e., the real and generative distributions $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ ) has spherical-shaped supports. In this transformed feature space, typical samples would be located near the centers of the spheres, whereas outliers would be closer to the boundaries.
21
+
22
+ To quantify Generalization, we introduce the Authenticity metric, which reflects the likelihood of a synthetic sample being copied from training data. We derive the Authenticity metric from a hypothesis test for data copying based on the observed proximity of synthetic samples to real ones in the embedded feature space. A pictorial illustration for all metrics is shown in Figure 1.
23
+
24
+ How is our metric different? If one think of standard precision and recall metrics as “hard” binary classifiers of real and synthetic samples, our $\alpha$ -Precision and $\beta$ -Recall can be thought of as softboundary classifiers that do not only compare the supports of $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ , but also assesses whether both distributions are calibrated. Precision and recall metrics are special cases of $\alpha$ -Precision and $\beta$ -Recall for $\alpha = \beta = 1$ . As we show later, our new metric definitions solve many of the drawbacks of standard precision-recall analysis, such as lack of robustness to outliers and failure to detect distributional mismatches (Naeem et al. (2020)). They also enable detailed diagnostics of different types of model failure, such as mode collapse and mode invention. Moreover, optimal values of our metrics are achieved only when $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ are identical, thereby eliminating the need to augment the evaluation procedure with additional measures of statistical divergence (e.g., KL divergence).
25
+
26
+ Previous works relied on pre-trained embeddings (using ImageNet feature extractors (Deng et al. (2009))). In this work, we propose feature embeddings that are model- and domain-agnostic, and are tailored to our metric definitions and data set at hand. Our proposed feature embedding step can be completely bespoke to raw data, or augmented with pre-trained embeddings. This enables our metric to remain operable in application domains where no pre-trained representations exist.
27
+
28
+ Overfitting is a crucial mode of failure of generative models, especially when modeling sensitive data (e.g., clinical data) for which data copying may violate privacy requirements (Yoon et al. (2020)), but it has been overlooked in previous works which focused exclusively on quantifying the FidelityDiversity characterization (Brock et al. (2018)). As we show in our experiments (Section 5), because our metric accounts for Generalization, it can provide a fuller picture of a generative model’s performance. Precisely, we show that some of the celebrated generative models score highly for Fidelity and Diversity simply because they memorize real samples, rendering them inappropriate for privacysensitive applications. A comprehensive survey of prior work is provided in the Appendix.
29
+
30
+ Model auditing as a novel use case. The sample-level nature of our metrics inspires the new use case of model auditing, wherein we judge individual synthetic samples by their quality, and reject samples that have low Fidelity or are unauthentic. In Section 5, we show that model audits can improve the outputs of a black-box model in a post-hoc fashion without any modifications to the model itself, and demonstrate this use case in synthesizing clinical data for COVID-19 patients.
31
+
32
+ # 2 EVALUATING AND AUDITING GENERATIVE MODELS
33
+
34
+ # 2.1 PROBLEM SETUP
35
+
36
+ We denote real and generated data as $X _ { r } \sim \mathbb { P } _ { r }$ and $X _ { g } \sim \mathbb { P } _ { g }$ , respectively, where $X _ { r } , X _ { g } \in \mathcal { X }$ , with $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ being the real and generative distributions, and $\mathcal { X }$ being the input space. The generative distribution, $\mathbb { P } _ { g }$ , is estimated using a generative model (e.g., GAN). The real and synthetic data sets are $\mathcal { D } _ { r e a l } = \{ \bar { X } _ { r , i } \} _ { i = 1 } ^ { n }$ and $\mathcal { D } _ { s y n t h } \bar { \mathbf { \Omega } } = \{ X _ { g , j } \} _ { j = 1 } ^ { m }$ , where $X _ { r , i } \sim \mathbb { P } _ { r }$ and $X _ { g , j } \sim \mathbb { P } _ { g }$ .
37
+
38
+ # 2.2 WHAT MAKES A GOOD SYNTHETIC DATA SET?
39
+
40
+ Our goal is to construct a metric $\pmb { \mathcal { E } } ( \mathcal { D } _ { r e a l } , \mathcal { D } _ { s y n t h } )$ for the quality of $\mathcal { D } _ { \boldsymbol { s y n t h } }$ in order to (i) evaluate the performance of the underlying generative model $\mathbb { P } _ { g }$ , and (ii) audit the model outputs by discarding (individual) “low-quality” samples, thereby improving the overall quality of $\mathcal { D } _ { { s y n t h } }$ . In order for $\varepsilon$ to fulfill the evaluation and auditing tasks, it must satisfy the following desiderata: (1) it should be able to disentangle the different modes of failure of $\mathbb { P } _ { g }$ through interpretable measures of performance, and (2) it should be sample-wise computable, i.e., we should be able to tell if a given (individual) synthetic sample $X _ { g } \sim \mathbb { P } _ { g }$ is of a low quality.
41
+
42
+ Having outlined the desiderata for our sought-after evaluation metric, we now propose three qualities of synthetic data that the metric $\varepsilon$ should be able to quantify. Failure to fulfill any of these three qualities correspond to independent modes of failure of the model $\mathbb { P } _ { g }$ . These qualities are:
43
+
44
+ 1. Fidelity—the generated samples resemble real samples from $\mathbb { P } _ { r }$ . A high-fidelity synthetic data set should contain “realistic” samples, e.g. visually-realistic images.
45
+ 2. Diversity—the generated samples are diverse enough to cover the variability of real data, i.e., a model should be able to generate a wide variety of good samples.
46
+ 3. Generalization—the generated samples should not be mere copies of the (real) samples in training data, i.e., models that overfit to $\mathcal { D } _ { r e a l }$ are not truly “generative”.
47
+
48
+ In Section 3, we propose a three-dimensional evaluation metric $\varepsilon$ that captures all of the qualities above. Our proposed metric can be succinctly described as follows:
49
+
50
+ $$
51
+ { \pmb { \mathcal { E } } } \triangleq ( \underbrace { \alpha { \mathrm { - } } \mathrm { P r e c i s i o n } } _ { F i d e l i t y } , \underbrace { \beta { \mathrm { - } } \mathrm { R e c a l l } } _ { D i v e r s i t y } , \underbrace { { \mathrm { A u t h e n t i c i t y } } } _ { G e n e r a l i z a t i o n } ) .
52
+ $$
53
+
54
+ The $\alpha$ -Precision and $\beta$ -Recall metrics are generalizations of the conventional notions of precision and recall used in binary classification analysis (Flach & Kull (2015)). Precision measures the rate by which the model synthesizes “realistic-looking” samples, whereas the recall measures the fraction of real samples that are covered by $\mathbb { P } _ { g }$ . The authenticity score measures the fraction of synthetic samples that are invented by the model and not copied from the training data.
55
+
56
+ # 2.3 EVALUATION AND AUDITING PIPELINES
57
+
58
+ Having provided a bird’s-eye view of our proposed metric $\varepsilon$ , we now briefly summarize the steps involved in the evaluation and auditing tasks. Since statistical comparisons of complex data types in the raw input space $\mathcal { X }$ are difficult, the evaluation pipeline starts by embedding $X _ { r }$ and $X _ { g }$ into a “meaningful” feature space through a representation $\Phi$ , dubbed the evaluation embedding, and then computing $\varepsilon$ on the embedded features (see Figure 2(a)). In Section 4, we propose a representation learning approach to construct embeddings tailored to our metric and the data set at hand.
59
+
60
+ In the (post-hoc) model auditing task, we compute the sample-level metrics for each $X _ { g , j }$ in $\mathcal { D } _ { \boldsymbol { s y n t h } }$ , and discard samples with low authenticity and/or precision scores, which results in a “curated” synthetic data set with an improved overall performance. When granted direct access to the model $\mathbb { P } _ { g }$ , the auditor serves as a rejection sampler that repeatedly draws samples from $\mathbb { P } _ { g }$ , only accepting ones with high precision and authenticity (Figure 2(b)). Model auditing is possible through our metrics as they can be used to evaluate the quality of individual synthetic samples; the same task cannot be carried out with statistical divergence measures that compare the overall real and generative distributions.
61
+
62
+ ![](images/c619ae1dcb069c440d59dccda5e10bbe9424285d890c70652818cc2c398baa1b.jpg)
63
+ Figure 2: The evaluation and auditing pipelines.
64
+
65
+ # 3 $\alpha$ -PRECISION, $\beta$ -RECALL AND AUTHENTICITY
66
+
67
+ # 3.1 DEFINITIONS AND NOTATIONS
68
+
69
+ Let $\widetilde X _ { r } = \Phi ( X _ { r } )$ and $\widetilde { X } _ { g } = \Phi ( X _ { g } )$ be the embedded real and synthetic features. For simplicity, we will use $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ to refer to the distributions over the raw and embedded features interchangeably. Let $\begin{array} { r } { S _ { r } = \operatorname { s u p p } ( \bar { \mathbb { P } _ { r } } ) } \end{array}$ and $S _ { g } = \operatorname { s u p p } ( \mathbb { P } _ { g } )$ , where $\operatorname { s u p p } ( \mathbb { P } )$ is the support of $\mathbb { P }$ . Central to our proposed metrics is a more general notion for the support of a distribution $\mathbb { P }$ , which we dub the $\alpha$ -support. We define the $\alpha$ -support as the smallest subset of $\begin{array} { r } { \begin{array} { r } { S = \operatorname* { s u p p } ( \mathbb { P } ) } \end{array} } \end{array}$ supporting a probability mass $\alpha$ , i.e.,
70
+
71
+ $$
72
+ S ^ { \alpha } \triangleq \operatorname* { m i n } _ { s \subseteq S } V ( s ) , s . t . \mathbb { P } ( s ) = \alpha ,
73
+ $$
74
+
75
+ where $V ( s )$ is the volume (Lebesgue measure) of $s$ , and $\alpha \in [ 0 , 1 ]$ . One can think of an $\alpha$ -support as dividing the full support of $\mathbb { P }$ into “normal” samples concentrated in $S ^ { \alpha }$ , and “outliers” residing in $\bar { S } ^ { \alpha }$ , where $\textstyle S = { \mathcal { S } } ^ { \alpha } { \dot { \cup } } { \bar { S } } ^ { \alpha }$ . The notion of $\alpha$ -support is also known as the minimum volume set, and has been traditionally used in outlier detection models (Polonik (1997); Scott & Nowak (2006)).
76
+
77
+ Finally, we define the distance between a data sample $X$ and the training data $\mathcal { D } _ { r e a l }$ as the distance between $X$ and the closest sample in $\mathcal { D } _ { r e a l }$ , i.e.,
78
+
79
+ $$
80
+ d ( X , { \mathcal { D } } _ { r e a l } ) = \operatorname* { m i n } _ { 1 \leq i \leq n } d ( X , X _ { r , i } ) ,
81
+ $$
82
+
83
+ where $d$ is a distance metric defined over the input space $\mathcal { X }$ .
84
+
85
+ # 3.2 SAMPLE-LEVEL EVALUATION METRICS
86
+
87
+ # 3.2.1 $\alpha$ -PRECISION AND $\beta$ -RECALL
88
+
89
+ $_ { \pmb { \alpha } }$ -Precision. The conventional Precision metric is defined as the probability that a generated sample is supported by the real distribution, i.e. $\mathbb { P } ( \widetilde { X } _ { g } \in { \mathcal { S } } _ { r } )$ (Sajjadi et al. (2018)). We propose a more refined measure of sample fidelity, dubbed the $\alpha$ -Precision (denoted as $P _ { \alpha }$ ), defined as follows:
90
+
91
+ $$
92
+ P _ { \alpha } \ \triangleq \ \mathbb { P } ( \widetilde { X } _ { g } \in { \mathcal { S } _ { r } ^ { \alpha } } ) , \mathrm { ~ f o r ~ } \alpha \in [ 0 , 1 ] .
93
+ $$
94
+
95
+ That is, $P _ { \alpha }$ is the probability that a synthetic sample resides in the $\alpha$ -support of the real distribution.
96
+
97
+ $\beta$ -Recall. To assess diversity in synthetic data, we propose the $\beta$ -Recall metric as a generalization of the conventional Recall metric. Formally, we define the $\beta$ -Recall as follows:
98
+
99
+ $$
100
+ R _ { \beta } \ \triangleq \ \mathbb { P } ( \widetilde { X } _ { r } \in S _ { g } ^ { \beta } ) , \mathrm { f o r } \beta \in [ 0 , 1 ] ,
101
+ $$
102
+
103
+ i.e., $R _ { \beta }$ is the fraction of real samples that reside in the $\beta$ -support of the generative distribution.
104
+
105
+ ![](images/c120047c6df5cd941104694401658ba62a97025caddf5592655083fc9acf23fa.jpg)
106
+ Figure 3: Interpretation of the $P _ { \alpha }$ and $R _ { \beta }$ curves. Real distribution is colored in blue, generative distribution is in red. Distributions are collapsed into 1 dimension for simplicity. Here, $\mathbb { P } _ { r }$ is a multimodal distribution of cat images, with one mode representing orange tabby cats and another mode for Calico cats; outliers comprise exotic Caracal cats. Shaded areas represent the probability mass covered by $\alpha \cdot$ - and $\beta$ -supports—these supports concentrate around the modes, but need not be contiguous for multimodal distributions, i.e., we have $S _ { r } ^ { \alpha } =$ $S _ { r , 1 } ^ { \alpha } \cup S _ { r , 2 } ^ { \alpha }$ , and $S _ { g _ { . } } ^ { \beta } = S _ { g , 1 } ^ { \beta } \cup S _ { g , 2 } ^ { \beta }$ . (a) Here, the model $\mathbb { P } _ { g }$ exhibits mode collapse where it over-represents orange tabbies. Such model would achieve a precision score of $P _ { 1 } = 1$ but a suboptimal (concave) $P _ { \alpha }$ curve (panel (d)). Because it does not cover all modes, the model will have both a suboptimal $R _ { 1 }$ score and $R _ { \beta }$ curve. (b) This model perfectly nails the support of $\mathbb { P } _ { r }$ , hence it scores optimal standard metrics $P _ { 1 } = R _ { 1 } = 1$ . However, the model invents a mode by over-representing outliers, where it mostly generates images for the exotic cat breed. Standard metrics imply that model (a) outperforms (b) where in reality (a) is more faithful to the real data. $P _ { \alpha }$ and $R _ { \beta }$ give us a fuller picture of the comparative performances of both models. (c) This model realizes both types of cats but estimates a slightly shifted support and density; intuitively, this is the best of the three models, but it will appear inferior to (b) under $P _ { 1 }$ and $R _ { 1 }$ . By examining the $P _ { \alpha ^ { - } } R _ { \beta }$ curves, we see that model (c) has less deviation from optimal performance (the dashed black lines in panel (d)).
107
+
108
+ Interpreting $_ { \pmb { \alpha } }$ -Precision and $\beta$ -Recall. To interpret (4) and (5), we first need to revisit the notion of $\alpha$ -support. From (2), we know that an $\alpha$ -support hosts the most densely packed probability mass $\alpha$ in a distribution, hence $S _ { r } ^ { \alpha }$ and $S _ { g } ^ { \beta }$ always concentrate around the modes of $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ (Figure 3); samples residing outside of $S _ { r } ^ { \alpha }$ and $S _ { g } ^ { \beta }$ can be thought of as outliers. In this sense, $P _ { \alpha }$ and $R _ { \beta }$ do not count outliers when assessing fidelity and diversity. That is, the $\alpha$ -Precision score deems a synthetic sample to be of a high fidelity not only if it looks “realistic”, but also if it looks “typical”. Similarly, $\beta$ -Recall counts a real sample as being covered by $\mathbb { P } _ { g }$ only if it is not an outlier in $\mathbb { P } _ { g }$ . By sweeping the values of $\alpha$ and $\beta$ from 0 to 1, we obtain a varying definition of which samples are typical and which are outliers—this gives us entire $P _ { \alpha }$ and $R _ { \beta }$ curves as illustrated in Figure 3.
109
+
110
+ Generalizing precision-recall analysis. Unlike standard precision and recall, $P _ { \alpha }$ and $R _ { \beta }$ take into account not only the supports of $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ , but also their densities. Standard precision (and recall) correspond to one point on the $P _ { \alpha }$ (and $R _ { \beta }$ ) curve; they coincide with $P _ { \alpha }$ and $R _ { \beta }$ evaluated on the full supports (i.e., $P _ { 1 }$ and $R _ { 1 }$ ). By defining our metrics with respect to the $\alpha$ - and $\beta$ -supports, we do not treat all samples equally, but assign higher importance to samples in “denser” regions of $S _ { r }$ and $ { \boldsymbol { S } } _ { g }$ . $P _ { \alpha }$ and $R _ { \beta }$ reflect the extent to which $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ are calibrated— i.e., good $P _ { \alpha }$ and $R _ { \beta }$ are achieved when $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ share the same modes and not just a common support.
111
+
112
+ Our proposed $P _ { \alpha }$ and $R _ { \beta }$ metrics address major shortcomings of the commonly used $P _ { 1 }$ and $R _ { 1 }$ , among these are: lack of robustness to outliers, failure to detect matching distributions, and inability to diagnose different types of distributional failure (Naeem et al. (2020)). Basically, $\mathbb { P } _ { g }$ will score perfectly on precision and recall $R _ { 1 } = P _ { 1 } = 1$ ) as long as it nails the support of $\mathbb { P } _ { r }$ , even if $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ place totally different densities on their common support. Figure 3 illustrates how our metrics remedy these shortcomings. While optimal $R _ { 1 }$ and $P _ { 1 }$ are achieved by arbitrarily mismatched densities, our $P _ { \alpha }$ and $R _ { \beta }$ curves are optimized only when $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ are identical as stated by Theorem 1.
113
+
114
+ Theorem 1. The $\alpha$ -Precision and $\beta$ -Recall satisfy the condition $P _ { \alpha } / \alpha = R _ { \beta } / \beta = 1$ , $\forall \alpha , \beta$ , if and only if the generative and real densities are identical, i.e., $\mathbb { P } _ { g } = \mathbb { P } _ { r }$ .
115
+
116
+ That is, a model is optimal if and only if its $P _ { \alpha }$ and $R _ { \beta }$ are both straight lines with unity slopes.
117
+
118
+ Measuring statistical discrepancy with $P _ { \alpha }$ and $R _ { \beta }$ . While the $P _ { \alpha }$ and $R _ { \beta }$ curves provide a detailed view on a model’s fidelity and diversity, it is often more convenient to summarize performance in a single number. To this end, we define the mean absolute deviation of $P _ { \alpha }$ and $R _ { \beta }$ as:
119
+
120
+ $$
121
+ \Delta P _ { \alpha } = \int _ { 0 } ^ { 1 } \left| P _ { \alpha } - \alpha \right| d \alpha , ~ \Delta R _ { \beta } = \int _ { 0 } ^ { 1 } \left| R _ { \beta } - \beta \right| d \beta ,
122
+ $$
123
+
124
+ where $\Delta P _ { \alpha } \in [ 0 , 1 / 2 ]$ and $\Delta R _ { \beta } \in [ 0 , 1 / 2 ]$ quantify the extent to which $P _ { \alpha }$ and $R _ { \beta }$ deviate from their optimal values. We define the integrated $P _ { \alpha }$ and $R _ { \beta }$ metrics as $I P _ { \alpha } = 1 - 2 \Delta P _ { \alpha }$ and $I R _ { \beta } =$ $1 - 2 \Delta R _ { \beta }$ , both take values in $[ 0 , 1 ]$ . From Theorem 1, $\dot { I } P _ { \alpha } = I R _ { \beta } = 1$ only if $\mathbb { P } _ { g } = \mathbb { P } _ { r }$ .
125
+
126
+ Together, $I P _ { \alpha }$ and $I R _ { \beta }$ serve as a measure of the discrepancy between the distributions $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ , eliminating the need to augment our precision-recall analysis with measures of statistical divergence. Moreover, unlike $f$ -divergence measures, the $( I P _ { \alpha } , I R _ { \beta } )$ metric disentangles fidelity and diversity into separate components, and does not require that $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ share a common support.
127
+
128
+ # 3.2.2 AUTHENTICITY
129
+
130
+ Generalization is independent of precision and recall since a model can achieve perfect fidelity and diversity without truly generating any samples, simply by resampling training data. Unlike discriminative models for which generalization is easily tested via held-out data, evaluating generalization in generative models is not straightforward (Adlam et al. (2019); Meehan et al. (2020)). We propose an authenticity score $A \in [ 0 , 1 ]$ to quantify the rate by which a model generates new samples. To pin down a mathematical definition for $A$ , we reformulate $\mathbb { P } _ { g }$ as a mixture of densities as follows:
131
+
132
+ $$
133
+ \mathbb { P } _ { g } = A \cdot \mathbb { P } _ { g } ^ { \prime } + ( 1 - A ) \cdot \delta _ { g , \epsilon } ,
134
+ $$
135
+
136
+ where $\mathbb { P } _ { g } ^ { \prime }$ is the generative distribution conditioned on the synthetic samples being non-overfitted, and $\delta _ { g , \epsilon }$ is a noisy distribution over training data. In particular, we define $\delta _ { g , \epsilon }$ as $\delta _ { g , \epsilon } = \delta _ { g } * N ( 0 , \epsilon ^ { 2 } )$ , where $\delta _ { g }$ is a discrete distribution that places an unknown probability mass on each training data point in $\mathbf { \mathcal { D } } _ { r e a l }$ , $\epsilon$ is an arbitrarily small noise variance, and $^ *$ is the convolution operator. Essentially, (7) assumes that the model flips a (biased coin), pulling off a training sample with probability $1 - A$ and adding some noise to it, or innovating a new sample with probability $A$ . A model with $A = 1$ always innovates, whereas an overfitted model will concentrate $\mathbb { P } _ { g }$ around the training data.
137
+
138
+ # 4 ESTIMATING THE EVALUATION METRIC
139
+
140
+ Since the metrics in Section 3 are defined through binary conditions on individual samples, we can obtain an estimate $\widehat { \pmb { \mathscr { E } } } = ( \widehat { P } _ { \alpha } , \widehat { R } _ { \beta } , \widehat { A } )$ of the metric $\varepsilon$ , for a given $\alpha$ and $\beta$ , by assigning binary scores $\widehat { P } _ { \alpha , j }$ , $\widehat { A } _ { j } \in \{ 0 , 1 \}$ to each synthetic sample $\widetilde { X } _ { g , j }$ in $\mathcal { D } _ { \boldsymbol { s y n t h } }$ , and $\widehat { R } _ { \beta , i } \in \{ 0 , 1 \}$ to each real sample $\widetilde { X } _ { r , i }$ in $\mathcal { D } _ { r e a l }$ , then averaging over all samples, i.e., $\begin{array} { r } { \widehat { P } _ { \alpha } = \frac { 1 } { m } \sum _ { j } \widehat { P } _ { \alpha , j } } \end{array}$ , $\begin{array} { r } { \widehat { R } _ { \beta } = \frac { 1 } { n } \sum _ { i } \widehat { R } _ { \beta , i } } \end{array}$ , $\begin{array} { r } { \widehat { A } = \frac { 1 } { m } \sum _ { j } \widehat { A } _ { j } } \end{array}$ . To assign binary scores, we construct 3 classifiers $f _ { P }$ , $f _ { R }$ , $f _ { A } : { \widetilde { \mathcal { X } } } \to \{ 0 , 1 \}$ , where $\widehat { P } _ { \alpha , j } = f _ { P } ( \widehat { X } _ { g , j } )$ , $\widehat { R } _ { \beta , i } = \overline { { f } } _ { R } ( \widehat { X } _ { r , i } )$ and $\widehat { A } _ { j } = f _ { A } ( \widehat { X } _ { g , j } )$ . We explain the operation of each classifier in what follows.
141
+
142
+ Precision and Recall classifiers. Based on definitions (4) and (5), both classifiers check if a sample resides in an $\alpha \cdot$ - (or $\beta$ -) support, i.e., $f _ { P } ( \widetilde { X } _ { g } ) = \mathbf { 1 } \{ \widetilde { X } _ { g } \in \dot { \mathcal { S } } _ { r } ^ { \alpha } \}$ and $\hat { f } _ { R } ( \widetilde { X } _ { r } ) = \mathbf { 1 } \{ \widetilde { X } _ { r } \in \widehat { S } _ { g } ^ { \beta } \}$ . Hence, the main difficulty in implementing $f _ { P }$ and $f _ { R }$ is estimating the supports $\widehat { S } _ { r } ^ { \alpha }$ and $\widehat { S } _ { g } ^ { \beta }$ —in fact, even if we know the exact distributions $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ , computing their $\alpha$ - and $\beta$ -supports is not straightforward as it involves solving the optimization problem in (2).
143
+
144
+ To address this challenge, we pre-process the real and synthetic data in a way that renders estimation of $\alpha$ -and $\beta$ -supports straightforward. The idea is to train the evaluation embedding $\Phi$ so as to cast the supports of the real data, $S _ { r }$ , into a hypersphere with radius $r$ , and cast the distribution $\mathbb { P } _ { r }$ into an isotropic density concentrated around the center $c _ { r }$ of the hypersphere. We achieve this by modeling $\Phi$ as a one-class neural network trained with the following loss function: $L = \sum _ { i } \ell _ { i }$ , where
145
+
146
+ $$
147
+ \ell _ { i } = r ^ { 2 } + \frac { 1 } { \nu } \operatorname* { m a x } \{ 0 , \| \Phi ( X _ { r , i } ) - c _ { r } \| ^ { 2 } - r ^ { 2 } \} .
148
+ $$
149
+
150
+ The loss is minimized over the radius $r$ and the parameters of $\Phi$ ; the output dimensions of $\Phi$ , $c _ { r }$ and $\nu$ are viewed as hyperparameters (see Supplementary material). The loss in (8) is based on the seminal
151
+
152
+ work on one-class SVMs in (Scholkopf et al. ¨ (2001)), which is commonly applied to outlier detection problems, e.g., (Ruff et al. (2018)). In a nutshell, the evaluation embedding squeezes real data into the minimum-volume hypersphere centered around $c _ { r }$ , hence the real $\alpha$ -support is estimated as:
153
+
154
+ $$
155
+ \begin{array} { r } { \widehat { S } _ { r } ^ { \alpha } = B ( c _ { r } , \widehat { r } _ { \alpha } ) , \widehat { r } _ { \alpha } = \widehat { Q } _ { \alpha } \{ \| \widetilde { X } _ { r , i } - c _ { r } \| : 1 \leq i \leq n \} , } \end{array}
156
+ $$
157
+
158
+ where $\boldsymbol { B } ( \boldsymbol { c } , \boldsymbol { r } )$ is a Euclidean ball with center $c$ and radius $r$ , and $\widehat { Q } _ { \alpha }$ is the $\alpha$ -quantile function. The set of all $\alpha$ -supports of $\mathbb { P } _ { r }$ corresponds to the set of all concentric spheres with center $c _ { r }$ and radii $\widehat { r } _ { \alpha }$ , $\forall \alpha \in [ 0 , 1 ]$ . Thus, the precision classifier assigns a score 1 to a synthetic sample $\widetilde { X } _ { g }$ if it resides in the Ball $\widehat { S } _ { r } ^ { \alpha }$ , i.e., $f _ { p } ( \widetilde { X } _ { g } ) = \mathbf { 1 } \{ \| \widetilde { X } _ { g } - c _ { r } \| \le \widehat { r } _ { \alpha } \}$ . Now define $\begin{array} { r } { c _ { g } = \frac { 1 } { m } \sum _ { j } \widetilde { X } _ { g , j } } \end{array}$ , and consider a hypersphere $B ( c _ { g } , \widehat { r } _ { \beta } )$ , where $\widehat { r } _ { \beta } = \widehat { Q } _ { \beta } \{ \| \widetilde { X } _ { g , j } - c _ { g } \| : 1 \le j \le m \}$ . We construct $f _ { R }$ as follows:
159
+
160
+ $$
161
+ f _ { R } ( \widetilde { X } _ { r , i } ) = \mathbf { 1 } \{ \widetilde { X } _ { g , j ^ { * } } ^ { \beta } \in B ( \widetilde { X } _ { r , i } , \mathrm { N N D } _ { k } ( \widetilde { X } _ { r , i } ) ) \} ,
162
+ $$
163
+
164
+ where $\widetilde { X } _ { g , j ^ { * } } ^ { \beta }$ is the synthetic sample in $B ( c _ { g } , \widehat { r } _ { \beta } )$ that is closest to $\widetilde { X } _ { r , i }$ , and $\mathrm { N N D } _ { k } ( \widetilde { X } _ { r , i } )$ is the distance between $\widetilde { X } _ { r , i }$ and its $k$ -nearest neighbor in $\mathcal { D } _ { r e a l }$ . Similar to the estimator in (Naeem et al. (2020)), (10) is a nonparametric estimate of $S _ { g } ^ { \beta }$ that checks if each real sample $i$ is locally covered by a synthetic sample in $B ( c _ { g } , \widehat { r } _ { \beta } )$ . A discussion on how to select the hyper-parameter $k$ , as well as an alternative method for estimating $S _ { g } ^ { \beta }$ using one-class representations is provided in the Appendix.
165
+
166
+ Authenticity classifier. We derive the classifier $f _ { A }$ from a hypothesis test that tests if a sample $\widetilde { X } _ { g , j }$ is non-memorized. Let $\mathcal { H } _ { 1 } : A _ { j } = 1$ be the hypothesis that $\widetilde { X } _ { g , j }$ is authentic, with the null hypothesis $\mathcal { H } _ { 0 } : A _ { j } = 0$ . To test the hypothesis, we use the likelihood-ratio statistic (Van Trees (2004)):
167
+
168
+ $$
169
+ \Lambda ( \widetilde { X } _ { g , j } ) = \mathbb { P } ( \widetilde { X } _ { g , j } \mid A _ { j } = 1 ) / \mathbb { P } ( \widetilde { X } _ { g , j } \mid A _ { j } = 0 ) = \mathbb { P } _ { g } ^ { \prime } ( \widetilde { X } _ { g , j } ) / \delta _ { g , \epsilon } ( \widetilde { X } _ { g , j } ) ,
170
+ $$
171
+
172
+ which follows from (7). Since both likelihood functions in (11) are unknown, we need to test the hypothesis $\mathcal { H } _ { 1 } : A _ { j } = 1$ using an alternative sufficient statistic with a known probability distribution.
173
+
174
+ Let $d _ { g , j } = d ( \widetilde { X } _ { g , j } , \mathcal { D } _ { r e a l } )$ be the distance between synthetic sample $j$ and the training data set, and let $i ^ { * }$ be the training sample in $\mathcal { D } _ { r e a l }$ closest to $X _ { g , j }$ , i.e., $d _ { g , j } = d ( \widetilde { X } _ { g , j } , \widetilde { X } _ { r , i ^ { * } } )$ . Let $d _ { r , i ^ { * } }$ be the distance between $\widetilde { X } _ { r , i ^ { * } }$ and $\mathcal { D } _ { r e a l } / \{ \widetilde { X } _ { r , i ^ { * } } \}$ , i.e., the training data with sample $i ^ { * }$ removed. Now consider the statistic $a _ { j } = \mathbf { 1 } \{ d _ { g , j } \leq d _ { r , i ^ { * } } \}$ , which indicates if synthetic sample $j$ is closer to training data than any other training sample. The likelihood ratio for observations $\{ a _ { j } \} _ { j }$ under hypotheses $\mathcal { H } _ { 0 }$ and $\mathcal { H } _ { 1 }$ is
175
+
176
+ $$
177
+ \Lambda ( a _ { j } ) = \mathbb { P } ( a _ { j } | A _ { j } = 1 ) / \mathbb { P } ( a _ { j } | A _ { j } = 0 ) \approx a _ { j } ^ { - 1 } \cdot \mathbb { P } ( d _ { g , j } \le d _ { r , i ^ { * } } | A _ { j } = 1 ) .
178
+ $$
179
+
180
+ Here, we used the fact that if sample $j$ is a memorized copy of $i ^ { * }$ , and if the noise variance $\epsilon$ in (7) is arbitrarily small, then $a _ { j } = 1$ almost surely and ${ \mathbb P } ( a _ { j } | A _ { j } = 0 ) \approx 1$ . If $j$ is authentic, then $\widetilde { X } _ { g , j }$ lies in the convex hull of the training data, and hence ${ \mathbb P } ( a _ { j } | A _ { j } = 0 ) \to 0$ and $\Lambda \infty$ for a large real data set. Thus, $f _ { A }$ issues a label $A _ { j } = 1$ if $a _ { j } = 0$ , and $A _ { j } = 0$ otherwise. Intuitively, $f _ { A }$ deems sample $j$ unauthentic if it is closer to $i ^ { * }$ than any other real sample in the training data.
181
+
182
+ # 5 EXPERIMENTS AND USE CASES
183
+
184
+ # 5.1 EVALUATING & AUDITING GENERATIVE MODELS FOR SYNTHESIZING COVID-19 DATA
185
+
186
+ In this experiment, we use our metric to assess the ability of different generative models to synthesize COVID-19 patient data that can be used for predictive modeling. Using SIVEP-Gripe (SIVEP-Gripe (2020)), a database of 99,557 COVID patients in Brazil, including sensitive data such as ethnicity. We use generative models to synthesize replicas of this data and fit predictive models to the replicas.
187
+
188
+ Models and baselines. We create 4 synthetic data sets using GAN, VAE, Wasserstein GANs with a gradient penalty (WGAN-GP) (Gulrajani et al. (2017)), and ADS-GAN, which is specifically designed to prevent patient identifiablity in generated data (Yoon et al. (2020)). To evaluate these synthetic data sets, we use Frechet Inception Distance (FID) ( ´ Heusel et al. (2017)), Precision/Recall $( P _ { 1 } / R _ { 1 } )$ (Sajjadi et al. (2018)), Density/Coverage $( D / C )$ (Naeem et al. (2020)), Parzen window likelihood $( P W )$ (Bengio et al. (2013)) and Wasserstein distance $( W )$ as baselines. On each synthetic data, we fit a predictive Logistic regression model to predict patient-level COVID-19 mortality.
189
+
190
+ ![](images/0ec544b6e7b5635d2d1506a18ede1c12aabf27d79cc729b86716f4e900e7de32.jpg)
191
+ Figure 4: Predictive modeling with synthetic data. (a) Here, we rank the 4 generative models (ADS-GAN: $\times$ , WGAN-GP: •, VAE: N, GAN: ) with respect to each evaluation metric (leftmost is best). For each metric, we train a predictive model on the synthetic data set with highest score, and test its AUC on real data. Ground-truth ranking of synthetic data is the ranking of the AUC of predictive models trained on them. (b) Hyper-parameter tuning for ADS-GAN. (Dashed lines are linear regression lines.) (c) Post-hoc auditing of ADS-GAN.
192
+
193
+ Predictive modeling with synthetic data. In the context of predictive modeling, a generative model is assessed with respect to its usefulness in training predictive models that generalize well on real data. Hence, the “ground-truth” ranking of the 4 generative models corresponds to the ranking of the AUC-ROC scores achieved by predictive models fit to their respective synthetic data sets and tested on real data (Figure 4(a)). The data synthesized by ADS-GAN $( \times )$ displayed the best performance, followed by WGAN-GP (•), VAE (N), and GAN (). To assess the accuracy of baseline evaluation metrics, we test if each metric can recover the ground-truth ranking of the 4 generative models (Figure 4(a)). Our integrated precision and recall metrics $I P _ { \alpha }$ and $I R _ { \beta }$ both assign the highest scores to ADS-GAN; $I P _ { \alpha }$ exactly nails the right ranking of generative models. On the other hand, competing metrics such as $P _ { 1 }$ , $C$ and $D$ , over-estimate the quality of VAE and WGAN-GP—if we use these metrics to decide which generative model to use, we will end up with predictive models that perform poorly, i.e. AUC-ROC of the predictive model fitted to synthetic data with best $P _ { 1 }$ is 0.55, compared to an AUC-ROC of 0.79 for our $I P _ { \alpha }$ score.
194
+
195
+ These results highlight the importance of accounting for the densities $\mathbb { P } _ { g }$ and $\mathbb { P } _ { r }$ , and not just their supports, when evaluating a generative model. This is because a shifted $\mathbb { P } _ { g }$ would result in a “covariate shift” in synthetic data, leading to poor generalization for predictive models fitted to it, even when real and synthetic support coincide. As we can see in Figure 4(a), metrics that compare distributions (our metrics, $P W$ and $F I D$ ), are able to accurately rank the 4 generative models.
196
+
197
+ Hyper-parameter tuning & the privacy-utility tradeoff. Another use case for our metric is hyperparameter optimization for generative models. Here, we focus on the best-performing model in our previous experiment: ADS-GAN. This model has a hyper-parameter $\lambda \in \mathbb { R }$ that determines the importance of the privacy-preservation loss function used to regularize the training of ADS-GAN (Yoon et al. (2020)): smaller values of $\lambda$ make the model more prone to overfitting, and hence privacy leakage. Figure 4(b) shows how our precision and authenticity metrics change with the different values of $\lambda$ : the curve provides an interpretable tradeoff between privacy and utility (e.g., for $\lambda = 2$ , an $A$ score of 0.4 means that $6 0 \%$ of patients may have personal information exposed). Increasing $\lambda$ improves privacy at the expense of precision. By visualizing this tradeoff using our metric, data holders can understand the risks of different modeling choices involved in data synthesis.
198
+
199
+ Improving synthetic data via model auditing. Our metrics are not only useful for hyper-parameter tuning, but can also be used to improve the quality of synthetic data generated by an already-trained model using (post-hoc) auditing. Because our metrics are defined on the sample level, we can discard unauthentic or imprecise samples. This does not only lead to nearly optimal precision and authenticity for the curated data (Figure 4(c)), but also improves the AUC-ROC of the predictive model fitted to audited data $\mathrm { f r o m } 0 . 7 6$ to 0.78 for the audited ADS-GAN synthetic data, $p < 0 . 0 0 5 )$ , since auditing eliminates noisy data points that would otherwise undermine generalization performance.
200
+
201
+ # 5.2 DIAGNOSING GENERATIVE DISTRIBUTIONS OF MNIST
202
+
203
+ In this experiment, we test the ability of our metrics to detect common modes of failure in generative modeling—in particular, we emulate a mode dropping scenario, where the generative model fails to recognize the distinct modes in a multimodal distribution $\mathbb { P } _ { r }$ , and instead recovers a single mode in $\mathbb { P } _ { g }$ . To construct this scenario, we fit a conditional GAN (CGAN) model (Wang et al. (2018)) on the MNIST data set, and generate 1,000 samples for each of the digits 0-9. (We can think of each digit as a distinct mode in $\mathbb { P } _ { r }$ .) To apply mode dropping, we first sample 1,000 instances of each digit from the CGAN, and then delete individual samples of digits 1 to 9 with a probability $P _ { d r o p }$ , and replace the deleted samples with new samples of the digit 0 to complete a data set of 10,000 instances. The parameter $\bar { P _ { d r o p } } \in [ 0 , 1 ]$ determines the severity of mode dropping: for $P _ { d r o p } = 0$ , the data set has all digits being equally represented with 1,000 samples, and for $P _ { d r o p } = 1$ , the data set has 10,000 samples of the digit 0 only as depicted pictorially in Figure 5(a) (bottom panel).
204
+
205
+ ![](images/129a8efbd37643c1262c8b569d94c1eec1f721557587baf6496de8dfa5cc738f.jpg)
206
+ Figure 5: (a) Diagnosing mode collapse in MNIST data. (b) Results for the hide-and-seek competition.
207
+
208
+ We show how the different evaluation metrics respond to varying $P _ { d r o p }$ from 0 to 1 in Figure 5(a) (top). Because mode dropping pushes the generative distribution away from the real one, statistical distance metrics such as $W$ and $F I D$ increase as $P _ { d r o p }$ approaches 1. However, these metrics only reflect a discrepancy between $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ , and do not disentangle the Fidelity and Diversity components of this discrepancy. On the other hand, standard precision and recall metric are completely insensitive to mode dropping except for the extreme case when $P _ { d r o p } = 1$ . This is because both metrics only check supports of $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ , so they cannot recognize mode dropping as long as there is a non-zero probability that the model will generates digits 1-9. On the contrary, mode dropping reflects in our metrics, which manifest in a declining $I R _ { \beta }$ as $P _ { d r o p }$ increases. Since mode dropping affects coverage of digits and not the quality of images, it only affects $I R _ { \beta }$ but not $I P _ { \alpha }$ .
209
+
210
+ # 5.3 REVISITING THE HIDE-AND-SEEK CHALLENGE FOR SYNTHESIZING TIME-SERIES DATA
211
+
212
+ Finally, we use our metric to re-evaluate the generative models submitted to the NeurIPS 2020 Hide-and-Seek competition (Jordon et al. (2020)). In this competition, participants were required to synthesize intensive care time-series data based on real data from the AmsterdamUMCdb database. A total of 16 submissions were judged based on the accuracy of predictive models fit to the synthetic data (an approach similar to the one in Section 5.1). The submissions followed various modeling choices, including recurrent GANs, autoencoders, differential privacy GANs, etc. Details of all submissions are available online. Surprisingly, the winning submission was a very simplistic model that adds Gaussian noise to the real data to create new samples.
213
+
214
+ To evaluate our metrics on time-series data, we trained a Seq-2-Seq embedding that is augmented with our One-class representations to transform time-series into fixed feature vectors. (The architecture for this embedding is provided in the Supplementary material.) In Figure 5(b), we evaluate all submissions with respect to precision, recall and authenticity. As we can see, the winning submission comes out as one of the least authentic models, despite performing competitively in terms of precision and recall. This highlights the detrimental impact of using na¨ıve metrics for evaluating generative models—based on the competition results, clinical institutions seeking to create synthetic data sets may be led to believe that Submission 1 in Figure 5(b) is the right model to use. However, our metrics—which give a fuller picture of the true quality of all submissions—shows that such model creates unauthentic samples that are mere noisy copies of real data, which would pose risk to patient privacy. We hope that our metrics and our pre-trained Seq-2-Seq embeddings can help clinical institutions evaluate the quality of their synthetic time-series data in the future.
215
+
216
+ # REFERENCES
217
+
218
+ Ben Adlam, Charles Weill, and Amol Kapoor. Investigating under and overfitting in wasserstein generative adversarial networks. arXiv preprint arXiv:1910.14137, 2019.
219
+
220
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein gan. ´ arXiv preprint arXiv:1701.07875, 2017.
221
+
222
+ Pedro Baqui, Ioana Bica, Valerio Marra, Ari Ercole, and Mihaela van Der Schaar. Ethnic and regional variations in hospital mortality from covid-19 in brazil: a cross-sectional observational study. The Lancet Global Health, 8(8):e1018–e1026, 2020.
223
+
224
+ Yoshua Bengio, Gregoire Mesnil, Yann Dauphin, and Salah Rifai. Better mixing via deep represen- ´ tations. In International conference on machine learning, pp. 552–560. PMLR, 2013.
225
+
226
+ Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale gan training for high fidelity natural image synthesis. arXiv preprint arXiv:1809.11096, 2018.
227
+
228
+ 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. Ieee, 2009.
229
+
230
+ Peter Flach and Meelis Kull. Precision-recall-gain curves: Pr analysis done right. Advances in neural information processing systems, 28:838–846, 2015.
231
+
232
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. Advances in neural information processing systems, 27:2672–2680, 2014.
233
+
234
+ Arthur Gretton, Dino Sejdinovic, Heiko Strathmann, Sivaraman Balakrishnan, Massimiliano Pontil, Kenji Fukumizu, and Bharath K Sriperumbudur. Optimal kernel choice for large-scale two-sample tests. In Advances in neural information processing systems, pp. 1205–1213. Citeseer, 2012.
235
+
236
+ 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.
237
+
238
+ Michael Gutmann and Aapo Hyvarinen. Noise-contrastive estimation: A new estimation principle ¨ for unnormalized statistical models. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 297–304. JMLR Workshop and Conference Proceedings, 2010.
239
+
240
+ Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, Gunter Klambauer, and ¨ Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a nash equilibrium. 2017.
241
+
242
+ Geoffrey E Hinton. Training products of experts by minimizing contrastive divergence. Neural computation, 14(8):1771–1800, 2002.
243
+
244
+ Aapo Hyvarinen, Jarmo Hurri, and Patrik O Hoyer. Estimation of non-normalized statistical models. ¨ In Natural Image Statistics, pp. 419–426. Springer, 2009.
245
+
246
+ James Jordon, Daniel Jarrett, Jinsung Yoon, Tavian Barnes, Paul Elbers, Patrick Thoral, Ari Ercole, Cheng Zhang, Danielle Belgrave, and Mihaela van der Schaar. Hide-and-seek privacy challenge. arXiv preprint arXiv:2007.12087, 2020.
247
+
248
+ Diederik $\mathrm { \bf P }$ Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
249
+
250
+ Tuomas Kynka¨anniemi, Tero Karras, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Improved ¨ precision and recall metric for assessing generative models. In NeurIPS, 2019.
251
+
252
+ Yann LeCun. The mnist database of handwritten digits. http://yann. lecun. com/exdb/mnist/, 1998.
253
+
254
+ Mario Lucic, Karol Kurach, Marcin Michalski, Sylvain Gelly, and Olivier Bousquet. Are gans created equal? a large-scale study. Advances in neural information processing systems, 31:700– 709, 2018.
255
+
256
+ Casey Meehan, Kamalika Chaudhuri, and Sanjoy Dasgupta. A non-parametric test to detect datacopying in generative models. arXiv preprint arXiv:2004.05675, 2020.
257
+
258
+ Muhammad Ferjad Naeem, Seong Joon Oh, Youngjung Uh, Yunjey Choi, and Jaejun Yoo. Reliable fidelity and diversity metrics for generative models. International Conference on Machine Learning (ICML), 2020.
259
+
260
+ Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. In NIPS-W, 2017.
261
+
262
+ Wolfgang Polonik. Minimum volume sets and generalized quantile processes. Stochastic processes and their applications, 69(1):1–24, 1997.
263
+
264
+ Lukas Ruff, Robert Vandermeulen, Nico Goernitz, Lucas Deecke, Shoaib Ahmed Siddiqui, Alexander Binder, Emmanuel Muller, and Marius Kloft. Deep one-class classification. In ¨ International conference on machine learning, pp. 4393–4402. PMLR, 2018.
265
+
266
+ Mehdi SM Sajjadi, Olivier Bachem, Mario Lucic, Olivier Bousquet, and Sylvain Gelly. Assessing generative models via precision and recall. Advances in Neural Information Processing Systems, 31:5228–5237, 2018.
267
+
268
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. arXiv preprint arXiv:1606.03498, 2016.
269
+
270
+ Bernhard Scholkopf, John C Platt, John Shawe-Taylor, Alex J Smola, and Robert C Williamson. ¨ Estimating the support of a high-dimensional distribution. Neural computation, 13(7):1443–1471, 2001.
271
+
272
+ Clayton D Scott and Robert D Nowak. Learning minimum volume sets. The Journal of Machine Learning Research, 7:665–704, 2006.
273
+
274
+ SIVEP-Gripe. http://plataforma.saude.gov.br/coronavirus/dados-abertos/. In Ministry of Health. SIVEP-Gripe public dataset, (accessed May 10, 2020; in Portuguese), 2020.
275
+
276
+ Jascha Sohl-Dickstein, Peter B Battaglino, and Michael R DeWeese. New method for parameter estimation in probabilistic models: minimum probability flow. Physical review letters, 107(22): 220601, 2011.
277
+
278
+ Nitish Srivastava, Elman Mansimov, and Ruslan Salakhudinov. Unsupervised learning of video representations using lstms. In International conference on machine learning, pp. 843–852. PMLR, 2015.
279
+
280
+ Dougal J Sutherland, Hsiao-Yu Tung, Heiko Strathmann, Soumyajit De, Aaditya Ramdas, Alex Smola, and Arthur Gretton. Generative models and model criticism via optimized maximum mean discrepancy. arXiv preprint arXiv:1611.04488, 2016.
281
+
282
+ Lucas Theis, Aaron van den Oord, and Matthias Bethge. A note on the evaluation of generative ¨ models. arXiv preprint arXiv:1511.01844, 2015.
283
+
284
+ Harry L Van Trees. Detection, estimation, and modulation theory, part I: detection, estimation, and linear modulation theory. John Wiley & Sons, 2004.
285
+
286
+ Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. Highresolution image synthesis and semantic manipulation with conditional gans. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8798–8807, 2018.
287
+
288
+ Liyang Xie, Kaixiang Lin, Shu Wang, Fei Wang, and Jiayu Zhou. Differentially private generative adversarial network. arXiv preprint arXiv:1802.06739, 2018.
289
+
290
+ Jinsung Yoon, Lydia N Drumright, and Mihaela Van Der Schaar. Anonymization through data synthesis using generative adversarial networks (ads-gan). IEEE Journal of Biomedical and Health Informatics, 2020.
291
+
292
+ SUPPLEMENTARY MATERIAL
293
+
294
+ # APPENDIX A: LITERATURE REVIEW
295
+
296
+ In this Section, we provide a comprehensive survey of prior work, along with a detailed discussion on how our metric relates to existing ones. We classify existing metrics for evaluating generative models into two main classes:
297
+
298
+ # 1. Statistical divergence metrics
299
+
300
+ # 2. Precision and recall metrics
301
+
302
+ Divergence metrics are single-valued measures of the distance between the real and generative distributions, whereas precision-recall metrics classify real and generated samples as to whether they are covered by generative and real distributions, respectively. In what follows, we list examples of these two types of metrics, highlighting their limitations.
303
+
304
+ # Statistical divergence metrics.
305
+
306
+ The most straightforward approach for evaluating a generative distribution is to compute the model log-likelihood—for density estimation tasks, this has been the de-facto standard for training and evaluating generative models. However, the likelihood function is a model-dependent criteria: this is problematic because the likelihood of many state-of-the-art models is inaccessible. For instance, GANs are implicit likelihood models and hence provide no explicit expression for its achieved loglikelihood Goodfellow et al. (2014). Other models, energy-based models has a normalization constant in the likelihood expression that is generally difficult to compute as they require solving intractable complex integrals Kingma & Welling (2013).
307
+
308
+ Statistical divergence measures are alternative (model-independent) metrics that are related to loglikelihood, and are commonly used for training and evaluating generative models. Examples include lower bounds on the log-likelihood Kingma & Welling (2013), contrastive divergence and noise contrastive estimation Hinton (2002); Gutmann & Hyvarinen ¨ (2010), probability flow Sohl-Dickstein et al. (2011), score matching Hyvarinen et al.¨ (2009), maximum mean discrepancy (MMD) Gretton et al. (2012), and the Jensen-Shannon divergence (JSD).
309
+
310
+ In general, statistical divergence measures suffer from the following limitations. The first limitation is that likelihood-based measures can be inadequate in high-dimensional feature spaces. As has been shown in (Theis et al., 2015), one can construct scenarios with poor likelihood and great samples through a simple lookup table model, and vice versa, we can think of scenarios with great likelihood and poor samples. This is because, if the model samples white noise $9 9 \%$ of the time, and samples high-quality outputs $1 \%$ of the time, the log-likelihood will be hardly distinguishable from a model that samples high-quality outputs $100 \%$ of the time if the data dimension is large. Our metrics solve this problem by measuring the rate of error on a sample-level rather than evaluating the overall distribution of samples.
311
+
312
+ Moreover, statistical divergence measures collapse the different modes of failure of the generative distribution into a single number. This hinders our ability to diagnose the different modes of generative model failures such as mode dropping, mode collapse, poor coverage, etc.
313
+
314
+ # Precision and recall metrics.
315
+
316
+ Precision and recall metrics for evaluating generative models were originally proposed in Sajjadi et al. (2018). Our metrics differ from these metrics in various ways. First, unlike standard metrics, $\alpha$ -Precision and $\beta$ -Recall take into account not only the supports of $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ , but also the actual probability densities of both distributions. Standard precision (and recall) correspond to one point on the $P _ { \alpha }$ (and $R _ { \beta }$ ) curve; they are equal to $P _ { \alpha }$ and $R _ { \beta }$ evaluated on the full support (i.e., $P _ { 1 }$ and $R _ { 1 }$ ). By defining our metrics with respect to the $\alpha$ - and $\beta$ -supports, we do not treat all samples equally, but rather assign higher importance to samples that land in “denser” regions of $S _ { r }$ and $ { \boldsymbol { S } } _ { g }$ . Hence, $P _ { \alpha }$ and $R _ { \beta }$ reflect the extent to which $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ are calibrated—i.e., good $P _ { \alpha }$ and $R _ { \beta }$ curves are achieved when $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ share the same modes and not just a common support. While optimal $R _ { 1 }$ and $P _ { 1 }$ can be achieved by arbitrarily mismatched $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ , our $P _ { \alpha }$ and $R _ { \beta }$ curves are optimized only when $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ are identical as stated by Theorem 1.
317
+
318
+ The new $P _ { \alpha }$ and $R _ { \beta }$ metrics address the major shortcomings of precision and recall. Among these shortcomings are: lack of robustness to outliers, failure to detect matching distributions, and inability to diagnose different types of distributional failure (such as mode collapse, mode invention, or density shifts) Naeem et al. (2020). Basically, a model $\mathbb { P } _ { g }$ will score perfectly on precision and recall $( R _ { 1 } { = } P _ { 1 } { = } 1 )$ ) as long as it nails the support of $\mathbb { P } _ { r }$ , even if $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ place totally different densities on their common support.
319
+
320
+ In addition to the above, our metrics estimate the supports of real and generative distributions using neural networks rather than nearest neighbor estimates as in Naeem et al. (2020). This prevents our estimates from overestimating the supports of real and generative distributions, thereby overestimating the coverage or quality of the generated samples.
321
+
322
+ # APPENDIX B: PROOF OF THEOREM 1
323
+
324
+ To prove the statement of the Theorem, we need to prove the two following statements:
325
+
326
+ (1) $\mathbb { P } _ { g } = \mathbb { P } _ { r } ~ \to ~ P _ { \alpha } / \alpha = R _ { \beta } / \beta = 1 , \forall \alpha , \beta$ (2) $P _ { \alpha } / \alpha = R _ { \beta } / \beta = 1 , \forall \alpha , \beta \ \mathbb { P } _ { g } = \mathbb { P } _ { r }$
327
+
328
+ To prove (1), we start by noting that since we have $\mathbb { P } _ { g } = \mathbb { P } _ { r }$ , then $S _ { \alpha } ^ { g } = S _ { \alpha } ^ { r }$ , $\forall \alpha \in [ 0 , 1 ]$ . Thus, we have
329
+
330
+ $$
331
+ P _ { \alpha } = \mathbb { P } ( \widetilde { X } _ { g } \in \mathcal { S } _ { r } ^ { \alpha } ) = \mathbb { P } ( \widetilde { X } _ { g } \in \mathcal { S } _ { g } ^ { \alpha } ) = \alpha ,
332
+ $$
333
+
334
+ for all $\alpha \in [ 0 , 1 ]$ , and similarly, we have
335
+
336
+ $$
337
+ R _ { \beta } = \mathbb { P } ( \widetilde { X } _ { r } \in \mathcal { S } _ { g } ^ { \beta } ) = \mathbb { P } ( \widetilde { X } _ { r } \in \mathcal { S } _ { r } ^ { \beta } ) = \beta ,
338
+ $$
339
+
340
+ for all $\beta \in [ 0 , 1 ]$ , which concludes condition (1).
341
+
342
+ Now we consider condition (2). We first note that $S _ { r } ^ { \alpha } \subseteq S _ { r } ^ { \alpha ^ { \prime } }$ for all $\alpha ^ { \prime } > \alpha$ . If $P _ { \alpha } = \alpha$ for all $\alpha$ , then we have
343
+
344
+ $$
345
+ \mathbb { P } ( \widetilde { X } _ { g } \in S _ { r } ^ { \alpha } ) = \int _ { S _ { r } ^ { \alpha } } d \mathbb { P } _ { g } = \alpha , \forall \alpha \in [ 0 , 1 ] .
346
+ $$
347
+
348
+ Now assume that $\alpha ^ { \prime } = \alpha + \Delta \alpha$ , then we have
349
+
350
+ $$
351
+ \int _ { S _ { r } ^ { \alpha ^ { \prime } } / S _ { r } ^ { \alpha } } d \mathbb { P } _ { g } = \int _ { S _ { r } ^ { \alpha ^ { \prime } } / S _ { r } ^ { \alpha } } d \mathbb { P } _ { r } = \Delta \alpha .
352
+ $$
353
+
354
+ Thus, the probability masses of $\mathbb { P } _ { g }$ and $\mathbb { P } _ { r }$ are equal for all infinitesimally small region $S _ { r } ^ { \alpha + \Delta \alpha } / S _ { r } ^ { \alpha }$ (for $\Delta \alpha 0$ ) of the $\alpha$ -support of $\mathbb { P } _ { r }$ , hence $\mathbb { P } _ { g } = \mathbb { P } _ { r }$ for all subsets of $S _ { r } ^ { 1 }$ . By applying the similar argument to the recall metric, we also have $\mathbb { P } _ { g } = \mathbb { P } _ { r }$ for all subsets of $S _ { g } ^ { 1 }$ , and hence $\mathbb { P } _ { g } = \mathbb { P } _ { r }$ .
355
+
356
+ # APPENDIX C: ALTERNATIVE APPROACH FOR ESTIMATING THE SUPPORT OFSYNTHETIC DATA & CODE SNIPPETS
357
+
358
+ Instead of using a one-class represen $k$ -NNtion proach to estimate the generative support for each new synthetic sample being eval $S _ { g } ^ { \beta }$ , one could use a separateed. We provide code snip$\Phi _ { g }$
359
+ pets and comparisons between the two approaches in the an anonymized Colab notebook. While the two approaches perform rather similarly, we opt to adopt the $k$ -NN based approach to avoid potential biases induced by using a separate representation for each generative model when using our metric for model comparisons.
360
+
361
+ # APPENDIX D: EXPERIMENTAL DETAILS
362
+
363
+ # .1 DATA
364
+
365
+ In this research the argue for the versatility of our metrics, hence we have included results for tabular (static), time-series and image data (see Table 1). For the tabular data we use Baqui et al. (2020)’s preprocessed version of the SIVEP-GRIPE dataset of Brazilian ICU Covid-19 patient data. For the image experiments, we use the 10,000 samples in the default MNIST test set LeCun (1998). For proper evaluation of the authenticity metric, the same original data is used for training of generative models and evaluation of all metrics.
366
+
367
+ Table 1: Datasets used, with $n$ and $d$ the number of samples and features, respectively.
368
+
369
+ <table><tr><td>Name</td><td>Type</td><td>n</td><td>d</td><td>Embedding</td><td>demb</td></tr><tr><td>SIVEP-GRIPE</td><td>Tabular</td><td>6882</td><td>25</td><td>1</td><td>1</td></tr><tr><td>AmsterdamUMCdb</td><td>Time-series</td><td>7695</td><td>70</td><td>Seq-2-Seq</td><td>280</td></tr><tr><td>MNIST</td><td>Image</td><td>10000</td><td>784</td><td>InceptionV3</td><td>2048</td></tr></table>
370
+
371
+ For the time-series experiments, AmsterdamUMCdb is used in a manner exactly analogous to the NeurIPS 2020 Hide-and-Seek Privacy Challenge Jordon et al. (2020), which describes it as follows: “AmsterdamUMCdb was developed and released by Amsterdam UMC in the Netherlands and the European Society of Intensive Care Medicine (ESICM). It is the first freely accessible comprehensive and high resolution European intensive care database. It is also first to have addressed compliance with General Data Protection Regulation [...] AmsterdamUMCdb contains approximately 1 billion clinical data points related to 23,106 admissions of 20,109 unique patients between 2003 and 2016. The released data points include patient monitor and life support device data, laboratory measurements, clinical observations and scores, medical procedures and tasks, medication, fluid balance, diagnosis groups and clinical patient outcomes.”. Notably, only the longitudinal features from this database are kept, with static ones discarded. The same subset as was used in the competition for “hider” synthetic data generation is used; this consists of 7695 examples with 70 features (and a time column), sequence length is limited to 100 (the original data contains sequences of up to length 135,337). The features are normalised to [0, 1] and imputed as follows: (1) back-fill, (2) forward-fill, (3) feature median imputation. This preprocessing is chosen to match the competition Jordon et al. (2020). The competition “hider” submissions were trained on this dataset and the synthetic data generated.
372
+
373
+ For metric consistency and the avoidance of tedious architecture optimization for each data modality, we follow previous works (e.g. Heusel et al. (2017); Sajjadi et al. (2018); Kynka¨anniemi et al. ¨ (2019); Naeem et al. (2020)) and embed image and time series data into a static embedding. This is required, since the original space is non-euclidean and will result in failure of most metrics. The static embedding is used for computing baseline metrics, and is used as input for the One-Class embedder.
374
+
375
+ For finding static representations of MNIST, images are upscaled and embedded using InceptionV3 pre-trained on ImageNET without top layer. This is the same embedder used for computing Frchet Inception Distance Heusel et al. (2017). Very similar results were obtained using instead a VGG16 embedder Brock et al. (2018); Kynka¨anniemi et al. ¨ (2019). Preliminary experimentation with random VGG-16 models Naeem et al. (2020) did not yield stable results for neither baselines nor our methods.
376
+
377
+ # .2 TIME SERIES EMBEDDING
378
+
379
+ The time series embeddings used throughout this work are based on Unsupervised Learning of Video Representations using LSTMs Srivastava et al. (2015), specifically the “LSTM Autoencoder Mode”. A sequence-to-sequence LSTM network is trained, with the target sequence set as the input sequence (reversed for ease of optimization), see Figure 1. The encoder hidden and cell states ( $h$ and $c$ vectors) at the end of a sequence are used as the learned representation and are passed to the decoder during training. At inference, these are concatenated to obtain one fixed-length vector per example.
380
+
381
+ The specifics of the LSTM autoencoder used here are as follows. Two LSTM layers are used in each encoder and decoder. The size of $h , c$ vectors is 70 (280 after concatenation). The model was implemented in PyTorch Paszke et al. (2017), utilising sequence packing for computational efficiency. All autoencoders were trained to convergence on the original data; the synthetic time series data was passed through this at inference. The time column (when present in data) was discarded.
382
+
383
+ ![](images/fff0d1f16e9608339043e7c0919aa80595959001a7937d769ffbbfd18947bf2b.jpg)
384
+ Figure 1: Architecture of LSTM Autoencoder, sourced from Srivastava et al. (2015).
385
+
386
+ Table 2: Metrics on tabular data for different generative models. Row ”audited” contains results for data generated by ADS-GAN, but in which samples are rejected if they do not meet the precision or authenticity threshold.
387
+
388
+ <table><tr><td>Model</td><td>W</td><td>FD</td><td>Parzen</td><td>P1</td><td>R1</td><td>D</td><td>C</td><td>A</td><td>IPa</td><td>IRβ</td></tr><tr><td>VAE</td><td>2.2626</td><td>2.9697</td><td>-11.3653</td><td>1.0000</td><td>0.1022</td><td>1.3999</td><td>0.0926</td><td>0.5147</td><td>0.4774</td><td>0.0596</td></tr><tr><td>GAN</td><td>1.5790</td><td>1.8065</td><td>-10.7824</td><td>0.7059</td><td>0.0875</td><td>0.4316</td><td>0.0939</td><td>0.6077</td><td>0.9802</td><td>0.0648</td></tr><tr><td>WGAN-GP</td><td>-0.0194</td><td>0.0856</td><td>-8.3650</td><td>0.9439</td><td>0.7299</td><td>1.0709</td><td>0.8945</td><td>0.4712</td><td>0.9398</td><td>0.4468</td></tr><tr><td>ADS-GAN</td><td>0.3578</td><td>0.2134</td><td>-8.7952</td><td>0.8083</td><td>0.6133</td><td>0.4711</td><td>0.5357</td><td>0.5905</td><td>0.7744</td><td>0.2914</td></tr><tr><td>DPGAN</td><td>1.1216</td><td>0.9389</td><td>-8.8394</td><td>0.9923</td><td>0.1822</td><td>1.4885</td><td>0.5065</td><td>0.3793</td><td>0.9591</td><td>0.1863</td></tr><tr><td>audited</td><td>-0.0470</td><td>0.0600</td><td>-8.5408</td><td>0.8986</td><td>0.8737</td><td>0.7560</td><td>0.8050</td><td>1.0000</td><td>0.9994</td><td>0.1961</td></tr></table>
389
+
390
+ # .3 FULL RESULTS
391
+
392
+ Table 2 contains metrics computed on different generated versions of the SIVEP-GRIPE tabular dataset. Included metrics are Wasserstein distance, Frchet Distance $( F D )$ , Parzen window likelihood estimate, precision $P _ { 1 }$ , recall $R _ { 1 }$ , density $( D )$ , coverage $C$ and the proposed metrics, specifically integrated $\alpha$ -precision $I P _ { \alpha }$ , integrated $\beta$ -recall $I R _ { \beta }$ and authenticity $A$ . For the tabular data, data is generated using a VAE, GAN, Wasserstein GAN with gradient penalisation (WGAN-GP) Arjovsky et al. (2017), ADS-GAN Yoon et al. (2020), Differentially Private GAN (DP-GAN) Xie et al. (2018) and an ADS-GAN generated dataset in which samples are audited on precision and authenticity. Similarly, Table 3 contains metric results1 for MNIST, generated by a VAE, Deep convolution GAN (DCGAN), WGAN-GP and ADS-GAN. Table 4 contains results for MIMIC generation using different methods from the Hide-and-Seek Privacy Competition Jordon et al. (2020). The submission that won the competition is the penultimate model, Hamada. The last row shows results for an audited version of the Hamada dataset, in which we keep generating data using the Hamada model and discard samples that do not meet the precision or authenticity threshold.
393
+
394
+ Table 4: Metrics on AmsterdamUMCdb data for different generative models.
395
+
396
+ <table><tr><td>Model (CodaLab username)</td><td>W</td><td>FD</td><td>Parzen</td><td>P1</td><td>R1</td><td>D</td><td>C</td><td>A</td><td>IP</td><td>IRβ</td></tr><tr><td>Add noise [baseline]</td><td>40.6</td><td>497</td><td>-228</td><td>0.0013</td><td>0.0173</td><td>0.0003</td><td>0.0010</td><td>0.8450</td><td>0.5187</td><td>0.0148</td></tr><tr><td>Time-GAN [baseline]</td><td>249.0</td><td>30478</td><td>-1404</td><td>0.0000</td><td>0.6642</td><td>0.0000</td><td>0.0000</td><td>0.9991</td><td>0.5000</td><td>0.0005</td></tr><tr><td>akashdeepsingh</td><td>13.3</td><td>44</td><td>-34</td><td>0.7643</td><td>0.3566</td><td>0.4263</td><td>0.0741</td><td>0.3958</td><td>0.6074</td><td>0.1408</td></tr><tr><td>saeedsa</td><td>93.4</td><td>1509</td><td>-2597</td><td>0.0000</td><td>0.0000</td><td>0.0000</td><td>0.0000</td><td>0.9925</td><td>0.5018</td><td>0.0025</td></tr><tr><td>wangzq312</td><td>62.3</td><td>645</td><td>-119</td><td>0.4430</td><td>0.8630</td><td>0.0920</td><td>0.0061</td><td>0.7665</td><td>0.6116</td><td>0.0185</td></tr><tr><td>csetraynor</td><td>64.6</td><td>1604</td><td>-4710</td><td>0.0000</td><td>0.0000</td><td>0.0000</td><td>0.0000</td><td>1.0000</td><td>0.5339</td><td>0.0000</td></tr><tr><td> jilljenn</td><td>118.0</td><td>17235</td><td>-5874</td><td>0.0000</td><td>0.0000</td><td>0.0000</td><td>0.0000</td><td>1.0000</td><td>0.4999</td><td>0.0000</td></tr><tr><td>SatoshiHasegawa</td><td>2.4</td><td>33</td><td>-156</td><td>0.9333</td><td>0.3264</td><td>0.5626</td><td>0.0988</td><td>0.3172</td><td>0.8050</td><td>0.1717</td></tr><tr><td>flynngo</td><td>126.3</td><td>8786</td><td>-120</td><td>0.0359</td><td>0.7663</td><td>0.0087</td><td>0.0022</td><td>0.8448</td><td>0.6497</td><td>0.0271</td></tr><tr><td>tuscan-chicken-wrap</td><td>118.7</td><td>5344</td><td>-892</td><td>0.0000</td><td>0.0535</td><td>0.0000</td><td>0.0000</td><td>0.9854</td><td>0.5030</td><td>0.0053</td></tr><tr><td>Atrin</td><td>175.3</td><td>15159</td><td>-1933</td><td>0.0000</td><td>0.7306</td><td>0.0000</td><td>0.0000</td><td>0.9975</td><td>0.5008</td><td>0.0019</td></tr><tr><td>wangz10</td><td>113.8</td><td>4624</td><td>-221</td><td>0.0039</td><td>0.2993</td><td>0.0010</td><td>0.0019</td><td>0.8509</td><td>0.5141</td><td>0.0113</td></tr><tr><td>yingruiz</td><td>146.7</td><td>8973</td><td>-562</td><td>0.0069</td><td>0.0626</td><td>0.0014</td><td>0.0001</td><td>0.8995</td><td>0.5129</td><td>0.0062</td></tr><tr><td>yingjialin</td><td>138.9</td><td>8919</td><td>-570</td><td>0.0000</td><td>0.0613</td><td>0.0000</td><td>0.0000</td><td>0.8864</td><td>0.5011</td><td>0.0030</td></tr><tr><td>lumip</td><td>25.8</td><td>271</td><td>-78</td><td>0.1796</td><td>0.4749</td><td>0.0727</td><td>0.0256</td><td>0.6335</td><td>0.5938</td><td>0.0801</td></tr><tr><td>hamada</td><td>8.3</td><td>73</td><td>-192</td><td>0.8933</td><td>0.4010</td><td>0.5906</td><td>0.0398</td><td>0.3572</td><td>0.5482</td><td>0.0850</td></tr><tr><td>hamada [audited]</td><td>7.1</td><td>48</td><td>-204</td><td>0.9006</td><td>0.0665</td><td>0.5931</td><td>0.0444</td><td>1.0</td><td>0.9976</td><td>0.0334</td></tr></table>
397
+
398
+ # .4 HYPERPARAMETER OPTIMIZATION
399
+
400
+ # .4.1 BASELINES
401
+
402
+ For computing the density and coverage metrics, we set a threshold of 0.95 on the minimum expected coverage, as recommended in the original work (Eq. 9 Naeem et al. (2020)). For all datasets, this is achieved for $k = 5$ . For consistency in these comparisons, we use $k = 5$ for the precision and recall metrics too.
403
+
404
+ # .4.2 ONECLASS EMBEDDINGS
405
+
406
+ We use Deep SVDD Ruff et al. (2018) to embed static data into One-Class representations. To mitigate hypersphere collapse (Propostions 2 and 3 of Ruff et al. (2018)), we do not include a bias term and use ReLU activation for the One-Class embedder. Original data is split into training $( 8 0 \% )$ and validation $( 2 0 \% )$ set, and One-Class design is fine-tuned to minimise validation loss. We use the SoftBoundary objective (Eq. 3 Ruff et al. (2018)) with $\nu = 0 . 0 1$ and center $\mathbf c = \mathbf 1$ for tabular and time-series data and $\mathbf { c } = 1 0 \cdot \mathbf { 1 }$ for image data. Let $n _ { h }$ be the number of hidden layers with each $d _ { h }$ nodes, and let $d _ { z }$ be the dimension of the representation layer. For tabular data, we use $n _ { h } = 3$ , $d _ { h } = 3 2$ and $d _ { z } = 2 5$ ; for time-series data, $n _ { h } = 2$ , $d _ { h } = 1 2 8$ and $d _ { z } = 3 2$ ; and for MNIST $n _ { h } = 3$ , $d _ { h } = 1 2 8$ and $d _ { z } = 3 2$ . Models are implemented in PyTorch Paszke et al. (2017) and the AdamW optimizer is used with weight decay $1 0 ^ { \div 2 }$ .
407
+
408
+ For the $\beta$ -recall metric, estimating the support of synthetic data involves tuning the $k$ parameter of the $k$ -NN estimator. The $k$ parameter can be tuned by fitting the NN estimator on a portion of the data for every given $k$ , and then testing the recall on a held out (real) sample. The selected $k$ for each $\alpha$ is the smallest $k$ that covers $\alpha$ held out samples. Similar to Naeem et al. (2020), we found that through this procedure, $k = 5$ seems to come up as the optimal $k$ for most experiments.
409
+
410
+ # .5 TOY EXPERIMENTS
411
+
412
+ We include two toy experiments that highlight the advantage of the proposed metrics compared to previous works. We focus our comparison on the improved precision and recall Kynka¨anniemi et al. ¨ (2019) and density and coverage Naeem et al. (2020) metrics.
413
+
414
+ # .5.1 ROBUSTNESS TO OUTLIERS
415
+
416
+ Naeem et al. (2020) showed that the precision and recall metrics as proposed by Sajjadi et al. (2018); Kynka¨anniemi et al. ¨ (2019) are not robust to outliers. We replicate toy experiments to show the proposed $\alpha$ -Precision and $\beta$ -Recall do not suffer the same fate.
417
+
418
+ Let $X , Y \in \mathbb { R } ^ { d }$ denote original and synthetic samples respectively, with original $X \sim N ( 0 , I )$ and $Y \sim N ( \mu , I )$ . We compute all metrics for $\mu \in [ - 1 , 1 ]$ . In this setting we conduct three experiments:
419
+
420
+ 1. No outliers
421
+ 2. One outlier in the real data at $X = \mathbf { 1 }$
422
+ 3. One outlier in the synthetic data at $Y = \mathbf { 1 }$
423
+
424
+ We set $d = 6 4$ and both original and synthetic data we sample 10000 points. Subsequent metric scores are shown in Figure
425
+
426
+ ![](images/6d2281c327b0f5d4e974379492a8f846a100fbe1f701e21f6afd4fe6d64c873e.jpg)
427
+ Figure 2: Toy experiment I: outlier robustnes
428
+
429
+ As can be seen, the precision and recall metrics are not robust to outliers, as just a single outlier has dramatic effects. The $I P _ { \alpha }$ and $I R _ { \beta }$ are not affected, as the outlier does not belong to the $\alpha$ -support (or $\beta$ -support) unless $\alpha$ (or $\beta$ ) is large.
430
+
431
+ # .5.2 MODE RESOLUTION
432
+
433
+ The precision and recall metrics only take into account the support of original and synthetic data, but not the actual densities. The density and coverage metric do take this into account, but here we show these are not able to capture this well enough to distinguish similar distributions.
434
+
435
+ In this experiment we look at mode resolution: how well is the metric able to distinguish a single mode from two modes? Let the original distribution be a mixture of two gaussians that are separated by distance $\mu$ and have $\sigma = 1$ ,
436
+
437
+ $$
438
+ X \sim { \frac { 1 } { 2 } } N ( - { \frac { \mu } { 2 } } , 1 ) + { \frac { 1 } { 2 } } N ( + { \frac { \mu } { 2 } } , 1 )
439
+ $$
440
+
441
+ and let the synthetic data be given by
442
+
443
+ $$
444
+ Y \sim N ( 0 , 1 + \mu ^ { 2 } ) .
445
+ $$
446
+
447
+ This situation would arise if a synthetic data generator fails to distinguish the two nodes, and instead tries to capture the two close-by modes of the original distribution using a single mode. We compute metrics for $\mu \in [ 0 , 5 ]$ .
448
+
449
+ ![](images/626f1af6b74263040abc64af705dd214f9361de817ecd2f37bda28cab4cccaa4.jpg)
450
+ Figure 3: Toy experiment II: mode resolution
451
+
452
+ As can be seen, neither P&R nor $\mathrm { D } \& \mathbb { C }$ notice that the synthetic data only consists of a single mode, whereas the original data consisted of two. The $\alpha$ -precision metric is able to capture this metric: for small $\alpha$ the $\alpha$ -support of the original distribution is centred around the two separated, and does not contain the space that separates the modes (i.e. the mode of the synthetic data).
parse/dev/8qWazUd8Jm/8qWazUd8Jm_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/8qWazUd8Jm/8qWazUd8Jm_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/8qWazUd8Jm/8qWazUd8Jm_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/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
+ ![](images/2b04ad2d673f48774cb42319804f2f969bcaaa215d964ae24f8db63501d1802a.jpg)
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 &quot;QueryEvent(&quot; constraint &quot;)&quot;constraint &quot;(&amp;&quot;constraint constraint &quot;)&quot;&quot;(start_?&quot; date &quot;)&quot;&quot;(attendee_?&quot; attendee attendee &quot;)&quot;date &quot;Wednesday&quot;attendee &quot;Bob&quot;|&quot;Carol&quot;</td></tr><tr><td rowspan=1 colspan=1>y1): QueryEvent(&amp; (start_? Wednesday)(attendee_? Bob Caro1))</td></tr><tr><td rowspan=1 colspan=1>x:Add meeting with Jean&#x27;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>&quot;CreateEvent(&quot;constraint &quot;)&quot;</td></tr><tr><td></td><td>&quot;(&amp;&quot; constraint constraint &quot;)&quot;</td></tr><tr><td rowspan="3"></td><td></td><td>&quot;(start_?&quot; date time &quot;)&quot;</td></tr><tr><td></td><td>&quot;(attendee_?&quot; attendee &quot;)&quot;</td></tr><tr><td></td><td>&quot;Wednesday&quot;</td></tr><tr><td rowspan="2">date time</td><td></td><td>&quot;NumberPM(3)&quot;</td></tr><tr><td>attendee</td><td>&quot;FindManager(&quot;attendee&quot;)&quot;丨&quot;Jean&quot;</td></tr><tr><td colspan="4">y: CreateEvent(&amp; (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
+ ![](images/a8af0ec65270a9fa50b7a3c8ed27f335dfa2f52fa2629b7fd2b5b11ab4eb2e7f.jpg)
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>&quot;C” &quot;N” |&quot;0&quot;</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>&quot;1&quot;</td></tr><tr><td>bond</td><td></td><td>0</td></tr><tr><td colspan="2">branch</td><td>&quot;=” &quot;(” smiles&quot;)&quot;</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
+ ![](images/d33d1ce26439bd7a3a7eb2a1163f2659527e3d9b1cd4995ca733549f3ad21aa8.jpg)
180
+
181
+ ![](images/af80604a819652b907d84bcaa00eef295fa5af3cd12e481aff418c8794096cd5.jpg)
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
+ ![](images/a1dedf4eb4ae557b0a38b28cd86d26799538b593a917584736cea0d7fbde280c.jpg)
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
+ ![](images/2df40de03c5859bf83a7882ace4da561806ef85e5bbe9eb4415e81794640a9b4.jpg)
435
+
436
+ ![](images/f6f12ff77eaec68b94046ef6ef6b8c0a99691743b3fb295c321387f3fbb887bc.jpg)
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 &quot;answer(&quot;answer_type &quot;)&quot; answer_type city丨state丨num丨place丨river丨country city &quot;city(&quot; city &quot;)&quot; &quot;cityid(‘&quot; CITYNAME &quot;&#x27;,‘&quot; STATEABBREV &quot;&#x27;)&quot; &quot;cityid(&quot;&quot; CITYNAME &quot;’_)&quot; &quot;capital(&quot;city &quot;)&quot; &quot;major(&quot; city &quot;)&quot; &quot;capital_1(&quot; state &quot;)&quot; &quot;loc_2(&quot; state &quot;)&quot; &quot;loc_2(&quot; country &quot;)&quot; &quot;largest(&quot; city &quot;)&quot; &quot;smallest(&quot; city &quot;)&quot; &quot;intersection(&quot;city&quot;,&quot;city &quot;)&quot; &quot;exclude(&quot; city &quot;,&quot; city &quot;)&quot; &quot;largest_one(population_1(&quot;city &quot;))&quot; &quot;largest_one(density_1(&quot;city &quot;))&quot; &quot;smallest_one(population_1(&quot;city &quot;))&quot; &quot;smallest_one(density_1(&quot;city &quot;))&quot; ALL_CITY</td></tr><tr><td colspan="2">query:what states border hawaii ? BNF grammar rules: query &quot;answer(&quot; answer_type &quot;)&quot; answer_type state state &quot;state(&quot; state &quot;)&quot; &quot;next_to_2(&quot;state&quot;)&quot;</td></tr></table>
440
+
441
+ ![](images/3d5b5931067d592de3a522b406fdaab148badd51044dd6fc476cfdd56754826d.jpg)
442
+ Figure 8: Prompt with real examples from the GeoQuery dataset.
443
+
444
+ ![](images/8d92a88917669cc7ba2c4559ba87fa24888a78fe4a87b1deae2bb36b80017117.jpg)
445
+
446
+ ![](images/b041f0daedb88338d77a54e6bcc2538f98010d1732f93f29c17f48898e8d3c80.jpg)
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
+ ![](images/008c71b4e60897332f77c656db7ba9be4d1876a0dd802bd0ebac9b452942ec38.jpg)
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>&quot;(pick-up-and-stack&quot; object object &quot;)&quot;</td><td></td></tr><tr><td>object</td><td>:</td><td>&quot;b&quot;|&quot;a&quot; &quot;c”</td><td>| &quot;d&quot;</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
+ ![](images/89e34825016276c656135b10f36626bd63379ccaec02b12935a484b38f890783.jpg)
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].
parse/dev/Bl8CQrx2Up4/Bl8CQrx2Up4.md ADDED
@@ -0,0 +1,393 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # COSFORMER : RETHINKING SOFTMAX IN ATTENTION
2
+
3
+ 1Zhen Qin† $^ { 1 , 3 }$ Weixuan Sun† 1,4Hui Deng† 3Dongxu Li 1Yunshen Wei 1Baohong Lv
4
+ 1Junjie Yan 2,5Lingpeng Kong 1,2Yiran Zhong∗
5
+ 1SenseTime Research 2Shanghai AI Laboratory 3Australian National University
6
+ 4Northwestern Polytechnical University 5The University of Hong Kong
7
+ {lastnamefirstname}@sensetime.com,lpk@cs.hku.hk
8
+
9
+ # ABSTRACT
10
+
11
+ Transformer has shown great successes in natural language processing, computer vision, and audio processing. As one of its core components, the softmax attention helps to capture long-range dependencies yet prohibits its scale-up due to the quadratic space and time complexity to the sequence length. Kernel methods are often adopted to reduce the complexity by approximating the softmax operator. Nevertheless, due to the approximation errors, their performances vary in different tasks/corpus and suffer crucial performance drops when compared with the vanilla softmax attention. In this paper, we propose a linear transformer called COSFORMER that can achieve comparable or better accuracy to the vanilla transformer in both casual and cross attentions. COSFORMER is based on two key properties of softmax attention: i). non-negativeness of the attention matrix; ii). a non-linear re-weighting scheme that can concentrate the distribution of the attention matrix. As its linear substitute, COSFORMER fulfills these properties with a linear operator and a cosine-based distance re-weighting mechanism. Extensive experiments on language modeling and text understanding tasks demonstrate the effectiveness of our method. We further examine our method on long sequences and achieve state-of-the-art performance on the Long-Range Arena benchmark. The source code is available at COSFORMER .
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ ![](images/98cc0c521a0b99d0a5cac97dcfbc16dfd26de52797c94458bc35409b9f7c0888.jpg)
16
+ Figure 1: Performance $y$ axis), speed $x$ axis), and memory footprint (circle sizes) of efficient transformers on the Long-Range Arena benchmark. The proposed COSFORMER achieves an all-around supremacy over competing methods in the top left quadrant.
17
+
18
+ With years of development, the transformer model (Vaswani et al., 2017) and its variants (Zaheer et al., 2020; Wang et al., 2020; Tay et al., 2020a) have been successfully adapted to three most popular artificial intelligence (AI) fields: i.e., natural language processing (Devlin et al., 2019; Liu et al., 2019), computer vision (Dosovitskiy et al., 2020; Carion et al., 2020; Liu et al., 2021) and audio processing (Schneider et al., 2019; Baevski et al., 2020). Compared with conventional recurrent (Hochreiter & Schmidhuber, 1997) and convolutional architectures (He et al., 2016), transformer-based architectures are generally more scalable to data volumes (Brown et al., 2020) and stronger in capturing global information with less inductive bias, thus excelling on many tasks.
19
+
20
+ Dot-product attention with softmax normalization is the cornerstone of the transformer to capture long-range dependencies. However, its quadratic space and time complexity with regard to the length of the sequence make its computational overhead prohibitive, especially for long inputs. To address this issue, numerous methods are proposed recently, such as the sparse attention matrix (Zaheer et al., 2020; Beltagy et al., 2020; Tay et al., 2020a; Kitaev et al., 2019; Child et al., 2019),lowrank representations (Wang et al., 2020) or kernel-based methods (Peng et al., 2020; Choromanski et al., 2020; Katharopoulos et al., 2020), among many others. These methods achieve reduced computational complexity with comparable performances when compared with the vanilla attention architecture on several selected tasks or corpus.
21
+
22
+ However, the improved efficiency is usually achieved via introducing additional yet often impractical assumptions on the attention matrix (Wang et al., 2020) or with valid approximation of softmax operation only within constrained theoretical bounds (Choromanski et al., 2020; Peng et al., 2020) Therefore, when their assumptions are unsatisfied or when approximation errors get accumulated, these methods may not always be advantageous over the vanilla architecture (Narang et al., 2021). Consequently, performance deficiencies in a broad application spectrum are often observed in these transformer variants, especially those with linear complexity. For example, the Performer (Choromanski et al., 2020), RFA (Peng et al., 2020) and Reformer (Kitaev et al., 2019) show less satisfactory performance on the GLUE benchmark (Wang et al., 2018) when compared with the vanilla architecture as suggested in our preliminary experiments (Tab. 2). Furthermore, many of these aforementioned methods are not applicable to casual attentions, which are critical for auto-regressive training. For example, techniques proposed in Linformer (Wang et al., 2020) and BigBird (Zaheer et al., 2020) are specific to cross attentions.
23
+
24
+ Since the softmax operator appears to be the main hurdle while efficient yet accurate approximation to softmax is difficult to achieve, one question naturally arises: “Can we replace the softmax operator with a linear function instead, while maintaining its key properties?”. By digging into the softmax attention, we find two key properties that affect its empirical performance: (i) elements in the attention matrix are non-negative (Tsai et al., 2019; Katharopoulos et al., 2020); (ii) the non-linear re-weighting scheme acts as a stabilizer for the attention weights (Titsias, 2016; Gao & Pavel, 2017; Jang et al., 2016). These findings reveal some new insights of the current approaches. For example, the linear transformer (Katharopoulos et al., 2020) achieves property (i) using an exponential linear unit (Clevert et al., 2016) activation function. However, due to lack of the re-weighting scheme, it underperforms other efficient transformer variants on the Long-Range Arena benchmark as shown in Figure 1 as well as the language modeling task (Table 2) based on our controlled experiments.
25
+
26
+ In this paper, we propose a new variant of linear transformer called COSFORMER that satisfies both of the above properties. Specifically, we enforce the non-negative property by passing the features to a ReLU (Agarap, 2018) activation function before computing the similarity scores. In this way, we encourage the model to avoid aggregating negatively-correlated contextual information. Further, we adopt a cos re-weighting scheme to stabilize the attention weights. This helps the model to amplify local correlations, which usually contain more relevant information for natural language tasks. Thanks to the Ptolemy’s theorem, our attention can be exactly decomposed into a linear form. We perform extensive experiments on both autoregressive language models and bidirectional models on five public benchmarks, including WikiText-103 (Merity et al., 2017), GLUE (Wang et al., 2018), IMDB (Maas et al., 2011), AMAZON (Ni et al., 2019) and Long-Range Arena benchmark (Tay et al., 2020b). Our model shows much better inference speed and smaller memory footprint, while achieving on par performance with the vanilla transformer. It is noteworthy that our method ranks $1 ^ { \mathrm { s t } }$ on the Long-Range Arena benchmark, showing favorable performance than other competitors, which well demonstrates its strong capacity in modeling long sequence inputs.
27
+
28
+ # 2 OUR METHOD
29
+
30
+ In this section, we provide technique details of our linear transformer called COSFORMER . The key insight of the COSFORMER is to replace the non-decomposable non-linear softmax operation by a linear operation with decomposable non-linear re-weighting mechanism. Our model is applicable
31
+
32
+ to both casual and cross attentions with a linear time and space complexity with regard to the input sequence length, thus exhibiting strong capacity in modeling long-range dependencies.
33
+
34
+ # 2.1 THE GENERAL FORM OF TRANSFORMER
35
+
36
+ Given an input sequence $x$ with length of $N$ , we first represent it in the embedding space $\boldsymbol { x } \in \mathbb { R } ^ { N \times d }$ with feature dimension of $d$ . A transformer block $\mathcal { T } : \dot { \mathbb { R } } ^ { N \times d } \mathbb { R } ^ { N \times d }$ with input $x$ is defined as:
37
+
38
+ $$
39
+ \mathcal { T } ( \boldsymbol { x } ) = \mathcal { F } ( \boldsymbol { A } ( \boldsymbol { x } ) + \boldsymbol { x } ) ,
40
+ $$
41
+
42
+ where $\mathcal { F }$ is a feedforward network that contains a residual connection; $\mathcal { A }$ is the self-attention function that computes the attention matrix $A$ , which has quadratic space and time complexity with respect to $N$ , thus becoming the computation bottleneck of $\tau$ on long inputs.
43
+
44
+ There are three key components in $\mathcal { A }$ , namely, query $( Q )$ , key $( K )$ , value $( V )$ computed through three learnable linear matrices WQ, WK , WV : $Q = x W _ { Q } , K = x W _ { K } , V = x W _ { V }$ . We use $M _ { i }$ to represent the i-th row of a matrix $M$ , then the output $\mathcal { O } \in \mathbb { R } ^ { N \times d }$ of $\mathcal { A } ( x )$ can be computed as:
45
+
46
+ $$
47
+ \boldsymbol { \mathcal { O } } = \boldsymbol { A } ( \boldsymbol { x } ) = \left[ \boldsymbol { \mathcal { O } } _ { 1 } , \ldots , \boldsymbol { \mathcal { O } } _ { N } \right] ^ { T } , \quad \boldsymbol { \mathcal { O } } _ { i } = \sum _ { j } \frac { \boldsymbol { \mathcal { S } } ( \boldsymbol { Q } _ { i } , K _ { j } ) } { \sum _ { j } \boldsymbol { \mathcal { S } } ( \boldsymbol { Q } _ { i } , K _ { j } ) } V _ { j } ,
48
+ $$
49
+
50
+ where $\boldsymbol { \mathcal { S } } ( \cdot )$ measures the similarity between queries. If $\begin{array} { r } { { \cal S } ( Q , K ) = \exp ( Q K ^ { T } ) } \end{array}$ , the Eq. 2 becomes the dot-product attention with softmax normalization. In this case, the space and time complexity to compute one row of the output $\mathcal { O } _ { i }$ is $O ( N )$ . Therefore, the total space and time complexity for computing $\mathcal { O }$ grows quadratically with respect to the input length.
51
+
52
+ # 2.2 LINEARIZATION OF SELF-ATTENTION
53
+
54
+ According to Eq. 2, we can select any similarity functions to compute the attention matrix. In order to maintain a linear computation budget, one solution is to adopt a decomposable similarity function such that:
55
+
56
+ $$
57
+ \begin{array} { r } { S ( Q _ { i } , K _ { j } ) = \phi ( Q _ { i } ) \phi ( K _ { j } ) ^ { T } , } \end{array}
58
+ $$
59
+
60
+ where $\phi$ is a kernel function that maps the queries and keys to their hidden representations. Then one can rewrite Eq. 2 in the form of kernel functions as:
61
+
62
+ $$
63
+ \begin{array} { r } { O _ { i } = \frac { \sum _ { j = 1 } ^ { N } ( \phi ( Q _ { i } ) \phi ( K _ { j } ) ^ { T } ) V _ { j } } { \sum _ { j = 1 } ^ { N } ( \phi ( Q _ { i } ) \phi ( K _ { j } ) ^ { T } ) } . , } \end{array}
64
+ $$
65
+
66
+ After that, attention operation in linear complexity is achieved via the matrix product property:
67
+
68
+ $$
69
+ ( \phi ( Q ) \phi ( K ) ^ { T } ) V = \phi ( Q ) ( \phi ( K ) ^ { T } V ) .
70
+ $$
71
+
72
+ In this form (Eq. 5), instead of explicitly computing the attention matrix $A = Q K ^ { T } \in \mathbb { R } ^ { N \times N }$ , we calculate the $\phi ( \mathbf { \bar { K } } ) ^ { T } V \in \mathbb { R } ^ { d \times d }$ first, and then multiplying $\phi ( Q ) \in \mathbb { R } ^ { N \times d }$ . By using this trick, we only incurs a computation complexity of $O ( N d ^ { 2 } )$ . Note that in typical natural language tasks, the feature dimension of one head $d$ is always much smaller than the input sequence length $N \left( d \ll N \right)$ , so we can safely omit $d$ and achieve computation complexity of $O ( N )$ , as illustrated in Figure 2.
73
+
74
+ Previous Solutions As aforementioned, the key to the linear attentions is to find a decomposable similarity function $\boldsymbol { \mathcal { S } } ( \cdot )$ that generalizes well to different tasks. Most existing linear transformers are trying to find an unbiased estimation of the softmax attention. For example, RFA (Peng et al., 2020) approximates the softmax operation with random feature maps using theorem of random fourier features (Rahimi & Recht, 2008) and the Performer (Choromanski et al., 2020) utilizes positive random features to approximate it. However, we empirically find that these methods are sensitive to the selection of sampling rate and becomes unstable if the sampling rate gets too high. Also, to accommodate recency bias, gating mechanisms are employed to better exploit more recent context.
75
+
76
+ Another group of works attempt to directly replace the softmax with a linear operation. For example, the linear transformer (Katharopoulos et al., 2020) model replaces the softmax similarity function with a pure dot product $\boldsymbol { \mathcal { S } } = \dot { Q } \boldsymbol { K } ^ { T }$ , and use a non-linear activation function $\phi ( \cdot ) = \mathrm { e l u \bar { ( \cdot ) } + 1 }$ to model the pairwise relation between features. However, our controlled experiments show that their solution does not necessarily generalize well on many downstream tasks (Tab. 2) or the Long-Range Arena benchmark (Tab. 4). In this paper, we propose a new replacement of softmax that not only achieves comparable or better performance than the softmax attention in a wide range of tasks, but also enjoys linear space and time complexity.
77
+
78
+ ![](images/eaed9442aa593eebbfa1a3af5b3eca39c44acbbf91d436f568cc8b45a3151831.jpg)
79
+ Figure 2: Illustration of the computations for vanilla self attention (left) and linearized attention (right). The input length is $N$ and feature dimension is $d$ , with $d \ll N$ . Tensors in the same box are associated for computation. The linearized formulation allows $O ( N )$ time and space complexity.
80
+
81
+ # 2.3 ANALYSIS OF SOFTMAX ATTENTION
82
+
83
+ In the vanilla transformer architecture, when $\begin{array} { r } { { \cal S } ( Q , K ) = \exp ( Q K ^ { T } ) . } \end{array}$ , the softmax operation is applied to obtain row-wise normalization on the attention matrix $\overset { \cdot } { A } \in \mathbb { R } ^ { N \times N }$ as shown in the Eq. 2. In other words, we normalize the relations of each element in the input sequence to all other elements in order to obtain a weighted aggregation of contextual information. However, apart from the good empirical performance of softmax attention, what are the crucial and necessary characteristics of it remain only loosely determined in the original transformer paper and follow-up works.
84
+
85
+ In this work, we empirically identify two key properties of the softmax operation that may play important roles for its performance: 1) it ensures all values in the attention matrix $A$ to be non-negative; 2) it provides a non-linear reweighting mechanism to concentrates the distribution of attention connections and stabilizes the training(Titsias, 2016; Gao & Pavel, 2017; Jang et al., 2016).
86
+
87
+ To validate these assumptions, we design the following preliminary studies as shown in Table 1. First, to validate the importance of nonnegativity, we compare three instantiations of
88
+
89
+ Table 1: Analysis of the softmax properties. All attention variants are implemented in the RoBERTa (Liu et al., 2019) architecture and are pre-trained on the WikiText-103 (Merity et al., 2017) dataset. The Loss represents the validation loss. We then fine-tune these variants on each downstream datasets and show the accuracy (the higher the better).
90
+
91
+ <table><tr><td></td><td>Loss</td><td>QQP</td><td>SST-2</td><td>MNLI</td></tr><tr><td>1</td><td>2.343</td><td>84.23</td><td>76.26</td><td>58.27</td></tr><tr><td>ΦLeakyReLU</td><td>2.246</td><td>84.46</td><td>78.21</td><td>74.26</td></tr><tr><td>ReLU</td><td>1.993</td><td>88.86</td><td>89.90</td><td>77.86</td></tr><tr><td>softmax</td><td>1.915</td><td>88.41</td><td>92.31</td><td>79.15</td></tr></table>
92
+
93
+ the function $\phi$ in equation 3: an identify mapping $\phi _ { \mathbf { I } } = \mathbf { I }$ that does not preserve the non-negativity, and the other variant $\phi _ { \mathrm { R e L U ( \cdot ) } } = \mathrm { R e L U ( \cdot ) }$ that retains only positive input values while replacing negative values to zeros. We also add the $\phi _ { \mathrm { L e a k y R e L U ( \cdot ) } } = \mathrm { L e a k y R e L U ( \cdot ) }$ variant as it does not have the non-negativity as well but have the same non-linearly as the ReLU one. Second, to demonstrate the effect of non-linear re-weighting, we compare the models using only $\phi _ { \mathrm { R e L U ( \cdot ) } }$ without any re-weighting and those with softmax operations. From Table 1, the superior results of $\phi _ { \mathrm { R e L U } }$ over $\phi _ { \mathbf { I } }$ and $\phi _ { \mathrm { L e a k y R e L U } }$ demonstrate the benefit of retaining non-negative values. Our conjecture is that by retaining only positive values in the similarity matrices, the model ignores features with negative correlations, thus effectively avoiding aggregating irrelevant contextual information. By comparing the results of $\phi _ { \mathrm { R e L U } }$ with the softmax, we observe that models with softmax re-weighting converge faster and generalize better to downstream tasks. This might be explained as softmax normalization amplifies the correlated pairs, which might be useful to identify useful patterns.
94
+
95
+ # 2.4 COSFORMER
96
+
97
+ Based on the observations above, we propose our model COSFORMER , which discards entirely the softmax normalization while still features the non-negativity and re-weighting mechanism. Our COSFORMER consists two main components: a linear projection kernel $\phi _ { \mathrm { l i n e a r } }$ and a cos-Based Reweighting mechanism. Below we describe details of each components:
98
+
99
+ Linear projection kernel $\phi _ { \mathrm { l i n e a r } }$ Recall the general form of the attention in Eq. 2, let us define a linear similarity as:
100
+
101
+ $$
102
+ \begin{array} { r } { S ( Q , K ) = \operatorname { s } ( \phi _ { \mathrm { l i n e a r } } ( Q ) , \phi _ { \mathrm { l i n e a r } } ( K ) ) = \operatorname { s } ( Q ^ { ' } , K ^ { ' } ) } \end{array}
103
+ $$
104
+
105
+ where $\phi _ { \mathrm { l i n e a r } }$ is the transformation function that map queries $Q$ and keys $K$ to our desired representations $Q ^ { ' }$ and $K ^ { ' }$ , and s is a function that can be linearly decomposed to measure the similarity between $Q ^ { ' }$ and $K ^ { ' }$ . Specifically, in order to ensure a full positive attention matrix $A$ and avoid
106
+
107
+ ![](images/65695e2d1527f8341947922689a983d86ddf0e66dd1cfe1de91db388c33324ae.jpg)
108
+ Figure 3: (1): Attention matrix of vanilla transformer.(2):Attention matrix of COSFORMER .(3): Attention matrix of COSFORMER without re-weighting. (4): Visualization of the cos-based distance matrix. After reweighting, we can see a smoother attention distribution along the diagonal region of attention matrix, exhibiting a similar pattern to the vanilla transformer, which assists to stabilize the training.
109
+
110
+ aggregating negatively-correlated information, we adopt $\mathrm { R e L U } ( \cdot )$ as the transformation functions and therefore effectively eliminate negative values:
111
+
112
+ $$
113
+ \phi _ { \mathrm { l i n e a r } } ( x ) = \mathrm { R e L U } ( x )
114
+ $$
115
+
116
+ As $Q ^ { ' }$ and $K ^ { ' }$ contain only non-negative values, we directly take their dot-product $s ( x , y ) \ =$ $\boldsymbol { x } \boldsymbol { y } ^ { T } , \boldsymbol { x } , \boldsymbol { y } \in \mathbb { R } ^ { 1 \times d }$ followed by a row-wise normalization to compute attention matrices:
117
+
118
+ $$
119
+ \begin{array} { r } { \mathcal { O } _ { i } = \frac { \sum _ { j = 1 } ^ { N } f ( \phi _ { \mathrm { l i n e a r } } ( Q _ { i } ) , \phi _ { \mathrm { l i n e a r } } ( K _ { j } ) ) V _ { j } } { \sum _ { j = 1 } ^ { N } f ( \phi _ { \mathrm { l i n e a r } } ( Q _ { i } ) , \phi _ { \mathrm { l i n e a r } } ( K _ { j } ) ) } = \frac { \sum _ { j = 1 } ^ { N } ( \mathrm { R e L U } ( Q _ { i } ) \mathrm { R e L U } ( K _ { j } ) ^ { T } ) V _ { j } } { \sum _ { j = 1 } ^ { N } ( \mathrm { R e L U } ( Q _ { i } ) \mathrm { R e L U } ( K _ { j } ) ^ { T } ) } } \end{array}
120
+ $$
121
+
122
+ Based on Eq. 4, we rearrange the order of dot-product and obtain the formulation of the proposed attention in linear complexity as:
123
+
124
+ $$
125
+ \begin{array} { r } { \mathcal { O } _ { i } = \frac { \mathrm { R e L U } ( Q _ { i } ) \sum _ { j = 1 } ^ { N } \mathrm { R e L U } ( K _ { j } ) ^ { T } V _ { j } } { \mathrm { R e L U } ( Q _ { i } ) \sum _ { j = 1 } ^ { N } \mathrm { R e L U } ( K _ { j } ) ^ { T } } } \end{array}
126
+ $$
127
+
128
+ cos-Based Re-weighting Mechanism The non-linear re-weighting mechanism introduced by the softmax attention can concentrate the distribution of the attention weights and therefore stabilize the training process (Titsias, 2016; Gao & Pavel, 2017; Jang et al., 2016). We also empirically find that it can punish far-away connections and enforce locality in some cases. In fact, such locality bias, i.e., a large portion of contextual dependencies are from neighboring tokens, is commonly observed on downstream NLP tasks (Clark et al., 2019; Kovaleva et al., 2019), as shown in Figure 3 (1).
129
+
130
+ Based on the assumption above, what we need to fulfill the second property of softmax may be a decomposable re-weighting mechanism that can introduce recency bias to the attention matrix. Here, we propose a cos-based re-weighting mechanism as it perfectly fit our purpose: 1). the Ptolemy’s theorem ensures the cos weights can be decomposed into two summations; 2). as shown in Figure 3 (4), the cos will put more weights on the neighbouring tokens and therefore enforces locality. Also, by comparing the attention matrices in Figure 3 (2) and (3), the COSFORMER enforces more locality than the one without the re-weighting mechanism.
131
+
132
+ Specifically, by combining with Eq 6, the model with cosine re-weighting is defined as:
133
+
134
+ $$
135
+ \begin{array} { r } { s ( Q _ { i } ^ { ' } , K _ { j } ^ { ' } ) = Q _ { i } ^ { ' } K _ { j } ^ { ' T } \cos \left( \frac { \pi } { 2 } \times \frac { i - j } { M } \right) } \end{array}
136
+ $$
137
+
138
+ By leveraging the Ptolemy’s theorem, we decompose this formulation as:
139
+
140
+ $$
141
+ \begin{array} { r l } & { Q _ { i } ^ { ' } K _ { j } ^ { ' T } \cos \left( \frac { \pi } { 2 } \times \frac { i - j } { M } \right) = Q _ { i } ^ { ' } K _ { j } ^ { ' T } \left( \cos \left( \frac { \pi i } { 2 M } \right) \cos \left( \frac { \pi j } { 2 M } \right) + \sin \left( \frac { \pi i } { 2 M } \right) \sin \left( \frac { \pi j } { 2 M } \right) \right) } \\ & { \phantom { = } = \left( Q _ { i } ^ { ' } \cos \left( \frac { \pi i } { 2 M } \right) \right) \left( K _ { j } ^ { ' } \cos \left( \frac { \pi j } { 2 M } \right) \right) ^ { T } + \left( Q _ { i } ^ { ' } \sin \left( \frac { \pi i } { 2 M } \right) \right) \left( K _ { j } ^ { ' } \sin \left( \frac { \pi j } { 2 M } \right) \right) ^ { T } } \end{array}
142
+ $$
143
+
144
+ where $i , j = 1 , . . . , N , M \geq N$ , and $Q ^ { ' } = \mathrm { R e L U } ( Q ) , K ^ { ' } = \mathrm { R e L U } ( K )$ . Let $\begin{array} { r } { Q _ { i } ^ { \mathrm { c o s } } = Q _ { i } ^ { ' } \mathrm { c o s } \left( \frac { \pi i } { 2 M } \right) } \end{array}$ $\begin{array} { r } { Q _ { i } ^ { \mathrm { s i n } } = Q _ { i } ^ { ' } \sin { \left( \frac { \pi i } { 2 M } \right) } } \end{array}$ , $\begin{array} { r } { K _ { j } ^ { \mathrm { c o s } } = K _ { j } ^ { ' } \cos \left( \frac { \pi j } { 2 M } \right) } \end{array}$ , $\begin{array} { r } { K _ { j } ^ { \mathrm { s i n } } = K _ { j } ^ { ' } \sin \left( \frac { \pi j } { 2 M } \right) } \end{array}$ , the output of the proposed attention module can be expressed as:
145
+
146
+ $$
147
+ \begin{array} { r } { { \cal O } _ { i } = \frac { \sum _ { j = 1 } ^ { N } f ( Q _ { i } ^ { ' } , K _ { j } ^ { ' } ) V _ { j } } { \sum _ { j = 1 } ^ { N } f ( Q _ { i } ^ { ' } , K _ { j } ^ { ' } ) } = \frac { \sum _ { j = 1 } ^ { N } Q _ { i } ^ { \mathrm { c o s } } \left( \left( K _ { j } ^ { \mathrm { c o s } } \right) ^ { T } V _ { j } \right) + \sum _ { j = 1 } ^ { N } Q _ { i } ^ { \mathrm { s i n } } \left( \left( K _ { j } ^ { \mathrm { s i n } } \right) ^ { T } V _ { j } \right) } { \sum _ { j = 1 } ^ { N } Q _ { i } ^ { \mathrm { c o s } } \left( K _ { j } ^ { \mathrm { c o s } } \right) ^ { T } + \sum _ { j = 1 } ^ { N } Q _ { i } ^ { \mathrm { s i n } } \left( K _ { j } ^ { \mathrm { s i n } } \right) ^ { T } } , } \end{array}
148
+ $$
149
+
150
+ ![](images/0ba17c36967e570dff292909fe114ec779c03f5c40b7e6b3134eebcb9cf1a403.jpg)
151
+ Figure 4: Training loss (left) and validation loss (right) of the bidirectional language modeling pre-train. In both training and validation, the proposed COSFORMER has a faster converge speed than vanilla transformer.
152
+
153
+ where $O _ { i }$ is the output at the $i ^ { t h }$ position of the sequence from the attention module. Detailed derivation are included in the Appendix. Without losing the generality, our method achieves a linear complexity as:
154
+
155
+ $$
156
+ \mathcal { O } = \mathcal { S } ( Q , K ) V = ( Q ^ { \mathrm { c o s } } K ^ { \mathrm { c o s } } + Q ^ { \mathrm { s i n } } K ^ { \mathrm { s i n } } ) V = Q ^ { \mathrm { c o s } } ( K ^ { \mathrm { c o s } } V ) + Q ^ { \mathrm { s i n } } ( K ^ { \mathrm { s i n } } V )
157
+ $$
158
+
159
+ Relation to positional encoding. COSFORMER can be seen as a new way of introducing the relative positional bias to the efficient transformer. Compared with the Rotary Position Embedding (Su et al., 2021), they use a more complex position embedding strategy and did not enforce the nonnegativity to the similarity scores as ours. Also, since they only change the position embedding on the numerator while keeping the denominator unchanged, the summation of their attention scores is not equal to 1. For Stochastic Positional Encoding (Liutkus et al., 2021), they use a sampling strategy to approximate the softmax, and introduce relative positional encoding to linear transformers.
160
+
161
+ # 3 EXPERIMENTS
162
+
163
+ In this section, we experimentally validate the effectiveness of the proposed method in multiple settings. The purposes of the experiments are three-fold. First, we validate the capacity of COSFORMER in language modeling through autoregressive (Sec. 3.1) and bidirectional (Sec. 3.2) setups using WikiText-103 (Merity et al., 2017). In this way, we validate the effectiveness of the proposed linear attention module in both causal and non-causal cases. Second, we investigate the generalization ability of COSFORMER on downstream tasks by comparisons with other existing transformer variants. This is achieved by performing comparative finetuning experiments on five datasets, including GLUE (QQP, SST-2, MNLI) (Wang et al., 2018), IMDB (Maas et al., 2011) and AMAZON (Ni et al., 2019) (Sec. 3.3). We further compare COSFORMER with other transformer variants on the long-range-arena benchmark (Tay et al., 2020b) to understand its ability in modeling long-range dependencies (Sec. 3.4) and show comparative analysis into model efficiency (Sec. 3.5). Third, we conduct ablation studies to understand each component in COSFORMER (Sec. 3.6).
164
+
165
+ # 3.1 AUTOREGRESSIVE LANGUAGE MODELING
166
+
167
+ In autoregressive or left-to-right language modeling, we estimate the probability distribution of a token given its previous tokens. We use (Baevski & Auli, 2018) as our baseline model. Specifically, we adopt their large model which has 16 cascaded layers with a projected dimensions of 1024, and replace the self-attention module with our proposed linear attention module. We train our model on 8 Nvidia Tesla A100 GPUs with a sequence length of 512 for 150K updates on the WikiText-103 (Merity et al., 2017) and report perplexity on the validation and test splits in Table 2.
168
+
169
+ We observe that although the baseline model is a powerful standard transformer which requires quadratic computation complexity, COSFORMER outperforms it with a clear margin in linear computation complexity. Besides, we achieve comparable perplexity to other methods on the validation set, and significantly outperform all competing methods on the test set by a clear gap, which further demonstrates the effectiveness of COSFORMER .
170
+
171
+ Table 2: Perplexity (lower is better) results of language modeling pre-training task on validation set and test set of the WikiText-103 (Merity et al., 2017) dataset.
172
+
173
+ <table><tr><td></td><td>ppl(val)↓</td><td>ppl(test)↓</td></tr><tr><td>VanillaTransformer</td><td>24.5</td><td>26.2</td></tr><tr><td>LinearTransformer</td><td>28.7</td><td>30.2</td></tr><tr><td>RFA-Gaussian</td><td>25.8</td><td>27.5</td></tr><tr><td>RFA-across</td><td>26.4</td><td>28.1</td></tr><tr><td>RFA-Gate-across</td><td>24.8</td><td>26.3</td></tr><tr><td>RFA-Gate-Gaussian</td><td>23.2</td><td>25.0</td></tr><tr><td>COSFORMER</td><td>23.5</td><td>23.1</td></tr></table>
174
+
175
+ Table 3: Results on fine-tuned downstream tasks based on pre-trained bidirectional model. Best result is in boldface and second best is underlined. The proposed COSFORMER achieves superb performances over competing efficient transformers and is approaching vanilla transformer.
176
+
177
+ <table><tr><td></td><td>QQP个</td><td>SST-2个</td><td>MNLI↑</td><td>IMDB ↑</td><td>AMAZON↑</td><td>Avg↑</td></tr><tr><td>Vanilla Transformer (Liu et al.,2019)</td><td>88.41</td><td>92.31</td><td>79.15</td><td>92.86</td><td>75.79</td><td>85.70</td></tr><tr><td>Performer (Choromanski et al.,2020)</td><td>69.92</td><td>50.91</td><td>35.37</td><td>60.36</td><td>64.84</td><td>56.28</td></tr><tr><td>Reformer (Kitaev et al.,2019)</td><td>63.18</td><td>50.92</td><td>35.47</td><td>50.01</td><td>64.28</td><td>52.77</td></tr><tr><td>Linear Trans. (Katharopoulos et al.,2020)</td><td>74.85</td><td>84.63</td><td>66.56</td><td>91.48</td><td>72.50</td><td>78.00</td></tr><tr><td>Longformer (Beltagy et al.,2020)</td><td>85.51</td><td>88.65</td><td>77.22</td><td>91.14</td><td>73.34</td><td>83.17</td></tr><tr><td>RFA (Peng et al.,2020)</td><td>75.28</td><td>76.49</td><td>57.6</td><td>78.98</td><td>68.15</td><td>71.30</td></tr><tr><td>COSFORMER</td><td>89.26</td><td>91.05</td><td>76.70</td><td>92.95</td><td>76.30</td><td>85.25</td></tr></table>
178
+
179
+ # 3.2 BIDIRECTIONAL LANGUAGE MODEL
180
+
181
+ For bidirectional language modeling, we adopt RoBERTa (Liu et al., 2019) as the baseline model. Similarly, we replace the self-attention module in the RoBERTa by the proposed linear attention module, and keep other structures unchanged. We train this bidirectional task on 2 Nvidia Tesla A100 GPUs for 50K iterations with a input sequence length 512. As shown in Figure 4, COSFORMER converges faster than vanilla transformer on both training and validation sets with a comparable or smaller loss values, despite it only consumes linear space and time computation complexity. In addition, the COSFORMER variant with re-weighting mechanism has both notably better converge speed and final results over the counterpart without re-weighting, which further validates the effectiveness of our cos-based distance matrix and also demonstrates the effectiveness of recency bias on natural language data.
182
+
183
+ # 3.3 DOWNSTREAM FINE-TUNING TASKS
184
+
185
+ In this section, we fine-tune the pre-trained model on downstream tasks to demonstrate the generalization ability of COSFORMER on downstream tasks. We use the pre-trained bidirectional model and fine-tune it on three downstream text classification tasks: GLUE (QQP, SST-2, MNLi) (Wang et al., 2018), IMDB (Maas et al., 2011) and AMAZON (Ni et al., 2019). For fair comparison, we first pre-train all the competing efficient transformer variants for the same 50K iterations on WikiText103 (Merity et al., 2017) under the same setting, then we follow the same fine-tuning protocol as RoBERTa (Liu et al., 2019) to fine-tune these methods on the downstream tasks. From Table 3, we can see that COSFORMER outperforms baseline (Liu et al., 2019) on three out of five datasets, and achieves either best or secondary place on all five downstream datasets compared to competing efficient transformers. It is worth noting that despite Longformer (Beltagy et al., 2020) achieves better results on MNLI than COSFORMER , it requires a computation complexity of $O ( N w )$ , where $w$ is window size. As shown in Figure 1, Longformer is slower and requires more memory overhead than COSFORMER . Other competing methods(Peng et al., 2020; Choromanski et al., 2020; Kitaev et al., 2019) are all based on kernel functions and have substantial performance gaps compared with our model. This validates the effectiveness of the proposed COSFORMER model compared with other efficient transformer variants.
186
+
187
+ # 3.4 RESULTS ON LONG-RANGE-ARENA BENCHMARK
188
+
189
+ To further evaluate the generalization ability of the proposed method, we train our model from scratch on Long-range-arena benchmark 2020b. Long-range-arena (Tay et al., 2020b) is a benchmark specifically designed for efficient transformers with long input sequences, thus serving as a suitable testbed to assess the quality of efficient transformer variants comparatively. To ensure fair comparison, we first implement our method on Jax (Bradbury et al., 2018), then carefully follow their preprocessing, data split, model structure and training protocol. We evaluate our method on a variety of tasks including Long sequence ListOps (Nangia & Bowman, 2018), Byte-level text classification (Maas et al., 2011), document retrieval using the ACL Anthology Network (Radev et al., 2013), image classification on sequence of pixels on CIFAR-10 (Krizhevsky & Hinton, 2009), and Pathfinder (Linsley et al., 2018). As shown in Table 4, COSFORMER overall achieves competitive results across all the tasks while achieving best performance on ListOps and Document Retrieval. For the Pathfinder task, since the distance between the two points can be very far from each other, our introduced locality bias would have negative impact to this task and show a bit lags to other SOTA methods, despite that the performance gap between our method and the vanilla transformer is small It is worth mentioning that COSFORMER achieves the best overall scores on Long-range-arena benchmark, being one of the only two models that surpass vanilla transformer architecture.
190
+
191
+ Table 4: Results on Long-range-arena benchmark. Best result is in boldface and second best is underlined. COSFORMER achieves the best average score across 5 different tasks.
192
+
193
+ <table><tr><td>Model</td><td>ListOps ↑</td><td>Text↑</td><td>Retrieval↑</td><td>Image↑</td><td>Pathfinder↑</td><td>Avg↑</td></tr><tr><td>Local Attention (Tay etal.,2020b)</td><td>15.82</td><td>52.98</td><td>53.39</td><td>41.46</td><td>66.63</td><td>46.06</td></tr><tr><td>Linear Trans. (Katharopoulos et al.,2020)</td><td>16.13</td><td>65.9</td><td>53.09</td><td>42.34</td><td>75.3</td><td>50.55</td></tr><tr><td>Reformer (Kitaev et al.,2019)</td><td>37.27</td><td>56.1</td><td>53.4</td><td>38.07</td><td>68.5</td><td>50.67</td></tr><tr><td>Sparse Trans.(Child et al.,2019)</td><td>17.07</td><td>63.58</td><td>59.59</td><td>44.24</td><td>71.71</td><td>51.24</td></tr><tr><td>Sinkhorn Trans.(Tay et al.,2020a)</td><td>33.67</td><td>61.2</td><td>53.83</td><td>41.23</td><td>67.45</td><td>51.29</td></tr><tr><td>Linformer(Wang et al., 2020)</td><td>35.7</td><td>53.94</td><td>52.27</td><td>38.56</td><td>76.34</td><td>51.36</td></tr><tr><td>Performer(Choromanski et al.,2020)</td><td>18.01</td><td>65.4</td><td>53.82</td><td>42.77</td><td>77.05</td><td>51.41</td></tr><tr><td>Synthesizer (Tay et al.,2021)</td><td>36.99</td><td>61.68</td><td>54.67</td><td>41.61</td><td>69.45</td><td>52.88</td></tr><tr><td>Longformer(Beltagy et al.,2020)</td><td>35.63</td><td>62.85</td><td>56.89</td><td>42.22</td><td>69.71</td><td>53.46</td></tr><tr><td>Transformer (Vaswani et al.,2017)</td><td>36.37</td><td>64.27</td><td>57.46</td><td>42.44</td><td>71.4</td><td>54.39</td></tr><tr><td>BigBird (Zaheer et al.,2020)</td><td>36.05</td><td>64.02</td><td>59.29</td><td>40.83</td><td>74.87</td><td>55.01</td></tr><tr><td>COSFORMER</td><td>37.9</td><td>63.41</td><td>61.36</td><td>43.17</td><td>70.33</td><td>55.23</td></tr></table>
194
+
195
+ Table 5: Speed comparison on the long-range-arena benchmark in both training and inference varying sequence lengths (1-4k). We mark it with a cross if a method runs out of memory. The higher, the better.
196
+
197
+ <table><tr><td></td><td colspan="4">Inference Speed(steps per second)↑</td><td colspan="4">Train Speed(steps per second)↑</td></tr><tr><td>model</td><td>1K</td><td>2K</td><td>3K</td><td>4k</td><td>1K</td><td>2K</td><td>3K</td><td>4K</td></tr><tr><td>Transformer(Vaswani et al.,2017)</td><td>25.37</td><td>7.83</td><td>X</td><td>X</td><td>6.95</td><td>2.23</td><td>X</td><td>X</td></tr><tr><td>Local Attention(Tay et al.,2020b)</td><td>57.73</td><td>33.19</td><td>23.36</td><td>17.79</td><td>13.45</td><td>6.71</td><td>4.32</td><td>3.09</td></tr><tr><td>Linformer(Wang et al., 2020)</td><td>70.09</td><td>39.1</td><td>27.05</td><td>20.62</td><td>14.75</td><td>7.09</td><td>4.52</td><td>3.21</td></tr><tr><td>Reformer(Kitaev et al., 2019)</td><td>44.21</td><td>21.58</td><td>12.74</td><td>8.37</td><td>11.58</td><td>4.98</td><td>2.94</td><td>1.95</td></tr><tr><td>Sinkhorn Trans.(Tay et al.,2020a)</td><td>43.29</td><td>23.58</td><td>16.53</td><td>12.7</td><td>11.09</td><td>5.57</td><td>3.68</td><td>2.68</td></tr><tr><td>Synthesizer (Tay et al.,2021)</td><td>20.89</td><td>6.24</td><td>X</td><td>X</td><td>6.36</td><td>2.01</td><td>X</td><td>X</td></tr><tr><td>BirBird (Zaheer et al., 2020)</td><td>20.96</td><td>11.5</td><td>8.12</td><td>6.15</td><td>6.46</td><td>3.2</td><td>2.13</td><td>1.53</td></tr><tr><td>Linear Trans. (Katharopoulos et al., 2020)</td><td>67.85</td><td>38.24</td><td>26.28</td><td>19.98</td><td>11.86</td><td>5.54</td><td>3.53</td><td>2.56</td></tr><tr><td>Performer (Choromanski et al.,2020)</td><td>74.15</td><td>42.31</td><td>29.5</td><td>22.44</td><td>14</td><td>6.49</td><td>4.1</td><td>2.94</td></tr><tr><td>Longformer (Beltagy et al.,2020)</td><td>22.99</td><td>6.72</td><td>X</td><td>X</td><td>4.4</td><td>1.3</td><td>×</td><td>X</td></tr><tr><td>Sparse Trans. Child et al. (2019)</td><td>24.87</td><td>7.5</td><td>X</td><td>×</td><td>6.77</td><td>2.2</td><td>X</td><td>×</td></tr><tr><td>COSFORMER</td><td>58.82</td><td>33.45</td><td>22.77</td><td>17.42</td><td>12.27</td><td>5.72</td><td>3.62</td><td>2.64</td></tr></table>
198
+
199
+ # 3.5 EFFICIENCY COMPARISON
200
+
201
+ In this section, we compare the efficiency of COSFORMER with other models, with a focus on long sequences as inputs. With the proposed linear attention module, we expect that COSFORMER scales comparably with other linear variants while significantly surpassing the vanilla transformer architecture. For a fair and comprehensive comparison, we implement our method and competing methods on Jax (Bradbury et al., 2018). We use the byte-level text classification benchmark and report runtime speed during both training and inference under different sequence lengths (1k-4k). We conduct experiments on one Nvidia A6000 GPU and also report the corresponding inferencetime memory foot prints as shown in Figure 1. As shown in Table 5 and Figure 1, most pattern based methods (Beltagy et al., 2020; Zaheer et al., 2020; Tay et al., 2020a; 2021) and vanilla transformer (Vaswani et al., 2017) are much slower and require greater memory than COSFORMER prevents them from extending to longer sequence. Further, the kernel based methods like (Narang et al., 2021; Choromanski et al., 2020; Tay et al., 2020a) have comparable speed and memory overheads, but their performances are less satisfactory compared to COSFORMER across above metrics. In summary, our model COSFORMER achieves overall better efficiency than other linear variants while maintain superior modeling and generalization ability.
202
+
203
+ # 3.6 ABLATION: cos-BASED RE-WEIGHTING
204
+
205
+ By introducing cos-based re-weighting, we provide a non-linear mechanism to concentrate the distribution of attention connections and stabilizes the training. In this way, we encourage the model to better take into account the locality inductive biases commonly observed on many natural language tasks. In particular, we investi
206
+
207
+ Table 6: Performance comparison of COSFORMER with and without cos-based re-weighting $( \phi _ { \mathrm { R e L U } } )$ . We evaluate on two compositive metrics. Bidirectional finetune $_ \mathrm { a v g }$ : average score across 5 datasets reported in Table 3. $\mathbf { L R A } _ { \mathrm { a v g } }$ : average score across 5 tasks reported in Table 4.
208
+
209
+ <table><tr><td>Model</td><td>Bidirectional finetuneavg 个</td><td>LRAavg↑</td></tr><tr><td>ReLU</td><td>85.12</td><td>54.20</td></tr><tr><td>COSFORMER</td><td>85.25</td><td>55.23</td></tr></table>
210
+
211
+ gate the effect of the cos-based re-weighting in two aspects. First, as shown in Figure 4, by adding
212
+
213
+ cos-based re-weighting, we obtain both notably better converge speed and final results in autoregressive language modeling. Further, in Table 6, we present a comparison between COSFORMER models with and without re-weighting mechanism. We use two composite metrics which comprehensively include 10 different datasets from bidirectional downstream fine-tuning tasks and long-range-arena (Tay et al., 2020b). COSFORMER achieves overall better results over the counterpart without reweighting, improving the average scores on bidirectional finetuning and long-range-arena by a clear margin. This verifies that the proposed re-weighting effectively incorporates the locality inductive biases for natural language tasks.
214
+
215
+ # 4 RELATED WORK
216
+
217
+ This section will introduce the existing works on improving the efficiency of Transformers, they can be broadly divided into two categories, Pattern based methods and Kernel based methods.
218
+
219
+ Pattern based method Pattern based methods sparsify the attention matrix with handcrafted or learnable patterns. As an early approach, Lee et al. (2019) leverages the inducing points from the sparse Gaussian process to reduce the quadratic complexities of a transformer. Child et al. (2019) reduces the complexity by applying combination of strided pattern and local pattern to the vanilla attention matrix. Longformer (Beltagy et al., 2020) designs fixed diagonal sliding windows combined with global window, and the sliding window pattern can also be extended with dilation to enlarge the receptive field. Zaheer et al. (2020) presents a more powerful and expressive sparse attention mechanism, which combines multiple types of attention patterns and gives a thorough study of sparse attention mechanism. Instead of fixed patterns, Kitaev et al. (2019) and Daras et al. (2020) group the attention computation process into buckets by local sensitive hashing, while Roy et al. (2020) uses mini-batch spherical $k$ -means. Nevertheless, Pattern based methods can only cope with sequences up to a certain length, and the computational complexity still grows rapidly when the input sequence becomes longer.
220
+
221
+ Kernel based method When faced with longer input sequences, it is more efficient to directly reduce the complexity of the theoretical calculation method. Kernel based methods speed up selfattention by reducing the computation complexity of self-attention from quadratic to linear. Vyas et al. (2020) approximate the full attention with a fixed number of cluster attention groups by assuming neighbouring queries in Euclidean space should have similar attention distributions. Peng et al. (2020) chooses to use the production of Gaussian kernel functions to approximate Softmax, changing the order of scale dot product calculation, thus reducing the theoretical time to linear complexity and Choromanski et al. (2020) uses Haar measurement based kernel instead. Wang et al. (2020) imports the low-rank prior for attention matrix and approximate softmax with SVD decomposition manner. Xiong et al. (2021) utilizes the Nystrom method with segment-means to generate a low- ¨ rank approximation of the Softmax matrix. Katharopoulos et al. (2020) formalizes the transformer layer as a recurrent neural network. In this paper, we demonstrate that the approximation to Softmax is unneccessary for Linearization of self-attention module. We instead propose a new method to replace Softmax with a linear operation with a re-weighting mechanism, which reduces both time complexity and space complexity to $O ( N )$ while maintaining the accuracy.
222
+
223
+ # 5 CONCLUSION
224
+
225
+ We presented COSFORMER , a new efficient transformer that has linear time and space complexity. Our COSFORMER is based on two key properties of the original softmax attention: (i) every element in the attention matrix are non-negative, such that negatively-correlated information are not included for contextual information aggregation; (ii) the non-linear re-weighting scheme concentrates the distribution of the attention matrix, in order to better exploit the locality inductive biases on sequence modeling. To fulfill these properties in our COSFORMER , we utilized the RuLU function as our linear operation to ensure the non-negative property; a new cos-based re-weighting mechanism was proposed to enforce the locality bias in the original softmax attention. Since our COSFORMER is naturally decomposable, it does not suffer the accumulated approximation error that usually happens in previous linear transformers. On causal pre-training, bidirectional pre-training, and multiple downstream text understanding tasks, COSFORMER achieves comparable or even better performances than the vanilla transformer. On long sequence benchmark, COSFORMER achieved state-of-the-art performance over five different tasks. Further, COSFORMER obtains a significant overall advantage in terms of time and memory efficiency over all existing efficient transformers, facilitating the transformers to easily scale to longer input sequence.
226
+
227
+ # REFERENCES
228
+
229
+ Abien Fred Agarap. Deep learning using rectified linear units (relu). arXiv preprint arXiv:1803.08375, 2018.
230
+
231
+ Alexei Baevski and Michael Auli. Adaptive input representations for neural language modeling. In International Conference on Learning Representations, 2018.
232
+
233
+ Alexei Baevski, Yuhao Zhou, Abdelrahman Mohamed, and Michael Auli. wav2vec 2.0: A framework for self-supervised learning of speech representations. Advances in Neural Information Processing Systems, 33, 2020.
234
+
235
+ Iz Beltagy, Matthew E Peters, and Arman Cohan. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150, 2020.
236
+
237
+ James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, and Skye Wanderman-Milne. Jax: composable transformations of python $^ +$ numpy programs. Version 0.1, 55, 2018.
238
+
239
+ 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. arXiv, 2020.
240
+
241
+ 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, pp. 213–229. Springer, 2020.
242
+
243
+ Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019.
244
+
245
+ Krzysztof Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Davis, Afroz Mohiuddin, Lukasz Kaiser, et al. Rethinking attention with performers. arXiv preprint arXiv:2009.14794, 2020.
246
+
247
+ Kevin Clark, Urvashi Khandelwal, Omer Levy, and Christopher D Manning. What does bert look at? an analysis of bert’s attention. In Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pp. 276–286, 2019.
248
+
249
+ Djork-Arne Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network ´ learning by exponential linear units (elus). In Yoshua Bengio and Yann LeCun (eds.), 4th International Conference on Learning Representations, ICLR, San Juan, Puerto Rico, 2016.
250
+
251
+ Giannis Daras, Nikita Kitaev, Augustus Odena, and Alexandros G Dimakis. Smyrf - efficient attention using asymmetric clustering. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), NeurIPS, volume 33, pp. 6476–6489. Curran Associates, Inc., 2020.
252
+
253
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4171–4186, 2019.
254
+
255
+ 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.
256
+
257
+ Bolin Gao and Lacra Pavel. On the properties of the softmax function with application in game theory and reinforcement learning. arXiv preprint arXiv:1704.00805, 2017.
258
+
259
+ 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.
260
+
261
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
262
+
263
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144, 2016.
264
+
265
+ Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and Franc¸ois Fleuret. Transformers are rnns: Fast autoregressive transformers with linear attention. In International Conference on Machine Learning, pp. 5156–5165. PMLR, 2020.
266
+
267
+ Nikita Kitaev, Lukasz Kaiser, and Anselm Levskaya. Reformer: The efficient transformer. In International Conference on Learning Representations, 2019.
268
+
269
+ Olga Kovaleva, Alexey Romanov, Anna Rogers, and Anna Rumshisky. Revealing the dark secrets of bert. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLPIJCNLP), pp. 4365–4374, 2019.
270
+
271
+ A. Krizhevsky and G. Hinton. Learning multiple layers of features from tiny images. Master’s thesis, Department of Computer Science, University of Toronto, 2009.
272
+
273
+ Juho Lee, Yoonho Lee, Jungtaek Kim, Adam Kosiorek, Seungjin Choi, and Yee Whye Teh. Set transformer: A framework for attention-based permutation-invariant neural networks. In ICML, pp. 3744–3753, 2019.
274
+
275
+ Drew Linsley, Junkyung Kim, Vijay Veerabadran, Charlie Windolf, and Thomas Serre. Learning long-range spatial dependencies with horizontal gated recurrent units. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, pp. 152–164, 2018.
276
+
277
+ 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.
278
+
279
+ 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
+
281
+ Antoine Liutkus, Ondˇrej C´ıfka, Shih-Lun Wu, Umut S¸ ims¸ekli, Yi-Hsuan Yang, and Gael Richard. ¨ Relative positional encoding for Transformers with linear complexity. In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 7067–7079. PMLR, 18–24 Jul 2021.
282
+
283
+ Andrew Maas, Raymond E Daly, Peter T Pham, Dan Huang, Andrew Y Ng, and Christopher Potts. Learning word vectors for sentiment analysis. In Proceedings of the 49th annual meeting of the association for computational linguistics: Human language technologies, pp. 142–150, 2011.
284
+
285
+ Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. 5th International Conference on Learning Representations, ICLR, Toulon, France, 2017.
286
+
287
+ Nikita Nangia and Samuel Bowman. Listops: A diagnostic dataset for latent tree learning. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Student Research Workshop, pp. 92–99, 2018.
288
+
289
+ Sharan Narang, Hyung Won Chung, Yi Tay, William Fedus, Thibault Fevry, Michael Matena, Karishma Malkan, Noah Fiedel, Noam Shazeer, Zhenzhong Lan, et al. Do transformer modifications transfer across implementations and applications? arXiv preprint arXiv:2102.11972, 2021.
290
+
291
+ Jianmo Ni, Jiacheng Li, and Julian McAuley. Justifying recommendations using distantly-labeled reviews and fine-grained aspects. 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. 188–197, 2019.
292
+
293
+ Hao Peng, Nikolaos Pappas, Dani Yogatama, Roy Schwartz, Noah Smith, and Lingpeng Kong. Random feature attention. In International Conference on Learning Representations, 2020.
294
+
295
+ Dragomir R Radev, Pradeep Muthukrishnan, Vahed Qazvinian, and Amjad Abu-Jbara. The acl anthology network corpus. Language Resources and Evaluation, 47(4):919–944, 2013.
296
+
297
+ Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. In J. Platt, D. Koller, Y. Singer, and S. Roweis (eds.), Advances in Neural Information Processing Systems, volume 20. Curran Associates, Inc., 2008.
298
+
299
+ Aurko Roy, Mohammad Taghi Saffar, David Grangier, and Ashish Vaswani. Efficient content-based sparse attention with routing transformers. In TACL, 2020.
300
+
301
+ Steffen Schneider, Alexei Baevski, Ronan Collobert, and Michael Auli. wav2vec: Unsupervised pre-training for speech recognition. In INTERSPEECH, 2019.
302
+
303
+ Jianlin Su, Yu Lu, Shengfeng Pan, Bo Wen, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. In arXiv, 2021.
304
+
305
+ Yi Tay, Dara Bahri, Liu Yang, Donald Metzler, and Da-Cheng Juan. Sparse sinkhorn attention. In International Conference on Machine Learning, pp. 9438–9447. PMLR, 2020a.
306
+
307
+ Yi Tay, Mostafa Dehghani, Samira Abnar, Yikang Shen, Dara Bahri, Philip Pham, Jinfeng Rao, Liu Yang, Sebastian Ruder, and Donald Metzler. Long range arena: A benchmark for efficient transformers. In International Conference on Learning Representations, 2020b.
308
+
309
+ Yi Tay, Dara Bahri, Donald Metzler, Da-Cheng Juan, Zhe Zhao, and Che Zheng. Synthesizer: Rethinking self-attention for transformer models. In International Conference on Machine Learning, pp. 10183–10192. PMLR, 2021.
310
+
311
+ Michalis K Titsias. One-vs-each approximation to softmax for scalable estimation of probabilities. arXiv preprint arXiv:1609.07410, 2016.
312
+
313
+ Yao-Hung Hubert Tsai, Shaojie Bai, Makoto Yamada, Louis-Philippe Morency, and Ruslan Salakhutdinov. Transformer dissection: An unified understanding for transformer’s attention via the lens of kernel. In EMNLP, 2019.
314
+
315
+ 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, pp. 5998–6008, 2017.
316
+
317
+ A. Vyas, A. Katharopoulos, and F. Fleuret. Fast transformers with clustered attention. In NeurIPS, 2020.
318
+
319
+ Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pp. 353–355, 2018.
320
+
321
+ Sinong Wang, Belinda Z Li, Madian Khabsa, Han Fang, and Hao Ma. Linformer: Self-attention with linear complexity. arXiv preprint arXiv:2006.04768, 2020.
322
+
323
+ Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan, Glenn Fung, Yin Li, and Vikas Singh. Nystromformer: A nystr ¨ om-based algorithm for approximating self-attention. In ¨ AAAI, 2021.
324
+
325
+ 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. In NeurIPS, 2020.
326
+
327
+ # A APPENDIX
328
+
329
+ A.1 MATHEMATICAL DERIVATION OF cos-BASED RE-WEIGHTING
330
+
331
+ Following Equation 11, we give a detailed deviation of how to obtain output at position $i ^ { t h }$ position:
332
+
333
+ $$
334
+ \begin{array} { r l } & { \mathcal { O } _ { 4 } = \frac { \sum _ { j = 1 } ^ { N } f \left( Q _ { j } ^ { \star } , K _ { j } ^ { \star \star } \right) ^ { T } V _ { j } } { \sum _ { j = 1 } ^ { N } f \left( Q _ { j } ^ { \star } , K _ { j } ^ { \star \star } \right) ^ { T } } } \\ & { = \frac { \sum _ { i = 1 } ^ { N } \left( \bar { Q } _ { i } ^ { \star \star \star } \left( \bar { K } _ { i } ^ { \star \star \star } \right) ^ { T } + \bar { Q } _ { i } ^ { \star \star \star } \left( \bar { K } _ { i } ^ { \star \star \star } \right) ^ { T } \right) V _ { j } } { \sum _ { i = 1 } ^ { N } \left( \bar { Q } _ { i } ^ { \star \star \star } \left( \bar { K } _ { i } ^ { \star \star \star } \right) ^ { T } + \bar { Q } _ { i } ^ { \star \star \star } \left( \bar { K } _ { i } ^ { \star \star \star } \right) ^ { T } \right) } } \\ & { = \frac { \sum _ { j = 1 } ^ { N } \bar { Q } _ { i } ^ { \star \star \star } \left( \bar { K } _ { j } ^ { \star \star \star } \right) ^ { T } V _ { j } + \sum _ { j = 1 } ^ { N } \bar { Q } _ { i } ^ { \star \star \star } \left( \bar { K } _ { j } ^ { \star \star \star } \right) ^ { T } V _ { j } } { \sum _ { j = 1 } ^ { N } \bar { Q } _ { i } ^ { \star \star \star } \left( \bar { K } _ { j } ^ { \star \star } \right) ^ { T } + \sum _ { j = 1 } ^ { N } \bar { Q } _ { i } ^ { \star \star \star } \left( \bar { K } _ { j } ^ { \star \star } \right) ^ { T } } } \\ & = \frac { \sum _ { j = 1 } ^ { N } \bar { Q } _ { i } ^ { \star \star } \left( \left( \bar { K } _ { j } ^ { \star \star \star } \right) ^ { T } V _ { j } \right) + \sum _ { j = 1 } ^ { N } \bar { Q } _ { i } ^ { \star \star } \left( \bar { K } _ { j } ^ { \star \star } \right) ^ { T } V _ { j } } { \sum _ { j = 1 } ^ { N } \bar { Q } _ { i } ^ { \star \star } \left( \bar { K } _ { j } ^ { \star \star } \right) ^ { T } V _ { j } } \end{array}
335
+ $$
336
+
337
+ where $i , j = 1 , . . . , N , M \geq N ,$ , and $Q ^ { ' } = \mathrm { R e L U } ( Q ) , K ^ { ' } = \mathrm { R e L U } ( K )$ . Let $\begin{array} { r } { Q _ { i } ^ { \mathrm { c o s } } = Q _ { i } ^ { ' } \cos \left( \frac { \pi i } { 2 M } \right) } \end{array}$ , $\begin{array} { r } { Q _ { i } ^ { \mathrm { c o s } } = Q _ { i } ^ { ' } \cos { \left( \frac { \pi i } { 2 M } \right) } , K _ { j } ^ { \mathrm { c o s } } = K _ { j } ^ { ' } \cos { \left( \frac { \pi j } { 2 M } \right) } , K _ { j } ^ { \mathrm { s i n } } = K _ { j } ^ { ' } \sin { \left( \frac { \pi j } { 2 M } \right) } . } \end{array}$ It presents that the output of the proposed COSFORMER attention can be obtained in a linear manner.
338
+
339
+ # A.2 PSEUDO CODE OF COSFORMER
340
+
341
+ Algorithm 1 describe the way to compute COSFORMER attention
342
+
343
+ <table><tr><td>Algorithm1 COsFoRMER attention</td></tr><tr><td>Input: Q ∈ RNxd1,K ∈RMxd1,V ∈RM×d2;</td></tr><tr><td>Output: O ∈ RN×d2;</td></tr><tr><td>Use Mi to represent the i-th row of matrix M;</td></tr><tr><td></td></tr><tr><td>Initialize Scos[i][j]=0,Ssin[i][j] =0,Tcos[i]=0,Tsin[i]=0,i=1,.,d1,j =1,.,d;</td></tr><tr><td>for i in 1,..., M do: Kcos=Kicos (),Kn =Ksin();</td></tr><tr><td>Scos += (Kcos)T Vi;</td></tr><tr><td>Ssin += (Ksin)T</td></tr><tr><td>Vi;</td></tr><tr><td>Tcos+= Kcos. 2</td></tr><tr><td>Tsin += Ksin; i ,</td></tr><tr><td>end for</td></tr><tr><td>for i in 1,...,N do:</td></tr><tr><td>Qcos = Qicos ( (),Qn = Qisin();</td></tr><tr><td>Qcos gcos +Qn Ssin O=</td></tr><tr><td></td></tr></table>
344
+
345
+ # A.3 ALGORITHM TO VISUALIZE ATTENTION MATRIX
346
+
347
+ Algorithm 2 describe the way to visualize attention matrix as Figure 3
348
+
349
+ # Algorithm 2 Algorithm to visualize attention matrix
350
+
351
+ Input: $M _ { k } \in \mathbb R _ { ~ . ~ . ~ . ~ . ~ , h } ^ { d \times d } { \mathrm { { \ell } } } = 1 , \ldots , n ; t h r e s h o l d \in [ 0 , 1 ] ;$
352
+ Output: $M \in \mathbb { R } ^ { d \times d }$ ;
353
+ Initialize $M [ i ] [ j ] = 0 , i \in { 1 , \dots , d , j } \in { 1 , \dots , d }$ ;
354
+ for $k$ in $1 , \ldots , n$ do: for $i$ in $1 , \ldots , d$ do: index $= \mathrm { a r g s o r t } ( M _ { k } [ i ] )$ (in descending order) $p = 0$ for $j$ in $1 , \ldots , d$ do: $l = \operatorname { i n d e x } [ j ]$ $p + = M _ { k } [ i ] [ l ]$ $M [ i ] [ l ] + = \bar { 1 }$ if $p >$ threshold then: break end if end for end for
355
+ end for
356
+ $M \ / = n$ ;
357
+ Use heatmap to visualize M;
358
+
359
+ # A.4 INTRODUCTION OF DATASET
360
+
361
+ We train both models on autoregressive language modeling and bidirectional modeling by Wikitext103 dataset, it is split by tokens and its statistics as Table 7.Then we fine-tune the pre-trained bidirectional modeling on several text classification tasks.
362
+
363
+ QQP dataset contain thousands of sentence pair from community question-answering website Quora.Network need to determine pairs of question are semantically equivalent. SST-2 and IMDB are collections of movie reviews. The task is to determine whether a review is positive or not. AMAZON dataset contains millions of product reviews from Amazon.The requirement of this task is to infer the scoring of the product from the review text.MNLI is a crow-source collections of sentence pairs. The network must distinguish which of the three categories entailment, contradiction and neutral the given sentences belong to.
364
+
365
+ The long-range-aren benchmark contains 5 different datasets.ListOps contains some designed clever mathematical problem to clarify the parsing ability of neural models. IMDB is also used in this benchmark to examine the text classification ability of neural models. CIFAR-10 is a image collection of various of object, this task require models capture 2D spatial relations between flatten pixels.In pathfinder task, models need to determine the connection of two points in the picture, so as to examine the model’s ability to acquire 2D spatial relationships.AAN dataset is used to evaluate the ability for models to encode and store compressed representations for retrieving.
366
+
367
+ <table><tr><td>Data</td><td>Train</td><td>Valid</td><td>Test</td></tr><tr><td>WikiText-103</td><td>103M</td><td>218K</td><td>246K</td></tr><tr><td>QQP</td><td>364K</td><td>-</td><td>391K</td></tr><tr><td>SST-2</td><td>67K</td><td>-</td><td>1.8K</td></tr><tr><td>MNLI</td><td>393K</td><td>-</td><td>20K</td></tr><tr><td>IMDB</td><td>25K</td><td>-</td><td>25K</td></tr><tr><td>AMAZON</td><td>3M</td><td>168K</td><td>168K</td></tr><tr><td>ListOps</td><td>90K</td><td>1</td><td>10K</td></tr><tr><td>AAN</td><td>147K</td><td>18K</td><td>17K</td></tr><tr><td>CIFAR-10</td><td>50K</td><td></td><td>10K</td></tr><tr><td>Pathfinder</td><td>160K</td><td>■</td><td>20K</td></tr></table>
368
+
369
+ Table 7: Statistics for the datasets.A subset of ”Small” amazon subset on electronics category is used for experiment
370
+
371
+ # A.5 QUALITATIVE RESULTS OF LRA
372
+
373
+ We provide our qualitative results of the ListOps and Document Retrieval tasks on Long-RangeArena benchmark (Tay et al., 2020b) with a comparison to the vanilla transformer.
374
+
375
+ ListOps is a ten-way classification task which aims to prediction the results of a sequence with a hierarchical structure and operators MAX, MEAN, MEDIAN and SUM MOD that are enclosed by delimiters (brackets). The network needs to access all tokens and model the logical structure of the inputs in order to make a prediction.
376
+
377
+ Document Retrieval task is to decide whether the two input long documents are similar or not with a binary label. This task evaluates a model’s ability to encode and store compressed representations that are useful for matching and retrieval. Since the samples in LRA are too long, We substantially shorten some selected samples and display them as below:
378
+
379
+ # Listops:
380
+
381
+ 1 Input: ( ( ( [MED 7 ) 9 ) 3 ) 1 ..... 5 ) 6 ) 8 ) ] ) ) 2 ) 8 ) 9 ) 5 ) 0 ) ] ) ) 8 ) 5 ) 1 ) 2 ) ] ) Our Output: 0, Transformer output: 9, Ground-truth: 0
382
+ 23 Input: ( ( ( ( ( ( ( ( ( [SM 5 ) 6 ) 0 ) 7 ) 1 ) ( ( ( ( ( (...... ( ( ( Input: ( ( [MIN 5 ) 8 ) 1 ) 0 ) (( [MED ( ( ( 8 ) 7 ) 2 ) 8 ) 1 ) 8 ) ] ) ) 7 ) ] )] ) Our output: 9, Transformer output: 3, Ground-truth: 9
383
+ 45 Input: ( ( ( ( ( ( ( ( ( [MAX 7 ) 4 ) 8 ) ( ( ( ( ( ( ( ( ( ( ( [MAX 5 ) 2 ) ( ( ( ( ( ( [SM 3 ) 6 ) 9 ) ( ( ( ...... ) ) 1 ) 6 ) 4 ) 2 ) ] ) ) ] ) Our output: 9, Transformer output: 5, Ground-truth: 9
384
+
385
+ # Listing 1: Examples of LisOps
386
+
387
+ # Byte-level document retrieval:
388
+
389
+ 1 Text1: b’1 Introduction Recent advances in Statistical Machine Translation (SMT) are widely centred around two concepts: (a) hierarchical translation processes, frequently employing Synchronous Context Free Grammars (SCFGs) and (b) transduction or synchronous rewrite processes over a linguistic ......
390
+ 23 Text2: b’1 Introduction Automatic Grammatical Error Correction (GEC) for non-native English language learners has attracted more and more attention with the development of natural language processing , machine learning and big-data techniques. ?The CoNLL2013 shared task focuses on the problem of GEC in five different error types including determiner, preposition, noun number....
391
+ 45 Our output: False, Transformer output: True, Ground-truth: False
392
+
393
+ Listing 2: Examples of Document Retrieval
parse/dev/Bl8CQrx2Up4/Bl8CQrx2Up4_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/Bq2-WN5csW/Bq2-WN5csW.md ADDED
@@ -0,0 +1,423 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Loss Landscape Dependent Self-Adjusting Learning Rates in Decentralized Stochastic Gradient Descent
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+ Abstract
8
+
9
+ 1 Distributed Deep Learning (DDL) is essential for large-scale Deep Learning (DL)
10
+ 2 training. Synchronous Stochastic Gradient Descent (SSGD) 1 is the de facto DDL
11
+ 3 optimization method. Using a sufficiently large batch size is critical to achieving
12
+ 4 DDL runtime speedup. In a large batch setting, the learning rate must be increased
13
+ 5 to compensate for the reduced number of parameter updates. However, a large
14
+ 6 learning rate may harm convergence in SSGD and training can easily diverge.
15
+ 7 Recently, Decentralized Parallel SGD (DPSGD) has been proposed to improve
16
+ 8 distributed training speed. In this paper, we find that DPSGD not only has a runtime
17
+ 9 benefit, but also a significant convergence benefit over SSGD in the large batch
18
+ 10 setting. Based on a detailed analysis of DPSGD learning dynamics, we find that
19
+ 11 DPSGD introduces additional landscape-dependent noise that automatically adjusts
20
+ 12 the effective learning rate to improve convergence. In addition, we theoretically
21
+ 13 show that this noise smooths the loss landscape, hence allowing a larger learning
22
+ 14 rate. This result also implies that DPSGD can greatly simplify learning rate tuning
23
+ 15 for tasks that require careful learning rate warmup (e.g, Attention-Based Language
24
+ 16 Modeling). We conduct extensive studies over 18 state-of-the-art DL models/tasks
25
+ 17 and demonstrate that DPSGD often converges in cases where SSGD diverges when
26
+ 18 training is sensitive to large learning rates. Our findings are consistent across three
27
+ 19 different application domains: Computer Vision (CIFAR10 and ImageNet-1K),
28
+ 20 Automatic Speech Recognition (SWB300 and SWB2000) and Natural Language
29
+ 21 Processing (Wikitext-103); three different types of neural network models: Convo
30
+ 22 lutional Neural Networks, Long Short-Term Memory Recurrent Neural Networks
31
+ 23 and Attention-based Transformer Models; and two optimizers: SGD and Adam.
32
+
33
+ # 24 1 Introduction
34
+
35
+ 25 Deep Learning (DL) has revolutionized AI across application domains: Computer Vision (CV)
36
+ 26 [29, 14], Natural Language Processing (NLP) [50], and Automatic Speech Recognition (ASR) [15].
37
+ 27 Stochastic Gradient Descent (SGD) is the fundamental optimization method used in DL training.
38
+ 28 Due to massive computational requirements, Distributed Deep Learning (DDL) is the preferred
39
+ 29 mechanism to train large scale Deep Learning (DL) tasks.
40
+
41
+ The degree of parallelism in a DDL system is dictated by batch size: the larger the batch size, the more parallelism and higher speedup can be expected. However, large batches require a larger learning rate and overall they may negatively affect model accuracy because (1) large batch training usually converges to sharp minima which do not generalize well [24], and (2) large learning rates may violate the conditions (i.e., the learning rate should be less than the reciprocal of the smoothness parameter) required for convergence in nonconvex optimization theory [11]. Although training longer with large batches can lead to better generalization [18], doing so gives up some or all of the speedup we seek.
42
+
43
+ ![](images/2a33efa6376669ea8f27d9129c76a4031e03f3a619bc6d95fd554dba0770cb5c.jpg)
44
+ Figure 1: SSGD (red) does not converge when the learning rate needs to be large (e.g., large batch setting or a short warmup period). Figure 1a shows model accuracy (higher is better), while Figure 1b and Figure 1c show heldout loss (lower is better). Injecting Gaussian noise (blue) does not enable SSGD to escape poor local minima. In contrast, DPSGD (green) converges using the same hyperparameter setup. The detailed task descriptions and training recipes are given in Sections 4.3 and 4.5. BS denotes Batch-Size.
45
+
46
+ 37 Through meticulous hyper-parameter design (e.g., learning rate schedules) tailored to each specific
47
+ 38 task, SSGD-based DDL systems have enabled large batch training and shortened training time for
48
+ 39 some challenging CV tasks [12, 54] and NLP tasks [55] from weeks to hours or less. However, it is
49
+ 40 observed that SSGD with large batch size leads to large training loss and inferior model quality for
50
+ 41 ASR tasks [58], as illustrated in Figure 1b (red curve). Here, we found for other types of tasks (e.g.
51
+ 42 CV and NLP) and DL models, large batch SSGD has the same problem (Figures 1a and 1c).
52
+ 43 Several SSGD variants have been proposed to address large batch training problems: (1) local
53
+ 44 SGD, i.e., SGD-based algorithms with periodic averaging, where learners conduct global averaging
54
+ 45 after multiple steps of gradient-based updates [13, 36, 64]; (2) SSGD based algorithm with second
55
+ 46 order statistics, including adaptive gradient algorithms [55, 54] and algorithms for exploring the
56
+ 47 information from the gradient covariance matrix [51]; and (3) SSGD-based algorithms on a smoothed
57
+ 48 landscape [35, 9], in which specifically designed loss landscape smoothing algorithms are used. All
58
+ 49 of these approaches require global synchronization and/or global statistics collection, which makes
59
+ 50 them vulnerable to stragglers.
60
+ 51 Decentralized algorithms, such as Decentralized Parallel Stochastic Gradient Descent (DPSGD) [33],
61
+ 52 are surrogates for SSGD in machine learning. Unlike SSGD, where each learner updates its weights
62
+ 53 by taking a global average of all learners’ weights, DPSGD updates each learner’s weights by taking
63
+ 54 a partial average (i.e., across a subset of neighboring learners). In contrast to the existing variants
64
+ 55 of SSGD, DPSGD requires no additional calculation and no global synchronization. Traditionally
65
+ 56 DPSGD is a second-choice to SSGD, and is used only when the underlying computational resources
66
+ 57 are less homogeneous (i.e., a high latency network or computational devices running at different
67
+ 58 speeds). Little thought has been given to the question of whether there are any convergence benefits
68
+ 59 for DPSGD, especially in the large batch setting.
69
+ 60 In this paper, we find that DPSGD [33] greatly improves large batch training performance, as
70
+ 61 illustrated by the green curves in Figure 1. Since DPSGD only uses a partial average of neighboring
71
+ 62 learners’ weights, each learner’s weights differ from the weights of other learners. The differing
72
+ 63 weights between learners are an additional source of noise in DPSGD training. The key difference
73
+ 64 between SSGD, SSGD with Gaussian noise (denoted as $" \mathrm { S } \mathrm { S } \mathrm { G } \mathrm { D } ^ { \ast \prime \prime }$ in this paper) and DPSGD is the
74
+ 65 source of noise during the update, and this noise directly affects performance in deep learning. This
75
+ 66 naturally motivates us to ask Why does decentralized training outperform synchronous training in the
76
+ 67 large batch setting? More specifically, we try to understand whether these performance differences
77
+ 68 are caused by differences in noise. We answer this question from both theoretical and empirical
78
+ 69 perspectives. Our contributions are:
79
+
80
+ • We analyze the dynamics of DDL algorithms, including both SSGD and DPSGD. We show, both theoretically and empirically, that the intrinsic noise in DPSGD automatically adjusts the effective learning rate when the batch size is large to help convergence. Note that the intrinsic noise comes completely for free in the DPSGD algorithm, and we show that it has
81
+
82
+ 74 a loss-landscape smoothing effect. Guided by our theoretical results, we also investigate
83
+ 75 training tasks where careful learning rate warmup schemes are required (e.g., Transformer
84
+ 76 models) [56, 42, 52] and find that DPSGD can work with a much shorter learning rate
85
+ 77 warmup period thus simplifying hyper-parameter tuning.
86
+
87
+ We conduct extensive empirical studies of 18 CV, ASR, and NLP tasks with state-of-the-art CNN, LSTM, and Transformer models. Our experimental results demonstrate that DPSGD consistently outperforms SSGD, across application domains and Neural Network (NN) architectures in the large batch setting, without any hyper-parameter tuning. To the best of our knowledge, DPSGD is the only generic algorithm that can improve SSGD large batch training and shorten learning rate warmup period for this many models/tasks. Furthermore, unlike other solutions, DPSGD does not require global synchronization.
88
+
89
+ 85 The remainder of this paper is organized as follows. Section 2 details the problem formulation
90
+ 86 and learning dynamics analysis of SSGD, ${ \bf S } { \bf S } { \bf G } { \bf D } ^ { * }$ , and DPSGD; Section 3 and Section 4 detail the
91
+ 87 empirical results; Section 5 discusses related work; and Section 6 concludes the paper.
92
+
93
+ # 88 2 Analysis of stochastic learning dynamics in SSGD and DPSGD
94
+
95
+ 89 We first formulate the dynamics of an SGD based learning algorithm with multiple $( n > 1 )$ ) learners
96
+ 90 indexed by $j = 1 , 2 , 3 , . . . n$ following the same theoretical framework established for a single
97
+ 91 learner [3]. At time (iteration) $t$ , each learner has its own weight vector $\vec { w } _ { j } ( t )$ , and the average
98
+ 92 weight vector $\vec { w } _ { a } ( t )$ is defined as: $\begin{array} { r } { \vec { w } _ { a } ( t ) \equiv n ^ { - 1 } \sum _ { j = 1 } ^ { n } \vec { w } _ { j } ( t ) } \end{array}$ . Each learner $j$ updates its weight vector
99
+ 93 according to the cross-entropy loss function $L ^ { \mu _ { j } ( t ) } ( \vec { w } )$ for minibatch $\mu _ { j } ( t )$ that is assigned to it at
100
+ 94 time $t$ . The size of the local minibatch is $B$ , and the overall batch size for all learners is $n B$ . Two
101
+ 95 multi-learner algorithms, SSGD and DPSGD, are described below.
102
+
103
+ (1) Synchronous Stochastic Gradient Descent (SSGD): In the synchronous algorithm, each learner $j \in [ 1 , n ]$ starts from the average weight vector $\vec { w } _ { a }$ and moves along the gradient of its local loss function $L ^ { \mu _ { j } ( t ) }$ evaluated at the average weight $\vec { w } _ { a }$ :
104
+
105
+ $$
106
+ \vec { w } _ { j } ( t + 1 ) = \vec { w } _ { a } ( t ) - \alpha \nabla L ^ { \mu _ { j } ( t ) } ( \vec { w } _ { a } ( t ) ) ,
107
+ $$
108
+
109
+ 99 where $\alpha$ is the learning rate.
110
+
111
+ 00 (2) Decentralized Parallel SGD (DPSGD): In the DPSGD algorithm [33], each learner $j$ computes
112
+ 101 the gradient at its own local weight $\vec { w } _ { j } ( t )$ . The learning dynamics follows:
113
+
114
+ $$
115
+ \vec { w } _ { j } ( t + 1 ) = \vec { w } _ { s , j } ( t ) - \alpha \nabla L ^ { \mu _ { j } ( t ) } ( \vec { w } _ { j } ( t ) ) .
116
+ $$
117
+
118
+ where $\vec { w } _ { s , j } ( t )$ is the starting weight set to be the average weight of a subset of “neighboring" learners of learner- $j$ , which corresponds to the non-zero entries in the mixing matrix 2 defined in [33] (note that $\vec { w } _ { s , j } = \vec { w } _ { a }$ if all learners are included as neighbors).
119
+
120
+ 05 By averaging over all learners, the learning dynamics for the average weight $\vec { w } _ { a }$ for both SSGD and
121
+ 106 DPSGD can be written formally the same way as:
122
+
123
+ $$
124
+ \vec { w } _ { a } ( t + 1 ) = \vec { w } _ { a } ( t ) - \alpha \vec { g } _ { a } ,
125
+ $$
126
+
127
+ 107 where $\begin{array} { r } { \vec { g } _ { a } = n ^ { - 1 } \sum _ { j = 1 } ^ { n } \vec { g } _ { j } } \end{array}$ is the average gradient and $\vec { g } _ { j }$ is the gradient from learner- $j$ . The difference
128
+ 108 between SSGD and DPSGD is the weight at which $\vec { g } _ { j }$ is computed: $\vec { g } _ { j } \equiv \nabla L ^ { \mu _ { j } ( t ) } ( \vec { w } _ { a } ( t ) )$ is
129
+ 109 computed at $\vec { w } _ { a }$ for SSGD; $\vec { g } _ { j } \equiv \nabla L ^ { \mu _ { j } ( t ) } ( \vec { w } _ { j } ( t ) )$ is computed at $\vec { w } _ { j }$ for DPSGD. The deviation of
130
+ 110 the weight for learner- $j$ from the average weight is defined as $\delta \vec { w } _ { j } \equiv \vec { w } _ { j } - \vec { w } _ { a }$ . It is easy to see that
131
+ 111 $\delta \vec { w } _ { j } ( t + 1 ) = \vec { w } _ { s , j } ( t ) - \vec { w } _ { a } ( t ) - \alpha [ \vec { g } _ { j } ( \bar { t } ) - \vec { g } _ { a } ( t ) ]$ , which depends on gradients at different points on
132
+ 112 the loss landscape.
133
+
134
+ # 113 2.1 Understanding DPSGD from the Optimization Perspective
135
+
136
+ The main difference between DPSGD and SSGD is that the stochastic gradients are calculated at different weights in DPSGD, while SSGD’s stochastic gradient is calculated at the same weight. Intuitively, DPSGD explores more space than SSGD, which may help explain the empirical success of DPSGD. We formalize this intuition into the following theorem, which shows that DPSGD is optimizing a smoother landscape than SSGD.
137
+
138
+ 119 Theorem 1. Denote $\mathcal { F } _ { t }$ by the filtration generated by all the random variables until the t-th iteration. Suppose n is large enough that120 $\begin{array} { r } { \left\| \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \nabla L ^ { \mu _ { i } ( t ) } ( \vec { w _ { i } } ( t ) ) - \frac { 1 } { n - 1 } \sum _ { i = 1 } ^ { n - 1 } \nabla L ^ { \mu _ { i } ( t ) } ( \vec { w _ { i } } ( t ) ) \right\| \leq \epsilon } \end{array}$
139
+
140
+ 121 almost surely, and assume $\delta \vec { w } _ { i } ( t ) | \mathcal { F } _ { t - 1 } \stackrel { i . i . d . } { \sim } \mathcal { N } ( 0 , \sigma _ { w } ^ { 2 } I )$ with $i = 1 , \ldots , n - 1$ . Then from the
141
+ 122 $( t - 1 )$ -th iteration to $t$ -th iteration, SSGD and DPSGD are doing one step of stochastic gradient
142
+ 123 descent on two different functions $L ( w )$ and $\tilde { L } ( \vec { w } ) \equiv \mathbb { E } _ { \delta \vec { w } _ { i } ( t ) } \left[ L ( \vec { w } + \delta \vec { w } _ { i } ( t ) ) | \mathcal { F } _ { t - 1 } \right] ,$ , respectively.
143
+ 124 The DPSGD loss $\tilde { L } ( w )$ is smoother than the SSGD loss $L ( \vec { w } ) i f L ( \vec { w } )$ is Lipschitz continuous.
144
+ 125 Remark: The proof of Theorem 1 can be found in Appendix A. Here, we briefly mention its
145
+ 126 implications. A function $f$ is defined as $l _ { s }$ -smooth if $\| \nabla \bar { f } ( x ) - \nabla f ( y ) \| \leq l _ { s } \| x - y \|$ for any $x , y$
146
+ 127 where $l _ { s }$ is the smoothness parameter of $f$ . The landscape of the function $f$ is smoother when $l _ { s }$
147
+ 128 is smaller. Assume $L ( w )$ is $G$ -Lipschitz continuous, i.e., $| L ( \vec { w } ) - L ( \vec { v } ) | \leq G \| \vec { w } - \vec { v } \|$ , then by
148
+ 129 using Lemma 2 of [39], we know that the DPSGD landscape $\tilde { L } ( w )$ is $\frac { 2 G } { \sigma _ { w } }$ -smooth. According to the
149
+ 130 convergence theory of SGD and DPSGD for nonconvex functions [11, 33, 12], the largest learning
150
+ 131 rate one can choose to guarantee convergence is $\frac { 1 } { l _ { s } }$ . For SSGD with the original loss landscape $L , l _ { s }$
151
+ 132 can be very large (even close to $+ \infty$ due to the nonsmooth nature of the ReLU activation) while $l _ { s }$ of
152
+ 133 the smoothed loss function $\tilde { L }$ for DPSGD is much smaller. This explains why we can use a larger
153
+ 134 learning rate in DPSGD as the landscape DPSGD sees has a smaller gradient-Lipschitz constant $l _ { s }$
154
+ 135 than that in SSGD.
155
+ 136 It is important to note that $l _ { s }$ of the smoothed loss function $\tilde { L }$ in DPSGD depends on the standard
156
+ 137 deviation $\sigma _ { w }$ of weights from different learners. Since $\sigma _ { w }$ depends on the loss landscape and changes
157
+ 138 with time (see Fig. 2(b)), the smoothing effect in DPSGD is self-adjusting – it is strong in the
158
+ 139 initial stage of training when the loss landscape is rough and becomes weaker as training progresses
159
+ 140 when the loss landscape becomes smoother. Our theoretical result suggests that this self-adjusting
160
+ 141 smoothing effect is responsible for DPSGD’s convergence with a large learning rate in the large batch
161
+ 142 size setting. Next, we elaborate on this insight and verify it in a simple network for classification
162
+ 143 using the MNIST dataset.
163
+ 144 Note that the Theorem 1 is only a one-step analysis. People may be interested in extending the
164
+ 145 analysis to trajectory-based analysis. We provide a sketch here. If we consider the perturbed objective
165
+ 146 $\tilde { L } ( w ) = \mathbb { E } _ { \delta } \left[ \bar { L } ( w + \delta ) \right]$ , where $\delta$ comes from the intrinsic noise of DPSGD, then we can utilize the
166
+ 147 descent lemma as shown in [11] to prove that DPSGD can converge to a stationary point of $\tilde { L } ( w )$ in
167
+ 148 polynomial time. However, without the inherent noise of DPSGD, the landscape is rough and that is
168
+ 149 the reason why SSGD diverges. SSGD may not be able to converge to the stationary point of $L ( w )$
169
+ 150 (since the large learning rate in large batch setting makes the descent lemma not applicable in this
170
+ 151 case) or $\tilde { L } ( w )$ (since there is no noise and landscape-smoothing effect in SSGD, so SSGD does not
171
+ 152 optimize the smoothed landscape). This is also consistent with our empirical evidence.
172
+
173
+ # 2.2 DPSGD Introduces a Landscape-Dependent Self-Adjusting Learning Rate that Helps Convergence
174
+
175
+ 155 To understand the implication of the smoothing effect in DPSGD (Theorem 1) for learning dynamics,
176
+ 156 we define an effective learning rate $\alpha _ { e } \equiv \alpha \vec { g } _ { a } \cdot \vec { g } / | | \vec { g } | | ^ { 2 }$ by projecting the weight displacement vector
177
+ 157 $\Delta \vec { w } _ { a } \equiv \alpha \vec { g } _ { a }$ onto the direction of the gradient $\vec { g } \equiv \nabla L ( \vec { w } _ { a } )$ of the original loss function $L$ at $\vec { w } _ { a }$ .
178
+ 158 The learning dynamics, Eq. 3, can be rewritten as:
179
+
180
+ $$
181
+ \vec { w } _ { a } ( t + 1 ) = \vec { w } _ { a } ( t ) - \alpha _ { e } \vec { g } + \vec { \eta } _ { \perp } ,
182
+ $$
183
+
184
+ 159 where the “noise” term $\vec { \eta } _ { \perp } \equiv - \alpha \vec { g } _ { a } + \alpha _ { e } \vec { g }$ describes the random weight dynamics in directions
185
+ 160 orthogonal to $\vec { g }$ . The noise term has zero mean $\langle \vec { \eta } _ { \perp } \rangle _ { \mu } = 0$ and the noise strength is characterized by
186
+ 161 its variance $\Delta ( t ) \equiv | | \vec { \eta } _ { \perp } | | ^ { 2 }$ .
187
+ 162 The effective learning rate $\alpha _ { e }$ is related to the noise strength: $\alpha _ { e } ^ { 2 } = ( \alpha ^ { 2 } | | \vec { g } _ { a } | | ^ { 2 } - \Delta ) / | | \vec { g } | | _ { - } ^ { 2 }$ , which
188
+ 163 indicates that a higher noise strength $\Delta$ leads to a lower effective learning rate $\alpha _ { e }$ . The DPSGD noise
189
+ 164 $\Delta _ { D P }$ is larger than the SSGD noise $\Delta _ { S }$ by an additional noise term $\Delta ^ { ( 2 ) } ( > 0 )$ that originates from
190
+ 165 the difference of local weights $( \vec { w } _ { j } )$ from their mean $( \vec { w } _ { a } ) \colon \Delta _ { D P } = \Delta _ { S } + \Delta ^ { ( 2 ) }$ , see Appendix B for
191
+
192
+ details. By expanding 166 $\Delta ^ { ( 2 ) }$ w.r.t. $\delta \vec { w } _ { j }$ , we obtain the average $\Delta ^ { ( 2 ) }$ over minibatch ensemble $\{ \mu \}$ :
193
+
194
+ $$
195
+ \begin{array} { l } { { \displaystyle \langle \Delta ^ { ( 2 ) } \rangle _ { \mu } \equiv \alpha ^ { 2 } \langle | | n ^ { - 1 } \sum _ { j = 1 } ^ { n } [ \nabla L ^ { \mu _ { j } } ( \vec { w } _ { j } ) - \nabla L ^ { \mu _ { j } } ( \vec { w } _ { a } ) ] | | ^ { 2 } \rangle _ { \mu } } } \\ { { \displaystyle \approx \alpha ^ { 2 } \sum _ { k , l , l ^ { \prime } } H _ { k l } H _ { k l ^ { \prime } } C _ { l l ^ { \prime } } } , } \end{array}
196
+ $$
197
+
198
+ 167 where $H _ { k l } = \nabla _ { k l } ^ { 2 } L$ is the Hessian matrix of the loss function and $\begin{array} { r } { C _ { l l ^ { \prime } } = n ^ { - 2 } \sum _ { j = 1 } ^ { n } \delta w _ { j , l } \delta w _ { j , l ^ { \prime } } } \end{array}$ is
199
+ 168 the weight covariance matrix. From Eq. 5 and the dependence of on $\Delta$ , it is clear that the effective
200
+ 169 learning rate in DPSGD depends directly on the loss landscape $( H )$ and indirectly via the weight
201
+ 170 variance, $\sigma _ { w } ^ { 2 } = T r ( C )$ , which decreases as the loss landscape becomes smooth (see Fig. 2(b)).
202
+ 171 It is important to stress that the noise $\vec { \eta } _ { \perp }$ in Eq.4 is not an artificially added noise. It is intrinsic to
203
+ 172 the use of minibatches (random subsampling) in all SGD-based algorithms (including SSGD and
204
+ 173 DPSGD). The noise is increased in DPSGD due to the weight difference among different learners
205
+ 174 $( \delta \vec { w } _ { j } )$ . The noise strength $\Delta$ varies in weight space via its dependence on the loss landscape, as
206
+ 175 explicitly shown in Eq. 5. However, besides its landscape dependence, SGD noise scales inversely
207
+ 176 with the minibatch size $B$ [3]. With $n$ synchronized learners, the noise in SSGD scales as $1 / ( n B )$ ,
208
+ 177 which is too small to be effective for a large batch size $n B$ . A main finding of our paper is that the
209
+ 178 additional landscape-dependent noise $\Delta ^ { ( 2 ) }$ in DPSGD can make up for the small SSGD noise when
210
+ 179 $n B$ is large and help enhance convergence in the large batch setting.
211
+ 180 The landscape dependent smoothing effect in DPSGD (shown in Sec. 2.1) indicates that $\alpha _ { e }$ in DPSGD
212
+ 181 is reduced at the beginning of training when the landscape is rough. To demonstrate effects of the
213
+ 182 landscape-dependent self-adjusting learning rates, we did detailed analysis in numerical experiments
214
+ 183 using the MNIST dataset. In this experiment, we used $n = 5$ learners with each learner a fully
215
+ 184 connected network with two hidden layers (50 units per layer) and we used $\vec { w } _ { s , j } = \vec { w } _ { a }$ for DPSGD.
216
+ 185 We focused on the large batch setting using $n B = 2 0 0 0$ and a large learning rate $\alpha = 1$ . As shown
217
+ 186 in Fig. 2(a), DPSGD converges to a solution with a low loss $2 . { \bar { 1 } } \%$ test error), but SSGD fails to
218
+ 187 converge.
219
+ 188 To understand the convergence in DPSGD, we computed the effective learning rate $( \alpha _ { e } )$ and the
220
+ 189 weight variance $( \sigma _ { w } ^ { 2 } )$ during training. As shown in Fig. 2(b) (upper panel), the effective learning rate
221
+ 190 $\alpha _ { e }$ is reduced in DPSGD during early training $0 \leq t \leq 7 0 0 )$ ). This reduction of $\alpha _ { e }$ is caused by the
222
+ 191 stronger noise $\Delta ^ { ( 2 ) }$ in DPSGD (see Fig. 4 in Appendix B), which is essential for convergence when
223
+ 192 gradients are large in the beginning of the training process. In the later stage of the training process
224
+ 193 when gradients are smaller, the landscape-dependent DPSGD noise decreases and $\alpha _ { e }$ automatically
225
+ 194 increases back to be $\approx \alpha$ to allow fast convergence. From Eq. 5, the landscape-dependent noise in
226
+
227
+ ![](images/0bd599bb75428b7917cbf8723dace7ca4a2e5359e6461bfd6deba5bf84f2ce1c.jpg)
228
+ Figure 2: (a) Comparison of different multi-learner algorithms, DPSGD (green), SSGD (red), and ${ \bf S } { \bf S } { \bf G } { \bf D } ^ { * }$ (blue) for a large learning rate $\alpha = 1$ . The adaptive learning rate allows DPSGD to converge while SSGD fails to converge. A fine-tuned ${ \bf S } { \bf S } { \bf G } { \bf D } ^ { * }$ also converges but to an inferior solution. (b) The effective learning rate for DPSGD $\alpha _ { e } ( D P S G D )$ is self-adaptive to the landscape – it is reduced in the beginning of training when gradients are large and recovers to $\sim \alpha$ when the gradients are small. The weight variance $\sigma _ { w } ^ { 2 } \overline { { ( t ) } }$ has the opposite landscape-dependence as $\alpha _ { e }$ and decreases with training time.
229
+
230
+ <table><tr><td colspan="2"></td><td>AlexNet</td><td>VGG</td><td>VGG-BN</td></tr><tr><td>bs=256 lr=1x</td><td>Baseline</td><td>56.31/79.05 lr=0.01</td><td>69.02/88.66</td><td>70.65/89.92 lr=0.1</td></tr><tr><td>bs=2048 lr=8x</td><td>SSGD DPSGD</td><td>54.29/77.43 53.71/76.91</td><td>67.67/87.91 67.28/87.58</td><td>70.36/89.58 69.76/89.31</td></tr><tr><td>bs=4096 lr=16x</td><td>SSGD DPSGD</td><td>0.10/0.50 52.53/76.01</td><td>0.10/0.50 66.44/87.20</td><td>65.39/86.51 68.86/88.82</td></tr><tr><td>bs=8192 lr=32x</td><td>SSGD DPSGD</td><td>0.10/0.50 49.01/73.00</td><td>0.10/0.50 65.00/86.11</td><td>0.10/0.50 63.55/85.43</td></tr></table>
231
+
232
+ Table 1: ImageNet-1K Top-1/Top-5 model accuracy $( \% )$ comparison for batch size 2048, 4096 and 8192. All experiments are conducted on 16 GPUs (learners), with batch size per GPU 128, 256 and 512 respectively. Bold text represents the best model accuracy achieved given the specific batch size and learning rate. The batch size 256 baseline is presented for reference. bs stands for batch-size, lr stands for learning rate. Baseline lr is set to 0.01 for AlexNet and VGG11, 0.1 for the other models. In the large batch setting, we use learning rate warmup and linear scaling as prescribed in [12]. For rough loss landscape like AlexNet and VGG, SSGD diverges when batch size is large whereas DPSGD converges.
233
+
234
+ 195 DPSGD depends on the weight variance. As shown in Fig. 2(b) (lower panel), the weight variance
235
+ 196 $\sigma _ { w } ^ { 2 }$ has a time-dependent trend that is opposite to $\alpha _ { e } \colon \sigma _ { w } ^ { 2 }$ is large in the beginning of training when
236
+ 197 the landscape is rough and decreases as training progresses and the landscape becomes smoother.
237
+ 198 To show the importance of the landscape-dependent weight variance, we used ${ \bf S } { \bf S } { \bf G } { \bf D } ^ { * }$ , which injects
238
+ 199 a Gaussian noise with a constant variance to weights in SSGD, i.e., by setting $\delta \vec { w } _ { j } \stackrel { i . i . d . } { \sim } \mathcal { N } ( 0 , \sigma _ { 0 } ^ { 2 } I )$
239
+ 200 with a constant $\sigma _ { 0 } ^ { 2 }$ . We found that ${ \bf S } { \bf S } { \bf G } { \bf D } ^ { * }$ fails to converge for most choices of noise strength $\sigma _ { 0 } ^ { 2 }$ .
240
+ 201 Only by fine tuning $\sigma _ { 0 } ^ { 2 }$ can ${ \bf S } { \bf S } { \bf G } { \bf D } ^ { * }$ converge, but to an inferior solution with much higher loss and
241
+ 202 test error $( 5 . 7 \% )$ as shown in Fig. 2(a).
242
+ 203 Finally, in addition to helping convergence, we found that the landscape-dependent noise in DPSGD
243
+ 204 can also help find flat minima with better generalization in the large batch setting (see Appendix C
244
+ 205 for details).
245
+
246
+ # 206 3 Experimental Methodology
247
+
248
+ 207 We implemented SSGD and DPSGD using PyTorch, OpenMPI, and NVidia NCCL. We ran exper
249
+ 208 iments on a cluster of two 8-V100-GPU $\mathbf { \boldsymbol { x } } 8 6$ servers. For CV tasks, we evaluated on CIFAR-10
250
+ 209 (50,000 training samples, 178MB) and ImageNet-1K (1.2 million training samples, 140GB). For
251
+ 210 ASR tasks, we evaluated on SWB-300 (300 hours training data, 4,000,000 samples, 30GB) and
252
+ 211 SWB-2000 (2000 hours training data, 30,000,000 samples, 216GB). For the NLP task, we evaluated
253
+ 212 on Wikitext-103(103 million tokens, 180MB). In all, we evaluate 18 state-of-the-art NN models: 15
254
+ 213 CNN models, 2 6-layer bi-directional LSTM models, and 1 16-layer GPT-2 transformer model. We
255
+ 214 summarize the model sizes and training times in Table 6 of Appendix D. Also refer to Appendix D for
256
+ 215 hardware configuration, software implementation, dataset and Neural Network (NN) model details.
257
+
258
+ # 216 4 Experimental Results
259
+
260
+ 217 All the large batch experiments are conducted on 16 GPUs (learners). Batches are evenly distributed
261
+ 218 among learners, e.g., with sixteen learners, each learner uses a local batch size that is one sixteenth
262
+ 219 the overall batch size. A learner randomly picks a neighbor with which to exchange weights in each
263
+ 220 DPSGD iteration [59].
264
+
265
+ # 4.1 SSGD and DPSGD Comparison on CV Tasks (CIFAR-10 and ImageNet-1K)
266
+
267
+ 2 On ImageNet-1K we test 6 CNN models – AlexNet, VGG11, VGG11-BN, ResNet-50, ResNext-50
268
+ 3 and DenseNet-161. Among them, AlexNet and VGG have rougher loss landscapes and can only
269
+ work with smaller learning rates, while VGG11-BN, ResNet-50, ResNext-50, and DenseNet-161
270
+ 25 have smoother loss landscapes thanks to the use of BatchNorm or Residual Connections, and thus
271
+ 6 can work with larger learning rates. We use the same baseline training recipe prescribed in [4]:
272
+ 227 batch size 256, initial learning rate 0.01 for AlexNet and VGG-11 and 0.1 for the other 4 models,
273
+ 228 learning rate anneals by 0.1 every 30 epochs, 100 epochs in total. To study the model performance
274
+ 229 in the large batch setting, we follow the large batch size learning rate schedule prescribed in [12]:
275
+ 230 learning rate warmup for the first 5 epochs and then learning rate linear scaling w.r.t batch size.
276
+ 231 For example, in the AlexNet batch-size 8192 experiment, the learning rate is gradually warmed-up
277
+ 232 from 0.01 to 0.32 in the first 5 epochs, annealed to 0.032 from epoch 31 to epoch 60, annealed to
278
+ 233 0.0032 from epoch 61 to epoch 90, and annealed to 0.00032 from epoch 91 to epoch 100. SSGD and
279
+ 234 DPSGD achieve comparable model accuracy in the large batch setting (see Table 10 in Appendix E.6).
280
+ 235 Most noticeably, when batch-size increases to 8192, SSGD diverges with AlexNet, VGG11, and
281
+ 236 VGG11-BN whereas DPSGD converges as shown in Table 1. Figure 9 in Appendix E.6 details the
282
+ 237 model accuracy progression versus epochs in each setting. Please see our detailed analysis of DPSGD
283
+ 238 vs SSGD on CIFAR-10 tasks throughout Appendix E.1 to Appendix E.5 where we document the
284
+ 239 DPSGD and SSGD comparison and loss landscape visualization (contour 2D projection and Hessian
285
+ 240 2D projection), which show that DPSGD usually leads to much flatter optima than SSGD, and thus
286
+ 241 better generalization in the large batch setting.
287
+
288
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3>SWB-300</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>bs2048</td><td rowspan=1 colspan=1>bs4096</td><td rowspan=1 colspan=1>bs8192</td></tr><tr><td rowspan=1 colspan=1>SSGD</td><td rowspan=1 colspan=1>1.58</td><td rowspan=1 colspan=1>10.37</td><td rowspan=1 colspan=1>10.37</td></tr><tr><td rowspan=1 colspan=1>DPSGD</td><td rowspan=1 colspan=1>1.59</td><td rowspan=1 colspan=1>1.60</td><td rowspan=1 colspan=1>1.66</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>SWB-2000</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>bs2048</td><td rowspan=1 colspan=1>bs4096</td><td rowspan=1 colspan=1>bs8192</td></tr><tr><td rowspan=1 colspan=1>SSGD</td><td rowspan=1 colspan=1>1.46</td><td rowspan=1 colspan=1>1.46</td><td rowspan=1 colspan=1>10.37</td></tr><tr><td rowspan=1 colspan=1>DPSGD</td><td rowspan=1 colspan=1>1.45</td><td rowspan=1 colspan=1>1.47</td><td rowspan=1 colspan=1>1.47</td></tr></table>
289
+
290
+ Table 2: Heldout loss comparison for SSGD and DPSGD, evaluated on SWB-300 and SWB-2000. There are 32000 classes in this task, a held-out loss 10.37 (i.e. $l n ^ { 3 2 0 0 0 }$ ) indicates a complete divergence. bs stands for batch size.
291
+
292
+ ![](images/0138712e56be5a2061e38ed01e9b31664a2149c8bf52189d16d89c8dd015f134.jpg)
293
+ Figure 3: SSGD diverges when the learning rate warmup period is 75 iterations while DPSGD converges with a warmup period as short as 25 iterations. (Wikitext103, GPT-2)
294
+
295
+ Summary For rough loss landscapes like AlexNet and VGG, DPSGD converges whereas SSGD diverges in the large batch setting.
296
+
297
+ # 4.2 SSGD and DPSGD Comparison on ASR tasks
298
+
299
+ Unlike CV tasks where CNNs and their residual connection variants are the dominant models, ASR tasks overwhelmingly adopt RNN/LSTM models that capture sequence features. Furthermore, BatchNorm is known not to work well in RNN/LSTM tasks [31]. Finally, there are over 32,000 different classes with wildy uneven distribution in our ASR tasks due to the Zipfian characteristics of natural language. All in all, ASR tasks present a much more challenging loss landscape than CV tasks to optimize over.
300
+
301
+ For the SWB-300 and SWB-2000 tasks, we follow the same learning rate schedule proposed in [57]: we use learning rate 0.1 for baseline batch size 256, and linearly warmup the learning rate w.r.t the baseline batch size for the first 10 epochs before annealing the learning rate by $\scriptstyle { \frac { 1 } { \sqrt { 2 } } }$ for the remaining 10 epochs. For example, when using a batch size 2048, we linearly warmup the learning rate to 0.8 by the end of the 10th epoch before annealing. Table 2 illustrates heldout loss for SWB-300 and SWB-2000. In the SWB-300 task, SSGD diverges beyond batch size 2048 and DPSGD converges well until batch size 8192. In the SWB-2000 task, SSGD diverges beyond batch size 4096 and DPSGD converges well until batch size 8192. Figure 10 in Appendix E.7 details the heldout loss progression versus epochs.
302
+
303
+ Summary For ASR tasks, SSGD diverges whereas DPSGD converges to baseline model accuracy in the large batch setting.
304
+
305
+ # 4.3 Noise-injection and Learning Rate Tuning
306
+
307
+ 263 In 6 out of 17 studied CV and ASR tasks, a large batch setting leads to a complete divergence in
308
+ 64 SSGD: EfficientNet-B0, AlexNet, VGG11, VGG11-BN, SWB-300 and SWB-2000. As discussed in
309
+ 265 Section 2, the intrinsic landscape-dependent noise in DPSGD effectively helps escape early traps (e.g.,
310
+ 266 saddle points) and improves training by automatically adjusting the learning rate. In this section, we
311
+ 267 demonstrate these facts by systematically adding Gaussian noise (the same as the $S S G D ^ { * }$ algorithm
312
+ 268 in Section 2) and decreasing the learning rate. We find that SSGD might escape early traps but still
313
+ 269 results in a much inferior model compared to DPSGD.
314
+ 270 Noise-injection In Figure 1, we systematically explore Gaussian noise injection with mean 0 and
315
+ 271 standard deviation (std) ranging from 10 to 0.00001 via binary search (i.e. roughly 20 configurations
316
+ 272 for each task). We found in the vast majority of the setups, noise-injection cannot escape early
317
+ 273 traps. In EfficientNet-B0, only when std is set to 0.04, does the model start to converge, but to a
318
+ 274 very low accuracy (test accuracy $2 2 . 1 5 \%$ in SSGD vs $9 1 . 1 3 \%$ in DPSGD). In the SWB-300 case,
319
+ 275 when std is 0.01, SSGD shows an early sign of converging for the first 3 epochs before it starts to
320
+ 276 diverge. In the AlexNet, VGG11, VGG11-BN, and SWB-2000 cases, we didn’t find any configuration
321
+ 277 that can escape early traps. Figure 1 characterizes our best-effort Gaussian noise tuning and its
322
+ 278 comparison against SSGD and DPSGD. A plausible explanation is that Gaussian noise injection
323
+ 279 escapes saddle points very slowly, since Gaussian noise is isotropic and the complexity for finding
324
+ 280 local minima is dimension-dependent [10]. Deep Neural Networks are usually over-parameterized
325
+ 281 (i.e., high-dimensional), so it may take a long time to escape local traps. In contrast, the heightened
326
+ 282 landscape-dependent noise in DPSGD is anisotropic [3, 8] and can drive the system to escape in the
327
+ 283 right directions.
328
+ 284 Learning Rate Tuning To make otherwise-divergent SSGD training converge in the large batch
329
+ 285 setting, we systematically tune down the learning rates. Table 3 and Table 4 compare the model quality
330
+ 286 trained by SSGD and DPSGD using smaller learning rates in the large batch setting, for ImageNet and
331
+
332
+ Table 3: ImageNet-1K learning rate tuning for AlexNet VGG11, VGG11-BN with batch-size 8192. Bold text in each column indicates the best top-1/top-5 accuracy achieved across different learning rate and optimization method configurations for the corresponding batch size. DPSGD consistently delivers the most accurate models. \*The learning rate 1x used here corresponds to batch size 256 baseline learning rate, and we still adopt the same learning rate warmup, scaling and annealing schedule. Thus $3 2 \mathrm { x }$ refers to linear learning rate scaling when batch size is 8192. By reducing learning rate to 16x, ${ 8 } \mathbf { x }$ and $_ { 4 \mathrm { X } }$ , SSGD can escape early traps but still lags behind compared to DPSGD in most cases.
333
+
334
+ <table><tr><td colspan="3">AlexNet</td><td>VGG11</td><td>VGG11-BN</td></tr><tr><td rowspan="2">lr*=32x</td><td>SSGD</td><td>0.10/0.50</td><td>0.10/0.50</td><td>0.10/0.50</td></tr><tr><td>DPSGD</td><td>49.010/73.00</td><td>65.004/86.11</td><td>63.546/85.43</td></tr><tr><td rowspan="2">lr=16x</td><td>SSGD</td><td>0.10/0.50</td><td>0.10/0.50</td><td>70.11/89.47</td></tr><tr><td>DPSGD</td><td>49.26/73.14</td><td>62.046/83.98</td><td>69.108/89.07</td></tr><tr><td rowspan="2">lr=8x</td><td>SSGD</td><td>46.40/70.25</td><td>45.32/70.61</td><td>69.54/89.22</td></tr><tr><td>DPSGD</td><td>47.78/71.89</td><td>56.52/79.92</td><td>68.98/88.78</td></tr><tr><td rowspan="2">lr=4x</td><td>SSGD</td><td>41.77/66.44</td><td>50.20/74.83</td><td>68.61/88.57</td></tr><tr><td>DPSGD</td><td>42.18/66.96</td><td>48.52/73.33</td><td>67.98/88.22</td></tr></table>
335
+
336
+ Table 4: Decreasing learning rate for SWB-300 and SWB-2000 (bs stands for batch-size). Bold text in each column indicates the best held-out loss achieved across different learning rate and optimization method configurations for the corresponding batch size. DPSGD consistently delivers the most accurate models. \*learning rate 1.6 is used for bs4096 and learning rate 3.2 is used for bs8192. We still adopt the same learning rate warmup, scaling and annealing schedule (baseline learning rate is 0.1 for batch size 256).
337
+
338
+ <table><tr><td colspan="2"></td><td>SWB-300 (bs4096)</td><td>SWB-300 (bs8192)</td><td>SWB-2000 (bs 8192)</td></tr><tr><td rowspan="2">lr*=1.6/3.2</td><td>SSGD</td><td>10.37</td><td>10.37</td><td>10.37</td></tr><tr><td>DPSGD</td><td>1.60</td><td>1.66</td><td>1.47</td></tr><tr><td rowspan="2">lr=0.8/1.6</td><td>SSGD</td><td>10.37</td><td>10.37</td><td>10.37</td></tr><tr><td>DPSGD</td><td>1.65</td><td>1.73</td><td>1.48</td></tr><tr><td rowspan="2">lr=0.4/0.8</td><td>SSGD</td><td>1.76</td><td>10.37</td><td>1.51</td></tr><tr><td>DPSGD</td><td>1.77</td><td>1.80</td><td>1.52</td></tr><tr><td rowspan="2">lr=0.2/0.4</td><td>SSGD</td><td>1.92</td><td>2.05</td><td>1.58</td></tr><tr><td>DPSGD</td><td>1.94</td><td>2.00</td><td>1.59</td></tr></table>
339
+
340
+ ASR tasks. Table 9 in Appendix E.3 illustrates the similar learning rate tuning effort for CIFAR-10 tasks. As we can see, by using a smaller learning rate, SSGD can escape early traps and converge, however it consistently lags behind DPSGD in the large batch setting. Morever, DPSGD does not depend on such an exhaustive learning rate tuning to achieve convergence. DPSGD can simply follow the learning rate warm-up and linear scaling rules [12] whereas SSGD requires much more stringent learning rate tuning. This implies DPSGD practitioners enjoy a much larger degree of freedom when it comes to hyper-parameter tuning in the large batch setting than the SSGD practitioners.
341
+
342
+ Summary By systematically introducing landscape-independent noise and reducing the learning rate, SSGD could escape early traps (e.g., saddle points), but results in much inferior models compared to DPSGD in the large batch setting.
343
+
344
+ # 4.4 DPSGD and SSGD Runtime Comparison
345
+
346
+ In Appendix F, we detail runtime comparison between DPSGD and SSGD and demonstrate DPSGD consistently runs faster than SSGD. We also compare DPSGD with LAMB[55], a state-of-the-art optimizer specifically designed for synchronous large-batch training, demonstrating that DPSGD can avoid straggler problems in distributed training.
347
+
348
+ # 4.5 SSGD and DPSGD Comparison on NLP tasks (Wikitext-103)
349
+
350
+ For NLP tasks such as Masked Language Modeling (MLM) [6, 50], a careful learning rate warmup scheme needs to be designed so that learning rate grows from 0 to a desired learning rate gradually. Too short a warmup period often leads to divergence and practitioners need to restart training, which wastes huge computational resources[42, 52, 56]. We test our theory by finding the shortest viable learning rate warmup period for SSGD and DPSGD. We use the hyper-parameter settings prescribed in [52], warmup learning rate 0 to $2 . 5 \times 1 0 ^ { - 4 }$ in the first 64000 samples (i.e., 250 iterations of batch size 256) and then cosine-annealing to zero on top of an Adam optimizer. We then shorten the learning rate warmup period and check convergence. Figure 3 and Table 5 show that SSGD diverges when the learning rate warmup period is shorter than 100 iterations, while DPSGD converges with a warmup period as short as 25 iterations. Figure 1c shows that injecting independent random noise into SSGD (in the same fashion as Section 4.3) does not help SSGD escape early training traps. These experiments corroborate our theory that DPSGD can leverage loss landscape noise to self-adjust the learning rate.
351
+
352
+ <table><tr><td>Warmup(iters)</td><td>250</td><td>100</td><td>75</td><td>50</td><td>25</td><td>15</td></tr><tr><td>SYNC</td><td>3.09</td><td>3.07</td><td>7.26</td><td>7.26</td><td>7.26</td><td>7.26</td></tr><tr><td>DPSGD</td><td>3.08</td><td>3.053</td><td>3.06</td><td>3.08</td><td>3.09</td><td>7.26</td></tr></table>
353
+
354
+ Table 5: Validation loss comparison when shortening the learning rate warmup period. DPSGD can converge with a much shorter warmup. All experiments are conducted on 16 GPUs (learners). Wikitext-103, GPT-2 model, 200 epochs training in total.
355
+
356
+ # 5 Related Works
357
+
358
+ Please see Appendix G
359
+
360
+ # 6 Conclusion
361
+
362
+ In this paper, we find that in the large-batch and large-learning-rate setting, DPSGD yields comparable model accuracy when SSGD converges; moreover, DPSGD converges when SSGD diverges. We then investigate why DPSGD outperforms SSGD for large batch training. Through detailed analysis on small-scale tasks and an extensive empirical study of a diverse set of modern DL tasks, we conclude that the landscape-dependent noise, which is strengthened in the DPSGD system, self-adjusts the effective learning rate according to the loss landscape, helping convergence. This self-adjusting learning rate effect is a mere by-product of the inherent loss-landscape-dependent-noise of the DPSGD training algorithm and requires no additional computation, no additional communication and no additional hyper-parameter tuning. The theory was originally developed to understand why DPSGD outperforms SSGD in the large batch setting for CV and ASR tasks. The same theory can be also verified in NLP tasks where when a carefully designed learning rate warmup scheme is required.
363
+
364
+ References [1] Carlo Baldassi, Christian Borgs, Jennifer T. Chayes, Alessandro Ingrosso, Carlo Lucibello, Luca Saglietti, and Riccardo Zecchina. Unreasonable effectiveness of learning neural networks: From accessible states and robust ensembles to basic algorithmic schemes. Proceedings of the National Academy of Sciences, 113(48):E7655–E7662, 2016. [2] Pratik Chaudhari, Anna Choromanska, Stefano Soatto, Yann LeCun, Carlo Baldassi, Christian Borgs, Jennifer Chayes, Levent Sagun, and Riccardo Zecchina. Entropy-sgd: Biasing gradient descent into wide valleys, 2016. [3] Pratik Chaudhari and Stefano Soatto. Stochastic gradient descent performs variational inference, converges to limit cycles for deep networks. 2018 Information Theory and Applications Workshop (ITA), Feb 2018.
365
+ [4] Soumith Chintala. PyTorch ImageNet Examples, 2020. Available at https://github.com/pytorch/ examples/tree/master/imagenet. [5] J. Deng, W. Dong, R. Socher, L. 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, 2009. [6] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics.
366
+ [7] Gintare Karolina Dziugaite and Daniel M Roy. Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. arXiv preprint arXiv:1703.11008, 2017. [8] Yu Feng and Yuhai Tu. The inverse variance–flatness relation in stochastic gradient descent is critical for finding flat minima. Proceedings of the National Academy of Sciences, 118(9), 2021. [9] Pierre Foret, Ariel Kleiner, Hossein Mobahi, and Behnam Neyshabur. Sharpness-aware minimization for efficiently improving generalization. ICLR, 2021.
367
+ [10] Rong Ge, Furong Huang, Chi Jin, and Yang Yuan. Escaping from saddle points—online stochastic gradient for tensor decomposition. In Conference on Learning Theory, pages 797– 842, 2015.
368
+ [11] Saeed Ghadimi and Guanghui Lan. Stochastic first-and zeroth-order methods for nonconvex stochastic programming. SIAM Journal on Optimization, 23(4):2341–2368, 2013.
369
+ [12] Priya Goyal, Piotr Dollár, Ross B. Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch SGD: training imagenet in 1 hour. CoRR, abs/1706.02677, 2017.
370
+ [13] Vipul Gupta, Santiago Akle Serrano, and Dennis DeCoste. Stochastic weight averaging in parallel: Large-batch training that generalizes well. ICLR, 2020.
371
+ [14] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CVPR, 2015.
372
+ [15] Geoffrey Hinton, Li Deng, Dong Yu, George Dahl, Abdel rahman Mohamed, Navdeep Jaitly, Andrew Senior, Vincent Vanhoucke, Patrick Nguyen, Tara Sainath, and Brian Kingsbury. Deep neural networks for acoustic modeling in speech recognition. Signal Processing Magazine, 2012.
373
+ [16] Geoffrey E. Hinton and Drew van Camp. Keeping the neural networks simple by minimizing the description length of the weights. In Proceedings of the Sixth Annual Conference on Computational Learning Theory, COLT ’93, pages 5–13, New York, NY, USA, 1993. ACM.
374
+ [17] Sepp Hochreiter and Jürgen Schmidhuber. Flat minima. Neural Computation, 9(1):1–42, 1997.
375
+ [18] Elad Hoffer, Itay Hubara, and Daniel Soudry. Train longer, generalize better: closing the generalization gap in large batch training of neural networks. In Advances in Neural Information Processing Systems, pages 1731–1741, 2017. [19] 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. CoRR, abs/1704.04861, 2017. [20] G. Huang, Z. Liu, L. Van Der Maaten, and K. Q. Weinberger. Densely connected convolutional networks. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 2261–2269, 2017.
376
+ 387 [21] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. ICML, 2015. [22] Stanisław Jastrz˛ebski, Zachary Kenton, Devansh Arpit, Nicolas Ballas, Asja Fischer, Yoshua Bengio, and Amos Storkey. Three factors influencing minima in sgd. arXiv preprint arXiv:1711.04623, 2017. [23] Stanislaw Jastrzebski, Zachary Kenton, Devansh Arpit, Nicolas Ballas, Asja Fischer, Yoshua Bengio, and Amos J Storkey. Finding flatter minima with sgd. In ICLR (Workshop), 2018. [24] 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. arXiv preprint arXiv:1609.04836, 2016. [25] D. P. Kingma and J. L. Ba. ADAM: a method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015. [26] Robert Kleinberg, Yuanzhi Li, and Yang Yuan. An alternative view: When does sgd escape local minima? arXiv preprint arXiv:1802.06175, 2018. [27] Anastasia Koloskova, Sebastian Stich, and Martin Jaggi. Decentralized stochastic optimization and gossip algorithms with compressed communication. In International Conference on Machine Learning, pages 3478–3487. PMLR, 2019. [28] Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Computer Science Department, University of Toronto, Tech. Rep, 1(4):7, 2009. [29] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pages 1097–1105, 2012. [30] Sameer Kumar, Victor Bitorff, Dehao Chen, Chiachen Chou, Blake Hechtman, HyoukJoong Lee, Naveen Kumar, Peter Mattson, Shibo Wang, Tao Wang, Yuanzhong Xu, and Zongwei Zhou. Scale MLPerf-0.6 models on Google TPU-v3 Pods. arXiv e-prints, page arXiv:1909.09756, September 2019. [31] César Laurent, Gabriel Pereyra, Philémon Brakel, Ying Zhang, and Yoshua Bengio. Batch normalized recurrent neural networks, 2016. [32] Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer, and Tom Goldstein. Visualizing the loss landscape of neural nets. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. CesaBianchi, and R. Garnett, editors, Advances in Neural Information Processing Systems 31, pages 6389–6399. Curran Associates, Inc., 2018. [33] Xiangru Lian, Ce Zhang, Huan Zhang, Cho-Jui Hsieh, Wei Zhang, and Ji Liu. Can decentralized algorithms outperform centralized algorithms? a case study for decentralized parallel stochastic gradient descent. In Advances in Neural Information Processing Systems, pages 5330–5340, 2017. [34] Xiangru Lian, Wei Zhang, Ce Zhang, and Ji Liu. Asynchronous decentralized parallel stochastic gradient descent. In ICML, 2018. [35] Tao Lin, Lingjing Kong, Sebastian Stich, and Martin Jaggi. Extrapolation for large-batch training in deep learning. In Hal Daumé III and Aarti Singh, editors, Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pages 6094–6104. PMLR, 13–18 Jul 2020.
377
+ 429 [36] Tao Lin, Sebastian U. Stich, and Martin Jaggi. Don’t use large mini-batches, use local SGD. ICLR, 2020. [37] Kang Liu. Train CIFAR10 with PyTorch, 2020. Available at https://github.com/kuangliu/pytorchcifar.
378
+ 433 [38] Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. ICLR, 2017. [39] Yurii Nesterov and Vladimir Spokoiny. Random gradient-free minimization of convex functions. Foundations of Computational Mathematics, 17(2):527–566, 2017.
379
+ 437 [40] Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nati Srebro. Exploring generalization in deep learning. In Advances in Neural Information Processing Systems, pages 5947–5956, 2017. [41] Behnam Neyshabur, Srinadh Bhojanapalli, and Nathan Srebro. A pac-bayesian approach to spectrally-normalized margin bounds for neural networks. arXiv preprint arXiv:1707.09564, 2017. [42] Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. 2018. [43] Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019. [44] Sashank J. Reddi, Satyen Kale, and Sanjiv Kumar. On the convergence of adam and beyond. In International Conference on Learning Representations, 2018. [45] Mark Sandler, Andrew G. Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Inverted residuals and linear bottlenecks: Mobile networks for classification, detection and segmentation. CVPR, abs/1801.04381, 2018. [46] K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. International Conference on Learning Representations, 2015. [47] Samuel L Smith and Quoc V Le. A bayesian perspective on generalization and stochastic gradient descent. arXiv preprint arXiv:1710.06451, 2017. [48] Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott E. Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. CoRR, abs/1409.4842, 2014. [49] Mingxing Tan and Quoc V. Le. Efficientnet: Rethinking model scaling for convolutional neural networks. ICML, abs/1905.11946, 2019. [50] 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 30, pages 5998–6008. Curran Associates, Inc., 2017. [51] Yeming Wen, Kevin Luk, Maxime Gazeau, Guodong Zhang, Harris Chan, and Jimmy Ba. An empirical study of stochastic gradient descent with structured covariance noise. In Silvia Chiappa and Roberto Calandra, editors, Proceedings of the Twenty Third International Conference on Artificial Intelligence and Statistics, volume 108 of Proceedings of Machine Learning Research, pages 3621–3631. PMLR, 26–28 Aug 2020. [52] Thomas Wolf. Transfer Learning in Natural Language Processing, 2019. Available at https: //github.com/huggingface/naacl_transfer_learning_tutorial. [53] Saining Xie, Ross B. Girshick, Piotr Dollár, Zhuowen Tu, and Kaiming He. Aggregated residual transformations for deep neural networks. CVPR, abs/1611.05431, 2017. [54] Yang You, Igor Gitman, and Boris Ginsburg. Scaling SGD batch size to 32k for imagenet training. CoRR, abs/1708.03888, 2017. [55] Yang You, Jing Li, Jonathan Hseu, Xiaodan Song, James Demmel, and Cho-Jui Hsieh. Reducing BERT pre-training time from 3 days to 76 minutes. CoRR, abs/1904.00962, 2019. [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. [57] Wei Zhang, Xiaodong Cui, Ulrich Finkler, Brian Kingsbury, George Saon, David Kung, and Michael Picheny. Distributed deep learning strategies for automatic speech recognition. In ICASSP’2019, May 2019.
380
+ [58] Wei Zhang, Xiaodong Cui, Ulrich Finkler, George Saon, Abdullah Kayi, Alper Buyuktosunoglu, Brian Kingsbury, David Kung, and Michael Picheny. A highly efficient distributed deep learning system for automatic speech recognition. In INTERSPEECH’2019, Sept 2019.
381
+ [59] Wei Zhang, Xiaodong Cui, Abdullah Kayi, Mingrui Liu, Ulrich Finkler, Brian Kingsbury, George Saon, Youssef Mroueh, Alper Buyuktosunoglu, Payel Das, David Kung, and Michael Picheny. Improving efficiency in large-scale decentralized distributed training. In ICASSP’2020, May 2020.
382
+ [60] Wei Zhang, Suyog Gupta, Xiangru Lian, and Ji Liu. Staleness-aware async-sgd for distributed deep learning. In Proceedings of the Twenty-Fifth International Joint Conference on Artificial Intelligence, IJCAI 2016, New York, NY, USA, 9-15 July 2016, pages 2350–2356, 2016.
383
+ [61] Wei Zhang, Suyog Gupta, and Fei Wang. Model accuracy and runtime tradeoff in distributed deep learning: A systematic study. In IEEE International Conference on Data Mining, 2016.
384
+ [62] Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, and Jian Sun. Shufflenet: An extremely efficient convolutional neural network for mobile devices. CVPR, abs/1707.01083, 2018.
385
+ [63] Yao Zhang, Andrew M. Saxe, Madhu S. Advani, and Alpha A. Lee. Energy–entropy competition and the effectiveness of stochastic gradient descent in machine learning. Molecular Physics, 116(21-22):3214–3223, Jun 2018.
386
+ [64] Fan Zhou and Guojing Cong. On the convergence properties of a k-step averaging stochastic gradient descent algorithm for nonconvex optimization. In IJCAI-18, pages 3219–3227, 7 2018.
387
+
388
+ # Checklist
389
+
390
+ 1. For all authors...
391
+
392
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
393
+ (b) Did you describe the limitations of your work? [Yes]
394
+ (c) Did you discuss any potential negative societal impacts of your work? [N/A]
395
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
396
+
397
+ 2. If you are including theoretical results...
398
+
399
+ (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]
400
+
401
+ 3. If you ran experiments...
402
+
403
+ (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] Not code(proprietary), but enough instructions to reproduce the results.
404
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
405
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No]
406
+ (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]
407
+
408
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
409
+
410
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
411
+ (b) Did you mention the license of the assets? [N/A]
412
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No]
413
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
414
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
415
+
416
+ 5. If you used crowdsourcing or conducted research with human subjects...
417
+
418
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
419
+
420
+ 536 (b) Did you describe any potential participant risks, with links to Institutional Review
421
+ 537 Board (IRB) approvals, if applicable? [N/A]
422
+ 538 (c) Did you include the estimated hourly wage paid to participants and the total amount
423
+ 539 spent on participant compensation? [N/A]
parse/dev/Bq2-WN5csW/Bq2-WN5csW_content_list.json ADDED
@@ -0,0 +1,1140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Loss Landscape Dependent Self-Adjusting Learning Rates in Decentralized Stochastic Gradient Descent ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 184,
8
+ 122,
9
+ 815,
10
+ 172
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Anonymous Author(s) \nAffiliation \nAddress \nemail \nAbstract ",
17
+ "bbox": [
18
+ 423,
19
+ 222,
20
+ 578,
21
+ 294
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "1 Distributed Deep Learning (DDL) is essential for large-scale Deep Learning (DL) \n2 training. Synchronous Stochastic Gradient Descent (SSGD) 1 is the de facto DDL \n3 optimization method. Using a sufficiently large batch size is critical to achieving \n4 DDL runtime speedup. In a large batch setting, the learning rate must be increased \n5 to compensate for the reduced number of parameter updates. However, a large \n6 learning rate may harm convergence in SSGD and training can easily diverge. \n7 Recently, Decentralized Parallel SGD (DPSGD) has been proposed to improve \n8 distributed training speed. In this paper, we find that DPSGD not only has a runtime \n9 benefit, but also a significant convergence benefit over SSGD in the large batch \n10 setting. Based on a detailed analysis of DPSGD learning dynamics, we find that \n11 DPSGD introduces additional landscape-dependent noise that automatically adjusts \n12 the effective learning rate to improve convergence. In addition, we theoretically \n13 show that this noise smooths the loss landscape, hence allowing a larger learning \n14 rate. This result also implies that DPSGD can greatly simplify learning rate tuning \n15 for tasks that require careful learning rate warmup (e.g, Attention-Based Language \n16 Modeling). We conduct extensive studies over 18 state-of-the-art DL models/tasks \n17 and demonstrate that DPSGD often converges in cases where SSGD diverges when \n18 training is sensitive to large learning rates. Our findings are consistent across three \n19 different application domains: Computer Vision (CIFAR10 and ImageNet-1K), \n20 Automatic Speech Recognition (SWB300 and SWB2000) and Natural Language \n21 Processing (Wikitext-103); three different types of neural network models: Convo \n22 lutional Neural Networks, Long Short-Term Memory Recurrent Neural Networks \n23 and Attention-based Transformer Models; and two optimizers: SGD and Adam. ",
28
+ "bbox": [
29
+ 147,
30
+ 309,
31
+ 766,
32
+ 627
33
+ ],
34
+ "page_idx": 0
35
+ },
36
+ {
37
+ "type": "text",
38
+ "text": "24 1 Introduction ",
39
+ "text_level": 1,
40
+ "bbox": [
41
+ 148,
42
+ 655,
43
+ 312,
44
+ 671
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "25 Deep Learning (DL) has revolutionized AI across application domains: Computer Vision (CV) \n26 [29, 14], Natural Language Processing (NLP) [50], and Automatic Speech Recognition (ASR) [15]. \n27 Stochastic Gradient Descent (SGD) is the fundamental optimization method used in DL training. \n28 Due to massive computational requirements, Distributed Deep Learning (DDL) is the preferred \n29 mechanism to train large scale Deep Learning (DL) tasks. ",
51
+ "bbox": [
52
+ 147,
53
+ 686,
54
+ 825,
55
+ 756
56
+ ],
57
+ "page_idx": 0
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "The degree of parallelism in a DDL system is dictated by batch size: the larger the batch size, the more parallelism and higher speedup can be expected. However, large batches require a larger learning rate and overall they may negatively affect model accuracy because (1) large batch training usually converges to sharp minima which do not generalize well [24], and (2) large learning rates may violate the conditions (i.e., the learning rate should be less than the reciprocal of the smoothness parameter) required for convergence in nonconvex optimization theory [11]. Although training longer with large batches can lead to better generalization [18], doing so gives up some or all of the speedup we seek. ",
62
+ "bbox": [
63
+ 166,
64
+ 762,
65
+ 825,
66
+ 861
67
+ ],
68
+ "page_idx": 0
69
+ },
70
+ {
71
+ "type": "image",
72
+ "img_path": "images/2a33efa6376669ea8f27d9129c76a4031e03f3a619bc6d95fd554dba0770cb5c.jpg",
73
+ "image_caption": [
74
+ "Figure 1: SSGD (red) does not converge when the learning rate needs to be large (e.g., large batch setting or a short warmup period). Figure 1a shows model accuracy (higher is better), while Figure 1b and Figure 1c show heldout loss (lower is better). Injecting Gaussian noise (blue) does not enable SSGD to escape poor local minima. In contrast, DPSGD (green) converges using the same hyperparameter setup. The detailed task descriptions and training recipes are given in Sections 4.3 and 4.5. BS denotes Batch-Size. "
75
+ ],
76
+ "image_footnote": [],
77
+ "bbox": [
78
+ 176,
79
+ 106,
80
+ 823,
81
+ 247
82
+ ],
83
+ "page_idx": 1
84
+ },
85
+ {
86
+ "type": "text",
87
+ "text": "37 Through meticulous hyper-parameter design (e.g., learning rate schedules) tailored to each specific \n38 task, SSGD-based DDL systems have enabled large batch training and shortened training time for \n39 some challenging CV tasks [12, 54] and NLP tasks [55] from weeks to hours or less. However, it is \n40 observed that SSGD with large batch size leads to large training loss and inferior model quality for \n41 ASR tasks [58], as illustrated in Figure 1b (red curve). Here, we found for other types of tasks (e.g. \n42 CV and NLP) and DL models, large batch SSGD has the same problem (Figures 1a and 1c). \n43 Several SSGD variants have been proposed to address large batch training problems: (1) local \n44 SGD, i.e., SGD-based algorithms with periodic averaging, where learners conduct global averaging \n45 after multiple steps of gradient-based updates [13, 36, 64]; (2) SSGD based algorithm with second \n46 order statistics, including adaptive gradient algorithms [55, 54] and algorithms for exploring the \n47 information from the gradient covariance matrix [51]; and (3) SSGD-based algorithms on a smoothed \n48 landscape [35, 9], in which specifically designed loss landscape smoothing algorithms are used. All \n49 of these approaches require global synchronization and/or global statistics collection, which makes \n50 them vulnerable to stragglers. \n51 Decentralized algorithms, such as Decentralized Parallel Stochastic Gradient Descent (DPSGD) [33], \n52 are surrogates for SSGD in machine learning. Unlike SSGD, where each learner updates its weights \n53 by taking a global average of all learners’ weights, DPSGD updates each learner’s weights by taking \n54 a partial average (i.e., across a subset of neighboring learners). In contrast to the existing variants \n55 of SSGD, DPSGD requires no additional calculation and no global synchronization. Traditionally \n56 DPSGD is a second-choice to SSGD, and is used only when the underlying computational resources \n57 are less homogeneous (i.e., a high latency network or computational devices running at different \n58 speeds). Little thought has been given to the question of whether there are any convergence benefits \n59 for DPSGD, especially in the large batch setting. \n60 In this paper, we find that DPSGD [33] greatly improves large batch training performance, as \n61 illustrated by the green curves in Figure 1. Since DPSGD only uses a partial average of neighboring \n62 learners’ weights, each learner’s weights differ from the weights of other learners. The differing \n63 weights between learners are an additional source of noise in DPSGD training. The key difference \n64 between SSGD, SSGD with Gaussian noise (denoted as $\" \\mathrm { S } \\mathrm { S } \\mathrm { G } \\mathrm { D } ^ { \\ast \\prime \\prime }$ in this paper) and DPSGD is the \n65 source of noise during the update, and this noise directly affects performance in deep learning. This \n66 naturally motivates us to ask Why does decentralized training outperform synchronous training in the \n67 large batch setting? More specifically, we try to understand whether these performance differences \n68 are caused by differences in noise. We answer this question from both theoretical and empirical \n69 perspectives. Our contributions are: ",
88
+ "bbox": [
89
+ 147,
90
+ 373,
91
+ 825,
92
+ 457
93
+ ],
94
+ "page_idx": 1
95
+ },
96
+ {
97
+ "type": "text",
98
+ "text": "",
99
+ "bbox": [
100
+ 145,
101
+ 463,
102
+ 825,
103
+ 574
104
+ ],
105
+ "page_idx": 1
106
+ },
107
+ {
108
+ "type": "text",
109
+ "text": "",
110
+ "bbox": [
111
+ 145,
112
+ 580,
113
+ 825,
114
+ 705
115
+ ],
116
+ "page_idx": 1
117
+ },
118
+ {
119
+ "type": "text",
120
+ "text": "",
121
+ "bbox": [
122
+ 145,
123
+ 710,
124
+ 825,
125
+ 849
126
+ ],
127
+ "page_idx": 1
128
+ },
129
+ {
130
+ "type": "text",
131
+ "text": "• We analyze the dynamics of DDL algorithms, including both SSGD and DPSGD. We show, both theoretically and empirically, that the intrinsic noise in DPSGD automatically adjusts the effective learning rate when the batch size is large to help convergence. Note that the intrinsic noise comes completely for free in the DPSGD algorithm, and we show that it has ",
132
+ "bbox": [
133
+ 217,
134
+ 856,
135
+ 823,
136
+ 911
137
+ ],
138
+ "page_idx": 1
139
+ },
140
+ {
141
+ "type": "text",
142
+ "text": "74 a loss-landscape smoothing effect. Guided by our theoretical results, we also investigate \n75 training tasks where careful learning rate warmup schemes are required (e.g., Transformer \n76 models) [56, 42, 52] and find that DPSGD can work with a much shorter learning rate \n77 warmup period thus simplifying hyper-parameter tuning. ",
143
+ "bbox": [
144
+ 145,
145
+ 92,
146
+ 825,
147
+ 147
148
+ ],
149
+ "page_idx": 2
150
+ },
151
+ {
152
+ "type": "text",
153
+ "text": "We conduct extensive empirical studies of 18 CV, ASR, and NLP tasks with state-of-the-art CNN, LSTM, and Transformer models. Our experimental results demonstrate that DPSGD consistently outperforms SSGD, across application domains and Neural Network (NN) architectures in the large batch setting, without any hyper-parameter tuning. To the best of our knowledge, DPSGD is the only generic algorithm that can improve SSGD large batch training and shorten learning rate warmup period for this many models/tasks. Furthermore, unlike other solutions, DPSGD does not require global synchronization. ",
154
+ "bbox": [
155
+ 215,
156
+ 147,
157
+ 823,
158
+ 244
159
+ ],
160
+ "page_idx": 2
161
+ },
162
+ {
163
+ "type": "text",
164
+ "text": "85 The remainder of this paper is organized as follows. Section 2 details the problem formulation \n86 and learning dynamics analysis of SSGD, ${ \\bf S } { \\bf S } { \\bf G } { \\bf D } ^ { * }$ , and DPSGD; Section 3 and Section 4 detail the \n87 empirical results; Section 5 discusses related work; and Section 6 concludes the paper. ",
165
+ "bbox": [
166
+ 148,
167
+ 250,
168
+ 826,
169
+ 292
170
+ ],
171
+ "page_idx": 2
172
+ },
173
+ {
174
+ "type": "text",
175
+ "text": "88 2 Analysis of stochastic learning dynamics in SSGD and DPSGD ",
176
+ "text_level": 1,
177
+ "bbox": [
178
+ 155,
179
+ 309,
180
+ 727,
181
+ 328
182
+ ],
183
+ "page_idx": 2
184
+ },
185
+ {
186
+ "type": "text",
187
+ "text": "89 We first formulate the dynamics of an SGD based learning algorithm with multiple $( n > 1 )$ ) learners \n90 indexed by $j = 1 , 2 , 3 , . . . n$ following the same theoretical framework established for a single \n91 learner [3]. At time (iteration) $t$ , each learner has its own weight vector $\\vec { w } _ { j } ( t )$ , and the average \n92 weight vector $\\vec { w } _ { a } ( t )$ is defined as: $\\begin{array} { r } { \\vec { w } _ { a } ( t ) \\equiv n ^ { - 1 } \\sum _ { j = 1 } ^ { n } \\vec { w } _ { j } ( t ) } \\end{array}$ . Each learner $j$ updates its weight vector \n93 according to the cross-entropy loss function $L ^ { \\mu _ { j } ( t ) } ( \\vec { w } )$ for minibatch $\\mu _ { j } ( t )$ that is assigned to it at \n94 time $t$ . The size of the local minibatch is $B$ , and the overall batch size for all learners is $n B$ . Two \n95 multi-learner algorithms, SSGD and DPSGD, are described below. ",
188
+ "bbox": [
189
+ 148,
190
+ 339,
191
+ 825,
192
+ 444
193
+ ],
194
+ "page_idx": 2
195
+ },
196
+ {
197
+ "type": "text",
198
+ "text": "(1) Synchronous Stochastic Gradient Descent (SSGD): In the synchronous algorithm, each learner $j \\in [ 1 , n ]$ starts from the average weight vector $\\vec { w } _ { a }$ and moves along the gradient of its local loss function $L ^ { \\mu _ { j } ( t ) }$ evaluated at the average weight $\\vec { w } _ { a }$ : ",
199
+ "bbox": [
200
+ 166,
201
+ 449,
202
+ 825,
203
+ 493
204
+ ],
205
+ "page_idx": 2
206
+ },
207
+ {
208
+ "type": "equation",
209
+ "img_path": "images/7f5fed58ea9fb35c582743ada0fe001f498938dffd7e22f5ccbb2c3e691fca9a.jpg",
210
+ "text": "$$\n\\vec { w } _ { j } ( t + 1 ) = \\vec { w } _ { a } ( t ) - \\alpha \\nabla L ^ { \\mu _ { j } ( t ) } ( \\vec { w } _ { a } ( t ) ) ,\n$$",
211
+ "text_format": "latex",
212
+ "bbox": [
213
+ 364,
214
+ 494,
215
+ 632,
216
+ 515
217
+ ],
218
+ "page_idx": 2
219
+ },
220
+ {
221
+ "type": "text",
222
+ "text": "99 where $\\alpha$ is the learning rate. ",
223
+ "bbox": [
224
+ 147,
225
+ 517,
226
+ 359,
227
+ 531
228
+ ],
229
+ "page_idx": 2
230
+ },
231
+ {
232
+ "type": "text",
233
+ "text": "00 (2) Decentralized Parallel SGD (DPSGD): In the DPSGD algorithm [33], each learner $j$ computes \n101 the gradient at its own local weight $\\vec { w } _ { j } ( t )$ . The learning dynamics follows: ",
234
+ "bbox": [
235
+ 150,
236
+ 536,
237
+ 826,
238
+ 565
239
+ ],
240
+ "page_idx": 2
241
+ },
242
+ {
243
+ "type": "equation",
244
+ "img_path": "images/5236d51099edb84c19eb4d91f8e645fef57c37499ceaac9079431b3b7db97239.jpg",
245
+ "text": "$$\n\\vec { w } _ { j } ( t + 1 ) = \\vec { w } _ { s , j } ( t ) - \\alpha \\nabla L ^ { \\mu _ { j } ( t ) } ( \\vec { w } _ { j } ( t ) ) .\n$$",
246
+ "text_format": "latex",
247
+ "bbox": [
248
+ 359,
249
+ 568,
250
+ 637,
251
+ 588
252
+ ],
253
+ "page_idx": 2
254
+ },
255
+ {
256
+ "type": "text",
257
+ "text": "where $\\vec { w } _ { s , j } ( t )$ is the starting weight set to be the average weight of a subset of “neighboring\" learners of learner- $j$ , which corresponds to the non-zero entries in the mixing matrix 2 defined in [33] (note that $\\vec { w } _ { s , j } = \\vec { w } _ { a }$ if all learners are included as neighbors). ",
258
+ "bbox": [
259
+ 160,
260
+ 589,
261
+ 826,
262
+ 633
263
+ ],
264
+ "page_idx": 2
265
+ },
266
+ {
267
+ "type": "text",
268
+ "text": "05 By averaging over all learners, the learning dynamics for the average weight $\\vec { w } _ { a }$ for both SSGD and \n106 DPSGD can be written formally the same way as: ",
269
+ "bbox": [
270
+ 151,
271
+ 638,
272
+ 825,
273
+ 667
274
+ ],
275
+ "page_idx": 2
276
+ },
277
+ {
278
+ "type": "equation",
279
+ "img_path": "images/920ecff0246fd17c6e267eac08357f766605676bbd909ea7a1b7e5959340e2d6.jpg",
280
+ "text": "$$\n\\vec { w } _ { a } ( t + 1 ) = \\vec { w } _ { a } ( t ) - \\alpha \\vec { g } _ { a } ,\n$$",
281
+ "text_format": "latex",
282
+ "bbox": [
283
+ 408,
284
+ 670,
285
+ 588,
286
+ 688
287
+ ],
288
+ "page_idx": 2
289
+ },
290
+ {
291
+ "type": "text",
292
+ "text": "107 where $\\begin{array} { r } { \\vec { g } _ { a } = n ^ { - 1 } \\sum _ { j = 1 } ^ { n } \\vec { g } _ { j } } \\end{array}$ is the average gradient and $\\vec { g } _ { j }$ is the gradient from learner- $j$ . The difference \n108 between SSGD and DPSGD is the weight at which $\\vec { g } _ { j }$ is computed: $\\vec { g } _ { j } \\equiv \\nabla L ^ { \\mu _ { j } ( t ) } ( \\vec { w } _ { a } ( t ) )$ is \n109 computed at $\\vec { w } _ { a }$ for SSGD; $\\vec { g } _ { j } \\equiv \\nabla L ^ { \\mu _ { j } ( t ) } ( \\vec { w } _ { j } ( t ) )$ is computed at $\\vec { w } _ { j }$ for DPSGD. The deviation of \n110 the weight for learner- $j$ from the average weight is defined as $\\delta \\vec { w } _ { j } \\equiv \\vec { w } _ { j } - \\vec { w } _ { a }$ . It is easy to see that \n111 $\\delta \\vec { w } _ { j } ( t + 1 ) = \\vec { w } _ { s , j } ( t ) - \\vec { w } _ { a } ( t ) - \\alpha [ \\vec { g } _ { j } ( \\bar { t } ) - \\vec { g } _ { a } ( t ) ]$ , which depends on gradients at different points on \n112 the loss landscape. ",
293
+ "bbox": [
294
+ 140,
295
+ 688,
296
+ 825,
297
+ 780
298
+ ],
299
+ "page_idx": 2
300
+ },
301
+ {
302
+ "type": "text",
303
+ "text": "113 2.1 Understanding DPSGD from the Optimization Perspective ",
304
+ "text_level": 1,
305
+ "bbox": [
306
+ 148,
307
+ 794,
308
+ 620,
309
+ 809
310
+ ],
311
+ "page_idx": 2
312
+ },
313
+ {
314
+ "type": "text",
315
+ "text": "The main difference between DPSGD and SSGD is that the stochastic gradients are calculated at different weights in DPSGD, while SSGD’s stochastic gradient is calculated at the same weight. Intuitively, DPSGD explores more space than SSGD, which may help explain the empirical success of DPSGD. We formalize this intuition into the following theorem, which shows that DPSGD is optimizing a smoother landscape than SSGD. ",
316
+ "bbox": [
317
+ 173,
318
+ 819,
319
+ 825,
320
+ 888
321
+ ],
322
+ "page_idx": 2
323
+ },
324
+ {
325
+ "type": "text",
326
+ "text": "119 Theorem 1. Denote $\\mathcal { F } _ { t }$ by the filtration generated by all the random variables until the t-th iteration. Suppose n is large enough that120 $\\begin{array} { r } { \\left\\| \\frac { 1 } { n } \\sum _ { i = 1 } ^ { n } \\nabla L ^ { \\mu _ { i } ( t ) } ( \\vec { w _ { i } } ( t ) ) - \\frac { 1 } { n - 1 } \\sum _ { i = 1 } ^ { n - 1 } \\nabla L ^ { \\mu _ { i } ( t ) } ( \\vec { w _ { i } } ( t ) ) \\right\\| \\leq \\epsilon } \\end{array}$ ",
327
+ "bbox": [
328
+ 142,
329
+ 90,
330
+ 826,
331
+ 127
332
+ ],
333
+ "page_idx": 3
334
+ },
335
+ {
336
+ "type": "text",
337
+ "text": "121 almost surely, and assume $\\delta \\vec { w } _ { i } ( t ) | \\mathcal { F } _ { t - 1 } \\stackrel { i . i . d . } { \\sim } \\mathcal { N } ( 0 , \\sigma _ { w } ^ { 2 } I )$ with $i = 1 , \\ldots , n - 1$ . Then from the \n122 $( t - 1 )$ -th iteration to $t$ -th iteration, SSGD and DPSGD are doing one step of stochastic gradient \n123 descent on two different functions $L ( w )$ and $\\tilde { L } ( \\vec { w } ) \\equiv \\mathbb { E } _ { \\delta \\vec { w } _ { i } ( t ) } \\left[ L ( \\vec { w } + \\delta \\vec { w } _ { i } ( t ) ) | \\mathcal { F } _ { t - 1 } \\right] ,$ , respectively. \n124 The DPSGD loss $\\tilde { L } ( w )$ is smoother than the SSGD loss $L ( \\vec { w } ) i f L ( \\vec { w } )$ is Lipschitz continuous. \n125 Remark: The proof of Theorem 1 can be found in Appendix A. Here, we briefly mention its \n126 implications. A function $f$ is defined as $l _ { s }$ -smooth if $\\| \\nabla \\bar { f } ( x ) - \\nabla f ( y ) \\| \\leq l _ { s } \\| x - y \\|$ for any $x , y$ \n127 where $l _ { s }$ is the smoothness parameter of $f$ . The landscape of the function $f$ is smoother when $l _ { s }$ \n128 is smaller. Assume $L ( w )$ is $G$ -Lipschitz continuous, i.e., $| L ( \\vec { w } ) - L ( \\vec { v } ) | \\leq G \\| \\vec { w } - \\vec { v } \\|$ , then by \n129 using Lemma 2 of [39], we know that the DPSGD landscape $\\tilde { L } ( w )$ is $\\frac { 2 G } { \\sigma _ { w } }$ -smooth. According to the \n130 convergence theory of SGD and DPSGD for nonconvex functions [11, 33, 12], the largest learning \n131 rate one can choose to guarantee convergence is $\\frac { 1 } { l _ { s } }$ . For SSGD with the original loss landscape $L , l _ { s }$ \n132 can be very large (even close to $+ \\infty$ due to the nonsmooth nature of the ReLU activation) while $l _ { s }$ of \n133 the smoothed loss function $\\tilde { L }$ for DPSGD is much smaller. This explains why we can use a larger \n134 learning rate in DPSGD as the landscape DPSGD sees has a smaller gradient-Lipschitz constant $l _ { s }$ \n135 than that in SSGD. \n136 It is important to note that $l _ { s }$ of the smoothed loss function $\\tilde { L }$ in DPSGD depends on the standard \n137 deviation $\\sigma _ { w }$ of weights from different learners. Since $\\sigma _ { w }$ depends on the loss landscape and changes \n138 with time (see Fig. 2(b)), the smoothing effect in DPSGD is self-adjusting – it is strong in the \n139 initial stage of training when the loss landscape is rough and becomes weaker as training progresses \n140 when the loss landscape becomes smoother. Our theoretical result suggests that this self-adjusting \n141 smoothing effect is responsible for DPSGD’s convergence with a large learning rate in the large batch \n142 size setting. Next, we elaborate on this insight and verify it in a simple network for classification \n143 using the MNIST dataset. \n144 Note that the Theorem 1 is only a one-step analysis. People may be interested in extending the \n145 analysis to trajectory-based analysis. We provide a sketch here. If we consider the perturbed objective \n146 $\\tilde { L } ( w ) = \\mathbb { E } _ { \\delta } \\left[ \\bar { L } ( w + \\delta ) \\right]$ , where $\\delta$ comes from the intrinsic noise of DPSGD, then we can utilize the \n147 descent lemma as shown in [11] to prove that DPSGD can converge to a stationary point of $\\tilde { L } ( w )$ in \n148 polynomial time. However, without the inherent noise of DPSGD, the landscape is rough and that is \n149 the reason why SSGD diverges. SSGD may not be able to converge to the stationary point of $L ( w )$ \n150 (since the large learning rate in large batch setting makes the descent lemma not applicable in this \n151 case) or $\\tilde { L } ( w )$ (since there is no noise and landscape-smoothing effect in SSGD, so SSGD does not \n152 optimize the smoothed landscape). This is also consistent with our empirical evidence. ",
338
+ "bbox": [
339
+ 140,
340
+ 133,
341
+ 826,
342
+ 200
343
+ ],
344
+ "page_idx": 3
345
+ },
346
+ {
347
+ "type": "text",
348
+ "text": "",
349
+ "bbox": [
350
+ 140,
351
+ 215,
352
+ 825,
353
+ 375
354
+ ],
355
+ "page_idx": 3
356
+ },
357
+ {
358
+ "type": "text",
359
+ "text": "",
360
+ "bbox": [
361
+ 140,
362
+ 380,
363
+ 825,
364
+ 492
365
+ ],
366
+ "page_idx": 3
367
+ },
368
+ {
369
+ "type": "text",
370
+ "text": "",
371
+ "bbox": [
372
+ 140,
373
+ 497,
374
+ 825,
375
+ 630
376
+ ],
377
+ "page_idx": 3
378
+ },
379
+ {
380
+ "type": "text",
381
+ "text": "2.2 DPSGD Introduces a Landscape-Dependent Self-Adjusting Learning Rate that Helps Convergence ",
382
+ "text_level": 1,
383
+ "bbox": [
384
+ 161,
385
+ 655,
386
+ 805,
387
+ 684
388
+ ],
389
+ "page_idx": 3
390
+ },
391
+ {
392
+ "type": "text",
393
+ "text": "155 To understand the implication of the smoothing effect in DPSGD (Theorem 1) for learning dynamics, \n156 we define an effective learning rate $\\alpha _ { e } \\equiv \\alpha \\vec { g } _ { a } \\cdot \\vec { g } / | | \\vec { g } | | ^ { 2 }$ by projecting the weight displacement vector \n157 $\\Delta \\vec { w } _ { a } \\equiv \\alpha \\vec { g } _ { a }$ onto the direction of the gradient $\\vec { g } \\equiv \\nabla L ( \\vec { w } _ { a } )$ of the original loss function $L$ at $\\vec { w } _ { a }$ . \n158 The learning dynamics, Eq. 3, can be rewritten as: ",
394
+ "bbox": [
395
+ 140,
396
+ 698,
397
+ 826,
398
+ 755
399
+ ],
400
+ "page_idx": 3
401
+ },
402
+ {
403
+ "type": "equation",
404
+ "img_path": "images/4ace28a29c2ab55bdf25d18096dad2bf48fc18fafecc3fa735cca5df3f32ee52.jpg",
405
+ "text": "$$\n\\vec { w } _ { a } ( t + 1 ) = \\vec { w } _ { a } ( t ) - \\alpha _ { e } \\vec { g } + \\vec { \\eta } _ { \\perp } ,\n$$",
406
+ "text_format": "latex",
407
+ "bbox": [
408
+ 388,
409
+ 770,
410
+ 607,
411
+ 787
412
+ ],
413
+ "page_idx": 3
414
+ },
415
+ {
416
+ "type": "text",
417
+ "text": "159 where the “noise” term $\\vec { \\eta } _ { \\perp } \\equiv - \\alpha \\vec { g } _ { a } + \\alpha _ { e } \\vec { g }$ describes the random weight dynamics in directions \n160 orthogonal to $\\vec { g }$ . The noise term has zero mean $\\langle \\vec { \\eta } _ { \\perp } \\rangle _ { \\mu } = 0$ and the noise strength is characterized by \n161 its variance $\\Delta ( t ) \\equiv | | \\vec { \\eta } _ { \\perp } | | ^ { 2 }$ . \n162 The effective learning rate $\\alpha _ { e }$ is related to the noise strength: $\\alpha _ { e } ^ { 2 } = ( \\alpha ^ { 2 } | | \\vec { g } _ { a } | | ^ { 2 } - \\Delta ) / | | \\vec { g } | | _ { - } ^ { 2 }$ , which \n163 indicates that a higher noise strength $\\Delta$ leads to a lower effective learning rate $\\alpha _ { e }$ . The DPSGD noise \n164 $\\Delta _ { D P }$ is larger than the SSGD noise $\\Delta _ { S }$ by an additional noise term $\\Delta ^ { ( 2 ) } ( > 0 )$ that originates from \n165 the difference of local weights $( \\vec { w } _ { j } )$ from their mean $( \\vec { w } _ { a } ) \\colon \\Delta _ { D P } = \\Delta _ { S } + \\Delta ^ { ( 2 ) }$ , see Appendix B for ",
418
+ "bbox": [
419
+ 142,
420
+ 803,
421
+ 825,
422
+ 848
423
+ ],
424
+ "page_idx": 3
425
+ },
426
+ {
427
+ "type": "text",
428
+ "text": "",
429
+ "bbox": [
430
+ 142,
431
+ 853,
432
+ 825,
433
+ 912
434
+ ],
435
+ "page_idx": 3
436
+ },
437
+ {
438
+ "type": "text",
439
+ "text": "details. By expanding 166 $\\Delta ^ { ( 2 ) }$ w.r.t. $\\delta \\vec { w } _ { j }$ , we obtain the average $\\Delta ^ { ( 2 ) }$ over minibatch ensemble $\\{ \\mu \\}$ : ",
440
+ "bbox": [
441
+ 138,
442
+ 88,
443
+ 807,
444
+ 107
445
+ ],
446
+ "page_idx": 4
447
+ },
448
+ {
449
+ "type": "equation",
450
+ "img_path": "images/2ad49e40cac0211e4f7e010129eb1a314a914b3e60050f8d46ea386dd34970d4.jpg",
451
+ "text": "$$\n\\begin{array} { l } { { \\displaystyle \\langle \\Delta ^ { ( 2 ) } \\rangle _ { \\mu } \\equiv \\alpha ^ { 2 } \\langle | | n ^ { - 1 } \\sum _ { j = 1 } ^ { n } [ \\nabla L ^ { \\mu _ { j } } ( \\vec { w } _ { j } ) - \\nabla L ^ { \\mu _ { j } } ( \\vec { w } _ { a } ) ] | | ^ { 2 } \\rangle _ { \\mu } } } \\\\ { { \\displaystyle \\approx \\alpha ^ { 2 } \\sum _ { k , l , l ^ { \\prime } } H _ { k l } H _ { k l ^ { \\prime } } C _ { l l ^ { \\prime } } } , } \\end{array}\n$$",
452
+ "text_format": "latex",
453
+ "bbox": [
454
+ 326,
455
+ 111,
456
+ 669,
457
+ 183
458
+ ],
459
+ "page_idx": 4
460
+ },
461
+ {
462
+ "type": "text",
463
+ "text": "167 where $H _ { k l } = \\nabla _ { k l } ^ { 2 } L$ is the Hessian matrix of the loss function and $\\begin{array} { r } { C _ { l l ^ { \\prime } } = n ^ { - 2 } \\sum _ { j = 1 } ^ { n } \\delta w _ { j , l } \\delta w _ { j , l ^ { \\prime } } } \\end{array}$ is \n168 the weight covariance matrix. From Eq. 5 and the dependence of on $\\Delta$ , it is clear that the effective \n169 learning rate in DPSGD depends directly on the loss landscape $( H )$ and indirectly via the weight \n170 variance, $\\sigma _ { w } ^ { 2 } = T r ( C )$ , which decreases as the loss landscape becomes smooth (see Fig. 2(b)). \n171 It is important to stress that the noise $\\vec { \\eta } _ { \\perp }$ in Eq.4 is not an artificially added noise. It is intrinsic to \n172 the use of minibatches (random subsampling) in all SGD-based algorithms (including SSGD and \n173 DPSGD). The noise is increased in DPSGD due to the weight difference among different learners \n174 $( \\delta \\vec { w } _ { j } )$ . The noise strength $\\Delta$ varies in weight space via its dependence on the loss landscape, as \n175 explicitly shown in Eq. 5. However, besides its landscape dependence, SGD noise scales inversely \n176 with the minibatch size $B$ [3]. With $n$ synchronized learners, the noise in SSGD scales as $1 / ( n B )$ , \n177 which is too small to be effective for a large batch size $n B$ . A main finding of our paper is that the \n178 additional landscape-dependent noise $\\Delta ^ { ( 2 ) }$ in DPSGD can make up for the small SSGD noise when \n179 $n B$ is large and help enhance convergence in the large batch setting. \n180 The landscape dependent smoothing effect in DPSGD (shown in Sec. 2.1) indicates that $\\alpha _ { e }$ in DPSGD \n181 is reduced at the beginning of training when the landscape is rough. To demonstrate effects of the \n182 landscape-dependent self-adjusting learning rates, we did detailed analysis in numerical experiments \n183 using the MNIST dataset. In this experiment, we used $n = 5$ learners with each learner a fully \n184 connected network with two hidden layers (50 units per layer) and we used $\\vec { w } _ { s , j } = \\vec { w } _ { a }$ for DPSGD. \n185 We focused on the large batch setting using $n B = 2 0 0 0$ and a large learning rate $\\alpha = 1$ . As shown \n186 in Fig. 2(a), DPSGD converges to a solution with a low loss $2 . { \\bar { 1 } } \\%$ test error), but SSGD fails to \n187 converge. \n188 To understand the convergence in DPSGD, we computed the effective learning rate $( \\alpha _ { e } )$ and the \n189 weight variance $( \\sigma _ { w } ^ { 2 } )$ during training. As shown in Fig. 2(b) (upper panel), the effective learning rate \n190 $\\alpha _ { e }$ is reduced in DPSGD during early training $0 \\leq t \\leq 7 0 0 )$ ). This reduction of $\\alpha _ { e }$ is caused by the \n191 stronger noise $\\Delta ^ { ( 2 ) }$ in DPSGD (see Fig. 4 in Appendix B), which is essential for convergence when \n192 gradients are large in the beginning of the training process. In the later stage of the training process \n193 when gradients are smaller, the landscape-dependent DPSGD noise decreases and $\\alpha _ { e }$ automatically \n194 increases back to be $\\approx \\alpha$ to allow fast convergence. From Eq. 5, the landscape-dependent noise in ",
464
+ "bbox": [
465
+ 140,
466
+ 186,
467
+ 825,
468
+ 246
469
+ ],
470
+ "page_idx": 4
471
+ },
472
+ {
473
+ "type": "text",
474
+ "text": "",
475
+ "bbox": [
476
+ 140,
477
+ 251,
478
+ 825,
479
+ 378
480
+ ],
481
+ "page_idx": 4
482
+ },
483
+ {
484
+ "type": "text",
485
+ "text": "",
486
+ "bbox": [
487
+ 140,
488
+ 383,
489
+ 825,
490
+ 494
491
+ ],
492
+ "page_idx": 4
493
+ },
494
+ {
495
+ "type": "image",
496
+ "img_path": "images/0bd599bb75428b7917cbf8723dace7ca4a2e5359e6461bfd6deba5bf84f2ce1c.jpg",
497
+ "image_caption": [
498
+ "Figure 2: (a) Comparison of different multi-learner algorithms, DPSGD (green), SSGD (red), and ${ \\bf S } { \\bf S } { \\bf G } { \\bf D } ^ { * }$ (blue) for a large learning rate $\\alpha = 1$ . The adaptive learning rate allows DPSGD to converge while SSGD fails to converge. A fine-tuned ${ \\bf S } { \\bf S } { \\bf G } { \\bf D } ^ { * }$ also converges but to an inferior solution. (b) The effective learning rate for DPSGD $\\alpha _ { e } ( D P S G D )$ is self-adaptive to the landscape – it is reduced in the beginning of training when gradients are large and recovers to $\\sim \\alpha$ when the gradients are small. The weight variance $\\sigma _ { w } ^ { 2 } \\overline { { ( t ) } }$ has the opposite landscape-dependence as $\\alpha _ { e }$ and decreases with training time. "
499
+ ],
500
+ "image_footnote": [],
501
+ "bbox": [
502
+ 178,
503
+ 507,
504
+ 800,
505
+ 695
506
+ ],
507
+ "page_idx": 4
508
+ },
509
+ {
510
+ "type": "text",
511
+ "text": "",
512
+ "bbox": [
513
+ 140,
514
+ 813,
515
+ 825,
516
+ 912
517
+ ],
518
+ "page_idx": 4
519
+ },
520
+ {
521
+ "type": "table",
522
+ "img_path": "images/20afd83e5fc900f3e47c61d9deed7dae2ea1e3276b2953b55c5346eaa92305b7.jpg",
523
+ "table_caption": [],
524
+ "table_footnote": [],
525
+ "table_body": "<table><tr><td colspan=\"2\"></td><td>AlexNet</td><td>VGG</td><td>VGG-BN</td></tr><tr><td>bs=256 lr=1x</td><td>Baseline</td><td>56.31/79.05 lr=0.01</td><td>69.02/88.66</td><td>70.65/89.92 lr=0.1</td></tr><tr><td>bs=2048 lr=8x</td><td>SSGD DPSGD</td><td>54.29/77.43 53.71/76.91</td><td>67.67/87.91 67.28/87.58</td><td>70.36/89.58 69.76/89.31</td></tr><tr><td>bs=4096 lr=16x</td><td>SSGD DPSGD</td><td>0.10/0.50 52.53/76.01</td><td>0.10/0.50 66.44/87.20</td><td>65.39/86.51 68.86/88.82</td></tr><tr><td>bs=8192 lr=32x</td><td>SSGD DPSGD</td><td>0.10/0.50 49.01/73.00</td><td>0.10/0.50 65.00/86.11</td><td>0.10/0.50 63.55/85.43</td></tr></table>",
526
+ "bbox": [
527
+ 290,
528
+ 87,
529
+ 705,
530
+ 204
531
+ ],
532
+ "page_idx": 5
533
+ },
534
+ {
535
+ "type": "text",
536
+ "text": "Table 1: ImageNet-1K Top-1/Top-5 model accuracy $( \\% )$ comparison for batch size 2048, 4096 and 8192. All experiments are conducted on 16 GPUs (learners), with batch size per GPU 128, 256 and 512 respectively. Bold text represents the best model accuracy achieved given the specific batch size and learning rate. The batch size 256 baseline is presented for reference. bs stands for batch-size, lr stands for learning rate. Baseline lr is set to 0.01 for AlexNet and VGG11, 0.1 for the other models. In the large batch setting, we use learning rate warmup and linear scaling as prescribed in [12]. For rough loss landscape like AlexNet and VGG, SSGD diverges when batch size is large whereas DPSGD converges. ",
537
+ "bbox": [
538
+ 173,
539
+ 204,
540
+ 826,
541
+ 315
542
+ ],
543
+ "page_idx": 5
544
+ },
545
+ {
546
+ "type": "text",
547
+ "text": "195 DPSGD depends on the weight variance. As shown in Fig. 2(b) (lower panel), the weight variance \n196 $\\sigma _ { w } ^ { 2 }$ has a time-dependent trend that is opposite to $\\alpha _ { e } \\colon \\sigma _ { w } ^ { 2 }$ is large in the beginning of training when \n197 the landscape is rough and decreases as training progresses and the landscape becomes smoother. \n198 To show the importance of the landscape-dependent weight variance, we used ${ \\bf S } { \\bf S } { \\bf G } { \\bf D } ^ { * }$ , which injects \n199 a Gaussian noise with a constant variance to weights in SSGD, i.e., by setting $\\delta \\vec { w } _ { j } \\stackrel { i . i . d . } { \\sim } \\mathcal { N } ( 0 , \\sigma _ { 0 } ^ { 2 } I )$ \n200 with a constant $\\sigma _ { 0 } ^ { 2 }$ . We found that ${ \\bf S } { \\bf S } { \\bf G } { \\bf D } ^ { * }$ fails to converge for most choices of noise strength $\\sigma _ { 0 } ^ { 2 }$ . \n201 Only by fine tuning $\\sigma _ { 0 } ^ { 2 }$ can ${ \\bf S } { \\bf S } { \\bf G } { \\bf D } ^ { * }$ converge, but to an inferior solution with much higher loss and \n202 test error $( 5 . 7 \\% )$ as shown in Fig. 2(a). \n203 Finally, in addition to helping convergence, we found that the landscape-dependent noise in DPSGD \n204 can also help find flat minima with better generalization in the large batch setting (see Appendix C \n205 for details). ",
548
+ "bbox": [
549
+ 143,
550
+ 352,
551
+ 825,
552
+ 395
553
+ ],
554
+ "page_idx": 5
555
+ },
556
+ {
557
+ "type": "text",
558
+ "text": "",
559
+ "bbox": [
560
+ 142,
561
+ 400,
562
+ 825,
563
+ 476
564
+ ],
565
+ "page_idx": 5
566
+ },
567
+ {
568
+ "type": "text",
569
+ "text": "",
570
+ "bbox": [
571
+ 142,
572
+ 482,
573
+ 825,
574
+ 525
575
+ ],
576
+ "page_idx": 5
577
+ },
578
+ {
579
+ "type": "text",
580
+ "text": "206 3 Experimental Methodology ",
581
+ "text_level": 1,
582
+ "bbox": [
583
+ 148,
584
+ 545,
585
+ 431,
586
+ 563
587
+ ],
588
+ "page_idx": 5
589
+ },
590
+ {
591
+ "type": "text",
592
+ "text": "207 We implemented SSGD and DPSGD using PyTorch, OpenMPI, and NVidia NCCL. We ran exper \n208 iments on a cluster of two 8-V100-GPU $\\mathbf { \\boldsymbol { x } } 8 6$ servers. For CV tasks, we evaluated on CIFAR-10 \n209 (50,000 training samples, 178MB) and ImageNet-1K (1.2 million training samples, 140GB). For \n210 ASR tasks, we evaluated on SWB-300 (300 hours training data, 4,000,000 samples, 30GB) and \n211 SWB-2000 (2000 hours training data, 30,000,000 samples, 216GB). For the NLP task, we evaluated \n212 on Wikitext-103(103 million tokens, 180MB). In all, we evaluate 18 state-of-the-art NN models: 15 \n213 CNN models, 2 6-layer bi-directional LSTM models, and 1 16-layer GPT-2 transformer model. We \n214 summarize the model sizes and training times in Table 6 of Appendix D. Also refer to Appendix D for \n215 hardware configuration, software implementation, dataset and Neural Network (NN) model details. ",
593
+ "bbox": [
594
+ 140,
595
+ 577,
596
+ 825,
597
+ 703
598
+ ],
599
+ "page_idx": 5
600
+ },
601
+ {
602
+ "type": "text",
603
+ "text": "216 4 Experimental Results ",
604
+ "text_level": 1,
605
+ "bbox": [
606
+ 148,
607
+ 710,
608
+ 385,
609
+ 727
610
+ ],
611
+ "page_idx": 5
612
+ },
613
+ {
614
+ "type": "text",
615
+ "text": "217 All the large batch experiments are conducted on 16 GPUs (learners). Batches are evenly distributed \n218 among learners, e.g., with sixteen learners, each learner uses a local batch size that is one sixteenth \n219 the overall batch size. A learner randomly picks a neighbor with which to exchange weights in each \n220 DPSGD iteration [59]. ",
616
+ "bbox": [
617
+ 142,
618
+ 742,
619
+ 825,
620
+ 797
621
+ ],
622
+ "page_idx": 5
623
+ },
624
+ {
625
+ "type": "text",
626
+ "text": "4.1 SSGD and DPSGD Comparison on CV Tasks (CIFAR-10 and ImageNet-1K) ",
627
+ "text_level": 1,
628
+ "bbox": [
629
+ 163,
630
+ 814,
631
+ 741,
632
+ 830
633
+ ],
634
+ "page_idx": 5
635
+ },
636
+ {
637
+ "type": "text",
638
+ "text": "2 On ImageNet-1K we test 6 CNN models – AlexNet, VGG11, VGG11-BN, ResNet-50, ResNext-50 \n3 and DenseNet-161. Among them, AlexNet and VGG have rougher loss landscapes and can only \nwork with smaller learning rates, while VGG11-BN, ResNet-50, ResNext-50, and DenseNet-161 \n25 have smoother loss landscapes thanks to the use of BatchNorm or Residual Connections, and thus \n6 can work with larger learning rates. We use the same baseline training recipe prescribed in [4]: \n227 batch size 256, initial learning rate 0.01 for AlexNet and VGG-11 and 0.1 for the other 4 models, \n228 learning rate anneals by 0.1 every 30 epochs, 100 epochs in total. To study the model performance \n229 in the large batch setting, we follow the large batch size learning rate schedule prescribed in [12]: \n230 learning rate warmup for the first 5 epochs and then learning rate linear scaling w.r.t batch size. \n231 For example, in the AlexNet batch-size 8192 experiment, the learning rate is gradually warmed-up \n232 from 0.01 to 0.32 in the first 5 epochs, annealed to 0.032 from epoch 31 to epoch 60, annealed to \n233 0.0032 from epoch 61 to epoch 90, and annealed to 0.00032 from epoch 91 to epoch 100. SSGD and \n234 DPSGD achieve comparable model accuracy in the large batch setting (see Table 10 in Appendix E.6). \n235 Most noticeably, when batch-size increases to 8192, SSGD diverges with AlexNet, VGG11, and \n236 VGG11-BN whereas DPSGD converges as shown in Table 1. Figure 9 in Appendix E.6 details the \n237 model accuracy progression versus epochs in each setting. Please see our detailed analysis of DPSGD \n238 vs SSGD on CIFAR-10 tasks throughout Appendix E.1 to Appendix E.5 where we document the \n239 DPSGD and SSGD comparison and loss landscape visualization (contour 2D projection and Hessian \n240 2D projection), which show that DPSGD usually leads to much flatter optima than SSGD, and thus \n241 better generalization in the large batch setting. ",
639
+ "bbox": [
640
+ 155,
641
+ 842,
642
+ 823,
643
+ 911
644
+ ],
645
+ "page_idx": 5
646
+ },
647
+ {
648
+ "type": "table",
649
+ "img_path": "images/8b0a1ad355b7044f8fcb5a14ac133dabe686ef8f7374051cd6ec297213ce05ac.jpg",
650
+ "table_caption": [],
651
+ "table_footnote": [
652
+ "Table 2: Heldout loss comparison for SSGD and DPSGD, evaluated on SWB-300 and SWB-2000. There are 32000 classes in this task, a held-out loss 10.37 (i.e. $l n ^ { 3 2 0 0 0 }$ ) indicates a complete divergence. bs stands for batch size. "
653
+ ],
654
+ "table_body": "<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3>SWB-300</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>bs2048</td><td rowspan=1 colspan=1>bs4096</td><td rowspan=1 colspan=1>bs8192</td></tr><tr><td rowspan=1 colspan=1>SSGD</td><td rowspan=1 colspan=1>1.58</td><td rowspan=1 colspan=1>10.37</td><td rowspan=1 colspan=1>10.37</td></tr><tr><td rowspan=1 colspan=1>DPSGD</td><td rowspan=1 colspan=1>1.59</td><td rowspan=1 colspan=1>1.60</td><td rowspan=1 colspan=1>1.66</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>SWB-2000</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>bs2048</td><td rowspan=1 colspan=1>bs4096</td><td rowspan=1 colspan=1>bs8192</td></tr><tr><td rowspan=1 colspan=1>SSGD</td><td rowspan=1 colspan=1>1.46</td><td rowspan=1 colspan=1>1.46</td><td rowspan=1 colspan=1>10.37</td></tr><tr><td rowspan=1 colspan=1>DPSGD</td><td rowspan=1 colspan=1>1.45</td><td rowspan=1 colspan=1>1.47</td><td rowspan=1 colspan=1>1.47</td></tr></table>",
655
+ "bbox": [
656
+ 209,
657
+ 94,
658
+ 465,
659
+ 200
660
+ ],
661
+ "page_idx": 6
662
+ },
663
+ {
664
+ "type": "image",
665
+ "img_path": "images/0138712e56be5a2061e38ed01e9b31664a2149c8bf52189d16d89c8dd015f134.jpg",
666
+ "image_caption": [
667
+ "Figure 3: SSGD diverges when the learning rate warmup period is 75 iterations while DPSGD converges with a warmup period as short as 25 iterations. (Wikitext103, GPT-2) "
668
+ ],
669
+ "image_footnote": [],
670
+ "bbox": [
671
+ 540,
672
+ 169,
673
+ 767,
674
+ 305
675
+ ],
676
+ "page_idx": 6
677
+ },
678
+ {
679
+ "type": "text",
680
+ "text": "",
681
+ "bbox": [
682
+ 138,
683
+ 313,
684
+ 826,
685
+ 520
686
+ ],
687
+ "page_idx": 6
688
+ },
689
+ {
690
+ "type": "text",
691
+ "text": "Summary For rough loss landscapes like AlexNet and VGG, DPSGD converges whereas SSGD diverges in the large batch setting. ",
692
+ "bbox": [
693
+ 165,
694
+ 526,
695
+ 823,
696
+ 555
697
+ ],
698
+ "page_idx": 6
699
+ },
700
+ {
701
+ "type": "text",
702
+ "text": "4.2 SSGD and DPSGD Comparison on ASR tasks ",
703
+ "text_level": 1,
704
+ "bbox": [
705
+ 174,
706
+ 563,
707
+ 532,
708
+ 578
709
+ ],
710
+ "page_idx": 6
711
+ },
712
+ {
713
+ "type": "text",
714
+ "text": "Unlike CV tasks where CNNs and their residual connection variants are the dominant models, ASR tasks overwhelmingly adopt RNN/LSTM models that capture sequence features. Furthermore, BatchNorm is known not to work well in RNN/LSTM tasks [31]. Finally, there are over 32,000 different classes with wildy uneven distribution in our ASR tasks due to the Zipfian characteristics of natural language. All in all, ASR tasks present a much more challenging loss landscape than CV tasks to optimize over. ",
715
+ "bbox": [
716
+ 171,
717
+ 588,
718
+ 825,
719
+ 671
720
+ ],
721
+ "page_idx": 6
722
+ },
723
+ {
724
+ "type": "text",
725
+ "text": "For the SWB-300 and SWB-2000 tasks, we follow the same learning rate schedule proposed in [57]: we use learning rate 0.1 for baseline batch size 256, and linearly warmup the learning rate w.r.t the baseline batch size for the first 10 epochs before annealing the learning rate by $\\scriptstyle { \\frac { 1 } { \\sqrt { 2 } } }$ for the remaining 10 epochs. For example, when using a batch size 2048, we linearly warmup the learning rate to 0.8 by the end of the 10th epoch before annealing. Table 2 illustrates heldout loss for SWB-300 and SWB-2000. In the SWB-300 task, SSGD diverges beyond batch size 2048 and DPSGD converges well until batch size 8192. In the SWB-2000 task, SSGD diverges beyond batch size 4096 and DPSGD converges well until batch size 8192. Figure 10 in Appendix E.7 details the heldout loss progression versus epochs. ",
726
+ "bbox": [
727
+ 173,
728
+ 678,
729
+ 825,
730
+ 806
731
+ ],
732
+ "page_idx": 6
733
+ },
734
+ {
735
+ "type": "text",
736
+ "text": "Summary For ASR tasks, SSGD diverges whereas DPSGD converges to baseline model accuracy in the large batch setting. ",
737
+ "bbox": [
738
+ 171,
739
+ 811,
740
+ 823,
741
+ 840
742
+ ],
743
+ "page_idx": 6
744
+ },
745
+ {
746
+ "type": "text",
747
+ "text": "4.3 Noise-injection and Learning Rate Tuning ",
748
+ "text_level": 1,
749
+ "bbox": [
750
+ 174,
751
+ 857,
752
+ 504,
753
+ 872
754
+ ],
755
+ "page_idx": 6
756
+ },
757
+ {
758
+ "type": "text",
759
+ "text": "263 In 6 out of 17 studied CV and ASR tasks, a large batch setting leads to a complete divergence in \n64 SSGD: EfficientNet-B0, AlexNet, VGG11, VGG11-BN, SWB-300 and SWB-2000. As discussed in \n265 Section 2, the intrinsic landscape-dependent noise in DPSGD effectively helps escape early traps (e.g., \n266 saddle points) and improves training by automatically adjusting the learning rate. In this section, we \n267 demonstrate these facts by systematically adding Gaussian noise (the same as the $S S G D ^ { * }$ algorithm \n268 in Section 2) and decreasing the learning rate. We find that SSGD might escape early traps but still \n269 results in a much inferior model compared to DPSGD. \n270 Noise-injection In Figure 1, we systematically explore Gaussian noise injection with mean 0 and \n271 standard deviation (std) ranging from 10 to 0.00001 via binary search (i.e. roughly 20 configurations \n272 for each task). We found in the vast majority of the setups, noise-injection cannot escape early \n273 traps. In EfficientNet-B0, only when std is set to 0.04, does the model start to converge, but to a \n274 very low accuracy (test accuracy $2 2 . 1 5 \\%$ in SSGD vs $9 1 . 1 3 \\%$ in DPSGD). In the SWB-300 case, \n275 when std is 0.01, SSGD shows an early sign of converging for the first 3 epochs before it starts to \n276 diverge. In the AlexNet, VGG11, VGG11-BN, and SWB-2000 cases, we didn’t find any configuration \n277 that can escape early traps. Figure 1 characterizes our best-effort Gaussian noise tuning and its \n278 comparison against SSGD and DPSGD. A plausible explanation is that Gaussian noise injection \n279 escapes saddle points very slowly, since Gaussian noise is isotropic and the complexity for finding \n280 local minima is dimension-dependent [10]. Deep Neural Networks are usually over-parameterized \n281 (i.e., high-dimensional), so it may take a long time to escape local traps. In contrast, the heightened \n282 landscape-dependent noise in DPSGD is anisotropic [3, 8] and can drive the system to escape in the \n283 right directions. \n284 Learning Rate Tuning To make otherwise-divergent SSGD training converge in the large batch \n285 setting, we systematically tune down the learning rates. Table 3 and Table 4 compare the model quality \n286 trained by SSGD and DPSGD using smaller learning rates in the large batch setting, for ImageNet and ",
760
+ "bbox": [
761
+ 150,
762
+ 883,
763
+ 825,
764
+ 911
765
+ ],
766
+ "page_idx": 6
767
+ },
768
+ {
769
+ "type": "table",
770
+ "img_path": "images/997050f80a6d49b6d9b024e2420cfb417c000c13e4939af4c0a6400a8d471254.jpg",
771
+ "table_caption": [
772
+ "Table 3: ImageNet-1K learning rate tuning for AlexNet VGG11, VGG11-BN with batch-size 8192. Bold text in each column indicates the best top-1/top-5 accuracy achieved across different learning rate and optimization method configurations for the corresponding batch size. DPSGD consistently delivers the most accurate models. \\*The learning rate 1x used here corresponds to batch size 256 baseline learning rate, and we still adopt the same learning rate warmup, scaling and annealing schedule. Thus $3 2 \\mathrm { x }$ refers to linear learning rate scaling when batch size is 8192. By reducing learning rate to 16x, ${ 8 } \\mathbf { x }$ and $_ { 4 \\mathrm { X } }$ , SSGD can escape early traps but still lags behind compared to DPSGD in most cases. "
773
+ ],
774
+ "table_footnote": [],
775
+ "table_body": "<table><tr><td colspan=\"3\">AlexNet</td><td>VGG11</td><td>VGG11-BN</td></tr><tr><td rowspan=\"2\">lr*=32x</td><td>SSGD</td><td>0.10/0.50</td><td>0.10/0.50</td><td>0.10/0.50</td></tr><tr><td>DPSGD</td><td>49.010/73.00</td><td>65.004/86.11</td><td>63.546/85.43</td></tr><tr><td rowspan=\"2\">lr=16x</td><td>SSGD</td><td>0.10/0.50</td><td>0.10/0.50</td><td>70.11/89.47</td></tr><tr><td>DPSGD</td><td>49.26/73.14</td><td>62.046/83.98</td><td>69.108/89.07</td></tr><tr><td rowspan=\"2\">lr=8x</td><td>SSGD</td><td>46.40/70.25</td><td>45.32/70.61</td><td>69.54/89.22</td></tr><tr><td>DPSGD</td><td>47.78/71.89</td><td>56.52/79.92</td><td>68.98/88.78</td></tr><tr><td rowspan=\"2\">lr=4x</td><td>SSGD</td><td>41.77/66.44</td><td>50.20/74.83</td><td>68.61/88.57</td></tr><tr><td>DPSGD</td><td>42.18/66.96</td><td>48.52/73.33</td><td>67.98/88.22</td></tr></table>",
776
+ "bbox": [
777
+ 284,
778
+ 87,
779
+ 714,
780
+ 204
781
+ ],
782
+ "page_idx": 7
783
+ },
784
+ {
785
+ "type": "table",
786
+ "img_path": "images/569993d46dfda2f43ab3fa6f11e4cce34482dd912c80cbb38f651f47cbfffaf7.jpg",
787
+ "table_caption": [
788
+ "Table 4: Decreasing learning rate for SWB-300 and SWB-2000 (bs stands for batch-size). Bold text in each column indicates the best held-out loss achieved across different learning rate and optimization method configurations for the corresponding batch size. DPSGD consistently delivers the most accurate models. \\*learning rate 1.6 is used for bs4096 and learning rate 3.2 is used for bs8192. We still adopt the same learning rate warmup, scaling and annealing schedule (baseline learning rate is 0.1 for batch size 256). "
789
+ ],
790
+ "table_footnote": [],
791
+ "table_body": "<table><tr><td colspan=\"2\"></td><td>SWB-300 (bs4096)</td><td>SWB-300 (bs8192)</td><td>SWB-2000 (bs 8192)</td></tr><tr><td rowspan=\"2\">lr*=1.6/3.2</td><td>SSGD</td><td>10.37</td><td>10.37</td><td>10.37</td></tr><tr><td>DPSGD</td><td>1.60</td><td>1.66</td><td>1.47</td></tr><tr><td rowspan=\"2\">lr=0.8/1.6</td><td>SSGD</td><td>10.37</td><td>10.37</td><td>10.37</td></tr><tr><td>DPSGD</td><td>1.65</td><td>1.73</td><td>1.48</td></tr><tr><td rowspan=\"2\">lr=0.4/0.8</td><td>SSGD</td><td>1.76</td><td>10.37</td><td>1.51</td></tr><tr><td>DPSGD</td><td>1.77</td><td>1.80</td><td>1.52</td></tr><tr><td rowspan=\"2\">lr=0.2/0.4</td><td>SSGD</td><td>1.92</td><td>2.05</td><td>1.58</td></tr><tr><td>DPSGD</td><td>1.94</td><td>2.00</td><td>1.59</td></tr></table>",
792
+ "bbox": [
793
+ 299,
794
+ 324,
795
+ 697,
796
+ 453
797
+ ],
798
+ "page_idx": 7
799
+ },
800
+ {
801
+ "type": "text",
802
+ "text": "",
803
+ "bbox": [
804
+ 140,
805
+ 574,
806
+ 825,
807
+ 643
808
+ ],
809
+ "page_idx": 7
810
+ },
811
+ {
812
+ "type": "text",
813
+ "text": "",
814
+ "bbox": [
815
+ 138,
816
+ 660,
817
+ 825,
818
+ 853
819
+ ],
820
+ "page_idx": 7
821
+ },
822
+ {
823
+ "type": "text",
824
+ "text": "",
825
+ "bbox": [
826
+ 142,
827
+ 869,
828
+ 825,
829
+ 911
830
+ ],
831
+ "page_idx": 7
832
+ },
833
+ {
834
+ "type": "text",
835
+ "text": "ASR tasks. Table 9 in Appendix E.3 illustrates the similar learning rate tuning effort for CIFAR-10 tasks. As we can see, by using a smaller learning rate, SSGD can escape early traps and converge, however it consistently lags behind DPSGD in the large batch setting. Morever, DPSGD does not depend on such an exhaustive learning rate tuning to achieve convergence. DPSGD can simply follow the learning rate warm-up and linear scaling rules [12] whereas SSGD requires much more stringent learning rate tuning. This implies DPSGD practitioners enjoy a much larger degree of freedom when it comes to hyper-parameter tuning in the large batch setting than the SSGD practitioners. ",
836
+ "bbox": [
837
+ 140,
838
+ 90,
839
+ 825,
840
+ 189
841
+ ],
842
+ "page_idx": 8
843
+ },
844
+ {
845
+ "type": "text",
846
+ "text": "Summary By systematically introducing landscape-independent noise and reducing the learning rate, SSGD could escape early traps (e.g., saddle points), but results in much inferior models compared to DPSGD in the large batch setting. ",
847
+ "bbox": [
848
+ 168,
849
+ 195,
850
+ 825,
851
+ 237
852
+ ],
853
+ "page_idx": 8
854
+ },
855
+ {
856
+ "type": "text",
857
+ "text": "4.4 DPSGD and SSGD Runtime Comparison ",
858
+ "text_level": 1,
859
+ "bbox": [
860
+ 173,
861
+ 251,
862
+ 500,
863
+ 267
864
+ ],
865
+ "page_idx": 8
866
+ },
867
+ {
868
+ "type": "text",
869
+ "text": "In Appendix F, we detail runtime comparison between DPSGD and SSGD and demonstrate DPSGD consistently runs faster than SSGD. We also compare DPSGD with LAMB[55], a state-of-the-art optimizer specifically designed for synchronous large-batch training, demonstrating that DPSGD can avoid straggler problems in distributed training. ",
870
+ "bbox": [
871
+ 174,
872
+ 277,
873
+ 825,
874
+ 333
875
+ ],
876
+ "page_idx": 8
877
+ },
878
+ {
879
+ "type": "text",
880
+ "text": "4.5 SSGD and DPSGD Comparison on NLP tasks (Wikitext-103) ",
881
+ "text_level": 1,
882
+ "bbox": [
883
+ 166,
884
+ 348,
885
+ 637,
886
+ 363
887
+ ],
888
+ "page_idx": 8
889
+ },
890
+ {
891
+ "type": "text",
892
+ "text": "For NLP tasks such as Masked Language Modeling (MLM) [6, 50], a careful learning rate warmup scheme needs to be designed so that learning rate grows from 0 to a desired learning rate gradually. Too short a warmup period often leads to divergence and practitioners need to restart training, which wastes huge computational resources[42, 52, 56]. We test our theory by finding the shortest viable learning rate warmup period for SSGD and DPSGD. We use the hyper-parameter settings prescribed in [52], warmup learning rate 0 to $2 . 5 \\times 1 0 ^ { - 4 }$ in the first 64000 samples (i.e., 250 iterations of batch size 256) and then cosine-annealing to zero on top of an Adam optimizer. We then shorten the learning rate warmup period and check convergence. Figure 3 and Table 5 show that SSGD diverges when the learning rate warmup period is shorter than 100 iterations, while DPSGD converges with a warmup period as short as 25 iterations. Figure 1c shows that injecting independent random noise into SSGD (in the same fashion as Section 4.3) does not help SSGD escape early training traps. These experiments corroborate our theory that DPSGD can leverage loss landscape noise to self-adjust the learning rate. ",
893
+ "bbox": [
894
+ 173,
895
+ 373,
896
+ 825,
897
+ 553
898
+ ],
899
+ "page_idx": 8
900
+ },
901
+ {
902
+ "type": "table",
903
+ "img_path": "images/34837a09251e98e97da01881155fecf45ff5878361a71b7b15777564823fb798.jpg",
904
+ "table_caption": [],
905
+ "table_footnote": [
906
+ "Table 5: Validation loss comparison when shortening the learning rate warmup period. DPSGD can converge with a much shorter warmup. All experiments are conducted on 16 GPUs (learners). Wikitext-103, GPT-2 model, 200 epochs training in total. "
907
+ ],
908
+ "table_body": "<table><tr><td>Warmup(iters)</td><td>250</td><td>100</td><td>75</td><td>50</td><td>25</td><td>15</td></tr><tr><td>SYNC</td><td>3.09</td><td>3.07</td><td>7.26</td><td>7.26</td><td>7.26</td><td>7.26</td></tr><tr><td>DPSGD</td><td>3.08</td><td>3.053</td><td>3.06</td><td>3.08</td><td>3.09</td><td>7.26</td></tr></table>",
909
+ "bbox": [
910
+ 290,
911
+ 564,
912
+ 705,
913
+ 608
914
+ ],
915
+ "page_idx": 8
916
+ },
917
+ {
918
+ "type": "text",
919
+ "text": "5 Related Works ",
920
+ "text_level": 1,
921
+ "bbox": [
922
+ 176,
923
+ 674,
924
+ 328,
925
+ 691
926
+ ],
927
+ "page_idx": 8
928
+ },
929
+ {
930
+ "type": "text",
931
+ "text": "Please see Appendix G ",
932
+ "bbox": [
933
+ 169,
934
+ 696,
935
+ 326,
936
+ 710
937
+ ],
938
+ "page_idx": 8
939
+ },
940
+ {
941
+ "type": "text",
942
+ "text": "6 Conclusion ",
943
+ "text_level": 1,
944
+ "bbox": [
945
+ 171,
946
+ 728,
947
+ 299,
948
+ 746
949
+ ],
950
+ "page_idx": 8
951
+ },
952
+ {
953
+ "type": "text",
954
+ "text": "In this paper, we find that in the large-batch and large-learning-rate setting, DPSGD yields comparable model accuracy when SSGD converges; moreover, DPSGD converges when SSGD diverges. We then investigate why DPSGD outperforms SSGD for large batch training. Through detailed analysis on small-scale tasks and an extensive empirical study of a diverse set of modern DL tasks, we conclude that the landscape-dependent noise, which is strengthened in the DPSGD system, self-adjusts the effective learning rate according to the loss landscape, helping convergence. This self-adjusting learning rate effect is a mere by-product of the inherent loss-landscape-dependent-noise of the DPSGD training algorithm and requires no additional computation, no additional communication and no additional hyper-parameter tuning. The theory was originally developed to understand why DPSGD outperforms SSGD in the large batch setting for CV and ASR tasks. The same theory can be also verified in NLP tasks where when a carefully designed learning rate warmup scheme is required. ",
955
+ "bbox": [
956
+ 171,
957
+ 758,
958
+ 825,
959
+ 911
960
+ ],
961
+ "page_idx": 8
962
+ },
963
+ {
964
+ "type": "text",
965
+ "text": "References [1] Carlo Baldassi, Christian Borgs, Jennifer T. Chayes, Alessandro Ingrosso, Carlo Lucibello, Luca Saglietti, and Riccardo Zecchina. Unreasonable effectiveness of learning neural networks: From accessible states and robust ensembles to basic algorithmic schemes. Proceedings of the National Academy of Sciences, 113(48):E7655–E7662, 2016. [2] Pratik Chaudhari, Anna Choromanska, Stefano Soatto, Yann LeCun, Carlo Baldassi, Christian Borgs, Jennifer Chayes, Levent Sagun, and Riccardo Zecchina. Entropy-sgd: Biasing gradient descent into wide valleys, 2016. [3] Pratik Chaudhari and Stefano Soatto. Stochastic gradient descent performs variational inference, converges to limit cycles for deep networks. 2018 Information Theory and Applications Workshop (ITA), Feb 2018. \n[4] Soumith Chintala. PyTorch ImageNet Examples, 2020. Available at https://github.com/pytorch/ examples/tree/master/imagenet. [5] J. Deng, W. Dong, R. Socher, L. 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, 2009. [6] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. \n[7] Gintare Karolina Dziugaite and Daniel M Roy. Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. arXiv preprint arXiv:1703.11008, 2017. [8] Yu Feng and Yuhai Tu. The inverse variance–flatness relation in stochastic gradient descent is critical for finding flat minima. Proceedings of the National Academy of Sciences, 118(9), 2021. [9] Pierre Foret, Ariel Kleiner, Hossein Mobahi, and Behnam Neyshabur. Sharpness-aware minimization for efficiently improving generalization. ICLR, 2021. \n[10] Rong Ge, Furong Huang, Chi Jin, and Yang Yuan. Escaping from saddle points—online stochastic gradient for tensor decomposition. In Conference on Learning Theory, pages 797– 842, 2015. \n[11] Saeed Ghadimi and Guanghui Lan. Stochastic first-and zeroth-order methods for nonconvex stochastic programming. SIAM Journal on Optimization, 23(4):2341–2368, 2013. \n[12] Priya Goyal, Piotr Dollár, Ross B. Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch SGD: training imagenet in 1 hour. CoRR, abs/1706.02677, 2017. \n[13] Vipul Gupta, Santiago Akle Serrano, and Dennis DeCoste. Stochastic weight averaging in parallel: Large-batch training that generalizes well. ICLR, 2020. \n[14] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CVPR, 2015. \n[15] Geoffrey Hinton, Li Deng, Dong Yu, George Dahl, Abdel rahman Mohamed, Navdeep Jaitly, Andrew Senior, Vincent Vanhoucke, Patrick Nguyen, Tara Sainath, and Brian Kingsbury. Deep neural networks for acoustic modeling in speech recognition. Signal Processing Magazine, 2012. \n[16] Geoffrey E. Hinton and Drew van Camp. Keeping the neural networks simple by minimizing the description length of the weights. In Proceedings of the Sixth Annual Conference on Computational Learning Theory, COLT ’93, pages 5–13, New York, NY, USA, 1993. ACM. \n[17] Sepp Hochreiter and Jürgen Schmidhuber. Flat minima. Neural Computation, 9(1):1–42, 1997. \n[18] Elad Hoffer, Itay Hubara, and Daniel Soudry. Train longer, generalize better: closing the generalization gap in large batch training of neural networks. In Advances in Neural Information Processing Systems, pages 1731–1741, 2017. [19] 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. CoRR, abs/1704.04861, 2017. [20] G. Huang, Z. Liu, L. Van Der Maaten, and K. Q. Weinberger. Densely connected convolutional networks. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 2261–2269, 2017. \n387 [21] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. ICML, 2015. [22] Stanisław Jastrz˛ebski, Zachary Kenton, Devansh Arpit, Nicolas Ballas, Asja Fischer, Yoshua Bengio, and Amos Storkey. Three factors influencing minima in sgd. arXiv preprint arXiv:1711.04623, 2017. [23] Stanislaw Jastrzebski, Zachary Kenton, Devansh Arpit, Nicolas Ballas, Asja Fischer, Yoshua Bengio, and Amos J Storkey. Finding flatter minima with sgd. In ICLR (Workshop), 2018. [24] 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. arXiv preprint arXiv:1609.04836, 2016. [25] D. P. Kingma and J. L. Ba. ADAM: a method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015. [26] Robert Kleinberg, Yuanzhi Li, and Yang Yuan. An alternative view: When does sgd escape local minima? arXiv preprint arXiv:1802.06175, 2018. [27] Anastasia Koloskova, Sebastian Stich, and Martin Jaggi. Decentralized stochastic optimization and gossip algorithms with compressed communication. In International Conference on Machine Learning, pages 3478–3487. PMLR, 2019. [28] Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Computer Science Department, University of Toronto, Tech. Rep, 1(4):7, 2009. [29] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pages 1097–1105, 2012. [30] Sameer Kumar, Victor Bitorff, Dehao Chen, Chiachen Chou, Blake Hechtman, HyoukJoong Lee, Naveen Kumar, Peter Mattson, Shibo Wang, Tao Wang, Yuanzhong Xu, and Zongwei Zhou. Scale MLPerf-0.6 models on Google TPU-v3 Pods. arXiv e-prints, page arXiv:1909.09756, September 2019. [31] César Laurent, Gabriel Pereyra, Philémon Brakel, Ying Zhang, and Yoshua Bengio. Batch normalized recurrent neural networks, 2016. [32] Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer, and Tom Goldstein. Visualizing the loss landscape of neural nets. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. CesaBianchi, and R. Garnett, editors, Advances in Neural Information Processing Systems 31, pages 6389–6399. Curran Associates, Inc., 2018. [33] Xiangru Lian, Ce Zhang, Huan Zhang, Cho-Jui Hsieh, Wei Zhang, and Ji Liu. Can decentralized algorithms outperform centralized algorithms? a case study for decentralized parallel stochastic gradient descent. In Advances in Neural Information Processing Systems, pages 5330–5340, 2017. [34] Xiangru Lian, Wei Zhang, Ce Zhang, and Ji Liu. Asynchronous decentralized parallel stochastic gradient descent. In ICML, 2018. [35] Tao Lin, Lingjing Kong, Sebastian Stich, and Martin Jaggi. Extrapolation for large-batch training in deep learning. In Hal Daumé III and Aarti Singh, editors, Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pages 6094–6104. PMLR, 13–18 Jul 2020. \n429 [36] Tao Lin, Sebastian U. Stich, and Martin Jaggi. Don’t use large mini-batches, use local SGD. ICLR, 2020. [37] Kang Liu. Train CIFAR10 with PyTorch, 2020. Available at https://github.com/kuangliu/pytorchcifar. \n433 [38] Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. ICLR, 2017. [39] Yurii Nesterov and Vladimir Spokoiny. Random gradient-free minimization of convex functions. Foundations of Computational Mathematics, 17(2):527–566, 2017. \n437 [40] Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nati Srebro. Exploring generalization in deep learning. In Advances in Neural Information Processing Systems, pages 5947–5956, 2017. [41] Behnam Neyshabur, Srinadh Bhojanapalli, and Nathan Srebro. A pac-bayesian approach to spectrally-normalized margin bounds for neural networks. arXiv preprint arXiv:1707.09564, 2017. [42] Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. 2018. [43] Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019. [44] Sashank J. Reddi, Satyen Kale, and Sanjiv Kumar. On the convergence of adam and beyond. In International Conference on Learning Representations, 2018. [45] Mark Sandler, Andrew G. Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Inverted residuals and linear bottlenecks: Mobile networks for classification, detection and segmentation. CVPR, abs/1801.04381, 2018. [46] K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. International Conference on Learning Representations, 2015. [47] Samuel L Smith and Quoc V Le. A bayesian perspective on generalization and stochastic gradient descent. arXiv preprint arXiv:1710.06451, 2017. [48] Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott E. Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. CoRR, abs/1409.4842, 2014. [49] Mingxing Tan and Quoc V. Le. Efficientnet: Rethinking model scaling for convolutional neural networks. ICML, abs/1905.11946, 2019. [50] 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 30, pages 5998–6008. Curran Associates, Inc., 2017. [51] Yeming Wen, Kevin Luk, Maxime Gazeau, Guodong Zhang, Harris Chan, and Jimmy Ba. An empirical study of stochastic gradient descent with structured covariance noise. In Silvia Chiappa and Roberto Calandra, editors, Proceedings of the Twenty Third International Conference on Artificial Intelligence and Statistics, volume 108 of Proceedings of Machine Learning Research, pages 3621–3631. PMLR, 26–28 Aug 2020. [52] Thomas Wolf. Transfer Learning in Natural Language Processing, 2019. Available at https: //github.com/huggingface/naacl_transfer_learning_tutorial. [53] Saining Xie, Ross B. Girshick, Piotr Dollár, Zhuowen Tu, and Kaiming He. Aggregated residual transformations for deep neural networks. CVPR, abs/1611.05431, 2017. [54] Yang You, Igor Gitman, and Boris Ginsburg. Scaling SGD batch size to 32k for imagenet training. CoRR, abs/1708.03888, 2017. [55] Yang You, Jing Li, Jonathan Hseu, Xiaodan Song, James Demmel, and Cho-Jui Hsieh. Reducing BERT pre-training time from 3 days to 76 minutes. CoRR, abs/1904.00962, 2019. [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. [57] Wei Zhang, Xiaodong Cui, Ulrich Finkler, Brian Kingsbury, George Saon, David Kung, and Michael Picheny. Distributed deep learning strategies for automatic speech recognition. In ICASSP’2019, May 2019. \n[58] Wei Zhang, Xiaodong Cui, Ulrich Finkler, George Saon, Abdullah Kayi, Alper Buyuktosunoglu, Brian Kingsbury, David Kung, and Michael Picheny. A highly efficient distributed deep learning system for automatic speech recognition. In INTERSPEECH’2019, Sept 2019. \n[59] Wei Zhang, Xiaodong Cui, Abdullah Kayi, Mingrui Liu, Ulrich Finkler, Brian Kingsbury, George Saon, Youssef Mroueh, Alper Buyuktosunoglu, Payel Das, David Kung, and Michael Picheny. Improving efficiency in large-scale decentralized distributed training. In ICASSP’2020, May 2020. \n[60] Wei Zhang, Suyog Gupta, Xiangru Lian, and Ji Liu. Staleness-aware async-sgd for distributed deep learning. In Proceedings of the Twenty-Fifth International Joint Conference on Artificial Intelligence, IJCAI 2016, New York, NY, USA, 9-15 July 2016, pages 2350–2356, 2016. \n[61] Wei Zhang, Suyog Gupta, and Fei Wang. Model accuracy and runtime tradeoff in distributed deep learning: A systematic study. In IEEE International Conference on Data Mining, 2016. \n[62] Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, and Jian Sun. Shufflenet: An extremely efficient convolutional neural network for mobile devices. CVPR, abs/1707.01083, 2018. \n[63] Yao Zhang, Andrew M. Saxe, Madhu S. Advani, and Alpha A. Lee. Energy–entropy competition and the effectiveness of stochastic gradient descent in machine learning. Molecular Physics, 116(21-22):3214–3223, Jun 2018. \n[64] Fan Zhou and Guojing Cong. On the convergence properties of a k-step averaging stochastic gradient descent algorithm for nonconvex optimization. In IJCAI-18, pages 3219–3227, 7 2018. ",
966
+ "bbox": [
967
+ 142,
968
+ 89,
969
+ 830,
970
+ 920
971
+ ],
972
+ "page_idx": 9
973
+ },
974
+ {
975
+ "type": "text",
976
+ "text": "",
977
+ "bbox": [
978
+ 147,
979
+ 74,
980
+ 828,
981
+ 916
982
+ ],
983
+ "page_idx": 10
984
+ },
985
+ {
986
+ "type": "text",
987
+ "text": "",
988
+ "bbox": [
989
+ 148,
990
+ 59,
991
+ 828,
992
+ 911
993
+ ],
994
+ "page_idx": 11
995
+ },
996
+ {
997
+ "type": "text",
998
+ "text": "",
999
+ "bbox": [
1000
+ 155,
1001
+ 90,
1002
+ 828,
1003
+ 383
1004
+ ],
1005
+ "page_idx": 12
1006
+ },
1007
+ {
1008
+ "type": "text",
1009
+ "text": "Checklist ",
1010
+ "text_level": 1,
1011
+ "bbox": [
1012
+ 173,
1013
+ 388,
1014
+ 254,
1015
+ 404
1016
+ ],
1017
+ "page_idx": 12
1018
+ },
1019
+ {
1020
+ "type": "text",
1021
+ "text": "1. For all authors... ",
1022
+ "bbox": [
1023
+ 214,
1024
+ 415,
1025
+ 341,
1026
+ 429
1027
+ ],
1028
+ "page_idx": 12
1029
+ },
1030
+ {
1031
+ "type": "text",
1032
+ "text": "(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] \n(b) Did you describe the limitations of your work? [Yes] \n(c) Did you discuss any potential negative societal impacts of your work? [N/A] \n(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] ",
1033
+ "bbox": [
1034
+ 238,
1035
+ 434,
1036
+ 825,
1037
+ 523
1038
+ ],
1039
+ "page_idx": 12
1040
+ },
1041
+ {
1042
+ "type": "text",
1043
+ "text": "2. If you are including theoretical results... ",
1044
+ "bbox": [
1045
+ 214,
1046
+ 529,
1047
+ 493,
1048
+ 542
1049
+ ],
1050
+ "page_idx": 12
1051
+ },
1052
+ {
1053
+ "type": "text",
1054
+ "text": "(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] ",
1055
+ "bbox": [
1056
+ 238,
1057
+ 546,
1058
+ 733,
1059
+ 578
1060
+ ],
1061
+ "page_idx": 12
1062
+ },
1063
+ {
1064
+ "type": "text",
1065
+ "text": "3. If you ran experiments... ",
1066
+ "bbox": [
1067
+ 214,
1068
+ 582,
1069
+ 393,
1070
+ 595
1071
+ ],
1072
+ "page_idx": 12
1073
+ },
1074
+ {
1075
+ "type": "text",
1076
+ "text": "(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] Not code(proprietary), but enough instructions to reproduce the results. \n(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] \n(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] \n(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] ",
1077
+ "bbox": [
1078
+ 238,
1079
+ 599,
1080
+ 825,
1081
+ 732
1082
+ ],
1083
+ "page_idx": 12
1084
+ },
1085
+ {
1086
+ "type": "text",
1087
+ "text": "4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... ",
1088
+ "bbox": [
1089
+ 210,
1090
+ 736,
1091
+ 823,
1092
+ 751
1093
+ ],
1094
+ "page_idx": 12
1095
+ },
1096
+ {
1097
+ "type": "text",
1098
+ "text": "(a) If your work uses existing assets, did you cite the creators? [Yes] \n(b) Did you mention the license of the assets? [N/A] \n(c) Did you include any new assets either in the supplemental material or as a URL? [No] \n(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] \n(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] ",
1099
+ "bbox": [
1100
+ 238,
1101
+ 755,
1102
+ 823,
1103
+ 861
1104
+ ],
1105
+ "page_idx": 12
1106
+ },
1107
+ {
1108
+ "type": "text",
1109
+ "text": "5. If you used crowdsourcing or conducted research with human subjects... ",
1110
+ "bbox": [
1111
+ 215,
1112
+ 864,
1113
+ 707,
1114
+ 880
1115
+ ],
1116
+ "page_idx": 12
1117
+ },
1118
+ {
1119
+ "type": "text",
1120
+ "text": "(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] ",
1121
+ "bbox": [
1122
+ 235,
1123
+ 883,
1124
+ 826,
1125
+ 912
1126
+ ],
1127
+ "page_idx": 12
1128
+ },
1129
+ {
1130
+ "type": "text",
1131
+ "text": "536 (b) Did you describe any potential participant risks, with links to Institutional Review \n537 Board (IRB) approvals, if applicable? [N/A] \n538 (c) Did you include the estimated hourly wage paid to participants and the total amount \n539 spent on participant compensation? [N/A] ",
1132
+ "bbox": [
1133
+ 138,
1134
+ 90,
1135
+ 826,
1136
+ 151
1137
+ ],
1138
+ "page_idx": 13
1139
+ }
1140
+ ]
parse/dev/Bq2-WN5csW/Bq2-WN5csW_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/Bq2-WN5csW/Bq2-WN5csW_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/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
+ ![](images/42991d33a7cd1e917551c18818df7714fc6b1b654734e20efdc8a4c1423aa773.jpg)
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
+ ![](images/d083e797d1f57af1e6cd040c35af7850010a293b270d8860be4ba6ea8f07cb06.jpg)
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
+ ![](images/8c63da7b1a1958a51bc353aa4e6fa0516e113142426187e47d953853e2500eb2.jpg)
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
+ ![](images/31d021b6b6c6c042444935f36bc12c6730460fb7bb0302240b7a8f396fb18c0b.jpg)
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
+ ![](images/ae108baf28e0ba63b589c9a45d070fa81b39be2b9d388cf89f8539c0a81d6f7a.jpg)
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
+ ![](images/5df04c636c274e48d67d7a346bd076972edeaf8671fd5d8c1b05cbe6ff69f314.jpg)
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
+ ![](images/37e352ba9c5afbe5cf4a68cd7422e58acb46a0a73bb59ec6fc8644278bbcef8d.jpg)
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.
parse/dev/CbsJ53LdKc/CbsJ53LdKc_content_list.json ADDED
@@ -0,0 +1,1144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "In-Context Impersonation Reveals Large Language Models’ Strengths and Biases ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 187,
8
+ 122,
9
+ 812,
10
+ 172
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Leonard Salewski1,2 Stephan Alaniz1,2 Isabel Rio-Torto3,4∗ ",
17
+ "bbox": [
18
+ 227,
19
+ 223,
20
+ 769,
21
+ 241
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "Eric Schulz2,5 ",
28
+ "bbox": [
29
+ 316,
30
+ 260,
31
+ 413,
32
+ 276
33
+ ],
34
+ "page_idx": 0
35
+ },
36
+ {
37
+ "type": "text",
38
+ "text": "Zeynep Akata1,2 ",
39
+ "bbox": [
40
+ 565,
41
+ 261,
42
+ 679,
43
+ 276
44
+ ],
45
+ "page_idx": 0
46
+ },
47
+ {
48
+ "type": "text",
49
+ "text": "1 University of Tübingen 2 Tübingen AI Center 3 University of Porto 4 INESC TEC 5 Max Planck Institute for Biological Cybernetics ",
50
+ "bbox": [
51
+ 254,
52
+ 292,
53
+ 746,
54
+ 323
55
+ ],
56
+ "page_idx": 0
57
+ },
58
+ {
59
+ "type": "text",
60
+ "text": "Abstract ",
61
+ "text_level": 1,
62
+ "bbox": [
63
+ 462,
64
+ 358,
65
+ 535,
66
+ 375
67
+ ],
68
+ "page_idx": 0
69
+ },
70
+ {
71
+ "type": "text",
72
+ "text": "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. ",
73
+ "bbox": [
74
+ 232,
75
+ 388,
76
+ 766,
77
+ 638
78
+ ],
79
+ "page_idx": 0
80
+ },
81
+ {
82
+ "type": "text",
83
+ "text": "1 Introduction ",
84
+ "text_level": 1,
85
+ "bbox": [
86
+ 174,
87
+ 665,
88
+ 310,
89
+ 683
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "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? ",
96
+ "bbox": [
97
+ 174,
98
+ 696,
99
+ 825,
100
+ 877
101
+ ],
102
+ "page_idx": 0
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "",
107
+ "bbox": [
108
+ 174,
109
+ 92,
110
+ 825,
111
+ 146
112
+ ],
113
+ "page_idx": 1
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "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. ",
118
+ "bbox": [
119
+ 174,
120
+ 154,
121
+ 825,
122
+ 347
123
+ ],
124
+ "page_idx": 1
125
+ },
126
+ {
127
+ "type": "text",
128
+ "text": "2 Related Work ",
129
+ "text_level": 1,
130
+ "bbox": [
131
+ 174,
132
+ 376,
133
+ 321,
134
+ 393
135
+ ],
136
+ "page_idx": 1
137
+ },
138
+ {
139
+ "type": "text",
140
+ "text": "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]. ",
141
+ "bbox": [
142
+ 174,
143
+ 414,
144
+ 823,
145
+ 469
146
+ ],
147
+ "page_idx": 1
148
+ },
149
+ {
150
+ "type": "text",
151
+ "text": "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]. ",
152
+ "bbox": [
153
+ 174,
154
+ 477,
155
+ 825,
156
+ 628
157
+ ],
158
+ "page_idx": 1
159
+ },
160
+ {
161
+ "type": "text",
162
+ "text": "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]. ",
163
+ "bbox": [
164
+ 174,
165
+ 635,
166
+ 825,
167
+ 773
168
+ ],
169
+ "page_idx": 1
170
+ },
171
+ {
172
+ "type": "text",
173
+ "text": "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]. ",
174
+ "bbox": [
175
+ 174,
176
+ 780,
177
+ 825,
178
+ 877
179
+ ],
180
+ "page_idx": 1
181
+ },
182
+ {
183
+ "type": "text",
184
+ "text": "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]. ",
185
+ "bbox": [
186
+ 174,
187
+ 883,
188
+ 821,
189
+ 911
190
+ ],
191
+ "page_idx": 1
192
+ },
193
+ {
194
+ "type": "text",
195
+ "text": "",
196
+ "bbox": [
197
+ 173,
198
+ 90,
199
+ 823,
200
+ 119
201
+ ],
202
+ "page_idx": 2
203
+ },
204
+ {
205
+ "type": "text",
206
+ "text": "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]. ",
207
+ "bbox": [
208
+ 173,
209
+ 126,
210
+ 825,
211
+ 210
212
+ ],
213
+ "page_idx": 2
214
+ },
215
+ {
216
+ "type": "text",
217
+ "text": "3 In-context Impersonation Methodology ",
218
+ "text_level": 1,
219
+ "bbox": [
220
+ 174,
221
+ 227,
222
+ 532,
223
+ 244
224
+ ],
225
+ "page_idx": 2
226
+ },
227
+ {
228
+ "type": "text",
229
+ "text": "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. ",
230
+ "bbox": [
231
+ 174,
232
+ 257,
233
+ 826,
234
+ 287
235
+ ],
236
+ "page_idx": 2
237
+ },
238
+ {
239
+ "type": "text",
240
+ "text": "3.1 Prompting and Querying the Large Language Model with Personas ",
241
+ "text_level": 1,
242
+ "bbox": [
243
+ 174,
244
+ 301,
245
+ 683,
246
+ 318
247
+ ],
248
+ "page_idx": 2
249
+ },
250
+ {
251
+ "type": "text",
252
+ "text": "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 ",
253
+ "bbox": [
254
+ 174,
255
+ 327,
256
+ 825,
257
+ 411
258
+ ],
259
+ "page_idx": 2
260
+ },
261
+ {
262
+ "type": "equation",
263
+ "img_path": "images/255d2b5d94e056ac8b9b21eb7ebc76b7409b0efa8471053e557c8c3e89c076fa.jpg",
264
+ "text": "$$\np _ { \\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 } )\n$$",
265
+ "text_format": "latex",
266
+ "bbox": [
267
+ 312,
268
+ 414,
269
+ 684,
270
+ 458
271
+ ],
272
+ "page_idx": 2
273
+ },
274
+ {
275
+ "type": "text",
276
+ "text": "We refer to this type of contextualization as in-context impersonation. ",
277
+ "bbox": [
278
+ 176,
279
+ 460,
280
+ 629,
281
+ 474
282
+ ],
283
+ "page_idx": 2
284
+ },
285
+ {
286
+ "type": "text",
287
+ "text": "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. ",
288
+ "bbox": [
289
+ 173,
290
+ 479,
291
+ 825,
292
+ 564
293
+ ],
294
+ "page_idx": 2
295
+ },
296
+ {
297
+ "type": "text",
298
+ "text": "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. ",
299
+ "bbox": [
300
+ 173,
301
+ 570,
302
+ 825,
303
+ 694
304
+ ],
305
+ "page_idx": 2
306
+ },
307
+ {
308
+ "type": "text",
309
+ "text": "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. ",
310
+ "bbox": [
311
+ 173,
312
+ 700,
313
+ 825,
314
+ 785
315
+ ],
316
+ "page_idx": 2
317
+ },
318
+ {
319
+ "type": "text",
320
+ "text": "3.2 Bandit Task Design ",
321
+ "text_level": 1,
322
+ "bbox": [
323
+ 174,
324
+ 800,
325
+ 348,
326
+ 815
327
+ ],
328
+ "page_idx": 2
329
+ },
330
+ {
331
+ "type": "text",
332
+ "text": "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]. ",
333
+ "bbox": [
334
+ 174,
335
+ 825,
336
+ 823,
337
+ 854
338
+ ],
339
+ "page_idx": 2
340
+ },
341
+ {
342
+ "type": "text",
343
+ "text": "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: ",
344
+ "bbox": [
345
+ 176,
346
+ 859,
347
+ 823,
348
+ 888
349
+ ],
350
+ "page_idx": 2
351
+ },
352
+ {
353
+ "type": "image",
354
+ "img_path": "images/42991d33a7cd1e917551c18818df7714fc6b1b654734e20efdc8a4c1423aa773.jpg",
355
+ "image_caption": [
356
+ "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). "
357
+ ],
358
+ "image_footnote": [],
359
+ "bbox": [
360
+ 174,
361
+ 88,
362
+ 820,
363
+ 296
364
+ ],
365
+ "page_idx": 3
366
+ },
367
+ {
368
+ "type": "text",
369
+ "text": "",
370
+ "bbox": [
371
+ 173,
372
+ 404,
373
+ 825,
374
+ 502
375
+ ],
376
+ "page_idx": 3
377
+ },
378
+ {
379
+ "type": "equation",
380
+ "img_path": "images/b9b9dec6e7ba53d65db4583b97f554fc8cf260ccfe4b9adb5aa3652ea859edd8.jpg",
381
+ "text": "$$\np ( A _ { t } = 1 | \\mathbf { w } ) = \\Phi \\left( \\beta _ { 1 } \\mathbf { V } _ { t } + \\beta _ { 2 } \\mathbf { R } \\mathbf { U } _ { t } \\right)\n$$",
382
+ "text_format": "latex",
383
+ "bbox": [
384
+ 379,
385
+ 508,
386
+ 619,
387
+ 526
388
+ ],
389
+ "page_idx": 3
390
+ },
391
+ {
392
+ "type": "text",
393
+ "text": "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]. ",
394
+ "bbox": [
395
+ 173,
396
+ 534,
397
+ 825,
398
+ 589
399
+ ],
400
+ "page_idx": 3
401
+ },
402
+ {
403
+ "type": "text",
404
+ "text": "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. ",
405
+ "bbox": [
406
+ 173,
407
+ 595,
408
+ 826,
409
+ 679
410
+ ],
411
+ "page_idx": 3
412
+ },
413
+ {
414
+ "type": "text",
415
+ "text": "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. ",
416
+ "bbox": [
417
+ 174,
418
+ 684,
419
+ 825,
420
+ 744
421
+ ],
422
+ "page_idx": 3
423
+ },
424
+ {
425
+ "type": "text",
426
+ "text": "3.3 Reasoning Task Design ",
427
+ "text_level": 1,
428
+ "bbox": [
429
+ 174,
430
+ 761,
431
+ 374,
432
+ 776
433
+ ],
434
+ "page_idx": 3
435
+ },
436
+ {
437
+ "type": "text",
438
+ "text": "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: ",
439
+ "bbox": [
440
+ 174,
441
+ 786,
442
+ 825,
443
+ 857
444
+ ],
445
+ "page_idx": 3
446
+ },
447
+ {
448
+ "type": "text",
449
+ "text": "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? ",
450
+ "bbox": [
451
+ 184,
452
+ 869,
453
+ 820,
454
+ 912
455
+ ],
456
+ "page_idx": 3
457
+ },
458
+ {
459
+ "type": "text",
460
+ "text": "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. ",
461
+ "bbox": [
462
+ 173,
463
+ 90,
464
+ 825,
465
+ 189
466
+ ],
467
+ "page_idx": 4
468
+ },
469
+ {
470
+ "type": "text",
471
+ "text": "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 ",
472
+ "bbox": [
473
+ 173,
474
+ 194,
475
+ 825,
476
+ 241
477
+ ],
478
+ "page_idx": 4
479
+ },
480
+ {
481
+ "type": "equation",
482
+ "img_path": "images/e6386dd934d9356dd093aab595bc5150de20f40a826785cdcbe5aeff7b9329d3.jpg",
483
+ "text": "$$\n\\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\n$$",
484
+ "text_format": "latex",
485
+ "bbox": [
486
+ 346,
487
+ 247,
488
+ 651,
489
+ 265
490
+ ],
491
+ "page_idx": 4
492
+ },
493
+ {
494
+ "type": "text",
495
+ "text": "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. ",
496
+ "bbox": [
497
+ 174,
498
+ 270,
499
+ 825,
500
+ 313
501
+ ],
502
+ "page_idx": 4
503
+ },
504
+ {
505
+ "type": "text",
506
+ "text": "3.4 Vision and Language Task Design ",
507
+ "text_level": 1,
508
+ "bbox": [
509
+ 176,
510
+ 329,
511
+ 447,
512
+ 344
513
+ ],
514
+ "page_idx": 4
515
+ },
516
+ {
517
+ "type": "text",
518
+ "text": "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: ",
519
+ "bbox": [
520
+ 174,
521
+ 353,
522
+ 825,
523
+ 410
524
+ ],
525
+ "page_idx": 4
526
+ },
527
+ {
528
+ "type": "text",
529
+ "text": "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 ",
530
+ "bbox": [
531
+ 209,
532
+ 421,
533
+ 797,
534
+ 449
535
+ ],
536
+ "page_idx": 4
537
+ },
538
+ {
539
+ "type": "text",
540
+ "text": "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. ",
541
+ "bbox": [
542
+ 174,
543
+ 460,
544
+ 826,
545
+ 544
546
+ ],
547
+ "page_idx": 4
548
+ },
549
+ {
550
+ "type": "text",
551
+ "text": "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. ",
552
+ "bbox": [
553
+ 173,
554
+ 549,
555
+ 826,
556
+ 619
557
+ ],
558
+ "page_idx": 4
559
+ },
560
+ {
561
+ "type": "text",
562
+ "text": "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 ^ { * }$ . ",
563
+ "bbox": [
564
+ 173,
565
+ 626,
566
+ 825,
567
+ 695
568
+ ],
569
+ "page_idx": 4
570
+ },
571
+ {
572
+ "type": "text",
573
+ "text": "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. ",
574
+ "bbox": [
575
+ 173,
576
+ 699,
577
+ 825,
578
+ 785
579
+ ],
580
+ "page_idx": 4
581
+ },
582
+ {
583
+ "type": "text",
584
+ "text": "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: ",
585
+ "bbox": [
586
+ 174,
587
+ 791,
588
+ 825,
589
+ 837
590
+ ],
591
+ "page_idx": 4
592
+ },
593
+ {
594
+ "type": "equation",
595
+ "img_path": "images/e6b6b31d549a548af579d3b563d3afb2ff6eac8ef0b0cf1ceaa5f240ee02a09c.jpg",
596
+ "text": "$$\nn ^ { ( p ) ^ { * } } = \\arg \\operatorname* { m a x } ( I \\cdot D _ { n } ^ { ( p ) } )\n$$",
597
+ "text_format": "latex",
598
+ "bbox": [
599
+ 408,
600
+ 843,
601
+ 589,
602
+ 863
603
+ ],
604
+ "page_idx": 4
605
+ },
606
+ {
607
+ "type": "text",
608
+ "text": "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. ",
609
+ "bbox": [
610
+ 174,
611
+ 869,
612
+ 826,
613
+ 911
614
+ ],
615
+ "page_idx": 4
616
+ },
617
+ {
618
+ "type": "text",
619
+ "text": "4 Experiments ",
620
+ "text_level": 1,
621
+ "bbox": [
622
+ 174,
623
+ 89,
624
+ 312,
625
+ 107
626
+ ],
627
+ "page_idx": 5
628
+ },
629
+ {
630
+ "type": "text",
631
+ "text": "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. ",
632
+ "bbox": [
633
+ 174,
634
+ 122,
635
+ 825,
636
+ 219
637
+ ],
638
+ "page_idx": 5
639
+ },
640
+ {
641
+ "type": "text",
642
+ "text": "4.1 Age-based impersonation changes exploration strategies ",
643
+ "text_level": 1,
644
+ "bbox": [
645
+ 173,
646
+ 238,
647
+ 602,
648
+ 253
649
+ ],
650
+ "page_idx": 5
651
+ },
652
+ {
653
+ "type": "text",
654
+ "text": "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. ",
655
+ "bbox": [
656
+ 174,
657
+ 265,
658
+ 823,
659
+ 292
660
+ ],
661
+ "page_idx": 5
662
+ },
663
+ {
664
+ "type": "text",
665
+ "text": "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. ",
666
+ "bbox": [
667
+ 174,
668
+ 299,
669
+ 550,
670
+ 438
671
+ ],
672
+ "page_idx": 5
673
+ },
674
+ {
675
+ "type": "text",
676
+ "text": "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. ",
677
+ "bbox": [
678
+ 174,
679
+ 444,
680
+ 550,
681
+ 609
682
+ ],
683
+ "page_idx": 5
684
+ },
685
+ {
686
+ "type": "image",
687
+ "img_path": "images/d083e797d1f57af1e6cd040c35af7850010a293b270d8860be4ba6ea8f07cb06.jpg",
688
+ "image_caption": [
689
+ "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. "
690
+ ],
691
+ "image_footnote": [],
692
+ "bbox": [
693
+ 568,
694
+ 303,
695
+ 823,
696
+ 508
697
+ ],
698
+ "page_idx": 5
699
+ },
700
+ {
701
+ "type": "text",
702
+ "text": "",
703
+ "bbox": [
704
+ 174,
705
+ 611,
706
+ 825,
707
+ 651
708
+ ],
709
+ "page_idx": 5
710
+ },
711
+ {
712
+ "type": "text",
713
+ "text": "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. ",
714
+ "bbox": [
715
+ 173,
716
+ 657,
717
+ 825,
718
+ 796
719
+ ],
720
+ "page_idx": 5
721
+ },
722
+ {
723
+ "type": "text",
724
+ "text": "4.2 Expertise-based impersonation changes reasoning abilities ",
725
+ "text_level": 1,
726
+ "bbox": [
727
+ 173,
728
+ 815,
729
+ 617,
730
+ 830
731
+ ],
732
+ "page_idx": 5
733
+ },
734
+ {
735
+ "type": "text",
736
+ "text": "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. ",
737
+ "bbox": [
738
+ 174,
739
+ 842,
740
+ 823,
741
+ 911
742
+ ],
743
+ "page_idx": 5
744
+ },
745
+ {
746
+ "type": "image",
747
+ "img_path": "images/8c63da7b1a1958a51bc353aa4e6fa0516e113142426187e47d953853e2500eb2.jpg",
748
+ "image_caption": [
749
+ "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. "
750
+ ],
751
+ "image_footnote": [],
752
+ "bbox": [
753
+ 174,
754
+ 75,
755
+ 825,
756
+ 244
757
+ ],
758
+ "page_idx": 6
759
+ },
760
+ {
761
+ "type": "text",
762
+ "text": "",
763
+ "bbox": [
764
+ 176,
765
+ 330,
766
+ 821,
767
+ 372
768
+ ],
769
+ "page_idx": 6
770
+ },
771
+ {
772
+ "type": "text",
773
+ "text": "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. ",
774
+ "bbox": [
775
+ 174,
776
+ 377,
777
+ 825,
778
+ 489
779
+ ],
780
+ "page_idx": 6
781
+ },
782
+ {
783
+ "type": "text",
784
+ "text": "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. ",
785
+ "bbox": [
786
+ 173,
787
+ 496,
788
+ 826,
789
+ 689
790
+ ],
791
+ "page_idx": 6
792
+ },
793
+ {
794
+ "type": "text",
795
+ "text": "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. ",
796
+ "bbox": [
797
+ 174,
798
+ 695,
799
+ 825,
800
+ 751
801
+ ],
802
+ "page_idx": 6
803
+ },
804
+ {
805
+ "type": "text",
806
+ "text": "4.3 Impersonation as categorical descriptions is complementary for visual categorization ",
807
+ "text_level": 1,
808
+ "bbox": [
809
+ 173,
810
+ 768,
811
+ 802,
812
+ 782
813
+ ],
814
+ "page_idx": 6
815
+ },
816
+ {
817
+ "type": "text",
818
+ "text": "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. ",
819
+ "bbox": [
820
+ 174,
821
+ 794,
822
+ 825,
823
+ 876
824
+ ],
825
+ "page_idx": 6
826
+ },
827
+ {
828
+ "type": "text",
829
+ "text": "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. ",
830
+ "bbox": [
831
+ 173,
832
+ 883,
833
+ 821,
834
+ 911
835
+ ],
836
+ "page_idx": 6
837
+ },
838
+ {
839
+ "type": "image",
840
+ "img_path": "images/31d021b6b6c6c042444935f36bc12c6730460fb7bb0302240b7a8f396fb18c0b.jpg",
841
+ "image_caption": [
842
+ "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. "
843
+ ],
844
+ "image_footnote": [],
845
+ "bbox": [
846
+ 174,
847
+ 102,
848
+ 825,
849
+ 287
850
+ ],
851
+ "page_idx": 7
852
+ },
853
+ {
854
+ "type": "text",
855
+ "text": "",
856
+ "bbox": [
857
+ 174,
858
+ 392,
859
+ 825,
860
+ 462
861
+ ],
862
+ "page_idx": 7
863
+ },
864
+ {
865
+ "type": "text",
866
+ "text": "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. ",
867
+ "bbox": [
868
+ 174,
869
+ 468,
870
+ 825,
871
+ 676
872
+ ],
873
+ "page_idx": 7
874
+ },
875
+ {
876
+ "type": "text",
877
+ "text": "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. ",
878
+ "bbox": [
879
+ 174,
880
+ 683,
881
+ 629,
882
+ 835
883
+ ],
884
+ "page_idx": 7
885
+ },
886
+ {
887
+ "type": "image",
888
+ "img_path": "images/ae108baf28e0ba63b589c9a45d070fa81b39be2b9d388cf89f8539c0a81d6f7a.jpg",
889
+ "image_caption": [
890
+ "Figure 6: Composition of personas on CUB for Vicuna-13B. "
891
+ ],
892
+ "image_footnote": [],
893
+ "bbox": [
894
+ 643,
895
+ 689,
896
+ 821,
897
+ 776
898
+ ],
899
+ "page_idx": 7
900
+ },
901
+ {
902
+ "type": "text",
903
+ "text": "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. ",
904
+ "bbox": [
905
+ 174,
906
+ 842,
907
+ 825,
908
+ 911
909
+ ],
910
+ "page_idx": 7
911
+ },
912
+ {
913
+ "type": "image",
914
+ "img_path": "images/5df04c636c274e48d67d7a346bd076972edeaf8671fd5d8c1b05cbe6ff69f314.jpg",
915
+ "image_caption": [
916
+ "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. "
917
+ ],
918
+ "image_footnote": [],
919
+ "bbox": [
920
+ 173,
921
+ 98,
922
+ 826,
923
+ 286
924
+ ],
925
+ "page_idx": 8
926
+ },
927
+ {
928
+ "type": "text",
929
+ "text": "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. ",
930
+ "bbox": [
931
+ 174,
932
+ 359,
933
+ 825,
934
+ 511
935
+ ],
936
+ "page_idx": 8
937
+ },
938
+ {
939
+ "type": "text",
940
+ "text": "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. ",
941
+ "bbox": [
942
+ 174,
943
+ 517,
944
+ 825,
945
+ 614
946
+ ],
947
+ "page_idx": 8
948
+ },
949
+ {
950
+ "type": "text",
951
+ "text": "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. ",
952
+ "bbox": [
953
+ 174,
954
+ 621,
955
+ 825,
956
+ 676
957
+ ],
958
+ "page_idx": 8
959
+ },
960
+ {
961
+ "type": "text",
962
+ "text": "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. ",
963
+ "bbox": [
964
+ 174,
965
+ 683,
966
+ 825,
967
+ 739
968
+ ],
969
+ "page_idx": 8
970
+ },
971
+ {
972
+ "type": "text",
973
+ "text": "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. ",
974
+ "bbox": [
975
+ 174,
976
+ 746,
977
+ 825,
978
+ 911
979
+ ],
980
+ "page_idx": 8
981
+ },
982
+ {
983
+ "type": "image",
984
+ "img_path": "images/37e352ba9c5afbe5cf4a68cd7422e58acb46a0a73bb59ec6fc8644278bbcef8d.jpg",
985
+ "image_caption": [
986
+ "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. "
987
+ ],
988
+ "image_footnote": [],
989
+ "bbox": [
990
+ 173,
991
+ 92,
992
+ 823,
993
+ 291
994
+ ],
995
+ "page_idx": 9
996
+ },
997
+ {
998
+ "type": "text",
999
+ "text": "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. ",
1000
+ "bbox": [
1001
+ 174,
1002
+ 369,
1003
+ 825,
1004
+ 452
1005
+ ],
1006
+ "page_idx": 9
1007
+ },
1008
+ {
1009
+ "type": "text",
1010
+ "text": "distinctive \"coo-coo-coo\" call a bird species found in North Aold 20 5 Broader Impact ",
1011
+ "text_level": 1,
1012
+ "bbox": [
1013
+ 174,
1014
+ 473,
1015
+ 338,
1016
+ 491
1017
+ ],
1018
+ "page_idx": 9
1019
+ },
1020
+ {
1021
+ "type": "text",
1022
+ "text": "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. ",
1023
+ "bbox": [
1024
+ 174,
1025
+ 506,
1026
+ 826,
1027
+ 685
1028
+ ],
1029
+ "page_idx": 9
1030
+ },
1031
+ {
1032
+ "type": "text",
1033
+ "text": "6 Conclusion ",
1034
+ "text_level": 1,
1035
+ "bbox": [
1036
+ 174,
1037
+ 705,
1038
+ 299,
1039
+ 723
1040
+ ],
1041
+ "page_idx": 9
1042
+ },
1043
+ {
1044
+ "type": "text",
1045
+ "text": "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. ",
1046
+ "bbox": [
1047
+ 174,
1048
+ 738,
1049
+ 825,
1050
+ 835
1051
+ ],
1052
+ "page_idx": 9
1053
+ },
1054
+ {
1055
+ "type": "text",
1056
+ "text": "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]. ",
1057
+ "bbox": [
1058
+ 174,
1059
+ 842,
1060
+ 825,
1061
+ 911
1062
+ ],
1063
+ "page_idx": 9
1064
+ },
1065
+ {
1066
+ "type": "text",
1067
+ "text": "7 Acknowledgements ",
1068
+ "text_level": 1,
1069
+ "bbox": [
1070
+ 176,
1071
+ 89,
1072
+ 367,
1073
+ 106
1074
+ ],
1075
+ "page_idx": 10
1076
+ },
1077
+ {
1078
+ "type": "text",
1079
+ "text": "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). ",
1080
+ "bbox": [
1081
+ 174,
1082
+ 121,
1083
+ 826,
1084
+ 176
1085
+ ],
1086
+ "page_idx": 10
1087
+ },
1088
+ {
1089
+ "type": "text",
1090
+ "text": "References ",
1091
+ "text_level": 1,
1092
+ "bbox": [
1093
+ 174,
1094
+ 195,
1095
+ 266,
1096
+ 212
1097
+ ],
1098
+ "page_idx": 10
1099
+ },
1100
+ {
1101
+ "type": "text",
1102
+ "text": "[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. \n[2] Taylor Webb, Keith J Holyoak, and Hongjing Lu. Emergent analogical reasoning in large language models. arXiv:2212.09196, 2022. \n[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. \n[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. \n[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. \n[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. \n[8] Marcel Binz and Eric Schulz. Using cognitive psychology to understand gpt-3. PNAS, 120(6), 2023. \n[9] Jonathan Pilault, Raymond Li, Sandeep Subramanian, and Christopher Pal. On extractive and abstractive neural document summarization with transformer language models. In EMNLP, 2020. \n[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. \n[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. \n[12] Sang Michael Xie, Aditi Raghunathan, Percy Liang, and Tengyu Ma. An explanation of in-context learning as implicit bayesian inference. In ICLR, 2022. \n[13] Ameet Deshpande, Vishvak Murahari, Tanmay Rajpurohit, Ashwin Kalyan, and Karthik Narasimhan. Toxicity in chatgpt: Analyzing persona-assigned language models. arXiv:2304.05335, 2023. \n[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. \n[15] Katherine Elkins and Jon Chun. Can gpt-3 pass a writer’s turing test? Journal of Cultural Analytics, 5(2), 2020. \n[16] Marcel Binz and Eric Schulz. Modeling human exploration through resource-rational reinforcement learning. In NeurIPS, 2022. \n[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. \n[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. \n[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. \n[20] Timo Schick and Hinrich Schütze. Exploiting cloze-questions for few-shot text classification and natural language inference. In EACL, 2021. \n[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. \n[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. \n[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. \n[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. \n[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. \n[26] Laria Reynolds and Kyle McDonell. Prompt programming for large language models: Beyond the few-shot paradigm. In CHI, 2021. \n[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. \n[28] Nathan Hunter. The art of prompt engineering with chatGPT. eBook, 2023. \n[29] Jonas Oppenlaender, Rhema Linder, and Johanna Silvennoinen. Prompting ai art: An investigation into the creative skill of prompt engineering. arXiv:2303.13534, 2023. \n[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. \n[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. \n[32] Murray Shanahan, Kyle McDonell, and Laria Reynolds. Role-play with large language models. ArXiv:2305.16367, 2023. \n[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. \n[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. \n[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. \n[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. \n[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. \n[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. \n[39] Sam Witteveen and Martin Andrews. Investigating prompt engineering in diffusion models. arXiv:2211.15462, 2022. \n[40] Stephanie Lin, Jacob Hilton, and Owain Evans. TruthfulQA: Measuring how models mimic human falsehoods. In ACL, 2022. \n[41] Yotam Wolf, Noam Wies, Yoav Levine, and Amnon Shashua. Fundamental limitations of alignment in large language models. arXiv:2304.11082, 2023. \n[42] Gati Aher, Rosa I Arriaga, and Adam Tauman Kalai. Using large language models to simulate multiple humans. arXiv:2208.10264, 2022. \n[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. \n[44] Peter S. Park, Philipp Schoenegger, and Chongyang Zhu. \"correct answers\" from the psychology of artificial intelligence. arXiv:2302.07267, 2023. \n[45] Saketh Reddy Karra, Son Nguyen, and Theja Tulabandhula. Ai personification: Estimating the personality of language models. arXiv:2204.12000, 2022. \n[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. \n[47] Ricardo Dominguez-Olmedo, Moritz Hardt, and Celestine Mendler-Dunner. Questioning the survey responses of large language models. arXiv:2306.07951, 2023. \n[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. \n[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. \n[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. \n[52] Abubakar Abid, Maheen Farooqi, and James Zou. Persistent anti-muslim bias in large language models. In AAAI/ACM AEIS, 2021. \n[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. \n[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. \n[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. \n[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. \n[57] Sachit Menon and Carl Vondrick. Visual classification via description from large language models. In ICLR, 2023. \n[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. \n[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. \n[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. \n[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. \n[62] Dom Eccleston. ShareGPT: Share your wildest conversations with one click. https://sharegpt.com/, 2023. [Online; accessed 15-May-2023]. \n[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. \n[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. \n[65] Samuel J Gershman. Deconstructing the human algorithms for exploration. Cognition, 173, 2018. \n[66] Eric Schulz and Samuel J Gershman. The algorithmic architecture of exploration in the human brain. Current opinion in neurobiology, 55, 2019. \n[67] Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. In ICLR, 2021. \n[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. \n[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. \n[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. \n[71] Emily G. Liquin and Alison Gopnik. Children are more exploratory and learn more than adults in an approach-avoid task. Cognition, 218, 2020. \n[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. \n[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. \n[74] Nathaniel J. Blanco and Vladimir M. Sloutsky. Systematic exploration and uncertainty dominate young children’s choices. Developmental science, 2019. \n[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. \n[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. \n[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. \n[78] Catherine Wah, Steve Branson, Peter Welinder, Pietro Perona, and Serge J. Belongie. The caltech-ucsd birds-200-2011 dataset. 2011. \n[79] Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3d object representations for fine-grained categorization. ICCV Workshops, 2013. \n[80] S. Maji, J. Kannala, E. Rahtu, M. Blaschko, and A. Vedaldi. Fine-grained visual classification of aircraft. Technical report, 2013. \n[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. \n[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. \n[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. \n[84] John Ed Oates and Andrew Ed Grayson. Cognitive and language development in children. Open University Press, 2004. \n[85] Philip Durrant and Mark Brenchley. Development of vocabulary sophistication across genres in english children’s writing. Springer Reading Writing, 32, 2019. \n[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. \n[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. \n[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. \n[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. \n[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. ",
1103
+ "bbox": [
1104
+ 173,
1105
+ 220,
1106
+ 826,
1107
+ 912
1108
+ ],
1109
+ "page_idx": 10
1110
+ },
1111
+ {
1112
+ "type": "text",
1113
+ "text": "",
1114
+ "bbox": [
1115
+ 171,
1116
+ 103,
1117
+ 828,
1118
+ 911
1119
+ ],
1120
+ "page_idx": 11
1121
+ },
1122
+ {
1123
+ "type": "text",
1124
+ "text": "",
1125
+ "bbox": [
1126
+ 171,
1127
+ 111,
1128
+ 828,
1129
+ 909
1130
+ ],
1131
+ "page_idx": 12
1132
+ },
1133
+ {
1134
+ "type": "text",
1135
+ "text": "",
1136
+ "bbox": [
1137
+ 171,
1138
+ 88,
1139
+ 826,
1140
+ 637
1141
+ ],
1142
+ "page_idx": 13
1143
+ }
1144
+ ]
parse/dev/CbsJ53LdKc/CbsJ53LdKc_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/CbsJ53LdKc/CbsJ53LdKc_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/CuV_qYkmKb3/CuV_qYkmKb3.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/CuV_qYkmKb3/CuV_qYkmKb3_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/CuV_qYkmKb3/CuV_qYkmKb3_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/CuV_qYkmKb3/CuV_qYkmKb3_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/CzceR82CYc/CzceR82CYc_content_list.json ADDED
The diff for this file is too large to render. See raw diff