Year: 2020

Abstract:
A major component of overfitting in model-free reinforcement learning (RL) involves the case where the agent may mistakenly correlate reward with certain spurious features from the observations generated by the Markov Decision Process (MDP). We provide a general framework for analyzing this scenario, which we use to design multiple synthetic benchmarks from only modifying the observation space of an MDP. When an agent overfits to different observation spaces even if the underlying MDP dynamics is fixed, we term this observational overfitting. Our experiments expose intriguing properties especially with regards to implicit regularization, and also corroborate results from previous works in RL generalization and supervised learning (SL).

heading: 1 INTRODUCTION
text: Generalization for RL has recently grown to be an important topic for agents to perform well in unseen environments. Complication arises when the dynamics of the environments entangle with the observation, which is often a high-dimensional projection of the true latent state. One particular framework, which we denote by zero-shot supervised framework (Zhang et al., 2018a;c; Nichol et al., 2018; Justesen et al., 2018) and is used to study RL generalization, is to treat it analogous to a classical supervised learning (SL) problem – i.e. assume there exists a distribution of MDP’s, train jointly on a finite “training set” sampled from this distribution, and check expected performance on the entire distribution, with the fixed trained policy. In this framework, there is a spectrum of analysis, ranging from almost purely theoretical analysis (Wang et al., 2019; Asadi et al., 2018) to full empirical results on diverse environments (Zhang et al., 2018c; Packer et al., 2018).
However, there is a lack of analysis in the middle of this spectrum. On the theoretical side, previous work do not provide analysis for the case when the underlying MDP is relatively complex and requires the policy to be a non-linear function approximator such as a neural network. On the empirical side, there is no common ground between recently proposed empirical benchmarks. This is partially caused by multiple confounding factors for RL generalization that can be hard to identify and separate. For instance, an agent can overfit to the MDP dynamics of the training set, such as for control in Mujoco (Pinto et al., 2017; Rajeswaran et al., 2017). In other cases, an RNN-based policy can overfit to maze-like tasks in exploration (Zhang et al., 2018c), or even exploit determinism and avoid using observations (Bellemare et al., 2012; Machado et al., 2018). Furthermore, various hyperparameters such as the batch-size in SGD (Smith et al., 2018), choice of optimizer (Kingma & Ba, 2014), discount factor γ (Jiang et al., 2015) and regularizations such as entropy (Ahmed et al., 2018) and weight norms (Cobbe et al., 2018) can also affect generalization.
∗Work partially performed as an OpenAI Fellow. †Work performed during the Google AI Residency Program. http://g.co/airesidency
Due to these confounding factors, it can be unclear what parts of the MDP or policy are actually contributing to overfitting or generalization in a principled manner, especially in empirical studies with newly proposed benchmarks. In order to isolate these factors, we study one broad factor affecting generalization that is most correlated with themes in SL, specifically observational overfitting, where an agent overfits due to properties of the observation which are irrelevant to the latent dynamics of the MDP family. To study this factor, we fix a single underlying MDP’s dynamics and generate a distribution of MDP’s by only modifying the observational outputs.
Our contributions in this paper are the following:
1. We discuss realistic instances where observational overfitting may occur and its difference from other confounding factors, and design a parametric theoretical framework to induce observational overfitting that can be applied to any underlying MDP. 2. We study observational overfitting with linear quadratic regulators (LQR) in a synthetic environment and neural networks such as multi-layer perceptrons (MLPs) and convolutions in classic Gym environments. A primary novel result we demonstrate for all cases is that implicit regularization occurs in this setting in RL. We further test the implicit regularization hypothesis on the benchmark CoinRun from using MLPs, even when the underlying MDP dynamics are changing per level. 3. In the Appendix, we expand upon previous experiments by including full training curve and hyperparamters. We also provide an extensive analysis of the convex one-step LQR case under the observational overfitting regime, showing that under Gaussian initialization of the policy and using gradient descent on the training cost, a generalization gap must necessarily exist.
The structure of this paper is outlined as follows: Section 2 discusses the motivation behind this work and the synthetic construction to abstract certain observation effects. Section 3 demonstrates numerous experiments using this synthetic construction that suggest implicit regularization is at work. Finally, Section 3.4 tests the implicit regularization hypothesis on CoinRun, as well as ablates various ImageNet architectures and margin metrics in the Appendix.

heading: 2 MOTIVATION AND RELATED WORK
text: We start by showing an example of observational overfitting in Figure 1. This example highlights the issues surrounding MDP’s with rich, textured observations - specifically, the agent can use any features that are correlated with progress, even those which may not generalize across levels. This is an important issue for vision-based policies, as many times it is not obvious what part of the observation causes an agent to act or generalize.
Currently most architectures used in model-free RL are simple (with fewer than one million parameters) compared to the much larger and more complex ImageNet architectures used for classification.
This is due to the fact that most RL environments studied either have relatively simple and highly structured images (e.g. Atari) compared to real world images, or conveniently do not directly force the agent to observe highly detailed images. For instance in large scale RL such as DOTA2 (OpenAI, 2018) or Starcraft 2 (Vinyals et al., 2017), the agent observations are internal minimaps pertaining to object xy-locations, rather than human-rendered observations.

heading: 2.1 WHAT HAPPENS IN OBSERVATION SPACE?
text: Several artificial benchmarks (Zhang et al., 2018b; Gamrian & Goldberg, 2019) have been proposed before to portray this notion of overfitting, where an agent must deal with a changing background - however, a key difference in our work is that we explicitly require the “background” to be correlated with the progress rather than loosely correlated (e.g. through determinism between the background and the game avatar) or not at all. This makes a more explicit connection to causal inference (Arjovsky et al., 2019; Heinze-Deml & Meinshausen, 2019; Heinze-Deml et al., 2019) where spurious correlations between ungeneralizable features and progress may make training easy, but are detrimental to test performance because they induce false attributions.
Previously, many works interpret the decision-making of an agent through saliency and other network visualizations (Greydanus et al., 2018; Such et al., 2018) on common benchmarks such as Atari. Other recent works such as (Igl et al., 2019) analyze the interactions between noise-injecting explicit regularizations and the information bottleneck. However, our work is motivated by learning theoretic frameworks to capture this phenomena, as there is vast literature on understanding the generalization properties of SL classifiers (Vapnik & Chervonenkis, 1971; McAllester, 1999; Bartlett & Mendelson, 2002) and in particular neural networks (Neyshabur et al., 2015b; Dziugaite & Roy, 2017; Neyshabur et al., 2017; Bartlett et al., 2017; Arora et al., 2018c). For an RL policy with high-dimensional observations, we hypothesize its overfitting can come from more theoretically principled reasons, as opposed to purely good inductive biases on game images.
As an example of what may happen in high dimensional observation space, consider linear least squares regression task where given the set X ∈ Rm×d and Y ∈ Rm, we want to find w ∈ Rd that minimizes `X,Y (w) = ‖Y −Xw‖2 where m is the number of samples and d is the input dimension. We know that if X>X is full rank (hence d ≤ m), `X,Y (.) has a unique global minimum w∗ = (X>X)−1X>Y . On the other hand if X>X is not full rank (eg. when m < d), then there are many global minima w∗ such that Y = Xw∗ 1. Luckily, if we use any gradient based optimization to minimize the loss and initialize with w = 0, the solution will only span column spaces of X and converges to minimum `2 norm solution among all global minima due to implicit regularization (Gunasekar et al., 2017). Thus a high dimensional observation space with a low dimensional state space can induce multiple solutions, some of which are not generalizable to other functions or MDP’s but one could hope that implicit regularization would help avoiding this issue. We analyze this case in further detail for the convex one-step LQR case in Section 3.1 and Appendix A.4.3.

heading: 2.2 NOTATION
text: In the zero-shot framework for RL generalization, we assume there exists a distributionD over MDP’s M for which there exists a fixed policy πopt that can achieve maximal return on expectation over MDP’s generated from the distribution. An appropriate finite training set M̂train = {M1, . . . ,Mn} can then be created by repeatedly randomly samplingM∼ D. Thus for a MDPM and any policy π, expected episodic reward is defined as RM(π).
In many empirical cases, the support of the distribution D is made by parametrized MDP’s where some process, given a parameter θ, creates a mapping θ →Mθ (e.g. through procedural generation), and thus we may simplify notation and instead define a distribution Θ that induces D, which implies a set of samples Θ̂train = {θ1, . . . , θn} also induces a M̂train = {M1, . . . ,Mn}, and we may redefine reward as RMθ (π) = Rθ(π).
1Given any X with full rank X>X , it is possible to create many global minima by projecting the data onto high dimensions using a semi-orthogonal matrix Z ∈ Rd×d ′ where d′ > m ≥ d and ZZ> = Id. Therefore, we the loss `XZ,Y (w) = ‖Y −XZw‖2 will have many global optima w∗ with Y = XZw∗.
As a simplified model of the observational problem from Sonic, we can construct a mapping θ →Mθ by first fixing a base MDPM = (S,A, r, T ), which corresponds to state space, action space, reward, and transition. The only effect of θ is to introduce an additional observation function φθ : S → O, where the agent receives input from the high dimensional observation space O rather than from the state space S. Thus, for our setting, θ actually parameterizes a POMDP family which can be thought of as simply a combination of a base MDP M and an observational function φθ, hence Mθ = (M, φθ).
Let Θ̂train = {θ1, . . . , θn} be a set of n i.i.d. samples from Θ, and suppose we train π to optimize reward against {Mθ : θ ∼ Θ̂train}. The objective JΘ̂(π) = 1
|Θ̂train|
∑ θi∈Θ̂train Rθi(π) is the
average reward over this empirical sample. We want to generalize to the distribution Θ, which can be expressed as the average episode reward R over the full distribution, i.e. JΘ(π) = Eθ∼Θ [Rθ(π)]. Thus we define the generalization gap as JΘ̂(π)− JΘ(π).

heading: 2.3 SETUP
text: We can model the effects of Figure 1 more generally, not specific to sidescroller games. We assume that there is an underlying state s (e.g. xy-locations of objects in a game), whose features may be very well structured, but that this state has been projected to a high dimensional observation space by φθ. To abstract the notion of generalizable and non-generalizable features, we construct a simple and natural candidate class of functions, where
φθ(s) = h(f(s), gθ(s)) (1)
In this setup, f(·) is a function invariant for the entire MDP population Θ, while gθ(·) is a function dependent on the sampled parameter θ. h is a ”combination” function which combines the two outputs of f and g to produce a final observation. While f projects this latent data into salient and important, invariant features such as the avatar, monsters, and items, gθ projects the latent data to unimportant features that do not contribute to extra generalizable information, and can cause overfitting, such as the changing background or textures. A visual representation is shown in Figure 2. This is a simplified but still insightful model relevant in more realistic settings. For instance, in settings where gθ does matter, learning this separation and task-identification (Yu et al., 2017; Peng et al., 2018) could potentially help fast adaptation in meta-learning (Finn et al., 2017). From now on, we denote this setup as the (f, g)-scheme.
This setting also leads to more interpretable generalization bounds - Lemma 2 of (Wang et al., 2019) provides a high probability (1− δ) bound for the “intrinsic” generalization gap when m levels are sampled: gap ≤ Radm(RΠ) +O (√ log(1/δ) m ) , where
Radm(RΠ) = E(θ1,...,θm)∼Θm [ Eσ∈{−1,+1} [ sup π∈Π 1 m m∑ i=1 σiRθi(π) ]] (2)
is the Rademacher Complexity under the MDP, where θi are the ζi parameters used in the original work, and the transition T and initialization I are fixed, therefore omitted, to accommodate our setting.
The Rademacher Complexity term captures how invariant policies in the set Π with respect to θ. For most RL benchmarks, this is not interpretable due to multiple confounding factors such as the varying level dynamics. For instance, it is difficult to imagine what behaviors or network weights a policy would possess in order to produce the same total rewards, regardless of changing dynamics.
However, in our case, because the environment parameters θ are only from gθ, the Rademacher Complexity is directly based on how much the policy “looks at” gθ. More formally, let Π∗ be the set of policies π∗ which are not be affected by changes in gθ; i.e. ∇θπ∗(φθ(s)) = 0 ∀s and thus Rθ(π
∗) = Rconst ∀θ, which implies that the environment parameter θ has no effect on the reward; hence Radm(RΠ∗) = Eσ∈{−1,+1} [ supπ∗∈Π∗ 1 m ∑m i=1 σiRconst ] = 0.

heading: 2.4 ARCHITECTURE AND IMPLICIT REGULARIZATION
text: Normally in a MDP such as a game, the concatenation operation may be dependent on time (e.g. textures move around in the frame). In the scope of this work, we simplify the concatenation effect and assume h(·) is a static concatenation, but still are able to demonstrate insightful properties. We note that this inductive bias on h allows explicit regularization to trivially solve this problem, by penalizing a policy’s first layer that is used to “view” gθ(s) (Appendix A.1.1), hence we only focus on implicit regularizations.
This setting is naturally attractive to analyzing architectural differences, as it is more closely related in spirit to image classifiers and SL. One particular line of work to explain the effects of certain architectural modifications in SL such as overparametrization and residual connections is implicit regularization (Neyshabur et al., 2015a; Gunasekar et al., 2017; Neyshabur, 2017), as overparametrization through more layer depth and wider layers has proven to have no `p-regularization equivalent (Arora et al., 2019), but rather precondition the dynamics during training. Thus, in order to fairly experimentally measure this effect, we always use fixed hyperparameters and only vary based on architecture. In this work, we only refer to architectural implicit regularization techniques, which do not have a explicit regularization equivalent. Some techniques e.g. coordinate descent (Bradley et al., 2011) are equivalent to explicit `1-regularization.

heading: 3 EXPERIMENTS

heading: 3.1 OVERPARAMTERIZED LQR
text: We first analyze the case of the LQR as a surrogate for what may occur in deep RL, which has been done before for various topics such as sample complexity (Dean et al., 2019) and model-based RL (Tu & Recht, 2019). This is analogous to analyzing linear/logistic regression (Kakade et al., 2008; McAllester, 2003) as a surrogate to understanding extensions to deep SL techniques (Neyshabur et al., 2018a; Bartlett et al., 2017). In particular, this has numerous benefits - the cost (negative of reward) function is deterministic, and allows exact gradient descent (i.e. the policy can differentiate through the cost function) as opposed to necessarily using stochastic gradients in normal RL, and thus can cleanly provide evidence of implicit regularization. Furthermore, in terms of gradient dynamics and optimization, LQR readily possesses nontrivial qualities compared to linear regression, as the LQR cost is a non-convex function but all of its minima are global minima (Fazel et al., 2018).
To show that overparametrization alone is an important implicit regularizer in RL, LQR allows the use of linear policies (and consequently also allows stacking linear layers) without requiring a stochastic output such as discrete Gumbel-softmax or for the continuous case, a parametrized Gaussian. This is setting able to show that overparametrization alone can affect gradient dynamics, and is not a consequence of extra representation power due to additional non-linearities in the policy. There have been multiple recent works on this linear-layer stacking in SL and other theoretical problems such as matrix factorization and matrix completion (Arora et al., 2018b;a; Gunasekar et al., 2017), but to our knowledge, we are the first to analyze this case in the context of RL generalization.
We explicitly describe setup as follows: for a given θ, we let f(s) = Wc · s, while gθ(s) = Wθ · s where Wc,Wθ are semi-orthogonal matrices, to prevent information loss relevant to outputting the optimal action, as the state is transformed into the observation. Hence, if st is the underlying state
at time t, then the observation is ot = [ Wc Wθ ] st and thus the action is at = Kot, where K is the policy matrix. While Wc remains a constant matrix, we sample Wθ randomly, using the “level ID” integer θ as the seed for random generation. In terms of dimensions, if s is of shape dstate, then f also projects to a shape of dstate, while gθ projects to a much larger shape dnoise, implying that the observation to the agent is of dimension dsignal + dnoise. In our experiments, we set as default (dsignal, dnoise) = (100, 1000).
If P? is the unique minimizer of the original cost function, then the unique minimizer of the population cost is K? = [ WcP T ?
0
]T . However, if we have a single level, then there exist multiple solutions,
for instance [ αWcP T ?
(1− α)WθPT?
]T ∀α. This extra bottom component WθPT? causes overfitting. In
Appendix A.4.3, we show that in the 1-step LQR case (which can be extended to convex losses whose gradients are linear in the input), gradient descent cannot remove this component, and thus overfitting necessarily occurs.
Number of Intermediate Layers. We plotted different Φ =
∑j
i=0 ‖A‖∗ ‖A‖ terms without exponents, as powers of those terms are monotonic transforms since ‖A‖∗‖A‖ ≥ 1 ∀A and ‖A‖∗ = ‖A‖F , ‖A‖1. We see that the naive spectral bound diverges at 2 layers, and the weight-counting sums are too loose.
As a surrogate model for deep RL, one may ask if the generalization gap of the final end-to-end policy K can be predicted by functions of the layers K0, ...,Kj . This is an important question as it is a required base case for predicting generalization when using stochastic policy gradient with nonlinear activations such as ReLU or Tanh. From examining the distribution of singular values on K (Appendix A.1.1), we find that more layers does not bias the policy towards a low rank solution in the nonconvex LQR case, unlike (Arora et al., 2018b) which shows this does occur for matrix completion, and in general, convex losses. Ultimately, we answer in the negative: intriguingly, SL bounds have very little predictive power in the RL domain case.
To understand why SL bounds may be candidates for the LQR case, we note that as a basic smoothness bound C(K)− C(K ′) ≤ O(‖K −K ′‖) (Appendix A.4) can lead to very similar reasoning with SL bounds. Since our setup is similar to SL in that “LQR levels” which may be interpreted as a dataset, we use bounds of the form ∆ ·Φ, where ∆ is a “macro” product term ∆ = ∏j i=0 ‖Ki‖ ≥
∥∥∥∏ji=0Ki∥∥∥ derivable from the fact that ‖AB‖ ≤ ‖A‖ ‖B‖ in the linear case, and Φ is a weight-counting term which deals with the overparametrized case, such as Φ = ∑j i=0 ‖Ki‖2F ‖Ki‖2 (Neyshabur et al., 2018a)
or Φ = (∑j
i=0 ( ‖Ki‖1 ‖Ki‖ )2/3)3 (Bartlett et al., 2017). However, the Φ terms increase too rapidly as
shown in Figure 3. Terms such as Frobenius product (Golowich et al., 2018) and Fischer-Rao (Liang et al., 2019) are effective for the SL depth case, but are both ineffective in the LQR depth case. For width, the only product which is effective is the nuclear norm product.

heading: 3.2 PROJECTED GYM ENVIRONMENTS
text: In Section 3.1, we find that observational overfitting exists and overparametrization potentially helps in the linear setting. In order to analyze the case when the underlying dynamics are nonlinear, we let M be a classic Gym environment and we generate a Mθ = (M, wθ) by performing the exact same (f, g)-scheme as the LQR case, i.e. sampling θ to produce an observation function
wθ(s) = [ Wc Wθ ] s. We again can produce training/test sets of MDPs by repeatedly sampling θ, and for policy optimization, we use Proximal Policy Gradient (Schulman et al., 2017).
Although bounds on the smoothness term Rθ(π) − Rθ(π′) affects upper bounds on Rademacher Complexity (and thus generalization bounds), we have no such theoretical guarantees in the Mujoco case as it is difficult to analyze the smoothness term for complicated transitions such as Mujoco’s physics simulator. However, in Figure 4, we can observe empirically that the underlying state dynamics has a significant effect on generalization performance as the policy nontrivially increased test performance such as in CartPole-v1 and Swimmer-v2, while it could not for others. This suggests that the Rademacher complexity and smoothness on the reward function vary highly for different environments.
Even though it is common practice to use basic (2-layer) MLPs in these classic benchmarks, there are highly nontrivial generalization effects from modifying on this class of architectures. Our results in
Figures 5 and 6 show that increasing width and depth for basic MLPs can increase generalization and is significantly dependent on the choice of activation, and other implicit regularizations such as using residual layers can also improve generalization. Specifically, switching between ReLU and Tanh activations produces different results during overparametrization. For instance, increasing Tanh layers improves generalization on CartPole-v1, and width increase with ReLU helps on Swimmer-v2. Tanh is noted to consistently improve generalization performance. However, stacking Tanh layers comes at a cost of also producing vanishing gradients which can produce subpar training performance, for e.g. HalfCheetah. To allow larger depths, we use ReLU residual layers, which also improves generalization and stabilizes training.
Previous work (Zhang et al., 2018c) did not find such an architectural pattern for GridWorld environments, suggesting that this effect may exist primarily for observational overfitting cases. While there have been numerous works which avoid overparametrization on simplifying policies (Rajeswaran et al., 2017; Mania et al., 2018) or compactifying networks (Choromanski et al., 2018; Gaier & Ha, 2019), we instead find that there are generalization benefits to overparametrization even in the nonlinear control case.

heading: 3.3 DECONVOLUTIONAL PROJECTIONS
text: From the above results with MLPs, one may wonder if similar results may carry to convolutional networks, as they are widely used for vision-based RL tasks. As a ground truth reference for our experiment, we the canonical networks proven to generalize well in the dataset CoinRun, which are from worst to best, NatureCNN Mnih et al. (2013), IMPALA Espeholt et al. (2018), and IMPALALARGE (IMPALA with more residual blocks and higher convolution depths), which have respective parameter numbers (600K, 622K, 823K).
We setup a similar (f, g)-scheme appropriate for the inductive bias of convolutions, by passing the vanilla Gym 1D state corresponding to joint locations and velocities, through multiple deconvolutions. We do so rather than using the RGB image from env.render() to enforce that the actual state is indeed low dimensional and minimize complications in experimentation, as e.g. inference of velocity information would require frame-stacking.
Specifically in our setup, we project the actual state to a fixed length, reshaping it into a square, and replacing f and gθ both with the same orthogonally-initialized deconvolution architecture to each produce a 84× 84 image (but gθ’s network weights are still generated by θ1, ..., θm similar to before). We combine the two outputs by using one half of the ”image” from f , and one half from gθ, as shown back in Figure 2.
Figure 7 shows that the same ranking between the three architectures exists as well on the GymDeconv dataset. We show that generalization ranking among NatureCNN/IMPALA/IMPALALARGE remains the same regardless of whether we use our synthetic constructions or CoinRun. This suggests that the RL generalization quality of a convolutional architecture is not limited to real world data, as our test purely uses numeric observations, which are not based on a human-prior. From these findings, one may conjecture that these RL generalization performances are highly correlated and may be due to common factors.
One of these factors we suggest is due to implicit regularization. In order to support this claim, we perform a memorization test by only showing gθ’s output to the policy. This makes the dataset impossible to generalize to, as the policy network cannot invert every single observation function {gθ1(·), gθ2(·), ..., gθn(·)} simultaneously. Zhang et al. (2018c) also constructs a memorization test for mazes and grid-worlds, and showed that more parameters increased the memorization ability of the policy. While it is intuitive that more parameters would incur more memorization, we show in Figure 8 that this is perhaps not a complete picture when implicit regularization is involved.
Using the underlying MDP as a Swimmer-v2 environment, we see that NatureCNN, IMPALA, IMPALA-LARGE have reduced memorization performances. IMPALA-LARGE, which has more depth parameters and more residual layers (and thus technically has more capacity), memorizes less than IMPALA due its inherent inductive bias. While memorization performance is dampened in 8, we perform another deconvolution memorization test using an LQR as the underlying MDP in Appendix A.1.1 that shows that there can exist specific hard limits to memorization, which also follows the same ranking above.

heading: 3.4 OVERPARAMETRIZATION IN COINRUN
text: We further test our overparametrization hypothesis from Sections 3.1, 3.2 to the CoinRun benchmark, using unlimited levels for training. For MLP networks, we downsized CoinRun from native 64× 64 to 32 × 32, and flattened the 32 × 32 × 3 image for input to an MLP. Two significant differences from the synthetic cases are that 1. Inherent dynamics are changing per level in CoinRun, and 2. The relevant and irrelevant CoinRun features change locations across the 1-D input vector. Regardless, in Figure 9, we show that overparametrization can still improve generalization in this more realistic
RL benchmark, much akin to (Neyshabur et al., 2018b) which showed that overparametrization for MLP’s improved generalization on 32× 32× 3 CIFAR-10.
While we also extend the case of large-parameter convolutional networks using ImageNet networks in Appendix A.2.1, an important question is how to predict the generalization gap only from the training phase. A particular set of metrics, popular in the SL community are margin distributions (Jiang et al., 2018; Bartlett et al., 2017), as they deal with the case for softmax outputs which do not explicitly penalize the weight norm of a network, by normalizing the ”confidence” margin of the logit outputs. While using margins on state-action pairs (from an on-policy replay buffer) is not technically rigorous, one may be curious to see if they have predictive power, especially as MLPs are relatively simple to norm-bound. We plotted these margin distributions in Appendix A.2.2, but found that the weight norm bounds used in SL are simply too dominant for this RL case. This, with the bound results found earlier for the LQR case, suggests that current norm bounds are simply too loose for the RL case even though we have shown overparametrization helps generalization in RL, and hopefully this motivates more of the study of such theory.

heading: 4 CONCLUSION
text: We have identified and isolated a key component of overfitting in RL as the particular case of “observational overfitting”, which is particularly attractive for studying architectural implicit regularizations. We have analyzed this setting extensively, by examining 3 main components:
1. The analytical case of LQR and linear policies under exact gradient descent, which lays the foundation for understanding theoretical properties of networks in RL generalization. 2. The empirical but principled Projected-Gym case for both MLP and convolutional networks which demonstrates the effects of neural network policies under nonlinear environments. 3. The large scale case for CoinRun, which can be interpreted as a case where relevant features are moving across the input, where empirically, MLP overparametrization also improves generalization.
We noted that current network policy bounds using ideas from SL are unable to explain overparametrization effects in RL, which is an important further direction. In some sense, this area of RL generalization is an extension of static SL classification from adding extra RL components. For instance, adding a nontrivial “combination function” between f and gθ that is dependent on time (to simulate how object pixels move in a real game) is both an RL generalization issue and potentially video classification issue, and extending results to the memory-based RNN case will also be highly beneficial.
Furthermore, it is unclear whether such overparametrization effects would occur in off-policy methods such as Q-learning and also ES-based methods. In terms of architectural design, recent works (Jacot et al., 2018; Garriga-Alonso et al., 2019; Lee et al., 2019) have shed light on the properties of asymptotically overparametrized neural networks in the infinite width and depth cases and their performance in SL. Potentially such architectures (and a corresponding training algorithm) may be used in the RL setting which can possibly provide benefits, one of which is generalization as shown in this paper. We believe that this work provides an important initial step towards solving these future problems.

heading: ACKNOWLEDGEMENTS
text: We would like to thank John Schulman for very helpful guidance over the course of this work. We also wish to thank Chiyuan Zhang, Ofir Nachum, Aurick Zhou, Daniel Seita, Alexander Irpan, and the OpenAI team for fruitful comments and discussions during the course of this work.

heading: A.1 FULL PLOTS FOR LQR AND FG-GYM
text: A.1.1 LQR
(a) (b)
(c) (d)
(e)
Figure A1: (a,b): Singular Values for varying depths and widths. (c,d): Train and Test Loss for varying widths and depths. (e): Train and Test Loss for varying Noise Dimensions.
We further verify that explicit regularization (norm based penalties) also reduces generalization gaps. However, explicit regularization may be explained due to the bias of the synthetic tasks, since the first layer’s matrix may be regularized to only ”view” the output of f , especially as regularizing the first layer’s weights substantially improves generalization.
Figure A2: Explicit Regularization on layer norms.
We provide another deconvolution memorization test, using an LQR as the underlying MDP. While fg-Gym-Deconv shows that memorization performance is dampened, this test shows that there can exist specific hard limits to memorization. Specifically, NatureCNN can memorize 30 levels, but not 50; IMPALA can memorize 2 levels but not 5; IMPALA-LARGE cannot memorize 2 levels at all.
0.0 0.5 1.0 1.5 2.0 2.5 Training Steps 1e6
20000
17500
15000
12500
10000
7500
5000
2500
0
R ew
ar d/
P er
fo rm
an ce
Training, Test Rewards (f = NULL)
IMPALA_2_levels IMPALA_5_levels IMPALA_30_levels IMPALA_LARGE_2_levels NatureCNN_30_levels NatureCNN_50_levels
Figure A3: Deconvolution memorization test using LQR as underlying MDP.

heading: A.2 EXTENDED LARGE RL RESULTS

heading: A.2.1 LARGE IMAGENET MODELS FOR COINRUN
text: For reference, we also extend the case of large-parameter convolutional networks using ImageNet networks. We experimentally verify in Table 1 that large ImageNet models perform very differently in RL than SL. We note that default network with the highest test reward was IMPALA-LARGE-BN (IMPALA-LARGE, with Batchnorm) at ≈ 5.5 test score. In order to verify that this is inherently a feature learning problem rather than a combinatorial problem involving objects, such as in (Santoro et al., 2018), we show that state-of-the-art attention mechanisms for RL such as Relational Memory Core (RMC) using pure attention on raw 32× 32 pixels does not perform well here, showing that a large portion of generalization and transfer must be based on correct convolutional setups.
We provide the training/testing curves for the ImageNet/large convolutional models used. Note the following:
1. RMC32x32 projects the native image from CoinRun from 64× 64 to 32× 32, and uses all pixels as components for attention, after adding the coordinate embedding found in (Santoro et al., 2018). Optimal parameters were (mem slots = 4, head size = 32, num heads = 4, num blocks = 2, gate style = ’memory’). 2. Auxiliary Loss in ShakeShake was not used during training, only the pure network. 3. VGG-A is a similar but slightly smaller version of VGG-16.
Figure A4: Large Architecture Training/Testing Curves (Smoothed).

heading: A.2.2 DO STATE-ACTION MARGIN DISTRIBUTIONS PREDICT GENERALIZATION IN RL?
text: A key question is how to predict the generalization gap only from the training phase. A particular set of metrics, popular in the SL community are margin distributions (Jiang et al., 2018; Bartlett et al., 2017), as they deal with the case for softmax categorical outputs which do not explicitly penalize the weight norm of a network, by normalizing the ”confidence” margin of the logit outputs. While using margins on state-action pairs (from an on-policy replay buffer) is not technically rigorous, one may be curious to see if they have predictive power, especially as MLP’s are relatively simple to norm-bound, and as seen from the LQR experiments, the norm of the policy may be correlated with the generalization performance.
For a policy, the the margin distribution will be defined as (x, y) → Fπ(x)y−maxi6=y Fπ(x)iRπ‖S‖2/n , where Fπ(x)y is the logit value (before applying softmax) of output y given input x, and S is the matrix of states in the replay buffer, and Rπ is a norm-based Lipschitz measure on the policy network logits. In general, Rπ is a bound on the Lipschitz constant of the network but can also be simply expressions which allow the margin distribution to have high correlation with the generalization gap. Thus, we use measures inspired by recent literature in SL in which we designate Spectral-L1, Distance, and Spectral-Frobenius measures forRπ , and we replace the classical supervised learning pair (x, y) = (s, a) with the state-action pairs found on-policy. 2
The expressions for Rπ (after removing irrelevant constants) are as follows, with their analogous papers:
1. Spectral-L1 measure: (∏d i=1 ‖Wi‖ )(∑d i=1 ‖Wi‖2/31 ‖Wi‖2/3 )3/2 (Bartlett et al., 2017)
2. Distance measure: √∑d
i=1 ‖Wi −W 0i ‖ 2 F (Nagarajan & Kolter, 2019)
3. Spectral-Fro measure: √ ln(d) ∏d i=1 ‖Wi‖ 2∑d j=1 ‖Wj−W 0j ‖2F ‖Wj‖2 (Neyshabur et al., 2018a)
We verify in Figure A5, that indeed, simply measuring the raw norms of the policy network is a poor way to predict generalization, as it generally increases even as training begins to plateau. This is inherently because the softmax on the logit output does not penalize arbitrarily high logit values, and hence proper normalization is needed.
The margin distribution converges to a fixed distribution even long after training has plateaued. However, unlike SL, the margin distribution is conceptually not fully correlated with RL generalization on the total reward, as a policy overconfident in some state-action pairs does not imply bad testing performance. This correlation is stronger if there are Lipschitz assumptions on state-action transitions, as noted in (Wang et al., 2019). For empirical datasets such as CoinRun, a metric-distance between transitioned states is ill-defined however. Nevertheless, the distribution over the on-policy replay buffer at each policy gradient iteration is a rough measure of overall confidence.
Figure A5: Margin Distributions across training.
We note that there are two forms of modifications, network dependent (explicit modifications to the policy - norm regularization, dropout, etc.) and data dependent (modifications only to the data in the replay buffer - action stochasticity, data augmentation, etc.). Ultimately however, we find that current
2We removed the training sample constant m from all original measures as this is ill-defined for the RL case, when one can generate infinitely many (s, a) pairs. Furthermore, we used the original ‖Wi‖1 in the numerator found in the first version of (Bartlett et al., 2017) rather than the current ‖Wi‖1,2.
norm measures Rπ become too dominant in the fraction, leading to the monotonic decreases in the means of the distributions as we increase parametrization.
Figure A6: Margin Distributions at the end of training.

heading: A.2.3 GYM-RETRO (SONIC)
text: In the Gym-Retro benchmark using Sonic (Nichol et al., 2018), the agent is given 47 training levels with rewards corresponding to increases in horizontal location. The policy is trained until 5k reward. At test time, 11 unseen levels are partitioned into starting positions, and the rewards are measured and averaged.
We briefly mention that the agent strongly overfits to the scoreboard (i.e. an artifact correlated with progress in the level), which may be interpreted as part of the output of gθ(·). In fact, the agent is still able to train to 5k reward from purely observing the timer as the observation. By blacking out this scoreboard with a black rectangle, we see an increase in test performance.

heading: A.3 HYPERPARAMETERS AND EXACT SETUPS

heading: A.3.1 EXACT INFINITE LQR
text: For infinite horizon case, see (Fazel et al., 2018) for the the full solution and notations. Using the same notation (A,B,Q,R), denote C(K) = ∑ x0∼D x T 0 PKx0 as the cost and ut = −Kxt as the
policy, where PK satisfies the infinite case for the Lyapunov equation:
PK = Q+K TRK + (A−BK)TPK(A−BK) (3)
We may calculate the precise LQR cost by vectorizing (i.e. flattening) both sides’ matrices and using the Kroncker product ⊗, which leads to a linear regression problem on PK , which has a precise solution, implementable in TensorFlow:
vec(PK) = vec(Q) + vec(KTRK) + [ (A−BK)T ⊗ (A−BK)T ) ] vec(PK) (4)
[ In2 − (A−BK)T ⊗ (A−BK)T ] vec(PK) = vec(Q) + vec(KTRK) (5)

heading: A.3.2 PROJECTION METHOD
text: The basis for producing f, gθ outputs is due to using batch matrix multiplication operations, or ”BMV”, where the same network architecture uses different network weights for each batch dimension, and thus each entry in a batchsize of B will be processed by the same architecture, but with different network weights. This is to simulate the effect of gθi . The numeric ID i of the environment is used as an index to collect a specific set of network weights θi from a global memory of network weights (e.g. using tensorflow.gather). We did not use nonlinear activations for the BMV architectures, as they did not change the outcome of the results.
Architecture Setup BMV-Deconv (filtersize = 2, stride = 1, outchannel = 8, padding = ”VALID”)
(filtersize = 4, stride = 2, outchannel = 4, padding = ”VALID”) (filtersize = 8, stride = 2, outchannel = 4, padding = ”VALID”) (filtersize = 8, stride = 3, outchannel = 3, padding = ”VALID”)
BMV-Dense f : Dense 30, g : Dense 100
A.3.3 IMAGENET MODELS
For the networks used in the supervised learning tasks, we direct the reader to the following repository: https://github.com/tensorflow/models/blob/master/research/ slim/nets/nets_factory.py. We also used the RMC: deepmind/sonnet/blob/ master/sonnet/python/modules/relational_memory.py

heading: A.3.4 PPO PARAMETERS
text: For the projected gym tasks, we used for PPO2 Hyperparameters:
PPO2 Hyperparameters Values nsteps 2048 nenvs 16 nminibatches 64 λ 0.95 γ 0.99 noptepochs 10 entropy 0.0 learning rate 3 · 10−4 vf coeffiicent 0.5 max-grad-norm 0.5 total time steps Varying
See (Cobbe et al., 2018) for the default parameters used for CoinRun. We only varied nminibatches in order to fit memory onto GPU. We also did not use RNN additions, in order to measure performance only from the feedforward network - the framestacking/temporal aspect is replaced by the option to present the agent velocity in the image.

heading: A.4 THEORETICAL (LQR)
text: In this section, we use notation consistent with (Fazel et al., 2018) for our base proofs. However, in order to avoid confusion with a high dimensional policy K we described in 3.1, we denote our low dimensional base policy as P and state as st rather than xt.

heading: A.4.1 NOTATION AND SETTING
text: Let ‖·‖ be the spectral norm of a matrix (i.e. largest singular value). Suppose C(P ) was the infinite horizon cost for an (A,B,Q,R)-LQR where action at = −P · st, st is the state at time t, state transition is st+1 = A · st +B · at, and timestep cost is sTt Qst + aTt Rat. C(P ) for an infinite horizon LQR, while known to be non-convex, still possess the property that when ∇C(P ∗) = 0, P ∗ is a global minimizer, or the problem statement is rank deficient. To ensure that our cost C(P ) always remains finite, we restrict our analysis when P ∈ P , where P = {P : ‖P‖ ≤ α and ‖A−BP‖ ≤ 1} for some constant α, by choosing A,B and the initialization of P appropriately, using the hyperparameters found in A.3.1. We further define the
observation modified cost as C(K;Wθ) = C ( K [ Wc Wθ ]T) .

heading: A.4.2 SMOOTHNESS BOUNDS
text: As described in Lemma 16 of (Fazel et al., 2018), we define
TP (X) = ∞∑ t=0 (A−BP )tX[(A−BP )T ]t (6)
and ‖TP ‖ = supX TP (X) ‖X‖ over all non-zero symmetric matrices X .
Lemma 27 of (Fazel et al., 2018) provides a bound on the difference C(P ′)−C(P ) for two different policies P, P ′ when LQR parameters A,B,Q,R are fixed. During the derivation, it states that when ‖P − P ′‖ ≤ min ( σmin(Q)µ 4C(P )‖B‖(‖A−BP‖+1) , ‖P‖ ) , then:
C(P ′)− C(P ) ≤ 2 ‖TP ‖ (2 ‖P‖ ‖R‖ ‖P ′ − P‖+ ‖R‖ ‖P ′ − P‖ 2 )+
2 ‖TP ‖2 2 ‖B‖ (‖A−BP‖+ 1) ‖P − P ′‖ ‖P‖2 ‖R‖ (7)
Lemma 17 also states that:
‖TP ‖ ≤ C(P )
µσmin(Q) (8)
where µ = σmin(Ex0∼D[x0xT0 ]) (9)
Assuming that in our problem setup, x0, Q,R,A,B were fixed, this means many of the parameters in the bounds are constant, and thus we conclude:
C(P ′)− C(P ) ≤ O ( C(P )2 [ ‖P‖2 ‖P − P ′‖ (‖A−BP‖+ ‖B‖+ 1) + ‖P‖ ‖P − P ′‖2 ]) (10)
Since we assumed ‖A−BP‖ ≤ 1 or else TP (X) is infinite, we thus collect the terms:
C(P ′)− C(P ) ≤ O ( C(P )2 [ ‖P‖2 ‖P − P ′‖+ ‖P‖ ‖P − P ′‖2 ]) (11)
Since α is a bound on ‖P‖ for P ∈ P , note that
‖P‖2 ‖P − P ′‖+ ‖P‖ ‖P − P ′‖2 = ‖P − P ′‖ (‖P‖2 + ‖P‖+ ‖P − P ′‖) (12)
≤ ‖P − P ′‖ (‖P‖2 + ‖P‖ (‖P‖+ ‖P ′‖) ≤ (3α2) ‖P − P ′‖ (13)
From (11), this leads to the bound: C(P ′)− C(P ) ≤ O ( C(P )2 ‖P − P ′‖ ) (14)
Note that this directly implies a similar bound in the high dimensional observation case - in particular, if P = K [ Wc Wθ ]T and P ′ = K [ Wc Wθ ]T then ‖P − P ′‖ ≤ ‖K −K ′‖ ∥∥∥∥∥ [ Wc Wθ ]T∥∥∥∥∥ = ‖K −K ′‖.

heading: A.4.3 GRADIENT DYNAMICS IN 1-STEP LQR
text: We first start with a convex cost 1-step LQR toy example under this regime, which shows that linear components such as β [
0 Wθ
]T cannot be removed from the policy by gradient descent dynamics to
improve generalization. To shorten notation, let Wc ∈ Rn×n and Wθ ∈ Rp×n, where n p. This is equivalent to setting dsignal = dstate = n and dnoise = p, and thus the policy K ∈ Rn×(n+p).
In the 1-step LQR, we allow s0 ∼ N (0, I), a0 = K [ Wc Wθ ] s0 and s1 = s0 + a0 with cost 12 ‖s1‖ 2, then
C(K;Wθ) = Es0
[ 1
2 ∥∥∥∥x0 +K [WcWθ ] x0 ∥∥∥∥2 ] = 1 2 ∥∥∥∥I +K [WcWθ ]∥∥∥∥2
F
(15)
and
∇C(K;Wθ) = ( I +K [ Wc Wθ ])[ Wc Wθ ]T . (16)
Define the population cost as C(K) := EWθ [C(K;Wθ)]. Let the notation O(p, n) denote the following set of orthogonal matrices:
O(p, n) = {W ∈ Rp×n : WTW = I} .
We use the shorthand O(n) = O(n, n).
Proposition 1. Suppose that Wθ ∼ Unif(O(p, n)) and Wc ∼ Unif(O(n)). Then (i) The minimizer of C(K) is unique and given by K? = [ −WTc 0 ] .
(ii) Thus, the minimizer cost is C(K?) = 0.
Proof. By standard properties of the Haar measure on O(p, n), we have that E[Wθ] = 0 and E[WθWTθ ] = n p I . Therefore,
C(K) = n
2 +
1 2 E [∥∥∥∥K [WcWθ ]∥∥∥∥2
F
] + E [ tr ( K [ Wc Wθ ])] = n
2 +
1 2 tr
( KTK [ I 0 0 np I ]) + tr ( K [ Wc 0 ]) .
We can now differentiate C(K): ∇C(K) = K [ I 0 0 np I ] + [ WTc 0 ] .
Both claims now follow.

heading: A.4.3.1 FINITE SAMPLE GENERALIZATION GAP
text: As an instructive example, we consider the case when we only possess one sample Wθ. Note that if
K = K ′ + β [ 0 Wθ ]T , then ∇C(K;Wθ) = ∇C(K ′;Wθ) + β [ 0 Wθ ]T . In particular, if we perform gradient descent dynamics Kt+1 = Kt − η∇C(Kt;Wθ), then we have Kt = K0(I − ηM)t +B(I − ηM)t−1 + ...+B (17) where M = [ Wc Wθ ] [ Wc Wθ ]T is the Hessian of C(K;Wθ) and B = −η [ Wc Wθ ] . Note that M has rank at most n n+ p, and thus at a high level, K0(I − ηM)t does not diminish if some portion of K0 lies in the orthogonal complement of the range of M . If the initialization is K0 ∼ N (0, I), then it is highly likely we can find a subspace Q ⊆ range(M)⊥ for which K0Q 6= 0. This is a specific example of the general case where if the Hessian of a function f(x) is degenerate everywhere (e.g. has rank k < n), then an x0 initialized with e.g. an isotropic Gaussian distribution cannot converge under gradient descent to a minimizer that lives in the span of the Hessian, as the non-degenerate components do not change. In particular, Proposition 4.7 in (Vershynin, 2009) points to the exact magnitude of the non-degenerate component in the relevant subspace Q: Ex∼N (0,I)
[∥∥ProjQ(x)∥∥2] = n−kn . The generalization gap may decrease if the number of level samples is high enough. This can be seen by the sample Hessian of Ĉ(K) = 1m ∑m i=1 C(K;Wθi) being M̂ = 1 m ∑m i=1Mi where
Mi = [ Wc Wθi ] [ Wc Wθi ]T ∀i. In particular, as m increases, the rank of M̂ increases, which allows gradient descent to recover the minimizer K? better.
We calculate the exact error of gradient descent on m samples of the 1-step LQR problem.
To simplify notation, we rewrite Wθi as Wi, and interchangeably use the abbreviations for the finite Cm(K) = Cm(·; {Wi}) = 1m ∑m i=1 C(K;Wi) when necessary. We consider gradient descent Kt+1 = Kt−η∇Cm(Kt) starting from a randomK0 with each entry iidN (0, ψ2) and η sufficiently small so that gradient descent converges. Let K∞ denote the limit point of gradient descent. We prove the following generalization gap between K∞ and Kopt. Theorem 1. Suppose that n divides p. Fix an m ∈ {1, ..., p/n}. Suppose that the samples {W1, ...,Wm} are generated by first sampling a W ∼ Unif(O(p)), and then partitioning the first n ·m columns of W into W1, ...,Wm. Suppose gradient descent is run with a sufficiently small step size η so that it converges to a unique limit point K∞. The limit point K∞ has the following generalization error:
E[C(K∞)] = n
2 +
m2n
2(m+ 1)2 +
n2m
2p(m+ 1)2 − m m+ 1
n︸ ︷︷ ︸ =:E1
+ ψ2n2
2
( m+ 2
m+ 1 − m
2
m+ 1
n
p ) ︸ ︷︷ ︸
=:E2
.
Here, the expectation is over the randomness of the samples {Wi}mi=1 and the initalization K0. The contribution from E1 is due to the generalization error of the minimum-norm stationary point of Cm(·; {Wi}). The contribution from E2 is due to the full-rank initialization of K0.
Figure A7: Plot of E[C(K∞)] as a function of m, p, n with elsewhere fixed default values n = 10, p = 1000, m = 10, and ψ = 1.
We remark that our proof specifically relies on the rank of the Hessian as m increases, rather than a more common concentration inequality used in empirical risk minimization arguments, which leads to a 1√
m scaling. Furthermore, the above expression for E[C(K∞)] does not scale increasingly
with poly(p) for the convex 1-Step LQR case, while empirically, the non-convex infinite LQR case does indeed increase from increasing the noise dimension p (as shown in Section 3.1). Interestingly, this suggests that there is an extra contribution from the non-convexity of the cost, where the observation-modified gradient dynamics tends to reach worse optima.

heading: A.4.3.2 PROOF OF THEOREM 1
text: Fix integers n, p with p ≥ n and suppose that n divides p. Draw a randomW ∈ O(p) uniformly from the Haar measure on O(p) and divide W column-wise into W1,W2, ...,Wp/n (that is Wi ∈ Rp×n, WTi Wi = In and W T i Wj = 0 when i 6= j). Also draw a Wc ∈ O(n) uniformly and independent from W . Now we consider the matrix Zm ∈ Rm·n×(n+p) for m = 1, ..., p/n defined as:
Zm := W T c W T 1 ... ...
WTc W T m  . Proposition 2. We have that Z†m is given as:
Z†m =
[ 1 m+1Wc . . .
1 m+1Wc
m m+1W1 − 1 m+1 ∑ i 6=1Wi · · · m m+1Wm − 1 m+1 ∑ i6=mWi
] .
Proof. Using the fact that WTc Wc = I , W T i Wi = In, and W T i Wj = 0 for i 6= j, we can compute:
ZmZ T m = Im·n + In... In  In... In  T .
By the matrix inversion formula we can compute the inverse (ZmZTm) −1 as the m×m block matrix where the diagonal blocks are mm+1I and the off-diagonal blocks are − 1 m+1I . We can now write Z † m using the formula:
Z†m = Z T m(ZmZ T m) −1 .
The result is seen to be:[ 1 m+1Wc . . .
1 i+1Wc
m m+1W1 − 1 m+1 ∑ i 6=1Wi · · · m m+1Wm − 1 m+1 ∑ i6=mWi
] .
Proposition 3. We have that:
PZTm =
[ m m+1WcW T c
1 m+1 ∑m i=1WcW T i
1 m+1 ∑m i=1WiW T c m m+1 ∑m i=1WiW T i − 1m+1 ∑ i 6=jWiW T j
] .
Proof. We use the formula PZTm = Z T m(ZmZ T m) −1Zm, combined with the calculations in the previous proposition.
Now we consider the gradient of Cm:
∇Cm(K) = 1
m m∑ i=1 [ Wc Wi ]T +K ( 1 m m∑ i=1 [ Wc Wi ] [ Wc Wi ]T) .
Setting∇Cm(K) = 0, we see that minimizers of Cm are solutions to:
K ( m∑ i=1 [ Wc Wi ] [ Wc Wi ]T) = − m∑ i=1 [ Wc Wi ]T .
Using our notation above, this is the same as:
KZTmZm = − [In · · · In]Zm .
The minimum norm solution, denoted Kmin, to this equation is:
Kmin = − [In · · · In] (Z†m)T .
Next, we recall that C(K) = E[Cm(K)] is:
C(K) = n
2 +
1 2 tr
( KTK [ I 0 0 np I ]) + tr ( K [ Wc 0 ]) .
Our next goal is to compute E[C(Kmin)]. First, we observe that:
tr ( Kmin [ Wc 0 ]) = − 〈 Z†m, [ Wc . . . Wc 0 . . . 0 ]〉 = − m
m+ 1 tr(WTc Wc)
= − m m+ 1 n .
Next, defining Bi := mm+1Wi − 1 m+1 ∑ j 6=iWj , we compute K T minKmin as:
KTminKmin =
[ 1
m+1Wc · · · 1
m+1Wc B1 · · · Bm ]I · · · I... . . . ... I · · · I   1 m+1W T c B T 1 ... ...
1 m+1W T c B T m  = [ m2
(m+1)2 I ∗ ∗ ( ∑m i=1Bi)( ∑m i=1Bi) T
]
=
[ m2
(m+1)2 I ∗ ∗ 1(m+1)2 ( ∑m i=1Wi)( ∑m i=1Wi) T
] .
Therefore:
tr ( KTminKmin [ I 0 0 np I ]) =
m2
(m+ 1)2 n+
n
p(m+ 1)2 (nm) .
Putting everything together, we have that:
C(Kmin) = n
2 +
m2n
2(m+ 1)2 +
n2m
2p(m+ 1)2 − m m+ 1 n .
Notice that this final value is not a function of the actual realization of W .
We now consider the second source of error, which comes from the initialization K0. Recall that each entry of K0 is drawn iid from N (0, ψ2). Let us consider the gradient descent dynamics:
Kt+1 = Kt − η∇Cm(Kt) . Unrolling the dynamics under our notation:
Kt = K0(I − (η/m)ZTmZm)t − (η/m) [In . . . In]Zm t−1∑ k=0 (I − (η/m)ZTmZm)k .
It is not hard to see that for η sufficiently small, as t→∞
lim t→∞ −(η/m) [In . . . In]Zm t−1∑ k=0 (I − (η/m)ZTmZm)k = Kmin .
Hence:
K∞ = K0(I − (η/m)ZTmZm)∞ +Kmin . Call the matrix M∞ := (I − (η/m)ZTmZm)∞. We observe that:
C(K∞) = n
2 +
1 2 tr
( MT∞K T 0 K0M∞ [ I 0 0 np I ]) + 1
2 tr
( (MT∞K T 0 Kmin +K T minK0M∞) [ I 0 0 np I ]) + 1
2 tr
( KTminKmin [ I 0 0 np I ]) + tr ( K0M∞ [ Wc 0
]) + tr ( KminM∞ [ Wc 0 ]) .
Noticing that K0 is independent of Zm, taking expectations
E[C(K∞)] = E[C(Kmin)] + 1
2 E tr
( MT∞K T 0 K0M∞ [ I 0 0 np I ]) = E[C(Kmin)] + ψ2n
2 E tr
( MT∞M∞ [ I 0 0 np I ]) .
Above, we use the fact that E[KT0 K0] = ψ2nIn+p. Now it is not hard to see that for η sufficiently small, we have that M∞ = I − PZTm . On the other hand, using E[WiW T j ] = 0, we have that
E[PZTm ] =
[ m m+1I 0
0 m 2
m+1 n p I
] .
Therefore:
E[MT∞M∞] = [ (1−m/(m+ 1))I 0
0 (1−m2n/((m+ 1)p)I
] .
Plugging in to the previous calculations, this yields
E[C(K∞)] = E[C(Kmin)] + ψ2n2
2
( m+ 2
m+ 1 − m
2
m+ 1
n
p
) .

Review summaries:
The paper proposes a method for measuring generalization error in reinforcement learning (RL). The paper proposes to disentangle the observations into the features that relevant and not-relevant for the policy and then perturb the non-relevant features while keeping the relevant features constant. If the agent has learned to generalize, then perturbing the non-relevant features should not change the RL score.