{'fraction_non_alphanumeric': 0.03582637374328422, 'fraction_numerical': 0.011995318899941486, 'mean_word_length': 4.682182257820765, 'pattern_counts': {'":': 0, '<': 44, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Temporal Predictive Coding For Model-Based Planning In Latent Space

High-dimensional observations are a major challenge in the application of model-based reinforcement learning (MBRL) to real-world environments. To handle high-dimensional sensory inputs, existing approaches use representation learning to map high-dimensional observations into a lower-dimensional latent space that is more amenable to dynamics estimation and planning. In this work, we present an information-theoretic approach that employs temporal predictive coding to encode elements in the environment that can be predicted across time. Since this approach focuses on encoding temporally-predictable information, we implicitly prioritize the encoding of task-relevant components over nuisance information within the environment that are provably task-irrelevant. By learning this representation in conjunction with a recurrent state space model, we can then perform planning in latent space. We evaluate our model on a challenging modification of standard DMControl tasks where the background is replaced with natural videos that contain complex but irrelevant information to the planning task. Our experiments show that our model is superior to existing methods in the challenging complex-background setting while remaining competitive with current state-of-the-art models in the standard setting.


Introduction
Learning to control from high dimensional observations has been made possible due to the advancements in reinforcement learning (RL) and deep learning. These advancements have enabled notable successes such as solving video games (Mnih et al., 2015;Lample & Chaplot, 2017) and continuous control problems (Lillicrap et al., 2016) from pixels. How-ever, it is well known that performing RL directly in the high-dimensional observation space is sample-inefficient and may require a large amount of training data (Lake et al., 2017). This is a critical problem, especially for real-world applications. Recent model-based RL works (Kaiser et al., 2020;Ha & Schmidhuber, 2018;Hafner et al., 2019;Zhang et al., 2019;Hafner et al., 2020) proposed to tackle this problem by learning a world model in the latent space, and then applying RL algorithms in the latent world model.
The existing MBRL methods that learn a latent world model typically do so via reconstruction-based objectives, which are likely to encode task-irrelevant information, such as of the background. In this work, we take inspiration from the success of contrastive learning and propose a model that employs temporal predictive coding for planning from pixels. The use of temporal predictive coding circumvents the need for reconstruction-based objectives and prioritizes the encoding of temporally-predictable components of the environment, thus making our model robust to environments dominated by nuisance information. Our primary contributions are as follows: • We propose a temporal predictive coding approach for planning from high-dimensional observations and theoretically analyze its ability to prioritize the encoding of task-relevant information.
• We show experimentally that temporal predicting coding allows our model to outperform existing state-ofthe-art models when dealing with complex environments dominated by task-irrelevant information, while remaining competitive on standard DeepMind control (DMC) tasks. Additionally, we conduct detailed ablation analyses to characterize the behavior of our model.

Motivation
The motivation and design of our model are largely based on two previous works Hafner et al., 2020).
In this section, we briefly go over the relevant concepts in each work as well as how they motivate our paper. Shu et al. (2020) proposed PC3, an information-theoretic approach that uses contrastive predictive coding (CPC) to learn a latent space amenable to locally-linear control. Their framework uses a CPC objective between the latent states of two arXiv:2106.07156v1 [cs.LG] 14 Jun 2021 consecutive time steps. They then use the latent dynamics F as the variational device to define the following lower bound cpc (E, F ): in which E is the encoder, which encodes a highdimensional observation into a latent state. We make particular note of their choice to define the CPC objective for latent states across time steps instead of between the frame and its corresponding state-as is popular in the existing literature on contrastive learning for RL (Hafner et al., 2020;Srinivas et al., 2020;Ding et al., 2020). We shall refer to these respective objectives henceforth as temporal predictive coding (TPC) and static predictive coding (SPC) respectively. Shu et al. (2020) motivated temporal predictive coding via a theory of predictive suboptimality, which shows that the representation learned by temporal predictive coding is no worse at future-observation prediction than the representation learned by a latent variable model when applied to the same task.
In this work, we take a stronger position and argue that temporal predictive coding learns an information-theoretically superior representation to conventional latent variable models and static predictive coding models. This is because conventional latent variables models (i.e. temporal variational autoencoders equipped with a Gaussian decoder) and static predictive coding models both seek to encode as much information as possible about the original high-dimensional observations. In contrast, temporal predictive coding only encourages the encoding of temporally-predictable information within the environment, which we shall prove is sufficient for optimal decision making (Section 3.2). This property of temporal predictive coding thus makes this objective particularly suitable for handling RL problems dominated by nuisance information, which has recently become an active area of research (Ding et al., 2020;Zhang et al., 2020;Ma et al., 2020).
However, since PC3 only tackles the problem from an optimal control perspective, it is not readily applicable to RL problems. Indeed, PC3 requires a depiction of the goal to perform control, and also the ability to teleport to random locations of the state space to collect data, which are impractical in many problems. On the other hand, Dreamer (Hafner et al., 2020) achieves state-of-the-art performance on many RL tasks, but learns the latent space using a reconstructionbased objective. And while the authors reported a contrastive approach that yielded inferior performance to their reconstruction-based approach, their contrastive approach employed a static predictive coding objective.
The goal of our paper is thus two-fold. First, we propose a model that leverages the concepts in PC3 and apply them to the Dreamer paradigm and RL setting. In particular, we show how to incorporate temporal predictive coding into the training of the recurrent state space model used in Dreamer. Second, we will demonstrate both theoretically and empirically that our resulting model is robust to RL environments that are dominated by nuisance information.

Temporal Predictive Coding for Planning
To plan in an unknown environment, we need to model the environment dynamics from experience. Following the Dreamer paradigm, we do so by iteratively collecting new data and using those data to train the world model. In this section, we focus on presenting the proposed model (its components and objective functions), a theoretical analysis of temporal predictive coding, followed lastly by some practical considerations when implementing the method.

Model Definition
Since we aim to learn a latent dynamics model for planning, we shall define an encoder E to embed high-dimensional observations into a latent space, a latent dynamics F to model the world in this space, and a reward function, Reward function: R(r t | s t ) = p(r t | s t ) (2) in which t is the discrete time step, {o t , a t , r t } T t=1 are data sequences with image observations o t , continuous action vectors a t , scalar rewards r t , and s t denotes the latent state at time t. We model the transition dynamics using a recurrent neural network with a deterministic state h t = RNN(h t−1 , s t−1 , a t−1 ), which summarizes information about the past, followed by the stochastic state model p(s t |s <t , a <t ) = p(s t |h t ). Following Hafner et al. (2019), we refer to this RNN as the recurrent state space model (RSSM). In practice, we use a deterministic encoder, and Gaussian distribution for dynamics and reward functions. The graphical model is presented in Figure 1. We now introduce the three key components of our model: temporal predictive coding, consistency, and reward prediction.
Temporal predictive coding with an RSSM Instead of performing pixel prediction to learn E and F as in Hafner et al. (2019;, we maximize the mutual information between the past latent codes and actions against the future latent code I(E(O t ); E(O <t ), A <t ). This objective prioritizes the encoding of predictable components from the environment, which potentially helps avoid encoding nuisance information when dealing with complex image observations. Unlike in Shu et al. (2020), which defined Figure 1. The graphical model of TPC, in which we employ a recurrent neural network to model the dynamics. We omit the action and reward for simplicity. The approximation ofŝt with st is done by using contrastive predictive coding and maximum likelihood.
the TPC objective in a Markovian setting, the use of an RSSM means that we are maximizing the mutual information between the latent code at any time step t and the entire historical trajectory latent codes and actions prior to t. To handle a trajectory over T steps, we define an objective that sums over every possible choice of t ∈ {2, . . . , T }, To estimate this quantity, we employ contrastive predictive coding (CPC) proposed by Oord et al. (2018). We perform CPC by introducing a critic function f to construct the lower bound at a particular time step t, where the expectation is over K i.i.d. samples of (o t , o <t , a <t ). Note that Eq. (4) uses past (E(o <t ) from unrelated trajectories as an efficient source of negative samples for the contrastive prediction of the future latent code E(o (i) t ). Following Shu et al. (2020), we choose to tie f to our recurrent latent dynamics model F , exp f (s t , s <t , a <t ) = F (s t |s <t , a <t ).
There are two favorable properties of this particular design. First, it is parameter-efficient since we can circumvent the instantiation of a separate critic f . Moreover, it takes advantage of the fact that an optimal critic is the true latent dynamics induced by the encoder E (Poole et al., 2019;Ma & Collins, 2018). We denote our objective as tpc (E, F ).
Enforcing latent dynamics consistency Although the true dynamics is an optimal critic for the CPC bound, maximizing this objective only does not ensure the learning of a latent dynamics model F that is consistent with the true latent dynamics, due to the non-uniqueness of the optimal critic . Since an accurate dynamics is crucial for planning in the latent space, we additionally introduce a consistency objective, which encourages the latent dynamics model to maintain a good prediction of the future latent code given the past latent codes and actions. Similar to the recurrent CPC objective, we optimize for consistency at every time step in the trajectory, Reward prediction Finally, we train the reward function by maximizing the likelihood of the true reward value conditioned on the latent state s t = E(o t ),

Theoretical Analysis
In contrast to a reconstruction-based objective, which explicitly encourages the encoder to behave injectively on the space of observations, our choice of mutual information objective as specified in Eq. (4) may discard information from the observed scene. In this section, we wish to formally characterize the information discarded by the temporal predictive coding (TPC) objective and argue that any information discarded by an optimal encoder under the TPC objective is provably task-irrelevant. Lemma 1. Consider an optimal encoder and reward pre- Let π(a t | E * (o ≤t ), a <t ) denote an E * -restricted policy whose access to the observations o <t is restricted by E * .
Let π aux (a t | E * (o ≤t ), E (o ≤t ), a <t ) denote an (E * , E )restricted policy which has access to auxiliary information about o <t via some encoder E . Let η(π) denote the expected cumulative reward achieved by a policy π over a finite horizon T . Then there exists no encoder E where the optimal E * -restricted policy underperforms the optimal (E * , E )-restricted policy, Intuitively, since E * optimizes TPC, any excess information contained in E about o t (not already accounted for by E * ) must be temporally-unpredictive-it is neither predictable from the past nor predictive of the future. The excess information conveyed by E is effectively nuisance information and thus cannot be exploited to improve the agent's performance. It is therefore permissible to dismiss the excess information in E as being task-irrelevant. We provide a proof formalizing this intuition in Appendix B.
It is worth noting that TPC does not actively penalize the encoding of nuisance information, nor does temporallypredictive information necessarily mean it will be taskrelevant. However, if the representation space has limited capacity to encode information about o t (e.g., due to dimensionality reduction, a stochastic encoder, or an explicit information bottleneck regularizer), TPC will favor temporally-predictive information over temporallyunpredictive information-and in this sense, thus favor potentially task-relevant information over provably taskirrelevant information. This is in sharp contrast to a reconstruction objective, which makes no distinction between these two categories of information contained in the observation o t .

Practical Implementation Details
Avoiding map collapse Naively optimizing tpc and cons can lead to a trivial solution, where the latent map collapses into a single point to increase the consistency objective arbitrarily. In the previous work, Shu et al. (2020) resolved this by adding Gaussian noise to the future encoding, which balances the latent space retraction encouraged by cons with the latent space expansion encouraged by tpc . However, we found this trick insufficient and thus further incorporate a variant of static predictive coding. Our static predictive coding defines a lower bound for Crucially, our variant keeps the variance σ fixed so that the static predictive coding objective solely serves the role of encouraging map expansion.
Smoothing the dynamics model Since our encoder is deterministic, the dynamics always receives clean latent codes as inputs during training. However, in behavior learning, we roll out multiple steps towards the future from a stochastic dynamics. These roll outs are susceptible to a cascading error problem, which hurts the value estimation and policy learning. To resolve this issue, we smooth the dynamics by adding Gaussian noise to the inputs of the recurrent dynamics during training. The noise-adding procedure is as follows: assume the dynamics outputsŝ t ∼ N (µ t , σ 2 t ) as the prediction at time step t, we then add t ∼ N (0, σ 2 t ) to s t = E(o t ) and feed it to the latent dynamics, and repeat for every time step 1 ≤ t ≤ T . We call this dynamicsassociated noise, which ensures that the latent dynamics can handle the amount of noise that it produces when rolling out. The overall objective of our model is

Behavior Learning
Following Hafner et al. (2020), we use latent imagination to learn a parameterized policy for control. For selfcontainedness, this section gives a summary of this approach. Given the latent state s t = E(o t ), we roll out multiple steps into the future using the learned dynamics F , estimate the return and perform backpropagation through the dynamics to maximize this return, which in turn improves the policy.
Action and value models Two components needed for behavior learning are the action model and the value model, which both operate on the latent space. The value model estimates the expected imagined return when following the action model from a particular state s τ , and the action model implements a policy, conditioned on s τ , that aims to maximize this return. With imagine horizon H, we have Action model: a τ ∼ π(a τ |s τ ) Value estimation To learn the action and value model, we need to estimate the state values of imagined trajectories {s τ , a τ , r τ } t+H τ =t , where s τ and a τ are sampled according to the dynamics and the policy. In this work, we use value estimation presented in Sutton & Barto (2018), which allows us to estimate the return beyond the imagine horizon. The value model is then optimized to regress this estimation, while the action model is trained to maximize the value estimation of all states s τ along the imagined trajectories,

Experiments
In this section, we empirically evaluate the proposed model (which we shall simply refer to as TPC for convenience) in various settings. First, we design experiments to compare the relative performance of our model with the current best model-based method in several standard control tasks. Second, we evaluate its ability to handle a more realistic but also more complicated scenario, in which we replace the background of the environment with a natural video. We discuss how our model is superior in the latter case compared to other existing methods, while remaining competitive in the standard setting. Finally, we conduct ablation studies to demonstrate the importance of the components of our model.

Control tasks
For the standard setting, we test our model on 6 DeepMind Control (DMC) tasks (Tassa et al., 2018): Cartpole Swingup, Cheetah Run, Walker Run, Pendulum Swingup, Hopper Hop and Cup Catch. In the natural background setting, we replace the background of each data trajectory with a video taken from the kinetics dataset (Kay et al., 2017). We split the original dataset into two separate sets for training and evaluation to also test the generalization of each method.
Baseline methods We compare TPC with Dreamer (Hafner et al., 2020), CVRL (Ma et al., 2020), and DBC (Zhang et al., 2020). We compare against Dreamer since it is the current state of the art model-based method for planning from pixels and directly inspired our design of TPC. CVRL is a closely-related contrastive-based model recently developed that also touted its ability to handle nuisance backgrounds. Finally, we compare with DBC, a leading model-free method for learning representations that are invariant to distractors, to showcase how temporal predictive coding fares against bisimulation for learning task-relevant representations for downstream control. Each method is evaluated by the environment return in 1000 steps. For the baselines, we use the best set of hyperparameters as reported in their paper. We run each task with 3 different seeds for each model. The return is computed in 1000 evironment steps. Each task is run with 3 seeds.

Comparisons in Standard Setting
We demonstrate the performance of all methods on standard control tasks in Figure 2. TPC is competitive with Dreamer in all but one task, while CVRL and DBC both underperformed Dreamer on four tasks. TPC's strong performance is in contrast to what was previously observed in Dreamer (Hafner et al., 2020), where they showed the inferiority of a static contrastive learning approach (which applies CPC between an image observation and its corresponding latent code) compared to their reconstruction-based approach. Our results thus show that the use of temporal contrastive predictive coding is critical for learning a latent space that is suitable for behavior learning.

Comparisons in Natural Background Setting
In this setting, we evaluate the robustness of TPC versus the baselines in dealing with complicated, natural backgrounds. The performance of all models in this setting is shown in Figure 3. Dreamer fails to achieve meaningful performance across all six tasks. This is due to the use of reconstruction loss, which forces the world model to reconstruct every single pixel in the observations, thus leading to the encoding of task-irrelevant information.
TPC outperforms all the baselines significantly on two of the six tasks, while being competitive to CVRL on Walker Run and Cheetah Run (see Appendix C for more environment steps, where TPC outperforms CVRL on three tasks).
All methods fail to work on Hopper Hop and Cup Catch 1 after 1 × 10 6 environment steps. Hopper Hop is a very challenging task even in the standard setting. Furthermore, the agents in these two tasks are tiny compared to the complex backgrounds, thus making it difficult for the model to distill task-relevant information. We note that the discrepancy between our results for CVRL and results reported in their paper (Ma et al., 2020) is due to the fact that while they used Imagenet (Russakovsky et al., 2015) for backgrounds in the original experiments, we use videos from kinetics dataset (Kay et al., 2017) instead.
DBC fails to work on all six tasks, which is in contrast to their reported performance in (Zhang et al., 2020). We note that, in their experiments, the authors used a single video for both training and testing. Their poor performance in our setting suggests that DBC is incapable of dealing with multiple distracting scenes, and also does not generalize well to unseen distractors.
Overall, the empirical results show that our proposed model is superior to all the baselines. In practice, it is desirable to have model which can work well for both standard (easy) setting and natural background (complex, distracting) setting. TPC satisfies this, since it performs on-par with Dreamer and significantly better than CVRL and DBC on standard control tasks, and in natural background setting which Dreamer fails, TPC works reasonably well and outperforms their counterparts CVRL and DBC.

Ablation Analysis
We conduct an ablation analysis to evaluate the importance of each CPC objective employed in TPC. To do so, we compare the original model with two variants, where we omit the temporal predictive coding or static predictive coding objective respectively (added to prevent map collapse; see Section 3.3). The relative performance of these models on three control tasks is shown in Figure 4. The original TPC achieves the best performance, while the variant with only static predictive coding (denoted SPC) fails across all three tasks. TPC without static predictive coding (Unstable-TPC) is unstable, since it faces the map collapsing problem, which leads to poor performance.

Analysis in the Random Background Setting
To demonstrate that temporal predictive coding is able to filter out temporally-unpredictive information, we conduct an experiment where the background is randomly chosen for each time step. In this setting, the only source of temporallypredictive information is the agent itself. Using the representations learned by Dreamer, TPC, and SPC, we then 1 TPC and CVRL work on Cup Catch after 2 × 10 6 steps. The results are shown in Appendix C.  trained auxiliary decoders that try to reconstruct the original observations. Figure 5 shows that the representation learned by TPC is unable to reconstruct the background but can reconstruct the agent with high fidelity. In contrast, Dreamer's representation can reconstruct most of the image but not the agent itself, and SPC's reconstructions are largely uninterpretable. Furthermore, of the three models, only TPC successfully performs in the random background setting.
While the random background setting experiment aligns with our theoretical analysis and clearly demonstrates TPC's robustness to temporally-unpredictive nuisance information, it also exposes a particular limitation in our theoretical understanding of TPC's performance in the natural background setting, since natural videos are in fact a source of temporally-predictive nuisance information. We provide two possible explanations for TPC's empirically strong performance in the natural background setting. First, the natural videos may contain considerable temporally-unpredictive information that TPC successfully dismisses. Second, the natural videos largely consist of hard-to-predict informa-tion that our recurrent neural network deems effectively unpredictable. We note that the latter potential explanation appears intimately related to the concept of "usable information" (Xu et al., 2020) whenever we instantiate a mutual information estimator with finite-computational power-and is worthy of further research scrutiny.

Related Work
Learning latent space for model-based RL via reconstruction Latent world models can be learned by jointly training the encoder and the latent dynamics model with observation reconstruction loss. Learning Controllable Embedding (LCE) approach, including E2C (Watter et al., 2015), RCE (Banijamali et al., 2018) and PCC , uses randomly collected data to pre-train a Markovian latent dynamic model that is specifically designed for locallylinear control, then run offline optimal control on top of the learned latent space. CARL (Cui et al., 2020) extends these works for Soft Actor-Critic (Haarnoja et al., 2018) and also proposes an online version, in which they iteratively learn the model and a parameterized policy. World Models (Ha & Schmidhuber, 2018) learn a recurrent latent dynamic model in a two-stage process to evolve their linear controllers in imagination. PlaNet (Hafner et al., 2019) jointly learns a recurrent state space model (RSSM) and plans in latent space using the cross entropy method, while Dreamer (Hafner et al., 2020) uses RSSM to iteratively learn the model and the policy by backpropagating through the dynamics. SOLAR (Zhang et al., 2019) models the dynamics as time-varying linear-Gaussian with quadratic costs and controls using guided policy search. However, training world models with reconstruction loss has several drawbacks: it requires a decoder as an auxiliary network for predicting images, and by reconstructing every single pixel, those methods are potentially vulnerable to task-irrelevant information such as an irrelevant background.
Learning latent space for model-based RL via constrastive learning An alternative framework for learning latent world models is contrastive learning. Contrastive learning is a self-supervised learning technique that aims to learn representations by contrasting positive samples against negative samples without having to reconstruct images (Oord et al., 2018;Chen et al., 2020a). Recently proposed contrastive learning methods have achieved significant successes in learning representations purely from unlabeled data, which include works by (Chen et al., 2020a;Bachman et al., 2019;Hénaff et al., 2019;He et al., 2020;Tian et al., 2019). Poole et al. (2019) has also established a close connection between contrastive learning and mutual information maximization. In the context of RL, recent works have proposed to use this framework to accelerate RL from pixels in two distinct directions: 1) cast contrastive learning as an auxiliary representation learning task, and use model-free RL methods on top of the learned latent space (Oord et al., 2018;Srinivas et al., 2020); and 2) use contrastive learning in conjunction with learning a latent dynamics for planning in the latent space Ding et al., 2020;Hafner et al., 2020).
Learning to control from pixels with distractors To work well in real-world scenarios, a control-from-pixel method needs to be robust against distractors in the observation. Recent works have been proposed to address this problem, including CVRL (Ma et al., 2020) and DBC (Zhang et al., 2020). Similar to TPC, CVRL employs a contrastive-based objective to learn the latent representation and latent dynamics that enable direct planning in latent space. However, they aim to maximize the mutual information between the current observation o t and its corresponding latent state s t . This in theory still encourages the model to encode as much information in the observation as possible, including rich but task-irrelevant information such as the background. Our proposed TPC, in contrast, employs a temporal predictive coding objective, which helps discourage the encoding of provably task-irrelevant information, as shown in Section 3.2. Taking a different approach, DBC was proposed to learn invariant representations for RL by forcing the latent space to preserve the on-policy bisimulation metric. This is in theory better than our contrastive objective, since it is capable of filtering out task-irrelevant but temporally-predictive information. However, while being theoretically sound, their implemented objective does not adhere to the true bisimulation metric. Specifically, they never solved the fixed point equation to compute the metric, but instead used a heuristic version of it, where they replaced the ground metric d with Euclidean distance while comparing two distributions of the next state, with d being the current bisimulation metric.

Conclusion
In this work, we propose a temporal predictive coding approach for planning in latent space. We show theoretically and experimentally that temporal predictive coding prioritizes the encoding of task-relevant components over temporally-unpredictive-and thus provably-irrelevantinformation. This is critically different from reconstructionbased objectives as well as static contrastive learning objectives that only maximize the mutual information between the current observation and its latent code, which indiscriminately favor the encoding of both task-relevant and irrelevant information. Our experiments show that temporally predictive coding outperforms state-of-the-art models in environments dominated by task-irrelevant information while remaining competitive on standard DMC tasks. • Activation function: ELU • The action model outputs a tanh mean scaled by a factor of 5 and a softplus standard deviation for the Normal distribution that is then transformed using tanh (Haarnoja et al., 2018) Learning updates • Gradient update rate: 100 gradient updates every 1000 environment steps.

Environment interaction
• The dataset is initialized with S = 5 episodes collected using random actions.
• We iterate between 100 training steps and collecting 1 episode by executing the predicted mode action with N (0, 0.3) exploration noise.
• Action repeat: 2 • Environment steps: 2 × 10 6 Additionally, • Dreamer and CVRL clip the KL below 3 nats • CVRL uses a bi-linear model for the critic function in the contrastive loss: f θ (s t , o t ) = exp(z T t W θ s t ), where z t is an embedding vector for observation o t and W θ is a learnable weight matrix parameterized by θ.
• TPC has a fixed set of coefficient in the overall objective for all control tasks: λ 1 = 1, λ 2 = 0.1, λ 3 = 1, λ 4 = 1. We use a fixed Gaussian noise ∼ N (0, 0.2 2 ) to add to the future latent code when computing temporal CPC, as suggested in , and also use 0.2 as the fixed variance in static CPC.
In TPC, we also use a target network for the value model and update this network every 100 gradient steps. Note that we also tried to use target value network for Dreamer, but it does not improve the results, as suggested by their original paper (Hafner et al., 2020).
Hyperparameters for DBC We use the same set of hyperparameters as reported in the paper (Zhang et al., 2020) • Replay buffer capacity: 1000000 • • Temperature Adam's β 1 : 0.9 • Init temperature: 0.1 Hyperparameters search for TPC TPC has four hyperparameters that can be tuned: λ 1 , λ 2 , λ 3 and λ 4 , which are coefficients for the TPC objective, consistency objective, SPC objective and reward prediction objective, respectively. Since λ 1 , λ 3 and λ 4 do not conflict with each other, we fixed them to 1 and only tuned λ 2 in our experiments. We performed grid search for λ 2 in range {0.05, 0.1, 0.2} 2 on the Cartpole Swingup task and then used the same set of hyperparameters for all the remaining tasks.

A.2. Natural background setting
To further encourage the model to focus on task-relevant information from observations, we additionally tune the weight λ 4 of the reward loss in the training objective for both Dreamer and TPC. In each control task they share the same reward coefficient, which is specified in the table below. CVRL and DBC have the same hyperparameters as in the standard setting.

B. Proof of Lemma 1
Our goal is to show that, under the conditions in Lemma 1, for any choice of auxiliary encoder E .
We start by denoting s t = E * (o t ) and s t = E (o t ). Note that the performance of π aux can be written as where τ aux denotes the full trajectory of (o, s, s , a) 1:T and r(o t ) evaluates the reward at o t (for simplicity, we shall assume where, with a slight abuse of notation, we note that R * (E * (o t )) = r(o t ). We now further rewrite π aux (a t | s ≤t , s ≤t , a <t ) as p(a t | s ≤t , s ≤t , a <t , π aux ), and subsequently collapse the expression of the performance as η(π aux ) = where the last step arises from marginalization of o 1:T . Note by chain rule that p(s 1:T , s 1:T , a 1:T | π aux ) becomes t p(s t | s <t , s <t , a <t , π aux )p(s t | s ≤t , s <t , a <t , π aux )p(a t | s ≤t , s ≤t , a <t , π aux ).
By analyzing the Markov blankets in p(s 1:T , s 1:T , a 1:T | π aux ), we can simplify the above expression to t p(s t | s <t , s <t , a <t )p(s t | s ≤t , s <t , a <t )p(a t | s ≤t , s ≤t , a <t , π aux ).
Note that we omit the dependency on π aux in the first two terms since, given only the history of past actions and observations, the next observation does not depend on our choice of policy but only on the environment dynamics.
Since E * is optimal under the MI objective, we note that I(S <t , S <t , A <t ; S t , S t ) = I(S <t , A <t ; S t ).
Eq. (24) implies that s <t is independent of s t given (s <t , a <t ), and that (s <t , s <t , a <t ) is independent of s t given s t . This allow us to further simplify Eq. (23) to t p(s t | s <t , a <t )p(s t | s t )π aux (a t | s ≤t , s ≤t , a <t ).
Thus, the performance expression equates to Note by way of similar reasoning (up to and including Eq. (23)) that By comparing Eq. (26) and Eq. (27), we see that s 1:T effectively serves as a source of noise that makes π aux behave like a stochastic policy depending on the seed choice for s 1:T . To take advantage of this, we introduce a reparameterization of s as such that where the last inequality comes from defining a policy π := π aux (a t | o ≤t , * ≤t , a <t ) and noting that the performance of π must be bounded by the performance of π * .

C. Additional Results
C.1. Comparision with CVRL after 2 × 10 6 environment steps In Figure 6, we compare the performance of TPC and CVRL after 2 × 10 6 environment steps in both the standard setting and the natural background setting. TPC learns faster and achieves much higher rewards compared to CVRL in the standard setting. In the natural control setting, TPC outperforms in 4 out of 6 tasks and is competitive in Walker Run. Both methods do not work on Hopper Hop.

C.3. Importance of dynamics smoothing
We run TPC in the standard setting without dynamics smoothing to investigate the empirical importance of this component. As shown in Figure 8, TPC 's performance degrades significantly without dynamics smoothing. Without smoothing, the dynamics model cannot handle noisy rollouts during test-time planning, leading to poor performance. Dynamics smoothing prevents this by enabling test-time robustness against cascading error.

C.4. Learning a separate reward model
Joint learning of reward is crucial for all models in the natural background setting (see Appendix A.2). Since background information is also temporally-predictive, increasing the weight of reward loss encourages the model to focus more on the components that are important for reward learning. However, in the random background setting, since all temporallypredictive information is task-relevant, TPC uniquely can learn the reward separately, as shown in Figure 9.

C.5. Reconstructions in the natural background setting
We conduct experiments to investigate what information the encoder in different models learns to encode during training in the natural background setting. To do that, we train auxiliary decoders that try to reconstruct the original observations from the representations learned by Dreamer and TPC. As shown in Figure 10, Dreamer (2 nd row) tries to encode both the agent and the background. In contrast, TPC (3 rd row) prioritizes encoding the agent, which is task-relevant, over the background.  As discussed in Section 3.2, TPC can capture certain task-irrelevant information. However, TPC can choose to not encode the background whenever encoding only the agent is sufficient to maximize the mutual information. In the experiments, we found that forcing the model to predict well the reward helps the encoder focus more on the agent, which can be done by increasing the weight of reward loss. Dreamer, in contrast, must encode as much information about the observation as possible to achieve a good reconstruction loss. To elaborate on this, we conducted an experiment where we replaced the natural background with a simplistic motion, easily predictable background, which is depicted in Figure 11. Figure 12 shows that TPC works well in this setting, and outperforms Dreamer significantly.