Datasets:
Add files using upload-large-folder tool
Browse files- parse/dev/8FhxBtXSl0/8FhxBtXSl0.md +0 -0
- parse/dev/8FhxBtXSl0/8FhxBtXSl0_content_list.json +0 -0
- parse/dev/8FhxBtXSl0/8FhxBtXSl0_middle.json +0 -0
- parse/dev/8FhxBtXSl0/8FhxBtXSl0_model.json +0 -0
- parse/dev/Bct2f8fRd8S/Bct2f8fRd8S_middle.json +0 -0
- parse/dev/JYtwGwIL7ye/JYtwGwIL7ye.md +347 -0
- parse/dev/JYtwGwIL7ye/JYtwGwIL7ye_content_list.json +1927 -0
- parse/dev/JYtwGwIL7ye/JYtwGwIL7ye_middle.json +0 -0
- parse/dev/JYtwGwIL7ye/JYtwGwIL7ye_model.json +0 -0
- parse/dev/Mspk_WYKoEH/Mspk_WYKoEH.md +0 -0
- parse/dev/Mspk_WYKoEH/Mspk_WYKoEH_middle.json +0 -0
- parse/dev/Mspk_WYKoEH/Mspk_WYKoEH_model.json +0 -0
- parse/dev/fwzUgo0FM9v/fwzUgo0FM9v.md +476 -0
- parse/dev/fwzUgo0FM9v/fwzUgo0FM9v_content_list.json +0 -0
- parse/dev/fwzUgo0FM9v/fwzUgo0FM9v_model.json +0 -0
- parse/dev/gERv_uy69IA/gERv_uy69IA.md +349 -0
- parse/dev/ktrw68Cmu9c/ktrw68Cmu9c.md +296 -0
- parse/dev/ktrw68Cmu9c/ktrw68Cmu9c_content_list.json +0 -0
- parse/dev/ktrw68Cmu9c/ktrw68Cmu9c_middle.json +0 -0
- parse/dev/ktrw68Cmu9c/ktrw68Cmu9c_model.json +0 -0
parse/dev/8FhxBtXSl0/8FhxBtXSl0.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/dev/8FhxBtXSl0/8FhxBtXSl0_content_list.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/dev/8FhxBtXSl0/8FhxBtXSl0_middle.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/dev/8FhxBtXSl0/8FhxBtXSl0_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/dev/Bct2f8fRd8S/Bct2f8fRd8S_middle.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/dev/JYtwGwIL7ye/JYtwGwIL7ye.md
ADDED
|
@@ -0,0 +1,347 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# THE EFFECTS OF REWARD MISSPECIFICATION: MAPPING AND MITIGATING MISALIGNED MODELS
|
| 2 |
+
|
| 3 |
+
Alexander Pan Caltech
|
| 4 |
+
|
| 5 |
+
Kush Bhatia UC Berkeley
|
| 6 |
+
|
| 7 |
+
Jacob Steinhardt UC Berkeley
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
Reward hacking—where RL agents exploit gaps in misspecified reward functions—has been widely observed, but not yet systematically studied. To understand how reward hacking arises, we construct four RL environments with misspecified rewards. We investigate reward hacking as a function of agent capabilities: model capacity, action space resolution, observation space noise, and training time. More capable agents often exploit reward misspecifications, achieving higher proxy reward and lower true reward than less capable agents. Moreover, we find instances of phase transitions: capability thresholds at which the agent’s behavior qualitatively shifts, leading to a sharp decrease in the true reward. Such phase transitions pose challenges to monitoring the safety of ML systems. To address this, we propose an anomaly detection task for aberrant policies and offer several baseline detectors.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
As reinforcement learning agents are trained with better algorithms, more data, and larger policy models, they are at increased risk of overfitting their objectives (Russell, 2019). Reward hacking, or the gaming of misspecified reward functions by RL agents, has appeared in a variety of contexts, such as game playing (Ibarz et al., 2018), text summarization (Paulus et al., 2018), and autonomous driving (Knox et al., 2021). These examples show that better algorithms and models are not enough; for human-centered applications such as healthcare (Yu et al., 2019), economics (Trott et al., 2021) and robotics (Kober et al., 2013), RL algorithms must be safe and aligned with human objectives (Bommasani et al., 2021; Hubinger et al., 2019).
|
| 16 |
+
|
| 17 |
+
Reward misspecifications occur because real-world tasks have numerous, often conflicting desiderata. In practice, reward designers resort to optimizing a proxy reward that is either more readily measured or more easily optimized than the true reward. For example, consider a recommender system optimizing for users’ subjective well-being (SWB). Because SWB is difficult to measure, engineers rely on more tangible metrics such as click-through rates or watch-time. Optimizing for misspecified proxies led YouTube to overemphasize watch-time and harm user satisfaction (Stray, 2020), as well as to recommended extreme political content to users (Ribeiro et al., 2020).
|
| 18 |
+
|
| 19 |
+
Addressing reward hacking is a first step towards developing human-aligned RL agents and one goal of ML safety (Hendrycks et al., 2021a). However, there has been little systematic work investigating when or how it tends to occur, or how to detect it before it runs awry. To remedy this, we study the problem of reward hacking across four diverse environments: traffic control (Wu et al., 2021), COVID response (Kompella et al., 2020), blood glucose monitoring (Fox et al., 2020), and the Atari game Riverraid (Brockman et al., 2016). Within these environments, we construct nine misspecified proxy reward functions (Section 3).
|
| 20 |
+
|
| 21 |
+
Using our environments, we study how increasing optimization power affects reward hacking, by training RL agents with varying resources such as model size, training time, action space resolution, and observation space noise (Section 4). We find that more powerful agents often attain higher proxy reward but lower true reward, as illustrated in Figure 1. Since the trend in ML is to increase resources exponentially each year (Littman et al., 2021), this suggests that reward hacking will become more pronounced in the future in the absence of countermeasures.
|
| 22 |
+
|
| 23 |
+

|
| 24 |
+
High mean commute
|
| 25 |
+
Figure 1: An example of reward hacking when cars merge onto a highway. A human-driver model controls the grey cars and an RL policy controls the red car. The RL agent observes positions and velocities of nearby cars (including itself) and adjusts its acceleration to maximize the proxy reward. At first glance, both the proxy reward and true reward appear to incentivize fast traffic flow. However, smaller policy models allow the red car to merge, whereas larger policy models exploit the misspecification by stopping the red car. When the red car stops merging, the mean velocity increases (merging slows down the more numerous grey cars). However, the mean commute time also increases (the red car is stuck). This exemplifies a phase transition: the qualitative behavior of the agent shifts as the model size increases.
|
| 26 |
+
|
| 27 |
+
More worryingly, we observe several instances of phase transitions. In a phase transition, the more capable model pursues a qualitatively different policy that sharply decreases the true reward. Figure 1 illustrates one example: An RL agent regulating traffic learns to stop any cars from merging onto the highway in order to maintain a high average velocity of the cars on the straightaway.
|
| 28 |
+
|
| 29 |
+
Since there is little prior warning of phase transitions, they pose a challenge to monitoring the safety of ML systems. Spurred by this challenge, we propose an anomaly detection task (Hendrycks & Gimpel, 2017; Tack et al., 2020): Can we detect when the true reward starts to drop, while maintaining a low false positive rate in benign cases? We instantiate our proposed task, POLYNOMALY, for the traffic and COVID environments (Section 5). Given a trusted policy with moderate performance, one must detect whether a given policy is aberrant. We provide several baseline anomaly detectors for this task and release our data at https://github.com/aypan17/ reward-misspecification.
|
| 30 |
+
|
| 31 |
+
# 2 RELATED WORK
|
| 32 |
+
|
| 33 |
+
Previous works have focused on classifying different types of reward hacking and sometimes mitigating its effects. One popular setting is an agent on a grid-world with an erroneous sensor. HadfieldMenell et al. (2017) show and mitigate the reward hacking that arises due to an incorrect sensor reading at test time in a $1 0 \mathrm { x } 1 0$ navigation grid world. Leike et al. (2017) show examples of reward hacking in a 3x3 boat race and a $5 \mathrm { x } 7$ tomato watering grid world. Everitt et al. (2017) theoretically study and mitigate reward hacking caused by a faulty sensor.
|
| 34 |
+
|
| 35 |
+
Game-playing agents have also been found to hack their reward. Baker et al. (2020) exhibit reward hacking in a hide-and-seek environment comprising 3-6 agents, 3-9 movable boxes and a few ramps: without a penalty for leaving the play area, the hiding agents learn to endlessly run from the seeking agents. Toromanoff et al. (2019) briefly mention reward hacking in several Atari games (Elevator Action, Kangaroo, Bank Heist) where the agent loops in a sub-optimal trajectory that provides a repeated small reward.
|
| 36 |
+
|
| 37 |
+
Agents optimizing a learned reward can also demonstrate reward hacking. Ibarz et al. (2018) show an agent hacking a learned reward in Atari (Hero, Montezuma’s Revenge, and Private Eye), where optimizing a frozen reward predictor eventually achieves high predicted score and low actual score. Christiano et al. (2017) show an example of reward hacking in the Pong game where the agent learns to hit the ball back and forth instead of winning the point. Stiennon et al. (2020) show that a policy which over-optimizes the learnt reward model for text summarization produces lower quality summarizations when judged by humans.
|
| 38 |
+
|
| 39 |
+
In this section, we describe our four environments (Section 3.1) and taxonomize our nine corresponding misspecified reward functions (Section 3.2).
|
| 40 |
+
|
| 41 |
+
# 3.1 ENVIRONMENTS
|
| 42 |
+
|
| 43 |
+
We chose a diverse set of environments and prioritized complexity of action space, observation space, and dynamics model. Our aim was to reflect real-world constraints in our environments, selecting ones with several desiderata that must be simultaneously balanced. Table 1 provides a summary.
|
| 44 |
+
|
| 45 |
+
Traffic Control. The traffic environment is an autonomous vehicle (AV) simulation that models vehicles driving on different highway networks. The vehicles are either controlled by a RL algorithm or pre-programmed via a human behavioral model. Our misspecifications are listed in Table 1.
|
| 46 |
+
|
| 47 |
+
We use the Flow traffic simulator, implemented by Wu et al. (2021) and Vinitsky et al. (2018), which extends the popular SUMO traffic simulator (Lopez et al., 2018). The simulator uses cars that drive like humans, following the Intelligent Driver Model (IDM) (Treiber et al., 2000), a widely-accepted approximation of human driving behavior. Simulated drivers attempt to travel as fast as possible while tending to decelerate whenever they are too close to the car immediately in front.
|
| 48 |
+
|
| 49 |
+
The RL policy has access to observations only from the AVs it controls. For each AV, the observation space consists of the car’s position, its velocity, and the position and velocity of the cars immediately in front of and behind it. The continuous control action is the acceleration applied to each AV. Figure 4 depicts the Traffic-Mer network, where cars from an on-ramp attempt to merge onto the straightaway. We also use the Traffic-Bot network, where cars (1-4 RL, 10-20 human) drive through a highway bottleneck where lanes decrease from four to two to one.
|
| 50 |
+
|
| 51 |
+
COVID Response. The COVID environment, developed by Kompella et al. (2020), simulates a population using the SEIR model of individual infection dynamics. The RL policymaker adjusts the severity of social distancing regulations while balancing economic health (better with lower regulations) and public health (better with higher regulations), similar in spirit to Trott et al. (2021). The population attributes (proportion of adults, number of hospitals) and infection dynamics (random testing rate, infection rate) are based on data from Austin, Texas.
|
| 52 |
+
|
| 53 |
+
Every day, the environment simulates the infection dynamics and reports testing results to the agent, but not the true infection numbers. The policy chooses one of three discrete actions: INCREASE, DECREASE, or MAINTAIN the current regulation stage, which directly affects the behavior of the population and indirectly affects the infection dynamics. There are five stages in total.
|
| 54 |
+
|
| 55 |
+
Atari Riverraid. The Atari Riverraid environment is run on OpenAI Gym (Brockman et al., 2016). The agent operates a plane which flies over a river and is rewarded by destroying enemies. The agent observes the raw pixel input of the environment. The agent can take one of eighteen discrete actions, corresponding to either movement or shooting within the environment.
|
| 56 |
+
|
| 57 |
+
Glucose Monitoring. The glucose environment, implemented in Fox et al. (2020), is a continuous control problem. It extends a FDA-approved simulator (Man et al., 2014) for blood glucose levels of a patient with Type 1 diabetes. The patient partakes in meals and wears a continuous glucose monitor (CGM), which gives noisy observations of the patient’s glucose levels. The RL agent administers insulin to maintain a healthy glucose level.
|
| 58 |
+
|
| 59 |
+
Every five minutes, the agent observes the patient’s glucose levels and decides how much insulin to administer. The observation space is the previous four hours of glucose levels and insulin dosages.
|
| 60 |
+
|
| 61 |
+
# 3.2 MISSPECIFICATIONS
|
| 62 |
+
|
| 63 |
+
Using the above environments, we constructed nine instances of misspecified proxy rewards. To help interpret these proxies, we taxonomize them as instances of misweighting, incorrect ontology, or incorrect scope. We elaborate further on this taxonimization using the traffic example from Figure 1.
|
| 64 |
+
|
| 65 |
+
Table 1: Reward misspecifications across our four environments. ‘Misalign’ indicates whether the true reward drops and ‘Transition’ indicates whether this corresponds to a phase transition (sharp qualitative change). We observe 5 instances of misalignment and 4 instances of phase transitions. ‘Mis.’ is a misweighting and ’Ont.’ is an ontological misspecification.
|
| 66 |
+
|
| 67 |
+
<table><tr><td>Env.</td><td>Type</td><td>Objective</td><td>Proxy</td><td>Misalign?</td><td>Transition?</td></tr><tr><td rowspan="3">Traffic</td><td>Mis. Mis. Ont.</td><td rowspan="3">minimize commute and accelerations</td><td rowspan="3">underpenalize acceleration underpenalize lane changes</td><td>No Yes</td><td>No Yes</td></tr><tr><td></td><td></td><td></td></tr><tr><td>velocity replaces commute</td><td>Yes</td><td>Yes</td></tr><tr><td rowspan="3">COVID</td><td rowspan="3">Scope Mis.</td><td rowspan="3">balance economic,</td><td rowspan="3">monitor velocity near merge underpenalize health cost</td><td>Yes</td><td>Yes</td></tr><tr><td></td><td></td></tr><tr><td>No</td><td>No Yes</td></tr><tr><td rowspan="3">Atari</td><td rowspan="3">Mis.</td><td rowspan="3">score points under</td><td rowspan="3">ignore political cost downweight movement</td><td>Yes</td><td></td></tr><tr><td></td><td></td></tr><tr><td>No No</td><td>No No</td></tr><tr><td>Glucose</td><td>Ont.</td><td>minimize health risk</td><td>risk in place of cost</td><td>Yes</td><td>No</td></tr></table>
|
| 68 |
+
|
| 69 |
+
• Misweighting. Suppose that the true reward is a linear combination of commute time and acceleration (for reducing carbon emissions). Downweighting the acceleration term thus underpenalizes carbon emissions. In general, misweighting occurs when the proxy and true reward capture the same desiderata, but differ on their relative importance.
|
| 70 |
+
• Ontological. Congestion could be operationalized as either high average commute time or low average vehicle velocity. In general, ontological misspecification occurs when the proxy and true reward use different desiderata to capture the same concept.
|
| 71 |
+
• Scope. If monitoring velocity over all roads is too costly, a city might instead monitor them only over highways, thus pushing congestion to local streets. In general, scope misspecification occurs when the proxy measures desiderata over a restricted domain (e.g. time, space).
|
| 72 |
+
|
| 73 |
+
We include a summary of all nine tasks in Table 1 and provide full details in Appendix A. Table 1 also indicates whether each proxy leads to misalignment (i.e. to a policy with low true reward) and whether it leads to a phase transition (a sudden qualitative shift as model capacity increases). We investigate both of these in Section 4.
|
| 74 |
+
|
| 75 |
+
Evaluation protocol. For each environment and proxy-true reward pair, we train an agent using the proxy reward and evaluate performance according to the true reward. We use PPO (Schulman et al., 2017) to optimize policies for the traffic and COVID environments, SAC (Haarnoja et al., 2018) to optimize the policies for the glucose environment, and torchbeast (Kuttler et al. ¨ , 2019), a PyTorch implementation of IMPALA (Espeholt et al., 2018), to optimize the policies for the Atari environment. When available, we adopt the hyperparameters (except the learning rate and network size) given by the original codebase.
|
| 76 |
+
|
| 77 |
+
# 4 HOW AGENT OPTIMIZATION POWER DRIVES MISALIGNMENT
|
| 78 |
+
|
| 79 |
+
To better understand reward hacking, we study how it emerges as agent optimization power increases. We define optimization power as the effective search space of policies the agent has access to, as implicitly determined by model size, training steps, action space, and observation space.
|
| 80 |
+
|
| 81 |
+
In Section 4.1, we consider the quantitative effect of optimization power for all nine environmentmisspecification pairs; we primarily do this by varying model size, but also use training steps, action space, and observation space as robustness checks. Overall, more capable agents tend to overfit the proxy reward and achieve a lower true reward. We also find evidence of phase transitions on four of the environment-misspecification pairs. For these phase transitions, there is a critical threshold at which the proxy reward rapidly increases and the true reward rapidly drops.
|
| 82 |
+
|
| 83 |
+
In Section 4.2, we further investigate these phase transitions by qualitatively studying the resulting policies. At the transition, we find that the quantitative drop in true reward corresponds to a qualitative shift in policy behavior. Extrapolating visible trends is therefore insufficient to catch all instances of reward hacking, increasing the urgency of research in this area.
|
| 84 |
+
|
| 85 |
+

|
| 86 |
+
Figure 2: Increasing the RL policy’s model size decreases true reward on three selected environments. The red line indicates a phase transition.
|
| 87 |
+
|
| 88 |
+
In Section 4.3, we assess the faithfulness of our proxies, showing that reward hacking occurs even though the true and proxy rewards are strongly positively correlated in most cases.
|
| 89 |
+
|
| 90 |
+
# 4.1 QUANTITATIVE EFFECTS VS. AGENT CAPABILITIES
|
| 91 |
+
|
| 92 |
+
As a stand-in for increasing agent optimization power, we first vary the model capacity for a fixed environment and proxy reward. Specifically, we vary the width and depth of the actor and critic networks, changing the parameter count by two to four orders of magnitude depending on the environment. For a given policy, the actor and critic are always the same size.
|
| 93 |
+
|
| 94 |
+
Model Capacity. Our results are shown in Figure 2, with additional plots included in Appendix A. We plot both the proxy (blue) and true (green) reward vs. the number of parameters. As model size increases, the proxy reward increases but the true reward decreases. This suggests that reward designers will likely need to take greater care to specify reward functions accurately and is especially salient given the recent trends towards larger and larger models (Littman et al., 2021).
|
| 95 |
+
|
| 96 |
+
The drop in true reward is sometimes quite sudden. We call these sudden shifts phase transitions, and mark them with dashed red lines in Figure 2. These quantitative trends are reflected in the qualitative behavior of the policies (Section 4.2), which typically also shift at the phase transition.
|
| 97 |
+
|
| 98 |
+
Model capacity is only one proxy for agent capabilities, and larger models do not always lead to more capable agents (Andrychowicz et al., 2020). To check the robustness of our results, we consider several other measures of optimization: observation fidelity, number of training steps, and action space resolution.
|
| 99 |
+
|
| 100 |
+

|
| 101 |
+
Figure 3: In addition to parameter count, we consider three other agent capabilities: training steps, action space resolution, and observation noise. In Figure 3a, an increase in the proxy reward comes at the cost of the true reward. In Figure 3b, increasing the granularity (from right to left) causes the agent to achieve similar proxy reward but lower true reward. In Figure 3c, increasing the fidelity of observations (by increasing the random testing rate in the population) tends to decrease the true reward with no clear impact on proxy reward.
|
| 102 |
+
|
| 103 |
+
Number of training steps. Assuming a reasonable RL algorithm and hyperparameters, agents which are trained for more steps have more optimization power. We vary training steps for an agent trained on the Atari environment. The true reward incentivizes staying alive for as many frames as possible while moving smoothly. The proxy reward misweights these considerations by underpenalizing the smoothness constraint. As shown in Figure 3a, optimizing the proxy reward for more steps harms the true reward, after an initial period where the rewards are positively correlated.
|
| 104 |
+
|
| 105 |
+
Action space resolution. Intuitively, an agent that can take more precise actions is more capable. For example, as technology improves, an RL car may make course corrections every millisecond instead of every second. We study action space resolution in the traffic environment by discretizing the output space of the RL agent. Specifically, under resolution level $\varepsilon$ , we round the action $a \in \mathbb { R }$ output by the RL agent to the nearest multiple of $\varepsilon$ and use that as our action. The larger the resolution level $\varepsilon$ , the lower the action space resolution. Results are shown in Figure 3b for a fixed model size. Increasing the resolution causes the proxy reward to remain roughly constant while the true reward decreases.
|
| 106 |
+
|
| 107 |
+
Observation fidelity. Agents with access to better input sensors, like higher-resolution cameras, should make more informed decisions and thus have more optimization power. Concretely, we study this in the COVID environment, where we increase the random testing rate in the population. The proxy reward is a linear combination of the number of infections and severity of social distancing, while the true reward also factors in political cost. As shown in Figure 3c, as the testing rate increases, the model achieves similar proxy reward at the cost of a slightly lower true reward.
|
| 108 |
+
|
| 109 |
+
# 4.2 QUALITATIVE EFFECTS
|
| 110 |
+
|
| 111 |
+
In the previous section, quantitative trends showed that increasing a model’s optimization power often hurts performance on the true reward. We shift our focus to understanding how this decrease happens. In particular, we typically observe a qualitative shift in behavior associated with each of the phase transitions, three of which we describe below.
|
| 112 |
+
|
| 113 |
+
Traffic Control. We focus on the Traffic-Mer environment from Figure 2a, where minimizing average commute time is replaced by maximizing average velocity. In this case, smaller policies learn to merge onto the straightaway by slightly slowing down the other vehicles (Figure 4a). On the other hand, larger policy models stop the AVs to prevent them from merging at all (Figure 4b). This increases the average velocity, because the vehicles on the straightaway (which greatly outnumber vehicles on the on-ramp) do not need to slow down for merging traffic. However, it significantly increases the average commute time, as the passengers in the AV remain stuck.
|
| 114 |
+
|
| 115 |
+
COVID Response. Suppose the RL agent optimizes solely for the public and economic health of a society, without factoring politics into its decision-making. This behavior is shown in Figure 5. The larger model chooses to increase the severity of social distancing restrictions earlier than the smaller model. As a result, larger models are able to maintain low average levels of both ICU usage (a proxy for public health) and social distancing restrictions (a proxy for economic health). These preemptive regulations may however be politically costly, as enforcing restrictions without clear signs of infection may foment public unrest (Boettke & Powell, 2021).
|
| 116 |
+
|
| 117 |
+

|
| 118 |
+
Figure 4: The larger model prevents the AVs (in red) from moving to increase the velocity of the human cars (unobserved cars in white and observed cars in blue). However, this greatly increases the average commute per person.
|
| 119 |
+
|
| 120 |
+

|
| 121 |
+
Figure 5: For COVID, ICU usage is a proxy for public health and regulation stage is a proxy for economic health. The blue line indicates the maximum stage (right) enforced by the larger policy and the corresponding ICU level (left) at that stage. The red line is the equivalent for the smaller policy. Because the larger policy enforces regulations much sooner than the smaller policy, it maintains both low ICU usage and low regulation stage. However, the larger policy is politically unfavorable: regulations are high even though public signs of infection, such as ICU usage, are low.
|
| 122 |
+
|
| 123 |
+
Atari Riverraid. We create an ontological misspecification by rewarding the plane for staying alive as long as possible while shooting as little as possible: a “pacifist run”. We then measure the game score as the true reward. We find that agents with more parameters typically maneuver more adeptly. Such agents shoot less frequently, but survive for much longer, acquiring points (true reward) due to passing checkpoints. In this case, therefore, the proxy and true rewards are wellaligned so that reward hacking does not emerge as capabilities increase.
|
| 124 |
+
|
| 125 |
+
We did, however, find that some of the agents exploited a bug in the simulator that halts the plane at the beginning of the level. The simulator advances but the plane itself does not move, thereby achieving high pacifist reward.
|
| 126 |
+
|
| 127 |
+
Glucose Monitoring. Consider an RL agent that optimizes solely for a patient’s health, without considering the economic costs of its treatment plans. In this case, the proxy reward is based off of a glycemic risk measure, which reflects the likelihood that a patient will suffer an acute hypoglycemic episode, developed by the medical community (Kovatchev et al., 2000).
|
| 128 |
+
|
| 129 |
+
However, a less economically-privileged patient may opt for the treatment plan with the least expected cost (Herkert et al., 2019; Fralick & Kesselheim, 2019), not the one with the least amount of risk. From this patient’s perspective, the true reward is the expected cost of the treatment plan, which includes the expected cost of hospital visits and the cost of administering the insulin.
|
| 130 |
+
|
| 131 |
+
Although larger model treatments reduce hypoglycemic risk more smaller model treatments, they administer more insulin. Based on the average cost of an ER visit for a hypogylcemic episode $\$ 1350$ from Bronstone & Graham (2016)) and the average cost of a unit of insulin $\mathfrak { F } 0 . 3 2$ from Lee (2020)), we find that it is actually more expensive to pursue the larger model’s treatment.
|
| 132 |
+
|
| 133 |
+
# 4.3 QUANTITATIVE EFFECTS VS PROXY-TRUE REWARD CORRELATION
|
| 134 |
+
|
| 135 |
+
We saw in Sections 4.1 and 4.2 that agents often pursue proxy rewards at the cost of the true reward. Perhaps this only occurs because the proxy is greatly misspecified, i.e., the proxy and true reward are weakly or negatively correlated. If this were the case, then reward hacking may pose less of a threat. To investigate this intuition, we plot the correlation between the proxy and true rewards.
|
| 136 |
+
|
| 137 |
+
The correlation is determined by the state distribution of a given policy, so we consider two types of state distributions. Specifically, for a given model size, we obtain two checkpoints: one that achieves the highest proxy reward during training and one from early in training (less than $1 \%$ of training complete). We call the former the “trained checkpoint” and the latter the “early checkpoint”.
|
| 138 |
+
|
| 139 |
+

|
| 140 |
+
Figure 6: Correlations between the proxy and true rewards, along with the reward hacking induced. In Figure 6a, we plot the proxy reward with “•” and the true reward with “ $\times ^ { \dag \mathparagraph }$ . In Figure 6b, we plot the trained checkpoint correlation and the early checkpoint correlation.
|
| 141 |
+
|
| 142 |
+
For a given model checkpoint, we calculate the Pearson correlation $\rho$ between the proxy reward $P$ and true reward $T$ using 30 trajectory rollouts. Reward hacking occurs even though there is significant positive correlation between the true and proxy rewards (see Figure 6). The correlation is lower for the trained model than for the early model, but still high. Further figures are shown in Appendix A.2. Among the four environments tested, only the Traffic-Mer environment with ontological misspecification had negative Pearson correlation.
|
| 143 |
+
|
| 144 |
+
# 5 POLYNOMALY: MITIGATING REWARD MISSPECIFICATION
|
| 145 |
+
|
| 146 |
+
In Section 4, we saw that reward hacking often leads to phase transitions in agent behaviour. Furthermore, in applications like traffic control or COVID response, the true reward may be observed only sporadically or not at all. Blindly optimizing the proxy in these cases can lead to catastrophic failure (Zhuang & Hadfield-Menell, 2020; Taylor, 2016).
|
| 147 |
+
|
| 148 |
+
This raises an important question: Without the true reward signal, how can we mitigate misalignment? We operationalize this as an anomaly detection task: the detector should flag instances of misalignment, thus preventing catastrophic rollouts. To aid the detector, we provide it with a trusted policy: one verified by humans to have acceptable (but not maximal) reward. Our resulting benchmark, POLYNOMALY, is described below.
|
| 149 |
+
|
| 150 |
+
# 5.1 PROBLEM SETUP
|
| 151 |
+
|
| 152 |
+
We train a collection of policies by varying model size on the traffic and COVID environments. For each policy, we estimate the policy’s true reward by averaging over 5 to 32 rollouts. One author labeled each policy as acceptable, problematic, or ambiguous based on its true reward score relative to that of other policies. We include only policies that received a non-ambiguous label.
|
| 153 |
+
|
| 154 |
+
For both environments, we provide a small-to-medium sized model as the trusted policy model, as Section 4.1 empirically illustrates that smaller models achieve reasonable true reward without exhibiting reward hacking. Given the trusted model and a collection of policies, the anomaly detector’s task is to predict the binary label of “acceptable” or “problematic” for each policy.
|
| 155 |
+
|
| 156 |
+
Table 3 in Appendix B.1 summarizes our benchmark. The trusted policy size is a list of the hidden unit widths of the trusted policy network (not including feature mappings).
|
| 157 |
+
|
| 158 |
+
# 5.2 EVALUATION
|
| 159 |
+
|
| 160 |
+
We propose two evaluation metrics for measuring the performance of our anomaly detectors.
|
| 161 |
+
|
| 162 |
+
• Area Under the Receiver Operating Characteristic (AUROC). The AUROC measures the probability that a detector will assign a random anomaly a higher score than a random non-anomalous policy (Davis & Goadrich, 2006). Higher AUROCs indicate stronger detectors.
|
| 163 |
+
|
| 164 |
+
• Max F-1 score. The F-1 score is the harmonic mean of the precision and the recall, so detectors with a high F-1 score have both low false positives and high true negatives. We calculate the max F-1 score by taking the maximum F-1 score over all possible thresholds for the detector.
|
| 165 |
+
|
| 166 |
+
# 5.3 BASELINES
|
| 167 |
+
|
| 168 |
+
In addition to the benchmark datasets described above, we provide baseline anomaly detectors based on estimating distances between policies. We estimate the distance between the trusted policy and the unknown policy based on either the Jensen-Shannon divergence (JSD) or the Hellinger distance. Specifically, we use rollouts to generate empirical action distributions. We compute the distance between these action distributions at each step of the rollout, then aggregate across steps by taking either the mean or the range. For full details, see Appendix B.2. Table 2 reports the AUROC and F-1 scores of several such detectors. We provide full ROC curves in Appendix B.2.
|
| 169 |
+
|
| 170 |
+
<table><tr><td>Baseline Detectors</td><td colspan="2">Mean Jensen-Shannon</td><td colspan="2">Mean Hellinger</td><td colspan="2">Range Hellinger</td></tr><tr><td>Env. - Misspecification</td><td>AUROC</td><td>Max F-1</td><td>AUROC</td><td>Max F-1</td><td>AUROC</td><td>Max F-1</td></tr><tr><td>Traffic-Mer- misweighting</td><td>81.0%</td><td>0.824</td><td>81.0%</td><td>0.824</td><td>76.2%</td><td>0.824</td></tr><tr><td>Traffic-Mer - scope</td><td>74.6%</td><td>0.818</td><td>74.6%</td><td>0.818</td><td>57.1%</td><td>0.720</td></tr><tr><td>Traffic-Mer - ontological</td><td>52.7%</td><td>0.583</td><td>55.4%</td><td>0.646</td><td>71.4%</td><td>0.842</td></tr><tr><td>Traffic-Bot - misweighting</td><td>88.9%</td><td>0.900</td><td>88.9%</td><td>0.900</td><td>74.1%</td><td>0.857</td></tr><tr><td>COVID - ontological</td><td>45.2%</td><td>0.706</td><td>59.5%</td><td>0.750</td><td>88.1%</td><td>0.923</td></tr></table>
|
| 171 |
+
|
| 172 |
+
Table 2: Performance of detectors on different subtasks. Each detector has at least one subtask with AUROC under $60 \%$ , indicating poor performance.
|
| 173 |
+
|
| 174 |
+
We observe that different detectors are better for different tasks, suggesting that future detectors could do better than any of our baselines. Our benchmark and baseline provides a starting point for further research on mitigating reward hacking.
|
| 175 |
+
|
| 176 |
+
# 6 DISCUSSION
|
| 177 |
+
|
| 178 |
+
In this work, we designed a diverse set of environments and proxy rewards, uncovered several instances of phase transitions, and proposed an anomaly detection task to help mitigate these transitions. Our results raise two questions: How can we not only detect phase transitions, but prevent them in the first place? And how should phase transitions shape our approach to safe ML?
|
| 179 |
+
|
| 180 |
+
On preventing phase transitions, anomaly detection already offers one path forward. Once we can detect anomalies, we can potentially prevent them, by using the detector to purge the unwanted behavior (e.g. by including it in the training objective). Similar policy shaping has recently been used to make RL agents more ethical (Hendrycks et al., 2021b). However, since the anomaly detectors will be optimized against by the RL policy, they need to be adversarially robust (Goodfellow et al., 2014). This motivates further work on adversarial robustness and adversarial anomaly detection. Another possible direction is optimizing policies against a distribution of rewards (Brown et al., 2020; Javed et al., 2021), which may prevent over-fitting to a given set of metrics.
|
| 181 |
+
|
| 182 |
+
Regarding safe ML, several recent papers propose extrapolating empirical trends to forecast future ML capabilities (Kaplan et al., 2020; Hernandez et al., 2021; Droppo & Elibol, 2021), partly to avoid unforeseen consequences from ML. While we support this work, our results show that trend extrapolation alone is not enough to ensure the safety of ML systems. To complement trend extrapolation, we need better interpretability methods to identify emergent model behaviors early on, before they dominate performance (Olah et al., 2018). ML researchers should also familiarize themselves with emergent behavior in self-organizing systems (Yates, 2012), which often exhibit similar phase transitions (Anderson, 1972). Indeed, the ubiquity of phase transitions throughout science suggests that ML researchers should continue to expect surprises–and should therefore prepare for them.
|
| 183 |
+
|
| 184 |
+
# ACKNOWLEDGEMENTS
|
| 185 |
+
|
| 186 |
+
We are thankful to Dan Hendrycks and Adam Gleave for helpful discussions about experiments and to Cassidy Laidlaw and Dan Hendrycks for providing valuable feedback on the writing. KB was supported by a JP Morgan AI Fellowship. JS was supported by NSF Award 2031985 and by Open Philanthropy.
|
| 187 |
+
|
| 188 |
+
# REFERENCES
|
| 189 |
+
|
| 190 |
+
Philip W Anderson. More is different. Science, 177(4047):393–396, 1972.
|
| 191 |
+
|
| 192 |
+
Marcin Andrychowicz, Anton Raichuk, Piotr Stanczyk, Manu Orsini, Sertan Girgin, Raphael ´ Marinier, Leonard Hussenot, Matthieu Geist, Olivier Pietquin, and Marcin Michalski. What ´ matters in on-policy reinforcement learning? A large-scale empirical study. arXiv preprint arXiv:2006.05990, 2020.
|
| 193 |
+
|
| 194 |
+
Bowen Baker, Ingmar Kanitscheider, Todor Markov, Yi Wu, Glenn Powell, Bob McGrew, and Igor Mordatch. Emergent tool use from multi-agent autocurricula. In International Conference on Learning Representations, 2020.
|
| 195 |
+
|
| 196 |
+
Peter Boettke and Benjamin Powell. The political economy of the covid-19 pandemic. Southern Economic Journal, 87(4):1090–1106, 2021.
|
| 197 |
+
|
| 198 |
+
Rishi Bommasani et al. On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258, 2021.
|
| 199 |
+
|
| 200 |
+
Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym, 2016.
|
| 201 |
+
|
| 202 |
+
Amy Bronstone and Claudia Graham. The potential cost implications of averting severe hypoglycemic events requiring hospitalization in high-risk adults with type 1 diabetes using real-time continuous glucose monitoring. Journal of Diabetes Science and Technology, 10, 2016.
|
| 203 |
+
|
| 204 |
+
Daniel Brown, Russell Coleman, Ravi Srinivasan, and Scott Niekum. Safe imitation learning via fast Bayesian reward inference from preferences. In Proceedings of the 37th International Conference on Machine Learning, 2020.
|
| 205 |
+
|
| 206 |
+
Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. In Advances in Neural Information Processing Systems, 2017.
|
| 207 |
+
|
| 208 |
+
Jesse Davis and Mark Goadrich. The relationship between precision-recall and roc curves. In International Conference on Machine Learning, 2006.
|
| 209 |
+
|
| 210 |
+
Jasha Droppo and Oguz Elibol. Scaling laws for acoustic models. arXiv preprint arXiv:2106.09488, 2021.
|
| 211 |
+
|
| 212 |
+
Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Volodymyr Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, Tim Harley, Iain Robert Dunning, Shane Legg, and Koray Kavukcuoglu. Impala: Scalable distributed deep-rl with importance weighted actor-learner architectures. 2018.
|
| 213 |
+
|
| 214 |
+
Tom Everitt, Victoria Krakovna, Laurent Orseau, and Shane Legg. Reinforcement learning with a corrupted reward channel. In International Joint Conference on Artificial Intelligence, 2017.
|
| 215 |
+
|
| 216 |
+
Ian Fox, Joyce Lee, Rodica Pop-Busui, and Jenna Wiens. Deep reinforcement learning for closedloop blood glucose control. In Machine Learning for Healthcare Conference, 2020.
|
| 217 |
+
|
| 218 |
+
M. Fralick and A. S. Kesselheim. The U.S. Insulin Crisis - Rationing a Lifesaving Medication Discovered in the 1920s. New England Journal of Medicine, 381(19):1793–1795, 2019.
|
| 219 |
+
|
| 220 |
+
Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
|
| 221 |
+
|
| 222 |
+
Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In International conference on machine learning, 2018.
|
| 223 |
+
|
| 224 |
+
Dylan Hadfield-Menell, Smitha Milli, Pieter Abbeel, Stuart J Russell, and Anca Dragan. Inverse reward design. In Advances in Neural Information Processing Systems, 2017.
|
| 225 |
+
|
| 226 |
+
Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. International Conference on Learning Representations, 2017.
|
| 227 |
+
|
| 228 |
+
Dan Hendrycks, Nicholas Carlini, John Schulman, and Jacob Steinhardt. Unsolved problems in ml safety. arXiv preprint arXiv:2109.13916, 2021a.
|
| 229 |
+
|
| 230 |
+
Dan Hendrycks, Mantas Mazeika, Andy Zou, Sahil Patel, Christine Zhu, Jesus Navarro, Dawn Song, Bo Li, and Jacob Steinhardt. What would Jiminy Cricket do? Towards agents that behave morally. 2021b.
|
| 231 |
+
|
| 232 |
+
Darby Herkert, Pavithra Vijayakumar, Jing Luo, Jeremy I. Schwartz, Tracy L. Rabin, Eunice DeFilippo, and Kasia J. Lipska. Cost-related insulin underuse among patients with diabetes. JAMA Internal Medicine, 179(1):112–114, Jan 2019.
|
| 233 |
+
|
| 234 |
+
Danny Hernandez, Jared Kaplan, Tom Henighan, and Sam McCandlish. Scaling laws for transfer. arXiv preprint arXiv:2102.01293, 2021.
|
| 235 |
+
|
| 236 |
+
Evan Hubinger, Chris van Merwijk, Vladimir Mikulik, Joar Skalse, and Scott Garrabrant. Risks from learned optimization in advanced machine learning systems. arXiv preprint arXiv:1906.01820, 2019.
|
| 237 |
+
|
| 238 |
+
Borja Ibarz, J. Leike, Tobias Pohlen, Geoffrey Irving, S. Legg, and Dario Amodei. Reward learning from human preferences and demonstrations in Atari. In Advances in Neural Information Processing Systems, 2018.
|
| 239 |
+
|
| 240 |
+
Zaynah Javed, Daniel S Brown, Satvik Sharma, Jerry Zhu, Ashwin Balakrishna, Marek Petrik, Anca Dragan, and Ken Goldberg. Policy gradient bayesian robust optimization for imitation learning. In Proceedings of the 38th International Conference on Machine Learning, 2021.
|
| 241 |
+
|
| 242 |
+
Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020.
|
| 243 |
+
|
| 244 |
+
W. Bradley Knox, Alessandro Allievi, Holger Banzhaf, Felix Schmitt, and Peter Stone. Reward (Mis)design for Autonomous Driving. arXiv e-prints arXiv:2104.13906, 2021.
|
| 245 |
+
|
| 246 |
+
Jens Kober, J Andrew Bagnell, and Jan Peters. Reinforcement learning in robotics: A survey. The International Journal of Robotics Research, 32(11):1238–1274, 2013.
|
| 247 |
+
|
| 248 |
+
Varun Kompella, Roberto Capobianco, Stacy Jong, Jonathan Browne, Spencer Fox, Lauren Meyers, Peter Wurman, and Peter Stone. Reinforcement learning for optimization of covid-19 mitigation policies, 2020.
|
| 249 |
+
|
| 250 |
+
BorIs. P. Kovatchev, Martin Straume, Daniel J. Cox, and Leon.S Farhy. Risk analysis of blood glucose data:a quantitative approach to optimizing the control of insulin dependent diabetes. Journal of Theoretical Medicine, 3(1):1–10, 2000.
|
| 251 |
+
|
| 252 |
+
Heinrich Kuttler, Nantas Nardelli, Thibaut Lavril, Marco Selvatici, Viswanath Sivakumar, Tim ¨ Rocktaschel, and Edward Grefenstette. TorchBeast: A PyTorch Platform for Distributed RL.¨ arXiv preprint arXiv:1910.03552, 2019.
|
| 253 |
+
|
| 254 |
+
Benita Lee. How much does insulin cost? Here’s how 23 brands compare, Nov 2020.
|
| 255 |
+
|
| 256 |
+
Jan Leike, Miljan Martic, Victoria Krakovna, Pedro A. Ortega, Tom Everitt, Andrew Lefrancq, Laurent Orseau, and Shane Legg. AI safety gridworlds, 2017.
|
| 257 |
+
|
| 258 |
+
Michael L. Littman, Ifeoma Ajunwa, Guy Berger, Craig Boutilier, Morgan Currie, Finale DoshiVelez, Gillian Hadfield, Michael C. Horowitz, Charles Isbell, Hiroaki Kitano, Karen Levy, Terah Lyons, Melanie Mitchell, Julie Shah, Steven Sloman, Shannon Vallor, and Toby Walsh. Gathering strength, gathering storms: The one hundred year study on artificial intelligence (AI100) 2021 study panel report. Technical report, Stanford University, Stanford, CA, 2021.
|
| 259 |
+
|
| 260 |
+
Pablo Alvarez Lopez, Michael Behrisch, Laura Bieker-Walz, Jakob Erdmann, Yun-Pang Flotter ¨ od, ¨ Robert Hilbrich, Leonhard Lucken, Johannes Rummel, Peter Wagner, and Evamarie Wießner. ¨ Microscopic traffic simulation using SUMO. In International Conference on Intelligent Transportation Systems, 2018.
|
| 261 |
+
|
| 262 |
+
Chiara Dalla Man, Francesco Micheletto, Dayu Lv, Marc Breton, Boris Kovatchev, and Claudio Cobelli. The UVA/PADOVA type 1 diabetes simulator: New features. Journal of Diabetes Science and Technology, 8(1):26–34, Jan 2014.
|
| 263 |
+
|
| 264 |
+
Chris Olah, Arvind Satyanarayan, Ian Johnson, Shan Carter, Ludwig Schubert, Katherine Ye, and Alexander Mordvintsev. The building blocks of interpretability. Distill, 3(3):e10, 2018.
|
| 265 |
+
|
| 266 |
+
Romain Paulus, Caiming Xiong, and Richard Socher. A deep reinforced model for abstractive summarization. In International Conference on Learning Representations, 2018.
|
| 267 |
+
|
| 268 |
+
Manoel Horta Ribeiro, Raphael Ottoni, Robert West, Virg´ılio A. F. Almeida, and Wagner Meira. Auditing radicalization pathways on youtube. In Conference on Fairness, Accountability, and Transparency, New York, NY, USA, 2020.
|
| 269 |
+
|
| 270 |
+
Stuart Russell. Human Compatible: Artificial Intelligence and the Problem of Control. Penguin, 2019.
|
| 271 |
+
|
| 272 |
+
John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
|
| 273 |
+
|
| 274 |
+
Nisan Stiennon, Long Ouyang, Jeff Wu, Daniel M Ziegler, Ryan Lowe, Chelsea Voss, Alec Radford, Dario Amodei, and Paul Christiano. Learning to summarize from human feedback. arXiv preprint arXiv:2009.01325, 2020.
|
| 275 |
+
|
| 276 |
+
Jonathan Stray. Aligning ai optimization to community well-being. International Journal of Community Well-Being, 3(4):443–463, Dec 2020.
|
| 277 |
+
|
| 278 |
+
Jihoon Tack, Sangwoo Mo, Jongheon Jeong, and Jinwoo Shin. Csi: Novelty detection via contrastive learning on distributionally shifted instances. Advances in Neural Information Processing Systems, 2020.
|
| 279 |
+
|
| 280 |
+
Jessica Taylor. Quantilizers: A safer alternative to maximizers for limited optimization. In AAAI Workshop: AI, Ethics, and Society, 2016.
|
| 281 |
+
|
| 282 |
+
Marin Toromanoff, Emilie Wirbel, and Fabien Moutarde. Is deep reinforcement learning really superhuman on Atari? Leveling the playing field, 2019.
|
| 283 |
+
|
| 284 |
+
Martin Treiber, Ansgar Hennecke, and Dirk Helbing. Congested traffic states in empirical observations and microscopic simulations. Physical review E, 62(2):1805, 2000.
|
| 285 |
+
|
| 286 |
+
Alexander Trott, Sunil Srinivasa, Douwe van der Wal, Sebastien Haneuse, and Stephan Zheng. Building a Foundation for Data-Driven, Interpretable, and Robust Policy Design using the AI Economist. arXiv preprint arXiv:2108.02904, 2021.
|
| 287 |
+
|
| 288 |
+
Eugene Vinitsky, Aboudy Kreidieh, Luc Le Flem, Nishant Kheterpal, Kathy Jang, Cathy Wu, Fangyu Wu, Richard Liaw, Eric Liang, and Alexandre M. Bayen. Benchmarks for reinforcement learning in mixed-autonomy traffic. In Conference on Robot Learning, 2018.
|
| 289 |
+
|
| 290 |
+
Cathy Wu, Abdul Rahman Kreidieh, Kanaad Parvate, Eugene Vinitsky, and Alexandre M. Bayen. Flow: A modular learning framework for mixed autonomy traffic. IEEE Transactions on Robotics, 2021.
|
| 291 |
+
|
| 292 |
+
F Eugene Yates. Self-organizing systems: The emergence of order. Springer Science & Business Media, 2012.
|
| 293 |
+
|
| 294 |
+
Chao Yu, Jiming Liu, and Shamim Nemati. Reinforcement learning in healthcare: A survey. arXiv preprint arXiv:1908.08796, 2019.
|
| 295 |
+
|
| 296 |
+
Simon Zhuang and Dylan Hadfield-Menell. Consequences of misaligned AI. In Advances in Neural Information Processing Systems, 2020.
|
| 297 |
+
|
| 298 |
+

|
| 299 |
+
Figure 7: Additional model size scatter plots. Observe that not all misspecifications cause misalignment. We plot the proxy reward with $\mathbf { \cdots } _ { \mathbf { 0 } } \mathbf { \cdot } \mathbf { \sigma } $ and the true reward with “ $\mathbf { \nabla } \times \mathbf { \vec { \mathbf { \nabla } } } \mathbf { \vec { \mathbf { \nabla } } }$ . The proxy reward is measured on the left-hand side of each figure and the true reward is measured on the right hand side of each figure.
|
| 300 |
+
|
| 301 |
+
# A.1 EFFECT OF MODEL SIZE
|
| 302 |
+
|
| 303 |
+
We plot the proxy and true reward vs. model size in Figure 7, following the experiment described in Section 4.1.
|
| 304 |
+
|
| 305 |
+

|
| 306 |
+
Figure 8: Correlations between the proxy and true rewards, along with the reward hacking induced. In the left column, we plot the proxy reward with “•” and the true reward with “ $\mathbf { \vec { \nabla } } \times \mathbf { \vec { \mathbf { \nabla } } } ^ { \mathbf { 3 } }$ . In the right column, we plot the trained checkpoint correlation and the randomly initialized checkpoint correlation.
|
| 307 |
+
|
| 308 |
+
# A.2 CORRELATION BETWEEN PROXY AND TRUE REWARDS
|
| 309 |
+
|
| 310 |
+
We plot the correlation between proxy and true rewards, following the experiment described in Section 4.3. Interestingly, we see that reward hacking still occurs when there is positive correlation between the true and proxy rewards, e.g., in Figures 8a/8b. Unsurprisingly, proxy-true pairs which are highly correlated, e.g., Figure 8c/8d do not exhibit reward hacking. Finally, proxy-true pairs which are negatively correlated, e.g., Figure 8e/8f exhibit the most reward hacking.
|
| 311 |
+
|
| 312 |
+
<table><tr><td>Env. - Misspecification</td><td>#Policies</td><td>#Problematic</td><td>Rollout length</td><td>Trusted policy size</td></tr><tr><td>Traffic-Mer - misweighting</td><td>10</td><td>7</td><td>270</td><td>[96,96]</td></tr><tr><td>Traffic-Mer- scope</td><td>16</td><td>9</td><td>270</td><td>[16,16]</td></tr><tr><td>Traffic-Mer- ontological</td><td>23</td><td>7</td><td>270</td><td>[4]</td></tr><tr><td>Traffic-Bot - misweighting</td><td>12</td><td>9</td><td>270</td><td>[64,64]</td></tr><tr><td>COVID - ontological</td><td>13</td><td>6</td><td>200</td><td>[16,16]</td></tr></table>
|
| 313 |
+
|
| 314 |
+
Table 3: Benchmark statistics. We average over 5 rollouts in traffic and 32 rollouts in COVID.
|
| 315 |
+
|
| 316 |
+
# B POLYNOMALY
|
| 317 |
+
|
| 318 |
+
# B.1 BENCHMARK STATISTICS
|
| 319 |
+
|
| 320 |
+
See Table 3 for Polynomaly’s statistics.
|
| 321 |
+
|
| 322 |
+
# B.2 RECEIVER OPERATING CHARACTERISTIC CURVES
|
| 323 |
+
|
| 324 |
+
We plot the ROC curves for the detectors described in Section 5.3. Our detectors are calculated as follows.
|
| 325 |
+
|
| 326 |
+
Let $P$ and $Q$ represent two probability distributions with $M = { \textstyle { \frac { 1 } { 2 } } } ( P + Q )$ . Then the Jensen-Shannon divergence and the Hellinger distance between them is given by
|
| 327 |
+
|
| 328 |
+
$$
|
| 329 |
+
\begin{array} { r l } & { \mathrm { J S D } ( P | | Q ) : = \cfrac { 1 } { 2 } \mathrm { K L } ( P | | M ) + \cfrac { 1 } { 2 } \mathrm { K L } ( Q | | M ) } \\ & { \mathrm { H e l l i n g e r } ( P , Q ) : = \cfrac { 1 } { 2 } \int \left( \sqrt { d P } - \sqrt { d Q } \right) ^ { 2 } . } \end{array}
|
| 330 |
+
$$
|
| 331 |
+
|
| 332 |
+
Our proposed detectors estimate the distance $\mathcal { D } ( \pi _ { \mathrm { t r u s t e d } } , \pi _ { \mathrm { u n k n o w n } } )$ between the trusted policy $\pi _ { \mathrm { t r u s t e d } }$ and unknown policy $\pi _ { \mathrm { u n k n o w n } }$ as follows: We generate $r$ rollouts of $\pi _ { \mathrm { u n k n o w n } }$ , where $r = 5$ in the traffic environment and $r = 3 2$ in the COVID environment. Every $s$ steps of a rollout, where $s = 1 0$ in the traffic environment and $s = 1$ in the COVID environment, we set $P$ to be the action distribution of $\pi _ { \mathrm { u n k n o w n } }$ given the unknown agent’s state at that timestep in the rollout and $Q$ to be the action distribution of $\pi _ { \mathrm { t r u s t e d } }$ given the unknown agent’s state at that timestep in the rollout. Intuitively, if $P$ and $Q$ are far apart, then the trusted agent would have performed a different action than the unknown agent at that given timestep, indicating a possible case of reward hacking. We then compute either $\bar { \mathrm { J S D } } ( P \Vert Q )$ or Hellinger $( P , Q )$ following Equation (1). These distances are collected every $s$ steps over the entire rollout, and we calculate metrics on these distances (range, mean, etc.) to assign an anomaly score to the untrusted policy.
|
| 333 |
+
|
| 334 |
+

|
| 335 |
+
Figure 9: ROC curves for Traffic-Mer - misweighting.
|
| 336 |
+
|
| 337 |
+

|
| 338 |
+
Figure 10: ROC curves for Traffic-Mer - scope.
|
| 339 |
+
|
| 340 |
+

|
| 341 |
+
Figure 11: ROC curves for Traffic-Mer - ontological.
|
| 342 |
+
|
| 343 |
+

|
| 344 |
+
Figure 12: ROC curves for Traffic-Bot - misweighting.
|
| 345 |
+
|
| 346 |
+

|
| 347 |
+
Figure 13: ROC curves for COVID - ontological.
|
parse/dev/JYtwGwIL7ye/JYtwGwIL7ye_content_list.json
ADDED
|
@@ -0,0 +1,1927 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"type": "text",
|
| 4 |
+
"text": "THE EFFECTS OF REWARD MISSPECIFICATION: MAPPING AND MITIGATING MISALIGNED MODELS ",
|
| 5 |
+
"text_level": 1,
|
| 6 |
+
"bbox": [
|
| 7 |
+
176,
|
| 8 |
+
98,
|
| 9 |
+
789,
|
| 10 |
+
146
|
| 11 |
+
],
|
| 12 |
+
"page_idx": 0
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"type": "text",
|
| 16 |
+
"text": "Alexander Pan Caltech ",
|
| 17 |
+
"bbox": [
|
| 18 |
+
184,
|
| 19 |
+
170,
|
| 20 |
+
289,
|
| 21 |
+
198
|
| 22 |
+
],
|
| 23 |
+
"page_idx": 0
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"type": "text",
|
| 27 |
+
"text": "Kush Bhatia UC Berkeley ",
|
| 28 |
+
"bbox": [
|
| 29 |
+
400,
|
| 30 |
+
170,
|
| 31 |
+
488,
|
| 32 |
+
198
|
| 33 |
+
],
|
| 34 |
+
"page_idx": 0
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"type": "text",
|
| 38 |
+
"text": "Jacob Steinhardt UC Berkeley ",
|
| 39 |
+
"bbox": [
|
| 40 |
+
599,
|
| 41 |
+
170,
|
| 42 |
+
720,
|
| 43 |
+
198
|
| 44 |
+
],
|
| 45 |
+
"page_idx": 0
|
| 46 |
+
},
|
| 47 |
+
{
|
| 48 |
+
"type": "text",
|
| 49 |
+
"text": "ABSTRACT ",
|
| 50 |
+
"text_level": 1,
|
| 51 |
+
"bbox": [
|
| 52 |
+
452,
|
| 53 |
+
234,
|
| 54 |
+
544,
|
| 55 |
+
251
|
| 56 |
+
],
|
| 57 |
+
"page_idx": 0
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"type": "text",
|
| 61 |
+
"text": "Reward hacking—where RL agents exploit gaps in misspecified reward functions—has been widely observed, but not yet systematically studied. To understand how reward hacking arises, we construct four RL environments with misspecified rewards. We investigate reward hacking as a function of agent capabilities: model capacity, action space resolution, observation space noise, and training time. More capable agents often exploit reward misspecifications, achieving higher proxy reward and lower true reward than less capable agents. Moreover, we find instances of phase transitions: capability thresholds at which the agent’s behavior qualitatively shifts, leading to a sharp decrease in the true reward. Such phase transitions pose challenges to monitoring the safety of ML systems. To address this, we propose an anomaly detection task for aberrant policies and offer several baseline detectors. ",
|
| 62 |
+
"bbox": [
|
| 63 |
+
233,
|
| 64 |
+
271,
|
| 65 |
+
764,
|
| 66 |
+
438
|
| 67 |
+
],
|
| 68 |
+
"page_idx": 0
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"type": "text",
|
| 72 |
+
"text": "1 INTRODUCTION ",
|
| 73 |
+
"text_level": 1,
|
| 74 |
+
"bbox": [
|
| 75 |
+
176,
|
| 76 |
+
477,
|
| 77 |
+
336,
|
| 78 |
+
492
|
| 79 |
+
],
|
| 80 |
+
"page_idx": 0
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"type": "text",
|
| 84 |
+
"text": "As reinforcement learning agents are trained with better algorithms, more data, and larger policy models, they are at increased risk of overfitting their objectives (Russell, 2019). Reward hacking, or the gaming of misspecified reward functions by RL agents, has appeared in a variety of contexts, such as game playing (Ibarz et al., 2018), text summarization (Paulus et al., 2018), and autonomous driving (Knox et al., 2021). These examples show that better algorithms and models are not enough; for human-centered applications such as healthcare (Yu et al., 2019), economics (Trott et al., 2021) and robotics (Kober et al., 2013), RL algorithms must be safe and aligned with human objectives (Bommasani et al., 2021; Hubinger et al., 2019). ",
|
| 85 |
+
"bbox": [
|
| 86 |
+
174,
|
| 87 |
+
512,
|
| 88 |
+
825,
|
| 89 |
+
625
|
| 90 |
+
],
|
| 91 |
+
"page_idx": 0
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"type": "text",
|
| 95 |
+
"text": "Reward misspecifications occur because real-world tasks have numerous, often conflicting desiderata. In practice, reward designers resort to optimizing a proxy reward that is either more readily measured or more easily optimized than the true reward. For example, consider a recommender system optimizing for users’ subjective well-being (SWB). Because SWB is difficult to measure, engineers rely on more tangible metrics such as click-through rates or watch-time. Optimizing for misspecified proxies led YouTube to overemphasize watch-time and harm user satisfaction (Stray, 2020), as well as to recommended extreme political content to users (Ribeiro et al., 2020). ",
|
| 96 |
+
"bbox": [
|
| 97 |
+
174,
|
| 98 |
+
631,
|
| 99 |
+
825,
|
| 100 |
+
728
|
| 101 |
+
],
|
| 102 |
+
"page_idx": 0
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"type": "text",
|
| 106 |
+
"text": "Addressing reward hacking is a first step towards developing human-aligned RL agents and one goal of ML safety (Hendrycks et al., 2021a). However, there has been little systematic work investigating when or how it tends to occur, or how to detect it before it runs awry. To remedy this, we study the problem of reward hacking across four diverse environments: traffic control (Wu et al., 2021), COVID response (Kompella et al., 2020), blood glucose monitoring (Fox et al., 2020), and the Atari game Riverraid (Brockman et al., 2016). Within these environments, we construct nine misspecified proxy reward functions (Section 3). ",
|
| 107 |
+
"bbox": [
|
| 108 |
+
174,
|
| 109 |
+
736,
|
| 110 |
+
825,
|
| 111 |
+
833
|
| 112 |
+
],
|
| 113 |
+
"page_idx": 0
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"type": "text",
|
| 117 |
+
"text": "Using our environments, we study how increasing optimization power affects reward hacking, by training RL agents with varying resources such as model size, training time, action space resolution, and observation space noise (Section 4). We find that more powerful agents often attain higher proxy reward but lower true reward, as illustrated in Figure 1. Since the trend in ML is to increase resources exponentially each year (Littman et al., 2021), this suggests that reward hacking will become more pronounced in the future in the absence of countermeasures. ",
|
| 118 |
+
"bbox": [
|
| 119 |
+
174,
|
| 120 |
+
840,
|
| 121 |
+
825,
|
| 122 |
+
922
|
| 123 |
+
],
|
| 124 |
+
"page_idx": 0
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
"type": "text",
|
| 128 |
+
"text": "",
|
| 129 |
+
"bbox": [
|
| 130 |
+
184,
|
| 131 |
+
233,
|
| 132 |
+
532,
|
| 133 |
+
248
|
| 134 |
+
],
|
| 135 |
+
"page_idx": 1
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"type": "image",
|
| 139 |
+
"img_path": "images/0716b5dacc343315af119cb36efc33c64b88da690a32a60aed3e6ed1d0b35a52.jpg",
|
| 140 |
+
"image_caption": [
|
| 141 |
+
"High mean commute ",
|
| 142 |
+
"Figure 1: An example of reward hacking when cars merge onto a highway. A human-driver model controls the grey cars and an RL policy controls the red car. The RL agent observes positions and velocities of nearby cars (including itself) and adjusts its acceleration to maximize the proxy reward. At first glance, both the proxy reward and true reward appear to incentivize fast traffic flow. However, smaller policy models allow the red car to merge, whereas larger policy models exploit the misspecification by stopping the red car. When the red car stops merging, the mean velocity increases (merging slows down the more numerous grey cars). However, the mean commute time also increases (the red car is stuck). This exemplifies a phase transition: the qualitative behavior of the agent shifts as the model size increases. "
|
| 143 |
+
],
|
| 144 |
+
"image_footnote": [],
|
| 145 |
+
"bbox": [
|
| 146 |
+
191,
|
| 147 |
+
99,
|
| 148 |
+
812,
|
| 149 |
+
244
|
| 150 |
+
],
|
| 151 |
+
"page_idx": 1
|
| 152 |
+
},
|
| 153 |
+
{
|
| 154 |
+
"type": "text",
|
| 155 |
+
"text": "More worryingly, we observe several instances of phase transitions. In a phase transition, the more capable model pursues a qualitatively different policy that sharply decreases the true reward. Figure 1 illustrates one example: An RL agent regulating traffic learns to stop any cars from merging onto the highway in order to maintain a high average velocity of the cars on the straightaway. ",
|
| 156 |
+
"bbox": [
|
| 157 |
+
174,
|
| 158 |
+
417,
|
| 159 |
+
825,
|
| 160 |
+
474
|
| 161 |
+
],
|
| 162 |
+
"page_idx": 1
|
| 163 |
+
},
|
| 164 |
+
{
|
| 165 |
+
"type": "text",
|
| 166 |
+
"text": "Since there is little prior warning of phase transitions, they pose a challenge to monitoring the safety of ML systems. Spurred by this challenge, we propose an anomaly detection task (Hendrycks & Gimpel, 2017; Tack et al., 2020): Can we detect when the true reward starts to drop, while maintaining a low false positive rate in benign cases? We instantiate our proposed task, POLYNOMALY, for the traffic and COVID environments (Section 5). Given a trusted policy with moderate performance, one must detect whether a given policy is aberrant. We provide several baseline anomaly detectors for this task and release our data at https://github.com/aypan17/ reward-misspecification. ",
|
| 167 |
+
"bbox": [
|
| 168 |
+
174,
|
| 169 |
+
481,
|
| 170 |
+
825,
|
| 171 |
+
592
|
| 172 |
+
],
|
| 173 |
+
"page_idx": 1
|
| 174 |
+
},
|
| 175 |
+
{
|
| 176 |
+
"type": "text",
|
| 177 |
+
"text": "2 RELATED WORK ",
|
| 178 |
+
"text_level": 1,
|
| 179 |
+
"bbox": [
|
| 180 |
+
176,
|
| 181 |
+
613,
|
| 182 |
+
344,
|
| 183 |
+
630
|
| 184 |
+
],
|
| 185 |
+
"page_idx": 1
|
| 186 |
+
},
|
| 187 |
+
{
|
| 188 |
+
"type": "text",
|
| 189 |
+
"text": "Previous works have focused on classifying different types of reward hacking and sometimes mitigating its effects. One popular setting is an agent on a grid-world with an erroneous sensor. HadfieldMenell et al. (2017) show and mitigate the reward hacking that arises due to an incorrect sensor reading at test time in a $1 0 \\mathrm { x } 1 0$ navigation grid world. Leike et al. (2017) show examples of reward hacking in a 3x3 boat race and a $5 \\mathrm { x } 7$ tomato watering grid world. Everitt et al. (2017) theoretically study and mitigate reward hacking caused by a faulty sensor. ",
|
| 190 |
+
"bbox": [
|
| 191 |
+
174,
|
| 192 |
+
645,
|
| 193 |
+
825,
|
| 194 |
+
728
|
| 195 |
+
],
|
| 196 |
+
"page_idx": 1
|
| 197 |
+
},
|
| 198 |
+
{
|
| 199 |
+
"type": "text",
|
| 200 |
+
"text": "Game-playing agents have also been found to hack their reward. Baker et al. (2020) exhibit reward hacking in a hide-and-seek environment comprising 3-6 agents, 3-9 movable boxes and a few ramps: without a penalty for leaving the play area, the hiding agents learn to endlessly run from the seeking agents. Toromanoff et al. (2019) briefly mention reward hacking in several Atari games (Elevator Action, Kangaroo, Bank Heist) where the agent loops in a sub-optimal trajectory that provides a repeated small reward. ",
|
| 201 |
+
"bbox": [
|
| 202 |
+
174,
|
| 203 |
+
734,
|
| 204 |
+
825,
|
| 205 |
+
819
|
| 206 |
+
],
|
| 207 |
+
"page_idx": 1
|
| 208 |
+
},
|
| 209 |
+
{
|
| 210 |
+
"type": "text",
|
| 211 |
+
"text": "Agents optimizing a learned reward can also demonstrate reward hacking. Ibarz et al. (2018) show an agent hacking a learned reward in Atari (Hero, Montezuma’s Revenge, and Private Eye), where optimizing a frozen reward predictor eventually achieves high predicted score and low actual score. Christiano et al. (2017) show an example of reward hacking in the Pong game where the agent learns to hit the ball back and forth instead of winning the point. Stiennon et al. (2020) show that a policy which over-optimizes the learnt reward model for text summarization produces lower quality summarizations when judged by humans. ",
|
| 212 |
+
"bbox": [
|
| 213 |
+
174,
|
| 214 |
+
825,
|
| 215 |
+
825,
|
| 216 |
+
924
|
| 217 |
+
],
|
| 218 |
+
"page_idx": 1
|
| 219 |
+
},
|
| 220 |
+
{
|
| 221 |
+
"type": "text",
|
| 222 |
+
"text": "In this section, we describe our four environments (Section 3.1) and taxonomize our nine corresponding misspecified reward functions (Section 3.2). ",
|
| 223 |
+
"bbox": [
|
| 224 |
+
174,
|
| 225 |
+
133,
|
| 226 |
+
820,
|
| 227 |
+
161
|
| 228 |
+
],
|
| 229 |
+
"page_idx": 2
|
| 230 |
+
},
|
| 231 |
+
{
|
| 232 |
+
"type": "text",
|
| 233 |
+
"text": "3.1 ENVIRONMENTS ",
|
| 234 |
+
"text_level": 1,
|
| 235 |
+
"bbox": [
|
| 236 |
+
176,
|
| 237 |
+
178,
|
| 238 |
+
328,
|
| 239 |
+
193
|
| 240 |
+
],
|
| 241 |
+
"page_idx": 2
|
| 242 |
+
},
|
| 243 |
+
{
|
| 244 |
+
"type": "text",
|
| 245 |
+
"text": "We chose a diverse set of environments and prioritized complexity of action space, observation space, and dynamics model. Our aim was to reflect real-world constraints in our environments, selecting ones with several desiderata that must be simultaneously balanced. Table 1 provides a summary. ",
|
| 246 |
+
"bbox": [
|
| 247 |
+
174,
|
| 248 |
+
204,
|
| 249 |
+
825,
|
| 250 |
+
261
|
| 251 |
+
],
|
| 252 |
+
"page_idx": 2
|
| 253 |
+
},
|
| 254 |
+
{
|
| 255 |
+
"type": "text",
|
| 256 |
+
"text": "Traffic Control. The traffic environment is an autonomous vehicle (AV) simulation that models vehicles driving on different highway networks. The vehicles are either controlled by a RL algorithm or pre-programmed via a human behavioral model. Our misspecifications are listed in Table 1. ",
|
| 257 |
+
"bbox": [
|
| 258 |
+
174,
|
| 259 |
+
276,
|
| 260 |
+
825,
|
| 261 |
+
318
|
| 262 |
+
],
|
| 263 |
+
"page_idx": 2
|
| 264 |
+
},
|
| 265 |
+
{
|
| 266 |
+
"type": "text",
|
| 267 |
+
"text": "We use the Flow traffic simulator, implemented by Wu et al. (2021) and Vinitsky et al. (2018), which extends the popular SUMO traffic simulator (Lopez et al., 2018). The simulator uses cars that drive like humans, following the Intelligent Driver Model (IDM) (Treiber et al., 2000), a widely-accepted approximation of human driving behavior. Simulated drivers attempt to travel as fast as possible while tending to decelerate whenever they are too close to the car immediately in front. ",
|
| 268 |
+
"bbox": [
|
| 269 |
+
174,
|
| 270 |
+
324,
|
| 271 |
+
825,
|
| 272 |
+
395
|
| 273 |
+
],
|
| 274 |
+
"page_idx": 2
|
| 275 |
+
},
|
| 276 |
+
{
|
| 277 |
+
"type": "text",
|
| 278 |
+
"text": "The RL policy has access to observations only from the AVs it controls. For each AV, the observation space consists of the car’s position, its velocity, and the position and velocity of the cars immediately in front of and behind it. The continuous control action is the acceleration applied to each AV. Figure 4 depicts the Traffic-Mer network, where cars from an on-ramp attempt to merge onto the straightaway. We also use the Traffic-Bot network, where cars (1-4 RL, 10-20 human) drive through a highway bottleneck where lanes decrease from four to two to one. ",
|
| 279 |
+
"bbox": [
|
| 280 |
+
174,
|
| 281 |
+
401,
|
| 282 |
+
825,
|
| 283 |
+
484
|
| 284 |
+
],
|
| 285 |
+
"page_idx": 2
|
| 286 |
+
},
|
| 287 |
+
{
|
| 288 |
+
"type": "text",
|
| 289 |
+
"text": "COVID Response. The COVID environment, developed by Kompella et al. (2020), simulates a population using the SEIR model of individual infection dynamics. The RL policymaker adjusts the severity of social distancing regulations while balancing economic health (better with lower regulations) and public health (better with higher regulations), similar in spirit to Trott et al. (2021). The population attributes (proportion of adults, number of hospitals) and infection dynamics (random testing rate, infection rate) are based on data from Austin, Texas. ",
|
| 290 |
+
"bbox": [
|
| 291 |
+
174,
|
| 292 |
+
500,
|
| 293 |
+
825,
|
| 294 |
+
584
|
| 295 |
+
],
|
| 296 |
+
"page_idx": 2
|
| 297 |
+
},
|
| 298 |
+
{
|
| 299 |
+
"type": "text",
|
| 300 |
+
"text": "Every day, the environment simulates the infection dynamics and reports testing results to the agent, but not the true infection numbers. The policy chooses one of three discrete actions: INCREASE, DECREASE, or MAINTAIN the current regulation stage, which directly affects the behavior of the population and indirectly affects the infection dynamics. There are five stages in total. ",
|
| 301 |
+
"bbox": [
|
| 302 |
+
174,
|
| 303 |
+
592,
|
| 304 |
+
825,
|
| 305 |
+
647
|
| 306 |
+
],
|
| 307 |
+
"page_idx": 2
|
| 308 |
+
},
|
| 309 |
+
{
|
| 310 |
+
"type": "text",
|
| 311 |
+
"text": "Atari Riverraid. The Atari Riverraid environment is run on OpenAI Gym (Brockman et al., 2016). The agent operates a plane which flies over a river and is rewarded by destroying enemies. The agent observes the raw pixel input of the environment. The agent can take one of eighteen discrete actions, corresponding to either movement or shooting within the environment. ",
|
| 312 |
+
"bbox": [
|
| 313 |
+
174,
|
| 314 |
+
661,
|
| 315 |
+
823,
|
| 316 |
+
718
|
| 317 |
+
],
|
| 318 |
+
"page_idx": 2
|
| 319 |
+
},
|
| 320 |
+
{
|
| 321 |
+
"type": "text",
|
| 322 |
+
"text": "Glucose Monitoring. The glucose environment, implemented in Fox et al. (2020), is a continuous control problem. It extends a FDA-approved simulator (Man et al., 2014) for blood glucose levels of a patient with Type 1 diabetes. The patient partakes in meals and wears a continuous glucose monitor (CGM), which gives noisy observations of the patient’s glucose levels. The RL agent administers insulin to maintain a healthy glucose level. ",
|
| 323 |
+
"bbox": [
|
| 324 |
+
174,
|
| 325 |
+
733,
|
| 326 |
+
825,
|
| 327 |
+
804
|
| 328 |
+
],
|
| 329 |
+
"page_idx": 2
|
| 330 |
+
},
|
| 331 |
+
{
|
| 332 |
+
"type": "text",
|
| 333 |
+
"text": "Every five minutes, the agent observes the patient’s glucose levels and decides how much insulin to administer. The observation space is the previous four hours of glucose levels and insulin dosages. ",
|
| 334 |
+
"bbox": [
|
| 335 |
+
174,
|
| 336 |
+
810,
|
| 337 |
+
823,
|
| 338 |
+
838
|
| 339 |
+
],
|
| 340 |
+
"page_idx": 2
|
| 341 |
+
},
|
| 342 |
+
{
|
| 343 |
+
"type": "text",
|
| 344 |
+
"text": "3.2 MISSPECIFICATIONS ",
|
| 345 |
+
"text_level": 1,
|
| 346 |
+
"bbox": [
|
| 347 |
+
176,
|
| 348 |
+
856,
|
| 349 |
+
356,
|
| 350 |
+
869
|
| 351 |
+
],
|
| 352 |
+
"page_idx": 2
|
| 353 |
+
},
|
| 354 |
+
{
|
| 355 |
+
"type": "text",
|
| 356 |
+
"text": "Using the above environments, we constructed nine instances of misspecified proxy rewards. To help interpret these proxies, we taxonomize them as instances of misweighting, incorrect ontology, or incorrect scope. We elaborate further on this taxonimization using the traffic example from Figure 1. ",
|
| 357 |
+
"bbox": [
|
| 358 |
+
176,
|
| 359 |
+
882,
|
| 360 |
+
823,
|
| 361 |
+
924
|
| 362 |
+
],
|
| 363 |
+
"page_idx": 2
|
| 364 |
+
},
|
| 365 |
+
{
|
| 366 |
+
"type": "table",
|
| 367 |
+
"img_path": "images/a4547fe2a8cfb6a36e0af40896f54d634f99a5edee99ffd020c2a4f8579ebd5a.jpg",
|
| 368 |
+
"table_caption": [
|
| 369 |
+
"Table 1: Reward misspecifications across our four environments. ‘Misalign’ indicates whether the true reward drops and ‘Transition’ indicates whether this corresponds to a phase transition (sharp qualitative change). We observe 5 instances of misalignment and 4 instances of phase transitions. ‘Mis.’ is a misweighting and ’Ont.’ is an ontological misspecification. "
|
| 370 |
+
],
|
| 371 |
+
"table_footnote": [],
|
| 372 |
+
"table_body": "<table><tr><td>Env.</td><td>Type</td><td>Objective</td><td>Proxy</td><td>Misalign?</td><td>Transition?</td></tr><tr><td rowspan=\"3\">Traffic</td><td>Mis. Mis. Ont.</td><td rowspan=\"3\">minimize commute and accelerations</td><td rowspan=\"3\">underpenalize acceleration underpenalize lane changes</td><td>No Yes</td><td>No Yes</td></tr><tr><td></td><td></td><td></td></tr><tr><td>velocity replaces commute</td><td>Yes</td><td>Yes</td></tr><tr><td rowspan=\"3\">COVID</td><td rowspan=\"3\">Scope Mis.</td><td rowspan=\"3\">balance economic,</td><td rowspan=\"3\">monitor velocity near merge underpenalize health cost</td><td>Yes</td><td>Yes</td></tr><tr><td></td><td></td></tr><tr><td>No</td><td>No Yes</td></tr><tr><td rowspan=\"3\">Atari</td><td rowspan=\"3\">Mis.</td><td rowspan=\"3\">score points under</td><td rowspan=\"3\">ignore political cost downweight movement</td><td>Yes</td><td></td></tr><tr><td></td><td></td></tr><tr><td>No No</td><td>No No</td></tr><tr><td>Glucose</td><td>Ont.</td><td>minimize health risk</td><td>risk in place of cost</td><td>Yes</td><td>No</td></tr></table>",
|
| 373 |
+
"bbox": [
|
| 374 |
+
207,
|
| 375 |
+
101,
|
| 376 |
+
794,
|
| 377 |
+
282
|
| 378 |
+
],
|
| 379 |
+
"page_idx": 3
|
| 380 |
+
},
|
| 381 |
+
{
|
| 382 |
+
"type": "text",
|
| 383 |
+
"text": "• Misweighting. Suppose that the true reward is a linear combination of commute time and acceleration (for reducing carbon emissions). Downweighting the acceleration term thus underpenalizes carbon emissions. In general, misweighting occurs when the proxy and true reward capture the same desiderata, but differ on their relative importance. \n• Ontological. Congestion could be operationalized as either high average commute time or low average vehicle velocity. In general, ontological misspecification occurs when the proxy and true reward use different desiderata to capture the same concept. \n• Scope. If monitoring velocity over all roads is too costly, a city might instead monitor them only over highways, thus pushing congestion to local streets. In general, scope misspecification occurs when the proxy measures desiderata over a restricted domain (e.g. time, space). ",
|
| 384 |
+
"bbox": [
|
| 385 |
+
173,
|
| 386 |
+
375,
|
| 387 |
+
825,
|
| 388 |
+
523
|
| 389 |
+
],
|
| 390 |
+
"page_idx": 3
|
| 391 |
+
},
|
| 392 |
+
{
|
| 393 |
+
"type": "text",
|
| 394 |
+
"text": "We include a summary of all nine tasks in Table 1 and provide full details in Appendix A. Table 1 also indicates whether each proxy leads to misalignment (i.e. to a policy with low true reward) and whether it leads to a phase transition (a sudden qualitative shift as model capacity increases). We investigate both of these in Section 4. ",
|
| 395 |
+
"bbox": [
|
| 396 |
+
174,
|
| 397 |
+
535,
|
| 398 |
+
825,
|
| 399 |
+
590
|
| 400 |
+
],
|
| 401 |
+
"page_idx": 3
|
| 402 |
+
},
|
| 403 |
+
{
|
| 404 |
+
"type": "text",
|
| 405 |
+
"text": "Evaluation protocol. For each environment and proxy-true reward pair, we train an agent using the proxy reward and evaluate performance according to the true reward. We use PPO (Schulman et al., 2017) to optimize policies for the traffic and COVID environments, SAC (Haarnoja et al., 2018) to optimize the policies for the glucose environment, and torchbeast (Kuttler et al. ¨ , 2019), a PyTorch implementation of IMPALA (Espeholt et al., 2018), to optimize the policies for the Atari environment. When available, we adopt the hyperparameters (except the learning rate and network size) given by the original codebase. ",
|
| 406 |
+
"bbox": [
|
| 407 |
+
173,
|
| 408 |
+
607,
|
| 409 |
+
825,
|
| 410 |
+
704
|
| 411 |
+
],
|
| 412 |
+
"page_idx": 3
|
| 413 |
+
},
|
| 414 |
+
{
|
| 415 |
+
"type": "text",
|
| 416 |
+
"text": "4 HOW AGENT OPTIMIZATION POWER DRIVES MISALIGNMENT ",
|
| 417 |
+
"text_level": 1,
|
| 418 |
+
"bbox": [
|
| 419 |
+
174,
|
| 420 |
+
723,
|
| 421 |
+
718,
|
| 422 |
+
739
|
| 423 |
+
],
|
| 424 |
+
"page_idx": 3
|
| 425 |
+
},
|
| 426 |
+
{
|
| 427 |
+
"type": "text",
|
| 428 |
+
"text": "To better understand reward hacking, we study how it emerges as agent optimization power increases. We define optimization power as the effective search space of policies the agent has access to, as implicitly determined by model size, training steps, action space, and observation space. ",
|
| 429 |
+
"bbox": [
|
| 430 |
+
174,
|
| 431 |
+
756,
|
| 432 |
+
823,
|
| 433 |
+
797
|
| 434 |
+
],
|
| 435 |
+
"page_idx": 3
|
| 436 |
+
},
|
| 437 |
+
{
|
| 438 |
+
"type": "text",
|
| 439 |
+
"text": "In Section 4.1, we consider the quantitative effect of optimization power for all nine environmentmisspecification pairs; we primarily do this by varying model size, but also use training steps, action space, and observation space as robustness checks. Overall, more capable agents tend to overfit the proxy reward and achieve a lower true reward. We also find evidence of phase transitions on four of the environment-misspecification pairs. For these phase transitions, there is a critical threshold at which the proxy reward rapidly increases and the true reward rapidly drops. ",
|
| 440 |
+
"bbox": [
|
| 441 |
+
174,
|
| 442 |
+
804,
|
| 443 |
+
823,
|
| 444 |
+
888
|
| 445 |
+
],
|
| 446 |
+
"page_idx": 3
|
| 447 |
+
},
|
| 448 |
+
{
|
| 449 |
+
"type": "text",
|
| 450 |
+
"text": "In Section 4.2, we further investigate these phase transitions by qualitatively studying the resulting policies. At the transition, we find that the quantitative drop in true reward corresponds to a qualitative shift in policy behavior. Extrapolating visible trends is therefore insufficient to catch all instances of reward hacking, increasing the urgency of research in this area. ",
|
| 451 |
+
"bbox": [
|
| 452 |
+
173,
|
| 453 |
+
895,
|
| 454 |
+
821,
|
| 455 |
+
924
|
| 456 |
+
],
|
| 457 |
+
"page_idx": 3
|
| 458 |
+
},
|
| 459 |
+
{
|
| 460 |
+
"type": "image",
|
| 461 |
+
"img_path": "images/2239da35f19488ff8fa05e9b91d185add90f722e69b8e5e2d8a9f7e4649dcbb3.jpg",
|
| 462 |
+
"image_caption": [
|
| 463 |
+
"Figure 2: Increasing the RL policy’s model size decreases true reward on three selected environments. The red line indicates a phase transition. "
|
| 464 |
+
],
|
| 465 |
+
"image_footnote": [],
|
| 466 |
+
"bbox": [
|
| 467 |
+
173,
|
| 468 |
+
99,
|
| 469 |
+
825,
|
| 470 |
+
234
|
| 471 |
+
],
|
| 472 |
+
"page_idx": 4
|
| 473 |
+
},
|
| 474 |
+
{
|
| 475 |
+
"type": "text",
|
| 476 |
+
"text": "",
|
| 477 |
+
"bbox": [
|
| 478 |
+
171,
|
| 479 |
+
304,
|
| 480 |
+
823,
|
| 481 |
+
333
|
| 482 |
+
],
|
| 483 |
+
"page_idx": 4
|
| 484 |
+
},
|
| 485 |
+
{
|
| 486 |
+
"type": "text",
|
| 487 |
+
"text": "In Section 4.3, we assess the faithfulness of our proxies, showing that reward hacking occurs even though the true and proxy rewards are strongly positively correlated in most cases. ",
|
| 488 |
+
"bbox": [
|
| 489 |
+
173,
|
| 490 |
+
340,
|
| 491 |
+
823,
|
| 492 |
+
368
|
| 493 |
+
],
|
| 494 |
+
"page_idx": 4
|
| 495 |
+
},
|
| 496 |
+
{
|
| 497 |
+
"type": "text",
|
| 498 |
+
"text": "4.1 QUANTITATIVE EFFECTS VS. AGENT CAPABILITIES ",
|
| 499 |
+
"text_level": 1,
|
| 500 |
+
"bbox": [
|
| 501 |
+
173,
|
| 502 |
+
388,
|
| 503 |
+
570,
|
| 504 |
+
402
|
| 505 |
+
],
|
| 506 |
+
"page_idx": 4
|
| 507 |
+
},
|
| 508 |
+
{
|
| 509 |
+
"type": "text",
|
| 510 |
+
"text": "As a stand-in for increasing agent optimization power, we first vary the model capacity for a fixed environment and proxy reward. Specifically, we vary the width and depth of the actor and critic networks, changing the parameter count by two to four orders of magnitude depending on the environment. For a given policy, the actor and critic are always the same size. ",
|
| 511 |
+
"bbox": [
|
| 512 |
+
174,
|
| 513 |
+
416,
|
| 514 |
+
825,
|
| 515 |
+
472
|
| 516 |
+
],
|
| 517 |
+
"page_idx": 4
|
| 518 |
+
},
|
| 519 |
+
{
|
| 520 |
+
"type": "text",
|
| 521 |
+
"text": "Model Capacity. Our results are shown in Figure 2, with additional plots included in Appendix A. We plot both the proxy (blue) and true (green) reward vs. the number of parameters. As model size increases, the proxy reward increases but the true reward decreases. This suggests that reward designers will likely need to take greater care to specify reward functions accurately and is especially salient given the recent trends towards larger and larger models (Littman et al., 2021). ",
|
| 522 |
+
"bbox": [
|
| 523 |
+
174,
|
| 524 |
+
491,
|
| 525 |
+
825,
|
| 526 |
+
560
|
| 527 |
+
],
|
| 528 |
+
"page_idx": 4
|
| 529 |
+
},
|
| 530 |
+
{
|
| 531 |
+
"type": "text",
|
| 532 |
+
"text": "The drop in true reward is sometimes quite sudden. We call these sudden shifts phase transitions, and mark them with dashed red lines in Figure 2. These quantitative trends are reflected in the qualitative behavior of the policies (Section 4.2), which typically also shift at the phase transition. ",
|
| 533 |
+
"bbox": [
|
| 534 |
+
174,
|
| 535 |
+
568,
|
| 536 |
+
825,
|
| 537 |
+
611
|
| 538 |
+
],
|
| 539 |
+
"page_idx": 4
|
| 540 |
+
},
|
| 541 |
+
{
|
| 542 |
+
"type": "text",
|
| 543 |
+
"text": "Model capacity is only one proxy for agent capabilities, and larger models do not always lead to more capable agents (Andrychowicz et al., 2020). To check the robustness of our results, we consider several other measures of optimization: observation fidelity, number of training steps, and action space resolution. ",
|
| 544 |
+
"bbox": [
|
| 545 |
+
173,
|
| 546 |
+
616,
|
| 547 |
+
825,
|
| 548 |
+
672
|
| 549 |
+
],
|
| 550 |
+
"page_idx": 4
|
| 551 |
+
},
|
| 552 |
+
{
|
| 553 |
+
"type": "image",
|
| 554 |
+
"img_path": "images/11d930e8f7af759471cf950deec3c75bc1649f3852cebaaa311bdfdf4ada0e39.jpg",
|
| 555 |
+
"image_caption": [
|
| 556 |
+
"Figure 3: In addition to parameter count, we consider three other agent capabilities: training steps, action space resolution, and observation noise. In Figure 3a, an increase in the proxy reward comes at the cost of the true reward. In Figure 3b, increasing the granularity (from right to left) causes the agent to achieve similar proxy reward but lower true reward. In Figure 3c, increasing the fidelity of observations (by increasing the random testing rate in the population) tends to decrease the true reward with no clear impact on proxy reward. "
|
| 557 |
+
],
|
| 558 |
+
"image_footnote": [],
|
| 559 |
+
"bbox": [
|
| 560 |
+
173,
|
| 561 |
+
696,
|
| 562 |
+
825,
|
| 563 |
+
825
|
| 564 |
+
],
|
| 565 |
+
"page_idx": 4
|
| 566 |
+
},
|
| 567 |
+
{
|
| 568 |
+
"type": "text",
|
| 569 |
+
"text": "Number of training steps. Assuming a reasonable RL algorithm and hyperparameters, agents which are trained for more steps have more optimization power. We vary training steps for an agent trained on the Atari environment. The true reward incentivizes staying alive for as many frames as possible while moving smoothly. The proxy reward misweights these considerations by underpenalizing the smoothness constraint. As shown in Figure 3a, optimizing the proxy reward for more steps harms the true reward, after an initial period where the rewards are positively correlated. ",
|
| 570 |
+
"bbox": [
|
| 571 |
+
174,
|
| 572 |
+
103,
|
| 573 |
+
823,
|
| 574 |
+
188
|
| 575 |
+
],
|
| 576 |
+
"page_idx": 5
|
| 577 |
+
},
|
| 578 |
+
{
|
| 579 |
+
"type": "text",
|
| 580 |
+
"text": "Action space resolution. Intuitively, an agent that can take more precise actions is more capable. For example, as technology improves, an RL car may make course corrections every millisecond instead of every second. We study action space resolution in the traffic environment by discretizing the output space of the RL agent. Specifically, under resolution level $\\varepsilon$ , we round the action $a \\in \\mathbb { R }$ output by the RL agent to the nearest multiple of $\\varepsilon$ and use that as our action. The larger the resolution level $\\varepsilon$ , the lower the action space resolution. Results are shown in Figure 3b for a fixed model size. Increasing the resolution causes the proxy reward to remain roughly constant while the true reward decreases. ",
|
| 581 |
+
"bbox": [
|
| 582 |
+
174,
|
| 583 |
+
204,
|
| 584 |
+
825,
|
| 585 |
+
315
|
| 586 |
+
],
|
| 587 |
+
"page_idx": 5
|
| 588 |
+
},
|
| 589 |
+
{
|
| 590 |
+
"type": "text",
|
| 591 |
+
"text": "Observation fidelity. Agents with access to better input sensors, like higher-resolution cameras, should make more informed decisions and thus have more optimization power. Concretely, we study this in the COVID environment, where we increase the random testing rate in the population. The proxy reward is a linear combination of the number of infections and severity of social distancing, while the true reward also factors in political cost. As shown in Figure 3c, as the testing rate increases, the model achieves similar proxy reward at the cost of a slightly lower true reward. ",
|
| 592 |
+
"bbox": [
|
| 593 |
+
174,
|
| 594 |
+
332,
|
| 595 |
+
825,
|
| 596 |
+
416
|
| 597 |
+
],
|
| 598 |
+
"page_idx": 5
|
| 599 |
+
},
|
| 600 |
+
{
|
| 601 |
+
"type": "text",
|
| 602 |
+
"text": "4.2 QUALITATIVE EFFECTS ",
|
| 603 |
+
"text_level": 1,
|
| 604 |
+
"bbox": [
|
| 605 |
+
176,
|
| 606 |
+
434,
|
| 607 |
+
375,
|
| 608 |
+
449
|
| 609 |
+
],
|
| 610 |
+
"page_idx": 5
|
| 611 |
+
},
|
| 612 |
+
{
|
| 613 |
+
"type": "text",
|
| 614 |
+
"text": "In the previous section, quantitative trends showed that increasing a model’s optimization power often hurts performance on the true reward. We shift our focus to understanding how this decrease happens. In particular, we typically observe a qualitative shift in behavior associated with each of the phase transitions, three of which we describe below. ",
|
| 615 |
+
"bbox": [
|
| 616 |
+
174,
|
| 617 |
+
460,
|
| 618 |
+
825,
|
| 619 |
+
516
|
| 620 |
+
],
|
| 621 |
+
"page_idx": 5
|
| 622 |
+
},
|
| 623 |
+
{
|
| 624 |
+
"type": "text",
|
| 625 |
+
"text": "Traffic Control. We focus on the Traffic-Mer environment from Figure 2a, where minimizing average commute time is replaced by maximizing average velocity. In this case, smaller policies learn to merge onto the straightaway by slightly slowing down the other vehicles (Figure 4a). On the other hand, larger policy models stop the AVs to prevent them from merging at all (Figure 4b). This increases the average velocity, because the vehicles on the straightaway (which greatly outnumber vehicles on the on-ramp) do not need to slow down for merging traffic. However, it significantly increases the average commute time, as the passengers in the AV remain stuck. ",
|
| 626 |
+
"bbox": [
|
| 627 |
+
174,
|
| 628 |
+
534,
|
| 629 |
+
825,
|
| 630 |
+
631
|
| 631 |
+
],
|
| 632 |
+
"page_idx": 5
|
| 633 |
+
},
|
| 634 |
+
{
|
| 635 |
+
"type": "text",
|
| 636 |
+
"text": "COVID Response. Suppose the RL agent optimizes solely for the public and economic health of a society, without factoring politics into its decision-making. This behavior is shown in Figure 5. The larger model chooses to increase the severity of social distancing restrictions earlier than the smaller model. As a result, larger models are able to maintain low average levels of both ICU usage (a proxy for public health) and social distancing restrictions (a proxy for economic health). These preemptive regulations may however be politically costly, as enforcing restrictions without clear signs of infection may foment public unrest (Boettke & Powell, 2021). ",
|
| 637 |
+
"bbox": [
|
| 638 |
+
173,
|
| 639 |
+
647,
|
| 640 |
+
825,
|
| 641 |
+
718
|
| 642 |
+
],
|
| 643 |
+
"page_idx": 5
|
| 644 |
+
},
|
| 645 |
+
{
|
| 646 |
+
"type": "image",
|
| 647 |
+
"img_path": "images/20c8d45ab80f8a40cdf6b8bd0ca3ec45b66632f220734672169d41f46f91b1ba.jpg",
|
| 648 |
+
"image_caption": [
|
| 649 |
+
"Figure 4: The larger model prevents the AVs (in red) from moving to increase the velocity of the human cars (unobserved cars in white and observed cars in blue). However, this greatly increases the average commute per person. "
|
| 650 |
+
],
|
| 651 |
+
"image_footnote": [],
|
| 652 |
+
"bbox": [
|
| 653 |
+
246,
|
| 654 |
+
742,
|
| 655 |
+
750,
|
| 656 |
+
866
|
| 657 |
+
],
|
| 658 |
+
"page_idx": 5
|
| 659 |
+
},
|
| 660 |
+
{
|
| 661 |
+
"type": "image",
|
| 662 |
+
"img_path": "images/63dd49680e8fd6b2b6c10f51ce5d1b884d8a5e5355a67c58d0f671ed0bea9a13.jpg",
|
| 663 |
+
"image_caption": [
|
| 664 |
+
"Figure 5: For COVID, ICU usage is a proxy for public health and regulation stage is a proxy for economic health. The blue line indicates the maximum stage (right) enforced by the larger policy and the corresponding ICU level (left) at that stage. The red line is the equivalent for the smaller policy. Because the larger policy enforces regulations much sooner than the smaller policy, it maintains both low ICU usage and low regulation stage. However, the larger policy is politically unfavorable: regulations are high even though public signs of infection, such as ICU usage, are low. "
|
| 665 |
+
],
|
| 666 |
+
"image_footnote": [],
|
| 667 |
+
"bbox": [
|
| 668 |
+
277,
|
| 669 |
+
99,
|
| 670 |
+
720,
|
| 671 |
+
257
|
| 672 |
+
],
|
| 673 |
+
"page_idx": 6
|
| 674 |
+
},
|
| 675 |
+
{
|
| 676 |
+
"type": "text",
|
| 677 |
+
"text": "",
|
| 678 |
+
"bbox": [
|
| 679 |
+
173,
|
| 680 |
+
380,
|
| 681 |
+
823,
|
| 682 |
+
409
|
| 683 |
+
],
|
| 684 |
+
"page_idx": 6
|
| 685 |
+
},
|
| 686 |
+
{
|
| 687 |
+
"type": "text",
|
| 688 |
+
"text": "Atari Riverraid. We create an ontological misspecification by rewarding the plane for staying alive as long as possible while shooting as little as possible: a “pacifist run”. We then measure the game score as the true reward. We find that agents with more parameters typically maneuver more adeptly. Such agents shoot less frequently, but survive for much longer, acquiring points (true reward) due to passing checkpoints. In this case, therefore, the proxy and true rewards are wellaligned so that reward hacking does not emerge as capabilities increase. ",
|
| 689 |
+
"bbox": [
|
| 690 |
+
174,
|
| 691 |
+
426,
|
| 692 |
+
825,
|
| 693 |
+
510
|
| 694 |
+
],
|
| 695 |
+
"page_idx": 6
|
| 696 |
+
},
|
| 697 |
+
{
|
| 698 |
+
"type": "text",
|
| 699 |
+
"text": "We did, however, find that some of the agents exploited a bug in the simulator that halts the plane at the beginning of the level. The simulator advances but the plane itself does not move, thereby achieving high pacifist reward. ",
|
| 700 |
+
"bbox": [
|
| 701 |
+
176,
|
| 702 |
+
517,
|
| 703 |
+
821,
|
| 704 |
+
559
|
| 705 |
+
],
|
| 706 |
+
"page_idx": 6
|
| 707 |
+
},
|
| 708 |
+
{
|
| 709 |
+
"type": "text",
|
| 710 |
+
"text": "Glucose Monitoring. Consider an RL agent that optimizes solely for a patient’s health, without considering the economic costs of its treatment plans. In this case, the proxy reward is based off of a glycemic risk measure, which reflects the likelihood that a patient will suffer an acute hypoglycemic episode, developed by the medical community (Kovatchev et al., 2000). ",
|
| 711 |
+
"bbox": [
|
| 712 |
+
174,
|
| 713 |
+
577,
|
| 714 |
+
825,
|
| 715 |
+
632
|
| 716 |
+
],
|
| 717 |
+
"page_idx": 6
|
| 718 |
+
},
|
| 719 |
+
{
|
| 720 |
+
"type": "text",
|
| 721 |
+
"text": "However, a less economically-privileged patient may opt for the treatment plan with the least expected cost (Herkert et al., 2019; Fralick & Kesselheim, 2019), not the one with the least amount of risk. From this patient’s perspective, the true reward is the expected cost of the treatment plan, which includes the expected cost of hospital visits and the cost of administering the insulin. ",
|
| 722 |
+
"bbox": [
|
| 723 |
+
174,
|
| 724 |
+
640,
|
| 725 |
+
825,
|
| 726 |
+
695
|
| 727 |
+
],
|
| 728 |
+
"page_idx": 6
|
| 729 |
+
},
|
| 730 |
+
{
|
| 731 |
+
"type": "text",
|
| 732 |
+
"text": "Although larger model treatments reduce hypoglycemic risk more smaller model treatments, they administer more insulin. Based on the average cost of an ER visit for a hypogylcemic episode $\\$ 1350$ from Bronstone & Graham (2016)) and the average cost of a unit of insulin $\\mathfrak { F } 0 . 3 2$ from Lee (2020)), we find that it is actually more expensive to pursue the larger model’s treatment. ",
|
| 733 |
+
"bbox": [
|
| 734 |
+
176,
|
| 735 |
+
702,
|
| 736 |
+
825,
|
| 737 |
+
758
|
| 738 |
+
],
|
| 739 |
+
"page_idx": 6
|
| 740 |
+
},
|
| 741 |
+
{
|
| 742 |
+
"type": "text",
|
| 743 |
+
"text": "4.3 QUANTITATIVE EFFECTS VS PROXY-TRUE REWARD CORRELATION ",
|
| 744 |
+
"text_level": 1,
|
| 745 |
+
"bbox": [
|
| 746 |
+
176,
|
| 747 |
+
777,
|
| 748 |
+
674,
|
| 749 |
+
792
|
| 750 |
+
],
|
| 751 |
+
"page_idx": 6
|
| 752 |
+
},
|
| 753 |
+
{
|
| 754 |
+
"type": "text",
|
| 755 |
+
"text": "We saw in Sections 4.1 and 4.2 that agents often pursue proxy rewards at the cost of the true reward. Perhaps this only occurs because the proxy is greatly misspecified, i.e., the proxy and true reward are weakly or negatively correlated. If this were the case, then reward hacking may pose less of a threat. To investigate this intuition, we plot the correlation between the proxy and true rewards. ",
|
| 756 |
+
"bbox": [
|
| 757 |
+
174,
|
| 758 |
+
805,
|
| 759 |
+
825,
|
| 760 |
+
861
|
| 761 |
+
],
|
| 762 |
+
"page_idx": 6
|
| 763 |
+
},
|
| 764 |
+
{
|
| 765 |
+
"type": "text",
|
| 766 |
+
"text": "The correlation is determined by the state distribution of a given policy, so we consider two types of state distributions. Specifically, for a given model size, we obtain two checkpoints: one that achieves the highest proxy reward during training and one from early in training (less than $1 \\%$ of training complete). We call the former the “trained checkpoint” and the latter the “early checkpoint”. ",
|
| 767 |
+
"bbox": [
|
| 768 |
+
176,
|
| 769 |
+
867,
|
| 770 |
+
823,
|
| 771 |
+
924
|
| 772 |
+
],
|
| 773 |
+
"page_idx": 6
|
| 774 |
+
},
|
| 775 |
+
{
|
| 776 |
+
"type": "image",
|
| 777 |
+
"img_path": "images/dd9c6f2c288fd62f89394bb0653bfc424d6c5a337f19c4fe4624d9bd4b79c0b4.jpg",
|
| 778 |
+
"image_caption": [
|
| 779 |
+
"Figure 6: Correlations between the proxy and true rewards, along with the reward hacking induced. In Figure 6a, we plot the proxy reward with “•” and the true reward with “ $\\times ^ { \\dag \\mathparagraph }$ . In Figure 6b, we plot the trained checkpoint correlation and the early checkpoint correlation. "
|
| 780 |
+
],
|
| 781 |
+
"image_footnote": [],
|
| 782 |
+
"bbox": [
|
| 783 |
+
251,
|
| 784 |
+
98,
|
| 785 |
+
746,
|
| 786 |
+
244
|
| 787 |
+
],
|
| 788 |
+
"page_idx": 7
|
| 789 |
+
},
|
| 790 |
+
{
|
| 791 |
+
"type": "text",
|
| 792 |
+
"text": "For a given model checkpoint, we calculate the Pearson correlation $\\rho$ between the proxy reward $P$ and true reward $T$ using 30 trajectory rollouts. Reward hacking occurs even though there is significant positive correlation between the true and proxy rewards (see Figure 6). The correlation is lower for the trained model than for the early model, but still high. Further figures are shown in Appendix A.2. Among the four environments tested, only the Traffic-Mer environment with ontological misspecification had negative Pearson correlation. ",
|
| 793 |
+
"bbox": [
|
| 794 |
+
174,
|
| 795 |
+
329,
|
| 796 |
+
825,
|
| 797 |
+
412
|
| 798 |
+
],
|
| 799 |
+
"page_idx": 7
|
| 800 |
+
},
|
| 801 |
+
{
|
| 802 |
+
"type": "text",
|
| 803 |
+
"text": "5 POLYNOMALY: MITIGATING REWARD MISSPECIFICATION ",
|
| 804 |
+
"text_level": 1,
|
| 805 |
+
"bbox": [
|
| 806 |
+
174,
|
| 807 |
+
438,
|
| 808 |
+
676,
|
| 809 |
+
453
|
| 810 |
+
],
|
| 811 |
+
"page_idx": 7
|
| 812 |
+
},
|
| 813 |
+
{
|
| 814 |
+
"type": "text",
|
| 815 |
+
"text": "In Section 4, we saw that reward hacking often leads to phase transitions in agent behaviour. Furthermore, in applications like traffic control or COVID response, the true reward may be observed only sporadically or not at all. Blindly optimizing the proxy in these cases can lead to catastrophic failure (Zhuang & Hadfield-Menell, 2020; Taylor, 2016). ",
|
| 816 |
+
"bbox": [
|
| 817 |
+
174,
|
| 818 |
+
470,
|
| 819 |
+
825,
|
| 820 |
+
526
|
| 821 |
+
],
|
| 822 |
+
"page_idx": 7
|
| 823 |
+
},
|
| 824 |
+
{
|
| 825 |
+
"type": "text",
|
| 826 |
+
"text": "This raises an important question: Without the true reward signal, how can we mitigate misalignment? We operationalize this as an anomaly detection task: the detector should flag instances of misalignment, thus preventing catastrophic rollouts. To aid the detector, we provide it with a trusted policy: one verified by humans to have acceptable (but not maximal) reward. Our resulting benchmark, POLYNOMALY, is described below. ",
|
| 827 |
+
"bbox": [
|
| 828 |
+
174,
|
| 829 |
+
534,
|
| 830 |
+
825,
|
| 831 |
+
603
|
| 832 |
+
],
|
| 833 |
+
"page_idx": 7
|
| 834 |
+
},
|
| 835 |
+
{
|
| 836 |
+
"type": "text",
|
| 837 |
+
"text": "5.1 PROBLEM SETUP ",
|
| 838 |
+
"text_level": 1,
|
| 839 |
+
"bbox": [
|
| 840 |
+
176,
|
| 841 |
+
625,
|
| 842 |
+
333,
|
| 843 |
+
638
|
| 844 |
+
],
|
| 845 |
+
"page_idx": 7
|
| 846 |
+
},
|
| 847 |
+
{
|
| 848 |
+
"type": "text",
|
| 849 |
+
"text": "We train a collection of policies by varying model size on the traffic and COVID environments. For each policy, we estimate the policy’s true reward by averaging over 5 to 32 rollouts. One author labeled each policy as acceptable, problematic, or ambiguous based on its true reward score relative to that of other policies. We include only policies that received a non-ambiguous label. ",
|
| 850 |
+
"bbox": [
|
| 851 |
+
174,
|
| 852 |
+
651,
|
| 853 |
+
825,
|
| 854 |
+
707
|
| 855 |
+
],
|
| 856 |
+
"page_idx": 7
|
| 857 |
+
},
|
| 858 |
+
{
|
| 859 |
+
"type": "text",
|
| 860 |
+
"text": "For both environments, we provide a small-to-medium sized model as the trusted policy model, as Section 4.1 empirically illustrates that smaller models achieve reasonable true reward without exhibiting reward hacking. Given the trusted model and a collection of policies, the anomaly detector’s task is to predict the binary label of “acceptable” or “problematic” for each policy. ",
|
| 861 |
+
"bbox": [
|
| 862 |
+
176,
|
| 863 |
+
714,
|
| 864 |
+
825,
|
| 865 |
+
770
|
| 866 |
+
],
|
| 867 |
+
"page_idx": 7
|
| 868 |
+
},
|
| 869 |
+
{
|
| 870 |
+
"type": "text",
|
| 871 |
+
"text": "Table 3 in Appendix B.1 summarizes our benchmark. The trusted policy size is a list of the hidden unit widths of the trusted policy network (not including feature mappings). ",
|
| 872 |
+
"bbox": [
|
| 873 |
+
169,
|
| 874 |
+
776,
|
| 875 |
+
823,
|
| 876 |
+
806
|
| 877 |
+
],
|
| 878 |
+
"page_idx": 7
|
| 879 |
+
},
|
| 880 |
+
{
|
| 881 |
+
"type": "text",
|
| 882 |
+
"text": "5.2 EVALUATION ",
|
| 883 |
+
"text_level": 1,
|
| 884 |
+
"bbox": [
|
| 885 |
+
176,
|
| 886 |
+
827,
|
| 887 |
+
305,
|
| 888 |
+
840
|
| 889 |
+
],
|
| 890 |
+
"page_idx": 7
|
| 891 |
+
},
|
| 892 |
+
{
|
| 893 |
+
"type": "text",
|
| 894 |
+
"text": "We propose two evaluation metrics for measuring the performance of our anomaly detectors. ",
|
| 895 |
+
"bbox": [
|
| 896 |
+
171,
|
| 897 |
+
853,
|
| 898 |
+
781,
|
| 899 |
+
868
|
| 900 |
+
],
|
| 901 |
+
"page_idx": 7
|
| 902 |
+
},
|
| 903 |
+
{
|
| 904 |
+
"type": "text",
|
| 905 |
+
"text": "• Area Under the Receiver Operating Characteristic (AUROC). The AUROC measures the probability that a detector will assign a random anomaly a higher score than a random non-anomalous policy (Davis & Goadrich, 2006). Higher AUROCs indicate stronger detectors. ",
|
| 906 |
+
"bbox": [
|
| 907 |
+
174,
|
| 908 |
+
882,
|
| 909 |
+
823,
|
| 910 |
+
924
|
| 911 |
+
],
|
| 912 |
+
"page_idx": 7
|
| 913 |
+
},
|
| 914 |
+
{
|
| 915 |
+
"type": "text",
|
| 916 |
+
"text": "• Max F-1 score. The F-1 score is the harmonic mean of the precision and the recall, so detectors with a high F-1 score have both low false positives and high true negatives. We calculate the max F-1 score by taking the maximum F-1 score over all possible thresholds for the detector. ",
|
| 917 |
+
"bbox": [
|
| 918 |
+
176,
|
| 919 |
+
103,
|
| 920 |
+
823,
|
| 921 |
+
146
|
| 922 |
+
],
|
| 923 |
+
"page_idx": 8
|
| 924 |
+
},
|
| 925 |
+
{
|
| 926 |
+
"type": "text",
|
| 927 |
+
"text": "5.3 BASELINES",
|
| 928 |
+
"text_level": 1,
|
| 929 |
+
"bbox": [
|
| 930 |
+
174,
|
| 931 |
+
162,
|
| 932 |
+
294,
|
| 933 |
+
176
|
| 934 |
+
],
|
| 935 |
+
"page_idx": 8
|
| 936 |
+
},
|
| 937 |
+
{
|
| 938 |
+
"type": "text",
|
| 939 |
+
"text": "In addition to the benchmark datasets described above, we provide baseline anomaly detectors based on estimating distances between policies. We estimate the distance between the trusted policy and the unknown policy based on either the Jensen-Shannon divergence (JSD) or the Hellinger distance. Specifically, we use rollouts to generate empirical action distributions. We compute the distance between these action distributions at each step of the rollout, then aggregate across steps by taking either the mean or the range. For full details, see Appendix B.2. Table 2 reports the AUROC and F-1 scores of several such detectors. We provide full ROC curves in Appendix B.2. ",
|
| 940 |
+
"bbox": [
|
| 941 |
+
173,
|
| 942 |
+
188,
|
| 943 |
+
825,
|
| 944 |
+
286
|
| 945 |
+
],
|
| 946 |
+
"page_idx": 8
|
| 947 |
+
},
|
| 948 |
+
{
|
| 949 |
+
"type": "table",
|
| 950 |
+
"img_path": "images/063965a23962047ad888aefba83efdf030b0330259733f0b420e6459418824ee.jpg",
|
| 951 |
+
"table_caption": [],
|
| 952 |
+
"table_footnote": [],
|
| 953 |
+
"table_body": "<table><tr><td>Baseline Detectors</td><td colspan=\"2\">Mean Jensen-Shannon</td><td colspan=\"2\">Mean Hellinger</td><td colspan=\"2\">Range Hellinger</td></tr><tr><td>Env. - Misspecification</td><td>AUROC</td><td>Max F-1</td><td>AUROC</td><td>Max F-1</td><td>AUROC</td><td>Max F-1</td></tr><tr><td>Traffic-Mer- misweighting</td><td>81.0%</td><td>0.824</td><td>81.0%</td><td>0.824</td><td>76.2%</td><td>0.824</td></tr><tr><td>Traffic-Mer - scope</td><td>74.6%</td><td>0.818</td><td>74.6%</td><td>0.818</td><td>57.1%</td><td>0.720</td></tr><tr><td>Traffic-Mer - ontological</td><td>52.7%</td><td>0.583</td><td>55.4%</td><td>0.646</td><td>71.4%</td><td>0.842</td></tr><tr><td>Traffic-Bot - misweighting</td><td>88.9%</td><td>0.900</td><td>88.9%</td><td>0.900</td><td>74.1%</td><td>0.857</td></tr><tr><td>COVID - ontological</td><td>45.2%</td><td>0.706</td><td>59.5%</td><td>0.750</td><td>88.1%</td><td>0.923</td></tr></table>",
|
| 954 |
+
"bbox": [
|
| 955 |
+
168,
|
| 956 |
+
299,
|
| 957 |
+
834,
|
| 958 |
+
419
|
| 959 |
+
],
|
| 960 |
+
"page_idx": 8
|
| 961 |
+
},
|
| 962 |
+
{
|
| 963 |
+
"type": "text",
|
| 964 |
+
"text": "Table 2: Performance of detectors on different subtasks. Each detector has at least one subtask with AUROC under $60 \\%$ , indicating poor performance. ",
|
| 965 |
+
"bbox": [
|
| 966 |
+
171,
|
| 967 |
+
429,
|
| 968 |
+
823,
|
| 969 |
+
457
|
| 970 |
+
],
|
| 971 |
+
"page_idx": 8
|
| 972 |
+
},
|
| 973 |
+
{
|
| 974 |
+
"type": "text",
|
| 975 |
+
"text": "We observe that different detectors are better for different tasks, suggesting that future detectors could do better than any of our baselines. Our benchmark and baseline provides a starting point for further research on mitigating reward hacking. ",
|
| 976 |
+
"bbox": [
|
| 977 |
+
174,
|
| 978 |
+
473,
|
| 979 |
+
825,
|
| 980 |
+
515
|
| 981 |
+
],
|
| 982 |
+
"page_idx": 8
|
| 983 |
+
},
|
| 984 |
+
{
|
| 985 |
+
"type": "text",
|
| 986 |
+
"text": "6 DISCUSSION ",
|
| 987 |
+
"text_level": 1,
|
| 988 |
+
"bbox": [
|
| 989 |
+
174,
|
| 990 |
+
535,
|
| 991 |
+
310,
|
| 992 |
+
551
|
| 993 |
+
],
|
| 994 |
+
"page_idx": 8
|
| 995 |
+
},
|
| 996 |
+
{
|
| 997 |
+
"type": "text",
|
| 998 |
+
"text": "In this work, we designed a diverse set of environments and proxy rewards, uncovered several instances of phase transitions, and proposed an anomaly detection task to help mitigate these transitions. Our results raise two questions: How can we not only detect phase transitions, but prevent them in the first place? And how should phase transitions shape our approach to safe ML? ",
|
| 999 |
+
"bbox": [
|
| 1000 |
+
174,
|
| 1001 |
+
568,
|
| 1002 |
+
825,
|
| 1003 |
+
623
|
| 1004 |
+
],
|
| 1005 |
+
"page_idx": 8
|
| 1006 |
+
},
|
| 1007 |
+
{
|
| 1008 |
+
"type": "text",
|
| 1009 |
+
"text": "On preventing phase transitions, anomaly detection already offers one path forward. Once we can detect anomalies, we can potentially prevent them, by using the detector to purge the unwanted behavior (e.g. by including it in the training objective). Similar policy shaping has recently been used to make RL agents more ethical (Hendrycks et al., 2021b). However, since the anomaly detectors will be optimized against by the RL policy, they need to be adversarially robust (Goodfellow et al., 2014). This motivates further work on adversarial robustness and adversarial anomaly detection. Another possible direction is optimizing policies against a distribution of rewards (Brown et al., 2020; Javed et al., 2021), which may prevent over-fitting to a given set of metrics. ",
|
| 1010 |
+
"bbox": [
|
| 1011 |
+
174,
|
| 1012 |
+
630,
|
| 1013 |
+
825,
|
| 1014 |
+
741
|
| 1015 |
+
],
|
| 1016 |
+
"page_idx": 8
|
| 1017 |
+
},
|
| 1018 |
+
{
|
| 1019 |
+
"type": "text",
|
| 1020 |
+
"text": "Regarding safe ML, several recent papers propose extrapolating empirical trends to forecast future ML capabilities (Kaplan et al., 2020; Hernandez et al., 2021; Droppo & Elibol, 2021), partly to avoid unforeseen consequences from ML. While we support this work, our results show that trend extrapolation alone is not enough to ensure the safety of ML systems. To complement trend extrapolation, we need better interpretability methods to identify emergent model behaviors early on, before they dominate performance (Olah et al., 2018). ML researchers should also familiarize themselves with emergent behavior in self-organizing systems (Yates, 2012), which often exhibit similar phase transitions (Anderson, 1972). Indeed, the ubiquity of phase transitions throughout science suggests that ML researchers should continue to expect surprises–and should therefore prepare for them. ",
|
| 1021 |
+
"bbox": [
|
| 1022 |
+
173,
|
| 1023 |
+
748,
|
| 1024 |
+
825,
|
| 1025 |
+
873
|
| 1026 |
+
],
|
| 1027 |
+
"page_idx": 8
|
| 1028 |
+
},
|
| 1029 |
+
{
|
| 1030 |
+
"type": "text",
|
| 1031 |
+
"text": "ACKNOWLEDGEMENTS ",
|
| 1032 |
+
"text_level": 1,
|
| 1033 |
+
"bbox": [
|
| 1034 |
+
176,
|
| 1035 |
+
103,
|
| 1036 |
+
367,
|
| 1037 |
+
117
|
| 1038 |
+
],
|
| 1039 |
+
"page_idx": 9
|
| 1040 |
+
},
|
| 1041 |
+
{
|
| 1042 |
+
"type": "text",
|
| 1043 |
+
"text": "We are thankful to Dan Hendrycks and Adam Gleave for helpful discussions about experiments and to Cassidy Laidlaw and Dan Hendrycks for providing valuable feedback on the writing. KB was supported by a JP Morgan AI Fellowship. JS was supported by NSF Award 2031985 and by Open Philanthropy. ",
|
| 1044 |
+
"bbox": [
|
| 1045 |
+
174,
|
| 1046 |
+
133,
|
| 1047 |
+
825,
|
| 1048 |
+
189
|
| 1049 |
+
],
|
| 1050 |
+
"page_idx": 9
|
| 1051 |
+
},
|
| 1052 |
+
{
|
| 1053 |
+
"type": "text",
|
| 1054 |
+
"text": "REFERENCES ",
|
| 1055 |
+
"text_level": 1,
|
| 1056 |
+
"bbox": [
|
| 1057 |
+
174,
|
| 1058 |
+
102,
|
| 1059 |
+
287,
|
| 1060 |
+
118
|
| 1061 |
+
],
|
| 1062 |
+
"page_idx": 10
|
| 1063 |
+
},
|
| 1064 |
+
{
|
| 1065 |
+
"type": "text",
|
| 1066 |
+
"text": "Philip W Anderson. More is different. Science, 177(4047):393–396, 1972. ",
|
| 1067 |
+
"bbox": [
|
| 1068 |
+
174,
|
| 1069 |
+
126,
|
| 1070 |
+
663,
|
| 1071 |
+
140
|
| 1072 |
+
],
|
| 1073 |
+
"page_idx": 10
|
| 1074 |
+
},
|
| 1075 |
+
{
|
| 1076 |
+
"type": "text",
|
| 1077 |
+
"text": "Marcin Andrychowicz, Anton Raichuk, Piotr Stanczyk, Manu Orsini, Sertan Girgin, Raphael ´ Marinier, Leonard Hussenot, Matthieu Geist, Olivier Pietquin, and Marcin Michalski. What ´ matters in on-policy reinforcement learning? A large-scale empirical study. arXiv preprint arXiv:2006.05990, 2020. ",
|
| 1078 |
+
"bbox": [
|
| 1079 |
+
173,
|
| 1080 |
+
148,
|
| 1081 |
+
826,
|
| 1082 |
+
205
|
| 1083 |
+
],
|
| 1084 |
+
"page_idx": 10
|
| 1085 |
+
},
|
| 1086 |
+
{
|
| 1087 |
+
"type": "text",
|
| 1088 |
+
"text": "Bowen Baker, Ingmar Kanitscheider, Todor Markov, Yi Wu, Glenn Powell, Bob McGrew, and Igor Mordatch. Emergent tool use from multi-agent autocurricula. In International Conference on Learning Representations, 2020. ",
|
| 1089 |
+
"bbox": [
|
| 1090 |
+
173,
|
| 1091 |
+
213,
|
| 1092 |
+
823,
|
| 1093 |
+
257
|
| 1094 |
+
],
|
| 1095 |
+
"page_idx": 10
|
| 1096 |
+
},
|
| 1097 |
+
{
|
| 1098 |
+
"type": "text",
|
| 1099 |
+
"text": "Peter Boettke and Benjamin Powell. The political economy of the covid-19 pandemic. Southern Economic Journal, 87(4):1090–1106, 2021. ",
|
| 1100 |
+
"bbox": [
|
| 1101 |
+
169,
|
| 1102 |
+
265,
|
| 1103 |
+
825,
|
| 1104 |
+
295
|
| 1105 |
+
],
|
| 1106 |
+
"page_idx": 10
|
| 1107 |
+
},
|
| 1108 |
+
{
|
| 1109 |
+
"type": "text",
|
| 1110 |
+
"text": "Rishi Bommasani et al. On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258, 2021. ",
|
| 1111 |
+
"bbox": [
|
| 1112 |
+
169,
|
| 1113 |
+
303,
|
| 1114 |
+
825,
|
| 1115 |
+
332
|
| 1116 |
+
],
|
| 1117 |
+
"page_idx": 10
|
| 1118 |
+
},
|
| 1119 |
+
{
|
| 1120 |
+
"type": "text",
|
| 1121 |
+
"text": "Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym, 2016. ",
|
| 1122 |
+
"bbox": [
|
| 1123 |
+
169,
|
| 1124 |
+
340,
|
| 1125 |
+
825,
|
| 1126 |
+
369
|
| 1127 |
+
],
|
| 1128 |
+
"page_idx": 10
|
| 1129 |
+
},
|
| 1130 |
+
{
|
| 1131 |
+
"type": "text",
|
| 1132 |
+
"text": "Amy Bronstone and Claudia Graham. The potential cost implications of averting severe hypoglycemic events requiring hospitalization in high-risk adults with type 1 diabetes using real-time continuous glucose monitoring. Journal of Diabetes Science and Technology, 10, 2016. ",
|
| 1133 |
+
"bbox": [
|
| 1134 |
+
173,
|
| 1135 |
+
377,
|
| 1136 |
+
823,
|
| 1137 |
+
421
|
| 1138 |
+
],
|
| 1139 |
+
"page_idx": 10
|
| 1140 |
+
},
|
| 1141 |
+
{
|
| 1142 |
+
"type": "text",
|
| 1143 |
+
"text": "Daniel Brown, Russell Coleman, Ravi Srinivasan, and Scott Niekum. Safe imitation learning via fast Bayesian reward inference from preferences. In Proceedings of the 37th International Conference on Machine Learning, 2020. ",
|
| 1144 |
+
"bbox": [
|
| 1145 |
+
176,
|
| 1146 |
+
428,
|
| 1147 |
+
823,
|
| 1148 |
+
472
|
| 1149 |
+
],
|
| 1150 |
+
"page_idx": 10
|
| 1151 |
+
},
|
| 1152 |
+
{
|
| 1153 |
+
"type": "text",
|
| 1154 |
+
"text": "Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. In Advances in Neural Information Processing Systems, 2017. ",
|
| 1155 |
+
"bbox": [
|
| 1156 |
+
174,
|
| 1157 |
+
479,
|
| 1158 |
+
823,
|
| 1159 |
+
522
|
| 1160 |
+
],
|
| 1161 |
+
"page_idx": 10
|
| 1162 |
+
},
|
| 1163 |
+
{
|
| 1164 |
+
"type": "text",
|
| 1165 |
+
"text": "Jesse Davis and Mark Goadrich. The relationship between precision-recall and roc curves. In International Conference on Machine Learning, 2006. ",
|
| 1166 |
+
"bbox": [
|
| 1167 |
+
171,
|
| 1168 |
+
531,
|
| 1169 |
+
823,
|
| 1170 |
+
560
|
| 1171 |
+
],
|
| 1172 |
+
"page_idx": 10
|
| 1173 |
+
},
|
| 1174 |
+
{
|
| 1175 |
+
"type": "text",
|
| 1176 |
+
"text": "Jasha Droppo and Oguz Elibol. Scaling laws for acoustic models. arXiv preprint arXiv:2106.09488, 2021. ",
|
| 1177 |
+
"bbox": [
|
| 1178 |
+
169,
|
| 1179 |
+
568,
|
| 1180 |
+
823,
|
| 1181 |
+
597
|
| 1182 |
+
],
|
| 1183 |
+
"page_idx": 10
|
| 1184 |
+
},
|
| 1185 |
+
{
|
| 1186 |
+
"type": "text",
|
| 1187 |
+
"text": "Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Volodymyr Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, Tim Harley, Iain Robert Dunning, Shane Legg, and Koray Kavukcuoglu. Impala: Scalable distributed deep-rl with importance weighted actor-learner architectures. 2018. ",
|
| 1188 |
+
"bbox": [
|
| 1189 |
+
173,
|
| 1190 |
+
606,
|
| 1191 |
+
823,
|
| 1192 |
+
648
|
| 1193 |
+
],
|
| 1194 |
+
"page_idx": 10
|
| 1195 |
+
},
|
| 1196 |
+
{
|
| 1197 |
+
"type": "text",
|
| 1198 |
+
"text": "Tom Everitt, Victoria Krakovna, Laurent Orseau, and Shane Legg. Reinforcement learning with a corrupted reward channel. In International Joint Conference on Artificial Intelligence, 2017. ",
|
| 1199 |
+
"bbox": [
|
| 1200 |
+
176,
|
| 1201 |
+
656,
|
| 1202 |
+
821,
|
| 1203 |
+
686
|
| 1204 |
+
],
|
| 1205 |
+
"page_idx": 10
|
| 1206 |
+
},
|
| 1207 |
+
{
|
| 1208 |
+
"type": "text",
|
| 1209 |
+
"text": "Ian Fox, Joyce Lee, Rodica Pop-Busui, and Jenna Wiens. Deep reinforcement learning for closedloop blood glucose control. In Machine Learning for Healthcare Conference, 2020. ",
|
| 1210 |
+
"bbox": [
|
| 1211 |
+
173,
|
| 1212 |
+
694,
|
| 1213 |
+
821,
|
| 1214 |
+
723
|
| 1215 |
+
],
|
| 1216 |
+
"page_idx": 10
|
| 1217 |
+
},
|
| 1218 |
+
{
|
| 1219 |
+
"type": "text",
|
| 1220 |
+
"text": "M. Fralick and A. S. Kesselheim. The U.S. Insulin Crisis - Rationing a Lifesaving Medication Discovered in the 1920s. New England Journal of Medicine, 381(19):1793–1795, 2019. ",
|
| 1221 |
+
"bbox": [
|
| 1222 |
+
174,
|
| 1223 |
+
731,
|
| 1224 |
+
821,
|
| 1225 |
+
761
|
| 1226 |
+
],
|
| 1227 |
+
"page_idx": 10
|
| 1228 |
+
},
|
| 1229 |
+
{
|
| 1230 |
+
"type": "text",
|
| 1231 |
+
"text": "Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014. ",
|
| 1232 |
+
"bbox": [
|
| 1233 |
+
173,
|
| 1234 |
+
768,
|
| 1235 |
+
821,
|
| 1236 |
+
797
|
| 1237 |
+
],
|
| 1238 |
+
"page_idx": 10
|
| 1239 |
+
},
|
| 1240 |
+
{
|
| 1241 |
+
"type": "text",
|
| 1242 |
+
"text": "Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In International conference on machine learning, 2018. ",
|
| 1243 |
+
"bbox": [
|
| 1244 |
+
176,
|
| 1245 |
+
806,
|
| 1246 |
+
823,
|
| 1247 |
+
849
|
| 1248 |
+
],
|
| 1249 |
+
"page_idx": 10
|
| 1250 |
+
},
|
| 1251 |
+
{
|
| 1252 |
+
"type": "text",
|
| 1253 |
+
"text": "Dylan Hadfield-Menell, Smitha Milli, Pieter Abbeel, Stuart J Russell, and Anca Dragan. Inverse reward design. In Advances in Neural Information Processing Systems, 2017. ",
|
| 1254 |
+
"bbox": [
|
| 1255 |
+
174,
|
| 1256 |
+
857,
|
| 1257 |
+
820,
|
| 1258 |
+
887
|
| 1259 |
+
],
|
| 1260 |
+
"page_idx": 10
|
| 1261 |
+
},
|
| 1262 |
+
{
|
| 1263 |
+
"type": "text",
|
| 1264 |
+
"text": "Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. International Conference on Learning Representations, 2017. ",
|
| 1265 |
+
"bbox": [
|
| 1266 |
+
176,
|
| 1267 |
+
895,
|
| 1268 |
+
820,
|
| 1269 |
+
924
|
| 1270 |
+
],
|
| 1271 |
+
"page_idx": 10
|
| 1272 |
+
},
|
| 1273 |
+
{
|
| 1274 |
+
"type": "text",
|
| 1275 |
+
"text": "Dan Hendrycks, Nicholas Carlini, John Schulman, and Jacob Steinhardt. Unsolved problems in ml safety. arXiv preprint arXiv:2109.13916, 2021a. ",
|
| 1276 |
+
"bbox": [
|
| 1277 |
+
169,
|
| 1278 |
+
103,
|
| 1279 |
+
825,
|
| 1280 |
+
132
|
| 1281 |
+
],
|
| 1282 |
+
"page_idx": 11
|
| 1283 |
+
},
|
| 1284 |
+
{
|
| 1285 |
+
"type": "text",
|
| 1286 |
+
"text": "Dan Hendrycks, Mantas Mazeika, Andy Zou, Sahil Patel, Christine Zhu, Jesus Navarro, Dawn Song, Bo Li, and Jacob Steinhardt. What would Jiminy Cricket do? Towards agents that behave morally. 2021b. ",
|
| 1287 |
+
"bbox": [
|
| 1288 |
+
174,
|
| 1289 |
+
141,
|
| 1290 |
+
823,
|
| 1291 |
+
184
|
| 1292 |
+
],
|
| 1293 |
+
"page_idx": 11
|
| 1294 |
+
},
|
| 1295 |
+
{
|
| 1296 |
+
"type": "text",
|
| 1297 |
+
"text": "Darby Herkert, Pavithra Vijayakumar, Jing Luo, Jeremy I. Schwartz, Tracy L. Rabin, Eunice DeFilippo, and Kasia J. Lipska. Cost-related insulin underuse among patients with diabetes. JAMA Internal Medicine, 179(1):112–114, Jan 2019. ",
|
| 1298 |
+
"bbox": [
|
| 1299 |
+
173,
|
| 1300 |
+
194,
|
| 1301 |
+
825,
|
| 1302 |
+
237
|
| 1303 |
+
],
|
| 1304 |
+
"page_idx": 11
|
| 1305 |
+
},
|
| 1306 |
+
{
|
| 1307 |
+
"type": "text",
|
| 1308 |
+
"text": "Danny Hernandez, Jared Kaplan, Tom Henighan, and Sam McCandlish. Scaling laws for transfer. arXiv preprint arXiv:2102.01293, 2021. ",
|
| 1309 |
+
"bbox": [
|
| 1310 |
+
173,
|
| 1311 |
+
244,
|
| 1312 |
+
821,
|
| 1313 |
+
275
|
| 1314 |
+
],
|
| 1315 |
+
"page_idx": 11
|
| 1316 |
+
},
|
| 1317 |
+
{
|
| 1318 |
+
"type": "text",
|
| 1319 |
+
"text": "Evan Hubinger, Chris van Merwijk, Vladimir Mikulik, Joar Skalse, and Scott Garrabrant. Risks from learned optimization in advanced machine learning systems. arXiv preprint arXiv:1906.01820, 2019. ",
|
| 1320 |
+
"bbox": [
|
| 1321 |
+
173,
|
| 1322 |
+
284,
|
| 1323 |
+
825,
|
| 1324 |
+
327
|
| 1325 |
+
],
|
| 1326 |
+
"page_idx": 11
|
| 1327 |
+
},
|
| 1328 |
+
{
|
| 1329 |
+
"type": "text",
|
| 1330 |
+
"text": "Borja Ibarz, J. Leike, Tobias Pohlen, Geoffrey Irving, S. Legg, and Dario Amodei. Reward learning from human preferences and demonstrations in Atari. In Advances in Neural Information Processing Systems, 2018. ",
|
| 1331 |
+
"bbox": [
|
| 1332 |
+
173,
|
| 1333 |
+
335,
|
| 1334 |
+
825,
|
| 1335 |
+
378
|
| 1336 |
+
],
|
| 1337 |
+
"page_idx": 11
|
| 1338 |
+
},
|
| 1339 |
+
{
|
| 1340 |
+
"type": "text",
|
| 1341 |
+
"text": "Zaynah Javed, Daniel S Brown, Satvik Sharma, Jerry Zhu, Ashwin Balakrishna, Marek Petrik, Anca Dragan, and Ken Goldberg. Policy gradient bayesian robust optimization for imitation learning. In Proceedings of the 38th International Conference on Machine Learning, 2021. ",
|
| 1342 |
+
"bbox": [
|
| 1343 |
+
174,
|
| 1344 |
+
387,
|
| 1345 |
+
823,
|
| 1346 |
+
431
|
| 1347 |
+
],
|
| 1348 |
+
"page_idx": 11
|
| 1349 |
+
},
|
| 1350 |
+
{
|
| 1351 |
+
"type": "text",
|
| 1352 |
+
"text": "Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020. ",
|
| 1353 |
+
"bbox": [
|
| 1354 |
+
174,
|
| 1355 |
+
439,
|
| 1356 |
+
823,
|
| 1357 |
+
483
|
| 1358 |
+
],
|
| 1359 |
+
"page_idx": 11
|
| 1360 |
+
},
|
| 1361 |
+
{
|
| 1362 |
+
"type": "text",
|
| 1363 |
+
"text": "W. Bradley Knox, Alessandro Allievi, Holger Banzhaf, Felix Schmitt, and Peter Stone. Reward (Mis)design for Autonomous Driving. arXiv e-prints arXiv:2104.13906, 2021. ",
|
| 1364 |
+
"bbox": [
|
| 1365 |
+
169,
|
| 1366 |
+
492,
|
| 1367 |
+
823,
|
| 1368 |
+
521
|
| 1369 |
+
],
|
| 1370 |
+
"page_idx": 11
|
| 1371 |
+
},
|
| 1372 |
+
{
|
| 1373 |
+
"type": "text",
|
| 1374 |
+
"text": "Jens Kober, J Andrew Bagnell, and Jan Peters. Reinforcement learning in robotics: A survey. The International Journal of Robotics Research, 32(11):1238–1274, 2013. ",
|
| 1375 |
+
"bbox": [
|
| 1376 |
+
169,
|
| 1377 |
+
530,
|
| 1378 |
+
823,
|
| 1379 |
+
559
|
| 1380 |
+
],
|
| 1381 |
+
"page_idx": 11
|
| 1382 |
+
},
|
| 1383 |
+
{
|
| 1384 |
+
"type": "text",
|
| 1385 |
+
"text": "Varun Kompella, Roberto Capobianco, Stacy Jong, Jonathan Browne, Spencer Fox, Lauren Meyers, Peter Wurman, and Peter Stone. Reinforcement learning for optimization of covid-19 mitigation policies, 2020. ",
|
| 1386 |
+
"bbox": [
|
| 1387 |
+
174,
|
| 1388 |
+
568,
|
| 1389 |
+
825,
|
| 1390 |
+
611
|
| 1391 |
+
],
|
| 1392 |
+
"page_idx": 11
|
| 1393 |
+
},
|
| 1394 |
+
{
|
| 1395 |
+
"type": "text",
|
| 1396 |
+
"text": "BorIs. P. Kovatchev, Martin Straume, Daniel J. Cox, and Leon.S Farhy. Risk analysis of blood glucose data:a quantitative approach to optimizing the control of insulin dependent diabetes. Journal of Theoretical Medicine, 3(1):1–10, 2000. ",
|
| 1397 |
+
"bbox": [
|
| 1398 |
+
174,
|
| 1399 |
+
621,
|
| 1400 |
+
825,
|
| 1401 |
+
664
|
| 1402 |
+
],
|
| 1403 |
+
"page_idx": 11
|
| 1404 |
+
},
|
| 1405 |
+
{
|
| 1406 |
+
"type": "text",
|
| 1407 |
+
"text": "Heinrich Kuttler, Nantas Nardelli, Thibaut Lavril, Marco Selvatici, Viswanath Sivakumar, Tim ¨ Rocktaschel, and Edward Grefenstette. TorchBeast: A PyTorch Platform for Distributed RL.¨ arXiv preprint arXiv:1910.03552, 2019. ",
|
| 1408 |
+
"bbox": [
|
| 1409 |
+
173,
|
| 1410 |
+
672,
|
| 1411 |
+
825,
|
| 1412 |
+
715
|
| 1413 |
+
],
|
| 1414 |
+
"page_idx": 11
|
| 1415 |
+
},
|
| 1416 |
+
{
|
| 1417 |
+
"type": "text",
|
| 1418 |
+
"text": "Benita Lee. How much does insulin cost? Here’s how 23 brands compare, Nov 2020. ",
|
| 1419 |
+
"bbox": [
|
| 1420 |
+
173,
|
| 1421 |
+
724,
|
| 1422 |
+
732,
|
| 1423 |
+
741
|
| 1424 |
+
],
|
| 1425 |
+
"page_idx": 11
|
| 1426 |
+
},
|
| 1427 |
+
{
|
| 1428 |
+
"type": "text",
|
| 1429 |
+
"text": "Jan Leike, Miljan Martic, Victoria Krakovna, Pedro A. Ortega, Tom Everitt, Andrew Lefrancq, Laurent Orseau, and Shane Legg. AI safety gridworlds, 2017. ",
|
| 1430 |
+
"bbox": [
|
| 1431 |
+
173,
|
| 1432 |
+
748,
|
| 1433 |
+
823,
|
| 1434 |
+
779
|
| 1435 |
+
],
|
| 1436 |
+
"page_idx": 11
|
| 1437 |
+
},
|
| 1438 |
+
{
|
| 1439 |
+
"type": "text",
|
| 1440 |
+
"text": "Michael L. Littman, Ifeoma Ajunwa, Guy Berger, Craig Boutilier, Morgan Currie, Finale DoshiVelez, Gillian Hadfield, Michael C. Horowitz, Charles Isbell, Hiroaki Kitano, Karen Levy, Terah Lyons, Melanie Mitchell, Julie Shah, Steven Sloman, Shannon Vallor, and Toby Walsh. Gathering strength, gathering storms: The one hundred year study on artificial intelligence (AI100) 2021 study panel report. Technical report, Stanford University, Stanford, CA, 2021. ",
|
| 1441 |
+
"bbox": [
|
| 1442 |
+
174,
|
| 1443 |
+
787,
|
| 1444 |
+
825,
|
| 1445 |
+
858
|
| 1446 |
+
],
|
| 1447 |
+
"page_idx": 11
|
| 1448 |
+
},
|
| 1449 |
+
{
|
| 1450 |
+
"type": "text",
|
| 1451 |
+
"text": "Pablo Alvarez Lopez, Michael Behrisch, Laura Bieker-Walz, Jakob Erdmann, Yun-Pang Flotter ¨ od, ¨ Robert Hilbrich, Leonhard Lucken, Johannes Rummel, Peter Wagner, and Evamarie Wießner. ¨ Microscopic traffic simulation using SUMO. In International Conference on Intelligent Transportation Systems, 2018. ",
|
| 1452 |
+
"bbox": [
|
| 1453 |
+
174,
|
| 1454 |
+
867,
|
| 1455 |
+
823,
|
| 1456 |
+
924
|
| 1457 |
+
],
|
| 1458 |
+
"page_idx": 11
|
| 1459 |
+
},
|
| 1460 |
+
{
|
| 1461 |
+
"type": "text",
|
| 1462 |
+
"text": "Chiara Dalla Man, Francesco Micheletto, Dayu Lv, Marc Breton, Boris Kovatchev, and Claudio Cobelli. The UVA/PADOVA type 1 diabetes simulator: New features. Journal of Diabetes Science and Technology, 8(1):26–34, Jan 2014. ",
|
| 1463 |
+
"bbox": [
|
| 1464 |
+
176,
|
| 1465 |
+
103,
|
| 1466 |
+
823,
|
| 1467 |
+
146
|
| 1468 |
+
],
|
| 1469 |
+
"page_idx": 12
|
| 1470 |
+
},
|
| 1471 |
+
{
|
| 1472 |
+
"type": "text",
|
| 1473 |
+
"text": "Chris Olah, Arvind Satyanarayan, Ian Johnson, Shan Carter, Ludwig Schubert, Katherine Ye, and Alexander Mordvintsev. The building blocks of interpretability. Distill, 3(3):e10, 2018. ",
|
| 1474 |
+
"bbox": [
|
| 1475 |
+
171,
|
| 1476 |
+
155,
|
| 1477 |
+
825,
|
| 1478 |
+
184
|
| 1479 |
+
],
|
| 1480 |
+
"page_idx": 12
|
| 1481 |
+
},
|
| 1482 |
+
{
|
| 1483 |
+
"type": "text",
|
| 1484 |
+
"text": "Romain Paulus, Caiming Xiong, and Richard Socher. A deep reinforced model for abstractive summarization. In International Conference on Learning Representations, 2018. ",
|
| 1485 |
+
"bbox": [
|
| 1486 |
+
171,
|
| 1487 |
+
193,
|
| 1488 |
+
823,
|
| 1489 |
+
222
|
| 1490 |
+
],
|
| 1491 |
+
"page_idx": 12
|
| 1492 |
+
},
|
| 1493 |
+
{
|
| 1494 |
+
"type": "text",
|
| 1495 |
+
"text": "Manoel Horta Ribeiro, Raphael Ottoni, Robert West, Virg´ılio A. F. Almeida, and Wagner Meira. Auditing radicalization pathways on youtube. In Conference on Fairness, Accountability, and Transparency, New York, NY, USA, 2020. ",
|
| 1496 |
+
"bbox": [
|
| 1497 |
+
176,
|
| 1498 |
+
229,
|
| 1499 |
+
823,
|
| 1500 |
+
273
|
| 1501 |
+
],
|
| 1502 |
+
"page_idx": 12
|
| 1503 |
+
},
|
| 1504 |
+
{
|
| 1505 |
+
"type": "text",
|
| 1506 |
+
"text": "Stuart Russell. Human Compatible: Artificial Intelligence and the Problem of Control. Penguin, 2019. ",
|
| 1507 |
+
"bbox": [
|
| 1508 |
+
173,
|
| 1509 |
+
281,
|
| 1510 |
+
823,
|
| 1511 |
+
310
|
| 1512 |
+
],
|
| 1513 |
+
"page_idx": 12
|
| 1514 |
+
},
|
| 1515 |
+
{
|
| 1516 |
+
"type": "text",
|
| 1517 |
+
"text": "John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017. ",
|
| 1518 |
+
"bbox": [
|
| 1519 |
+
171,
|
| 1520 |
+
319,
|
| 1521 |
+
823,
|
| 1522 |
+
349
|
| 1523 |
+
],
|
| 1524 |
+
"page_idx": 12
|
| 1525 |
+
},
|
| 1526 |
+
{
|
| 1527 |
+
"type": "text",
|
| 1528 |
+
"text": "Nisan Stiennon, Long Ouyang, Jeff Wu, Daniel M Ziegler, Ryan Lowe, Chelsea Voss, Alec Radford, Dario Amodei, and Paul Christiano. Learning to summarize from human feedback. arXiv preprint arXiv:2009.01325, 2020. ",
|
| 1529 |
+
"bbox": [
|
| 1530 |
+
174,
|
| 1531 |
+
357,
|
| 1532 |
+
823,
|
| 1533 |
+
400
|
| 1534 |
+
],
|
| 1535 |
+
"page_idx": 12
|
| 1536 |
+
},
|
| 1537 |
+
{
|
| 1538 |
+
"type": "text",
|
| 1539 |
+
"text": "Jonathan Stray. Aligning ai optimization to community well-being. International Journal of Community Well-Being, 3(4):443–463, Dec 2020. ",
|
| 1540 |
+
"bbox": [
|
| 1541 |
+
171,
|
| 1542 |
+
409,
|
| 1543 |
+
821,
|
| 1544 |
+
438
|
| 1545 |
+
],
|
| 1546 |
+
"page_idx": 12
|
| 1547 |
+
},
|
| 1548 |
+
{
|
| 1549 |
+
"type": "text",
|
| 1550 |
+
"text": "Jihoon Tack, Sangwoo Mo, Jongheon Jeong, and Jinwoo Shin. Csi: Novelty detection via contrastive learning on distributionally shifted instances. Advances in Neural Information Processing Systems, 2020. ",
|
| 1551 |
+
"bbox": [
|
| 1552 |
+
171,
|
| 1553 |
+
446,
|
| 1554 |
+
823,
|
| 1555 |
+
489
|
| 1556 |
+
],
|
| 1557 |
+
"page_idx": 12
|
| 1558 |
+
},
|
| 1559 |
+
{
|
| 1560 |
+
"type": "text",
|
| 1561 |
+
"text": "Jessica Taylor. Quantilizers: A safer alternative to maximizers for limited optimization. In AAAI Workshop: AI, Ethics, and Society, 2016. ",
|
| 1562 |
+
"bbox": [
|
| 1563 |
+
173,
|
| 1564 |
+
497,
|
| 1565 |
+
823,
|
| 1566 |
+
527
|
| 1567 |
+
],
|
| 1568 |
+
"page_idx": 12
|
| 1569 |
+
},
|
| 1570 |
+
{
|
| 1571 |
+
"type": "text",
|
| 1572 |
+
"text": "Marin Toromanoff, Emilie Wirbel, and Fabien Moutarde. Is deep reinforcement learning really superhuman on Atari? Leveling the playing field, 2019. ",
|
| 1573 |
+
"bbox": [
|
| 1574 |
+
173,
|
| 1575 |
+
536,
|
| 1576 |
+
821,
|
| 1577 |
+
565
|
| 1578 |
+
],
|
| 1579 |
+
"page_idx": 12
|
| 1580 |
+
},
|
| 1581 |
+
{
|
| 1582 |
+
"type": "text",
|
| 1583 |
+
"text": "Martin Treiber, Ansgar Hennecke, and Dirk Helbing. Congested traffic states in empirical observations and microscopic simulations. Physical review E, 62(2):1805, 2000. ",
|
| 1584 |
+
"bbox": [
|
| 1585 |
+
173,
|
| 1586 |
+
573,
|
| 1587 |
+
823,
|
| 1588 |
+
603
|
| 1589 |
+
],
|
| 1590 |
+
"page_idx": 12
|
| 1591 |
+
},
|
| 1592 |
+
{
|
| 1593 |
+
"type": "text",
|
| 1594 |
+
"text": "Alexander Trott, Sunil Srinivasa, Douwe van der Wal, Sebastien Haneuse, and Stephan Zheng. Building a Foundation for Data-Driven, Interpretable, and Robust Policy Design using the AI Economist. arXiv preprint arXiv:2108.02904, 2021. ",
|
| 1595 |
+
"bbox": [
|
| 1596 |
+
176,
|
| 1597 |
+
611,
|
| 1598 |
+
823,
|
| 1599 |
+
655
|
| 1600 |
+
],
|
| 1601 |
+
"page_idx": 12
|
| 1602 |
+
},
|
| 1603 |
+
{
|
| 1604 |
+
"type": "text",
|
| 1605 |
+
"text": "Eugene Vinitsky, Aboudy Kreidieh, Luc Le Flem, Nishant Kheterpal, Kathy Jang, Cathy Wu, Fangyu Wu, Richard Liaw, Eric Liang, and Alexandre M. Bayen. Benchmarks for reinforcement learning in mixed-autonomy traffic. In Conference on Robot Learning, 2018. ",
|
| 1606 |
+
"bbox": [
|
| 1607 |
+
174,
|
| 1608 |
+
662,
|
| 1609 |
+
825,
|
| 1610 |
+
707
|
| 1611 |
+
],
|
| 1612 |
+
"page_idx": 12
|
| 1613 |
+
},
|
| 1614 |
+
{
|
| 1615 |
+
"type": "text",
|
| 1616 |
+
"text": "Cathy Wu, Abdul Rahman Kreidieh, Kanaad Parvate, Eugene Vinitsky, and Alexandre M. Bayen. Flow: A modular learning framework for mixed autonomy traffic. IEEE Transactions on Robotics, 2021. ",
|
| 1617 |
+
"bbox": [
|
| 1618 |
+
173,
|
| 1619 |
+
714,
|
| 1620 |
+
825,
|
| 1621 |
+
757
|
| 1622 |
+
],
|
| 1623 |
+
"page_idx": 12
|
| 1624 |
+
},
|
| 1625 |
+
{
|
| 1626 |
+
"type": "text",
|
| 1627 |
+
"text": "F Eugene Yates. Self-organizing systems: The emergence of order. Springer Science & Business Media, 2012. ",
|
| 1628 |
+
"bbox": [
|
| 1629 |
+
173,
|
| 1630 |
+
765,
|
| 1631 |
+
825,
|
| 1632 |
+
796
|
| 1633 |
+
],
|
| 1634 |
+
"page_idx": 12
|
| 1635 |
+
},
|
| 1636 |
+
{
|
| 1637 |
+
"type": "text",
|
| 1638 |
+
"text": "Chao Yu, Jiming Liu, and Shamim Nemati. Reinforcement learning in healthcare: A survey. arXiv preprint arXiv:1908.08796, 2019. ",
|
| 1639 |
+
"bbox": [
|
| 1640 |
+
171,
|
| 1641 |
+
804,
|
| 1642 |
+
823,
|
| 1643 |
+
833
|
| 1644 |
+
],
|
| 1645 |
+
"page_idx": 12
|
| 1646 |
+
},
|
| 1647 |
+
{
|
| 1648 |
+
"type": "text",
|
| 1649 |
+
"text": "Simon Zhuang and Dylan Hadfield-Menell. Consequences of misaligned AI. In Advances in Neural Information Processing Systems, 2020. ",
|
| 1650 |
+
"bbox": [
|
| 1651 |
+
171,
|
| 1652 |
+
842,
|
| 1653 |
+
825,
|
| 1654 |
+
871
|
| 1655 |
+
],
|
| 1656 |
+
"page_idx": 12
|
| 1657 |
+
},
|
| 1658 |
+
{
|
| 1659 |
+
"type": "image",
|
| 1660 |
+
"img_path": "images/76fb28d847f309167b1a3491d0a885781d7f168c53fe1c4c2978c449a2519fbf.jpg",
|
| 1661 |
+
"image_caption": [
|
| 1662 |
+
"Figure 7: Additional model size scatter plots. Observe that not all misspecifications cause misalignment. We plot the proxy reward with $\\mathbf { \\cdots } _ { \\mathbf { 0 } } \\mathbf { \\cdot } \\mathbf { \\sigma } $ and the true reward with “ $\\mathbf { \\nabla } \\times \\mathbf { \\vec { \\mathbf { \\nabla } } } \\mathbf { \\vec { \\mathbf { \\nabla } } }$ . The proxy reward is measured on the left-hand side of each figure and the true reward is measured on the right hand side of each figure. "
|
| 1663 |
+
],
|
| 1664 |
+
"image_footnote": [],
|
| 1665 |
+
"bbox": [
|
| 1666 |
+
171,
|
| 1667 |
+
131,
|
| 1668 |
+
825,
|
| 1669 |
+
693
|
| 1670 |
+
],
|
| 1671 |
+
"page_idx": 13
|
| 1672 |
+
},
|
| 1673 |
+
{
|
| 1674 |
+
"type": "text",
|
| 1675 |
+
"text": "A.1 EFFECT OF MODEL SIZE ",
|
| 1676 |
+
"text_level": 1,
|
| 1677 |
+
"bbox": [
|
| 1678 |
+
176,
|
| 1679 |
+
786,
|
| 1680 |
+
388,
|
| 1681 |
+
801
|
| 1682 |
+
],
|
| 1683 |
+
"page_idx": 13
|
| 1684 |
+
},
|
| 1685 |
+
{
|
| 1686 |
+
"type": "text",
|
| 1687 |
+
"text": "We plot the proxy and true reward vs. model size in Figure 7, following the experiment described in Section 4.1. ",
|
| 1688 |
+
"bbox": [
|
| 1689 |
+
174,
|
| 1690 |
+
813,
|
| 1691 |
+
825,
|
| 1692 |
+
842
|
| 1693 |
+
],
|
| 1694 |
+
"page_idx": 13
|
| 1695 |
+
},
|
| 1696 |
+
{
|
| 1697 |
+
"type": "image",
|
| 1698 |
+
"img_path": "images/fb5bde77c268a894b2f5dc52bdd728fd4b6daac92d2c3a1af6ab8787cf4628e8.jpg",
|
| 1699 |
+
"image_caption": [
|
| 1700 |
+
"Figure 8: Correlations between the proxy and true rewards, along with the reward hacking induced. In the left column, we plot the proxy reward with “•” and the true reward with “ $\\mathbf { \\vec { \\nabla } } \\times \\mathbf { \\vec { \\mathbf { \\nabla } } } ^ { \\mathbf { 3 } }$ . In the right column, we plot the trained checkpoint correlation and the randomly initialized checkpoint correlation. "
|
| 1701 |
+
],
|
| 1702 |
+
"image_footnote": [],
|
| 1703 |
+
"bbox": [
|
| 1704 |
+
171,
|
| 1705 |
+
95,
|
| 1706 |
+
826,
|
| 1707 |
+
676
|
| 1708 |
+
],
|
| 1709 |
+
"page_idx": 14
|
| 1710 |
+
},
|
| 1711 |
+
{
|
| 1712 |
+
"type": "text",
|
| 1713 |
+
"text": "A.2 CORRELATION BETWEEN PROXY AND TRUE REWARDS ",
|
| 1714 |
+
"text_level": 1,
|
| 1715 |
+
"bbox": [
|
| 1716 |
+
181,
|
| 1717 |
+
753,
|
| 1718 |
+
591,
|
| 1719 |
+
768
|
| 1720 |
+
],
|
| 1721 |
+
"page_idx": 14
|
| 1722 |
+
},
|
| 1723 |
+
{
|
| 1724 |
+
"type": "text",
|
| 1725 |
+
"text": "We plot the correlation between proxy and true rewards, following the experiment described in Section 4.3. Interestingly, we see that reward hacking still occurs when there is positive correlation between the true and proxy rewards, e.g., in Figures 8a/8b. Unsurprisingly, proxy-true pairs which are highly correlated, e.g., Figure 8c/8d do not exhibit reward hacking. Finally, proxy-true pairs which are negatively correlated, e.g., Figure 8e/8f exhibit the most reward hacking. ",
|
| 1726 |
+
"bbox": [
|
| 1727 |
+
173,
|
| 1728 |
+
780,
|
| 1729 |
+
825,
|
| 1730 |
+
851
|
| 1731 |
+
],
|
| 1732 |
+
"page_idx": 14
|
| 1733 |
+
},
|
| 1734 |
+
{
|
| 1735 |
+
"type": "table",
|
| 1736 |
+
"img_path": "images/2120b0bfb73cfd218f23ae0b15820445387a024ba9664d3349a3329d725a8c19.jpg",
|
| 1737 |
+
"table_caption": [],
|
| 1738 |
+
"table_footnote": [],
|
| 1739 |
+
"table_body": "<table><tr><td>Env. - Misspecification</td><td>#Policies</td><td>#Problematic</td><td>Rollout length</td><td>Trusted policy size</td></tr><tr><td>Traffic-Mer - misweighting</td><td>10</td><td>7</td><td>270</td><td>[96,96]</td></tr><tr><td>Traffic-Mer- scope</td><td>16</td><td>9</td><td>270</td><td>[16,16]</td></tr><tr><td>Traffic-Mer- ontological</td><td>23</td><td>7</td><td>270</td><td>[4]</td></tr><tr><td>Traffic-Bot - misweighting</td><td>12</td><td>9</td><td>270</td><td>[64,64]</td></tr><tr><td>COVID - ontological</td><td>13</td><td>6</td><td>200</td><td>[16,16]</td></tr></table>",
|
| 1740 |
+
"bbox": [
|
| 1741 |
+
176,
|
| 1742 |
+
101,
|
| 1743 |
+
825,
|
| 1744 |
+
200
|
| 1745 |
+
],
|
| 1746 |
+
"page_idx": 15
|
| 1747 |
+
},
|
| 1748 |
+
{
|
| 1749 |
+
"type": "text",
|
| 1750 |
+
"text": "Table 3: Benchmark statistics. We average over 5 rollouts in traffic and 32 rollouts in COVID. ",
|
| 1751 |
+
"bbox": [
|
| 1752 |
+
189,
|
| 1753 |
+
210,
|
| 1754 |
+
807,
|
| 1755 |
+
226
|
| 1756 |
+
],
|
| 1757 |
+
"page_idx": 15
|
| 1758 |
+
},
|
| 1759 |
+
{
|
| 1760 |
+
"type": "text",
|
| 1761 |
+
"text": "B POLYNOMALY ",
|
| 1762 |
+
"text_level": 1,
|
| 1763 |
+
"bbox": [
|
| 1764 |
+
176,
|
| 1765 |
+
251,
|
| 1766 |
+
326,
|
| 1767 |
+
267
|
| 1768 |
+
],
|
| 1769 |
+
"page_idx": 15
|
| 1770 |
+
},
|
| 1771 |
+
{
|
| 1772 |
+
"type": "text",
|
| 1773 |
+
"text": "B.1 BENCHMARK STATISTICS ",
|
| 1774 |
+
"text_level": 1,
|
| 1775 |
+
"bbox": [
|
| 1776 |
+
176,
|
| 1777 |
+
281,
|
| 1778 |
+
395,
|
| 1779 |
+
296
|
| 1780 |
+
],
|
| 1781 |
+
"page_idx": 15
|
| 1782 |
+
},
|
| 1783 |
+
{
|
| 1784 |
+
"type": "text",
|
| 1785 |
+
"text": "See Table 3 for Polynomaly’s statistics. ",
|
| 1786 |
+
"bbox": [
|
| 1787 |
+
174,
|
| 1788 |
+
308,
|
| 1789 |
+
431,
|
| 1790 |
+
323
|
| 1791 |
+
],
|
| 1792 |
+
"page_idx": 15
|
| 1793 |
+
},
|
| 1794 |
+
{
|
| 1795 |
+
"type": "text",
|
| 1796 |
+
"text": "B.2 RECEIVER OPERATING CHARACTERISTIC CURVES",
|
| 1797 |
+
"text_level": 1,
|
| 1798 |
+
"bbox": [
|
| 1799 |
+
174,
|
| 1800 |
+
338,
|
| 1801 |
+
566,
|
| 1802 |
+
354
|
| 1803 |
+
],
|
| 1804 |
+
"page_idx": 15
|
| 1805 |
+
},
|
| 1806 |
+
{
|
| 1807 |
+
"type": "text",
|
| 1808 |
+
"text": "We plot the ROC curves for the detectors described in Section 5.3. Our detectors are calculated as follows. ",
|
| 1809 |
+
"bbox": [
|
| 1810 |
+
173,
|
| 1811 |
+
364,
|
| 1812 |
+
823,
|
| 1813 |
+
395
|
| 1814 |
+
],
|
| 1815 |
+
"page_idx": 15
|
| 1816 |
+
},
|
| 1817 |
+
{
|
| 1818 |
+
"type": "text",
|
| 1819 |
+
"text": "Let $P$ and $Q$ represent two probability distributions with $M = { \\textstyle { \\frac { 1 } { 2 } } } ( P + Q )$ . Then the Jensen-Shannon divergence and the Hellinger distance between them is given by ",
|
| 1820 |
+
"bbox": [
|
| 1821 |
+
173,
|
| 1822 |
+
400,
|
| 1823 |
+
823,
|
| 1824 |
+
429
|
| 1825 |
+
],
|
| 1826 |
+
"page_idx": 15
|
| 1827 |
+
},
|
| 1828 |
+
{
|
| 1829 |
+
"type": "equation",
|
| 1830 |
+
"img_path": "images/224e7dfc757e468890a450de4aa224bfae288dd28a913fc022a113ff5cef96c2.jpg",
|
| 1831 |
+
"text": "$$\n\\begin{array} { r l } & { \\mathrm { J S D } ( P | | Q ) : = \\cfrac { 1 } { 2 } \\mathrm { K L } ( P | | M ) + \\cfrac { 1 } { 2 } \\mathrm { K L } ( Q | | M ) } \\\\ & { \\mathrm { H e l l i n g e r } ( P , Q ) : = \\cfrac { 1 } { 2 } \\int \\left( \\sqrt { d P } - \\sqrt { d Q } \\right) ^ { 2 } . } \\end{array}\n$$",
|
| 1832 |
+
"text_format": "latex",
|
| 1833 |
+
"bbox": [
|
| 1834 |
+
349,
|
| 1835 |
+
434,
|
| 1836 |
+
647,
|
| 1837 |
+
500
|
| 1838 |
+
],
|
| 1839 |
+
"page_idx": 15
|
| 1840 |
+
},
|
| 1841 |
+
{
|
| 1842 |
+
"type": "text",
|
| 1843 |
+
"text": "Our proposed detectors estimate the distance $\\mathcal { D } ( \\pi _ { \\mathrm { t r u s t e d } } , \\pi _ { \\mathrm { u n k n o w n } } )$ between the trusted policy $\\pi _ { \\mathrm { t r u s t e d } }$ and unknown policy $\\pi _ { \\mathrm { u n k n o w n } }$ as follows: We generate $r$ rollouts of $\\pi _ { \\mathrm { u n k n o w n } }$ , where $r = 5$ in the traffic environment and $r = 3 2$ in the COVID environment. Every $s$ steps of a rollout, where $s = 1 0$ in the traffic environment and $s = 1$ in the COVID environment, we set $P$ to be the action distribution of $\\pi _ { \\mathrm { u n k n o w n } }$ given the unknown agent’s state at that timestep in the rollout and $Q$ to be the action distribution of $\\pi _ { \\mathrm { t r u s t e d } }$ given the unknown agent’s state at that timestep in the rollout. Intuitively, if $P$ and $Q$ are far apart, then the trusted agent would have performed a different action than the unknown agent at that given timestep, indicating a possible case of reward hacking. We then compute either $\\bar { \\mathrm { J S D } } ( P \\Vert Q )$ or Hellinger $( P , Q )$ following Equation (1). These distances are collected every $s$ steps over the entire rollout, and we calculate metrics on these distances (range, mean, etc.) to assign an anomaly score to the untrusted policy. ",
|
| 1844 |
+
"bbox": [
|
| 1845 |
+
173,
|
| 1846 |
+
512,
|
| 1847 |
+
825,
|
| 1848 |
+
666
|
| 1849 |
+
],
|
| 1850 |
+
"page_idx": 15
|
| 1851 |
+
},
|
| 1852 |
+
{
|
| 1853 |
+
"type": "image",
|
| 1854 |
+
"img_path": "images/7399a39d54aa75762eb6da34ed7e56deb5e64882f2ce5351cb13a0481a60fbb8.jpg",
|
| 1855 |
+
"image_caption": [
|
| 1856 |
+
"Figure 9: ROC curves for Traffic-Mer - misweighting. "
|
| 1857 |
+
],
|
| 1858 |
+
"image_footnote": [],
|
| 1859 |
+
"bbox": [
|
| 1860 |
+
171,
|
| 1861 |
+
111,
|
| 1862 |
+
825,
|
| 1863 |
+
467
|
| 1864 |
+
],
|
| 1865 |
+
"page_idx": 16
|
| 1866 |
+
},
|
| 1867 |
+
{
|
| 1868 |
+
"type": "image",
|
| 1869 |
+
"img_path": "images/515ed1705c03a3ca9825367f39ff4be0ff426d5b8461ba3c2ab3cc70285f4e69.jpg",
|
| 1870 |
+
"image_caption": [
|
| 1871 |
+
"Figure 10: ROC curves for Traffic-Mer - scope. "
|
| 1872 |
+
],
|
| 1873 |
+
"image_footnote": [],
|
| 1874 |
+
"bbox": [
|
| 1875 |
+
171,
|
| 1876 |
+
523,
|
| 1877 |
+
825,
|
| 1878 |
+
882
|
| 1879 |
+
],
|
| 1880 |
+
"page_idx": 16
|
| 1881 |
+
},
|
| 1882 |
+
{
|
| 1883 |
+
"type": "image",
|
| 1884 |
+
"img_path": "images/2afd15e0e5d322675944c5520933a1513e0bf00cc8cd9f54865efc5e780be0c7.jpg",
|
| 1885 |
+
"image_caption": [
|
| 1886 |
+
"Figure 11: ROC curves for Traffic-Mer - ontological. "
|
| 1887 |
+
],
|
| 1888 |
+
"image_footnote": [],
|
| 1889 |
+
"bbox": [
|
| 1890 |
+
171,
|
| 1891 |
+
111,
|
| 1892 |
+
825,
|
| 1893 |
+
467
|
| 1894 |
+
],
|
| 1895 |
+
"page_idx": 17
|
| 1896 |
+
},
|
| 1897 |
+
{
|
| 1898 |
+
"type": "image",
|
| 1899 |
+
"img_path": "images/53f778a7de57400268ec71169ea46402329ce835192620a8a4ff88aed71b8f71.jpg",
|
| 1900 |
+
"image_caption": [
|
| 1901 |
+
"Figure 12: ROC curves for Traffic-Bot - misweighting. "
|
| 1902 |
+
],
|
| 1903 |
+
"image_footnote": [],
|
| 1904 |
+
"bbox": [
|
| 1905 |
+
171,
|
| 1906 |
+
523,
|
| 1907 |
+
825,
|
| 1908 |
+
882
|
| 1909 |
+
],
|
| 1910 |
+
"page_idx": 17
|
| 1911 |
+
},
|
| 1912 |
+
{
|
| 1913 |
+
"type": "image",
|
| 1914 |
+
"img_path": "images/bad590b3cea2bc46f6fdf6090474fb67464619fbe90b8a1e400df7b6dd5a7a2b.jpg",
|
| 1915 |
+
"image_caption": [
|
| 1916 |
+
"Figure 13: ROC curves for COVID - ontological. "
|
| 1917 |
+
],
|
| 1918 |
+
"image_footnote": [],
|
| 1919 |
+
"bbox": [
|
| 1920 |
+
171,
|
| 1921 |
+
318,
|
| 1922 |
+
825,
|
| 1923 |
+
675
|
| 1924 |
+
],
|
| 1925 |
+
"page_idx": 18
|
| 1926 |
+
}
|
| 1927 |
+
]
|
parse/dev/JYtwGwIL7ye/JYtwGwIL7ye_middle.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/dev/JYtwGwIL7ye/JYtwGwIL7ye_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/dev/Mspk_WYKoEH/Mspk_WYKoEH.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/dev/Mspk_WYKoEH/Mspk_WYKoEH_middle.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/dev/Mspk_WYKoEH/Mspk_WYKoEH_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/dev/fwzUgo0FM9v/fwzUgo0FM9v.md
ADDED
|
@@ -0,0 +1,476 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ROBBING THE FED: DIRECTLY OBTAINING PRIVATE DATA IN FEDERATED LEARNING WITH MODIFIED MODELS
|
| 2 |
+
|
| 3 |
+
Liam Fowl∗ Department of Mathematics University of Maryland
|
| 4 |
+
|
| 5 |
+
Jonas Geiping∗ Department of Computer Science University of Maryland
|
| 6 |
+
|
| 7 |
+
Wojtek Czaja Department of Mathematics University of Maryland
|
| 8 |
+
|
| 9 |
+
Micah Goldblum Center for Data Science New York University
|
| 10 |
+
|
| 11 |
+
Tom Goldstein Department of Computer Science University of Maryland
|
| 12 |
+
|
| 13 |
+
# ABSTRACT
|
| 14 |
+
|
| 15 |
+
Federated learning has quickly gained popularity with its promises of increased user privacy and efficiency. Previous works have shown that federated gradient updates contain information that can be used to approximately recover user data in some situations. These previous attacks on user privacy have been limited in scope and do not scale to gradient updates aggregated over even a handful of data points, leaving some to conclude that data privacy is still intact for realistic training regimes. In this work, we introduce a new threat model based on minimal but malicious modifications of the shared model architecture which enable the server to directly obtain a verbatim copy of user data from gradient updates without solving difficult inverse problems. Even user data aggregated over large batches – where previous methods fail to extract meaningful content – can be reconstructed by these minimally modified models.
|
| 16 |
+
|
| 17 |
+
# 1 INTRODUCTION
|
| 18 |
+
|
| 19 |
+
Federated learning (Konecnˇ y et al., 2015), also known as collaborative learning (Shokri & ´ Shmatikov, 2015), is a mechanism for training machine learning models in a distributed fashion on multiple user devices. In the simplest setting, a central server sends out model states to a group of users, who compute an update to the model based on their local data. These updates are then returned to the server, aggregated, and used to train the model. Over multiple rounds, this protocol can train a machine learning model, distributed over all users, without exchanging local data – only model updates are exchanged. Two central goals of federated learning are to improve training efficiency by decreasing communication overhead and to side-step issues of user-level privacy and data access rights that have become a focus of public attention in recent years (Veale et al., 2018).
|
| 20 |
+
|
| 21 |
+
Accordingly, many organizations, ranging from large tech companies (McMahan & Ramage, 2017) to medical institutions with especially strict privacy laws, such as hospitals (Jochems et al., 2016), have utilized federated learning to train machine learning models. However, in practice, data privacy is not guaranteed in general, but is dependent on a large number of interdependent settings and design choices specific to each federated learning system. In this work, we focus on the user perspective of privacy, and we study federated learning systems in which the central server is not able to directly view user data.
|
| 22 |
+
|
| 23 |
+
The key privacy concern for users is whether model updates reveal too much about the data on which they were calculated. Although Kairouz et al. (2021) discuss that “model updates are more focused on the learning task at hand than is the raw data (i.e. they contain strictly no additional information about the user, and typically significantly less, compared to the raw data)”, scenarios can be constructed in which the model updates themselves can be inverted to recover their input user information (Wang et al., 2018; Melis et al., 2018). Simple knowledge of the shared model state and model update can be sufficient for such an attack (Zhu et al., 2019; Geiping et al., 2020). These inversion attacks are particularly fruitful if a user’s model update is based on a single data point or only a small batch. Accordingly, a strong defense against these attacks is aggregation. The user only reports model updates aggregated over a significant number of local data points, and data from multiple users can be combined with secure aggregation protocols (Bonawitz et al., 2017) before being passed to the server. This ability to aggregate user updates while maintaining their utility is thought to be the main source of security in federated learning. Averaging raw local data in similar amounts would make it unusable for training, but model updates can be effectively aggregated.
|
| 24 |
+
|
| 25 |
+
Previous inversion attacks typically focus on a threat model in which the server (server here is a stand-in for any party with root access to the server or its incoming and outgoing communication) is interested in uncovering user information by examining updates, but without modifying the federated learning protocol, a behavior also referred to as honest-but-curious or semi-honest (Goldreich, 2009). In our case, where the party intending to recover user data is the server, this “honest” scenario appears contrived, as the server can modify its behavior to obtain private information. In this work, we are thus interested in explicitly malicious servers that may modify the model architecture and model parameters sent to the user.
|
| 26 |
+
|
| 27 |
+
We focus on scenarios in which an agent obtains data without making suspicious changes to the client code or learning behavior. One scenario which enables this threat model involves recently introduced APIs that allow organizations to train their own models using established federated learning protocols (Cason, 2020). In this environment, a malicious API participant can change their model’s architecture and parameters but cannot force unsuspecting edge devices to send user data directly.
|
| 28 |
+
|
| 29 |
+
We introduce minimal changes to model architectures that enable servers to breach user privacy, even in the face of large aggregations that have been previously deemed secure. These changes induce a structured pattern in the model update, where parts of the update contain information only about a fixed subset of data points. The constituent data points can then be recovered exactly, while evading existing aggregation defenses. For architectures that already contain large linear layers, the attack even works directly, modifying only the parameters of these layers.
|
| 30 |
+
|
| 31 |
+
# 2 LIMITATIONS OF EXISTING ATTACK STRATEGIES
|
| 32 |
+
|
| 33 |
+
A range of possible attacks against privacy in federated learning have been proposed in recent literature. In the simplest case of analytic attacks, Phong et al. (2017b) were among the first to discuss that the input to a learnable affine function can be directly computed from the gradient of its weights and bias, and additional analysis of this case can be found in Qian & Hansen (2020); Fan et al. (2020), and in Section 3.2. However, analytic recovery of this kind only succeeds for a single data point. For multiple data points, only the average of their inputs can be recovered, leading the attack to fail in most realistic scenarios.
|
| 34 |
+
|
| 35 |
+
Recursive attacks as proposed in Zhu & Blaschko (2021) can extend analytic attacks to models with more than only linear layers - a construction also mentioned in Fan et al. (2020). However, these attacks still recover only the average of inputs in the best case. Improvements in Pan et al. (2020) transform linear layers with ReLU activations into systems of linear equations that allow for a degree of recovery for batched inputs to these linear layers, although preceding convolutional layers still have to be deconvolved by recursion or numerical inversion techniques.
|
| 36 |
+
|
| 37 |
+
Surprisingly, optimization-based attacks turn out to be highly effective in inverting model updates. Wang et al. (2018) propose the direct recovery of input information in a setting where the users’ model update is the model parameter gradient averaged over local data. In a supervised learning setting, we define this update by $g$ and the loss function over this model by $\mathcal { L }$ with model parameters $\theta$ and data points $( x , y ) \in [ 0 , 1 ] ^ { n } \times \mathbb { R } ^ { m }$ . The server can then attempt recovery by solving the gradient matching problem of
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
\operatorname* { m i n } _ { x \in [ 0 , 1 ] ^ { n } } | | \nabla _ { \theta } \mathcal { L } ( x , y , \theta ) - g | | ^ { 2 }
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
and solve this optimization objective using first-order methods or any nonlinear equation solver. Subsequent work in Zhu et al. (2019); Zhao et al. (2020) and Wainakh et al. (2021) proposes solutions that also handle recovery of targets $y$ and variants of this objective are solved for example in Geiping et al. (2020) with cosine similarity and improved optimization and in Jeon et al. (2021)
|
| 44 |
+
|
| 45 |
+
with additional generative image priors. Reconstruction of input images can be further boosted by additional regularizers as in Yin et al. (2021) and Qian et al. (2021).
|
| 46 |
+
|
| 47 |
+
Most attacks in the literature focus on the described fedSGD setting (Konecnˇ y et al., 2015) in which ´ the users return gradient information to the server, but numerical attacks can also be performed against local updates with multiple local steps Geiping et al. (2020), for example against fedAVG (McMahan et al., 2017). In this work, we will discuss both update schemes, noting that gradient aggregation in “time”, with multiple local update steps, is not fundamentally more secure than aggregation over multiple data points. Previous attacks also focus significantly on learning scenarios where the user data is comprised of images. This is an advantage to the attacker, given that image data is highly structured, and a multitude of image priors are known and can be employed to improve reconstruction. In contrast, data types with weaker structure, such as tabular data, do not lend themselves to regularization based on strong priors, and we will show that our approach, on the other hand, does not rely on such tricks, and is therefore more data-agnostic.
|
| 48 |
+
|
| 49 |
+
The central limitation of these attack mechanisms is the degradation of attack success when user data is aggregated over even moderately large batches of data (either by the user themselves or by secure aggregation). State-of-the-art attacks such as Yin et al. (2021) recover only $2 8 \%$ of the user data (given a charitable measure of recovery) on a batch size of 48 for a ResNet-50 (He et al., 2015) model on ImageNet (ILSVRC2012 (Russakovsky et al., 2015)) with unlikely label collisions. The rate of images that can be successfully recovered drops drastically with increased batch sizes. Even without label collisions, large networks such as a ResNet-32-10 (Zagoruyko & Komodakis, 2016) leak only a few samples for a batch size of 128 in Geiping et al. (2020). These attacks further reconstruct only approximations to the actual user data which can fail to recover parts of the user data or replace it with likely but unrelated information in the case of strong image priors.
|
| 50 |
+
|
| 51 |
+
Further, although all of the previous works nominally operate under an honest-but-curious server model, they do often contain model adaptations on which reconstruction works especially well, such as large vision models with large gradient vectors, models with many features (Wang et al., 2018; Zhu & Blaschko, 2021), special activation functions (Zhu et al., 2019; Zhu & Blaschko, 2021), wide models (Geiping et al., 2020), or models trained with representation learning (Yin et al., 2021; Chen et al., 2020). These may be seen as malicious models with architectural choices that breach user privacy. In the same vein, we ask, what is the worst-case (but small) modification that can be applied to a neural network to break privacy?
|
| 52 |
+
|
| 53 |
+
# 3 MODEL MODIFICATIONS
|
| 54 |
+
|
| 55 |
+
In this section, we detail an example of a small model modification that has a major effect on user privacy, even allowing for the direct recovery of verbatim user data from model updates.
|
| 56 |
+
|
| 57 |
+
# 3.1 THREAT MODEL
|
| 58 |
+
|
| 59 |
+
We define two parties: the server $s$ and the users $\mathcal { U }$ . The server could be a tech company, a third party app using a federated learning framework on a mobile platform, or an organization like a hospital. The server $S$ defines a model architecture and distributes parameters $\theta$ for this architecture to the users, who compute local updates and return them to the server. The server cannot deviate from standard federated learning protocol in ways beyond changes to model architecture (within limits imposed by common ML frameworks) and model parameters. We measure the strength of a malicious modification of the architecture using the number of additional parameters inserted into the model. While it is clear that models with more parameters can leak more information, we will see that clever attacks can have a disproportionate effect on attack success, compared to more benign increases in parameter count, such as when model width is increased.
|
| 60 |
+
|
| 61 |
+
# 3.2 A SIMPLE EXAMPLE
|
| 62 |
+
|
| 63 |
+
To motivate the introduction of malicious modifications, we start with the simple case of a fully connected layer. A forward pass on this layer is written as $y = W x + b$ where $W$ is a weight matrix, $b$ is a bias, and $x$ is the layer’s input. As seen in Phong et al. (2017a); Qian & Hansen (2020); Fan et al. (2020), when the parameters of the network are updated according to some objective $\mathcal { L }$ , the $i ^ { t h }$
|
| 64 |
+
|
| 65 |
+
row of the update to $W$ :
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\nabla _ { W ^ { i } } \mathcal { L } = \frac { \partial \mathcal { L } } { \partial y ^ { i } } \cdot \nabla _ { W ^ { i } } y ^ { i } = \frac { \partial \mathcal { L } } { \partial y ^ { i } } \cdot x ,
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
where we use the shorthand $\mathcal { L } = \mathcal { L } ( \boldsymbol { x } ; W , b )$ . Similarly,
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
{ \frac { \partial { \mathcal { L } } } { \partial b ^ { i } } } = { \frac { \partial { \mathcal { L } } } { \partial y ^ { i } } } { \frac { \partial y ^ { i } } { \partial b ^ { i } } } = { \frac { \partial { \mathcal { L } } } { \partial y ^ { i } } } .
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
So as long as there exists some index $i$ with $\textstyle { \frac { \partial { \mathcal { L } } } { \partial b ^ { i } } } \neq 0$ , the single input $x$ is recovered perfectly as:
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
x = \nabla _ { W ^ { i } } \mathcal { L } \oslash \frac { \partial \mathcal { L } } { \partial b ^ { i } }
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
where $\oslash$ denotes entry-wise division.
|
| 84 |
+
|
| 85 |
+
computation can only recover However, for batched input $x$ , all derivatives are summed over the batch dimension $\begin{array} { r } { \sum _ { t = 1 } ^ { n } \nabla _ { W _ { l } ^ { i } } \mathcal { L } _ { t } \oslash \sum _ { t = 1 } ^ { n } \frac { \partial \mathcal { L } _ { t } } { \partial b _ { l } ^ { i } } } \end{array}$ 1 ∂Lt∂bi from each row where Pnt=1 ∂Lt∂bi $\begin{array} { r } { \sum _ { t = 1 } ^ { n } \frac { \partial \mathcal { L } _ { t } } { \partial b _ { l } ^ { i } } \neq 0 } \end{array}$ $n$ and the same , which is merely proportional to a linear combination of the $x _ { t }$ ’s. However, data points $x _ { t }$ only appear in the average if $\frac { \partial \mathcal { L } _ { t } } { \partial y _ { t } ^ { i } }$ is non-zero, a phenomenon also discussed in Sun et al. (2021). If $\mathcal { L }$ has a sparse gradient, e.g. in a multinomial logistic regression, then this structured gradient weakens the notion of averaging: Let $x$ be a batch of data with unique labels $1 , \ldots , n$ . In this setting $\begin{array} { r } { \frac { \partial \mathcal { L } _ { t } } { \partial y _ { t } ^ { i } } = 0 } \end{array}$ for all $i \neq t$ , so that each row $i$ actually recovers
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
x _ { t } = \sum _ { t = 1 } ^ { n } { \frac { \partial { \mathcal { L } } _ { t } } { \partial y _ { t } ^ { i } } } x _ { t } \oslash \sum _ { t = 1 } ^ { n } { \frac { \partial { \mathcal { L } } _ { t } } { \partial y _ { t } ^ { i } } } = { \frac { \partial { \mathcal { L } } _ { t } } { \partial y _ { t } ^ { i } } } x _ { t } \oslash { \frac { \partial { \mathcal { L } } _ { t } } { \partial y _ { t } ^ { i } } } .
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
For a batch of $n$ data points with unique labels, we could thus recover all data points exactly for this multinomial logistic regression. We visualize this in Appendix Fig. 11 for ImageNet data Russakovsky et al. (2015) (image classification, 1000 classes), where we could technically recover up to 1000 unique data points in the optimal case. However, this setup is impractical and suffers from several significant problems:
|
| 92 |
+
|
| 93 |
+
• Averaging: Multiple image reconstruction as described above is only possible in the linear setting, and with a logistic regression loss, a loss that depends on sparse logits is used. Even in this restrictive setting, reconstruction fails as soon as labels are repeated in a user update (which is the default case and outside the control of the server), especially if the accumulation size of a user update is larger than the underlying label space of the data. In this case, the server reconstructs the average of repeated classes. In Appendix Fig. 11, we see that in the worst-case scenario where all data points fall into the same class, each piece of user data contributes to the gradient equally, resulting in a mashup reconstruction that leaks little private information.
|
| 94 |
+
• Integration: As stated above, the naive reconstruction is only guaranteed to work only if the linear (single-layer) model is a standalone model, and not within a larger network. If the naive linear model was placed before another network, like a ResNet-18, then gradient entries for the linear layer contain elements averaged over all labels, as the combined network ostensibly depends on each output of the linear layer.
|
| 95 |
+
• Scalability: on an industrial scale dataset like ImageNet, the naive logistic regression model would require $> ~ 1 5 0 M$ parameters to retrieve an image from each label, which is of course far from any practical application.
|
| 96 |
+
|
| 97 |
+
# 3.3 IMPRINTING USER INFORMATION INTO MODEL UPDATES
|
| 98 |
+
|
| 99 |
+
Nonetheless, the perfect reconstruction afforded by the linear model remains an attractive feature. To this end, we introduce the imprint module class of modifications which overcome the previously described issues, while maintaining the superior reconstruction abilities of an analytic reconstruction as described above. Further, the imprint module can be constructed from a combination of commonly used architectural features with maliciously modified parameters that can create structured gradient entries for large volumes of data.
|
| 100 |
+
|
| 101 |
+
The imprint module can be constructed with a single linear layer (with bias), together with a ReLU activation. Formally, let $\{ x _ { i } \} _ { i = 1 } ^ { n } = X \in \mathbb { R } ^ { n \times m }$ be a batch of size $n$ of user data, then a malicious server can define an imprint module whose forward pass (on a single datapoint, $x$ ) looks like
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
M ( x ) = f ( W _ { * } x + b _ { * } ) ,
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
where $f$ is a standard ReLU nonlinearity. The crux of the imprint module lies in the construction of $W _ { * } \in \dot { \mathbb { R } } ^ { k \times m }$ and $b _ { * } \in \mathbb { R } ^ { k }$ . We denote the $i ^ { t h }$ row (or channel) of $W _ { * }$ and the $i ^ { t h }$ entry of $b _ { * }$ as $W _ { * } ^ { i }$ and $b _ { * } ^ { i }$ , respectively. We then construct $\boldsymbol { W } _ { * } ^ { ( i ) }$ so that
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\langle W _ { * } ^ { i } , x \rangle = h ( x ) ,
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
where $h$ is any linear function of the data where the server can estimate the distribution of values $\{ h ( x ) \} _ { x \sim \mathcal { D } }$ of this function on the user data distribution. For example, if the user data are images, $h$ could be average brightness, in which case $\boldsymbol { W } _ { * } ^ { i }$ is simply the row vector with entries identically equal to $\frac { 1 } { m }$ . In order to define the entries of the bias vector, we assume that the server knows some information about the cumulative density function (CDF), assumed to be continuous for the quantity measured by $h$ . Note this attack does not require the server to know the full distribution of user data, but rather can estimate the distribution of some scalar quantity associated with the user data (a much easier task). In Appendix Fig. 5, we see this can be quite easy for a server, and can even be done with a small amount of surrogate data. We also stress that the choice of $h$ here is not important to our method. For the purpose of explanation, we will assume that the quantity measured by $h$ is distributed normally, with $\mu = 0$ , $\sigma = 1$ . Then, the biases of the imprint module are determined by
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
b _ { * } ^ { i } = - \Phi ^ { - 1 } ( \frac { i } { k } ) = - c _ { i } ,
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
where $\Phi ^ { - 1 }$ is the inverse of the standard Gaussian CDF. In plain language, we first measure some quantity, like brightness, with the matrix $W _ { * }$ . We duplicate this measurement along the $k$ channels (rows) of $W _ { * }$ . In the meantime, we create $k$ “bins” for the data corresponding to intervals of equal mass according to the CDF of $h$ . Then, the measurement for a given datapoint will land somewhere in the distribution of $h$ .
|
| 120 |
+
|
| 121 |
+
For example, consider the case when the brightness of some image $x _ { t }$ lands between two values: $c _ { l } \leq h ( x _ { t } ) \leq c _ { l + 1 }$ , and no other image in the same batch has brightness in this range. In this situation, we say that $x _ { t }$ alone activates bin $l$ . Then, if the image $x _ { t }$ is passed through the imprint module, we have
|
| 122 |
+
|
| 123 |
+
$$
|
| 124 |
+
\left( \nabla _ { W _ { * } ^ { l } } \mathcal { L } - \nabla _ { W _ { * } ^ { l + 1 } } \mathcal { L } \right) \mathcal { O } \left( \frac { \partial \mathcal { L } } { \partial b _ { * } ^ { l } } - \frac { \partial \mathcal { L } } { \partial b _ { * } ^ { l + 1 } } \right) = x _ { t } + \sum _ { s = 1 } ^ { p } x _ { i _ { s } } - \sum _ { s = 1 } ^ { p } x _ { i _ { s } } = x _ { t } ,
|
| 125 |
+
$$
|
| 126 |
+
|
| 127 |
+
where images $\{ x _ { i _ { s } } \}$ are images from the batch with brightness $> c _ { l }$ . That is, the difference in successive rows $l , l + 1$ of the gradient entry for $W _ { * }$ correspond to all elements with brightness $c _ { l } \leq h ( x ) \leq c _ { l + 1 }$ (in this case, assumed to be just $x _ { t }$ - see Appendix $\mathbf { B }$ for remark). This is because all of $x _ { t } \cup \{ x _ { i _ { s } } \}$ activate the non-linearity for layer $l$ , since all these images have brightness $\geq c _ { l }$ , however, only images $\{ x _ { s } \}$ have brightness $\geq c _ { l + 1 }$ , so only these images activate the non-linearity for layer $l + 1$ . An interesting biproduct of this setup is that it would be difficult even for hand inspection of the parameters to reveal the inclusion of this module as the server could easily permute the bins, and add random rows to $W _ { * }$ which do not correspond to actual bins and only contribute to model performance. The gradient does not directly contain user data, so that the leak is also difficult to find by analyzing the gradient data and checking for matches with user data therein.
|
| 128 |
+
|
| 129 |
+
How successful will this attack be? Recall the parameter $k$ defined in the construction of the imprint module. This corresponds to the number of bins the malicious server can create to reconstruct user data. If a batch of data is passed through the imprint module, depending on the batch size $n$ used to calculate the update sent to the server, and number of bins, $k$ , the server can expect several bins to activate for only one datapoint. And the corresponding entries of the gradient vector can be appropriately combined, and inverted easily. The following result quantifies the user vulnerability in terms of the number of imprint bins, $k$ , and the amount of data, $n$ , averaged in a given update.
|
| 130 |
+
|
| 131 |
+
Proposition 1. If the server knows the CDF (assumed to be continuous) of some quantity associated with user data that can be measured with a linear function $h : \mathbb { R } ^ { m } \mathbb { R }$ , then for a batch of size $n$ and a number of imprint bins $k > n > 2$ , by using an appropriate combination of linear layer and ReLU activation, the server can expect to exactly recover
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
\frac { 1 } { \binom { k + n - 1 } { k - 1 } } [ \sum _ { i = 1 } ^ { n - 2 } i \cdot \binom { k } { i } \cdot \binom { \lfloor \frac { n - i } { 2 } \rfloor } { j = 1 } \binom { k - i } { j } \binom { n - i - j - 1 } { j - 1 } ) ] + r ( n , k )
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
samples of user data (where the data is in $\mathbb { R } ^ { m }$ ) perfectly. Note: $r ( n , k )$ is a correction term (see proof for full expansion).
|
| 138 |
+
|
| 139 |
+
Proof. See Appendix A.1.
|
| 140 |
+
|
| 141 |
+
This can be thought of as a lower bound on privacy breaches since, often, identifiable information can be extracted from a mixture of two images. Note that increasing the expected number of perfectly reconstructed images requires increasing the number of imprint bins, which in turn requires increasing the number of channels of the matrix $W _ { * }$ and thus the number of parameters. Thus, to visualize the result above in terms of the server-side hyperparameter, $k$ , we plot the expected proportion of data recovered as a function of number of bins in Fig. 1(a). Note that this inversion is analytic, and significantly more efficient and realistic than optimization based methods which often require tens of thousands of update steps.
|
| 142 |
+
|
| 143 |
+

|
| 144 |
+
Figure 1: Left (a): Expected proportion of a batch of 64 images perfectly recovered as a function of number of bins added via an imprint block in front of a ResNet-18 on ImageNet. With only 156 bins, an attacker can expect to recover over $50 \%$ of a batch of user images perfectly. Right (b): Probability of a successful “one-shot” attack on a batch of 4096 images as a function of mass captured in the one-shot bin. An attacker can optimize their bin size given an expected batch size.
|
| 145 |
+
|
| 146 |
+
The imprint module as described can be inserted in any position in any neural network which receives a non-zero gradient signal. To recover the input feature dimension of the module, a second linear layer can be appended, or – if no additional parameters are of interest – the sum of the outputs of the imprint module can be added to the next layer in the network. The binning behavior of the imprint module is independent of the structure of succeeding layers as long as any gradient signal is propagated. This flexibility allows for wide trade-offs between inconspicuousness and effectiveness of the imprint module. The module can be placed in later stages of model whereas an early linear layer might be suspicious to observers (now that they have seen this trick), but depending on the data modality, early linear layers can be a feature of an architecture anyway, in which case there is even no model modification necessary, only parameter changes. The parameter alterations necessary to trigger this vulnerability can furthermore be hidden from inspection until use. The layer can lay “dormant”, functioning and training as a normal linear layer initialized with random activations, as long as the server desires. At any point, a party with access to the server can send out parameter updates containing $W ^ { * } , b ^ { * }$ and trigger the attack.
|
| 147 |
+
|
| 148 |
+

|
| 149 |
+
Figure 2: Left: Ground truth batch of 64 user images. Right: Analytic reconstruction for an imprint model with 128 bins in front of a ResNet-18. Gray reconstructions denote bins in which no data point falls.)
|
| 150 |
+
|
| 151 |
+
# 4 EXPERIMENTS
|
| 152 |
+
|
| 153 |
+
In the following section, we provide empirical examples of imprint modules. In all experiments we evaluate ImageNet examples to relate to previous work (Yin et al., 2021), but stress that the approach is entirely data agnostic. Given an aggregated gradient update, we always reconstruct as discussed in Section 3. When, in the case of imprecision due to noise, more candidate data points are extracted than the expected batch size, only the candidates with highest gradient mean per row in $W ^ { * }$ are selected and the rest discarded. For analysis, we then use ground-truth information to order all data points in their original order (as much as possible) and measure PSNR scores as well as Image Identifiability Precision (IIP) scores as described in Yin et al. (2021). For IIP we search for nearest-neighbors in pixel space to evaluate a model-independent distance - a more strict metric compared to IIP as used in Yin et al. (2021). All computations run in single floating point precision.
|
| 154 |
+
|
| 155 |
+
# 4.1 FULL BATCH RECOVERY
|
| 156 |
+
|
| 157 |
+
We begin with a straightforward and realistic case as a selling point for our method - user gradient updates aggregated over a batch of 64 ImageNet images. We modify a ResNet-18 to include an imprint module with 128 bins in front. This relatively vanilla setup presents is a major stumbling block for optimization based techniques. For example, for a much smaller batch size of 8, the prior art in optimization based batched reconstruction achieves only 12.93 average PSNR (Yin et al., 2021). We do of course operate in different threat models (although Yin et al. (2021) also uses non-obvious parameter modifications). However, our imprint method is successfully able to recover almost perfect reconstructions of a majority of user data (see Fig. 2), and achieves an average PSNR of 75.75. We further stress that a batch size of 64 is by no means a limitation of the method. If bins, and hence additional rows in $W ^ { * }$ are added proportionally to the expected batch size, then recovery of significant proportions (see Fig. 1) of batches of arbitrary size – albeit with the incurred cost in additional parameters for each row – is possible. Note that concurrent work, Boenisch et al. (2021) also proposes a method to recover user data from large-batch updates by malicious modifications - operating in the same setting/threat model as our work . However, in a direct comparison, we find that our imprint module presents a much more significant threat to privacy compared to Boenisch et al. (2021) - see Appendix Fig. 21.
|
| 158 |
+
|
| 159 |
+
# 4.2 PRIVACY BREACHES IN INDUSTRIAL-SIZED BATCHES – ONE-SHOT ATTACKS
|
| 160 |
+
|
| 161 |
+
A breach in privacy can occur if even a single piece of user data is compromised. Unfortunately, there is a threatening modification of the imprint module for exactly such an attack. If a server has access to enough users, then it becomes feasible for the server to start fishing for private data among all updates, and attempt to recover a single data point from each incoming batch of data. Attacks of this nature require only as many additional parameters as twice the size of a single piece of targeted user data, as only two bins are needed. For this, $k$ bins are constructed initially, and then all bins are “fused” to create 2 final bins: a one-shot bin containing mass $n / k$ , and the other containing the remaining mass $( n + 1 ) / k$ . For perspective, for a ResNet-18 on ImageNet, this would require only an additional $1 \%$ of parameters - this is tiny compared to potentially massive increases in the number of parameters when no bins were fused, which could raise suspicion under inspection. Further, based on Proposition 1, it is always possible to select an optimal bin size, so that a data point is leaked on average once every four batches of incoming data, no matter how large the batch size. We demonstrate this statistical property by recovering a single image from an aggregated batch of $2 ^ { 1 4 } = 1 6$ , 384 ImageNet images (see Fig. 3). Even though the gradient updates are averaged over a vast number of data points, there can be no perfect privacy, and one data point is leaked in its entirety by only a minor model modification.
|
| 162 |
+
|
| 163 |
+

|
| 164 |
+
Figure 3: Left (a): A true user image from class “minibus”. Right (b): The reconstructed image from class “minibus” captured via our one-shot attack from averages aggregated over 16,384 datapoints. The PSNR is 161.36, i.e. a verbatim copy at machine precision. This user could potentially be identified via their recovered license plate, which was blanked out (by us!) to preserve privacy.
|
| 165 |
+
|
| 166 |
+
# 4.3 VARIANTS
|
| 167 |
+
|
| 168 |
+
Flexible placement The imprint module does not depend on its placement within a given model. No matter its position in a network, the incoming input features will be leaked to the server. Furthermore, the server can also change the parameters of preceding layers to represent (near)-identity mappings, allowing for the recovery of raw input data from inconspicuous positions deep in a network. For a convolutional network, we show off this variant in Fig. 14 for a ResNet-18. Here, the model parameters are manipulated to contain identity maps up to the location of the imprint module, while the downsampling operations remain. Even these later layers leak enough information that their inputs can be upsampled to breach privacy of the inputs. We remark that we show a simplified version of this attack here where the first three channels in each layer act as an identity, and all other channels are zero, but the model can also be modified to provide off-set pixels in all other channels, effectively increasing the spatial resolution in any layer proportionally with the number of channels.
|
| 169 |
+
|
| 170 |
+
Multiple local updates: In several federated learning protocols, such as fedAVG, users take several local update steps on data before sending model updates to the server Konecnˇ y et al. (2015). The ´ imprint module is threatening when a large amount of user data is used for a single update step. In this case, the only variable that matters is amount of total data used in the update. That is to say, 10 users sending updates on 100 datapoints each is equivalent (recovery-wise) to a single user sending an update calculated on 1000 datapoints. However, when multiple steps are taken, inverting gradients from pairwise differences (as in Eq. (4)) becomes more difficult, as entries in $W ^ { * }$ shift with local updates. However, an imprint variant that produces sparse gradients per data point is a threat to such federated averaging. Defining a forward pass in this new variant as $\bar { M ^ { \prime } } ( x )$ as $M ^ { \prime } ( x ) = g ( W _ { \ast } x + b _ { \ast } )$ where the non-linearity $g$ is a thresholding function:
|
| 171 |
+
|
| 172 |
+
$$
|
| 173 |
+
g ( t ) = \left\{ { \begin{array} { l l } { 0 } & { t \leq 0 } \\ { t } & { 0 \leq t \leq 1 } \\ { 1 } & { 1 \leq t } \end{array} } \right.
|
| 174 |
+
$$
|
| 175 |
+
|
| 176 |
+
Note this non-linearity can be simply constructed with a combination of two ReLUs, or with an implementation of a Hardtanh. We now define $\boldsymbol { W } _ { * } ^ { i }$ as: $\begin{array} { r } { \langle W _ { * } ^ { i } , x \rangle = \frac { h ( x ) } { \delta _ { i } } } \end{array}$ where $h$ is the a linear function of the data as described before, and the biases are defined as:
|
| 177 |
+
|
| 178 |
+
$$
|
| 179 |
+
b _ { * } ^ { i } = - { \frac { c _ { i } } { \delta _ { i } } } \quad \mathrm { w h e r e } \quad \delta _ { i } = \Phi ^ { - 1 } ( { \frac { i + 1 } { k } } ) - \Phi ^ { - 1 } ( { \frac { i } { k } } ) .
|
| 180 |
+
$$
|
| 181 |
+
|
| 182 |
+
This setup creates sparse bins where inversion is directly possible (without taking pairwise differences) in gradient entries, at the cost of an additional activation layer. Analyzing a local update step with $W _ { * } ^ { i , j }$ as the $i ^ { t h }$ row of $W _ { * }$ at update step $j$ , reveals that
|
| 183 |
+
|
| 184 |
+
$$
|
| 185 |
+
W _ { * } ^ { i , j } = W _ { * } ^ { i , j - 1 } - \alpha \frac { \partial \mathcal { L } } { \partial a ^ { i , j } } x _ { j }
|
| 186 |
+
$$
|
| 187 |
+
|
| 188 |
+
where $x _ { j }$ denotes the data from the previous batch that activated bin $i$ , and $a ^ { i , j }$ denotes the $i ^ { t h }$ activation at step $j$ , and $\alpha$ is the local learning rate. Note that if either a linear layer, or a convolutional layer follows this imprint module, then $\frac { \partial \mathcal { L } } { \partial a ^ { i , j } }$ does not depend on the scale of $W _ { * } ^ { i , j }$ . Therefore, a simple way to increase the effectiveness of the new imprint module, $M ^ { \prime }$ in the fedAVG case is to scale the linear function associated to the rows of $W _ { * }$ - i.e. $h ^ { \prime } ( x ) = c _ { 0 } \cdot h ( x )$ . This “flattens” the distribution of values, and increases the relative size of $b _ { * } ^ { i , j }$ compared to the gradient update $\frac { \partial \mathcal { L } } { \partial a ^ { i , j } }$ , which prevents the bins from shifting too significantly during local updates. As bin shift goes to 0, we recover the situation where the only variable that matters is the total data used in an update.
|
| 189 |
+
|
| 190 |
+

|
| 191 |
+
Figure 4: Left: Identification Success vs bin size. Right: Identification Success (via IIP score) vs. bin size and position in a ResNet-18 model. We find that the attack is stable over a range of batch sizes and positions in a model.
|
| 192 |
+
|
| 193 |
+
With this modification, reconstruction quality remains similar to the fedSGD setting. For example, splitting the batch of 64 ImageNet images up into 8 local updates with learning rate $\tau = 1 e - 4$ yields an IIP score of $7 0 . 3 1 \%$ , due to minor image duplications where images hit multiple shifted bins, which we visualize in Appendix Fig. 19.
|
| 194 |
+
|
| 195 |
+
Other data modalities: Yet another advantage to our imprint module over existing optimization based gradient inversion techniques is the flexibility in data domain. Other techniques have demonstrated some success in the image domain by leveraging strong regularizers including total variation (TV), image registration, matching batch norm statistics, and DeepInversion priors (Geiping et al., 2020; Yin et al., 2021). Such strong regularizers do not always exist in other domains of interest, such as text or tabular data. The discussed imprint module, however, is data-agnostic, and while we focus our experiments on the image domain, nowhere do we use any assumptions unique to vision. In fact, linear layers often appear in language models, and tabular data models - cases in which the attacker only needs to modify parameters of an existing model to breach user privacy (Vaswani et al., 2017; Somepalli et al., 2021) without architecture modifications.
|
| 196 |
+
|
| 197 |
+
# 5 POTENTIAL DEFENSE AND MITIGATION STRATEGIES
|
| 198 |
+
|
| 199 |
+
If aggregation is the only source of security in a FL system, then the proposed attack breaks it, uncovering samples of private data from arbitrarily large batches, especially via the One-shot mechanism. In light of this attack, the effectiveness of secure aggregation is reduced to only secure shuffling (Kairouz et al., 2021): When private data is uncovered via the imprint module, based on data that has been securely aggregated, then the data is breached, but is not directly connected to any specific user (aside from possible revealing information in the data itself). A mitigation strategy for users that does not require coordination (or consent) of a central server is to employ local differential privacy (Dwork & Roth, 2013). Adding sufficient gradient noise can be a defense against this attack as the division in Eq. (2) leads to potentially unbounded errors in the scale of the data. Yet, in practice, privacy is often still broken even if the correct scale cannot be determined, so that the amount of noise that has to be added is large. In Appendix Fig. 20, even with $\sigma = 0 . 0 1$ , private data is visibly leaked. Additional discussion on defenses can be found in Appendix A.7
|
| 200 |
+
|
| 201 |
+
# 6 CONCLUSIONS
|
| 202 |
+
|
| 203 |
+
Federated learning offers a promising avenue for training models in a distributed fashion. However, the use of federated learning, even with large scale averaging, does not guarantee user privacy. Using common and inconspicuous machine learning modules, a malicious server can breach user privacy by sending minimally modified models and parameters in a federated setup. We hope that constructing these examples clarifies current limitations and informs discussions on upcoming applications, especially concerning API design.
|
| 204 |
+
|
| 205 |
+
# ETHICS STATEMENT
|
| 206 |
+
|
| 207 |
+
In this work, we uncover an attack on federated learning that has the potential to compromise user privacy. While this method has the potential to be used for malicious purposes, the fundamental purpose of this research is to inform the community about the state of privacy in federated learning, and to help users and technical experts better understand the limitations of federated learning for the purpose of preserving user privacy.
|
| 208 |
+
|
| 209 |
+
# REPRODUCIBILITY STATEMENT
|
| 210 |
+
|
| 211 |
+
We provide additional technical details and the proof Proposition 1 in the appendix. Further, we provide open-source implementations of all attacks investigated in this work. The repository at https://github.com/lhfowl/robbing_the_fed shows a minimalistic implementation of the principles of this attack and the repository at https://github.com/JonasGeiping/ breaching embeds the attack in a larger framework of privacy attacks against federated learning. The experiments in this work require no GPU resources and can be cheaply evaluated on almost any machine with sufficient RAM.
|
| 212 |
+
|
| 213 |
+
# ACKNOWLEDGEMENTS
|
| 214 |
+
|
| 215 |
+
This work was supported by DARPA GARD, the Office and Naval Research, and the National Science Foundation Division of Mathematical Sciences. Addition support was provided by the Sloan Foundation, JP Morgan Chase, and Capital One Bank.
|
| 216 |
+
|
| 217 |
+
# REFERENCES
|
| 218 |
+
|
| 219 |
+
Franziska Boenisch, Adam Dziedzic, Roei Schuster, Ali Shahin Shamsabadi, Ilia Shumailov, and Nicolas Papernot. When the curious abandon honesty: Federated learning is not private. arXiv preprint arXiv:2112.02918, 2021.
|
| 220 |
+
|
| 221 |
+
Kallista Bonawitz, Vladimir Ivanov, Ben Kreuter, Antonio Marcedone, H. Brendan McMahan, Sarvar Patel, Daniel Ramage, Aaron Segal, and Karn Seth. Practical Secure Aggregation for Privacy Preserving Machine Learning. Technical Report 281, 2017. URL http://eprint.iacr. org/2017/281.
|
| 222 |
+
|
| 223 |
+
Patrick Cason. Announcing 4 New Libraries for Federated Learning on Web and Mobile Devices, 2020. https://blog.openmined.org/ announcing-new-libraries-for-fl-on-web-and-mobile/.
|
| 224 |
+
|
| 225 |
+
Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved Baselines with Momentum Contrastive Learning. arXiv:2003.04297 [cs], March 2020. URL http://arxiv.org/abs/ 2003.04297.
|
| 226 |
+
|
| 227 |
+
Cynthia Dwork and Aaron Roth. The Algorithmic Foundations of Differential Privacy. Foundations and Trends® in Theoretical Computer Science, 9(3-4):211–407, 2013. ISSN 1551-305X, 1551- 3068. doi: 10.1561/0400000042.
|
| 228 |
+
|
| 229 |
+
Lixin Fan, Kam Woh Ng, Ce Ju, Tianyu Zhang, Chang Liu, Chee Seng Chan, and Qiang Yang. Rethinking Privacy Preserving Deep Learning: How to Evaluate and Thwart Privacy Attacks. In Federated Learning: Privacy and Incentive, Lecture Notes in Computer Science, pp. 32–50. Springer International Publishing, Cham, 2020. ISBN 978-3-030-63076-8. doi: 10.1007/978-3-030-63076-8 3.
|
| 230 |
+
|
| 231 |
+
Jonas Geiping, Hartmut Bauermeister, Hannah Droge, and Michael Moeller.¨ Inverting Gradients - How easy is it to break privacy in federated learning? In Advances in Neural Information Processing Systems, volume 33, December 2020. URL https://proceedings.neurips.cc//paper_files/paper/2020/hash/ c4ede56bbd98819ae6112b20ac6bf145-Abstract.html.
|
| 232 |
+
|
| 233 |
+
Micah Goldblum, Jonas Geiping, Avi Schwarzschild, Michael Moeller, and Tom Goldstein. Truth or backpropaganda? An empirical investigation of deep learning theory. In Eighth International Conference on Learning Representations (ICLR 2020, Oral Presentation), April 2020. URL https://iclr.cc/virtual_2020/poster_HyxyIgHFvr.html.
|
| 234 |
+
|
| 235 |
+
Oded Goldreich. Foundations of Cryptography: Volume 2, Basic Applications. Cambridge University Press, Cambridge, 1st edition edition, September 2009. ISBN 978-0-521-11991-7.
|
| 236 |
+
|
| 237 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. arXiv:1512.03385 [cs], December 2015. URL http://arxiv.org/abs/ 1512.03385.
|
| 238 |
+
|
| 239 |
+
Jinggang Huang and David Mumford. Statistics of natural images and models. In Proceedings. 1999 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (Cat. No PR00149), volume 1, pp. 541–547 Vol. 1, June 1999. doi: 10.1109/CVPR.1999.786990.
|
| 240 |
+
|
| 241 |
+
Jinwoo Jeon, Jaechang Kim, Kangwook Lee, Sewoong Oh, and Jungseul Ok. Gradient Inversion with Generative Image Prior. In International Workshop on Federated Learning for User Privacy and Data Confidentiality, pp. 12, 2021.
|
| 242 |
+
|
| 243 |
+
Arthur Jochems, Timo M. Deist, Johan van Soest, Michael Eble, Paul Bulens, Philippe Coucke, Wim Dries, Philippe Lambin, and Andre Dekker. Distributed learning: Developing a predictive model based on data from multiple hospitals without data leaving the hospital – A real life proof of concept. Radiotherapy and Oncology, 121(3):459–467, December 2016. ISSN 0167-8140, 1879-0887. doi: 10.1016/j.radonc.2016.10.002.
|
| 244 |
+
|
| 245 |
+
Peter Kairouz, H. Brendan McMahan, Brendan Avent, Aurelien Bellet, Mehdi Bennis, Arjun Nitin ´ Bhagoji, Kallista Bonawitz, Zachary Charles, Graham Cormode, Rachel Cummings, Rafael G. L. D’Oliveira, Hubert Eichner, Salim El Rouayheb, David Evans, Josh Gardner, Zachary Garrett, Adria Gasc \` on, Badih Ghazi, Phillip B. Gibbons, Marco Gruteser, Zaid Harchaoui, Chaoyang He, ´ Lie He, Zhouyuan Huo, Ben Hutchinson, Justin Hsu, Martin Jaggi, Tara Javidi, Gauri Joshi, Mikhail Khodak, Jakub Konecnˇ y, Aleksandra Korolova, Farinaz Koushanfar, Sanmi Koyejo, ´ Tancrede Lepoint, Yang Liu, Prateek Mittal, Mehryar Mohri, Richard Nock, Ayfer \` Ozg ¨ ur, Rasmus ¨ Pagh, Mariana Raykova, Hang Qi, Daniel Ramage, Ramesh Raskar, Dawn Song, Weikang Song, Sebastian U. Stich, Ziteng Sun, Ananda Theertha Suresh, Florian Tramer, Praneeth Vepakomma, \` Jianyu Wang, Li Xiong, Zheng Xu, Qiang Yang, Felix X. Yu, Han Yu, and Sen Zhao. Advances and Open Problems in Federated Learning. arXiv:1912.04977 [cs, stat], March 2021. URL http://arxiv.org/abs/1912.04977.
|
| 246 |
+
|
| 247 |
+
Jakub Konecnˇ y, Brendan McMahan, and Daniel Ramage. Federated Optimization:Distributed ´ Optimization Beyond the Datacenter. arXiv:1511.03575 [cs, math], November 2015. URL http://arxiv.org/abs/1511.03575.
|
| 248 |
+
|
| 249 |
+
E.Y. Lam and J.W. Goodman. A mathematical analysis of the DCT coefficient distributions for images. IEEE Transactions on Image Processing, 9(10):1661–1666, October 2000. ISSN 10577149. doi: 10.1109/83.869177.
|
| 250 |
+
|
| 251 |
+
Brendan McMahan and Daniel Ramage. Federated Learning: Collaborative Machine Learning without Centralized Training Data, April 2017. URL http://ai.googleblog.com/2017/ 04/federated-learning-collaborative.html.
|
| 252 |
+
|
| 253 |
+
H. Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera ¨ y Arcas. Communication-Efficient Learning of Deep Networks from Decentralized Data. arXiv:1602.05629 [cs], February 2017. URL http://arxiv.org/abs/1602.05629.
|
| 254 |
+
|
| 255 |
+
Luca Melis, Congzheng Song, Emiliano De Cristofaro, and Vitaly Shmatikov. Exploiting Unintended Feature Leakage in Collaborative Learning. arXiv:1805.04049 [cs], November 2018. URL http://arxiv.org/abs/1805.04049.
|
| 256 |
+
|
| 257 |
+
Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer Sentinel Mixture Models. November 2016. URL https://openreview.net/forum?id $=$ Byj72udxe.
|
| 258 |
+
|
| 259 |
+
Xudong Pan, Mi Zhang, Yifan Yan, Jiaming Zhu, and Min Yang. Theory-Oriented Deep Leakage from Gradients via Linear Equation Solver. arXiv:2010.13356 [cs, stat], October 2020. URL http://arxiv.org/abs/2010.13356.
|
| 260 |
+
|
| 261 |
+
Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in PyTorch. In NIPS 2017 Autodiff Workshop, Long Beach, CA, 2017. URL https: //openreview.net/forum?id $=$ BJJsrmfCZ.
|
| 262 |
+
|
| 263 |
+
Le Trieu Phong, Yoshinori Aono, Takuya Hayashi, Lihua Wang, and Shiho Moriai. PrivacyPreserving Deep Learning via Additively Homomorphic Encryption. Technical Report 715, 2017a. URL http://eprint.iacr.org/2017/715.
|
| 264 |
+
|
| 265 |
+
Le Trieu Phong, Yoshinori Aono, Takuya Hayashi, Lihua Wang, and Shiho Moriai. PrivacyPreserving Deep Learning: Revisited and Enhanced. In Applications and Techniques in Information Security, Communications in Computer and Information Science, pp. 100–110, Singapore, 2017b. Springer. ISBN 978-981-10-5421-1. doi: 10.1007/978-981-10-5421-1 9.
|
| 266 |
+
|
| 267 |
+
Jia Qian and Lars Kai Hansen. What can we learn from gradients? September 2020. URL https: //openreview.net/forum?id $=$ gQn5xeVtz0I.
|
| 268 |
+
|
| 269 |
+
Jia Qian, Hiba Nassar, and Lars Kai Hansen. Minimal conditions analysis of gradient-based reconstruction in Federated Learning. arXiv:2010.15718 [cs, eess], March 2021. URL http: //arxiv.org/abs/2010.15718.
|
| 270 |
+
|
| 271 |
+
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language Models are Unsupervised Multitask Learners. pp. 24, 2019.
|
| 272 |
+
|
| 273 |
+
Daniel L. Ruderman. The statistics of natural images. 5(4):517–548, January 1994. ISSN 0954- 898X. doi: 10.1088/0954-898X/5/4/006.
|
| 274 |
+
|
| 275 |
+
Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision, 115(3):211–252, December 2015. ISSN 1573-1405. doi: 10.1007/s11263-015-0816-y.
|
| 276 |
+
|
| 277 |
+
Reza Shokri and Vitaly Shmatikov. Privacy-Preserving Deep Learning. In Proceedings of the 22nd ACM SIGSAC Conference on Computer and Communications Security - CCS ’15, pp. 1310–1321, Denver, Colorado, USA, 2015. ACM Press. ISBN 978-1-4503-3832-5. doi: 10.1145/2810103. 2813687.
|
| 278 |
+
|
| 279 |
+
Gowthami Somepalli, Micah Goldblum, Avi Schwarzschild, C Bayan Bruss, and Tom Goldstein. Saint: Improved neural networks for tabular data via row attention and contrastive pre-training. arXiv preprint arXiv:2106.01342, 2021.
|
| 280 |
+
|
| 281 |
+
Jingwei Sun, Ang Li, Binghui Wang, Huanrui Yang, Hai Li, and Yiran Chen. Soteria: Provable Defense Against Privacy Leakage in Federated Learning From Representation Perspective. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9311–9319, 2021. URL https://openaccess.thecvf.com/content/CVPR2021/ html/Sun_Soteria_Provable_Defense_Against_Privacy_Leakage_in_ Federated_Learning_From_CVPR_2021_paper.html.
|
| 282 |
+
|
| 283 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention Is All You Need. arXiv:1706.03762 [cs], December 2017. URL http://arxiv.org/abs/1706.03762.
|
| 284 |
+
|
| 285 |
+
Michael Veale, Reuben Binns, and Lilian Edwards. Algorithms that remember: Model inversion attacks and data protection law. Philosophical Transactions of the Royal Society A: Mathematical, Physical and Engineering Sciences, 376(2133):20180083, November 2018. doi: 10.1098/rsta. 2018.0083.
|
| 286 |
+
|
| 287 |
+
Aidmar Wainakh, Fabrizio Ventola, Till Mußig, Jens Keim, Carlos Garcia Cordero, Ephraim Zim-¨ mer, Tim Grube, Kristian Kersting, and Max Muhlh ¨ auser. User Label Leakage from Gradients ¨ in Federated Learning. arXiv:2105.09369 [cs], June 2021. URL http://arxiv.org/abs/ 2105.09369.
|
| 288 |
+
|
| 289 |
+
Jianyu Wang, Zachary Charles, Zheng Xu, Gauri Joshi, H. Brendan McMahan, Blaise Aguera y Arcas, Maruan Al-Shedivat, Galen Andrew, Salman Avestimehr, Katharine Daly, Deepesh Data, Suhas Diggavi, Hubert Eichner, Advait Gadhikar, Zachary Garrett, Antonious M. Girgis, Filip Hanzely, Andrew Hard, Chaoyang He, Samuel Horvath, Zhouyuan Huo, Alex Ingerman, Martin Jaggi, Tara Javidi, Peter Kairouz, Satyen Kale, Sai Praneeth Karimireddy, Jakub Konecny, Sanmi Koyejo, Tian Li, Luyang Liu, Mehryar Mohri, Hang Qi, Sashank J. Reddi, Peter Richtarik, Karan Singhal, Virginia Smith, Mahdi Soltanolkotabi, Weikang Song, Ananda Theertha Suresh, Sebastian U. Stich, Ameet Talwalkar, Hongyi Wang, Blake Woodworth, Shanshan Wu, Felix X. Yu, Honglin Yuan, Manzil Zaheer, Mi Zhang, Tong Zhang, Chunxiang Zheng, Chen Zhu, and Wennan Zhu. A Field Guide to Federated Optimization. arXiv:2107.06917 [cs], July 2021. URL http://arxiv.org/abs/2107.06917.
|
| 290 |
+
|
| 291 |
+
Zhibo Wang, Mengkai Song, Zhifei Zhang, Yang Song, Qian Wang, and Hairong Qi. Beyond Inferring Class Representatives: User-Level Privacy Leakage From Federated Learning. arXiv:1812.00535 [cs], December 2018. URL http://arxiv.org/abs/1812.00535.
|
| 292 |
+
|
| 293 |
+
Hongxu Yin, Arun Mallya, Arash Vahdat, Jose M. Alvarez, Jan Kautz, and Pavlo Molchanov. See Through Gradients: Image Batch Recovery via GradInversion. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16337–16346, 2021. URL https://openaccess.thecvf.com/content/CVPR2021/html/Yin_See_ Through_Gradients_Image_Batch_Recovery_via_GradInversion_CVPR_ 2021_paper.html.
|
| 294 |
+
|
| 295 |
+
Sergey Zagoruyko and Nikos Komodakis. Wide Residual Networks. arXiv:1605.07146 [cs], May 2016. URL http://arxiv.org/abs/1605.07146.
|
| 296 |
+
|
| 297 |
+
Richard Zhang, Phillip Isola, Alexei A. Efros, Eli Shechtman, and Oliver Wang. The Unreasonable Effectiveness of Deep Features as a Perceptual Metric. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 586– 595, 2018. URL https://openaccess.thecvf.com/content_cvpr_2018/html/ Zhang_The_Unreasonable_Effectiveness_CVPR_2018_paper.html.
|
| 298 |
+
|
| 299 |
+
Bo Zhao, Konda Reddy Mopuri, and Hakan Bilen. iDLG: Improved Deep Leakage from Gradients. arXiv:2001.02610 [cs, stat], January 2020. URL http://arxiv.org/abs/2001.02610.
|
| 300 |
+
|
| 301 |
+
Junyi Zhu and Matthew Blaschko. R-GAP: Recursive Gradient Attack on Privacy. arXiv:2010.07733 [cs], March 2021. URL http://arxiv.org/abs/2010.07733.
|
| 302 |
+
|
| 303 |
+
Ligeng Zhu, Zhijian Liu, and Song Han. Deep Leakage from Gradients. In Advances in Neural Information Processing Systems 32, pp. 14774–14784. Curran Associates, Inc., 2019. URL http: //papers.nips.cc/paper/9617-deep-leakage-from-gradients.pdf.
|
| 304 |
+
|
| 305 |
+
# A APPENDIX
|
| 306 |
+
|
| 307 |
+
# A.1 PROOF OF PROPOSITION 1
|
| 308 |
+
|
| 309 |
+
Proposition. If the server knows the CDF (assumed to be continuous) of some quantity associated with user data that can be measured with a linear function $h : \mathbb { R } ^ { m } \mathbb { R }$ , then for a batch size of $n$ , and a number of imprint bins $k > n > 2$ , by using an appropriate combination of linear layer and ReLU activation, the server can expect to recover
|
| 310 |
+
|
| 311 |
+
$$
|
| 312 |
+
\frac { 1 } { \binom { k + n - 1 } { k - 1 } } [ \sum _ { i = 1 } ^ { n - 2 } i \cdot \binom { k } { i } \cdot \binom { \lfloor \frac { n - i } { 2 } \rfloor } { j = 1 } \binom { k - i } { j } \binom { n - i - j - 1 } { j - 1 } ) ] + r ( n , k )
|
| 313 |
+
$$
|
| 314 |
+
|
| 315 |
+
amount of user data (where the data is in $\mathbb { R } ^ { m }$ ) perfectly. Note: $r ( n , k )$ is a correction term (see proof for expression).
|
| 316 |
+
|
| 317 |
+
Proof. By construction of the imprint module, given a random sample (batch) $X _ { 1 } , \ldots , X _ { n }$ (iid) the server perfectly recovers data whenever an imprint bin has exactly 1 element of the batch. Because we know the CDFs, we can create partitions of equal mass corresponding to imprint bins $\{ b _ { j } \} =$ $\{ [ a _ { j } , b _ { j } ] \}$ where $P ( X _ { i } \in [ a _ { j } , b _ { j } ] ) = 1 / k \forall i , j$ .
|
| 318 |
+
|
| 319 |
+
We can then phrase the problem of expected number of perfectly recovered samples as a modified “stars and bars” problem. For a given batch of data, to calculate the amount of data recovered, we first calculate:
|
| 320 |
+
|
| 321 |
+
$$
|
| 322 |
+
\sum _ { i = 1 } ^ { n } i \cdot { \binom { k } { i } } \cdot N _ { i }
|
| 323 |
+
$$
|
| 324 |
+
|
| 325 |
+
Where $\textstyle { \binom { k } { i } }$ is the number of ways to select the $i$ bins that have exactly 1 element, and $N _ { i }$ is the number of orientations of the remaining data into the remaining bins so that no bin has exactly 1 element. Note that we can do this because the bins all have equal mass, and thus we can factor out the (uniform) probability of any configuration from the sum.
|
| 326 |
+
|
| 327 |
+
Simply put, we first take the configuration where there is only 1 bin with exactly 1 element, and weight it by 1, then we take the number of configurations with 2 bins with exactly 1 element, and weight it by 2, and so on.
|
| 328 |
+
|
| 329 |
+
In order to calculate $N _ { i }$ , we notice that in our construction, once the $i$ bins with exactly 1 element are chosen, every other bin has either 0 or $\geq 2$ elements. We focus on the bins that have $\geq 2$ elements. By a simple “reverse” pigeon hole argument, we can now have at most $\lfloor { \frac { n - i } { 2 } } \rfloor$ of the remaining bins containing any elements, as otherwise, one bin would be guaranteed to contain exactly 1 element.
|
| 330 |
+
|
| 331 |
+
So we further select any $1 \leq j \leq \lfloor { \frac { n - i } { 2 } } \rfloor$ number of the remaining $k - i$ bins all to contain at least 2 elements. Formally, this is equivalent to calculating the number of orientations of integers $\{ x _ { l } \} _ { l = 1 } ^ { j }$ so that
|
| 332 |
+
|
| 333 |
+
$$
|
| 334 |
+
x _ { 1 } + \cdot \cdot \cdot + x _ { j } = n - i
|
| 335 |
+
$$
|
| 336 |
+
|
| 337 |
+
constrained with $x _ { l } \geq 2 \forall l$
|
| 338 |
+
|
| 339 |
+
Now, we make a change of variables to instead calculate the number of orientations of integers
|
| 340 |
+
|
| 341 |
+
$$
|
| 342 |
+
\{ p _ { l } \} _ { l = 1 } ^ { j }
|
| 343 |
+
$$
|
| 344 |
+
|
| 345 |
+
so that
|
| 346 |
+
|
| 347 |
+
$$
|
| 348 |
+
p _ { 1 } + \cdot \cdot \cdot + p _ { j } = n - i - 2 j
|
| 349 |
+
$$
|
| 350 |
+
|
| 351 |
+
constrained with $p _ { l } \geq 0 \forall l$ . Now we just have a “stars and bars” problem with $k ^ { \prime } = j$ bars and $n ^ { \prime } = n - i - 2 j$ stars. This reduces to:
|
| 352 |
+
|
| 353 |
+
$$
|
| 354 |
+
\binom { n - i - j - 1 } { j - 1 }
|
| 355 |
+
$$
|
| 356 |
+
|
| 357 |
+
orientations for the remaining bins with exactly $j$ elements. Once these $i$ bins with 1 element, and $j$ bins with $\geq 2$ elements are chosen, all the other bins are required to have 0 elements.
|
| 358 |
+
|
| 359 |
+
Table 1: Ablation study linear functions and distributions.
|
| 360 |
+
|
| 361 |
+
<table><tr><td>Linear Function</td><td>Assumed Distribution</td><td>MSE</td><td>PSNR</td><td>IIP-Pixel</td></tr><tr><td>Mean</td><td>Normal</td><td>0.0183</td><td>75.75</td><td>65.62%</td></tr><tr><td>Mean</td><td>Laplacian</td><td>0.0174</td><td>79.63</td><td>71.88%</td></tr><tr><td>Cosine</td><td>Laplacian</td><td>0.0167</td><td>99.82</td><td>79.69%</td></tr><tr><td>Random</td><td>Normal</td><td>0.0203</td><td>91.29</td><td>75.00%</td></tr></table>
|
| 362 |
+
|
| 363 |
+
So adding these parts together, we have the expected amount data the server can expect to reconstruct perfectly becomes:
|
| 364 |
+
|
| 365 |
+
$$
|
| 366 |
+
\frac { 1 } { \binom { k + n - 1 } { k - 1 } } \left[ \sum _ { i = 1 } ^ { n - 2 } i \cdot \binom { k } { i } \cdot \left( \sum _ { j = 1 } ^ { \lfloor \frac { n - i } { 2 } \rfloor } \binom { k - i } { j } \binom { n - i - j - 1 } { j - 1 } \right) \right] + \overbrace { \frac { \binom { n } { k + n - 1 } } { \binom { k + n - 1 } { k - 1 } } \binom { k } { n } - \frac { n } { k } } ^ { r ( n , k ) }
|
| 367 |
+
$$
|
| 368 |
+
|
| 369 |
+
We call the last two “residual” terms $r ( n , k )$ . The first of these terms corresponds to the term in the expectation where all elements of the batch end up in separate bins, and the second term is the expected number of elements that land in the tail of the CDF not covered in any bin. □
|
| 370 |
+
|
| 371 |
+
# A.2 OTHER CHOICES OF LINEAR FUNCTIONS AND DISTRIBUTIONS
|
| 372 |
+
|
| 373 |
+
In previous experiments we have restrthat measures average brightness, i.e. ns to the linear function which we approximate t $h : \mathbb { R } ^ { m } \mathbb { R }$ $\begin{array} { r } { h ( x ) = \frac { 1 } { m } \sum _ { i = 1 } ^ { m ^ { - } } x _ { i } } \end{array}$ distributed. Given that ImageNet (and this also applies to most image datasets) is pre-processed by normalization by color in each channel, and that the number of pixels is large and they are not perfectly correlated, this is a reasonable approximation based on the central limit theorem that could similarly apply to other data modalities as well. For analysis, we visualize the closeness of this approximation based on an evaluation over the full ImageNet validation set in Fig. 6.
|
| 374 |
+
|
| 375 |
+
We verify that the actual ground truth distribution can be approximated by a normal distribution, but we also see that the approximation is imperfect. The attack works well in Fig. 2 even with this discrepancy, however it could be further improved if the attacker has more accurate about the CDF. Image brightness is better described by a Laplacian distribution Ruderman (1994); Huang & Mumford (1999). Replacing the normal distribution by a Laplacian distribution with scale $1 / \sqrt { 2 }$ does improve the accuracy slightly. This distribution can be further stabilized by considering higher frequencies compared to the mean, e.g. via DCT coefficients Lam & Goodman (2000); Huang & Mumford (1999). We accordingly also visualize this distribution for e.g. the 32nd DCT coefficient in Fig. 6 and use this cosine wave for the imprint module (with scaling factor $\textstyle { \frac { 4 } { m } } f$ . This leads to the strongest attack against image data, but of course utilizes attacker knowledge that the users train on natural images.
|
| 376 |
+
|
| 377 |
+
On the flip side, the estimation can also be improved by replacing the linear function $h$ with a Gaussian random vector of independent draws from $\begin{array} { r } { \mathcal { N } ( 0 , \frac { 1 } { \sqrt { m } } ) } \end{array}$ . The resulting distribution (4th figure in Fig. 6) approximates a normal distribution much better. While not as optimal as the Laplacian distribution for higher frequencies, this variant is applicable for other data modalities if the data has bounded variance. Visualizations of the reconstruction with other linear functions can be found in Fig. 7.
|
| 378 |
+
|
| 379 |
+
Finally, even with a small amount of data, the server could estimate the density of the quantity of interest. Visually, we plot the the estimated density as for several amounts of ImageNet data used to estimate the brightness distribution. We find that even with $0 . 1 \%$ of the data used, the server could obtain a close approximation to the distribution of interest (see Fig. 5).
|
| 380 |
+
|
| 381 |
+
# A.3 COMPARISON TO HONEST SERVERS AND OPTIMIZATION-BASED ATTACKS
|
| 382 |
+
|
| 383 |
+
We argue that the proposed attack operating in our threat model is significantly more threatening than existing optimization-based attacks in the honest-but-curious server model. To illustrate this point and show by example that the change is threat model which amounts to only a minor architectural change in the neural network leads to a massive difference in reconstruction, we run the attack of Geiping et al. (2020) in the scenario of Fig. 2. The results can be found in Fig. 8. The attack leads to an IIP score of $6 . 2 5 \%$ when measuring in pixel space, $6 . 2 5 \%$ when measuring in LPIPS (Zhang et al., 2018) and, and $2 0 . 3 1 \%$ when measuring the cosine distances in feature space of this model (the metric of Yin et al. (2021)).
|
| 384 |
+
|
| 385 |
+

|
| 386 |
+
Figure 5: Density of image brightness estimated from access to different amounts of data from the ImageNet dataset.
|
| 387 |
+
|
| 388 |
+

|
| 389 |
+
Figure 6: Distributions on the ImageNet validation set for several linear query functions. From left to right: Mean compared to normal distribution, mean compared to Laplacian distribution, 32nd DCT coeffcient compared to Laplacian distribution, random normal vector compared to normal distribution. In each plot the approximate distribution used by the attacker is visualized in blue/black and the ground-truth (GT) distribution in green/red.
|
| 390 |
+
|
| 391 |
+
As an additional ablation, we also investigate whether the optimization-based attacks can find the optimal solution in the malicious server threat model that we consider. However, the right side of Fig. 8 shows that at least conventional optimization-based methods have trouble finding the vulnerability introduced by the imprint module. The vulnerability that the attack solves analytically might be hard to exploit by first-order optimization or require specifically tuned optimization schemes to succeed. This also shows that defenses that attempt to detect privacy breaches by evaluating a range of optimization-based attacks would not have triggered an alarm for this attack.
|
| 392 |
+
|
| 393 |
+
# A.4 OTHER DATA MODALITIES - TEXT
|
| 394 |
+
|
| 395 |
+
As discussed in the main body, the attack is entirely data-agnostic and could be launched against any kind of input data, e.g. not only image data but also tabular features or text. In principle the input data could be comprised of random signals - these can still be binned and separated by the proposed attack. We verify this property by launching the same attack against text data.
|
| 396 |
+
|
| 397 |
+
We investigate the transformer architecture discussed in Wang et al. (2021) specifically for language tasks in federated learning scenarios and insert the imprint module as malicious block right after the word embeddings. This is strictly a maliciously modified architecture - normal feedforward blocks in a transformer would not span across the entire length of the sequence. We initialize the linear function as a Gaussian random vector and make no modifications to the attack hyperparameters. We recover the input tokens ids from a direct lookup of their closest match in the word embedding layer (Zhu et al., 2019). To evaluate the success of the attack we generate sample batches of sentences from the wikitext dataset (Merity et al., 2016) with a batch size of 128 and a sequence length of 32, tokenized via the GPT-2 tokenizer (Radford et al., 2019). Instantiating the attack with 512 bins immediately reveals 110 out of 128 sentences perfectly, leading to an overall reconstruction accuracy of $8 6 . 3 3 \%$ which is also a BLEU score of $8 8 \%$ and ROUGE-L of $8 7 \%$ . We refer to our open source implementation for further details.
|
| 398 |
+
|
| 399 |
+

|
| 400 |
+
Figure 7: Analytic reconstruction for an imprint model with 128 bins in front of a ResNet-18. Left: The linear function is the 32nd DCT coefficient and bins are based on a Laplacian distribution. Right: Linear function is a Gaussian random vector and bins are based on a normal distribution. Gray reconstructions denote bins in which no data point falls.)
|
| 401 |
+
|
| 402 |
+

|
| 403 |
+
Figure 8: Optimization-based attack of Geiping et al. (2020) for a ResNet-18 and a batch size of 64, the setting of Fig. 2. Left: An honest server model. Right: Gradient inversion attack applied to a module that contains the imprint module.
|
| 404 |
+
|
| 405 |
+
We show examples of recovered data below, but note that printing the recovered text is not that insightful. The attack perfectly recovers a subset of sentences of user text and cannot recover some other sentences entirely, in full analogy to the results for images in e.g. Fig. 7:
|
| 406 |
+
|
| 407 |
+
# Recovered wikitext data:
|
| 408 |
+
|
| 409 |
+
The Tower Building of the Little Rock Arsenal, also known as U.S. Arsenal Building, is a building located in MacArthur Park in downtown Little Rock, Arkansas . Built in 1840, it was part of Little Rock’s first military installation. Since its decommissioning, The Tower Building has housed two museums. It was home to the Arkansas Museum of Natural History and Antiquities from 1942 to 1997 and the MacArthur Museum of Arkansas Military History since 2001. It has also been the headquarters of the Little Rock Æsthetic Club since 1894. The building receives its name from its distinct octagonal tower. Besides being the last
|
| 410 |
+
|
| 411 |
+
# A.5 TECHNICAL DETAILS
|
| 412 |
+
|
| 413 |
+
All experiments were implemented in PyTorch (Paszke et al., 2017) and were run on several laptop and machine CPUs, as the reconstruction itself requires only a few tensor operations. Especially, compared to optimization-based reconstruction techniques, this makes the approach significantly faster and significantly more portable. For visualization purposes and to measure accurate PSNR and IIP scores all images (which are recovered in the order given by the chosen function $h$ ) are matched with possible correspondences in the ground truth batch. The matching is found based on LPIPS feature similarities scores (Zhang et al., 2018) which are matched using a linear sum assignment solver. No labels are recovered using the proposed approach which is entirely labelagnostic, but labels could be assigned a-posteriori using model predictions of the reconstructed data if required. For experiments where the imprint module is placed deeper into a network, the network (which is here a ResNet) is linearized by resetting batch normalization parameters and buffers to the identity map, setting all residual paths to zero and initializing the first convolution and the shortcut convolutions to identity maps. The nonlinearities can be bypassed by bias shifting as in Goldblum et al. (2020).
|
| 414 |
+
|
| 415 |
+
PSNR scores are computed as average PSNR where we first compute PSNR scores per image and then average. This procedure is standard in computer vision, but does bias the score toward successful reconstructions, as the minimal PSNR score is bounded at 0, but its potential upside unbounded. For the image identifiability precision (IIP) score of Yin et al. (2021) we implement the score as proposed therein, but measure nearest neighbors not in the model feature space (which we consider biased, given that the model parameters are already used for reconstruction), but directly in image pixel space, where we check whether the given reconstruction is indeed closer to its true counterpart in euclidean distance than any other image from this class in the validation set.
|
| 416 |
+
|
| 417 |
+
# A.6 ADDITIONAL IMAGES
|
| 418 |
+
|
| 419 |
+
This section contains additional image examples, such as using CIFAR-10 in Fig. 12 and Fig. 13 where an attack with the imprint module on this dataset shows that almost all of the user data is perfectly recovered. Furthermore, example panels of imprint modules inserted in later ResNet layers are visualized as well as the results of the sparse variant that is used to attack a federated averaging scheme.
|
| 420 |
+
|
| 421 |
+
# A.7 DEFENSE DISCUSSION
|
| 422 |
+
|
| 423 |
+
An algorithmic defense against the proposed attack would be to validate the incoming model parameters on the user side. There, the attack with multiple bins requires repeated computations of the same quantity. At first, this pattern could be detected by rank analysis of all linear layers (which would return a rank of 1 for the linear layer of the imprint module described above). Yet, the attacker can easily randomize a few entries of the linear layer to increase its rank without significantly weakening the attack, or introduce additional rows that compute normal deep features, so that we do not believe a defender can win by model analysis under the given threat model.
|
| 424 |
+
|
| 425 |
+

|
| 426 |
+
Figure 9: Expected number of data points recovered for several batch sizes and increased bins and corresponding parameter increase. Model: ResNet50 with ImageNet, targeting the input to the 3rd residual block.
|
| 427 |
+
|
| 428 |
+

|
| 429 |
+
Figure 10: Left: Raw data for the 64 ImageNet images with separate classes. Right: Raw data for the 64 images from the white shark class.
|
| 430 |
+
|
| 431 |
+
# A.8 COMPARISON TO CONCURRENT WORK
|
| 432 |
+
|
| 433 |
+
We include a comparison to the concurrent attack of Boenisch et al. (2021) operating in the same threat model in Fig. 21. The threat model is characterized purely as a parameter modification therein that only applies to models with input-sized linear layers followed by ReLU activations. In the same vein the attack discussed in this work does not require malicious architecture modifications if these vulnerable layers are already present.
|
| 434 |
+
|
| 435 |
+
# B REMARK ON RECOVERY
|
| 436 |
+
|
| 437 |
+
$W$ te that for the recovery in Eq. (2), we place either an averaging operation, or linewith identical row elements. This is because in Eq. (2), the attacker needs $\begin{array} { r } { \frac { \partial \mathcal { L } } { \partial b _ { i } } \dot { } = \frac { \partial \mathcal { L } } { \partial b _ { i + 1 } } } \end{array}$ ing. A sufficient condition for this is that the operation proceeding the imprint module, such as averaging,
|
| 438 |
+
|
| 439 |
+

|
| 440 |
+
Figure 11: Left: Analytic reconstruction for a linear model of 64 ImageNet images with separate classes (PSNR: 36.45 versus true user data). Right: Same recovery algorithm but for 64 images from the same class (white shark), (PSNR: 13.84 versus true user data.)
|
| 441 |
+
|
| 442 |
+

|
| 443 |
+
Figure 12: Left (a): A batch of 64 CIFAR10 images. Right (b): The same batch of images reconstructed naively using Eq. (2).
|
| 444 |
+
|
| 445 |
+
can be expressed as a matrix operation with identical row elements. This falls squarely within our assumed threat model and is empirically how we implement our attack.
|
| 446 |
+
|
| 447 |
+
# C CODE RELEASE
|
| 448 |
+
|
| 449 |
+
We provide open-source implementations of all attacks investigated in this work. The repository at https://github.com/lhfowl/robbing_the_fed shows a minimalistic implementation of the principles of this attack and the repository at https://github.com/JonasGeiping/ breaching embeds the attack in a larger framework of privacy attacks against federated learning.
|
| 450 |
+
|
| 451 |
+

|
| 452 |
+
Figure 13: Left (a): A batch of 64 CIFAR10 images. Right (b): The same batch of images reconstructed using the imprint module with 300 bins. Gray images can result from collisions within a given bin.
|
| 453 |
+
|
| 454 |
+

|
| 455 |
+
Figure 14: Different placements of the imprint module in a ResNet-18. From left to right: Before the first block $\left( 5 6 x 5 6 \right)$ , before the third block $( 2 8 x 2 8 )$ , before the fourth block $( 1 4 x 1 4 )$ and before the last average pooling $( 7 x 7 )$ . Compare to a placement before the first convolution $( 2 2 4 x 2 2 4 )$ and raw input data in Fig. 2. Enlarged versions of each panel can be seen in Figs. 15 - 18
|
| 456 |
+
|
| 457 |
+

|
| 458 |
+
Figure 15: Different placements of the imprint module in a ResNet-18. Before the first block $( 5 6 \times$ 56). Only the first three channels at this position are utilized in this demonstration.
|
| 459 |
+
|
| 460 |
+

|
| 461 |
+
Figure 16: Different placements of the imprint module in a ResNet-18. Before the third block $( 2 8 \times 2 8 )$ . Only the first three channels at this position are utilized in this demonstration.
|
| 462 |
+
|
| 463 |
+

|
| 464 |
+
Figure 17: Different placements of the imprint module in a ResNet-18. Before the fourth block $( 1 4 \times 1 4 )$
|
| 465 |
+
|
| 466 |
+

|
| 467 |
+
Figure 18: Different placements of the imprint module in a ResNet-18. Before the last averagepooling layer $( 7 \times 7 )$ . Only the first three channels at this position are utilized in this demonstration.
|
| 468 |
+
|
| 469 |
+

|
| 470 |
+
Figure 19: Results for federated averaging for 8 steps with 8 images each, i.e. 64 unique data points for a single user, and 128 bins. PSNR: 32.65. IIP: $7 0 . 3 1 \%$ . Drift of bins during local updates leads to a few duplicated entries.
|
| 471 |
+
|
| 472 |
+

|
| 473 |
+
Figure 20: Left: IIP score vs Laplacian gradient noise. Right: Exemplary recovery for $\sigma = 0 . 0 1$ . Recovery is stable for a large range of Laplacian gradient noise injections.
|
| 474 |
+
|
| 475 |
+

|
| 476 |
+
Figure 21: Comparison to the ”Curious Abandon Honesty” (CAH) attack proposed in Boenisch et al. (2021). We find our attack outperforms their attack at every scale.
|
parse/dev/fwzUgo0FM9v/fwzUgo0FM9v_content_list.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/dev/fwzUgo0FM9v/fwzUgo0FM9v_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/dev/gERv_uy69IA/gERv_uy69IA.md
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# K-LITE: Learning Transferable Visual Models with External Knowledge
|
| 2 |
+
|
| 3 |
+
Sheng Shen⇤\, Chunyuan $\mathbf { L i } ^ { * \dagger } \triangleq$ , Xiaowei $\mathbf { H } \mathbf { u } ^ { * \dagger }$ , Jianwei Yang†, Yujia Xie†, Pengchuan Zhang†, Zhe $\mathbf { G a n } ^ { \dagger }$ , Lijuan Wang†, Lu Yuan†
|
| 4 |
+
Ce Liu†, Kurt Keutzer\, Trevor Darrell\, Anna Rohrbach\, Jianfeng Gao† †Microsoft \University of California, Berkeley
|
| 5 |
+
|
| 6 |
+
# Abstract
|
| 7 |
+
|
| 8 |
+
The new generation of state-of-the-art computer vision systems are trained from natural language supervision, ranging from simple object category names to descriptive captions. This form of supervision ensures high generality and usability of the learned visual models, due to the broad concept coverage achieved via largescale data collection process. Alternatively, we argue that learning with external knowledge is a promising way which leverages a much more structured source of supervision and offers sample efficiency. We propose K-LITE1, a simple strategy to leverage external knowledge for building transferable visual systems: In training, it enriches entities in text with WordNet and Wiktionary knowledge, leading to an efficient and scalable approach to learning image representations that uses knowledge about the visual concepts. In evaluation, the text is also augmented with external knowledge and then used to reference learned visual concepts (or describe new ones) to enable zero-shot and few-shot transfer of the pre-trained models. We study the performance of K-LITE on two important computer vision problems, image classification and object detection, benchmarking on 20 and 13 different existing datasets, respectively. The proposed knowledge-augmented models show significant improvement in transfer learning performance over existing methods. 2
|
| 9 |
+
|
| 10 |
+
# 1 Introduction
|
| 11 |
+
|
| 12 |
+
One of the core aspirations in computer vision (CV) is to develop systems that endow computers with the ability to effectively learn general visual representations, which can be transferred to a variety of downstream recognition datasets with arbitrary visual concepts in the wild. Though excellent performance has been achieved on standard benchmarks, the traditional supervised approaches are limited to learning a fixed set of concepts, e.g., 22K concepts on ImageNet $\mathbb { \ m }$ or 18K concepts on JFT-300M $\lVert \overline { { 8 2 } } \rVert$ . This leads to a few issues: $( i )$ Annotating each individual vision dataset is not only labor intensive, but also results in a narrow set of visual concepts; $( i i )$ Visual models trained on such datasets are good at one task (with the given concept set) and this task only, and show poor transfer learning performance to customized datasets that usually come with a different set of concepts $\pmb { \left. 2 7 \right. }$ .
|
| 13 |
+
|
| 14 |
+
To tackle this problem, recent large-scale language-augmented visual models, such as CLIP [71], ALIGN $\left[ \left[ 3 6 \right] \right]$ and Florence [101], are trained on a wide variety of images with natural language supervision that is abundantly available on the Internet. These models demonstrate strong zero-shot transfer capabilities, since they acquire open-set recognition abilities through problem reformulation from classification to retrieval. Moreover, model generalization is improved as natural language supervision typically contains rich semantics. While these models usually perform well on recognizing common objects, they still struggle on visual concepts that are absent or rare in the pre-training stage. To ensure good transfer performance, it is required to train such models on huge datasets with sufficient concept coverage(e.g., ${ \bf \Gamma } > 4 0 0 \bf { M }$ image-text pairs), which is both labor and compute expensive.
|
| 15 |
+
|
| 16 |
+
Instead of scaling the number of image-text pairs to increase concept coverage, we propose to leverage structured external knowledge to augment language supervision. The inspiration comes from how humans generalize to novel concepts: instead of trying to memorize all concepts, humans leverage the structured knowledge such as definitions and concept hierarchy. For example, when we visit a Japanese restaurant for the first time, we may struggle to understand the menu by only looking at the dish names (e.g., Takoyaki, Sashimi), as it is hard to imagine what they are. However, it becomes much clearer once a waiter introduces these concepts (Figure $\bigstar \bigstar \bigstar \bigstar$ , leading to success in ordering food (i.e., matching content to a name). Similar intuitions have been exploited in computer vision for class-level transfer $\pm \mathbb { E } \mathbb { L } 2 \mathbb { I }$ , but not yet for task-level transfer settings (similar to that of CLIP).
|
| 17 |
+
|
| 18 |
+
To this end, we explore a systematic approach to acquire and learn with external knowledge sources from databases such as WordNet $\pmb { \| } \overline { { 6 3 } } \dot { \| }$ and Wiktionary $\pmb { \Vert 6 2 \Vert }$ to train more transferable and sampleefficient visual models. The concept descriptions and concept hierarchies are purely textual, and the process of collecting external knowledge is fully automatic without extra human annotation. The acquired knowledge typically provides information that is shared between seen and unseen concepts to facilitate effective transfer. Specifically, rare concepts, e.g., Takoyaki, Sashimi in Figure $\mathbb { L } ,$ are explained with more common concepts. Such knowledge sources are generally available for a variety of domains and datasets, making it possible to build a generic approach for task-level transfer.
|
| 19 |
+
|
| 20 |
+

|
| 21 |
+
Figure 1: Motivating examples: knowledge explains the content of the rare dish concepts.
|
| 22 |
+
|
| 23 |
+
Our main findings and contributions can be summarized as follows:
|
| 24 |
+
|
| 25 |
+
• We present the first strong evidence that external knowledge can benefit large-scale task-level transfer for two core CV problems, image classification (IC) and object detection (OD), by exploring external knowledge sources, including WordNet and Wiktionary.
|
| 26 |
+
|
| 27 |
+
• A simple and effective strategy K-LITE (Knowledge-augmented Language Image Training and Evaluation) is proposed: The acquired knowledge is appended to the original textual concepts as model input during pre-training and evaluation. It can be viewed as an automatic knowledge-aware language prompting, which makes it easier for the model to access relevant information shared between the training and evaluation data. A modularized approach is also developed to enable efficient adaptation from vanilla visual models to their knowledge-augmented versions.
|
| 28 |
+
|
| 29 |
+
• To demonstrate the generality of the K-LITE, we instantiate it with two recent visual models and develop our knowledge-augmented counterparts: UniCL [95] for IC and GLIP $\pmb { \Vert 5 0 }$ for OD. Extensive experiments in zero-shot and few-shot learning settings demonstrate that knowledgeaugmented models can significantly improve over prior work. Notably, our model can achieve similar zero-shot performance to previous methods using only half of pre-training image-text pairs in some scenarios, demonstrating sample efficiency of the proposed approach.
|
| 30 |
+
|
| 31 |
+
# 2 Related Work
|
| 32 |
+
|
| 33 |
+
Zero-shot Visual Recognition: Zero-shot learning, i.e., classifying images where there is a lack of labeled training data, has been studied for decades $\left[ \left[ 2 1 \right] \right]$ , and its popularity has recently increased further $\mathbb { \underline { { \nabla 4 } } }$ . Based on the technique evolution, it can be broadly categorized into two generations: the traditional class-level zero-shot and recently popular task-level zero-shot setting.
|
| 34 |
+
|
| 35 |
+
Class-level Transfer. Class-level zero-shot learning aims to recognize object classes whose instances have not been observed during training. The goal for the zero-shot learning methods is to associate observed and non-observed classes through some form of auxiliary information, which can be either implicit such as pre-trained semantic embeddings [92, 78, 10], or explicit such as attributes [21, 43, $\textcircled { 3 5 } \textcircled { 1 }$ , text [18, 19, 72, 70], knowledge graphs [91, 74], or rules and ontologies $\mathbb { \left| \left[ 2 3 \right] \right| }$ . Please, refer to the recent survey on knowledge-aware zero-shot learning for a more detailed review [12]. Recently, it has been suggested to move away from the restricted nature of standard zero-shot evaluation and make the task more practical by including training classes at test time, i.e., generalized zero-shot learning setting $\underline { { \| 9 4 \| } }$ . Despite the progress in this area, the traditional setting is typically limited to studying zero-shot transfer across classes in a single domain with manually defined splits, such as Animal with Attributes (AwA) [44], Birds-200 [89], SUN attributes [67], and ZS-ImageNet [73, 26]. Concurrently, $[ | 8 5 | |$ explore leveraging external knowledge to improve long-tailed visual recognition within individual domains, which falls into the category of class-level transfer.
|
| 36 |
+
|
| 37 |
+
Task-level Transfer. Another line of work focuses on task-level zero-shot transfer [52, 46, 64, 71, 36, 97]. They pre-train visual models on hundreds of millions of web-crawled image-caption or image-tags pairs, and evaluate their transfer ability by directly performing inference in a wide range of downstream datasets, without tuning the model weights. We argue that the task-level transfer is more practical and attractive than class-level transfer, as it is more relevant to real-world scenarios, where we may want to develop models that can serve many visual recognition applications.
|
| 38 |
+
|
| 39 |
+
Our work bridges the gap between the two lines of works above: it borrows the spirit of exploring knowledge in class-level transfer, and generalizes it for task-level transfer, leveraging the best of both worlds. To summarize, our work is different in two major aspects: (i) Settings. We focus on the task-level transfer learning across domains, i.e., from large publicly available datasets to a diverse set of downstream datasets in different domains, and demonstrate that external knowledge benefits task-level transfer. (ii) Modeling. Existing class-level transfer works are built upon pre-trained visual features/backbones and shallow word embeddings or tf-idf scores, and only train the classifiers. One representative example is DeViSE [25], where a skip-gram word embedding model and an image classifier are fine-tuned jointly. In contrast, we are training large Transformer-based models in an end-to-end manner from scratch as in CLIP/ALIGN, providing the first empirical evidence that external knowledge can help train a general visual backbone.
|
| 40 |
+
|
| 41 |
+
Knowledge-Intensive Models: In natural language processing (NLP), with the increase of model capacity via pre-trained language models $\bar { \mathbb { E } \ b { \mathscr { A } } }$ , there emerges the need for more knowledgeable models $\begin{array} { r l } { \| \boldsymbol { \bar { 5 } } \boldsymbol { \bar { 5 } } \| } & { { } } \end{array}$ with advanced functionalities such as making use of encyclopedic [88, 4, 6] and commonsense knowledge [79, 102]. To address this, a large number of language models augmented with external knowledge sources have been proposed [68, 29, 45, 56, 100, 7], achieving strong performance on a variety of NLP tasks [69, 42]. Please refer to a recent survey $\pmb { \Vert } \pmb { \Vert } \pmb { \Vert }$ for a comprehensive review.
|
| 42 |
+
|
| 43 |
+
In vision-and-language $( \mathrm { V } { + } \mathrm { L } )$ domain, researchers have also started exploring knowledge-intensive tasks, e.g., OK-VQA $\pmb { \mathbb { E } } \pmb { \mathbb { 1 } }$ and WebQA [9]. They often require additional information sources (e.g., factual and commonsense knowledge) beyond the QA pairs, compared to the established tasks such as VQA [3, 34] and image captioning [54, 2]. Hence, existing pre-trained models [49, 83, 58, 51, 81, 103, 38, 48, 30, 99, $\textcircled { 7 7 }$ would perform poorly on these knowledge-intensive $_ { \mathrm { V + L } }$ tasks [9]. To address the problem, acquiring external knowledge becomes an essential component for success [93, 60, 96].
|
| 44 |
+
|
| 45 |
+
The success of knowledge in NLP and $_ { \mathrm { V + L } }$ tasks inspires us to ask a natural question: Can we learn a transferable visual backbone model with external knowledge? Thus, we dissect and borrow the vital elements such as knowledge sources $\mathbb { \lVert 6 3 \rVert 6 2 \rVert }$ and modeling techniques $\mathbb { P 9 0 , } \overline { { 1 0 0 } }$ , and carry out studies for core computer vision tasks.
|
| 46 |
+
|
| 47 |
+
# 3 Knowledge-Augmented Visual Models
|
| 48 |
+
|
| 49 |
+
Problem setup. Computer vision systems have achieved strong transfer performance, when learning with large-scale image-label data $\textcircled { 1 3 9 } \textcircled { 1 }$ and image-caption data $\dot { \mathbb { Z } } \dot { \mathbb { I } }$ . Recently, it has been demonstrated in $\pmb { \boxed { 9 5 } } \boxed { 1 0 1 }$ that the unification of image-label and image-text formats into image-text-label achieves superior performance over either of them. We follow the setting in $\mathbb { \lVert \underline { { 9 5 } } \rVert }$ , and define a unified triplet-wise data format $\boldsymbol { \mathcal { D } } = \{ ( \boldsymbol { x } _ { n } , t _ { n } , y _ { n } ) \} _ { n = 1 } ^ { N }$ , where $\mathbf { \boldsymbol { x } } \in \mathcal { X }$ is an image, $t \in \tau$ is its language description, and $y \in \mathcal { V }$ is a label indicating the index of the unique language description in the dataset. In a general form, the language description is a text sequence $\pmb { t } = [ t _ { 1 } , \cdots , t _ { L } ]$ . It ranges from simple category names representing visual concepts when $L$ is small, to more free-form and semantic-rich sentences such as captions when $L$ is relatively large.
|
| 50 |
+
|
| 51 |
+
In this paper, we assume there exists an external knowledge source $s$ , where one may use the language description $\pmb { t }$ as a query to seek additional knowledge description $s \in { \mathcal { S } }$ for $\pmb { t }$ . Given these triplet data instances $\mathcal { D }$ and an external knowledge source $s$ , our goal is to learn generic visualsemantic representations, which are readily transferable to a wide range of downstream datasets, whose category names are not necessarily observed during training. In Figure 2, we visually illustrate the proposed knowledge-augmentation process and two considered application scenarios.
|
| 52 |
+
|
| 53 |
+

|
| 54 |
+
Figure 2: Left: Illustration of data construction process of the proposed knowledge-augmented language-image learning, in contrast to the baseline language-image learning. The query $q$ is constructed from Eq. $\mathbb { \underline { { \left( 1 \right) } } }$ . The same process is performed for both pre-training and downstream tasks. Right: The proposed strategy is applied to IC and OD for task-level transfer.
|
| 55 |
+
|
| 56 |
+
# 3.1 External Knowledge
|
| 57 |
+
|
| 58 |
+
Query Construction. For a text sequence associated with an image, different tokens may play different roles in contributing to describing the main semantics of the image. Humans leverage this prior inherently in parsing the sentences to understand the image. Further, it is infeasible to employ the entire sequence as a query, as this may lead to the lack of coverage in the knowledge bases. Instead, we propose to construct a query $\pmb q \in \mathcal { Q }$ as a compact form of original language description $\pmb { t }$ represented with the words that convey the main concepts of the image.
|
| 59 |
+
|
| 60 |
+
Specifically, we consider a divide-and-conquer approach. For short text sequences $\pmb { t }$ such as category names in image-tag/label datasets (e.g., ImageNet $\mathbb { I } 1 5 \mathbb { I } )$ , we directly use the category name as the query. For long text sequences $\pmb { t }$ such as captions (e.g., YFCC $\pmb { \mathbb { B 4 } }$ ), we first parse the sentence to extract the noun-phrases, among which the most rare noun-phrase over the corpus is used as a query for this sentence. The intuition is to convert the rare concepts into “explanations” represented in common words using external knowledge. Noun phrases are useful for summarizing the sentence and thus inferring what is being talked about in the image. For example, in “professional boxer is introduced to the crowd”, the noun-phrases are “boxer”, “professional boxer”, and “the crowd”. We summarize the query construction process $g _ { q u e r y }$ below for clarity:
|
| 61 |
+
|
| 62 |
+
$\pmb { t }$ $\pmb { t }$
|
| 63 |
+
|
| 64 |
+
Knowledge Acquisition from External Sources. We consider three knowledge sources $s$ to enrich the language descriptions $\pmb { t }$ . They are constructed based on the two knowledge bases: WordNet $\pmb { \mathbb { E 3 } } ] $ and Wiktionary $\pmb { \mathbb { E 2 } }$ . To measure the breadth of a knowledge base, we define the concept coverage as the percentage of non-empty knowledge items retrieved for a given set of issued queries.(i) WordNet $\pmb { \mathbb { \left[ 6 3 \right] } }$ is a lexical database which links words into semantic relations including synonyms, hyponyms, and meronyms. Both nouns and verbs are organized into hierarchies, defined by hypernym relationships. The synonyms in WordNet are grouped into synsets, expressing the same distinct concept. The synsets serve as a natural link between language and vision domains. For example, ImageNet is an image database organized according to the WordNet hierarchy, where each node is depicted by hundreds/thousands of images. $( i i )$ Wiktionary $\pmb { \Vert 6 2 \Vert }$ is a web-based content dictionary of terms (including words, phrases, proverbs, linguistic reconstructions). These entries may contain definitions, illustrations, usage examples etc.. Next, we provide our knowledge retrieval process $\pmb { s } = g _ { r e t r i e v e } ( \pmb { q } )$ for each source $s$ , followed by an example result for the query “boxer”:
|
| 65 |
+
|
| 66 |
+
• WordNet Hierarchy ${ \mathcal { S } } _ { \mathrm { w n \_ p a t h } }$ . A WordNet node of the query is located, then we repeatedly search its parent node. The words along the traversal path are recorded as the knowledge.
|
| 67 |
+
- [boxer, combatant, person, causal_agent, physical_entity, entity]
|
| 68 |
+
WordNet Definition $S _ { \mathrm { { w n \_ d e f } } }$ . The definition from the synsets is used to explain the query.
|
| 69 |
+
- someone who fights with his fists for sport
|
| 70 |
+
• Wiktionary Definition $S _ { \mathrm { w i k i \_ d e f h } }$ . The query is used for dictionary look-up in Wiktionary, and the corresponding definition is used.
|
| 71 |
+
- a fighter in a boxing match
|
| 72 |
+
|
| 73 |
+
When multiple meanings (senses) exist for a given query, we simply consider the first one for simplicity, and leave more sophisticated designs as future work. After querying each knowledge source, we represent the external knowledge for each language description $\pmb { t }$ in the form of concatenation of its query and the corresponding retrieved result: $[ q , s ]$ . This external knowledge introduces additional supervision signals to guide visual models to learn better aligned visual-semantic representations, as we explain later. We next describe how to encode knowledge in multimodal models to improve transfer in the image-level task of image classification and the region-level task of object detection.
|
| 74 |
+
|
| 75 |
+
# 3.2 Image Classification
|
| 76 |
+
|
| 77 |
+
Recent works that learn visual models with language supervision $\mathbb { \ m }$ often employ a dual-encoder architecture. For each image $_ { \textbf { \em x } }$ , an image encoder model $f _ { \theta }$ parameterized by $\pmb { \theta }$ first represents $_ { \textbf { \em x } }$ as a visual feature vector $\tilde { v } \in \mathbb { R } ^ { P \times 1 }$ : $\tilde { v } = f _ { \theta } ( { \boldsymbol { x } } )$ . For each language description $\mathbf { \boldsymbol { t } } \in \mathcal { T }$ , we encode it with a text encoder $f _ { \phi } ( t )$ parameterized by $\phi$ , and get the [EOS] feature as the vector representation of the sentence $\tilde { \pmb { u } } \in \mathbb { R } ^ { P \times 1 } : \tilde { \pmb { u } } = f _ { \phi } ( \pmb { t } )$ . In this paper, we further leverage this text encoder to encode the external knowledge. First, the query $\pmb q$ is represented in natural language $\pmb { p } = g _ { p r o m p t } ( \pmb { q } )$ using the language prompt as in $\pmb { \mathbb { Z } } \mathbf { \mathbb { 1 } }$ . Depending on the language input $\pmb { t }$ and our augmentation scheme, the knowledge-augmented text sequence $\mathbf { \boldsymbol { t } } ^ { \tilde { k } } \in \mathcal { T } ^ { k }$ $k$ stands for knowledge) is represented as:
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
t ^ { k } = \left\{ \begin{array} { l l } { t _ { e } ^ { k } = [ p , q , s ] , } & { \mathrm { ~ w h e n ~ } t \mathrm { ~ i s ~ a ~ c a t e g o r y , ~ c l a s s ~ o r ~ t a g ~ n a m e } , } \\ { t _ { c } ^ { k } = [ t , q , s ] , } & { \mathrm { ~ w h e n ~ } t \mathrm { ~ i s ~ a ~ c a p t i o n , ~ a n d ~ a ~ c o n c a t ~ s c h e m e ~ i s ~ u s e d } , } \\ { \{ t _ { c } ^ { k } , t _ { e } ^ { k } \} , } & { \mathrm { ~ w h e n ~ } t \mathrm { ~ i s ~ a ~ c a p t i o n , ~ a n d ~ a ~ c o m b i n e ~ s c h e m e ~ i s ~ u s e d } } \end{array} \right.
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
For example, for category name $\pmb { t = }$ boxer or for caption $\pmb { t = }$ professional boxer is introduced to the crowd, we have $\mathbf { \nabla } q =$ boxer, and the corresponding language description are:
|
| 84 |
+
|
| 85 |
+
• $t _ { e } ^ { k } = \mathsf { a }$ photo of a cool boxer ; boxer , a fighter in a boxing match • $t _ { c } ^ { k } =$ professional boxer is introduced to the crowd ; boxer , a fighter in a boxing match
|
| 86 |
+
|
| 87 |
+
We re-use the same text encoder $f _ { \phi }$ to encode $t ^ { k }$ as the original $\pmb { t }$ as supervision for image $_ { \textbf { \em x } }$ .
|
| 88 |
+
|
| 89 |
+
Training. For $i$ -th image $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ and $j$ -th language description $t _ { j }$ in a batch $\boldsymbol { B }$ , we normalize their feature vectors in a hyper-sphere using $\begin{array} { r } { \pmb { u } _ { i } = \frac { f _ { \pmb { \theta } } \left( \pmb { x } _ { i } \right) } { \left\| \int _ { \pmb { \theta } } \left( \pmb { x } _ { i } \right) \right\| } } \end{array}$ and $\begin{array} { r } { v _ { j } = \frac { { \bar { f } } _ { \phi } ( t _ { j } ) } { \| f _ { \phi } ( t _ { j } ) \| } } \end{array}$ , and their similarity is calculated as $\pmb { u } _ { i } ^ { \top } \pmb { v } _ { j }$ . A bidirectional supervised contrastive objective is considered to train the model:
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
\mathcal { C } _ { i 2 t } = - \sum _ { i \in B } \frac { 1 } { | \mathcal { P } ( i ) | } \sum _ { \boldsymbol { k } \in \mathcal { P } ( i ) } \log \frac { \exp ( \tau u _ { i } ^ { \top } \boldsymbol { v } _ { k } ) } { \sum _ { j \in B } \exp ( \tau u _ { i } ^ { \top } \boldsymbol { v } _ { j } ) } \mathrm { ~ a n d ~ } \mathcal { L } _ { t 2 i } = - \sum _ { j \in B } \frac { 1 } { | \mathcal { Q } ( j ) | } \sum _ { \boldsymbol { k } \in \mathcal { Q } ( j ) } \log \frac { \exp ( \tau u _ { k } ^ { \top } \boldsymbol { v } _ { j } ) } { \sum _ { i \in B } \exp ( \tau u _ { i } ^ { \top } \boldsymbol { v } _ { j } ) }
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
where $\mathcal { P } ( i ) = \{ k | k \in B , y _ { k } = y _ { i } \}$ , $\mathcal { Q } ( j ) = \{ k | k \in B , y _ { k } = y _ { j } \}$ , and $\tau$ is a temperature hyperparameter controlling the strength of penalties on hard negative samples. Note $( 3 )$ is a general form; it reduces to the training objective of CLIP $\mathbb { \ m }$ or ALIGN $\begin{array} { r l r } { { \mathbb { I } \mathscr { 3 } 6 \| } } \end{array}$ when there is a one-to-one mapping between an image and its paired caption in a batch, i.e., $\mathcal { P } ( i ) = \{ i \}$ and $\mathcal { Q } ( j ) = \{ j \}$ .
|
| 96 |
+
|
| 97 |
+
Evaluation. Given a downstream image classification task with a custom set of category names, we represent them with the knowledge-augmented prompt form in $\textcircled{2}$ ; they are fed into the pre-trained text encoder $f _ { \phi }$ to obtain the class embedding. The test image $_ { \textbf { \em x } }$ is encoded with $f _ { \pmb \theta } ( \pmb x )$ , and compared to all class embeddings to get its label from the best matching class.
|
| 98 |
+
|
| 99 |
+
Extensions with Modularized Modeling. In our study, we found it is key to ensure consistency between training and evaluation stages: if a model is trained with knowledge, it performs well when also evaluated with knowledge. Similarly, if a model is trained without knowledge (e.g., CLIP/UniCL), adding knowledge directly in the evaluation stage results in performance drop. However, due to the limited knowledge coverage in existing knowledge bases, $\pmb { s }$ could be empty for a large number of queries $\pmb q$ . When the low coverage happens for a downstream evaluation dataset, it may result in a training-evaluation inconsistency for our knowledge-augmented models, and thus lower performance.
|
| 100 |
+
|
| 101 |
+
It is desired to have a modularized model that can switch between “with” and “without” knowledge settings. Inspired by $\mathbb { \lVert \underline { { 9 0 } } \rVert }$ , we propose to employ adapters $\pmb { \mathbb { B 3 } }$ to build the network branch to encode knowledge-augmented language $\dot { \mathbf { \Omega } } _ { t ^ { k } } ^ { k }$ , where serial MLP adapters are inserted after each self-attention and MLP modules for all Transformer layers of the text encoder, and $t ^ { k }$ is passed through $f _ { \phi }$ and adapters. Meanwhile, the original $f _ { \phi }$ is reserved as the branch to encode vanilla natural language $\pmb { t }$ . The proposed adapter-modularized architecture can also be used for efficient stage-wise continual pre-training: one may start with a vanilla language-image model pre-trained on $\mathcal { D }$ , and continue pre-train the adapters with knowledge-augmented data $( \mathcal { D } , \mathcal { S } )$ to build its knowledge version.
|
| 102 |
+
|
| 103 |
+
# 3.3 Object Detection
|
| 104 |
+
|
| 105 |
+
Object detection (OD) typically involves two tasks: $\mathcal { L } _ { \mathrm { O D } } = \mathcal { L } _ { \mathrm { c l s } } + \mathcal { L } _ { \mathrm { l o c } }$ , where the localization task $\mathcal { L } _ { \mathrm { l o c } }$ aims to locate the presence of objects in an image with a bounding box, and classification task $\mathcal { L } _ { \mathrm { c l s } }$ determines what object categories are present in that box. Similar to the IC task above, we improve the categorization task of individual boxes $\mathcal { L } _ { \mathrm { c l s } }$ in OD with external knowledge, and keep $\mathcal { L } _ { \mathrm { l o c } }$ the same. Specifically, we leverage GLIP $ { \mathbb { I } } ^ { { 5 } \mathrm { O } \| }$ to reformulate OD as a phrase grounding task, by grounding each region proposed by $\mathcal { L } _ { \mathrm { l o c } }$ $\mathbb { \left. 5 3 \right. }$ to phrases in a text sequence. For language encoding, we first augment a category name $\pmb { t }$ into its knowledge-augmented form ${ \pmb t } ^ { k } = [ { \pmb q } , s ]$ ; this is different from IC in that $\pmb { p }$ is excluded, as no prompt engineering is used in OD, as in $\pmb { \mathbb { B } } \pmb { \mathrm { O } } \Vert$ . In the original GLIP, a sequential text encoding scheme is used: a concatenated long sequence $[ \pmb q _ { 1 } , \cdots , \pmb q _ { K } ]$ over category names is considered as the text encoder input. In our case, simple concatenation $[ { \pmb q } _ { 1 } , { \pmb s } _ { 1 } \cdot \cdot \cdot , { \pmb q } _ { K } , { \pmb s } _ { K } ]$ will quickly break the max length requirement of the language encoder.
|
| 106 |
+
|
| 107 |
+
To resolve the issue, we propose a parallel text encoding scheme: each $t ^ { k }$ is passed through language encoder independently, we use the top-layer feature of [CLS] token as the contextual vector representation $\tilde { \pmb { u } } \in \mathbb { R } ^ { P \times 1 }$ of $t ^ { k }$ : $\tilde { \mathbf { u } } = f _ { \phi } ( \dot { t } ^ { k } )$ . Given $K$ categories, they can be encoded in parallel in a batch; the encoded phrase feature sequence is the concatenation $\mathbf { U } \in \mathbb { R } ^ { P \times K }$ : ${ \bf U } = [ \tilde { \pmb { u } } _ { 1 } , \cdots , \tilde { \pmb { u } } _ { K } ]$ The region encoding is the same as in GLIP. The feature pyramid is $\mathbf { V } \in \mathbb { R } ^ { M \times P } : \mathbf { V } = \dot { f } _ { \pmb { \theta } } ( \pmb { x } )$ · , where $M$ is the number of box features. The alignment scores $\mathbf { S } _ { \mathrm { g r o u n d } }$ are computed:
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\mathbf { S } _ { \mathrm { g r o u n d } } { = } \mathbf { V } \mathbf { U } , ~ \mathcal { L } _ { \mathrm { c l s } } { = } \mathcal { M } ( \mathbf { S } _ { \mathrm { g r o u n d } } ; \mathbf { T } ) ,
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
where $\mathbf { T } \in \{ 0 , 1 \} ^ { M \times K }$ is the target indicating match or no match, and $\mathcal { M } ( \mathbf { S } ; \mathbf { T } )$ is the focal loss $\pmb { \Vert 5 3 \Vert }$ . The grounding model, consisting of the image encoder $f _ { \theta }$ , the language encoder $f _ { \phi }$ and a cross-modal interaction head introduced in $\pmb { \Vert \bar { 5 0 } } $ , is trained end-to-end by minimizing the loss defined in $( 4 )$ . In the evaluation stage, the external knowledge is also retrieved, and encoded in the same parallel encoding manner to enrich the category names in the downstream OD tasks.
|
| 114 |
+
|
| 115 |
+
# 4 Experimental Results
|
| 116 |
+
|
| 117 |
+
In this section, we examine our knowledge-augmented approach to answer two research questions. $\mathsf { Q 1 }$ : To what extent external knowledge benefits visual transfer learning, including sample-efficiency in pre-training and downstream? Q2: Why does external knowledge help zero-shot transfer (illustrated with success and failure case studies)?
|
| 118 |
+
|
| 119 |
+
# 4.1 Settings
|
| 120 |
+
|
| 121 |
+
Evaluation benchmark. We apply the proposed knowledge-augmented models to two task-level transfer settings defined in ELEVATER benchmark [47], which evaluates the transferability of the learned visual representations in the wild. We study our models based on the datasets described in Table $\nsupseteq$ . The license, PII, and consent details of each dataset are in the respective papers. Due to the limited computational resources, the pre-training datasets are constrained to the large publicly available datasets used in [95, 50]. This setting is defined as the “Academic Track” in [47], which friendly to the academic community to allow reproducibility of the results. The number of visual concepts is identical to the number of categories for datasets with category names (e.g., ImageNet
|
| 122 |
+
|
| 123 |
+
Table 1: Statistics of training and test datasets used in our experiments. #Instances indicates #Image for IC and #Regions for OD, respectively. For #Concept and Vocabulary size, we report numbers for the full set and for items with frequency larger than 5. #Ins/C. reports the mean and standard derivation for the numbers of instances per concept.
|
| 124 |
+
|
| 125 |
+
<table><tr><td rowspan="2">Task</td><td colspan="5">Pre-training</td><td colspan="2">Downstream</td></tr><tr><td></td><td>#Instances</td><td>#Concepts</td><td>Vocab. Size</td><td>#Ins/#C.</td><td colspan="2">Concept Overlap (%)</td></tr><tr><td rowspan="5">IC</td><td>Dataset ImageNet-21K[15]</td><td>13M</td><td></td><td></td><td></td><td>ImageNet-1K</td><td>|20-datasets</td></tr><tr><td></td><td></td><td>19.2K/18.4K</td><td>13.5K/12.9K</td><td>591 ±537</td><td>11.82</td><td>13.26</td></tr><tr><td>GCC-3M[ 国</td><td>3.3M</td><td>681K/64.5K</td><td>29.6K/13.0K</td><td>9.5 ±303</td><td>35.97</td><td>19.73</td></tr><tr><td>GCC-12M</td><td>12M</td><td>10.2M/728K</td><td>1.24M/264K</td><td>5.6±353</td><td>61.02</td><td>31.34</td></tr><tr><td>YFCC-14M 84</td><td>14M</td><td>14.2M/1.25M</td><td>2.41M/473K</td><td>8.3 ±1354</td><td>65.23</td><td>34.65</td></tr><tr><td rowspan="2">OD</td><td>Dataset</td><td></td><td></td><td></td><td></td><td>LVIS</td><td>13-datasets</td></tr><tr><td>Object-365 因</td><td>9.6M</td><td>365 /365</td><td>452/452</td><td>26.3K ± 12.4K</td><td>13.46</td><td>21.26</td></tr></table>
|
| 126 |
+
|
| 127 |
+
<table><tr><td>Training Method</td><td>Knowledge S</td><td>ImageNet-1K</td><td></td><td>ICinW (20 datasets)</td></tr><tr><td rowspan="4">1-branch,from scratch</td><td>、</td><td>28.16 4.93 29.03</td><td>27.15</td><td>17.10</td></tr><tr><td>Swn_hier</td><td>27.43</td><td>28.15</td><td>28.69</td></tr><tr><td>Swn_def</td><td>22.87 29.31</td><td>26.97</td><td>29.14</td></tr><tr><td>Swiki_def</td><td>22.05 30.23</td><td>29.03</td><td>33.44</td></tr><tr><td rowspan="2">2-branch,continue pre-training 2-branch,from scratch</td><td>Swiki_def</td><td>28.16</td><td>28.40/28.90 27.15</td><td>30.73/30.91</td></tr><tr><td>Swiki_def</td><td>28.16</td><td>32.52/32.44 27.15</td><td>32.46/33.49</td></tr></table>
|
| 128 |
+
|
| 129 |
+
Table 2: Zero-shot task transfer performance after pre-training on ImageNet-21K dataset. The top block studies the effectiveness of knowledge sources $s$ , and the bottom block studies the modularized approach. For each downstream task, the 1st and 2nd column reports the results without and with knowledge, namely green cells indicate “a match”, orange cells indicate “a mismatch” w.r.t. adding knowledge in training and evaluation. In the bottom block, we report two numbers when evaluated with knowledge: using the knowledge branch only, and using two branches selectively.
|
| 130 |
+
|
| 131 |
+
and Object-365). For image-text data (bottom 3 rows of the IC block), we use Spacy $\pmb { \Vert 3 2 } \Vert$ to extract the noun phrases. We also use a merged version of GCC-3M and GCC-12M denoted as GCC-15M. Given the pool of concepts, we calculate the number of unique words and report it as the vocabulary size. For Concepts and Vocab Size, we report 2 numbers: first for the full set, second for items with frequency larger than 5. The latter provides a sense of “long-tailness”. The statistics (e.g., ratio of #Instance / #Concept) illustrates the varied trade-off over different datasets: image diversity, semantic richness and long-tailness. For example, YFCC is the most long-tail dataset in IC, as it has low mean value and the largest standard derivation value in #Instance / #Concept. The concept overlap is computed as the percentage of concepts in a downstream dataset that are covered by the pre-training dataset. For 20-datasets and 13-datasets, the averaged overlap across individual datasets is reported. It measures the gap (or difficulty) in concept transfer between the pre-training and the downstream data. The dataset statistics are detailed in Section B.1 in Appendix.
|
| 132 |
+
|
| 133 |
+
Zero/Few-shot image classification. Following UniCL [95], this task evaluates to what extent a model understands novel concepts. We pre-train on ImageNet-21K [15] and GCC [76, 11]/YFCC [84] datasets, and report results on ImageNet-1K [15] and a suite of 20 datasets (ICinW) proposed in [47]. We use the same text prompts as in [71, 95], and report scores averaged over 20 datasets. UniCL/Florence [101] show superior performance to CLIP or ALIGN counterparts; UniCL is Florence in a controlled academic setting, trained on the large publicly available datasets [95].
|
| 134 |
+
|
| 135 |
+
Zero-shot object detection. Following GLIP $\mathbb { \left[ \left[ 5 0 \right] \right] }$ , we pre-train on Object365 $\mathbb { \left. \overline { { \boldsymbol { \mathscr { Z } } \boldsymbol { \cdot } \boldsymbol { \cdot } } } \right. }$ , and transfer the learned visual representations for object detection on LVIS $\pmb { \left[ \widetilde { \left| 2 8 \right| } \right] }$ and a suite of 13 small OD datasets (ODinW) proposed in [50, 47], to check the generalization ability. The box mAP is reported.
|
| 136 |
+
|
| 137 |
+
# 4.2 Image Classification
|
| 138 |
+
|
| 139 |
+
ImageNet-21K pre-training. We start by pre-training on ImageNet-21K, where all ImageNet-1K images are excluded. We still see a small amount of concept overlap in Table $\bigstar$ and hypothesize that some category names are given based on different level of WordNet hierarchy. The benefits of this setting are two-fold: it ensures distinctively less concept overlap, and all concepts can find their full WordNet knowledge. We report the results in Table $2 .$ For each checkpoint, we report the results without and with knowledge in the evaluation stage. We confirm two major findings below.
|
| 140 |
+
|
| 141 |
+
Table 3: Overall comparisons of our knowledge-augmented models. Each model is pre-trained with 32 epochs following CLIP [71]/UniCL $\boldsymbol { \| 9 5 \| }$ . } It indicates that the Combine scheme is used for the image-caption data, otherwise the default is the Concat scheme decribed in Section $3 . 2 .$ The linear probing and fine-tuning results are reported for 5-shot settings over 3 random seeds.
|
| 142 |
+
|
| 143 |
+
<table><tr><td colspan="2">Training Data Dataset</td><td rowspan="2">Method</td><td>ImageNet-1K</td><td colspan="3">ICinW (20 datasets)</td></tr><tr><td># Samples</td><td></td><td>Zero-shot</td><td>Zero-shot</td><td>Linear Probing</td><td>Fine-tuning</td></tr><tr><td rowspan="2">ImageNet-21K</td><td>13M (full)</td><td>UniCL</td><td>28.16</td><td>27.15</td><td>53.07 ± 4.15</td><td>55.96 ± 2.50</td></tr><tr><td>13M (full)</td><td>K-LITE</td><td>30.23</td><td>33.44</td><td>53.92 ± 1.05</td><td>57.81 ± 1.48</td></tr><tr><td rowspan="5">YFCC-14M + ImageNet-21K</td><td>14M (half)</td><td>UniCL</td><td>34.43</td><td>34.30</td><td>53.50 ± 2.22</td><td>56.45 ± 2.48</td></tr><tr><td>14M (half)</td><td>K-LITE</td><td>36.67</td><td>36.50</td><td>49.48 ± 2.23</td><td>55.88 ± 1.64</td></tr><tr><td>14M (half)</td><td>K-LITE</td><td>42.36</td><td>36.50</td><td>54.28 ± 3.66</td><td> 52.11 ± 4.90</td></tr><tr><td>27M (full)</td><td>UniCL</td><td>43.06</td><td>35.99</td><td>55.96 ± 3.38</td><td>58.25 ± 2.98</td></tr><tr><td>27M (full)</td><td>K-LITE</td><td>45.67</td><td>38.89</td><td>57.06 ± 1.48</td><td>58.24 ± 2.36</td></tr><tr><td rowspan="5">GCC-15M + ImageNet-21K</td><td>15M (half)</td><td>UniCL</td><td>41.64</td><td>36.31</td><td>53.86 ± 2.73</td><td>59.04 ± 3.13</td></tr><tr><td>15M (half)</td><td>K-LITE</td><td>44.26</td><td>39.53</td><td>55.91 ± 2.53</td><td>58.20 ± 3.39</td></tr><tr><td>15M (half)</td><td>K-LITE</td><td>47.30</td><td>40.32</td><td> 57.38 ± 2.70</td><td>60.72 ± 2.29</td></tr><tr><td>28M (full)</td><td>UniCL</td><td>46.83</td><td>38.90</td><td>57.92 ± 3.31</td><td>60.99 ± 2.74</td></tr><tr><td>28M (full)</td><td>K-LITE</td><td>48.76</td><td>41.34</td><td>58.56 ± 3.12</td><td>63.39 ± 1.74</td></tr></table>
|
| 144 |
+
|
| 145 |
+
F1: All three knowledge sources are beneficial. In Section $3 . 1 ,$ we have introduced WordNet hierarchy ${ \mathcal { S } } _ { \mathrm { w n \_ p a t h } }$ , WordNet definition $S _ { \mathrm { { w n \_ d e f } } }$ , and Wiktionary definition $\boldsymbol { S } _ { \mathrm { w i k i \_ d e f } }$ as external knowledge sources. It is shown that all three of them are effective, improving the zero-shot accuracy by absolute gain $1 \%$ on ImageNet-1K (from $2 8 . 1 6 \%$ to $3 0 . 2 3 \%$ ) and $2 \%$ on the dataset suite in average (from $2 7 . 1 5 \%$ to $3 3 . 4 4 \%$ , respectively. Among them, Wiktionary definition $\boldsymbol { S } _ { \mathrm { w i k i \_ d e f } }$ turns out to be the most effective, therefore, we use it as the default knowledge source throughout the remaining experiments.
|
| 146 |
+
|
| 147 |
+
F2: The modularized approach is effective. Our results in Table 2 reveal that training/test inconsistency in terms of involving knowledge can dramatically degrade the model performance. For example in the 1st row, the baseline UniCL is pre-trained without knowledge, its performance decreases from $2 8 . 1 6 \%$ to $4 . 9 3 \%$ when knowledge is added in the test stage. In contrast, in the 4th row, our K-LITE is pre-trained with knowledge, its performance decrease from $3 3 . 4 4 \%$ to $2 9 . 0 3 \%$ if knowledge is excluded in the evaluation stage. Therefore, we consider a modularized approach with 2-branch in the model. First, we continue pre-train our modularized model from a 32-epoch knowledge-free checkpoint by only updating the Adapters on knowledge-augmented image-text pairs for 10 epochs. It already shows a performance gain from $2 7 . 6 1 \%$ to $2 8 . 4 0 \%$ . This suggests a more affordable solution to obtain knowledge-augmented models from existing models. We can further boost the performance to $2 8 . 9 0 \%$ if we evaluate with two branches, each of which only passes its corresponding language version. Finally, we also train the modularized model from scratch, and it demonstrates a significant gain (absolute $4 \%$ ) on ImageNet-1K, and over $5 \%$ improvement on the 20 datasets. For fair comparisons with knowledge-free models, we train our models with one branch in the rest of experiments.
|
| 148 |
+
|
| 149 |
+
To demonstrate the performance of K-LITE in the extreme large-scale settings, we leverage the largest checkpoint of Florence $\mathbb { I O I }$ trained on 800M image-text pairs, and continue pre-training the model on ImageNet-21K with external knowledge. It improves the zero-shot ImageNet-1K accuracy of Florence from $8 3 . 7 4 \%$ to $8 5 . 8 0 \%$ . As an ablation baseline, continuing pre-training without knowledge yields $8 5 . 3 5 \%$ . The absolute $0 . 4 5 \%$ performance gain shows that external knowledge can still benefit transfer learning, though a huge amount of pre-training data is employed.
|
| 150 |
+
|
| 151 |
+
Pre-training on image-text-label data. The unification of image-label and image-caption as imagetext-label has been demonstrated superior over either one of them [95]. Therefore, we report overall results on the combined data in Table $\textcircled { 3 }$ The few-shot learning results are reported with 5 training examples, using two model adaptation method: linear probing and full model fine-tuning. The average numbers over 3 random seeds are reported. K-LITE improves its knowledge-free counterpart UniCL in almost all the cases. Importantly, K-LITE can outperform UniCL using only half of the pre-training image-text pairs in several cases. It demonstrate the high sample-efficiency of K-LITE, and that external knowledge is an effective source to consider, when collecting large-scale image-text pairs to develop language-augmented visual models at scale. We also compare K-LITE and UniCL with Swin-Base on the joint data including ImageNet-21K, GCC15M and YFCC15M. K-LITE
|
| 152 |
+
|
| 153 |
+

|
| 154 |
+
|
| 155 |
+

|
| 156 |
+
Figure 3: Performance improvement analysis with external knowledge. External knowledge can largely improve concept overlap between pre-training and evaluation stages, hence usually yields higher recognition scores. Knowledge coverage indicates the percentage of concepts that exist in theFood-101 (Wiki knowledge improves performance) knowledge base for each downstream dataset.
|
| 157 |
+
|
| 158 |
+
English marigold: Any of the Old World plants, of the genus Calendula, with orange, yellow or reddish flowers.
|
| 159 |
+
|
| 160 |
+
Bird of paradise: Any of variouLobster bisque: A thick creamy soup birds of the family Paradisaemade from fish, shellfish, meat or Oceanvegetables.
|
| 161 |
+
|
| 162 |
+

|
| 163 |
+
|
| 164 |
+
Wallflower: Any of several short-lived herbs or shrubs of the Erysimum genus with bright yellow to red flowers.
|
| 165 |
+
|
| 166 |
+

|
| 167 |
+
|
| 168 |
+
Hot and sour soup: Any one of seve Canna lily: Any of several flowesoups, served in various Asian cuisi genus Lilium of the familywhich are both spicy and sour
|
| 169 |
+
|
| 170 |
+
(a) Success examples. The two datasets with largest improvement in Fig. 3: Flowers102 and Food101. The description of the parent concept, material, shape, color etc. clarifies the concepts, boosting performance for the fine-grained classification tasks.
|
| 171 |
+
|
| 172 |
+

|
| 173 |
+
|
| 174 |
+
bus: A motor vehicle for transporting large numbers of people along roads.
|
| 175 |
+
|
| 176 |
+

|
| 177 |
+
|
| 178 |
+

|
| 179 |
+
|
| 180 |
+
car: A wheeled vehicle that moves independently, with at least three wheels
|
| 181 |
+
|
| 182 |
+

|
| 183 |
+
Figure 4: Success and failure cases on image classification. For each image, the top row is the knowledge-based prediction, and the bottom row is the baseline prediction (no knowledge).
|
| 184 |
+
|
| 185 |
+
(b) Failure examples. The two datasets with the largest performance loss in Fig. 3. Left (EuroSat): both class names have the same knowledge. Middle & Right (VOC2007): The knowledge contains spurious words that confuse the models.
|
| 186 |
+
|
| 187 |
+
improve the zero-shot performance of UniCL from $5 2 . 1 8 \%$ to $5 7 . 7 8 \%$ on ImageNet-1K, and from from $4 3 . 2 0 \%$ to $4 5 . 4 7 \%$ on ICinW.
|
| 188 |
+
|
| 189 |
+
Breakdown Analysis. Next, we ask why does external knowledge improve the zero-shot task transfer performance on a broad range of datasets? To answer this question, we compare the breakdown performance on all 20 dataset in Figure $^ { 3 , }$ for the ImageNet-21K checkpoints trained with and without Wiki knowledge. Out of 20 datasets, external knowledge shows superior/comparable/inferior performance to the baseline on 16/1/3 datasets, respectively. One prominent observation is that Wiki knowledge improves concept overlap for train-evaluation from $1 3 . 2 6 \%$ to $5 1 . 2 4 \%$ by average. It is easy to understand, concepts are explained in more commonly used words in Wikitionary, providing a bridge for train and evaluation. This is reflected by the increased height of blue bar for most datasets in Figure $3 .$ Interestingly, for all datasets with increased accuracy scores, there shows an increase of the concept overlap. In summary, knowledge is an effective approach to improve concept overlap, a prerequisite for good task transfer performance. In Figure $^ 4$ (a), we provide success examples after adding knowledge; more examples are shown in Appendix.
|
| 190 |
+
|
| 191 |
+
Limitations. The failure cases where knowledge-augmented approach does not help mainly belong to two scenarios: (i) No external knowledge was extracted from the given knowledge base (i.e., Wiktionary in this case), e.g., StanfordCars and FGVC Aircraft. They often require domain-specific knowledge explanations to define a car brand (e.g., Volvo C30 Hatchback 2012) or an aircraft model type (e.g., 737-200), while Wiktionary can hardly provide such professional definitions. $( i i )$ While knowledge is available, the quality is too low to provide useful information. In Figure $\textcircled { 4 }$ (b), we provide failure examples from two datasets with the biggest performance loss after adding
|
| 192 |
+
|
| 193 |
+
<table><tr><td rowspan="2">Method</td><td colspan="10">LVIS</td><td colspan="4">ODinW (13 datasets)</td></tr><tr><td>APr</td><td>APc</td><td>APf</td><td>=</td><td>SLVIS</td><td>Swn_path</td><td></td><td>Swn_def</td><td>Swiki_def</td><td>-</td><td>Swn_path</td><td>Swn_def</td><td>Swiki_def</td></tr><tr><td>GLIP-A 四</td><td>14.2</td><td>13.9</td><td>23.4</td><td>18.5</td><td>-</td><td></td><td></td><td></td><td></td><td>28.8</td><td></td><td></td><td></td></tr><tr><td>Baseline GLIP</td><td>8.6</td><td>14.0</td><td>23.1</td><td>17.9</td><td>17.6</td><td>17.1</td><td>17.2</td><td></td><td>15.0</td><td>27.5</td><td>26.8</td><td>21.0</td><td>18.5</td></tr><tr><td>K-LITE</td><td>14.8</td><td>18.6</td><td>24.8</td><td>16.9</td><td>21.3</td><td>18.7</td><td></td><td>21.4</td><td>20.5</td><td>25.0</td><td>30.3</td><td>28.4</td><td> 31.7</td></tr></table>
|
| 194 |
+
|
| 195 |
+
Table 4: Zero-shot task transfer performance on OD. APr/APc/APf indicates the AP values for rare, common, frequent groups of categories on LVIS. Cell coloring follows the same protocol as in Table 2. ${ \mathcal { O } } _ { \mathrm { G L I P } }$ is implemented with parallel text encoding in Section 3.3 without external knowledge.
|
| 196 |
+
|
| 197 |
+
knowledge. In Figure 6 in the Appendix, we show more examples where knowledge only yields slight improvement. To summarize, a promising future research direction is to improve the knowledge quality to be more related to the given classification tasks.
|
| 198 |
+
|
| 199 |
+
# 4.3 Object detection
|
| 200 |
+
|
| 201 |
+
We evaluate the model’s ability to recognize diverse objects on LVIS $\left[ \left[ 2 8 \right] \right]$ and 13 downstream datasets used in $\pmb { \Vert 5 0 \Vert }$ in a zero-shot setting. We report on MiniVal containing 5,000 images on LVIS. Our K-LITE GLIP is trained with Wiktionary definitions. The results are presented in Table 4. The 1st row are the original numbers reported in $\left[ \left[ 5 0 \right] \right]$ , using the sequential text encoding. The 2nd row is our implementation of GLIP using parallel text encoding, whose effectiveness is validated by the comparable numbers with 1st row. The 3rd row is our knowledge-augmented GLIP, i.e., K-LITE. The benefit of using external knowledge is evident. On LVIS, the categories are divided into rare, common, frequent groups, based on the number of training images per category. K-LITE improves the detection performance for all three groups with an average of 2.8 points on LVIS, and particularly brings a 4.7 points improvement on MiniVal APc over the GLIP-A reported in $\pmb { \| 5 0 \| }$ . We conclude that the enriched semantics of external knowledge significantly helps the model recognize concepts with a decent number of instances. Since LVIS has its own knowledge source $\mathcal { S } _ { \mathrm { { L V I S } } }$ , mostly built upon WordNet definitions $[ [ 2 8 ] ]$ , we evaluate our model with $ { S _ { \mathrm { { L V I S } } } }$ . We alter the external knowledge source to ${ \mathcal { S } } _ { \mathrm { w n \_ p a t h } }$ , $S _ { \mathrm { { w n \_ d e f } } }$ , and $\boldsymbol { S } _ { \mathrm { w i k i \_ d e f } }$ in evaluation, which yields mAP 18.7, 21.4, 20.5, respectively. It verifies that our knowledge source extraction process is reliable. Similarly, K-LITE improve the 13 downstream OD datasets from 28.8 (or 27.5 with its own knowledge-free counterpart) to 31.7. The success and failure examples of OD are shown in Section $\mathbf { B . } 5$ in Appendix.
|
| 202 |
+
|
| 203 |
+
# 5 Conclusions
|
| 204 |
+
|
| 205 |
+
In this paper, we have presented a knowledge-augmented approach K-LITE to learn a generic visual model for task-level transfer. General external knowledge sources including WordNet and Wiktionary are explored to enrich the natural language supervision, which is then used in both the language-image pre-training stage and the prompt-based evaluation stage. We have demonstrated the generality and effectiveness of K-LITE in two core computer vision problems: image classification and object detection. Extensive experimental results show that our method can achieve superior performance over existing methods on $2 0 \ : \mathrm { I C }$ datasets and $1 3 \mathrm { \ O D }$ datasets, respectively. K-LITE also outperforms its knowledge-free counterpart UniCL using half of the pre-training data in the large-scale academic data setting, demonstrating that leveraging external knowledge is a promising direction in improving pre-training sample-efficiency for learning transferable visual models.
|
| 206 |
+
|
| 207 |
+
# Acknowledgments
|
| 208 |
+
|
| 209 |
+
The authors gratefully acknowledge Chenguang Zhu, Wenhao Yu, Yuwei Fang for the early insightful discussions on the use of dictionary for rare concepts in NLP task, Hao Cheng for the inspirations of external knowledge in open-domain QA. The project is partly done in the MSR-Berkeley collaboration program3. The work depends on publicly available knowledge databases; we acknowledge all the original authors and contributors who made their “knowledge” public. Sheng Shen and Kurt Keutzer are supported by Samsung SAIT, Intel corporation, Intel VLAB team, Intel One-API center of excellence, as well as funding through BDD and BAIR. The work of Sheng Shen, Anna Rohrbach and Trevor Darrell was supported in part by DoD including DARPA’s LwLL, PTG and/or SemaFor programs, as well as BAIR’s industrial alliance programs.
|
| 210 |
+
|
| 211 |
+
# References
|
| 212 |
+
|
| 213 |
+
[1] FER 2013: Kaggle challenges in representation learning facial expression recognition. https://www. kaggle.com/.
|
| 214 |
+
[2] Harsh Agrawal, Karan Desai, Yufei Wang, Xinlei Chen, Rishabh Jain, Mark Johnson, Dhruv Batra, Devi Parikh, Stefan Lee, and Peter Anderson. nocaps: novel object captioning at scale. In ICCV, 2019.
|
| 215 |
+
[3] Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C Lawrence Zitnick, and Devi Parikh. Vqa: Visual question answering. In ICCV, 2015.
|
| 216 |
+
[4] Sören Auer, Christian Bizer, Georgi Kobilarov, Jens Lehmann, Richard Cyganiak, and Zachary Ives. Dbpedia: A nucleus for a web of open data. In The semantic web, pages 722–735. Springer, 2007.
|
| 217 |
+
[5] Sven Bambach, Stefan Lee, David Crandall, and Chen Yu. Lending a hand: Detecting hands and recognizing activities in complex egocentric interactions. In ICCV, 2015.
|
| 218 |
+
[6] Kurt Bollacker, Colin Evans, Praveen Paritosh, Tim Sturge, and Jamie Taylor. Freebase: a collaboratively created graph database for structuring human knowledge. In ACM SIGMOD, 2008.
|
| 219 |
+
[7] Sebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai, Eliza Rutherford, Katie Millican, George van den Driessche, Jean-Baptiste Lespiau, Bogdan Damoc, Aidan Clark, et al. Improving language models by retrieving from trillions of tokens. arXiv preprint arXiv:2112.04426, 2021.
|
| 220 |
+
[8] Lukas Bossard, Matthieu Guillaumin, and Luc Van Gool. Food-101–mining discriminative components with random forests. In ECCV, 2014.
|
| 221 |
+
[9] Yingshan Chang, Mridu Narang, Hisami Suzuki, Guihong Cao, Jianfeng Gao, and Yonatan Bisk. Webqa: Multihop and multimodal qa. arXiv preprint arXiv:2109.00590, 2021.
|
| 222 |
+
[10] Soravit Changpinyo, Wei-Lun Chao, and Fei Sha. Predicting visual exemplars of unseen classes for zero-shot learning. In ICCV, 2017.
|
| 223 |
+
[11] Soravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual 12m: Pushing web-scale image-text pre-training to recognize long-tail visual concepts. In CVPR, 2021.
|
| 224 |
+
[12] Jiaoyan Chen, Yuxia Geng, Zhuo Chen, Ian Horrocks, Jeff Z Pan, and Huajun Chen. Knowledge-aware zero-shot learning: Survey and perspective. IJCAI, 2021.
|
| 225 |
+
[13] Gong Cheng, Junwei Han, and Xiaoqiang Lu. Remote sensing image scene classification: Benchmark and state of the art. Proceedings of the IEEE, 2017.
|
| 226 |
+
[14] Mircea Cimpoi, Subhransu Maji, Iasonas Kokkinos, Sammy Mohamed, and Andrea Vedaldi. Describing textures in the wild. In CVPR, 2014.
|
| 227 |
+
[15] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009.
|
| 228 |
+
[16] Li Deng. The MNIST database of handwritten digit images for machine learning research. IEEE signal processing magazine, 2012.
|
| 229 |
+
[17] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
|
| 230 |
+
[18] Mohamed Elhoseiny, Babak Saleh, and Ahmed Elgammal. Write a classifier: Zero-shot learning using purely textual descriptions. In ICCV, 2013.
|
| 231 |
+
[19] Mohamed Elhoseiny, Yizhe Zhu, Han Zhang, and Ahmed Elgammal. Link the head to the “beak”: Zero shot learning from noisy text description at part precision. In CVPR, 2017.
|
| 232 |
+
[20] Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes (VOC) challenge. IJCV, 2010.
|
| 233 |
+
[21] Ali Farhadi, Ian Endres, Derek Hoiem, and David Forsyth. Describing objects by their attributes. In CVPR, 2009.
|
| 234 |
+
[22] Li Fei-Fei, Rob Fergus, and Pietro Perona. Learning generative visual models from few training examples: An incremental Bayesian approach tested on 101 object categories. In CVPR workshop, 2004.
|
| 235 |
+
[23] Rob Fergus, Hector Bernal, Yair Weiss, and Antonio Torralba. Semantic label sharing for learning with many categories. In ECCV, 2010.
|
| 236 |
+
[24] Jannik Fritsch, Tobias Kuehnl, and Andreas Geiger. A new performance measure and evaluation benchmark for road detection algorithms. In ITSC. IEEE, 2013.
|
| 237 |
+
[25] Andrea Frome, Greg S Corrado, Jon Shlens, Samy Bengio, Jeff Dean, Marc’Aurelio Ranzato, and Tomas Mikolov. Devise: A deep visual-semantic embedding model. NeurIPS, 2013.
|
| 238 |
+
[26] Yanwei Fu and Leonid Sigal. Semi-supervised vocabulary-informed learning. In CVPR, 2016.
|
| 239 |
+
[27] Robert Geirhos, Patricia Rubisch, Claudio Michaelis, Matthias Bethge, Felix A Wichmann, and Wieland Brendel. Imagenet-trained cnns are biased towards texture; increasing shape bias improves accuracy and robustness. arXiv preprint arXiv:1811.12231, 2018.
|
| 240 |
+
[28] Agrim Gupta, Piotr Dollar, and Ross Girshick. Lvis: A dataset for large vocabulary instance segmentation. In CVPR, 2019.
|
| 241 |
+
[29] Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. Realm: Retrievalaugmented language model pre-training. arXiv preprint arXiv:2002.08909, 2020.
|
| 242 |
+
[30] Weituo Hao, Chunyuan Li, Xiujun Li, Lawrence Carin, and Jianfeng Gao. Towards learning a generic agent for vision-and-language navigation via pre-training. In CVPR, 2020.
|
| 243 |
+
[31] Patrick Helber, Benjamin Bischke, Andreas Dengel, and Damian Borth. EuroSat: A novel dataset and deep learning benchmark for land use and land cover classification. IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing, 2019.
|
| 244 |
+
[32] Matthew Honnibal and Ines Montani. spaCy 2: Natural language understanding with Bloom embeddings, convolutional neural networks and incremental parsing. To appear, 2017.
|
| 245 |
+
[33] Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin De Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. Parameter-efficient transfer learning for nlp. In ICML, 2019.
|
| 246 |
+
[34] Drew A Hudson and Christopher D Manning. Gqa: A new dataset for real-world visual reasoning and compositional question answering. In CVPR, 2019.
|
| 247 |
+
[35] Dinesh Jayaraman and Kristen Grauman. Zero shot recognition with unreliable attributes. arXiv preprint arXiv:1409.4327, 2014.
|
| 248 |
+
[36] Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc V Le, Yunhsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. arXiv preprint arXiv:2102.05918, 2021.
|
| 249 |
+
[37] Douwe Kiela, Hamed Firooz, Aravind Mohan, Vedanuj Goswami, Amanpreet Singh, Pratik Ringshia, and Davide Testuggine. The hateful memes challenge: Detecting hate speech in multimodal memes. NeurIPS, 2020.
|
| 250 |
+
[38] Wonjae Kim, Bokyung Son, and Ildoo Kim. Vilt: Vision-and-language transformer without convolution or region supervision. arXiv preprint arXiv:2102.03334, 2021.
|
| 251 |
+
[39] Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (bit): General visual representation learning. In ECCV, 2020.
|
| 252 |
+
[40] Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3d object representations for fine-grained categorization. In ICCV workshops, 2013.
|
| 253 |
+
[41] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
|
| 254 |
+
[42] Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, et al. Natural questions: a benchmark for question answering research. TACL, 2019.
|
| 255 |
+
[43] Christoph H Lampert, Hannes Nickisch, and Stefan Harmeling. Learning to detect unseen object classes by between-class attribute transfer. In CVPR, 2009.
|
| 256 |
+
[44] Christoph H Lampert, Hannes Nickisch, and Stefan Harmeling. Attribute-based classification for zero-shot visual object categorization. PAMI, 2013.
|
| 257 |
+
[45] Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, et al. Retrieval-augmented generation for knowledge-intensive NLP tasks. NeurIPS, 2020.
|
| 258 |
+
[46] Ang Li, Allan Jabri, Armand Joulin, and Laurens Van Der Maaten. Learning visual n-grams from web data. In ICCV, 2017.
|
| 259 |
+
[47] Chunyuan Li, Haotian Liu, Liunian Harold Li, Pengchuan Zhang, Jyoti Aneja, Jianwei Yang, Ping Jin, Houdong Hu, Zicheng Liu, Yong Jae Lee, and Jianfeng Gao. ELEVATER: A benchmark and toolkit for evaluating language-augmented visual models. In NeurIPS Track on Datasets and Benchmarks, 2022.
|
| 260 |
+
[48] Junnan Li, Ramprasaath R Selvaraju, Akhilesh Deepak Gotmare, Shafiq Joty, Caiming Xiong, and Steven Hoi. Align before fuse: Vision and language representation learning with momentum distillation. arXiv preprint arXiv:2107.07651, 2021.
|
| 261 |
+
[49] Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, and Kai-Wei Chang. Visualbert: A simple and performant baseline for vision and language. arXiv preprint arXiv:1908.03557, 2019.
|
| 262 |
+
[50] Liunian Harold Li, Pengchuan Zhang, Haotian Zhang, Jianwei Yang, Chunyuan Li, Yiwu Zhong, Lijuan Wang, Lu Yuan, Lei Zhang, Jenq-Neng Hwang, et al. Grounded language-image pre-training. CVPR, 2022.
|
| 263 |
+
[51] Xiujun Li, Xi Yin, Chunyuan Li, Pengchuan Zhang, Xiaowei Hu, Lei Zhang, Lijuan Wang, Houdong Hu, Li Dong, Furu Wei, et al. Oscar: Object-semantics aligned pre-training for vision-language tasks. In ECCV, 2020.
|
| 264 |
+
[52] Yangguang Li, Feng Liang, Lichen Zhao, Yufeng Cui, Wanli Ouyang, Jing Shao, Fengwei Yu, and Junjie Yan. Supervision exists everywhere: A data efficient contrastive language-image pre-training paradigm. arXiv preprint arXiv:2110.05208, 2021.
|
| 265 |
+
[53] Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollár. Focal loss for dense object detection. In ICCV, 2017.
|
| 266 |
+
[54] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ECCV, 2014.
|
| 267 |
+
[55] Angli Liu, Jingfei Du, and Veselin Stoyanov. Knowledge-augmented language model and its application to unsupervised named-entity recognition. arXiv preprint arXiv:1904.04458, 2019.
|
| 268 |
+
[56] Weijie Liu, Peng Zhou, Zhe Zhao, Zhiruo Wang, Qi Ju, Haotang Deng, and Ping Wang. K-BERT: Enabling language representation with knowledge graph. In AAAI, 2020.
|
| 269 |
+
[57] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. ICCV, 2021.
|
| 270 |
+
[58] Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. arXiv preprint arXiv:1908.02265, 2019.
|
| 271 |
+
[59] Subhransu Maji, Esa Rahtu, Juho Kannala, Matthew Blaschko, and Andrea Vedaldi. Fine-grained visual classification of aircraft. arXiv preprint arXiv:1306.5151, 2013.
|
| 272 |
+
[60] Kenneth Marino, Xinlei Chen, Devi Parikh, Abhinav Gupta, and Marcus Rohrbach. Krisp: Integrating implicit and symbolic knowledge for open-domain knowledge-based VQA. In CVPR, 2021.
|
| 273 |
+
[61] Kenneth Marino, Mohammad Rastegari, Ali Farhadi, and Roozbeh Mottaghi. OK-VQA: A visual question answering benchmark requiring external knowledge. In CVPR, 2019.
|
| 274 |
+
[62] Christian M Meyer and Iryna Gurevych. Wiktionary: A new rival for expert-built lexicons? Exploring the possibilities of collaborative lexicography. na, 2012.
|
| 275 |
+
[63] George A Miller. WordNet: An electronic lexical database. MIT press, 1998.
|
| 276 |
+
[64] Norman Mu, Alexander Kirillov, David Wagner, and Saining Xie. Slip: Self-supervision meets languageimage pre-training. arXiv preprint arXiv:2112.12750, 2021.
|
| 277 |
+
[65] Maria-Elena Nilsback and Andrew Zisserman. Automated flower classification over a large number of classes. In Indian Conference on Computer Vision, Graphics & Image Processing. IEEE, 2008.
|
| 278 |
+
[66] Omkar M Parkhi, Andrea Vedaldi, Andrew Zisserman, and CV Jawahar. Cats and dogs. In CVPR, 2012.
|
| 279 |
+
[67] Genevieve Patterson and James Hays. SUN attribute database: Discovering, annotating, and recognizing scene attributes. In CVPR, 2012.
|
| 280 |
+
[68] Matthew E Peters, Mark Neumann, Robert L Logan IV, Roy Schwartz, Vidur Joshi, Sameer Singh, and Noah A Smith. Knowledge enhanced contextual word representations. arXiv preprint arXiv:1909.04164, 2019.
|
| 281 |
+
[69] Fabio Petroni, Aleksandra Piktus, Angela Fan, Patrick Lewis, Majid Yazdani, Nicola De Cao, James Thorne, Yacine Jernite, Vladimir Karpukhin, Jean Maillard, et al. KILT: a benchmark for knowledge intensive language tasks. arXiv preprint arXiv:2009.02252, 2020.
|
| 282 |
+
[70] Ruizhi Qiao, Lingqiao Liu, Chunhua Shen, and Anton Van Den Hengel. Less is more: zero-shot learning from online textual documents with noise suppression. In CVPR, 2016.
|
| 283 |
+
[71] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. arXiv preprint arXiv:2103.00020, 2021.
|
| 284 |
+
[72] Scott Reed, Zeynep Akata, Honglak Lee, and Bernt Schiele. Learning deep representations of fine-grained visual descriptions. In CVPR, 2016.
|
| 285 |
+
[73] Marcus Rohrbach, Michael Stark, and Bernt Schiele. Evaluating knowledge transfer and zero-shot learning in a large-scale setting. In CVPR, 2011.
|
| 286 |
+
[74] Ruslan Salakhutdinov, Antonio Torralba, and Josh Tenenbaum. Learning to share visual appearance for multiclass object detection. In CVPR, 2011.
|
| 287 |
+
[75] Shuai Shao, Zeming Li, Tianyuan Zhang, Chao Peng, Gang Yu, Xiangyu Zhang, Jing Li, and Jian Sun. Objects365: A large-scale, high-quality dataset for object detection. In ICCV, 2019.
|
| 288 |
+
[76] Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In ACL, 2018.
|
| 289 |
+
[77] Sheng Shen, Liunian Harold Li, Hao Tan, Mohit Bansal, Anna Rohrbach, Kai-Wei Chang, Zhewei Yao, and Kurt Keutzer. How much can clip benefit vision-and-language tasks? ICLR, 2022.
|
| 290 |
+
[78] Richard Socher, Milind Ganjoo, Christopher D Manning, and Andrew Ng. Zero-shot learning through cross-modal transfer. NeurIPS, 2013.
|
| 291 |
+
[79] Robyn Speer, Joshua Chin, and Catherine Havasi. Conceptnet 5.5: An open multilingual graph of general knowledge. In AAAI, 2017.
|
| 292 |
+
[80] Johannes Stallkamp, Marc Schlipsing, Jan Salmen, and Christian Igel. The german traffic sign recognition benchmark: a multi-class classification competition. In IJCNN, 2011.
|
| 293 |
+
[81] Weijie Su, Xizhou Zhu, Yue Cao, Bin Li, Lewei Lu, Furu Wei, and Jifeng Dai. Vl-bert: Pre-training of generic visual-linguistic representations. arXiv preprint arXiv:1908.08530, 2019.
|
| 294 |
+
[82] Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In ICCV, 2017.
|
| 295 |
+
[83] Hao Tan and Mohit Bansal. Lxmert: Learning cross-modality encoder representations from transformers. In EMNLP, 2019.
|
| 296 |
+
[84] Bart Thomee, David A Shamma, Gerald Friedland, Benjamin Elizalde, Karl Ni, Douglas Poland, Damian Borth, and Li-Jia Li. Yfcc100m: The new data in multimedia research. Communications of the ACM, 2016.
|
| 297 |
+
[85] Changyao Tian, Wenhai Wang, Xizhou Zhu, Xiaogang Wang, Jifeng Dai, and Yu Qiao. Vl-ltr: Learning class-wise visual-linguistic representation for long-tailed visual recognition. arXiv preprint arXiv:2111.13579, 2021.
|
| 298 |
+
[86] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, 2017.
|
| 299 |
+
[87] Bastiaan S Veeling, Jasper Linmans, Jim Winkens, Taco Cohen, and Max Welling. Rotation equivariant cnns for digital pathology. In MICCAI, 2018.
|
| 300 |
+
[88] Denny Vrandeciˇ c. Wikidata: A new platform for collaborative data collection. In ´ WWW, 2012.
|
| 301 |
+
[89] Catherine Wah, Steve Branson, Peter Welinder, Pietro Perona, and Serge Belongie. The caltech-ucsd birds-200-2011 dataset, 2011.
|
| 302 |
+
[90] Ruize Wang, Duyu Tang, Nan Duan, Zhongyu Wei, Xuanjing Huang, Guihong Cao, Daxin Jiang, Ming Zhou, et al. K-adapter: Infusing knowledge into pre-trained models with adapters. arXiv preprint arXiv:2002.01808, 2020.
|
| 303 |
+
[91] Xiaolong Wang, Yufei Ye, and Abhinav Gupta. Zero-shot recognition via semantic embeddings and knowledge graphs. In CVPR, 2018.
|
| 304 |
+
[92] Jason Weston, Samy Bengio, and Nicolas Usunier. Large scale image annotation: learning to rank with joint word-image embeddings. Machine learning, 2010.
|
| 305 |
+
[93] Jialin Wu, Jiasen Lu, Ashish Sabharwal, and Roozbeh Mottaghi. Multi-modal answer validation for knowledge-based VQA. arXiv preprint arXiv:2103.12248, 2021.
|
| 306 |
+
[94] Yongqin Xian, Christoph H Lampert, Bernt Schiele, and Zeynep Akata. Zero-shot learning—a comprehensive evaluation of the good, the bad and the ugly. PAMI, 2018.
|
| 307 |
+
[95] Jianwei Yang, Chunyuan Li, Pengchuan Zhang, Bin Xiao, Lu Yuan, Ce Liu, and Jianfeng Gao. Unified contrastive learning in image-text-label space. CVPR, 2022.
|
| 308 |
+
[96] Zhengyuan Yang, Zhe Gan, Jianfeng Wang, Xiaowei Hu, Yumao Lu, Zicheng Liu, and Lijuan Wang. An empirical study of GPT-3 for few-shot knowledge-based VQA. arXiv preprint arXiv:2109.05014, 2021.
|
| 309 |
+
[97] Lewei Yao, Runhui Huang, Lu Hou, Guansong Lu, Minzhe Niu, Hang Xu, Xiaodan Liang, Zhenguo Li, Xin Jiang, and Chunjing Xu. Filip: Fine-grained interactive language-image pre-training. arXiv preprint arXiv:2111.07783, 2021.
|
| 310 |
+
[98] Da Yin, Li Dong, Hao Cheng, Xiaodong Liu, Kai-Wei Chang, Furu Wei, and Jianfeng Gao. A survey of knowledge-intensive nlp with pre-trained language models. arXiv preprint arXiv:2202.08772, 2022.
|
| 311 |
+
[99] Fei Yu, Jiji Tang, Weichong Yin, Yu Sun, Hao Tian, Hua Wu, and Haifeng Wang. Ernie-vil: Knowledge enhanced vision-language representations through scene graph. arXiv preprint arXiv:2006.16934, 2020.
|
| 312 |
+
[100] Wenhao Yu, Chenguang Zhu, Yuwei Fang, Donghan Yu, Shuohang Wang, Yichong Xu, Michael Zeng, and Meng Jiang. Dict-bert: Enhancing language model pre-training with dictionary. arXiv preprint arXiv:2110.06490, 2021.
|
| 313 |
+
[101] Lu Yuan, Dongdong Chen, Yi-Ling Chen, Noel Codella, Xiyang Dai, Jianfeng Gao, Houdong Hu, Xuedong Huang, Boxin Li, Chunyuan Li, et al. Florence: A new foundation model for computer vision. arXiv preprint arXiv:2111.11432, 2021.
|
| 314 |
+
[102] Hongming Zhang, Daniel Khashabi, Yangqiu Song, and Dan Roth. Transomcs: From linguistic graphs to commonsense knowledge. arXiv preprint arXiv:2005.00206, 2020.
|
| 315 |
+
[103] Pengchuan Zhang, Xiujun Li, Xiaowei Hu, Jianwei Yang, Lei Zhang, Lijuan Wang, Yejin Choi, and Jianfeng Gao. Vinvl: Revisiting visual representations in vision-language models. In CVPR, 2021.
|
| 316 |
+
|
| 317 |
+
# Checklist
|
| 318 |
+
|
| 319 |
+
1. For all authors...
|
| 320 |
+
|
| 321 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 322 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 323 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] in Appendix
|
| 324 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 325 |
+
|
| 326 |
+
2. If you are including theoretical results...
|
| 327 |
+
|
| 328 |
+
(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
|
| 329 |
+
|
| 330 |
+
3. If you ran experiments...
|
| 331 |
+
|
| 332 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No]
|
| 333 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] in Appendix
|
| 334 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] in Table 3
|
| 335 |
+
(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] in Appendix
|
| 336 |
+
|
| 337 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 338 |
+
|
| 339 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 340 |
+
(b) Did you mention the license of the assets? [Yes] in Appendix
|
| 341 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 342 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 343 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 344 |
+
|
| 345 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 346 |
+
|
| 347 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 348 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 349 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
parse/dev/ktrw68Cmu9c/ktrw68Cmu9c.md
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CODET: CODE GENERATION WITH GENERATED TESTS
|
| 2 |
+
|
| 3 |
+
Bei Chen∗, Fengji Zhang∗, Anh Nguyen∗, Daoguang Zan, Zeqi Lin, Jian-Guang Lou, Weizhu Chen Microsoft Corporation {beichen, v-fengjzhang, anhnguyen, v-dazan, zeqi.lin, jlou, wzchen}@microsoft.com
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
The task of generating code solutions for a given programming problem can benefit from the use of pre-trained language models such as Codex, which can produce multiple diverse samples. However, a major challenge for this task is to select the most appropriate solution from the multiple samples generated by the pretrained language models. A natural way to evaluate the quality and correctness of a code solution is to run it against a set of test cases, but the manual creation of such test cases is often costly and time-consuming. In this paper, we propose a novel method, CODET, that leverages the same pre-trained language models to automatically generate test cases for the code samples, thus reducing the human effort and increasing the coverage of the test scenarios. CODET then executes the code samples using the generated test cases and performs a dual execution agreement, which considers both the consistency of the outputs against the generated test cases and the agreement of the outputs with other code samples. We conduct comprehensive experiments on four benchmarks, HumanEval, MBPP, APPS, and CodeContests, using five different pre-trained language models with varying sizes and capabilities. Our results show that CODET can significantly improve the performance of code solution selection over previous methods, achieving remarkable and consistent gains across different models and benchmarks. For instance, CODET improves the pass $@ 1$ metric on HumanEval to $6 5 . 8 \%$ , which represents an absolute improvement of $1 8 . 8 \%$ over the code-davinci-002 model, and an absolute improvement of more than $2 0 \%$ over the previous state-of-the-art results.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Despite the remarkable progress in pre-training techniques for code generation, selecting a single correct solution from multiple candidates generated by large language models remains a hard problem. For instance, Codex (Chen et al., 2021), a state-of-the-art pre-trained language model for code generation, can achieve a pass $@ 1 0 0$ (pass if one or more among 100 generated solutions for a given problem can pass the corresponding test cases) of $7 7 . 4 \%$ , but a pass $@ 1$ (correct rate of a single solution) of only $3 3 . 5 \%$ on the HumanEval benchmark (Chen et al., 2021)1. This huge gap limits the practical usefulness of code generation models and motivates us to explore how to pick the correct or best solution from multiple candidates.
|
| 12 |
+
|
| 13 |
+
A straightforward way to verify the correctness of a solution is to execute it and check if it passes all corresponding test cases. This execution-guided approach has been widely adopted in various code-related tasks, such as code generation (Chen et al., 2021; Li et al., 2022b; Shi et al., 2022), code translation (Roziere et al., 2021), and program synthesis (Chen et al., 2018; Ellis et al., 2019). However, this approach relies heavily on the quality and quantity of test cases, which are often costly and time-consuming to create and maintain. Moreover, in real-world applications like Copilot2, a code generation tool that assists developers in writing code, it is unrealistic to expect users to provide test cases for every problem they want to solve. Therefore, we propose to automatically generate test cases for arbitrary programming problems and use them to quickly verify any solution.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: The illustration of CODET. Both the code solutions and the test cases are generated by the pre-trained language model. The best code solution is then selected by a dual execution agreement.
|
| 17 |
+
|
| 18 |
+
In this paper, we propose CODET: CODE generation with generated Test-driven dual execution agreement, as illustrated in Figure 1. First, we leverage the same pre-trained language model that generates code solutions, such as Codex, to generate a large number of test cases for each programming problem by providing an elaborate instruction as prompt. Next, we use a dual execution agreement approach inspired by the classical RANSAC algorithm (Fischler & Bolles, 1981). We execute each generated code solution on each generated test case, and iteratively find multiple groups of code solution and test case pairs. Each group, or consensus set, has solutions that pass the same test cases, indicating that they have the same functionality, even if they are different in implementation. We expect that a solution that passes more test cases is more correct, and that a solution that has more similar solutions, i.e., solutions in the same consensus set, is more consistent with the problem specification. So, we rank each consensus set by both the number of test cases and solutions in it, and choose the best solution from the highest-ranked consensus set.
|
| 19 |
+
|
| 20 |
+
Our method is simple and efficient, as it does not require any labelled data or additional rankers, but it achieves surprisingly exceptional performance. We evaluate our method on five different pre-trained language models for code generation: three OpenAI Codex models (Chen et al., 2021), INCODER (Fried et al., 2022), and CODEGEN (Nijkamp et al., 2022), as well as four established benchmarks for code generation: HumanEval (Chen et al., 2021), MBPP (Austin et al., 2021), APPS (Hendrycks et al., 2021), and CodeContests (Li et al., 2022b). The experimental results show that our method can effectively select the correct solution from multiple candidates, improving the pass $@ 1$ score significantly on all benchmarks in the zero-shot setting. For instance, CODET achieves improvements using code-davinci-002: HumanEval $( 4 7 . 0 \% \to 6 5 . 8 \%$ ), MBPP $( 5 8 . 1 \% 6 7 . 7 \% )$ , APPS INTRODUCTORY $( 2 7 . 2 \% \to 3 4 . 6 \% )$ , and CodeContests $( 0 . 7 \% 2 . 1 \%$ ). Moreover, when we combine code-davinci-002, the most powerful pre-trained model, and CODET, we outperform previous state-of-the-art methods by a large margin, e.g., HumanEval: $4 2 . 7 \%$ (Inala et al., 2022) $ 6 5 . 8 \%$ . We also conduct a thorough analysis to provide more insights. Our work is publicly available at https://github.com/microsoft/CodeT.
|
| 21 |
+
|
| 22 |
+
# 2 METHODOLOGY
|
| 23 |
+
|
| 24 |
+
The task of code generation is to solve a programming problem: generate code solution $x$ based on context c. As shown in Figure 2, context $c$ contains natural language problem description in the form of code comment, and a code snippet that includes statements such as imports and the function header. A code solution is a code snippet that solves the programming problem described in the context. Generally, we sample a set of code solutions, denoted as $\mathbf { X } = \left\{ x _ { 1 } , x _ { 2 } , \cdot \cdot \cdot , x _ { N } \right\}$ , based on the context $c$ using a pre-trained language model $\mathcal { M }$ , which can be formulated as $\mathbf { X } \doteq \mathcal { M } ( c )$ . Our goal is to select the best code solution $\hat { x }$ from the set of generated code solutions $\mathbf { X }$ , where $\hat { x }$ is the most likely solution to correctly solve the given programming problem. To this end, we propose CODET in the hope of unleashing the inherent power of the pre-trained language model $\mathcal { M }$ . Specifically, we use $\mathcal { M }$ to generate test cases for the programming problem (Section 2.1), and then select the best code solution $\hat { x }$ based on a dual execution agreement (Section 2.2).
|
| 25 |
+
|
| 26 |
+
# 2.1 TEST CASE GENERATION
|
| 27 |
+
|
| 28 |
+
Besides generating code solutions, we also need to generate test cases to evaluate the correctness of the code solutions. A test case is a pair of input and expected output for the function defined in the context. For example, in Figure 2, a test case for the programming problem of checking whether there exist close elements in a list less than a threshold. To generate test cases, we use the same pre-trained language model $\mathcal { M }$ that we use for generating code solutions, but we add an instruction $p$ to the context $c$ as a prompt to indicate that we want test cases instead of code solutions. As shown in Figure 2, the instruction $p$ consists of three parts: (1) a “pass” statement as a placeholder of the function body, which signals that we do not need to generate code for the function, (2) a comment “check the correctness of [entry point]” to clarify the intention of generating test cases, where “[entry point]” is the name of the function, and (3) an “assert” statement to start the test case generation, which specifies the format of the test cases as input-output pairs.
|
| 29 |
+
|
| 30 |
+

|
| 31 |
+
Figure 2: Code generation and test case generation: an example from the HumanEval benchmark. Example input-output cases are removed from the context.
|
| 32 |
+
|
| 33 |
+
We then feed the concatenated context and instruction, $\mathrm { c o n c a t } ( c , p )$ , to the language model $\mathcal { M }$ , and sample a set of test cases, denoted as $\mathbf { Y } = \{ y _ { 1 } , y _ { 2 } , \cdot \cdot \cdot , y _ { M } \}$ , from the model output. The process of test case generation can be formulated as $\mathbf { Y } = { \mathcal { M } } ( \mathrm { c o n c a t } ( c , p ) )$ . The language model will try to complete the instruction by generating plausible input-output pairs for the function. Note that we remove all example input-output cases from the context $c$ before generating code solutions and test cases, to avoid exposing real test cases to the language model.
|
| 34 |
+
|
| 35 |
+
# 2.2 DUAL EXECUTION AGREEMENT
|
| 36 |
+
|
| 37 |
+
In this subsection, we explain how we select the best code solution $\hat { x }$ from the set of generated code solutions $\textbf { X } = \{ x _ { 1 } , x _ { 2 } , \cdot \cdot \cdot , x _ { N } \}$ , using the set of generated test cases $\mathbf { Y } = \{ y _ { 1 } , y _ { 2 } , \cdot \cdot \cdot , y _ { M } \}$ as a criterion. We can execute a code solution $x$ on a test case $y$ , which means running the function defined by $x$ on the input part of $y$ and comparing the output with the output part of $y$ . If the code solution $x$ can be executed without errors and the output matches the expected output, then we say the code solution $x$ can pass the test case $y$ . Furthermore, we say there is a functionality agreement between two code solutions $x _ { i }$ and $x _ { j }$ if they can pass the same set of test cases in $\mathbf { Y }$ . Our approach is based on the following assumptions: (1) the code solutions and the test cases are independently and randomly sampled from the pre-trained language model $\mathcal { M }$ given a certain programming problem, and (2) incorrect code solutions are often diverse, and the probability of having a functionality agreement between two incorrect code solutions by chance is very low. These assumptions are similar to those of the classical RANSAC algorithm (Fischler & Bolles, 1981), which is a robust method for finding consensus among noisy data. Inspired by RANSAC, we propose our approach CODET to perform dual execution agreement, which is an iterative approach as follows:
|
| 38 |
+
|
| 39 |
+
• We randomly select a pair $( x , y )$ from the set of all possible pairs $\mathcal { D } = \{ ( x , y ) | x \in \mathbf { X } , y \in$ $\mathbf { Y } \}$ . We then try to execute the code solution $x$ on the test case $y$ . If $x$ can pass $y$ , then we say that the pair $( x , y )$ is a hypothetical inlier, because it hypothetically describes the correct functionality for the programming problem. Otherwise, we say that $( x , y )$ is an outlier, because it fails to describe the correct functionality. Figure 3 shows a simple example of the programming problem “return the square of a number”. $( x _ { 1 } , y _ { 1 } )$ and $( x _ { 3 } , y _ { 2 } )$ are two of the hypothetical inliers, while $( x _ { 1 } , y _ { 4 } )$ and $( x _ { 3 } , y _ { 1 } )$ are two of the outliers. • If $( x , y )$ is a hypothetical inlier, we collect all other pairs from $\mathcal { D }$ that agree with this hypothetical inlier, forming a set $s$ called consensus set. To find the pairs that agree with $\bar { ( } x , y )$ , we first find all test cases that $x$ can pass, denoted as $\mathcal { S } _ { y }$ . Then, we find all code solutions that can pass exactly the same test cases as $x$ , denoted as $S _ { x }$ . Finally, the consensus set is the set of all pairs that consist of a code solution from $S _ { x }$ and a test case from $\mathcal { S } _ { y }$ , i.e., $\mathcal { S } \ = \ \{ ( x , y ) | x \ \in \ S _ { x } , y \ \in \ S _ { y } \}$ . For example in Figure 3, we can get ${ \mathcal { S } } _ { x } = \{ x _ { 1 } , x _ { 2 } \} , S _ { y } = \{ y _ { 1 } , y _ { 2 } , y _ { 3 } \}$ from the hypothetical inlier $( x _ { 1 } , y _ { 1 } )$ (shown in green box), and $S _ { x } = \{ x _ { 3 } \} , S _ { y } = \{ y _ { 2 } , y _ { 3 } , y _ { 4 } , y _ { 5 } \}$ from $( x _ { 3 } , y _ { 2 } )$ (shown in purple box).
|
| 40 |
+
|
| 41 |
+

|
| 42 |
+
Figure 3: A simple example of the programming problem “return the square of a number”. The gray line between $x$ and $y$ indicates that $x$ can pass $y$ , i.e., $( x , y )$ is a hypothetical inlier. The green or purple box indicates a consensus set.
|
| 43 |
+
|
| 44 |
+
Table 1: Statistics of benchmarks: the total number of problems in the benchmark (Problems), the average number of ground-truth test cases per problem (GT Tests), and the number of sampling code solutions for each problem $( n )$ .
|
| 45 |
+
|
| 46 |
+
<table><tr><td>Benchmark</td><td>Problems</td><td>GTTests</td><td>n</td></tr><tr><td>HumanEval</td><td>164</td><td>7.77</td><td>100</td></tr><tr><td>MBPP</td><td>427</td><td>3.1</td><td>100</td></tr><tr><td rowspan="4">INTRODUCTORY APPS INTERVIEW</td><td>1,000</td><td rowspan="4">20.99</td><td rowspan="4">50</td></tr><tr><td>3,000</td></tr><tr><td>1,000</td></tr><tr><td>165</td></tr></table>
|
| 47 |
+
|
| 48 |
+
• We score the consensus set as $f ( S ) = | S _ { x } | | S _ { y } |$ , where $| S _ { x } |$ is the number of code solutions in $S _ { x }$ and $| S _ { y } |$ is the number of test cases in $\mathcal { S } _ { y }$ . This score is equal to the number of pairs in the consensus set. The intuition is that the more pairs that agree with the hypothetical functionality, the more likely this functionality is correct, according to our assumptions. Following the example in Figure 3, the consensus set scores are 6 and 4 for the hypothetical inliers $( x _ { 1 } , y _ { 1 } )$ and $( x _ { 3 } , y _ { 2 } )$ , respectively.
|
| 49 |
+
|
| 50 |
+
We repeat the above procedure for a fixed number of times, each time producing a consensus set with its score. Finally, we get the best code solution $\hat { x }$ by selecting any code solution from the consensus set with the highest score. If we want to obtain $k$ code solutions, we can select the top $k$ consensus sets with the highest scores, and one code solution is picked up from each of the $k$ consensus sets.
|
| 51 |
+
|
| 52 |
+
In practice, when the number of code solutions in $\mathcal { D }$ is not large, we can simplify the above method by examining all possible pairs in $\mathcal { D }$ , instead of sampling pairs from $\mathcal { D }$ . Specially, for each code solution $x \in \mathbf { X }$ , we run it with every test case in $\mathbf { Y }$ and keep track of which test cases it passes. We group together code solutions that pass the same test cases, because they have the same functionality. This way, we divide all code solutions in $\mathbf { X }$ into groups based on their functionality, which we write as $\mathbf { X } = \left\{ \mathcal { S } _ { x } ^ { 1 } , \mathcal { S } _ { x } ^ { 2 } , \cdot \cdot \cdot , \mathcal { S } _ { x } ^ { K } \right\}$ , where $K$ is the number of code solution groups. Each group $S _ { x }$ has a set of test cases that it passes, which we write as $\mathcal { S } _ { y }$ . Then, we get $K$ consensus sets, each of which has the form $\mathcal { S } = \{ ( \bar { x , y } ) | x \in \mathcal { S } _ { x } , y \in \mathcal { S } _ { y } \}$ . We can score each consensus set by $f ( S ) = | S _ { x } | | S _ { y } |$ , as before. This naive version captures the same underline intuition, but it finds all consensus sets right away, without sampling pairs repeatedly.
|
| 53 |
+
|
| 54 |
+
# 3 EXPERIMENTAL SETUP
|
| 55 |
+
|
| 56 |
+
Models Our experiments are based on Codex (Chen et al., 2021), INCODER (Fried et al., 2022) and CODEGEN (Nijkamp et al., 2022). Codex is a descendant of GPT-3 (Brown et al., 2020) and proficient in understanding the provided context and generating functional programs. We use three Codex models with different capabilities provided by OpenAI: code-cushman-001, code-davinci001, and code-davinci-002. INCODER is a unified generative model that can perform left-to-right code generation and code infilling, while CODEGEN is a family of large-scale language models to perform conversational program synthesis. We take use of the INCODER 6.7B version (INCODER6B) and the CODEGEN 16B Python mono-lingual version (CODEGEN-MONO-16B).
|
| 57 |
+
|
| 58 |
+
Metrics and Baseline We use the metric pass $@ k$ (with $n$ samples) for performance evaluation and take advantage of ground truth test cases to determine the functional correctness of code solutions. For each problem, we sample $n$ code solutions and then select $k$ of them for evaluation. If any of the $k$ code solutions passes all ground truth test cases, the problem is considered solved. Then pass $@ k$ is the percentage of solved problems. We use the unbiased definition of pass $@ k$ as our baseline (Chen et al., 2021), where $k$ solutions are randomly picked from $n$ samples. Our CodeT uses a dual execution agreement mechanism to select $k$ solutions from $n$ samples, as mentioned in 2.2. In addition, we include a clustering method from Li et al. (2022b) for comparison, denoted as AlphaCode-C. Our replication is to use the test inputs generated by CODET, run the solutions on the test inputs, group the solutions by test outputs, and rank the clusters by size (details in Appendix I).
|
| 59 |
+
|
| 60 |
+
Table 2: Pass $@ k$ $( \% )$ on the HumanEval and MBPP benchmarks. AlphaCode-C is our replication of the clustering method in Li et al. (2022b). The numbers in red indicate the absolute improvements of CODET over baseline on pass $@ 1$ and pass $@ 1 0$ . We also list the baseline results from Fried et al. (2022) and Nijkamp et al. (2022) for reference in gray, where the settings of context are not exactly the same as ours. For CODET, temperature is set to 0.8 and sampling number is set to 100. We do not show CODET pass $@ 1 0 0$ , since it is the same as the baseline pass $@ 1 0 0$ .
|
| 61 |
+
|
| 62 |
+
<table><tr><td>Methods</td><td colspan="3">Baseline</td><td colspan="3">AlphaCode-C</td><td colspan="3">CODET</td></tr><tr><td>k</td><td>1</td><td>10</td><td>100</td><td>1</td><td>2</td><td>10</td><td>1</td><td>2</td><td>10</td></tr><tr><td colspan="10">HumanEval</td></tr><tr><td>code-cushman-001</td><td>33.5</td><td>54.3</td><td>77.4</td><td>39.6</td><td>46.4</td><td>63.8</td><td> 44.5 11.0</td><td>50.1</td><td> 65.7 11.4</td></tr><tr><td>code-davinci-001</td><td>39.0</td><td>60.6</td><td>84.1</td><td>41.6</td><td>50.7</td><td>75.6</td><td>50.2 11.2</td><td>58.9</td><td>75.8 15.2</td></tr><tr><td>code-davinci-002</td><td>47.0</td><td>74.9</td><td>92.1</td><td>55.1</td><td>64.1</td><td>84.4</td><td>65.8 18.8</td><td>75.1</td><td>86.6 11.7</td></tr><tr><td>INCODER-6B</td><td>16.4 15.2</td><td>28.3 27.8</td><td>47.5 47.0</td><td>17.7</td><td>23.8</td><td>34.8</td><td>20.6 4.2</td><td>27.6</td><td>37.1 8.8</td></tr><tr><td>CODEGEN-MONO-16B</td><td>29.7 29.3</td><td>50.349.9</td><td>73.7 75.0</td><td>27.3</td><td>38.5</td><td>64.4</td><td>36.7 7.0</td><td>44.7</td><td>59.3 9.0</td></tr><tr><td colspan="10">MBPP</td></tr><tr><td>code-cushman-001</td><td>45.9</td><td>66.9</td><td>79.9</td><td>51.5</td><td>59.0</td><td>73.3</td><td> 55.4 9.5</td><td>61.7</td><td>72.7 5.8</td></tr><tr><td>code-davinci-001</td><td>51.8</td><td>72.8</td><td>84.1</td><td>56.2</td><td>64.7</td><td>78.8</td><td>61.9 10.1</td><td>69.1</td><td>79.3 6.5</td></tr><tr><td>code-davinci-002</td><td>58.1</td><td>76.7</td><td>84.5</td><td>62.0</td><td>70.7</td><td>79.9</td><td>67.7 9.6</td><td>74.6</td><td>81.5 4.8</td></tr><tr><td>INCODER-6B</td><td>21.3 19.4</td><td>46.5</td><td>66.2</td><td>26.7</td><td>35.3</td><td>56.2</td><td>34.4 13.1</td><td>43.9</td><td>58.2 11.7</td></tr><tr><td>CODEGEN-MONO-16B</td><td>42.4</td><td>65.8</td><td>79.1</td><td>41.0</td><td>55.9</td><td>73.6</td><td>49.5 7.1</td><td>56.6</td><td>68.5 2.7</td></tr></table>
|
| 63 |
+
|
| 64 |
+
Benchmarks We conduct experiments on four public code generation benchmarks in the zeroshot setting. The statistics of benchmarks are shown in Table 1. (1) HumanEval (Chen et al., 2021) consists of hand-written Python programming problems. The original contexts include example input-output cases, which are removed in our experiments to avoid exposing real test cases. The experiment in Appendix B shows that this removal operation is reasonable and indispensable. (2) MBPP (Austin et al., 2021) (sanitized version) contains crowd-sourced Python programming problems, and we follow HumanEval to construct the context for it. (3) APPS (Hendrycks et al., 2021) consists of coding problems collected from open-access coding websites, which have different difficulty levels. (4) CodeContests (Li et al., 2022b) includes competitive programming problems scraped from the Codeforces platform. To enable zero-shot inference, we construct the context for APPS and CodeContests as follows: the original problem description is treated as a comment where input-output examples are removed, and a simple function header “def solution(stdin : str) str :” is placed after the comment to accommodate the input/output data format. More implementation details can be found in Appendix A.
|
| 65 |
+
|
| 66 |
+
# 4 EXPERIMENTAL RESULTS
|
| 67 |
+
|
| 68 |
+
In this section, we evaluate CODET on five different pre-trained models and four benchmarks to verify its effectiveness, followed by test case analysis and case studies to provide more insights.
|
| 69 |
+
|
| 70 |
+
# 4.1 RESULTS ON HUMANEVAL AND MBPP
|
| 71 |
+
|
| 72 |
+
The experimental results of various models on the HumanEval and MBPP benchmarks are summarized in Table 2. If we compare the pass $@ 1 0 0$ to pass $@ 1$ on the Baseline column, it is clear that the former is significantly better than the latter, indicating the potential to select the best code solution from the 100 generated samples.
|
| 73 |
+
|
| 74 |
+
For three Codex models, when we compare the CODET column with the Baseline column, CODET pass $@ 1$ achieves an absolute improvement of about $1 0 \%$ over the baseline pass $@ 1$ . The improvements are consistently above $1 0 \%$ on HumanEval. Surprisingly, even for the strongest baseline, code-davinci-002, the improvement is $1 8 . 8 \%$ , boosting the pass $@ 1$ to $6 5 . 8 \%$ , which is a $2 0 + \%$ absolute improvement over the best previously reported results (Inala et al., 2022). We attribute this larger improvement to the higher quality of test cases generated by code-davinci-002, providing a deeper analysis in Section 4.3. CODET also achieves exceptional performance on the MBPP benchmark, although the magnitude of the improvements is slightly less than that of HumanEval. Using the code-davinci-002 as an example, the pass $@ 1$ improves by $9 . 6 \%$ . We also report pass $@ 2$ and pass $@ 1 0$ of CODET to further show its superiority. The pass $@ 2$ results of CODET are close to the baseline pass $@ 1 0$ results. Meanwhile, the improvements on pass $@ 1 0$ are also consistently over $1 0 \%$ on the HumanEval benchmark.
|
| 75 |
+
|
| 76 |
+
Table 3: Pass $@ k$ $( \% )$ results on the APPS and CodeContests benchmarks using code-davinci-002 in the zero-shot setting. The numbers in red indicate the absolute improvements of CODET over baseline on pass $@ 1$ , pass $@ 1 0$ and pass $@ 1 0 0$ . For CODET, temperature is set to 0.8 and sampling number is set to 50 for APPS and 1, 000 for CodeContests.
|
| 77 |
+
|
| 78 |
+
<table><tr><td colspan="2">Methods</td><td colspan="5">Baseline</td><td colspan="4">CODET</td></tr><tr><td colspan="2">k</td><td></td><td>10</td><td>50</td><td>100</td><td>1000</td><td>1</td><td>2</td><td>10</td><td>100</td></tr><tr><td rowspan="3">APPS</td><td>INTRODUCTORY</td><td>27.2</td><td>46.6</td><td>59.4</td><td>-</td><td>1</td><td>34.6 7.4</td><td>41.2</td><td>53.2 6.6</td><td></td></tr><tr><td>INTERVIEW</td><td>5.1</td><td>12.8</td><td>23.0</td><td>1</td><td>=</td><td>8.1 3.0</td><td>11.2</td><td>18.1 5.3</td><td></td></tr><tr><td>COMPETITION</td><td>1.8</td><td>4.9</td><td>12.1</td><td>-</td><td>-</td><td>2.2 0.4</td><td>4.1</td><td>8.6 3.7</td><td></td></tr><tr><td colspan="2">CodeContests</td><td>0.7</td><td>3.0</td><td>5.7</td><td>7.5</td><td>13.9</td><td>2.1 1.4</td><td>2.3</td><td>5.3 2.3</td><td>9.9 2.4</td></tr></table>
|
| 79 |
+
|
| 80 |
+
The experimental results of INCODER-6B and CODEGEN-MONO-16B further verify the effectiveness of CODET. It is obvious CODET can significantly improve the pass $@ 1$ , with absolute improvements in the range of $4 . 2 \%$ to $1 3 . 1 \%$ . INCODER-6B achieves the greatest improvement with a gain of $1 3 . 1 \%$ on the MBPP benchmark. Similar to the experimental results of Codex, the pass $@ 2$ results are close to the baseline pass $@ 1 0$ . All the results demonstrate that CODET can boost the performance of various pre-trained language models consistently.
|
| 81 |
+
|
| 82 |
+
As for AlphaCode-C, it is consistently inferior to CODET on both benchmarks using different models, demonstrating the superiority of our dual execution agreement that takes test case information into consideration. In addition, we notice that duplication exists in the generated code solutions and test cases. We perform an ablation study in Appendix $\mathbf { D }$ to show that de-duplication has little influence on the results of CODET. Moreover, we discuss the sensitivity of CODET to the temperature in Appendix E, showing the rationality of choosing a rather high temperature at 0.8.
|
| 83 |
+
|
| 84 |
+
# 4.2 RESULTS ON APPS AND CODECONTESTS
|
| 85 |
+
|
| 86 |
+
We also conduct experiments on two more challenging benchmarks, APPS and CodeContests. We build the zero-shot versions of APPS and CodeContests to be in line with our setting of HumanEval and MBPP by removing the example input-output cases in the problem descriptions. We employ code-davinci-002 for code solution and test case generation. The sampling number is set to 50 for APPS to save computation cost on the 5, 000 testing problems, while for CodeContests, following Li et al. (2022b), the sampling number is set to $1 , 0 0 0$ to solve especially hard problems. From the results summarized in Table 3, we can clearly observe the consistent performance improvements on both benchmarks using CODET. The absolute pass $@ 1$ improvement is $7 . 4 \%$ for introductory problems in APPS, while the improvements are not significant for competition level problems in APPS and CodeContest, indicating their difficulties. In addition, we notice that code-davinci-002 may generate many trivial code solutions for the problems in APPS and CodeContests due to the superior difficulty of these two benchmarks. We perform a comprehensive study in Appendix F to demonstrate the robustness of CODET to this issue. Inspired by Chen et al. (2021) and Li et al. (2022b), we also conduct experiments in the one-shot setting, which is detailed in Appendix G.
|
| 87 |
+
|
| 88 |
+
# 4.3 ANALYSIS ON TEST CASES
|
| 89 |
+
|
| 90 |
+
The test cases are vital to CODET since the core idea is based on test-driven execution agreement.
|
| 91 |
+
Hence, in this subsection, we analyze the test cases by answering the following research questions.
|
| 92 |
+
|
| 93 |
+

|
| 94 |
+
Figure 4: The distributions of (a) test case accuracy and (b) toxicity rate for each problem on HumanEval. Test cases are of better quality if they have higher accuracy and lower toxicity rate.
|
| 95 |
+
|
| 96 |
+
<table><tr><td>Benchmarks</td><td colspan="3">HumanEval</td><td colspan="3">MBPP</td></tr><tr><td>k</td><td>1</td><td>2</td><td>10</td><td>1</td><td>2</td><td>10</td></tr><tr><td>code-cushman-001</td><td>47.1 2.6</td><td>58.6 8.5</td><td>71.2 5.5</td><td>59.7 4.3</td><td>64.8 3.1</td><td>75.5 2.8</td></tr><tr><td>code-davinci-001</td><td>52.0 1.8</td><td>62.9 4.0</td><td>78.1 2.3</td><td>64.3 2.4</td><td>71.7 2.6</td><td>80.5 1.2</td></tr><tr><td>INCODER-6B</td><td>26.8 6.2</td><td>30.4 2.8</td><td>40.8 3.7</td><td>50.3 15.9</td><td>55.4 11.5</td><td>64.5 6.3</td></tr><tr><td>CODEGEN-MONO-16B</td><td>47.7 11.0</td><td>54.9 10.2</td><td>71.0 11.7</td><td>60.0 10.5</td><td>67.6 11.0</td><td>76.5 8.0</td></tr></table>
|
| 97 |
+
|
| 98 |
+
Table 4: Pass $@ k$ $( \% )$ on the HumanEval and MBPP benchmarks with code-cushman-001, codedavinci-001, INCODER, and CODEGEN using the test cases generated by code-davinci-002. The numbers in orange indicate the absolute improvements of pass $@ k$ using code-davinci-002 test cases over that using their own generated test cases.
|
| 99 |
+
|
| 100 |
+
# Q1. What is the quality of the generated test cases?
|
| 101 |
+
|
| 102 |
+
We evaluate the correctness of the generated test cases using the canonical solutions. A test case is considered correct if the canonical solution can pass it. Figure 4a summarizes the distributions of test case accuracy on HumanEval, where the horizontal axis represents the accuracy value for each problem and the vertical axis represents the probability density of problems with the corresponding accuracy value. We can see that the test cases generated by Codex models are of much higher accuracy than CODEGEN/INCODER. Besides accuracy, we also introduce the test case toxicity rate as a measurement of quality. We consider a test case to be “toxic” if any generated code solution can pass it while the canonical solution cannot. Toxic test cases may hinder the scoring of consensus sets and lead to the failure of CODET. As shown in Figure 4b, we can find that the toxicity rate highly correlates to the test case accuracy with respect to different models, where the proportions of toxic test cases for Codex models are smaller than CODEGEN/INCODER. We also evaluate the code coverage of generated test cases using two coverage criteria in Appendix H.2, where Codex models still outperform CODEGEN/INCODER with an average coverage of over $9 5 \%$ . Comparing the test case quality and the performance of CODET shown in Table 2, we can find that the quality of test cases strongly correlates to the performance gain using CODET concerning different models.
|
| 103 |
+
|
| 104 |
+
# Q2. Can better test cases further boost the performance of mediocre models?
|
| 105 |
+
|
| 106 |
+
From the above discussion with Figure 4, we can find that code-davinci-002 is the most capable model for generating high-quality test cases. Hence, we conduct an experiment to boost the performance of the other four models (code-cushman-001, code-davinci-001, INCODER, and CODEGEN) using test cases generated by code-davinci-002. Table 4 summarizes the performance gain with respect to different models on the HumanEval and MBPP benchmarks. In general, using the test cases generated by code-davinci-002 has significantly better performance than using the test cases generated by the less capable models themselves. For code-cushman-001 and code-davinci-001, the absolute improvements are in the range of $1 . 8 \%$ to $4 . 3 \%$ on pass $@ 1$ , while for INCODER and CODEGEN, the range is from $6 . 2 \%$ to $1 5 . { \bar { 9 } } \%$ . The above results indicate that the correct code solutions generated by mediocre models can be further exploited by adopting better test cases.
|
| 107 |
+
|
| 108 |
+

|
| 109 |
+
Figure 5: Two real cases from the HumanEval benchmark with CODET and code-cushman-001.
|
| 110 |
+
|
| 111 |
+
Q3. How effective is CODET when there are fewer test cases?
|
| 112 |
+
Table 5: Pass $@ 1$ $( \% )$ on HumanEval using CODET and code-davinci-002 with different numbers of test cases. Sampling Number denotes the number of samples generated by model, and Limit denotes the test cases extracted per sample.
|
| 113 |
+
|
| 114 |
+
<table><tr><td rowspan="2">Limit</td><td colspan="4">Sampling Number</td></tr><tr><td>10</td><td>20</td><td>50</td><td>100</td></tr><tr><td>1</td><td>56.5</td><td>57.5</td><td>60.7</td><td>62.4</td></tr><tr><td>2</td><td>62.2</td><td>62.8</td><td>63.2</td><td>63.6</td></tr><tr><td>3</td><td>62.9</td><td>63.2</td><td>65.5</td><td>65.0</td></tr><tr><td>4</td><td>64.1</td><td>64.5</td><td>65.7</td><td>65.0</td></tr><tr><td>5</td><td>63.9</td><td>64.2</td><td>65.2</td><td>65.8</td></tr></table>
|
| 115 |
+
|
| 116 |
+
When generating test cases for the HumanEval benchmark, we sample 100 times for each problem and each sample may include multiple assertion statements (i.e., test cases), denoted as Sampling Number $= 1 0 0$ . Then we extract the first 5 syntactically correct test cases from each sample, denoted as $L i m i t = 5$ . This means each problem is equipped with 500 test cases at most. The actual numbers of extracted test cases are summarized in Appendix H.1. We perform an ablation study on the number of test cases by decreasing Sampling Number and Limit. As shown in Table 5, we can conclude that using more test cases in CODET could generally lead to better performance, while the performance gap narrows when Sampling Number $\geq 5 0$ and $L i m i t \ge 3$ . Moreover, CODET improves the pass $@ 1$ by $9 . 5 \%$ with only 10 test cases using code-davinci-002, suggesting the high test case efficiency. We can use a smaller Sampling Number in real-world application to balance the performance and computation cost. More results can be found in Appendix H.3.
|
| 117 |
+
|
| 118 |
+
# 4.4 CASE STUDY
|
| 119 |
+
|
| 120 |
+
In CODET, we design the dual execution agreement based on the idea that a good code solution can pass the most test cases and agree with the most solutions of the same functionality. We use “dual” because both the code solutions and the test cases are critical. Figure 5a shows a case from the HumanEval benchmark using code-cushman-001. The highest scoring consensus set has the correct functionality that returns true if all numbers in the list are below threshold $t$ , while the consensus set ranked 2 does not understand the boundary condition exactly. The solutions in the second consensus set can pass more test cases (i.e., 226) than that in the first consensus set (i.e., 218). However, considering both code solutions and test cases, CODET can successfully rank the consensus sets and find the correct solutions. Such cases are not rare, suggesting that our design of the dual execution agreement is reasonable. For further statistical demonstration, we conduct an ablation study to score the consensus set by considering only the number of code solutions or test cases. The results again support our claim, as detailed in Appendix I.
|
| 121 |
+
|
| 122 |
+
CODET is empowered by the pre-trained language models, but is also limited by them. Therefore, the second assumption made in Section 2.2 does not always hold, leading to error cases where the correct code solution is generated, but not in the top 1 consensus set. For CODET with codecushman-001 on the HumanEval benchmark, we find 53 out of 164 programming problems that belong to this situation. We manually investigated these problems and found that $2 0 \%$ of them can be blamed on issues such as ambiguous problem descriptions, uncovered corner cases, and lack of import statements, while the remaining problems are attributed to the failure of the model to understand the problem descriptions. Figure 5b shows an error case caused by ambiguity. The correct understanding of the description “sum(first index value, last index value)” is to add the first and last values, while the code solutions that sum all values from the first to the last are ranked top 1. More real cases can be found in Appendix J. And hope the error analysis can provide inspiration for future studies on improving code generation for more difficult programming problems.
|
| 123 |
+
|
| 124 |
+
# 5 RELATED WORK
|
| 125 |
+
|
| 126 |
+
Code Generation with Large Models Recently, a number of large pre-trained language models have been proposed for code generation. Benefiting from billions of trainable parameters and massive publicly available source code, models could achieve surprisingly good performance. For instance, AlphaCode (Li et al., 2022b) claimed to have outperformed half of the human competitors in real-world programming competitions, and Codex (Chen et al., 2021) is empowering Copilot to provide real-time coding suggestions. Other open-source code generation models include GPTNeo (Black et al., 2021), GPT-J (Wang & Komatsuzaki, 2021), CodeParrot (Tunstall et al., 2022), PolyCoder (Xu et al., 2022), CODEGEN (Nijkamp et al., 2022), and INCODER (Fried et al., 2022). In our study, we take advantage of the Codex inference API provided by OpenAI as well as the two competitive open-source models CODEGEN and INCODER to perform zero-shot code generation.
|
| 127 |
+
|
| 128 |
+
Automatic Test Case Generation Automated test case generation for programming problems can reduce the effort of writing test cases manually by developers. Early works including Randoop (Pacheco et al., 2007), EvoSuite (Fraser & Arcuri, 2011), MOSA (Panichella et al., 2015), DynaMOSA (Panichella et al., 2017), and MIO (Arcuri, 2017), were proposed to automatically generate test cases for statically typed programming languages like Java. The later proposed Pynguin (Lukasczyk & Fraser, 2022) could handle dynamically typed language like Python. Nevertheless, they are all search-based heuristics methods, which have limitations to the diversity and quantity of generated test cases. To combat these limitations, recently proposed approaches (Tufano et al., 2020; Li et al., 2022b) leveraged pre-trained language models like BART (Lewis et al., 2019) and T5 (Raffel et al., 2020) fine-tuned on labelled data for test case generation. Unlike previous works that require heuristic rules or model training, we directly sample test cases from powerful code generation models like Codex in the zero-shot setting with elaborate prompts.
|
| 129 |
+
|
| 130 |
+
Code Selection from Multiple Samples Despite large models have achieved great performance in code generation, the models need to sample many times to find the correct answer. Recently, several approaches were proposed to tackle this issue. In the domain of solving math word problems, Cobbe et al. (2021) chose the one with highest rank by a trained verifier, and Shen et al. (2021) proposed to jointly train the generator and ranker through a multi-task framework. In the domain of general purpose code generation, Inala et al. (2022) trained a fault-aware ranker. Moreover, some work has been proposed to leverage the execution information (Shi et al., 2022; Li et al., 2022b; Le et al., 2022; Lahiri et al., 2022). Unlike previous works that require model training or pre-existing test cases or user interactions, we let the large models generate test cases for themselves and automatically rank the solutions based on the test-driven dual execution agreement. The idea of ranking based on agreement also appears in the domain of reasoning (Wang et al., 2022; Li et al., 2022a).
|
| 131 |
+
|
| 132 |
+
# 6 CONCLUSION AND FUTURE WORK
|
| 133 |
+
|
| 134 |
+
In this paper, we propose a simple yet effective approach, called CODET, leveraging pre-trained language models to generate both the code solutions and the test cases. CODET executes the code solutions using the test cases and chooses the best solution based on the dual execution agreement. We demonstrate the dual agreement with both the test cases and other solutions is critical to the success of CODET, perform a thorough analysis on the quality of generated test cases and their impact on CODET, and study cases to provide more insights. Experimental results clearly demonstrate the superiority of CODET, improving the pass $@ 1$ numbers significantly on various benchmarks. While there remain challenges that CODET only works for executable code generation and it introduces extra computation cost for test case generation. In future work, we will explore the ways to tackle these challenges and improve CODET to solve more difficult programming problems.
|
| 135 |
+
|
| 136 |
+
# ACKNOWLEDGEMENT
|
| 137 |
+
|
| 138 |
+
We would like to thank Davis Mueller and Jade Huang for proofreading the paper and providing valuable comments. We also sincerely thank all the anonymous reviewers for their constructive feedback and insightful comments.
|
| 139 |
+
|
| 140 |
+
# REFERENCES
|
| 141 |
+
|
| 142 |
+
Andrea Arcuri. Many independent objective (MIO) algorithm for test suite generation. In International symposium on search based software engineering, pp. 3–17. Springer, 2017.
|
| 143 |
+
|
| 144 |
+
Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, et al. Program synthesis with large language models. arXiv preprint arXiv:2108.07732, 2021.
|
| 145 |
+
|
| 146 |
+
Sid Black, Leo Gao, Phil Wang, Connor Leahy, and Stella Biderman. GPT-Neo: Large scale autoregressive language modeling with mesh-tensorflow. 2021.
|
| 147 |
+
|
| 148 |
+
Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
|
| 149 |
+
|
| 150 |
+
Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021.
|
| 151 |
+
|
| 152 |
+
Xinyun Chen, Chang Liu, and Dawn Song. Execution-guided neural program synthesis. In International Conference on Learning Representations, 2018.
|
| 153 |
+
|
| 154 |
+
Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021.
|
| 155 |
+
|
| 156 |
+
Kevin Ellis, Maxwell Nye, Yewen Pu, Felix Sosa, Josh Tenenbaum, and Armando Solar-Lezama. Write, execute, assess: Program synthesis with a repl. Advances in Neural Information Processing Systems, 32, 2019.
|
| 157 |
+
|
| 158 |
+
Martin A Fischler and Robert C Bolles. Random sample consensus: a paradigm for model fitting with applications to image analysis and automated cartography. Communications of the ACM, 24 (6):381–395, 1981.
|
| 159 |
+
|
| 160 |
+
Gordon Fraser and Andrea Arcuri. EvoSuite: automatic test suite generation for object-oriented software. In Proceedings of the 19th ACM SIGSOFT symposium and the 13th European conference on Foundations of software engineering, pp. 416–419, 2011.
|
| 161 |
+
|
| 162 |
+
Daniel Fried, Armen Aghajanyan, Jessy Lin, Sida Wang, Eric Wallace, Freda Shi, Ruiqi Zhong, Wen-tau Yih, Luke Zettlemoyer, and Mike Lewis. Incoder: A generative model for code infilling and synthesis. arXiv preprint arXiv:2204.05999, 2022.
|
| 163 |
+
|
| 164 |
+
Dan Hendrycks, Steven Basart, Saurav Kadavath, Mantas Mazeika, Akul Arora, Ethan Guo, Collin Burns, Samir Puranik, Horace He, Dawn Song, et al. Measuring coding challenge competence with apps. arXiv preprint arXiv:2105.09938, 2021.
|
| 165 |
+
|
| 166 |
+
Jeevana Priya Inala, Chenglong Wang, Mei Yang, Andres Codas, Mark Encarnacion, Shuvendu K ´ Lahiri, Madanlal Musuvathi, and Jianfeng Gao. Fault-aware neural code rankers. arXiv preprint arXiv:2206.03865, 2022.
|
| 167 |
+
|
| 168 |
+
Shuvendu K. Lahiri, Aaditya Naik, Georgios Sakkas, Piali Choudhury, Curtis von Veh, Madanlal Musuvathi, Jeevana Priya Inala, Chenglong Wang, and Jianfeng Gao. Interactive code generation via test-driven user-intent formalization, 2022.
|
| 169 |
+
|
| 170 |
+
Hung Le, Yue Wang, Akhilesh Deepak Gotmare, Silvio Savarese, and Steven CH Hoi. CodeRL: Mastering code generation through pretrained models and deep reinforcement learning. arXiv preprint arXiv:2207.01780, 2022.
|
| 171 |
+
Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. Bart: Denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. arXiv preprint arXiv:1910.13461, 2019.
|
| 172 |
+
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 preprint arXiv:2206.02336, 2022a.
|
| 173 |
+
Yujia Li, David Choi, Junyoung Chung, Nate Kushman, Julian Schrittwieser, Remi Leblond, Tom ´ Eccles, James Keeling, Felix Gimeno, Agustin Dal Lago, et al. Competition-level code generation with alphacode. arXiv preprint arXiv:2203.07814, 2022b.
|
| 174 |
+
Stephan Lukasczyk and Gordon Fraser. Pynguin: Automated unit test generation for python. arXiv preprint arXiv:2202.05218, 2022.
|
| 175 |
+
Erik Nijkamp, Bo Pang, Hiroaki Hayashi, Lifu Tu, Huan Wang, Yingbo Zhou, Silvio Savarese, and Caiming Xiong. Codegen: An open large language model for code with multi-turn program synthesis. arXiv preprint arXiv:2203.13474, 2022.
|
| 176 |
+
Carlos Pacheco, Shuvendu K Lahiri, Michael D Ernst, and Thomas Ball. Feedback-directed random test generation. In 29th International Conference on Software Engineering (ICSE’07), pp. 75–84. IEEE, 2007.
|
| 177 |
+
Annibale Panichella, Fitsum Meshesha Kifetew, and Paolo Tonella. Reformulating branch coverage as a many-objective optimization problem. In 2015 IEEE 8th international conference on software testing, verification and validation (ICST), pp. 1–10. IEEE, 2015.
|
| 178 |
+
Annibale Panichella, Fitsum Meshesha Kifetew, and Paolo Tonella. Automated test case generation as a many-objective optimisation problem with dynamic selection of the targets. IEEE Transactions on Software Engineering, 44(2):122–158, 2017.
|
| 179 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J Liu, et al. Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 21(140):1–67, 2020.
|
| 180 |
+
Baptiste Roziere, Jie M Zhang, Francois Charton, Mark Harman, Gabriel Synnaeve, and Guillaume Lample. Leveraging automated unit tests for unsupervised code translation. arXiv preprint arXiv:2110.06773, 2021.
|
| 181 |
+
Jianhao Shen, Yichun Yin, Lin Li, Lifeng Shang, Xin Jiang, Ming Zhang, and Qun Liu. Generate & rank: A multi-task framework for math word problems. arXiv preprint arXiv:2109.03034, 2021.
|
| 182 |
+
Freda Shi, Daniel Fried, Marjan Ghazvininejad, Luke Zettlemoyer, and Sida I Wang. Natural language to code translation with execution. arXiv preprint arXiv:2204.11454, 2022.
|
| 183 |
+
Michele Tufano, Dawn Drain, Alexey Svyatkovskiy, Shao Kun Deng, and Neel Sundaresan. Unit test case generation with transformers and focal context. arXiv preprint arXiv:2009.05617, 2020.
|
| 184 |
+
Lewis Tunstall, Leandro von Werra, and Thomas Wolf. Natural language processing with transformers. ” O’Reilly Media, Inc.”, 2022.
|
| 185 |
+
Ben Wang and Aran Komatsuzaki. GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/mesh-transformer-jax, May 2021.
|
| 186 |
+
Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022.
|
| 187 |
+
Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, and Jamie Brew. Huggingface’s transformers: State-of-the-art natural language processing. ArXiv, 2019.
|
| 188 |
+
Frank F Xu, Uri Alon, Graham Neubig, and Vincent Josua Hellendoorn. A systematic evaluation of large language models of code. In Deep Learning for Code Workshop, 2022.
|
| 189 |
+
|
| 190 |
+
Table 6: Pass $@ k$ $( \% )$ on the original HumanEval benchmark with Codex models. The numbers in orange indicate the absolute improvements of pass $@ k$ on the original benchmark over our modified benchmark in Table 2.
|
| 191 |
+
|
| 192 |
+
<table><tr><td>Methods</td><td colspan="3">Baseline</td><td colspan="3">CODET</td></tr><tr><td>k</td><td>1</td><td>10</td><td>100</td><td>1</td><td>2</td><td>10</td></tr><tr><td>code-cushman-001</td><td>31.7-1.8</td><td>56.4 2.1</td><td>84.1 6.7</td><td>58.6 14.1</td><td>65.7 15.6</td><td>80.1 14.4</td></tr><tr><td>code-davinci-001</td><td>34.8 -4.2</td><td>63.0 2.4</td><td>87.2 3.1</td><td>60.4 10.2</td><td>69.1 10.2</td><td>82.4 6.6</td></tr><tr><td>code-davinci-002</td><td>47.6 0.6</td><td>78.8 3.9</td><td>92.7 0.6</td><td>74.8 9.0</td><td>82.9 7.8</td><td>89.0 2.4</td></tr></table>
|
| 193 |
+
|
| 194 |
+
# A MORE IMPLEMENTATION DETAILS
|
| 195 |
+
|
| 196 |
+
We set the temperature to 0.8, the top $p$ to 0.95, the max generation length to 300, and the timeout of executing a test case to 0.1 seconds. Specially, for baseline pass $@ 1$ , we use the greedy search setting with temperature 0. The number of sampling test cases for each problem is set to 100 for the HumanEval and MBPP benchmarks, and 50 for the APPS and CodeContests benchmarks. When scoring consensus sets in CODET, we use the square root of $| S _ { x } |$ to reduce the impact caused by code solutions. A supporting experiment can be found in Appendix C. For code solution post-processing, we follow Chen et al. (2021) to truncate the generated content by five stop sequences: “\nclass”, “\ndef”, “\n#”, “\nif”, and “\nprint”. For the implementation of INCODER and CODEGEN, we use the HuggingFace transformers library (Wolf et al., 2019) and run both models with half precision. In addition, when the number of consensus sets in CODET is smaller than $k$ , the selection is done from the highest scoring consensus set to the lowest. When reaching the set with the lowest score, it repeats from the highest scoring consensus set. In most cases, the number of consensus sets is larger than $k$ , as shown in Figure 6.
|
| 197 |
+
|
| 198 |
+
# B RESULTS ON ORIGINAL HUMANEVAL
|
| 199 |
+
|
| 200 |
+
As mentioned in Section 3, for all benchmarks, we remove the example input-output cases from the original contexts to avoid exposing real test cases. To study the influence of such modification, we take HumanEval as an example and perform an additional experiment with its original contexts. The results are summarized in Table 6. On the one hand, the baseline pass $@ 1 0$ and pass $@ 1 0 0$ results on the original HumanEval benchmark outperform the modified version, which is reasonable because the example input-output cases may provide useful information for code generation. Nevertheless, the pass $@ 1$ results on the original benchmark are basically the same or even worse than the modified version, suggesting that the Codex models have not fully understood the semantics of the example input-output cases provided in the contexts. On the other hand, the performance of CODET is significantly improved using the original benchmark. This is as expected because the original contexts used for test case generation include real test cases, which could be borrowed by the models during the generation. Such real test cases will greatly empower CODET to distinguish correct code solutions. Hence, in our experiments, it is indispensable to remove the example input-output cases to avoid exposing the real test cases. In this way, the effectiveness of CODET can be fairly verified.
|
| 201 |
+
|
| 202 |
+
# C ANALYSIS ON CODE SOLUTIONS
|
| 203 |
+
|
| 204 |
+
In CODET, code solutions that can pass exactly the same test cases are considered consistent in functionality and are grouped into the same consensus set. Since we employ top $p$ sampling with a rather high temperature of 0.8, the functionality of the code solutions may vary significantly, which results in more consensus sets. We draw a histogram in Figure 6 to show the number of consensus sets produced by code-cushman-001 and CODET for each problem on the HumanEval benchmark. The average and median numbers are 26.8 and 25.5, respectively. We can find that most problems have less than 50 consensus sets, but the numbers have a high variance among different problems. We also draw the distribution of the numbers of code solutions for the top-ranked consensus sets in Figure 7. The consensus sets ranked top 1 tend to have more code solutions with an average value of 9.8, and the numbers also have a high variance.
|
| 205 |
+
|
| 206 |
+

|
| 207 |
+
Figure 6: The numbers of consensus sets that are produced by code-cushman-001 and CODET on the HumanEval benchmark.
|
| 208 |
+
|
| 209 |
+

|
| 210 |
+
Figure 7: The distribution of the code solution numbers for the top 5 consensus sets. The long tail distribution with number $\geq 2 0$ is truncated.
|
| 211 |
+
|
| 212 |
+

|
| 213 |
+
Figure 8: The CODET results of three Codex models with and without constraint on the number of code solutions.
|
| 214 |
+
|
| 215 |
+

|
| 216 |
+
Figure 9: The baseline pass $@ 1 0 0$ and CODET pass $@ 1$ with code-cushman-001 at different temperature settings.
|
| 217 |
+
|
| 218 |
+
As mentioned in Appendix A, we use the square root of $| S _ { x } |$ to reduce the impact caused by code solutions, because we believe passing more test cases is more important than having more code solutions with the same functionality. For example, there may be one code solution that can pass five test cases, whereas another five code solutions in a consensus set can pass only one test case. We intuitively consider that the former may be more likely correct. For validation, we perform an experiment by comparing the performance of CODET with the “sqrt”, “log” functions, and without any constraint (i.e., “linear”) on the number of code solutions. Figure 8 shows the results of three Codex models on the HumanEval benchmark. We can find that reducing the importance of code solutions can consistently improve the performance of CODET. Similar observations have been found in other models and benchmarks, where the performance of employing “sqrt” is always better than or competitive to “linear”, indicating the rationality of our design.
|
| 219 |
+
|
| 220 |
+
# D INFLUENCE OF DE-DUPLICATION
|
| 221 |
+
|
| 222 |
+
Since we sample multiple times during generation, there is the chance that many of the generated code solutions and test cases are exactly the same. On the one hand, the number of duplicates may indicate the importance of a sample. On the other hand, duplicates may hinder the scoring of consensus sets in CODET when the quality of generation is unsatisfactory. Hence, we perform an ablation study to investigate the effects of removing duplicate code solutions and test cases. Specifically, we first format the generated Python code to conform to the PEP 8 style guide3, and then remove duplicate code solutions and test cases before performing CODET. The de-duplication results on the HumanEval and MBPP benchmarks using CODET and code-cushman-001 are shown in Table 7, where we can choose to de-duplicate the code solutions, or the test cases, or both. We can find that de-duplication has slight and inconsistent influence on the performance of CODET. For the HumanEval benchmark, the pass $@ 1$ results using code solution de-duplication alone are better than other settings. Nonetheless, for the MBPP benchmark, the best pass $@ 1$ results are achieved without de-duplication. Therefore, in our main experiments, we reserve all the generated code solutions and test cases when performing CODET and leave the study of more advanced de-duplication methods for future work.
|
| 223 |
+
|
| 224 |
+
Table $\tilde { \mathbf { \Lambda } } : \operatorname* { P a s s } \textcircled { a } k$ $( \% )$ on the HumanEval and MBPP benchmarks using CODET and code-cushman001 with different de-duplication settings. The setting “No No” in the first line means that neither the code solutions nor the test cases are de-duplicated, which is used in our main experiments.
|
| 225 |
+
|
| 226 |
+
<table><tr><td colspan="2">De-duplication</td><td colspan="3">HumanEval</td><td colspan="3">MBPP</td></tr><tr><td>Solution</td><td>Test</td><td>1</td><td>2</td><td>10</td><td>1</td><td>2</td><td>10</td></tr><tr><td>No</td><td>No</td><td>44.5</td><td>50.1</td><td>65.7</td><td>55.4</td><td>61.7</td><td>72.7</td></tr><tr><td>No</td><td>Yes</td><td>42.2</td><td>48.8</td><td>66.7</td><td>54.5</td><td>62.3</td><td>73.4</td></tr><tr><td>Yes</td><td>No</td><td>46.9</td><td>52.5</td><td>65.6</td><td>54.7</td><td>61.7</td><td>73.2</td></tr><tr><td>Yes</td><td>Yes</td><td>42.7</td><td>51.2</td><td>66.4</td><td>54.7</td><td>62.1</td><td>73.2</td></tr></table>
|
| 227 |
+
|
| 228 |
+
Table 8: $\mathrm { P a s s } @ k$ $( \% )$ results on the zero-shot APPS and CodeContests benchmarks using codedavinci-002 and CODET with/without the trivial code solutions filtered. The numbers in red indicate the absolute improvements after filtering the trivial solutions.
|
| 229 |
+
|
| 230 |
+
<table><tr><td colspan="2">Methods</td><td colspan="3">CODET</td><td colspan="3">CODET(Remove Trivial)</td></tr><tr><td colspan="2">k</td><td>1</td><td>10</td><td>100</td><td>1</td><td>10</td><td>100</td></tr><tr><td rowspan="3">APPS</td><td>INTRODUCTORY</td><td>34.6</td><td>53.2</td><td>1</td><td>34.9 0.3</td><td> 53.4 0.2</td><td>=</td></tr><tr><td>INTERVIEW</td><td>8.1</td><td>18.1</td><td>=</td><td>8.3 0.2</td><td>18.2 0.1</td><td>1</td></tr><tr><td>COMPETITION</td><td>2.2</td><td>8.6</td><td>1</td><td>2.5 0.3</td><td>8.7 0.1</td><td>=</td></tr><tr><td colspan="2">CodeContests</td><td>2.1</td><td> 5.3</td><td>9.9</td><td> 2.7 0.6</td><td>5.3 0.0</td><td>10.0 0.1</td></tr></table>
|
| 231 |
+
|
| 232 |
+
# E SENSITIVITY TO THE TEMPERATURE
|
| 233 |
+
|
| 234 |
+
The hyper-parameter temperature has a great impact on the quality of generated code solutions and test cases when using top $p$ sampling. We use a high temperature of 0.8 in our main experiments since CODET could benefit from a larger number of diverse samples. To investigate the sensitivity of CODET to the temperature, we perform an ablation study by using a range of temperatures to report the results of baseline pass $@ 1 0 0$ and CODET pass $@ 1$ . Figure 9 shows the results of codecushman-001 on the HumanEval benchmark at different temperature settings. We can find that a higher temperature does improve the baseline pass $@ 1 0 0$ and CODET pass $@ 1$ , and CODET achieves a good performance when temperature is set to 0.8.
|
| 235 |
+
|
| 236 |
+
# F REMOVING TRIVIAL CODE SOLUTIONS
|
| 237 |
+
|
| 238 |
+
The problems in the APPS COMPETITION and CodeContests benchmarks are of great difficulty compared to HumanEval and MBPP, leading to the poor performance of the most capable codedavinci-002 model. After checking the incorrect code solutions generated by code-davinci-002, we identify many trivial solutions that just return the input argument or a constant value. Such solutions may hinder the ranking process of CODET if they can pass any generated test case. A trivial solution can be easily identified by its input arguments and returned values. If a solution always returns the same output value for different inputs, or its returned values are always the same as the inputs, it must be a trivial solution. To investigate the impact of trivial code solutions, we use code-davinci002 on the zero-shot APPS and CodeContests benchmarks, and perform CODET after filtering out all the trivial solutions. As a result, we can remove an average of 4.5 (91.6) trivial solutions from the $5 0 \ ( 1 , 0 0 0 )$ generated solutions per problem for the APPS (CodeContests) benchmark. However, as shown in Table 8, after removing a prominent percentage of trivial solutions, there is little performance gain, which could exactly demonstrate the robustness of CODET.
|
| 239 |
+
|
| 240 |
+
Table 9: Pass $@ k$ $( \% )$ results on the APPS and CodeContests benchmarks using code-davinci-002 and the one-shot setting. The numbers in red indicate the absolute improvements of CODET (Filter) over Baseline (Filter) on pass $@ 1$ , pass $@ 1 0$ and pass $@ 1 0 0$ . For CODET (Filter), temperature is set to 0.8 and sampling number is set to 50 for APPS and 1, 000 for CodeContests. We do not report pass $@ 1 0 0 0$ for “Baseline Filter” because the numbers of code solutions after filtering are less than the sampling numbers.
|
| 241 |
+
|
| 242 |
+
<table><tr><td colspan="2">k</td><td>1</td><td>10</td><td>50</td><td>100</td><td>1000</td><td>1</td><td>2</td><td>10</td><td>100</td></tr><tr><td rowspan="5"></td><td colspan="5"></td><td colspan="5"></td></tr><tr><td>INTRODUCTORY</td><td>29.3</td><td>48.5</td><td>60.9</td><td></td><td></td><td> 47.3 18.0</td><td>52.7</td><td> 58.4 9.9</td><td></td></tr><tr><td>INTERVIEW</td><td>6.4</td><td>14.6</td><td>25.4</td><td></td><td></td><td>14.3 7.9</td><td>18.2</td><td>23.3 8.7</td><td></td></tr><tr><td>COMPETITION</td><td>2.5</td><td>6.3</td><td>14.5</td><td></td><td></td><td>6.2 3.7</td><td>9.8</td><td>13.6 7.3</td><td></td></tr><tr><td colspan="2">CodeContests</td><td>1.0</td><td>4.1 7.1</td><td>8.8</td><td>15.2</td><td> 3.2 2.2</td><td>5.6</td><td>9.3 5.2</td><td>12.3 3.5</td></tr><tr><td rowspan="5">APPS</td><td colspan="5"></td><td colspan="5">CODET Filter</td></tr><tr><td>INTRODUCTORY</td><td>43.6</td><td>58.6</td><td></td><td></td><td></td><td>49.6 6.0</td><td>54.3</td><td> 59.4 0.8</td><td></td></tr><tr><td>INTERVIEW</td><td>13.3</td><td>22.8</td><td></td><td></td><td></td><td>16.1 2.8</td><td>19.5</td><td>24.0 1.2</td><td></td></tr><tr><td>COMPETITION</td><td>7.0</td><td>13.3</td><td></td><td></td><td></td><td>7.9 0.9</td><td>10.5</td><td>14.1 0.8</td><td></td></tr><tr><td>CodeContests</td><td>9.9</td><td>14.5</td><td>15.1</td><td>15.2</td><td></td><td>9.6 -0.3</td><td>11.5</td><td>13.7 -0.8</td><td>14.5 -0.7</td></tr></table>
|
| 243 |
+
|
| 244 |
+
# G RESULTS ON APPS AND CODECONTESTS IN THE ONE-SHOT SETTING
|
| 245 |
+
|
| 246 |
+
Inspired by Chen et al. (2021) and Li et al. (2022b), we build one-shot versions of APPS and CodeContests by appending a single input-output example to the problem description as a formatting hint. After generation, we filter out the generated solutions that cannot pass the given example input-output cases, which we call the “Baseline Filter” method. After filtering, we can still perform CODET using the rest of code solutions, called the “CODET Filter” method. Following the zeroshot experiments on APPS and CodeContests, we employ code-davinci-002 for generation and set the sampling number to 50 for APPS and 1, 000 for CodeContests.
|
| 247 |
+
|
| 248 |
+
We summarize the experimental results in Table 9, where we can find the one-shot performance using CODET is much better than that reported in Table 3 in the zero-shot setting. The performance of the baselines can be significantly improved by filtering the solutions with the given example test cases. Moreover, “CODET Filter” can further outperform “Baseline Filter” on the APPS benchmark, especially for the introductory and interview problems. Nonetheless, for CodeContests and the competition level problems in APPS, “CODET Filter” has little performance improvement or even performs slightly worse than “Baseline Filter”. After manual investigation, we blame such issue to the generated low-quality test cases, which hinder the scoring of consensus sets. This suggests the interest of future study on test case generation for more challenging programming problems.
|
| 249 |
+
|
| 250 |
+
# H MORE ANALYSIS ON TEST CASES
|
| 251 |
+
|
| 252 |
+
# H.1 STATISTICS ON TEST CASES
|
| 253 |
+
|
| 254 |
+
How many valid test cases do the models generate for CODET? Taking the HumanEval benchmark as an example, we sample 100 times for each problem when generating test cases. As illustrated in Figure 2, at each time of sampling, we feed the context $c$ along with an instruction $p$ to the model and get the generated content that may contain multiple test cases. Then, as mentioned in Section 4.3, we further post-process the generated samples to get individual test cases that are syntactically correct. Finally, we only keep the first five valid test cases for each sample, which means a problem can be equipped with 500 test cases at most. Table 10 summarizes the average and median numbers of the extracted test cases for each problem. We can find that almost all the models could generate a considerable number of syntactically correct test cases, while CODEGEN generates plenty of unexpected noise.
|
| 255 |
+
|
| 256 |
+
Table 10: The numbers of extracted test cases for each problem generated by five models on the HumanEval benchmark.
|
| 257 |
+
|
| 258 |
+
<table><tr><td rowspan="2">Methods</td><td colspan="2">Test Case Number</td></tr><tr><td>Average</td><td>Median</td></tr><tr><td>code-cushman-001</td><td>410.7</td><td>429.0</td></tr><tr><td>code-davinci-001</td><td>381.9</td><td>388.0</td></tr><tr><td>code-davinci-002</td><td>391.1</td><td>402.0</td></tr><tr><td>INCODER</td><td>390.1</td><td>400.0</td></tr><tr><td>CODEGEN</td><td>55.6</td><td>42.0</td></tr></table>
|
| 259 |
+
|
| 260 |
+
<table><tr><td rowspan="2">Methods</td><td colspan="2">Code Coverage</td></tr><tr><td>Statement</td><td>Branch</td></tr><tr><td>code-cushman-001</td><td>95.3</td><td>98.1</td></tr><tr><td>code-davinci-001</td><td>94.9</td><td>97.6</td></tr><tr><td>code-davinci-002</td><td>95.7</td><td>98.5</td></tr><tr><td>INCODER</td><td>94.0</td><td>96.3</td></tr><tr><td>CODEGEN</td><td>78.2</td><td>78.6</td></tr></table>
|
| 261 |
+
|
| 262 |
+
Table 11: The Code Coverage $( \% )$ statistics of test cases generated by five models on the HumanEval benchmark.
|
| 263 |
+
|
| 264 |
+
<table><tr><td rowspan="2">Limit</td><td colspan="4">Sampling Number</td><td rowspan="2">Limit</td><td colspan="4">Sampling Number</td><td rowspan="2">Limit</td><td colspan="4">Sampling Number</td></tr><tr><td>10</td><td>20</td><td>50</td><td>100</td><td>10</td><td>20</td><td>50</td><td>100</td><td>10</td><td>20</td><td>50</td><td>100</td></tr><tr><td></td><td colspan="4"> code-cushman-001</td><td colspan="4"> code-cushman-001</td><td></td><td colspan="4">code-cushman-001</td></tr><tr><td>1</td><td>37.8</td><td>40.0</td><td>40.8</td><td>38.7</td><td>1</td><td>43.3</td><td>48.1</td><td>48.2</td><td>49.1</td><td>1</td><td>55.1</td><td>56.6</td><td>61.9</td><td>62.9</td></tr><tr><td>2</td><td>42.1</td><td>41.8</td><td>43.4</td><td>41.8</td><td></td><td>48.1</td><td>48.1</td><td>49.5</td><td>49.8</td><td>2</td><td>58.7</td><td>61.4</td><td>64.5</td><td>65.8</td></tr><tr><td>3</td><td>41.6</td><td>41.9</td><td>43.8</td><td>42.5</td><td>123</td><td>49.0</td><td>47.7</td><td>48.7</td><td>48.7</td><td>3</td><td>60.9</td><td>62.5</td><td>63.4</td><td>65.3</td></tr><tr><td>4</td><td>41.2</td><td>41.2</td><td>43.8</td><td>43.3</td><td>4</td><td>49.2</td><td>47.9</td><td>49.4</td><td>49.1</td><td>4</td><td>61.4</td><td>63.3</td><td>63.3</td><td>65.8</td></tr><tr><td>5</td><td>41.0</td><td>41.9</td><td>45.4</td><td>44.5</td><td>5</td><td>48.3</td><td>48.5</td><td>48.9</td><td>50.1</td><td>5</td><td>63.1</td><td>62.6</td><td>63.8</td><td>65.7</td></tr><tr><td></td><td colspan="4"> code-davinci-002</td><td colspan="4"> code-davinci-002</td><td></td><td colspan="4"> code-davinci-002</td><td></td></tr><tr><td>1</td><td>56.5</td><td>57.5</td><td>60.7</td><td>62.4</td><td></td><td>65.1</td><td>67.8</td><td>71.9</td><td>71.5</td><td>1</td><td>77.9</td><td>79.6</td><td>82.8</td><td>84.3</td></tr><tr><td></td><td>62.2</td><td>62.8</td><td>63.2</td><td>63.6</td><td></td><td>71.7</td><td>73.2</td><td>74.2</td><td>74.1</td><td>2</td><td>80.8</td><td>81.8</td><td>84.3</td><td>86.5</td></tr><tr><td>23</td><td>62.9</td><td>63.2</td><td>65.5</td><td>65.0</td><td>123</td><td>73.2</td><td>73.5</td><td>75.1</td><td>75.0</td><td>3</td><td>82.3</td><td>83.2</td><td>85.5</td><td>87.1</td></tr><tr><td>4</td><td>64.1</td><td>64.5</td><td>65.7</td><td>65.0</td><td>4</td><td>73.3</td><td>74.1</td><td>75.5</td><td>74.3</td><td>4</td><td>82.9</td><td>84.4</td><td>85.4</td><td>86.9</td></tr><tr><td>5</td><td>63.9</td><td>64.2</td><td>65.2</td><td>65.8</td><td>5</td><td>73.5</td><td>74.3</td><td>74.5</td><td>75.1</td><td>5</td><td>83.8</td><td>84.1</td><td>85.2</td><td>86.6</td></tr><tr><td colspan="5">(a) pass@1</td><td colspan="4">(b) pass@2</td><td></td><td colspan="4">(c) pass@10</td></tr></table>
|
| 265 |
+
|
| 266 |
+
Table 12: $\mathrm { P a s s } @ k ( \% )$ on the HumanEval benchmark using CODET with different test case numbers. Sampling Number is the number of test case samples we generate for each problem. Each sample may contain multiple assertion statements. These assertion statements are potential test cases, but we do not use all of them. Instead, we extract a Limit number of syntactically correct assertion statements from each sample, and discard the rest.
|
| 267 |
+
|
| 268 |
+
# H.2 CODE COVERAGE OF TEST CASES
|
| 269 |
+
|
| 270 |
+
To further inspect the quality of generated test cases, we utilize the code coverage measurement and report two coverage criteria — the statement coverage and the branch coverage. The statement coverage can be calculated as the percentage of statements in a code solution that are executed by test cases. The branch coverage is the percentage of executed branches for the control structure (e.g. the if statement). We execute the canonical solution for each HumanEval problem on the test cases generated by five models, then collect the coverage results using Coverage.py4. As a result, the average numbers of statements and branches in the canonical solution of a problem are 6.30 and 4.42, respectively. As shown in Table 11, all the models except CODEGEN have good performance on both statement and branch coverage, reaching an average of over $9 4 \%$ coverage. Such results may be attributed to the relatively short canonical solutions and the massive sampling number of test cases. Nevertheless, there are still corner cases that the models cannot cover, which calls for future improvements.
|
| 271 |
+
|
| 272 |
+
# H.3 RESULTS OF REDUCING THE NUMBER OF TEST CASES
|
| 273 |
+
|
| 274 |
+
To investigate the performance of CODET using fewer test cases, we perform an ablation study on the number of test cases that participate in the dual execution agreement. As shown in Table 12, we report the results on the HumanEval benchmark using code-cushman-001 and code-davinci-002 with a range of test case numbers. The number of test cases is related to two hyper-parameters. One is the number of test case samples, which is set to 100 for HumanEval in our main experiments. The other one is Limit that controls the amount of syntactically correct test cases we extract from each sample, which is set to 5 for all benchmarks in our main experiments. Note that Limit multiplied by the Sampling Number is the maximum number of test cases for a problem, not the exact number, because not every sample contains the Limit number of valid test cases. A valid test case (i.e., assertion statement) should start with “assert” and contain the name of the corresponding entry point function. We can conclude from the results that using more test cases in CODET could generally lead to better performance. While the performance gap narrows when Limit $\geq 3$ and the sampling number $\geq 5 0$ . Moreover, using only 10 test cases per problem for CODET can still improve the baseline pass $@ 1$ performance of code-cushman-001 by absolute $4 . 3 \%$ and code-davinci-002 by absolute ${ \bar { 9 } } . 5 \%$ . It demonstrates that CODET has high test case efficiency and we can use a smaller Sampling Number in real-world application to balance the performance and computation cost.
|
| 275 |
+
|
| 276 |
+
Table 13: Pass $@ k$ $( \% )$ on the HumanEval benchmark with ranking only on the number of code solutions $( f ^ { \prime } ( S ) = | S _ { x } | )$ or test cases $( f ^ { \prime \prime } ( S ) = | S _ { y } | )$ in a consensus set. The numbers in red and green indicate the absolute improvements over baseline and CODET, respectively.
|
| 277 |
+
|
| 278 |
+
<table><tr><td>Methods</td><td colspan="3">Code Solution Only f'</td><td colspan="3">Test Case Only f"</td></tr><tr><td>k</td><td>1</td><td>2</td><td>10</td><td>1</td><td>2</td><td>10</td></tr><tr><td>code-cushman-001</td><td>41.2 -3.3</td><td>-0.9 49.2</td><td>61.9 -3.8 +7.6</td><td>29.9 -14.6 -3.6</td><td>36.6-13.5</td><td>59.5+.2 -6.2</td></tr><tr><td>code-davinci-001</td><td>2+5. 44.4+5.4</td><td>54.7 -4.2</td><td>69.0 6.8 +8.4</td><td>35.0 15.2 -4.0</td><td>46.0 -12.9</td><td>70.2+96 5.6</td></tr><tr><td>code-davinci-002</td><td>55.9+8.9 -9:9</td><td>67.0 -8.1</td><td>82.7 3.9 7+7.8</td><td>58.4711.4</td><td>65.1-10.0</td><td>86.1 .5 +11.2</td></tr></table>
|
| 279 |
+
|
| 280 |
+
# I ABLATION STUDY ON THE SCORE OF CONSENSUS SET
|
| 281 |
+
|
| 282 |
+
In CODET, the score of a consensus set is calculated as $f ( S ) = | S _ { x } | | S _ { y } |$ , where $S _ { x }$ and $\mathcal { S } _ { y }$ are the code solutions and test cases in the consensus set, respectively. We can naturally derive two variants of scoring. One is $f ^ { \prime } ( S ) = | S _ { x } |$ , in line with the idea of self-consistency (Wang et al., 2022), which only considers the number of code solutions with the same functionality. The other one is $f ^ { \prime \prime } ( S ) = | \mathcal { S } _ { y } |$ , which corresponds to simply counting the test cases that each code solution can pass. To evaluate the performance of these two variants, we perform an ablation study on the HumanEval benchmark using three Codex models. The experimental results are summarized in Table 13, from which we can observe that only considering the number of code solutions or test cases for consensus set scoring performs consistently worse than CODET, and even worse than the baseline. Therefore, it is essential to consider the importance of both code solutions and test cases, suggesting the reasonable design of our dual execution agreement.
|
| 283 |
+
|
| 284 |
+
As mentioned in Section 3, AlphaCode (Li et al., 2022b) also includes a clustering method (denoted as AlphaCode-C) to select the generated code solutions, which shares a similar goal with our ablation method $f ^ { \prime }$ : clustering code solutions based on code functionality, and then scoring each cluster by size. AlphaCode-C requires a number of additional test inputs to produce outputs from code solutions, which are then used to determine the functional equivalence. AlphaCode-C relies on a separate test input generation model, which needs extra training and annotation. The model is unavailable and hard to replicate, as the paper does not provide sufficient details. We replicate AlphaCode-C by extracting test inputs from the test cases generated by CODET. We run all code solutions on the test inputs, and group them by outputs. The clusters are ranked by size and then we select the code solutions from each cluster in order. From Table 2 and Table 13, we can find that AlphaCode-C is inferior to $f ^ { \prime }$ , though they share the similar idea. The reason is that AlphaCode-C will group the trivial code solutions (e.g., solutions that always output “None”, “0“, or an empty string with whatever inputs) together, leading to a large cluster of incorrect solutions that significantly affects performance. While such trivial code solutions are hard to pass the generated test cases in CODET, thus having lower consensus scores for ranking. This confirms the effectiveness of considering test case information.
|
| 285 |
+
|
| 286 |
+

|
| 287 |
+
Figure 10: Two cases from the HumanEval benchmark, where CODET can find the correct consensus sets though they have (a) fewer code solutions, or (b) fewer test cases.
|
| 288 |
+
|
| 289 |
+
# J MORE EXAMPLES FOR CASE STUDY
|
| 290 |
+
|
| 291 |
+
Figure 10 illustrates two cases that CODET can successfully find the correct consensus sets. Specifically, the case in Figure 10a requires to remove the vowels in the input text. There are 41 incorrect solutions and 147 test cases in the consensus set ranked 2, which forget to remove the upper-case vowels. Though the correct solutions in the top 1 consensus set are fewer (i.e., 31), they can pass more test cases (i.e., 170) and thus have a higher score. The case in Figure 10b is to decide when the balance of account will fall below zero. The functionality of the incorrect solutions in the second consensus set is to tell whether there are withdrawing operations. Nevertheless, the incorrect solutions can pass more test cases (i.e., 255) than the correct solutions (i.e., 248) in the top 1 consensus set. Fortunately, there are 79 correct solutions and only 6 incorrect solutions, making it possible for CODET to rank the correct consensus ahead. Both cases demonstrate the plausibility of using the dual execution agreement instead of solely considering the functional agreement between code solutions or the number of passed test cases.
|
| 292 |
+
|
| 293 |
+
Figure 11 illustrates the cases that CODET fails to find the correct consensus sets. Specifically, Figure 11a demonstrates the situation that there are partially correct solutions that may fail at certain corner cases. In the example, there are 20 incorrect solutions in the top 1 consensus set that can pass 205 test cases, which will fail if the input is a string of length 1. The correct consensus set ranked 3 has more test cases (i.e., 222), while it has a lower consensus score due to the small number of code solutions (i.e., 9). The second example in Figure 11b shows the most common situation where CODET fails because the model cannot fully understand the problem. We can find that the incorrect solutions in the top 1 consensus set are totally missing the points of the given problem. While the model still tends to generate more incorrect solutions and test cases based on its wrong understanding. All the bad cases call for future improvements on the quality of generated code solutions and test cases.
|
| 294 |
+
|
| 295 |
+

|
| 296 |
+
Figure 11: Two incorrect cases from the HumanEval benchmark, where CODET cannot find the correct consensus sets due to (a) uncovered corner cases, or (b) failure of problem understanding.
|
parse/dev/ktrw68Cmu9c/ktrw68Cmu9c_content_list.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/dev/ktrw68Cmu9c/ktrw68Cmu9c_middle.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/dev/ktrw68Cmu9c/ktrw68Cmu9c_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|