Observational Overfitting in Reinforcement Learning
Xingyou Song, Yiding Jiang, Stephen Tu, Yilun Du, Behnam Neyshabur
Introduction
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.
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:
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.
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.
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, as well as ablates various ImageNet architectures and margin metrics.
Motivation and Related Work
We start by showing an example of observational overfitting, found from the Gym-Retro benchmark for the game Sonic The Hedgehog (Nichol et al., 2018). In this benchmark, 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.
As shown in Figure 1, by using saliency maps (Greydanus et al., 2018), we found that the agent strongly overfits to the scoreboard/timer (i.e. an artifact correlated with progress in the level through determinism). In fact, by only showing the scoreboard as the observation, we found that the agent was still able to train to 5K reward. By blacking out this scoreboard with a black rectangle in the regular image during training, we saw an increase in test performance performance by for both the NatureCNN and IMPALA policies described in (Cobbe et al., 2018). Specifically, in terms of mean reward across training runs, NatureCNN increased from to , while IMPALA increased from to when the standard deviation between runs was .
Furthermore, we found that background objects such as clouds and textures were also highlighted, suggesting that they are also important features for training the agent. One explanation for this effect is due to the benchmark being from a sidescroller game - the background objects move backward as the character moves forward, thus making them correlated with progress.
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.
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.
2 Notation
In the zero-shot framework for RL generalization, we assume there exists a distribution over MDP’s for which there exists a fixed policy that can achieve maximal return on expectation over MDP’s generated from the distribution. An appropriate finite training set can then be created by repeatedly randomly sampling . Thus for a MDP and any policy , expected episodic reward is defined as .
In many empirical cases, the support of the distribution is made by parametrized MDP’s where some process, given a parameter , creates a mapping (e.g. through procedural generation), and thus we may simplify notation and instead define a distribution that induces , which implies a set of samples also induces a , and we may redefine reward as .
As a simplified model of the observational problem from Sonic, we can construct a mapping by first fixing a base MDP , which corresponds to state space, action space, reward, and transition. The only effect of is to introduce an additional observation function , where the agent receives input from the high dimensional observation space rather than from the state space . Thus, for our setting, actually parameterizes a POMDP family which can be thought of as simply a combination of a base MDP and an observational function , hence .
3 Setup
We can model the effects of Figure 1 more generally, not specific to sidescroller games. We assume that there is an underlying state (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
In this setup, is a function invariant for the entire MDP population , while is a function dependent on the sampled parameter . is a ”combination” function which combines the two outputs of and to produce a final observation. While projects this latent data into salient and important, invariant features such as the avatar, monsters, and items, 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 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 -scheme.
This setting also leads to more interpretable generalization bounds - Lemma 2 of (Wang et al., 2019) provides a high probability bound for the “intrinsic” generalization gap when levels are sampled: , where
is the Rademacher Complexity under the MDP, where are the parameters used in the original work, and the transition and initialization 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.
4 Architecture and Implicit Regularization
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 is a static concatenation, but still are able to demonstrate insightful properties. We note that this inductive bias on allows explicit regularization to trivially solve this problem, by penalizing a policy’s first layer that is used to “view” (Appendix A2), hence we only focus on implicit regularizations.
Experiments
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 , while where are semi-orthogonal matrices, to prevent information loss relevant to outputting the optimal action, as the state is transformed into the observation. Hence, if is the underlying state at time , then the observation is and thus the action is , where is the policy matrix. While remains a constant matrix, we sample randomly, using the “level ID” integer as the seed for random generation. In terms of dimensions, if is of shape , then also projects to a shape of , while projects to a much larger shape , implying that the observation to the agent is of dimension . In our experiments, we set as default .
If is the unique minimizer of the original cost function, then the unique minimizer of the population cost is . However, if we have a single level, then there exist multiple solutions, for instance . This extra bottom component causes overfitting. In Appendix A.4.2, 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.
Furthermore, we find that increasing increases the generalization gap in the LQR setting. This is empirically verified in Figure 3 using an actual non-convex LQR loss, and the results suggest that the gap scales by . In terms of overparametrization, we experimentally added more linear layers and increased widths for a 2-layer case (Figure 3), and observe that both settings reduce the generalization gap, and also reduce the norms (spectral, nuclear, Frobenius) of the final end-to-end policy , without changing its expressiveness. This suggests that gradient descent under overparametrization implicitly biases the policy towards a “simpler” model in the LQR case.
As a surrogate model for deep RL, one may ask if the generalization gap of the final end-to-end policy can be predicted by functions of the layers . 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 (Appendix A1), 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 (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 derivable from the fact that in the linear case, and is a weight-counting term which deals with the overparametrized case, such as (Neyshabur et al., 2018a) or (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.
2 Projected Gym Environments
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 be a classic Gym environment and we generate a by performing the exact same -scheme as the LQR case, i.e. sampling to produce an observation function . 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 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, 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.
3 Deconvolutional Projections
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 IMPALA-LARGE (IMPALA with more residual blocks and higher convolution depths), which have respective parameter numbers (600K, 622K, 823K).
We setup a similar -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 and both with the same orthogonally-initialized deconvolution architecture to each produce a image (but ’s network weights are still generated by similar to before). We combine the two outputs by using one half of the ”image” from , and one half from , as shown back in Figure 2.
Figure 7 shows that the same ranking between the three architectures exists as well on the Gym-Deconv dataset. We show that generalization ranking among NatureCNN/IMPALA/IMPALA-LARGE 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 ’s output to the policy. This makes the dataset impossible to generalize to, as the policy network cannot invert every single observation function 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. We perform another deconvolution memorization test, using an LQR as the underlying MDP. While Figure 8 shows that memorization performance is dampened, Figure 9 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. This supports the hypothesis that these extra residual blocks may be implicitly regularizing the network. This is corroborated by the fact that residual layers are also explained as an implicit regularization technique for SL.
4 Observational Overfitting in CoinRun
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 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 pixels does not perform well here, showing that a large portion of generalization and transfer must be based on correct convolutional setups.
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 to , and flattened the 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 10, 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 CIFAR-10.
4.2 Do State-Action Margin Distributions Predict Generalization in RL?
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 , where is the logit value (before applying softmax) of output given input , and is the matrix of states in the replay buffer, and is a norm-based Lipschitz measure on the policy network logits. In general, 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 for , and we replace the classical supervised learning pair with the state-action pairs found on-policy. We removed the training sample constant from all original measures as this is ill-defined for the RL case, when one can generate infinitely many pairs. Furthermore, we used the original in the numerator found in the first version of (Bartlett et al., 2017) rather than the current .
The expressions for (after removing irrelevant constants) are as follows, with their analogous papers:
Spectral-L1 measure: (Bartlett et al., 2017)
Distance measure: (Nagarajan & Kolter, 2019)
Spectral-Fro measure: (Neyshabur et al., 2018a)
We verify in Figure 11, 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.
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 norm measures become too dominant in the fraction, leading to the monotonic decreases in the means of the distributions as we increase parametrization.
This, with the bound results found earlier for the LQR case, suggests that current norm measures 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.
Conclusion
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:
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.
The empirical but principled Projected-Gym case for both MLP and convolutional networks which demonstrates the effects of neural network policies under nonlinear environments.
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 and 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.
Acknowledgements
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.
References
Appendix A.1 Full Plots for LQR and fg-Gym
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 , especially as regularizing the first layer’s weights substantially improves generalization.
Appendix A.2 Large ImageNet Models for CoinRun
We provide the training/testing curves for the ImageNet/large convolutional models used. Note the following:
RMC32x32 projects the native image from CoinRun from to , 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’).
Auxiliary Loss in ShakeShake was not used during training, only the pure network.
VGG-A is a similar but slightly smaller version of VGG-16.
Appendix A.3 Hyperparameters and Exact Setups
For infinite horizon case, see (Fazel et al., 2018) for the the full solution and notations. Using the same notation , denote as the cost and as the policy, where satisfies the infinite case for the Lyapunov equation:
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 , which has a precise solution, implementable in TensorFlow:
A.3.2 Projection Method
The basis for producing 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 will be processed by the same architecture, but with different network weights. This is to simulate the effect of . The numeric ID of the environment is used as an index to collect a specific set of network weights 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.
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
A.3.4 PPO Parameters
For the projected gym tasks, we used for PPO2 Hyperparameters:
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.
Appendix A.4 Theoretical (LQR)
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 we described in 3.1, we denote our low dimensional base policy as and state as rather than .
Let be the spectral norm of a matrix (i.e. largest singular value). Suppose was the infinite horizon cost for an -LQR where action , is the state at time , state transition is , and timestep cost is .
for an infinite horizon LQR, while known to be non-convex, still possess the property that when , is a global minimizer, or the problem statement is rank deficient. To ensure that our cost always remains finite, we restrict our analysis when , where for some constant , by choosing and the initialization of appropriately, using the hyperparameters found in A.3.1. We further define the observation modified cost as .
As described in Lemma 16 of (Fazel et al., 2018), we define
and over all non-zero symmetric matrices .
Lemma 27 of (Fazel et al., 2018) provides a bound on the difference for two different policies when LQR parameters are fixed. During the derivation, it states that when , then:
Assuming that in our problem setup, were fixed, this means many of the parameters in the bounds are constant, and thus we conclude:
Since we assumed or else is infinite, we thus collect the terms:
Since is a bound on for , note that
Note that this directly implies a similar bound in the high dimensional observation case - in particular, if and then .
A.4.2 Gradient Dynamics in 1-Step LQR
In the 1-step LQR, we allow , and with cost , then
The minimizer of is unique and given by .
Thus, the minimizer cost is .
As an instructive example, we consider the case when we only possess one sample . Note that if , then . In particular, if we perform gradient descent dynamics , then we have
The generalization gap may decrease if the number of level samples is high enough. This can be seen by the sample Hessian of being where . In particular, as increases, the rank of increases, which allows gradient descent to recover the minimizer better.
We calculate the exact error of gradient descent on samples of the 1-step LQR problem.
Here, the expectation is over the randomness of the samples and the initalization . The contribution from is due to the generalization error of the minimum-norm stationary point of . The contribution from is due to the full-rank initialization of .
A.4.2.2 Proof of Theorem 1
We have that is given as:
Using the fact that , , and for , we can compute:
By the matrix inversion formula we can compute the inverse as the block matrix where the diagonal blocks are and the off-diagonal blocks are . We can now write using the formula:
We use the formula , combined with the calculations in the previous proposition. ∎
Setting , we see that minimizers of are solutions to:
Using our notation above, this is the same as:
Putting everything together, we have that:
Notice that this final value is not a function of the actual realization of .
We now consider the second source of error, which comes from the initialization . Recall that each entry of is drawn iid from .
Let us consider the gradient descent dynamics:
Unrolling the dynamics under our notation:
It is not hard to see that for sufficiently small, as
Call the matrix . We observe that:
Noticing that is independent of , taking expectations
Plugging in to the previous calculations, this yields