ZHANGYUXUAN-zR commited on
Commit
1530eca
·
verified ·
1 Parent(s): ec8eb39

Add files using upload-large-folder tool

Browse files
parse/dev/67o9UQgTD0/67o9UQgTD0.md ADDED
@@ -0,0 +1,474 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Counterfactual Memorization in Neural Language Models
2
+
3
+ Chiyuan Zhang Google Research chiyuan@google.com
4
+
5
+ Daphne Ippolito Carnegie Mellon University daphnei@cmu.edu
6
+
7
+ Katherine Lee Google DeepMind katherinelee@google.com
8
+
9
+ Matthew Jagielski Google DeepMind jagielski@google.com
10
+
11
+ Florian Tramèr ETH Zürich florian.tramer@inf.ethz.ch
12
+
13
+ Nicholas Carlini Google DeepMind ncarlini@google.com
14
+
15
+ # Abstract
16
+
17
+ Modern neural language models that are widely used in various NLP tasks risk memorizing sensitive information from their training data. Understanding this memorization is important in real world applications and also from a learningtheoretical perspective. An open question in previous studies of language model memorization is how to filter out “common” memorization. In fact, most memorization criteria strongly correlate with the number of occurrences in the training set, capturing memorized familiar phrases, public knowledge, templated texts, or other repeated data. We formulate a notion of counterfactual memorization which characterizes how a model’s predictions change if a particular document is omitted during training. We identify and study counterfactually-memorized training examples in standard text datasets. We estimate the influence of each memorized training example on the validation set and on generated texts, showing how this can provide direct evidence of the source of memorization at test time.
18
+
19
+ # 1 Introduction
20
+
21
+ Modern neural language models (LMs) have achieved impressive results in generating high quality text [e.g. Brown et al., 2020, Zhang et al., 2022, Chowdhery et al., 2022, OpenAI, 2023] and have led to breakthroughs in many downstream natural language processing tasks [Devlin et al., 2019, Raffel et al., 2020b, Bommasani et al., 2021]. The paradigm of taking a single large-scale pre-trained model and fine-tuning it for many tasks motivates the study of these models’ ability to generalize by avoiding memorizing their training data. Moreover, memorization of sensitive user information or copyrighted materials in the training data [Carlini et al., 2020, Vyas et al., 2023, Lee et al., 2023] leads to practical concerns in real world applications.
22
+
23
+ Previous work on memorization in neural language models demonstrated the ability to extract memorized training data, including sensitive data such as phone numbers and usernames [Carlini et al., 2020, Ziegler, 2021, Carlini et al., 2019, Henderson et al., 2017, Thakkar et al., 2020, Thomas et al., 2020]. One issue with these extraction attacks is that they primarily identify “common” and frequently occurring strings in the training set. For example, as shown in the analysis of Lee et al. [2021], near-duplicate training examples, which are very common in standard text corpora, account for a large majority of the memorized content. To filter out such commonly occurring strings from all memorized texts, previous work applied various heuristic rules to distinguish frequently-occurring sequences from memorization of isolated pieces of information.
24
+
25
+ In this paper, we propose a principled causal perspective to disentangle memorization of common vs rare data, by directly tying a model’s predictions to the presence or absence of individual training examples. We define counterfactual memorization as a measure of the change in a model’s prediction when a particular example is excluded from the training set. Counterfactual memorization accounts for the commonality of an example as removing one instance of a text that is common across multiple documents will have a minor effect on the model’s prediction on that text. The mathematical formulation of counterfactual memorization extends a prior definition of label memorization in classification models [Feldman, 2020] to the context of neural language modeling.
26
+
27
+ Formally, a training document $x$ is considerded counterfactually memorized, when the language model predicts $x$ accurately if and only $i f$ the model was trained on $x$ . This allows us to construct a procedure to quantitatively measure the memorization of isolated pieces of text, whose sole presence in the training dataset have a large effect on the model’s predictions.
28
+
29
+ Following Feldman and Zhang [2020], we further extend this definition to counterfactual influence, which measures the influence of a memorized training text sample on another text example. Counterfactual influence allows us to trace the source of information for a model’s predictions, by locating the training example(s) which significantly contributed to it. With these tools, we study memorization across several standard text datasets. Our main contributions are as follows:
30
+
31
+ 1. We define counterfactual memorization in neural LMs which gives us a principled perspective to distinguish memorization of “rare” and “common” information in neural LMs (Section 3). 2. We estimate counterfactual memorization on several standard text datasets, and confirm that rare memorized examples exist in all of them. We study common patterns across memorized text and the memorization profiles of individual internet domains. (Section 4). 3. We identify an inverse correlation between number of duplicates and counterfactual memorization as compared with previous definitions of memorization (Section 5). 4. We extend the definition of counterfactual memorization to counterfactual influence, and study the impact of memorized examples on the test-time prediction of the validation set examples and generated examples (Section 6).
32
+
33
+ # 2 Related Work
34
+
35
+ Previous work analyzed the memorization of large language models on sensitive information (e.g. phone numbers) in the training data [Carlini et al., 2020, Ziegler, 2021] or synthetically injected “canaries” [Carlini et al., 2019, Henderson et al., 2017, Thakkar et al., 2020, Thomas et al., 2020]. However, not all the memorized texts are equally interesting — as confirmed in a later study [Lee et al., 2021], near-duplicated training examples are very common in standard text corpus, and those commonly occurring phrases contribute significantly to memorized texts. In order to distinguish “common” memorization of common phrases or public knowledge from “rare” memorization of private, rare information, various heuristics were adopted in previous investigations. Our paper proposed a principled perspective towards this problem. Our intuition comes from psychologies studies that categorize human (declarative) memory into episodic memory [Tulving, 1983] of specific contents of individual events, and semantic memory [Squire, 1992] about general knowledge like grammars and factual information. We would like the models to obtain semantic memory but avoid episodic memory. The capture the latter, we proposed a notion of counterfactual memorization. The mathematical formulation of counterfactual memorization is borrowed from a notion of label memorization in Feldman [2020] and adapted to the context of neural LMs in this paper. This formulation has been studied empirically in the context of computer vision in Feldman and Zhang [2020]. In a follow up work, Ilyas et al. [2022] showed that it is possible to fit a datamodel to predict the outcome of training a model on a specific training subset and evaluating on a specific input. However, this procedure requires training a massive number of models (e.g. 300,000 for CIFAR-10) on random subsets of the training data, thus is computationally infeasible for the scale of language models considered here.
36
+
37
+ The general idea of measuring model behavior on held-out training data is common in machine learning. In cross validation, held-out data is used to estimate the test performance for model selection; in learning theory, leave-one-out stability was shown to be deeply connected to generalization [e.g. Mukherjee et al., 2006]; in differential privacy, the worst case performance difference of models trained on two “neighboring” datasets (identical except a single example being held-out or replaced)
38
+
39
+ quantifies the privacy guarantee of a learning algorithm [Dwork et al., 2014, Nasr et al., 2021, Jagielski et al., 2020]. Most previous work aimed for an overall measurement, while our paper focused on characterizing the behaviors of individual examples.
40
+
41
+ We estimated a counterfactual influence to study how a memorized training example impact the model prediction at test time. Influence functions have been used in statistics to assess robust estimators since Hampel [1974]. Previous papers adopted it to analyze neural network predictions [Koh and Liang, 2017, Koh et al., 2019]. However, the estimation was found to be computational expensive and fragile [Basu et al., 2021]. Pruthi et al. [2020] tracks the gradient updates during training to estimate the influence from a training example; Feldman [2020], Feldman and Zhang [2020] use aggregated statistics from multiple models independently trained on heldout data subsets to estimate the influence. Further extensions were shown to work well on detecting mislabeled data in classification problems [Wang and Jia, 2022] and characterizing hallucinations in Neural Machine Translation [Raunak et al., 2021]. Alternative methods also looked at simple data statistics (e.g. co-occurrence counts) without model re-training to infer the causal effects on language models’ predictions [Elazar et al., 2022]. In this paper, we adapt the approach from Feldman [2020], and formulate counterfactual influence directly with subset sampling, as oppose to leave-one-out influence. We also extend the estimation to assess the influence on generated examples.
42
+
43
+ Counterfactual is an important notion in statistical causality [Pearl et al., 2000, Rubin, 2005, Pearl, 2009, Imbens and Rubin, 2015] useful for studying causal probabilistic inference under alternative conditions. Such counterfactuals may or may not be directly testable (e.g. a counterfactual treatment in medical studies). In this paper, we directly measure the counterfactual influence of a training example by comparing the behavior of the model trained with and without that example.
44
+
45
+ # 3 Counterfactual Memorization
46
+
47
+ To quantify memorization of rare details of a specific training document, we define the following notion of counterfactual memorization. The mathematical formulation is borrowed from Feldman [2020], where it was originally proposed to quantify label memorization in multi-class classification problems. We extend it to the context of unsupervised neural language modeling.
48
+
49
+ Definition 3.1 (Counterfactual Memorization). Given a training algorithm $A$ that maps a training dataset $D$ to a trained model $f$ , and a measure $M ( f , x )$ of the performance of $f$ on a specific example $x$ , the counterfactual memorization of a training example $x$ in $D$ is given by
50
+
51
+ $$
52
+ \mathsf { m e m } ( x ) \triangleq \mathbb { E } _ { S \subset D , x \in S } [ M ( A ( S ) , x ) ] - \mathbb { E } _ { S \subset D , x \notin S } [ M ( A ( S ) , x ) ] \quad ,
53
+ $$
54
+
55
+ where $S$ and $S ^ { \prime }$ are subsets of training examples sampled from $D$ . The expectation is taken with respect to the random sampling of $S$ and $S ^ { \prime }$ , as well as the randomness in the training algorithm $A$ .
56
+
57
+ That is, our memorization definition compares the difference between two expected performance measures on a given example $x$ . On one side, we compute the expected performance of a model when trained on datasets that contain the example $x$ , and, on the other side, we compute the expected performance of a model when trained on datasets that do not contain the example $x$ . Throughout this paper we use per-token accuracy as the measure $M$ . In other words, we ask the model to predict the next token based on the groundtruth context (preceding tokens), measure the 0-1 loss of the argmax token prediction, and then average it across all predicted tokens.
58
+
59
+ The expectations in Equation (1) can be empirically estimated via sampling. Specifically, we train $m$ different models on independently sampled subsets $S _ { 1 } , \ldots , S _ { m }$ of equal size $| S _ { i } | = r | D |$ for a fixed $r \in ( 0 , 1 )$ . We then divide these models into two groups: the first group contains all models trained on subsets $S$ where $x \in S$ ; and the second group are all models trained on subsets $S$ where $x \not \in S$ . We take the average performance on $x$ in the two groups separately and compute the difference between the two:
60
+
61
+ $$
62
+ \widehat { \mathsf { m e m } } ( x ) \triangleq \operatorname* { m e a n } _ { i : x \in S _ { i } } [ M ( A ( S _ { i } ) , x ) ] - \operatorname* { m e a n } _ { i : x \notin S _ { i } } [ M ( A ( S _ { i } ) , x ) ] .
63
+ $$
64
+
65
+ This difference quantifies how the presence or absence of the example $x$ in a model’s training set affect the model’s performance on $x$ . If there is a large difference between including an example in the training set versus not including it, then we consider this example counterfactually memorized.
66
+
67
+ For each $x$ , we refer to models trained with $x$ in the training set ( $\{ A ( S _ { i } ) : x \in S _ { i } \} )$ as IN models and the models $x$ was not trained on $\{ A ( S _ { i } ) : x \notin S _ { i } \} )$ as OUT models. Note we do not need to retrain a model for each example $x$ . Instead, we train $m$ models once on random subsets of $D$ , and compute the estimation (Equation 2) for all examples using the same set of $m$ models. Ilyas et al. [2022] recently showed that it may also be possible to directly predict these scores using a regression model, yet this approach is computationally prohibitive for large language models.
68
+
69
+ # 4 Analyzing Counterfactual Memorization
70
+
71
+ We estimate and analyze counterfactual memorization of training examples in three standard text datasets: RealNews [Zellers et al., 2019], C4 [Raffel et al., 2020a] and Wiki40B:en [Guo et al., 2020]. Unless otherwise specified, we use Transformer-based language models [Vaswani et al., 2017] equivalent to (decoder only) T5-base [Raffel et al., 2020b] with ${ \sim } 1 1 2 \mathbf { M }$ parameters. To save computation and enable more direct comparisons across datasets, we truncate the training set for each datasets by taking the first $2 ^ { 2 1 }$ documents. To estimate counterfactual memorization, we train 400 models for each dataset, each on a random $2 5 \%$ subset of the training examples. In practice, we use a hash-based filtering mechanism to efficiently approximate random subset sampling (details in Appendix G), as the data loading APIs for large text corpora generally support only sequential visits to examples with limited shuffling and subsampling capability within a window.
72
+
73
+ We train each model for 60 epochs1 using the Adam optimizer [Kingma and Ba, 2015] with learning rate 0.1 and weight decay $1 0 ^ { - 5 }$ . For C4/RealNews/Wiki40B:en, respectively, our models converge to an average per-token accuracy of $4 4 . 2 1 \% / 4 7 . 5 9 \% / 6 6 . 3 5 \%$ on the subsampled training set, and $2 7 . 9 0 \% / 3 1 . { \bar { 0 } } 9 \% / 4 9 . 5 5 \%$ on the validation set. On average, the models start to overfit at around epoch 5, as indicated by the signal that the validation accuracy starting to decrease.
74
+
75
+ # 4.1 Distribution of Memorization
76
+
77
+ Table 1 shows examples from the RealNews training set sampled at various memorization levels. Examples with the highest memorization are generally unconventional text such as all-capital letters, structured formats (i.e., tables or bullet list), and multilingual texts. After those artificial examples, examples with intermediate-to-high memorization are most often news reports of specific events. One of our main goals is to be able to separate memorization of such examples containing details of specific events from memorization of common facts or highly duplicated template texts. Indeed, templated documents with many near-duplicate copies in the training data generally have low counterfactual memorization. C4 and Wiki40B:en have similar trends. Interestingly, though Wikipedia articles are less likely to be auto-generated from templates than the web in general, we do observe repetitive patterns in low-scoring documents, such as “_START_ARTICLE_ <place name>, Virginia _START_PARAGRAPH_ <place name> is an unincorporated community in <county name>, in the U.S. state of Virginia.”
78
+
79
+ To visualize the distribution of memorization, we plot 2D histograms in Figure 1, where the $\mathbf { X }$ -axis shows the difference of IN-accuracy and OUT-accuracy (i.e. the counterfactual memorization), and the y-axis shows the sum of the two, which we term “simplicity”. A simple example is one that is scored highly regardless of whether a model saw it during training. The histograms are plotted in log scale to better visualize the exponential decay in the tail for high memorization and simplicity levels.
80
+
81
+ From the 2D density plots, we find that easy examples tend to have low memorization. However, there is no simple linear correlation. Peak memorization occurs for examples of intermediate simplicity. For the hardest examples, the memorization scores are low, because even the IN-models could not learn them well. Many hard examples consist of ill formatted text or contained foreign languages. As a result, in Wiki40B:en, which contains higher quality texts, the lower bound of the histogram is higher than the other two datasets (Figure 1). Interestingly, the choice of data has a relatively minor effect on memorization: the shape of the memorization histogram is generally consistent across the three datasets; the range of memorization values is only slightly compressed for Wiki40B:en.
82
+
83
+ Table 1: Examples of RealNews training set sampled at high, intermediate and low memorization. The URL of each document is included at the beginning of each example. [...] indicate omitted text for brevity. In the last block, two near-duplicate examples are shown; the yellow highlights in the last block indicate differences.
84
+
85
+ <table><tr><td>Index</td><td>mem</td><td>Text</td></tr><tr><td>2090855</td><td>0.6546</td><td>link → THE AMERICAN JEWISH CONGRESS ANNOUNCED TODAY THE PUBLICATION OF A REPORT ON JEWISH NON- EMPLOYMENT AS A RESULT OF ECONOMIC DISCRIMINATION,[J THEREAFTER ONE OF THE DEPARTMENTS OF A.T.&amp; T.”ALMOSTUNPRECEDENTEDLY &quot;ENGAGED A JEWISH APPLICANT.</td></tr><tr><td>2085736</td><td>0.5755</td><td>linkxRECIPE:ChinesePork&amp;VegetableSoupwith WontonNodles ChinesePork&amp;Vegetable SoupwithWontonNoodeslpork enderloin (about1-1/4poudsize)oeddutitinchcubupswerodickenrothuwate*/4cpakes (about11/2cups each)RecipebyPorkBeInspired.com withadaptations byculinarydietian &amp;nutritionistKim Galeaz,RDNCD</td></tr><tr><td>1680600</td><td>0.5807</td><td>linkLangaggs.ab.edgmtofout.cwoldiktogatsi being heldonthe traditionallandsofthe (appropriate group)people,nd paymyrespectoelders both past and present&quot;[]</td></tr><tr><td>2074805</td><td>0.2835</td><td>linkATexasoorsstudentpunishdforsinghatomosealitysongshadhisuspesosnded.WesteHilhde thecorrectdecisioninreversingtheircoursefctio.&quot;Thedecisiontoescid thesuspensionis thecorrecto.Thesuspensonaswrong andimproper&quot;saidStaver.&quot;Iaplaudthestudentforstandingup.Westoodwithhimtoresistanunjustsuspensionandweaepleasedthat suspensionhasevesed&quot;Libetyounselillotiuetteisefrdfosiedeliosdae instancesareincreasingandwillcontinue toincreaseunlessChristiansandpeoplewholovelibertystandupandesistisitolerance.&quot;</td></tr><tr><td>449808</td><td>0.0361</td><td>link &gt;Investors in Digital Realty Trust, Inc.(DLR) sawnew optionsbegin trading thisweek. for theFebruary2014 expiration.At Stock Options Channel, our YieldBoost formula has looked up and down theI eDLRoptions chain for the new February2014 contracts and identified one put and one callcontract of particular interest.The put contract at the $45.OO strike price has a current bid of $1.00. [...]</td></tr><tr><td>1157311</td><td>0.0356</td><td>link &gt; Investors in Abercrombie &amp; Fitch Co. (ANF): sawnew optionsbecome available today, for theApril 4th expiration. At Stock Options Channel,our YieldBoost formula has looked up and down the ANF optionschain for the new April4th contracts and identified one put and one call contract of particular interest.The put contract at the $34.OO strike price has a current bid of $1.97. [...]</td></tr></table>
86
+
87
+ ![](images/68e681741272d5b8342f41e8a0b444cf99f00a515f274dc72faa8e679ce234bc.jpg)
88
+ Figure 1: The joint distribution of counterfactual memorization (X axis) and simplicity (Y axis), where simplicity is measured as the overall accuracy for an example across all models. (Histograms are in log-scale).
89
+
90
+ Figure 1 shows the overall distribution of memorization for each training datasets. To obtain a more granular view, we can also analyze the distributions for texts sourced from individual web domains in RealNews and C4, to see whether different data sources display different memorization profiles. Web domains such as news portals, blogs, and forums differ both stylistically and in how much they reference or even copy from other websites. Additionally, some domains are represented much more frequently than others in the datasets we studied. This could lead to considerably different memorization profiles for examples from different domains.
91
+
92
+ To investigate these effects, we visualize the 95th percentile memorization score in each web domain against the number of examples in that domain for RealNews (Figure 2a) and C4 (Figure 2b). C4 contains many more domain names than RealNews since the latter is collected only from news websites. For both datasets, the domains with a large number of crawled documents show a smaller variance in the 95-percentile values, while “smaller” domains depict a wide range of variety in memorization profiles. The memorization profiles of a few representative domains are visualized in Figures 2c and 2d. The domains we selected for visualization are: the largest domain (blue), the domain with highest 95 percentile memorization (orange), and two domains that have more than 1000 and 50 articles in RealNews and C4 respectively (green and red).
93
+
94
+ In RealNews (Figure 2c), reuters.com contains the largest number of documents but low memorization scores on average. The domain digitallibrary.un.org, the United Nations Digital Library, has high memorization scores potentially because it contains many multilingual documents. We have observed that less frequently occurring tokens, like those in foreign languages or ALL-CAPITAL words tend to cause high memorization. Similarly, flattened structured data (e.g. tabular texts) also deviates significantly from normal English texts and potentially leads to high memorization, as demonstrated by zap2it.com, a website for TV program listings. On the other hand, hotair.com is a news commentary website that frequently quotes other major news articles. This may lead to duplicate text in the dataset which we suspect contributes to its overall lower memorization distribution.
95
+
96
+ ![](images/87de939eff15baaa1dd5185a48c6e3ea4d2d2a5fe63e09ba283e62c5de63cf20.jpg)
97
+ Figure 2: For each web domain, we plot the 95-percentile of memorization against the number of examples from that domain in (a) RealNews and (b) C4. The red dotted line indicates a threshold of a minimum of 1000 articles for RealNews and 50 articles for C4. The memorization distributions of a few representative domains are shown for (c) RealNews and (d) C4.
98
+
99
+ The observations are similar on C4: blogspot.com contains a large number of documents in the training set with only moderate amounts of memorization; zh.wikipedia.org and buckinghamautos.com.au have high memorization due to foreign (Chinese) or structured (car sales listings) text; and www.unitedstateszipcodes.org has very low memorization scores because common templates are re-used to generate similar pages for individual zip codes.
100
+
101
+ # 4.2 Number of Models Needed
102
+
103
+ To evaluate the impact of a single training example, one may wish to train two models that differ only in that single example. In practice, the stochasticity in a single run of common training algorithms (e.g. SGD) produces too low signal-to-noise ratios to be useful for such estimation. Moreover, leave-one-out estimation means a separate pair of models needs to be trained for each training example, which is computationally costly. Therefore, we formulated our estimation in Section 3 by accumulating statistics from $m$ models independently trained on random training subsets. In our experiments, we set $m = 4 0 0$ . To understand how sensitive our results are to $m$ , we analyze the rankings produced by distinct sets of models of size $m$ . We vary $m$ from 6 to 192, and partition our set of 400 models into up to 10 sets of $m$ models (e.g. for $m = 1 9 2$ , we construct 2 partitions, and for $m = 6$ , we construct 10). We then compute the Spearman’s R between these partitions to measure the agreement between the rankings produced by each partition. If the rankings are very similar (have Spearman’s R close to 1), then this number of models is reliably estimating the true ranking of memorization scores. We plot these Spearman’s R values in Figure 3a. Even at 96 models, this correlation begins to plateau near 1, lending confidence that 400 models is sufficient for reliable estimation of memorization scores. See Appendix D for more analysis on the sensitivity to $m$ .
104
+
105
+ # 4.3 Impact of Number of Training Epochs
106
+
107
+ As expected, the overall amount of memorization grows consistently with the number of epochs of training (Figure 3b). This makes sense since training for more epochs increases overfitting. As training progresses, we also see an increasingly long tail of examples with high memorization scores. On RealNews, about $59 \%$ of examples had consistently increasing memorization scores across all epochs considered. There were no examples whose memorization decreased in a significant way over training (all observed decreases can be attributed either to noise or to instability early in training). Only $0 . 5 \%$ of examples stayed completely un-memorized with scores which never rose above 0.1, while $85 \%$ of examples had memorization scores which never rose above 0.2. Figure 3c shows the fraction of memorized examples as training progresses, at several thresholds of memorization. We can see that more training epochs significantly increases memorization.
108
+
109
+ ![](images/ec9bdcf61ce8e5b77424346b849d98d8e92d285cf28db852f72bfecc4afdbd43.jpg)
110
+ Figure 3: (a) Spearman’s R between memorization rankings from two disjoint sets of $m$ models. The rankings are variable at low numbers of models, but starts to converge at 192 models. All of our other experiments use 400 models. Reported values are averages over up to 10 partitions, with error bars of 10 standard deviations. (b) The distribution in memorization of RealNews examples as training progresses. (c) The fraction of RealNews examples with memorization consistently above the specified threshold as training progresses. (d) For RealNews, we plot memorization scores against the number of near-duplicates an example had in the dataset.
111
+
112
+ # 5 Duplicate Text and Memorization
113
+
114
+ One of the goals of evaluating counterfactual memorization is to identify examples that have a low number of duplicates yet whose presence versus absence in the training data has a large effect on the model. Here, we perform a quantitative study of the (anti-)correlation between duplication and counterfactual memorization compared with the positive correlation between duplication and the “generation-time memorization” definitions of memorization used by Lee et al. [2021], Carlini et al. [2022], Kandpal et al. [2022].
115
+
116
+ Following the method from [Lee et al., 2021], we first use MinHash [Broder, 1997] to identify near-duplicate examples in RealNews train set. We consider a example a duplicate if it has an normalized edit similarity of greater than 0.7 (definition included in Appendix I). Out of 2.01 million examples, ${ \sim } 3 8 { , } 0 0 0$ were identified as being a near-duplicate with at least one other example. Among these frequently-occurring examples, the Pearson correlation between an example’s counterfactual memorization score and the number of near-duplicates for that example is $- 0 . 3 9$ ; in other words, memorization does quantitatively decrease when data is repeated more often.
117
+
118
+ In Figure 3d we can see that examples with a large number of near-duplicates have smaller memorization scores. Counterfactual memorization primarily differentiates amongst examples with a few number of duplicates. This makes sense given that examples with lots of near duplicates would likely have their near duplicates in OUT-models. This is to be contrasted with “generation-time memorization” (discussed in Section A) that measures the textual overlap between model generated texts and the training documents. There, the number of occurrences strongly correlate with the measured memorization [Carlini et al., 2020, Lee et al., 2021, Kandpal et al., 2022]. Counterfactual memorization measures a fundamentally different type of memorization from simple textual matching considered in prior work, providing information about how easy or hard a training example is in the context of the rest of the training set. In Table 1 we can see this effect qualitatively: sequences with near-duplicates in the training set tend to have low counterfactual memorization (as expected) .
119
+
120
+ # 6 From Memorization to Influence
121
+
122
+ Counterfactual memorization identifies training examples that contain rare information not conveyed by other examples. A natural question to ask is whether a model would leak the information in a memorized example during inference. Previous paper studies membership inference attack [Shokri et al., 2017, Sablayrolles et al., 2019, Long et al., 2020] where an attacker tries to figure out if a particular example exists in the training set. In this paper, we consider standard model evaluation without adversarial attackers, and quantify “does seeing a particular training example strongly influence the prediction on a validation example?” Another way of asking this is if a single example in the training set has an large and over-representative impact on the prediction of a validation example. We answer these questions by measuring counterfactual influence with a formulation adapted from Feldman and Zhang [2020]:
123
+
124
+ ![](images/d5c504abe9d67c414f32afbdee69aeeac7e118269c0b6bb2c0256baacb290d22.jpg)
125
+ Figure 4: (a) Histogram of the influence of all the training examples on a specific test example for three different test examples on RealNews. The blue and orange examples have high and intermediate influence from some training examples, as indicated by the outlier values to the right of the each histogram plot. The green one is a random example, where the influence from all individual training examples are close to zero. (b) The joint distribution of the memorization score of each training example and its maximum influence on any validation set example. The histograms are in log scale to better visualize the tail of the distributions. C4 shown in Figure 6.
126
+
127
+ Definition 6.1 (Counterfactual Influence). Given a training algorithm $A$ that maps a training set $D$ to a trained model, and a performance measure $M$ , the counterfactual influence of a training example $x \in D$ on another example $x ^ { \prime }$ is
128
+
129
+ $$
130
+ \mathsf { i n f l } ( x \Rightarrow x ^ { \prime } ) \triangleq \mathbb { E } _ { S \subset D , x \in S } [ M ( A ( S ) , x ^ { \prime } ) ] - \mathbb { E } _ { S \subset D , x \notin S } [ M ( A ( S ) , x ^ { \prime } ) ] ,
131
+ $$
132
+
133
+ where $S$ is a subset of training examples sampled from $D$ . The expectation is taken with respect to the random sampling of $S$ , as well as the randomness in the training algorithm $A$ . Here $x ^ { \prime }$ can be an example from the validation set or test set, a generated example or a training example.
134
+
135
+ An empirical estimation of the influence can be computed similarly to counterfactual memorization by uniformly sampling $m$ subsets $S _ { 1 } , \ldots , S _ { m }$ from $D$ , where $| S _ { i } | = r | D |$ , and calculating
136
+
137
+ $$
138
+ \begin{array} { r } { \widehat { \mathfrak { i n f } } | ( x \Rightarrow x ^ { \prime } ) \triangleq \underset { i : x \in S _ { i } } { \mathrm { m e a n } } [ M ( A ( S _ { i } ) , x ^ { \prime } ) ] - \underset { i : x \notin S _ { i } } { \mathrm { m e a n } } [ M ( A ( S _ { i } ) , x ^ { \prime } ) ] . } \end{array}
139
+ $$
140
+
141
+ This measures how much a training sample $x$ ’s presence influences the prediction of a different example $x ^ { \prime }$ . Note, ${ \mathsf { m e m } } ( x ) = { \mathsf { i n f l } } ( x \Rightarrow x )$ , i.e., counterfactual memorization is self influence.
142
+
143
+ Influence on Examples of the Validation Set. With the same models trained for estimating memorization, we can estimate the counterfactual influence on the validation set according to Equation (4). For each example in the validation set, we can estimate the influence on it from each training example. Figure 4a shows the distribution of influence from all training example on three different examples from the validation set. The green example was randomly chosen and represents the behavior for most validation examples: it receive close-to-zero influence from all the (individual) training examples. The blue and orange examples were sampled to have high and intermediate maximum influence. Each of them has one (or a few) strong influencer from the training set, as indicated by the bars to the right of the histogram. They also only receive tiny influence from all the rest of the training examples, though the variance of influence is larger than for the green example.
144
+
145
+ Intuitively, most training examples will have small influence on validation set examples because the models learn distributional patterns shared across many training examples, and individual training examples tend to have insignificant influence here. However, a training example $x$ with high counterfactual memorization contains rare information that are not shared with other examples. Therefore, if a validation set example $x ^ { \prime }$ contains similar information, $\mathsf { i n f l } ( x \Rightarrow x ^ { \prime } )$ could be large. Figure $^ { 4 \mathrm { b } }$ shows the relationship between memorization and influence by plotting $\mathsf { m e m } ( x )$ of each training example $x$ against its maximum influence $\mathrm { m a x } _ { x ^ { \prime } } \mathsf { i n f l } ( x \Rightarrow x ^ { \prime } )$ on $x ^ { \prime }$ across the validation set.
146
+
147
+ Consistent with our intuition, examples with small memorization scores have small max-influence scores. Larger influence scores on the validation set generally requires larger memorization scores of the training example itself. However, not all training examples with large memorization scores lead to large influence scores. In particular, the max-influences drop significantly for examples with memorization larger than 0.4. One potential reason is that many examples with very high memorization are simply low quality text, so memorization is required in order to learn them, but they do not encode anything interesting that could influence a validation example. On the other hand, even if a memorized example encodes some rare and useful information, the max-influence could still be low because the validation set does not contain a relevant document. This is especially true given that all datasets have considerably smaller validation sets than training sets.
148
+
149
+ Table 2: Train-validation example pairs of RealNews sampled at a variety of influence levels. [...] indicate text omitted for brevity. Differences in each document pair are highlighted yellow.
150
+
151
+ <table><tr><td>Index</td><td>Estim.</td><td>Text</td><td></td></tr><tr><td>Validation 1334662</td><td>infl 0.3780</td><td>link &gt;</td><td>Identical URL except with the htp://protocol instead of https://.The text is identical to the training example.</td></tr><tr><td>Train 2077314</td><td>mem 0.3780</td><td>Jeffrey Heller/Jeremy Gaunt)</td><td>linkByAriRabinoichZEELLLEYIsrael(Reuters)edisposablepaperfcemasksoferitteproteionfromteodf dustthatfleelosteaphtoleari</td></tr><tr><td>Validation 838341</td><td>infl 0.1209</td><td>link VATICAN CITY(AP)</td><td>Emeritus Pope Benedict XVI is offering a first-ever papal assessment of his own pontificate in a book that recountshissooipseathscodisptsttleathallVtiasgalb&quot;dic XVI:TheFinalConversatios,&quot;isdueoutinSeptemberthelatestVaticancarerbysimplyspreadinggossipthathewas gay Different</td></tr><tr><td>Train</td><td>mem 0.1650</td><td>link &gt;VATICAN CITY</td><td>websites,but (almost) identical report. Emeritus Pope Benedict XVIisofferingafirst-everpapal assessmentof hisown pontificate inabook thatrecounts hisdecisiontosipiseatscodiseptstosmatleatallVatian’s&quot;globy&quot;ec Final Conversations,&quot;isdueoutineptember,thelatest[.Vaticancarerbysimplyspreadinggossipthathewasgay. Follow Nicole Winfield</td></tr><tr><td>614881</td><td></td><td></td><td>at www.twitter.com/nwinfield linkANAH-OnanighthenFancoiseaucheminhadtwoistsinrontandChrisProngebockedsixsotsinetroi69</td></tr><tr><td>Validation 682107</td><td>infl</td><td>0.0673</td><td>DucksfansmighthavebeelostwitoutheirprogramsonWednesayightItsonlytefrstgameoftepreseasonutaeeraearly begun.AgroupofmostlyewcomersinDucksuniforsbeatPhoenix3-2inashootoutonWednesdayatHondaCenter.Afamilarfacemade ct,however,asobbyRyansoredtwogoalsRyaalsoscoredtwgoalsintheDucks’preseasonopenerastyariernt</td></tr><tr><td></td><td></td><td></td><td>the biggest impact,</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>websites on the same event with slightly diferent wordings.</td></tr><tr><td>Train</td><td></td><td>mem</td><td>linkANAHE-OnanightwhenFrancoisBeaucheminhadtwoasstsinorontoandChrisProngerblockedsixsots inDetroit,the</td></tr><tr><td>494435</td><td></td><td>0.1439</td><td>13,869 Ducks&#x27; fans who showed at at Honda Center Wednesday needed programs to identify the players on their favorite team.</td></tr><tr><td></td><td></td><td></td><td>frstgameoftepresasoutraasal.Agroupofostlwcoesiucksosatoix-inot</td></tr><tr><td></td><td></td><td></td><td>althoughafamiliarfacemade thebiggest impactasBobbyRyanscoredtwo goalsinregulationandanother intheshootout. two goals in the Ducks’ preseason opener last year[...]</td></tr><tr><td></td><td></td><td></td><td>Ryan also scored</td></tr><tr><td>Validation</td><td></td><td>infl</td><td>linkxMoretan7oo poundsofButerballtrkeyrecalledbecauseofpotentialsalmonella WASHINGON—The U.S.Departentof</td></tr><tr><td>1165799</td><td></td><td>0.0360</td><td>Agriculture&#x27;s Food Safety and Inspections services announced on Wednesday[ [.] They were shipped to nationwide retail and institutional</td></tr><tr><td></td><td></td><td></td><td>locations.RELATED: View the fullrecall FSIS,the Centers for Disease Control and Prevention and[..] Different websitesreportingthe same</td></tr><tr><td></td><td></td><td></td><td>event, one embeded a lot more information than the other.</td></tr><tr><td>Train</td><td></td><td></td><td>link &gt; x Butterball recalls nearly 8o.oo0 pounds of turkey a after salmonella cases WASHINGTON- The U.S. Department of Agriculture&#x27;s</td></tr><tr><td>1571976</td><td></td><td>mem</td><td>Food Safetyand Inspection service announced Wednesday [..] The raw ground turkey was produced on July 7, 2018. The following products</td></tr><tr><td></td><td></td><td>0.2094</td><td></td></tr><tr><td></td><td></td><td></td><td>under recall were shippedtonationwide retailand institutionallocations: 48-oz.plastic wrappedtraycontaining&quot;BUTTERBALLeveryday</td></tr><tr><td></td><td></td><td></td><td>Fresh GroundTurkeyWITHNAURALFLAVORING(85%LEAN/15%FAT)withsellorfreeze bydateof726/18,lotcode 818andUP</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>codes22655-7155or2655-71557representedonthelabel.48-oz.plasticwrappedtraycontaining&quot;BUERBALLeverdayFreshGoud</td></tr><tr><td></td><td></td><td></td><td>Turkey WITH NATURAL FLAVORING (93% LEAN/7% FAT)&quot; with sellor freeze by date of 7/26/18, lot[.] labelshere. FSIS,the Centers for</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>Disease Control and Prevention and</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr></table>
152
+
153
+ Table 2 shows train-validation example pairs from RealNews sampled at different influence value ranges. We found that the train-validation pairs with the highest influence are almost identical, except some superficial differences, such as different handling of quotation / em dash marks. As we move to intermediate influence ranges, we commonly found reports on the same events. Large paragraphs of identical text indicate that one document might be citing the other or both citing from a third party. At low influence, two types of correlations are commonly observed: 1) templated texts with high similarity—the reason for a low influence is that there are many similar training examples that split the influence; 2) superficially related documents due to a shared prefix such as ST. CLOUD – This week in our “Behind the Scenes” series on WJON or a shared substring of some common knowledge like FSIS, the Centers for Disease Control and Prevention. Due to high signal-to-noise ratio, here were no noticeable relationships in the document pairs with influence scores below 0.02.
154
+
155
+ Influence turns out to be an effective tool for analyzing and attributing the model predictions at test time: for predictions that rely on information obtained by (counterfactual) memorization, we can identify exactly which training example provided such information. Our observation of nearduplicated training-validation document pairs is consistent with recent studies that identifies data contamination in large Internet crawled text corpus [Lee et al., 2021, Dodge et al., 2021].
156
+
157
+ Influence on Generated Texts. The influence estimation is not restricted to the validation set. We can also estimate influence on generated examples. In this section, we evaluate on the publicly released generations from the Grover models [Zellers et al., 2019] trained on RealNews. Specifically, we take the generations from Grover-Mega $\scriptstyle ( \mathtt { p } = 0 . 9 6 )$ ), a 1.5-billion-parameter model trained on the RealNews dataset. Comparing with the train-validation influence in Figure 4b, the histogram (c.f. Figure 10 in Appendix.) decays faster as max-influence grows. Moreover, the value range of max-influence is also twice smaller. The reason that we did not find a lot of highly influenced generated examples are two fold: 1) there are only 24,576 generation in the public release, which is much fewer than the validation examples. As a result, the corresponding example of many memorized training examples do not get sampled in the generations. For comparison, previous work [Carlini et al., 2020, Lee et al., 2021] generated $1 0 0 { , } 0 0 0 { + }$ examples to identify memorization in generation. These approaches also count duplicates in the training set, which counterfactual memorization filters out. 2) The Grover model was trained on the full RealNews training set, while we have restricted our analysis to the first 2M training examples. There could be potentially more high influence training examples that are missed in our calculation.
158
+
159
+ # 7 Summary and Discussion
160
+
161
+ We studied memorization in neural language models. We formulated a notion of counterfactual memorization as a tool that can systematically ignore “common” memorization such as general knowledge (e.g. “Paris is a city in France”) and captures memorization of rare, specific information (e.g. description of a specific episode of event) present in the training examples. We conducted experiments on three commonly used text corpus in language modeling and found memorization in all of them. We further analyze the per-domain memorization profiles for Internet-crawled data, and found that different sources could have substantially different memorization profiles.
162
+
163
+ Furthermore, we analyzed how memorized training examples could impact the model predictions at test time via counterfactual influence. We found that for examples from both the validation set and the model generated texts, the model predictions could be drastically different depending on the presence or absence of a particular training example with high memorization.
164
+
165
+ Limitations. This study mainly focus on English datasets. While we expect the characterization of memorization would be similar when evaluated on corpus of other (natural) languages, new patterns might be observed on multilingual data or more structured domains such as programming languages.
166
+
167
+ Both the neural language models and training sets used in this work are orders of magnitude smaller than modern standards such as GPT-3 [Brown et al., 2020], GPT-4 [OpenAI, 2023] and PaLM2 [Google, 2023]. Moreover, we only conducted preliminary investigation of the dynamics of counterfactual memorization during training. Although our experiments effectively estimated and detected memorization, we suspect more interesting examples might emerge if larger, more capable models are analyzed. For example, currently when the information from a memorized training example is leaked in the prediction of a strongly influenced test example, it can usually be explained by a high text overlap between the training and test examples. For models with deeper understanding of languages, we suspect that strong influence could be observed even between documents that have no direct text overlap but that encode similar semantic information.
168
+
169
+ In order to test this, it will be necessary to scale our framework to larger models and datasets. Moreover, it will be necessary to construct datasets where semantically similar but textually different document pairs exist. One potential source to construct such datasets would be versioned Wikipedia articles–two versions of the same article with large time span or edit distance may contain semantically similar (but paraphrased) information. Such a dataset of paraphrased text pairs would be more broadly useful to understand the ability of different models to disentangle text content and form—by measuring the influence of one piece of text on a paraphrased piece of text.
170
+
171
+ Counterfactual memorization enables us to identify examples that whose presence or absence has a large impact on the model and the model’s ability to score and generate other text. The privacy risk for this is low since in order to perform this analysis, one would need to already have access to the dataset and the ability to train models.
172
+
173
+ Acknowledgments. The authors would like to thank Samy Bengio, Christopher A. ChoquetteChoo, Ethan Dyer, Michael C. Mozer, Behnam Neyshabur, Andrew Nystrom, and Hanie Sedghi for constructive discussions and feedback. The authors would like to thank Andrew Nystrom for assistance with MinHash-based near-duplicate detection.
174
+
175
+ # References
176
+
177
+ Samyadeep Basu, Philip Pope, and Soheil Feizi. Influence functions in deep learning are fragile. ArXiv, abs/2006.14651, 2021.
178
+
179
+ Rishi Bommasani, Drew A Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, Erik Brynjolfsson, Shyamal Buch, Dallas Card, Rodrigo Castellon, Niladri Chatterji, Annie Chen, Kathleen Creel, Jared Quincy Davis, Dora Demszky, Chris Donahue, Moussa Doumbouya, Esin Durmus, Stefano Ermon, John Etchemendy, Kawin Ethayarajh, Li Fei-Fei, Chelsea Finn, Trevor Gale, Lauren Gillespie, Karan Goel, Noah Goodman, Shelby Grossman, Neel Guha, Tatsunori Hashimoto, Peter Henderson, John Hewitt, Daniel E Ho, Jenny Hong, Kyle Hsu, Jing Huang, Thomas Icard, Saahil Jain, Dan Jurafsky, Pratyusha Kalluri, Siddharth Karamcheti, Geoff Keeling, Fereshte Khani, Omar Khattab, Pang Wei Kohd, Mark Krass, Ranjay Krishna, Rohith Kuditipudi, Ananya Kumar, Faisal Ladhak, Mina Lee, Tony Lee, Jure Leskovec, Isabelle Levent, Xiang Lisa Li, Xuechen Li, Tengyu Ma, Ali Malik, Christopher D Manning, Suvir Mirchandani, Eric Mitchell, Zanele Munyikwa, Suraj Nair, Avanika Narayan, Deepak Narayanan, Ben Newman, Allen Nie, Juan Carlos Niebles, Hamed Nilforoshan, Julian Nyarko, Giray Ogut, Laurel Orr, Isabel Papadimitriou, Joon Sung Park, Chris Piech, Eva Portelance, Christopher Potts, Aditi Raghunathan, Rob Reich, Hongyu Ren, Frieda Rong, Yusuf Roohani, Camilo Ruiz, Jack Ryan, Christopher Ré, Dorsa Sadigh, Shiori Sagawa, Keshav Santhanam, Andy Shih, Krishnan Srinivasan, Alex Tamkin, Rohan Taori, Armin W Thomas, Florian Tramèr, Rose E Wang, William Wang, Bohan Wu, Jiajun Wu, Yuhuai Wu, Sang Michael Xie, Michihiro Yasunaga, Jiaxuan You, Matei Zaharia, Michael Zhang, Tianyi Zhang, Xikun Zhang, Yuhui Zhang, Lucia Zheng, Kaitlyn Zhou, and Percy Liang. On the opportunities and risks of foundation models. August 2021.
180
+
181
+ James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wanderman-Milne, and Qiao Zhang. JAX: composable transformations of Python+NumPy programs, 2018. URL http://github.com/google/jax.
182
+
183
+ Andrei Z Broder. On the resemblance and containment of documents. In Proceedings. Compression and Complexity of SEQUENCES 1997 (Cat. No. 97TB100171), pages 21–29. IEEE, 1997.
184
+
185
+ Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 1877–1901. Curran Associates, Inc., 2020. URL https://proceedings. neurips.cc/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf.
186
+
187
+ Nicholas Carlini, Chang Liu, Úlfar Erlingsson, Jernej Kos, and Dawn Song. The secret sharer: Evaluating and testing unintended memorization in neural networks. In USENIX Security Symposium, 2019.
188
+
189
+ Nicholas Carlini, Florian Tramer, Eric Wallace, Matthew Jagielski, Ariel Herbert-Voss, Katherine Lee, Adam Roberts, Tom Brown, Dawn Song, Ulfar Erlingsson, et al. Extracting training data from large language models. arXiv preprint arXiv:2012.07805, 2020.
190
+
191
+ Nicholas Carlini, Steve Chien, Milad Nasr, Shuang Song, Andreas Terzis, and Florian Tramer. Membership inference attacks from first principles, 2021.
192
+
193
+ Nicholas Carlini, Daphne Ippolito, Matthew Jagielski, Katherine Lee, Florian Tramer, and Chiyuan Zhang. Quantifying memorization across neural language models. arXiv preprint arXiv:2202.07646, 2022.
194
+
195
+ 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.
196
+
197
+ 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. doi: 10.18653/v1/N19-1423. URL https: //aclanthology.org/N19-1423.
198
+
199
+ Jesse Dodge, Maarten Sap, Ana Marasovic, William Agnew, Gabriel Ilharco, Dirk Groeneveld, and Matt Gardner. Documenting the english colossal clean crawled corpus. arXiv preprint arXiv:2104.08758, 2021.
200
+
201
+ Cynthia Dwork, Aaron Roth, et al. The algorithmic foundations of differential privacy. Found. Trends Theor. Comput. Sci., 9(3-4):211–407, 2014.
202
+
203
+ Yanai Elazar, Nora Kassner, Shauli Ravfogel, Amir Feder, Abhilasha Ravichander, Marius Mosbach, Yonatan Belinkov, Hinrich Schütze, and Yoav Goldberg. Measuring causal effects of data statistics on language model’s factual predictions. arXiv preprint arXiv:2207.14251, 2022.
204
+
205
+ Vitaly Feldman. Does learning require memorization? A short tale about a long tail. In STOC, 2020.
206
+
207
+ Vitaly Feldman and Chiyuan Zhang. What neural networks memorize and why: Discovering the long tail via influence estimation. In Advances in Neural Information Processing Systems, 2020.
208
+
209
+ Google. Palm 2 technical report. Technical report, Google, 2023.
210
+
211
+ Mandy Guo, Zihang Dai, Denny Vrandecic, and Rami Al-Rfou. Wiki-40b: Multilingual language model dataset. In LREC 2020, 2020.
212
+
213
+ Frank R Hampel. The influence curve and its role in robust estimation. Journal of the american statistical association, 69(346):383–393, 1974.
214
+
215
+ Jonathan Heek, Anselm Levskaya, Avital Oliver, Marvin Ritter, Bertrand Rondepierre, Andreas Steiner, and Marc van Zee. Flax: A neural network library and ecosystem for JAX, 2020. URL http://github.com/google/flax.
216
+
217
+ Peter Henderson, Koustuv Sinha, Nicolas Angelard-Gontier, Nan Rosemary Ke, Genevieve Fried, Ryan Lowe, and Joelle Pineau. Ethical challenges in data-driven dialogue systems, 2017.
218
+
219
+ Andrew Ilyas, Sung Min Park, Logan Engstrom, Guillaume Leclerc, and Aleksander Madry. Datamodels: Predicting predictions from training data. arXiv preprint arXiv:2202.00622, 2022.
220
+
221
+ Guido W Imbens and Donald B Rubin. Causal inference in statistics, social, and biomedical sciences. Cambridge University Press, 2015.
222
+
223
+ Matthew Jagielski, Jonathan Ullman, and Alina Oprea. Auditing differentially private machine learning: How private is private sgd?, 2020.
224
+
225
+ Nikhil Kandpal, Eric Wallace, and Colin Raffel. Deduplicating training data mitigates privacy risks in language models. arXiv preprint arXiv:2202.06539, 2022.
226
+
227
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In The International Conference for Learning Representations, 2015.
228
+
229
+ Pang Wei Koh and Percy Liang. Understanding black-box predictions via influence functions. ArXiv, abs/1703.04730, 2017.
230
+
231
+ Pang Wei Koh, Kai-Siang Ang, Hubert Hua Kian Teo, and Percy Liang. On the accuracy of influence functions for measuring group effects. In NeurIPS, 2019.
232
+
233
+ Jooyoung Lee, Thai Le, Jinghui Chen, and Dongwon Lee. Do language models plagiarize? In Proceedings of the ACM Web Conference 2023, pages 3637–3647, 2023.
234
+
235
+ Katherine Lee, Daphne Ippolito, Andrew Nystrom, Chiyuan Zhang, Douglas Eck, Chris CallisonBurch, and Nicholas Carlini. Deduplicating training data makes language models better. CoRR, abs/2107.06499, 2021. URL https://arxiv.org/abs/2107.06499.
236
+
237
+ Yunhui Long, Lei Wang, Diyue Bu, Vincent Bindschaedler, Xiaofeng Wang, Haixu Tang, Carl A Gunter, and Kai Chen. A pragmatic approach to membership inferences on machine learning models. In 2020 IEEE European Symposium on Security and Privacy (EuroS&P), pages 521–534. IEEE, 2020.
238
+
239
+ Sayan Mukherjee, Partha Niyogi, Tomaso Poggio, and Ryan Rifkin. Learning theory: stability is sufficient for generalization and necessary and sufficient for consistency of empirical risk minimization. Advances in Computational Mathematics, 25(1):161–193, 2006.
240
+
241
+ Milad Nasr, Shuang Song, Abhradeep Thakurta, Nicolas Papernot, and Nicholas Carlini. Adversary instantiation: Lower bounds for differentially private machine learning, 2021.
242
+
243
+ OpenAI. Gpt-4 technical report. arXiv, 2023.
244
+
245
+ Judea Pearl. Causal inference in statistics: An overview. 2009.
246
+
247
+ Judea Pearl et al. Causality: Models, reasoning and inference. Cambridge, UK: CambridgeUniversityPress, 19(2):3, 2000.
248
+
249
+ Garima Pruthi, Frederick Liu, Mukund Sundararajan, and Satyen Kale. Estimating training data influence by tracking gradient descent. ArXiv, abs/2002.08484, 2020.
250
+
251
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1–67, 2020a. URL http://jmlr.org/papers/v21/20-074.html.
252
+
253
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1–67, 2020b. URL http://jmlr.org/papers/v21/20-074.html.
254
+
255
+ Vikas Raunak, Arul Menezes, and Marcin Junczys-Dowmunt. The curious case of hallucinations in neural machine translation. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1172–1183, Online, June 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021. naacl-main.92. URL https://aclanthology.org/2021.naacl-main.92.
256
+
257
+ Donald B Rubin. Causal inference using potential outcomes: Design, modeling, decisions. Journal of the American Statistical Association, 100(469):322–331, 2005.
258
+
259
+ Alexandre Sablayrolles, Matthijs Douze, Yann Ollivier, Cordelia Schmid, and Hervé Jégou. Whitebox vs black-box: Bayes optimal strategies for membership inference, 2019.
260
+
261
+ Reza Shokri, Marco Stronati, Congzheng Song, and Vitaly Shmatikov. Membership inference attacks against machine learning models. In 2017 IEEE Symposium on Security and Privacy (SP), pages 3–18. IEEE, 2017.
262
+
263
+ Larry R Squire. Memory and the hippocampus: a synthesis from findings with rats, monkeys, and humans. Psychological review, 99(2):195, 1992.
264
+
265
+ Om Thakkar, Swaroop Ramaswamy, Rajiv Mathews, and Françoise Beaufays. Understanding unintended memorization in federated learning, 2020.
266
+
267
+ Aleena Thomas, David Ifeoluwa Adelani, Ali Davody, Aditya Mogadala, and Dietrich Klakow. Investigating the impact of pre-trained word embeddings on memorization in neural networks. In International Conference on Text, Speech, and Dialogue, pages 273–281. Springer, 2020.
268
+
269
+ Endel Tulving. Elements of episodic memory. Oxford University Press, 1983. ISBN 9780198521259.
270
+
271
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pages 5998–6008, 2017.
272
+
273
+ Nikhil Vyas, Sham Kakade, and Boaz Barak. Provable copyright protection for generative models. arXiv preprint arXiv:2302.10870, 2023.
274
+
275
+ Tianhao Wang and Ruoxi Jia. Data banzhaf: A data valuation framework with maximal robustness to learning stochasticity. arXiv preprint arXiv:2205.15466, 2022.
276
+
277
+ Santiago Zanella-Béguelin, Lukas Wutschitz, Shruti Tople, Victor Rühle, Andrew Paverd, Olga Ohrimenko, Boris Köpf, and Marc Brockschmidt. Analyzing information leakage of updates to natural language models. Proceedings of the 2020 ACM SIGSAC Conference on Computer and Communications Security, Oct 2020. doi: 10.1145/3372297.3417880. URL http://dx.doi.org/ 10.1145/3372297.3417880.
278
+
279
+ Rowan Zellers, Ari Holtzman, Hannah Rashkin, Yonatan Bisk, Ali Farhadi, Franziska Roesner, and Yejin Choi. Defending against neural fake news. In Advances in Neural Information Processing Systems, 2019.
280
+
281
+ 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.
282
+
283
+ Albert Ziegler. GitHub Copilot: Parrot or crow? https://docs.github.com/en/github/copilot/researchrecitation, 2021.
284
+
285
+ ![](images/c7cdee2a4be26310b2290ccdc75b3eb7485b9a5df99c7a02a83c9d834e9d6644.jpg)
286
+ Figure 5: Per-token accuracy of training examples evaluated on IN models vs OUT models.
287
+
288
+ # A Difference Between Counterfactual and Generation-Time Memorization
289
+
290
+ Many definitions of memorization operate at generation-time: a sequence of generated text is marked as memorized if a sufficient amount of overlap is found in the training dataset [Carlini et al., 2020]. When the training data is not available, heuristic-based methods comparing language model perplexities are used to predict whether a generation contains memorized content [Carlini et al., 2019, Thakkar et al., 2020, Thomas et al., 2020, Carlini et al., 2020, Zanella-Béguelin et al., 2020]. One difficulty with these approaches is that generation-time instances of memorization are strongly correlated with the number of similar or near-duplicate examples in the training set. As observed in Lee et al. [2021], large clusters of near-duplicated examples do exist in common language datasets, dominating memorization detected in generated text. Generation-time methods for measuring memorization are forced to design heuristics to avoid simply identifying these uninteresting instances of memorization.
291
+
292
+ In contrast, the counterfactual memorization we study in this paper handles the issue of near-duplicates automatically without the need for heuristics. For a training example, $x$ , with many near-duplicate copies in the training set, $\mathsf { m e m } ( x )$ will be small (because other samples $x ^ { \prime } \approx x$ will be present in the training dataset whether or not $x$ is). This does not mean that counterfactual memorization is the opposite of generation-time memorization. An example, $x$ , with high $\mathsf { m e m } ( x )$ may have a high chance of being generated if a model is appropriately prompted, despite and possibly because it is rare, and thus the example is considered memorized by both definitions. In summary, generationtime memorization measures the chance a model will directly copy from training examples, while counterfactual memorization aims to discover rare information that is memorized.
293
+
294
+ # B Average Accuracy of IN models vs OUT models
295
+
296
+ Figure 5 compares the per-token accuracy between the IN models and OUT models for the training examples from three different datasets. Counterfactual memorization is estimated by taking the difference between the average IN-accuracy and the average OUT-accuracy. Thus, the examples closer to the upper left corner are more counterfactually memorized, while the examples near the diagonal are not.
297
+
298
+ # C The Impact of Data Deduplication on Memorization
299
+
300
+ To investigate the impact of data deduplication on counterfactual memorization, we compared C4 with C4-NEARDUP [Lee et al., 2021], which is derived from C4 with deduplication using approximate document matching. Figure 7 compares the distribution of memorization between the original C4 and the deuplicated dataset. We did not find significant difference between the two datasets. One potential reason is that the deduplication criterion was relatively conservative, which removed only $\sim 3 \%$ of the training examples. In fact, we can still easily see near duplicate examples in C4-NEARDUP among examples with low memorization, as shown below:
301
+
302
+ Example 1380925 $\mathtt { ( m e m = 0 . 0 3 7 4 }$ ) link $\vartriangleright$ This is a placeholder page for Joshua Baldridge, which means this person is not currently on this site. We do suggest using the tools below to find Joshua Baldridge. You are visiting the placeholder page for Joshua Baldridge. This page is here because someone used our placeholder utility to look for Joshua Baldridge. We created this page automatically in hopes Joshua Baldridge would find it. If you are not Joshua Baldridge, but are an alumni of Brecksville Broadview Heights High School, register on this site for free now.
303
+
304
+ ![](images/85a8975845465421d6da082a6958e82def849b704102eefabfd8471afd6416e9.jpg)
305
+ Figure 6: Full version of Figure 4b: The joint distribution of the memorization score of each training example and its maximum influence on any validation set example. The histograms are in log scale to better visualize the tail of the distributions.
306
+
307
+ Example 2048352 $\mathrm { { ( m e m = 0 . 0 3 2 0 ) } }$ ) link $\vartriangleright$ This is a placeholder page for Laytoya Brannon, which means this person is not currently on this site. We do suggest using the tools below to find Laytoya Brannon. You are visiting the placeholder page for Laytoya Brannon. This page is here because someone used our placeholder utility to look for Laytoya Brannon. We created this page automatically in hopes Laytoya Brannon would find it. If you are not Laytoya Brannon, but are an alumni of Mainland High School, register on this site for free now.
308
+
309
+ Example 1314053 $\mathtt { ( m e m = 0 . 0 2 7 8 ) }$ ) link $\vartriangleright$ This is a placeholder page for Devin Mcguire, which means this person is not currently on this site. We do suggest using the tools below to find Devin Mcguire. You are visiting the placeholder page for Devin Mcguire. This page is here because someone used our placeholder utility to look for Devin Mcguire. We created this page automatically in hopes Devin Mcguire would find it. If you are not Devin Mcguire, but are an alumni of Kankakee Valley High School, register on this site for free now.
310
+
311
+ Example 1085524 $\mathrm { { ( m e m = 0 . 0 2 0 9 } }$ ) link $\vartriangleright$ This is a placeholder page for Anthony Christie, which means this person is not currently on this site. We do suggest using the tools below to find Anthony Christie. You are visiting the placeholder page for Anthony Christie. This page is here because someone used our placeholder utility to look for Anthony Christie. We created this page automatically in hopes Anthony Christie would find it. If you are not Anthony Christie, but are an alumni of Old Bridge High School, register on this site for free now.
312
+
313
+ ![](images/461521b9a79af9eb189f66aa4dde5981811c185dca692a8cfc435a41df144976.jpg)
314
+ Figure 7: The joint distribution of memorization and simplicity. The histograms are plotted in log scale to better visualize the tail of the distributions.
315
+
316
+ ![](images/8468ae3ac416f31cf5815abfe82bedf4c60580a981b0f37c12fbea48d3922045.jpg)
317
+
318
+ ![](images/709588e8c4d9eb7565992971e1fa07064365cc1e345688ddd804e60ca9756497.jpg)
319
+ Figure 8: Spearman’s R between memorization rankings from a set of $m$ models and our full set of 400 models. As more models are trained, the ranking changes very little, with the ranking at 192 models having a Spearman’s R of at least 0.992 on all datasets.
320
+ Figure 9: The variance in memorization scores decreases significantly as the number of models increases for all 3 datasets.
321
+
322
+ Measurements of the edit distances show that they are near the boundary of the deduplication threshold chosen in Lee et al. [2021]. On the other hand, the tail of the distribution — examples with high counterfactual memorization are mostly unaffected by text deduplication.
323
+
324
+ # D Variance of Memorization Scores
325
+
326
+ In Figure 8, we measure the Spearman’s R between our total set of 400 models and an $m$ model subset. As expected, as $m$ increases, so does Spearman’s R—in particular, at 192 models, the Spearman’s R is at least $9 9 . 2 \%$ for all datasets, and increasing $m$ already appears to have diminishing returns.
327
+
328
+ Using the same partitioning into size $m$ sets of models, we analyze the variance of memorization scores assigned to each sample. To do this, within each partition, we compute the memorization score assigned to each sample. We then compute the standard deviation of all partitions’ memorization scores for each sample. In Figure 9, we plot each sample’s standard deviation — in all, this demonstrates the distribution of the variance of memorization scores. We find that the variance decreases substantially as $m$ grows, and concentrates near 0 already with $m = 1 9 2$ , for all datasets.
329
+
330
+ # E Histogram of Max-Influence on Generated Texts
331
+
332
+ Figure 10 shows the histogram of max-influence on each generated example by Grover-Mega $\scriptstyle \left( \mathrm { p } = 0 . 9 6 \right)$ [Zellers et al., 2019], from the RealNews training examples. Those generated examples are publicly released at https://github.com/rowanz/grover/tree/master/generation_examples.
333
+
334
+ # F Miscellaneous Experiment Details
335
+
336
+ Our experiments are implemented using JAX [Bradbury et al., 2018] and Flax [Heek et al., 2020], both open sourced library under the Apache-2.0 license. In the study of influence on generated texts, we use the publicly released generations from the Grover models [Zellers et al., 2019], available at their open source code repository, under the Apache-2.0 license.
337
+
338
+ We run the experiments using our internal cluster. The majority of the compute is consumed by model training. In this paper, we use standard training setup for transformer based neural language models, which could run on single node machines with one or multiple GPUs. However, to carry out the full analysis, we need to train 400 different models for each of the three datasets analyzed in this paper.
339
+
340
+ ![](images/663f92af93fa09fa9a6d70c95880f93380c953f5a831e4271fe1108741f0693a.jpg)
341
+ Figure 10: Histogram of max-influence on each generated example by Grover-Mega $\scriptstyle ( \mathtt { p } = 0 . 9 6$ ), from the RealNews training examples.
342
+
343
+ ![](images/1e66c13454ccab201a26ffcc3d4bcb455872a9be54f28a8093715153fefd24b9.jpg)
344
+ Figure 11: Comparison of hash based subset sampling with numpy.random.choice.
345
+
346
+ # G Subsampling Procedure
347
+
348
+ In the estimation of memorization and influence, we trained 400 models each on an independent random subset of training examples. We use Tensorflow Datasets (TFDS) 2 to load our training data. TFDS supports loading a continuous range of examples, but does not support subset loading from a list of indices of individual examples. The API has a filter function which allows us to provide a Tensorflow predicate to precisely control the subset loading. However, a naive implementation of checking whether the index of the current example is in a given list of subset indices is very slow and scales poorly with the subset size.
349
+
350
+ To mitigate the issue, we implemented a hash based subset sampling predicate that can be evaluated efficiently for each example, and (approximately) select a random subset of a specified size. Let $N$ be the total number of training examples, $n < N$ be the expected subset size. The idea is to map the index $i$ of each example to $N / n$ hash buckets, and select all the examples that fall into one particular bucket. To make sure each model gets an independent subset sampling, we need to use different hash functions for different models. In our implementation, we compose a known hash function for uint64 types with a simple pseudo number based on the index of the current model to achieve this. Note the subset size sampled is close to $n$ but is not guaranteed to be exactly $n$ . But this is not a problem in our settings. The specific implementation is shown below:
351
+
352
+ def hash_sampler(mod, seed, system): """Get hash based subset sampler.
353
+
354
+ Args: mod: total_n_egs // subset_size seed: different seed leads to different subset sample
355
+
356
+ system: 'np' or 'tf'.
357
+
358
+ Returns:
359
+
360
+ A Tensorflow or Numpy subset sampler. np_hash $=$ hash_uint64_builder('np') mul, offset, remainder $=$ np_hash(seed $^ +$ 1234 + np.arange(3)) remainder $=$ remainder % mod
361
+
362
+ if system $\ d = \ d \cdot \mathsf { n p } ^ { \prime }$ : def np_sampler(n_total): $\mathrm { ~ \bf ~ { ~ x ~ } ~ } =$ np.arange(n_total, dtype=np.uint64) return np_hash(x\*mul $^ +$ offset) $\%$ mod $= =$ remainder return np_sampler
363
+ elif system $= =$ 'tf': tf_hash $=$ hash_uint64_builder('tf') def tf_filter(idx, _): return tf.equal(tf_hash(idx\*mul $^ +$ offset) % mod, remainder) return tf_filter
364
+ raise KeyError(f'Unknown system: {system}')
365
+
366
+ def hash_uint64_builder(system): """Build a hash function in tf/np for uint64.""" if system $\ d = \ d \cdot \mathsf { n p } ^ { \prime }$ : uint64_cast $=$ functools.partial(np.array, dtype=np.uint64) op_xor $=$ operator.xor op_rshift $=$ operator.rshift elif system $= =$ 'tf': uint64_cast $=$ functools.partial(tf.cast, dtype=tf.uint64) op_xor $=$ tf.bitwise.bitwise_xor op_rshift $=$ tf.bitwise.right_shift else: raise KeyError(f'Unknown system: {system}')
367
+
368
+ # https://stackoverflow.com/questions/664014/
369
+ # what-integer-hash-function-are-good-that-accepts-an-integer-hash-key
370
+ def hash_uint64(x): $\times \ =$ uint64_cast(x) $\times \ =$ op_xor(x, op_rshift(x, 30)) $\star$ uint64_cast(0xbf58476d1ce4e5b9) $\times \ =$ op_xor(x, op_rshift(x, 27)) $\star$ uint64_cast(0x94d049bb133111eb) x = op_xor(x, op_rshift(x, 31)) return x
371
+
372
+ return hash_uint64
373
+
374
+ In Figure 11, we compare our hash-based subset sampler with numpy.random.choice(N, size=n, replace $=$ False). The leftmost section of the figure shows that the sampling procedure always samples close to $n$ points, with a small variance. The middle section plots a histogram of the empirical fraction of total models that each point appears in. Note that, because we use $r = 0 . 2 5$ , this fraction should be 0.25 on average, although, because we only use 400 models, each value will not be identically 0.25. We find that our hash-based sampler produces probabilities which are highly consistent with those produced by numpy.random.choice. We also measure the pairwise independence of the hash-based sampler, measuring the probability that two different training points $x _ { 1 } , x _ { 2 }$ appear both IN or OUT of a model’s training set. We expect this value to be 0.625 $( = r ^ { 2 } + ( 1 - r ) ^ { 2 } )$ . We plot this in the right portion of the figure, demonstrating that the independence of our hash-based sampler is very similar to numpy.random.choice.
375
+
376
+ ![](images/00cf755c7af408fecad9c6d916b6e647c3adff772c3243a84b0fa854d165c877.jpg)
377
+ Figure 12: Comparison of directly using the per-token-accuracy vs. taking the logit of the per-tokenaccuracy. Top row: logit(per-token-accuracy). Bottom row: per-token-accuracy. Figures exactly the same as Figure 5.
378
+
379
+ # H Alternative Memorization Metrics with Logit Scaling
380
+
381
+ We defined the counterfactual memorization in (1) with a generic performance measure $M$ . Throughout the paper, we define $M$ as per-token accuracy–the fraction of the times the model assigns the highest score to the true next token in the sequence. The finite value range could cause unnecessary compression for values near the interval boundary. As a result, the resolution of memorization estimation is lower for models with very high or very low performance. To mitigate this issue, we explore an alternative measure by taking the logit on the per-token accuracy [Carlini et al., 2021]. The logit function maps to $( - \infty , \infty )$ before aggregating across independently trained models. Figure 12 compares the scatter plots of average performance on IN / OUT models measured by the logit scaled per-token accuracy and the raw per-token accuracy. Comparing to the raw per-token accuracy, the scatter plots generated with the logit scaled measure are no longer artificially constrained to be a triangular shape. As a result, the memorization estimation, which is proportional to the distance to the diagonal line, has a higher resolution on the two ends (lower left and upper right) than the unscaled version.
382
+
383
+ Note there is no absolutely right or wrong measure. While the scaled version has better resolution on the two ends, the advantage of the unscaled version is that the value range [0, 1] makes it straightforward to interpret the numerical values of counterfactual memorization. Since the consistency between the two versions are high (Spearman’s $\rho$ correlation between the two versions are $0 . 9 4 7 \mathrm { ~ / ~ } 0 . 9 0 3 \mathrm { ~ / ~ }$ 0.944 on RealNews/ C4/ Wiki40B:en), we use the unscaled version throughout the paper for easier interpretation.
384
+
385
+ # I Definition of Edit Similarity
386
+
387
+ We define the edit similarity between two sequences $x _ { i }$ and $x _ { j }$ as. In our case, we use token-level similarity.
388
+
389
+ $$
390
+ \mathrm { E d i t S i m } ( x _ { i } , x _ { j } ) = 1 - { \frac { \mathrm { E d i t D i s t a n c e } ( x _ { i } , x _ { j } ) } { \operatorname* { m a x } ( | x _ { i } | , | x _ { j } | ) } }
391
+ $$
392
+
393
+ Table 3: Pairs of RealNews training examples and Grover generations sampled at several influence levels. “link” contains the document URL. [...] indicate text omitted for brevity. Differences in each pair are highlighted.
394
+
395
+ <table><tr><td></td><td rowspan=1 colspan=15>Index Estim. Text</td></tr><tr><td></td><td rowspan=5 colspan=15>Generation infl linkBakubaAridlateofUdostbaatsa91361 0.1805 manats,espeielyrileloeatesofbjatstodrsccdgtoatafrCtalBankof AzerbaijanforAprilI5.0OJapaneseyen10JPY1.51871NewZealanddollar1NZD1.1513FollowTrendonTelegram.Onlymost interesting and important newsTrain mem linkBakbacdgateofUdgtAbjmawasseatd2072973 0.3534 manats,respeelyfarch5.loeatesofbjagstordecodgtoatafroCalBank of AzerbaijanforMarch15.[Japaneseyen1JY5221NewZealanddolla1NZD11636FollowTendonTelegram.Onlymost interesting and important news</td></tr><tr><td></td><td rowspan=1 colspan=2>1361</td></tr><tr><td></td><td rowspan=1 colspan=1></td></tr><tr><td></td><td rowspan=1 colspan=5>manats,respec</td><td rowspan=1 colspan=2>bectively</td></tr><tr><td></td><td rowspan=1 colspan=2>nkofA</td><td rowspan=1 colspan=4>Azerbaijanfor</td></tr><tr><td></td><td rowspan=3 colspan=15>Generation infl link &gt; NEW DELHI: India is likely to see average monsoon rains this year.thestate-runvweather office said on Monday, which should support21998 0.0218 agriculturalpodctiodoocothisia’sdigooealffadcstioslis</td></tr><tr><td></td></tr><tr><td></td><td rowspan=1 colspan=1></td></tr><tr><td></td><td rowspan=6 colspan=14>expectedtob96petofteogteaverage,M.jeeanetaryatteistryofarthiencstoldcofereeIndiaMeterolicaepnt(sagalifallte96ped4tf89 centimeters for the entire four-month season beginning June. [..]However,onaveraeteIasforeastaccratelyolyoeeveriveyearsovertepasttdeades,venaftertingcctanerror band of plus or minus 5 percentage points.</td><td rowspan=1 colspan=1>retaryat theMinistry of E</td></tr><tr><td></td><td rowspan=2 colspan=1>allasbety</td></tr><tr><td></td><td rowspan=1 colspan=1>he Ministry of Earth Sci</td></tr><tr><td></td><td rowspan=1 colspan=1>ndia's</td></tr><tr><td></td><td rowspan=2 colspan=8>error band of plus or minus 5 percentage points.</td><td rowspan=1 colspan=2>Dhas</td><td rowspan=2 colspan=2>as forecast</td><td rowspan=2 colspan=1>east accurately only once every five y</td></tr><tr><td></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=5 colspan=3>Train326212</td><td rowspan=1 colspan=2>Train326212</td><td rowspan=1 colspan=3>mem0.1555</td><td rowspan=1 colspan=7>higherfarmand</td><td rowspan=1 colspan=1>rs)-In</td></tr><tr><td rowspan=4 colspan=2></td><td rowspan=1 colspan=3>thecountry</td><td rowspan=1 colspan=8>ry's$2trillioneconomy.areexpected</td><td rowspan=1 colspan=1>be97p</td></tr><tr><td rowspan=1 colspan=11>Meteorological Department (IMD), told a newsconference.“We see very less probability of a deficit monsoon,&quot; Ramesh said on Monday.Otherthanliftingfarmandiderconomicgrowth,aspellofgoodrainswillkeepalidonifation,potentillytmptingPrieisterNarendraoditiadgeeaetisueiy9.a’sathofsageoalfalle96</td><td rowspan=1 colspan=1>“We see very less probability of a deficit monsoon,&quot; Ramesh said on Monday.Otherthanliftingfarmandiderconomicgrowth,aspellofgoodrainswillkeepalidonifation,potentillytmptingPrieister</td></tr><tr><td rowspan=1 colspan=11>percentand104percentofyearaverageof89forthentiefour-mothseasonbegiingJne.saidaumbabaseddealerwit</td></tr><tr><td rowspan=1 colspan=11>a global trading firm. Average monsoon rainfallwill help India retain its position as the world&#x27;s top rice exporter</td></tr></table>
396
+
397
+ # J Examples of Train-Generation Pairs at Different Influence Ranges
398
+
399
+ In table 3, we show examples of train-generation pairs sampled from different influence ranges. The patterns generally follow the train-validation pairs shown in table 2, although many of the relations are due to some form of templating.
400
+
401
+ # K Examples Sampled at Different Level of Memorization
402
+
403
+ Figure 13, Figure 14, and Figure 15 show full examples from RealNews sampled at high, middle and low memorization value ranges, respectively. Similarly, Figure 16, Figure 17, and Figure 18 show examples from C4 sampled at high, middle and low memorization value ranges, respectively. Figure 19, Figure 20, and Figure 21 show examples from Wiki40B:en sampled at high, middle and low memorization value ranges, respectively.
404
+
405
+ # L Example Pairs Sampled at Different Level of Influence
406
+
407
+ Figure 22, Figure 23, Figure 24, Figure 25, and Figure 26 show train-validation example pairs from RealNews sampled from high to low influence ranges. For each pair, we show the validation set example first, and then show the corresponding training example with a difflib generated visualization of textual difference with the training example.
408
+
409
+ Similarly, Figure 27 and Figure 28 show train-validation example pairs from C4, and Figure 29 and Figure 30 from Wiki40B:en.
410
+
411
+ We also show train-generation influence pairs between RealNews training set and Grover [Zellers et al., 2019] model generation in Figure 31, Figure 32, and Figure 33.
412
+
413
+ ![](images/3e98a504239303633259ae2726cf637d22d5a9c3fb73f5bd59d2b4f74ea1ada3.jpg)
414
+ Figure 13: Text examples from RealNews with high memorization.
415
+
416
+ ![](images/f3b006d769c93885b251e7e5ece29e11f1b704172fb044a00954cf3c4887a5a1.jpg)
417
+ Figure 14: Text examples from RealNews with intermediate memorization.
418
+
419
+ ![](images/8f1669c31a7e25d77a68b259c4b743aa2ca9a36b885ffc85b27868dc129f1e49.jpg)
420
+ Figure 15: Text examples from RealNews with low memorization.
421
+
422
+ ![](images/87cfe71d28ed75b985da996bee445a6785dc05a1809f03d6bfe75525a3aaacb2.jpg)
423
+ Figure 16: Text examples from C4 with high memorization.
424
+
425
+ ![](images/91acbf3f385ef39792f8b280af85bf44432c88cc4eb7a5930f4a2afae9f6dfca.jpg)
426
+ Figure 17: Text examples from C4 with intermediate memorization.
427
+
428
+ ![](images/96db1246403681b470df5c235accefed59c5a322d44b3ad39d60f31864d3eaea.jpg)
429
+ Figure 18: Text examples from C4 with low memorization.
430
+
431
+ ![](images/3507ef78f2af341deb7e9397c2c6f4340f7dd10736700556763f5bbdf4d8c793.jpg)
432
+ Figure 19: Text examples from Wiki40B:en with high memorization.
433
+
434
+ ![](images/6f705ab531b816359aade6c840d6bc6220b3122a95126a6ae9d2a5925a2d8e39.jpg)
435
+ Figure 20: Text examples from Wiki40B:en with intermediate memorization.
436
+
437
+ ![](images/e784888677573c59de4ecd5ad07da60df715a968d841bd3fcac1a54d20923860.jpg)
438
+ Figure 21: Text examples from Wiki40B:en with low memorization.
439
+
440
+ ![](images/f5cfb1c9b2a2fcaa7b4b6c7da50bb9e20e4a77b6f6092bccbf38bc6611834532.jpg)
441
+ Figure 22: Validation / training example pair from RealNews with high influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
442
+
443
+ ![](images/26f0cd48bd3707d2a1559aca77bc3ca50392393fb6b2c1190bf88c9e82df0b2e.jpg)
444
+ Figure 23: Validation / training example pair from RealNews with relatively high influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
445
+
446
+ ![](images/ae5dea3ca2a4eef4181955b3c448f0e986fe9462c7f39b18f50fb1466c71234c.jpg)
447
+ Figure 24: Validation / training example pair from RealNews with intermediate influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
448
+
449
+ ![](images/4743eca348c156e6a0d5f6f950c48b9f61b3d5b47f5dccde2f9d874fa10928d9.jpg)
450
+ Figure 25: Validation / training example pair from RealNews with relatively low influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
451
+
452
+ ![](images/b5049aea6f12480aa341e3c9abc2b0d01dceb07a8f9d5f09d28589861a12dee6.jpg)
453
+ Figure 26: Validation / training example pair from RealNews with low influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
454
+
455
+ ![](images/6e770c815a7158399732a34331844be96f8307aa761dfd12146d3a74c3f49f60.jpg)
456
+ Figure 27: Validation / training example pair from C4 with high to intermediate influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
457
+
458
+ ![](images/322b03767ce1c7b018f0e7174f5c06f87d3274603439cbb73f765b4af7416b7e.jpg)
459
+ Figure 28: Validation / training example pair from C4 with intermediate to low influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
460
+
461
+ ![](images/35c140262eb79535e76098788241bc56e6ea44bea2076364c76627c75da14b9e.jpg)
462
+ Figure 29: Validation / training example pair from Wiki40B:en with high to intermediate influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
463
+
464
+ ![](images/a1771e0ba0ddf480379135601ab3db3fa5646502c3204f14c5f6a755675e5827.jpg)
465
+ Figure 30: Validation / training example pair from Wiki40B:en with intermediate to low influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
466
+
467
+ ![](images/3c7724c877e2cfe21f44a53e761801b693f4d777e38a820b004df7581e1cdd0a.jpg)
468
+ Figure 31: Generated / training example pair from RealNews with high to intermediate influence. The generated examples are directly taken from publicly released generations of the Grover-Mega $\scriptstyle \left( \mathrm { p } = 0 . 9 6 \right)$ model [Zellers et al., 2019]. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
469
+
470
+ ![](images/f61ba1b916bd80c3e40b08fee4023b13c33665017f83c8915517f572ba09085d.jpg)
471
+ Figure 32: Generated / training example pair from RealNews with intermediate to low influence. The generated examples are directly taken from publicly released generations of the Grover-Mega $\scriptstyle \left( \mathrm { p } = 0 . 9 6 \right)$ model [Zellers et al., 2019]. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
472
+
473
+ ![](images/6a6cde1c2c77c754b71618a5e2cf9dfcef66af8b24a72ce6e228e6da09f039df.jpg)
474
+ Figure 33: Generated / training example pair from RealNews with low influence. The generated examples are directly taken from publicly released generations of the Grover-Mega $\scriptstyle ( \mathtt { p } = 0 . 9 6 )$ ) model [Zellers et al., 2019]. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
parse/dev/67o9UQgTD0/67o9UQgTD0_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/9EAQVEINuum/9EAQVEINuum.md ADDED
@@ -0,0 +1,414 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # OPTIMIZING BI-ENCODER FOR NAMED ENTITY RECOGNITION VIA CONTRASTIVE LEARNING
2
+
3
+ Sheng Zhang, Hao Cheng, Jianfeng Gao, and Hoifung Poon Microsoft Research
4
+
5
+ # ABSTRACT
6
+
7
+ We present a bi-encoder framework for named entity recognition (NER), which applies contrastive learning to map candidate text spans and entity types into the same vector representation space. Prior work predominantly approaches NER as sequence labeling or span classification. We instead frame NER as a representation learning problem that maximizes the similarity between the vector representations of an entity mention and its type. This makes it easy to handle nested and flat NER alike, and can better leverage noisy self-supervision signals. A major challenge to this bi-encoder formulation for NER lies in separating non-entity spans from entity mentions. Instead of explicitly labeling all non-entity spans as the same class Outside (O) as in most prior methods, we introduce a novel dynamic thresholding loss, learned in conjunction with the standard contrastive loss. Experiments show that our method performs well in both supervised and distantly supervised settings, for nested and flat NER alike, establishing new state of the art across standard datasets in the general domain (e.g., ACE2004, ACE2005, CoNLL2003) and high-value verticals such as biomedicine (e.g., GENIA, NCBI, BC5CDR, JNLPBA). We release the code at github.com/microsoft/binder.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Named entity recognition (NER) is the task of identifying text spans associated with named entities and classifying them into a predefined set of entity types such as person, location, etc. As a fundamental component in information extraction systems (Nadeau & Sekine, 2007), NER has been shown to be of benefit to various downstream tasks such as relation extraction (Mintz et al., 2009), coreference resolution (Chang et al., 2013), and fine-grained opinion mining (Choi et al., 2006).
12
+
13
+ Inspired by recent success in open-domain question answering (Karpukhin et al., 2020) and entity linking (Wu et al., 2020; Zhang et al., 2021a), we propose an efficient BI-encoder for NameD Entity Recognition (BINDER). Our model employs two encoders to separately map text and entity types into the same vector space, and it is able to reuse the vector representations of text for different entity types (or vice versa), resulting in a faster training and inference speed. Based on the bi-encoder representations, we propose a unified contrastive learning framework for NER, which enables us to overcome the limitations of popular NER formulations (shown in Figure 1), such as difficulty in handling nested NER with sequence labeling (Chiu & Nichols, 2016; Ma & Hovy, 2016), complex learning and inference for span-based classification (Yu et al., 2020; Fu et al., 2021), and challenges in learning with noisy supervision (Strakova et al., 2019; Yan et al., 2021). ´ 1 Through contrastive learning, we encourage the representation of entity types to be similar with the corresponding entity spans, and to be dissimilar with that of other text spans. Additionally, existing work labels all nonentity tokens or spans as the same class Outside (O), which can introduce false negatives when the training data is partially annotated (Das et al., 2022; Aly et al., 2021). We instead introduce a novel dynamic thresholding loss in contrastive learning, which learns candidate-specific dynamic thresholds to distinguish entity spans from non-entity ones.
14
+
15
+ To the best of our knowledge, we are the first to optimize bi-encoder for NER via contrastive learning. We conduct extensive experiments to evaluate our method in both supervised and distantly supervised settings. Experiments demonstrate that our method achieves the state of the art on a wide range of NER datasets, covering both general and biomedical domains. In supervised NER, compared to the previous best results, our method obtains a $2 . 4 \% - 2 . 9 \%$ absolute improvement in F1 on standard nested NER datasets such as ACE2004 and ACE2005, and a $1 . 2 \% - 1 . 9 \%$ absolute improvement on standard flat NER datasets such as BC5-chem, BC5-disease, and NCBI. In distantly supervised NER, our method obtains a $1 . 5 \%$ absolute improvement in F1 on the BC5CDR dataset. We further study the impact of various choices of components in our method, and conduct breakdown analysis at entity type level and token level, which reveals potential growth opportunities.
16
+
17
+ ![](images/013d66c08200cd53ad767dd76a6209f82330d02f3794c9703f7feb0cfca94f26.jpg)
18
+ Figure 1: Left: The architecture of BINDER. The entity type and text encoder are isomorphic and fully decoupled Transformer models. In the vector space, the anchor point $( \bigcirc )$ represents the special token [CLS] from the entity type encoder. Through contrastive learning, we maximize the similarity between the anchor and the positive token ( Jim), and minimize the similarity between the anchor and negative tokens. The dotted gray circle (delimited by the similarity between the anchor and $\operatorname { O } [ \operatorname { C L S } ]$ from the text encoder) represents a threshold that separates entity tokens from non-entity tokens. To reduce clutter, data points that represent possible spans from the input text are not shown. Right: We compare BINDER with existing solutions for NER on three dimensions: 1) whether it can be applied to nested NER without special handling; 2) whether it can be trained using noisy supervision without special handling; 3) whether it has a fast training and inference speed.
19
+
20
+ ![](images/f570d705a5d2f1509c6f4a7c55afe25a8f04b94656ccf7258ad3e9f9fa47fd81.jpg)
21
+
22
+ # 2 METHOD
23
+
24
+ In this section, we present the design of BINDER, a novel architecture for NER tasks. As our model is built upon a bi-encoder framework, we first provide the necessary background for encoding both entity types and text using the Transformer-based (Vaswani et al., 2017) bi-encoder. Then, we discuss our ways of deriving entity type and individual mention span representations using the embedding output from the bi-encoder. Based on that, we introduce two types of contrastive learning objectives for NER using the token and span-level similarity respectively.
25
+
26
+ # 2.1 BI-ENCODER FOR NER
27
+
28
+ The overall architecture of BINDER is shown in Figure 1. Our model is built upon a bi-encoder architecture which has been mostly explored for dense retrieval (Karpukhin et al., 2020). Following the recent work, our bi-encoder also consists of two isomorphic and fully decoupled Transformer models (Vaswani et al., 2017), i.e. an entity type encoder and a text encoder. For NER tasks, we consider two types of inputs, entity type descriptions and text to detect named entities. At the high level, the entity type encoder produces type representations for each entity of interests (e.g. person in Figure 1) and the text encoder outputs representations for each input token in the given text where named entities are potentially mentioned (e.g. Jim in Figure 1). Then, we enumerate all span candidates based on corresponding token representations and match them with each entity type in the vector space. As shown in Figure 1, we maximize the similarity between the entity type and the positive spans, and minimize the similarity of negative spans.
29
+
30
+ We first formally discuss encoding both inputs using a pretrained Transformer model, BERT (Devlin et al., 2019).2 Specifically, we use $x _ { 1 } , \ldots , x _ { N }$ to denote an input sequence of length $N$ . When using BERT, there is a prepended token [CLS] and an appended token [SEP]for all input sequences, i.e. [CLS], $x _ { 1 } , \ldots , x _ { N }$ [SEP]. Then the output is a sequence of hidden states $\mathbf { h } _ { [ \mathbb { C L S } ] } , \mathbf { h } _ { 1 } , \dots , \mathbf { h } _ { N } , \mathbf { h } _ { [ \mathbb { S E P } ] } \in \mathbb { R } ^ { d }$ from the last BERT layer for each input token, where $d$ is the hidden dimension. Note that as [CLS]is always in the beginning, $\mathbf { h } _ { 0 }$ and $\mathbf { h } _ { \left[ \mathrm { C L S } \right] }$ are interchangeable here. Based on this, we then discuss the way of computing entity type and text token embeddings, which are the basic building blocks for deriving our NER constrative learning objectives later.
31
+
32
+ Entity Type Embeddings The goal of entity type encoder is to produce entity type embeddings that serve as anchors in the vector space for contrastive learning. In this work, we focus on a predefined set of entity types $\mathcal { E } = \{ E _ { 1 } , \ldots , E _ { K } \}$ , where each entity type has one or multiple natural language descriptions. The natural language description can be formal textual definitions based on the dataset annotation guideline or Wikipedia, and prototypical instances where a target type of named entities are mentioned. For simplicity, the discussion proceeds with one description per type and we use $E _ { k }$ to denote a sequence of tokens for the $k$ -th entity type description. For a given entity type $E _ { k }$ , we use BERT as the entity type encoder $( \mathrm { B E R T } ^ { E \setminus } ,$ ) and add an additional linear projection to compute corresponding entity type embeddings in the following way:
33
+
34
+ $$
35
+ \begin{array} { r l } & { { \bf { h } } _ { [ \mathbb { C } \mathrm { L S } ] } ^ { E _ { k } } = { \tt B E R T } ^ { E } ( E _ { k } ) , } \\ & { { \bf { e } } _ { k } = { \tt L i n e a r } ^ { E } ( { \bf { h } } _ { [ \mathbb { C } \mathrm { L S } ] } ^ { E _ { k } } ) , } \end{array}
36
+ $$
37
+
38
+ where Linear is a learnable linear layer and $\mathbf { e } _ { k } \in \mathbb { R } ^ { d }$ is the vector representation for $E _ { k }$
39
+
40
+ Text Token Embeddings Instead of using [CLS]embeddings as done in the recent bi-encoder work for entity retrieval (Wu et al., 2020), we consider using text token embeddings as the basic unit for computing similarity with entity span embeddings. As there are multiple potential named entities not known as a prior in the input, naively using special markers (Wu et al., 2020) incurs huge computation overhead for NER. Similar to the entity type embeddings, we again use BERT as the text encoder (BERTT ) and simply use the final hidden states as the basic text token representations3,
41
+
42
+ $$
43
+ \mathbf { h } _ { 1 } ^ { T } , \ldots , \mathbf { h } _ { N } ^ { T } = \mathtt { B E R T } ^ { T } \big ( x _ { 1 } , \ldots , x _ { N } \big ) .
44
+ $$
45
+
46
+ # 2.2 CONTRASTIVE LEARNING FOR NER
47
+
48
+ Based on the entity type embeddings and text token embeddings discussed above, we then introduce two different contrastive learning objectives for NER in this part. Here, we assume a span $( i , j )$ is a contiguous sequence of tokens in the input text with a start token in position $i$ and an end token in position $j$ . Throughout this work, we use the similarity function, $\begin{array} { r } { s \mathrm { i m } ( \cdot , \cdot ) = \frac { \cos ( \cdot , \cdot ) } { \tau } } \end{array}$ cos(·,·) , where τ is a scalar parameter.
49
+
50
+ As shown in Figure 1, the overall goal of NER constrastive learning is to push the entity mention span representations close to their corresponding entity type embeddings (positive) and far away from irrelevant types (negative) in vector space, e.g. Person closer to $\ J \ i \mathrm { m }$ but away from Acme. To achieve that, we propose a multi-objective formulation consisting of two objectives based on span and token embedding spaces respectively.
51
+
52
+ Span-based Objective We derive the vector representation for span $( i , j )$ as below:
53
+
54
+ $$
55
+ \mathsf { \mathbf { s } } _ { i , j } = \mathtt { L i n e a r } ^ { S } ( \mathbf { h } _ { i } ^ { T } \oplus \mathbf { h } _ { j } ^ { T } \oplus D ( j - i ) ) ,
56
+ $$
57
+
58
+ where $\mathbf { h } _ { i } ^ { T } , \mathbf { h } _ { j } ^ { T }$ are text token embeddings (Equation 3), $\mathbf { s } _ { i , j } \in \mathbb { R } ^ { d }$ , LinearS is a learnable linear layer, $\oplus$ indicates the vector concatenation, $D ( j - i ) \in \mathbb { R } ^ { m }$ is the $( j - i )$ -th row of a learnable span width embedding matrix $D \in \mathbb { R } ^ { N \times m }$ . Based on this, the span-based infoNCE (Oord et al., 2018) can be defined as
59
+
60
+ $$
61
+ \ell _ { \mathrm { s p a n } } = - \log \frac { \exp ( \sin ( \mathbf { s } _ { i , j } , \mathbf { e } _ { k } ) ) } { \sum _ { \mathbf { s } ^ { \prime } \in \mathcal { S } _ { k } ^ { - } \cup \mathbf { s } _ { i , j } } \exp ( \sin ( \mathbf { s } ^ { \prime } , \mathbf { e } _ { k } ) ) } ,
62
+ $$
63
+
64
+ where the span $( i , j )$ belongs to entity type $E _ { k }$ , $S _ { k } ^ { - }$ is the set of negative spans that are all possible spans from the input text, excluding entity spans from $E _ { k }$ , and $\mathbf { e } _ { k }$ is the entity type embedding.
65
+
66
+ Position-based Objective One limitation of the span-based objective is that it penalizes all negative spans in the same way, even if they are partially correct spans, e.g., spans that have the same start or end token with the gold entity span. Intuitively, it is more desirable to predict partially correct spans than completely wrong spans. Therefore, we propose additional position-based contrastive learning objectives. Specby using additional linear layers, ddings , where $E _ { k }$ $e _ { k } ^ { \mathrm { B } } = \mathtt { L i n e a r } _ { B } ^ { E } ( \mathbf { h } _ { \scriptscriptstyle { [ \mathrm { C L S } ] } } ^ { E _ { k } } ) , e _ { k } ^ { \mathrm { Q } } = \mathtt { L i n e a r } _ { Q } ^ { E } ( \mathbf { h } _ { \scriptscriptstyle { [ \mathrm { C L S } ] } } ^ { E _ { k } } )$ $e _ { k } ^ { \tt B } , e _ { k } ^ { \tt Q }$ are the type embeddings for the start and end positions respectively, $\mathbf { h } _ { [ \mathbb { C } \mathrm { L } S ] } ^ { E _ { k } }$ is from the entity type encoder (Equation 1). Accordingly, we can use two addtional linear layers to compute the corresponding token embeddings for the start and end tokens respectively, $\mathbf u _ { n } = \mathtt { L i n e a r } _ { B } ^ { \mathrm { - } } ( \mathbf h _ { n } ^ { T } ) , \mathbf v _ { n } =$ Linea $\underline { { \boldsymbol { r } } } _ { Q } ^ { T } ( \mathbf { h } _ { n } ^ { T } )$ , where $\mathbf { h } _ { n } ^ { T }$ is the text token embeddings (Equation 3). Using $e _ { \mathbf { B } } ^ { k } , e _ { \mathbf { Q } } ^ { k }$ as anchors, we then define two position-based objectives via contrastive learning:
67
+
68
+ $$
69
+ \begin{array} { r l } & { \ell _ { \mathrm { s t a r t } } = - \log \frac { \exp ( \sin ( \mathbf { u } _ { i } , \mathbf { e } _ { k } ^ { \mathrm { B } } ) ) } { \sum _ { \mathbf { u } ^ { \prime } \in \mathcal { U } _ { k } ^ { - } \cup \mathbf { u } _ { i } } \exp ( \sin ( \mathbf { u } ^ { \prime } , \mathbf { e } _ { k } ^ { \mathrm { B } } ) ) } } \\ & { \ell _ { \mathrm { e n d } } = - \log \frac { \exp ( \sin ( \mathbf { v } _ { j } , \mathbf { e } _ { k } ^ { \mathrm { Q } } ) ) } { \sum _ { \mathbf { v } ^ { \prime } \in \mathcal { V } _ { k } ^ { - } \cup \mathbf { v } _ { j } } \exp ( \sin ( \mathbf { v } ^ { \prime } , \mathbf { e } _ { k } ^ { \mathrm { Q } } ) ) } , } \end{array}
70
+ $$
71
+
72
+ where $\mathcal { U } _ { k } ^ { - } , \mathcal { V } _ { k } ^ { - }$ are two sets of positions in the input text that do not belong to the start/end of any span of entity type $k$ . Compared with Equation 5, the main difference of position-based objectives comes from the corresponding negative sets where start and end positions are independent of each other. In other words, the position-based objectives can potentially help the model to make better start and end position predictions.
73
+
74
+ Thresholding for Non-Entity Cases Although the contrastive learning objectives defined above can effectively push the positive spans close to their corresponding entity type in vector space, it might be problematic for our model at test time to decide how close a span should be before it can be predicted as positive. In other words, the model is not able to separate entity spans from nonentity spans properly. To address this issue, we use the similarity between the special token [CLS] and the entity type as a dynamic threshold (as shown in Figure 1). Intuitively, the representation of [CLS] reads the entire input text and summarizes the contextual information, which could make it a good choice to estimate the threshold to separate entity spans from non-entity spans. We compare it with several other thresholding choices in $\ S 4$ .
75
+
76
+ To learn thresholding, we extend the original contrastive learning objectives with extra adaptive learning objectives for non-entity cases. Specifically, for the start loss (Equation 6), the augmented start loss $\ell _ { \mathrm { s t a r t } } ^ { + }$ is defined as
77
+
78
+ $$
79
+ \ell _ { \mathrm { s t a r t } } ^ { + } = \beta \ell _ { \mathrm { s t a r t } } - ( 1 - \beta ) \log \frac { \exp ( \sin ( \mathbf { u } _ { \scriptscriptstyle { \left[ \mathrm { C L S } \right] } } , \mathbf { e } _ { k } ^ { \mathrm { B } } ) ) } { \sum _ { \mathbf { u } ^ { \prime } \in \mathcal { U } _ { k } ^ { - } \exp ( \sin ( \mathbf { u } ^ { \prime } , \mathbf { e } _ { k } ^ { \mathrm { B } } ) ) } } .
80
+ $$
81
+
82
+ An augmented end loss use the span embedding $\ell _ { \mathrm { e n d } } ^ { + }$ can be defined in a similar fashion. Ffor deriving the augmented span loss span loss (Equation 5), we $\mathbf { s } _ { 0 , 0 }$ $\ell _ { \tt s p a n } ^ { + }$
83
+
84
+ $$
85
+ \ell _ { \mathrm { s p a n } } ^ { + } = \beta \ell _ { \mathrm { s p a n } } - ( 1 - \beta ) \log \frac { \exp ( \sin ( \mathbf { s } _ { 0 , 0 } , \mathbf { e } _ { k } ) ) } { \sum _ { \mathbf { s } ^ { \prime } \in S _ { k } ^ { - } } \exp ( \sin ( \mathbf { s } ^ { \prime } , \mathbf { e } _ { k } ) ) } .
86
+ $$
87
+
88
+ Note that we use a single scalar hyperparameter $\beta$ for balancing the adaptive thresholding learning and original contrastive learning for all three cases.
89
+
90
+ Training Finally, we consider a multi-task contrastive formulation by combing three augmented contrastive learning discussed above, leading to our overall training objective
91
+
92
+ $$
93
+ \mathcal { L } = \alpha \ell _ { \mathrm { s t a r t } } ^ { + } + \gamma \ell _ { \mathrm { e n d } } ^ { + } + \lambda \ell _ { \mathrm { s p a n } } ^ { + } ,
94
+ $$
95
+
96
+ where $\alpha , \gamma , \lambda$ are all scalar hyperparameters.
97
+
98
+ Inference Strategy During inference, we enumerate all possible spans that are less than the length of $L$ and compute three similarity scores based on the start/end/span cases for each entity type. We consider two prediction strategies, joint position-span and span-only predictions. In the joint position-span case, for entity type $E _ { k }$ , we prune out spans $( i , j )$ that have either start or end similar scores lower than the learned threshold, i.e. $\mathrm { s i m } ( \mathbf { u } _ { i } , \mathbf { e } _ { k } ^ { \mathrm { B } } ) \ < \ \mathrm { s i m } ( \mathbf { u } _ { \mathrm { [ C L S ] } } , \mathbf { e } _ { k } ^ { \mathrm { B } } )$ or $\sin ( \mathbf { v } _ { j } , \mathbf { e } _ { k } ^ { \mathrm { Q } } ) < \sin ( \mathbf { v } _ { [ \mathtt { C L S } ] } , \mathbf { e } _ { k } ^ { \mathrm { Q } } )$ . Then, only those spans with span similarity scores higher than the span threshold are predicted as positive ones i.e. $\sin ( \mathbf { s } _ { i , j } , \mathbf { e } _ { k } ) > \sin ( \mathbf { s } _ { 0 , 0 } , \mathbf { e } _ { k } )$ . For the span-only strategy, we just rely on the span similarity score and keep all qualified spans as final predictions. As shown later in our experiments $( \ S 4 )$ , we find the span-only inference is more effective, because the joint inference is more likely to be affected by annotation artifacts. The full inference algorithm is summarized in Appendix A.5.
99
+
100
+ # 3 EXPERIMENTS
101
+
102
+ We evaluate our method in both supervised and distantly supervised settings. The implementation details of our method are described in Appendix A.4
103
+
104
+ Evaluation Metrics We follow the standard evaluation protocol and use micro F1: a predicted entity span is considered correct if its span boundaries and the predicted entity type are both correct.
105
+
106
+ Datasets In the supervised setting, we evaluate our method on both nested and flat NER. For nested NER, we consider ACE2004, ACE2005, and GENIA (Kim et al., 2003). ACE2004 and ACE2005 are collected from general domains (e.g., news and web). We follow Luan et al. (2018) to split ACE2004 into 5 folds, and ACE2005 into train, development and test sets. GENIA is from the biomedical domain. We use its v3.0.2 corpus and follow Finkel & Manning (2009) and Lu & Roth (2015) to split it into $8 0 \% / 1 0 \% / 1 0 \%$ train/dev/test splits. For flat NER, we consider CoNLL2003 (Tjong Kim Sang & De Meulder, 2003) as well as five biomedical NER datasets from the BLURB benchmark (Gu et al., 2021): BC5-chem/disease (Li et al., 2016), NCBI (Dogan et al., ˘ 2014), BC2GM (Smith et al., 2008), and JNLPBA (Collier & Kim, 2004). Preprocessing and splits follow Gu et al. (2021). Appendix A.6 reports the dataset statistics.
107
+
108
+ In the distantly supervised setting, we consider BC5CDR (Li et al., 2016). It consists of 1,500 articles annotated with 15,935 chemical and 12,852 disease mentions. We use the standard train, development, and test splits. In the train and development sets, we discard all human annotations and only keep the unlabeled articles. Their distant labels are generated using exact string matching against a dictionary released by Shang et al. (2018).4 On the training set, the distant labels have high precision $( 9 7 . 9 9 \%$ for chemicals, and $9 8 . 3 4 \%$ for diseases), but low recall $6 3 . 1 4 \%$ for chemicals, and $4 6 . 7 3 \%$ for diseases).
109
+
110
+ Supervised NER Results Table 1 presents the comparison of our method with all previous methods evaluated on three nested NER datasets, ACE2004, ACE2005, and GENIA. We report precision, recall, and F1. As is shown, our method achieves the state of the art performance on all three datasets. On ACE2004 and ACE2005, it outperforms all previous methods with $8 9 . 7 \%$ and $9 0 . 0 \%$ F1. Particularly, in comparison with the previous best method (Tan et al., 2021), our method significantly improves F1 by the absolute points of $+ 2 . 4 \%$ and $+ 2 . 9 \%$ respectively. On GENIA, our method advances the previous state of the art (Yu et al., 2020) by $+ 0 . 3 \%$ F1. Note that the previous methods are built on top of different encoders, e.g., LSTM, BERT-large, BART-large, and T5-base. We also report our method using a BERT-base encoder, which even outperforms the previous methods that use a larger encoder of BERT-large (Tan et al., 2021) or BART-large (Yan et al., 2021). Overall, our method has substantial gains over the previous methods. Due to the space limit, we report the result on CoNLL03 and compare with prompt-based NER and span-based NER in Appendix A.1 and A.2.
111
+
112
+ Table 2 compares our method with all previous submissions on the BLURB benchmark. We only report F1 due to unavailability of precision and recall of these submissions. The major difference among these submissions are encoders. A direct comparison can be made between our method and Gu et al. (2021) which formulates NER as a sequential labeling task and fine-tunes a standard $\mathrm { L S T M + C R F }$ classifier on top of the pretrained transformer encoder. While both using PubMedBERT as the encoder, our method significantly outperforms Gu et al. (2021) across the board. Compared to the previous best submissions (Kanakarajan et al., 2021; Yasunaga et al., 2022), our method also show substantial gains on BC5-chem $( + 1 . 2 \% )$ , BC5-disease $( + 1 . 9 \% )$ , and NCBI $( 1 . 5 \% )$ .
113
+
114
+ Table 1: Test scores on three nested NER datasets. Bold-and-underline, bold-only and underline-only indicate the best, the second best, and the third best respectively. The different encoders are used: $\mathrm { L } = \mathrm { L S T M }$ , $\mathbf { B l } =$ BERT-large, BioB $=$ BioBERT, BioBl $=$ BioBERT-large, $\mathbf { B A l = }$ BART-large, $\mathrm { T } 5 \mathrm { b } = \mathrm { T } 5$ -base, $\mathbf { B } \mathbf { b } =$ BERT-base. $\dagger$ Original scores of Li et al. (2020) are not reproducible. Like Yan et al. (2021), we report the rerun of their released code.
115
+
116
+ <table><tr><td rowspan="2"></td><td rowspan="2">Encoder</td><td colspan="3">ACE2004</td><td colspan="3">ACE2005</td><td colspan="3">GENIA</td></tr><tr><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td></tr><tr><td>Lu &amp; Roth (2015)</td><td>-</td><td>70.0</td><td>56.9</td><td>62.8</td><td>66.3</td><td>59.2</td><td>62.5</td><td>74.2</td><td>66.7</td><td>70.3</td></tr><tr><td>Katiyar &amp; Cardie (2018)</td><td>L</td><td>73.6</td><td>71.8</td><td>72.7</td><td>70.6</td><td>70.4</td><td>70.5</td><td>77.7</td><td>71.8</td><td>74.6</td></tr><tr><td>Shibuya &amp; Hovy (2020)</td><td>B1</td><td>83.7</td><td>81.9</td><td>82.8</td><td>83.0</td><td>82.4</td><td>82.7</td><td>78.1</td><td>76.5</td><td>77.3</td></tr><tr><td>Wang et al. (2020)</td><td>Bl/BioB</td><td>86.1</td><td>86.5</td><td>86.3</td><td>84.0</td><td>85.4</td><td>84.7</td><td>79.5</td><td>78.9</td><td>79.2</td></tr><tr><td>Li et al. (2020)t</td><td>Bl/BioB</td><td>85.8</td><td>85.8</td><td>85.8</td><td>85.0</td><td>84.1</td><td>84.6</td><td>81.2</td><td>76.4</td><td>78.7</td></tr><tr><td>Yu et al. (2020)</td><td>Bl/BioB</td><td>87.3</td><td>86.0</td><td>86.7</td><td>85.2</td><td>85.6</td><td>85.4</td><td>81.8</td><td>79.3</td><td>80.5</td></tr><tr><td>Tan et al. (2021)</td><td>Bl/BioB</td><td>88.5</td><td>86.1</td><td>87.3</td><td>87.5</td><td>86.6</td><td>87.1</td><td>82.3</td><td>78.7</td><td>80.4</td></tr><tr><td>Yan et al. (2021)</td><td>BAl</td><td>87.3</td><td>86.4</td><td>86.8</td><td>83.2</td><td>86.4</td><td>84.7</td><td>78.6</td><td>79.3</td><td>78.9</td></tr><tr><td>Zhang et al. (2022)</td><td>T5b</td><td>86.5</td><td>84.5</td><td>85.4</td><td>83.3</td><td>86.6</td><td>84.9</td><td>81.0</td><td>77.2</td><td>79.1</td></tr><tr><td>Wan et al. (2022)</td><td>Bb</td><td>86.7</td><td>85.9</td><td>86.3</td><td>84.4</td><td>85.9</td><td>85.1</td><td>77.9</td><td>80.7</td><td>79.3</td></tr><tr><td rowspan="2">BINDER (Ours)</td><td>Bb/BioB</td><td>88.3</td><td>89.1</td><td>88.7</td><td>89.1</td><td>89.8</td><td>89.5</td><td>81.5</td><td>79.6</td><td>80.5</td></tr><tr><td>Bl/BioBl</td><td>89.7</td><td>89.7</td><td>89.7</td><td>89.6</td><td>90.5</td><td>90.0</td><td>83.4</td><td>78.3</td><td>80.8</td></tr></table>
117
+
118
+ Table 2: Test F1 scores on five flat NER datasets from the BLURB benchmark (aka.ms/blurb). Bold and underline indicate the best and the second best respectively. All encoders use their base version.
119
+
120
+ <table><tr><td></td><td>Encoder</td><td>BC5-chem</td><td>BC5-disease</td><td>NCBI</td><td>BC2GM</td><td> JNLPBA</td></tr><tr><td>Lee et al. (2019)</td><td>BioBERT</td><td>92.9</td><td>84.7</td><td>89.1</td><td>83.8</td><td>78.6</td></tr><tr><td>Gu et al. (2021)</td><td>PubMedBERT</td><td>93.3</td><td>85.6</td><td>87.8</td><td>84.5</td><td>79.1</td></tr><tr><td>Kanakarajan et al. (2021)</td><td>BioELECTRA</td><td>93.6</td><td>85.8</td><td>89.4</td><td>84.7</td><td>80.2</td></tr><tr><td>Yasunaga et al. (2022)</td><td>LinkBERT</td><td>93.8</td><td>86.1</td><td>88.2</td><td>84.9</td><td>79.0</td></tr><tr><td>BINDER (Ours)</td><td>PubMedBERT</td><td>95.0</td><td>88.0</td><td>90.9</td><td>84.6</td><td>80.3</td></tr></table>
121
+
122
+ Distantly Supervised NER Results Table 3 compares test scores of our method and previous methods on BC5CDR. It presents a clear advantage of our method over all previous methods in the distantly supervised setting. The F1 score is advanced by $+ 1 . 5 \%$ over the previous best method (Zhou et al., 2022), which adapts positive and unlabeled (PU) learning to obtain a high recall yet at the loss of precision. In contrast, our method maintains a reasonable recall (comparable to Shang et al., 2018; Peng et al., 2019) and substantially improves the precision. Note that besides the dictionary used to generate distant supervisions, Zhou et al. (2022); Shang et al. (2018) require an additional high-quality dictionary to estimate the noisiness of non-entity spans. Our method does not have such a requirement. For reference, Table 2 also includes the supervised state of the art. Our method in the supervised setting achieves $9 1 . 9 \%$ F1, outperforming the previous SOTA Wang et al. (2021) by $1 . 0 \%$ . Comparing both settings, we observe that the distantly supervised result still has an over-10-point gap with the supervised one, indicating a potential to further reduce the false negative noise.
123
+
124
+ Table 3: Test scores on BC5CDR. All baselines scores in the distantly supervised setting are quoted from Zhou et al. (2022).
125
+
126
+ <table><tr><td rowspan="2"></td><td colspan="3">BC5CDR</td></tr><tr><td>P</td><td>R</td><td>F1</td></tr><tr><td colspan="4">Distantly Supervised</td></tr><tr><td>Dict/KB Matching AutoNER (Shang et al., 2018)</td><td>86.4 82.6</td><td>51.2 77.5</td><td>64.3 80.0</td></tr><tr><td>BNPU (Peng et al.,2019)</td><td>48.1</td><td>77.1</td><td>59.2</td></tr><tr><td>BERT-ES (Liang et al.,2020)</td><td>80.4</td><td>67.9</td><td>73.7</td></tr><tr><td>Conf-MPU (Zhou et al., 2022)</td><td>76.6</td><td>83.8</td><td>80.1</td></tr><tr><td>BINDER (Ours)</td><td>87.6</td><td>76.3</td><td>81.6</td></tr><tr><td colspan="4">Fully Supervised</td></tr><tr><td>Nooralahzadeh et al. (2019)</td><td>92.1</td><td>87.9</td><td>89.9</td></tr><tr><td>Wang et al. (2021)</td><td>-</td><td>-</td><td>90.9</td></tr><tr><td>BINDER (Ours)</td><td>92.6</td><td>91.2</td><td>91.9</td></tr></table>
127
+
128
+ # 4 ANALYSIS
129
+
130
+ Here we conduct extensive analyses of our method. For efficiency, all analysis in this section is done based on the uncased BERT-base encoder.
131
+
132
+ Ablation Study We compare several variants of our method and report their test scores on ACE2005 in Table 4. We observe performance degradation in all these variants. Shared linear layers uses the same linear layer for span and token embeddings, and the same linear layer for entity type embeddings, in the hope of projecting them into the same vector space and sharing their semantics. It leads to a slightly better precision but a drop of recall. Similar changes are observed in Joint position-span inference, which adopts a more stringent strategy to prune out spans – only keep spans whose start, end, and span scores are all above the thresholds. No position-based objectives only optimizes the span-based objective, which penalizes partially corrected spans in the same way as other spans, resulting in a marginal improvement of recall but a significant loss of precision.
133
+
134
+ Choices of Entity Type Descriptions Table 5 compares different choices of entity type descriptions. Our final model uses annotation guidelines, which outperforms other choices: (1) Atomic labels considers each entity type as an atomic label. Instead of learning an entity type encoder, we directly learn an embedding vector for each entity type. (2) Keywords uses a keyword for each entity type as the input to the entity type encoder, e.g., “person” for PER. (3) Prototypical instances for each minibatch during training dynamically samples from the training data a prototypical instance for each entity type and uses it as input to the entity type encoder. Unlike annotation guidelines, we add special markers to indicate the start and end of an entity span and use the hidden states of the start marker as entity type embeddings. At test time, we increase the number of prototypical instances to three for each entity type. Larger number of prototypical instances may improve the performance. Prototypical instances may also lead to a better performance in few-shot or zero-shot settings. We leave them to future exploration.
135
+
136
+ Table 4: Test scores of our method and its variants on ACE2005.
137
+
138
+ <table><tr><td rowspan="2"></td><td colspan="3">ACE2005</td></tr><tr><td>P</td><td>R</td><td>F1</td></tr><tr><td>Our full model</td><td>89.1</td><td>89.8</td><td>89.5</td></tr><tr><td>Shared linear layers</td><td>89.3</td><td>89.3</td><td>89.3</td></tr><tr><td>Joint position-span inference</td><td>89.4</td><td>89.2</td><td>89.3</td></tr><tr><td>No position-based objectives</td><td>88.7</td><td>89.9</td><td>89.3</td></tr></table>
139
+
140
+ Table 5: Test scores on ACE2005 with different entity type descriptions.
141
+
142
+ <table><tr><td rowspan="2"></td><td colspan="3">ACE2005</td></tr><tr><td>P</td><td>R</td><td>F1</td></tr><tr><td>Atomic labels</td><td>88.9</td><td>89.6</td><td>89.2</td></tr><tr><td>Keywords</td><td>88.7</td><td>89.8</td><td>89.2</td></tr><tr><td>Prototypical instances</td><td>88.7</td><td>90.1</td><td>89.4</td></tr><tr><td>Annotation guidelines</td><td>89.1</td><td>89.8</td><td>89.5</td></tr></table>
143
+
144
+ Thresholding Strategies Our method uses dynamic similarity thresholds to distinguish entity spans from non-entity spans. We compare the impact of dynamic thresholds in our method with two straightforward variants: (1) Learned global thresholds replaces dynamic thresholds with global thresholds, one for each entity type. Specifically, we consider the global similarity thresholds as scalar parameters (initialized as 0). During training, we replace the similarity function outputs $\mathrm { s i m } \big ( \mathbf { u } _ { \mathrm { [ C L S ] } } , \mathbf { e } _ { k } ^ { \mathrm { B } } \big )$ in Equation 8 and $\sin ( \mathbf { s } _ { 0 , 0 } , \mathbf { e } _ { k } )$ in Equation 9 with the corresponding global thresholds. At test times, the global thresholds are used to separate entity spans from non-entity spans. (2) Global thresholds tuned on dev introduces global thresholds after the training is done and tune them on the development set. During training, instead of Equation 10, we optimize a simplified loss without thresholding, $\alpha \ell _ { \mathrm { s t a r t } } + \gamma \ell _ { \mathrm { e n d } } + \lambda \ell _ { \mathrm { j o i n t } }$ . Table 6 compares their test scores on the ACE2005 dataset. Dynamic thresholds have the best scores overall. Learned global thresholds performs better than global thresholds tuned on the development set, indicating the necessity of learning thresholds during training. Note that the global thresholds tuned on dev still outperforms all the previous methods in Table 1, showing a clear advantage of our bi-encoder framework. In Appendix A.7, We further visualize and discuss the distribution of similarity scores between text spans and entity types based on different thresholding strategies.
145
+
146
+ Time Efficiency Table 7 compares the training and inference speed of our method against several prominent methods. To ensure fair comparisons, all speed numbers are recorded based on the same machine using their released code with the same batch size and the same maximum sequence length.
147
+
148
+ MRC-NER (Li et al., 2020) formulates NER as a machine reading comprehension problem and employs a cross-attention encoder. Comparing with it, our bi-encoder framework has $1 7 \mathrm { x }$ and $8 \mathbf { { X } }$ speed on training and inference respectively. Biaffine-NER (Yu et al., 2020) formulates NER as a dependency parsing problem and applies a biaffine classifier to classify the typed arc between an entity span start and end. Comparing with it, our framework does not need a biaffine layer and is $1 . 7 \mathrm { x }$ and 2.4x faster at training and inference. Without the need of conditional random fields (CRFs), our framework is even faster than the widely used BERT-CRF framework. A drawback of BERT-CRF is that it cannot be applied to nested NER. Here we test it on a flat NER dataset CoNLL2003 (Tjong Kim Sang & De Meulder, 2003). All other frameworks are tested on ACE2005.
149
+
150
+ <table><tr><td></td><td colspan="3">ACE2005</td></tr><tr><td></td><td>P</td><td>R</td><td>F1</td></tr><tr><td>Dynamic thresholds</td><td>89.1</td><td>89.8</td><td>89.5</td></tr><tr><td>Learned global thresholds</td><td>88.2</td><td>89.0</td><td>88.6</td></tr><tr><td>Global thresholds tuned on dev</td><td>86.3</td><td>88.7</td><td>87.5</td></tr></table>
151
+
152
+ Table 6: Test scores of our method using different thresholding strategies on ACE2005.
153
+ Table 7: Training and inference speed.
154
+
155
+ <table><tr><td></td><td colspan="2">Speed (w/s)</td></tr><tr><td></td><td>Training</td><td>Inference</td></tr><tr><td>MRC-NER (Li et al., 2020)</td><td>147</td><td>1,110</td></tr><tr><td>Biaffine-NER(Yu et al.,2020)</td><td>1,548</td><td>3,634</td></tr><tr><td>BERT-CRF (pytorch_neural_crf)</td><td>2,273</td><td>8,596</td></tr><tr><td>BINDER (Ours)</td><td>2,571</td><td>8,886</td></tr></table>
156
+
157
+ Table 8: Test F1 score breakdowns on ACE2005 and GENIA. Columns compare F1 scores on different entity types. Rows compare F1 scores based on the entire entity span, or only the start or end of entity span. S-F1 denotes the strict F1 requiring the exact boundary match. L-F1 denotes the loose F1 allowing partial overlaps. The color signifies substantially better F1 scores than the corresponding entity span strict F1 scores.
158
+
159
+ <table><tr><td rowspan="2"></td><td colspan="8">ACE2005</td><td colspan="6">GENIA</td></tr><tr><td>PER</td><td>GPE</td><td>ORG</td><td>FAC</td><td>LOC</td><td>VEH</td><td>WEA</td><td>ALL</td><td>Prot.</td><td>DNA</td><td>CellT.</td><td>CelIL.</td><td>RNA</td><td>ALL</td></tr><tr><td>S-F1span</td><td>93.4</td><td>91.2</td><td>79.7</td><td>81.0</td><td>78.7</td><td>84.8</td><td>82.1</td><td>89.5</td><td>82.9</td><td>77.6</td><td>74.5</td><td>76.3</td><td>87.9</td><td>80.5</td></tr><tr><td>S-F1start</td><td>93.9</td><td>91.2</td><td>80.7</td><td>81.0</td><td>79.0</td><td>84.8</td><td>82.1</td><td>89.9</td><td>86.1</td><td>80.9</td><td>74.5</td><td>80.2</td><td>88.7</td><td>83.2</td></tr><tr><td>S-F1end</td><td>93.9</td><td>91.2</td><td>81.9</td><td>83.1</td><td>79.0</td><td>86.8</td><td>82.1</td><td>90.3</td><td>87.6</td><td>82.6</td><td>83.7</td><td>82.8</td><td>91.0</td><td>85.8</td></tr><tr><td>L-F1span</td><td>94.4</td><td>91.4</td><td>83.0</td><td>83.1</td><td>79.4</td><td>87.2</td><td>82.1</td><td>90.8</td><td>91.6</td><td>87.4</td><td>84.8</td><td>87.2</td><td>91.7</td><td>89.9</td></tr></table>
160
+
161
+ Performance Breakdown Table 8 shows the test F1 scores on each entity type of ACE2005 and GENIA. We report four types of F1 scores: $\mathrm { S - F 1 _ { \mathrm { s p a n } } }$ is the strict F1 based on the exact match of entity spans; $\mathrm { S } { \mathrm { - F } } 1 _ { \mathrm { s t a r t } }$ is the strict F1 based on the exact match of entity start words; $\mathrm { S - F 1 _ { e n d } }$ is the strict F1 based on the exact match of entity end words; $\mathrm { L } { \mathrm { - F } } 1 _ { \mathrm { s p a n } }$ is the loose F1 allowing the partial match of entity spans. We notice that $\mathrm { S - F 1 _ { e n d } }$ is often substantially better than $\mathrm { S - F 1 _ { \mathrm { s p a n } } }$ and $\mathrm { \bf S } { - } \mathrm { \bf F } 1 _ { \mathrm { s t a r t } }$ To explain this difference, we go through these partially corrected predictions and summarize the common errors in Table 9. The most common one is the inclusion or exclusion of modifiers. This could be due to annotation disagreement: in ACE2005, sometimes generic spans are preferred (e.g., “tomcats” vs. “f-14 tomcats”), while in some cases specific spans are preferred (e.g., “cruise ship” vs. “ship”). This issue is more common in the biomedical dataset GENIA, e.g., “human GR” is considered
162
+
163
+ Table 9: Examples of common errors among the partially corrected predictions. Red indicates error spans. Blue indicates missing spans. The number after each span mean the span frequency in the training data.
164
+
165
+ <table><tr><td>Error Type</td><td>Ent. Type</td><td>Predicted ←Gold</td></tr><tr><td rowspan="2">Modifier Error</td><td>VEH FAC VEH CellL. Prot.</td><td>f-14 tomcats (O) ←→ tomcats (0) federal court (O) ←→court (0) ship (29) ←→cruise ship (1) unstimulated Tcells (O) ←→Tcells (553)</td></tr><tr><td>CellT.</td><td>human GR(O)←GR(88) lymphocytes(117) ←→ human lympho- cytes (18)</td></tr><tr><td>Missing Genitive</td><td>PER</td><td>E6 motif (O) ←→ synthetic E6 motif (0) attendant (3) ←→attendant&#x27;s (0)</td></tr><tr><td rowspan="5">Annotation Error</td><td>PER</td><td>Dr.Germ (O) ←→Dr(1)/Germ (0)</td></tr><tr><td>Prot.</td><td>Ag amino acid sequence (O) ←→Ag (1)/ amino acid sequence (6)</td></tr><tr><td>CellL.</td><td>EBV-transformed human B cell line SKW6.4(O) ←→EBV-transformed hu-</td></tr><tr><td>DNA</td><td>man B cell line (O)/SKW6.4 (1) second-site LTR revertants (0) ↑ second-site LTR (O)</td></tr></table>
166
+
167
+ as wrong while “human lymphocytes” are correct, which explains the higher scores of $\mathrm { S - F 1 _ { e n d } }$ than $\mathrm { S } { \mathrm { - F } } 1 _ { \mathrm { s t a r t } }$ . Missing genitives for person names are another common errors in ACE2005. We also discover some annotation errors, where names of a single person, protein, or cell line are sometimes broken into two less meaningful spans, e.g., “Dr. Germ” is annotated as two person mentions “Dr”
168
+
169
+ and “Germ”, and “EBV-transformed human B cell line SKW6.4” is annotated as two separate cell lines “EBV-transformed human B cell line” and “SKW6.4”.
170
+
171
+ # 5 RELATED WORK
172
+
173
+ Supervised NER Early techniques for NER are based on hidden markov models (e.g., Zhou & Su, 2002) and conditional random fields (CRFs) (e.g., McDonald & Pereira 2005). However, due to the inability to handle nested named entities, techniques such as cascaded CRFs (Alex et al., 2007), adpated constituency parsing (Finkel & Manning, 2009), and hypergraphs (Lu & Roth, 2015) are developed for nested NER. More recently, with the advance in deep learning, a myriad of new techniques have been used in supervised NER. Depending on the way they formulate the task, these techniques can be categorized as NER as sequence labeling (Chiu & Nichols, 2016; Ma & Hovy, 2016; Katiyar & Cardie, 2018); NER as parsing (Lample et al., 2016; Yu et al., 2020); NER as span classification (Sohrab & Miwa, 2018; Xia et al., 2019; Ouchi et al., 2020; Fu et al., 2021); NER as a sequence-to-sequence problem (Strakova et al., 2019; Yan et al., 2021); and NER as machine ´ reading comprehension (Li et al., 2020; Mengge et al., 2020). Unlike previous work, we formulate NER as a contrastive learning problem. The span-based design of our bi-encoder and contrastive loss provides us with the flexibility to handle both nested and flat NER.
174
+
175
+ Distantly Supervised NER Distant supervision from external knowledge bases in conjunction with unlabeled text is generated by string matching (Giannakopoulos et al., 2017) or heuristic rules (Ren et al., 2015; Fries et al., 2017). Due to the limited coverage of external knowledge bases, distant supervision often has a high false negative rate. To alleviate this issue, Shang et al. (2018) design a new tagging scheme with an unknown tag specifically for false negatives; Mayhew et al. (2019) iteratively detect false negatives and downweigh them in training; Peng et al. (2019); Zhou et al. (2022) address overfitting to false negatives using Positive and Unlabeled (PU) learning; Zhang et al. (2021b) identify dictionary biases via a structural causal model, and de-bias them using causal interventions. Liu et al. (2021) introduce a calibrated confidence estimation method and integrate it into a self-training framework. Without replying on sophisticated de-noising designs, our bi-encoder framework can be directly used in distant supervision. Experiments in $\ S 3$ show the robustness of our contrastive learning algorithm to the noise in distantly supervised NER.
176
+
177
+ Bi-Encoder The use of bi-encoder dates back to Bromley et al. (1993) for signature verification and Chopra et al. (2005) for face verification. These works and their descendants (e.g., Yih et al., 2011; Hu et al., 2014) refer to the architecture as siamese networks since two similar inputs are encoded separately by two copies of the same network (all parameters are shared). Wsabie (Weston et al., 2010) and StarSpace (Wu et al., 2018) subsequently employ bi-encoder to learn embeddings for different data types. Using deep pretrained transformers as encoders, Humeau et al. (2019) compare three different architectures, bi-encoder, poly-encoder, and cross-encoder. The bi-encoder architecture afterwards has been use in various tasks, e.g., information retrieval (Huang et al., 2013; Gillick et al., 2018), open-domain question answering (Karpukhin et al., 2020), and entity linking (Gillick et al., 2019; Wu et al., 2020; Zhang et al., 2021a). To our best knowledge, there is no previous work learning bi-encoder for NER.
178
+
179
+ # 6 CONCLUSIONS
180
+
181
+ We present a bi-encoder framework for NER using contrastive learning, which separately maps text and entity types into the same vector space. To separate entity spans from non-entity ones, we introduce a novel contrastive loss to jointly learn span identification and entity classification. Experiments in both supervised and distantly supervised settings show the effectiveness and robustness of our method. We conduct extensive analysis to explain the success of our method and reveal growth opportunities. Future directions include further improving low-performing types and applications in self-supervised zero-shot settings.
182
+
183
+ # REFERENCES
184
+
185
+ Beatrice Alex, Barry Haddow, and Claire Grover. Recognising nested named entities in biomedical text. In Biological, translational, and clinical language processing, pp. 65–72, Prague, Czech Republic, June 2007. Association for Computational Linguistics. URL https:// aclanthology.org/W07-1009.
186
+
187
+ Rami Aly, Andreas Vlachos, and Ryan McDonald. Leveraging type descriptions for zero-shot named entity recognition and classification. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 1516–1528, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.120. URL https: //aclanthology.org/2021.acl-long.120.
188
+
189
+ Jane Bromley, Isabelle Guyon, Yann LeCun, Eduard Sackinger, and Roopak Shah. Signature verifi- ¨ cation using a” siamese” time delay neural network. Advances in neural information processing systems, 6, 1993.
190
+
191
+ Kai-Wei Chang, Rajhans Samdani, and Dan Roth. A constrained latent variable model for coreference resolution. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pp. 601–612, Seattle, Washington, USA, October 2013. Association for Computational Linguistics. URL https://aclanthology.org/D13-1057.
192
+
193
+ Jason P.C. Chiu and Eric Nichols. Named entity recognition with bidirectional LSTM-CNNs. Transactions of the Association for Computational Linguistics, 4:357–370, 2016. doi: 10.1162/ tacl a 00104. URL https://aclanthology.org/Q16-1026.
194
+
195
+ Yejin Choi, Eric Breck, and Claire Cardie. Joint extraction of entities and relations for opinion recognition. In Proceedings of the 2006 Conference on Empirical Methods in Natural Language Processing, pp. 431–439, Sydney, Australia, July 2006. Association for Computational Linguistics. URL https://aclanthology.org/W06-1651.
196
+
197
+ Sumit Chopra, Raia Hadsell, and Yann LeCun. Learning a similarity metric discriminatively, with application to face verification. In 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’05), volume 1, pp. 539–546. IEEE, 2005.
198
+
199
+ Nigel Collier and Jin-Dong Kim. Introduction to the bio-entity recognition task at JNLPBA. In Proceedings of the International Joint Workshop on Natural Language Processing in Biomedicine and its Applications (NLPBA/BioNLP), pp. 73–78, Geneva, Switzerland, August 28th and 29th 2004. COLING. URL https://aclanthology.org/W04-1213.
200
+
201
+ Leyang Cui, Yu Wu, Jian Liu, Sen Yang, and Yue Zhang. Template-based named entity recognition using BART. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pp. 1835–1845, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/ v1/2021.findings-acl.161. URL https://aclanthology.org/2021.findings-acl. 161.
202
+
203
+ Sarkar Snigdha Sarathi Das, Arzoo Katiyar, Rebecca Passonneau, and Rui Zhang. CONTaiNER: Few-shot named entity recognition via contrastive learning. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 6338– 6353, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/ 2022.acl-long.439. URL https://aclanthology.org/2022.acl-long.439.
204
+
205
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1423. URL https: //aclanthology.org/N19-1423.
206
+
207
+ Ning Ding, Yulin Chen, Xu Han, Guangwei Xu, Pengjun Xie, Hai-Tao Zheng, Zhiyuan Liu, Juanzi Li, and Hong-Gee Kim. Prompt-learning for fine-grained entity typing. arXiv preprint arXiv:2108.10604, 2021.
208
+
209
+ Rezarta Islamaj Dogan, Robert Leaman, and Zhiyong Lu. Special report: Ncbi disease corpus: A ˘ resource for disease name recognition and concept normalization. J. of Biomedical Informatics, 47:1–10, feb 2014. ISSN 1532-0464.
210
+
211
+ Gamaleldin Elsayed, Dilip Krishnan, Hossein Mobahi, Kevin Regan, and Samy Bengio. Large margin deep networks for classification. Advances in neural information processing systems, 31, 2018.
212
+
213
+ Jenny Rose Finkel and Christopher D. Manning. Nested named entity recognition. In Proceedings of the 2009 Conference on Empirical Methods in Natural Language Processing, pp. 141–150, Singapore, August 2009. Association for Computational Linguistics. URL https: //aclanthology.org/D09-1015.
214
+
215
+ Jason Fries, Sen Wu, Alex Ratner, and Christopher Re. Swellshark: A generative model for biomed-´ ical named entity recognition without labeled data. arXiv preprint arXiv:1704.06360, 2017.
216
+
217
+ Jinlan Fu, Xuanjing Huang, and Pengfei Liu. SpanNER: Named entity re-/recognition as span prediction. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 7183–7195, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.558. URL https://aclanthology.org/2021. acl-long.558.
218
+
219
+ Athanasios Giannakopoulos, Claudiu Musat, Andreea Hossmann, and Michael Baeriswyl. Unsupervised aspect term extraction with B-LSTM & CRF using automatically labelled datasets. In Proceedings of the 8th Workshop on Computational Approaches to Subjectivity, Sentiment and Social Media Analysis, pp. 180–188, Copenhagen, Denmark, September 2017. Association for Computational Linguistics. doi: 10.18653/v1/W17-5224. URL https://aclanthology. org/W17-5224.
220
+
221
+ Daniel Gillick, Alessandro Presta, and Gaurav Singh Tomar. End-to-end retrieval in continuous space. arXiv preprint arXiv:1811.08008, 2018.
222
+
223
+ Daniel Gillick, Sayali Kulkarni, Larry Lansing, Alessandro Presta, Jason Baldridge, Eugene Ie, and Diego Garcia-Olano. Learning dense representations for entity retrieval. In Proceedings of the 23rd Conference on Computational Natural Language Learning (CoNLL), pp. 528–537, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/ K19-1049. URL https://aclanthology.org/K19-1049.
224
+
225
+ Yu Gu, Robert Tinn, Hao Cheng, Michael Lucas, Naoto Usuyama, Xiaodong Liu, Tristan Naumann, Jianfeng Gao, and Hoifung Poon. Domain-specific language model pretraining for biomedical natural language processing. ACM Transactions on Computing for Healthcare (HEALTH), 3(1): 1–23, 2021.
226
+
227
+ Tao Gui, Jiacheng Ye, Qi Zhang, Zhengyan Li, Zichu Fei, Yeyun Gong, and Xuanjing Huang. Uncertainty-aware label refinement for sequence labeling. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 2316–2326, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main. 181. URL https://aclanthology.org/2020.emnlp-main.181.
228
+
229
+ Baotian Hu, Zhengdong Lu, Hang Li, and Qingcai Chen. Convolutional neural network architectures for matching natural language sentences. Advances in neural information processing systems, 27, 2014.
230
+
231
+ Po-Sen Huang, Xiaodong He, Jianfeng Gao, Li Deng, Alex Acero, and Larry Heck. Learning deep structured semantic models for web search using clickthrough data. In Proceedings of the 22nd ACM International Conference on Information &amp; Knowledge Management, CIKM ’13, pp. 2333–2338, New York, NY, USA, 2013. Association for Computing Machinery. ISBN 9781450322638. doi: 10.1145/2505515.2505665. URL https://doi.org/10.1145/ 2505515.2505665.
232
+
233
+ Samuel Humeau, Kurt Shuster, Marie-Anne Lachaux, and Jason Weston. Poly-encoders: Architectures and pre-training strategies for fast and accurate multi-sentence scoring. In International Conference on Learning Representations, 2019.
234
+
235
+ Kamal raj Kanakarajan, Bhuvana Kundumani, and Malaikannan Sankarasubbu. BioELECTRA:pretrained biomedical text encoder using discriminators. In Proceedings of the 20th Workshop on Biomedical Language Processing, pp. 143–154, Online, June 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.bionlp-1.16. URL https://aclanthology. org/2021.bionlp-1.16.
236
+
237
+ Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. Dense passage retrieval for open-domain question answering. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 6769–6781, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.550. URL https://aclanthology.org/2020. emnlp-main.550.
238
+
239
+ Arzoo Katiyar and Claire Cardie. Nested named entity recognition revisited. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 861–871, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. doi: 10.18653/v1/N18-1079. URL https://aclanthology.org/N18-1079.
240
+
241
+ Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. Supervised contrastive learning. Advances in Neural Information Processing Systems, 33:18661–18673, 2020.
242
+
243
+ J-D Kim, Tomoko Ohta, Yuka Tateisi, and Jun’ichi Tsujii. Genia corpus—a semantically annotated corpus for bio-textmining. Bioinformatics, 19(suppl 1):i180–i182, 2003.
244
+
245
+ Guillaume Lample, Miguel Ballesteros, Sandeep Subramanian, Kazuya Kawakami, and Chris Dyer. Neural architectures for named entity recognition. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 260–270, San Diego, California, June 2016. Association for Computational Linguistics. doi: 10.18653/v1/N16-1030. URL https://aclanthology.org/N16-1030.
246
+
247
+ Jinhyuk Lee, Wonjin Yoon, Sungdong Kim, Donghyeon Kim, Sunkyu Kim, Chan Ho So, and Jaewoo Kang. BioBERT: a pre-trained biomedical language representation model for biomedical text mining. Bioinformatics, 36(4):1234–1240, 09 2019. ISSN 1367-4803. doi: 10.1093/bioinformatics/btz682. URL https://doi.org/10.1093/bioinformatics/ btz682.
248
+
249
+ Jiao Li, Yueping Sun, Robin J Johnson, Daniela Sciaky, Chih-Hsuan Wei, Robert Leaman, Allan Peter Davis, Carolyn J Mattingly, Thomas C Wiegers, and Zhiyong Lu. Biocreative v cdr task corpus: a resource for chemical disease relation extraction. Database, 2016, 2016.
250
+
251
+ Xiaoya Li, Jingrong Feng, Yuxian Meng, Qinghong Han, Fei Wu, and Jiwei Li. A unified MRC framework for named entity recognition. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 5849–5859, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.519. URL https: //aclanthology.org/2020.acl-main.519.
252
+
253
+ Chen Liang, Yue Yu, Haoming Jiang, Siawpeng Er, Ruijia Wang, Tuo Zhao, and Chao Zhang. Bond: Bert-assisted open-domain named entity recognition with distant supervision. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery &amp; Data Mining, KDD ’20, pp. 1054–1064, New York, NY, USA, 2020. Association for Computing Machinery. ISBN 9781450379984. doi: 10.1145/3394486.3403149. URL https: //doi.org/10.1145/3394486.3403149.
254
+
255
+ Kun Liu, Yao Fu, Chuanqi Tan, Mosha Chen, Ningyu Zhang, Songfang Huang, and Sheng Gao. Noisy-labeled NER with confidence estimation. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 3437–3445, Online, June 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.naacl-main.269. URL https://aclanthology.org/2021. naacl-main.269.
256
+
257
+ Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
258
+
259
+ Wei Lu and Dan Roth. Joint mention extraction and classification with mention hypergraphs. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 857–867, Lisbon, Portugal, September 2015. Association for Computational Linguistics. doi: 10.18653/v1/D15-1102. URL https://aclanthology.org/D15-1102.
260
+
261
+ Yi Luan, Luheng He, Mari Ostendorf, and Hannaneh Hajishirzi. Multi-task identification of entities, relations, and coreference for scientific knowledge graph construction. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 3219–3232, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/ v1/D18-1360. URL https://aclanthology.org/D18-1360.
262
+
263
+ Ruotian Ma, Xin Zhou, Tao Gui, Yiding Tan, Linyang Li, Qi Zhang, and Xuanjing Huang. Templatefree prompt tuning for few-shot NER. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 5721–5732, Seattle, United States, July 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.naacl-main.420. URL https://aclanthology.org/2022. naacl-main.420.
264
+
265
+ Xuezhe Ma and Eduard Hovy. End-to-end sequence labeling via bi-directional LSTM-CNNs-CRF. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1064–1074, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/P16-1101. URL https://aclanthology.org/ P16-1101.
266
+
267
+ Stephen Mayhew, Snigdha Chaturvedi, Chen-Tse Tsai, and Dan Roth. Named entity recognition with partially annotated training data. In Proceedings of the 23rd Conference on Computational Natural Language Learning (CoNLL), pp. 645–655, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/K19-1060. URL https://aclanthology.org/K19-1060.
268
+
269
+ Ryan McDonald and Fernando Pereira. Identifying gene and protein mentions in text using conditional random fields. BMC bioinformatics, 6(1):1–7, 2005.
270
+
271
+ Xue Mengge, Bowen Yu, Zhenyu Zhang, Tingwen Liu, Yue Zhang, and Bin Wang. Coarse-toFine Pre-training for Named Entity Recognition. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 6345–6354, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.514. URL https://aclanthology.org/2020.emnlp-main.514.
272
+
273
+ Mike Mintz, Steven Bills, Rion Snow, and Daniel Jurafsky. Distant supervision for relation extraction without labeled data. In Proceedings of the Joint Conference of the 47th Annual Meeting of the ACL and the 4th International Joint Conference on Natural Language Processing of the AFNLP, pp. 1003–1011, Suntec, Singapore, August 2009. Association for Computational Linguistics. URL https://aclanthology.org/P09-1113.
274
+
275
+ David Nadeau and Satoshi Sekine. A survey of named entity recognition and classification. Lingvisticae Investigationes, 30(1):3–26, 2007.
276
+
277
+ Farhad Nooralahzadeh, Jan Tore Lønning, and Lilja Øvrelid. Reinforcement-based denoising of distantly supervised NER with partial annotation. In Proceedings of the 2nd Workshop on Deep Learning Approaches for Low-Resource NLP (DeepLo 2019), pp. 225–233, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-6125. URL https://aclanthology.org/D19-6125.
278
+
279
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
280
+
281
+ Hiroki Ouchi, Jun Suzuki, Sosuke Kobayashi, Sho Yokoi, Tatsuki Kuribayashi, Ryuto Konno, and Kentaro Inui. Instance-based learning of span representations: A case study through named entity recognition. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 6452–6459, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.575. URL https://aclanthology.org/2020. acl-main.575.
282
+
283
+ Minlong Peng, Xiaoyu Xing, Qi Zhang, Jinlan Fu, and Xuanjing Huang. Distantly supervised named entity recognition using positive-unlabeled learning. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 2409–2419, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1231. URL https: //aclanthology.org/P19-1231.
284
+
285
+ Xiang Ren, Ahmed El-Kishky, Chi Wang, Fangbo Tao, Clare R Voss, and Jiawei Han. Clustype: Effective entity recognition and typing by relation phrase-based clustering. In Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 995–1004. ACM, 2015.
286
+
287
+ Jingbo Shang, Liyuan Liu, Xiaotao Gu, Xiang Ren, Teng Ren, and Jiawei Han. Learning named entity tagger using domain-specific dictionary. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 2054–2064, Brussels, Belgium, OctoberNovember 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1230. URL https://aclanthology.org/D18-1230.
288
+
289
+ Takashi Shibuya and Eduard Hovy. Nested Named Entity Recognition via Second-best Sequence Learning and Decoding. Transactions of the Association for Computational Linguistics, 8:605– 620, 09 2020. ISSN 2307-387X. doi: 10.1162/tacl a 00334. URL https://doi.org/10. 1162/tacl_a_00334.
290
+
291
+ Larry Smith, Lorraine K Tanabe, Cheng-Ju Kuo, I Chung, Chun-Nan Hsu, Yu-Shi Lin, Roman Klinger, Christoph M Friedrich, Kuzman Ganchev, Manabu Torii, et al. Overview of biocreative ii gene mention recognition. Genome biology, 9(2):1–19, 2008.
292
+
293
+ Mohammad Golam Sohrab and Makoto Miwa. Deep exhaustive model for nested named entity recognition. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 2843–2849, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1309. URL https://aclanthology.org/ D18-1309.
294
+
295
+ Jana Strakova, Milan Straka, and Jan Hajic. Neural architectures for nested NER through lineariza- ´ tion. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 5326–5331, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1527. URL https://aclanthology.org/P19-1527.
296
+
297
+ Sainbayar Sukhbaatar, Joan Bruna, Manohar Paluri, Lubomir Bourdev, and Rob Fergus. Training convolutional networks with noisy labels. arXiv preprint arXiv:1406.2080, 2014.
298
+
299
+ Zeqi Tan, Yongliang Shen, Shuai Zhang, Weiming Lu, and Yueting Zhuang. A sequence-to-set network for nested named entity recognition. In Proceedings of the 30th International Joint Conference on Artificial Intelligence, IJCAI-21, 2021. URL https://arxiv.org/abs/ 2105.08901.
300
+
301
+ Erik F. Tjong Kim Sang and Fien De Meulder. Introduction to the CoNLL-2003 shared task: Language-independent named entity recognition. In Proceedings of the Seventh Conference on Natural Language Learning at HLT-NAACL 2003, pp. 142–147, 2003. URL https: //aclanthology.org/W03-0419.
302
+
303
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In
304
+
305
+ Proc. Advances in Neural Information Processing Systems (NeurIPS), volume 30, 2017. URL https://proceedings.neurips.cc/paper/2017/file/ 3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf.
306
+
307
+ Juncheng Wan, Dongyu Ru, Weinan Zhang, and Yong Yu. Nested named entity recognition with span-level graphs. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 892–903, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.63. URL https: //aclanthology.org/2022.acl-long.63.
308
+
309
+ Jue Wang, Lidan Shou, Ke Chen, and Gang Chen. Pyramid: A layered model for nested named entity recognition. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 5918–5928, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.525. URL https://aclanthology.org/2020. acl-main.525.
310
+
311
+ Xinyu Wang, Yong Jiang, Nguyen Bach, Tao Wang, Zhongqiang Huang, Fei Huang, and Kewei Tu. Improving named entity recognition by external context retrieving and cooperative learning. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 1800–1812, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/ v1/2021.acl-long.142. URL https://aclanthology.org/2021.acl-long.142.
312
+
313
+ Jason Weston, Samy Bengio, and Nicolas Usunier. Large scale image annotation: learning to rank with joint word-image embeddings. Machine learning, 81(1):21–35, 2010.
314
+
315
+ Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander Rush. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pp. 38–45, Online, October 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-demos.6. URL https: //aclanthology.org/2020.emnlp-demos.6.
316
+
317
+ Ledell Wu, Adam Fisch, Sumit Chopra, Keith Adams, Antoine Bordes, and Jason Weston. Starspace: Embed all the things! In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
318
+
319
+ Ledell Wu, Fabio Petroni, Martin Josifoski, Sebastian Riedel, and Luke Zettlemoyer. Scalable zero-shot entity linking with dense entity retrieval. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 6397–6407, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.519. URL https://aclanthology.org/2020.emnlp-main.519.
320
+
321
+ Congying Xia, Chenwei Zhang, Tao Yang, Yaliang Li, Nan Du, Xian Wu, Wei Fan, Fenglong Ma, and Philip Yu. Multi-grained named entity recognition. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 1430–1440, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1138. URL https://aclanthology.org/P19-1138.
322
+
323
+ Hang Yan, Tao Gui, Junqi Dai, Qipeng Guo, Zheng Zhang, and Xipeng Qiu. A unified generative framework for various NER subtasks. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 5808–5822, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.451. URL https://aclanthology.org/2021.acl-long.451.
324
+
325
+ Jie Yang, Shuailong Liang, and Yue Zhang. Design challenges and misconceptions in neural sequence labeling. In Proceedings of the 27th International Conference on Computational Linguistics, pp. 3879–3889, Santa Fe, New Mexico, USA, August 2018. Association for Computational Linguistics. URL https://aclanthology.org/C18-1327.
326
+
327
+ Michihiro Yasunaga, Jure Leskovec, and Percy Liang. LinkBERT: Pretraining language models with document links. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 8003–8016, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.551. URL https://aclanthology.org/2022.acl-long.551.
328
+
329
+ Wen-tau Yih, Kristina Toutanova, John C. Platt, and Christopher Meek. Learning discriminative projections for text similarity measures. In Proceedings of the Fifteenth Conference on Computational Natural Language Learning, pp. 247–256, Portland, Oregon, USA, June 2011. Association for Computational Linguistics. URL https://aclanthology.org/W11-0329.
330
+
331
+ Juntao Yu, Bernd Bohnet, and Massimo Poesio. Named entity recognition as dependency parsing. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 6470–6476, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/ 2020.acl-main.577. URL https://aclanthology.org/2020.acl-main.577.
332
+
333
+ Sheng Zhang, Hao Cheng, Shikhar Vashishth, Cliff Wong, Jinfeng Xiao, Xiaodong Liu, Tristan Naumann, Jianfeng Gao, and Hoifung Poon. Knowledge-rich self-supervised entity linking. arXiv preprint arXiv:2112.07887, 2021a.
334
+
335
+ Shuai Zhang, Yongliang Shen, Zeqi Tan, Yiquan Wu, and Weiming Lu. De-bias for generative extraction in unified NER task. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 808–818, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.59. URL https: //aclanthology.org/2022.acl-long.59.
336
+
337
+ Wenkai Zhang, Hongyu Lin, Xianpei Han, and Le Sun. De-biasing distantly supervised named entity recognition via causal intervention. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 4803–4813, Online, August 2021b. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.371. URL https: //aclanthology.org/2021.acl-long.371.
338
+
339
+ Zhilu Zhang and Mert Sabuncu. Generalized cross entropy loss for training deep neural networks with noisy labels. Advances in neural information processing systems, 31, 2018.
340
+
341
+ GuoDong Zhou and Jian Su. Named entity recognition using an HMM-based chunk tagger. In Proceedings of the 40th Annual Meeting of the Association for Computational Linguistics, pp. 473–480, Philadelphia, Pennsylvania, USA, July 2002. Association for Computational Linguistics. doi: 10.3115/1073083.1073163. URL https://aclanthology.org/P02-1060.
342
+
343
+ Kang Zhou, Yuepei Li, and Qi Li. Distantly supervised named entity recognition via confidencebased multi-class positive and unlabeled learning. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 7198–7211, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long. 498. URL https://aclanthology.org/2022.acl-long.498.
344
+
345
+ # A APPENDIX
346
+
347
+ # A.1 COMPARISON WITH PROMPT-BASED LEARNING
348
+
349
+ Prompt-based learning emerges as a powerful method in few-shot NER (Cui et al., 2021; Ma et al., 2022; Ding et al., 2021). Below, we compare BINDER with Tempalte BART (Cui et al., 2021), a representative prompt-based learning method:
350
+
351
+ Method Difference Cui et al. (2021) follows an encoder-decoder framework. Given a text span, it decodes and selects among all possible templates including none-entity templates. Their candidates are templates based on a static set of entity types. In contrast, BINDER is to given an entity type select among all possible text spans. The candidates are a dynamic set of text spans, which are different for different input documents. The size of candidates is much larger – $\mathcal { O } ( L ^ { 2 } )$ , where $L$ is the max seq length, set to 256 in our experiments.
352
+
353
+ Loss Difference Cui et al. (2021) uses cross-entropy to maximize the likelihood of gold entity type template against templates of other entity types. In comparison, BINDER uses contrastive learning, given an entity type, to maximize the similarity of gold text spans against other text spans. Instead of comparing entity types, BINDER compares all possible text spans from an input document. It captures subtleties of each text span via contrastive learning. As shown in previous work, instancebased contrastive learning has better generalization performance than cross-entropy loss (Khosla et al., 2020), due to its robustness to noisy labels (Zhang & Sabuncu, 2018; Sukhbaatar et al., 2014) and the possibility of better margins (Elsayed et al., 2018). To our best knowledge, we are the first to demonstrate BINDER with contrastive loss (among text spans) significantly cross-entropy loss (among entity types/templates), in both supervised settings (see Table 1 and Table 2) and distantly supervised settings (see Table 3).
354
+
355
+ Non-entity Handling Difference Cui et al. (2021) labels all non-entity spans with non-entity templates. This can introduce false negatives when the training data is partially annotated (Das et al., 2022; Aly et al., 2021). Our formulation allows us to avoid using an explicit non-entity class, and instead to introduce a dynamic threshold based on the input document and the entity type, to distinguish entity spans from non-entity spans. Our experiments show a clear advantage of dynamic thresholding over explicit non-entity labeling scheme.
356
+
357
+ Computational Efficiency The encoder-decoder framework used by Cui et al. (2021) has much lower computational efficiency. First, it has double parameter size compared to BINDER (which is encoder-only). Second, both its training and inference time are significantly slower than BINDER. Because the decoding process relies on cross-attention from decoder to encoder, their method has to decode all possible templates for each input document. The number of templates $N _ { \mathrm { t e m p l a t e s } } =$ $N _ { \mathrm { t e x t s p a n s } } \times N _ { \mathrm { e n t i t y t y p e s } }$ . And the overall the decoding operations are $\mathcal { O } ( N _ { \mathrm { d o c u m e n t s } } \times N _ { \mathrm { t e x t s p a n s } } \times$ $N _ { \mathrm { e n t i t y } \mathrm { t y p e s } } )$ . Furthermore, the decoding process has to be done in an autoregressive manner, which even reduces the time efficiency. In comparison, BINDER employs a bi-encoder framework. It separately encodes entity types and input documents. Encoding entity types does not rely on input documents. At test time, it only needs to encode entity types once, and then re-use them to for NER of different input documents. Encoding entity types is only $\mathcal { O } ( N _ { \mathrm { e n t i t y } \mathrm { t y p e s } } )$ , and can be done very efficiently in parallel on GPU.
358
+
359
+ Performance on CoNLL03 To make a direct comparison with Cui et al. (2021), we train and evaluate BINDER on CoNLL03 (Tjong Kim Sang & De Meulder, 2003). Table 10 reports the test results. BINDER outperforms Template BART as well as other strong baselines.
360
+
361
+ Table 10: Test scores on CoNLL03.
362
+
363
+ <table><tr><td></td><td colspan="3">CoNLL03</td></tr><tr><td></td><td>P</td><td>R</td><td>F1</td></tr><tr><td>Yang et al. (2018)</td><td></td><td>-</td><td>90.77</td></tr><tr><td>Ma &amp; Hovy (2016)</td><td></td><td></td><td>91.21</td></tr><tr><td>Gui et al. (2020)</td><td></td><td>=</td><td>92.02</td></tr><tr><td>Template BART (Cui et al., 2021)</td><td>91.72</td><td>93.40</td><td>92.55</td></tr><tr><td>BINDER</td><td>93.08</td><td>93.57</td><td>93.33</td></tr></table>
364
+
365
+ # A.2 COMPARISON WITH SPAN-BASED NER
366
+
367
+ We highlight the difference between our method (BINDER) and span-based NER below:
368
+
369
+ Formulation Difference In span-based NER, it is to given a text span select among all entity types. The candidates are a static set of entity types, the size of which is usually small (e.g., PER, ORG, LOC, MISC). In contrast, BINDER formulates NER as given an entity type to select among all possible text spans of an input document. The candidates are a dynamic set of text spans, which are different for different input documents. The size of candidates is much larger – $\mathcal { O } ( \dot { L } ^ { 2 } )$ , where $L$ is the max seq length, set to 256 in our experiments.
370
+
371
+ Loss Difference Span-based NER uses cross-entropy to maximize the likelihood of gold entity type template against templates of other entity types. In comparison, BINDER uses contrastive learning, given an entity type, to maximize the similarity of gold text spans against other text spans. Instead of comparing entity types, BINDER compares all possible text spans from an input document. It captures subtleties of each text span via contrastive learning. As shown in previous work, instancebased contrastive learning has better generalization performance than cross-entropy loss (Khosla et al., 2020), due to its robustness to noisy labels (Zhang & Sabuncu, 2018; Sukhbaatar et al., 2014) and the possibility of better margins (Elsayed et al., 2018). To our best knowledge, we are the first to demonstrate BINDER with contrastive loss (among text spans) significantly cross-entropy loss (among entity types), in both supervised settings (see Table 1 and Table 2) and distantly supervised settings (see Table 3).
372
+
373
+ Non-entity Handling Difference Span-based NER labels all non-entity tokens or spans with the same class Outside (O). This can introduce false negatives when the training data is partially annotated (Das et al., 2022; Aly et al., 2021). Our formulation allows us to avoid using an explicit non-entity class, and instead to introduce a dynamic threshold based on the input document and the entity type, to distinguish entity spans from non-entity spans. Our experiments show a clear advantage of dynamic thresholding over traditional explicit O labeling scheme.
374
+
375
+ # A.3 IMPACT OF MAXIMUM SEQUENCE LENGTH
376
+
377
+ In our experiments, we set the maximum sequence length $L$ to 256, meaning that the number of candidate spans is $\mathcal { O } ( L ^ { 2 } )$ . Speed comparison in Table 7 is made based on $L = 2 5 6$ . We also experimented with smaller numbers of $L$ (e.g., 64, 128), which resulted in better speed but a slight performance degradation. Increasing $L$ did not bring significant gain but increased memory consumption. Therefore, in the experiments, we set $L$ to 256.
378
+
379
+ # A.4 IMPLEMENTATION DETAILS
380
+
381
+ We implement our models based on the HuggingFace Transformers library (Wolf et al., 2020). The base encoders are initialized using PubMedBERT-base-uncased (Gu et al., 2021) or BioBERT (Lee et al., 2019) for biomedical NER datasets, and BERT-base-uncased or BERT-large-uncased (Devlin et al., 2019) for NER datasets in the general domains. The linear layer output size is 128; the width embedding size is 128; the initial temperatures are 0.07. We train our models with the AdamW optimizer (Loshchilov & Hutter, 2017) of a linear scheduler and dropout of 0.1. The entity start/end/span contrastive loss weights are set to $\alpha = 0 . 2 , \gamma = 0 . 2 , \lambda = 0 . 6$ , and the same loss weights are chosen for thresholding contrastive learning. The contrastive losses for thresholding and entity are weighted equally in the final loss. For all experiments, we ignore sentence boundaries, and tokenize and split text into sequences with a stride of 16. For base encoders, we train our models for 20 epochs with a learning rate of 3e-5 and a batch size of 8 sequences with the maximum token length of $N = 1 2 8$ . For large encoders, we train our models for 40 epochs with a learning rate of 3e-5 and a batch size of 16 sequences with the maximum token length of $N = 2 5 6$ . The maximum token length for entity spans is set to 30. We use early stop with a patience of 10 in the distantly supervised setting. Validation is done at every 50 steps of training, and we adopt the models that have the best performance on the development set. We report the median score of multiple runs.
382
+
383
+ # A.5 INFERENCE FOR BINDER
384
+
385
+ As we can see in Algorithm 1, the difference between joint position-span and span-only strategies is whether line 9 is used. Also, for flat NER datasets, we further carry out a post-processing step to remove overlapping predictions (line 19 in Algorithm 1). Here, the post-processing (removeOverlap) is carried out in a greedy fashion where higher scored span predictions with earlier start and end positions are preferred.
386
+
387
+ # Algorithm 1: Inference for BINDER.
388
+
389
+ Input: $\begin{array} { r } { S = \{ ( i , j ) | i , j = 1 , \dots , N , 0 \leq j - i \leq L \} } \end{array}$ the set of spans , $\mathcal { E } = \{ E _ { 1 } , \ldots , E _ { K } \}$ the set of entity types, joint for whether using joint position-span inference, and flat for whether the inference is for flat NER. $M = \{ \}$ ; for $E _ { k } \in \mathcal { E }$ do
390
+ 4 compute start/end/span threshold scores $b _ { n u l l } , e _ { n u l l } , s _ { n u l l }$ .
391
+ 6 for $( i , j ) \in S$ do compute start/end/span similarity scores $b , e , s$ .
392
+ 9 if joint is true and $b < b _ { n u l l }$ or $e < e _ { n u l l }$ then Continue; end
393
+ 13 if $s > s _ { n u l l }$ then $M = M \cup \{ ( i , j , E _ { k } ) \}$ ; end end end
394
+ 19 if flat is true then return removeOverlap $( M )$ ); end return $M$ ; Function removeOverlap $( \hat { D } )$ : $\hat { M } = \{ \}$ ; sort $\hat { D }$ by the similarity score in descending order and break the tie by ascending in start and end positions; for $( i , j , E _ { k } )$ in $\hat { D }$ do if span $( i , j )$ has no overlap in $\hat { M }$ then $\hat { M } = \hat { M } \cup \{ ( i , j , E _ { k } ) \}$ ; end end return $\hat { M }$ ;
395
+
396
+ # A.6 STATISTICS OF DATASETS
397
+
398
+ Table 11 reports the statistics of supervised NER datasets.
399
+
400
+ Table 11: The statistics of supervised NER datasets.
401
+
402
+ <table><tr><td rowspan="2">Dataset</td><td rowspan="2">|</td><td colspan="3"># Annotations</td></tr><tr><td>Train</td><td>Dev</td><td>Test</td></tr><tr><td>ACE2004</td><td>7</td><td>22,735 (5-fold)</td><td></td><td></td></tr><tr><td>ACE2005</td><td>7</td><td>26,473</td><td>6.338</td><td>5,476</td></tr><tr><td>GENIA</td><td>5</td><td>46,142</td><td>4,367</td><td>5,506</td></tr><tr><td>BC5-chem</td><td>1</td><td>5,203</td><td>5,347</td><td>5,385</td></tr><tr><td>BC5-disease</td><td>1</td><td>4,182</td><td>4,244</td><td>4,424</td></tr><tr><td>NCBI</td><td>1</td><td>5,134</td><td>787</td><td>960</td></tr><tr><td>BC2GM</td><td>1</td><td>15,197</td><td>3,061</td><td>6,325</td></tr><tr><td>JNLPBA</td><td>1</td><td>46,750</td><td>4,551</td><td>8,662</td></tr></table>
403
+
404
+ # A.7 DISTRIBUTIONS OF SIMILARITY SCORES
405
+
406
+ Figure 2 visualizes the distributions of similarity scores between different text spans and entity types based on different thresholding strategies. Consistent with the scores in Table 6, the majority of entity spans and non-entity spans are separable regardless of the thresholding strategy. This is true even when no thresholds are used during training and instead we tune global thresholds on dev.
407
+
408
+ ![](images/2bfec918851ee5b8e3c6cb0e10855b0f24a126e8d57e793d745ec2022b16f3e8.jpg)
409
+ Figure 2: The kernel density estimation of similarity scores between different text spans (entity, non-entity, and threshold spans) and entity types (PER, ORG, GPE) on ACE2005 based on different thresholding strategies.
410
+
411
+ We zoom in the distributions in Figure 3 and observe that the learned global thresholds tend to make the similarities less separable between entity spans and non-entity spans.
412
+
413
+ ![](images/45d65f6cfb78d81f127b935a24f3b48b700203da870473dc6f7c40e3dc1fa0e5.jpg)
414
+ Figure 3: Zoom-in of the kernel density estimation of similarity scores in Figure 2, with the $y$ -axis density limited to (0, 0.1).
parse/dev/9EAQVEINuum/9EAQVEINuum_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/NiEtU7blzN/NiEtU7blzN.md ADDED
@@ -0,0 +1,453 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LARGE LANGUAGE MODELS CAN SELF-IMPROVE
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Large Language Models (LLMs) have achieved excellent performances in various tasks. However, fine-tuning an LLM requires extensive supervision. Human, on the other hand, may improve their reasoning abilities by self-thinking without external inputs. In this work, we demonstrate that an LLM is also capable of self-improving with only unlabeled datasets. We use a pre-trained LLM to generate “high-confidence” rationale-augmented answers for unlabeled questions using Chain-of-Thought prompting and self-consistency, and fine-tune the LLM using those self-generated solutions as target outputs. We show that our approach improves the general reasoning ability of a 540B-parameter LLM $7 4 . 4 \% 8 2 . 1 \%$ on GSM8K, $7 8 . 2 \% 8 3 . 0 \%$ on DROP, $9 0 . 0 \% 9 4 . 4 \%$ on OpenBookQA, and $6 3 . 4 \% 6 7 . 9 \%$ on ANLI-A3) and achieves state-of-the-art-level performance, without any ground truth label. We conduct ablation studies and show that finetuning on reasoning is critical for self-improvement.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Scaling has enabled Large Language Models (LLMs) to achieve state-of-the-art performance on a range of Natural Language Processing (NLP) tasks (Wang et al., 2018; 2019; Rajpurkar et al., 2016). More importantly, new capabilities have emerged from LLMs as they are scaled to hundreds of billions of parameters (Wei et al., 2022a): in-context few-shot learning (Brown et al., 2020) makes it possible for an LLM to perform well on a task it never trained on with only a handful of examples; Chain-of-Thought (CoT) prompting (Wei et al., 2022b; Kojima et al., 2022) demonstrates strong reasoning ability of LLMs across diverse tasks with or without few-shot examples; self-consistency (Wang et al., 2022b) further improves the performance via self-evaluating multiple reasoning paths.
12
+
13
+ Despite these incredible capabilities of models trained on large text corpus (Brown et al., 2020; Chowdhery et al., 2022), fundamentally improving the model performances beyond few-shot baselines still requires finetuning on an extensive amount of high-quality supervised datasets. FLAN (Wei et al., 2021; Chung et al., 2022) and T0 (Sanh et al., 2022) curated tens of benchmark NLP datasets to boost zero-shot task performances on unseen tasks; InstructGPT (Ouyang et al., 2022) crowd-sourced many human answers for diverse sets of text instructions to better align their model to human instructions. While significant efforts were committed on collecting high-quality supervised datasets, human brain, on the contrary, is capable of the metacognition process (Dunlosky & Metcalfe, 2008), where we can refine our own reasoning ability without external inputs.
14
+
15
+ In this paper, we study how an LLM capable of in-context few-shot learning and chain-of-thought reasoning, is able to self-improve its reasoning ability without supervised data. We show that using only input sequences (without ground truth output sequences) from multiple NLP task datasets, a pre-trained LLM is able to improve performances for both in-domain and out-of-domain tasks. Our method is shown in Figure 1: we first sample multiple predictions using few-shot Chain-ofThought (CoT) (Wei et al., 2022b) as prompts, filter “high-confidence” predictions using majority voting (Wang et al., 2022b), and finally finetune the LLM on these high-confidence predictions. The resulting model shows improved reasoning in both greedy and multi-path evaluations. We call the model fine-tuned in this way as Language Model Self-Improved (LMSI). Note that LMSI depends on in-context few-shot learning and chain-of-thought reasoning abilities which small language models do not necessarily have. We empirically verify LMSI using a pre-trained 540B LLM, where our method not only improves training task performances $( 7 4 . 4 \% 8 2 . 1 \%$ on GSM8K, $7 8 . 2 \% 8 3 . 0 \%$ on DROP, $9 0 . 0 \% 9 4 . 4 \%$ on OpenBookQA, and $6 3 . 4 \% 6 7 . 9 \%$ on ANLI-A3), but also enhances out-of-domain (OOD) test tasks (AQUA, StrategyQA, MNLI), achieving state-of-the-art performances in many tasks without relying on supervised ground truth answers. Lastly, we conduct preliminary studies on self-generating additional input questions and few-shot CoT prompts, which could further reduce the amount of human effort required for model self-improving, and ablation studies on important hyperparameters of our approach. We hope our simple approach and strong empirical results could encourage more future work by the community to investigate optimal performances of pretrained LLMs without additional human supervision.
16
+
17
+ ![](images/b06f20e703216e6d931d745778703756f93a946674c388b654f0fda95a92192b.jpg)
18
+ Figure 1: Overview of our method. With Chain-of-Thought (CoT) examples as demonstration (Wei et al., 2022b), the language model generates multiple CoT reasoning paths and answers (temperature $T > 0$ ) for each question. The most consistent answer is selected by majority voting (Wang et al., 2022b). The “high-confidence” CoT reasoning paths that lead to the majority answer are augmented by mixed formats as the final training samples to be fed back to the model for fine-tuning.
19
+
20
+ Our contributions are summarized as follows:
21
+
22
+ • We demonstrate that a large language model can self-improve by taking datasets without ground truth outputs, by leveraging CoT reasoning (Wei et al., 2022b) and selfconsistency (Wang et al., 2022b), achieving competitive in-domain multi-task performances as well as out-of-domain generalization. We achieve state-of-the-art-level results on ARC, OpenBookQA, and ANLI datasets.
23
+ • We provide detailed ablation studies on training sample formatting and sampling temperature after fine-tuning, and identify critical design choices for most successful selfimprovement by LLMs.
24
+ • We study two other approaches for self-improvements, where the model generates additional questions from finite input questions and generates few-shot CoT prompt templates itself. The latter achieves $7 4 . 2 \%$ on GSM8K, which is the state-of-the-art zero-shot performance, against $4 3 . 0 \%$ by Kojima et al. (2022) or $7 0 . 1 \%$ through its naive extension with Wang et al. (2022b).
25
+
26
+ # 2 RELATED WORK
27
+
28
+ Learning from explanations. Augmenting a machine learning model with explanations has been studied in existing literature extensively. For example, in the supervised learning setting, a model can be fine-tuned using human-annotated rationales (Zaidan et al., 2007; Ling et al., 2017b; Narang et al., 2020; Camburu et al., 2018; Cobbe et al., 2021; Chung et al., 2022). A few works have also looked at how explanations can help the models in various settings, e.g., in-context learning (Lampinen et al., 2022) and in distillation (Pruthi et al., 2022). In this paper, we focus more on the unsupervised learning setting, where we do not assume we have a rationale-augmented training dataset available, since human-annotated rationales can be expensive.
29
+
30
+ Few-shot explanations improves reasoning in LLMs. Recently, a lot of progress has been made towards improving LLMs’ reasoning abilities via prompting or in-context learning. Wei et al.
31
+
32
+ (2022b) propose Chain-of-Thought prompting, which prompts the language model to generate a series of natural-language-based intermediate steps, and show it can help language models better solve complex and multi-step reasoning tasks. Wang et al. (2022b) improve Chain-of-Thought prompting by sampling multiple diverse reasoning paths and finding the most consistent answers via majority voting. Kojima et al. (2022) propose to prompt the language model with “Let’s think step by step” to generate reasoning in a zero-shot fashion. Zhou et al. (2022a) further decompose the questions into multiple sub-questions, and ask the language model to solve each sub-question sequentially.
33
+
34
+ Refining explanations. More recent work proposes to further refine the generated reasoning paths as some of them could be unreliable. For example, Ye & Durrett (2022) calibrate model predictions based on the reliability of the explanations, Jung et al. (2022) show that inducing a tree of explanations and inferring the satisfiability of each explanation can further help judge the correctness of explanations. Li et al. (2022b) show that sampling a diverse set of prompts from the training data, and a voting verifier can be used to improve model’s reasoning performance. Zelikman et al. (2022) proposes better rationale generation by augmenting ground truth answers as hints when predicted answers are incorrect. Our work is orthogonal to these lines of work, as we utilize refined explanations for model self-improvement, and could readily incorporate these other refinement techniques for generating higher-quality self-training data. Our work is similar to Zelikman et al. (2022) where we both propose to fine-tune a model on self-generated CoT data, but our method does not require ground truth labels and shows stronger empirical results with multi-task generalization.
35
+
36
+ Self-training models. One related line of work is self-training (see a survey from Amini et al. (2022)). The key idea is to assign pseudo labels from a learned classifier to unlabeled data, and use these pseudo-labeled examples to further improve the original model training, e.g., (RoyChowdhury et al., 2019; Xie et al., 2020; He et al., 2020; Chen et al., 2021). Different from such prior work, our proposed self-improvement framework uses CoT prompting plus self-consistency to obtain highconfidence solutions on a large set of unlabeled data to augment the fine-tuning process.
37
+
38
+ Distillation and dark knowledge. Our method also tangentially relates to rich literature on distillation (Ba & Caruana, 2014; Hinton et al., 2015). A key detail is to learn from soft targets instead of hard predicted labels, as softmax outputs with a high temperature reveal more detailed relative class likelihoods, colloquially known as dark knowledge (Hinton et al., 2015; Korattikara Balan et al., 2015). Recent studies (Zelikman et al., 2022; Snell et al., 2022; Eisenstein et al., 2022) show that dark knowledge within LLMs can be retrieved with more computation at inference time, such as adding informative instructions into the input sequence, and output CoT generation (Wei et al., 2022b; Kojima et al., 2022). In our work, we explicitly show that imperfect CoT reasoning (which may lead to incorrect answer) can be used directly for self-improving language models as evidenced in our experiments in Sections 5.2 and 5.3.
39
+
40
+ # 3 METHOD
41
+
42
+ The overview of our method is illustrated in Fig. 1: We are given a pre-trained Large Language Model (LLM) $M$ and a question-only training dataset $\mathcal { D } ^ { \mathrm { t r a i n } } = \{ x _ { i } \} _ { i = 1 } ^ { \hat { D } }$ with few-shot Chain-ofThought (CoT) examples (Wei et al., 2022b). We apply multiple path decoding with a sampling temperature $T > 0$ for generating $m$ reasoning paths and answers $\{ r _ { i _ { 1 } } , r _ { i _ { 2 } } , \ldots , r _ { i _ { m } } \}$ for each question $x _ { i }$ in $\mathcal { D } ^ { \tt t r a i n }$ , and use majority voting (self-consistency) to select the most consistent, highest confidence answer (Wang et al., 2022b). We then keep all reasoning paths that lead to the most consistent answer, apply mixed formats of prompts and answers for augmentation, and fine-tune the model on these self-generated reasoning-answer data. We consider our approach as making the model self-improve. In the following sections, we detail important designs within our method, along with additional approaches for the model to self-improve without supervised data.
43
+
44
+ # .1 GENERATING AND FILTERING MULTIPLE REASONING PATHS
45
+
46
+ Self-consistency (Wang et al., 2022b) brings large improvements on reasoning tasks (e.g., $5 6 . 5 \% $ $7 4 . 4 \%$ on GSM8K test set), and the gap between greedy decoding and diverse decoding shows there is a potential for further improving the reasoning ability of $M$ , using the self-selected highconfidence reasoning paths as training data.
47
+
48
+ Question: Stefan goes to a restaurant with his family. They order an appetizer that costs $\$ 10$ and 4 entrees that are $\$ 20$ each. If they tip $20 \%$ of the total, what is the total amount of money that they spend?
49
+
50
+ # Multiple Path Decoding:
51
+
52
+ Output 1: The appetizer costs $\$ 10$ . The entrees cost $\$ 20$ each so in total $4 * \ S 2 0 = \ S 8 0$ . This means the total cost is $\$ 10+580=590$ . They tip $20 \%$ of it, so the total amount they spend is $\$ 90 *1.2$ $= \$ 108$ . The answer is 108.
53
+
54
+ Output 2: The appetizer costs $\$ 10$ and the entrees are $\$ 20$ each. There are 4 entrees so the sum is $\$ 20 *4=980$ . The waiter gets $20 \%$ of the total. $20 \%$ of $\$ 80$ is $\$ 80 ^ { * }$ . $2 = \$ 16$ . The answer is $\$ 80$ $+ \$ 16= \$ 96$ . (Incorrect reasoning path)
55
+
56
+ Output 3: The appetizer costs $\$ 10$ . The entrees cost $4 * \ S 2 0 = \ S 8 0$ . The tip is $20 \%$ of the total, so it is $20 \%$ of the $\$ 90$ they have spent. The tip is $0 . 2 * 9 0 = \mathbb { S } 1 8$ . The total they spent is $\$ 90+\$ 18$ $= \$ 108$ . The answer is 108.
57
+
58
+ Table 1: Examples of 3 self-generated CoT reasoning paths given a question. Output 1 and 3 are the most consistent reasoning paths based on majority voting and kept as self-training data.
59
+
60
+ For each training question $x _ { i }$ , we sample $m$ CoT reasoning paths, denoted as $\{ r _ { i _ { 1 } } , r _ { i _ { 2 } } , \ldots , r _ { i _ { m } } \}$ (see Table 1 for examples). Since $M$ is prompted with the CoT examples from Wei et al. (2022b), we apply the same output parsing with “The answer is” to generate their predicted answers $\left\{ y _ { i _ { 1 } } , y _ { i _ { 2 } } , \ldots , y _ { i _ { m } } \right\}$ . The most consistent answer, which is not necessarily a correct answer, { 1 2 m }is selected by majority voting, denoted as y˜i = arg maxyij $\begin{array} { r } { \tilde { y } _ { i } = \arg \operatorname* { m a x } _ { y _ { i _ { j } } } \sum _ { k = 1 } ^ { m } \mathbb { I } ( y _ { i _ { j } } = y _ { i _ { k } } ) } \end{array}$ Pmk=1 I(yij = yik ). For all the training questions, we filter the CoT reasoning paths that reach $\tilde { y }$ as the final answer to be put into the self-training data, denoted as $\mathcal { D } ^ { \mathsf { s e l f - c o n s i s t e n t } } = \{ x _ { i } , \tilde { r _ { i } } \}$ , where $\tilde { r _ { i } } = \{ r _ { i _ { j } } | 1 \leq j \leq m , \bar { y } _ { i _ { j } } = \tilde { y } _ { i } \}$ .
61
+
62
+ Since we do not use any ground truth labels to filter out cases where $\tilde { y } _ { i } \ne y _ { i }$ , it is important that the self-generated CoT reasoning paths are mostly reliable and incorrect answers do not hurt the self-improvement of the model. We plot the relation between the accuracy and confidence of self-generated CoT paths for each question in GSM8K training set in Fig. 2. The confidence is the number of CoT paths leading to $\tilde { y }$ divided by the total path number $m$ . The y-axis shows the accuracy of $\tilde { y }$ under a certain confidence. The circle area and the color darkness shows the number of questions under a certain confidence. We can observe that confident answers are more likely to be correct, which means that when a question has many consistent CoT paths, then the corresponding $\tilde { y }$ is more likely to be correct. On the other hand, when $\tilde { y }$ is wrong, it is likely to be supported by fewer CoT paths, and brings little noise to the training samples.
63
+
64
+ ![](images/d3150fce00ceb89bc25ef5037a566bc7387b0929ff87945c7c6aac8d8ddf6297.jpg)
65
+ Figure 2: The relation of accuracy and confidence of the majorityvoted answer after multiple path decoding on GSM8K training-set questions. Predicted confidence from selfconsistency (Wang et al., 2022b) is well calibrated (Guo et al., 2017).
66
+
67
+ # 3.2 TRAINING WITH MIXED FORMATS
68
+
69
+ To prevent the language model from overfitting to specific prompts or answer styles, we create four different formats for each reasoning path to be mixed in the self-training data, shown in Table 2. In the first format, a few Chain-of-Thought examples (questions followed by reasoning paths leading to the correct final answers) are prepended to the new question, while the language model output is trained to be the same with the filtered CoT reasoning paths. In the second format, we use examples of questions and their direct answers as standard prompting, and the language model output is supposed to also only contain the direct answer. The third and fourth format are similar to the first and second format, except that no example of question-answer pairs are given, so that the model will learn to think on its own in an in-context zero-shot manner. In the third format, where we want the model to output CoT reasoning without prepending examples containing CoT reasonings, we append “Let’s think step by step.” at the end of the input sequence, to guide the language model to generate step-by-step CoT reasoning paths (Kojima et al., 2022). The mixed formats of training samples are then used to fine-tune the pre-trained language model $M$ .
70
+
71
+ <table><tr><td>Question: Amy is 1O years old. Jake is 8 years old. Alex&#x27;s age is right in the middle. How old is Alex? Selected Chain-of-Thought: Amy is 1O years old.Jake is 8 years old.Alex&#x27;s age is in the middle of Amy and Jake,so Alex is(8+10)/2=9 years old. The answer is 9.</td></tr><tr><td>Mixed-formats of training data: Format 1: Input: [CoT prompting examples] +‘\n’ + [Question] +‘\n’+‘A:&#x27; Output: Amy is 10 years old. Jake is 8 years old. Alex&#x27;s age is in the middle of Amy and Jake, so Alex</td></tr><tr><td>is (8 + 10)/2=9 years old. The answer is 9. Format 2: Input: [Standard prompting examples] +‘\n&#x27;+ [Question] +‘\n’ +‘A:&#x27;</td></tr><tr><td>Output: The answer is 9. Format 3: Input: [Question] +‘\n’ +‘A: Let&#x27;s think step by step.&#x27;</td></tr><tr><td>Output: Amy is 10 years old. Jake is 8 years old. Alex&#x27;s age is in the middle of Amy and Jake,so Alex</td></tr><tr><td></td></tr><tr><td>is (8 + 10)/2=9 years old. The answer is 9.</td></tr><tr><td>Format 4: Input: [Question] +‘\n’ +‘A:&#x27; Output: The answer is 9.</td></tr></table>
72
+
73
+ Table 2: An example of how a reasoning path is augmented into four formats of training data with different prompts (in input) and answer styles (in output). Specifically, the CoT prompting examples used for each tasks are listed in Appendix A.2. The Standard prompting examples are the same question-answer pairs with CoT prompting examples, except that reasoning is removed.
74
+
75
+ # 3.3 GENERATING QUESTIONS AND PROMPTS
76
+
77
+ Given a set of training questions and a few human-written Chain-of-Thought (CoT) examples as prompts, our proposed approach enables model self-improvement. However, when the amount of training questions or CoT examples is limited, our method may not generate sufficient training samples for language model self-training. Collecting questions from the web requires human engineering. To further reduce human effort, we investigate how to self-generate more training questions as well as example prompts.
78
+
79
+ Question Generation Previous work (Yoo et al., 2021; Meng et al., 2022) discuss few-shot data augmentation by generating diverse training samples using LLMs. However, those methods are designed for classification tasks and require ground truth label for each few-shot example. We use a simple yet effective approach to generate diverse questions (without ground truth answers) for in-domain questions. Specifically, we randomly select several existing questions, concatenate them in a random order as input prompt, and let the language model generate consecutive sequences as new questions. We repeat the process to obtain a large set of new questions, then use selfconsistency (Wang et al., 2022b) to only keep the questions that have a highly confident answer. Those questions are then used as self-generated training questions.
80
+
81
+ Prompt Generation Given a set of questions, humans can write CoT examples as reasoning paths leading to the final answer. In zero-shot setting without manual prompts, we can generate these CoT paths using the model itself. Following Kojima et al. (2022), we start the answer with “A: Let’s think step by step.” and let the language model generate the consecutive reasoning paths. We then use those generated reasoning paths as examples for few-shot CoT prompting.
82
+
83
+ # 4 EXPERIMENTAL SETUP
84
+
85
+ Tasks and Datasets. We demonstrate the effectiveness of our method on three types of tasks1:
86
+
87
+ • Arithmetic reasoning: We use the math problem set GSM8K (Cobbe et al., 2021), and a reading comprehension benchmark DROP (Dua et al., 2019) which requires numerical reasoning. We follow Zhou et al. (2022a) to partition the DROP dataset into football related and non-football related subsets for training.
88
+
89
+ • Commonsense reasoning: We use the OpenBookQA (Mihaylov et al., 2018) dataset, and the AI2 Reasoning Challenge (ARC) (Clark et al., 2018) dataset. Note that for ARC, we only use the Challenge sub-set (ARC-c) in our experiments. Both datasets contain multiple-choice questions.
90
+
91
+ • Natural Language Inference: We use the Adversarial NLI (ANLI) (Mihaylov et al., 2018) subsets, ANLI-A2 and ANLI-A3, which are the more challenging subsets compared to ANLI-A1. These datasets contain pairs of sentences with relations of entailment, neutral, or contradiction.
92
+
93
+ Models, Training settings and Hyperparameters We follow previous studies (Wei et al., 2022b; Wang et al., 2022b) and conduct our experiments on an autoregressive Transformer-based language model with 540 billion parameters. The CoT examples for each dataset are listed in Appendix A.2. We generate $m = 3 2$ reasoning paths for each question in a training set. Since each reasoning path is augmented into four formats in Sec. 3.2, the final training samples are up to the size of $\bar { 1 } 2 8 \times \lvert \mathscr { D } ^ { \mathrm { t r a i n } } \rvert$ , with $\left| \mathcal { D } ^ { \mathtt { t r a i n } } \right|$ being the size of the corresponding training set. For all datasets except DROP, we use the whole training set; To reduce the training burden, we sample 5k examples from the non-football and football partition of the DROP dataset, and sample $5 \mathrm { k }$ examples from ANLI-A2 and ANLI-A3. For each dataset, we fine-tune the model for 10k steps with a learning rate of 5e−5 and a batch size of 32. For multiple path decoding, we use a sampling temperature of $T = 0 . 7$ with the pre-trained model as suggested by Wang et al. (2022b). We use $T = 1 . 2$ for the language model after self-improvement (LMSI). We set the maximum number of decoded steps to 256 for all experiments.
94
+
95
+ # 5 RESULTS
96
+
97
+ We conduct a series of experiments to demonstrate the effectiveness of our proposed self-improving method. First, we apply our method on each individual dataset (task) and report the results. We then merge the generated data from all datasets and train one model to study the generalization ability of the model on unseen datasets as in (Wei et al., 2021). In addition to the results of using generated CoT reasoning paths, we show studies on generating input questions and few-shot prompts. We end with ablation studies on model sizes and hyperparameters.
98
+
99
+ # 5.1 MAIN RESULTS
100
+
101
+ <table><tr><td></td><td>Prompting Method</td><td>GSM8K</td><td>DROP</td><td>ARC-c</td><td>OpenBookQA</td><td>ANLI-A2</td><td>ANLI-A3</td></tr><tr><td></td><td>Previous SOTA</td><td>82.3a</td><td>84.9b</td><td>88.7c</td><td>91.0d</td><td>64.9d</td><td>66.0d</td></tr><tr><td rowspan="3">w/o LMSI</td><td>Standard-Prompting</td><td>17.9</td><td>60.0</td><td>87.1</td><td>84.4</td><td>55.8</td><td>55.8</td></tr><tr><td>CoT-Prompting</td><td>56.5</td><td>70.6</td><td>85.2</td><td>86.4</td><td>58.9</td><td>60.6</td></tr><tr><td>Self-Consistency</td><td>74.4</td><td>78.2</td><td>88.7</td><td>90.0</td><td>64.5</td><td>63.4</td></tr><tr><td rowspan="3">LMSI</td><td>Standard-Prompting</td><td>32.2</td><td>71.7</td><td>87.2</td><td>92.0</td><td>64.8</td><td>66.9</td></tr><tr><td>CoT-Prompting</td><td>73.5</td><td>76.2</td><td>88.3</td><td>93.0</td><td>65.3</td><td>67.3</td></tr><tr><td>Self-Consistency</td><td>82.1</td><td>83.0</td><td>89.8</td><td>94.4</td><td>66.5</td><td>67.9</td></tr></table>
102
+
103
+ Table 3: Accuracy results on six reasoning benchmarks. The previous SOTA results are from: (a) Li et al. (2022a), (b) Zhou et al. (2022b), (c) Wang et al. (2022b), (d) Wang et al. (2022a).
104
+
105
+ We list the results of using the 540B model before and after LMSI in Table 3. For each model, during test time, we apply three separate prompting methods on all six datasets: standard-prompting, CoT-Prompting, and Self-Consistency. We observe that after LMSI, the performance of all three prompting methods increase by a large margin. We observe significant improvement, comparing self-consistency versus LMSI with self-consistency: $+ 7 . 7 \%$ on GSM8K, $+ 4 . 8 \%$ on DROP, $+ 4 . 4 \%$ on OpenBookQA, and $+ 4 . 5 \%$ on ANLI-A3. This shows that our proposed method is quite effective. Furthermore, the single path CoT-Prompting performance of LMSI is close to or even better than the multiple path Self-Consistency performance of the model without LMSI, showing that LMSI truly helps the language model learn from the multiple consistent reasoning paths. We also compare our results with previous SOTA, achieved by different methods on different datasets, listed in Table 3. On ARC-c, OpenBookQA, ANLI-A2 and ANLI-A3, LMSI outperforms previous SOTA. On GSM8K dataset, LMSI is close to the DiVeRSe approach (Li et al., 2022a) which uses diverse prompts and a voting verifier to ensemble 100 output paths. On the contrary, we only use 32 output paths for self-generating training samples and for self-consistency with LMSI. On the DROP dataset, LMSI is close to the OPERA approach (Zhou et al., 2022b) which uses ground truth labels for training. On the other hand, our method only leverages the questions in the training set, without using ground truth labels.
106
+
107
+ Table 4: Comparison of CoT-prompting accuracy results on six Out-Of-Domain benchmarks with or without training on six In-Domain (GSM8K, DROP, ARC-c, OpenBookQA, ANLI-A2, ANLI-A3) training-set questions.
108
+
109
+ <table><tr><td></td><td>Self-training data</td><td>AQUA</td><td>SVAMP</td><td>StrategyQA</td><td>ANLI-A1</td><td>RTE</td><td>MNLI-M/MM</td></tr><tr><td>w/o LMSI</td><td>-</td><td>35.8</td><td>79.0</td><td>75.3</td><td>68.8</td><td>79.1</td><td>72.0/74.0</td></tr><tr><td>LMSI</td><td>GSM8K + DROP +...</td><td>39.0</td><td>82.8</td><td>77.8</td><td>79.2</td><td>80.1</td><td>81.8/82.2</td></tr></table>
110
+
111
+ Multi-task self-training for unseen tasks To demonstrate the generalization ability of LMSI, we conduct experiments of self-training on a mixture of the training-set questions from the above six datasets (denoted as In-Domain tasks), then use the same model checkpoint for the evaluation on six Out-Of-Domain (OOD) tasks, as shown in Table 4. Of all the OOD tasks: (1) AQUA (Ling et al., 2017a) and SVAMP (Patel et al., 2021) are arithmetic reasoning tasks; (2) StrategyQA (Geva et al., 2021) is a commonsense reasoning task; (3) ANLI-A1 (Mihaylov et al., 2018), RTE (Dagan et al., 2005) and MNLI-M/MM (Williams et al., 2018) are natural language inference tasks.2 Among these tasks, AQUA, StrategyQA, and RTE are significantly different from any In-Domain task. These three tasks have their own few-shot prompts. From Table 4, we can observe that LMSI achieves higher accuracy results on all OOD tasks, showing that the overall reasoning ability of the language model is improved.
112
+
113
+ Table 5: Ablation study: w/ or w/o CoT reasoning paths as training format on GSM8K dataset.
114
+
115
+ <table><tr><td colspan="2">Results on GSM8K</td></tr><tr><td></td><td>Standard Prompting CoT Prompting</td></tr><tr><td>w/o LMSI</td><td>17.9 56.5</td></tr><tr><td>LMSI w/o CoT formats 23.6</td><td>61.6</td></tr><tr><td>LMSI</td><td>32.2 73.5</td></tr></table>
116
+
117
+ Importance of training with Chain-of-Thought formats We demonstrate the importance of training language models with Chain-of-Thoughts compared to training with only direct answers. In Table 5, we list the results of LMSI with all four formats, and the results of LMSI with only direct answer formats. The results clearly show that without the CoT formats, the language model can still self-improve, but the performance gain drops by a large amount compared to using all four formats.
118
+
119
+ # 5.2 PUSHING THE LIMIT OF SELF-IMPROVEMENTS
120
+
121
+ Self-Generating Questions We further explore the few-shot setting where there are only limited training questions in the target domain. On GSM8K, we sample 10 real questions as few-shot samples, and use the language model to generate more training questions using the method in Section 3.3. We then self-train the language model with these generated questions and list the results in Table 6. The results show that using self-generated questions still improves the reasoning ability of language models, but using the real training-set questions leads to better results.
122
+
123
+ Table 6: Accuracy on GSM8K test set after self-training on self-generated or training set questions.
124
+
125
+ <table><tr><td></td><td>Questions used for Self-Training</td><td colspan="2">Results on GSM8K CoT-Prompting Self-Consistency</td></tr><tr><td>w/o LMSI</td><td>=</td><td>56.5</td><td>74.4</td></tr><tr><td>LMSI</td><td>Generated Questions</td><td>66.2</td><td>78.1</td></tr><tr><td>LMSI</td><td>Training-set Questions</td><td>73.5</td><td>82.1</td></tr></table>
126
+
127
+ ![](images/bc0a159b60dca8628f5de89417a1518661fd75054c350ebaa453511279752914.jpg)
128
+ Figure 3: Accuracy results on GSM8K test set using 540B model with multi-path sampling and self-consistency (Wang et al., 2022b). “Step-by-Step” is the baseline performance of Kojima et al. (2022) plus self-consistency (Wang et al., 2022b), while our “Few-Shot w/ Step-by-Step” uses exemplers self-generated from Step-by-Step (greedy decoding) for few-shot prompting the LLM.
129
+
130
+ Self-Generating Few-Shot CoT Prompts We explore the situation where no in-domain CoT examples are provided for a task. We apply the Step-by-Step method (Kojima et al., 2022) to generate CoT examples using the language model as described in Section 3.3, and show the results in Figure 3. We observe that few-shot prompting with self-generated Step-by-Step CoT examples substantially outperforms the Step-by-Step (Kojima et al., 2022) baseline $6 6 . 2 \%$ vs $5 3 . 8 \%$ at 10 paths, $7 4 . 2 \%$ vs $7 0 . 1 \%$ at 40 paths), and nearly matches the performance of human-written few-shot CoT (Wei et al., 2021) $7 4 . 4 \%$ at 40 paths (Wang et al., 2022b)). The strong performance of “Few-Shot w/ Stepby-Step” despite the limited accuracy of prompt examples $4 3 . 0 \%$ for greedy Step-by-Step) likely comes from leveraging more diverse CoT prompts for multi-path decoding (Li et al., 2022a), where at 40 paths it uses 20 generate prompt-templates, each with 4-shot CoT examples, i.e. a total of 80 generated CoT examples compared to 8 human-written examples use in Wei et al. (2022b). Since we did not use training questions or few-shot CoT examples, $7 4 . 2 \%$ also marks the new state-of-the-art zero-shot performance on GSM8K.
131
+
132
+ # 5.3 DISTILLATION TO SMALLER MODELS
133
+
134
+ <table><tr><td></td><td colspan="3">Results on GSM8K</td></tr><tr><td></td><td>8 billion</td><td>62 billion</td><td>540 billion</td></tr><tr><td>w/o LMSI</td><td>5.0</td><td>29.7</td><td>56.5</td></tr><tr><td>Distilled from LMSI 540 billion</td><td>33.4</td><td>57.4</td><td>1</td></tr></table>
135
+
136
+ Table 7: Distillation from 540B model to small models. We see that distilled smaller models outperform models that are one-tier larger.
137
+
138
+ We also explore whether the knowledge can be distilled to smaller models, such as in distillation (Hinton et al., 2015) and in Zelikman et al. (2022). We use the same set of training samples generated by the 540B model, but fine-tune on models with smaller sizes (8B and 62B respectively), and show the results of CoT-prompting in Table 7. It is interesting to point out that after distillation from LMSI, the 62 billion model can outperform the pre-trained 540 billion model, and the 8 billion model can outperform the pre-trained 62 billion model. This implies that for downstream applications with limited computing resources, the reasoning knowledge from large models can be used to largely enhance small models to achieve competitive performance.
139
+
140
+ # 5.4 HYPERPARAMETER STUDY
141
+
142
+ ![](images/5e5a5db1f98580fc7054105b047f24932ac635694f991fc2239c4bbec58a9854.jpg)
143
+ Figure 4: Hyperparameter study results.
144
+
145
+ Sampling Temperature after Self-Improvement We study the effect of varying the temperature $T$ for multiple path decoding after LMSI is applied. Specifically, we vary $T$ between [0.7, 1.0, 1.2, 1.5] and show the results on GSM8K and DROP dataset respectively in Fig. 4(a). As shown in the figure, $T = 1 . 2$ benefits both datasets the most, and is used in the Self-Consistency method for LMSI on all datasets. We notice that the optimal $T$ after model self-improvement is larger than the optimal $T = 0 . 7$ (Wang et al., 2022b) before self-improvement. We believe the reason is that after training the model, the entropy of the output distribution is reduced.
146
+
147
+ Number of Sampled Reasoning Paths We study whether the number of sampled reasoning paths $m$ for Self-Consistency largely affects the accuracy after LMSI is applied. We show the accuracy on GSM8K test set for models both with or without LMSI in Fig. 4(b). For both cases, setting $m = 1 5$ already achieves a reasonably good accuracy, and using a larger $m$ only brings marginal improvements. We also notice that after Self-Improvement, using 5 paths for Self-Consistency can already surpass the performance of using 32 paths for model without Self-Improvement. Thus, with a well-improved model, huge computing resources can be saved when applied to real applications.
148
+
149
+ # 6 CONCLUSIONS
150
+
151
+ We demonstrated that a Large Language Model (LLM) is capable of improving its performance on reasoning datasets by training on its own generated labels, given input questions only. Experiments using an LLM with 540 billion parameters show that our approach improves the accuracy scores on the six datasets by $1 . 1 \%$ to $7 . 7 \%$ , achieving new state-of-the-art results on ARC, OpenBookQA, and ANLI, without training on ground truth labels. Furthermore, we show that it is possible for the LLM to self-improve even on its own generated questions and few-shot Chain-of-Thought prompts. As part of our future work, we plan to combine large-scale generated data from our approach and existing supervised data, to further improve the performance of LLMs.
152
+
153
+ # REFERENCES
154
+
155
+ Massih-Reza Amini, Vasilii Feofanov, Loic Pauletto, Emilie Devijver, and Yury Maximov. Selftraining: A survey, 2022. URL https://arxiv.org/abs/2202.12040.
156
+
157
+ Jimmy Ba and Rich Caruana. Do deep nets really need to be deep? Advances in neural information processing systems, 27, 2014.
158
+
159
+ BIG bench collaboration. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models. ArXiv, abs/2206.04615, 2022.
160
+
161
+ Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, T. J. Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeff Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In Neurips, 2020.
162
+
163
+ Oana-Maria Camburu, Tim Rocktaschel, Thomas Lukasiewicz, and Phil Blunsom.¨ esnli: Natural language inference with natural language explanations. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 9539–9549. Curran Associates, Inc., 2018. URL http://papers.nips.cc/paper/ 8163-e-snli-natural-language-inference-with-natural-language-explanations. pdf.
164
+
165
+ Xiaokang Chen, Yuhui Yuan, Gang Zeng, and Jingdong Wang. Semi-supervised semantic segmentation with cross pseudo supervision. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
166
+
167
+ Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh, Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek B Rao, Parker Barnes, Yi Tay, Noam M. Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Benton C. Hutchinson, Reiner Pope, James Bradbury, Jacob Austin, Michael Isard, Guy Gur-Ari, Pengcheng Yin, Toju Duke, Anselm Levskaya, Sanjay Ghemawat, Sunipa Dev, Henryk Michalewski, Xavier Garc´ıa, Vedant Misra, Kevin Robinson, Liam Fedus, Denny Zhou, Daphne Ippolito, David Luan, Hyeontaek Lim, Barret Zoph, Alexander Spiridonov, Ryan Sepassi, David Dohan, Shivani Agrawal, Mark Omernick, Andrew M. Dai, Thanumalayan Sankaranarayana Pillai, Marie Pellat, Aitor Lewkowycz, Erica Oliveira Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee, Zongwei Zhou, Xuezhi Wang, Brennan Saeta, Mark D´ıaz, Orhan Firat, Michele Catasta, Jason Wei, Kathleen S. MeierHellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. Palm: Scaling language modeling with pathways. ArXiv, abs/2204.02311, 2022.
168
+
169
+ Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, Adams Yu, Albert Webson, Xinyun Chen, Gaurav Mishra, Zhuyun Dai, Shixiang Shane Gu, Mirac Suzgun, Vincent Zhao, Aakanksha Chowdhery, Sharan Narang, Yanping Huang, Andrew Dai, Hongkun Yu, Ed H. Chi, Jeff Dean, Jacob Devlin, Adam Roberts, Denny Zhou, Quoc V. Le, and Jason Wei. Scaling instruction-finetuned language models. In arxiv, 2022.
170
+
171
+ Peter Clark, Isaac Cowhey, Oren Etzioni, Tushar Khot, Ashish Sabharwal, Carissa Schoenick, and Oyvind Tafjord. Think you have solved question answering? try arc, the ai2 reasoning challenge. ArXiv, abs/1803.05457, 2018.
172
+
173
+ Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems. ArXiv, abs/2110.14168, 2021.
174
+
175
+ Ido Dagan, Oren Glickman, and Bernardo Magnini. The pascal recognising textual entailment challenge. In MLCW, 2005.
176
+
177
+ Dheeru Dua, Yizhong Wang, Pradeep Dasigi, Gabriel Stanovsky, Sameer Singh, and Matt Gardner. Drop: A reading comprehension benchmark requiring discrete reasoning over paragraphs. In NAACL, 2019.
178
+
179
+ John Dunlosky and Janet Metcalfe. Metacognition. Sage Publications, 2008.
180
+
181
+ Jacob Eisenstein, Daniel Andor, Bernd Bohnet, Michael Collins, and David Mimno. Honest students from untrusted teachers: Learning an interpretable question-answering pipeline from a pretrained language model. arXiv preprint arXiv:2210.02498, 2022.
182
+
183
+ Mor Geva, Daniel Khashabi, Elad Segal, Tushar Khot, Dan Roth, and Jonathan Berant. Did aristotle use a laptop? a question answering benchmark with implicit reasoning strategies. Transactions of the Association for Computational Linguistics, 9:346–361, 2021.
184
+
185
+ Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On calibration of modern neural networks. In International conference on machine learning, pp. 1321–1330. PMLR, 2017.
186
+
187
+ Junxian He, Jiatao Gu, Jiajun Shen, and Marc’Aurelio Ranzato. Revisiting self-training for neural sequence generation. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $_ { \cdot } =$ SJgdnAVKDH.
188
+
189
+ Geoffrey Hinton, Oriol Vinyals, Jeff Dean, et al. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2(7), 2015.
190
+
191
+ Jaehun Jung, Lianhui Qin, Sean Welleck, Faeze Brahman, Chandra Bhagavatula, Ronan Le Bras, and Yejin Choi. Maieutic prompting: Logically consistent reasoning with recursive explanations, 2022. URL https://arxiv.org/abs/2205.11822.
192
+
193
+ Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. Neural Information Processing Systems (NeurIPS), 2022.
194
+
195
+ Anoop Korattikara Balan, Vivek Rathod, Kevin P Murphy, and Max Welling. Bayesian dark knowledge. Advances in neural information processing systems, 28, 2015.
196
+
197
+ Andrew K. Lampinen, Ishita Dasgupta, Stephanie C. Y. Chan, Kory Matthewson, Michael Henry Tessler, Antonia Creswell, James L. McClelland, Jane X. Wang, and Felix Hill. Can language models learn from explanations in context?, 2022. URL https://arxiv.org/abs/2204. 02329.
198
+
199
+ Yifei Li, Zeqi Lin, Shizhuo Zhang, Qiang Fu, Bei Chen, Jian-Guang Lou, and Weizhu Chen. On the advance of making language models better reasoners. ArXiv, abs/2206.02336, 2022a.
200
+
201
+ Yifei Li, Zeqi Lin, Shizhuo Zhang, Qiang Fu, Bei Chen, Jian-Guang Lou, and Weizhu Chen. On the advance of making language models better reasoners, 2022b. URL https://arxiv.org/ abs/2206.02336.
202
+
203
+ Wang Ling, Dani Yogatama, Chris Dyer, and Phil Blunsom. Program induction by rationale generation: Learning to solve and explain algebraic word problems. In ACL, 2017a.
204
+
205
+ Wang Ling, Dani Yogatama, Chris Dyer, and Phil Blunsom. Program induction by rationale generation: Learning to solve and explain algebraic word problems. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), 2017b. doi: 10.18653/v1/P17-1015. URL https://aclanthology.org/P17-1015.
206
+
207
+ Yu Meng, Jiaxin Huang, Yu Zhang, and Jiawei Han. Generating training data with language models: Towards zero-shot language understanding. ArXiv, abs/2202.04538, 2022.
208
+
209
+ Todor Mihaylov, Peter Clark, Tushar Khot, and Ashish Sabharwal. Can a suit of armor conduct electricity? a new dataset for open book question answering. In EMNLP, 2018.
210
+
211
+ Sharan Narang, Colin Raffel, Katherine Lee, Adam Roberts, Noah Fiedel, and Karishma Malkan. Wt5?! training text-to-text models to explain their predictions, 2020. URL https://arxiv. org/abs/2004.14546.
212
+
213
+ 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.
214
+
215
+ Arkil Patel, S. Bhattamishra, and Navin Goyal. Are nlp models really able to solve simple math word problems? In NAACL, 2021.
216
+
217
+ Danish Pruthi, Rachit Bansal, Bhuwan Dhingra, Livio Baldini Soares, Michael Collins, Zachary C. Lipton, Graham Neubig, and William W. Cohen. Evaluating Explanations: How Much Do Explanations from the Teacher Aid Students? Transactions of the Association for Computational Linguistics, 10:359–375, 04 2022. ISSN 2307-387X. doi: 10.1162/tacl a 00465. URL https://doi.org/10.1162/tacl_a_00465.
218
+
219
+ Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: $1 0 0 { , } 0 0 0 { + }$ questions for machine comprehension of text. In EMNLP, 2016.
220
+
221
+ Aruni RoyChowdhury, Prithvijit Chakrabarty, Ashish Singh, SouYoung Jin, Huaizu Jiang, Liangliang Cao, and Erik G. Learned-Miller. Automatic adaptation of object detectors to new domains using self-training. In CVPR, pp. 780–790, 2019. URL http: //openaccess.thecvf.com/content_CVPR_2019/html/RoyChowdhury_ Automatic_Adaptation_of_Object_Detectors_to_New_Domains_Using_ Self-Training_CVPR_2019_paper.html.
222
+
223
+ Victor Sanh, Albert Webson, Colin Raffel, Stephen H Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, et al. Multitask prompted training enables zero-shot task generalization. In ICLR, 2022.
224
+
225
+ Charlie Snell, Dan Klein, and Ruiqi Zhong. Learning by distilling context. arXiv preprint arXiv:2209.15189, 2022.
226
+
227
+ Yi Tay, Mostafa Dehghani, Vinh Quang Tran, Xavier Garc´ıa, Jason Wei, Xuezhi Wang, Hyung Won Chung, Dara Bahri, Tal Schuster, Huaixiu Zheng, Denny Zhou, Neil Houlsby, and Donald Metzler. Ul2: Unifying language learning paradigms. 2022.
228
+
229
+ Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. In BlackboxNLP@EMNLP, 2018.
230
+
231
+ Alex Wang, Yada Pruksachatkun, Nikita Nangia, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. Superglue: A stickier benchmark for general-purpose language understanding systems. ArXiv, abs/1905.00537, 2019.
232
+
233
+ Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. Rationaleaugmented ensembles in language models. ArXiv, abs/2207.00747, 2022a.
234
+
235
+ Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. ArXiv, abs/2203.11171, 2022b.
236
+
237
+ Jason Wei, Maarten Bosma, Vincent Y Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M Dai, and Quoc V Le. Finetuned language models are zero-shot learners. arXiv preprint arXiv:2109.01652, 2021.
238
+
239
+ Jason Wei, Yi Tay, Rishi Bommasani, Colin Raffel, Barret Zoph, Sebastian Borgeaud, Dani Yogatama, Maarten Bosma, Denny Zhou, Donald Metzler, et al. Emergent abilities of large language models. arXiv preprint arXiv:2206.07682, 2022a.
240
+
241
+ Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Brian Ichter, Fei Xia, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. Advances in Neural Information Processing Systems, 35, 2022b.
242
+
243
+ Adina Williams, Nikita Nangia, and Samuel R. Bowman. A broad-coverage challenge corpus for sentence understanding through inference. In NAACL, 2018.
244
+
245
+ Qizhe Xie, Minh-Thang Luong, Eduard Hovy, and Quoc V. Le. Self-training with noisy student improves imagenet classification. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10684–10695, 2020. doi: 10.1109/CVPR42600.2020.01070.
246
+
247
+ Xi Ye and Greg Durrett. The unreliability of explanations in few-shot in-context learning, 2022.
248
+
249
+ Kang Min Yoo, Dongju Park, Jaewook Kang, Sang-Woo Lee, and Woomyeong Park. Gpt3mix: Leveraging large-scale language models for text augmentation. In EMNLP Findings, 2021.
250
+
251
+ Omar Zaidan, Jason Eisner, and Christine Piatko. Using “annotator rationales” to improve machine learning for text categorization. NAACL, 2007. URL https://aclanthology.org/ N07-1033.
252
+
253
+ Eric Zelikman, Yuhuai Wu, Jesse Mu, and Noah D. Goodman. Star: Bootstrapping reasoning with reasoning, 2022. URL https://arxiv.org/abs/2203.14465.
254
+
255
+ Denny Zhou, Nathanael Scharli, Le Hou, Jason Wei, Nathan Scales, Xuezhi Wang, Dale Schuurmans, Olivier Bousquet, Quoc Le, and Ed Chi. Least-to-most prompting enables complex reasoning in large language models. ArXiv, abs/2205.10625, 2022a.
256
+
257
+ Yongwei Zhou, Junwei Bao, Chaoqun Duan, Haipeng Sun, Jiahui Liang, Yifan Wang, Jing Zhao, Youzheng Wu, Xiaodong He, and Tiejun Zhao. Opera: Operation-pivoted discrete reasoning over text. In NAACL, 2022b.
258
+
259
+ # A APPENDIX
260
+
261
+ # A.1 RESULTS ON UL2 MODEL
262
+
263
+ We also apply LMSI on a recently proposed public language model, UL2 (Tay et al., 2022), using the pre-trained model at step $2 , 6 5 0 , \dot { 0 } 0 0 ^ { 3 }$ . We use a fixed set of hyperparameters for fine-tuning on each dataset. Specifically, we generate $m = 4 0$ reasoning paths for each question in a training set for majority voting. We fine-tune the model for 10k steps with a learning rate of 5e−5 and a batch size of 32. For multiple path decoding, we use a sampling temperature of $T = 0 . 5$ with the pre-trained UL2 model following Tay et al. (2022), and set $T = 0 . 7$ for the language model after LMSI. We set the maximum number of decode steps to 256 for all experiments.
264
+
265
+ The results are shown in Table 8. For arithmetic reasoning datasets, we follow (Tay et al., 2022) to provide both exact matching accuracy scores as well as accuracy scores after an equation-correction postprocessing step. We observe that for most datasets, LMSI still improves the reasoning accuracy $( + 1 . 6 \%$ on DROP, $+ 1 . 2 \%$ on OpenBookQA, and $+ 0 . 7 \%$ on ANLI-A2), but the improvement on UL2 is not as large as that on 540B. We think the reason is that, since LMSI exploits the implicit rationale of language models, and the capacity of a language model is determined by its size, larger models can capture more high-order semantics and are more likely to benefit from LMSI. For example, on the adversarial entailment tasks of ANLI (which is a three-class classification problem with labels “yes”, “no”, or “it is not possible to tell”), the UL2 model w/o LMSI only achieves an accuracy of marginally above $1 / 3$ , implying that the model is slightly better than doing random guess on this challenging task without any training. Our proposed LMSI can still improve the performance under this hard case by training on its implicit knowledge from self-generated paths.
266
+
267
+ <table><tr><td></td><td>Prompting Method</td><td>GSM8K</td><td>DROP</td><td>ARC-c</td><td>OpenBookQA</td><td>ANLI-A2</td><td>ANLI-A3</td></tr><tr><td> w/o LMSI</td><td>CoT-Prompting Self-Consistency</td><td>5.4/7.1 6.4/9.9</td><td>11.1/16.8 16.8/26.5</td><td>49.9 54.9</td><td>53.6 54.0</td><td>35.9 37.4</td><td>33.8 36.8</td></tr><tr><td>LMSI</td><td>CoT-Prompting Self-Consistency</td><td>6.1/8.6 7.9/10.2</td><td>11.4/17.1 18.1/28.1</td><td>50.9 54.7</td><td>53.8 55.2</td><td>35.4 38.1</td><td>34.4 37.4</td></tr></table>
268
+
269
+ Table 8: Accuracy results on six reasoning benchmarks with LMSI on UL2. On GSM8K and DROP, we also include accuracy scores after an equation-correction postprocessing step.
270
+
271
+ # A.2 CHAIN-OF-THOUGHT PROMPTS FOR EACH DATASET
272
+
273
+ We list the Chain-of-Thought Prompts for each dataset for “CoT-Prompting” experiments and selfgenerated training samples.
274
+
275
+ Q: Poison causes harm to which of the following? (a) a Tree (b) a robot (c) a house (d) a car
276
+ A: Poison will harm living things, only a tree is a living thing. The answer is (a).
277
+ Q: As you look deeper into a Marbel you can see (a) the future (b) minut defects (c) colors (d) the other side A: Marbel is not transparent, so you can not see the other side. Marbel does not necessarily have multiple colors. You will see minut defects. The answer is (b).
278
+ Q: When food is reduced in the stomach (a) the mind needs time to digest (b) take a second to digest what I said (c) nutrients are being deconstructed (d) reader’s digest is a body of works
279
+ A: The food is being deconstructed in the stomach during digestion. The answer is (c).
280
+ Q: The sun is responsible for (a) puppies learning new tricks (b) children growing up and getting old (c) flowers wilting in a vase (d) plants sprouting, blooming and wilting
281
+ A: The sun can affect the growing of living things, like plants. The answer is (d). Q: There are 15 trees in the grove. Grove workers will plant trees in the grove today. After they are done, there will be 21 trees. How many trees did the grove workers plant today?
282
+ A: We start with 15 trees. Later we have 21 trees. The difference must be the number of trees they planted. So, they must have planted $2 1 - 1 5 = 6$ trees. The answer is 6.
283
+ Q: If there are 3 cars in the parking lot and 2 more cars arrive, how many cars are in the parking lot? A: There are 3 cars in the parking lot already. 2 more arrive. Now there are $3 + 2 = 5$ cars. The answer is 5. Q: Leah had 32 chocolates and her sister had 42. If they ate 35, how many pieces do they have left in total? A: Leah had 32 chocolates and Leah’s sister had 42. That means there were originally $3 2 + 4 2 = 7 4$ chocolates. 35 have been eaten. So in total they still have $7 4 - 3 5 = 3 9$ chocolates. The answer is 39. Q: Jason had 20 lollipops. He gave Denny some lollipops. Now Jason has 12 lollipops. How many lollipops did Jason give to Denny?
284
+ A: Jason had 20 lollipops. Since he only has 12 now, he must have given the rest to Denny. The number of lollipops he has given to Denny must have been $2 0 - 1 2 = 8 $ lollipops. The answer is 8.
285
+ Q: Shawn has five toys. For Christmas, he got two toys each from his mom and dad. How many toys does he have now?
286
+ A: He has 5 toys. He got 2 from mom, so after that he has $5 + 2 = 7$ toys. Then he got 2 more from dad, so in total he has $7 + 2 = 9$ toys. The answer is 9.
287
+ Q: There were nine computers in the server room. Five more computers were installed each day, from monday to thursday. How many computers are now in the server room?
288
+ A: There are 4 days from monday to thursday. 5 computers were added each day. That means in total 4 $^ { * } 5 = 2 0$ computers were added. There were 9 computers in the beginning, so now there are $9 + 2 0 = 2 9$ computers. The answer is 29.
289
+ Q: Michael had 58 golf balls. On tuesday, he lost 23 golf balls. On wednesday, he lost 2 more. How many golf balls did he have at the end of wednesday?
290
+ A: Michael initially had 58 balls. He lost 23 on Tuesday, so after that he has $5 8 \textrm { - } 2 3 = 3 5$ balls. On Wednesday he lost 2 more so now he has $3 5 - 2 = 3 3$ balls. The answer is 33.
291
+ Q: Olivia has $\$ 23$ . She bought five bagels for $\$ 3$ each. How much money does she have left?
292
+ A: She bought 5 bagels for $\$ 3$ each. This means she spent $5 * \ S 3 = \ S 1 5$ on the bagels. She had $\$ 23$ in beginning, so now she has $\$ 23-\$ 515=58$ . The answer is 8.
293
+
294
+ Q: Since the 1970s, U.S. governments have negotiated managed-trade agreements, such as the North American Free Trade Agreement in the 1990s, the Dominican Republic-Central America Free Trade Agreement in 2006, and a number of bilateral agreements. In Europe, six countries formed the European Coal and Steel Community in 1951 which became the European Economic Community in 1958. Two core objectives of the EEC were the development of a common market, subsequently renamed the single market, and establishing a customs union between its member states. How many years did the European Coal and Steel Community exist?
295
+
296
+ A: According to the passage, the European Coal and Steel Community was established in 1951 and became the EEC in 1958. 1958 - $1 9 5 1 = 7$ . So the answer is 7.
297
+
298
+ Q: In the county, the population was spread out with $2 3 . 5 0 \%$ under the age of 18, $8 . 7 0 \%$ from 18 to 24, $2 9 . 7 0 \%$ from 25 to 44, $2 4 . 7 0 \%$ from 45 to 64, and $1 3 . 3 0 \%$ who were 65 years of age or older. How many more percent are under the age of 18 compared to the 18 to 24 group?
299
+
300
+ A: According to the passage, $2 3 . 5 \%$ are under the age of 18, and $8 . 7 \%$ are from ages 18 to 24. $2 3 . 5 \%$ - $8 . 7 \% = 1 4 . 8 \%$ . So the answer is 14.8.
301
+
302
+ Q: Playing in their second straight Thanksgiving game, the Eagles struggled especially on defense, where they were unable to stop the much-hyped Lions offense. The worst of it all was how unproven rookie Eric Rowe was tasked with covering wide receiver Calvin Johnson, leading to Johnson catching 3 touchdowns. Stafford’s five passing touchdowns, including three of them to Johnson was too much for the Eagles to overcome and for the second consecutive time this season, the Eagles gave up 45 points in a game. With the loss, the Eagles drop to 4-7 on the season and 6-1 when playing on Thanksgiving. How many TD passes did Stafford throw other than to Johnson?
303
+
304
+ A: According to the passage, Stafford threw $5 ~ \mathrm { T D }$ passes, 3 of which were to Johnson. $5 \textrm { - } 3 = 2$ . So the answer is 2.
305
+
306
+ Table 11: Few-shot CoT prompts for DROP (nonfootball), from Zhou et al. (2022a).
307
+
308
+ Q: The Seahawks played the San Francisco 49ers. In the first quarter, the Hawks RB Julius Jones got a 27-yard TD run, along with DT Craig Terrill returning a fumble 9 yards for a touchdown. In the third quarter, the 49ers almost rallied as RB H. J. Torres made a 12-yard TD pass to Lucas Nelly, along with Mare kicking a 32-yard field goal. In the final quarter, Julius Jones got another 11-yard TD. How many yards do the shortest touchdown run and the longest touchdown pass combine for?
309
+
310
+ A: All the touchdown runs are: a 27-yard touchdown run, a 9-yard touchdown run, a 11-yard touchdown run. The smallest number among 27, 9, 11 is 9. So the shortest touchdown run was 9 yards. All the touchdown passes are: a 12-yard touchdown pass. So the longest touchdown pass was 12 yards. So the shortest touchdown run and the longest touchdown pass combine for $9 + 1 2 = 2 1$ yards. So the answer is 21 yards.
311
+
312
+ Q: The Steelers went home for a duel with the Baltimore Ravens. Pittsburgh would deliver the opening punch in the first quarter with a 1-yard touchdown from running back Rashard Mendenhall. The Ravens would make it even as running back Willis McGahee got a 9-yard TD. The Ravens kicker Billy Cundiff got a 45-yard field goal in the second quarter, concluding the first half with a 10-7 lead. The Steelers brought the game into overtime with a 38-yard field goal by Andrew Foster. The Ravens Billy Cundiff pulled off a winning 33-yard field goal in overtime. How many points did the Ravens have at halftime?
313
+
314
+ A: The Ravens kicker Billy Cundiff got a 45-yard field goal in the second quarter, concluding the first half with a 10-7 lead. So the Ravens had 10 points at halftime. So the answer is 10 points.
315
+
316
+ Q: The Vikings flew to Bank of America Stadium to face the Carolina Panthers. After a scoreless first quarter, Carolina got on the board with quarterback Matt Moore finding fullback Brad Hoover on a 1-yard TD pass. After yet another scoreless quarter, Carolina sealed the game as Matt Moore completed a 42-yard touchdown pass to wide receiver Steve Smith. How many scoreless quarters were there?
317
+
318
+ A: The first and third quarters were the scoreless quarters. So there are 2 scoreless quarters. So the answer is 2.
319
+
320
+ # Premise:
321
+
322
+ ”Conceptually cream skimming has two basic dimensions - product and geography.”
323
+
324
+ Based on this premise, can we conclude the hypothesis ”Product and geography are what make cream skimming work.” is true?
325
+
326
+ OPTIONS:
327
+ - yes
328
+ - no
329
+ - it is not possible to tell
330
+
331
+ A: Based on ”cream skimming has two basic dimensions” we can’t infer that these two dimensions are what make cream skimming work. The answer is it is not possible to tell.
332
+
333
+ Premise:
334
+
335
+ ”One of our member will carry out your instructions minutely.”
336
+ Based on this premise, can we conclude the hypothesis ”A member of my team will execute your orders with
337
+ immense precision.” is true?
338
+ OPTIONS:
339
+ - yes
340
+ - no
341
+ - it is not possible to tell
342
+
343
+ A: ”one of” means the same as ”a member of”, ”carry out” means the same as ”execute”, and ”minutely” means the same as ”immense precision”. The answer is yes.
344
+
345
+ Premise:
346
+ ”Fun for adults and children.”
347
+ Based on this premise, can we conclude the hypothesis ”Fun for only children.” is true?
348
+ OPTIONS:
349
+ - yes
350
+ - no
351
+ - it is not possible to tell
352
+
353
+ A: ”adults and children” contradicts ”only children”. The answer is no.
354
+
355
+ Premise:
356
+ ”He turned and smiled at Vrenna.”
357
+ Based on this premise, can we conclude the hypothesis ”He smiled at Vrenna who was walking slowly behind
358
+ him with her mother.” is true?
359
+ OPTIONS:
360
+ - yes
361
+ - no
362
+ - it is not possible to tell
363
+
364
+ A: the premise does not say anything about ”Vrenna was walking”. The answer is it is not possible to tell.
365
+
366
+ Premise:
367
+ ”well you see that on television also”
368
+ Based on this premise, can we conclude the hypothesis ”You can see that on television, as well.” is true?
369
+ OPTIONS:
370
+ - yes
371
+ - no
372
+ - it is not possible to tell
373
+
374
+ A: ”also” and ”as well” mean the same thing. The answer is yes.
375
+
376
+ Premise:
377
+ ”Vrenna and I both fought him and he nearly took us.”
378
+ Based on this premise, can we conclude the hypothesis ”Neither Vrenna nor myself have ever fought him.” is true?
379
+ OPTIONS:
380
+ - yes
381
+ - no
382
+ - it is not possible to tell
383
+ A: ”Vrenna and I both” contradicts ”neither Vrenna nor myself”. The answer is no. Table 13: Few-shot CoT prompts for NLI tasks, including ANLI and MNLI, from Wang et al.
384
+ (2022a). Q: George wants to warm his hands quickly by rubbing them. Which skin surface will produce the most heat? (a) dry palms. (b) wet palms. (c) palms covered with oil. (d) palms covered with lotion.
385
+ A: Dry surfaces will more likely cause more friction via rubbing than other smoother surfaces, hence dry palms will produce the most heat. The answer is (a).
386
+ Q: Which factor will most likely cause a person to develop a fever? (a) a leg muscle relaxing after exercise. (b) a bacterial population in the bloodstream. (c) several viral particles on the skin. (d) carbohydrates being digested in the stomach.
387
+ A: Option (b), bacterial population is the most likely cause for a person developing fever. The answer is (b).
388
+ Q: Which change in the state of water particles causes the particles to become arranged in a fixed position? (a) boiling. (b) melting. (c) freezing. (d) evaporating.
389
+ A: When water is freezed, the particles are arranged in a fixed position; the particles are still moving for all other options. The answer is (c).
390
+ Q: When a switch is used in an electrical circuit, the switch can (a) cause the charge to build. (b) increase and decrease the voltage. (c) cause the current to change direction. (d) stop and start the flow of current. A: The function of a switch is to start and stop the flow of a current. The answer is (d). Q: John found that the average of 15 numbers is 40. If 10 is added to each number then the mean of the numbers is? Answer Choices: (a) 50 (b) 45 (c) 65 (d) 78 (e) 64
391
+ A: If 10 is added to each number, then the mean of the numbers also increases by 10. So the new mean would be 50. The answer is (a).
392
+ Q: If a $/ \mathrm { b } = 3 / 4$ and $8 \mathrm { a } + 5 \mathrm { b } = 2 2$ ,then find the value of a. Answer Choices: (a) 1/2 (b) 3/2 (c) 5/2 (d) 4/2 (e) 7/2
393
+ A: If a $/ { \mathbf { b } } = 3 / 4$ , then $\mathsf { b } = 4 \mathrm { a } \mathrm { ~ / ~ } 3$ . So $8 \mathrm { a } + 5 ( 4 \mathrm { a } / 3 ) = 2 2$ . This simplifies to $8 \mathrm { a } + 2 0 \mathrm { a } / 3 = 2 2$ , which means $4 4 \mathrm { a } / 3 = 2 2$ . So a is equal to $3 / 2$ . The answer is (b).
394
+ Q: A person is traveling at $2 0 \ \mathrm { k m / h r }$ and reached his destiny in $2 . 5 \ \mathrm { h r }$ then find the distance? Answer Choices: (a) $5 3 \mathrm { k m }$ (b) $5 5 \mathrm { k m }$ (c) $5 2 \mathrm { k m }$ (d) $6 0 \mathrm { k m }$ (e) $5 0 \mathrm { k m }$
395
+ A: The distance that the person traveled would have been $2 0 \mathrm { k m } / \mathrm { h r } * 2 . 5 \mathrm { h r s } = 5 0 \mathrm { k m }$ . The answer is (e). Q: How many keystrokes are needed to type the numbers from 1 to 500? Answer Choices: (a) 1156 (b) 1392 (c) 1480 (d) 1562 (e) 1788
396
+ A: There are 9 one-digit numbers from 1 to 9. There are 90 two-digit numbers from 10 to 99. There are 401 three-digit numbers from 100 to $5 0 0 . ~ 9 + 9 0 ( 2 ) + 4 0 1 ( 3 ) = 1 3 9 2 .$ . The answer is (b).
397
+
398
+ Q: Do hamsters provide food for any animals?
399
+
400
+ A: Hamsters are prey animals. Prey are food for predators. Thus, hamsters provide food for some animals.
401
+ The answer is yes.
402
+
403
+ Q: Could Brooke Shields succeed at University of Pennsylvania?
404
+
405
+ A: Brooke Shields went to Princeton University. Princeton University is about as academically rigorous as the University of Pennsylvania. Thus, Brooke Shields could also succeed at the University of Pennsylvania. The answer is yes.
406
+
407
+ Q: Yes or no: Hydrogen’s atomic number squared exceeds number of Spice Girls?
408
+
409
+ A: Hydrogen has an atomic number of 1. 1 squared is 1. There are 5 Spice Girls. Thus, Hydrogen’s atomic number squared is less than 5. The answer is no.
410
+
411
+ Q: Yes or no: Is it common to see frost during some college commencements?
412
+
413
+ A: College commencement ceremonies can happen in December, May, and June. December is in the winter, so there can be frost. Thus, there could be frost at some commencements. The answer is yes.
414
+
415
+ Q: Yes or no: Could a llama birth twice during War in Vietnam (1945-46)?
416
+
417
+ A: The War in Vietnam was 6 months. The gestation period for a llama is 11 months, which is more than 6 months. Thus, a llama could not give birth twice during the War in Vietnam. The answer is no.
418
+
419
+ Q: Yes or no: Would a pear sink in water?
420
+
421
+ A: The density of a pear is about $0 . 6 ~ \mathrm { g } / \mathrm { c m } ^ { 3 }$ , which is less than water. Objects less dense than water float.
422
+ Thus, a pear would float. The answer is no.
423
+
424
+ Table 16: Few-shot CoT prompts for StrategyQA, from Wei et al. (2022b).
425
+
426
+ Premise:
427
+
428
+ ”No Weapons of Mass Destruction Found in Iraq Yet.” Based on this premise, can we conclude the hypothesis ”Weapons of Mass Destruction Found in Iraq.” is true?
429
+
430
+ A: ”No Weapons of Mass Destruction Found” contradicts ”Weapons of Mass Destruction Found”. The answer is no.
431
+
432
+ Premise:
433
+
434
+ ”A place of sorrow, after Pope John Paul II died, became a place of celebration, as Roman Catholic faithful gathered in downtown Chicago to mark the installation of new Pope Benedict XVI.”
435
+
436
+ Based on this premise, can we conclude the hypothesis ”Pope Benedict XVI is the new leader of the Roman Catholic Church.” is true?’
437
+
438
+ A: ”installation of new Pope Benedict XVI.” means ”Pope Benedict XVI is the new leader”. The answer is yes.
439
+
440
+ Premise:
441
+
442
+ ”A man is due in court later charged with the murder 26 years ago of a teenager whose case was the first to be featured on BBC One’s Crimewatch. Colette Aram, 16, was walking to her boyfriend’s house in Keyworth, Nottinghamshire, on 30 October 1983 when she disappeared. Her body was later found in a field close to her home. Paul Stewart Hutchinson, 50, has been charged with murder and is due before Nottingham magistrates later.”
443
+
444
+ Based on this premise, can we conclude the hypothesis ”Paul Stewart Hutchinson is accused of having stabbed a girl.” is true?
445
+
446
+ A: The premise does not say Paul Stewart Hutchinson ”stabbed” this girl. The answer is no.
447
+
448
+ Premise:
449
+
450
+ ”Herceptin was already approved to treat the sickest breast cancer patients, and the company said, Monday, it will discuss with federal regulators the possibility of prescribing the drug for more breast cancer patients.” Based on this premise, can we conclude the hypothesis ”Herceptin can be used to treat breast cancer.” is true?
451
+
452
+ A: ”Herceptin was approved to treat breast cancer” implies that ”Herceptin can be used to treat breast cancer”.
453
+ The answer is yes.
parse/dev/NiEtU7blzN/NiEtU7blzN_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/TntbHxxGd6j/TntbHxxGd6j.md ADDED
@@ -0,0 +1,347 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # OUTPUT DISTRIBUTION OVER THE ENTIRE INPUT SPACE: A NOVEL PERSPECTIVE TO UNDERSTAND NEURAL NETWORKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Understanding the input-output mapping relationship in the entire input space contributes a novel perspective to a comprehensive understanding of deep neural networks. In this paper, we focus on binary neural classifiers and propose to first uncover the histogram about the number of inputs that are mapped to certain output values and then scrutinize the representative inputs from a certain output range of interest, such as the positive-logit region that corresponds to one of the classes. A straightforward solution is uniform sampling (or exhaustive enumeration) in the entire input space but when the inputs are high dimensional, it can take almost forever to converge. We connect the output histogram to the density of states in physics by making an analogy between the energy of a system and the neural network output. Inspired by the Wang-Landau algorithm designed for sampling the density of states, we propose an efficient sampler that is driven to explore the under-explored output values through a gradient-based proposal. Compared with the random proposal in Wang-Landau algorithm, our gradientbased proposal converges faster as it can propose the inputs corresponding to the under-explored output values. Extensive experiments have verified the accuracy of the histogram generated by our sampler and also demonstrated interesting findings. For example, the models map many human unrecognizable images to very negative logit values. These properties of a neural model are revealed for the first time through our sampled statistics. We believe that our approach opens a new gate for neural model evaluation and shall be further explored in future works.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Understanding the input-output mapping relationship in the entire input space contributes a novel perspective to a comprehensive understanding of deep neural networks. Existing methods approximate such mapping relations through the evaluation on a certain subset of the entire input space, such as measuring the accuracy on in-distribution test sets Dosovitskiy et al. (2021); Tolstikhin et al. (2021); Steiner et al. (2021); Chen et al. (2021); Zhuang et al. (2022); He et al. (2015), out-ofdistribution (OOD) test sets (Liu et al., 2020; Hendrycks & Gimpel, 2016; Hendrycks et al., 2019; Hsu et al., 2020; Lee et al., 2017; 2018), and adversarial test sets Szegedy et al. (2013); Rozsa et al. (2016); Miyato et al. (2018); Kurakin et al. (2016). However, none of the existing evaluations can offer a comprehensive understanding that covers the entire input space, including all kinds of inputs mentioned above and even those human unrecognizable inputs as shown in Fig 1a.
12
+
13
+ As a pilot study, we focus on binary classification — given a trained binary classifier, we aim to uncover a histogram that counts how many samples in the entire input space are mapped to certain logit values, i.e., the distribution of the output values, as shown in Fig 1b. A straightforward solution is uniform sampling (or exhaustive enumeration) in the entire input space but when the inputs are high dimensional, it can take almost forever to converge. Therefore, it calls for a novel efficient sampling method over a neural model’s output space. Note that, as a side product of the sampling procedure, one can expect that this histogram also offers fine-grained information such as some representative input samples corresponding to a certain range of output values.
14
+
15
+ ![](images/29ec5d1242f09bc8849324efbf60a3490ac355a746485b26678407d230c3dadb.jpg)
16
+ Figure 1: Input types and the example output histogram when the task is binary classification between digits 0 and 1. The entire input space covers all possible gray-scale images of the same shape. y is the output (logit) of input $\mathbf { X }$ .
17
+
18
+ We connect the output histogram problem to the density of states (DOS) problem in physics by making an analogy between the system energy and neural network output, as shown in the right figure. If one follows the physics language to describe our problem, the input $\mathbf { x }$ to the neural network can be viewed as the configuration $\mathbf { x }$ of the system; the neural network output (e.g., logit values in binary classifier) $y ( \mathbf { x } )$ corresponds to the energy function $E ( \mathbf { x } )$ ; the desired output histogram can be obtained through the DOS (a.k.a., the entropy, $S ( E ( \mathbf { x } ) { \bar { ) } }$ , the log scale of DOS), which is the count of the configurations given the energy value. Note that the density of states by definition is over the entire input space, which aligns perfectly with our objective.
19
+
20
+ ![](images/ad5a7aeb42a570ca2f9b842f8a6e68d599dbba1e4e3359f8c99a0d5fe36c7fcc.jpg)
21
+
22
+ Inspired by the Wang-Landau algorithm (Wang & Landau, 2001) designed for density of states, we propose an efficient sampler that is driven to explore the under-explored output values through a gradient-based proposal. If the binary classifier is well-trained, it is reasonable to believe that in-distribution inputs (images) which usually have certain semantic structures are concentrated in certain output ranges. If one follows the random proposal in the Wang-Landau algorithm, it is difficult to propose the inputs with meaningful structure (or even in-distribution inputs), thus possibly preventing the sampler from exploring the corresponding output values. Thus, we propose to apply a gradient-based proposal called Gibbs-with-Gradients (GWG) (Grathwohl et al., 2021) which proves to be efficient to propose in-distribution inputs for a trained model.
23
+
24
+ With the help of this new sampler, we can reveal some new understanding of the models for the entire input space. First, in our experiments on a real-world dataset, the dominant output values are very negative and correspond to the human-unrecognizable inputs. This indicates the models may map an overwhelmingly large number of unrecognizable images to the overconfident prediction probabilities. Second, we can derive the relative difference between the dominant peak of output values and the other output values, especially those where the in-distribution inputs correspond to. The output values where the in-distribution inputs correspond to are also dominated by the humanunrecognizable inputs. This result presents significant challenges to the OOD detection problems. Third, we observe a clear trend of the representative samples in a CNN model and speculate it simply utilizes the background to predict the labels of the digits.
25
+
26
+ Our contributions are summarized as follows.
27
+
28
+ • We work on the challenging problem to uncover the output distribution over the entire input space. Such output distributions offer a novel perspective to understand deep neural networks. • We connect this output distribution problem to the density of states problem in physic and successfully tailor Wang-Landau algorithm using a gradient-based proposal, which is a must-have component to sample the entire output space as much as possible, improving the efficiency. • We conduct extensive experiments on toy and real-world datasets based on CNN and ResNet-18 to confirm the correctness of our proposed sampler and discover novel and interesting findings.
29
+
30
+ We believe that our approach opens a new gate for neural model evaluation and shall be further explored in future works. For example, one can can utilize our sampler to estimate the intrinsic ratio of in-distribution samples given a range of interest with human evaluation as shown in Sec. 5.3.
31
+
32
+ # 2 PROBLEM DEFINITION
33
+
34
+ In the traditional setting, binary neural classifiers model the class distribution through logit $z$ . A neural classifier parameterized by $\theta$ learns $p _ { \theta } ( z | \mathbf { x } ) = \delta ( z - y _ { \theta } ( \mathbf { x } ) )$ through a function $y _ { \theta } : \mathbf { x } z \in$ $\mathbb { R }$ , where $\mathbf { x } \in \Omega$ , $\Omega \subseteq \{ 0 , . . . , N \} ^ { D }$ for images, and $\delta$ is the Dirac delta function. $\Omega$ is aligned with Gibbs-With-Gradient’s setting to be discrete.
35
+
36
+ What the above model does not define is the distribution of the data $\mathbf { x }$ . This paper aims to obtain the output value distribution of binary classifiers in the entire input space: $\Omega \doteq \dot { \{ 0 , . . . , N \} } ^ { D }$ . Here we assume that the data distribution $p ( \mathbf { x } )$ follows the uniform distribution over the domain $\Omega$ of $\mathbf { x }$ and denote its measure by $\mu$ . We define the joint distribution
37
+
38
+ $$
39
+ p _ { \theta } ( z , \mathbf { x } ) = p _ { \theta } ( z | \mathbf { x } ) \mu ( \mathbf { x } )
40
+ $$
41
+
42
+ Our goal is only the logit (output) distribution. We marginalize the above joint distribution to define the density given the logit $z$ :
43
+
44
+ $$
45
+ p _ { \theta } ( z ) = \sum _ { \Omega } p _ { \theta } ( z | \mathbf { x } ) \mu ( \mathbf { x } ) = \sum _ { \mathbf { x } \in \Omega } \delta ( z - y _ { \theta } ( \mathbf { x } ) )
46
+ $$
47
+
48
+ To sample from the distribution $p _ { \theta } ( z )$ , we can first sample $\mathbf { x } _ { i } \sim \mathrm { U n i f o r m } ( \Omega )$ , then condition on the sampled $\mathbf { x } _ { i }$ , sample $z _ { i } \sim p _ { \theta } ( z | \mathbf { x } _ { i } )$ . While uniform sampler in principle can resolve our problem, it takes almost forever to converge.
49
+
50
+ # 3 METHOD
51
+
52
+ In this section, we first discuss the connection between our problem to density of states (DOS), introduce both Wang-Landau algorithm and Gibbs-with-Gradient as background, and present our new sampler Gradient-Wang-Landau algorithm.
53
+
54
+ # 3.1 CONNECTION TO DENSITY OF STATES (DOS) IN PHYSICS
55
+
56
+ In statistical physics, given the energy function $E : \mathbf { x } \mathcal { E } \in \mathbb { R }$ , the DOS $\rho ( \mathcal { E } )$ is defined as
57
+
58
+ $$
59
+ \rho ( \mathcal { E } ) = \sum _ { \mathbf { x } \in \Omega } \delta ( \mathcal { E } - E ( \mathbf { x } ) )
60
+ $$
61
+
62
+ where $\delta$ is the Dirac delta function and $\Omega$ is the domain of $\mathbf { x }$ where $\mathbf { x }$ is valid. The DOS is treated as a probability distribution in the energy space, whose log-probability is defined as the entropy $S$ :
63
+
64
+ $$
65
+ \rho ( \mathcal { E } ) = \exp ( S ( \mathcal { E } ) )
66
+ $$
67
+
68
+ Boltzmann constant is assumed to be 1 in our setting. DOS is meaningful because many physical quantities depend on energy or its integration but not the specific input $\mathbf { x }$ .
69
+
70
+ We connect the output histogram to DOS in physics by making an analogy between the system energy $\mathcal { E } = E ( \mathbf { x } )$ and neural network output $z = y ( \mathbf { x } )$ . This connection is based on the observation that the energy function in physics maps an input configuration to a scalar-valued energy; similarly, a binary neural classifier maps an image to a logit. Both the logit and energy are treated as the direct output of the mapping. Other quantities, such as the loss, are derived from the output. The desired output histogram can be obtained similarly through sampling the DOS (a.k.a., the entropy $S ( E ( \mathbf { x } ) )$ or $\bar { S } ( y ( { \bf x } ) )$ in the log scale) which is the count of the configurations given the energy value. The output histogram and DOS are defined in the entire input space.
71
+
72
+ # 3.2 WANG-LANDAU ALGORITHM AND GIBBS-WITH-GRADIENT
73
+
74
+ Wang-Landau algorithm is a Markov chain Monte Carlo sampler that samples DOS. Since the true distribution $\rho ( \mathcal { E } )$ is what we are interested in sampling but its formula/model is unknown, we need to approximate it. The Wang-Landau algorithm uses a histogram to store the current estimation $\tilde { S }$ . It improves the sampling efficiency by sampling the inverted distribution:
75
+
76
+ $$
77
+ p ( \mathbf { x } ) \propto \exp ( - \tilde { S } ( E ( \mathbf { x } ) ) )
78
+ $$
79
+
80
+ By sampling $p ( \mathbf { x } )$ , we can get an ensemble of $\mathcal { E }$ via $E ( \cdot )$ whose probability distribution is:
81
+
82
+ $$
83
+ \pi ( \mathcal { E } ) = \sum _ { \mathbf { x } \sim p ( \mathbf { x } ) } \delta ( \mathcal { E } - E ( \mathbf { x } ) )
84
+ $$
85
+
86
+ When $\tilde { S } ( \mathcal { E } )$ approaches $S ( \mathcal { E } )$ , the energy distribution $\pi ( \mathcal { E } )$ approaches to $\mathcal { E }$ -independent constant for all the accessible energy $\mathcal { E }$ .
87
+
88
+ Gibbs-With-Gradient (GWG) is used for energy-based models (EBM) by sampling
89
+
90
+ $$
91
+ \log p ( \mathbf { x } ) = f ( \mathbf { x } ) - \log Z ,
92
+ $$
93
+
94
+ where $f ( \mathbf { x } )$ is the unnormalized log-probability, $Z$ is the partition function, and $\mathbf { x }$ is discrete. Typical Gibbs sampler iterates every dimension $x _ { i }$ of $\mathbf { x }$ , computes the conditional probability $p ( x _ { i } | x _ { 1 } , . . . x _ { i - 1 } , x _ { i + 1 } , . . . , x _ { D } )$ , and samples according to this conditional probability.
95
+
96
+ When the training data $\mathbf { x }$ are natural images and the EBM learns $\mathbf { x }$ decently well, the traditional Gibbs sampler wastes much of the computation. For example, most pixel-by-pixel iterations over $x _ { i }$ in MNIST dataset will be on the background which should stay black. GWG proposes a smart proposal that picks the pixel $x _ { i }$ that is more likely to change, such as the pixels around the edge between the bright and dark region of the digits.
97
+
98
+ # 3.3 WANG-LANDAU WITH GRADIENT PROPOSAL
99
+
100
+ Directly applying Wang-Landau algorithm is not enough as it uses random proposal, because a trained neural model learns preferred mapping through the loss function. For example, a binary classifier should map the training inputs to either the sufficiently positive or negative logit values which ideally should correspond to the extremely rare but semantically meaningful inputs. After the sampler explores and generates the peak centered at 0 where most random samples correspond to as shown in Fig. 1b, it is almost impossible for the sampler with a random proposal to propose the inputs with meaningful structure (or even in-distribution inputs) so that the other possible output values are explored. Of course, whether those output values correspond to in-distribution inputs is only confirmable after sampling. In summary, it is extremely difficult for the random proposal in Wang-Landau algorithm to explore (almost all) the possible output values.
101
+
102
+ We propose to use the framework of Wang-Landau algorithm but replace the proposal distribution with the Gibbs-With-Gradients (GWG) sampler which has a gradient proposal, since the gradient proposal takes the advantage of model’s learned weights to propose inputs. In order to sample the distribution of the output prediction through GWG, we define log-probability $f ( x )$ as:
103
+
104
+ $$
105
+ f ( x ) = S ( y ( \mathbf { x } ) )
106
+ $$
107
+
108
+ where $S$ is the count for the bin corresponding to $y ( \mathbf x )$ . The fixed $f ( \cdot )$ in the original GWG is changing in our sampling process given the input $\mathbf { x }$ , since the formula for $S$ is unknown and we can only estimate the output distribution as we did in Wang-Landau algorithm. Moreover, the GWG requires the gradient of $f$ , but the $S$ is not differentiable since it is approximated through discrete bins. We adopt a first-order differentiable interpolation for the discrete histogram of entropy.
109
+
110
+ In summary, similar to the original Wang-Landau algorithm, we first initialize two histograms with all of their bins to 0. One of these histograms is for entropy $S$ , and the other histogram, $H$ , is a counter of how many times the sampler workers visited a specific bin and $H$ is also for the flatness check. We first preset the number of iterations. When $H$ passes the flatness check, it enters the next iteration loop with the step counter reset to 0. Every step in the while loop until the flatness check passes, we interpolate the entropy in the histogram to get a differentiable interpolation and take the derivative of the negation of the entropy with respect to the output $z$ and the inputs $\mathbf { x }$ through the chain rule. GWG uses this gradient to propose the next input that is likely to have lower entropy and be accepted by the sampler. his procedure drives the sampler to visit rare samples whose logit values correspond to the lower entropy until $S$ converges. This proposal also goes through a Monte-Carlo accept-reject procedure in the GWG. Once the flatness is met, the bins of $H$ are reset to 0 and the step size is halved before a new iteration. Our proposed algorithm is in Alg. 1 in Appendix.
111
+
112
+ # 4 RELATED WORKS AND DISCUSSIONS
113
+
114
+ Performance Characterization has long been explored even before the era of deep learning (Haralick, 1992; Klette et al., 2000; Thacker et al., 2008). The input-output relationship has been explored for simple functions (Hammitt & Bartlett, 1995) and mathematical morphological operators (Gao et al., 2002; Kanungo & Haralick, 1990). Compared to existing performance characterization approaches (Ramesh et al., 1997; Bowyer & Phillips, 1998; Aghdasi, 1994; Ramesh & Haralick, 1992; 1994), our work focuses on the output distribution (Greiffenhagen et al., 2001) of a neural network over the entire input space (i.e., not task specific) following the blackbox approach (Courtney et al., 1997; Cho et al., 1997) where the system transfer function from input to output is unknown. Our setting shall be viewed as the most general forward uncertainty quantification case (Lee & Chen, 2009) where the model performance is characterized when the inputs are perturbed (Roberts et al., 2021). To our best knowledge, we demonstrate for the first time that the challenging task of sampling the entire input space for modern neural networks is feasible and efficient by drawing the connection between neural network and physics models. Our proposed method can offer samples to be further integrated with the performance characterization methods mentioned above.
115
+
116
+ Density Estimation and Energy Landscape Mapping Previous works in density estimation focus on data density Tabak & Turner (2013); Liu et al. (2021), where class samples are given and the goal is to estimate the density of samples. Here we are not interested in the density of the given dataset, but the density of all the valid samples in the pixel space for a trained model. Hill et al. (2019); Barbu & Zhu (2020) have done the pioneering work in sampling the energy landscape for energy-based models. Their methods specifically focus on the local minimum and barriers of the energy landscape. We can relax the requirement and generalize the mapping on the “output” space where either sufficiently positive or sufficiently negative output (logit) values are meaningful in binary classifiers and other models.
117
+
118
+ Open-world Model Evaluation Though many neural models have achieved the SOTA performance, most of them are only on in-distribution test sets (Dosovitskiy et al., 2021; Tolstikhin et al., 2021; Steiner et al., 2021; Chen et al., 2021; Zhuang et al., 2022; He et al., 2015; Simonyan & Zisserman, 2014; Szegedy et al., 2015; Huang et al., 2017; Zagoruyko & Komodakis, 2016). Openworld settings where the test set distribution differs from the in-distribution training set create special challenges for the model. While the models have to detect the OOD samples from in-distribution samples (Liu et al., 2020; Hendrycks & Gimpel, 2016; Hendrycks et al., 2019; Hsu et al., 2020; Lee et al., 2017; 2018; Liang et al., 2018; Mohseni et al., 2020; Ren et al., 2019), we also expect sometimes the model could generalize what it learns to OOD datasets (Cao et al., 2022; Sun & Li, 2022). It has been discovered that models have over-confident predictions for some OOD samples that obviously do not align with human judgments (Nguyen et al., 2015). The OOD generalization becomes more challenging because of this discovery, because the models may not be as reliable as we thought they were. Adversarial test sets Szegedy et al. (2013); Rozsa et al. (2016); Miyato et al. (2018); Kurakin et al. (2016); Xie et al. (2019); Madry et al. (2017) also present special challenges as models decisions are different from those of humans. Having a full view of input-output relation with all the above different kinds of test sets under consideration is important.
119
+
120
+ Samplers MCMC samplers (Chen et al., 2014; Welling & Teh, 2011; Li et al., 2016; Xu et al., 2018) are developed to scale to big datasets and sample efficient with gradients. Recently, GibbsWith-Gradients (GWG) (Grathwohl et al., 2021) is proposed to pick the promising pixel(s) as the proposal. To further improve sampling efficiency, CSGLD (Deng et al., 2020) drives the sampler to explore the under-explored energy using similar idea as Wang-Landau algorithm (Wang & Landau, 2001). The important difference between our problem setting and the previous ones solved by other MCMC samplers is the function or model as distribution to be sampled from is unknown. Wang-Landau algorithm utilizes previous approximation of the distribution to drive the sampler to explore the under-explored energy regions. This algorithm can be more efficient through parallelization (Vogel et al., 2013; Cunha-Netto et al., 2008), bin-free (Junghans et al., 2014; Li & Eisenbach, 2017) and extended to multi-dimensional outputs (Zhou et al., 2006). While the previous samplers can be applied to high dimensional inputs, the energy functions written by physicists are relative simple and symmetric. However, modern neural networks are complex and hard to characterize performance (Roberts et al., 2021). We assume agnostic of the output properties of the model and thus apply the Wang-Landau algorithm to sample the entropy as a function of energy but with the gradient proposal in GWG to make the sampler more efficient. Similar to GWG, our sampler can propose the inputs corresponding to the under-explored regions of outputs. Improvements of efficiency can benefit from a patch of pixel changes.
121
+
122
+ # 5 EXPERIMENTS
123
+
124
+ In this section, we apply our proposed Gradient Wang-Landau sampler to inspect a few neural network models and present the discovered output histogram together with representative samples. The dataset and model training details are introduced in Sec. 5.1. We first empirically confirm our sampler performance through a toy example in Sec. 5.2. We then discuss results for modern binary classifiers in Sec. 5.3 and Sec. 5.4. Hyperparameters of the samplers tested in are Appendix C.
125
+
126
+ 5.1 DATASETS, MODELS, AND OTHER EXPERIMENT SETTINGS
127
+
128
+ Datasets As aforementioned, we focus on binary classification. Therefore, we derive two datasets from the MNIST datasets by only including samples with labels $\{ 0 , 1 \}$ . The training and test splits are the same as those in the original MNIST dataset.
129
+
130
+ • Toy is a simple dataset with $5 \times 5$ binary input images we construct. It is designed to make feasible the bruteforce enumeration over the entire input space (only $2 ^ { 5 \times 5 }$ different samples). We center crop the MNIST samples from $\{ 0 , 1 \}$ classes and resize them to $5 \times 5$ images. We compute the average of the pixel values and use the average as the threshold to binarize the images — the pixel value lower than this threshold becomes 0; otherwise, it becomes 1. The duplicates are not removed for accuracy after resizing since PyTorch does not find duplicate row indices. • MNIST-0/1 is an MNIST dataset whose samples only have the 0,1 labels. To align with the GWG setting, the inputs are discrete and not $\mathrm { _ { Z } }$ -normalized. Therefore, in this dataset, the input $\mathbf { x }$ is $2 8 \times 2 8$ dimensional with discrete pixel values from $\{ 0 , . . . , 2 5 5 \}$ .
131
+
132
+ Neural Network Models for Evaluation Since the focus of this paper is not to compare different neural architectures, given the relatively small datasets we have, we train two types of models, a simple CNN and ResNet-18 (He et al., 2015). Each pixel of the inputs is first transformed to the one-hot encoding and passed to a 3-by-3 convolution layer with 3 channel output. The CNN model contains 2 convolution layers with 3-by-3 filter size. The output channels are 32 and 128. The final features are average-pooled and passed to a fully-connected layer for the binary classification.
133
+
134
+ Please keep in mind that our goal in this experiment section is to showcase that our proposed sampler can uncover some novel interesting empirical insights for neural network models. Models with different architectures, weights due to different initialization, optimization, and/or datasets will lead to different results. Therefore, our results and discussions are all model-specific. Specifically, we train a simple CNN model to classify the $5 \times 5$ binary images in the Toy dataset (CNN-Toy). The test accuracy of this CNN-Toy model reaches $9 9 . 7 \%$ , which is almost perfect. We train a simple CNN model to classify the $2 8 \times 2 8$ grey-scale images in the MNIST-0/1 dataset (CNN-MNIST-0/1). The test accuracy of CNN-MNIST-0/1 model is $9 7 . 8 \%$ . We train a ResNet-18 model to classify the $2 8 \times 2 8$ grey-scale images in the MNIST-0/1 dataset (ResNet-18-MNIST-0/1). The test accuracy of ResNet-18-MNIST-0/1 model is $1 0 0 \%$ .
135
+
136
+ Sampling Methods for Comparison We compare several different sampling methods (including our proposed method) to obtain the output histogram over the entire input space.
137
+
138
+ • Enumeration generates the histogram by enumerating all the possible pixel values as inputs. This is a rather slow but the most accurate method.
139
+ • In-dist Test Samples generates the histogram of the inputs based on the fixed test set.This is commonly used in machine learning evaluation. It is based on a very small and potentially biased subset of the entire input space.
140
+ • Wang-Landau algorithm (WL) generates the histogram the Wang-Landau algorithm with the random proposal. Specifically, we randomly pick one pixel at a time and change it to any valid (discrete) value as in this implementation 1
141
+ • Gradient Wang-Landau (GWL) generates the histogram by our proposed sampler of WangLandau algorithm with gradient proposal.
142
+
143
+ ![](images/0c66faa4a0eb7a34a59abefd6c5d10be5d13bb2f8cef0d5ec07bef93354745d8.jpg)
144
+ Figure 2: Output histograms of CNN-Toy obtained by different sampling methods. The indistribution samples are only a very small portion in the output histogram. We also present the representative samples obtained by GWL given different logit values.
145
+
146
+ ![](images/b8f5711f821ee80ee89c73c4737a3b20b82e3cfc2d828174a5f1009260d0b2a3.jpg)
147
+ Figure 3: Output histograms of CNN-MNIST-0/1 obtained by different sampling methods. The blue scale is for GWL and the red scale is for In-distribution Test Samples. We also present the representative samples obtained by GWL given different logit values (more in Fig. 6 in Appendix)
148
+
149
+ # 5.2 RESULTS OF CNN-TOY
150
+
151
+ Given the CNN-Toy model, we apply Enumeration, GWL, and In-dist Test Samples to obtain the output histograms, as shown in Fig. 2. Note that our GWL method samples the relative entropy of different energy values as duplicate x may be proposed. After normalization with the maximum entropy, the GWL histogram almost exactly matches the Enumeration histogram which is the ground truth histogram. This confirms the accuracy of our GWL sampler and we can apply it further to more complicated models with confidence.
152
+
153
+ Remarkably, this histogram is quite different from the expectation we presented in Fig. 1b — this histogram is even not centered at 0 or has the expected subdominant peaks on both the positive and negative sides. Instead, the dominant peak is so wide that it covers almost the entire spectrum of the possible output values. From a coarse-grained overview, most of the samples are mapped to the center of logit $- 5$ with a decay from $- 5$ to both sides in the CNN-Toy model. This shows the CNN-Toy model is biased to predict more samples to the negative logit values.
154
+
155
+ In Fig. 2, we also present the representative samples obtained by GWL given different logit values in the CNN-Toy model. The visualization results suggest that the CNN-Toy model probably learns the digit “1” for positive logit values as the center pixels of the representative samples are white (see the three representative samples with logit values from 0 to 20) and $\ " 0 \ "$ for the very negative logit values as the center pixels of the representative samples are black (see two representative samples with logit values from -20 to -30). From this example, one can see that the output histogram over the entire input space can offer a comprehensive understanding of the neural network models, helping researchers better understand critical questions such as the distribution of the outputs, where the model maps the samples to, and what the representative samples with high likelihood are.
156
+
157
+ # 5.3 RESULTS OF CNN-MNIST-0/1
158
+
159
+ Histogram Results by GWL The trial of applying GWL on the CNN-Toy model is encouraging and we now apply GWL to the CNN-MNIST-0/1 that is trained on a real-world dataset. The results are shown in Fig. 3. As our GWL reveals, the output histogram of CNN-MNIST-0/1, similar to CNN-Toy’s histogram, does not have the subdominant peaks. It is also different from the presumed case in Fig. 1b. Compared with the output histogram of the CNN-Toy model (i.e., Fig. 2), this time, the peak is on the negative boundary and the histogram is skewed towards the negative logit values. $S$ almost linearly decays to the positive logit values. While the in-distribution samples have logit values between $- 2 0$ and 15 as we expect, these samples are exponentially (i.e., $e ^ { 1 3 0 0 }$ at logit value -20 to $e ^ { 3 1 0 0 }$ at logit value 13, thousands in log scale) less often found than the majority samples whose logit values are around $- 5 5$ . From a fine-grained view, the CNN-MNIST-0/1 model tends to map the human-unrecognizable samples to the very negative logit values. While previous work (Nguyen et al., 2015) showed the existence of the overconfident prediction samples, our result shows a rough but quantitative performance of this CNN which can serve as a baseline for further improvements. One may notice that in Fig. 3, there is still some output values (e.g., the rightmost positive logit region) that are not yet covered by our GWL sampler. We believe that this calls for more future work to follow on more advanced efficient samplers.
160
+
161
+ ![](images/e9ff3076d4a132b973f8030a8b19784ad990e1a23965a3fd9c23de67d84f3d1b.jpg)
162
+ Figure 4: Intermediate output histogram $S$ per iteration. (a) GWL gradually explores the logit values in the first iteration. (b) GWL discovers the output histogram well within 2 iterations. (c) The original WL explores the output distribution much slower.
163
+
164
+ GWL is much more efficient than WL Since WL takes a much longer time to converge, we are not able to obtain the converged results from WL. For the comparison purpose, we inspect the intermediate $S$ results of the GWL and WL samplers, as shown in Fig. 4. As one can see from Fig. 4a, in the first iteration, GWL has already been able to gradually explore the logit values efficiently from the most dominant output value around $- 5 5$ to the positive logit values. Within only two iterations, as shown in Fig. 4b, GWL can discover the output histogram covering the value range from $- 5 5$ to 13. On the other hand, as presented in Fig. 4c, in the first two iterations, the original WL can only explore the output ranges from around $- 5 5$ to $- 4 5$ ; in the 3rd iteration, WL converges significantly slower and never ends in a reasonable time. This result indicates that the GWL converges much faster than the original WL and is able to explore a much more diverse range of output values.
165
+
166
+ Manual inspection on more representative samples As show in Fig. 3, for the CNN-MNIST$_ { 0 / 1 }$ model, GWL can effectively sample input images from logit values ranging from -55 to 13. We further group these logit values per 100 bins (100 bins correspond to a difference of 10 in logit value) in $S$ , resulting in about 7 groups. For every group, we sample 200 representative input images. To make sure they are not correlated, we sample every 1000 steps. For demonstration purposes, we randomly pick 10-out-of-200 samples from every group in Fig. 6 in Appendix. We manually inspect the sufficiently positive group (e.g., the last column in Fig. 6) and the sufficiently negative groups (e.g., the first five columns in Fig. 6) , and there are no human recognizable samples of digits. We also observe an interesting pattern that as the logit value increases, more and more representative samples have black background. This result suggests that the CNN-MNIST-0/1 model may heavily rely on the background to classify the images (Xiao et al., 2020). We conjecture that is because the samples in the most dominant peak are closer to class 0 samples than class 1 samples (Appendix. D). In summary, although CNN-MNIST-0/1 holds a very high in-distribution test accuracy, it is far from a robust model because it does not truly understand the semantic structure of the digits.
167
+
168
+ Discussion Fig. 3 presents challenges to the OOD detection methods that may be more modeldependent than we thought before. If the model cannot map most of the human unrecognizable samples with high uncertainty, the likelihood-based OOD detection methods (Liu et al., 2020; Hendrycks & Gimpel, 2016) cannot perform well for samples in the entire input space. Fig. 6 shows the inputs with the in-distribution output values (output logits of the red plot) of the CNN model may not uniquely correspond to in-distribution samples. More rigorous experiments to a definite conclusion are yet required as future work.
169
+
170
+ ![](images/12832be2d3026b42c4b661d4a5448d60b6a476c48ec9c0a5dde3fb23f35a2113.jpg)
171
+ (a) Results with random re-initialization.
172
+
173
+ ![](images/092109fc749bf3dd1476c50096882b69ff635bf9f62d94622d943b3cda11f427.jpg)
174
+ (b) Results with test set re-initialization.
175
+ Figure 5: Output histograms of ResNet-18-MNIST-0/1 obtained by different sampling methods. There may be a sharp local minima in the output landscape causing a cliff around the logit value of -33 and making GWL “trapped”. We have tried two variants to address the “trapped” issue via (a) random re-initialization and (b) test set re-initialization. The blue scale is for GWL and the red scale is for In-distribution Test Samples. We also present the representative samples obtained by GWL given different logit values.
176
+
177
+ # 5.4 RESULTS OF RESNET-18-MNIST-0/1
178
+
179
+ When applying our GWL samplers to the ResNet-18-MNIST-0/1 model, we observe that the sampler can easily get trapped in some output regions. This is a fairly common phenomenon for WangLandau-based samplers, as reported in (Vogel et al., 2018). We follow the common practice to re-initialize the sampler to the random samples every time it gets trapped. We let those workers run 1000 steps (10,000 pixels selected with replacement) before counting to $S$ again. As shown in Fig. 5a, the smallest logit values in ResNet-18-MNIST-0/1 are around -220, much lower than those of CNN-MNIST-0/1. A wide range of negative logit values corresponds to human unrecognizable inputs and there is no obvious pattern observed in contrast to CNN-MNIST-0/1’s results.
180
+
181
+ Interestingly, we observe a cliff around the logit value of -33. We try another variant for reinitialization: we re-initialize using the test set samples every time it gets trapped in certain output value. This time, as shown in Figure 5b, it can explore the output values larger than -33. We believe there may be a sharp local minima in the output landscape, similar to the case discussed before Vogel et al. (2018).
182
+
183
+ Because of the “trapping” issue and the complexity of ResNet-18 over CNN, we have to relax the flatness check a bit to let GWL converge for the first iteration. Because of the less rigorous flatness check, we do not draw conclusions about ResNet-18-MNIST-0/1 evaluation of the relative entropy differences. Compared with the CNN-MNIST-0/1 model, ResNet-18-MNIST-0/1 has more interesting phenomena and further exploration is needed to understand these phenomena.
184
+
185
+ # 6 CONCLUSION
186
+
187
+ We aim to get a full picture of the input-output relationship of a model through the inputs valid in the pixel space. We propose to use a histogram to better understand the input-output distribution. When the inputs are high-dimensional, enumeration or uniform sampling is either impossible or takes too long to converge. We connect the density of states in physics to this histogram sampling problem. We propose to use an efficient sampler to achieve this goal. We confirm empirically this can be achieved and uncover some new aspects of neural networks.
188
+
189
+ For future work, it is interesting to develop a new and more efficient sampler that has theoretical guarantees to acquire this input-output relationship in order to sample with more pixels, such as the ImageNet (Deng et al., 2009). Most importantly, with this new sampler, we can develop new insights into network architectures developed in the last decade for open-world applications.
190
+
191
+ # 7 REPRODUCIBILITY
192
+
193
+ We provide fairly amount of information to re-implement our sampler. The data processing is in the Sec. 5.1 and algorithm is in Appendix B. The hyperparameters and sampling details are also listed in the Sec. 5. We also provide different time stamp of steps for our samplers to indicate what to expect during the sampling procedure in Fig. 4. Of course, the Wang-Landau algorithm we adopted is the prototypical one and it subjects to some issues reported in its follow-up works, such as the discontinuity of the boundaries between bins and trapping in one of the bins. These problems lead to some issues in our experiments and we discussed them in Sec. 5.4. More advanced algorithms have been developed to resolve these issues.
194
+
195
+ # 8 ETHICS STATEMENT
196
+
197
+ Our method aims to provide a comprehensitve understanding of the neural models. This work will be applicable to many applications, such as those in the safety and trusty-worthy machine learning. As a pilor study, we do not anticipate the negative aspects of our work.
198
+
199
+ # REFERENCES
200
+
201
+ Farzin Aghdasi. Digitization and analysis of mammographic images for early detection of breast cancer. PhD thesis, University of British Columbia, 1994.
202
+
203
+ Adrian Barbu and Song-Chun Zhu. Mapping the energy landscape. In Monte Carlo Methods, pp. 367–420. Springer, 2020.
204
+
205
+ Kevin Bowyer and P Jonathon Phillips. Empirical evaluation techniques in computer vision. IEEE Computer Society Press, 1998.
206
+
207
+ Kaidi Cao, Maria Brbic, and Jure Leskovec. Open-world semi-supervised learning. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum? id=O-r8LOR-CCA.
208
+
209
+ Tianqi Chen, Emily Fox, and Carlos Guestrin. Stochastic gradient hamiltonian monte carlo. In International conference on machine learning, pp. 1683–1691. PMLR, 2014.
210
+
211
+ Xiangning Chen, Cho-Jui Hsieh, and Boqing Gong. When vision transformers outperform resnets without pretraining or strong data augmentations. arXiv preprint arXiv:2106.01548, 2021.
212
+
213
+ Kyujin Cho, Peter Meer, and Javier Cabrera. Performance assessment through bootstrap. IEEE Transactions on Pattern Analysis and Machine Intelligence, 19(11):1185–1198, 1997.
214
+
215
+ Patrick Courtney, Neil Thacker, and Adrian F Clark. Algorithmic modelling for performance evaluation. Machine Vision and Applications, 9(5):219–228, 1997.
216
+
217
+ Antonio Gonc¸alves da Cunha-Netto, AA Caparica, Shan-Ho Tsai, Ronald Dickman, and David Paulˆ Landau. Improving wang-landau sampling with adaptive windows. Physical Review E, 78(5): 055701, 2008.
218
+
219
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE Conference on Computer Vision and Pattern Recognition, pp. 248–255, 2009. doi: 10.1109/CVPR.2009.5206848.
220
+
221
+ Wei Deng, Guang Lin, and Faming Liang. A contour stochastic gradient langevin dynamics algorithm for simulations of multi-modal distributions. In Advances in Neural Information Processing Systems, 2020.
222
+
223
+ 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. ICLR, 2021.
224
+
225
+ Xiang Gao, Visvanathan Ramesh, and Terry Boult. Statistical characterization of morphological operator sequences. In European Conference on Computer Vision, pp. 590–605. Springer, 2002.
226
+
227
+ Will Grathwohl, Kevin Swersky, Milad Hashemi, David Duvenaud, and Chris Maddison. Oops i took a gradient: Scalable sampling for discrete distributions. In International Conference on Machine Learning, pp. 3831–3841. PMLR, 2021.
228
+
229
+ Michael Greiffenhagen, Dorin Comaniciu, Heinrich Niemann, and Visvanathan Ramesh. Design, analysis, and engineering of video monitoring systems: An approach and a case study. Proceedings of the IEEE, 89(10):1498–1517, 2001.
230
+
231
+ AM Hammitt and EB Bartlett. Determining functional relationships from trained neural networks. Mathematical and computer modelling, 22(3):83–103, 1995.
232
+
233
+ Robert M Haralick. Performance characterization in computer vision. In BMVC92, pp. 1–8. Springer, 1992.
234
+
235
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385, 2015.
236
+
237
+ Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. arXiv preprint arXiv:1610.02136, 2016.
238
+
239
+ Dan Hendrycks, Mantas Mazeika, and Thomas Dietterich. Deep anomaly detection with outlier exposure. In International Conference on Learning Representations, 2019. URL https:// openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ HyxCxhRcY7.
240
+
241
+ Mitch Hill, Erik Nijkamp, and Song-Chun Zhu. Building a telescope to look into high-dimensional image spaces. Quarterly of Applied Mathematics, 77(2):269–321, 2019.
242
+
243
+ Yen-Chang Hsu, Yilin Shen, Hongxia Jin, and Zsolt Kira. Generalized ODIN: Detecting outof-distribution image without learning from out-of-distribution data. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10951–10960, 2020.
244
+
245
+ Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4700–4708, 2017.
246
+
247
+ Christoph Junghans, Danny Perez, and Thomas Vogel. Molecular dynamics in the multicanonical ensemble: Equivalence of wang–landau sampling, statistical temperature molecular dynamics, and metadynamics. Journal of chemical theory and computation, 10(5):1843–1847, 2014.
248
+
249
+ Tapas Kanungo and Robert M Haralick. Character recognition using mathematical morphology. In Proc. of the Fourth USPS Conference on Advanced Technology, pp. 973–986, 1990.
250
+
251
+ Reinhard Klette, H Siegfried Stiehl, Max A Viergever, and Koen L Vincken. Performance characterization in computer vision. Springer, 2000.
252
+
253
+ Alexey Kurakin, Ian Goodfellow, Samy Bengio, et al. Adversarial examples in the physical world, 2016.
254
+
255
+ Kimin Lee, Honglak Lee, Kibok Lee, and Jinwoo Shin. Training confidence-calibrated classifiers for detecting out-of-distribution samples. arXiv preprint arXiv:1711.09325, 2017.
256
+
257
+ Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin. A simple unified framework for detecting out-of-distribution samples and adversarial attacks. In Advances in Neural Information Processing Systems, pp. 7167–7177, 2018.
258
+
259
+ Sang Hoon Lee and Wei Chen. A comparative study of uncertainty propagation methods for blackbox-type problems. Structural and multidisciplinary optimization, 37(3):239–253, 2009.
260
+
261
+ Chunyuan Li, Changyou Chen, David Carlson, and Lawrence Carin. Preconditioned stochastic gradient langevin dynamics for deep neural networks. In Thirtieth AAAI Conference on Artificial Intelligence, 2016.
262
+
263
+ Ying Wai Li and Markus Eisenbach. A histogram-free multicanonical monte carlo algorithm for the basis expansion of density of states. In Proceedings of the Platform for Advanced Scientific Computing Conference, pp. 1–7, 2017.
264
+
265
+ Shiyu Liang, Yixuan Li, and Rayadurgam Srikant. Enhancing the reliability of out-of-distribution image detection in neural networks. In 6th International Conference on Learning Representations, ICLR 2018, 2018.
266
+
267
+ Qiao Liu, Jiaze Xu, Rui Jiang, and Wing Hung Wong. Density estimation using deep generative neural networks. Proceedings of the National Academy of Sciences, 118(15):e2101344118, 2021.
268
+
269
+ Weitang Liu, Xiaoyun Wang, John Owens, and Yixuan Li. Energy-based out-of-distribution detection. Advances in Neural Information Processing Systems, 2020.
270
+
271
+ Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. arXiv preprint arXiv:1706.06083, 2017.
272
+
273
+ Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, and Shin Ishii. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. IEEE transactions on pattern analysis and machine intelligence, 41(8):1979–1993, 2018.
274
+
275
+ Sina Mohseni, Mandar Pitale, JBS Yadawa, and Zhangyang Wang. Self-supervised learning for generalizable out-of-distribution detection. Proceedings of the AAAI Conference on Artificial Intelligence, 34(04):5216–5223, April 2020. ISSN 2159-5399. doi: 10.1609/aaai.v34i04.5966.
276
+
277
+ Anh Nguyen, Jason Yosinski, and Jeff Clune. Deep neural networks are easily fooled: High confidence predictions for unrecognizable images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 427–436, 2015.
278
+
279
+ V Ramesh and RM Haralick. A methodology for automatic selection of iu algorithm tuning parameters. In ARPA Image Understanding Workshop, 1994.
280
+
281
+ Visvanathan Ramesh and Robert M Haralick. Random perturbation models and performance characterization in computer vision. In Proceedings 1992 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, pp. 521–522. IEEE Computer Society, 1992.
282
+
283
+ Visvanathan Ramesh, RM Haralick, AS Bedekar, X Liu, DC Nadadur, KB Thornton, and X Zhang. Computer vision performance characterization. RADIUS: Image Understanding for Imagery Intelligence, pp. 241–282, 1997.
284
+
285
+ Jie Ren, Peter J Liu, Emily Fertig, Jasper Snoek, Ryan Poplin, Mark Depristo, Joshua Dillon, and Balaji Lakshminarayanan. Likelihood ratios for out-of-distribution detection. In Advances in Neural Information Processing Systems, pp. 14680–14691, 2019.
286
+
287
+ Daniel A Roberts, Sho Yaida, and Boris Hanin. The principles of deep learning theory. arXiv preprint arXiv:2106.10165, 2021.
288
+
289
+ Andras Rozsa, Ethan M Rudd, and Terrance E Boult. Adversarial diversity and hard positive generation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pp. 25–32, 2016.
290
+
291
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
292
+
293
+ Andreas Steiner, Alexander Kolesnikov, , Xiaohua Zhai, Ross Wightman, Jakob Uszkoreit, and Lucas Beyer. How to train your vit? data, augmentation, and regularization in vision transformers. arXiv preprint arXiv:2106.10270, 2021.
294
+
295
+ Yiyou Sun and Yixuan Li. Open-world contrastive learning. arXiv preprint arXiv:2208.02764, 2022.
296
+
297
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
298
+
299
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1–9, 2015.
300
+
301
+ Esteban G Tabak and Cristina V Turner. A family of nonparametric density estimation algorithms. Communications on Pure and Applied Mathematics, 66(2):145–164, 2013.
302
+
303
+ Neil A Thacker, Adrian F Clark, John L Barron, J Ross Beveridge, Patrick Courtney, William R Crum, Visvanathan Ramesh, and Christine Clark. Performance characterization in computer vision: A guide to best practices. Computer vision and image understanding, 109(3):305–334, 2008.
304
+
305
+ Ilya Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Andreas Steiner, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, and Alexey Dosovitskiy. Mlp-mixer: An all-mlp architecture for vision. arXiv preprint arXiv:2105.01601, 2021.
306
+
307
+ Thomas Vogel, Ying Wai Li, Thomas Wust, and David P Landau. Generic, hierarchical framework¨ for massively parallel wang-landau sampling. Physical review letters, 110(21):210603, 2013.
308
+
309
+ Thomas Vogel, Ying Wai Li, and David P. Landau. A practical guide to replica-exchange wang—landau simulations. 1012, 4 2018. ISSN 1742-6588. doi: 10.1088/1742-6596/1012/ 1/012003. URL https://www.osti.gov/biblio/1479789.
310
+
311
+ Fugao Wang and David P Landau. Efficient, multiple-range random walk algorithm to calculate the density of states. Physical review letters, 86(10):2050, 2001.
312
+
313
+ Max Welling and Yee W Teh. Bayesian learning via stochastic gradient langevin dynamics. In Proceedings of the 28th international conference on machine learning (ICML-11), pp. 681–688, 2011.
314
+
315
+ Kai Xiao, Logan Engstrom, Andrew Ilyas, and Aleksander Madry. Noise or signal: The role of image backgrounds in object recognition. arXiv preprint arXiv:2006.09994, 2020.
316
+
317
+ Cihang Xie, Zhishuai Zhang, Yuyin Zhou, Song Bai, Jianyu Wang, Zhou Ren, and Alan L Yuille. Improving transferability of adversarial examples with input diversity. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2730–2739, 2019.
318
+
319
+ Pan Xu, Jinghui Chen, Difan Zou, and Quanquan Gu. Global convergence of langevin dynamics based algorithms for nonconvex optimization. Advances in Neural Information Processing Systems, 31, 2018.
320
+
321
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
322
+
323
+ Chenggang Zhou, T. C. Schulthess, Stefan Torbrugge, and D. P. Landau. Wang-landau algorithm ¨ for continuous models and joint density of states. Phys. Rev. Lett., 96:120201, Mar 2006. doi: 10.1103/PhysRevLett.96.120201. URL https://link.aps.org/doi/10.1103/ PhysRevLett.96.120201.
324
+
325
+ Juntang Zhuang, Boqing Gong, Liangzhe Yuan, Yin Cui, Hartwig Adam, Nicha Dvornek, Sekhar Tatikonda, James Duncan, and Ting Liu. Surrogate gap minimization improves sharpness-aware training. ICLR, 2022.
326
+
327
+ # A APPENDIX A: REPRESENTATIVE INPUTS
328
+
329
+ Here we list more representative samples of the CNN-MNIST-0/1 scenario. The samples are bounded by a black box of boundaries.
330
+
331
+ <table><tr><td>-50.6 国</td><td>-43.2 -43.9</td><td>-31.5 国</td><td>-18.3 国 -18.5</td><td>-13.8 国</td><td>-0.5 □</td><td></td><td>10.3 ■</td></tr><tr><td>-54.2 国</td><td>国</td><td>-28.9 国</td><td></td><td>国</td><td>-13.9 国</td><td>0.6 国</td><td>8.8 □</td></tr><tr><td>-46.7 国</td><td>-44.2 国</td><td>-32.8 √</td><td>-17.4 √</td><td>-13.9 国</td><td></td><td>-3.5 国</td><td>11.2 ■</td></tr><tr><td>-49.3 国</td><td>-39.0 国</td><td>-26.0 国</td><td>-20.2 国</td><td>-9.8 国</td><td></td><td>0.7 国</td><td>7.9 □</td></tr><tr><td>-49.1 图</td><td>-39.6 国</td><td>-33.4 国</td><td>-23.4 国</td><td>-11.0 □</td><td></td><td>0.8 ■</td><td>6.3 1</td></tr><tr><td>-47.9 国</td><td>-35.7 園</td><td>-32.2 国</td><td>-18.6 国</td><td>-7.6 √</td><td></td><td>-0.7</td><td>9.3</td></tr><tr><td>-47.2</td><td>-43.1</td><td>-33.7</td><td>-16.2</td><td>-14.9</td><td></td><td>国 3.4</td><td>□ 10.4</td></tr><tr><td>国</td><td>国 -38.1</td><td>国 -28.8</td><td>□ -23.4</td><td>国</td><td></td><td>□</td><td>□</td></tr><tr><td>-45.1 国</td><td>国</td><td>国</td><td>国</td><td>-12.2 ?</td><td></td><td>3.9 □</td><td>14.8 ■</td></tr><tr><td>-53.1</td><td>-36.7</td><td>-33.5</td><td>-22.5</td><td>-5.7</td><td></td><td>-1.9</td><td>8.8</td></tr><tr><td>国</td><td>国</td><td>国</td><td>国</td><td>国</td><td></td><td>国</td><td>□</td></tr><tr><td>-48.7</td><td>-43.8</td><td>-31.7</td><td>-22.2</td><td>-8.0</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td>0.2</td><td></td></tr><tr><td>国</td><td>国</td><td>国</td><td>国</td><td></td><td>国</td><td>国</td><td>5.8 □</td></tr></table>
332
+
333
+ Figure 6: More representative samples of the CNN-MNIST-0/1 model obtained by GWL at different logit values, grouped by logit values. We further group these logit values per 100 bins (100 bins correspond to a difference of 10 in logit value) in $S$ , resulting in about 10 groups. The output values in the first column are within the range [-55,-45) and the second is from [-45,-35], etc.
334
+
335
+ # B APPENDIX B: GRADIENT WANG-LANDAU ALGORITHM
336
+
337
+ Here we provide the algorithms of the GWL algorithm. The input and output are listed. The hyperparameters are determined mostly by the toy-example.
338
+
339
+ <table><tr><td colspan="2">Algorithm 1 Our proposed Gradient Wang-Landau (GWL)</td></tr><tr><td>lation function g(z, S) for t=1,2,...,Tdo X~Dte while His not flat do</td><td>Require: pretrained model y: X → z, flat histogram H = O,entropy histogram S = 0, increment/step-size lnf, number of iterations T,test set Dte, GWG sampler GWG(z,S), interpo- &gt; Get the continuous interpolation entropy Sin at output z</td></tr><tr><td colspan="2">z =y(x) Sin=g(z,S) X ~ GWG(z,-Sin) = round(z) Round z to the nearest z&#x27; that corresponds to one of the bins S[]←S[]+lnf H[]←H[]+1 end while lnf ←lnf/2</td></tr></table>
340
+
341
+ # C HYPER-PARAMETERS AND IMPLEMENTATION DETAILS FOR GWL AND WL
342
+
343
+ The hyper-parameters for GWL and WL are extremely similar, if not identical, as the only major difference between GWL and WL is the gradient proposal versus the random proposal. We first preset a large enough range of output values for the sampler to explore the trained neural network models. In our experiments, we found that the output (logit) values of the binary classifiers typically fall in the range of -300 to 100 (based on ResNet). Therefore, we use this range for all experiments. For flatness histogram $H$ , the bin window size is set to be 1, resulting in 400 bins. The histogram $H$ is considered flat if the difference between maximum bin value and minimum bin value is smaller than the average bin value. For output histogram $S$ , we set the bin window size to be 0.1, resulting in 4000 bins. Instead of updating one bin at a time for $S$ , we update the neighbor bins with exponential decay. We use the linear interpolation to approximate the bins for continuous queries. We iterate 5 times with test set initialization. Every step the GWG tries to at most update 10 pixels.
344
+
345
+ # D SAMPLES SIMILARITY
346
+
347
+ The samples in the most dominant peak may be closer to class 0 than to class 1. We compute the L2 pixel-wise distance from the uniform noise image to the samples of class 1 and 0 respectively. The mean L2 distance from uniform noise to 0 is around 0.3121 and that from uniform noise to 1 is around 0.3236. The distance between 1 and 0 samples is 0.1652. This result shows the samples in the most dominant peak are closer to class 0 samples than class 1 samples. More rigorous experiments to a definite conclusion is yet required as future work.
parse/dev/VgOw1pUPh97/VgOw1pUPh97.md ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SegNeXt: Rethinking Convolutional Attention Design for Semantic Segmentation
2
+
3
+ Meng-Hao Guo1 Cheng-Ze $\mathbf { L } \mathbf { u } ^ { 2 }$ Qibin Hou2 Zheng-Ning Liu3 Ming-Ming Cheng2 Shi-Min $\mathbf { H } \mathbf { u } ^ { 1 * }$
4
+
5
+ 1BNRist, Department of Computer Science and Technology, Tsinghua University 2TMCC, CS, Nankai University 3Fitten Tech, Beijing, China
6
+
7
+ # Abstract
8
+
9
+ We present SegNeXt, a simple convolutional network architecture for semantic segmentation. Recent transformer-based models have dominated the field of semantic segmentation due to the efficiency of self-attention in encoding spatial information. In this paper, we show that convolutional attention is a more efficient and effective way to encode contextual information than the self-attention mechanism in transformers. By re-examining the characteristics owned by successful segmentation models, we discover several key components leading to the performance improvement of segmentation models. This motivates us to design a novel convolutional attention network that uses cheap convolutional operations. Without bells and whistles, our SegNeXt significantly improves the performance of previous state-of-the-art methods on popular benchmarks, including ADE20K, Cityscapes, COCO-Stuff, Pascal VOC, Pascal Context, and iSAID. Notably, SegNeXt outperforms EfficientNet-L2 w/ NAS-FPN and achieves $9 0 . 6 \%$ mIoU on the Pascal VOC 2012 test leaderboard using only $1 / _ { 1 0 }$ parameters of it. On average, SegNeXt achieves about $2 . 0 \%$ mIoU improvements compared to the state-of-the-art methods on the ADE20K datasets with the same or fewer computations.
10
+
11
+ # 1 Introduction
12
+
13
+ As one of the most fundamental research topics in computer vision, semantic segmentation, which aims at assigning each pixel a semantic category, has attracted great attention over the past decade. From early CNN-based models, typified by FCN [60] and DeepLab series [4, 5, 7], to recent transformer-based methods, represented by SETR [108] and SegFormer [90], semantic segmentation models have experienced significant revolution in terms of network architectures.
14
+
15
+ Table 1: Properties we observe from the successful semantic segmentation methods that are beneficial to the boost of model performance. Here, $n$ refers to the number of pixels or tokens. Strong encoder denotes strong backbones, like ViT [16] and VAN [25].
16
+
17
+ <table><tr><td>Properties</td><td>DeepLabV3+</td><td>HRNet</td><td> SETR</td><td>SegFormer</td><td>SegNeXt</td></tr><tr><td>Strong encoder Multi-scale interaction</td><td>X</td><td>X</td><td>√</td><td>√</td><td>√</td></tr><tr><td>Spatial attention</td><td>X</td><td>√ X</td><td>X</td><td>×</td><td>:</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Computational complexity</td><td>0(n)</td><td>0(n)</td><td>O(n2)</td><td>O(n2)</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>O(n)</td></tr></table>
18
+
19
+ ∗S.-M. Hu is the corresponding author. Project page: https://github.com/Jittor/JSeg
20
+
21
+ ![](images/9db5ab107ef1d03d34dfc9ae42d81b89a4476e99a46537a167895cd39c35040c.jpg)
22
+ Figure 1: Performance-Computing curves on the Cityscapes (left) and ADE20K (right) validation sets. FLOPs are calculated using an input size of 2, $0 4 8 \times 1$ , 024 for Cityscapes and $5 1 2 \times 5 1 2$ for ADE20K. The size of the circle indicates the number of parameters. Larger circles mean more parameters. We can see that our SegNeXt achieves the best trade-off between segmentation performance and computational complexity.
23
+
24
+ By revisiting previous successful semantic segmentation works, we summarize several key properties different models possess as shown in Tab. 1. Based on the above observation, we argue a successful semantic segmentation model should have the following characteristics: (i) A strong backbone network as encoder. Compared to previous CNN-based models, the performance improvement of transformer-based models is mostly from a stronger backbone network. (ii) Multi-scale information interaction. Different from the image classification task that mostly identifies a single object, semantic segmentation is a dense prediction task and hence needs to process objects of varying sizes in a single image. (iii) Spatial attention. Spatial attention allows models to perform segmentation through prioritization of areas within the semantic regions. (iv) Low computational complexity. This is especially crucial when dealing with high-resolution images from remote sensing and urban scenes.
25
+
26
+ Taking the aforementioned analysis into account, in this paper, we rethink the design of convolutional attention and propose an efficient yet effective architecture for semantic segmentation. Unlike previous transformer-based models that use convolutions in decoders as feature refiners, our method inverts the transformer-convolution encoder-decoder architecture. Specifically, for each block in our encoder, we renovate the design of conventional convolutional blocks and utilize multi-scale convolutional features to evoke spatial attention via a simple element-wise multiplication following [25]. We found such a simple way to build spatial attention is more efficient than both the standard convolutions and self-attention in spatial information encoding. For decoder, we collect multi-level features from different stages and use Hamburger [22] to further extract global context. Under this setting, our method can obtain multi-scale context from local to global, achieve adaptability in spatial and channel dimensions, and aggregate information from low to high levels.
27
+
28
+ Our network, termed SegNeXt, is mostly composed of convolutional operations except the decoder part, which contains a decomposition-based Hamburger module [22] (Ham) for global information extraction. This makes our SegNeXt much more efficient than previous segmentation methods that heavily rely on transformers. As shown in Fig. 1, SegNeXt outperforms recent transformer-based methods significantly. In particular, our SegNeXt-S outperforms SegFormer-B2 ( $8 1 . 3 \%$ vs. $8 1 . 0 \%$ ) using only about 1/6 (124.6G vs. 717.1G) computational cost and $1 / 2$ parameters (13.9M vs. 27.6M) when dealing with high-resolution urban scenes from the Cityscapes dataset.
29
+
30
+ Our contributions can be summarized as follows:
31
+
32
+ • We identify the characteristics that a good semantic segmentation model should own and present a novel tailored network architecture, termed SegNeXt, that evokes spatial attention via multi-scale convolutional features.
33
+ • We show that an encoder with simple and cheap convolutions can still perform better than vision transformers, especially when processing object details, while it requires much less computational cost.
34
+
35
+ • Our method improves the performance of state-of-the-art semantic segmentation methods by a large margin on various segmentation benchmarks, including ADE20K, Cityscapes, COCO-Stuff, Pascal VOC, Pascal Context, and iSAID.
36
+
37
+ # 2 Related Work
38
+
39
+ # 2.1 Semantic Segmentation
40
+
41
+ Semantic segmentation is a fundamental computer vision task. Since FCN [60] was proposed, convolutional neural networks (CNNs) [1, 71, 98, 106, 20, 99, 79, 21, 51] have achieved great success and become a popular architecture for semantic segmentation. Recently, transformer-based methods [108, 90, 100, 73, 70, 50, 10, 9] have shown great potentials and outperform CNN-based methods.
42
+
43
+ In the era of deep learning, the architecture of segmentation models can be roughly divided into two parts: encoder and decoder. For the encoder, researchers usually adopt popular classification networks (e.g., ResNet [28], ResNeXt [91] and DenseNet [33]) instead of tailored architecture. However, semantic segmentation is a kind of dense prediction task, which is different from image classification. The improvement in classification may not appear in the challenging segmentation task [29]. Thus, some tailored encoders appear, including Res2Net [21], HRNet [79], SETR [108], SegFormer [90], HRFormer [100], MPViT [44], DPT [70], etc. For the decoder, it is often used in cooperating with encoders to achieve better results. There are different types of decoders for different goals, including achieving multi-scale receptive fields [106, 6, 88], collecting multi-scale semantics [71, 90, 7], enlarging receptive field [4, 4, 69], strengthening edge features [107, 2, 15, 48, 102], and capturing global context [20, 35, 101, 46, 24, 27, 103].
44
+
45
+ In this paper, we summarize the characteristics of those successful models designed for semantic segmentation and present a CNN-based model, named SegNeXt. The most related work to our paper, is [69], which decomposes a $k \times k$ convolution into a pair of $k \times 1$ and $1 \times k$ convolutions. Though this work has shown large convolutional kernels matter in semantic segmentation, it ignores the importance of multi-scale receptive field and does not consider how to leverage these multi-scale features extracted by large kernels for segmentation in the form of attention.
46
+
47
+ # 2.2 Multi-Scale Networks
48
+
49
+ Designing multi-scale network is one of the popular directions in computer vision. For segmentation models, multi-scale blocks appear in both the encoder [79, 21, 75] and the decoder [106, 98, 5] parts. GoogleNet [75] is one of the most related multi-scale architectures to our method, which uses a multi-branch structure to achieve multi-scale feature extraction. Another work that is related to our method is HRNet [79]. In the deeper stages, HRNet also keeps high-resolution features, which are aggregated with low-resolution features, to enable multi-scale feature extraction.
50
+
51
+ Different from previous methods, SegNeXt, besides capturing multi-scale features in encoder, introduces an efficient attention mechanism and employs cheaper and larger kernel convolutions. These enable our model to achieve higher performance than the aforementioned segmentation methods.
52
+
53
+ # 2.3 Attention Mechanisms
54
+
55
+ Attention mechanism is a kind of adaptive selection process, which aims to make the network focus on the important part. Generally speaking, it can be divided into two categories in semantic segmentation [26], including channel attention and spatial attention. Different types of attentions play different roles. For instance, spatial attentions mainly care about the important spatial regions [16, 13, 64, 58, 23]. Differently, the goal of using channel attention is to make the network selectively attend to those important objects, which has been demonstrated important in previous works [31, 8, 80]. Speaking of the recent popular vision transformers [16, 58, 94, 81, 82, 57, 90, 34, 56, 100, 93], they usually ignore adaptability in channel dimension.
56
+
57
+ Visual attention network (VAN) [25] is the most related work to SegNeXt, which also proposes to leverage the large-kernel attention (LKA) mechanism to build both channel and spatial attention. Though VAN has achieved great performance in image classification, it neglects the role of multi-scale feature aggregation during the network design, which is crucial for segmentation-like tasks.
58
+
59
+ ![](images/78097cf1e13ceb076b8e713af871442ecfc2004f49ff0e1f52fd52242eaec869.jpg)
60
+ Figure 2: Illustration of the proposed MSCA and MSCAN. Here, $d , k _ { 1 } \times k _ { 2 }$ means a depth-wise convolution $( d )$ using a kernel size of $k _ { 1 } \times k _ { 2 }$ . We extract multi-scale features using convolutions and then utilize them as attention weights to reweigh the input of MSCA.
61
+
62
+ # 3 Method
63
+
64
+ In this section, we describe the architecture of the proposed SegNeXt in detail. Basically, we adopt an encoder-decoder architecture following most previous works, which is simple and easy to follow.
65
+
66
+ # 3.1 Convolutional Encoder
67
+
68
+ We adopt the pyramid structure for our encoder following most previous work [90, 4, 20]. For the building block in our encoder, we adopt a similar structure to that of ViT [16, 90] but what is different is that we do not use the self-attention mechanism but design a novel multi-scale convolutional attention (MSCA) module. As depicted in Fig. 2 (a), MSCA contains three parts: a depth-wise convolution to aggregate local information, multi-branch depth-wise strip convolutions to capture multi-scale context, and an $1 \times 1$ convolution to model relationship between different channels. The output of the $1 \times 1$ convolution is used as attention weights directly to reweigh the input of MSCA. Mathematically, our MSCA can be written as:
69
+
70
+ $$
71
+ \begin{array} { r l } & { \mathrm { A t t } = \mathrm { C o n v } _ { 1 \times 1 } ( \displaystyle \sum _ { i = 0 } ^ { 3 } \mathrm { S c a l e } _ { i } ( \mathrm { D W } \mathrm { - C o n v } ( F ) ) ) , } \\ & { \mathrm { O u t } = \mathrm { A t t } \otimes F . } \end{array}
72
+ $$
73
+
74
+ where $F$ represents the input feature. Att and Out are the attention map and output, respectively. $\otimes$ is the element-wise matrix multiplication operation. DW-Conv denotes depth-wise convolution and $\mathrm { S c a l e } _ { i }$ , $i \in \{ 0 , 1 , 2 , 3 \}$ , denotes the $i$ th branch in Fig. 2(b). Scale $^ 0$ is the identity connection. Following [69], in each branch, we use two depth-wise strip convolutions to approximate standard depth-wise convolutions with large kernels. Here, the kernel size for each branch is set to 7, 11, and 21, respectively. The reasons why we choose depth-wise strip convolutions are two-fold. On one hand, strip convolution is lightweight. To mimic a standard 2D convolution with kernel size $7 \times 7$ , we only need a pair of $7 \times 1$ and $1 \times 7$ convolutions. On the other hand, there are some strip-like objects, such as human and telephone pole in the segmentation scenes. Thus, strip convolution can be a complement of grid convolutions and helps extract strip-like features [69, 30].
75
+
76
+ Stacking a sequence of building blocks yields the proposed convolutional encoder, named MSCAN. For MSCAN, we adopt a common hierarchical structure, which contains four stages with decreasing spatial resolutions $\begin{array} { l } { \frac { H } { 4 } ^ { \bullet } \times \frac { W } { 4 } } \end{array}$ , ${ \frac { H } { 8 } } \times { \frac { W } { 8 } }$ , $\begin{array} { r } { \frac { H } { 1 6 } \times \frac { W } { 1 6 } } \end{array}$ and $\textstyle { \frac { H } { 3 2 } } \times { \frac { W } { 3 2 } }$ . Here, $H$ and $W$ are height and width of the input image, respectively. Each stage contains a down-sampling block and a stack of building blocks as described above. The down-sampling block has a convolution with stride 2 and kernel size $3 \times 3$ , followed by a batch normalization layer [36]. Note that, in each building block of MSCAN, we use batch normalization instead of layer normalization as we found batch normalization gains more for the segmentation performance.
77
+
78
+ Table 2: Detailed settings of different sizes of the proposed SegNeXt. In this table, ‘e.r.’ represents the expansion ratio in the feed-forward network. $C '$ and $\cdot _ { L } ,$ are the numbers of channels and building blocks, respectively. ‘Decoder dimension’ denotes the MLP dimension in the decoder. ‘Parameters’ are calculated on the ADE20K dataset [111]. Due to the different numbers of the categories in different datasets, the number of parameters may change slightly.
79
+
80
+ <table><tr><td rowspan=1 colspan=1>stage</td><td rowspan=1 colspan=1>output size|e.r.</td><td rowspan=1 colspan=1>SegNeXt-T</td><td rowspan=1 colspan=1>SegNeXt-S</td><td rowspan=1 colspan=1>SegNeXt-B</td><td rowspan=1 colspan=1>SegNeXt-L</td></tr><tr><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>C=32,L=3</td><td rowspan=1 colspan=1>C =64,L=2</td><td rowspan=1 colspan=1>C = 64,L =3</td><td rowspan=1 colspan=1>C =64,L=3</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>xxC8</td><td rowspan=1 colspan=1>C=64,L=3</td><td rowspan=1 colspan=1>C =128,L = 2</td><td rowspan=1 colspan=1>C=128,L=3</td><td rowspan=1 colspan=1>C=128,L=5</td></tr><tr><td rowspan=1 colspan=2>3</td><td rowspan=1 colspan=1>C = 160,L = 5</td><td rowspan=1 colspan=1>C = 320,L = 4</td><td rowspan=1 colspan=1>C = 320,L = 12</td><td rowspan=1 colspan=1>C = 320,L = 27</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>×wxC4</td><td rowspan=1 colspan=1>C = 256,L = 2</td><td rowspan=1 colspan=1>C = 512,L = 2</td><td rowspan=1 colspan=1>C = 512,L =3</td><td rowspan=1 colspan=1>C =512,L =3</td></tr><tr><td rowspan=1 colspan=2>Decoder dimension</td><td rowspan=1 colspan=1>256</td><td rowspan=1 colspan=1>256</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>1,024</td></tr><tr><td rowspan=1 colspan=2>Parameters (M)</td><td rowspan=1 colspan=1>4.3</td><td rowspan=1 colspan=1>13.9</td><td rowspan=1 colspan=1>27.6</td><td rowspan=1 colspan=1>48.9</td></tr></table>
81
+
82
+ We desgin four encoder models with different sizes, named MSCAN-T, MSCAN-S, MSCAN-B, and MSCAN-L, respectively. The corresponding overall segmentation models are termed SegNeXt-T, SegNeXt-S, SegNeXt-B, SegNeXt-L, respectively. Detailed network settings are displayed in Tab. 2.
83
+
84
+ # 3.2 Decoder
85
+
86
+ In segmentation models [90, 108, 4], the encoders are mostly pretrained on the ImageNet dataset. To capture high-level semantics, a decoder is usually necessary, which is applied upon the encoder. In this work, we investigate three simple decoder structures, which have been shown in Fig. 3. The first one, adopted in SegFormer [90], is a purely MLP-based structure. The second one is mostly adopted CNN-based models. In this kind of structure, the output of the encoder is directly used as the input to a heavy decoder head, like ASPP [4], PSP [106], and DANet [20]. The last one is the structure adopted in our SegNeXt. We aggregate features from the last three stages and use a lightweight Hamburger [22] to further model the global context. Combined with our powerful convolutional encoder, we found that using a lightweight decoder improves performance-computation efficiency.
87
+
88
+ ![](images/26505bf45b4ff00088c851eebc2a34d2e7fc9732718da16c332c39ff87621586.jpg)
89
+ Figure 3: Three different decoder designs.
90
+
91
+ It is worth nothing that unlike SegFormer whose decoder aggregates the features from Stage 1 to Stage 4, our decoder only receives features from the last three stages. This is because our SegNeXt is based on convolutions. The features from Stage 1 contain too much low-level information and hurts the performance. Besides, operations on Stage 1 bring heavy computational overhead. In our experiment section, we will show that our convolutional SegNeXt performs much better than the recent state-of-the-art transformer-based SegFormer [90] and HRFormer [100].
92
+
93
+ # 4 Experiments
94
+
95
+ Dataset. We evaluate our methods on seven popular datasets, including ImageNet-1K [14], ADE20K [111], Cityscapes [12], Pascal VOC [17], Pascal Context [65], COCO-Stuff [3], and iSAID [84]. ImageNet [14] is the best-known dataset for image classification, which contains
96
+
97
+ Table 3: Comparison with state-of-the-art methods on ImageNet validation set. ‘Acc.’ denotes Top-1 accuracy.
98
+
99
+ <table><tr><td rowspan=1 colspan=3>Method</td><td rowspan=1 colspan=1>Params. (M)</td><td rowspan=1 colspan=1>Acc. (%)</td></tr><tr><td rowspan=1 colspan=3>MiT-B0 [90]VAN-Tiny [25]MSCAN-T</td><td rowspan=1 colspan=1>3.74.14.2</td><td rowspan=1 colspan=1>70.575.475.9</td></tr><tr><td rowspan=1 colspan=3>MiT-B1 [90]VAN-Small [25]MSCAN-S</td><td rowspan=1 colspan=1>14.013.914.0</td><td rowspan=1 colspan=1>78.781.181.2</td></tr><tr><td rowspan=1 colspan=3>MiT-B2 [90]Swin-T[58]ConvNeXt-T[59]VAN-Base [25]MSCAN-B</td><td rowspan=1 colspan=1>25.428.328.626.626.8</td><td rowspan=1 colspan=1>81.681.382.182.883.0</td></tr><tr><td rowspan=5 colspan=3>MiT-B3 [28]Swin-S [58]ConvNeXt-S [58]VAN-Large [25]MSCAN-L</td><td rowspan=1 colspan=1>45.2</td><td rowspan=1 colspan=1>83.1</td></tr><tr><td rowspan=1 colspan=1>49.6</td><td rowspan=1 colspan=1>83.0</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>50.1</td><td rowspan=2 colspan=1>83.183.9</td></tr><tr><td rowspan=1 colspan=2>5]</td><td rowspan=1 colspan=1>44.8</td></tr><tr><td rowspan=1 colspan=1>45.2</td><td rowspan=1 colspan=1>83.9</td></tr></table>
100
+
101
+ Table 4: Comparison with state-of-the-art methods on the remote sensing dataset iSAID. Single-scale (SS) test is applied by default. Our SegNeXt-T has achieved state-of-the-art performance.
102
+
103
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Backbone</td><td rowspan=1 colspan=1>mIoU (%)</td></tr><tr><td rowspan=2 colspan=1>DenseASPP[95]PSPNet [106]</td><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>57.3</td></tr><tr><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>60.3</td></tr><tr><td rowspan=1 colspan=1>SemanticFPN [40]</td><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>62.1</td></tr><tr><td rowspan=1 colspan=1>RefineNet [54]</td><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>60.2</td></tr><tr><td rowspan=1 colspan=1>HRNet [79]</td><td rowspan=1 colspan=1>HRNetW-18</td><td rowspan=1 colspan=1>61.5</td></tr><tr><td rowspan=2 colspan=1>GSCNN[76]SFNet [49]</td><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>63.4</td></tr><tr><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>64.3</td></tr><tr><td rowspan=1 colspan=1>RANet [66]</td><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>62.1</td></tr><tr><td rowspan=1 colspan=1>PointRend [41]</td><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>62.8</td></tr><tr><td rowspan=1 colspan=1>FarSeg[109]</td><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>63.7</td></tr><tr><td rowspan=2 colspan=1>UperNet [89]PointFlow [47]</td><td rowspan=1 colspan=1>Swin-T</td><td rowspan=1 colspan=1>64.6</td></tr><tr><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>66.9</td></tr><tr><td rowspan=4 colspan=1>SegNeXt-TSegNeXt-SSegNeXt-BSegNeXt-L</td><td rowspan=1 colspan=1>MSCAN-T</td><td rowspan=1 colspan=1>68.3</td></tr><tr><td rowspan=1 colspan=1>MSCAN-S</td><td rowspan=1 colspan=1>68.8</td></tr><tr><td rowspan=1 colspan=1>MSCAN-B</td><td rowspan=1 colspan=1>69.9</td></tr><tr><td rowspan=1 colspan=1>MSCAN-L</td><td rowspan=1 colspan=1>70.3</td></tr></table>
104
+
105
+ 1,000 categories. Similar to most segmentation methods, we use it to pretrain our MSCAN encoder. ADE20K [111] is a challenging dataset which contains 150 semantic classes. It consists of 20,210/2,000/3,352 images in the training, validation and test sets. Cityscapes [12] mainly focuses on urban scenes and contains 5.000 high-resolution images with 19 categories. There are 2,975/500/1,525 images for training, validation and testing, respectively. Pascal VOC [17] involves 20 foreground classes and a background class. After augmentation, it has 10, 582/1, 449/1, 456 images for training, validation and testing, respectively. Pascal Context [65] contains 59 foreground classes and a background class. The training set and validation set contain 4,996 and 5,104 images, respectively. COCO-Stuff [3] is also a challenging benchmark, which contains 172 semantic categories and 164k images in total. iSAID [84] is a large-scale aerial image segmentation benchmark, which includes 15 foreground classes and a background class. Its training, validation and test sets separately involve 1,411/458/937 images.
106
+
107
+ Implementation details. We conduct experiments by using Jittor [32] and Pytorch [68]. Our implementation is based on timm (Apache-2.0) [85] and mmsegmentation (Apache-2.0) [11] libraries for classification and segmentation, respectively. All encoders of our segmentation models are pretrained on the ImageNet-1K dataset [14]. We adopt Top-1 accuracy and mean Intersection over Union (mIoU) as our evaluation metrics for classification and segmentation, respectively. All models are trained on a node with 8 RTX 3090 GPUs.
108
+
109
+ For ImageNet pretraining, our data augmentation method and training settings are the same as DeiT [78]. For segmentation experiments, we adopt some common data augmentation including random horizontal flipping, random scaling (from 0.5 to 2) and random cropping. The batch size is set to 8 for the Cityscapes dataset and 16 for all the other datasets. AdamW [61] is applied to train our models. We set the initial learning rate as 0.00006 and employ the poly-learning rate decay policy. We train our model 160K iterations for ADE20K, Cityscapes and iSAID datasets and 80K iterations for COCO-Stuff, Pascal VOC and Pascal Context datasets. During testing, we use both the single-scale (SS) and multi-scale (MS) flip test strategies for a fair comparison. More details can be found in our supplementary materials.
110
+
111
+ # 4.1 Encoder Performance on ImageNet
112
+
113
+ ImageNet pretraining is a common strategy for training segmentation models [106, 5, 90, 100, 4]. Here, we compare the performance of our MSCAN with several recent popular CNN-based and transformer-based classification models. As shown in Tab. 3, our MSCAN achieves better results than the recent state-of-the-art CNN-based method, ConvNeXt [59] and outperforms popular transformerbased methods, like Swin Transformer [58] and MiT, the encoder of SegFormer [90].
114
+
115
+ Table 5: Performance of different attention mechanisms in decoder. SegNeXt-B w/ Ham means the MSCAN-B encoder plus the Ham decoder. FLOPs are calculated using the input size of $5 1 2 \times 5 1 2$ .
116
+
117
+ <table><tr><td>Architecture</td><td>Params. (M)</td><td>GFLOPs</td><td>mIoU (SS)</td><td>mIoU (MS)</td></tr><tr><td>SegNeXt-B w/ CC [35]</td><td>27.8</td><td>35.7</td><td>47.3</td><td>48.6</td></tr><tr><td>SegNeXt-B w/EMA [46]</td><td>27.4</td><td>32.3</td><td>48.0</td><td>49.1</td></tr><tr><td>SegNeXt-B w/ NL [83]</td><td>27.6</td><td>40.9</td><td>48.6</td><td>50.0</td></tr><tr><td>SegNeXt-B w/ Ham [22]</td><td>27.6</td><td>34.9</td><td>48.5</td><td>49.9</td></tr></table>
118
+
119
+ # 4.2 Ablation study
120
+
121
+ Ablation on MSCA design. We conduct ablation study on MSCA design on both ImageNet and ADE20K dataset. $\mathbf { K } \times \mathbf { K }$ branch contains a depth-wise $1 \times \mathrm { K }$ convolution and a $\textsf { K } \times 1$ depth-wise convolution. $1 \times 1$ conv means the channel mixing operation. Attention means the element-wise product, which makes the network obtain adaptive ability. Results are shown in Tab. 6. We can find that each part contributes to the final performance.
122
+
123
+ Table 6: Ablation study on the design of MSCA. Top-1 means Top-1 accuracy on ImageNet dataset and mIoU denotes mIoU on ADE20K benchmark. The results are based on MSCAN-T.
124
+
125
+ <table><tr><td>7 × 7branch</td><td></td><td>11 ×11 branch|21 × 21 branch</td><td>1×1Conv</td><td>Attention</td><td>Top-1</td><td>mIoU</td></tr><tr><td>&lt;xx&lt;&lt;&gt;</td><td>x&lt;x&lt;&lt;&gt;</td><td>xx&lt;&lt;&lt;&gt;</td><td>&lt;&lt;&lt;x&lt;&gt;</td><td>&lt;&lt;&lt;&lt;x&gt;</td><td>74.7</td><td>39.6</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>75.2</td><td>39.7</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>75.3</td><td>40.0</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>74.8</td><td>39.1</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>75.5</td><td>40.5</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>75.9</td><td>41.1</td></tr></table>
126
+
127
+ Global Context for Decoder. Decoder plays an important role in integrating global context from multi-scale features for segmentation models. Here, we investigate the influence of different global context modules on decoder. As shown in most previous works [83, 20], attention-based decoders achieves better performance for CNNs than pyramid structures [106, 4], we thus only show the results using attention-based decoders. Specifically, we show results with 4 different types of attentionbased decoders, including non-local (NL) attention [83] with $\mathcal { O } ( n ^ { 2 } )$ complexity and CCNet [35], EMANet [46], and HamNet [22] with ${ \mathcal { O } } ( n )$ complexity. As shown in Tab. 5, Ham achieves the best trade-off between complexity and performance. Therefore, we use Hamburger [22] in our decoder.
128
+
129
+ Table 7: Performance of different decoder structures. SegNeXt-T (a) means Fig. 3 (a) is used in decoder. FLOPs are calculated using the input size of $5 1 2 \times 5 1 2$ . SegNeXt-T (c) w/ stage 1 means the output of stage 1 is also sent into the decoder.
130
+
131
+ <table><tr><td>Architecture</td><td>Params. (M)</td><td>GFLOPs</td><td>mIoU (SS)</td><td>mIoU (MS)</td></tr><tr><td>SegNeXt-T (a)</td><td>4.4</td><td>10.0</td><td>40.3</td><td>41.1</td></tr><tr><td>SegNeXt-T (b)</td><td>4.2</td><td>4.9</td><td>30.9</td><td>40.6</td></tr><tr><td>SegNeXt-T (c)</td><td>4.3</td><td>6.6</td><td>41.1</td><td>42.2</td></tr><tr><td>SegNeXt-T (c) w/ stage 1</td><td>4.3</td><td>12.1</td><td>40.7</td><td>42.2</td></tr></table>
132
+
133
+ Decoder Structure. Unlike image classification, segmentation models need high-resolution outputs. We ablate three different decoder designs for segmentation, all of which have been shown in Fig. 3. The corresponding results are listed in Tab. 7. We can see that SegNeXt (c) achieves the best performance and the computational cost is also low.
134
+
135
+ Importance of Our MSCA. Here, we conduct experiments to demonstrate the importance of MSCA for segmentation. As a comparison, we follow VAN [25] and replace the multiple branches in our MSCA with a single convolution with a large kernel. As shown in Tab. 8 and Tab. 3, we can observe that though the performance of the two encoders is close in ImageNet classification, SegNeXt w/ MSCA yields much better results than the setting w/o MSCA. This indicates that aggregating multi-scale features is crucial in encoder for semantic segmentation.
136
+
137
+ ![](images/07ffe41d77e1fd50ff9518bdff049fe3c5a9352c40788dbef09d84f261c4dd11.jpg)
138
+ Figure 4: Qualitative Comparison of SegNeXt-B and SegFormer-B2 on the Cityscapes dataset. More visual results can be found in our supplementary materials.
139
+
140
+ # 4.3 Comparison with state-of-the-art methods
141
+
142
+ In this subsection, we compare our method with state-of-the-art CNN-based methods, such as HRNet [79], ResNeSt [104], and EfficientNet [77], and transformer-based methods, like Swin Transformer [58], SegFormer [90], HRFormer [100], MaskFormer [10], and Mask2Former [9].
143
+
144
+ Performance-computation trade-off. ADE20K and Cityscapes are two widely used benchmarks in semantic segmentation. As shown in Fig. 1, we plot the performance-computation curves of different methods on the Cityscape and ADE20K validation set. Clearly, our method achieves the best trade-off between performance and computations compared to other state-of-the-art methods, like SegFormer [90], HRFormer [100], and MaskFormer [10].
145
+
146
+ Comparison with state-of-the-art transformers. We compare SegNeXt with state-of-the-art transformer models on the ADE20K, Cityscapes, COCO-Stuff and Pascal Context benchmarks. As shown in Tab. 9, SegNeXt-L surpasses Mask2Former with Swin-T backbone by 3.3 mIoU (51.0 v.s. 47.7) with similar parameters and computational cost on he ADE20K dataset. Moreover, SegNeXt-B yields $2 . 0 \mathrm { m I o U }$ improvement (48.5 v.s. 46.5) compared to SegFormer-B2 using only $56 \%$ computations on the ADE20K dataset. In particular, since the self-attention in SegFormer [90] is of quadratic complexity w.r.t., the input size while our method uses convolutions, this makes our method perform greatly well when dealing with high-resolution images from the Cityscapes dataset. For instance, SegNeXt-B gains 1.6 mIoU (81.0 v.s. 82.6) over SegFormer-B2 but uses $40 \%$ less computations. In Fig. 4, we also show a qualitative comparison with SegFormer. We can see that thanks to the proposed MSCA, our method recognizes well when processing object details.
147
+
148
+ Comparison with state-of-the-art CNNs. As shown in Tab. 4, Tab. 10, and Tab. 12, we compare our SegNeXt with state-of-the-art CNNs such as ResNeSt-269 [104], EfficientNet-L2 [112], and HRNetW48 [79] on the Pascal VOC 2012, Pascal Context, and iSAID datasets. SegNeXt-L outperforms the popular HRNet (OCR) [79, 99] model (60.3 v.s. 56.3) using even less parameters and computations, which is elaborately designed for the segmentation task. Moreover, SegNeXt-L performs even better than EfficientNet-L2 (NAS-FPN), which is pretrained on additional 300 million unavailable images, on the Pascal VOC 2012 test leaderboard. It is worth noting that EfficientNet-L2 (NAS-FPN) has 485M parameters, while SegNeXt-L has only 48.7M parameters.
149
+
150
+ Table 9: Comparison with state-of-the-art methods on the ADE20K, Cityscapes and COCO-Stuff benchmarks. The number of FLOPs (G) is calculated on the input size of $5 1 2 \times 5 1 2$ for ADE20K and COCO-Stuff, and $2 , 0 4 8 \times 1 , 0 2 4$ for Cityscapes. † means models pretrained on ImageNet-22K.
151
+
152
+ <table><tr><td rowspan="2">Model</td><td rowspan="2">Params (M)</td><td colspan="3">ADE20K</td><td colspan="3">Cityscapes</td><td colspan="3">COCO-Stuff</td></tr><tr><td>GFLOPs</td><td>mIoU (SS/MS)</td><td></td><td>GFLOPs</td><td>mloU (SS/MS)</td><td></td><td>GFLOPs</td><td>mIoU (SS/MS)</td><td></td></tr><tr><td>Segformer-B0 [90]</td><td>3.8</td><td>8.4</td><td>37.4</td><td>38.0</td><td>125.5</td><td>76.2</td><td>78.1</td><td>8.4</td><td>35.6</td><td>-</td></tr><tr><td>SegNeXt-T</td><td>4.3</td><td>6.6</td><td>41.1</td><td>42.2</td><td>50.5</td><td>79.8</td><td>81.4</td><td>6.6</td><td>38.7</td><td>39.1</td></tr><tr><td>Segformer-B1 [90]</td><td>13.7</td><td>15.9</td><td>42.2</td><td>43.1</td><td>243.7</td><td>78.5</td><td>80.0</td><td>15.9</td><td>40.2</td><td>■</td></tr><tr><td>HRFormer-S[100]</td><td>13.5</td><td>109.5</td><td>44.0</td><td>45.1</td><td>835.7</td><td>80.0</td><td>81.0</td><td>109.5</td><td>37.9</td><td>38.9</td></tr><tr><td>SegNeXt-S</td><td>13.9</td><td>15.9</td><td>44.3</td><td>45.8</td><td>124.6</td><td>81.3</td><td>82.7</td><td>15.9</td><td>42.2</td><td>42.8</td></tr><tr><td>Segformer-B2 [90]</td><td>27.5</td><td>62.4</td><td>46.5</td><td>47.5</td><td>717.1</td><td>81.0</td><td>82.2</td><td>62.4</td><td>44.6</td><td>-</td></tr><tr><td>MaskFormer [10]</td><td>42</td><td>55</td><td>46.7</td><td>48.8</td><td>-</td><td>■</td><td>=</td><td>-</td><td>■</td><td>■</td></tr><tr><td>SegNeXt-B</td><td>27.6</td><td>34.9</td><td>48.5</td><td>49.9</td><td>275.7</td><td>82.6</td><td>83.8</td><td>34.9</td><td>45.8</td><td>46.3</td></tr><tr><td>SETR-MLA+[108]</td><td>310.6</td><td>-</td><td>48.6</td><td>50.1</td><td>-</td><td>79.3</td><td>82.2</td><td>-</td><td>-</td><td>-</td></tr><tr><td>DPT-Hybrid [70]</td><td>124.0</td><td>307.9</td><td>-</td><td>49.0</td><td>-</td><td>-</td><td>-</td><td>-</td><td>■</td><td>■</td></tr><tr><td>Segformer-B3 [90]</td><td>47.3</td><td>79.0</td><td>49.4</td><td>50.0</td><td>962.9</td><td>81.7</td><td>83.3</td><td>79.0</td><td>45.5</td><td>-</td></tr><tr><td>Mask2Former[9]</td><td>47</td><td>74</td><td>47.7</td><td>49.6</td><td></td><td>=</td><td>■</td><td>■</td><td>=</td><td>-</td></tr><tr><td>HRFormer-B[100]</td><td>56.2</td><td>280.0</td><td>48.7</td><td>50.0</td><td>2223.8</td><td>81.9</td><td>82.6</td><td>280.0</td><td>42.4</td><td>43.3</td></tr><tr><td>MaskFormer [10]</td><td>63</td><td>79</td><td>49.8</td><td>51.0</td><td>-</td><td>=</td><td>=</td><td>-</td><td>=</td><td>-</td></tr><tr><td>SegNeXt-L</td><td>48.9</td><td>70.0</td><td>51.0</td><td>52.1</td><td>577.5</td><td>83.2</td><td>83.9</td><td>70.0</td><td>46.5</td><td>47.2</td></tr></table>
153
+
154
+ Table 10: Comparison with state-of-the-art methods on Pascal VOC dataset. ∗ means COCO [55] pretraining. † denotes JFT-300M [74] pretraining. \$ utilizes additional 300M unlabeled images for pretraining.
155
+
156
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=2>Backbone</td><td rowspan=1 colspan=1>mIoU</td></tr><tr><td rowspan=7 colspan=1>DANet [20]OCRNet [99]HamNet [22]EncNet*[103]EMANet* [46]DeepLabV3+*[7]DeepLabV3+†[7]NAS-FPN$[112]</td><td rowspan=1 colspan=2>ResNet101HRNetV2-W48</td><td rowspan=1 colspan=1>82.684.5</td></tr><tr><td rowspan=1 colspan=2>ResNet101</td><td rowspan=1 colspan=1>85.9</td></tr><tr><td rowspan=4 colspan=2>ResNet101ResNet101Xception-71Xception-JFT</td><td rowspan=1 colspan=1>85.9</td></tr><tr><td rowspan=1 colspan=1>87.7</td></tr><tr><td rowspan=1 colspan=1>Xception-71</td><td rowspan=1 colspan=1>87.8</td></tr><tr><td rowspan=1 colspan=1>Xception-JFT</td><td rowspan=1 colspan=1>89.0</td></tr><tr><td rowspan=1 colspan=2>EfficientNet-L2</td><td rowspan=1 colspan=1>90.5</td></tr><tr><td rowspan=3 colspan=1>SegNeXt-TSegNeXt-SSegNeXt-BSegNeXt-L*</td><td rowspan=3 colspan=2>MSCAN-TMSCAN-SMSCAN-BMSCAN-L</td><td rowspan=1 colspan=1>82.7</td></tr><tr><td rowspan=1 colspan=1>85.3</td></tr><tr><td rowspan=1 colspan=1>87.590.6</td></tr></table>
157
+
158
+ Table 11: Comparison with state-of-the-art realtime methods on Cityscapes test dataset. We test our method with a single RTX-3090 GPU and AMD EPYC 7543 32-core processor CPU . Without using any optimizations, SegNeXt-T can achieve 25 frames per second (FPS), which meets the requirements of real-time applications.
159
+
160
+ <table><tr><td>Method</td><td>Input size</td><td>mIoU</td></tr><tr><td>ESPNet [62] ESPNetv2 [63]</td><td>512×1,024 512×1,024</td><td>60.3 66.2</td></tr><tr><td>ICNet [105] DFANet [45]</td><td>1,024 × 2,048 1,024 × 1,024</td><td>69.5 71.3</td></tr><tr><td>BiSeNet [97]</td><td>768 × 1,536</td><td>74.6</td></tr><tr><td>BiSeNetv2 [96]</td><td>512 × 1,024</td><td></td></tr><tr><td>DF2-Seg [52]</td><td>1,024 × 2.048</td><td>75.3</td></tr><tr><td>SwiftNet [67]</td><td></td><td>74.8</td></tr><tr><td></td><td>1,024 × 2.048</td><td>75.5</td></tr><tr><td>SFNet [49]</td><td>1,024 × 2,048</td><td>77.8</td></tr><tr><td>SegNeXt-T</td><td>768 × 1,536</td><td>78.0</td></tr></table>
161
+
162
+ Comparison with real-time methods. In addition to the state-of-the-art performance, our method is also suitable for real-time deployments. Even without any specific software or hardware acceleration, SegNeXt-T realizes 25 frames per second (FPS) using a single 3090 RTX GPU when dealing with an image of size $^ { 7 6 8 \times 1 , 5 3 6 }$ . As shown in Tab. 11, our method sets new state-of-the-art results for real-time segmentation on the Cityscapes test set.
163
+
164
+ # 4.4 Weakly-Supervised Semantic Segmentation
165
+
166
+ In this subsection, we apply the proposed network to the weakly-supervised semantic segmentation task. In this task, a pseudo segmentation map is often generated by a classification model using CAM [110]. Previous works mostly utilize VGGNet [72] or ResNets [28, 87] as the CAM generator. Here, we test the performance of the CAMs produced by our MSCAN. We use the EPS [43] architecture and follow the training strategies and recipes. The numerical results are shown in Tab. 13. We can see that simply replacing the ResNet38 backbone with our MSCAN can clearly improve the performance compared to the EPS baseline. When using our SegNeXt as the segmentation network, the performance gain increases further.
167
+
168
+ Table 12: Comparison on Pascal Context benchmark. The number of FLOPs is calculated with the input size of $5 1 2 \times 5 1 2$ . ∗ means ImageNet-22K pretraining. † denotes ADE20K pretraining.
169
+
170
+ <table><tr><td rowspan=1 colspan=3>Method</td><td rowspan=1 colspan=1>Backbone</td><td rowspan=1 colspan=3>Params.(M)</td><td rowspan=1 colspan=2>GFLOPs</td><td rowspan=1 colspan=1>mIoU (SS/MS)</td></tr><tr><td rowspan=1 colspan=3>DANet [20]</td><td rowspan=1 colspan=1>ResNet101</td><td rowspan=1 colspan=3>69.1</td><td rowspan=1 colspan=2>277.7</td><td rowspan=1 colspan=1>= 52.6</td></tr><tr><td rowspan=1 colspan=3>EMANet [46]</td><td rowspan=1 colspan=1>ResNet101</td><td rowspan=1 colspan=3>61.1</td><td rowspan=1 colspan=2>246.1</td><td rowspan=1 colspan=1>53.1</td></tr><tr><td rowspan=6 colspan=3>HamNet [22]HRNet (OCR) [79]DeepLabV3+[7]SETR-MLA*[108]HRFormer-B [100]DPT-Hybrid+[70]</td><td rowspan=5 colspan=1>ResNet101HRNetW48ResNeSt-269ViT-LargeHRFormer-B</td><td rowspan=2 colspan=3>69.174.5</td><td rowspan=1 colspan=2>277.9</td><td rowspan=1 colspan=1>55.2</td></tr><tr><td rowspan=1 colspan=2>-</td><td rowspan=1 colspan=1>= 56.2</td></tr><tr><td rowspan=3 colspan=3>1309.556.2</td><td rowspan=1 colspan=2>=</td><td rowspan=2 colspan=1>= 58.954.9 55.8</td></tr><tr><td rowspan=1 colspan=1>309.5</td><td rowspan=1 colspan=2>=</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>54.9</td></tr><tr><td rowspan=1 colspan=2>56.2</td><td rowspan=1 colspan=2>280.0</td><td rowspan=1 colspan=1>57.6 58.5</td></tr><tr><td rowspan=1 colspan=1>ViT-Hybrid</td><td rowspan=1 colspan=3>124.0</td><td rowspan=1 colspan=2>1</td><td rowspan=1 colspan=1>- 60.5</td></tr><tr><td rowspan=1 colspan=3>SegNeXt-TSegNeXt-S</td><td rowspan=1 colspan=1>MSCAN-T</td><td rowspan=1 colspan=3>4.2</td><td rowspan=1 colspan=2>6.6</td><td rowspan=1 colspan=1>51.2 53.3</td></tr><tr><td rowspan=1 colspan=1>SegNeXt-S</td><td></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>MSCAN-S</td><td rowspan=1 colspan=3>13.9</td><td rowspan=1 colspan=2>15.9</td><td rowspan=1 colspan=1>54.2 56.1</td></tr><tr><td rowspan=3 colspan=3>SegNeXt-BSegNeXt-LSegNeXt-Lt</td><td rowspan=1 colspan=1>SegNeXt-B</td><td rowspan=1 colspan=3>MSCAN-B</td><td rowspan=1 colspan=2>27.6</td><td rowspan=1 colspan=1>34.9</td></tr><tr><td rowspan=1 colspan=2>SegNeXt-L</td><td rowspan=1 colspan=1>MSCAN-L</td><td rowspan=1 colspan=3>48.8</td><td rowspan=1 colspan=2>70.0</td><td rowspan=1 colspan=1>58.7 60.3</td></tr><tr><td rowspan=1 colspan=1>MSCAN-L</td><td rowspan=1 colspan=3>48.8</td><td rowspan=1 colspan=2>70.0</td><td rowspan=1 colspan=1>59.2 60.9</td></tr></table>
171
+
172
+ Table 13: Comparisons to previous state-of-the-art weakly-supervised semantic segmentation approaches on the PASCAL VOC 2012 validation set. All the segmentation results are based on the ResNet backbone [28, 87] except ours which utilize MSCAN-B.
173
+
174
+ <table><tr><td>Methods</td><td>Network</td><td>Supervision</td><td>mIoU (%) on Val.</td></tr><tr><td>FickleNet2019 [42]</td><td>DeeplabV2</td><td>Image + Saliency</td><td>64.9</td></tr><tr><td>OAA2019 [37]</td><td>DeeplabV1</td><td>Image + Saliency</td><td>65.2</td></tr><tr><td>ICD2020 [18]</td><td>DeeplabV1</td><td>Image + Saliency</td><td>67.8</td></tr><tr><td>Multi-Est.2020 [19]</td><td>DeeplabV1</td><td>Image + Saliency</td><td>67.2</td></tr><tr><td>DRS2021 [39]</td><td>DeeplabV2</td><td>Image+ Saliency</td><td>71.2</td></tr><tr><td>Group-WSSS2021 [53]</td><td>DeeplabV2</td><td>Image+ Saliency</td><td>68.2</td></tr><tr><td>AuxSegNet2021 [92]</td><td>DeeplabV1</td><td>Image + Saliency</td><td>69.0</td></tr><tr><td>EDAM2021 [86]</td><td>DeeplabV1</td><td>Image + Saliency</td><td>70.9</td></tr><tr><td>EPS2021 [43]</td><td>DeeplabV2</td><td>Image + Saliency</td><td>70.9</td></tr><tr><td>L2G2022 [38]</td><td>DeeplabV1</td><td>Image + Saliency</td><td>72.0</td></tr><tr><td>MSCAN + EPS [43](Ours)</td><td>DeeplabV2</td><td>Image + Saliency</td><td>71.7</td></tr><tr><td>MSCAN + EPS [43] (Ours)</td><td>SegNeXt</td><td>Image + Saliency</td><td>72.2</td></tr></table>
175
+
176
+ # 5 Conclusions and Discussion
177
+
178
+ In this paper, we analyze previous successful segmentation models and find the good characteristics owned by them. Based on the findings, we present a tailored convolutional attention module MSCA and a CNN-style network SegNeXt. Experimental results demonstrate that SegNeXt surpasses current state-of-the-art transformer-based methods by a considerable margin.
179
+
180
+ Recently, transformer-based models have dominated various segmentation leaderboards. Instead, this paper shows that CNN-based methods can still perform better than transformer-based methods when using a proper design. We hope this paper could encourage researchers to further investigate the potential of CNNs.
181
+
182
+ Our model also has its limitations, for example, extending this method to large-scale models with $1 0 0 \mathbf { M } +$ parameters and the performance on other vision or NLP tasks. These will be addressed in our future works.
183
+
184
+ # Acknowledgment
185
+
186
+ This work was supported by the National Key R&D Program of China (NO. 2018AAA0100400) and the Natural Science Foundation of China (No. 62220106003, No. 62176130, and No. 62276145). We would like to thank Yi Zhang and Zhengyang Geng for their kind help in experiments.
187
+
188
+ References
189
+ [1] Badrinarayanan, V., Kendall, A., Cipolla, R.: Segnet: A deep convolutional encoder-decoder architecture for image segmentation. IEEE Transactions on Pattern Analysis and Machine Intelligence 39(12), 2481–2495 (2017)
190
+ [2] Bertasius, G., Shi, J., Torresani, L.: Semantic segmentation with boundary neural fields. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 3602–3610 (2016)
191
+ [3] Caesar, H., Uijlings, J., Ferrari, V.: Coco-stuff: Thing and stuff classes in context. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 1209–1218 (2018)
192
+ [4] Chen, L.C., Papandreou, G., Kokkinos, I., Murphy, K., Yuille, A.L.: Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs. IEEE Transactions on Pattern Analysis and Machine Intelligence 40(4), 834–848 (2017)
193
+ [5] Chen, L.C., Papandreou, G., Schroff, F., Adam, H.: Rethinking atrous convolution for semantic image segmentation. arXiv preprint arXiv:1706.05587 (2017)
194
+ [6] Chen, L.C., Yang, Y., Wang, J., Xu, W., Yuille, A.L.: Attention to scale: Scale-aware semantic image segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 3640–3649 (2016)
195
+ [7] Chen, L.C., Zhu, Y., Papandreou, G., Schroff, F., Adam, H.: Encoder-decoder with atrous separable convolution for semantic image segmentation. In: European Conference on Computer Vision. pp. 801–818 (2018)
196
+ [8] Chen, L., Zhang, H., Xiao, J., Nie, L., Shao, J., Liu, W., Chua, T.S.: Sca-cnn: Spatial and channel-wise attention in convolutional networks for image captioning. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 5659–5667 (2017)
197
+ [9] Cheng, B., Misra, I., Schwing, A.G., Kirillov, A., Girdhar, R.: Masked-attention mask transformer for universal image segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 1290–1299 (2022)
198
+ [10] Cheng, B., Schwing, A., Kirillov, A.: Per-pixel classification is not all you need for semantic segmentation. Advances in Neural Information Processing Systems 34, 17864–17875 (2021)
199
+ [11] Contributors, M.: MMSegmentation: Openmmlab semantic segmentation toolbox and benchmark. https://github.com/open-mmlab/mmsegmentation(Apache-2.0) (2020)
200
+ [12] Cordts, M., Omran, M., Ramos, S., Rehfeld, T., Enzweiler, M., Benenson, R., Franke, U., Roth, S., Schiele, B.: The cityscapes dataset for semantic urban scene understanding. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 3213–3223 (2016)
201
+ [13] Dai, J., Qi, H., Xiong, Y., Li, Y., Zhang, G., Hu, H., Wei, Y.: Deformable convolutional networks. In: IEEE/CVF International Conference on Computer Vision. pp. 764–773 (2017)
202
+ [14] Deng, J., Dong, W., Socher, R., Li, L.J., Li, K., Fei-Fei, L.: Imagenet: A large-scale hierarchical image database. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 248–255. Ieee (2009)
203
+ [15] Ding, H., Jiang, X., Liu, A.Q., Thalmann, N.M., Wang, G.: Boundary-aware feature propagation for scene segmentation. In: IEEE/CVF International Conference on Computer Vision. pp. 6819–6829 (2019)
204
+ [16] Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., et al.: An image is worth 16x16 words: Transformers for image recognition at scale. In: International Conference on Learning Representations. (2020)
205
+ [17] Everingham, M., Van Gool, L., Williams, C.K., Winn, J., Zisserman, A.: The pascal visual object classes (voc) challenge. International Journal of Computer Vision 88(2), 303–338 (2010)
206
+ [18] Fan, J., Zhang, Z., Song, C., Tan, T.: Learning integral objects with intra-class discriminator for weakly-supervised semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 4283–4292 (2020)
207
+ [19] Fan, J., Zhang, Z., Tan, T.: Employing multi-estimations for weakly-supervised semantic segmentation. In: European Conference on Computer Vision. pp. 332–348. Springer (2020)
208
+ [20] Fu, J., Liu, J., Tian, H., Li, Y., Bao, Y., Fang, Z., Lu, H.: Dual attention network for scene segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 3146–3154 (2019)
209
+ [21] Gao, S.H., Cheng, M.M., Zhao, K., Zhang, X.Y., Yang, M.H., Torr, P.: Res2net: A new multiscale backbone architecture. IEEE Transactions on Pattern Analysis and Machine Intelligence 43(2), 652–662 (2021)
210
+ [22] Geng, Z., Guo, M.H., Chen, H., Li, X., Wei, K., Lin, Z.: Is attention better than matrix decomposition? In: International Conference on Learning Representations. (2021)
211
+ [23] Guo, M.H., Cai, J.X., Liu, Z.N., Mu, T.J., Martin, R.R., Hu, S.M.: Pct: Point cloud transformer. Computational Visual Media 7(2), 187–199 (2021)
212
+ [24] Guo, M.H., Liu, Z.N., Mu, T.J., Hu, S.M.: Beyond self-attention: External attention using two linear layers for visual tasks. arXiv preprint arXiv:2105.02358 (2021)
213
+ [25] Guo, M.H., Lu, C.Z., Liu, Z.N., Cheng, M.M., Hu, S.M.: Visual attention network. arXiv preprint arXiv:2202.09741 (2022)
214
+ [26] Guo, M.H., Xu, T.X., Liu, J.J., Liu, Z.N., Jiang, P.T., Mu, T.J., Zhang, S.H., Martin, R.R., Cheng, M.M., Hu, S.M.: Attention mechanisms in computer vision: A survey. Computational Visual Media 8(3), 329–367 (2022)
215
+ [27] He, J., Deng, Z., Zhou, L., Wang, Y., Qiao, Y.: Adaptive pyramid context network for semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 7519–7528 (2019)
216
+ [28] He, K., Zhang, X., Ren, S., Sun, J.: Deep residual learning for image recognition. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 770–778 (2016)
217
+ [29] He, T., Zhang, Z., Zhang, H., Zhang, Z., Xie, J., Li, M.: Bag of tricks for image classification with convolutional neural networks. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 558–567 (2019)
218
+ [30] Hou, Q., Zhang, L., Cheng, M.M., Feng, J.: Strip pooling: Rethinking spatial pooling for scene parsing. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 4003–4012 (2020)
219
+ [31] Hu, J., Shen, L., Sun, G.: Squeeze-and-excitation networks. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 7132–7141 (2018)
220
+ [32] Hu, S.M., Liang, D., Yang, G.Y., Yang, G.W., Zhou, W.Y.: Jittor: a novel deep learning framework with meta-operators and unified graph execution. Science China Information Sciences 63(222103), 1–21 (2020)
221
+ [33] Huang, G., Liu, Z., Van Der Maaten, L., Weinberger, K.Q.: Densely connected convolutional networks. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 4700– 4708 (2017)
222
+ [34] Huang, Z., Shi, X., Zhang, C., Wang, Q., Cheung, K.C., Qin, H., Dai, J., Li, H.: Flowformer: A transformer architecture for optical flow. arXiv preprint arXiv:2203.16194 (2022)
223
+ [35] Huang, Z., Wang, X., Huang, L., Huang, C., Wei, Y., Liu, W.: Ccnet: Criss-cross attention for semantic segmentation. In: IEEE/CVF International Conference on Computer Vision. pp. 603–612 (2019)
224
+ [36] Ioffe, S., Szegedy, C.: Batch normalization: Accelerating deep network training by reducing internal covariate shift. In: International Conference on Machine Learning. pp. 448–456. PMLR (2015)
225
+ [37] Jiang, P.T., Hou, Q., Cao, Y., Cheng, M.M., Wei, Y., Xiong, H.K.: Integral object mining via online attention accumulation. In: IEEE/CVF International Conference on Computer Vision. pp. 2070–2079 (2019)
226
+ [38] Jiang, P.T., Yang, Y., Hou, Q., Wei, Y.: $\mathrm { L } 2 \mathrm { g }$ : A simple local-to-global knowledge transfer framework for weakly supervised semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 16886–16896 (2022)
227
+ [39] Kim, B., Han, S., Kim, J.: Discriminative region suppression for weakly-supervised semantic segmentation. In: Association for the Advancement of Artificial Intelligence. pp. 1754–1761 (2021)
228
+ [40] Kirillov, A., Girshick, R., He, K., Dollar, P.: Panoptic feature pyramid networks. In: IEEE/CVF ´ Conference on Computer Vision and Pattern Recognition. pp. 6399–6408 (2019)
229
+ [41] Kirillov, A., Wu, Y., He, K., Girshick, R.: Pointrend: Image segmentation as rendering. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 9799–9808 (2020)
230
+ [42] Lee, J., Kim, E., Lee, S., Lee, J., Yoon, S.: Ficklenet: Weakly and semi-supervised semantic image segmentation using stochastic inference. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 5267–5276 (2019)
231
+ [43] Lee, S., Lee, M., Lee, J., Shim, H.: Railroad is not a train: Saliency as pseudo-pixel supervision for weakly supervised semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 5495–5505 (2021)
232
+ [44] Lee, Y., Kim, J., Willette, J., Hwang, S.J.: Mpvit: Multi-path vision transformer for dense prediction. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. (2022)
233
+ [45] Li, H., Xiong, P., Fan, H., Sun, J.: Dfanet: Deep feature aggregation for real-time semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 9522–9531 (2019)
234
+ [46] Li, X., Zhong, Z., Wu, J., Yang, Y., Lin, Z., Liu, H.: Expectation-maximization attention networks for semantic segmentation. In: IEEE/CVF International Conference on Computer Vision. pp. 9167–9176 (2019)
235
+ [47] Li, X., He, H., Li, X., Li, D., Cheng, G., Shi, J., Weng, L., Tong, Y., Lin, Z.: Pointflow: Flowing semantics through points for aerial image segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 4217–4226 (2021)
236
+ [48] Li, X., Li, X., Zhang, L., Cheng, G., Shi, J., Lin, Z., Tan, S., Tong, Y.: Improving semantic segmentation via decoupled body and edge supervision. In: European Conference on Computer Vision. pp. 435–452. Springer (2020)
237
+ [49] Li, X., You, A., Zhu, Z., Zhao, H., Yang, M., Yang, K., Tan, S., Tong, Y.: Semantic flow for fast and accurate scene parsing. In: European Conference on Computer Vision. pp. 775–793. Springer (2020)
238
+ [50] Li, X., Zhang, W., Pang, J., Chen, K., Cheng, G., Tong, Y., Loy, C.C.: Video k-net: A simple, strong, and unified baseline for video segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 18847–18857 (2022)
239
+ [51] Li, X., Zhao, H., Han, L., Tong, Y., Tan, S., Yang, K.: Gated fully fusion for semantic segmentation. In: Association for the Advancement of Artificial Intelligence. pp. 11418–11425 (2020)
240
+ [52] Li, X., Zhou, Y., Pan, Z., Feng, J.: Partial order pruning: for best speed/accuracy trade-off in neural architecture search. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 9145–9153 (2019)
241
+ [53] Li, X., Zhou, T., Li, J., Zhou, Y., Zhang, Z.: Group-wise semantic mining for weakly supervised semantic segmentation. In: Association for the Advancement of Artificial Intelligence. pp. 1984–1992 (2021)
242
+ [54] Lin, G., Milan, A., Shen, C., Reid, I.: Refinenet: Multi-path refinement networks for highresolution semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 1925–1934 (2017)
243
+ [55] Lin, T.Y., Maire, M., Belongie, S., Hays, J., Perona, P., Ramanan, D., Dollar, P., Zitnick, C.L.: ´ Microsoft coco: Common objects in context. In: European Conference on Computer Vision. pp. 740–755. Springer (2014)
244
+ [56] Liu, R., Deng, H., Huang, Y., Shi, X., Lu, L., Sun, W., Wang, X., Dai, J., Li, H.: Decoupled spatial-temporal transformer for video inpainting. arXiv preprint arXiv:2104.06637 (2021)
245
+ [57] Liu, R., Deng, H., Huang, Y., Shi, X., Lu, L., Sun, W., Wang, X., Dai, J., Li, H.: Fuseformer: Fusing fine-grained information in transformers for video inpainting. In: IEEE/CVF International Conference on Computer Vision. pp. 14040–14049 (2021)
246
+ [58] Liu, Z., Lin, Y., Cao, Y., Hu, H., Wei, Y., Zhang, Z., Lin, S., Guo, B.: Swin transformer: Hierarchical vision transformer using shifted windows. In: IEEE/CVF International Conference on Computer Vision. pp. 10012–10022 (2021)
247
+ [59] Liu, Z., Mao, H., Wu, C.Y., Feichtenhofer, C., Darrell, T., Xie, S.: A convnet for the 2020s. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 11976–11986 (2022)
248
+ [60] Long, J., Shelhamer, E., Darrell, T.: Fully convolutional networks for semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 3431–3440 (2015)
249
+ [61] Loshchilov, I., Hutter, F.: Decoupled weight decay regularization. In: International Conference on Learning Representations (2019)
250
+ [62] Mehta, S., Rastegari, M., Caspi, A., Shapiro, L., Hajishirzi, H.: Espnet: Efficient spatial pyramid of dilated convolutions for semantic segmentation. In: European Conference on Computer Vision. pp. 552–568 (2018)
251
+ [63] Mehta, S., Rastegari, M., Shapiro, L., Hajishirzi, H.: Espnetv2: A light-weight, power efficient, and general purpose convolutional neural network. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 9190–9200 (2019)
252
+ [64] Mnih, V., Heess, N., Graves, A., et al.: Recurrent models of visual attention. In: Advances in Neural Information Processing Systems. pp. 2204–2212 (2014)
253
+ [65] Mottaghi, R., Chen, X., Liu, X., Cho, N.G., Lee, S.W., Fidler, S., Urtasun, R., Yuille, A.: The role of context for object detection and semantic segmentation in the wild. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 891–898 (2014)
254
+ [66] Mou, L., Hua, Y., Zhu, X.X.: A relation-augmented fully convolutional network for semantic segmentation in aerial scenes. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 12416–12425 (2019)
255
+ [67] Orsic, M., Kreso, I., Bevandic, P., Segvic, S.: In defense of pre-trained imagenet architectures for real-time semantic segmentation of road-driving images. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 12607–12616 (2019)
256
+ [68] Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., et al.: Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems 32 (2019)
257
+ [69] Peng, C., Zhang, X., Yu, G., Luo, G., Sun, J.: Large kernel matters–improve semantic segmentation by global convolutional network. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 4353–4361 (2017)
258
+ [70] Ranftl, R., Bochkovskiy, A., Koltun, V.: Vision transformers for dense prediction. In: IEEE/CVF International Conference on Computer Vision. pp. 12179–12188 (2021)
259
+ [71] Ronneberger, O., Fischer, P., Brox, T.: U-net: Convolutional networks for biomedical image segmentation. In: International Conference on Medical Image Computing and ComputerAssisted Intervention. pp. 234–241. Springer (2015)
260
+ [72] Simonyan, K., Zisserman, A.: Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556 (2014)
261
+ [73] Strudel, R., Garcia, R., Laptev, I., Schmid, C.: Segmenter: Transformer for semantic segmentation. In: IEEE/CVF International Conference on Computer Vision. pp. 7262–7272 (2021)
262
+ [74] Sun, C., Shrivastava, A., Singh, S., Gupta, A.: Revisiting unreasonable effectiveness of data in deep learning era. In: IEEE/CVF International Conference on Computer Vision. pp. 843–852 (2017)
263
+ [75] Szegedy, C., Liu, W., Jia, Y., Sermanet, P., Reed, S., Anguelov, D., Erhan, D., Vanhoucke, V., Rabinovich, A.: Going deeper with convolutions. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 1–9 (2015)
264
+ [76] Takikawa, T., Acuna, D., Jampani, V., Fidler, S.: Gated-scnn: Gated shape cnns for semantic segmentation. In: IEEE/CVF International Conference on Computer Vision. pp. 5229–5238 (2019)
265
+ [77] Tan, M., Le, Q.: Efficientnet: Rethinking model scaling for convolutional neural networks. In: International conference on machine learning. pp. 6105–6114. PMLR (2019)
266
+ [78] Touvron, H., Cord, M., Douze, M., Massa, F., Sablayrolles, A., Jegou, H.: Training data- ´ efficient image transformers & distillation through attention. In: International Conference on Machine Learning. pp. 10347–10357. PMLR (2021)
267
+ [79] Wang, J., Sun, K., Cheng, T., Jiang, B., Deng, C., Zhao, Y., Liu, D., Mu, Y., Tan, M., Wang, X., et al.: Deep high-resolution representation learning for visual recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence (2020)
268
+ [80] Wang, Q., Wu, B., Zhu, P., Li, P., Zuo, W., Hu, Q.: Eca-net: Efficient channel attention for deep convolutional neural networks. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 11534–11542 (2020)
269
+ [81] Wang, W., Xie, E., Li, X., Fan, D.P., Song, K., Liang, D., Lu, T., Luo, P., Shao, L.: Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In: IEEE/CVF International Conference on Computer Vision. pp. 568–578 (2021)
270
+ [82] Wang, W., Xie, E., Li, X., Fan, D.P., Song, K., Liang, D., Lu, T., Luo, P., Shao, L.: Pvt v2: Improved baselines with pyramid vision transformer. Computational Visual Media 8(3), 415–424 (2022)
271
+ [83] Wang, X., Girshick, R., Gupta, A., He, K.: Non-local neural networks. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 7794–7803 (2018)
272
+ [84] Waqas Zamir, S., Arora, A., Gupta, A., Khan, S., Sun, G., Shahbaz Khan, F., Zhu, F., Shao, L., Xia, G.S., Bai, X.: isaid: A large-scale dataset for instance segmentation in aerial images. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshop. pp. 28–37 (2019)
273
+ [85] Wightman, R.: Pytorch image models. https://github.com/rwightman/ pytorch-image-models(Apache-2.0) (2019)
274
+ [86] Wu, T., Huang, J., Gao, G., Wei, X., Wei, X., Luo, X., Liu, C.H.: Embedded discriminative attention mechanism for weakly supervised semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 16765–16774 (2021) [87] Wu, Z., Shen, C., Van Den Hengel, A.: Wider or deeper: Revisiting the resnet model for visual recognition. Pattern Recognition. 90, 119–133 (2019)
275
+ [88] Xia, F., Wang, P., Chen, L.C., Yuille, A.L.: Zoom better to see clearer: Human and object parsing with hierarchical auto-zoom net. In: European Conference on Computer Vision. pp. 648–663. Springer (2016) [89] Xiao, T., Liu, Y., Zhou, B., Jiang, Y., Sun, J.: Unified perceptual parsing for scene understanding. In: European Conference on Computer Vision. pp. 418–434 (2018)
276
+ [90] Xie, E., Wang, W., Yu, Z., Anandkumar, A., Alvarez, J.M., Luo, P.: Segformer: Simple and efficient design for semantic segmentation with transformers. Advances in Neural Information Processing Systems 34 (2021)
277
+ [91] Xie, S., Girshick, R., Dollar, P., Tu, Z., He, K.: Aggregated residual transformations for deep ´ neural networks. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 1492–1500 (2017) [92] Xu, L., Ouyang, W., Bennamoun, M., Boussaid, F., Sohel, F., Xu, D.: Leveraging auxiliary tasks with affinity learning for weakly supervised semantic segmentation. In: IEEE/CVF International Conference on Computer Vision. pp. 6984–6993 (2021) [93] Xu, Y., Wei, H., Lin, M., Deng, Y., Sheng, K., Zhang, M., Tang, F., Dong, W., Huang, F., Xu, C.: Transformers in computational visual media: A survey. Computational Visual Media 8(1), 33–62 (2022)
278
+ [94] Yang, J., Li, C., Zhang, P., Dai, X., Xiao, B., Yuan, L., Gao, J.: Focal attention for long-range interactions in vision transformers. Advances in Neural Information Processing Systems 34, 30008–30022 (2021)
279
+ [95] Yang, M., Yu, K., Zhang, C., Li, Z., Yang, K.: Denseaspp for semantic segmentation in street scenes. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 3684–3692 (2018) [96] Yu, C., Gao, C., Wang, J., Yu, G., Shen, C., Sang, N.: Bisenet v2: Bilateral network with guided aggregation for real-time semantic segmentation. International Journal of Computer Vision 129(11), 3051–3068 (2021)
280
+ [97] Yu, C., Wang, J., Peng, C., Gao, C., Yu, G., Sang, N.: Bisenet: Bilateral segmentation network for real-time semantic segmentation. In: European Conference on Computer Vision. pp. 325–341 (2018)
281
+ [98] Yu, F., Koltun, V.: Multi-scale context aggregation by dilated convolutions. In: International Conference on Learning Representation (2016) [99] Yuan, Y., Chen, X., Wang, J.: Object-contextual representations for semantic segmentation. In: European Conference on Computer Vision. pp. 173–190. Springer (2020)
282
+ [100] Yuan, Y., Fu, R., Huang, L., Lin, W., Zhang, C., Chen, X., Wang, J.: Hrformer: High-resolution vision transformer for dense predict. Advances in Neural Information Processing Systems 34, 7281–7293 (2021)
283
+ [101] Yuan, Y., Huang, L., Guo, J., Zhang, C., Chen, X., Wang, J.: Ocnet: Object context network for scene parsing. arXiv preprint arXiv:1809.00916 (2018)
284
+ [102] Yuan, Y., Xie, J., Chen, X., Wang, J.: Segfix: Model-agnostic boundary refinement for segmentation. In: European Conference on Computer Vision. pp. 489–506. Springer (2020)
285
+ [103] Zhang, H., Dana, K., Shi, J., Zhang, Z., Wang, X., Tyagi, A., Agrawal, A.: Context encoding for semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 7151–7160 (2018)
286
+ [104] Zhang, H., Wu, C., Zhang, Z., Zhu, Y., Lin, H., Zhang, Z., Sun, Y., He, T., Mueller, J., Manmatha, R., et al.: Resnest: Split-attention networks. arXiv preprint arXiv:2004.08955 (2020)
287
+ [105] Zhao, H., Qi, X., Shen, X., Shi, J., Jia, J.: Icnet for real-time semantic segmentation on high-resolution images. In: European Conference on Computer Vision. pp. 405–420 (2018)
288
+ [106] Zhao, H., Shi, J., Qi, X., Wang, X., Jia, J.: Pyramid scene parsing network. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 2881–2890 (2017)
289
+ [107] Zhen, M., Wang, J., Zhou, L., Li, S., Shen, T., Shang, J., Fang, T., Quan, L.: Joint semantic segmentation and boundary detection using iterative pyramid contexts. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 13666–13675 (2020)
290
+ [108] Zheng, S., Lu, J., Zhao, H., Zhu, X., Luo, Z., Wang, Y., Fu, Y., Feng, J., Xiang, T., Torr, P.H., et al.: Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 6881–6890 (2021)
291
+ [109] Zheng, Z., Zhong, Y., Wang, J., Ma, A.: Foreground-aware relation network for geospatial object segmentation in high spatial resolution remote sensing imagery. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 4096–4105 (2020)
292
+ [110] Zhou, B., Khosla, A., Lapedriza, A., Oliva, A., Torralba, A.: Learning deep features for discriminative localization. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 2921–2929 (2016)
293
+ [111] Zhou, B., Zhao, H., Puig, X., Fidler, S., Barriuso, A., Torralba, A.: Scene parsing through ade20k dataset. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 633–641 (2017)
294
+ [112] Zoph, B., Ghiasi, G., Lin, T.Y., Cui, Y., Liu, H., Cubuk, E.D., Le, Q.: Rethinking pre-training and self-training. Advances in Neural Information Processing Systems 33, 3833–3845 (2020)
parse/dev/WVX0NNVBBkV/WVX0NNVBBkV_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/biaOpY5gAo/biaOpY5gAo_content_list.json ADDED
@@ -0,0 +1,830 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Stack More Layers Differently: High-Rank Training Through Low-Rank Updates ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 196,
8
+ 122,
9
+ 802,
10
+ 172
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Anonymous Author(s) \nAffiliation \nAddress \nemail ",
17
+ "bbox": [
18
+ 423,
19
+ 226,
20
+ 580,
21
+ 281
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "Abstract ",
28
+ "text_level": 1,
29
+ "bbox": [
30
+ 462,
31
+ 318,
32
+ 535,
33
+ 334
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "1 Despite the dominance and effectiveness of scaling, resulting in large networks with \n2 hundreds of billions of parameters, the necessity to train overparametrized models \n3 remains poorly understood, and alternative approaches do not necessarily make \n4 it cheaper to train high-performance models. In this paper, we explore low-rank \n5 training techniques as an alternative approach to training large neural networks. \n6 We introduce a novel method called ReLoRA, which utilizes low-rank updates to \n7 train high-rank networks. We apply ReLoRA to pre-training transformer language \n8 models with up to 350M parameters, and demonstrate comparable performance \n9 to regular neural network training. Furthermore, we observe that the efficiency \n10 of ReLoRA increases with model size, making it a promising approach for train \n11 ing multi-billion-parameter networks efficiently. Our findings shed light on the \n12 potential of low-rank training techniques and their implications for scaling laws.1 ",
40
+ "bbox": [
41
+ 148,
42
+ 349,
43
+ 766,
44
+ 516
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "13 1 Introduction ",
51
+ "text_level": 1,
52
+ "bbox": [
53
+ 148,
54
+ 542,
55
+ 312,
56
+ 560
57
+ ],
58
+ "page_idx": 0
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "14 Over the past decade, the machine learning field has been dominated by the trend of training \n15 increasingly overparametrized networks or adopting the \"stack more layers\" approach [32, 21, 27]. \n16 The definition of a large network has evolved from models with 100 million [46, 39] to hundreds \n17 of billions [8, 12] of parameters, which has made computational costs associated with training of \n18 such networks prohibitive to most of the research groups. Despite this, the necessity to train models \n19 which can have orders of magnitude more parameters than the training examples [8, 12, 16], is poorly \n20 understood theoretically [25, 4, 60]. \n21 Alternative approaches to scaling, such as more compute-efficient scaling optima [22], retrieval \n22 augmented models [28, 7], and the simple approach of training smaller models for longer [50], have \n23 offered new interesting trade-offs. However, they do not bring us closer to understanding why we \n24 need overparametrized models and rarely democratize the training of these models. For example, \n25 training RETRO [7] requires a complex training setup and infrastructure capable of quickly searching \n26 over trillions of tokens, while training LLaMA-6B [50] still requires hundreds of GPUs. \n7 In contrast, approaches like zero-redundancy optimizers [43], 16-bit training [37], 8-bit inference [14], \n28 and parameter-efficient fine-tuning (PEFT) [33] have played a crucial role in making large models \n29 more accessible. Specifically, PEFT methods have enabled fine-tuning of billion-scale language or \n30 diffusion models on consumer hardware. This raises the question: Can these approaches also benefit \n31 pre-training? ",
63
+ "bbox": [
64
+ 147,
65
+ 575,
66
+ 825,
67
+ 672
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "",
74
+ "bbox": [
75
+ 147,
76
+ 679,
77
+ 825,
78
+ 762
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "",
85
+ "bbox": [
86
+ 153,
87
+ 768,
88
+ 825,
89
+ 838
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "On one hand, pre-training is exactly the step that allows for small modifications to the network to adapt it to new tasks. Aghajanyan et al. [1] demonstrated that the rank of the changes required ",
96
+ "bbox": [
97
+ 160,
98
+ 844,
99
+ 823,
100
+ 873
101
+ ],
102
+ "page_idx": 0
103
+ },
104
+ {
105
+ "type": "image",
106
+ "img_path": "images/f06cdfa300daa5962682fbc37a47df3ef9e43dab670981cc2bf8d11c7e1aec3e.jpg",
107
+ "image_caption": [
108
+ "Figure 1: ReLoRA learns a high-rank network through a sequence of low-rank updates. It outperforms networks with the same trainable parameter count and achieves similar performance to training a full network at $1 0 0 \\mathbf { M } +$ scale. The efficiency of ReLoRA increases with the model size, making it a viable candidate for multi-billion-parameter training. "
109
+ ],
110
+ "image_footnote": [],
111
+ "bbox": [
112
+ 179,
113
+ 93,
114
+ 816,
115
+ 279
116
+ ],
117
+ "page_idx": 1
118
+ },
119
+ {
120
+ "type": "text",
121
+ "text": "34 to learn a task decreases the more you pre-train the network. On the other hand, multiple studies \n35 have demonstrated the simplicity of features extracted and utilized by language and vision models, \n36 along with their low intrinsic dimensionality [31, 17, 42, 47]. For instance, attention patterns in \n37 transformers [51] often exhibit a small rank, which has been successfully leveraged to develop more \n38 efficient variants of attention [52, 11]. Moreover, overparametrization is also not necessary for \n39 training. The Lottery Ticket Hypothesis [17] empirically demonstrates that during initialization (or \n40 early in training [18]), there exist sub-networks – winning tickets – that when trained in isolation \n41 reach the performance of the full network. \n42 In this study, we focus on low-rank training techniques and introduce ReLoRA that uses low-rank \n43 updates to train a high-rank network. We empirically demonstrate that ReLoRA performs a high-rank \n44 update and achieves performance similar to regular neural network training. The components of \n45 ReLoRA include initial full-rank training of the neural network (similar to Frankle et al. [18]), LoRA \n46 training, restarts, a jagged learning rate schedule, and partial optimizer resets. We evaluate ReLoRA \n47 on transformer language models up to 350M parameters. We chose to focus on autoregressive \n48 language modeling, as this approach has demonstrated its universality in most of the applications of \n49 neural networks [41, 56, 3, 35, 10]. Finally, we observe that the efficiency of ReLoRA increases with \n50 model size, making it a viable option for efficient training of multi-billion-parameter networks. ",
122
+ "bbox": [
123
+ 147,
124
+ 377,
125
+ 825,
126
+ 488
127
+ ],
128
+ "page_idx": 1
129
+ },
130
+ {
131
+ "type": "text",
132
+ "text": "",
133
+ "bbox": [
134
+ 147,
135
+ 494,
136
+ 825,
137
+ 619
138
+ ],
139
+ "page_idx": 1
140
+ },
141
+ {
142
+ "type": "text",
143
+ "text": "51 Each experiment in this study has used no more than 8 GPU days of compute. ",
144
+ "bbox": [
145
+ 147,
146
+ 625,
147
+ 681,
148
+ 640
149
+ ],
150
+ "page_idx": 1
151
+ },
152
+ {
153
+ "type": "text",
154
+ "text": "52 2 Related work ",
155
+ "text_level": 1,
156
+ "bbox": [
157
+ 150,
158
+ 664,
159
+ 316,
160
+ 680
161
+ ],
162
+ "page_idx": 1
163
+ },
164
+ {
165
+ "type": "text",
166
+ "text": "53 Scaling versus Efficiency The relationship between overparametrization and neural network \n54 trainability and generalization has been extensively studied [59, 5, 17, 38, 47], yet it remains a \n55 mystery [60]. Moreover, scaling laws [27, 19, 22, 30, 2] demonstrate a simple and strong power-law \n56 dependence between network size and its performance across a variety of modalities. This finding \n57 not only supports overparametrization but also encourages the training of extraordinarily resource \n58 intensive neural networks [8, 12, 16]. Nonetheless, the Lottery Ticket Hypothesis [17, 18] suggests \n59 that overparametrization could, in principle, be minimized. Specifically, it shows that early in training, \n60 subnetworks exist that can be trained to achieve the performance of the full network (winning tickets). \n61 Parameter-efficient fine-tuning Aghajanyan et al. [1] found that pre-training reduces the amount \n62 of change to the network, or its intrinsic dimensionality, to learn a new task through fine-tuning. I.e., \n63 larger networks or networks pre-trained on more data require smaller modifications in terms of the \n64 rank of the range to learn a new task. This explains the success of parameter-efficient fine-tuning \n65 methods [33] and has also motivated the development of low-rank fine-tuning methods such as LoRA \n66 [23] and Compacter [36]. \n67 Low-rank neural network training Training low-rank representations has been explored in the \n68 context of CNN compression, regularization, and efficient training [24, 26, 49, 44, 34, 57]. However, \n69 most of these methods are either specific to CNNs, do not scale well, or have not been evaluated \n70 on large transformers [51] with hundreds of millions of parameters, which can benefit greatly from \n71 efficient training. While transformers have been shown to have a low-rank internal dimensionality \n72 and representations [1, 52], the study by Bhojanapalli et al. [6] demonstrated that the low rank of key \n73 and query projections in multi-head attention bottlenecks the performance of transformers. Our own \n74 experiments (Section 3) also demonstrate that low-rank transformers perform significantly worse \n75 compared to the full-rank baseline and ReLoRA. ",
167
+ "bbox": [
168
+ 147,
169
+ 698,
170
+ 825,
171
+ 809
172
+ ],
173
+ "page_idx": 1
174
+ },
175
+ {
176
+ "type": "text",
177
+ "text": "",
178
+ "bbox": [
179
+ 147,
180
+ 828,
181
+ 825,
182
+ 911
183
+ ],
184
+ "page_idx": 1
185
+ },
186
+ {
187
+ "type": "image",
188
+ "img_path": "images/e5544a796d2dd01b849e744926b53c58425e130bdb52b3193427ffc104e1c408.jpg",
189
+ "image_caption": [
190
+ "Figure 2: Jagged cosine scheduler used in ReLoRA. On every ReLoRA reset, we set the learning rate to zero and perform a quick (50-100 steps) learning rate warmup back to the cosine schedule. "
191
+ ],
192
+ "image_footnote": [],
193
+ "bbox": [
194
+ 313,
195
+ 95,
196
+ 681,
197
+ 261
198
+ ],
199
+ "page_idx": 2
200
+ },
201
+ {
202
+ "type": "text",
203
+ "text": "",
204
+ "bbox": [
205
+ 147,
206
+ 329,
207
+ 825,
208
+ 455
209
+ ],
210
+ "page_idx": 2
211
+ },
212
+ {
213
+ "type": "text",
214
+ "text": "76 3 Method ",
215
+ "text_level": 1,
216
+ "bbox": [
217
+ 150,
218
+ 473,
219
+ 271,
220
+ 489
221
+ ],
222
+ "page_idx": 2
223
+ },
224
+ {
225
+ "type": "text",
226
+ "text": "Let’s start by revisiting linear algebra-101. In particular, we are interested in the rank of the sum of two matrices: ",
227
+ "bbox": [
228
+ 158,
229
+ 503,
230
+ 826,
231
+ 531
232
+ ],
233
+ "page_idx": 2
234
+ },
235
+ {
236
+ "type": "equation",
237
+ "img_path": "images/5b3180b9aa8860cf5d837070b32e6e212b8479e8fb30a5c058aac2154f0d0e45.jpg",
238
+ "text": "$$\n\\operatorname { r a n k } ( A + B ) \\leq \\operatorname { r a n k } ( A ) + \\operatorname { r a n k } ( B ) .\n$$",
239
+ "text_format": "latex",
240
+ "bbox": [
241
+ 375,
242
+ 530,
243
+ 622,
244
+ 547
245
+ ],
246
+ "page_idx": 2
247
+ },
248
+ {
249
+ "type": "text",
250
+ "text": "79 This bound on the rank of the sum is tight: for a matrix A, $\\operatorname { r a n k } ( \\mathbf { A } ) < d i m ( \\mathbf { A } )$ , there exists $\\mathbf { B }$ , \n80 $\\operatorname { r a n k } ( \\mathbf { B } ) < d i m ( \\mathbf { B } )$ such that sum of the matrices has a higher rank than either $\\mathbf { A }$ or $\\mathbf { B }$ . We want to \n81 exploit this property to make a flexible parameter-efficient training method. We start with LoRA [23] \n82 which is a parameter-efficient fine-tuning method based on the idea of low-rank updates. LoRA can \n83 be applied to any linear operation parametrized through $W \\in \\mathbb { R } ^ { m \\times n }$ . Specifically, LoRA decomposes \n84 the weight update $\\delta W$ into a low-rank product $W _ { A } W _ { B }$ as shown in Equation 2, where $s \\in \\mathbb R$ is a \n85 fixed scaling factor usually equal to $\\textstyle { \\frac { 1 } { r } }$ . ",
251
+ "bbox": [
252
+ 147,
253
+ 554,
254
+ 825,
255
+ 654
256
+ ],
257
+ "page_idx": 2
258
+ },
259
+ {
260
+ "type": "equation",
261
+ "img_path": "images/5f14d403bb5ba88843e991b5adefbcf73627e82a53f61d60211ae16215747db4.jpg",
262
+ "text": "$$\n\\begin{array} { l } { \\delta W = s W _ { A } W _ { B } } \\\\ { W _ { A } \\in \\mathbb { R } ^ { \\mathrm { i n } \\times r } , W _ { B } \\in \\mathbb { R } ^ { r \\times \\mathrm { o u t } } } \\end{array}\n$$",
263
+ "text_format": "latex",
264
+ "bbox": [
265
+ 405,
266
+ 666,
267
+ 591,
268
+ 707
269
+ ],
270
+ "page_idx": 2
271
+ },
272
+ {
273
+ "type": "text",
274
+ "text": "86 In practice, LoRA is usually implemented by adding new trainable parameters $W _ { A }$ and $W _ { B }$ , which \n87 could be merged back into the original parameters after training. Thus, even though Equation 1 \n88 allows the total update over training time $\\sum _ { t } \\delta W _ { t }$ to have a higher rank than any of the individual \n89 matrices, LoRA implementations are restricted by the rank $r = \\mathrm { m a x } _ { W _ { A } , W _ { B } } \\mathrm { r a n k } ( W _ { A } W _ { B } )$ . \n90 If we could restart LoRA, meaning we merge $W _ { A }$ and $W _ { B }$ during training and reset the values of \n91 these matrices, we could increase the total rank of the update. Doing this multiple times brings the \n92 total neural network update to ",
275
+ "bbox": [
276
+ 147,
277
+ 713,
278
+ 825,
279
+ 770
280
+ ],
281
+ "page_idx": 2
282
+ },
283
+ {
284
+ "type": "text",
285
+ "text": "",
286
+ "bbox": [
287
+ 147,
288
+ 773,
289
+ 825,
290
+ 818
291
+ ],
292
+ "page_idx": 2
293
+ },
294
+ {
295
+ "type": "equation",
296
+ "img_path": "images/736913ad905f2d632eb6b692c2e883a72b59f6ed1d6d15c0533cc730e6330dfa.jpg",
297
+ "text": "$$\n\\Delta W = \\sum _ { t = 0 } ^ { T _ { 1 } } \\delta W _ { t } + \\sum _ { t = T _ { 1 } } ^ { T _ { 2 } } \\delta W _ { t } + \\cdot \\cdot \\cdot + \\sum _ { t = T _ { N - 1 } } ^ { T _ { N } } \\delta W _ { t } = s W _ { A } ^ { 1 } W _ { B } ^ { 1 } + s W _ { A } ^ { 2 } W _ { B } ^ { 2 } + \\cdot \\cdot \\cdot + s W _ { A } ^ { N } W _ { B } ^ { N }\n$$",
298
+ "text_format": "latex",
299
+ "bbox": [
300
+ 179,
301
+ 838,
302
+ 802,
303
+ 885
304
+ ],
305
+ "page_idx": 2
306
+ },
307
+ {
308
+ "type": "text",
309
+ "text": "where the sums are independent enough, meaning that rank93 $( W _ { A } ^ { i } W _ { B } ^ { i } ) + \\operatorname { r a n k } ( W _ { A } ^ { j } W _ { B } ^ { j } ) \\geq r .$ ",
310
+ "bbox": [
311
+ 140,
312
+ 895,
313
+ 774,
314
+ 912
315
+ ],
316
+ "page_idx": 2
317
+ },
318
+ {
319
+ "type": "text",
320
+ "text": "94 However, implementing restarts is not trivial in practice and requires certain modifications to the \n95 optimization procedure. Naïve implementation causes the model to diverge right after the restart. \n96 Unlike plain stochastic gradient descent, which solely relies on the value of the gradient at the current \n97 optimization timestep, Adam [29] update is guided mainly by the first and second moments of the \n98 gradient accumulated over the previous steps. In practice, gradient moment smoothing parameters $\\beta _ { 1 }$ \n99 and $\\beta _ { 2 }$ are usually very high $0 . 9 - 0 . 9 9 9$ . Let’s assume that at the reinitialization boundary $W _ { A } ^ { 1 }$ and \n100 the corresponding gradient moments $m _ { A }$ and $v _ { A }$ , are full-rank $( r )$ . Then, after the merge-and-reinit, \n101 continuing to use old gradient moments for $W _ { A } ^ { 2 }$ will guide it in the same direction as $W _ { A } ^ { 1 }$ and \n102 optimize the same subspace. \n103 To resolve this issue, we propose ReLoRA. ReLoRA performs a partial reset of the optimizer state \n104 during merge-and-reinit and sets the learning rate to 0 with a subsequent warmup. Specifically, we set \n105 $9 9 \\%$ of low-magnitude optimizer state values to zero and use a jagged-cosine learning rate schedule \n106 (Figure 2). Our ablation studies (Section 3) show that both of these modifications are required to \n107 improve the performance over vanilla LoRA. \n108 To reiterate, ReLoRA is a low-rank training method inspired by LoRA that uses restarts to increase \n109 the effective rank of the update, uses partial optimizer reset, and a jagged scheduler to stabilize \n110 training and warm starts. All of this allows ReLoRA to achieve performance comparable to full-rank \n111 training, especially in large transformer networks, by only training a small set of parameters at a time. \n112 ReLoRA is described in Algorithm 1. \n113 Enhancing computational efficiency Unlike other low-rank training techniques [44, 49], ReLoRA \n114 follows the LoRA approach by maintaining the frozen weights of the original network and adding \n115 new trainable parameters. At first glance, this may appear computationally inefficient; however, the \n116 differentiation between frozen and trainable parameters plays a crucial role in parameter-efficient \n117 fine-tuning [33]. \n118 These methods achieve significant improvements in training time and memory efficiency by reducing \n119 the size of the gradients and the optimizer states. Notably, Adam states consume twice as much \n120 memory as the model weights. Moreover, it is common practice to maintain gradient accumulation \n121 buffers in 32-bit precision for large networks, thereby adding significant overhead to the memory \n122 consumption of gradients. \n23 By substantially reducing the number of trainable parameters, ReLoRA enables the utilization of larger \n24 batch sizes, maximizing hardware efficiency. Additionally, it reduces the bandwidth requirements in \n25 distributed setups, which are often the limiting factor in large-scale training. \n126 Furthermore, since the frozen parameters are not being updated between restarts, they can be kept in \n127 a low-precision quantized format, further reducing their memory and computational impact. This \n128 additional optimization contributes to overall improved efficiency in terms of memory utilization and \n129 computational resources of ReLoRA and increases at scale. ",
321
+ "bbox": [
322
+ 143,
323
+ 90,
324
+ 825,
325
+ 217
326
+ ],
327
+ "page_idx": 3
328
+ },
329
+ {
330
+ "type": "text",
331
+ "text": "",
332
+ "bbox": [
333
+ 142,
334
+ 222,
335
+ 825,
336
+ 291
337
+ ],
338
+ "page_idx": 3
339
+ },
340
+ {
341
+ "type": "text",
342
+ "text": "",
343
+ "bbox": [
344
+ 142,
345
+ 297,
346
+ 825,
347
+ 367
348
+ ],
349
+ "page_idx": 3
350
+ },
351
+ {
352
+ "type": "text",
353
+ "text": "",
354
+ "bbox": [
355
+ 142,
356
+ 388,
357
+ 825,
358
+ 458
359
+ ],
360
+ "page_idx": 3
361
+ },
362
+ {
363
+ "type": "text",
364
+ "text": "",
365
+ "bbox": [
366
+ 142,
367
+ 463,
368
+ 825,
369
+ 534
370
+ ],
371
+ "page_idx": 3
372
+ },
373
+ {
374
+ "type": "text",
375
+ "text": "",
376
+ "bbox": [
377
+ 150,
378
+ 540,
379
+ 826,
380
+ 582
381
+ ],
382
+ "page_idx": 3
383
+ },
384
+ {
385
+ "type": "text",
386
+ "text": "",
387
+ "bbox": [
388
+ 142,
389
+ 588,
390
+ 825,
391
+ 643
392
+ ],
393
+ "page_idx": 3
394
+ },
395
+ {
396
+ "type": "text",
397
+ "text": "130 4 Experiments ",
398
+ "text_level": 1,
399
+ "bbox": [
400
+ 142,
401
+ 669,
402
+ 312,
403
+ 685
404
+ ],
405
+ "page_idx": 3
406
+ },
407
+ {
408
+ "type": "text",
409
+ "text": "131 To evaluate the effectiveness of ReLoRA, we apply it to train a transformer language model on the C4 \n132 dataset [41] using various model sizes: 60M, 130M, 250M, and 350M. Language modeling has been \n133 shown to be a fundamental task in machine learning [40], it enables text and image classification \n134 [56], translation [8], programming [9], in-context learning, step-by-step reasoning [54], and many \n135 other emergent abilities [53]. Given its significance, we focus solely on language modeling for the \n136 purposes of this paper. \n137 Architecture and training hyperparameters Our architecture is based on transformer [51] and \n138 closely resembles LLaMA [50]. Namely, we use pre-normalization, RMSNorm [58], SwiGLU \n139 activations [45], $\\scriptstyle { \\frac { 8 } { 3 } } h$ fully-connected hidden state size [50], and rotary embeddings [48]. All hyperpa \n140 rameters are presented in Table 1. \n141 We use bfloat16 for all floating point operations and Flash attention [13] for effective attention \n142 computation. Compared to attention in LLaMA, which uses float32 for softmax computation, this \n143 increased training throughput by $5 0 \\mathrm { - } 1 0 0 \\%$ without any training stability issues. ",
410
+ "bbox": [
411
+ 142,
412
+ 703,
413
+ 825,
414
+ 787
415
+ ],
416
+ "page_idx": 3
417
+ },
418
+ {
419
+ "type": "text",
420
+ "text": "",
421
+ "bbox": [
422
+ 142,
423
+ 808,
424
+ 825,
425
+ 863
426
+ ],
427
+ "page_idx": 3
428
+ },
429
+ {
430
+ "type": "text",
431
+ "text": "",
432
+ "bbox": [
433
+ 143,
434
+ 869,
435
+ 825,
436
+ 911
437
+ ],
438
+ "page_idx": 3
439
+ },
440
+ {
441
+ "type": "text",
442
+ "text": "Algorithm 1 ReLoRA. $\\theta$ is model parameters, $\\hat { \\theta }$ is model parameters with linear layers replaced with ReLoRA, $M$ and $V$ are Adam optimizer states, $\\eta$ is learning rate scheduled according to a jagged scheduler, and finally, $q$ is the reinit frequency. ",
443
+ "bbox": [
444
+ 173,
445
+ 93,
446
+ 825,
447
+ 137
448
+ ],
449
+ "page_idx": 4
450
+ },
451
+ {
452
+ "type": "text",
453
+ "text": "Require: $\\theta , M , V , q , \\eta$ \n1: for t in warm start steps do \n2: Update $\\theta , M , V , \\eta$ {Regular training for warm start} \n3: end for \n4: for layer in model layers do \n5: if layer is linear then \n6: laye $\\mathrm { \\Delta \\ r { \\ r { \\sim R e L o R A } } } ( W ^ { i } , W _ { A } ^ { i } , W _ { B } ^ { i } )$ \n7: Freeze $W ^ { i }$ \n8: end if \n9: end for \n10: for t in training steps do \n11: Update $\\hat { \\theta }$ , $M , V$ {Training step with ReLoRA} \n12: if $\\mathbf { M O D } ( t , q ) = 0$ then \n13: for l in model layers do \n14: if l is linear then \n15: $\\begin{array} { r l } & { W ^ { i } \\gets ( W ^ { i } + s W _ { A } ^ { i } W _ { B } ^ { i } ) } \\\\ & { W _ { A } ^ { i } \\gets \\mathrm { k a i m i n g \\_ i n i t } ( W _ { A } ^ { i } ) ; W _ { B } ^ { i } \\gets 0 } \\\\ & { M _ { W _ { A } ^ { i } } \\gets \\mathrm { p r u n e } ( M _ { W _ { A } ^ { i } } ) ; V _ { W _ { A } ^ { i } } \\gets \\mathrm { p r u n e } ( V _ { W _ { A } ^ { i } } ) } \\\\ & { \\bullet \\bullet ^ { o } \\quad \\mathrm { k a } ^ { \\prime } \\Pi \\mathring { \\mathbf { \\Gamma } } ^ { \\mathrm { u n i n g \\_ i n i t } } \\index { \\mathbf { V } _ { W _ { A } ^ { i } } } \\gets \\mathrm { p r u n e } ( V _ { W _ { A } ^ { i } } ) } \\end{array}$ \n16: \n17: \n18: end if \n19: end for \n20: Start $\\eta$ warmup \n21: end if \n22: end for \n23: return θ \n144 Most of our models were trained on 8 RTX 4090 for one day or less. Due to computational constraints, \n145 we train much smaller models than LLaMA, with the largest model having 350M parameters, the \n146 same as BERT Large [15]. We select the number of pre-training tokens based on the Chinchilla \n147 scaling laws [22] for all models, except for the largest one, which we train for 6.8B tokens while 9.5B \n148 tokens are Chinchilla-optimal. \n149 ReLoRA and baselines setup In our low-rank training experiments, ReLoRA replaces all attention \n150 and fully-connected network parameters, while keeping the embeddings full-rank. The RMSNorm \n151 parametrization remains unchanged. Since ReLoRA-wrapped models have fewer trainable parameters \n152 than full-rank training, we include a Control baseline, which is a full-rank transformer with the same \n153 number of trainable parameters as ReLoRA. \n154 We initialize ReLoRA from a checkpoint of full-rank training at 5,000 update steps and reset it \n155 every 5,000 steps thereafter, 3 times in total. After each reset, $9 9 \\%$ of the optimizer state is pruned \n156 based on magnitude, and the loss is warmed up for the next 100 iterations. ReLoRA parameters are \n157 reinitialized following LoRA best practices, Kaiming initialization [20] for $A$ -matrix, and zeros for \n158 $B$ -matrix. In case of not using the restarts, the $B$ -matrix also uses Kaiming initialization to avoid \n159 gradient-symmetry issues. ",
454
+ "bbox": [
455
+ 174,
456
+ 141,
457
+ 570,
458
+ 481
459
+ ],
460
+ "page_idx": 4
461
+ },
462
+ {
463
+ "type": "text",
464
+ "text": "",
465
+ "bbox": [
466
+ 140,
467
+ 512,
468
+ 825,
469
+ 582
470
+ ],
471
+ "page_idx": 4
472
+ },
473
+ {
474
+ "type": "text",
475
+ "text": "",
476
+ "bbox": [
477
+ 142,
478
+ 601,
479
+ 825,
480
+ 671
481
+ ],
482
+ "page_idx": 4
483
+ },
484
+ {
485
+ "type": "text",
486
+ "text": "",
487
+ "bbox": [
488
+ 142,
489
+ 676,
490
+ 825,
491
+ 761
492
+ ],
493
+ "page_idx": 4
494
+ },
495
+ {
496
+ "type": "table",
497
+ "img_path": "images/dca4836333ae443644e6df84eb0ae14a5c85f62c66087cfcffcef5d9a357fef4.jpg",
498
+ "table_caption": [
499
+ "Table 1: Hyperparameters of the language models trained in this study. "
500
+ ],
501
+ "table_footnote": [],
502
+ "table_body": "<table><tr><td>Params</td><td>Hidden</td><td>Heads</td><td>Layers</td><td>Learning rate</td><td>Batch (tokens)</td><td>Seq. len.</td><td>Tokens</td></tr><tr><td>60M</td><td>512</td><td>8</td><td>8</td><td>1e-3</td><td>122K</td><td>256</td><td>1.2B</td></tr><tr><td>130M</td><td>768</td><td>12</td><td>12</td><td>1e-3</td><td>154K</td><td>256</td><td>2.6B</td></tr><tr><td>250M</td><td>768</td><td>16</td><td>24</td><td>5e-4</td><td>590K</td><td>512</td><td>6.8B</td></tr><tr><td>350M</td><td>1024</td><td>16</td><td>24</td><td>5e-4</td><td>590K</td><td>512</td><td>6.8B</td></tr></table>",
503
+ "bbox": [
504
+ 184,
505
+ 789,
506
+ 812,
507
+ 873
508
+ ],
509
+ "page_idx": 4
510
+ },
511
+ {
512
+ "type": "table",
513
+ "img_path": "images/4db8c121ea945f27606f5705f82dd1e3befa883d2d7ab5d15bca99aef7a54554.jpg",
514
+ "table_caption": [
515
+ "Table 2: Comparing perplexities between baseline methods and ReLoRA (lower is better). Control has the same number of trainable parameters as low-rank training. Low-rank training is bold if it outperforms the Control baseline. Notice that ReLoRA efficacy increases as the network size grows. "
516
+ ],
517
+ "table_footnote": [],
518
+ "table_body": "<table><tr><td></td><td>60M</td><td>130M</td><td>250M</td><td>350M</td></tr><tr><td>Full training</td><td>33.81</td><td>23.65</td><td>22.39</td><td>20.40</td></tr><tr><td>Control</td><td>36.52</td><td>27.30</td><td>29.12</td><td>23.65</td></tr><tr><td> Low-rank pre-training with LoRA</td><td>47.44</td><td>34.17</td><td>36.60</td><td>57.11</td></tr><tr><td>Low-rank pre-training with ReLoRA</td><td>38.28</td><td>25.04</td><td>23.28</td><td>22.48</td></tr><tr><td>No. of training tokens (billions)</td><td>1.2</td><td>2.6</td><td>6.8</td><td>6.8</td></tr></table>",
519
+ "bbox": [
520
+ 250,
521
+ 88,
522
+ 748,
523
+ 195
524
+ ],
525
+ "page_idx": 5
526
+ },
527
+ {
528
+ "type": "image",
529
+ "img_path": "images/1943b6f74b415d00eccc7560455fa8b41d7ff87f70203e5f9d24f30e7f7957c1.jpg",
530
+ "image_caption": [
531
+ "Figure 3: Singular values spectra of the weight difference between ReLoRA and LoRA at 5,000 iterations (warm start) and 20,000 iterations. ReLoRA exhibits a closer resemblance to full-rank training singular values than LoRA, indicating its effectiveness in approximating full-rank behavior. "
532
+ ],
533
+ "image_footnote": [],
534
+ "bbox": [
535
+ 176,
536
+ 273,
537
+ 820,
538
+ 426
539
+ ],
540
+ "page_idx": 5
541
+ },
542
+ {
543
+ "type": "text",
544
+ "text": "160 5 Results ",
545
+ "text_level": 1,
546
+ "bbox": [
547
+ 145,
548
+ 506,
549
+ 266,
550
+ 523
551
+ ],
552
+ "page_idx": 5
553
+ },
554
+ {
555
+ "type": "text",
556
+ "text": "Parameter-efficient pre-training Our main results are resented in Table 2. ReLoRA significantly outperforms low-rank LoRA training demonstrating the effectiveness of our proposed modifications (ablated in Section 3). Furthermore, ReLoRA achieves similar performance to full-rank training, and the performance gap diminishes as network size increases. ",
557
+ "bbox": [
558
+ 161,
559
+ 540,
560
+ 825,
561
+ 595
562
+ ],
563
+ "page_idx": 5
564
+ },
565
+ {
566
+ "type": "text",
567
+ "text": "165 Interestingly, the only model in which ReLoRA couldn’t surpass the Control baseline was our smallest \n166 model with 60M parameters. This observation suggests that ReLoRA is particularly effective in \n167 improving the training of large networks, which aligns with our goal of developing a method that \n168 improves large-network training. \n169 High-rank training through low-rank updates To determine whether ReLoRA performs a higher \n170 rank update than LoRA we plot the singular value spectrum of the difference between warm-start \n171 weights and the final weights for ReLoRA, LoRA, and full-rank training. Figure 3 illustrates \n172 significant qualitative differences between LoRA and ReLoRA for the singular values of $W _ { Q }$ , $W _ { K }$ , \n173 $W _ { V }$ , and $W _ { d o w n }$ . \n174 While most of the singular values for LoRA are zero (Figure 4) with a noticeable number of \n175 exceptionally high values above 1.5, ReLoRA exhibits a higher distribution mass between 0.1 and 1.0, \n176 reminiscent of full-rank training. This observation emphasizes the significance of high-rank updates \n177 and demonstrates the qualitative efficacy of ReLoRA, which accomplishes a high-rank update by \n178 performing multiple low-rank updates. ",
568
+ "bbox": [
569
+ 142,
570
+ 602,
571
+ 825,
572
+ 659
573
+ ],
574
+ "page_idx": 5
575
+ },
576
+ {
577
+ "type": "text",
578
+ "text": "",
579
+ "bbox": [
580
+ 142,
581
+ 676,
582
+ 825,
583
+ 747
584
+ ],
585
+ "page_idx": 5
586
+ },
587
+ {
588
+ "type": "text",
589
+ "text": "",
590
+ "bbox": [
591
+ 142,
592
+ 752,
593
+ 825,
594
+ 821
595
+ ],
596
+ "page_idx": 5
597
+ },
598
+ {
599
+ "type": "text",
600
+ "text": "179 5.1 Ablation studies ",
601
+ "text_level": 1,
602
+ "bbox": [
603
+ 145,
604
+ 842,
605
+ 325,
606
+ 857
607
+ ],
608
+ "page_idx": 5
609
+ },
610
+ {
611
+ "type": "text",
612
+ "text": "180 We conduct ablation studies on all four crucial components of ReLoRA: restarts, jagged schedule, \n181 optimizer resets, and warm starts, utilizing the 130M-sized model. The results are presented in \n182 Table 3. In this section, we will focus on and analyze certain combinations of these components. \n183 LoRA ReLoRA, without the aforementioned components, is essentially equivalent to training \n184 a low-rank network parameterized by LoRA. This approach yields remarkably high perplexity, \n185 indicating that a simple matrix decomposition has significantly different training dynamics from \n186 full-rank training. \n187 Adding restarts and optimizer resets ReLoRA, without a jagged schedule and optimizer reset, \n188 performs similarly to LoRA because old optimizer states force the newly initialized parameters \n189 into the same subspace as the prior weights, limiting the model’s capacity. However, doing a naive \n190 optimizer reset with ReLoRA causes the model to diverge. A jagged schedule helps to stabilize \n191 training and has a positive impact on the mixture. In our initial experiments, we also observed that a \n192 combination of partial optimizer reset and jagged scheduler allows for a quicker warm-up, as low as \n193 50 steps, instead of hundreds of steps required when the optimizer is initialized from scratch. \n194 Warm start The warm start shows the most significant improvement, dropping perplexity by \n195 almost 10 points. To investigate whether post-warmup training contributes to the loss, we measured \n196 the perplexity of the warmed-up network, which equals 27.03. It outperforms all low-rank methods \n197 except for our final ReLoRA recipe but still demonstrates a significant difference from the final \n198 network. This demonstrates the importance of early training, similar to the concept of the lottery \n199 ticket hypothesis with rewinding [18]. ",
613
+ "bbox": [
614
+ 142,
615
+ 869,
616
+ 825,
617
+ 911
618
+ ],
619
+ "page_idx": 5
620
+ },
621
+ {
622
+ "type": "table",
623
+ "img_path": "images/e3ea41ee5b5c2fc7c633abafe7f53964e1f9892dd67a2259ab30bfa76644ff70.jpg",
624
+ "table_caption": [],
625
+ "table_footnote": [],
626
+ "table_body": "<table><tr><td>Restarts</td><td>Jagged Schedule</td><td>Optimizer Reset</td><td>Warm Start</td><td>Perplexity (↓)</td></tr><tr><td></td><td>×</td><td>×</td><td>×</td><td>34.17</td></tr><tr><td>×</td><td>×</td><td>×</td><td>×</td><td>34.25</td></tr><tr><td>√</td><td>×</td><td>√</td><td>×</td><td>N/A</td></tr><tr><td>√</td><td>√</td><td>×</td><td>×</td><td>34.29</td></tr><tr><td>√</td><td>√</td><td>√</td><td>×</td><td>29.77</td></tr><tr><td>×</td><td>×</td><td>×</td><td>√</td><td>25.46</td></tr><tr><td>√</td><td>√</td><td>√</td><td>√</td><td>25.04</td></tr></table>",
627
+ "bbox": [
628
+ 232,
629
+ 88,
630
+ 764,
631
+ 215
632
+ ],
633
+ "page_idx": 6
634
+ },
635
+ {
636
+ "type": "image",
637
+ "img_path": "images/287aaf10efa00d3fa6100b2a9bac37ab816097b97672f57cf00b5cfea67e7d19.jpg",
638
+ "image_caption": [
639
+ "Table 3: Ablation studies of ReLoRA. Restarts and warm starts are essential for good performance. Using restarts and optimizer reset without a jagged schedule causes the model to diverge. ",
640
+ "Figure 4: Number of singular values $< 0 . 1$ in attention and FCN projection matrices. "
641
+ ],
642
+ "image_footnote": [],
643
+ "bbox": [
644
+ 246,
645
+ 287,
646
+ 733,
647
+ 397
648
+ ],
649
+ "page_idx": 6
650
+ },
651
+ {
652
+ "type": "text",
653
+ "text": "",
654
+ "bbox": [
655
+ 142,
656
+ 454,
657
+ 825,
658
+ 511
659
+ ],
660
+ "page_idx": 6
661
+ },
662
+ {
663
+ "type": "text",
664
+ "text": "",
665
+ "bbox": [
666
+ 140,
667
+ 525,
668
+ 825,
669
+ 622
670
+ ],
671
+ "page_idx": 6
672
+ },
673
+ {
674
+ "type": "text",
675
+ "text": "",
676
+ "bbox": [
677
+ 140,
678
+ 637,
679
+ 825,
680
+ 722
681
+ ],
682
+ "page_idx": 6
683
+ },
684
+ {
685
+ "type": "text",
686
+ "text": "00 6 Conclusion ",
687
+ "text_level": 1,
688
+ "bbox": [
689
+ 155,
690
+ 741,
691
+ 299,
692
+ 757
693
+ ],
694
+ "page_idx": 6
695
+ },
696
+ {
697
+ "type": "text",
698
+ "text": "In this paper, we investigated low-rank training techniques for large transformer language models. We first examined the limitations of a simple low-rank matrix factorization (LoRA) approach and observed that it struggles to effectively train high-performing transformer models. To address this issue, we proposed a novel method called ReLoRA, which leverages the rank of sum property to train a high-rank network through multiple low-rank updates. Similar to the lottery ticket hypothesis with rewinding, ReLoRA employs a full-rank training warm start before transitioning to ReLoRA. Additionally, ReLoRA introduces a merge-and-reinit (restart) strategy, a jagged learning rate scheduler, and partial optimizer resets, which collectively enhance the efficiency of ReLoRA and bring it closer to full-rank training, particularly in large networks. ReLoRA efficiency increases with the network size making it a viable candidate for multi-billion-scale training. ",
699
+ "bbox": [
700
+ 165,
701
+ 772,
702
+ 825,
703
+ 911
704
+ ],
705
+ "page_idx": 6
706
+ },
707
+ {
708
+ "type": "text",
709
+ "text": "211 We firmly believe that the development of low-rank training methods holds great promise for improv \n212 ing the efficiency of training large language models and neural networks in general. Furthermore, \n213 low-rank training has the potential to provide valuable insights for the advancement of deep learning \n214 theories, aiding our understanding of neural network trainability through gradient descent and their \n215 exceptional generalization capabilities in the overparametrized regime. ",
710
+ "bbox": [
711
+ 140,
712
+ 92,
713
+ 826,
714
+ 161
715
+ ],
716
+ "page_idx": 7
717
+ },
718
+ {
719
+ "type": "text",
720
+ "text": "216 7 Limitations and Future Work ",
721
+ "text_level": 1,
722
+ "bbox": [
723
+ 142,
724
+ 180,
725
+ 452,
726
+ 198
727
+ ],
728
+ "page_idx": 7
729
+ },
730
+ {
731
+ "type": "text",
732
+ "text": "217 Scaling beyond 350M Due to limited computational resources, our experiments were constrained to \n218 training language models with up to 350M parameters. Nonetheless, ReLoRA already demonstrates \n219 promising results at this scale. However, we anticipate its true potential will be realized in the $1 \\mathrm { B } +$ \n220 parameter region. Additionally, while the 350M model outperforms the Control baseline, it does not \n221 continue the trend of narrowing the gap between ReLoRA and full-rank training. We attribute this to \n222 suboptimal hyperparameter choice, which requires further investigation. \n223 Furthermore, in 60-350M experiments, even though ReLoRA significantly reduces the number of \n224 trainable parameters, we did not observe substantial improvements in memory and computation \n225 for the networks of this size. To evaluate the efficiency of our current implementation at a larger \n226 scale, we trained the 1.3B-parameter model for a small number of iterations to estimate memory and \n227 compute improvements of ReLoRA. At this scale, we observe $30 \\%$ memory consumption reduction \n228 and $52 \\%$ training throughput increase. We expect to observe even bigger improvements over the \n229 full-training baseline for larger networks since the number of trainable parameters for ReLoRA, \n230 similar to LoRA, increases at a much slower rate compared to the number of frozen parameters. \n231 ReLoRA implementation could be further improved by effectively utilizing gradient checkpointing \n232 for ReLoRA layers, custom backward functions, and converting frozen model weights to int8 or int4 \n233 quantized format [14]. ",
733
+ "bbox": [
734
+ 140,
735
+ 212,
736
+ 825,
737
+ 295
738
+ ],
739
+ "page_idx": 7
740
+ },
741
+ {
742
+ "type": "text",
743
+ "text": "",
744
+ "bbox": [
745
+ 143,
746
+ 303,
747
+ 825,
748
+ 454
749
+ ],
750
+ "page_idx": 7
751
+ },
752
+ {
753
+ "type": "text",
754
+ "text": "Comparison to other low-rank training methods A number of approaches to low-rank training have been explored with other model architectures in earlier work [44, 49, 55]. Two aspects set our work apart from these earlier efforts. First, the approach we propose performs high-rank updates through low-rank training. Second, our work demonstrates competitiveness of the low-rank training methods in large-scale transformer language models with $1 0 0 \\mathbf { M } +$ parameters. ",
755
+ "bbox": [
756
+ 169,
757
+ 469,
758
+ 825,
759
+ 539
760
+ ],
761
+ "page_idx": 7
762
+ },
763
+ {
764
+ "type": "text",
765
+ "text": "References ",
766
+ "text_level": 1,
767
+ "bbox": [
768
+ 158,
769
+ 558,
770
+ 266,
771
+ 573
772
+ ],
773
+ "page_idx": 7
774
+ },
775
+ {
776
+ "type": "text",
777
+ "text": "[1] A. Aghajanyan, S. Gupta, and L. Zettlemoyer. Intrinsic dimensionality explains the effectiveness of language model fine-tuning. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 7319–7328, Online, Aug. 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.568. URL https://aclanthology.org/2021.acl-long.568. \n[2] A. Aghajanyan, L. Yu, A. Conneau, W.-N. Hsu, K. Hambardzumyan, S. Zhang, S. Roller, N. Goyal, O. Levy, and L. Zettlemoyer. Scaling laws for generative mixed-modal language models, 2023. \n[3] J.-B. Alayrac, J. Donahue, P. Luc, A. Miech, I. Barr, Y. Hasson, K. Lenc, A. Mensch, K. Millican, M. Reynolds, et al. Flamingo: a visual language model for few-shot learning. Advances in Neural Information Processing Systems, 35:23716–23736, 2022. \n[4] Z. Allen-Zhu, Y. Li, and Z. Song. A convergence theory for deep learning via over-parameterization. In K. Chaudhuri and R. Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pages 242–252. PMLR, 09–15 Jun 2019. URL https://proceedings.mlr.press/v97/allen-zhu19a.html. \n[5] M. Belkin, D. J. Hsu, S. Ma, and S. Mandal. Reconciling modern machine-learning practice and the classical bias–variance trade-off. Proceedings of the National Academy of Sciences, 116:15849 – 15854, 2018. \n[6] S. Bhojanapalli, C. Yun, A. S. Rawat, S. Reddi, and S. Kumar. Low-rank bottleneck in multi-head attention models. In International Conference on Machine Learning, pages 864–873. PMLR, 2020. \n[7] S. Borgeaud, A. Mensch, J. Hoffmann, T. Cai, E. Rutherford, K. Millican, G. B. Van Den Driessche, J.-B. Lespiau, B. Damoc, A. Clark, D. De Las Casas, A. Guy, J. Menick, R. Ring, T. Hennigan, S. Huang, ",
778
+ "bbox": [
779
+ 156,
780
+ 580,
781
+ 828,
782
+ 911
783
+ ],
784
+ "page_idx": 7
785
+ },
786
+ {
787
+ "type": "text",
788
+ "text": "261 L. Maggiore, C. Jones, A. Cassirer, A. Brock, M. Paganini, G. Irving, O. Vinyals, S. Osindero, K. Simonyan, \n262 J. Rae, E. Elsen, and L. Sifre. Improving language models by retrieving from trillions of tokens. In \n263 K. Chaudhuri, S. Jegelka, L. Song, C. Szepesvari, G. Niu, and S. Sabato, editors, Proceedings of the \n264 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning \n265 Research, pages 2206–2240. PMLR, 17–23 Jul 2022. URL https://proceedings.mlr.press/v162/ \n266 borgeaud22a.html. \n267 [8] T. Brown, B. Mann, N. Ryder, M. Subbiah, J. D. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, \n268 A. Askell, S. Agarwal, A. Herbert-Voss, G. Krueger, T. Henighan, R. Child, A. Ramesh, D. Ziegler, J. Wu, \n269 C. Winter, C. Hesse, M. Chen, E. Sigler, M. Litwin, S. Gray, B. Chess, J. Clark, C. Berner, S. McCandlish, \n270 A. Radford, I. Sutskever, and D. Amodei. Language models are few-shot learners. In H. Larochelle, \n271 M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing \n272 Systems, volume 33, pages 1877–1901. Curran Associates, Inc., 2020. URL https://proceedings. \n273 neurips.cc/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf. \n274 [9] M. Chen, J. Tworek, H. Jun, Q. Yuan, H. P. de Oliveira Pinto, J. Kaplan, H. Edwards, Y. Burda, N. Joseph, \n275 G. Brockman, A. Ray, R. Puri, G. Krueger, M. Petrov, H. Khlaaf, G. Sastry, P. Mishkin, B. Chan, S. Gray, \n276 N. Ryder, M. Pavlov, A. Power, L. Kaiser, M. Bavarian, C. Winter, P. Tillet, F. P. Such, D. Cummings, \n277 M. Plappert, F. Chantzis, E. Barnes, A. Herbert-Voss, W. H. Guss, A. Nichol, A. Paino, N. Tezak, J. Tang, \n278 I. Babuschkin, S. Balaji, S. Jain, W. Saunders, C. Hesse, A. N. Carr, J. Leike, J. Achiam, V. Misra, \n279 E. Morikawa, A. Radford, M. Knight, M. Brundage, M. Murati, K. Mayer, P. Welinder, B. McGrew, \n280 D. Amodei, S. McCandlish, I. Sutskever, and W. Zaremba. Evaluating large language models trained on \n281 code. 2021. \n282 [10] J. Cho, J. Lei, H. Tan, and M. Bansal. Unifying vision-and-language tasks via text generation. In \n283 International Conference on Machine Learning, pages 1931–1942. PMLR, 2021. \n284 [11] K. M. Choromanski, V. Likhosherstov, D. Dohan, X. Song, A. Gane, T. Sarlós, P. Hawkins, J. Q. Davis, \n285 A. Mohiuddin, L. Kaiser, D. B. Belanger, L. J. Colwell, and A. Weller. Rethinking attention with performers. \n286 In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, \n287 2021. OpenReview.net, 2021. URL https://openreview.net/forum?id=Ua6zuk0WRH. \n288 [12] A. Chowdhery, S. Narang, J. Devlin, M. Bosma, G. Mishra, A. Roberts, P. Barham, H. W. Chung, C. Sutton, \n289 S. Gehrmann, P. Schuh, K. Shi, S. Tsvyashchenko, J. Maynez, A. Rao, P. Barnes, Y. Tay, N. M. Shazeer, \n290 V. Prabhakaran, E. Reif, N. Du, B. C. Hutchinson, R. Pope, J. Bradbury, J. Austin, M. Isard, G. Gur-Ari, \n291 P. Yin, T. Duke, A. Levskaya, S. Ghemawat, S. Dev, H. Michalewski, X. García, V. Misra, K. Robinson, \n292 L. Fedus, D. Zhou, D. Ippolito, D. Luan, H. Lim, B. Zoph, A. Spiridonov, R. Sepassi, D. Dohan, S. Agrawal, \n293 M. Omernick, A. M. Dai, T. S. Pillai, M. Pellat, A. Lewkowycz, E. Moreira, R. Child, O. Polozov, K. Lee, \n294 Z. Zhou, X. Wang, B. Saeta, M. Díaz, O. Firat, M. Catasta, J. Wei, K. S. Meier-Hellstern, D. Eck, J. Dean, \n295 S. Petrov, and N. Fiedel. Palm: Scaling language modeling with pathways. ArXiv, abs/2204.02311, 2022. \n296 [13] T. Dao, D. Y. Fu, S. Ermon, A. Rudra, and C. Re. Flashattention: Fast and memory-efficient exact attention \n297 with IO-awareness. In A. H. Oh, A. Agarwal, D. Belgrave, and K. Cho, editors, Advances in Neural \n298 Information Processing Systems, 2022. URL https://openreview.net/forum?id=H4DqfPSibmx. \n299 [14] T. Dettmers, M. Lewis, Y. Belkada, and L. Zettlemoyer. GPT3.int8(): 8-bit matrix multiplication for \n300 transformers at scale. In A. H. Oh, A. Agarwal, D. Belgrave, and K. Cho, editors, Advances in Neural \n301 Information Processing Systems, 2022. URL https://openreview.net/forum?id=dXiGWqBoxaD. \n302 [15] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. BERT: Pre-training of deep bidirectional transformers \n303 for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the \n304 Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short \n305 Papers), pages 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. \n306 doi: 10.18653/v1/N19-1423. URL https://aclanthology.org/N19-1423. \n307 [16] W. Fedus, B. Zoph, and N. Shazeer. Switch transformers: Scaling to trillion parameter models with simple \n308 and efficient sparsity. J. Mach. Learn. Res., 23(1), jan 2022. ISSN 1532-4435. \n309 [17] J. Frankle and M. Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. In \n310 International Conference on Learning Representations, 2019. URL https://openreview.net/forum? \n311 id=rJl-b3RcF7. \n312 [18] J. Frankle, G. Karolina Dziugaite, D. M. Roy, and M. Carbin. Stabilizing the lottery ticket hypothesis. \n313 arXiv e-prints, pages arXiv–1903, 2019. \n314 [19] B. Ghorbani, O. Firat, M. Freitag, A. Bapna, M. Krikun, X. García, C. Chelba, and C. Cherry. Scaling \n315 laws for neural machine translation. ArXiv, abs/2109.07740, 2021. \n316 [20] K. He, X. Zhang, S. Ren, and J. Sun. Delving deep into rectifiers: Surpassing human-level performance on \n317 imagenet classification. CoRR, abs/1502.01852, 2015. URL http://arxiv.org/abs/1502.01852. \n318 [21] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. 2016 IEEE Conference \n319 on Computer Vision and Pattern Recognition (CVPR), pages 770–778, 2016. \n320 [22] J. Hoffmann, S. Borgeaud, A. Mensch, E. Buchatskaya, T. Cai, E. Rutherford, D. de las Casas, L. A. \n321 Hendricks, J. Welbl, A. Clark, T. Hennigan, E. Noland, K. Millican, G. van den Driessche, B. Damoc, \n322 A. Guy, S. Osindero, K. Simonyan, E. Elsen, O. Vinyals, J. W. Rae, and L. Sifre. An empirical analysis \n323 of compute-optimal large language model training. In A. H. Oh, A. Agarwal, D. Belgrave, and K. Cho, \n324 editors, Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/ \n325 forum?id $\\equiv$ iBBcRUlOAPR. \n326 [23] E. J. Hu, yelong shen, P. Wallis, Z. Allen-Zhu, Y. Li, S. Wang, L. Wang, and W. Chen. LoRA: Low-rank \n327 adaptation of large language models. In International Conference on Learning Representations, 2022. \n328 URL https://openreview.net/forum?id=nZeVKeeFYf9. \n329 [24] Y. Idelbayev and M. A. Carreira-Perpinan. Low-rank compression of neural nets: Learning the rank of \n330 each layer. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages \n331 8046–8056, 2020. doi: 10.1109/CVPR42600.2020.00807. \n332 [25] A. Jacot, F. Gabriel, and C. Hongler. Neural tangent kernel: Convergence and generalization in neural \n333 networks. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, \n334 NIPS’18, page 8580–8589, Red Hook, NY, USA, 2018. Curran Associates Inc. \n335 [26] M. Jaderberg, A. Vedaldi, and A. Zisserman. Speeding up convolutional neural networks with low \n336 rank expansions. In Proceedings of the British Machine Vision Conference. BMVA Press, 2014. doi: \n337 http://dx.doi.org/10.5244/C.28.88. \n338 [27] J. Kaplan, S. McCandlish, T. J. Henighan, T. B. Brown, B. Chess, R. Child, S. Gray, A. Radford, J. Wu, \n339 and D. Amodei. Scaling laws for neural language models. ArXiv, abs/2001.08361, 2020. \n340 [28] U. Khandelwal, O. Levy, D. Jurafsky, L. Zettlemoyer, and M. Lewis. Generalization through memorization: \n341 Nearest neighbor language models. In International Conference on Learning Representations, 2020. URL \n342 https://openreview.net/forum?id=HklBjCEKvH. \n343 [29] D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2015. \n344 [30] T. Klug and R. Heckel. Scaling laws for deep learning based image reconstruction. In The Eleventh \n345 International Conference on Learning Representations, 2023. URL https://openreview.net/forum? \n346 id=op-ceGueqc4. \n347 [31] O. Kovaleva, A. Romanov, A. Rogers, and A. Rumshisky. Revealing the dark secrets of bert. In Proceedings \n348 of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International \n349 Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4365–4374, 2019. \n350 [32] A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural \n351 networks. In F. Pereira, C. Burges, L. Bottou, and K. Weinberger, editors, Advances in Neural Information \n352 Processing Systems, volume 25. Curran Associates, Inc., 2012. URL https://proceedings.neurips. \n353 cc/paper_files/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf. \n354 [33] V. Lialin, V. Deshpande, and A. Rumshisky. Scaling down to scale up: A guide to parameter-efficient \n355 fine-tuning, 2023. \n356 [34] R. Lin, C.-Y. Ko, Z. He, C. Chen, Y. Cheng, H. Yu, G. Chesi, and N. Wong. Hotcake: Higher order tucker \n357 articulated kernels for deeper cnn compression. In 2020 IEEE 15th International Conference on Solid-State \n358 & Integrated Circuit Technology (ICSICT), pages 1–4, 2020. doi: 10.1109/ICSICT49897.2020.9278257. \n359 [35] J. Lu, C. Clark, R. Zellers, R. Mottaghi, and A. Kembhavi. UNIFIED-IO: A unified model for vision, \n360 language, and multi-modal tasks. In The Eleventh International Conference on Learning Representations, \n361 2023. URL https://openreview.net/forum?id=E01k9048soZ. \n362 [36] R. K. mahabadi, J. Henderson, and S. Ruder. Compacter: Efficient low-rank hypercomplex adapter layers. \n363 In A. Beygelzimer, Y. Dauphin, P. Liang, and J. W. Vaughan, editors, Advances in Neural Information \n364 Processing Systems, 2021. URL https://openreview.net/forum?id=bqGK5PyI6-N. \n365 [37] P. Micikevicius, S. Narang, J. Alben, G. Diamos, E. Elsen, D. Garcia, B. Ginsburg, M. Houston, \n366 O. Kuchaiev, G. Venkatesh, and H. Wu. Mixed precision training. In International Conference on \n367 Learning Representations, 2018. URL https://openreview.net/forum?id=r1gs9JgRZ. \n368 [38] P. Nakkiran, G. Kaplun, Y. Bansal, T. Yang, B. Barak, and I. Sutskever. Deep double descent: where bigger \n369 models and more data hurt. Journal of Statistical Mechanics: Theory and Experiment, 2021, 2019. \n370 [39] A. Radford, K. Narasimhan, T. Salimans, I. Sutskever, et al. Improving language understanding by \n371 generative pre-training. 2018. \n372 [40] A. Radford, J. Wu, R. Child, D. Luan, D. Amodei, and I. Sutskever. Language models are unsupervised \n373 multitask learners. 2019. \n374 [41] C. Raffel, N. Shazeer, A. Roberts, K. Lee, S. Narang, M. Matena, Y. Zhou, W. Li, and P. J. Liu. Exploring \n375 the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, \n376 21(140):1–67, 2020. URL http://jmlr.org/papers/v21/20-074.html. \n377 [42] A. Raganato, Y. Scherrer, and J. Tiedemann. Fixed encoder self-attention patterns in transformer-based \n378 machine translation. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages \n379 556–568, 2020. \n380 [43] S. Rajbhandari, J. Rasley, O. Ruwase, and Y. He. Zero: Memory optimizations toward training trillion \n381 parameter models. In SC20: International Conference for High Performance Computing, Networking, \n382 Storage and Analysis, pages 1–16, 2020. doi: 10.1109/SC41405.2020.00024. \n383 [44] S. Schotthöfer, E. Zangrando, J. Kusch, G. Ceruti, and F. Tudisco. Low-rank lottery tickets: finding efficient \n384 low-rank neural networks via matrix differential equations. In S. Koyejo, S. Mohamed, A. Agarwal, \n385 D. Belgrave, K. Cho, and A. Oh, editors, Advances in Neural Information Processing Systems, volume 35, \n386 pages 20051–20063. Curran Associates, Inc., 2022. URL https://proceedings.neurips.cc/paper_ \n387 files/paper/2022/file/7e98b00eeafcdaeb0c5661fb9355be3a-Paper-Conference.pdf. \n388 [45] N. Shazeer. Glu variants improve transformer, 2020. \n389 [46] K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In \n390 Y. Bengio and Y. LeCun, editors, 3rd International Conference on Learning Representations, ICLR 2015, \n391 San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015. URL http://arxiv.org/ \n392 abs/1409.1556. \n393 [47] S. P. Singh, G. Bachmann, and T. Hofmann. Analytic insights into structure and rank of neural network \n394 hessian maps. In A. Beygelzimer, Y. Dauphin, P. Liang, and J. W. Vaughan, editors, Advances in Neural \n395 Information Processing Systems, 2021. URL https://openreview.net/forum?id=otDgw7LM7Nn. \n396 [48] J. Su, Y. Lu, S. Pan, B. Wen, and Y. Liu. Roformer: Enhanced transformer with rotary position embedding. \n397 ArXiv, abs/2104.09864, 2021. \n398 [49] Y. Sui, M. Yin, W. Yang, Y. Gong, J. Xiao, H. Phan, D. Ding, X. Xu, S. Liu, Z. Chen, and B. Yuan. ELRT: \n399 Towards efficient low-rank training for compact neural networks, 2023. URL https://openreview. \n400 net/forum?id=TC39w69m8bB. \n401 [50] H. Touvron, T. Lavril, G. Izacard, X. Martinet, M.-A. Lachaux, T. Lacroix, B. Rozière, N. Goyal, E. Hambro, \n402 F. Azhar, A. Rodriguez, A. Joulin, E. Grave, and G. Lample. Llama: Open and efficient foundation language \n403 models. arXiv preprint arXiv:2302.13971, 2023. \n404 [51] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin. \n405 Attention is all you need. Advances in neural information processing systems, 30, 2017. \n406 [52] S. Wang, B. Z. Li, M. Khabsa, H. Fang, and H. Ma. Linformer: Self-attention with linear complexity. \n407 arXiv preprint arXiv:2006.04768, 2020. \n408 [53] J. Wei, Y. Tay, R. Bommasani, C. Raffel, B. Zoph, S. Borgeaud, D. Yogatama, M. Bosma, D. Zhou, \n409 D. Metzler, E. H. Chi, T. Hashimoto, O. Vinyals, P. Liang, J. Dean, and W. Fedus. Emergent abilities \n410 of large language models. Transactions on Machine Learning Research, 2022. ISSN 2835-8856. URL \n411 https://openreview.net/forum?id=yzkSU5zdwD. Survey Certification. \n412 [54] J. Wei, X. Wang, D. Schuurmans, M. Bosma, brian ichter, F. Xia, E. H. Chi, Q. V. Le, and D. Zhou. \n413 Chain of thought prompting elicits reasoning in large language models. In A. H. Oh, A. Agarwal, \n414 D. Belgrave, and K. Cho, editors, Advances in Neural Information Processing Systems, 2022. URL \n415 https://openreview.net/forum?id=_VjQlMeSB_J. \n416 [55] H. Yang, M. Tang, W. Wen, F. Yan, D. Hu, A. Li, H. H. Li, and Y. Chen. Learning low-rank deep neural \n417 networks via singular vector orthogonality regularization and singular value sparsification. 2020 IEEE/CVF \n418 Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), pages 2899–2908, 2020. \n419 [56] J. Yu, Z. Wang, V. Vasudevan, L. Yeung, M. Seyedhosseini, and Y. Wu. Coca: Contrastive captioners are \n420 image-text foundation models. Transactions on Machine Learning Research, 2022. ISSN 2835-8856. URL \n421 https://openreview.net/forum?id=Ee277P3AYC. \n422 [57] X. Yuan, P. H. P. Savarese, and M. Maire. Growing efficient deep networks by structured contin \n423 uous sparsification. In International Conference on Learning Representations, 2021. URL https: \n424 //openreview.net/forum?id=wb3wxCObbRT. \n425 [58] B. Zhang and R. Sennrich. Root mean square layer normalization. In H. Wallach, H. Larochelle, \n426 A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing \n427 Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper_ \n428 files/paper/2019/file/1e8a19426224ca89e83cef47f1e7f53b-Paper.pdf. \n429 [59] C. Zhang, S. Bengio, M. Hardt, B. Recht, and O. Vinyals. Understanding deep learning requires \n430 rethinking generalization. In International Conference on Learning Representations, 2017. URL \n431 https://openreview.net/forum?id=Sy8gdB9xx. \n432 [60] C. Zhang, S. Bengio, M. Hardt, B. Recht, and O. Vinyals. Understanding deep learning (still) requires \n433 rethinking generalization. Communications of the ACM, 64:107 – 115, 2021. ",
789
+ "bbox": [
790
+ 137,
791
+ 64,
792
+ 828,
793
+ 921
794
+ ],
795
+ "page_idx": 8
796
+ },
797
+ {
798
+ "type": "text",
799
+ "text": "",
800
+ "bbox": [
801
+ 148,
802
+ 94,
803
+ 830,
804
+ 919
805
+ ],
806
+ "page_idx": 9
807
+ },
808
+ {
809
+ "type": "text",
810
+ "text": "",
811
+ "bbox": [
812
+ 147,
813
+ 69,
814
+ 828,
815
+ 917
816
+ ],
817
+ "page_idx": 10
818
+ },
819
+ {
820
+ "type": "text",
821
+ "text": "",
822
+ "bbox": [
823
+ 138,
824
+ 90,
825
+ 826,
826
+ 323
827
+ ],
828
+ "page_idx": 11
829
+ }
830
+ ]
parse/dev/dUSI4vFyMK/dUSI4vFyMK_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/n0OeTdNRG0Q/n0OeTdNRG0Q.md ADDED
@@ -0,0 +1,418 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EFFICIENT SHARPNESS-AWARE MINIMIZATION FOR IMPROVED TRAINING OF NEURAL NETWORKS
2
+
3
+ Jiawei $\mathbf { D } \mathbf { u } ^ { 1 , 2 }$ , Hanshu $\mathbf { Y a n } ^ { 2 }$ , Jiashi Feng2 , Joey Tianyi Zhou1∗, Liangli Zhen4 , Rick Siow Mong $\mathbf { G o h ^ { 4 } }$ , Vincent Y. F. Tan3,2
4
+
5
+ 1Centre for Frontier AI Research (CFAR), A\*STAR, Singapore,
6
+ 2Department of Electrical and Computer Engineering, National University of Singapore
7
+ 3Department of Mathematics, National University of Singapore
8
+ 4Institute of High Performance Computing (IHPC), A\*STAR, Singapore
9
+ {dujiawei, hanshu.yan}@u.nus.edu,vtan@nus.edu.sg
10
+ jshfeng@gmail.com, Joey.tianyi.zhou@gmail.com
11
+ {zhen liangli, gohsm}@ihpc.a-star.edu.sg
12
+
13
+ # ABSTRACT
14
+
15
+ Overparametrized Deep Neural Networks (DNNs) often achieve astounding performances, but may potentially result in severe generalization error. Recently, the relation between the sharpness of the loss landscape and the generalization error has been established by Foret et al. (2020), in which the Sharpness Aware Minimizer (SAM) was proposed to mitigate the degradation of the generalization. Unfortunately, SAM’s computational cost is roughly double that of base optimizers, such as Stochastic Gradient Descent (SGD). This paper thus proposes Efficient Sharpness Aware Minimizer (ESAM), which boosts SAM’s efficiency at no cost to its generalization performance. ESAM includes two novel and efficient training strategies—Stochastic Weight Perturbation and Sharpness-Sensitive Data Selection. In the former, the sharpness measure is approximated by perturbing a stochastically chosen set of weights in each iteration; in the latter, the SAM loss is optimized using only a judiciously selected subset of data that is sensitive to the sharpness. We provide theoretical explanations as to why these strategies perform well. We also show, via extensive experiments on the CIFAR and ImageNet datasets, that ESAM enhances the efficiency over SAM from requiring $\bar { 1 } 0 0 \%$ extra computational overhead to $4 0 \%$ vis- $\grave { \mathbf { a } }$ -vis base optimizers, while test accuracies are preserved or even improved. Our codes are avaliable at https://github.com/dydjw9/Efficient_SAM.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Deep learning has achieved astounding performances in many fields by relying on larger numbers of parameters and increasingly sophisticated optimization algorithms. However, DNNs with far more parameters than training samples are more prone to poor generalization. Generalization is arguably the most fundamental and yet mysterious aspect of deep learning.
20
+
21
+ Several studies have been conducted to better understand the generalization of DNNs and to train DNNs that generalize well across the natural distribution (Keskar et al., 2017; Neyshabur et al., 2017; Chaudhari et al., 2019; Zhang et al., 2019; Wu et al., 2020; Foret et al., 2020; Zhang et al., 2021). For example, Keskar et al. (2017) investigate the effect of batch size on neural networks’ generalization ability. Zhang et al. (2019); Zhou et al. (2021) propose optimizers for training DNNs with improved generalization ability. Specifically, Hochreiter & Schmidhuber (1995), Li et al. (2018) and Dinh et al. (2017) argue that the geometry of the loss landscape affects generalization and DNNs with a flat minimum can generalize better. The recent work by Foret et al. (2020) proposes an effective training algorithm Sharpness Aware Minimizer (SAM) for obtaining a flat minimum. SAM employs a base optimizer such as Stochastic Gradient Descent (Nesterov, 1983) or Adam (Kingma & Ba, 2015) to minimize both the vanilla training loss and the sharpness. The sharpness, which describes the flatness of a minimum, is characterized using eigenvalues of the Hessian matrix by Keskar et al. (2017). SAM quantifies the sharpness as the maximized change of training loss when a constraint perturbation is added to current weights. As a result, SAM leads to a flat minimum and significantly improves the generalization ability of the trained DNNs. SAM and its variants have been shown to outperform the state-of-the-art across a variety of deep learning benchmarks (Kwon et al., 2021; Chen et al., 2021; Galatolo et al., 2021; Zheng et al., 2021). Regrettably though, SAM and its variants achieve such remarkable performance at the expense of doubling the computational overhead of the given base optimizers, which minimize the training loss with a single forward and backward propagation step. SAM requires an additional propagation step compared to the base optimizers to resolve the weight perturbation for quantifying the sharpness. The extra propagation step requires the same computational overhead as the single propagation step used by base optimizers, resulting in SAM’s computational overhead being doubled $( 2 \times )$ . As demonstrated in Figure 1, SAM achieves higher test accuracy (i.e., $8 4 . 4 6 \%$ vs. $8 1 . 8 9 \%$ ) at the expense of sacrificing half of the training speed of the base optimizer (i.e., 276 imgs/s vs. 557 imgs/s).
22
+
23
+ ![](images/1c2dd31098616b5569890863c325b770c0c9fa795c1fb8d611303a9fa108b49d.jpg)
24
+ Figure 1: Training Speed vs. Accuracy of SGD, SAM and ESAM evaluated by PyramidNet on CIFAR100. ESAM improves the efficiency with better accuracy compared to SAM.
25
+
26
+ In this paper, we aim to improve the efficiency of SAM but preserve its superior performance in generalization. We propose Efficient Sharpness Aware Minimizer (ESAM), which consists of two training strategies Stochastic Weight Perturbation (SWP) and Sharpnesssensitive Data Selection $( S D S )$ , both of which reduce computational overhead and preserve the performance of SAM. On the one hand, SWP approximates the sharpness by searching weight perturbation within a stochastically chosen neighborhood of the current weights. SWP preserves the performance by ensuring that the expected weight perturbation is identical to that solved by SAM. On the other hand, SDS improves efficiency by approximately optimizing weights based on the sharpnesssensitive subsets of batches. These subsets consist of samples whose loss values increase most w.r.t. the weight perturbation and consequently can better quantify the sharpness of DNNs. As a result, the sharpness calculated over the subsets can serve as an upper bound of the SAM’s sharpness, ensuring that SDS’s performance is comparable to that of SAM’s.
27
+
28
+ We verify the effectiveness of ESAM on the CIFAR10, CIFAR100 (Krizhevsky et al., 2009) and ImageNet (Deng et al., 2009) datasets with five different DNN architectures. The experimental results demonstrate that ESAM obtains flat minima at a cost of only $4 0 \%$ (vs. SAM’s $100 \%$ ) extra computational overhead over base optimizers. More importantly, ESAM achieves better performance in terms of the test accuracy compared to SAM. In a nutshell, our contributions are as follows:
29
+
30
+ • We propose two novel and effective training strategies Stochastic Weight Perturbation (SWP) and Sharpness-sensitive Data Selection (SDS). Both strategies are designed to improve efficiency without sacrificing performance. The empirical results demonstrate that both of the proposed strategies can improve both the efficiency and effectiveness of SAM. • We introduce the ESAM, which integrates SWP and SDS. ESAM improves the generalization ability of DNNs with marginally additional computational cost compared to standard training.
31
+
32
+ The rest of this paper is structured in this way. Section 2.1 introduces SAM and its computational issues. Section 2.2 and Section 2.3 discuss how the two proposed training strategies SWP and SDS are designed respectively. Section 3 verifies the effectiveness of ESAM across a variety of datasets and DNN architectures. Section 4 presents the related work and Section 5 concludes this paper.
33
+
34
+ # 2 METHODOLOGY
35
+
36
+ We start with recapitulating how SAM achieves a flat minimum with small sharpness, which is quantified by resolving a maximization problem. To compute the sharpness, SAM requires additional forward and backward propagation and results in the doubling of the computational overhead
37
+
38
+ # Algorithm 1 Efficient SAM (ESAM)
39
+
40
+ Input: Network $f _ { \theta }$ with parameters $\theta = ( \theta _ { 1 } , \theta _ { 2 } , \ldots , \theta _ { N } )$ ; Training set $\mathbb { S }$ ; Batch size $b$ ; Learning rate $\eta > 0$ ; Neighborhood size $\rho > 0$ ; Number of iterations $A$ ; SWP hyperparameter $\beta$ ; SDS hyperparameter $\gamma$ .
41
+
42
+ Output: A flat minimum solution $\hat { \theta }$
43
+
44
+ <table><tr><td colspan="2">1:fora=1 to A do</td></tr><tr><td>2:</td><td>Sample a mini-batch B C S with size b.</td></tr><tr><td>3:</td><td>for n=1 to N do</td></tr><tr><td>4:</td><td>if 0n is chosen by probability β then</td></tr><tr><td>5:</td><td>En←i=VθnLB(fe) SWP in B1</td></tr><tr><td>6:</td><td>else</td></tr><tr><td>7:</td><td>En←0</td></tr><tr><td>8:</td><td>@←(∈1,.,éN) &gt;Assign Weight Perturbation</td></tr><tr><td>9:</td><td>Compute l(fe+ε, Xi, yi) and construct B+ with selection ratio γ (Equation 6)</td></tr><tr><td>10:</td><td>Compute gradients g = VθLB+(fθ+ε) SDS in B2</td></tr><tr><td>11:</td><td>Update weightsθ ←θ-ng</td></tr></table>
45
+
46
+ compared to base optimizers. Following that, we demonstrate how we derive and propose ESAM, which integrates SWP and SDS, to maximize efficiency while maintaining the performance. We introduce SWP and SDS in Sections 2.2 and 2.3 respectively. Algorithm 1 shows the overall proposed ESAM algorithm.
47
+
48
+ Throughout this paper, we denote a neural network $f$ with weight parameters $\theta$ as $f _ { \theta }$ . The weights are contained in the vector $\theta = ( \theta _ { 1 } , \theta _ { 2 } , \ldots , \theta _ { N } )$ , where $N$ is the number of weight units in the neural network. Given a training dataset $\mathbb { S }$ that contains samples i.i.d. drawn from a distribution $\mathcal { D }$ , the network is trained to obtain optimal weights $\hat { \theta }$ via empirical risk minimization (ERM), i.e.,
49
+
50
+ $$
51
+ \hat { \theta } = \underset { \theta } { \arg \operatorname* { m i n } } \left\{ L _ { \mathbb { S } } ( f _ { \theta } ) = \frac { 1 } { \left| \mathbb { S } \right| } \sum _ { ( x _ { i } , y _ { i } ) \in \mathbb { S } } \ell ( f _ { \theta } , x _ { i } , y _ { i } ) \right\} .
52
+ $$
53
+
54
+ where $\ell$ can be an arbitrary loss function. We take $\ell$ to be the cross entropy loss in this paper. The population loss is defined as $L _ { \mathcal { D } } ( f _ { \theta } ) \ \triangleq \ \mathbb { E } _ { ( x _ { i } , y _ { i } ) \sim \mathcal { D } } \big [ \ell ( f _ { \theta } , x _ { i } , y _ { i } ) \big ]$ . In each training iteration, optimizers sample a mini-batch $\mathbb { B } \subset \mathbb { S }$ with size $b$ to update parameters.
55
+
56
+ # 2.1 SHARPNESS-AWARE MINIMIZATION AND ITS COMPUTATIONAL DRAWBACK
57
+
58
+ To improve the generalization capability of DNNs, Foret et al. (2020) proposed the SAM training strategy for searching flat minima. SAM trains DNNs by solving the following min-max optimization problem,
59
+
60
+ $$
61
+ \operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \epsilon : \| \epsilon \| _ { 2 } \leq \rho } L _ { \mathbb { S } } ( f _ { \theta + \epsilon } ) .
62
+ $$
63
+
64
+ Given $\theta$ , the inner optimization attempts to find a weight perturbation $\epsilon$ in Euclidean ball with radius $\rho$ that maximizes the empirical loss. The maximized loss at weights $\theta$ is the sum of the empirical loss and the sharpness, which is defined to be $\begin{array} { r } { R _ { \mathbb { S } } ( f _ { \theta } ) = \operatorname* { m a x } _ { \epsilon : \| \epsilon \| _ { 2 } < \rho } [ L _ { \mathbb { S } } ( f _ { \theta + \epsilon } ) - L _ { \mathbb { S } } ( f _ { \theta } ) ] } \end{array}$ . This sharpness is quantified by the maximal change of empirical loss when a perturbation $\epsilon$ (whose norm is constrained by $\rho \mathrm { \hbar }$ ) is added to $\theta$ . The min-max problem encourages SAM to find flat minima.
65
+
66
+ For a certain set of weights $\theta$ , Foret et al. (2020) theoretically justifies that the population loss of DNNs can be upper-bounded by the sum of sharpness, empirical loss, and a regularization term on the norm of weights (refer to Equation 3). Thus, by minimizing the sharpness together with the empirical loss, SAM produces optimized solutions for DNNs with flat minima, and the resultant models can thus generalize better (Foret et al., 2020; Chen et al., 2021; Kwon et al., 2021). Indeed, we have
67
+
68
+ $$
69
+ L _ { \mathcal { D } } ( f _ { \theta } ) \leq R _ { \mathbb { S } } ( f _ { \theta } ) + L _ { \mathbb { S } } ( f _ { \theta } ) + \lambda \| \theta \| _ { 2 } ^ { 2 } = \operatorname* { m a x } _ { \epsilon : \| \epsilon \| _ { 2 } \leq \rho } L _ { \mathbb { S } } ( f _ { \theta + \epsilon } ) + \lambda \| \theta \| _ { 2 } ^ { 2 } .
70
+ $$
71
+
72
+ In practice, SAM first approximately solves the inner optimization by means of a single-step gradient descent method, i.e.,
73
+
74
+ $$
75
+ \hat { \epsilon } = \operatorname * { a r g m a x } _ { \epsilon : \| \epsilon \| _ { 2 } < \rho } L _ { \mathbb { S } } ( f _ { \theta + \epsilon } ) \approx \rho \nabla _ { \theta } L _ { \mathbb { S } } ( f _ { \theta } ) .
76
+ $$
77
+
78
+ The sharpness at weights $\theta$ is approximated by $R _ { \mathbb { S } } ( f _ { \theta } ) = L _ { \mathbb { S } } ( f _ { \theta + \hat { \epsilon } } ) - L _ { \mathbb { S } } ( f _ { \theta } )$ . Then, a base optimizer, such as SGD (Nesterov, 1983) or Adam (Kingma & Ba, 2015), updates the DNNs’ weights to minimize $L _ { \mathbb { S } } ( f _ { \theta + \hat { \epsilon } } )$ . We refer to $L _ { \mathbb { S } } ( f _ { \theta + \hat { \epsilon } } )$ as the SAM loss. Overall, SAM requires two forward and two backward operations to update weights once. We refer to the forward and backward propagation for approximating $\hat { \epsilon }$ as $F _ { 1 }$ and $B _ { 1 }$ and those for updating weights by base optimizers as $F _ { 2 }$ and $B _ { 2 }$ respectively. Although SAM can effectively improve the generalization of DNNs, it additionally requires one forward and one backward operation $F _ { 1 }$ and $B _ { 1 }$ ) in each training iteration. Thus, SAM results in a doubling of the computational overhead compared to the use of base optimizers.
79
+
80
+ To improve the efficiency of SAM, we propose ESAM, which consists of two strategies—SWP and SDS, to accelerate the sharpness approximation phase and the weight updating phase. Specifically, on the one hand, when estimating $\hat { \epsilon }$ around weight vector $\theta$ , SWP efficiently approximates ˆ by randomly selecting each parameter with a given probability to form a subset of weights to be perturbed. The reduction of the number of perturbed parameters results in lower computational overhead during the backward propagation. SWP rescales the resultant weight perturbation so as to assure that the expected weight perturbation equals to $\hat { \epsilon }$ , and the generalization capability thus will not be significantly degraded. On the other hand, when updating weights via base optimizers, instead of computing the upper bound $L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } )$ over a whole batch of samples, SDS selects a subset of samples, $\mathbb { B } ^ { + }$ , whose loss values increase the most with respect to the perturbation ˆ. Optimizing the weights based on a fewer number of samples decreases the computational overhead (in a linear fashion). We further justify that $L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } )$ can be upper bounded by $L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } )$ and consequently the generalization capability can be preserved. In general, ESAM works much more efficiently and performs as well as SAM in terms of the generalization capability.
81
+
82
+ # 2.2 STOCHASTIC WEIGHT PERTURBATION
83
+
84
+ This section elaborates on the first efficiency enhancement strategy, SWP, and explains why SWP can effectively reduce computational overhead while preserving the generalization capability.
85
+
86
+ To efficiently approximate ${ \hat { \epsilon } } ( \theta , \mathbb { S } )$ during the sharpness estimation phase, SWP randomly chooses a subset $\tilde { \boldsymbol { \theta } } = \{ \theta _ { I _ { 1 } } , \theta _ { I _ { 2 } } , . . . \}$ from the original set of weights $\theta = ( \theta _ { 1 } , \ldots , \theta _ { N } )$ to perform backpropagation $B _ { 1 }$ . Each parameter is selected to be in the subvector $\tilde { \theta }$ with some probability $\beta$ , which can be tuned as a hyperparameter. SWP approximates the weight perturbation with $\rho \nabla _ { \tilde { \theta } } L _ { \mathbb { S } } ( f _ { \theta } )$ . To be formal, we introduce a gradient mask $\mathbf { m } = ( m _ { 1 } , \dots , m _ { N } )$ where $m _ { i } \stackrel { \mathrm { i . i . d . } } { \sim } \mathrm { B e r n } ( \beta )$ for all $i \in \{ 1 , \ldots , N \}$ . Then, we have $\rho \nabla _ { \tilde { \theta } } L _ { \mathbb { S } } ( f _ { \theta } ) = \mathbf { m } ^ { \top } \hat { \epsilon } ( \theta , \mathbb { B } )$ . To ensure the expected weight perturbation of SWP equals to $\hat { \epsilon }$ , we scale $\rho \nabla _ { \tilde { \theta } } L _ { \mathbb { S } } ( f _ { \theta } )$ by a factor of $\frac { 1 } { \beta }$ . Finally, SWP produces an approximate solution of the inner maximization as
87
+
88
+ $$
89
+ \mathbf { \boldsymbol { a } } ( \theta , \mathbb { B } ) = \frac { \mathbf { \boldsymbol { m } } ^ { \top } \boldsymbol { \hat { \epsilon } } ( \theta , \mathbb { B } ) } { \beta } .
90
+ $$
91
+
92
+ Computation Ideally, SWP reduces the overall computational overhead in proportion to $1 - \beta$ in $B _ { 1 }$ . However, there exists some parameters not included in $\tilde { \theta }$ that are still required to be updated in the backpropagation step. This additional computational overhead is present due to the use of the chain rule, which calculates the entire set of gradients with respect to the parameters along a propagation path. This additional computational overhead slightly increases in deeper neural networks. Thus, the amount of reduction in the computational overhead is positively correlated to $1 - \beta$ . In practice, $\beta$ is tuned to maximize SWP’s efficiency while maintaining a generalization performance comparable to SAM’s.
93
+
94
+ Generalization We will next argue that SWP’s generalization performance can be preserved when compared to SAM by showing that the expected weight perturbation ${ \pmb a } ( \theta , { \mathbb { B } } )$ of SWP equals to the original SAM’s perturbation $\hat { \epsilon } ( \theta , \mathbb { B } )$ in the sense of the $\ell _ { 2 }$ norm and direction. We denote the expected SWP perturbation by $\bar { \mathbf { a } } ( \theta , \mathbb { B } )$ , where
95
+
96
+ $$
97
+ \bar { \pmb { a } } ( \theta , \mathbb { B } ) _ { [ i ] } = \mathbb { E } [ \pmb { a } ( \theta , \mathbb { B } ) _ { [ i ] } ] = \frac { 1 } { \beta } \cdot \beta \hat { \epsilon } ( \theta , \mathbb { B } ) _ { [ i ] } = \hat { \epsilon } ( \theta , \mathbb { B } ) _ { [ i ] } ,
98
+ $$
99
+
100
+ for $i \in \{ 1 , \ldots , N \}$ . Thus, it holds that
101
+
102
+ $$
103
+ \| \bar { \boldsymbol { a } } ( \theta , \mathbb { B } ) \| _ { 2 } = \| \hat { \epsilon } ( \theta , \mathbb { B } ) \| _ { 2 } \quad \mathrm { a n d } \quad \mathrm { C o s S i m } \big ( \bar { \boldsymbol { a } } ( \theta , \mathbb { B } ) , \hat { \boldsymbol { \epsilon } } ( \theta , \mathbb { B } ) \big ) = 1 ,
104
+ $$
105
+
106
+ showing that the expected weight perturbation of SWP is the same as that of SAM’s.
107
+
108
+ # 2.3 SHARPNESS-SENSITIVE DATA SELECTION
109
+
110
+ In this section, we introduce the second efficiency enhancement technique, SDS, which reduces computational overhead of SAM linearly as the number of selected samples decreases. We also explain why the generalization capability of SAM is preserved by SDS.
111
+
112
+ In the sharpness estimation phase, we obtain the approximate solution ˆof the inner maximization. Perturbing weights along this direction significantly increases the average loss over a batch $\mathbb { B }$ . To improve the efficiency but still control the upper bound $L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } )$ , we select a subset of samples from the whole batch. The loss values of this subset of samples increase most when the weights are perturbed by $\hat { \epsilon }$ . To be specific, SDS splits the mini-batch $\mathbb { B }$ into the following two subsets
113
+
114
+ $$
115
+ \begin{array} { r l } & { \mathbb { B } ^ { + } : = \big \{ ( x _ { i } , y _ { i } ) \in \mathbb { B } : \ell ( f _ { \theta + \hat { \epsilon } } , x _ { i } , y _ { i } ) - \ell ( f _ { \theta } , x _ { i } , y _ { i } ) > \alpha \big \} , } \\ & { \mathbb { B } ^ { - } : = \big \{ ( x _ { i } , y _ { i } ) \in \mathbb { B } : \ell ( f _ { \theta + \hat { \epsilon } } , x _ { i } , y _ { i } ) - \ell ( f _ { \theta } , x _ { i } , y _ { i } ) < \alpha \big \} , } \end{array}
116
+ $$
117
+
118
+ ![](images/7c70a7bc4c836ff87980f3d5571f0e23ef5eb052885c41604143e0d4edb991a2.jpg)
119
+ Figure 2: Illustration on the loss changes of samples in $\mathbb { B } ^ { + }$ and $\mathbb { B } ^ { - }$ along the weight perturbation ˆ. The average loss of samples in $\mathbb { B } ^ { + }$ increases the most along the perturbation
120
+
121
+ where $\mathbb { B } ^ { + }$ is termed as the sharpness-sensitive subset and the direction ˆ. threshold $\alpha$ controls the size of $\mathbb { B } ^ { + }$ . We let $\gamma = | \mathbb { B } ^ { + } | / | \mathbb { B } |$ be the ratio of the number of selected samples with respect to the batch size. In practice, $\gamma$ determines the exact value of $\alpha$ and serves as a predefined hyperparameter of SDS. As illustrated in Figure 2, when $\alpha = 0$ , the gradient of the weights evaluated on $\mathbb { B } ^ { + }$ aligns with the direction of $\hat { \epsilon }$ and the loss values of the samples in $\mathbb { B } ^ { + }$ will increase with respect to the weight perturbation $\hat { \epsilon }$ .
122
+
123
+ Computation SDS reduces the computational overhead in $F _ { 2 }$ and $B _ { 2 }$ . The reduction is linear in $1 - \gamma$ . The hyperparameter $\gamma$ can be tuned to meet up distinct requirements in efficiency and performance. SDS is configured the same as SWP for maximizing efficiency with comparable performance to SAM.
124
+
125
+ Generalization For the generalization capability, we now justify that the SAM loss computing over the batch $\mathbb { B }$ , $L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } )$ , can be approximately upper bounded by the corresponding loss evaluated only on $\mathbb { B } ^ { + }$ , $L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } )$ . From Equation 3, we have
126
+
127
+ $$
128
+ \begin{array} { r l } & { L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } ) = \gamma L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } ) + ( 1 - \gamma ) L _ { \mathbb { B } ^ { - } } ( f _ { \theta + \hat { \epsilon } } ) } \\ & { \quad \quad \quad \quad = L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } ) + ( 1 - \gamma ) [ L _ { \mathbb { B } ^ { - } } ( f _ { \theta + \hat { \epsilon } } ) - L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } ) ] } \\ & { \quad \quad \quad \quad = L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } ) + ( 1 - \gamma ) [ R _ { \mathbb { B } ^ { - } } ( f _ { \theta } ) + L _ { \mathbb { B } ^ { - } } ( f _ { \theta } ) - R _ { \mathbb { B } ^ { + } } ( f _ { \theta } ) - L _ { \mathbb { B } ^ { + } } ( f _ { \theta } ) ] . } \end{array}
129
+ $$
130
+
131
+ On the one hand, since $\begin{array} { r } { { \cal R } _ { \mathbb { B } } ( f _ { \theta } ) = \frac { 1 } { | \mathbb { B } | } \sum _ { ( x _ { i } , y _ { i } ) \in \mathbb { B } } [ \ell ( f _ { \theta + \hat { \epsilon } } , x _ { i } , y _ { i } ) - \ell ( f _ { \theta } , x _ { i } , y _ { i } ) ] } \end{array}$ represents the average sharpness of the batch $\mathbb { B }$ , by Equation 6, we have $R _ { \mathbb { B } ^ { - } } ( f _ { \theta } ) \leq R _ { \mathbb { B } } ( f _ { \theta } ) \leq R _ { \mathbb { B } ^ { + } } ( f _ { \theta } )$ , and
132
+
133
+ $$
134
+ R _ { \mathbb { B } ^ { - } } ( f _ { \theta } ) - R _ { \mathbb { B } ^ { + } } ( f _ { \theta } ) \leq 0 .
135
+ $$
136
+
137
+ On the other hand, $\mathbb { B } ^ { + }$ and $\mathbb { B } ^ { - }$ are constructed by sorting $\ell ( f _ { \theta + \hat { \epsilon } } , x _ { i } , y _ { i } ) - \ell ( f _ { \theta } , x _ { i } , y _ { i } )$ , which is positively correlated to $l ( f _ { \theta } , x _ { i } , y _ { i } )$ (Li et al., 2019) (more details can be found in Appendix A.2). Thus, we have
138
+
139
+ $$
140
+ L _ { \mathbb { B } ^ { - } } ( f _ { \theta } ) - L _ { \mathbb { B } ^ { + } } ( f _ { \theta } ) \leq 0 .
141
+ $$
142
+
143
+ Therefore, by Equation 8 and Equation 9, we have
144
+
145
+ $$
146
+ L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } ) \leq L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } ) .
147
+ $$
148
+
149
+ Experimental results in Figure 5 corroborate that $R _ { \mathbb { B } ^ { - } } ( f _ { \theta } ) - R _ { \mathbb { B } ^ { + } } ( f _ { \theta } ) < 0$ and $L _ { \mathbb { B } ^ { - } } ( f _ { \theta } ) \ – L _ { \mathbb { B } ^ { + } } ( f _ { \theta } ) <$ 0. Besides, Figure 6 verifies that the selected batch $\mathbb { B } ^ { + }$ is sufficiently representative to mimic the gradients of $\mathbb { B }$ since $\mathbb { B } ^ { + }$ has a significantly higher cosine similarity with $\mathbb { B }$ compared to $\mathbb { B } ^ { - }$ in terms of the computed gradients. According to Equation 10, one can utilize $L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } )$ as a proxy to the real objective to minimize of the overall loss $L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } )$ with a smaller number of samples. As a result, SDS improves SAM’s efficiency without performance degradation.
150
+
151
+ # 3 EXPERIMENTS
152
+
153
+ This section demonstrates the effectiveness of our proposed ESAM algorithm. We conduct experiments on several benchmark datasets: CIFAR-10 (Krizhevsky et al., 2009), CIFAR-100 (Krizhevsky et al., 2009) and ImageNet (Deng et al., 2009), using various model architectures: ResNet (He et al., 2016), Wide ResNet (Zagoruyko & Komodakis, 2016), and PyramidNet (Han et al., 2017). We demonstrate the proposed ESAM improves the efficiency of vanilla SAM by speeding up to $4 0 . 3 \%$ computational overhead with better generalization performance. We report the main results in Table 1 and Table 2. Besides, we perform an ablation study on the two proposed strategies of ESAM (i.e., SWP and SDS). The experimental results in Table 3 and Figure 3 indicate that both strategies improve SAM’s efficiency and performance.
154
+
155
+ # 3.1 RESULTS
156
+
157
+ CIFAR10 and CIFAR100 We start from evaluating ESAM on the CIFAR-10 and CIFAR-100 image classification datasets. The evaluation is carried out on three different model architectures: ResNet18 (He et al., 2016), WideResNet-28-10 (Zagoruyko & Komodakis, 2016) and PyramidNet-110 (Han et al., 2017). We set all the training settings, including the maximum number of training epochs, iterations per epoch, and data augmentations, the same for fair comparison among SGD, SAM and ESAM. Additionally, the other hyperparameters of SGD, SAM and ESAM have been tuned separately for optimal test accuracies using grid search.
158
+
159
+ We train all the models with 3 different random seeds using a batch size of 128, weight decay $1 0 ^ { - 4 }$ and cosine learning rate decay (Loshchilov & Hutter, 2017). The training epochs are set to be 200 for ResNet-18 (He et al., 2016), WideResNet-28-10 (Zagoruyko & Komodakis, 2016), and 300 for PyramidNet-110 (Han et al., 2017). We set $\beta = 0 . 6$ and $\gamma = 0 . 5$ for ResNet-18 and PyramidNet110 models; and set $\beta = 0 . 5$ and $\gamma = 0 . 5$ for WideResNet-28-10. The above-mentioned $\beta$ and $\gamma$ are optimal for efficiency with comparable performance compared to SAM. The details of training setting are listed in Appendix A.7. We record the best test accuracies obtained by SGD, SAM and ESAM in Table 1.
160
+
161
+ The experimental results indicate that our proposed ESAM can increase the training speed by up to $4 0 . 3 0 \%$ in comparison with SAM. Concerning the performance, ESAM outperforms SAM in the six sets of experiments. The best efficiency of ESAM is reported in CIFAR10 trained with ResNet-18 (Training speed $1 4 0 . 3 \%$ vs. SAM $1 0 0 \%$ ). The best accuracy is reported in CIFAR100 trained with PyramidNet110 (Accuracy $8 5 . 5 6 \%$ vs. SAM $8 4 . 4 6 \%$ ). ESAM improves efficiency and achieves better performance compared to SAM in CIFAR10/100 benchmarks.
162
+
163
+ Table 1: Classification accuracies and training speed on the CIFAR-10 and CIFAR-100 datasets. Computational overhead is quantified by #images processed per second (images/s). The numbers in parentheses (·) indicate the ratio of ESAM’s training speed w.r.t. SAM.
164
+
165
+ <table><tr><td></td><td colspan="2">CIFAR-10</td><td colspan="2">CIFAR-100</td></tr><tr><td>ResNet-18</td><td>Accuracy</td><td>images/s</td><td>Accuracy</td><td> images/s</td></tr><tr><td>SGD</td><td>95.41± 0.03</td><td>3,387</td><td>78.17± 0.05</td><td>3,483</td></tr><tr><td>SAM</td><td>96.52± 0.13</td><td>1,717(100.0%)</td><td>80.17± 0.17</td><td>1,730 (100.0%)</td></tr><tr><td>ESAM</td><td>96.56± 0.08</td><td>2,409 (140.3%)</td><td>80.41± 0.10</td><td>2,423 (140.0%)</td></tr><tr><td>Wide-28-10</td><td> Accuracy</td><td>images/s</td><td> Accuracy</td><td>images/s</td></tr><tr><td>SGD</td><td>96.34± 0.12</td><td>801</td><td>81.56± 0.13</td><td>792</td></tr><tr><td>SAM</td><td>97.27± 0.11</td><td>396 (100.0%)</td><td>83.42±0.04</td><td>391 (100.0%)</td></tr><tr><td>ESAM</td><td>97.29± 0.11</td><td>550 (138.9%)</td><td>84.51± 0.01</td><td>545 (139.4%)</td></tr><tr><td>PyramidNet-110</td><td> Accuracy</td><td>images/s</td><td>Accuracy</td><td>images/s</td></tr><tr><td>SGD</td><td>96.62± 0.10</td><td>580</td><td>81.89±0.17</td><td>555</td></tr><tr><td>SAM</td><td>97.30 ± 0.10</td><td>289 (100.0%)</td><td>84.46±0.04</td><td>276 (100.0%)</td></tr><tr><td>ESAM</td><td>97.81± 0.01</td><td>401 (138.7%)</td><td>85.56± 0.05</td><td>381 (137.9%)</td></tr></table>
166
+
167
+ ImageNet To evaluate ESAM’s effectiveness on a large-scale benchmark dataset, we conduct experiments on ImageNet Datasets.The 1000 class ImageNet dataset contains roughly 1.28 million training images and 50, 000 validation images with $4 6 9 \times 3 8 7$ averaged resolution. The ImageNet dataset is more representative (of real-world scenarios) and persuasive (of a method’s effectiveness) than CIFAR datasets. We resize the images on ImageNet to $2 2 4 \times 2 2 4$ resolution to train ResNet-50 and ResNet-101 models. We train 90 epochs and set the optimal hyperparameters for SGD, SAM and ESAM as suggested by Chen et al. (2021), and the details are listed in appendix A.7. We use $\beta = 0 . 6$ and $\gamma = 0 . 7$ for ResNet-50 and ResNet-101. We employ the $m$ -sharpness strategy for both SAM and ESAM with $m = 1 2 8$ , which is the same as that suggested in Zheng et al. (2021).
168
+
169
+ Table 2: Classification accuracies and training speed on the ImageNet dataset. The numbers in parentheses (·) indicate the ratio of ESAM’s training speed w.r.t. SAM’s. Results with \* are referred to Chen et al. (2021)
170
+
171
+ <table><tr><td></td><td colspan="2">ResNet-50</td><td colspan="2">ResNet-101</td></tr><tr><td>ImageNet</td><td> Accuracy</td><td>images/s</td><td> Accuracy</td><td> images/s</td></tr><tr><td>SGD</td><td>76.00*</td><td>1,327</td><td>77.80*</td><td>891</td></tr><tr><td>SAM</td><td>76.70*</td><td>654 (100.0%)</td><td>78.60*</td><td>438 (100.0%)</td></tr><tr><td>ESAM</td><td>77.05</td><td>846 (129.3%)</td><td>79.09</td><td>564 (128.7%)</td></tr></table>
172
+
173
+ The experimental results are reported in Table 2. The results indicate that the performance of ESAM on large-scale datasets is consistent with the two (smaller) CIFAR datasets. ESAM outperforms SAM by $0 . 3 5 \%$ to $0 . 4 9 \%$ in accuracy and, more importantly, enjoys $2 8 . 7 \%$ faster training speed compared to SAM. As the $\gamma$ we used here is larger than the one used in CIFAR datasets, the training speed of ESAM here is slightly slower than that in the CIFAR datasets.
174
+
175
+ These experiments demonstrate that ESAM outperforms SAM on a variety of benchmark datasets for widely-used DNNs’ architectures in terms of training speed and classification accuracies.
176
+
177
+ # 3.2 ABLATION AND PARAMETER STUDIES
178
+
179
+ To better understand the effectiveness of SWP and SDS in improving the performance and efficiency compared to SAM, we conduct four sets of ablation studies on CIFAR-10 and CIFAR-100 datasets using ResNet-18 and WideResNet-28-10 models, respectively. We consider two variants of ESAM: (i) only with SWP, (ii) only with SDS. The rest of the experimental settings are identical to the settings described in Section 3.1. We conduct grid search over the interval [0.3, 0.9] for $\beta$ and the interval [0.3, 0.9] for $\gamma$ , with a same step size of 0.1. We report the grid search results in Figure 3. We use $\beta = 0 . 6 , \gamma = 0 . 5$ for ResNet-18; and set $\beta = 0 . 5$ , $\gamma = 0 . 5$ for WideResNet-28-10 in the four sets of ablation studies. The ablation study results are reported in Table 3.
180
+
181
+ Table 3: Ablation Study of ESAM on CIFAR-10 and CIFAR100. The numbers in brackets [·] represent the accuracy improvement in comparison to SGD. The numbers in parentheses (·) indicate the ratio of ESAM’s training speed to SAM’s. Green color indicates improvement compared to SAM, whereas red color suggests a degradation.
182
+
183
+ <table><tr><td></td><td colspan="2">CIFAR-10</td><td colspan="2">CIFAR-100</td></tr><tr><td>ResNet-18</td><td>Accuracy</td><td>images/s</td><td>Accuracy</td><td>images/s</td></tr><tr><td>SGD</td><td>95.41</td><td>3,387</td><td>78.17</td><td>3,438</td></tr><tr><td>SAM</td><td>96.52 [+1.11]</td><td>1,717 (100.0%)</td><td>80.17 [+2.00]</td><td>1,730 (100.0%)</td></tr><tr><td>+ ESAM-SWP</td><td>96.74 [+1.33]</td><td>1,896 (110.5%)</td><td>80.53 [+2.36]</td><td>1,887 (109.1%)</td></tr><tr><td>+ ESAM-SDS</td><td>96.45 [+1.04]</td><td>2,105 (122.6%)</td><td>80.38 [+2.21]</td><td>2,103 (121.5%)</td></tr><tr><td>ESAM</td><td>96.56 [+1.15]</td><td>2,409 (140.3%)</td><td>80.41 [+2.24]</td><td>2,423 (140.9%)</td></tr><tr><td>Wide-28-10</td><td> Accuracy</td><td> images/s</td><td> Accuracy</td><td>images/s</td></tr><tr><td>SGD</td><td>96.34</td><td>801</td><td>81.56</td><td>792</td></tr><tr><td>SAM</td><td>97.27 [+0.93]</td><td>396 (100.0%)</td><td>83.42 [+1.86]</td><td>391 (100.0%)</td></tr><tr><td>+ ESAM-SWP</td><td>97.37 [+1.03]</td><td>430 (108.5%)</td><td>84.44 [+2.88]</td><td>423 (108.3%)</td></tr><tr><td>+ ESAM-SDS</td><td>97.24 [+0.90]</td><td>495 (124.8%)</td><td>84.46 [+2.90]</td><td>492 (125.8%)</td></tr><tr><td>ESAM</td><td>97.29 [+0.95]</td><td>551 (138.9%)</td><td>84.51 [+2.95]</td><td>545 (139.4%)</td></tr></table>
184
+
185
+ ![](images/c393f8c2def51fc848bffe8b1ce5143d983a53ac09d93de31b94d0a1fdcad727.jpg)
186
+ Figure 3: Parameter study of SWP and SDS. The connected dots refer to SWP and SDS with different parameters; the isolated dots refer to the final results of SGD, SAM, and ESAM.
187
+
188
+ ESAM-SWP As shown in Table 3, SWP improves SAM’s training speed by $8 . 3 \%$ to $1 0 . 5 \%$ , and achieves better performance at the same time. SWP can further improve the efficiency by using a smaller $\beta$ . The best performance of SWP is obtained when $\beta = 0 . 6$ for ResNet-18 and $\beta = 0 . 5$ for WideResNet-28-10. The four sets of experiments indicate that $\beta$ is consistent among different architectures and datasets. Therefore, we set $\beta = 0 . 6$ for PyramidNet on CIFAR10/100 datasets and ResNet on ImageNet datasets.
189
+
190
+ ESAM-SDS SDS also significantly improves the efficiency by $2 1 . 5 \%$ to $2 5 . 8 \%$ compared to SAM. It outperforms SAM’s performance on CIFAR100 datasets, and achieves comparable performance on CIFAR10 datasets. SDS can outperform SAM on both datasets with both architectures with little degradation to the efficiency, as demonstrated in Figure 3. Across all experiments, $\gamma = 0 . 5$ is the smallest value that is optimal for efficiency while maintaining comparable performance to SAM.
191
+
192
+ Visualization of Loss Landscapes To visualize the sharpness of the flat minima obtained by ESAM, we plot the loss landscapes trained with SGD, SAM and ESAM on the ImageNet dataset. We display the loss landscapes in Figure 4, following the plotting algorithm in Li et al. (2018). The $x \mathrm { - }$ and $y$ - axes represent two random sampled orthogonal Gaussian perturbations. We sampled $1 0 0 \times 1 0 0$ points for 10 groups random Gaussian perturbations. The displayed loss landscapes are the results we obtained by averaging over ten groups of random perturbations. It can be clearly seen that both SAM and ESAM improve the sharpness significantly in comparison to SGD.
193
+
194
+ To summarize, SWP and SDS both reduce the computational overhead and accelerate training compared to SAM. Most importantly, both these strategies achieve a comparable or better performance than SAM. In practice, by configuring the $\beta$ and $\gamma$ , ESAM can meet a variety of user-defined efficiency and performance requirements.
195
+
196
+ # 4 RELATED WORK
197
+
198
+ The concept of regularizing sharpness for better generalization dates back to (Hochreiter & Schmidhuber, 1995). By using an MDL-based argument, which clarifies that a statistical model with fewer bits to describe can have better generalization ability, Hochreiter & Schmidhuber (1995) claim that a flat minimum can alleviate overfitting issues. Following that, more studies were proposed to investigate the connection between the flat minima with the generalization abilities (Keskar et al., 2017; Dinh et al., 2017; Liu et al., 2020; Li et al., 2018; Dziugaite & Roy, 2017; Jiang et al., 2019; Moosavi-Dezfooli et al., 2019). Keskar et al. (2017) starts by investigating the phenomenon that training with a larger batch size results in worse generalization ability. The authors found that the sharpness of the minimum is critical in accounting for the observed phenomenon. Keskar et al. (2017) and Dinh et al. (2017) both argue that the sharpness can be characterized using the eigenvalues of the Hessian. Although they also define specific notions and methods to quantify sharpness, they do not propose complete training strategies to find minima that are relative “flat”.
199
+
200
+ ![](images/1cdd2ecb202b1e70cb356a150bb90dba7bd38ec161de673e4ad2551b63bcc869.jpg)
201
+ Figure 4: Cross-entropy loss landscapes of the ResNet50 model on the ImageNet dataset trained with SGD, SAM, and ESAM.
202
+
203
+ SAM (Foret et al., 2020) leverages the connection between “flat” minima and the generalization error to train DNNs that generalize well across the natural distribution. Inspired by Keskar et al. (2017) and Dinh et al. (2017), SAM first proposes the quantification of the sharpness, which is achieved by solving a maximization problem. Then, SAM proposes a complete training algorithm to improve the generalization abilities of DNNs. SAM is demonstrated to achieve state-of-the-art performance in a variety of deep learning benchmarks, including image classification, natural language processing, and noisy learning (Foret et al., 2020; Chen et al., 2021; Kwon et al., 2021; Pham et al., 2021; Yuan et al., 2021; Jia et al., 2021).
204
+
205
+ A series of SAM-related works has been proposed. A work that was done contemporaneously SAM (Wu et al., 2020) also regularizes the sharpness term in adversarial training and achieves much more robust generalization performance against adversarial attacks. Many works focus on combining SAM with other training strategies or architectures (Chen et al., 2021; Wang et al., 2022; Tseng et al., 2021), or apply SAM on other tasks (Zheng et al., 2021; Damian et al., 2021; Galatolo et al., 2021). Kwon et al. (2021) improves SAM’s sharpness by adaptively scaling the size of the nearby search space $\rho$ in relation to the size of parameters. Liu et al. (2022) leverages the past calculated weight perturbations to save SAM’s computations. However, most of these works overlook the fact that SAM improves generalization at the expense of the doubling the computational overhead. As a result, most of the SAM-related works suffer from the same efficiency drawback as SAM. This computational cost prevents SAM from being widely used in large-scale datasets and architectures, particularly in real-world applications, which motivates us to propose ESAM to efficiently improve the generalization ability of DNNs.
206
+
207
+ # 5 CONCLUSION
208
+
209
+ In this paper, we propose the Efficient Sharpness Aware Minimizer (ESAM) to enhance the efficiency of vanilla SAM. The proposed ESAM integrates two novel training strategies, namely, SWP and SDS, both of which are derived based on theoretical underpinnings and are evaluated over a variety of datasets and DNN architectures. Both SAM and ESAM are two-step training strategies consisting of sharpness estimation and weight updating. In each step, gradient back-propagation is performed to compute the weight perturbation or updating. In future research, we will explore how to combine the two steps into one by utilizing the information of gradients in previous iterations so that the computational overhead of ESAM can be reduced to the same as base optimizers.
210
+
211
+ # ACKNOWLEDGEMENT
212
+
213
+ Jiawei Du and Joey Tianyi Zhou are suppored by Joey Tianyi Zhou’s A\*STAR SERC Central Research Fund.
214
+
215
+ Hanshu Yan and Vincent Tan are funded by a Singapore National Research Foundation (NRF) Fellowship (R-263-000-D02-281) and a Singapore Ministry of Education AcRF Tier 1 grant (R-263- 000-E80-114).
216
+
217
+ We would like to express our special thanks of gratitude to Dr. Yuan Li for helping us conduct experiments on ImageNet, and Dr. Wang Yangzihao for helping us implement Distributed Data Parallel codes.
218
+
219
+ # REFERENCES
220
+
221
+ 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. Journal of Statistical Mechanics: Theory and Experiment, 2019 (12):124018, 2019.
222
+
223
+ Xiangning Chen, Cho-Jui Hsieh, and Boqing Gong. When vision transformers outperform resnets without pretraining or strong data augmentations. arXiv preprint arXiv:2106.01548, 2021.
224
+
225
+ Alex Damian, Tengyu Ma, and Jason D Lee. Label noise sgd provably prefers flat global minimizers. Advances in Neural Information Processing Systems, 34, 2021.
226
+
227
+ 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.
228
+
229
+ Laurent Dinh, Razvan Pascanu, Samy Bengio, and Yoshua Bengio. Sharp minima can generalize for deep nets. In International Conference on Machine Learning, pp. 1019–1028. PMLR, 2017.
230
+
231
+ Jiawei Du, Hu Zhang, Joey Tianyi Zhou, Yi Yang, and Jiashi Feng. Query-efficient meta attack to deep neural networks. In International Conference on Learning Representations, 2019.
232
+
233
+ 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.
234
+
235
+ Pierre Foret, Ariel Kleiner, Hossein Mobahi, and Behnam Neyshabur. Sharpness-aware minimization for efficiently improving generalization. In International Conference on Learning Representations, 2020.
236
+
237
+ Alessio Galatolo, Alfred Nilsson, Roderick Karlemstrand, and Yineng Wang. Using early-learning regularization to classify real-world noisy data. arXiv preprint arXiv:2105.13244, 2021.
238
+
239
+ Dongyoon Han, Jiwhan Kim, and Junmo Kim. Deep pyramidal residual networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5927–5935, 2017.
240
+
241
+ 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.
242
+
243
+ Sepp Hochreiter and Jurgen Schmidhuber. Simplifying neural nets by discovering flat minima. In ¨ Advances in neural information processing systems, pp. 529–536, 1995.
244
+
245
+ Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc Le, Yun-Hsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. In International Conference on Machine Learning, pp. 4904–4916. PMLR, 2021.
246
+
247
+ Yiding Jiang, Behnam Neyshabur, Hossein Mobahi, Dilip Krishnan, and Samy Bengio. Fantastic generalization measures and where to find them. In International Conference on Learning Representations, 2019.
248
+
249
+ Nitish Shirish Keskar, Jorge Nocedal, Ping Tak Peter Tang, Dheevatsa Mudigere, and Mikhail Smelyanskiy. On large-batch training for deep learning: Generalization gap and sharp minima. In 5th International Conference on Learning Representations, ICLR 2017, 2017.
250
+
251
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR (Poster), 2015.
252
+
253
+ Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. CIFAR-10 and CIFAR-100 datasets. URl: https://www. cs. toronto. edu/kriz/cifar. html, 6(1):1, 2009.
254
+
255
+ Jungmin Kwon, Jeongseop Kim, Hyunseo Park, and In Kwon Choi. Asam: Adaptive sharpnessaware minimization for scale-invariant learning of deep neural networks. In International Conference on Machine Learning, pp. 5905–5914. PMLR, 2021.
256
+
257
+ Buyu Li, Yu Liu, and Xiaogang Wang. Gradient harmonized single-stage detector. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 8577–8584, 2019.
258
+
259
+ Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer, and Tom Goldstein. Visualizing the loss landscape of neural nets. Advances in neural information processing systems, 31, 2018.
260
+
261
+ Chen Liu, Mathieu Salzmann, Tao Lin, Ryota Tomioka, and Sabine Susstrunk. On the loss landscape ¨ of adversarial training: Identifying challenges and how to overcome them. Advances in Neural Information Processing Systems, 33:21476–21487, 2020.
262
+
263
+ Yong Liu, Siqi Mai, Xiangning Chen, Cho-Jui Hsieh, and Yang You. Towards efficient and scalable sharpness-aware minimization. arXiv preprint arXiv:2203.02714, 2022.
264
+
265
+ Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. 2017.
266
+
267
+ Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, Jonathan Uesato, and Pascal Frossard. Robustness via curvature regularization, and vice versa. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9078–9086, 2019.
268
+
269
+ Yurii E Nesterov. A method for solving the convex programming problem with convergence rate $O ( 1 / k ^ { 2 } )$ . In Dokl. akad. nauk Sssr, volume 269, pp. 543–547, 1983.
270
+
271
+ Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nati Srebro. Exploring generalization in deep learning. Advances in neural information processing systems, 30, 2017.
272
+
273
+ Hieu Pham, Zihang Dai, Qizhe Xie, and Quoc V Le. Meta pseudo labels. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11557–11568, 2021.
274
+
275
+ Chongli Qin, James Martens, Sven Gowal, Dilip Krishnan, Krishnamurthy Dvijotham, Alhussein Fawzi, Soham De, Robert Stanforth, and Pushmeet Kohli. Adversarial robustness through local linearization. Advances in Neural Information Processing Systems, 32, 2019.
276
+
277
+ Ching-Hsun Tseng, Shin-Jye Lee, Jia-Nan Feng, Shengzhong Mao, Yu-Ping Wu, Jia-Yu Shang, Mou-Chung Tseng, and Xiao-Jun Zeng. Upanets: Learning from the universal pixel attention networks. arXiv preprint arXiv:2103.08640, 2021.
278
+
279
+ Pichao Wang, Xue Wang, Hao Luo, Jingkai Zhou, Zhipeng Zhou, Fan Wang, Hao Li, and Rong Jin. Scaled relu matters for training vision transformers. 2022.
280
+
281
+ Dongxian Wu, Shu-Tao Xia, and Yisen Wang. Adversarial weight perturbation helps robust generalization. Advances in Neural Information Processing Systems, 33:2958–2969, 2020.
282
+
283
+ Hanshu Yan, Jiawei Du, Vincent Tan, and Jiashi Feng. On robustness of neural ordinary differential equations. In International Conference on Learning Representations, 2019.
284
+
285
+ Hanshu Yan, Jingfeng Zhang, Gang Niu, Jiashi Feng, Vincent YF Tan, and Masashi Sugiyama. CIFS: Improving adversarial robustness of CNNs via channel-wise importance-based feature selection. International Conference on Machine Learning, 2021.
286
+ Li Yuan, Qibin Hou, Zihang Jiang, Jiashi Feng, and Shuicheng Yan. Volo: Vision outlooker for visual recognition. arXiv preprint arXiv:2106.13112, 2021.
287
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In British Machine Vision Conference 2016. British Machine Vision Association, 2016.
288
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning (still) requires rethinking generalization. Communications of the ACM, 64(3):107– 115, 2021.
289
+ Michael Zhang, James Lucas, Jimmy Ba, and Geoffrey E Hinton. Lookahead optimizer: k steps forward, 1 step back. Advances in Neural Information Processing Systems, 32, 2019.
290
+ Yaowei Zheng, Richong Zhang, and Yongyi Mao. Regularizing neural networks via adversarial model perturbation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8156–8165, 2021.
291
+ Pan Zhou, Hanshu Yan, Xiaotong Yuan, Jiashi Feng, and Shuicheng Yan. Towards understanding why lookahead generalizes better than SGD and beyond. In Proc. Conf. Neural Information Processing Systems, 2021.
292
+
293
+ # A APPENDIX
294
+
295
+ # A.1 THE ALGORITHM OF SAM
296
+
297
+ The algorithm of SAM is demonstrated in Algorithm 2.
298
+
299
+ # Algorithm 2 SGD vs. SAM
300
+
301
+ Input: Network $f _ { \theta }$ , $\theta = ( \theta _ { 1 } , \theta _ { 1 } , \ldots , \theta _ { N } )$ , Training set $\mathbb { S }$ , Batch size $b$ , Learning rate $\eta$ , Neighborhood size $\rho$ , Iterations $A$ .
302
+
303
+ Output: A minimum solution $\tilde { \theta }$ .
304
+
305
+ 1: for $a = 1$ to $A$ do
306
+ 2: Sample $\mathbb { B }$ with size b that $\mathbb { B } \subset \mathbb { S }$
307
+ 3: if SGD then
308
+ 4: $\hat { \epsilon } \gets 0$
309
+ 5: else if SAM then
310
+ 6: $\hat { \epsilon } \nabla _ { \theta } L _ { \mathbb { B } } ( f _ { \theta } )$
311
+ 7: Compute $\boldsymbol { g } = \nabla _ { \boldsymbol { \theta } } L _ { \mathbb { B } } ( f _ { \boldsymbol { \theta } + \hat { \epsilon } } )$
312
+ 8: update the weights $\theta \theta - \eta g$
313
+
314
+ # A.2 OPTIMIZING OVER SUBSET $\mathbb { B } ^ { + }$ IS REPRESENTATIVE
315
+
316
+ The sharpness-sensitive subset $\mathbb { B } ^ { + }$ is constructed by sorting $\ell ( f _ { \theta + \hat { \epsilon } } , x _ { i } , y _ { i } ) - \ell ( f _ { \theta } , x _ { i } , y _ { i } )$ , which is positively correlated to $l ( f _ { \theta } , x _ { i } , y _ { i } )$ . By a first-order Taylor series approximation,
317
+
318
+ $$
319
+ \begin{array} { r } { \ell \big ( f _ { \theta + \hat { \epsilon } } , x _ { i } , y _ { i } \big ) - \ell \big ( f _ { \theta } , x _ { i } , y _ { i } \big ) = \hat { \epsilon } \cdot \nabla _ { \theta } \ell \big ( f _ { \theta } , x _ { i } , y _ { i } \big ) + o \big ( \| \hat { \epsilon } \| \big ) . } \end{array}
320
+ $$
321
+
322
+ By Equation 4, $\hat { \epsilon }$ is the aggregated gradients of each instance in the complete dataset $\mathbb { B }$ , i.e.,
323
+
324
+ $$
325
+ \hat { \epsilon } = \underset { \epsilon : | | \epsilon | | _ { 2 } < \rho } { \arg \operatorname* { m a x } } L _ { \mathbb { S } } ( f _ { \theta + \epsilon } ) \approx \rho \nabla _ { \theta } L _ { \mathbb { S } } ( f _ { \theta } ) = \sum _ { i = 1 } ^ { | \mathbb { B } | } \nabla _ { \theta } \ell ( f _ { \theta } , x _ { i } , y _ { i } ) ,
326
+ $$
327
+
328
+ which indicates that $\ell ( f _ { \theta + \hat { \epsilon } } , x _ { i } , y _ { i } ) \ - \ \ell ( f _ { \theta } , x _ { i } , y _ { i } )$ is positively correlated to the gradient $\nabla _ { \theta } \ell ( f _ { \theta } , x _ { i } , y _ { i } )$ . Li et al. (2019) claims that the difficult examples in deep learning (the training samples with high training loss) produce gradients with larger magnitudes. Therefore, $\ell ( f _ { \theta + \hat { \epsilon } } , x _ { i } , y _ { i } ) -$ $\ell ( f _ { \theta } , x _ { i } , y _ { i } )$ is positively correlated to $l ( f _ { \theta } , x _ { i } , y _ { i } )$ . We also demonstrate the correlation empirically.
329
+
330
+ We conduct experiments to verify Equation 9 and Equation 10. In Figure 5, We plot the four losses, $L _ { \mathbb { B } ^ { + } } ( f _ { \theta } ) , L _ { \mathbb { B } ^ { - } } \bar { ( } f _ { \theta } ) , L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } )$ , and $L _ { \mathbb { B } ^ { - } } ( f _ { \theta + \hat { \epsilon } } )$ w.r.t the epochs. The experimental results verify that Equation 9 and Equation 10 hold for every training epoch.
331
+
332
+ Moreover, we conduct experiments to demonstrate that optimizing over the subset $\mathbb { B } ^ { + }$ is much more representative than the subset $\mathbb { B } ^ { - }$ . We compare the updating gradients computed from $\mathbb { B } ^ { + } , \mathbb { B } ^ { - }$ and a random subset $\mathbb { B } _ { \mathrm { r a n d } }$ that $\vert \mathbb { B } _ { \mathrm { r a n d } } \vert = \vert \mathbb { B } ^ { + } \vert = \vert \mathbb { B } ^ { - } \vert$ to those computed from $\mathbb { B }$ by calculating the cosine similarity inspired by (Du et al., 2019), i.e.
333
+
334
+ $$
335
+ \begin{array} { r l } & { \mathrm { C o s S i m } ( \nabla _ { \theta } L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } ) , \nabla _ { \theta } L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } ) ) , } \\ & { \mathrm { C o s S i m } ( \nabla _ { \theta } L _ { \mathbb { B } ^ { - } } ( f _ { \theta + \hat { \epsilon } } ) , \nabla _ { \theta } L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } ) ) , } \\ & { \mathrm { C o s S i m } ( \nabla _ { \theta } L _ { \mathbb { B } _ { \mathrm { r a n d } } } ( f _ { \theta + \hat { \epsilon } } ) , \nabla _ { \theta } L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } ) ) . } \end{array}
336
+ $$
337
+
338
+ In Figure 6, we plot the cosine similarities in each training epoch evaluated with ResNet-18, Wide28-10 on CIFAR10. In terms of the computed gradients, the experimental results show that $\mathbb { B } ^ { + }$ has the highest cosine similarities with $\mathbb { B }$ than $\mathbb { B } ^ { - }$ and the random set $\mathbb { B } _ { \mathrm { r a n d } }$ .
339
+
340
+ # A.3 LINEARITY MEASUREMENT OF SWP
341
+
342
+ As the experimental results in Figure 3 demonstrated, SWP can also improve the accuracy of ESAM compared to SAM. We will investigate the advantage of SWP in terms of generalization in the future research. Here we provide a discussion about the accuracy improvement contributed by SWP. A plausible reason for such improvement is that SWP leads to a better inner maximization solved in equation 2. The current solution of $\hat { \epsilon }$ is approximated by assuming $L _ { \mathbb { S } } ( f _ { \theta } )$ is a linear function. Therefore, the $\hat { \epsilon }$ would result in a better inner maximization if $L _ { \mathbb { S } } ( f _ { \theta } )$ is “more linear” with respect to $\theta$ . Inspired by (Qin et al., 2019; Yan et al., 2019; 2021), we measure the linearity of the loss function by
343
+
344
+ ![](images/1e408ff83ee7267830382a7902e45ff66882f705de45e97539233492aae24fa4.jpg)
345
+ Figure 5: The SAM loss and the empirical loss calculated over the selected subsets $\mathbb { B } ^ { + }$ , $\mathbb { B } ^ { - }$ , w.r.t the epochs, as evaluated with ResNet-18, Wide-28-10 on CIFAR10 and CIFAR100. The subset $\mathbb { B } ^ { + }$ selected by SDS has much higher SAM loss and empirical loss than $\mathbb { B } ^ { - }$ among all the four groups of experiments.
346
+
347
+ ![](images/a1d44d380ad729edfdee892fbe32feb15060235de6c7ac9c229a455bdb9a53dc.jpg)
348
+ Figure 6: The cosine similarity between the gradients computed from subsets $\mathbb { B } ^ { + }$ , $\mathbb { B } ^ { - }$ , and $\mathbb { B } _ { \mathrm { r a n d } }$ with $\mathbb { B }$ , as evaluated with ResNet-18, Wide-28-10 on CIFAR10 and CIFAR100. The gradients from the subset $\mathbb { B } ^ { + }$ selected by SDS has much higher cosine similarity with the gradients from $\mathbb { B }$ than the gradients from $\mathbb { B } ^ { - }$ and $\mathbb { B } _ { \mathrm { r a n d } }$ among all the four groups of experiments.
349
+
350
+ $$
351
+ \zeta ( \epsilon , \mathbb { B } ) = | L _ { \mathbb { B } } ( f _ { \theta + \epsilon } ) - L _ { \mathbb { B } } ( f _ { \theta } ) - \epsilon ^ { \top } \nabla _ { \theta } L _ { \mathbb { B } } ( f _ { \theta } ) | .
352
+ $$
353
+
354
+ We conduct experiments on the CIFAR10 dataset with ResNet-18 model to verify that SWP can improve the linearity $\zeta ( \epsilon , \mathbb { B } )$ of the loss function $L _ { \mathbb { S } } ( f _ { \theta } )$ . We compare the linearity of ESAM with the $\beta$ ranging from $\{ 0 . 2 , 0 . 3 , . . . , 0 . 9 \}$ to the SAM. The results are demonstrated in Figure 7. It can
355
+
356
+ ![](images/0545c6c474a936b2fbf53af0a0ca840f83fea02ad38c7cba8ab1ce247d5e4474.jpg)
357
+ Figure 7: The linearity measurement of SWP evaluated with the ResNet18 model on the CIFAR10 dataset compared with SAM. The experimental results indicate that a smaller $\beta$ can result in better linearity.
358
+
359
+ be shown that SWP will result in a better linearity as the $\beta$ decreases. However, decreasing $\beta$ will also reduce the magnitude of ˆ and thus result in a worse inner maximization in equation 2. We observe that $\beta = \{ \bar { 0 . 5 } , 0 . 6 \}$ is optimal to balance the accuracy and efficiency of ESAM.
360
+
361
+ # A.4 REDUCED COMPUTATIONAL OVERHEAD CONTRIBUTED BY SWP
362
+
363
+ Formulation We formulate the saved computational overhead contributed by SWP here. We discuss and examine the computational overhead in the PyTorch framework. Suppose that the NN we discussed here has $N$ layers. The most unit of parameters $( D \times C \times H \times W )$ is the entire parameters of a layer in NN, where $D$ is the number of kernels, $C$ is the number of channels, $H$ and $W$ are the height and width of the input. SWP select each basic parameter unit to compute gradients (i.e. requries grad $=$ True) with probability $\beta$ . We use $g ( N , \beta )$ to measure the saved computational overhead in terms of percentage contributed by SWP compared to the vanilla SAM.
364
+
365
+ The computational overhead $g ( N , \beta )$ is reduced not just by calculating gradients, but also by the storing and hooking gradients. Because the storing and hooking operations of each parameter’s gradients are independent to each other, the computational overhead saved from storing and hooking are proportional to $1 - \beta$ and irrelevant to the depth $N$ of NN. In addition, the storing and hooking gradients are the dominant factor that result in the reduced computational overhead according to our toy example in the following.
366
+
367
+ Next we discuss the saved computational overhead that stems from the calculation operations in the general case. Some layers in the DNNs with complicated architectures such as DenseNet and ViT, may have multiple basic parameter units in the same layer and be connected across any other layers. Suppose the $n _ { t h }$ layer has $K ( n )$ basic parameter units, let $p ^ { n }$ be the calculation-free rate of a certain parameter unit in $n _ { t h }$ layer, we have $p ^ { n } = ( 1 - \beta ) ^ { K ( n ) } \cdot p ^ { n - 1 }$ . Therefore, $p ^ { n } = ( 1 - \beta ) ^ { \sum _ { j = 1 } ^ { n } K ( j ) } \approx$ $( 1 - \beta ) ^ { n \bar { K } }$ , where $\begin{array} { r } { \bar { K } = \frac { 1 } { N } \sum _ { j = 1 } ^ { N } K ( j ) } \end{array}$ . Assumed that the computations of each layer are the same, by summing up the saved computational overhead of all parameters, we have
368
+
369
+ $$
370
+ \begin{array} { l } { \displaystyle g ( N , \beta ) = k _ { 1 } ( 1 - \beta ) + k _ { 2 } \sum _ { n = i } ^ { N } \frac { p ^ { n } } { N } } \\ { \displaystyle \approx k _ { 1 } ( 1 - \beta ) + \frac { k _ { 2 } ( 1 - \beta ) } { N [ 1 - ( 1 - \beta ) ^ { \tilde { K } } ] } } \\ { \displaystyle \approx k _ { 1 } ( 1 - \beta ) + \frac { k _ { 2 } ^ { \prime } ( 1 - \beta ) } { N \beta } . } \end{array}
371
+ $$
372
+
373
+ where k1, k2 are determined by the computing time of calculation, k02 = k2β[1−(1−β)K¯ ] .
374
+
375
+ However, the commonly used DNNs’ architectures such as ResNet only have one basic parameter unit in each layer. Besides, each layer of them is connected in serial with the next layer. Then, we have $p ^ { n } = ( 1 \bar { ~ } - \beta ) \cdot p ^ { n - 1 }$ . Therefore, $p ^ { n } = ( 1 - \beta ) ^ { n }$ . The saved calculation contributed by the parameter unit is $\scriptstyle { \frac { 1 } { N } } p ^ { n }$ . By summing up the saved computational overhead of all parameters, we have
376
+
377
+ $$
378
+ \begin{array} { l } { \displaystyle g ( N , \beta ) = k _ { 1 } ( 1 - \beta ) + k _ { 2 } \sum _ { n = i } ^ { N } \frac { p ^ { n } } { N } } \\ { \displaystyle = k _ { 1 } ( 1 - \beta ) + \frac { k _ { 2 } } { N } \frac { 1 - \beta - ( 1 - \beta ) ^ { N } } { \beta } } \\ { \displaystyle \approx k _ { 1 } ( 1 - \beta ) + \frac { k _ { 2 } ( 1 - \beta ) } { N \beta } . } \end{array}
379
+ $$
380
+
381
+ where $k _ { 1 }$ , $k _ { 2 }$ are determined by the computing time of calculation, storing and hooking gradients.
382
+
383
+ Toy Example We conducted a toy example on the CIFAR10 dataset with two MLPs. Each fully connected layer of MLP is the same with a size of 3, 000 for both in and out features. The first mlp is for the special case that $\bar { K } = 1$ , where each layer has only one basic parameter unit and is connected in serial with the next layer. We examined $\dot { N } = \{ 5 0 , 7 5 , 1 0 0 , 1 2 5 \}$ and $\beta = \{ 0 . 1 , . . . , 0 . 9 , 1 . 0 \}$ to record the saved computational overhead in percentage. Part of the results are reported in Table A.4. By linear regression, we have $k _ { 1 } = 0 . 3 1 8 5 , k _ { 2 } = 0 . 1 3 1 0$ , and the returned $\Dot { R } ^ { 2 } \ = \ 0 . 9 9 8 3$ . The second mlp is for the general case that $\bar { K } > 1$ , where each layer may have multiple basic parameter units in the same layer and be connected across any other layers. We examined $N = \{ 3 5 , 5 0 , 6 5 , 7 5 \}$ and $\beta = \{ 0 . 1 , . . . , 0 . 9 , 1 . 0 \}$ to record the saved computational overhead in percentage. Part of the results are reported in Table A.4. By linear regression, we have $k _ { 1 } = 0 . 3 1 4 3 , k _ { 2 } = 0 . 0 7 3 7$ , and the returned $\mathbf { \bar { \mathit { R } } ^ { 2 } } = 0 . 9 9 8 9$ . The above experimental results verify the formulation of the reduced computational overhead contributed by SWP in equation 11 and equation 12.
384
+
385
+ <table><tr><td>N</td><td>B</td><td>g(N,β)</td></tr><tr><td>50</td><td>0.9 0.5</td><td>3.42%</td></tr><tr><td>50 50</td><td>0.1</td><td>16.28% 30.08%</td></tr><tr><td>75</td><td>0.9</td><td>3.44%</td></tr><tr><td>75</td><td>0.5</td><td>15.79%</td></tr><tr><td>75</td><td>0.1</td><td>30.42%</td></tr><tr><td>100</td><td>0.9</td><td></td></tr><tr><td>100</td><td></td><td>3.37%</td></tr><tr><td></td><td>0.5</td><td>15.86%</td></tr><tr><td>100</td><td>0.1</td><td>29.56%</td></tr><tr><td>125</td><td>0.9</td><td>2.94%</td></tr><tr><td>125</td><td>0.5</td><td>14.87%</td></tr><tr><td>125</td><td>0.1</td><td>29.42%</td></tr></table>
386
+
387
+ <table><tr><td rowspan=1 colspan=1>N</td><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>g(N,β)</td></tr><tr><td rowspan=2 colspan=1>25</td><td rowspan=1 colspan=1>0.9</td><td rowspan=1 colspan=1>2.88%</td></tr><tr><td rowspan=1 colspan=1>0.5</td><td rowspan=1 colspan=1>15.54%</td></tr><tr><td rowspan=1 colspan=1>25</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>30.03%</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>0.9</td><td rowspan=1 colspan=1>2.34%</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>0.5</td><td rowspan=1 colspan=1>15.10%</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>29.83%</td></tr><tr><td rowspan=1 colspan=1>65</td><td rowspan=1 colspan=1>0.9</td><td rowspan=1 colspan=1>2.23%</td></tr><tr><td rowspan=1 colspan=1>65</td><td rowspan=1 colspan=1>0.5</td><td rowspan=1 colspan=1>14.95%</td></tr><tr><td rowspan=1 colspan=1>65</td><td rowspan=1 colspan=1>0.</td><td rowspan=1 colspan=1>29.22%</td></tr><tr><td rowspan=1 colspan=1>75</td><td rowspan=1 colspan=1>0.9</td><td rowspan=1 colspan=1>2.22%</td></tr><tr><td rowspan=1 colspan=1>75</td><td rowspan=1 colspan=1>0.5</td><td rowspan=1 colspan=1>15.10%</td></tr><tr><td rowspan=1 colspan=1>75</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>28.68%</td></tr></table>
388
+
389
+ Table 4: The special case that $\bar { K } = 1$ . By linear regression, $k _ { 1 } = 0 . 3 1 8 5 , k _ { 2 } = 0 . 1 3 1 0$ , and the returned $R ^ { 2 } = 0 . 9 9 8 3$ .
390
+
391
+ Table 5: The general case that $\bar { K } > 1$ . By linear regression, $\bar { k _ { 1 } } = 0 . 3 1 4 3 , \bar { k _ { 2 } } = 0 . 0 7 3 7$ , and the returned $R ^ { 2 } = 0 . 9 9 8 9$ .
392
+
393
+ # A.5 VISUALIZATION OF LOSS LANDSCAPES WITH RESPECT TO ADVERSARIAL WEIGHT PERTURBATIONS
394
+
395
+ We visualize the sharpness of the flat minima with respect to adversarial weight perturbations of SGD,SAM and ESAM on the Cifar10 dataset. The $x$ - and $y$ -axes represent two orthogonal adversarial weight perturbations, which are $\eta \nabla _ { \theta } L _ { \mathbb { B } _ { x } } ( f _ { \theta } )$ and $\eta \nabla _ { \theta } L _ { \mathbb { B } _ { y } } ( f _ { \theta } )$ respectively, where $\eta$ is the learning rate during training. $\mathbb { B } _ { x }$ and $\mathbb { B } _ { y }$ are the randomly sampled subsets of batch $\mathbb { B }$ , and $\begin{array} { r } { | \mathbb { B } _ { x } | = | \mathbb { B } _ { y } | = \frac { 1 } { 2 } | \mathbb { B } | } \end{array}$ , $\mathbb { B } _ { x } \cup \mathbb { B } _ { y } = \mathbb { B }$ . We display the loss landscape in Figure 8, which demonstrates that both SAM and ESAM improve the sharpness significantly in comparison to SGD.
396
+
397
+ ![](images/f26dd540181ea1dd14aa4f3d2d225b80020a93bad0b9206f59a9b8686480bea9.jpg)
398
+ Figure 8: Cross-entropy loss landscapes of the ResNet18 model respect to adversarial weight perturbations on the CIFAR10 dataset trained with SGD, SAM, and ESAM.
399
+
400
+ # A.6 EVALUATION OF ESAM ON VIT-S/16
401
+
402
+ SAM has also been demonstrated to be effective on the new vision Transformer(ViT) architecture (Chen et al., 2021). Therefore, we also evaluate ESAM with ViT-S/16 on ImageNet Datasets. We use $\beta = 0 . 5$ and $\gamma = 0 . 7$ for ViT-S/16, which share the same hyperparameters as ResNet-50 and ResNet-101 in section 3.1. The results are reported in Table 6, which indicate that ESAM can still be effective to improve efficiency in ViT-S/16 architecture. In particular, ESAM-SWP achieves much better accuracy than SAM $8 0 . 8 8 \%$ v.s. $8 0 . 3 4 \%$ ).
403
+
404
+ Table 6: Classification accuracies and training speed of ViT-S/16 on the ImageNet dataset.
405
+
406
+ <table><tr><td></td><td colspan="2">ViT-S/16</td></tr><tr><td>ImageNet</td><td>Accuracy</td><td> images/s</td></tr><tr><td>SGD</td><td>79.72</td><td>1,133</td></tr><tr><td>SAM</td><td>80.34</td><td>581</td></tr><tr><td>ESAM-SWP</td><td>80.88</td><td>616</td></tr><tr><td>ESAM-SDS</td><td>79.97</td><td>693</td></tr><tr><td>ESAM</td><td>80.46</td><td>734</td></tr></table>
407
+
408
+ # A.7 TRAINING DETAILS
409
+
410
+ We tune the training parameters of SGD, SAM, and ESAM, by using grid searches. The learning rate is chosen from the set $\{ 0 . 0 1 , 0 . 0 5 , 0 . 1 , 0 . 2 \}$ , the weight decay from the set $\{ 5 \times 1 0 ^ { - 4 } , 1 \times 1 \bar { 0 } ^ { - 3 } \}$ , and the batch size from the set $\{ 6 4 , 1 2 8 , 2 5 6 \}$ . This is done to attain the best accuracies. The exact training hyperparameters are reported in Table 7. On the ImageNet datasets, limited by the computing resource, we follow and slightly modify the optimal hyperparameters as suggested by Chen et al. (2021) for SGD, SAM and ESAM. The exact training hyperparameters are reported in Table 8.
411
+
412
+ Table 7: Hyperparameters for training from scratch on CIFAR10 and CIFAR100
413
+
414
+ <table><tr><td>ResNet-18</td><td colspan="3">CIFAR-10 SGD SAM</td><td colspan="3">CIFAR-100 SGD SAM ESAM</td></tr><tr><td>Epoch</td><td></td><td>200</td><td>ESAM</td><td></td><td>200</td><td></td></tr><tr><td>Batch size</td><td></td><td>128</td><td></td><td></td><td>128</td><td></td></tr><tr><td>Data augmentation</td><td></td><td>Basic</td><td></td><td></td><td>Basic</td><td></td></tr><tr><td>Peak learning rate</td><td></td><td>0.05</td><td></td><td></td><td>0.05</td><td></td></tr><tr><td>Learning rate decay</td><td></td><td>Cosine</td><td></td><td></td><td>Cosine</td><td></td></tr><tr><td>Weight decay</td><td>5×10-4</td><td>1 ×10-3</td><td>1 ×10-3</td><td>5×10-4</td><td>1×10-3</td><td>1 ×10-3</td></tr><tr><td>p</td><td>1</td><td>0.05</td><td>0.05</td><td>1</td><td>0.05</td><td>0.05</td></tr><tr><td>Wide-28-10</td><td>SGD</td><td>SAM</td><td>ESAM</td><td>SGD</td><td>SAM</td><td>ESAM</td></tr><tr><td>Epoch</td><td></td><td>200</td><td></td><td></td><td>200</td><td></td></tr><tr><td>Batch size</td><td></td><td>256</td><td></td><td></td><td>256</td><td></td></tr><tr><td>Data augmentation</td><td></td><td>Basic</td><td></td><td></td><td>Basic</td><td></td></tr><tr><td>Peak learning rate</td><td></td><td>0.05</td><td></td><td></td><td>0.05</td><td></td></tr><tr><td>Learning rate decay</td><td></td><td>Cosine</td><td></td><td></td><td>Cosine</td><td></td></tr><tr><td>Weight decay</td><td>5×10-4</td><td>1×10-3</td><td>1×10-3</td><td>5×10-4</td><td>1×10-3</td><td>1 ×10-3</td></tr><tr><td>p</td><td>1</td><td>0.1</td><td>0.1</td><td>-</td><td>0.1</td><td>0.1</td></tr><tr><td>PyramidNet-110</td><td>SGD</td><td>SAM</td><td>ESAM</td><td>SGD</td><td></td><td>ESAM</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>SAM</td><td></td></tr><tr><td>Epoch</td><td></td><td>300</td><td></td><td></td><td>300</td><td></td></tr><tr><td>Batch size</td><td></td><td>256</td><td></td><td></td><td>256</td><td></td></tr><tr><td>Data augmentation</td><td></td><td>Basic</td><td></td><td></td><td>Basic</td><td></td></tr><tr><td>Peak learning rate</td><td></td><td>0.1</td><td></td><td></td><td>0.1</td><td></td></tr><tr><td>Learning rate decay</td><td></td><td>Cosine</td><td></td><td></td><td>Cosine</td><td></td></tr><tr><td>Weight decay</td><td></td><td>5×10-4</td><td></td><td></td><td>5×10-4</td><td></td></tr><tr><td>P</td><td></td><td>0.2</td><td>0.2</td><td></td><td>0.2</td><td>0.2</td></tr></table>
415
+
416
+ Table 8: Hyperparameters for training from scratch on ImageNet
417
+
418
+ <table><tr><td>ImageNet</td><td>ResNet-50 SGD SAM ESAM</td><td colspan="2">ResNet-110 SGD SAM ESAM</td></tr><tr><td>Epoch</td><td>90</td><td>90</td><td></td></tr><tr><td>Batch size</td><td>512</td><td>512</td><td></td></tr><tr><td>Data augmentation</td><td>Inception-style</td><td>Inception-style</td><td></td></tr><tr><td>Peak learning rate</td><td>0.2</td><td>0.2</td><td></td></tr><tr><td>Learning rate decay</td><td>Cosine</td><td>Cosine</td><td></td></tr><tr><td>Weight decay</td><td>1×10-4</td><td>1×10-4</td><td></td></tr><tr><td>p</td><td>0.05 0.05</td><td>0.05</td><td>0.05</td></tr><tr><td>Input resolution</td><td>224× 224</td><td>224× 224</td><td></td></tr></table>
parse/dev/n0OeTdNRG0Q/n0OeTdNRG0Q_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/n0OeTdNRG0Q/n0OeTdNRG0Q_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/ucASPPD9GKN/ucASPPD9GKN.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/w6fj2r62r_H/w6fj2r62r_H_content_list.json ADDED
@@ -0,0 +1,1935 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Torsional Diffusion for Molecular Conformer Generation ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 290,
8
+ 122,
9
+ 702,
10
+ 172
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Bowen Jing,∗ 1 Gabriele Corso,∗ 1 Jeffrey Chang,2 Regina Barzilay,1 Tommi Jaakkola1 1CSAIL, Massachusetts Institute of Technology 2Dept. of Physics, Harvard University ",
17
+ "bbox": [
18
+ 192,
19
+ 219,
20
+ 803,
21
+ 251
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "Abstract ",
28
+ "text_level": 1,
29
+ "bbox": [
30
+ 462,
31
+ 286,
32
+ 535,
33
+ 303
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "Molecular conformer generation is a fundamental task in computational chemistry. Several machine learning approaches have been developed, but none have outperformed state-of-the-art cheminformatics methods. We propose torsional diffusion, a novel diffusion framework that operates on the space of torsion angles via a diffusion process on the hypertorus and an extrinsic-to-intrinsic score model. On a standard benchmark of drug-like molecules, torsional diffusion generates superior conformer ensembles compared to machine learning and cheminformatics methods in terms of both RMSD and chemical properties, and is orders of magnitude faster than previous diffusion-based models. Moreover, our model provides exact likelihoods, which we employ to build the first generalizable Boltzmann generator. Code is available at https://github.com/gcorso/torsional-diffusion. ",
40
+ "bbox": [
41
+ 233,
42
+ 320,
43
+ 766,
44
+ 473
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "1 Introduction ",
51
+ "text_level": 1,
52
+ "bbox": [
53
+ 174,
54
+ 503,
55
+ 310,
56
+ 520
57
+ ],
58
+ "page_idx": 0
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "Many properties of a molecule are determined by the set of low-energy structures, called conformers, that it adopts in 3D space. Conformer generation is therefore a fundamental problem in computational chemistry [Hawkins, 2017] and an area of increasing attention in machine learning. Traditional approaches to conformer generation consist of metadynamics-based methods, which are accurate but slow [Pracht et al., 2020]; and cheminformatics-based methods, which are fast but less accurate [Hawkins et al., 2010, Riniker and Landrum, 2015]. Thus, there is growing interest in developing deep generative models to combine high accuracy with fast sampling. ",
63
+ "bbox": [
64
+ 174,
65
+ 537,
66
+ 825,
67
+ 635
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "Diffusion or score-based generative models [Ho et al., 2020, Song et al., 2021]—a promising class of generative models—have been applied to conformer generation under several different formulations. These have so far considered diffusion processes in Euclidean space, in which Gaussian noise is injected independently into every data coordinate—either pairwise distances in a distance matrix [Shi et al., 2021, Luo et al., 2021] or atomic coordinates in 3D [Xu et al., 2022]. However, these models require a large number of denoising steps and have so far failed to outperform the best cheminformatics methods. ",
74
+ "bbox": [
75
+ 174,
76
+ 640,
77
+ 825,
78
+ 737
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "We instead propose torsional diffusion, in which the diffusion process over conformers acts only on the torsion angles and leaves the other degrees of freedom fixed. This is possible and effective because the flexibility of a molecule, and thus the difficulty of conformer generation, lies largely in torsional degrees of freedom [Axelrod and Gómez-Bombarelli, 2022]; in particular, bond lengths and angles can already be determined quickly and accurately by standard cheminformatics methods. Leveraging this insight significantly reduces the dimensionality of the sample space; drug-like molecules2 have, on average, $n = 4 4$ atoms, corresponding to a $3 n$ -dimensional Euclidean space, but only $m = 7 . 9$ torsion angles of rotatable bonds. ",
85
+ "bbox": [
86
+ 174,
87
+ 743,
88
+ 826,
89
+ 854
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "image",
95
+ "img_path": "images/4e9e126e33051c6cdada58eb0ea8f4432df5fe50ce2a1500db2a2aa5d2c5022d.jpg",
96
+ "image_caption": [
97
+ "Figure 1: Overview of torsional diffusion. Left: Extrinsic and intrinsic views of torsional diffusion (only 2 dimensions/bonds shown). Right: In a step of reverse diffusion (A), the current conformer is provided as a 3D structure $\\mathbf { ( B ) }$ to the score model, which predicts intrinsic torsional updates (C). The final layer of the score model is constructed to resemble a torque computation around each bond $\\mathbf { \\eta } ^ { ( \\mathbf { D } ) }$ . $Y$ refers to the spherical harmonics and $V _ { b }$ the learned atomic embeddings. "
98
+ ],
99
+ "image_footnote": [],
100
+ "bbox": [
101
+ 171,
102
+ 92,
103
+ 823,
104
+ 268
105
+ ],
106
+ "page_idx": 1
107
+ },
108
+ {
109
+ "type": "text",
110
+ "text": "Torsion angle coordinates define not a Euclidean space, but rather an $m$ -dimensional torus $\\mathbb { T } ^ { m }$ (Figure 1, left). However, the dimensionality and distribution over the torus vary between molecules and even between different ways of defining the torsional space for the same molecule. To resolve these difficulties, we develop an extrinsic-to-intrinsic score model (Figure 1, right) that takes as input a 3D point cloud representation of the conformer in Euclidean space (extrinsic coordinates), and predicts as output a score on a torsional space specific to that molecule (intrinsic coordinates). To do so, we consider a torsional score for a bond as a geometric property of a 3D point cloud, and use $S E ( 3 )$ -equivariant networks to predict them directly for each bond. ",
111
+ "bbox": [
112
+ 173,
113
+ 386,
114
+ 825,
115
+ 497
116
+ ],
117
+ "page_idx": 1
118
+ },
119
+ {
120
+ "type": "text",
121
+ "text": "Unlike prior work, our model provides exact likelihoods of generated conformers, enabling training with the ground-truth energy function rather than samples alone. This connects with the literature on Boltzmann generators—generative models which aim to sample the Boltzmann distribution of physical systems without expensive molecular dynamics or MCMC simulations [Noé et al., 2019, Köhler et al., 2021]. Thus, as a variation on the torsional diffusion framework, we develop torsional Boltzmann generators that can approximately sample the conditional Boltzmann distribution for unseen molecules. This starkly contrasts with existing Boltzmann generators, which are specific for the chemical system on which they are trained. ",
122
+ "bbox": [
123
+ 173,
124
+ 503,
125
+ 825,
126
+ 614
127
+ ],
128
+ "page_idx": 1
129
+ },
130
+ {
131
+ "type": "text",
132
+ "text": "Our main contributions are: ",
133
+ "bbox": [
134
+ 174,
135
+ 621,
136
+ 354,
137
+ 636
138
+ ],
139
+ "page_idx": 1
140
+ },
141
+ {
142
+ "type": "text",
143
+ "text": "• We formulate conformer generation in terms of diffusion modeling on the hypertorus— the first demonstration of non-Euclidean diffusion on complex datasets—and develop an extrinsic-to-intrinsic score model that satisfies the required symmetries: $S E ( 3 )$ invariance, torsion definition invariance, and parity equivariance. \n• We obtain state-of-the-art results on the GEOM-DRUGS dataset [Axelrod and GómezBombarelli, 2022] and are the first method to consistently outperform the established commercial software OMEGA [Hawkins, 2017]. We do so using two orders of magnitude fewer denoising steps than GeoDiff [Xu et al., 2022], the best Euclidean diffusion approach. \n• We propose torsional Boltzmann generators—the first Boltzmann generator based on diffusion models rather than normalizing flows and the first to be useful for a class of molecules rather than a specific system. ",
144
+ "bbox": [
145
+ 217,
146
+ 646,
147
+ 826,
148
+ 808
149
+ ],
150
+ "page_idx": 1
151
+ },
152
+ {
153
+ "type": "text",
154
+ "text": "2 Background ",
155
+ "text_level": 1,
156
+ "bbox": [
157
+ 174,
158
+ 830,
159
+ 308,
160
+ 848
161
+ ],
162
+ "page_idx": 1
163
+ },
164
+ {
165
+ "type": "text",
166
+ "text": "Diffusion generative models Consider the data distribution as the starting distribution $p _ { 0 } ( \\mathbf { x } )$ of a forward diffusion process described by an Ito stochastic differential equation (SDE): ",
167
+ "bbox": [
168
+ 173,
169
+ 862,
170
+ 825,
171
+ 890
172
+ ],
173
+ "page_idx": 1
174
+ },
175
+ {
176
+ "type": "equation",
177
+ "img_path": "images/42be56061e172d8f3d7cca9e8d1d00d3317af4561cc801a16b3d514b8ad04da1.jpg",
178
+ "text": "$$\nd \\mathbf { x } = \\mathbf { f } ( \\mathbf { x } , t ) ~ d t + g ( t ) ~ d \\mathbf { w } , ~ t \\in ( 0 , T )\n$$",
179
+ "text_format": "latex",
180
+ "bbox": [
181
+ 367,
182
+ 895,
183
+ 630,
184
+ 912
185
+ ],
186
+ "page_idx": 1
187
+ },
188
+ {
189
+ "type": "text",
190
+ "text": "where w is the Wiener process and $\\mathbf { f } ( \\mathbf { x } , t ) , g ( t )$ are chosen functions. With sufficiently large $T$ , the distribution $p _ { T } ( \\mathbf { x } )$ —the prior—approaches a simple Gaussian. Sampling from the prior and solving the reverse diffusion ",
191
+ "bbox": [
192
+ 174,
193
+ 90,
194
+ 821,
195
+ 133
196
+ ],
197
+ "page_idx": 2
198
+ },
199
+ {
200
+ "type": "equation",
201
+ "img_path": "images/61a419f4c6c57974df5f9a20b28ce91b8eba19f42a0a12d2e1f651e026cbdd5a.jpg",
202
+ "text": "$$\nd \\mathbf { x } = \\left[ \\mathbf { f } ( \\mathbf { x } _ { t } , t ) - g ^ { 2 } ( t ) \\nabla _ { \\mathbf { x } } \\log p _ { t } ( \\mathbf { x } ) \\right] ~ d t + g ( t ) ~ d \\mathbf { \\bar { w } }\n$$",
203
+ "text_format": "latex",
204
+ "bbox": [
205
+ 326,
206
+ 143,
207
+ 669,
208
+ 164
209
+ ],
210
+ "page_idx": 2
211
+ },
212
+ {
213
+ "type": "text",
214
+ "text": "yields samples from the data distribution $p _ { 0 } ( \\mathbf { x } )$ [Anderson, 1982, Song et al., 2021]. Diffusion, or score-based, generative models $[ \\mathrm { H o }$ et al., 2020, Song et al., 2021] learn the score $\\nabla _ { \\mathbf { x } } \\log p _ { t } ( \\mathbf { x } )$ of the diffused data with a neural network and generate data by approximately solving the reverse diffusion. The score of the diffused data also defines a probability flow ODE—a continuous normalizing flow that deterministically transforms the prior into the data distribution [Song et al., 2021]. We leverage the insight that, in many cases, this flow makes it possible to use diffusion models in place of normalizing flows and highlight one such case with the torsional Boltzmann generator. ",
215
+ "bbox": [
216
+ 173,
217
+ 176,
218
+ 825,
219
+ 275
220
+ ],
221
+ "page_idx": 2
222
+ },
223
+ {
224
+ "type": "text",
225
+ "text": "Diffusion generative models have traditionally been used to model data on Euclidean spaces (such as images); however, De Bortoli et al. [2022] recently showed that the theoretical framework holds with relatively few modifications for data distributions on compact Riemannian manifolds. The hypertorus $\\mathbb { T } ^ { m }$ , which we use to define torsional diffusion, is a specific case of such a manifold. ",
226
+ "bbox": [
227
+ 174,
228
+ 280,
229
+ 825,
230
+ 335
231
+ ],
232
+ "page_idx": 2
233
+ },
234
+ {
235
+ "type": "text",
236
+ "text": "Several methods [Salimans and Ho, 2022, Vahdat et al., 2021, Nichol and Dhariwal, 2021] have been proposed to improve and accelerate diffusion models in the domain of image generation. Among these, the most relevant to this work is subspace diffusion [Jing et al., 2022], in which the diffusion is progressively restricted to linear subspaces. Torsional diffusion can be viewed in a similar spirit, as it effectively restricts Euclidean diffusion to a nonlinear manifold given by fixing the non-torsional degrees of freedom. ",
237
+ "bbox": [
238
+ 174,
239
+ 342,
240
+ 825,
241
+ 425
242
+ ],
243
+ "page_idx": 2
244
+ },
245
+ {
246
+ "type": "text",
247
+ "text": "Molecular conformer generation The conformers of a molecule are the set of its energetically favorable 3D structures, corresponding to local minima of the potential energy surface.3 The gold standards for conformer generation are metadynamics-based methods such as CREST [Pracht et al., 2020], which explore the potential energy surface while filling in local minima [Hawkins, 2017]. However, these require an average of 90 core-hours per drug-like molecule [Axelrod and GómezBombarelli, 2022] and are not considered suitable for high-throughput applications. Cheminformatics methods instead leverage approximations from chemical heuristics, rules, and databases for significantly faster generation [Lagorce et al., 2009, Cole et al., 2018, Miteva et al., 2010, Bolton et al., 2011, Li et al., 2007]; while these can readily model highly constrained degrees of freedom, they fail to capture the full energy landscape. The most well-regarded of such methods include the commercial software OMEGA [Hawkins et al., 2010] and the open-source RDKit ETKDG [Landrum et al., 2013, Riniker and Landrum, 2015]. ",
248
+ "bbox": [
249
+ 174,
250
+ 446,
251
+ 826,
252
+ 612
253
+ ],
254
+ "page_idx": 2
255
+ },
256
+ {
257
+ "type": "text",
258
+ "text": "A number of machine learning methods for conformer generation has been developed [Xu et al., 2021a,b, Shi et al., 2021, Luo et al., 2021], the most recent and advanced of which are GeoMol [Ganea et al., 2021] and GeoDiff $[ \\mathrm { X u }$ et al., 2022]. GeoDiff is a Euclidean diffusion model that treats conformers as point clouds $\\mathbf { x } \\in \\mathbb { R } ^ { 3 n }$ and learns an $S E ( 3 )$ equivariant score. On the other hand, GeoMol employs a graph neural network that, in a single forward pass, predicts neighboring atomic coordinates and torsion angles from a stochastic seed. ",
259
+ "bbox": [
260
+ 174,
261
+ 619,
262
+ 825,
263
+ 702
264
+ ],
265
+ "page_idx": 2
266
+ },
267
+ {
268
+ "type": "text",
269
+ "text": "Boltzmann generators An important problem in physics and chemistry is that of generating independent samples from a Boltzmann distribution $p ( \\mathbf { \\bar { x } } ) \\mathbf { \\Psi } \\stackrel { \\mathbf { \\bar { \\mathbf { \\Lambda } } } } { \\propto } e ^ { - E ( \\mathbf { x } ) / k T }$ with known but unnormalized density.4 Generative models with exact likelihoods, such as normalizing flows, can be trained to match such densities [Noé et al., 2019] and thus provide independent samples from an approximation of the target distribution. Such Boltzmann generators have shown high fidelity on small organic molecules [Köhler et al., 2021] and utility on systems as large as proteins [Noé et al., 2019]. However, a separate model has to be trained for every molecule, as the normalizing flows operate on intrinsic coordinates whose definitions are specific to that molecule. This limits the utility of existing Boltzmann generators for molecular screening applications. ",
270
+ "bbox": [
271
+ 174,
272
+ 723,
273
+ 825,
274
+ 849
275
+ ],
276
+ "page_idx": 2
277
+ },
278
+ {
279
+ "type": "text",
280
+ "text": "3 Torsional Diffusion ",
281
+ "text_level": 1,
282
+ "bbox": [
283
+ 176,
284
+ 88,
285
+ 366,
286
+ 106
287
+ ],
288
+ "page_idx": 3
289
+ },
290
+ {
291
+ "type": "text",
292
+ "text": "Consider a molecule as a graph $G = ( \\nu , \\mathcal { E } )$ with atoms $v \\in \\mathcal V$ and bonds $e \\in { \\mathcal { E } }$ ,5 and denote the space of its possible conformers $\\mathcal { C } _ { G }$ . A conformer $C \\in { \\mathcal { C } } _ { G }$ can be specified in terms of its intrinsic (or internal) coordinates: local structures $L$ consisting of bond lengths, bond angles, and cycle conformations; and torsion angles $\\tau$ consisting of dihedral angles around freely rotatable bonds (precise definitions in Appendix A). We consider a bond freely rotatable if severing the bond creates two connected components of $G$ , each of which has at least two atoms.6 Thus, torsion angles in cycles (or rings), which cannot be rotated independently, are considered part of the local structure $L$ . ",
293
+ "bbox": [
294
+ 173,
295
+ 119,
296
+ 825,
297
+ 218
298
+ ],
299
+ "page_idx": 3
300
+ },
301
+ {
302
+ "type": "text",
303
+ "text": "Conformer generation consists of learning probability distributions $p _ { G } ( L , \\tau )$ . However, the set of possible stable local structures $L$ for a particular molecule is very constrained and can be accurately predicted by fast cheminformatics methods, such as RDKit ETKDG [Riniker and Landrum, 2015] (see Appendix F.1 for verification). Thus, we use RDKit to provide approximate samples from $p _ { G } ( L )$ , and develop a diffusion-based generative model to learn distributions $p _ { G } ( \\tau \\mid L )$ over torsion angles—conditioned on a given graph and local structure. ",
304
+ "bbox": [
305
+ 173,
306
+ 223,
307
+ 825,
308
+ 308
309
+ ],
310
+ "page_idx": 3
311
+ },
312
+ {
313
+ "type": "text",
314
+ "text": "Our method is illustrated in Figure 1 and detailed as follows. Section 3.1 formulates diffusion modeling on the torus defined by torsion angles. Section 3.2 describes the torsional score framework, Section 3.3 the required symmetries, and Section 3.4 our score model architecture. Section 3.5 discusses likelihoods, and Section 3.6 how likelihoods can be used for energy-based training. ",
315
+ "bbox": [
316
+ 174,
317
+ 313,
318
+ 825,
319
+ 369
320
+ ],
321
+ "page_idx": 3
322
+ },
323
+ {
324
+ "type": "text",
325
+ "text": "3.1 Diffusion modeling on $\\mathbb { T } ^ { m }$ ",
326
+ "text_level": 1,
327
+ "bbox": [
328
+ 174,
329
+ 387,
330
+ 392,
331
+ 401
332
+ ],
333
+ "page_idx": 3
334
+ },
335
+ {
336
+ "type": "text",
337
+ "text": "Since each torsion angle coordinate lies in $[ 0 , 2 \\pi )$ , the $m$ torsion angles of a conformer define a hypertorus $\\mathbb { T } ^ { m }$ . To learn a generative model over this space, we apply the continuous score-based framework of Song et al. [2021], which holds with minor modifications for data distributions on compact Riemannian manifolds (such as $\\mathbb { T } ^ { m }$ ) [De Bortoli et al., 2022]. Specifically, for Riemannian manifold $M$ let $\\mathbf { x } \\in M$ , let w be the Brownian motion on the manifold, and let the drift $\\mathbf { \\boldsymbol { \\mathfrak { f } } } ( \\mathbf { \\boldsymbol { x } } , t )$ , score $\\nabla _ { \\mathbf { x } } \\log p _ { t } ( \\mathbf { x } )$ , and score model output $\\mathbf { s } ( \\mathbf { x } , t )$ be elements of the tangent space $T _ { \\mathbf { x } } M$ . Then equation 2 remains valid—that is, discretizing and solving the reverse SDE on the manifold as a geodesic random walk starting with samples from $p _ { T } ( \\mathbf { x } )$ approximately recovers the original data distribution $p _ { 0 } ( \\mathbf { x } )$ [De Bortoli et al., 2022]. ",
338
+ "bbox": [
339
+ 173,
340
+ 411,
341
+ 826,
342
+ 537
343
+ ],
344
+ "page_idx": 3
345
+ },
346
+ {
347
+ "type": "text",
348
+ "text": "For the forward diffusion we use rescaled Brownian motion given by $\\begin{array} { r } { \\mathbf { f } ( \\mathbf { x } , t ) = 0 , g ( t ) = \\sqrt { \\frac { d } { d t } \\sigma ^ { 2 } ( t ) } } \\end{array}$ where $\\sigma ( t )$ is the noise scale. Specifically, we use an exponential diffusion $\\sigma ( t ) = \\sigma _ { \\operatorname* { m i n } } ^ { 1 - t } \\sigma _ { \\operatorname* { m a x } } ^ { t }$ as in Song and Ermon [2019], with $\\sigma _ { \\mathrm { m i n } } = 0 . 0 1 \\pi$ , $\\sigma _ { \\operatorname* { m a x } } = \\pi , t \\in ( 0 , 1 )$ . Due to the compactness of the manifold, however, the prior $p _ { T } ( \\mathbf { x } )$ is no longer a Gaussian, but a uniform distribution over $M$ . ",
349
+ "bbox": [
350
+ 173,
351
+ 546,
352
+ 825,
353
+ 612
354
+ ],
355
+ "page_idx": 3
356
+ },
357
+ {
358
+ "type": "text",
359
+ "text": "Training the score model with denoising score matching requires a procedure to sample from the perturbation kernel $p _ { t | 0 } ( \\mathbf { x } ^ { \\prime } \\mid \\mathbf { x } )$ of the forward diffusion and compute its score. We view the torus $\\mathbb { T } ^ { m } \\cong [ 0 , 2 \\pi ) ^ { m }$ as the quotient space $\\mathbb { R } ^ { m } / 2 \\pi \\mathbb { Z } ^ { m }$ with equivalence relations $( \\tau _ { 1 } , \\dots \\tau _ { m } ) \\sim$ $( \\tau _ { 1 } + 2 \\pi , \\ldots , \\tau _ { m } ) \\ldots \\sim ( \\tau _ { 1 } , \\ldots \\tau _ { m } + 2 \\pi )$ . Hence, the perturbation kernel for rescaled Brownian motion on $\\mathbb { T } ^ { m }$ is the wrapped normal distribution on $\\mathbb { R } ^ { m }$ ; that is, for any $\\tau , \\tau ^ { \\prime } \\in [ 0 , 2 \\pi ) ^ { m }$ , we have ",
360
+ "bbox": [
361
+ 173,
362
+ 617,
363
+ 825,
364
+ 689
365
+ ],
366
+ "page_idx": 3
367
+ },
368
+ {
369
+ "type": "equation",
370
+ "img_path": "images/76b5f4d68f1ca31612ee67c6740f92749f30e1f4e45b9da0fabfa0a1ebdd7578.jpg",
371
+ "text": "$$\np _ { t | 0 } ( \\pmb { \\tau } ^ { \\prime } \\mid \\pmb { \\tau } ) \\propto \\sum _ { \\mathbf { d } \\in \\mathbb { Z } ^ { m } } \\exp \\left( - \\frac { | | \\pmb { \\tau } - \\pmb { \\tau } ^ { \\prime } + 2 \\pi \\mathbf { d } | | ^ { 2 } } { 2 \\sigma ^ { 2 } ( t ) } \\right)\n$$",
372
+ "text_format": "latex",
373
+ "bbox": [
374
+ 334,
375
+ 695,
376
+ 663,
377
+ 736
378
+ ],
379
+ "page_idx": 3
380
+ },
381
+ {
382
+ "type": "text",
383
+ "text": "where $\\sigma ( t )$ is the noise scale of the perturbation kernel $p _ { t | 0 }$ . We thus sample from the perturbation kernel by sampling from the corresponding unwrapped isotropic normal and taking elementwise mod $2 \\pi$ . The scores of the kernel are pre-computed using a numerical approximation. During training, we sample times $t$ at uniform and minimize the denoising score matching loss ",
384
+ "bbox": [
385
+ 173,
386
+ 743,
387
+ 825,
388
+ 800
389
+ ],
390
+ "page_idx": 3
391
+ },
392
+ {
393
+ "type": "equation",
394
+ "img_path": "images/890b176682328a9e848a14531f16cb7b18406fc533df53cfad7f52d9284c5df7.jpg",
395
+ "text": "$$\nJ _ { \\mathrm { D S M } } ( \\theta ) = \\mathbb { E } _ { t } \\left[ \\lambda ( t ) \\mathbb { E } _ { \\tau _ { 0 } \\sim p _ { 0 } , \\tau _ { t } \\sim p _ { t | 0 } ( \\cdot | \\tau _ { 0 } ) } \\left[ | | \\mathbf { s } ( \\tau _ { t } , t ) - \\nabla _ { \\tau _ { t } } \\log p _ { t | 0 } ( \\tau _ { t } \\mid \\tau _ { 0 } ) | | ^ { 2 } \\right] \\right]\n$$",
396
+ "text_format": "latex",
397
+ "bbox": [
398
+ 241,
399
+ 806,
400
+ 756,
401
+ 834
402
+ ],
403
+ "page_idx": 3
404
+ },
405
+ {
406
+ "type": "text",
407
+ "text": "where the weight factors $\\lambda ( t ) = 1 / \\mathbb { E } _ { \\pmb { \\tau } \\sim p _ { t | 0 } ( \\cdot | 0 ) } \\left[ | | \\nabla _ { \\pmb { \\tau } } \\log p _ { t | 0 } ( \\pmb { \\tau } \\mid \\mathbf { 0 } ) | | ^ { 2 } \\right]$ are also precomputed. As the tangent space $T _ { \\tau } \\mathbb { T } ^ { m }$ is just $\\mathbb { R } ^ { m }$ , all the operations in the loss computation are the familiar ones. ",
408
+ "bbox": [
409
+ 178,
410
+ 840,
411
+ 826,
412
+ 873
413
+ ],
414
+ "page_idx": 3
415
+ },
416
+ {
417
+ "type": "text",
418
+ "text": "For inference, we first sample from a uniform prior over the torus. We then discretize and solve the reverse diffusion with a geodesic random walk; however, since the exponential map on the torus (viewed as a quotient space) is just $\\exp _ { \\tau } ( \\delta ) = \\tau + \\delta$ mod $2 \\pi$ , the geodesic random walk is equivalent to the wrapping of the random walk on $\\mathbb { R } ^ { m }$ . ",
419
+ "bbox": [
420
+ 174,
421
+ 90,
422
+ 825,
423
+ 147
424
+ ],
425
+ "page_idx": 4
426
+ },
427
+ {
428
+ "type": "text",
429
+ "text": "3.2 Torsional score framework ",
430
+ "text_level": 1,
431
+ "bbox": [
432
+ 176,
433
+ 164,
434
+ 400,
435
+ 178
436
+ ],
437
+ "page_idx": 4
438
+ },
439
+ {
440
+ "type": "text",
441
+ "text": "While we have defined the diffusion process over intrinsic coordinates, learning a score model $\\mathbf { s } ( \\tau , t )$ directly over intrinsic coordinates is potentially problematic for several reasons. First, the dimensionality $m$ of the torsional space depends on the molecular graph $G$ . Second, the mapping from torsional space to physically distinct conformers depends on $G$ and local structures $L$ , but it is unclear how to best provide these to a model over $\\mathbb { T } ^ { m }$ . Third, there is no canonical choice of independent intrinsic coordinates $( L , \\tau )$ ; in particular, the torsion angle at a rotatable bond can be defined as any of the dihedral angles at that bond, depending on an arbitrary choice of reference neighbors (Figure 2 and Appendix A). Thus, even with fixed $G$ and $L$ , the mapping from $\\mathbb { T } ^ { m }$ to conformers is ill-defined. This posed a significant challenge to prior works using intrinsic coordinates [Ganea et al., 2021]. ",
442
+ "bbox": [
443
+ 174,
444
+ 189,
445
+ 614,
446
+ 382
447
+ ],
448
+ "page_idx": 4
449
+ },
450
+ {
451
+ "type": "text",
452
+ "text": "To circumvent these difficulties, we instead consider a conformer $C \\in { \\mathcal { C } } _ { G }$ in terms of its extrinsic (or Cartesian) coordinates—that is, as a point cloud in 3D space, defined up to global roto-translation: $\\mathcal { C } _ { G } \\triangleq \\mathbb { R } ^ { 3 n } / S E ( 3 )$ . Then, we construct the score model ${ \\bf s } _ { G } ( C , t )$ as a function over $\\mathcal { C } _ { G }$ rather than $\\mathbb { T } ^ { m }$ . The outputs remain in the tangent space of $\\mathbb { T } ^ { m }$ , which is just $\\mathbb { R } ^ { m }$ . Such a score model is simply an $S E ( 3 )$ -invariant model over point clouds in 3D space $\\mathbf { s } _ { G } : \\mathbb { R } ^ { 3 n } \\times [ 0 , T ] \\mapsto \\mathbb { R } ^ { m }$ conditioned on $G$ . Thus, we have reduced the problem of learning a score on the torus, conditioned on the molecular graph and local structure, to the much more familiar problem of predicting $S E ( 3 )$ -invariant scalar quantities—one for each bond—from a 3D conformer. ",
453
+ "bbox": [
454
+ 173,
455
+ 388,
456
+ 614,
457
+ 554
458
+ ],
459
+ "page_idx": 4
460
+ },
461
+ {
462
+ "type": "image",
463
+ "img_path": "images/0ab5296ed044c2475b95fad725b352978091724b32fcc2f400d37ce8ab62afbc.jpg",
464
+ "image_caption": [
465
+ "Figure 2: A: The torsion $\\tau$ around a bond depends on a choice of neighbors. B: The change $\\Delta \\tau$ caused by a relative rotation is the same for all choices. C: The sign of $\\Delta \\tau$ is unambiguous because given the same neighbors, $\\tau$ does not depend on bond direction. "
466
+ ],
467
+ "image_footnote": [],
468
+ "bbox": [
469
+ 627,
470
+ 193,
471
+ 823,
472
+ 435
473
+ ],
474
+ "page_idx": 4
475
+ },
476
+ {
477
+ "type": "text",
478
+ "text": "It may appear that we still need to choose a definition of each torsion angle $\\tau _ { i }$ so that we can sample from $p _ { t | 0 } ( \\cdot | \\tau )$ during training and solve the reverse SDE over $\\tau$ during inference. However, we leverage the following insight: given fixed local structures, the action on $C$ of changing a single torsion angle $\\tau _ { i }$ by some $\\Delta \\tau _ { i }$ can be applied without choosing a definition (Figure 2). Geometrically, this action is a (signed) relative rotation of the atoms on opposite sides of the bond and can be applied directly to the atomic coordinates in 3D. The geometric intuition can be stated as follows (proven in Appendix B and discussed further in Appendix F.2). ",
479
+ "bbox": [
480
+ 173,
481
+ 561,
482
+ 612,
483
+ 589
484
+ ],
485
+ "page_idx": 4
486
+ },
487
+ {
488
+ "type": "text",
489
+ "text": "",
490
+ "bbox": [
491
+ 173,
492
+ 589,
493
+ 825,
494
+ 671
495
+ ],
496
+ "page_idx": 4
497
+ },
498
+ {
499
+ "type": "text",
500
+ "text": "Proposition 1. Let $( b _ { i } , c _ { i } )$ be a rotatable bond, let $\\mathbf { x } _ { \\mathcal { V } ( b _ { i } ) }$ be the positions of atoms on the $b _ { i }$ side of the molecule, and let $R ( \\pmb \\theta , x _ { c _ { i } } ) \\in S E ( 3 )$ be the rotation by Euler vector $\\pmb \\theta$ about $x _ { c _ { i } }$ . Then for $C , C ^ { \\prime } \\in { \\mathcal { C } } _ { G }$ , if $\\tau _ { i }$ is any definition of the torsion angle around bond $( b _ { i } , c _ { i } )$ , ",
501
+ "bbox": [
502
+ 174,
503
+ 676,
504
+ 825,
505
+ 719
506
+ ],
507
+ "page_idx": 4
508
+ },
509
+ {
510
+ "type": "equation",
511
+ "img_path": "images/1625bac2312ef549c086383c69da41ad24111019a1adaf5f6600bb2ed347d7a6.jpg",
512
+ "text": "$$\n\\begin{array} { r l } & { \\tau _ { i } ( C ^ { \\prime } ) = \\tau _ { i } ( C ) + \\theta } \\\\ & { \\tau _ { j } ( C ^ { \\prime } ) = \\tau _ { j } ( C ) \\quad \\forall j \\neq i } \\end{array} \\quad \\begin{array} { r l } & { i f \\quad \\quad \\exists \\mathbf { x } \\in C , \\mathbf { x } ^ { \\prime } \\in C ^ { \\prime } . } \\\\ & { \\mathbf { x } ^ { \\prime } \\in \\ l _ { \\ l } ( c _ { i } ) = R \\left( \\theta \\hat { \\mathbf { r } } _ { b _ { i } c _ { i } } , x _ { c _ { i } } \\right) \\mathbf { x } _ { \\mathcal { V } ( c _ { i } ) } } \\end{array}\n$$",
513
+ "text_format": "latex",
514
+ "bbox": [
515
+ 197,
516
+ 727,
517
+ 779,
518
+ 768
519
+ ],
520
+ "page_idx": 4
521
+ },
522
+ {
523
+ "type": "text",
524
+ "text": "where $\\hat { \\bf r } _ { b _ { i } c _ { i } } = ( x _ { c _ { i } } - x _ { b _ { i } } ) / \\vert \\vert x _ { c _ { i } } - x _ { b _ { i } } \\vert \\vert .$ ",
525
+ "bbox": [
526
+ 173,
527
+ 773,
528
+ 437,
529
+ 791
530
+ ],
531
+ "page_idx": 4
532
+ },
533
+ {
534
+ "type": "text",
535
+ "text": "To apply a torsion update $\\Delta \\tau = \\left( \\Delta \\tau _ { 1 } , \\dots \\Delta \\tau _ { m } \\right)$ involving all bonds, we apply $\\Delta \\tau _ { i }$ sequentially in any order. Then, since training and inference only make use of torsion updates $\\Delta \\tau$ , we work solely in terms of 3D point clouds and updates applied to them. To draw local structures $L$ from RDKit, we draw full 3D conformers $C \\in { \\mathcal { C } } _ { G }$ and then randomize all torsion angles to sample uniformly over $\\mathbb { T } ^ { m }$ . To solve the reverse SDE, we repeatedly predict torsion updates directly from, and apply them directly to, the 3D point cloud. Therefore, since our method never requires a choice of reference neighbors for any $\\tau _ { i }$ , it is manifestly invariant to such a choice. These procedures are detailed in Appendix C. ",
536
+ "bbox": [
537
+ 173,
538
+ 799,
539
+ 825,
540
+ 911
541
+ ],
542
+ "page_idx": 4
543
+ },
544
+ {
545
+ "type": "text",
546
+ "text": "3.3 Parity equivariance ",
547
+ "text_level": 1,
548
+ "bbox": [
549
+ 174,
550
+ 90,
551
+ 349,
552
+ 106
553
+ ],
554
+ "page_idx": 5
555
+ },
556
+ {
557
+ "type": "text",
558
+ "text": "The torsional score framework presented thus far requires an $S E ( 3 )$ -invariant model. However, an additional symmetry requirement arises from the fact that the underlying physical energy is invariant, or extremely nearly so, under parity inversion [Quack, 2002]. Thus our learned density should respect $p ( C ) = p ( { \\bar { - } } C )$ where $- C \\stackrel { - } { = } \\{ - { \\bf x } | { \\bf x } \\in C \\}$ . In terms of the conditional distribution over torsion angles, we require $p ( \\pmb { \\tau } ( C ) \\mid L ( \\overline { { C } } ) ) = p ( \\pmb { \\tau } ( \\overline { { - C } } ) \\mid L ( - C ) )$ . Then, ",
559
+ "bbox": [
560
+ 173,
561
+ 116,
562
+ 823,
563
+ 186
564
+ ],
565
+ "page_idx": 5
566
+ },
567
+ {
568
+ "type": "text",
569
+ "text": "Proposition 2. I $^ { \\prime } p ( \\pmb { \\tau } ( C ) \\mid L ( C ) ) = p ( \\pmb { \\tau } ( - C ) \\mid L ( - C ) )$ , then for all diffusion times $t$ ",
570
+ "bbox": [
571
+ 181,
572
+ 188,
573
+ 750,
574
+ 203
575
+ ],
576
+ "page_idx": 5
577
+ },
578
+ {
579
+ "type": "equation",
580
+ "img_path": "images/a61dde9f7ee801855d081d9c4c716db76d0ee23abcf0181b07152fca278b81f3.jpg",
581
+ "text": "$$\n\\nabla _ { \\tau } \\log { p _ { t } ( \\tau ( C ) \\mid L ( C ) ) } = - \\nabla _ { \\tau } \\log { p _ { t } ( \\tau ( - C ) \\mid L ( - C ) ) }\n$$",
582
+ "text_format": "latex",
583
+ "bbox": [
584
+ 308,
585
+ 204,
586
+ 692,
587
+ 220
588
+ ],
589
+ "page_idx": 5
590
+ },
591
+ {
592
+ "type": "text",
593
+ "text": "Because the score model seeks to learn $\\mathbf { s } _ { G } ( C , t ) ~ = ~ \\nabla _ { \\pmb { \\tau } } \\log p _ { t } ( \\pmb { \\tau } ( C ) ~ | ~ L ( C ) )$ , we must have ${ \\bf s } _ { G } ( C , t ) = - { \\bf s } _ { G } ( - C , t )$ . Thus, the score model must be invariant under $S E ( 3 )$ but equivariant (change sign) under parity inversion of the input point cloud— i.e. it must output a set of pseudoscalars in $\\mathbb { R } ^ { m }$ . ",
594
+ "bbox": [
595
+ 173,
596
+ 228,
597
+ 823,
598
+ 284
599
+ ],
600
+ "page_idx": 5
601
+ },
602
+ {
603
+ "type": "text",
604
+ "text": "3.4 Score network architecture ",
605
+ "text_level": 1,
606
+ "bbox": [
607
+ 176,
608
+ 300,
609
+ 401,
610
+ 314
611
+ ],
612
+ "page_idx": 5
613
+ },
614
+ {
615
+ "type": "text",
616
+ "text": "Based on sections 3.2 and 3.3, the desiderata for the score model are: ",
617
+ "bbox": [
618
+ 174,
619
+ 324,
620
+ 625,
621
+ 340
622
+ ],
623
+ "page_idx": 5
624
+ },
625
+ {
626
+ "type": "text",
627
+ "text": "Predict a pseudoscalar $\\delta \\tau _ { i } : = \\partial \\log p / \\partial \\tau _ { i } \\in \\mathbb { R }$ that is $S E ( 3 )$ -invariant and parity equivariant for every rotatable bond in a $3 D$ point cloud representation of a conformer. ",
628
+ "bbox": [
629
+ 186,
630
+ 348,
631
+ 812,
632
+ 377
633
+ ],
634
+ "page_idx": 5
635
+ },
636
+ {
637
+ "type": "text",
638
+ "text": "While there exist several GNN architectures which are $S E ( 3 )$ -equivariant [Jing et al., 2021, Satorras et al., 2021], their $S E ( 3 )$ -invariant outputs are also parity invariant and, therefore, cannot satisfy the desired symmetry. Instead, we leverage the ability of equivariant networks based on tensor products [Thomas et al., 2018, Geiger et al., 2022] to produce pseudoscalar outputs. ",
639
+ "bbox": [
640
+ 176,
641
+ 385,
642
+ 823,
643
+ 441
644
+ ],
645
+ "page_idx": 5
646
+ },
647
+ {
648
+ "type": "text",
649
+ "text": "Our architecture, detailed in Appendix D, consists of an embedding layer, a series of atomic convolution layers, and a final bond convolution layer. The first two closely follow the architecture of Tensor Field Networks [Thomas et al., 2018], and produce learned feature vectors for each atom. The final bond convolution layer constructs tensor product filters spatially centered on every rotatable bond and aggregates messages from neighboring atom features. We extract the pseudoscalar outputs of this filter to produce a single real-valued pseudoscalar prediction $\\delta \\tau _ { i }$ for each rotatable bond. ",
650
+ "bbox": [
651
+ 174,
652
+ 446,
653
+ 825,
654
+ 531
655
+ ],
656
+ "page_idx": 5
657
+ },
658
+ {
659
+ "type": "text",
660
+ "text": "Naively, the bond convolution layer could be constructed the same way as the atomic convolution layers, i.e., with spherical harmonic filters. However, to supply information about the orientation of the bond about which the torsion occurs, we construct a filter from the product of the spherical harmonics with a representation of the bond (Figure 1D). Because the convolution conceptually resembles computing the torque, we call this final layer the pseudotorque layer. ",
661
+ "bbox": [
662
+ 174,
663
+ 536,
664
+ 825,
665
+ 607
666
+ ],
667
+ "page_idx": 5
668
+ },
669
+ {
670
+ "type": "text",
671
+ "text": "3.5 Likelihood ",
672
+ "text_level": 1,
673
+ "bbox": [
674
+ 174,
675
+ 621,
676
+ 289,
677
+ 636
678
+ ],
679
+ "page_idx": 5
680
+ },
681
+ {
682
+ "type": "text",
683
+ "text": "By using the probability flow ODE, we can compute the likelihood of any sample $\\tau$ as follows [Song et al., 2021, De Bortoli et al., 2022]: ",
684
+ "bbox": [
685
+ 173,
686
+ 646,
687
+ 825,
688
+ 675
689
+ ],
690
+ "page_idx": 5
691
+ },
692
+ {
693
+ "type": "equation",
694
+ "img_path": "images/8cf3f7d32e080ce29d0d81da2f308dffda3a4283271912299c5a257267131fcd.jpg",
695
+ "text": "$$\n\\log p _ { 0 } ( \\tau _ { 0 } ) = \\log p _ { T } ( \\tau _ { T } ) - \\frac { 1 } { 2 } \\int _ { 0 } ^ { T } g ^ { 2 } ( t ) \\ \\nabla _ { \\tau } \\cdot \\mathbf { s } _ { G } ( \\tau _ { t } , t ) \\ d t\n$$",
696
+ "text_format": "latex",
697
+ "bbox": [
698
+ 307,
699
+ 676,
700
+ 691,
701
+ 712
702
+ ],
703
+ "page_idx": 5
704
+ },
705
+ {
706
+ "type": "text",
707
+ "text": "In Song et al. [2021], the divergence term is approximated via Hutchinson’s method [Hutchinson, 1989], which gives an unbiased estimate of $\\log p _ { 0 } ( \\tau )$ . However, this gives a biased estimate of $p _ { 0 } ( \\tau )$ , which is unsuitable for our applications. Thus, we compute the divergence term directly, which is feasible here (unlike in Euclidean diffusion) due to the reduced dimensionality of the torsional space. ",
708
+ "bbox": [
709
+ 173,
710
+ 712,
711
+ 826,
712
+ 767
713
+ ],
714
+ "page_idx": 5
715
+ },
716
+ {
717
+ "type": "text",
718
+ "text": "The above likelihood is in torsional space $p _ { G } ( \\tau \\mid L ) , \\tau \\in \\mathbb { T } ^ { m }$ , but to enable compatibility with the Boltzmann measure $e ^ { - E ( \\mathbf { x } ) / k T }$ , it is desirable to interconvert this with a likelihood in Euclidean space $p ( \\mathbf { x } \\mid L ) , \\mathbf { x } \\in \\mathbb { R } ^ { 3 n }$ . A factor is necessary to convert between the volume element in torsional space and in Euclidean space (full derivation in Appendix B): ",
719
+ "bbox": [
720
+ 173,
721
+ 772,
722
+ 825,
723
+ 832
724
+ ],
725
+ "page_idx": 5
726
+ },
727
+ {
728
+ "type": "text",
729
+ "text": "Proposition 3. Let $\\mathbf { x } \\in C ( \\tau , L )$ be a centered7 conformer in Euclidean space. Then, ",
730
+ "bbox": [
731
+ 171,
732
+ 833,
733
+ 733,
734
+ 848
735
+ ],
736
+ "page_idx": 5
737
+ },
738
+ {
739
+ "type": "equation",
740
+ "img_path": "images/041bda72c013f169082595bc1bcef1291f9a235edfe9a659814edaa8d39361fc.jpg",
741
+ "text": "$$\np _ { G } ( \\mathbf { x } \\mid L ) = { \\frac { p _ { G } ( \\tau \\mid L ) } { 8 \\pi ^ { 2 } { \\sqrt { \\operatorname* { d e t } g } } \\quad { \\mathrm { w h e r e } } \\ g _ { \\alpha \\beta } = \\sum _ { k = 1 } ^ { n } J _ { \\alpha } ^ { ( k ) } \\cdot J _ { \\beta } ^ { ( k ) } } }\n$$",
742
+ "text_format": "latex",
743
+ "bbox": [
744
+ 308,
745
+ 849,
746
+ 687,
747
+ 891
748
+ ],
749
+ "page_idx": 5
750
+ },
751
+ {
752
+ "type": "text",
753
+ "text": "7Additional formalism is needed for translations, but it is independent of the conformer and can be ignored. ",
754
+ "bbox": [
755
+ 186,
756
+ 897,
757
+ 821,
758
+ 911
759
+ ],
760
+ "page_idx": 5
761
+ },
762
+ {
763
+ "type": "text",
764
+ "text": "where the indices $\\alpha , \\beta$ are integers between $^ { l }$ and $m + 3 .$ . For $1 \\leq \\alpha \\leq m$ , $J _ { \\alpha } ^ { ( k ) }$ is defined as ",
765
+ "bbox": [
766
+ 168,
767
+ 88,
768
+ 781,
769
+ 108
770
+ ],
771
+ "page_idx": 6
772
+ },
773
+ {
774
+ "type": "equation",
775
+ "img_path": "images/474b238d377636d40c3761754ecb29481d63eec3f0b04ff704b54516cb641c18.jpg",
776
+ "text": "$$\nJ _ { i } ^ { ( k ) } = \\tilde { J } _ { i } ^ { ( k ) } - \\frac { 1 } { n } \\sum _ { \\ell = 1 } ^ { n } \\tilde { J } _ { i } ^ { ( \\ell ) } \\quad \\mathrm { w i t h } ~ \\tilde { J } _ { i } ^ { ( \\ell ) } = \\left\\{ \\begin{array} { l l } { 0 } & { \\ell \\in \\mathcal { V } ( b _ { i } ) , } \\\\ { \\frac { \\mathbf { x } _ { b _ { i } } - \\mathbf { x } _ { c _ { i } } } { | | \\mathbf { x } _ { b _ { i } } - \\mathbf { x } _ { c _ { i } } | | } \\times ( \\mathbf { x } _ { \\ell } - \\mathbf { x } _ { c _ { i } } ) , } & { \\ell \\in \\mathcal { V } ( c _ { i } ) , } \\end{array} \\right.\n$$",
777
+ "text_format": "latex",
778
+ "bbox": [
779
+ 228,
780
+ 112,
781
+ 767,
782
+ 155
783
+ ],
784
+ "page_idx": 6
785
+ },
786
+ {
787
+ "type": "text",
788
+ "text": "and for $\\alpha \\in \\{ m + 1 , m + 2 , m + 3 \\}$ as ",
789
+ "bbox": [
790
+ 174,
791
+ 160,
792
+ 436,
793
+ 176
794
+ ],
795
+ "page_idx": 6
796
+ },
797
+ {
798
+ "type": "equation",
799
+ "img_path": "images/e659805a97fa5453417016d36d0bcddc3126312f04de9424e26361c28fb1e753.jpg",
800
+ "text": "$$\nJ _ { m + 1 } ^ { ( k ) } = { \\bf x } _ { k } \\times \\hat { x } , \\qquad J _ { m + 2 } ^ { ( k ) } = { \\bf x } _ { k } \\times \\hat { y } , \\qquad J _ { m + 3 } ^ { ( k ) } = { \\bf x } _ { k } \\times \\hat { z } ,\n$$",
801
+ "text_format": "latex",
802
+ "bbox": [
803
+ 279,
804
+ 181,
805
+ 684,
806
+ 204
807
+ ],
808
+ "page_idx": 6
809
+ },
810
+ {
811
+ "type": "text",
812
+ "text": "where $( b _ { i } , c _ { i } )$ is the freely rotatable bond for torsion angle i, $\\mathcal { V } ( b _ { i } )$ is the set of all nodes on the same side of the bond as $b _ { i }$ , and $\\hat { x } , \\hat { y } , \\hat { z }$ are the unit vectors in the respective directions. ",
813
+ "bbox": [
814
+ 173,
815
+ 209,
816
+ 825,
817
+ 238
818
+ ],
819
+ "page_idx": 6
820
+ },
821
+ {
822
+ "type": "text",
823
+ "text": "3.6 Energy-based training ",
824
+ "text_level": 1,
825
+ "bbox": [
826
+ 174,
827
+ 253,
828
+ 369,
829
+ 268
830
+ ],
831
+ "page_idx": 6
832
+ },
833
+ {
834
+ "type": "text",
835
+ "text": "By computing likelihoods, we can train torsional diffusion models to match the Boltzmann distribution over torsion angles using the energy function. At a high level, we minimize the usual score matching loss, but with simulated samples from the Boltzmann distribution rather than data samples. The procedure therefore consists of two stages: resampling and score matching, which are tightly coupled during training (Algorithm 1). In the resampling stage, we use the model as an importance sampler for the Boltzmann distribution, where Proposition 3 is used to compute the (unnormalized) torsional Boltzmann density $\\tilde { p } _ { G } ( \\tau \\mid L )$ . In the score-matching stage, the importance weights are used to approximate the denoising score-matching loss with expectations taken over $\\tilde { p } _ { G } ( \\tau \\mid L )$ . As the model learns the score, it improves as an importance sampler. ",
836
+ "bbox": [
837
+ 173,
838
+ 279,
839
+ 825,
840
+ 405
841
+ ],
842
+ "page_idx": 6
843
+ },
844
+ {
845
+ "type": "text",
846
+ "text": "This training procedure differs substantially from that of existing Boltzmann generators, which are trained as flows with a loss that directly depends on the model density. In contrast, we train the model as a score-based model, but use it as a flow—both during training and inference—to generate samples. The model density is needed only to reweight the samples to approximate the target density. Since in principle the model used for resampling does not need to be the same as the model ",
847
+ "bbox": [
848
+ 174,
849
+ 410,
850
+ 475,
851
+ 561
852
+ ],
853
+ "page_idx": 6
854
+ },
855
+ {
856
+ "type": "text",
857
+ "text": "Algorithm 1: Energy-based training epoch ",
858
+ "text_level": 1,
859
+ "bbox": [
860
+ 490,
861
+ 417,
862
+ 769,
863
+ 433
864
+ ],
865
+ "page_idx": 6
866
+ },
867
+ {
868
+ "type": "text",
869
+ "text": "Input: Boltzmann density $\\tilde { p }$ , training pairs $\\{ ( G _ { i } , L _ { i } ) \\} _ { i }$ , torsional diffusion model $q$ \nfor each $( G _ { i } , L _ { i } )$ do Sample $\\pmb { \\tau } _ { 1 } , \\dots \\pmb { \\tau } _ { K } \\sim q _ { G _ { i } } ( \\pmb { \\tau } \\mid L _ { i } )$ ; for $k \\gets 1$ to $K$ do $\\\\begin{array} { r } { \\underline { \\mathbf { \\Omega } } \\underline { \\mathbf { \\Omega } } \\tilde { w } _ { k } = \\tilde { p } _ { G _ { i } } ( \\pmb { \\tau } _ { k } \\mid L _ { i } ) / q _ { G _ { i } } ( \\pmb { \\tau } _ { k } \\mid L _ { i } ) ; } \\end{array}$ Approximate $J _ { \\mathrm { D S M } }$ for $p _ { 0 } \\propto \\tilde { p }$ using $\\{ ( \\tilde { w } _ { i } , \\pmb { \\tau } _ { i } ) \\} _ { i }$ ; Minimize $J _ { \\mathrm { D S M } }$ ; ",
870
+ "bbox": [
871
+ 488,
872
+ 436,
873
+ 803,
874
+ 546
875
+ ],
876
+ "page_idx": 6
877
+ },
878
+ {
879
+ "type": "text",
880
+ "text": "being trained,8 we can use very few steps (a shallow flow) during resampling to accelerate training, and then increase the number of steps (a deeper flow) for better approximations during inference—an option unavailable to existing Boltzmann generators. ",
881
+ "bbox": [
882
+ 174,
883
+ 563,
884
+ 826,
885
+ 603
886
+ ],
887
+ "page_idx": 6
888
+ },
889
+ {
890
+ "type": "text",
891
+ "text": "4 Experiments ",
892
+ "text_level": 1,
893
+ "bbox": [
894
+ 174,
895
+ 622,
896
+ 312,
897
+ 640
898
+ ],
899
+ "page_idx": 6
900
+ },
901
+ {
902
+ "type": "text",
903
+ "text": "We evaluate torsional diffusion by comparing the generated and ground-truth conformers in terms of ensemble RMSD (Section 4.3) and properties (Section 4.4). Section 4.1 first discusses a preprocessing procedure required to train a conditional model $p _ { G } ( \\tau \\mid L )$ . Section 4.5 concludes with torsional Boltzmann generators. See Appendix H for additional results, including ablation experiments. ",
904
+ "bbox": [
905
+ 174,
906
+ 654,
907
+ 825,
908
+ 710
909
+ ],
910
+ "page_idx": 6
911
+ },
912
+ {
913
+ "type": "text",
914
+ "text": "4.1 Conformer matching ",
915
+ "text_level": 1,
916
+ "bbox": [
917
+ 174,
918
+ 726,
919
+ 359,
920
+ 741
921
+ ],
922
+ "page_idx": 6
923
+ },
924
+ {
925
+ "type": "text",
926
+ "text": "In focusing on $p _ { G } ( \\tau \\mid L )$ , we have assumed that we can sample local structures $L \\sim p _ { G } ( L )$ with RDKit. While this assumption is very good in terms of RMSD, the RDKit marginal $\\hat { p } _ { G } ( L )$ is only an approximation of the ground truth $p _ { G } ( L )$ . Thus, if we train on the denoising score-matching loss with ground truth conformers—i.e., conditioned on ground truth local structures—there will be a distributional shift at test time, where only approximate local structures from $\\hat { p } _ { G } ( L )$ are available. We found that this shift significantly hurts performance. ",
927
+ "bbox": [
928
+ 174,
929
+ 751,
930
+ 825,
931
+ 835
932
+ ],
933
+ "page_idx": 6
934
+ },
935
+ {
936
+ "type": "text",
937
+ "text": "We thus introduce a preprocessing procedure called conformer matching. In brief, for the training split only, we substitute each ground truth conformer $C$ with a synthetic conformer $\\hat { C }$ with local structures $\\hat { L } \\sim \\hat { p } _ { G } ( L )$ and made as similar as possible to $C$ . That is, we use RDKit to generate $\\hat { L }$ and change torsion angles $\\hat { \\tau }$ to minimize $\\mathrm { R M S D } ( C , { \\hat { C } } )$ . Naively, we could sample $\\hat { L } \\sim \\hat { p } _ { G } ( L )$ independently for each conformer, but this eliminates any possible dependence between $L$ and $\\tau$ that could serve as training signal. Instead, we view the distributional shift as a domain adaptation problem that can be solved by optimally aligning $p _ { G } ( L )$ and $\\hat { p } _ { G } ( L )$ . See Appendix E for details. ",
938
+ "bbox": [
939
+ 174,
940
+ 840,
941
+ 825,
942
+ 888
943
+ ],
944
+ "page_idx": 6
945
+ },
946
+ {
947
+ "type": "table",
948
+ "img_path": "images/924914bcc0a399cb39f84cbb2bbdfc124d3414d7c41b4c6e713db63b68e0f4a2.jpg",
949
+ "table_caption": [
950
+ "Table 1: Quality of generated conformer ensembles for the GEOM-DRUGS test set in terms of Coverage $( \\% )$ and Average Minimum RMSD $( \\mathring \\mathrm { A } )$ . We compute Coverage with a threshold of $\\delta =$ $0 . 7 5 \\mathring { \\mathrm { A } }$ to better distinguish top methods. Note that this is different from most prior works, which used $\\delta = 1 . 2 5 \\mathrm { ~ \\AA ~ }$ . "
951
+ ],
952
+ "table_footnote": [],
953
+ "table_body": "<table><tr><td></td><td colspan=\"4\">Recall</td><td colspan=\"4\">Precision</td></tr><tr><td></td><td colspan=\"2\">Coverage ↑</td><td colspan=\"2\">AMR↓</td><td colspan=\"2\">Coverage ↑</td><td colspan=\"2\">AMR↓</td></tr><tr><td>Method</td><td>Mean</td><td>Med</td><td>Mean</td><td>Med</td><td>Mean</td><td>Med</td><td>Mean</td><td>Med</td></tr><tr><td>RDKit ETKDG</td><td>38.4</td><td>28.6</td><td>1.058</td><td>1.002</td><td>40.9</td><td>30.8</td><td>0.995</td><td>0.895</td></tr><tr><td>OMEGA</td><td>53.4</td><td>54.6</td><td>0.841</td><td>0.762</td><td>40.5</td><td>33.3</td><td>0.946</td><td>0.854</td></tr><tr><td>GeoMol</td><td>44.6</td><td>41.4</td><td>0.875</td><td>0.834</td><td>43.0</td><td>36.4</td><td>0.928</td><td>0.841</td></tr><tr><td>GeoDiff</td><td>42.1</td><td>37.8</td><td>0.835</td><td>0.809</td><td>24.9</td><td>14.5</td><td>1.136</td><td>1.090</td></tr><tr><td>Torsional Diffusion</td><td>72.7</td><td>80.0</td><td>0.582</td><td>0.565</td><td>55.2</td><td>56.9</td><td>0.778</td><td>0.729</td></tr></table>",
954
+ "bbox": [
955
+ 202,
956
+ 154,
957
+ 794,
958
+ 280
959
+ ],
960
+ "page_idx": 7
961
+ },
962
+ {
963
+ "type": "text",
964
+ "text": "",
965
+ "bbox": [
966
+ 174,
967
+ 305,
968
+ 825,
969
+ 363
970
+ ],
971
+ "page_idx": 7
972
+ },
973
+ {
974
+ "type": "text",
975
+ "text": "4.2 Experimental setup ",
976
+ "text_level": 1,
977
+ "bbox": [
978
+ 174,
979
+ 378,
980
+ 349,
981
+ 395
982
+ ],
983
+ "page_idx": 7
984
+ },
985
+ {
986
+ "type": "text",
987
+ "text": "Dataset We evaluate on the GEOM dataset [Axelrod and Gómez-Bombarelli, 2022], which provides gold-standard conformer ensembles generated with metadynamics in CREST [Pracht et al., 2020]. We focus on GEOM-DRUGS—the largest and most pharmaceutically relevant part of the dataset— consisting of $3 0 4 \\mathrm { k }$ drug-like molecules (average 44 atoms). To test the capacity to extrapolate to the largest molecules, we also collect from GEOM-MoleculeNet all species with more than 100 atoms into a dataset we call GEOM-XL and use it to evaluate models trained on DRUGS. Finally, we train and evaluate models on GEOM-QM9, a more established dataset but with significantly smaller molecules (average 11 atoms). Results for GEOM-XL and GEOM-QM9 are in Appendix H. ",
988
+ "bbox": [
989
+ 173,
990
+ 405,
991
+ 826,
992
+ 516
993
+ ],
994
+ "page_idx": 7
995
+ },
996
+ {
997
+ "type": "text",
998
+ "text": "Evaluation We use the train/val/test splits from Ganea et al. [2021] and use the same metrics to compare the generated and ground truth conformer ensembles: Average Minimum RMSD (AMR) and Coverage. These metrics are reported both for Recall (R)—which measures how well the generated ensemble covers the ground-truth ensemble—and Precision (P)—which measures the accuracy of the generated conformers. See Appendix G for exact definitions and further details. Following the literature, we generate $2 K$ conformers for a molecule with $K$ ground truth conformers. ",
999
+ "bbox": [
1000
+ 174,
1001
+ 522,
1002
+ 825,
1003
+ 606
1004
+ ],
1005
+ "page_idx": 7
1006
+ },
1007
+ {
1008
+ "type": "text",
1009
+ "text": "Baselines We compare with the strongest existing methods from Section 2. Among cheminformatics methods, we evaluate RDKit ETKDG [Riniker and Landrum, 2015], the most established open-source package, and OMEGA [Hawkins et al., 2010, Hawkins and Nicholls, 2012], a commercial software in continuous development. Among machine learning methods, we evaluate GeoMol [Ganea et al., 2021] and GeoDiff [Xu et al., 2022], which have outperformed all previous models on the evaluation metrics. Note that GeoDiff originally used a small subset of the DRUGS dataset, so we retrained it using the splits from Ganea et al. [2021]. ",
1010
+ "bbox": [
1011
+ 174,
1012
+ 612,
1013
+ 825,
1014
+ 709
1015
+ ],
1016
+ "page_idx": 7
1017
+ },
1018
+ {
1019
+ "type": "text",
1020
+ "text": "4.3 Ensemble RMSD ",
1021
+ "text_level": 1,
1022
+ "bbox": [
1023
+ 174,
1024
+ 726,
1025
+ 333,
1026
+ 741
1027
+ ],
1028
+ "page_idx": 7
1029
+ },
1030
+ {
1031
+ "type": "text",
1032
+ "text": "Torsional diffusion significantly outperforms all previous methods on GEOM-DRUGS (Table 1 and Figure 3), reducing by $30 \\%$ the average minimum recall RMSD and by $16 \\%$ the precision RMSD relative to the previous state-of-the-art method. Torsional diffusion is also the first ML method to consistently generate better ensembles than OMEGA. As OMEGA is a well-established product used in industry, this represents an essential step towards establishing the utility of conformer generation with machine learning. ",
1033
+ "bbox": [
1034
+ 173,
1035
+ 752,
1036
+ 825,
1037
+ 835
1038
+ ],
1039
+ "page_idx": 7
1040
+ },
1041
+ {
1042
+ "type": "text",
1043
+ "text": "Torsional diffusion offers specific advantages over both GeoDiff and GeoMol, the most advanced prior machine learning methods. GeoDiff, a Euclidean diffusion model, requires 5000 denoising steps to obtain the results shown, whereas our model—thanks to the reduced degrees of freedom—requires only 20 steps. In fact, our model outperforms GeoDiff with as few as 5 denoising steps. As seen in Table 2, this translates to enormous runtime improvements. ",
1044
+ "bbox": [
1045
+ 174,
1046
+ 842,
1047
+ 825,
1048
+ 911
1049
+ ],
1050
+ "page_idx": 7
1051
+ },
1052
+ {
1053
+ "type": "image",
1054
+ "img_path": "images/7786ffba558ddea10b907eb13e211e8021da9164d09ba6b1d941b9f1e0b7fa39.jpg",
1055
+ "image_caption": [
1056
+ "Figure 3: Mean coverage for recall (left) and precision (right) when varying the threshold value $\\delta$ on GEOM-DRUGS. "
1057
+ ],
1058
+ "image_footnote": [],
1059
+ "bbox": [
1060
+ 179,
1061
+ 126,
1062
+ 812,
1063
+ 311
1064
+ ],
1065
+ "page_idx": 8
1066
+ },
1067
+ {
1068
+ "type": "table",
1069
+ "img_path": "images/104788b432394b4faba9d4faab25b75f9ba886eeb30f14eb223e62c9b17fa783.jpg",
1070
+ "table_caption": [
1071
+ "Table 2: Median AMR and runtime (core-secs per conformer) of machine learning methods, evaluated on CPU for comparison with RDKit. "
1072
+ ],
1073
+ "table_footnote": [],
1074
+ "table_body": "<table><tr><td>Method</td><td>Steps</td><td>AMR-R</td><td>AMR-P</td><td>Runtime</td></tr><tr><td>RDKit</td><td>1</td><td>1.002</td><td>0.895</td><td>0.10</td></tr><tr><td>GeoMol</td><td>1</td><td>0.834</td><td>0.841</td><td>0.18</td></tr><tr><td>GeoDiff</td><td>5000</td><td>0.809</td><td>1.090</td><td>305</td></tr><tr><td>Torsional</td><td>5</td><td>0.685</td><td>0.963</td><td>1.76</td></tr><tr><td>Diffusion</td><td>10</td><td>0.580</td><td>0.791</td><td>2.82</td></tr><tr><td></td><td>20</td><td>0.565</td><td>0.729</td><td>4.90</td></tr></table>",
1075
+ "bbox": [
1076
+ 173,
1077
+ 378,
1078
+ 532,
1079
+ 500
1080
+ ],
1081
+ "page_idx": 8
1082
+ },
1083
+ {
1084
+ "type": "table",
1085
+ "img_path": "images/2b80963ebbe3280c358ca01ded94899f9dca7c73a83ab96bd3db8eb336c11302.jpg",
1086
+ "table_caption": [
1087
+ "Table 3: Median absolute error of generated v.s. ground truth ensemble properties. $E , \\Delta \\epsilon , E _ { \\mathrm { m i n } }$ in kcal/mol, $\\mu$ in debye. "
1088
+ ],
1089
+ "table_footnote": [],
1090
+ "table_body": "<table><tr><td>Method</td><td>E</td><td>μ</td><td>△</td><td>Emin</td></tr><tr><td>RDKit</td><td>0.81</td><td>0.52</td><td>0.75</td><td>1.16</td></tr><tr><td>OMEGA</td><td>0.68</td><td>0.66</td><td>0.68</td><td>0.69</td></tr><tr><td>GeoMol</td><td>0.42</td><td>0.34</td><td>0.59</td><td>0.40</td></tr><tr><td>GeoDiff</td><td>0.31</td><td>0.35</td><td>0.89</td><td>0.39</td></tr><tr><td>Tor. Diff.</td><td>0.22</td><td>0.35</td><td>0.54</td><td>0.13</td></tr></table>",
1091
+ "bbox": [
1092
+ 542,
1093
+ 390,
1094
+ 825,
1095
+ 489
1096
+ ],
1097
+ "page_idx": 8
1098
+ },
1099
+ {
1100
+ "type": "text",
1101
+ "text": "Compared to torsional diffusion, GeoMol similarly makes use of intrinsic coordinates. However, since GeoMol can only access the molecular graph, it is less suited for reasoning about relationships that emerge only in a spatial embedding, especially between regions of the molecule that are distant on the graph. Our extrinsic-to-intrinsic score framework—which gives direct access to spatial relationships—addresses precisely this issue. The empirical advantages are most evident for the large molecules in GEOM-XL, on which GeoMol fails to improve consistently over RDKit (Appendix H). On the other hand, because GeoMol requires only a single-forward pass, it retains the advantage of faster runtime compared to diffusion-based methods. ",
1102
+ "bbox": [
1103
+ 173,
1104
+ 525,
1105
+ 826,
1106
+ 636
1107
+ ],
1108
+ "page_idx": 8
1109
+ },
1110
+ {
1111
+ "type": "text",
1112
+ "text": "4.4 Ensemble properties ",
1113
+ "text_level": 1,
1114
+ "bbox": [
1115
+ 174,
1116
+ 651,
1117
+ 356,
1118
+ 666
1119
+ ],
1120
+ "page_idx": 8
1121
+ },
1122
+ {
1123
+ "type": "text",
1124
+ "text": "While RMSD gives a geometric way to evaluate ensemble quality, we also consider the chemical similarity between generated and ground truth ensembles. For a random 100-molecule subset of DRUGS, we generate $\\operatorname* { m i n } ( 2 K , 3 2 )$ conformers per molecule, relax the conformers with GFN2-xTB [Bannwarth et al., 2019],9 and compare the Boltzmann-weighted properties of the generated and ground truth ensembles. Specifically, the following properties are computed with xTB [Bannwarth et al., 2019]: energy $E$ , dipole moment $\\mu$ , HOMO-LUMO gap $\\Delta \\epsilon$ , and the minimum energy $E _ { \\mathrm { m i n } }$ . The median errors for torsional diffusion and the baselines are shown in Table 4. Our method produces the most chemically accurate ensembles, especially in terms of energy. In particular, we significantly improve over GeoMol and GeoDiff in finding the lowest-energy conformers that are only (on median) $0 . 1 3 \\mathrm { k c a l / m o l }$ higher in energy than the global minimum. ",
1125
+ "bbox": [
1126
+ 173,
1127
+ 678,
1128
+ 826,
1129
+ 816
1130
+ ],
1131
+ "page_idx": 8
1132
+ },
1133
+ {
1134
+ "type": "text",
1135
+ "text": "4.5 Torsional Boltzmann generator ",
1136
+ "text_level": 1,
1137
+ "bbox": [
1138
+ 174,
1139
+ 92,
1140
+ 429,
1141
+ 106
1142
+ ],
1143
+ "page_idx": 9
1144
+ },
1145
+ {
1146
+ "type": "text",
1147
+ "text": "Finally, we evaluate how well a torsional Boltzmann generator trained with MMFF [Halgren, 1996] energies can sample the corresponding Boltzmann density over torsion angles. We train and test on GEOMDRUGS molecules with 3–7 rotatable bonds and use the local structures of the first ground-truth conformers. For the baselines, we implement annealed importance samplers (AIS) [Neal, 2001] with MetropolisHastings steps over the torsional space and tune the variance of the transition kernels. ",
1148
+ "bbox": [
1149
+ 174,
1150
+ 116,
1151
+ 521,
1152
+ 255
1153
+ ],
1154
+ "page_idx": 9
1155
+ },
1156
+ {
1157
+ "type": "text",
1158
+ "text": "Table 4 shows the quality of the samplers in terms of the effective sample size (ESS) given by the weights of 32 samples for each test molecule, which measures the $\\alpha$ -divergence (with $\\alpha = 2$ ) between the model and Boltzmann distributions [Midgley et al., 2021]. Our method significantly outperforms the AIS baseline, and improves with increased step size despite being trained with only a 5-step resampler. Note that, since these evaluations are done on unseen molecules, they are beyond the capabilities of existing Boltzmann generators. ",
1159
+ "bbox": [
1160
+ 173,
1161
+ 261,
1162
+ 521,
1163
+ 316
1164
+ ],
1165
+ "page_idx": 9
1166
+ },
1167
+ {
1168
+ "type": "table",
1169
+ "img_path": "images/a96161e3e5067e855b0df46926643a8609886879e813c13d4d7cf74a87081837.jpg",
1170
+ "table_caption": [
1171
+ "Table 4: Effective sample size (out of 32) given by importance sampling weights over the torsional Boltzmann density. "
1172
+ ],
1173
+ "table_footnote": [],
1174
+ "table_body": "<table><tr><td colspan=\"3\"></td><td colspan=\"2\">Temp. (K)</td></tr><tr><td>Method</td><td>Steps</td><td>1000</td><td>500</td><td>300</td></tr><tr><td>Uniform</td><td>1</td><td>1.71</td><td>1.21</td><td>1.02</td></tr><tr><td rowspan=\"3\">AIS</td><td>5</td><td>2.20</td><td>1.36</td><td>1.18</td></tr><tr><td>20</td><td>3.12</td><td>1.76</td><td>1.30</td></tr><tr><td>100</td><td>6.72</td><td>3.12</td><td>2.06</td></tr><tr><td>Torsional</td><td>5</td><td>7.28</td><td>3.60</td><td>3.04</td></tr><tr><td>BG</td><td>20</td><td>11.42</td><td>6.42</td><td>4.68</td></tr></table>",
1175
+ "bbox": [
1176
+ 534,
1177
+ 162,
1178
+ 825,
1179
+ 309
1180
+ ],
1181
+ "page_idx": 9
1182
+ },
1183
+ {
1184
+ "type": "text",
1185
+ "text": "",
1186
+ "bbox": [
1187
+ 174,
1188
+ 316,
1189
+ 826,
1190
+ 372
1191
+ ],
1192
+ "page_idx": 9
1193
+ },
1194
+ {
1195
+ "type": "text",
1196
+ "text": "5 Conclusion ",
1197
+ "text_level": 1,
1198
+ "bbox": [
1199
+ 174,
1200
+ 391,
1201
+ 299,
1202
+ 407
1203
+ ],
1204
+ "page_idx": 9
1205
+ },
1206
+ {
1207
+ "type": "text",
1208
+ "text": "We presented torsional diffusion, a method for generating molecular conformers based on a diffusion process restricted to the most flexible degrees of freedom. Torsional diffusion is the first machine learning model to significantly outperform standard cheminformatics methods and is orders of magnitude faster than previous Euclidean diffusion models. Using the exact likelihoods provided by our model, we also train the first system-agnostic Boltzmann generator. ",
1209
+ "bbox": [
1210
+ 174,
1211
+ 422,
1212
+ 825,
1213
+ 492
1214
+ ],
1215
+ "page_idx": 9
1216
+ },
1217
+ {
1218
+ "type": "text",
1219
+ "text": "There are several exciting avenues for future work. A natural extension is to relax the rigid local structure assumption by developing an efficient diffusion-based model over the full space of intrinsic coordinates while still incorporating chemical constraints. Moreover, torsional diffusion—or similar ideas—could be applicable to larger molecular systems, for which fast, parsimonious models of structural flexibility could benefit applications such as drug discovery and protein design. ",
1220
+ "bbox": [
1221
+ 174,
1222
+ 498,
1223
+ 825,
1224
+ 568
1225
+ ],
1226
+ "page_idx": 9
1227
+ },
1228
+ {
1229
+ "type": "text",
1230
+ "text": "Acknowledgments ",
1231
+ "text_level": 1,
1232
+ "bbox": [
1233
+ 174,
1234
+ 587,
1235
+ 328,
1236
+ 604
1237
+ ],
1238
+ "page_idx": 9
1239
+ },
1240
+ {
1241
+ "type": "text",
1242
+ "text": "We pay tribute to Octavian-Eugen Ganea (1987-2022), dear colleague, mentor, and friend without whom this work would have never been possible. ",
1243
+ "bbox": [
1244
+ 174,
1245
+ 618,
1246
+ 823,
1247
+ 647
1248
+ ],
1249
+ "page_idx": 9
1250
+ },
1251
+ {
1252
+ "type": "text",
1253
+ "text": "We thank Hannes Stärk, Wenxian Shi, Xiang Fu, Felix Faltings, Jason Yim, Adam Fisch, Alex Wu, Jeremy Wohlwend, Peter Mikhael, and Saro Passaro for helpful feedback and discussions. We thank Lagnajit Pattanaik, Minkai Xu, and Simon Axelrod for their advice and support when working with, respectively, GeoMol, GeoDiff and the GEOM dataset. This work was supported by the Machine Learning for Pharmaceutical Discovery and Synthesis (MLPDS) consortium, the Abdul Latif Jameel Clinic for Machine Learning in Health, the DTRA Discovery of Medical Countermeasures Against New and Emerging (DOMANE) threats program, the DARPA Accelerated Molecular Discovery program and the Sanofi Computational Antibody Design grant. We acknowledge support from the Department of Energy Computational Science Graduate Fellowship (BJ), the Robert Shillman Fellowship (GC), and the NSF Graduate Research Fellowship (JC). ",
1254
+ "bbox": [
1255
+ 173,
1256
+ 652,
1257
+ 825,
1258
+ 791
1259
+ ],
1260
+ "page_idx": 9
1261
+ },
1262
+ {
1263
+ "type": "text",
1264
+ "text": "References ",
1265
+ "text_level": 1,
1266
+ "bbox": [
1267
+ 174,
1268
+ 89,
1269
+ 267,
1270
+ 106
1271
+ ],
1272
+ "page_idx": 10
1273
+ },
1274
+ {
1275
+ "type": "text",
1276
+ "text": "Brian DO Anderson. Reverse-time diffusion equation models. Stochastic Processes and their Applications, 1982. ",
1277
+ "bbox": [
1278
+ 174,
1279
+ 113,
1280
+ 823,
1281
+ 142
1282
+ ],
1283
+ "page_idx": 10
1284
+ },
1285
+ {
1286
+ "type": "text",
1287
+ "text": "Simon Axelrod and Rafael Gómez-Bombarelli. Geom, energy-annotated molecular conformations for property prediction and molecular generation. Scientific Data, 2022. ",
1288
+ "bbox": [
1289
+ 173,
1290
+ 150,
1291
+ 823,
1292
+ 179
1293
+ ],
1294
+ "page_idx": 10
1295
+ },
1296
+ {
1297
+ "type": "text",
1298
+ "text": "Christoph Bannwarth, Sebastian Ehlert, and Stefan Grimme. Gfn2-xtb—an accurate and broadly parametrized self-consistent tight-binding quantum chemical method with multipole electrostatics and density-dependent dispersion contributions. Journal of chemical theory and computation, 2019. ",
1299
+ "bbox": [
1300
+ 174,
1301
+ 188,
1302
+ 826,
1303
+ 242
1304
+ ],
1305
+ "page_idx": 10
1306
+ },
1307
+ {
1308
+ "type": "text",
1309
+ "text": "Simon Batzner, Albert Musaelian, Lixin Sun, Mario Geiger, Jonathan P Mailoa, Mordechai Kornbluth, Nicola Molinari, Tess E Smidt, and Boris Kozinsky. E (3)-equivariant graph neural networks for data-efficient and accurate interatomic potentials. Nature communications, 2022. ",
1310
+ "bbox": [
1311
+ 174,
1312
+ 251,
1313
+ 823,
1314
+ 295
1315
+ ],
1316
+ "page_idx": 10
1317
+ },
1318
+ {
1319
+ "type": "text",
1320
+ "text": "Evan E Bolton, Sunghwan Kim, and Stephen H Bryant. Pubchem3d: conformer generation. Journal of cheminformatics, 2011. ",
1321
+ "bbox": [
1322
+ 171,
1323
+ 303,
1324
+ 823,
1325
+ 332
1326
+ ],
1327
+ "page_idx": 10
1328
+ },
1329
+ {
1330
+ "type": "text",
1331
+ "text": "Sean M Carroll. Spacetime and geometry. Cambridge University Press, 2019. ",
1332
+ "bbox": [
1333
+ 174,
1334
+ 339,
1335
+ 686,
1336
+ 356
1337
+ ],
1338
+ "page_idx": 10
1339
+ },
1340
+ {
1341
+ "type": "text",
1342
+ "text": "Gregory S Chirikjian. Stochastic models, information theory, and Lie groups, volume 2: Analytic methods and modern applications, volume 2. Springer Science & Business Media, 2011. ",
1343
+ "bbox": [
1344
+ 171,
1345
+ 363,
1346
+ 823,
1347
+ 392
1348
+ ],
1349
+ "page_idx": 10
1350
+ },
1351
+ {
1352
+ "type": "text",
1353
+ "text": "Jason C Cole, Oliver Korb, Patrick McCabe, Murray G Read, and Robin Taylor. Knowledge-based conformer generation using the cambridge structural database. Journal of Chemical Information and Modeling, 2018. ",
1354
+ "bbox": [
1355
+ 173,
1356
+ 400,
1357
+ 823,
1358
+ 443
1359
+ ],
1360
+ "page_idx": 10
1361
+ },
1362
+ {
1363
+ "type": "text",
1364
+ "text": "David F Crouse. On implementing 2d rectangular assignment algorithms. IEEE Transactions on Aerospace and Electronic Systems, 2016. ",
1365
+ "bbox": [
1366
+ 169,
1367
+ 452,
1368
+ 823,
1369
+ 481
1370
+ ],
1371
+ "page_idx": 10
1372
+ },
1373
+ {
1374
+ "type": "text",
1375
+ "text": "Valentin De Bortoli, Emile Mathieu, Michael Hutchinson, James Thornton, Yee Whye Teh, and Arnaud Doucet. Riemannian score-based generative modeling. arXiv preprint, 2022. ",
1376
+ "bbox": [
1377
+ 171,
1378
+ 488,
1379
+ 823,
1380
+ 518
1381
+ ],
1382
+ "page_idx": 10
1383
+ },
1384
+ {
1385
+ "type": "text",
1386
+ "text": "Edward M Driggers, Stephen P Hale, Jinbo Lee, and Nicholas K Terrett. The exploration of macrocycles for drug discovery—an underexploited structural class. Nature Reviews Drug Discovery, 2008. ",
1387
+ "bbox": [
1388
+ 174,
1389
+ 526,
1390
+ 823,
1391
+ 568
1392
+ ],
1393
+ "page_idx": 10
1394
+ },
1395
+ {
1396
+ "type": "text",
1397
+ "text": "Octavian Ganea, Lagnajit Pattanaik, Connor Coley, Regina Barzilay, Klavs Jensen, William Green, and Tommi Jaakkola. Geomol: Torsional geometric generation of molecular 3d conformer ensembles. Advances in Neural Information Processing Systems, 2021. ",
1398
+ "bbox": [
1399
+ 176,
1400
+ 577,
1401
+ 823,
1402
+ 619
1403
+ ],
1404
+ "page_idx": 10
1405
+ },
1406
+ {
1407
+ "type": "text",
1408
+ "text": "Mario Geiger, Tess Smidt, Alby M., Benjamin Kurt Miller, Wouter Boomsma, Bradley Dice, Kostiantyn Lapchevskyi, Maurice Weiler, Michał Tyszkiewicz, Simon Batzner, Dylan Madisetti, Martin Uhrin, Jes Frellsen, Nuri Jung, Sophia Sanborn, Mingjian Wen, Josh Rackers, Marcel Rød, and Michael Bailey. Euclidean neural networks: e3nn, April 2022. URL https://doi.org/10.5281/zenodo.6459381. ",
1409
+ "bbox": [
1410
+ 173,
1411
+ 627,
1412
+ 826,
1413
+ 698
1414
+ ],
1415
+ "page_idx": 10
1416
+ },
1417
+ {
1418
+ "type": "text",
1419
+ "text": "Thomas A Halgren. Merck molecular force field. i. basis, form, scope, parameterization, and performance of mmff94. Journal of computational chemistry, 1996. ",
1420
+ "bbox": [
1421
+ 173,
1422
+ 707,
1423
+ 823,
1424
+ 736
1425
+ ],
1426
+ "page_idx": 10
1427
+ },
1428
+ {
1429
+ "type": "text",
1430
+ "text": "Paul CD Hawkins. Conformation generation: the state of the art. Journal of Chemical Information and Modeling, 2017. ",
1431
+ "bbox": [
1432
+ 173,
1433
+ 743,
1434
+ 823,
1435
+ 772
1436
+ ],
1437
+ "page_idx": 10
1438
+ },
1439
+ {
1440
+ "type": "text",
1441
+ "text": "Paul CD Hawkins and Anthony Nicholls. Conformer generation with omega: learning from the data set and the analysis of failures. Journal of chemical information and modeling, 2012. ",
1442
+ "bbox": [
1443
+ 171,
1444
+ 781,
1445
+ 823,
1446
+ 810
1447
+ ],
1448
+ "page_idx": 10
1449
+ },
1450
+ {
1451
+ "type": "text",
1452
+ "text": "Paul CD Hawkins, A Geoffrey Skillman, Gregory L Warren, Benjamin A Ellingson, and Matthew T Stahl. Conformer generation with omega: algorithm and validation using high quality structures from the protein databank and cambridge structural database. Journal of chemical information and modeling, 2010. ",
1453
+ "bbox": [
1454
+ 173,
1455
+ 818,
1456
+ 825,
1457
+ 875
1458
+ ],
1459
+ "page_idx": 10
1460
+ },
1461
+ {
1462
+ "type": "text",
1463
+ "text": "Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 2020. ",
1464
+ "bbox": [
1465
+ 176,
1466
+ 882,
1467
+ 823,
1468
+ 911
1469
+ ],
1470
+ "page_idx": 10
1471
+ },
1472
+ {
1473
+ "type": "text",
1474
+ "text": "Michael F Hutchinson. A stochastic estimator of the trace of the influence matrix for laplacian smoothing splines. Communications in Statistics-Simulation and Computation, 1989. ",
1475
+ "bbox": [
1476
+ 171,
1477
+ 90,
1478
+ 825,
1479
+ 119
1480
+ ],
1481
+ "page_idx": 11
1482
+ },
1483
+ {
1484
+ "type": "text",
1485
+ "text": "Bowen Jing, Stephan Eismann, Patricia Suriana, Raphael John Lamarre Townshend, and Ron Dror. Learning from protein structure with geometric vector perceptrons. In International Conference on Learning Representations, 2021. ",
1486
+ "bbox": [
1487
+ 178,
1488
+ 127,
1489
+ 823,
1490
+ 171
1491
+ ],
1492
+ "page_idx": 11
1493
+ },
1494
+ {
1495
+ "type": "text",
1496
+ "text": "Bowen Jing, Gabriele Corso, Renato Berlinghieri, and Tommi Jaakkola. Subspace diffusion generative models. arXiv preprint arXiv:2205.01490, 2022. ",
1497
+ "bbox": [
1498
+ 171,
1499
+ 179,
1500
+ 823,
1501
+ 208
1502
+ ],
1503
+ "page_idx": 11
1504
+ },
1505
+ {
1506
+ "type": "text",
1507
+ "text": "Leslie Kish. Survey sampling. Number 04; HN29, K5. 1965. ",
1508
+ "bbox": [
1509
+ 173,
1510
+ 217,
1511
+ 575,
1512
+ 233
1513
+ ],
1514
+ "page_idx": 11
1515
+ },
1516
+ {
1517
+ "type": "text",
1518
+ "text": "Jonas Köhler, Andreas Krämer, and Frank Noé. Smooth normalizing flows. Advances in Neural Information Processing Systems, 2021. ",
1519
+ "bbox": [
1520
+ 171,
1521
+ 241,
1522
+ 825,
1523
+ 270
1524
+ ],
1525
+ "page_idx": 11
1526
+ },
1527
+ {
1528
+ "type": "text",
1529
+ "text": "David Lagorce, Tania Pencheva, Bruno O Villoutreix, and Maria A Miteva. Dg-ammos: A new tool to generate 3d conformation of small molecules using d istance g eometry and a utomated m olecular m echanics o ptimization for in silico s creening. BMC Chemical Biology, 2009. ",
1530
+ "bbox": [
1531
+ 176,
1532
+ 277,
1533
+ 823,
1534
+ 321
1535
+ ],
1536
+ "page_idx": 11
1537
+ },
1538
+ {
1539
+ "type": "text",
1540
+ "text": "Greg Landrum et al. Rdkit: A software suite for cheminformatics, computational chemistry, and predictive modeling, 2013. ",
1541
+ "bbox": [
1542
+ 173,
1543
+ 329,
1544
+ 823,
1545
+ 358
1546
+ ],
1547
+ "page_idx": 11
1548
+ },
1549
+ {
1550
+ "type": "text",
1551
+ "text": "Jiabo Li, Tedman Ehlers, Jon Sutter, Shikha Varma-O’Brien, and Johannes Kirchmair. Caesar: a new conformer generation algorithm based on recursive buildup and local rotational symmetry consideration. Journal of chemical information and modeling, 2007. ",
1552
+ "bbox": [
1553
+ 174,
1554
+ 367,
1555
+ 823,
1556
+ 410
1557
+ ],
1558
+ "page_idx": 11
1559
+ },
1560
+ {
1561
+ "type": "text",
1562
+ "text": "Shitong Luo, Chence Shi, Minkai Xu, and Jian Tang. Predicting molecular conformation via dynamic graph score matching. Advances in Neural Information Processing Systems, 2021. ",
1563
+ "bbox": [
1564
+ 176,
1565
+ 417,
1566
+ 821,
1567
+ 448
1568
+ ],
1569
+ "page_idx": 11
1570
+ },
1571
+ {
1572
+ "type": "text",
1573
+ "text": "Oscar Méndez-Lucio, Mazen Ahmad, Ehecatl Antonio del Rio-Chanona, and Jörg Kurt Wegner. A geometric deep learning approach to predict binding conformations of bioactive molecules. Nature Machine Intelligence, 2021. ",
1574
+ "bbox": [
1575
+ 173,
1576
+ 455,
1577
+ 825,
1578
+ 500
1579
+ ],
1580
+ "page_idx": 11
1581
+ },
1582
+ {
1583
+ "type": "text",
1584
+ "text": "Laurence Illing Midgley, Vincent Stimper, Gregor NC Simm, and José Miguel Hernández-Lobato. Bootstrap your flow. arXiv preprint, 2021. ",
1585
+ "bbox": [
1586
+ 173,
1587
+ 507,
1588
+ 821,
1589
+ 536
1590
+ ],
1591
+ "page_idx": 11
1592
+ },
1593
+ {
1594
+ "type": "text",
1595
+ "text": "Maria A Miteva, Frederic Guyon, and Pierre Tuffery. Frog2: Efficient 3d conformation ensemble generator for small compounds. Nucleic acids research, 2010. ",
1596
+ "bbox": [
1597
+ 173,
1598
+ 545,
1599
+ 823,
1600
+ 574
1601
+ ],
1602
+ "page_idx": 11
1603
+ },
1604
+ {
1605
+ "type": "text",
1606
+ "text": "Radford M Neal. Annealed importance sampling. Statistics and computing, 2001. ",
1607
+ "bbox": [
1608
+ 173,
1609
+ 582,
1610
+ 714,
1611
+ 598
1612
+ ],
1613
+ "page_idx": 11
1614
+ },
1615
+ {
1616
+ "type": "text",
1617
+ "text": "Alex Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning, 2021. ",
1618
+ "bbox": [
1619
+ 173,
1620
+ 606,
1621
+ 820,
1622
+ 636
1623
+ ],
1624
+ "page_idx": 11
1625
+ },
1626
+ {
1627
+ "type": "text",
1628
+ "text": "Frank Noé, Simon Olsson, Jonas Köhler, and Hao Wu. Boltzmann generators: Sampling equilibrium states of many-body systems with deep learning. Science, 2019. ",
1629
+ "bbox": [
1630
+ 169,
1631
+ 643,
1632
+ 825,
1633
+ 672
1634
+ ],
1635
+ "page_idx": 11
1636
+ },
1637
+ {
1638
+ "type": "text",
1639
+ "text": "Philipp Pracht, Fabian Bohle, and Stefan Grimme. Automated exploration of the low-energy chemical space with fast quantum chemical methods. Physical Chemistry Chemical Physics, 2020. ",
1640
+ "bbox": [
1641
+ 174,
1642
+ 681,
1643
+ 823,
1644
+ 710
1645
+ ],
1646
+ "page_idx": 11
1647
+ },
1648
+ {
1649
+ "type": "text",
1650
+ "text": "Martin Quack. How important is parity violation for molecular and biomolecular chirality? Angewandte Chemie International Edition, 2002. ",
1651
+ "bbox": [
1652
+ 171,
1653
+ 718,
1654
+ 823,
1655
+ 747
1656
+ ],
1657
+ "page_idx": 11
1658
+ },
1659
+ {
1660
+ "type": "text",
1661
+ "text": "Sereina Riniker and Gregory A Landrum. Better informed distance geometry: using what we know to improve conformation generation. Journal of chemical information and modeling, 2015. ",
1662
+ "bbox": [
1663
+ 173,
1664
+ 756,
1665
+ 823,
1666
+ 786
1667
+ ],
1668
+ "page_idx": 11
1669
+ },
1670
+ {
1671
+ "type": "text",
1672
+ "text": "Tim Salimans and Jonathan Ho. Progressive distillation for fast sampling of diffusion models. In International Conference on Learning Representations, 2022. ",
1673
+ "bbox": [
1674
+ 174,
1675
+ 792,
1676
+ 823,
1677
+ 823
1678
+ ],
1679
+ "page_idx": 11
1680
+ },
1681
+ {
1682
+ "type": "text",
1683
+ "text": "Vıctor Garcia Satorras, Emiel Hoogeboom, and Max Welling. E (n) equivariant graph neural networks. In International Conference on Machine Learning, 2021. ",
1684
+ "bbox": [
1685
+ 174,
1686
+ 830,
1687
+ 821,
1688
+ 861
1689
+ ],
1690
+ "page_idx": 11
1691
+ },
1692
+ {
1693
+ "type": "text",
1694
+ "text": "Kristof Schütt, Pieter-Jan Kindermans, Huziel Enoc Sauceda Felix, Stefan Chmiela, Alexandre Tkatchenko, and Klaus-Robert Müller. Schnet: A continuous-filter convolutional neural network for modeling quantum interactions. Advances in neural information processing systems, 2017. ",
1695
+ "bbox": [
1696
+ 176,
1697
+ 868,
1698
+ 825,
1699
+ 911
1700
+ ],
1701
+ "page_idx": 11
1702
+ },
1703
+ {
1704
+ "type": "text",
1705
+ "text": "Chence Shi, Shitong Luo, Minkai Xu, and Jian Tang. Learning gradient fields for molecular conformation generation. In International Conference on Machine Learning, 2021. ",
1706
+ "bbox": [
1707
+ 173,
1708
+ 90,
1709
+ 825,
1710
+ 119
1711
+ ],
1712
+ "page_idx": 12
1713
+ },
1714
+ {
1715
+ "type": "text",
1716
+ "text": "Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in Neural Information Processing Systems, 2019. ",
1717
+ "bbox": [
1718
+ 171,
1719
+ 128,
1720
+ 825,
1721
+ 159
1722
+ ],
1723
+ "page_idx": 12
1724
+ },
1725
+ {
1726
+ "type": "text",
1727
+ "text": "Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. International Conference on Learning Representations, 2021. ",
1728
+ "bbox": [
1729
+ 178,
1730
+ 165,
1731
+ 825,
1732
+ 209
1733
+ ],
1734
+ "page_idx": 12
1735
+ },
1736
+ {
1737
+ "type": "text",
1738
+ "text": "Hannes Stärk, Octavian-Eugen Ganea, Lagnajit Pattanaik, Regina Barzilay, and Tommi Jaakkola. Equibind: Geometric deep learning for drug binding structure prediction. In International Conference on Machine Learning, 2022. ",
1739
+ "bbox": [
1740
+ 176,
1741
+ 217,
1742
+ 825,
1743
+ 261
1744
+ ],
1745
+ "page_idx": 12
1746
+ },
1747
+ {
1748
+ "type": "text",
1749
+ "text": "Nathaniel Thomas, Tess Smidt, Steven Kearnes, Lusann Yang, Li Li, Kai Kohlhoff, and Patrick Riley. Tensor field networks: Rotation-and translation-equivariant neural networks for 3d point clouds. arXiv preprint, 2018. ",
1750
+ "bbox": [
1751
+ 173,
1752
+ 268,
1753
+ 825,
1754
+ 311
1755
+ ],
1756
+ "page_idx": 12
1757
+ },
1758
+ {
1759
+ "type": "text",
1760
+ "text": "Arash Vahdat, Karsten Kreis, and Jan Kautz. Score-based generative modeling in latent space. In Advances in Neural Information Processing Systems, 2021. ",
1761
+ "bbox": [
1762
+ 171,
1763
+ 319,
1764
+ 823,
1765
+ 349
1766
+ ],
1767
+ "page_idx": 12
1768
+ },
1769
+ {
1770
+ "type": "text",
1771
+ "text": "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, 2017. ",
1772
+ "bbox": [
1773
+ 173,
1774
+ 357,
1775
+ 825,
1776
+ 400
1777
+ ],
1778
+ "page_idx": 12
1779
+ },
1780
+ {
1781
+ "type": "text",
1782
+ "text": "Minkai Xu, Shitong Luo, Yoshua Bengio, Jian Peng, and Jian Tang. Learning neural generative dynamics for molecular conformation generation. In International Conference on Learning Representations, 2021a. ",
1783
+ "bbox": [
1784
+ 173,
1785
+ 409,
1786
+ 825,
1787
+ 452
1788
+ ],
1789
+ "page_idx": 12
1790
+ },
1791
+ {
1792
+ "type": "text",
1793
+ "text": "Minkai Xu, Wujie Wang, Shitong Luo, Chence Shi, Yoshua Bengio, Rafael Gomez-Bombarelli, and Jian Tang. An end-to-end framework for molecular conformation generation via bilevel programming. In International Conference on Machine Learning, 2021b. ",
1794
+ "bbox": [
1795
+ 173,
1796
+ 460,
1797
+ 825,
1798
+ 503
1799
+ ],
1800
+ "page_idx": 12
1801
+ },
1802
+ {
1803
+ "type": "text",
1804
+ "text": "Minkai Xu, Lantao Yu, Yang Song, Chence Shi, Stefano Ermon, and Jian Tang. Geodiff: A geometric diffusion model for molecular conformation generation. In International Conference on Learning Representations, 2022. ",
1805
+ "bbox": [
1806
+ 174,
1807
+ 511,
1808
+ 825,
1809
+ 555
1810
+ ],
1811
+ "page_idx": 12
1812
+ },
1813
+ {
1814
+ "type": "text",
1815
+ "text": "Checklist ",
1816
+ "text_level": 1,
1817
+ "bbox": [
1818
+ 174,
1819
+ 89,
1820
+ 254,
1821
+ 106
1822
+ ],
1823
+ "page_idx": 13
1824
+ },
1825
+ {
1826
+ "type": "text",
1827
+ "text": "1. For all authors... ",
1828
+ "bbox": [
1829
+ 214,
1830
+ 116,
1831
+ 339,
1832
+ 130
1833
+ ],
1834
+ "page_idx": 13
1835
+ },
1836
+ {
1837
+ "type": "text",
1838
+ "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 Appendix F \n(c) Did you discuss any potential negative societal impacts of your work? [Yes] Conformer generation is useful for many scientific applications, some of which could have negative societal impacts. \n(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] ",
1839
+ "bbox": [
1840
+ 238,
1841
+ 135,
1842
+ 825,
1843
+ 253
1844
+ ],
1845
+ "page_idx": 13
1846
+ },
1847
+ {
1848
+ "type": "text",
1849
+ "text": "2. If you are including theoretical results... ",
1850
+ "bbox": [
1851
+ 214,
1852
+ 257,
1853
+ 493,
1854
+ 272
1855
+ ],
1856
+ "page_idx": 13
1857
+ },
1858
+ {
1859
+ "type": "text",
1860
+ "text": "(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Appendix B. (b) Did you include complete proofs of all theoretical results? [Yes] See Appendix B. ",
1861
+ "bbox": [
1862
+ 238,
1863
+ 276,
1864
+ 825,
1865
+ 321
1866
+ ],
1867
+ "page_idx": 13
1868
+ },
1869
+ {
1870
+ "type": "text",
1871
+ "text": "3. If you ran experiments... ",
1872
+ "bbox": [
1873
+ 212,
1874
+ 325,
1875
+ 393,
1876
+ 340
1877
+ ],
1878
+ "page_idx": 13
1879
+ },
1880
+ {
1881
+ "type": "text",
1882
+ "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] The code can be found at https://github.com/gcorso/torsional-diffusion. \n(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix G. \n(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Appendix H. \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] Approximately 2000 GPU-hours on an internal cluster. ",
1883
+ "bbox": [
1884
+ 238,
1885
+ 344,
1886
+ 825,
1887
+ 489
1888
+ ],
1889
+ "page_idx": 13
1890
+ },
1891
+ {
1892
+ "type": "text",
1893
+ "text": "4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... ",
1894
+ "bbox": [
1895
+ 215,
1896
+ 494,
1897
+ 823,
1898
+ 510
1899
+ ],
1900
+ "page_idx": 13
1901
+ },
1902
+ {
1903
+ "type": "text",
1904
+ "text": "(a) If your work uses existing assets, did you cite the creators? [Yes] \n(b) Did you mention the license of the assets? [Yes] We used the code and data released by GeoMol and GeoDiff released under MIT license and the GEOM datasets released under CC0 1.0 license. \n(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] See the instructions in our repository https://github.com/gcorso/ torsional-diffusion. \n(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] All data used is open-source. \n(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] No personal data is used. ",
1905
+ "bbox": [
1906
+ 238,
1907
+ 513,
1908
+ 825,
1909
+ 675
1910
+ ],
1911
+ "page_idx": 13
1912
+ },
1913
+ {
1914
+ "type": "text",
1915
+ "text": "5. If you used crowdsourcing or conducted research with human subjects... ",
1916
+ "bbox": [
1917
+ 214,
1918
+ 680,
1919
+ 705,
1920
+ 694
1921
+ ],
1922
+ "page_idx": 13
1923
+ },
1924
+ {
1925
+ "type": "text",
1926
+ "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] ",
1927
+ "bbox": [
1928
+ 238,
1929
+ 699,
1930
+ 825,
1931
+ 787
1932
+ ],
1933
+ "page_idx": 13
1934
+ }
1935
+ ]
parse/dev/yb3HOXO3lX2/yb3HOXO3lX2.md ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Defining and Characterizing Reward Hacking
2
+
3
+ Joar Skalse∗ University of Oxford
4
+
5
+ Nikolaus H. R. Howe Mila, Université de Montréal
6
+
7
+ Dmitrii Krasheninnikov University of Cambridge
8
+
9
+ David Krueger∗ University of Cambridge
10
+
11
+ # Abstract
12
+
13
+ We provide the first formal definition of reward hacking, a phenomenon where optimizing an imperfect proxy reward function, $\tilde { \mathcal { R } }$ , leads to poor performance according to the true reward function, $\mathcal { R }$ . We say that a proxy is unhackable if increasing the expected proxy return can never decrease the expected true return. Intuitively, it might be possible to create an unhackable proxy by leaving some terms out of the reward function (making it “narrower”) or overlooking fine-grained distinctions between roughly equivalent outcomes, but we show this is usually not the case. A key insight is that the linearity of reward (in state-action visit counts) makes unhackability a very strong condition. In particular, for the set of all stochastic policies, two reward functions can only be unhackable if one of them is constant. We thus turn our attention to deterministic policies and finite sets of stochastic policies, where non-trivial unhackable pairs always exist, and establish necessary and sufficient conditions for the existence of simplifications, an important special case of unhackability. Our results reveal a tension between using reward functions to specify narrow tasks and aligning AI systems with human values.
14
+
15
+ # 1 Introduction
16
+
17
+ It is well known that optimising a proxy can lead to unintended outcomes: a boat spins in circles collecting “powerups” instead of following the race track in a racing game (Clark and Amodei, 2016); an evolved circuit listens in on radio signals from nearby computers’ oscillators instead of building its own (Bird and Layzell, 2002); universities reject the most qualified applicants in order to appear more selective and boost their ratings (Golden, 2001). In the context of reinforcement learning (RL), such failures are called reward hacking.
18
+
19
+ For AI systems that take actions in safety-critical real world environments such as autonomous vehicles, algorithmic trading, or content recommendation systems, these unintended outcomes can be catastrophic. This makes it crucial to align autonomous AI systems with their users’ intentions. Precisely specifying which behaviours are or are not desirable is challenging, however. One approach to this specification problem is to learn an approximation of the true reward function $\mathrm { N g }$ et al., 2000; Ziebart, 2010; Leike et al., 2018). Optimizing a learned proxy reward can be dangerous, however; for instance, it might overlook side-effects (Krakovna et al., 2018; Turner et al., 2019) or encourage power-seeking (Turner et al., 2021) behavior. This raises the question motivating our work: When is it safe to optimise a proxy?
20
+
21
+ To begin to answer this question, we consider a somewhat simpler one: When could optimising a proxy lead to worse behaviour? “Optimising”, in this context, does not refer to finding a global, or even local, optimum, but rather running a search process, such as stochastic gradient descent (SGD), that yields a sequence of candidate policies, and tends to move towards policies with higher (proxy) reward. We make no assumptions about the path through policy space that optimisation takes.1 Instead, we ask whether there is any way in which improving a policy according to the proxy could make the policy worse according to the true reward; this is equivalent to asking if there exists a pair of policies $\pi _ { 1 } , \pi _ { 2 }$ where the proxy prefers $\pi _ { 1 }$ , but the true reward function prefers $\pi _ { 2 }$ . When this is the case, we refer to this pair of true reward function and proxy reward function as hackable.
22
+
23
+ Given the strictness of our definition, it is not immediately apparent that any non-trivial examples of unhackable reward function pairs exist. And indeed, if we consider the set of all stochastic policies, they do not (Section 5.1). However, restricting ourselves to any finite set of policies guarantees at least one non-trivial unhackable pair (Section 5.2).
24
+
25
+ Intuitively, we might expect the proxy to be a “simpler” version of the true reward function. Noting that the definition of unhackability is symmetric, we introduce the asymmetric special case of simplification, and arrive at similar theoretical results for this notion.2 In the process, and through examples, we show that seemingly natural ways of simplifying reward functions often fail to produce simplifications in our formal sense, and in fact fail to rule out the potential for reward hacking.
26
+
27
+ We conclude with a discussion of the implications and limitations of our work. Briefly, our work suggests that a proxy reward function must satisfy demanding standards in order for it to be safe to optimize. This in turn implies that the reward functions learned by methods such as reward modeling and inverse RL are perhaps best viewed as auxiliaries to policy learning, rather than specifications that should be optimized. This conclusion is weakened, however, by the conservativeness of our chosen definitions; future work should explore when hackable proxies can be shown to be safe in a probabilistic or approximate sense, or when subject to only limited optimization.
28
+
29
+ # 2 Example: Cleaning Robot
30
+
31
+ Consider a household robot tasked with cleaning a house with three rooms: Attic , Bedroom , and Kitchen . The robot’s (deterministic) policy is a vector indicating which rooms it cleans: $\pi = [ \pi _ { 1 } , \pi _ { 2 } , \pi _ { 3 } ] \in \{ 0 , 1 \} ^ { 3 }$ . The robot receives a (non-negative) reward of $r _ { 1 } , r _ { 2 } , r _ { 3 }$ for cleaning the attic, bedroom, and kitchen, respectively, and the total reward is given by $J ( \pi ) = \pi \cdot r$ . For example, if $r = [ 1 , 2 , 3 ]$ and the robot cleans the attic and the kitchen, it receives a reward of $1 + 3 = 4$ .
32
+
33
+ ![](images/2a5f0e758cee8782cce498bb9938b27dbbee3e5a66d2693a4acc5b08165ab7ec.jpg)
34
+ Figure 1: An illustration of hackable and unhackable proxy rewards arising from overlooking rewarding features. A human wants their house cleaned. In (a), the robot draws an incorrect conclusion because of the proxy; this could lead to hacking. In (b), no such hacking can occur: the proxy is unhackable.
35
+
36
+ At least two ideas come to mind when thinking about “simplifying” a reward function. The first one is overlooking rewarding features: suppose the true reward is equal for all the rooms, $r _ { \mathrm { t r u e } } = [ 1 , 1 , 1 ]$ , but we only ask the robot to clean the attic and bedroom, $r _ { \mathrm { p r o x y } } = [ 1 , 1 , 0 ]$ . In this case, $r _ { \mathrm { p r o x y } }$ and $r _ { \mathrm { t r u e } }$ are unhackable. However, if we ask the robot to only clean the attic, $r _ { \mathrm { p r o x y } } = [ 1 , 0 , 0 ]$ , this is hackable with respect to $r _ { \mathrm { t r u e } }$ . To see this, note that according to $r _ { \mathrm { p r o x y } }$ cleaning the attic $\begin{array} { r } { J _ { \mathrm { p r o x y } } = 1 } \end{array}$ ) is better than cleaning the bedroom and the kitchen $\mathbf { \nabla } _ { J _ { \mathrm { p r o x y } } } = 0 _ { \cdot } ^ { \cdot }$ . Yet, $r _ { \mathrm { t r u e } }$ says that cleaning the attic $J _ { \mathrm { t r u e } } = 1 )$ is worse than cleaning the bedroom and the kitchen $J _ { \mathrm { t r u e } } = 2$ ). This situation is illustrated in Figure 1.
37
+
38
+ The second seemingly natural way to simplify a reward function is overlooking fine details: suppose $r _ { \mathrm { t r u e } } = [ 1 , 1 . 5 , 2 ]$ , and we ask the robot to clean all the rooms, $r _ { \mathrm { p r o x y } } = [ 1 , 1 , 1 ]$ . For these values, the proxy and true reward are unhackable. However, with a slightly less balanced true reward function such as $r _ { \mathrm { t r u e } } = [ 1 , 1 . 5 , 3 ]$ the proxy does lead to hacking, since the robot would falsely calculate that it’s better to clean the attic and the bedroom than the kitchen alone.
39
+
40
+ These two examples illustrate that while simplification of reward functions is sometimes possible, attempts at simplification can easily lead to reward hacking. Intuitively, omitting/overlooking details is okay so long as all these details are not as important together as any of the details that we do share. In general, it is not obvious what the proxy must look like to avoid reward hacking, suggesting we should take great care when using proxies. For this specific environment, a proxy and a true reward are hackable exactly when there are two sets of rooms $S _ { 1 } , S _ { 2 }$ such that the true reward gives strictly higher value to cleaning $S _ { 1 }$ than it does to cleaning $S _ { 2 }$ , and the proxy says the opposite: $J _ { 1 } ( S _ { 1 } ) > J _ { 1 } ( S _ { 2 } )$ & $J _ { 2 } ( S _ { 1 } ) < J _ { 2 } ( S _ { 2 } )$ . For a proof of this statement, see Appendix D.2.1.
41
+
42
+ # 3 Related Work
43
+
44
+ While we are the first to define hackability, we are far from the first to study specification hacking. The observation that optimizing proxy metrics tends to lead to perverse instantiations is often called “Goodhart’s Law”, and is attributed to Goodhart (1975). Manheim and Garrabrant (2018) provide a list of four mechanisms underlying this observation.
45
+
46
+ Examples of such unintended behavior abound in both RL and other areas of AI; Krakovna et al. (2020) provide an extensive list. Notable recent instances include a robot positioning itself between the camera and the object it is supposed to grasp in a way that tricks the reward model (Amodei et al., 2017), the previously mentioned boat race example (Clark and Amodei, 2016), and a multitude of examples of reward model hacking in Atari (Ibarz et al., 2018). Reward hacking can occur suddenly. Ibarz et al. (2018) and Pan et al. (2022) showcase plots similar to one in Figure 2, where optimizing the proxy (either a learned reward model or a hand-specified reward function) first leads to both proxy and true rewards increasing, and then to a sudden phase transition where the true reward collapses while the proxy continues going up.
47
+
48
+ ![](images/91122212aa3faa9f5a3fd2b3142b3468096faf9fec6bf16d8fc4971e765a5ce8.jpg)
49
+ Figure 2: An illustration of reward hacking when optimizing a hackable proxy. The true reward first increases and then drops off, while the proxy reward continues to increase.
50
+
51
+ Note that not all of these examples correspond to optimal behavior according to the proxy. Indeed, convergence to suboptimal policies is a well-known issue in RL (Thrun and Schwartz, 1993). As a consequence, improving optimization often leads to unexpected, qualitative changes in behavior. For instance, Zhang et al. (2021) demonstrate a novel cartwheeling behavior in the widely studied Half-Cheetah environment that exceeds previous performance so greatly that it breaks the simulator. The unpredictability of RL optimization is a key motivation for our definition of hackability, since we cannot assume that agents will find an optimal policy. Neither can we rule out the possibility of sudden improvements in proxy reward and corresponding qualitative changes in behavior. Unhackability could provide confidence that reward hacking will not occur despite these challenges.
52
+
53
+ Despite the prevalence and potential severity of reward hacking, to our knowledge Pan et al. (2022) provide the first peer-reviewed work that focuses specifically on it, although Everitt et al. (2017) tackle the closely related issue of reward corruption. The work of Pan et al. (2022) is purely empirical; they manually construct proxy rewards for several diverse environments, and evaluate whether optimizing these proxies leads to reward hacking; in 5 out of 9 of their settings, it does. In another closely related work, Zhuang and Hadfield-Menell (2020) examine what happens when the proxy reward function depends on a strict subset of features relevant for the true reward. They show that optimizing the proxy reward can lead to arbitrarily low true reward under suitable assumptions. This can be seen as a seemingly valid simplification of the true reward that turns out to be (highly) hackable. While their result only applies to environments with decreasing marginal utility and increasing opportunity cost, we demonstrate hackability is an issue in arbitrary MDPs.
54
+
55
+ Hackability is particularly concerning given arguments that reward optimizing behavior tends to be power-seeking (Turner et al., 2021). But Leike et al. (2018) establish that any desired behavior (power-seeking or not) can in principle be specified as optimal via a reward function.3 However, unlike us, they do not consider the entire policy preference ordering. Meanwhile, Abel et al. (2021) note that Markov reward functions cannot specify arbitrary orderings over policies or trajectories, although they do not consider hackability. Previous works consider reward functions to be equivalent if they preserve the ordering over policies (Ng et al., 1999, 2000). Unhackability relaxes this, allowing equalities to be refined to inequalities, and vice versa. Unhackability provides a notion of what it means to be “aligned enough”; Brown et al. (2020b) provide an alternative. They say a policy is $\varepsilon$ -value aligned if its value at every state is close enough to optimal (according to the true reward function). Neither notion implies the other.
56
+
57
+ Reward tampering (Everitt et al., 2017; Kumar et al., 2020; Uesato et al., 2020; Everitt et al., 2021) can be viewed as a special case of reward hacking, and refers to an agent corrupting the process generating reward signals, e.g. by tampering with sensors, memory registers storing the reward signal, or other hardware. Everitt et al. (2017) introduce the Corrupt Reward MDP (CRMDP), to model this possibility. A CRMDP distinguishes corrupted and uncorrupted rewards; these are exactly analogous to the proxy and true reward discussed in our work and others. Leike et al. (2018) distinguish reward tampering from reward gaming, where an agent achieves inappropriately high reward without tampering. However, in principle, a reward function could prohibit all forms of tampering if the effects of tampering are captured in the state. So this distinction is somewhat imprecise, and the CRMDP framework is general enough to cover both forms of hacking.
58
+
59
+ Our notion of simplification bears a close resemblance to quantilization (Taylor, 2016). Quantilization returns a random policy from the top $\mathrm { n } \%$ best policies. This is similar to equating the values of those policies, but a simplification may also equate the values of the bottom/middle $\mathrm { n } \%$ , etc. Thus simplification may achieve a similar effect to quantilization without assuming that we are free to choose from among the best policies.
60
+
61
+ # 4 Preliminaries
62
+
63
+ We begin with an overview of reinforcement learning (RL) to establish our notation and terminology.
64
+ Section 4.2 introduces our novel definitions of hackability and simplification.
65
+
66
+ # 4.1 Reinforcement Learning
67
+
68
+ We expect readers to be familiar with the basics of RL, which can be found in Sutton and Barto (2018). RL methods attempt to solve a sequential decision problem, typically formalised as a Markov decision process (MDP) , which is a tuple $( S , A , T , I , \mathcal { R } , \gamma )$ where $S$ is a set of states, $A$ is a set of actions, $T : S \times A \to \Delta ( S )$ is a transition function, $I \in \Delta ( S )$ is an initial state distribution, $\mathcal { R }$ is a reward function, the most general form of which is $\mathcal { R } : S \times A \times S \Delta ( \mathbb { R } )$ , and $\gamma \in [ 0 , 1 ]$ is the discount factor. Here $\Delta ( X )$ is the set of all distributions over $X$ . A stationary policy is a function $\pi : S \to \Delta ( A )$ that specifies a distribution over actions in each state, and a non-stationary policy is a function $\vec { \pi } : ( S \times \bar { A } ) ^ { * } \times S \Delta ( A )$ , where $^ *$ is the Kleene star. A trajectory $\tau$ is a path $s _ { 0 } , a _ { 0 } , r _ { 0 } , \ldots$ through the MDP tnted sum of rewards ding to , and th $T , I ,$ , and ue of $\mathcal { R }$ . The return of a trajectorypolicy is the expected return $\begin{array} { r } { G ( \tau ) \dot { = } \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r _ { t } } \end{array}$
69
+ $J ( \pi ) \doteq \mathbb { E } _ { \tau \sim \pi } [ G ( \tau ) ]$ . We derive policy (preference) orderings from reward functions by ordering policies according to their value. In this paper, we assume that $S$ and $A$ are finite, that $| { \cal A } | > 1$ , that all states are reachable, and that $\mathcal { R } ( s , a , s ^ { \prime } )$ has finite mean for all $s , a , s ^ { \prime }$ .
70
+
71
+ In our work, we consider various reward functions for a given environment, which is then formally a Markov decision process without reward $M D P \setminus \overline { { \mathcal { R } } } \doteq ( S , A , T , I , \_ , \gamma )$ . Having fixed an $M D P \setminus \mathcal { R }$ , any reward function can be viewed as a function of only the current state and action by marginalizing over transitions: $\begin{array} { r } { \mathcal { R } ( s , a ) \doteq \sum _ { s ^ { \prime } \sim T ( s ^ { \prime } \mid s , a ) } \mathcal { R } ( s , a , s ^ { \prime } ) } \end{array}$ , we adopt this view from here on. We define the (discounted) visit counts of a policy as $\begin{array} { r } { \mathcal { F } ^ { \pi } ( s , a ) \doteq \mathbb { E } _ { \tau \sim \pi } [ \sum _ { i = 0 } ^ { \infty } \gamma ^ { i } \mathbb { 1 } ( s _ { i } = s , a _ { i } = a ) ] } \end{array}$ Note that $\begin{array} { r } { J ( \pi ) = \sum _ { s , a } \mathcal { R } ( s , a ) \mathcal { F } ^ { \pi } ( s , a ) } \end{array}$ , which we also write as $\langle \mathcal { R } , \mathcal { F } ^ { \pi } \rangle$ . When considering multiple reward functions in an $M D P \setminus \mathcal { R }$ , we define $J _ { \mathcal { R } } ( \pi ) \doteq \langle \mathcal { R } , \mathcal { F } ^ { \pi } \rangle$ and sometimes use
72
+
73
+ $J _ { i } ( \pi ) \doteq \langle { \mathcal { R } } _ { i } , { \mathcal { F } } ^ { \pi } \rangle$ as shorthand. We also use $\mathcal { F } : \Pi \mathbb { R } ^ { | S | | A | }$ to denote the embedding of policies into Euclidean space via their visit counts, and define $\mathcal { F } ( \dot { \Pi } ) \doteq \{ \mathcal { F } ( \pi : \pi \in \dot { \Pi } ) \}$ for any $\dot { \Pi }$ . Moreover, we also use a second way to embed policies into Euclidean space; let $\mathcal { G } ( \pi )$ be the $| S | | A |$ -dimensional vector where $\mathcal { G } ( \pi ) [ s , a ] = \pi ( a \mid s )$ , and let $\mathcal { G } ( \dot { \Pi } ) \doteq \{ \mathcal { G } ( \pi : \pi \in \dot { \Pi } ) \}$ .
74
+
75
+ # 4.2 Definitions and Basic Properties of Hackability and Simplification
76
+
77
+ Here, we formally define hackability as a binary relation between reward functions.
78
+
79
+ Definition 1. A pair of reward functions $\mathcal { R } _ { 1 } , \mathcal { R } _ { 2 }$ are hackable relative to policy set $\Pi$ and an environment $( S , A , T , I , \_ , \gamma )$ if there exist $\pi , \pi ^ { \prime } \in \Pi$ such that
80
+
81
+ $$
82
+ J _ { 1 } ( \pi ) < J _ { 1 } ( \pi ^ { \prime } ) \& J _ { 2 } ( \pi ) > J _ { 2 } ( \pi ^ { \prime } ) ,
83
+ $$
84
+
85
+ else they are unhackable.
86
+
87
+ Note that an unhackable reward pair can have $J _ { 1 } ( \pi ) < J _ { 1 } ( \pi ^ { \prime } ) \& J _ { 2 } ( \pi ) = J _ { 2 } ( \pi ^ { \prime } )$ or vice versa. Unhackability is symmetric; this can be seen be swapping $\pi$ and $\pi ^ { \prime }$ in Definition 1. It is not transitive, however. In particular, the constant reward function is unhackable with respect to any other reward function, so if it were transitive, any pair of policies would be unhackable. Additionally, we say that $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ are equivalent on a set of policies $\Pi$ if $J _ { 1 }$ and $J _ { 2 }$ induce the same ordering of $\Pi$ , and that $\mathcal { R }$ is trivial on $\Pi$ if $J ( \pi ) = J ( \pi ^ { \prime } )$ for all $\pi , \pi ^ { \prime } \in \Pi$ . It is clear that $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ are unhackable whenever they are equivalent, or one of them is trivial, but this is relatively uninteresting. Our central question is if and when there are other unhackable reward pairs.
88
+
89
+ The symmetric nature of this definition is counter-intuitive, given that our motivation distinguishes the proxy and true reward functions. We might break this symmetry by only considering policy sequences that monotonically increase the proxy, however, this is equivalent to our original definition of hackability: think of $\mathcal { R } _ { 1 }$ as the proxy, and consider the sequence $\pi , \pi ^ { \prime }$ . We could also restrict ourselves to policies that are approximately optimal according to the proxy; Corollary 2 shows that Theorem 1 applies regardless of this restriction. Finally, we define simplification as an asymmetric special-case of unhackability; Theorem 3 shows this is in fact a more demanding condition.
90
+
91
+ Definition 2. $\mathcal { R } _ { 2 }$ is a simplification of $\mathcal { R } _ { 1 }$ relative to policy set $\Pi$ if for all $\pi , \pi ^ { \prime } \in \Pi$ ,
92
+
93
+ $$
94
+ J _ { 1 } ( \pi ) < J _ { 1 } ( \pi ^ { \prime } ) \implies J _ { 2 } ( \pi ) \le J _ { 2 } ( \pi ^ { \prime } ) \ \& \ J _ { 1 } ( \pi ) = J _ { 1 } ( \pi ^ { \prime } ) \implies J _ { 2 } ( \pi ) = J _ { 2 } ( \pi ^ { \prime } )
95
+ $$
96
+
97
+ and there exist $\pi , \pi ^ { \prime } \in \Pi$ such that $J _ { 2 } ( \pi ) = J _ { 2 } ( \pi ^ { \prime } )$ but $J _ { 1 } ( \pi ) \ne J _ { 1 } ( \pi ^ { \prime } )$ . Moreover, if $\mathcal { R } _ { 2 }$ is trivial then we say that this is a trivial simplification.
98
+
99
+ Intuitively, while unhackability allows replacing inequality with equality – or vice versa – a simplification can only replace inequalities with equality, collapsing distinctions between policies. When $\mathcal { R } _ { 1 }$ is a simplification of $\mathcal { R } _ { 2 }$ , we also say that $\mathcal { R } _ { 2 }$ is a refinement of $\mathcal { R } _ { 1 }$ . We denote this relationship as $\mathcal { R } _ { 1 } \leq \mathcal { R } _ { 2 }$ or $\mathcal { R } _ { 2 } \ \trianglerighteq { \mathcal { R } _ { 1 } }$ ; the narrowing of the triangle at $R _ { 1 }$ represents the collapsing of distinctions between policies. If $\mathcal { R } _ { 1 } \overset { \vartriangle } { \ v u } \overset { \vartriangle } { \ v u } \mathcal { R } _ { 2 } \overset { \vartriangle } { \ v u } \geq \mathcal { R } _ { 3 }$ , then we have that $\mathcal { R } _ { 1 } , \mathcal { R } _ { 3 }$ are unhackable,4 but if $\mathcal { R } _ { 1 } \trianglerighteq { 2 } \mathcal { R } _ { 2 } \triangleleft \mathscr { R } _ { 3 }$ , then this is not necessarily the case.5
100
+
101
+ Note that these definitions are given relative to some $M D P \setminus \mathcal { R }$ , although we often assume the environment in question is clear from context and suppress this dependence. The dependence on the policy set $\Pi$ , on the other hand, plays a critical role in our results.
102
+
103
+ # 5 Results
104
+
105
+ Our results are aimed at understanding when it is possible to have an unhackable proxy reward function. We first establish (in Section 5.1) that (non-trivial) unhackability is impossible when considering the set of all policies. We might imagine that restricting ourselves to a set of sufficiently good (according to the proxy) policies would remove this limitation, but we show that this is not the case. We then analyze finite policy sets (with deterministic policies as a special case), and establish necessary and sufficient conditions for unhackability and simplification. Finally, we demonstrate via example that non-trivial simplifications are also possible for some infinite policy sets in Section 5.3.
106
+
107
+ # 5.1 Non-trivial Unhackability Requires Restricting the Policy Set
108
+
109
+ We start with a motivating example. Consider the setting shown in Figure 3, where the agent can move left/stay-still/right and gets a reward depending on its state. Let the Gaussian (blue) be the true reward $\mathcal { R } _ { 1 }$ and the step function (orange) be the proxy $\mathcal { R } _ { 2 }$ . These are hackable. To see this, consider being at state $B$ . Let $\pi ( B )$ travel to $A$ or $C$ with 50/50 chance, and compare with the policy $\pi ^ { \prime }$ that stays at $B$ . Then we have that $J _ { 1 } ( \pi ) > J _ { 1 } ( \overline { { \pi } } ^ { \prime } )$ and $J _ { 2 } ( \pi ) \overline { { { < } } } \bar { J _ { 2 } } ( \pi ^ { \prime } )$ .
110
+
111
+ Generally, we might hope that some environments allow for unhackable reward pairs that are not equivalent or trivial. Here we show that this is not the case, unless we impose restrictions on the set of policies we consider.
112
+
113
+ ![](images/5234b4a4432b360ef8b7946b12af0f0e0429536d1319dd4425ab384954c852fe.jpg)
114
+ Figure 3: Two reward functions. While the step function may seem like a simplification of the Gaussian, these reward functions are hackable.
115
+
116
+ First note that if we consider non-stationary policies, this result is relatively straightforward. Suppose $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ are unhackable and non-trivial on the set $\Pi ^ { N }$ of all non-stationary policies, and let $\pi ^ { \star }$ be a policy that maximises $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ ) reward, and $\pi _ { \perp }$ be a policy that minimises $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ ) reward. Then the policy $\pi _ { \lambda }$ that plays $\pi ^ { \star }$ with probability $\lambda$ and $\pi _ { \perp }$ with probability $1 - \lambda$ is a policy in $\Pi ^ { N }$ . Moreover, for any $\pi$ there are two unique $\alpha , \beta \in [ 0 , 1 ]$ such that $J _ { 1 } ( \pi ) = J _ { 1 } ( \pi _ { \alpha } )$ and $J _ { 2 } ( \pi ) = J _ { 2 } ( \pi _ { \beta } )$ . Now, if $\alpha \neq \beta$ , then either $J _ { 1 } ( \pi ) < J _ { 1 } ( \pi _ { \delta } )$ and ${ \bf \dot { \cal J } } _ { 2 } ( \pi ) > { \cal J } _ { 2 } ( \pi _ { \delta } )$ , or vice versa, for $\delta = ( \alpha + \beta ) / 2$ . If $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ are unhackable then this cannot happen, so it must be that $\alpha = \beta$ This, in turn, implies that $J _ { 1 } ( \pi ) = J _ { 1 } ( \pi ^ { \prime } )$ iff $J _ { 2 } ( \pi ) = J _ { 2 } ( \pi ^ { \prime } )$ , and so $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ are equivalent. This means that no interesting unhackability can occur on the set of all non-stationary policies.
117
+
118
+ The same argument cannot be applied to the set of stationary policies, because $\pi _ { \lambda }$ is typically not stationary, and mixing stationary policies’ action probabilities does not have the same effect. For instance, consider a hallway environment where an agent can either move left or right. Mixing the “always go left” and “always go right” policies corresponds to picking a direction and sticking with it, whereas mixing their action probabilities corresponds to choosing to go left or right independently at every time-step. However, we will see that there still cannot be any interesting unhackability on this policy set, and, more generally, that there cannot be any interesting unhackability on any set of policies which contains an open subset. Formally, a set of (stationary) policies $\dot { \Pi }$ is open if $\mathcal { G } ( \dot { \Pi } )$ is open in the smallest affine space that contains $\mathcal { G } ( \Pi )$ , for the set of all stationary policies $\Pi$ . We will use the following lemma:
119
+
120
+ Lemma 1. In any $M D P \setminus \mathcal { R } ,$ if Π˙ is an open set of policies, then $\mathcal { F } ( \dot { \Pi } )$ is open in $\mathbb { R } ^ { | S | ( | A | - 1 ) }$ , and $\mathcal { F }$ is a homeomorphism between $\mathcal { G } ( \dot { \Pi } )$ and $\mathcal { F } ( \dot { \Pi } )$ .
121
+
122
+ Using this lemma, we can show that interesting unhackability is impossible on any set of stationary policies $\hat { \Pi }$ which contains an open subset $\dot { \Pi }$ . Roughly, if $\mathcal { F } ( \dot { \Pi } )$ is open, and $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ are non-trivial and unhackable on $\dot { \Pi }$ , then the fact that $J _ { 1 }$ and $J _ { 2 }$ have a linear structure on $\mathcal { F } ( \hat { \Pi } )$ implies that $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ must be equivalent on $\dot { \Pi }$ . From this, and the fact that $\mathcal { F } ( \dot { \Pi } )$ is open, it follows that $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ are equivalent everywhere.
123
+
124
+ Theorem 1. In any $M D P \setminus { \mathcal { R } } ,$ if Πˆ contains an open set, then any pair of reward functions that are unhackable and non-trivial on $\hat { \Pi }$ are equivalent on $\hat { \Pi }$ .
125
+
126
+ Since simplification is a special case of unhackability, this also implies that non-trivial simplification is impossible for any such policy set. Also note that Theorem 1 makes no assumptions about the transition function, etc. From this result, we can show that interesting unhackability always is impossible on the set $\Pi$ of all (stationary) policies. In particular, note that the set $\tilde { \Pi }$ of all policies that always take each action with positive probability is an open set, and that $\tilde { \Pi } \subset \Pi$ .
127
+
128
+ Corollary 1. In any $M D P \backslash \mathcal { R } ,$ , any pair of reward functions that are unhackable and non-trivial on the set of all (stationary) policies Π are equivalent on Π.
129
+
130
+ Theorem 1 can also be applied to many other policy sets. For example, we might not care about the hackability resulting from policies with low proxy reward, as we would not expect a sufficiently good learning algorithm to learn such policies. This leads us to consider the following definition:
131
+
132
+ Definition 3. A (stationary) policy $\pi$ is $\varepsilon$ -suboptimal if $J ( \pi ) \geq J ( \pi ^ { \star } ) - \varepsilon$
133
+
134
+ Alternatively, if the learning algorithm always uses a policy that is “nearly” deterministic (but with some probability of exploration), then we might not care about hackability resulting from very stochastic policies, leading us to consider the following definition:
135
+
136
+ Definition 4. A (stationary) policy $\pi$ is $\delta$ -deterministic if $\forall s \in S \exists a \in A : \mathbb { P } ( \pi ( s ) = a ) \geq \delta .$
137
+
138
+ Unfortunately, both of these sets contain open subsets, which means they are subject to Theorem 1.
139
+
140
+ Corollary 2. In any $M D P \setminus \mathcal { R } ,$ any pair of reward functions that are unhackable and non-trivial on the set of all $\varepsilon$ -suboptimal policies $\mathit { \Omega } ^ { \prime } \varepsilon > 0 \mathit { \Omega } .$ ) $\Pi ^ { \varepsilon }$ are equivalent on $\Pi ^ { \varepsilon }$ , and any pair of reward functions that are unhackable and non-trivial on the set of all $\delta$ -deterministic policies $\delta < 1$ ) $\Pi ^ { \delta }$ are equivalent on Πδ.
141
+
142
+ Intuitively, Theorem 1 can be applied to any policy set with “volume” in policy space.
143
+
144
+ # 5.2 Finite Policy Sets
145
+
146
+ Having established that interesting unhackability is impossible relative to the set of all policies, we now turn our attention to the case of finite policy sets. Note that this includes the set of all deterministic policies, since we restrict our analysis to finite MDPs. Surprisingly, here we find that non-trivial non-equivalent unhackable reward pairs always exist.
147
+
148
+ Theorem 2. For any $M D P \setminus \mathcal R$ , any finite set of policies Πˆ containing at least two $\pi , \pi ^ { \prime }$ such that $\mathcal { F } ( \pi ) \neq \mathcal { F } ( \pi ^ { \prime } )$ , and any reward function $\mathcal { R } _ { 1 }$ , there is a non-trivial reward function $\mathcal { R } _ { 2 }$ such that $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ are unhackable but not equivalent.
149
+
150
+ This proof proceeds by finding a path from $\mathcal { R } _ { 1 }$ to another reward function $\mathcal { R } _ { 3 }$ that is hackable with respect to $\mathcal { R } _ { 1 }$ . Along the way to reversing one of $\mathcal { R } _ { 1 }$ ’s inequalities, we must encounter a reward function $\mathcal { R } _ { 2 }$ that instead replaces it with equality. In the case that $\mathrm { d i m } ( \hat { \Pi } ) = 3$ , we can visualize moving along this path as rotating the contour lines of a reward function defined on the space containing the policies’ discounted state-action occupancies, see Figure 4. This path can be constructed so as to avoid any reward functions that produce trivial policy orderings, thus guaranteeing $\mathcal { R } _ { 2 }$ is non-trivial. For a simplification to exist, we require some further conditions, as established by the following theorem:
151
+
152
+ Theorem 3. Let $\hat { \Pi }$ be a finite set of policies, and $\mathcal { R } _ { 1 }$ a reward function. The following procedure determines if there exists a non-trivial simplification of $\mathcal { R } _ { 1 }$ in a given $M D P \setminus \mathcal R$ :
153
+
154
+ ![](images/c97da9abdc8efafcb631520baa4346efc32862725dd3fc4b70c12bbe8730b6ae.jpg)
155
+ Figure 4: An illustration of the state-action ocRotating the reward to make V(π3) equal V(π4) first sets V(π1) equal V(π2) cupancy space with a reward function defined over it. Points correspond to policies’ stateaction occupancies. Shading intensity indicates expected reward. Rotating the reward function to make $J ( \pi _ { 3 } ) > J ( \pi _ { 4 } )$ passes through a reward function that sets $\dot { J ( \pi _ { 1 } ) } = J ( \pi _ { 2 } ) \dot { }$ . Solid black lines are contour lines of the original reward function, dotted blue lines are contour lines of the rotated reward function.
156
+
157
+ 1. Let $E _ { 1 } \ldots E _ { m }$ be the partition of $\hat { \Pi }$ where $\pi , \pi ^ { \prime }$ belong to the same set iff $J ( \pi ) = J ( \pi ^ { \prime } )$ .
158
+
159
+ 2. For each such set $E _ { i }$ , select a policy $\pi _ { i } \in E _ { i }$ and let $Z _ { i }$ be the set of vectors that is obtained by subtracting $\mathcal { F } ( \pi _ { i } )$ from each element of $\mathcal { F } ( E _ { i } )$ .
160
+
161
+ Then there is a non-trivial simplification of $\mathcal { R }$ iff $\dim ( Z _ { 1 } \cup \dotsb \cup Z _ { m } ) \leq \dim ( { \mathcal { F } } ( { \hat { \Pi } } ) ) - 2$ , where $\mathrm { d i m } ( S )$ is the number of linearly independent vectors in $S$ .
162
+
163
+ The proof proceeds similarly to Theorem 2. However, in Theorem 2 it was sufficient to show that there are no trivial reward functions along the path from $\mathcal { R } _ { 1 }$ to $\mathcal { R } _ { 3 }$ , whereas here we additionally need that if $J ( \pi ) = J ( \pi ^ { \prime } )$ then $J ^ { \prime } ( \pi ) = \bar { J } ^ { \prime } ( \pi ^ { \prime } )$ for all functions $\mathcal { R } _ { 2 }$ on the path — this is what the extra conditions ensure.
164
+
165
+ Theorem 3 is opaque, but intuitively, the cases where $\mathcal { R } _ { 1 }$ cannot be simplified are those where $\mathcal { R } _ { 1 }$ imposes many different equality constraints that are difficult to satisfy simultaneously. We can think of $\dim ( { \mathcal { F } } ( \Pi ) )$ as measuring how diverse the behaviours of policies in policy set $\Pi$ are. Having a less diverse policy set means that a given policy ordering imposes fewer constraints on the reward function, creating more potential for simplification. The technical conditions of this proof determine when the diversity of $\Pi$ is or is not sufficient to prohibit simplification, as measured by $\dim ( Z _ { 1 } \cup \dots \cup Z _ { m } )$ .
166
+
167
+ Projecting $E _ { i }$ to $Z _ { i }$ simply moves these spaces to the origin, so that we can compare the directions in which they vary (i.e. their span). By assumption, $E _ { i } \cap E _ { j } = \{ \}$ , but $\operatorname { s p a n } ( Z _ { i } ) \cap \operatorname { s p a n } ( Z _ { j } )$ will include the origin, and may also contain linear subspaces of dimension greater than 0. This is the case exactly when there are a pair of policies in $E _ { i }$ and a pair of policies in $E _ { j }$ that differ by the same visit counts, for example, when the environment contains an obstacle that could be circumnavigated in several different ways (with an impact on visit counts, but no impact on reward), and the policies in $E _ { i }$ and $E _ { j }$ both need to circumnavigate it before doing something else. Roughly speaking, $\mathrm { d i m } ( Z _ { 1 } \cup \dots \cup Z _ { m } )$ is large when either (i) we have very large and diverse sets of policies in $\hat { \Pi }$ that get the same reward according to $\mathcal { R }$ , or (ii) we have a large number of different sets of policies that get the same reward according to $\mathcal { R }$ , and where there are different kinds of diversity in the behaviour of the policies in each set. There are also intuitive special cases of Theorem 3. For example, as noted before, if $E _ { i }$ is a singleton then $Z _ { i }$ has no impact on $\dim ( Z _ { 1 } \cup \dotsb \cup Z _ { m } )$ . This implies the following corollary:
168
+
169
+ Corollary 3. For any finite set of policies $\hat { \Pi } ,$ , any environment, and any reward function $\mathcal { R } , i f | \hat { \Pi } | \geq 2$ and $J ( \pi ) \ne J ( \pi ^ { \prime } )$ for all $\pi , \pi ^ { \prime } \in \hat { \Pi }$ then there is a non-trivial simplification of $\mathcal { R }$ .
170
+
171
+ A natural question is whether any reward function is guaranteed to have a non-trivial simplification on the set of all deterministic policies. As it turns out, this is not the case. For concreteness, and to build intuition for this result, we examine the set of deterministic policies in a simple $M D P \setminus \mathcal R$ with $S = \{ 0 , 1 \} , A = \{ 0 , 1 \} , T ( s , a ) = a , I = \{ 0 : 0 . 5 , 1 : 0 . 5 \} , \gamma = 0 . 5 .$ Denote $\pi _ { i j }$ the policy that takes action $i$ from state 0 and action $j$ from state 1. There are exactly four deterministic policies. We find that of the $4 ! = 2 4$ possible policy orderings, 12 are realizable via some reward function. In each of those 12 orderings, exactly two policies (of the six available pairs of policies in the ordering) can be set to equal value without resulting in the trivial reward function (which pair can be equated depends on the ordering in consideration). Attempting to set three policies equal always results in the trivial reward simplification.
172
+
173
+ For example, given the ordering $\pi _ { 0 0 } \leq \pi _ { 0 1 } \leq \pi _ { 1 1 } \leq \pi _ { 1 0 }$ , the simplification $\pi _ { 0 0 } = \pi _ { 0 1 } < \pi _ { 1 1 } < \pi _ { 1 0 }$ is represented by $R = \left[ { \begin{array} { l l } { 0 \ 3 } \\ { 2 \ 1 } \end{array} } \right]$ , where $\begin{array} { r } { \mathcal { R } ( s , a ) = R [ s , a ] } \end{array}$ : for example, here taking action 1 from state 0 gives reward $\mathcal { R } ( 0 , 1 ) = \mathbf { \bar { 3 } }$ . But there is no reward function representing a non-trivial simplification of this ordering with $\pi _ { 0 1 } = \pi _ { 1 1 }$ . We develop and release a software suite to compute these results. Given an environment and a set of policies, it can calculate all policy orderings represented by some reward function. Also, for a given policy ordering, it can calculate all nontrivial simplifications and reward functions that represent them. For a link to the repository, as well as a full exploration of these policies, orderings, and simplifications, see Appendix D.3.
174
+
175
+ # 5.3 Unhackability in Infinite Policy Sets
176
+
177
+ The results in Section 5.1 do not characterize unhackability for infinite policy sets that do not contain open sets. Here, we provide two examples of such policy sets; one of them admits unhackable reward pairs and the other does not. Consider policies $A , B , C$ , and reward functions $\mathcal { R } _ { 1 }$ with $J _ { 1 } ( C ) \overset { = } { < } J _ { 1 } ( B ) < J _ { 1 } ( A )$ and $\mathcal { R } _ { 2 }$ with $J _ { 2 } ( C ) = J _ { 2 } ( B ) < J _ { 2 } ( A )$ . Policy sets $\Pi _ { a } = \{ A \} \cup \{ \lambda B +$ $( 1 - \lambda ) C : \lambda \in [ 0 , 1 ] \}$ and $\Pi _ { b } = \{ A \} \cup \{ \lambda B + ( 1 - \lambda ) C : \lambda \in [ 0 , 1 ] \}$ are depicted in Figure 5; the vertical axis represents policies’ values according to $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ . For $\Pi _ { a }$ , $\mathcal { R } _ { 2 }$ is a simplification of $\mathcal { R } _ { 1 }$ , but for $\Pi _ { b }$ , it is not, since $J _ { 1 } ( X ) < J _ { 1 } ( Y )$ and $J _ { 2 } ( X ) > J _ { 2 } ( Y )$ .
178
+
179
+ # 6 Discussion
180
+
181
+ We reflect on our results and identify limitations in Section 6.1. In Section 6.2, we discuss how our work can inform discussions about the appropriateness, potential risks, and limitations of using of reward functions as specifications of desired behavior.
182
+
183
+ ![](images/f62db4fe01a9fa8f5dd35fad9cc6dec7fa797c354b23c721b7f0c7373245af2a.jpg)
184
+ Figure 5: Infinite policy sets that do not contain open sets sometimes allow simplification (a), but not always (b). Points A, B, C represent deterministic policies, while the bold lines between them represent stochastic policies. The y-axis gives the values of the policies according to reward functions $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ . We attempt to simplify $\mathcal { R } _ { 1 }$ by rotating the reward function such that $J _ { 2 } ( B ) = J _ { 2 } ( C )$ ; in the figure, we instead (equivalently) rotate the triangle along the AB axis, leading to the red triangle. In (a), $\mathcal { R } _ { 2 }$ simplifies $\mathcal { R } _ { 1 }$ , setting all policies along the BC segment equal in value (but still lower than A). In (b), $\mathcal { R } _ { 2 }$ swaps the relative value of policies $\mathbf { X }$ and $\mathbf { Y }$ $\begin{array} { r } { J _ { 1 } ( X ) < J _ { 1 } ( Y ) = J _ { 2 } ( Y ) < J _ { 2 } ( X ) ) } \end{array}$ and so does not simplify $\mathcal { R } _ { 1 }$ .
185
+
186
+ # 6.1 Limitations
187
+
188
+ Our work has a number of limitations. We have only considered finite MDPs and Markov reward functions, leaving more general environments for future work. While we characterized hackability and simplification for finite policy sets, the conditions for simplification are somewhat opaque, and our characterization of infinite policy sets remains incomplete.
189
+
190
+ As previously discussed, our definition of hackability is strict, arguably too strict. Nonetheless, we believe that understanding the consequences of this strict definition is an important starting point for further theoretical work in this area.
191
+
192
+ The main issue with the strictness of our definition has to do with the symmetric nature of hackability. The existence of complex behaviors that yield low proxy reward and high true reward is much less concerning than the reverse, as these behaviors are unlikely to be discovered while optimizing the proxy. For example, it is very unlikely that our agent would solve climate change in the course of learning how to wash dishes. Note that the existence of simple behaviors with low proxy reward and high true reward is concerning; these could arise early in training, leading us to trust the proxy, only to later see the true reward decrease as the proxy is further optimized. To account for this issue, future work should explore more realistic assumptions about the probability of encountering a given sequence of policies when optimizing the proxy, and measure hackability in proportion to this probability.
193
+
194
+ We could allow for approximate unhackability by only considering pairs of policies ranked differently by the true and proxy reward functions as evidence of hacking iff their value according to the true reward function differs by more than some $\varepsilon$ . Probabilistic unhackability could be defined by looking at the number of misordered policies; this would seem to require making assumptions about the probability of encountering a given policy when optimizing the proxy.
195
+
196
+ Finally, while unhackability is a guarantee that no hacking will occur, hackability is far from a guarantee of hacking. Extensive empirical work is necessary to better understand the factors that influence the occurrence and severity of reward hacking in practice.
197
+
198
+ # 6.2 Implications
199
+
200
+ How should we specify our preferences for AI systems’ behavior? And how detailed a specification is required to achieve a good outcome? In reinforcement learning, the goal of maximizing (some) reward function is often taken for granted, but a number of authors have expressed reservations about this approach (Gabriel, 2020; Dobbe et al., 2021; Hadfield-Menell et al., 2016b, 2017; Bostrom, 2014). Our work has several implications for this discussion, although we caution against drawing any strong conclusions due to the limitations mentioned in Section 6.1.
201
+
202
+ One source of confusion and disagreement is the role of the reward function; it is variously considered as a means of specifying a task (Leike et al., 2018) or encoding broad human values (Dewey, 2011); such distinctions are discussed by Christiano (2019) and Gabriel (2020). We might hope to use Markov reward functions to specify narrow tasks without risking behavior that goes against our broad values. However, if we consider the “narrow task” reward function as a proxy for the true “broad values” reward function, our results indicate that this is not possible: these two reward functions will invariably be hackable. Such reasoning suggests that reward functions must instead encode broad human values, or risk being hacked. This seems challenging, perhaps intractably so, indicating that alternatives to reward optimization may be more promising. Potential alternatives include imitation learning (Ross et al., 2011), constrained RL (Szepesvári, 2020), quantilizers (Taylor, 2016), and incentive management (Everitt et al., 2019).
203
+
204
+ Scholars have also criticized the assumption that human values can be encoded as rewards (Dobbe et al., 2021), and challenged the use of metrics more broadly (O’Neil, 2016; Thomas and Uminsky, 2022), citing Goodhart’s Law (Manheim and Garrabrant, 2018; Goodhart, 1975). A concern more specific to the optimization of reward functions is power-seeking (Turner et al., 2021; Bostrom, 2012; Omohundro, 2008). Turner et al. (2021) prove that optimal policies tend to seek power in most MDPs and for most reward functions. Such behavior could lead to human disempowerment; for instance, an AI system might disable its off-switch (Hadfield-Menell et al., 2016a). Bostrom (2014) and others have argued that power-seeking makes even slight misspecification of rewards potentially catastrophic, although this has yet to be rigorously established.
205
+
206
+ Despite such concerns, approaches to specification based on learning reward functions remain popular (Fu et al., 2017; Stiennon et al., 2020; Nakano et al., 2021). So far, reward hacking has usually been avoidable in practice, although some care must be taken (Stiennon et al., 2020). Proponents of such approaches have emphasized the importance of learning a reward model in order to exceed human performance and generalize to new settings (Brown et al., 2020a; Leike et al., 2018). But our work indicates that such learned rewards are almost certainly hackable, and so cannot be safely optimized. Thus we recommend viewing such approaches as a means of learning a policy in a safe and controlled setting, which should then be validated before being deployed.
207
+
208
+ # 7 Conclusion
209
+
210
+ Our work begins the formal study of reward hacking in reinforcement learning. We formally define hackability and simplification of reward functions, and show conditions for the (non-)existence of non-trivial examples of each. We find that unhackability is quite a strict condition, as the set of all policies never contains non-trivial unhackable pairs of reward functions. Thus in practice, reward hacking must be prevented by limiting the set of possible policies, or controlling (e.g. limiting) optimization. Alternatively, we could pursue approaches not based on optimizing reward functions.
211
+
212
+ # References
213
+
214
+ Abel, D., Dabney, W., Harutyunyan, A., Ho, M. K., Littman, M., Precup, D., and Singh, S. (2021). On the Expressivity of Markov Reward. Advances in Neural Information Processing Systems, 34.
215
+ Amodei, D., Christiano, P., and Ray, A. (2017). Learning from Human Preferences. OpenAI https: //openai.com/blog/deep-reinforcement-learning-from-human-preferences/.
216
+ Bird, J. and Layzell, P. (2002). The evolved radio and its implications for modelling the evolution of novel sensors. In Proceedings of the 2002 Congress on Evolutionary Computation. CEC’02 (Cat. No. 02TH8600), volume 2, pages 1836–1841. IEEE.
217
+ Bostrom, N. (2012). The superintelligent will: Motivation and instrumental rationality in advanced artificial agents. Minds and Machines, 22(2):71–85.
218
+ Bostrom, N. (2014). Superintelligence: Paths, Dangers, Strategies.
219
+ Brown, D. S., Goo, W., and Niekum, S. (2020a). Better-than-demonstrator imitation learning via automatically-ranked demonstrations. In Conference on robot learning, pages 330–359. PMLR.
220
+ Brown, D. S., Schneider, J., Dragan, A. D., and Niekum, S. (2020b). Value Alignment Verification. CoRR, abs/2012.01557.
221
+ Christiano, P. (2019). Ambitious vs. narrow value learning. AI Alignment Forum. https://www.alignmentforum.org/posts/SvuLhtREMy8wRBzpC/ ambitious-vs-narrow-value-learning.
222
+ Clark, J. and Amodei, D. (2016). Faulty Reward Functions in the Wild. OpenAI Codex https: //openai.com/blog/faulty-reward-functions/.
223
+ Dewey, D. (2011). Learning What to Value. In Schmidhuber, J., Thórisson, K. R., and Looks, M., editors, Artificial General Intelligence: 4th International Conference, AGI 2011, pages 309–314, Berlin, Heidelberg. Springer Berlin Heidelberg.
224
+ Dobbe, R., Gilbert, T. K., and Mintz, Y. (2021). Hard Choices in Artificial Intelligence. CoRR, abs/2106.11022.
225
+ Everitt, T., Hutter, M., Kumar, R., and Krakovna, V. (2021). Reward tampering problems and solutions in reinforcement learning: A causal influence diagram perspective. Synthese, 198(27):6435–6467.
226
+ Everitt, T., Krakovna, V., Orseau, L., Hutter, M., and Legg, S. (2017). Reinforcement learning with a corrupted reward channel. arXiv preprint arXiv:1705.08417.
227
+ Everitt, T., Ortega, P. A., Barnes, E., and Legg, S. (2019). Understanding agent incentives using causal influence diagrams. Part I: Single action settings. arXiv preprint arXiv:1902.09980.
228
+ Fu, J., Luo, K., and Levine, S. (2017). Learning robust rewards with adversarial inverse reinforcement learning. arXiv preprint arXiv:1710.11248.
229
+ Gabriel, I. (2020). Artificial intelligence, values, and alignment. Minds and machines, 30(3):411–437.
230
+ Golden, D. (2001). Glass Floor: Colleges Reject Top Applicants, Accepting Only the Students Likely to Enroll. The Wall Street Journal. https://www.wsj.com/articles/ SB991083160294634500.
231
+ Goodhart, C. A. (1975). Problems of monetary management: the UK experience. In of Australia, R. B., editor, Papers in monetary economics. Reserve Bank of Australia.
232
+ Hadfield-Menell, D., Dragan, A., Abbeel, P., and Russell, S. (2016a). The Off-Switch Game. CoRR, abs/1611.08219.
233
+ Hadfield-Menell, D., Dragan, A. D., Abbeel, P., and Russell, S. J. (2016b). Cooperative Inverse Reinforcement Learning. CoRR, abs/1606.03137.
234
+ Hadfield-Menell, D., Milli, S., Abbeel, P., Russell, S. J., and Dragan, A. (2017). Inverse reward design. Advances in neural information processing systems, 30.
235
+ Ibarz, B., Leike, J., Pohlen, T., Irving, G., Legg, S., and Amodei, D. (2018). Reward learning from human preferences and demonstrations in atari. Advances in neural information processing systems, 31.
236
+ Krakovna, V., Orseau, L., Kumar, R., Martic, M., and Legg, S. (2018). Penalizing side effects using stepwise relative reachability. CoRR, abs/1806.01186.
237
+ Krakovna, V., Uesato, J., Mikulik, V., Rahtz, M., Everitt, T., Kumar, R., Kenton, Z., Leike, J., and Legg, S. (2020). Specification gaming: the flip side of AI ingenuity.
238
+ Kumar, R., Uesato, J., Ngo, R., Everitt, T., Krakovna, V., and Legg, S. (2020). Realab: An embedded perspective on tampering. arXiv preprint arXiv:2011.08820.
239
+ Leike, J., Krueger, D., Everitt, T., Martic, M., Maini, V., and Legg, S. (2018). Scalable agent alignment via reward modeling: a research direction. CoRR, abs/1811.07871.
240
+ Manheim, D. and Garrabrant, S. (2018). Categorizing Variants of Goodhart’s Law. CoRR, abs/1803.04585.
241
+ Nakano, R., Hilton, J., Balaji, S., Wu, J., Ouyang, L., Kim, C., Hesse, C., Jain, S., Kosaraju, V., Saunders, W., et al. (2021). WebGPT: Browser-assisted question-answering with human feedback. arXiv preprint arXiv:2112.09332.
242
+ Ng, A. Y., Harada, D., and Russell, S. (1999). Policy invariance under reward transformations: Theory and application to reward shaping. In Icml, volume 99, pages 278–287.
243
+ Ng, A. Y., Russell, S. J., et al. (2000). Algorithms for inverse reinforcement learning. In Icml, volume 1, page 2.
244
+ Omohundro, S. M. (2008). The basic AI drives.
245
+ O’Neil, C. (2016). Weapons of math destruction: How big data increases inequality and threatens democracy. Crown Publishing Group.
246
+ Pan, A., Bhatia, K., and Steinhardt, J. (2022). The Effects of Reward Misspecification: Mapping and Mitigating Misaligned Models. arXiv preprint arXiv:2201.03544.
247
+ Ross, S., Gordon, G., and Bagnell, D. (2011). A reduction of imitation learning and structured prediction to no-regret online learning. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pages 627–635. JMLR Workshop and Conference Proceedings.
248
+ Stiennon, N., Ouyang, L., Wu, J., Ziegler, D., Lowe, R., Voss, C., Radford, A., Amodei, D., and Christiano, P. F. (2020). Learning to summarize with human feedback. Advances in Neural Information Processing Systems, 33:3008–3021.
249
+ Sutton, R. S. and Barto, A. G. (2018). Reinforcement learning: An introduction. MIT press.
250
+ Szepesvári, C. (2020). Constrained MDPs and the reward hypothesis. http://readingsml. blogspot.com/2020/03/constrained-mdps-and-reward-hypothesis.html.
251
+ Taylor, J. (2016). Quantilizers: A safer alternative to maximizers for limited optimization. In Workshops at the Thirtieth AAAI Conference on Artificial Intelligence.
252
+ Thomas, R. L. and Uminsky, D. (2022). Reliance on metrics is a fundamental challenge for AI. Patterns, 3(5):100476.
253
+ Thrun, S. and Schwartz, A. (1993). Issues in using function approximation for reinforcement learning. In Proceedings of the 1993 Connectionist Models Summer School Hillsdale, NJ. Lawrence Erlbaum, volume 6.
254
+ Turner, A. M., Hadfield-Menell, D., and Tadepalli, P. (2019). Conservative Agency via Attainable Utility Preservation. CoRR, abs/1902.09725.
255
+ Turner, A. M., Smith, L., Shah, R., Critch, A., and Tadepalli, P. (2021). Optimal Policies Tend to Seek Power. Advances in Neural Information Processing Systems.
256
+ Uesato, J., Kumar, R., Krakovna, V., Everitt, T., Ngo, R., and Legg, S. (2020). Avoiding tampering incentives in deep rl via decoupled approval. arXiv preprint arXiv:2011.08827.
257
+ Zhang, B., Rajan, R., Pineda, L., Lambert, N., Biedenkapp, A., Chua, K., Hutter, F., and Calandra, R. (2021). On the Importance of Hyperparameter Optimization for Model-based Reinforcement Learning. CoRR, abs/2102.13651.
258
+ Zhuang, S. and Hadfield-Menell, D. (2020). Consequences of misaligned AI. Advances in Neural Information Processing Systems, 33:15763–15773.
259
+ Ziebart, B. D. (2010). Modeling purposeful adaptive behavior with the principle of maximum causal entropy. Carnegie Mellon University.
parse/dev/z9NLqoFvZ0/z9NLqoFvZ0.md ADDED
@@ -0,0 +1,481 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # State-wise Constrained Policy Optimization
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 Reinforcement Learning (RL) algorithms have shown tremendous success in simu
11
+ 2 lation environments, but their application to real-world problems faces significant
12
+ 3 challenges, with safety being a major concern. In particular, enforcing state-wise
13
+ 4 constraints is essential for many challenging tasks such as autonomous driving
14
+ 5 and robot manipulation. However, existing safe RL algorithms under the frame
15
+ 6 work of Constrained Markov Decision Process (CMDP) do not consider state-wise
16
+ 7 constraints. To address this gap, we propose State-wise Constrained Policy Opti
17
+ 8 mization (SCPO), the first general-purpose policy search algorithm for state-wise
18
+ 9 constrained reinforcement learning. SCPO provides guarantees for state-wise con
19
+ 10 straint satisfaction in expectation. In particular, we introduce the framework of
20
+ 11 Maximum Markov Decision Process, and prove that the worst-case safety violation
21
+ 12 is bounded under SCPO. We demonstrate the effectiveness of our approach on
22
+ 13 training neural network policies for extensive robot locomotion tasks, where the
23
+ 14 agent must satisfy a variety of state-wise safety constraints. Our results show
24
+ 15 that SCPO significantly outperforms existing methods and can handle state-wise
25
+ 16 constraints in high-dimensional robotics tasks.
26
+
27
+ # 17 1 Introduction
28
+
29
+ 18 Reinforcement learning (RL) has achieved remarkable progress in games and control tasks [Mnih
30
+ 19 et al., 2015, Vinyals et al., 2019, Brown and Sandholm, 2018, He et al., 2022, Zhao et al., 2019].
31
+ 20 However, one major barrier that limits the application of RL algorithms to real-world problems is
32
+ 21 the lack of safety assurance. RL agents learn to make reward-maximizing decisions, which may
33
+ 22 violate safety constraints. For example, an RL agent controlling a self-driving car may receive high
34
+ 23 rewards by driving at high speeds but will be exposed to high chances of collision. Although the
35
+ 24 reward signals can be designed to penalize risky behaviors, there is no guarantee for safety. In other
36
+ 25 words, RL agents may sometimes prioritize maximizing the reward over ensuring safety, which can
37
+ 26 lead to unsafe or even catastrophic outcomes [Gu et al., 2022]
38
+ 27 Emerging in the literature, safe RL aims to provide safety guarantees during or after training. Early
39
+ 28 attempts have been made under the framework of constrained Markov Decision Process, where the
40
+ 29 majority of works enforce cumulative constraints or chance constraints [Ray et al., 2019, Achiam
41
+ 30 et al., 2017a, Liu et al., 2021]. In real-world applications, however, many critical constraints are
42
+ 31 instantaneous. For instance, collision avoidance must be enforced at all times for autonomous
43
+ 32 cars [Zhao et al., 2023]. Another example is that when a robot holds a glass, the robot can only
44
+ 33 release the glass when the glass is on a stable surface. The violation of those constraints will lead to
45
+ 34 irreversible failures of the task. In this work, we focus on state-wise (instantaneous) constraints.
46
+ 35 The State-wise Constrained Markov Decision Process (SCMDP) is a novel formulation in reinforce
47
+ 36 ment learning that requires policies to satisfy hard state-wise constraints. Unlike cumulative or
48
+ 37 probabilistic constraints, state-wise constraints demand full compliance at each time step as for
49
+ 38 malized by Zhao et al. [2023]. Existing state-wise safe RL methods can be categorized based on
50
+ 39 whether safety is ensured during training. There is a fundamental limitation that it is impossible to
51
+ 40 guarantee hard state-wise safety during training without prior knowledge of the dynamic model. The
52
+ 41 best we can achieve in a model free setting is to learn to satisfy the constraints using as few samples
53
+ 42 as possible, which is the focus of this paper. We aim to provide theoretical guarantees on state-wise
54
+ 43 safety violation and worst case reward degredation during training.
55
+ 44 Our approach is underpinned by a key insight that constraining the maximum violation is equivalent
56
+ 45 to enforcing state-wise safety. This insight leads to a novel formulation of MDP called the Maximum
57
+ 46 Markov Decision Process (MMDP). With MMDP, we establish a new theoretical result that provides
58
+ 47 a bound on the difference between the maximum cost of two policies for episodic tasks. This result
59
+ 48 expands upon the cumulative discounted reward and cost bounds for policy search using trust regions,
60
+ 49 as previously documented in literature [Achiam et al., 2017b]. We leverage this result to design a
61
+ 50 policy improvement step that not only guarantees worst-case performance degradation but also ensures
62
+ 51 state-wise cost constraints. Our proposed algorithm, State-wise Constrained Policy Optimization
63
+ 52 (SCPO), approximates the theoretically-justified update, which achieves a state-of-the-art trade-off
64
+ 53 between safety and performance. Through experiments, we demonstrate that SCPO effectively
65
+ 54 trains neural network policies with thousands of parameters on high-dimensional simulated robot
66
+ 55 locomotion tasks; and is able to optimize rewards while enforcing state-wise safety constraints. This
67
+ 56 work represents a significant step towards developing practical safe RL algorithms that can be applied
68
+ 57 to many real-world problems.
69
+
70
+ # 58 2 Related Work
71
+
72
+ # 2.1 Cumulative Safety
73
+
74
+ 60 Cumulative safety requires that the expected discounted return with respect to some cost function is
75
+ 61 upper-bounded over the entire trajectory. One representative approach is constrained policy optimiza
76
+ 62 tion (CPO) [Achiam et al., $\dot { \underline { 2 0 1 7 a } }$ , which builds on a theoretical bound on the difference between
77
+ 63 the costs of different policies and derives a policy improvement procedure to ensure constraints
78
+ 64 satisfaction. Another approach is interior-point policy optimization (IPO) $\mathbb { \underline { { | L i u \ e t \ a l . } } } , \bigstar$ , which
79
+ 65 augments the reward-maximizing objective with logarithmic barrier functions as penalty functions
80
+ 66 to accommodate the constraints. Other methods include Lagrangian methods [Ray et al., 2019]
81
+ 67 which use adaptive penalty coefficients to enforce constraints and projection-based constrained
82
+ 68 policy optimization (PCPO) $\mathrm { \parallel Y a n g e t a l . } , \mathrm { \text2 0 2 0 a } \mathrm { ] }$ which projects trust-region policy updates onto the
83
+ 69 constraint set. Although our focus is on a different setting of constraints, existing methods are still
84
+ 70 valuable references for illustrating the advantages of our SCPO. By utilizing MMDP, SCPO breaks
85
+ 71 the conventional safety-reward trade-off, which results in stronger convergence of state-wise safety
86
+ 72 constraints and guaranteed performance degradation bounds.
87
+
88
+ # 73 2.2 State-wise Safety
89
+
90
+ 74 Hierarchical Policy One way to enforce state-wise safety constraints is to use hierarchical policies,
91
+ 75 with an RL policy generating reward-maximizing actions, and a safety monitor modifying the actions
92
+ 76 to satisfy state-wise safety constraints. Such an approach often requires a perfect safety critic to
93
+ 77 function well. For example, conservative safety critics (CSC) [Bharadhwaj et al., 2020] propose
94
+ 78 a safe critic $Q _ { C } ( s , a )$ , providing a conservative estimate of the likelihood of being unsafe given a
95
+ 79 state-action pair. If the safety violation exceeds a predefined threshold, a new action is re-sampled
96
+ 80 from the policy until it passes the safety critic. However, this approach is time-consuming. On
97
+ 81 the other hand, optimization-based methods such as gradient descent or quadratic programming
98
+ 82 can be used to find a safe action that satisfies the constraint while staying close to the reference
99
+ 83 action. Unrolling safety layer (USL) $[ [ \mathrm { Z h a n g e t a l . } , [ 2 0 2 2 \mathrm { a } ] ]$ follows a similar hierarchical structure as
100
+ 84 CSC but performs gradient descent on the reference action iteratively until the constraint is satisfied
101
+ 85 based on learned safety critic $Q _ { C } ( s , a )$ . Finally, instead of using gradient descent, Lyapunov-based
102
+ 86 policy gradient (LPG) $[ \mathbb { C h o w e t a l . } ] \mathbb { 2 0 1 9 } ]$ and SafeLayer $\underline { { \mathrm { | } \mathbf { D a l a l \acute { e t a l . } } \mathbf { \lbrack 2 0 1 8 \rbrack } } }$ directly solve quadratic
103
+ 87 programming (QP) to project actions to the safe action set induced by the linearized versions of some
104
+ 88 learned critic $Q _ { C } ( s , a )$ . All these approaches suffer from safety violations due to imperfect critic
105
+ 89 $Q _ { C } ( s , a )$ , while those solving QPs further suffer from errors due to the linear approximation of the
106
+ 90 critic. To avoid those issues, we propose SCPO as an end-to-end policy which does not explicitly
107
+ 91 maintain a safety monitor.
108
+ 92 End-to-End Policy End-to-end policies maximize task rewards while ensuring safety at the same
109
+ 93 time. Related work regarding state-wise safety after convergence has been explored recently. Some
110
+ 94 approaches [Liang et al., 2018, Tessler et al., 2018] solve a primal-dual optimization problem to
111
+ 95 satisfy the safety constraint in expectation. However, the associated optimization is hard in practice
112
+ 96 because the optimization problem changes at every learning step. Bohez et al. [2019] approaches
113
+ 97 the same setting by augmenting the reward with the sum of the constraint penalty weighted by the
114
+ 98 Lagrangian multiplier. Although claimed state-wise safety performance, the aforementioned methods
115
+ 99 do not provide theoretical guarantee and fail to achieve near-zero safety violation in practice. He
116
+ 100 et al. $\underline { { \hat { \left\| 2 0 2 3 \right\| } } }$ proposes AutoCost to automatically find an appropriate cost function using evolutionary
117
+ 101 search over the space of cost functions as parameterized by a simple neural network. It is empirically
118
+ 102 shown that the evolved cost functions achieve near-zero safety violation, however, no theoretical
119
+ 103 guarantee is provided, and extensive computation is required. FAC $[ \mathbb { M } \mathrm { a } \mathrm { e t } \mathrm { a l } . ] [ 2 0 2 1 ]$ does provide
120
+ 104 theoretically guaranteed state-wise safety via parameterized Lagrange functions. However, FAC
121
+ 105 replies on strong assumptions and performs poorly in practice. To resolve the above issues, we
122
+ 106 propose SCPO as an easy-to-implement and theoretically sound approach with no prior assumptions
123
+ 107 on the underlying safety functions.
124
+
125
+ # 08 3 Problem Formulation
126
+
127
+ # 3.1 Preliminaries
128
+
129
+ In this paper, we are especially interested in guaranteeing safety for episodic tasks, which falls within in the scope of finite-horizon Markov Decision Process (MDP). An MDP is specified by a tuple $( S , { \mathcal { A } } , \gamma , R , P , \mu )$ , where $s$ is the state space, and $\mathcal { A }$ is the control space, $R : S \times \mathcal { A } \mapsto \mathbb { R }$ is the reward function, $0 \leq \gamma < 1$ is the discount factor, $\mu : S \mapsto \mathbb { R }$ is the initial state distribution, and $P : \mathcal { S } \times \mathcal { A } \times \mathcal { S } \mapsto \mathbb { R }$ is the transition probability function. $P ( s ^ { \prime } | s , a )$ is the probability of transitioning to state $s ^ { \prime }$ given that the previous state was $s$ and the agent took action $a$ at state $s$ . A stationary policy $\pi : { \bar { \mathcal { S } } } \mapsto { \mathcal { P } } ( { \mathcal { A } } )$ is a map from states to a probability distribution over actions, with $\pi ( a | s )$ denoting the probability of selecting action $a$ in state $s$ . We denote the set of all stationary policies by ⇧. Subsequently, we denote $\pi _ { \theta }$ as the policy that is parameterized by the parameter $\theta$ .
130
+
131
+ 119 The standard goal for MDP is to learn a policy $\pi$ that maximizes a performance measure $\mathcal { I } _ { 0 } ( \pi )$ which
132
+ 120 is computed via the discounted sum of reward:
133
+
134
+ $$
135
+ \mathcal { I } _ { 0 } ( \pi ) = \mathbb { E } _ { \tau \sim \pi } \left[ \sum _ { { t = 0 } } ^ { H } \gamma ^ { t } R ( s _ { t } , a _ { t } , s _ { t + 1 } ) \right] ,
136
+ $$
137
+
138
+ 121 where $H \in \mathbb { N }$ is the horizon, ${ \boldsymbol \tau } = [ s _ { 0 } , a _ { 0 } , s _ { 1 } , \cdot \cdot \cdot ] ,$ , and $\tau \sim \pi$ is shorthand for that the distribution
139
+ 122 over trajectories depends on $\pi : s _ { 0 } \sim \mu , a _ { t } \sim \pi ( \cdot | s _ { t } ) , s _ { t + 1 } \sim P ( \cdot | s _ { t } , a _ { t } )$ .
140
+
141
+ # 123 3.2 State-wise Constrained Markov Decision Process
142
+
143
+ 124 A constrained Markov Decision Process (CMDP) is an MDP augmented with constraints that restrict
144
+ 125 the set of allowable policies. Specifically, CMDP introduces a set of cost functions, $C _ { 1 } , C _ { 2 } , \cdots , C _ { m }$ ,
145
+ 126 where $C _ { i } : S \times A \times S \mapsto \mathbb { R }$ maps the state action transition tuple into a cost value. Analogous to $\mathbb { \underline { { \left( 1 \right) } } }$ ,
146
+ 127 we denote
147
+
148
+ $$
149
+ \mathcal { I } _ { C _ { i } } ( \pi ) = \mathbb { E } _ { \tau \sim \pi } \left[ \sum _ { t = 0 } ^ { H } \gamma ^ { t } C _ { i } ( s _ { t } , a _ { t } , s _ { t + 1 } ) \right]
150
+ $$
151
+
152
+ as the cost measure for policy 128 $\pi$ with respect to cost function $C _ { i }$ . Hence, the set of feasible stationary 129 policies for CMDP is then defined as follows, where $d _ { i } \in \mathbb { R }$ :
153
+
154
+ $$
155
+ \Pi _ { C } = \{ \pi \in \Pi \vert \forall i , { \mathcal { I } } _ { C _ { i } } ( \pi ) \leq d _ { i } \} .
156
+ $$
157
+
158
+ 130 In CMDP, the objective is to select a feasible stationary policy $\pi _ { \theta }$ that maximizes the performance
159
+ 131 measure:
160
+
161
+ $$
162
+ \operatorname* { m a x } _ { \pi } \mathcal { I } _ { 0 } ( \pi ) , \ : \ : \mathbf { s . t . } \pi \in \Pi _ { C } .
163
+ $$
164
+
165
+ 132 In this paper, we are interested in a special type of CMDP where the safety specification is to persis
166
+ 133 tently satisfy a hard cost constraint at every step (as opposed to cumulative costs over trajectories),
167
+ 134 which we refer to as State-wise Constrained Markov Decision Process (SCMDP). Like CMDP,
168
+ 135 SCMDP uses the set of cost functions $C _ { 1 } , C _ { 2 } , \cdots , C _ { m }$ to evaluate the instantaneous cost of state
169
+ 136 action transition tuples. Unlike CMDP, SCMDP requires the cost for every state action transition to
170
+ 137 satisfy a hard constraint. Hence, the set of feasible stationary policies for SCMDP is defined as
171
+
172
+ $$
173
+ \bar { \Pi } _ { C } = \{ \pi \in \Pi \big | \forall i , \ \mathbb { E } _ { ( s _ { t } , a _ { t } , s _ { t + 1 } ) \sim \tau , \tau \sim \pi } \big [ C _ { i } ( s _ { t } , a _ { t } , s _ { t + 1 } ) \big ] \le w _ { i } \}
174
+ $$
175
+
176
+ 138 where $w _ { i } \in \mathbb { R }$ . Then the objective for SCMDP is to find a feasible stationary policy from $\bar { \Pi } _ { C }$ that
177
+ 139 maximizes the performance measure. Formally,
178
+
179
+ $$
180
+ \operatorname* { m a x } _ { \pi } \mathcal { I } _ { 0 } ( \pi ) , \ : \ : \mathbf { s . t . } \pi \in \bar { \Pi } _ { C }
181
+ $$
182
+
183
+ # 140 3.3 Maximum Markov Decision Process
184
+
185
+ 141 Note that for $( 6 )$ , every state-action transition pair corresponds to a constraint, which is intractable to
186
+ 142 solve using conventional reinforement learning algorithms. Our intuition is that, instead of directly
187
+ 143 constraining the cost of each possible state-action transition, we can constrain the expected maximum
188
+ 144 state-wise cost along the trajectory, which is much easier to solve. Following that intuition, we define
189
+ 145 a novel Maximum Markov-Decision Process (MMDP), which further extends CMDP via (i) a set of
190
+ 146 up-to-now maximum state-wise costs $M \doteq [ M _ { 1 } , M _ { 2 } , \cdot \cdot \cdot , M _ { m } ]$ where $M _ { i } \in \mathcal { M } \subset \mathbb { R }$ , and (ii) a set
191
+ 147 of cost increment functions, $D _ { 1 } , D _ { 2 } , \cdots , D _ { m }$ , where $D _ { i } : ( \mathcal { S } , \mathcal { M } ^ { m } ) \times \mathcal { A } \times \mathcal { S } \mapsto [ 0 , \mathbb { R } ^ { + } ]$ maps the
192
+ 148 augmented state action transition tuple into a non-negative cost increment. We define the augmented
193
+ 149 state $\hat { s } = ( s , M ) \in ( S , \mathcal { M } ^ { m } ) \doteq \hat { S }$ , where $\hat { S }$ is the augmented state space. Formally,
194
+
195
+ $$
196
+ D _ { i } \big ( \hat { s } _ { t } , a _ { t } , \hat { s } _ { t + 1 } \big ) = \operatorname* { m a x } \{ C _ { i } \big ( s _ { t } , a _ { t } , s _ { t + 1 } \big ) - M _ { i t } , 0 \} .
197
+ $$
198
+
199
+ By setting 150 $D _ { i } \big ( \hat { s } _ { 0 } , a _ { 0 } , \hat { s } _ { 1 } \big ) \ : = \ : C _ { i } \big ( s _ { 0 } , a _ { 0 } , s _ { 1 } \big )$ , we have $\begin{array} { r } { M _ { i t } = \sum _ { k = 0 } ^ { t - 1 } D _ { i } \big ( \hat { s } _ { k } , a _ { k } , \hat { s } _ { k + 1 } \big ) } \end{array}$ for $t \geq 1$ 151 Hence, we define expected maximum state-wise cost (or $D _ { i }$ -return) for $\pi$ :
200
+
201
+ $$
202
+ \mathcal { I } _ { D _ { i } } ( \pi ) = \mathbb { E } _ { \tau \sim \pi } \left[ \sum _ { t = 0 } ^ { H } D _ { i } \big ( \hat { s } _ { t } , a _ { t } , \hat { s } _ { t + 1 } \big ) \right] .
203
+ $$
204
+
205
+ 152 Importantly, $\textcircled{8}$ is the key component of MMDP and differs our work from existing safe RL ap
206
+ 153 proaches that are based on CMDP cost measure $( 2 )$ . With $( 8 ) , ( 6 )$ can be rewritten as:
207
+
208
+ $$
209
+ \operatorname* { m a x } _ { \pi } \mathcal { I } ( \pi ) , \ \mathbf { s . t . } \forall i , \mathcal { I } _ { D _ { i } } ( \pi ) \leq w _ { i } ,
210
+ $$
211
+
212
+ 154 where $\begin{array} { r } { \mathcal { I } ( \pi ) = \mathbb { E } _ { \tau \sim \pi } \left[ \sum _ { t = 0 } ^ { H } \gamma ^ { t } R ( \hat { s } _ { t } , a _ { t } , \hat { s } _ { t + 1 } ) \right] } \end{array}$ and $R ( \hat { s } , a , \hat { s } ^ { \prime } ) \doteq R ( s , a , s ^ { \prime } )$ . With $R ( \tau )$ being the
213
+ 155 discounted return of a trajectory, we define the on-policy value function as $\begin{array} { r } { V ^ { \pi } ( \hat { s } ) \doteq \mathbb { E } _ { \tau \sim \pi } [ R ( \tau ) | \hat { s } _ { 0 } = } \end{array}$
214
+ 156 $\hat { s } ]$ , the on-policy action-value function as $Q ^ { \pi } ( \hat { s } , a ) \doteq \perp _ { \tau \sim \pi } [ R ( \tau ) | \hat { s } _ { 0 } = \hat { s } , a _ { 0 } = a ] .$ , and the advantage
215
+ 157 function as $A ^ { \pi } ( { \hat { s } } , a ) \doteq Q ^ { \pi } ( { \hat { s } } , a ) - V ^ { \pi } ( { \hat { s } } )$ . Lastly, we define on-policy value functions, action-value
216
+ 158 functions, and advantage functions for the cost increments in analogy to $V ^ { \pi }$ , $Q ^ { \pi }$ , and $A ^ { \pi }$ , with $D _ { i }$
217
+ 159 replacing $R$ , respectively. We denote those by $V _ { D _ { i } } ^ { \pi }$ , $Q _ { D _ { i } } ^ { \pi }$ and $A _ { D _ { i } } ^ { \pi }$ .
218
+
219
+ # 160 4 State-wise Constrained Policy Optimization
220
+
221
+ 161 To solve large and continuous MDPs, policy search algorithms search for the optimal policy within a
222
+ 162 set $\Pi _ { \theta } \subset \Pi$ of parametrized policies. In local policy search [Peters and Schaal, $\boxed { 2 0 0 8 }$ , the policy is
223
+ 163 iteratively updated by maximizing $\mathcal { I } ( \pi )$ over a local neighborhood of the most recent policy $\pi _ { k }$ . In
224
+ 164 local policy search for SCMDPs, policy iterates must be feasible, so optimization is over $\Pi _ { \theta } \bigcap { \bar { \Pi } } _ { C }$ .
225
+ 165 The optimization problem is:
226
+
227
+ $$
228
+ \begin{array} { r l } & { \pi _ { k + 1 } = \underset { \pi \in \Pi _ { \theta } } { \mathbf { a r g m a x } } \mathcal { I } ( \pi ) , } \\ & { ~ \mathrm { s . t . } \mathcal { D } i s t ( \pi , \pi _ { k } ) \leq \delta , } \\ & { ~ \mathcal { I } _ { D _ { i } } ( \pi ) \leq w _ { i } , i = 1 , \cdot \cdot \cdot , m . } \end{array}
229
+ $$
230
+
231
+ 166 where $\mathcal { D } i s t$ is some distance measure, and $\delta > 0$ is a step size. For actual implementation, we need
232
+ 167 to evaluate the constraints first in order to determine the feasible set. However, it is challenging to
233
+ 168 evaluate the constraints using samples during the learning process. In this work, we propose SCPO
234
+ 169 inspired by recent trust region optimization methods $\boxed { \mathrm { S c h u l m a n ~ e t ~ a l . } } \boxed { 2 0 1 5 } ]$ . SCPO approximates
235
+ 170 $\underline { { \hat { \left( \mathrm { 1 0 } \right) } } }$ using (i) KL divergence distance metric $\mathcal { D } i s t$ and (ii) surrogate functions for the objective and
236
+ 171 constraints, which can be easily estimated from samples on $\pi _ { k }$ . Mathematically, SCPO requires
237
+ 172 the policy update at each iteration is bounded within a trust region, and updates policy via solving
238
+ 173 following optimization:
239
+
240
+ $$
241
+ \begin{array} { r l } & { \mathrm { \tt \tt 1 } = \underset { \pi \in \Pi _ { \theta } } { \bf { r g m a x } } \ \underset { \hat { a } \sim \pi ^ { \pi } } { \mathbb { E } } \big [ A ^ { \pi _ { k } } \big ( \hat { s } , a \big ) \big ] } \\ & { \mathrm { s . t . } \ \mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi _ { k } } } \big [ \mathcal { D } _ { K L } \big ( \pi \| \pi _ { k } \big ) [ \hat { s } ] \big ] \leq \delta , } \\ & { \mathrm { \tt \top } _ { D _ { i } } \big ( \pi _ { k } \big ) + \underset { \hat { a } \sim \pi } { \mathbb { E } } \bigg [ A _ { D _ { i } } ^ { \pi _ { k } } \big ( \hat { s } , a \big ) \bigg ] + 2 \big ( H + 1 \big ) \epsilon _ { D _ { i } } ^ { \pi } \sqrt { \frac { 1 } { 2 } \delta } \leq w _ { i } , i = 1 , \cdots , m . } \end{array}
242
+ $$
243
+
244
+ 174 where $\mathcal { D } _ { K L } ( \pi ^ { \prime } \| \pi ) [ \hat { s } ]$ is $\mathrm { K L }$ divergence between two policy $( \pi ^ { \prime } , \pi )$ at state $\hat { s }$ , the set $\{ \pi \in$
245
+ 175 $\Pi _ { \theta } ~ : ~ \mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi _ { k } } } [ \mathcal { D } _ { K L } ( \pi \| \pi _ { k } ) [ \hat { s } ] ] \le \delta \}$ is called trust region, $\begin{array} { r } { d ^ { \pi _ { k } } \doteq ( 1 - \gamma ) \sum _ { t = 0 } ^ { H } \gamma ^ { t } P ( \hat { s } _ { t } = \hat { s } | \pi _ { k } ) } \end{array}$
246
+ 176 $\begin{array} { r } { \bar { d } ^ { \pi _ { k } } \doteq \sum _ { t = 0 } ^ { H } P ( \hat { s } _ { t } = \hat { s } | \pi _ { k } ) } \end{array}$ and $\epsilon _ { D _ { i } } ^ { \pi } \doteq \mathbf { m } \mathbf { a x } _ { \hat { s } } \vert \mathbb { E } _ { a \sim \pi } [ A _ { D _ { i } } ^ { \pi _ { k } } ( \hat { s } , a ) ] \vert$ t=0 . We then show that SCPO guaran
247
+ 177 tees (i) worst case maximum state-wise cost violation, and (ii) worst case performance degradation
248
+ 178 for policy update, by establishing new bounds on the difference in returns between two stochastic
249
+ 179 policies $\pi$ and $\pi ^ { \prime }$ for MMDPs.
250
+ 180 Theoretical Guarantees for SCPO We start with the theoretical foundation for our approach,
251
+ 181 i.e. a new bound on the difference in state-wise maximum cost between two arbitrary policies. The
252
+ 182 following theorem connects the difference in maximum state-wise cost between two arbitrary policies
253
+ 183 to the total variation divergence between them. Here total variation divergence between discrete
254
+ 184 probability distributions $p , q$ is defined as $\begin{array} { r } { \mathcal { D } _ { T V } ( p | | q ) = \frac { 1 } { 2 } \sum _ { i } | p _ { i } - q _ { i } | } \end{array}$ . This measure can be easily
255
+ 185 extended to continuous states and actions by replacing the sums with integrals. Thus, the total variation
256
+ 186 divergence between two policy $( \pi ^ { \prime } , \pi )$ at state $\hat { s }$ is defined as: $\mathcal { D } _ { T V } ( \pi ^ { \prime } \| \bar { \pi } ) [ \hat { s } ] = \mathcal { D } _ { T V } ( \pi ^ { \prime } ( \cdot | \hat { s } ) \| \pi ( \cdot | \hat { s } ) )$ .
257
+ 187 188 $\epsilon _ { D } ^ { \pi ^ { \prime } } \doteq \mathbf { m a x } _ { \hat { s } } \vert \mathbb { E } _ { a \sim \pi ^ { \prime } } [ A _ { D } ^ { \pi } ( \hat { s } , a ) ] \vert$ ate State-wis, and define $\begin{array} { r } { \bar { d } ^ { \pi } = \sum _ { t = 0 } ^ { H } P ( \hat { s } _ { t } = \hat { s } | \pi ) } \end{array}$ For any policies as the non-disco $\pi ^ { \prime } , \pi$ , with aug
258
+ 189 mented state distribution using $\pi$ , then the following bound holds:
259
+
260
+ $$
261
+ \begin{array} { r } { \mathcal { I } _ { D } ( \pi ^ { \prime } ) - \mathcal { I } _ { D } ( \pi ) \leq \underset { \underset { a \sim \pi ^ { \prime } } { \hat { s } \sim \bar { d } ^ { \pi ^ { \prime } } } } { \mathbb { E } } \left[ A _ { D } ^ { \pi } ( \hat { s } , a ) + 2 ( H + 1 ) \epsilon _ { D } ^ { \pi ^ { \prime } } \mathcal { D } _ { T V } ( \pi ^ { \prime } | | \pi ) [ \hat { s } ] \right] . } \end{array}
262
+ $$
263
+
264
+ 190 The proof for Theorem $^ 1$ is summarized in Appendix $\boxed { \mathrm { A } }$ Next, we note the following relationship
265
+ 191 between the total variation divergence and the KL divergence [Boyd et al., 2003, Achiam et al., 2017a]:
266
+ 192 $\begin{array} { r } { \mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi } } [ \mathcal { D } _ { \underline { { T } } V } ( p \| q ) [ \hat { s } ] ] \leq \sqrt { \frac { 1 } { 2 } \mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi } } [ \mathcal { D } _ { K L } ( p \| q ) [ \hat { s } ] ] } } \end{array}$ . The following bound then follows directly from
267
+ 193 Theorem 1:
268
+
269
+ $$
270
+ \mathcal { I } _ { D } ( \pi ^ { \prime } ) \leq \mathcal { I } _ { D } ( \pi ) + \underset { \ a \sim \pi ^ { \prime } } { \mathbb { E } } \bigg [ A _ { D } ^ { \pi } ( \hat { s } , a ) + 2 ( H + 1 ) \epsilon _ { D } ^ { \pi ^ { \prime } } \sqrt { \frac { 1 } { 2 } \mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi } } [ \mathcal { D } _ { K L } ( \pi ^ { \prime } \| \pi ) [ \hat { s } ] ] } \bigg ] .
271
+ $$
272
+
273
+ 194 By Equation $\textcircled { 1 3 }$ , we have a guarantee for satisfaction of maximum state-wise constraints:
274
+
275
+ 195 Proposition 1 (SCPO Update Constraint Satisfaction). Suppose $\pi _ { k } , \pi _ { k + 1 }$ are related by $\textcircled { 1 1 }$ , then
276
+ 196 $D _ { i }$ -return for $\pi _ { k + 1 }$ satisfies
277
+
278
+ $$
279
+ \forall i , { \mathcal { T } } _ { D _ { i } } ( \pi _ { k + 1 } ) \leq w _ { i } .
280
+ $$
281
+
282
+ 198 Proposition $\mathbb { I }$ presents the first constraint satisfaction guarantee under MMDP. Unlike trust region
283
+ 199 methods such as CPO and TRPO, which assume a discounted sum characteristic, MMDP’s non
284
+ 200 discounted sum characteristic invalidates these theories. As the maximum state-wise cost is calculated
285
+ 201 through a summation of non-discounted increments, analysis must be performed on a finite horizon to
286
+ 202 upper bound the worst-case summation. In contrast, the theory behind CPO relies on infinite horizon
287
+ 203 analysis with discounted constraint assumptions, which is not applicable for MMDP settings.
288
+
289
+ Next, we provide the performance guarantee of SCPO. Previous analyses of performance guarantees have focused on infinite-horizon MDP. We generalize the analysis to finite-horizon MDP, inspired by previous work [Kakade and Langford, $\begin{array} { r } { \boxed { 2 0 0 2 } , } \end{array}$ Schulman et al., 2015, Achiam et al., 2017a], and prove it in Appendix B. The infinite-horizon case can be viewed as a special case of the finite-horizon setting.
290
+
291
+ Proposition 2 (SCPO Update Worst Performance Degradation). Suppose $\pi _ { k }$ , $\pi _ { k + 1 }$ are related by $\textcircled { 1 1 }$ , with $\epsilon ^ { \pi _ { k + 1 } } \doteq \mathbf { m } \mathbf { a x } _ { \hat { s } } | \mathbb { E } _ { a \sim \pi _ { k + 1 } } [ A ^ { \pi _ { k } } ( \hat { s } , a ) ] |$ , then performance return for $\pi _ { k + 1 }$ satisfies
292
+
293
+ $$
294
+ \mathcal { I } ( \pi _ { k + 1 } ) - \mathcal { I } ( \pi _ { k } ) \geq - \frac { \sqrt { 2 \delta } \gamma \epsilon ^ { \pi _ { k + 1 } } } { 1 - \gamma } .
295
+ $$
296
+
297
+ # 211 5 Practical Implementation
298
+
299
+ 212 In this section, we show how to (a) implement an efficient approximation to the update $( 1 1 )$ , (b)
300
+ 213 encourage learning even when $( 1 1 )$ becomes infeasible, and (c) handle the difficulty of fitting
301
+ 214 augmented value $V _ { D _ { i } } ^ { \pi }$ which is unique to our novel MMDP formulation. The full SCPO pseudocode
302
+ 215 is given as algorithm 1 in appendix C.
303
+ 216 Practical implementation with sample-based estimation We first estimate the objective and
304
+ 217 constraints in $\mathbb { \underline { { ( 1 1 ) } } }$ using samples. Note that we can replace the expected advantage on rewards using
305
+ 218 an importance sampling estimator with a sampling distribution $\pi _ { k }$ [Achiam et al., $\boxed { 2 0 1 7 \mathrm { a } }$ as
306
+
307
+ $$
308
+ \mathbb { E } _ { \hat { s } \sim d ^ { \pi _ { k } } , a \sim \pi } [ A ^ { \pi _ { k } } ( \hat { s } , a ) ] = \mathbb { E } _ { \hat { s } \sim d ^ { \pi _ { k } } , a \sim \pi _ { k } } \left[ \frac { \pi ( a | \hat { s } ) } { \pi _ { k } ( a | \hat { s } ) } A ^ { \pi _ { k } } ( \hat { s } , a ) \right] .
309
+ $$
310
+
311
+ 219 $( 1 4 )$ allows us to replace $A ^ { \pi _ { k } }$ with empirical estimates at each state-action pair $( \hat { s } , a )$ from rollouts
312
+ 220 by the previous policy $\pi _ { k }$ . The empirical estimate of reward advantage is given by $R ( \hat { s } , a , \hat { s } ^ { \prime } ) +$
313
+ 221 $\gamma \dot { V } ^ { \pi _ { k } } ( \bar { \hat { s } } ^ { \prime } ) - { V } ^ { \pi _ { k } } ( \hat { s } )$ . $V ^ { \pi _ { k } } \left( \hat { s } \right)$ can be computed at each augmented state by taking the discounted
314
+ 222 future return. The same can be applied to the expected advantage with respect to cost increments, with
315
+ 223 the sample estimates given by $\begin{array} { r } { \bar { D _ { i } } ( \hat { s } , a , \hat { s } ^ { \prime } ) + \bar { V _ { D _ { i } } ^ { \pi _ { k } } } ( \hat { s } ^ { \prime } ) - { V _ { D _ { i } } ^ { \pi _ { k } } } ( \hat { s } ) } \end{array}$ . $V _ { D _ { i } } ^ { \pi _ { k } } \left( \hat { s } \right)$ is computed by taking the
316
+ 224 non-discounted future $D _ { i }$ -return. To proceed, we convexify $( 1 1 )$ by approximating the objective and
317
+ 225 cost constraint via first-order expansions, and the trust region constraint via second-order expansions.
318
+ 226 Then, $\textcircled{1 1 }$ can be efficiently solved using duality [Achiam et al., $\underline { { 2 0 1 7 a } }$ .
319
+ 227 Infeasible constraints An update to $\theta$ is computed every time $\textcircled { 1 1 }$ is solved. However, due to
320
+ 228 approximation errors, sometimes $( 1 1 )$ can become infeasible. In that case, we follow [Achiam
321
+ 229 et al., 2017a] to propose an recovery update that only decreases the constraint value within the trust
322
+ 230 region. In addition, approximation errors can also cause the proposed policy update (either feasible
323
+ 231 or recovery) to violate the original constraints in $( 1 1 )$ . Hence, each policy update is followed by
324
+ 232 a backtracking line search to ensure constraint satisfaction. If all these fails, we relax the search
325
+ 233 condition by also accepting decreasing expected advantage with respect to the costs, when the cost
326
+ 234 constraints are already violated. Denoting $c _ { i } \doteq \mathcal { J } _ { D _ { i } } ( \pi _ { k } ) + 2 ( H + 1 ) \epsilon _ { D } ^ { \pi } \sqrt { \delta / 2 } - w _ { i }$ , the above criteria
327
+ 235 can be summarized as
328
+
329
+ $$
330
+ \mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi _ { k } } } [ \mathcal { D } _ { K L } ( \pi \| \pi _ { k } ) [ \hat { s } ] ] \le \delta
331
+ $$
332
+
333
+ $$
334
+ \mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi _ { k } } , a \sim \pi } \left[ A _ { D _ { i } } ^ { \pi _ { k } } ( \hat { s } , a ) \right] - \mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi _ { k } } , a \sim \pi _ { k } } \left[ A _ { D _ { i } } ^ { \pi _ { k } } ( \hat { s } , a ) \right] \leq \operatorname* { m a x } ( - c _ { i } , 0 ) .
335
+ $$
336
+
337
+ Note that the previous expected advantage 236 $\mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi _ { k } } , a \sim \pi _ { k } } \left[ A _ { D _ { i } } ^ { \pi _ { k } } ( \hat { s } , a ) \right]$ is also estimated from rollouts 237 by $\pi _ { k }$ and converges to zero asymptotically, which recovers the original cost constraints in $\textcircled { 1 1 }$ .
338
+
339
+ 238 Imbalanced cost value targets A critical step in solving $\textcircled { 1 1 }$ is to fit the cost increment value
340
+ 239 functions $V _ { D _ { i } } ^ { \pi _ { k } } ( \hat { s } _ { t } )$ . By definition, $V _ { D _ { i } } ^ { \pi _ { k } } ( \hat { s } _ { t } )$ is equal to the maximum cost increment in any future
341
+ 240 i i state over the maximal state-wise cost so far. In other words, the true $V _ { D _ { i } } ^ { \pi _ { k } }$ will always be zero for all
342
+ 241 $\hat { s } _ { t : H }$ when the maximal state-wise cost has already occurred before time $t$ . In practice, this causes
343
+ 242 the distribution of cost increment value function to be highly zero-skewed and makes the fitting very
344
+ 243 hard. To mitigate the problem, we sub-sample the zero-valued targets to match the population of
345
+ 244 non-zero values. We provide more analysis on this trick in Q3 in section $\boxed { 6 . 2 }$
346
+
347
+ In our experiments, we aim to answer these questions:
348
+
349
+ Q1 How does SCPO compare with other state-of-theart methods for safe RL?
350
+
351
+ Q2 What benefits are demonstrated by constraining the maximum state-wise cost?
352
+
353
+ Q3 How do the sub-sampling trick of SCPO impact its performance?
354
+
355
+ # 6.1 Experiment Setups
356
+
357
+ New Safety Gym To showcase the effectiveness of our state-wise constrained policy optimization approach, we enhance the widely recognized safe reinforcement learning benchmark environment, Safety $\mathrm { G y m } [ \mathrm { R a y \ e t \ a l . } ] \ [ \mathrm { 2 0 1 9 } ]$ , by incorporating additional robots and constraints. Subsequently, we perform a series of experiments on this augmented environment.
358
+
359
+ Our experiments are based on five different robots: (i) Point: Figure $2 \mathrm { a } \mathrm { A }$ point-mass robot $( \mathcal { A } \subseteq \mathbb { R } ^ { 2 }$ ) that can move on the ground. (ii) Swimmer: Figure $\bigstar$ A three-link robot $( \mathcal { A } \subseteq \mathbb { R } ^ { 2 }$ ) that can move on the ground. (iii) Walker: Figure 2d A bipedal robot $[ A \subseteq \mathbb { R } ^ { 1 0 } ]$ that can move on the ground. (iv) Ant: Figure $\mathbf { \left\lfloor 2 c \right\rfloor A }$ quadrupedal robot $\mathcal { A } \subseteq \mathbb { R } ^ { 8 \cdot }$ ) that can move on the ground. (v) Drone: Figure $2 \mathrm { e } \mathrm { A }$ quadrotor robot $\bar { ( \mathcal { A } \subseteq \mathbb { R } ^ { 4 } ) }$ that can move in the air.
360
+
361
+ ![](images/3eb78ec22c3e5e7f697ec3dca9f640247109bc107457d2415fbc10c22b0d0a42.jpg)
362
+ Figure 1: Comparison of results from two representative test suites in high dimensional systems (Ant and Walker).
363
+
364
+ 268 All of the experiments are based on the goal task where the robot must navigate to a goal. Additionally,
365
+ 269 since we are interested in episodic tasks (finite-horizon MDP), the environment will be reset once the
366
+ 270 goal is reached. For the robots that can move in 3D spaces (e.g, the Drone robot), we also design a
367
+ 271 new 3D goal task with a sphere goal floating in the 3D space. Three different types of constraints are
368
+ 272 considered: (i) Hazard: Dangerous areas as shown in Figure $3 \mathrm { a } .$ Hazards are trespassable circles on
369
+ 273 the ground. The agent is penalized for entering them. (ii) 3D Hazard: 3D Dangerous areas as shown
370
+ 274 in Figure $3 \mathbf { b } .$ 3D Hazards are trespassable spheres in the air. The agent is penalized for entering them.
371
+ (iii) Pillar: Fixed obstacles as shown in Figure 3c. The agent is penalized for hitting them.
372
+ 276 Considering different robots, constraint types, and constraint difficulty levels, we design 14 test suites
373
+ 277 with 5 types of robots and 9 types of constraints, which are summarized in Table 1 in Appendix. We
374
+ 278 name these test suites as {Robot}-{Constraint Type}-{Constraint Number}.
375
+ 279 Comparison Group The methods in the comparison group include: (i) unconstrained RL algorithm
376
+ 280 TRPO [Schulman et al., 2015] (ii) end-to-end constrained safe RL algorithms CPO [Achiam et al.,
377
+ 281 2017a], TRPO-Lagrangian [Bohez et al., 2019], TRPO-FAC [Ma et al., 2021], TRPO-IPO [Liu et al.,
378
+ 282 2020], PCPO [Yang et al., 2020b], and (iii) hierarchical safe RL algorithms TRPO-SL (TRPO-Safety
379
+ 283 Layer) [Dalal et al., $\boxed { 2 0 1 8 }$ , TRPO-USL (TRPO-Unrolling Safety Layer) [Zhang et al., 2022b] . We
380
+ 284 select TRPO as our baseline method since it is state-of-the-art and already has safety-constrained
381
+ 285 derivatives that can be tested off-the-shelf. For hierarchical safe RL algorithms, we employ a warm-up
382
+ 286 phase $1 / 3$ of the whole epochs) which does unconstrained TRPO training, and the generated data
383
+ 287 will be used to pre-train the safety critic for future epochs. For all experiments, the policy $\pi$ , the value
384
+ 288 $( V ^ { \pi } , V _ { D } ^ { \pi } )$ are all encoded in feedforward neural networks using two hidden layers of size (64,64)
385
+ 289 with tanh activations. More details are provided in Appendix D.
386
+ 290 Evaluation Metrics For comparison, we evaluate algorithm performance based on (i) reward
387
+ 291 performance, (ii) average episode cost and (iii) cost rate. Comparison metric details are provided
388
+ 292 in Appendix $\mathbf { D } . 3 .$ We set the limit of cost to 0 for all the safe RL algorithms since we aim to avoid
389
+ 293 any violation of the constraints. For our comparison, we implement the baseline safe RL algorithms
390
+ 294 exactly following the policy update / action correction procedure from the original papers. We
391
+ 295 emphasize that in order for the comparison to be fair, we give baseline safe RL algorithms every
392
+ 296 advantage that is given to SCPO, including equivalent trust region policy updates.
393
+
394
+ ![](images/352eb55d3c1e32d8afe19dad5ac603b7bde1bf2ace2aef2421b32fec1e23456c.jpg)
395
+ Figure 2: Robots for benchmark problems in upgraded Safety Gym.
396
+
397
+ ![](images/ee4f8c3e51f8ff50232b6b6653a367f08c0f9deb461ba66e20afe909b48792ad.jpg)
398
+ Figure 3: Constraints for benchmark problems in upgraded Safety Gym.
399
+
400
+ ![](images/f97adf9322eea33c453f6b4414ec80bcb32228b01e8c8a971290880d7b9457fd.jpg)
401
+ Figure 4: Comparison of results from four representative test suites in low dimensional systems (Point, Swimmer, and Drone).
402
+
403
+ # 6.2 Evaluating SCPO and Comparison Analysis
404
+
405
+ Low Dimension System We select four representative test suites on low dimensional system (Point, Swimmer, Drone) and summarize the comparison results on Figure $\mathbb { E } ,$ which demonstrate that SCPO is successful at approximately enforcing zero constraints violation safety performance in all environments after the policy converges. Specifically, compared with the baseline safe RL methods, SCPO is able to achieve (i) near zero average episode cost and (ii) significantly lower cost rate without sacrificing reward performance. The baseline end-to-end safe RL methods (TRPOLagrangian, TRPO-FAC, TRPO-IPO, CPO, PCPO) fail to achieve the near zero cost performance
406
+
407
+ 305 even when the cost limit is set to be 0. The baseline hierarchical safe RL methods (TRPO-SL,
408
+ 306 TRPO-USL) also fail to achieve near zero cost performance even with an explicit safety layer to
409
+ 307 correct the unsafe action at every time step. End-to-end safe RL algorithms fail since all methods
410
+ 308 rely on CMDP to minimize the discounted cumulative cost while SCPO directly work with MMDP
411
+ 309 to restrict the state-wise maximum cost by Proposition $\nsupseteq$ We also observe that TRPO-SL fails to
412
+ 310 lower the violation during training, due to the fact that the linear approximation of cost function
413
+ 311 $C ( \hat { s } _ { t } , a , \hat { s } _ { t + 1 } )$ [Dalal et al., 2018] becomes inaccurate when the dynamics are highly nonlinear like
414
+ 312 the ones we used in MuJoCo [Todorov et al., 2012]. More detailed metrics for comparison and
415
+ 313 experimental results on test suites with low dimension systems are summarized in Appendix D.3.
416
+ 314 High Dimension System To demonstrate the scalability and per
417
+ 315 formance of SCPO in high-dimensional systems, we conducted ad
418
+ 316 ditional tests on the Ant-Hazard-8 and Walker-Hazard-8 suites, with
419
+ 317 8-dimensional and 10-dimensional control spaces, respectively. The
420
+ 318 comparison results for high-dimensional systems are summarized in
421
+ 319 Figure $\bigtriangledown$ which show that SCPO outperforms all other baselines in
422
+ 320 enforcing zero safety violation without compromising performance
423
+ 321 in terms of return. SCPO rapidly stabilizes the cost return around
424
+ 322 zero and significantly reduces the cost rate, while the other baselines
425
+ 323 fail to converge to a policy with near-zero cost. The comparison
426
+ 324 results of both low dimension and high dimension systems answer
427
+ 325 Q1.
428
+ 326 Maximum State-wise Cost As pointed in Section 3.3, the under
429
+ 327 lying magic for enabling near-zero safety violation is to restrict the maximum state-wise cost to stay
430
+ 328 around zero. To have a better understanding of this process, we visualize the evolution of maximum
431
+ 329 state-wise cost for SCPO on the challenging high-dimensional Ant-Hazard-8 and Walker-Hazard-8
432
+ 330 test suites in Figure $5$ , which answers Q2.
433
+
434
+ ![](images/a8e823ea1e7b8ca3c37ad70833e6d7abda61aed9b5dbc5833f2b04387cd0e8d2.jpg)
435
+ Figure 5: Maximum state-wise cost
436
+
437
+ Ablation on Sub-sampling Imbalanced Cost Increment Value Targets As pointed in Section $\textcircled { 5 }$ fitting $V _ { D _ { i } } ^ { \pi _ { k } } \left( \hat { s } _ { t } \right)$ is a critical step towards solving SCPO, which is challenging due to zero-skewed distribution of cost increment value function. To demonstrate the necessity of sub-sampling for solving this challenge, we compare the performance of SCPO with and without sub-sampling trick on the aerial robot test suite, summarized in Figure $6 .$ It is evident that with sub-sampling, the agent achieves higher rewards and more importantly, converges to near-zero costs.
438
+
439
+ ![](images/9f1958df6f801c284795fd2a5a004b2d3a5748d27cfc752dc8db7da3f7ea52cc.jpg)
440
+ Figure 6: SCPO sub-sampling ablation study with Drone-3DHazard-8
441
+
442
+ That is because sub-sampling effectively balances the cost increment value targets and improves the fitting of $V _ { D _ { i } } ^ { \pi _ { k } } ( \hat { s } _ { t } )$ . We also attempted to solve the imbalance issue via over-sampling non-zero targets, but did not observe promising results. This ablation study provides insights into Q3.
443
+
444
+ # 45 7 Conclusion and Future Work
445
+
446
+ This paper proposed SCPO, the first general-purpose policy search algorithm for state-wise constrained RL. Our approach provides guarantees for state-wise constraint satisfaction at each iteration, allows training of high-dimensional neural network policies while ensuring policy behavior, and is based on a new theoretical result on Maximum Markov Decision Process. We demonstrate SCPO’s effectiveness on robot locomotion tasks, showing its significant performance improvement compared to existing methods and ability to handle state-wise constraints.
447
+
448
+ Limitation and future work One limitation of our work is that, although SCPO satisfies state-wise constraints, the theoretical results are valid only in expectation, meaning that constraint violations are still possible during deployment. To address that, we will study absolute state-wise constraint satisfaction, i.e. bounding the maximal possible state-wise cost, which is even stronger than the current result (satisfaction in expectation).
449
+
450
+ 357 References 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. Oriol Vinyals, Igor Babuschkin, Wojciech M Czarnecki, Michaël Mathieu, Andrew Dudzik, Junyoung Chung, David H Choi, Richard Powell, Timo Ewalds, Petko Georgiev, et al. Grandmaster level in starcraft ii using multi-agent reinforcement learning. Nature, 575(7782):350–354, 2019. Noam Brown and Tuomas Sandholm. Superhuman ai for heads-up no-limit poker: Libratus beats top professionals. Science, 359(6374):418–424, 2018. Tairan He, Yuge Zhang, Kan Ren, Minghuan Liu, Che Wang, Weinan Zhang, Yuqing Yang, and Dongsheng Li. Reinforcement learning with automated auxiliary loss search. arXiv preprint arXiv:2210.06041, 2022. Wei-Ye Zhao, Xi-Ya Guan, Yang Liu, Xiaoming Zhao, and Jian Peng. Stochastic variance reduction for deep q-learning. arXiv preprint arXiv:1905.08152, 2019. Shangding Gu, Long Yang, Yali Du, Guang Chen, Florian Walter, Jun Wang, Yaodong Yang, and Alois Knoll. A review of safe reinforcement learning: Methods, theory and applications. arXiv preprint arXiv:2205.10330, 2022. Alex Ray, Joshua Achiam, and Dario Amodei. Benchmarking safe exploration in deep reinforcement learning. CoRR, abs/1910.01708, 2019. Joshua Achiam, David Held, Aviv Tamar, and Pieter Abbeel. Constrained policy optimization. In International conference on machine learning, pages 22–31. PMLR, 2017a. Yongshuai Liu, Avishai Halev, and Xin Liu. Policy learning with constraints in model-free reinforcement learning: A survey. In The 30th International Joint Conference on Artificial Intelligence (IJCAI), 2021. Weiye Zhao, Tairan He, Rui Chen, Tianhao Wei, and Changliu Liu. State-wise safe reinforcement learning: A survey. The 32nd International Joint Conference on Artificial Intelligence (IJCAI), 2023.
451
+ 384 Joshua Achiam, David Held, Aviv Tamar, and Pieter Abbeel. Constrained policy optimization. In International Conference on Machine Learning, pages 22–31. PMLR, 2017b. Yongshuai Liu, Jiaxin Ding, and Xin Liu. IPO: interior-point policy optimization under constraints. CoRR, abs/1910.09615, 2019. URL http://arxiv.org/abs/1910.09615. Tsung-Yen Yang, Justinian Rosca, Karthik Narasimhan, and Peter J. Ramadge. Projection-based constrained policy optimization. CoRR, abs/2010.03152, 2020a. URL https://arxiv.org/ abs/2010.03152. Homanga Bharadhwaj, Aviral Kumar, Nicholas Rhinehart, Sergey Levine, Florian Shkurti, and Animesh Garg. Conservative safety critics for exploration. arXiv preprint arXiv:2010.14497, 2020. Linrui Zhang, Qin Zhang, Li Shen, Bo Yuan, Xueqian Wang, and Dacheng Tao. Evaluating model-free reinforcement learning toward safety-critical tasks. arXiv preprint arXiv:2212.05727, 2022a. Yinlam Chow, Ofir Nachum, Aleksandra Faust, Edgar Duenez-Guzman, and Mohammad Ghavamzadeh. Lyapunov-based safe policy optimization for continuous control. ICML 2019 Workshop RL4RealLife, abs/1901.10031, 2019. Gal Dalal, Krishnamurthy Dvijotham, Matej Vecerik, Todd Hester, Cosmin Paduraru, and Yuval Tassa. Safe exploration in continuous action spaces. CoRR, abs/1801.08757, 2018. Qingkai Liang, Fanyu Que, and Eytan Modiano. Accelerated primal-dual policy optimization for safe reinforcement learning. arXiv preprint arXiv:1802.06480, 2018.
452
+ 402 Chen Tessler, Daniel J Mankowitz, and Shie Mannor. arXiv preprint arXiv:1805.11074, 2018.
453
+
454
+ 403 Steven Bohez, Abbas Abdolmaleki, Michael Neunert, Jonas Buchli, Nicolas Heess, and Raia Hadsell.
455
+ 404 Value constrained model-free continuous control. arXiv preprint arXiv:1902.04623, 2019.
456
+ 405 Tairan He, Weiye Zhao, and Changliu Liu. Autocost: Evolving intrinsic cost for zero-violation
457
+ 406 reinforcement learning. Proceedings of the AAAI Conference on Artificial Intelligence, 2023.
458
+ 407 Haitong Ma, Yang Guan, Shegnbo Eben Li, Xiangteng Zhang, Sifa Zheng, and Jianyu Chen. Feasible
459
+ 408 actor-critic: Constrained reinforcement learning for ensuring statewise safety. arXiv preprint
460
+ 409 arXiv:2105.10682, 2021.
461
+ 410 Jan Peters and Stefan Schaal. Reinforcement learning of motor skills with policy gradients. Neural
462
+ 411 networks, 21(4):682–697, 2008.
463
+ 412 John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region
464
+ 413 policy optimization. In International conference on machine learning, pages 1889–1897. PMLR,
465
+ 414 2015.
466
+ 415 Stephen Boyd, Lin Xiao, and Almir Mutapcic. Subgradient methods. lecture notes of EE392o,
467
+ 416 Stanford University, Autumn Quarter, 2004:2004–2005, 2003.
468
+ 417 Sham Kakade and John Langford. Approximately optimal approximate reinforcement learning. In
469
+ 418 Proceedings of the Nineteenth International Conference on Machine Learning, pages 267–274,
470
+ 419 2002.
471
+ 420 Yongshuai Liu, Jiaxin Ding, and Xin Liu. Ipo: Interior-point policy optimization under constraints.
472
+ 421 In Proceedings of the AAAI conference on artificial intelligence, volume 34, pages 4940–4947,
473
+ 422 2020.
474
+ 423 Tsung-Yen Yang, Justinian Rosca, Karthik Narasimhan, and Peter J Ramadge. Projection-based
475
+ 424 constrained policy optimization. arXiv preprint arXiv:2010.03152, 2020b.
476
+ 425 Linrui Zhang, Qin Zhang, Li Shen, Bo Yuan, and Xueqian Wang. Saferl-kit: Evaluating efficient
477
+ 426 reinforcement learning methods for safe autonomous driving. arXiv preprint arXiv:2206.08528,
478
+ 427 2022b.
479
+ 428 Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control.
480
+ 429 In 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems, pages 5026–5033.
481
+ 430 IEEE, 2012.
parse/dev/z9NLqoFvZ0/z9NLqoFvZ0_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/z9NLqoFvZ0/z9NLqoFvZ0_model.json ADDED
The diff for this file is too large to render. See raw diff