T EMPORALLY C ONSISTENT V IDEO T RANSFORMER FOR L ONG -T ERM V IDEO P REDICTION
Anonymous authors
Paper under double-blind review
A BSTRACT
Generating long, temporally consistent video remains an open challenge in video generation.
Primarily due to computational limitations, most prior methods limit themselves to training on a small subset of frames that are then extended to generate longer videos through a sliding window fashion.
Although these techniques may produce sharp videos, they have difficulty retaining long-term temporal consistency due to their limited context length.
In this work, we present Te mporally Co nsistent Video Transformer (TECO), a vector-quantized latent dynamics video prediction model that learns compressed representations to efficiently condition on long videos of hundreds of frames during both training and generation.
We use a MaskGit prior for dynamics prediction which enables both sharper and faster generations compared to prior work.
Our experiments show that
TECO outperforms SOTA baselines in a variety of video prediction benchmarks ranging from simple mazes in DMLab, large 3D worlds in Minecraft, and complex real-world videos from Kinetics-600.
In addition, to better understand the capabilities of video prediction models in modeling temporal consistency, we introduce several challenging video prediction tasks consisting of agents randomly traversing 3D scenes of varying difficulty.
This presents a challenging benchmark for video prediction in partially observable environments where a model must understand what parts of the scenes to re-create versus invent depending on its past observations or generations.
Generated videos are available on the website: https://sites.google.com/view/iclr23-teco (cid:87)(cid:3)(cid:32)(cid:3)(cid:22)(cid:25) (cid:21)(cid:28)(cid:28)
I NTRODUCTION
Recent work in video prediction has seen tremendous progress (Ho et al., 2022; Clark et al., 2019;
Yan et al., 2021; Le Moing et al., 2021;
Ge et al., 2022; Tian et al., 2021; Luc et al., 2020) in producing high-fidelity and diverse samples on complex video data.
This can largely be attributed to a combination of increased computational resources and more compute efficient high-capacity neural architectures.
However, much of this progress has focused on generating short videos, where models can perform well by basing their predictions on only a handful of previous frames.
Video prediction models with short context windows can generate long videos in a sliding window fashion.
While the resulting videos can look impressive at first sight, they lack temporal consistency.
We would like models to predict temporally consistent videos — where the same content is generated if a camera pans back to a previously observed location.
On the other hand, the model should imagine a new part of the scene for locations that have not yet been observed, and future predictions should remain consistent to this newly imagined part of the scene.
Prior work has investigated techniques for modeling long-term dependencies, such as temporal hierarchies (Saxena et al., 2021) and strided sampling with frame-wise interpolation (Ge et al., 2022;
Hong et al., 2022).
Other methods train on sparse sets of frames selected out of long videos (Harvey et al., 2022; Skorokhodov et al., 2021;
Clark et al., 2019; Saito & Saito, 2018; Yu et al., 2022), or model videos via compressed representations (Yan et al., 2021;
Rakhimov et al., 2020; Le Moing et al., 2021; Seo et al., 2022; Gupta et al., 2022; Walker et al., 2021).
Refer to Appendix M for more detailed discussion on related work.
Despite this progress, many methods still have difficulty scaling to datasets with many longrange dependencies.
While Clockwork-VAE (Saxena et al., 2021) trains on long sequences, it is limited by training time (due to a recurrent architecture) and difficult to scale to more complex data.
On the other hand, transformer-based methods over latent spaces (Yan et al., 2021) scale poorly to long videos due to quadratic complexity in attention, with long videos containing tens of thousands of tokens.
Methods that train on subsets of tokens are limited by truncated backpropagation through time (Hutchins et al., 2022;
Rae et al., 2019; Dai et al., 2019) or naive temporal operations (Hawthorne et al., 2022).
In this paper, we introduce Te mporally Co nsistent Video Transformer (TECO), a vector-quantized latent dynamics model that effectively models long-term dependencies in a compact representation space using efficient transformers.
The key contributions are summarized as follows:
• We introduce TECO, an efficient and scalable video prediction model that learns a set of compressed VQ-latents to allow for efficient training and generation.
• We propose several long-length video prediction datasets centered around 3D scenes in DMLab (Beattie et al., 2016),
Minecraft (Guss et al., 2019), and Habitat (Szot et al., 2021; Savva et al., 2019) to help better evaluate temporal consistency in video predictions.
• We show that TECO has strong performance on a variety of difficult video prediction tasks, and is able to leverage long-term temporal context to generate high quality videos with consistency.
• We provide several ablations providing intuition for why TECO is able to generate more temporally consistency predictions, and how these insights can extend to future work in longterm video prediction.
P RELIMINARIES 2.
VQ
-GAN
VQ-GAN (Esser et al., 2021; Van Den Oord et al., 2017) is an autoencoder that learns to compress data into a set of discrete latents, consisting of an encoder E , decoder G , codebook C , and discriminator D .
Given an image x ∈ R H × W × 3 , the encoder E maps x to its latent representation h ∈ R H ′ × W ′ × D , which is quantized by nearest neighbors lookup in a codebook of embeddings
C = { e i } K i =1 to produce z ∈ R H ′ × W ′ × D .
The discretized latent z is fed through decoder G to reconstruct x .
A straight-through estimator (Bengio, 2013) is used to maintain gradient flow through the quantization step.
The codebook optimizes the following loss:
[Equation]
where β
= 0 .
25 is a hyperparameter, and e is the corresponding nearest-neighbors embedding from codebook C .
For reconstruction, VQ-GAN replaces the original ℓ 2 loss with a perceptual loss (Zhang et al., 2012), L LPIPS .
Finally, in order to encourage higher-fidelity samples, patch-level discriminator D is trained to classify between real and reconstructed images, with.
[Equation]
Overall, VQ-GAN optimizes the following combination of losses:
[Equation]
where λ =
∥ ∇ GL L LPIPS ∥
2 ∥ ∇
GL L GAN ∥
+ δ is an adaptive weight, G L is the last decoder layer, δ = 10 − 6 , and
L LPIPS is the exact distance metric described in Zhang et al.
2. M ASK G IT
MaskGit (Chang et al., 2022) is a generative model that models distributions over tokens, such as produced by a VQ-GAN.
Instead of autoregressively modelling the sequence of tokens, MaskGit generates images with competitive sample quality at a fraction of the sampling cost by using a masked token prediction objective during training.
Formally, we denote z ∈ Z H × W as the discrete latent tokens representing an image.
For each training step, we uniformly sample t ∈ [0 , 1) and randomly generate a mask m ∈ { 0 , 1 } H × W with N = ⌈ γHW ⌉ masked values, where γ = cos (cid:0) π 2 t (cid:1) .
Then, MaskGit learns to predict the masked tokens with the following objective
[Equation]
During inference, because MaskGit has been trained to model any set of unconditional and conditional probabilities, we can sample any subset of tokens per sampling iteration, from the extreme case of sampling all tokens (independent) to sampling one token at a time (autoregressive).
Chang et al.
(2022) introduces a confidence-based sampling mechanism whereas other work (Lee et al., 2022) proposes iterative sample-and-revise approaches.
TECO
Generating temporally consistent videos requires training on long videos to correctly learn longterm temporal dependencies between frames.
However, computational and memory requirements remain the primary bottleneck in preventing from doing so.
We present Te mporally Co nsistent
Video Transformer (TECO), a video generation model that more efficiently scales to training on longer horizon videos.
First, we train a VQ-GAN to spatially compress our video data.
Shown in prior work (Seo et al., 2022), this is an important step for video prediction in a more efficient and scalable manner.
However, even in latent space, existing methods are still limited to modeling short sequences of 16–24 frames, which can be attributed to the quadratics costs of transformer layers as sequence length grows.
With 256 tokens per frame, 16 frame videos already consist of 4096 tokens, and scaling to longer videos of 100s frames is prohibitively expensive, where resulting videos have tens of thousands of tokens.
Therefore, in the following sections, we propose several key design choices to building a more efficient video prediction model.
3. V ECTOR -Q UANTIZED L ATENT D YNAMICS
Our proposed framework shown in Figure 2 follows similarly to prior work in latent dynamics models (Hafner et al., 2019; 2020; Saxena et al., 2021), with several key differences in architectural and latent variable design.
Let x 1: T consist of a sequence of video frames encoded using a pretrained
[Figure]
xxhzhzhzxxx 4 zzz× L zzz
Enc
Enc Enc
Dec Dec
Dec MaskGit
MaskGit
MaskGit ^ ^
^ ^ ^ ^
[Figure]
VQ-GAN.
In the following sections, we motivate each component for our model, with several specific design choices to ensure efficiency and scalability.
TECO consists of four components:
Encoder:
[Equation]
Dynamics Prior:
[Equation]
Encoder Although VQ-GAN exploits spatial redundancies, we can achieve more compressed representations by leveraging temporal redundancy in video data.
To do this, we learn a CNN encoder z t = E ( x t , x t − 1 ) which encodes the current frame x t conditioned on the previous frame by channel-wise concatenating x t − 1 , and then quantizes the output using codebook C to produce z t .
We apply the VQ loss defined in Equation (1) per timestep.
In addition, we ℓ 2 -normalize the codebook and embeddings to encourage higher codebook usage (Yu et al., 2021).
Conditionally encoding nearby frames lets the model learn smaller latents, and provides a general way to take advantage of temporal redundancy.
The most common form of temporal redundancy is the large amount of shared bits between neighboring frames, generally only differing in small movements, such as slight camera shifts, or objects moving slightly.
The first frame is concatenated with zeros and does not quantize z 1 to prevent information loss.
As we focus on video prediction, there is always at least 1 frame to condition on, so we do not need to predict the un-quantized representation of the first frame when computing decoding and dynamics losses.
Intuitively, this also does not burden the dynamics model to learn an unconditional prior.
Temporal Transformer Compressed, discrete latents are more lossy and tend to require higher spatial resolutions compared to continuous latents.
Therefore, before modeling temporal information, we apply a single strided convolution to downsample each discrete latent z t , where visually simpler datasets allow for more downsampling and visually complex datasets require less downsampling.
Afterwards, we learn a large transformer to model temporal dependencies, and then apply a transposed convolution to upsample our representation back to the original resolution of z t .
In summary, we use the following architecture:
[Equation]
Decoder The decoder is an upsampling CNN that reconstructs ˆ x t = D ( z t , h t ) , where z t can be interpreted as the posterior of timestep t , and h t is the output of the temporal transformer which summarizes information from previous timesteps.
z t and h t are concatenated channel-wise before [Figure] being fed into the decoder.
Together with the encoder, the decoder optimizes the following cross entropy reconstruction loss
[Equation]
which encourages z t features to encode relative information between frames since the temporal transformer can aggregate information over time.
This allows us to learn more compressed codes that enable more efficient modeling over longer sequences.
Dynamics Prior Lastly, we use a MaskGit (Chang et al., 2022) to model the dynamics prior, p ( z t | h t ) .
In our experiments, we show that using a MaskGit prior allows for not just faster but also higher quality sampling compared to an autoregressive prior.
During every training iteration, we use the same process as prior work to sample a random mask m t and optimize
[Equation]
(8) where h t is concatenated channel-wise with masked z t to predict the masked tokens.
During generation, we follow Lee et al.
(2022), where we initially generate each frame in chunks ofat a time and then go through 2 revise rounds of re-generating half the tokens each time.
Training Objective
The final objective is the sum of these losses:
[Equation]
To train the model efficiently on long videos, we propose DropLoss, a simple trick to allow for more scalable and efficient training.
Due to its architecture design, TECO can be separated into two components: (1) learning temporal representations, consisting of the encoder and the temporal transformer, and (2) predicting future frames, consisting of the dynamics prior and decoder.
We can increase training efficiency by dropping out random timesteps that are not decoded and thus omitted from the reconstruction loss.
For example, given a video of T frames, we compute h t for all t ∈ { 1 , . . .
, T } , and then compute the losses L prior and L recon for only 10% of the indices.
Because random indices are selected each iteration, the model still needs to learn to accurately predict all timesteps.
This reduces training costs significantly because the decoder and dynamics prior require non-trivial computations.
DropLoss is applicable to both a wide class of architectures and to tasks beyond video prediction.
E XPERIMENTS 4. D ATASETS
We introduce three challenging video datasets to better measure long-range consistency in video prediction.
We design these benchmarks around 3D environments in DMLab (Beattie et al., 2016),
Minecraft (Guss et al., 2019), and Habitat (Savva et al., 2019), with videos of agents randomly traversing different scenes of varying difficulty.
These datasets require video prediction models to re-produce observed parts of scenes, and newly generate unobserved parts of the scene.
In contrast, [Table] many existing video benchmarks do not have strong long-range dependencies, where a model with limited context is sufficient.
Refer to Appendix N for further details on each dataset.
DMLab DeepMind Lab is a simulator that procedurally generates random 3D mazes with random floor and wall textures.
We generate 40k action-conditioned 64 × 64 videos of 300 frames of an agent randomly traversing 7 × 7 mazes by choosing random points in the maze and navigating to them via the shortest path.
We train all models for both action-conditioned and unconditional prediction (by periodically masking out actions) to enable both types of generations.
We use both modes to evaluate since a video model may generate new parts of a scene that do not correlate with the action (e.g. run into a wall) which results in out-of-distribution errors.
However, action-conditioning is useful with enough conditioned past context, and substantially lowers variance on PSNR, SSIM, and LPIPS evaluations.
Minecraft
This popular game features procedurally generated 3D worlds that contain complex terrain such as hills, forests, rivers, and lakes.
We collect 200k action-conditioned videos of length 300 and resolution 128 × 128 in Minecraft’s marsh biome.
The player iterates between walking forward for a random number of steps and randomly rotating left or right, resulting in parts of the scene going out of view and coming back into view later.
We train action-conditioned for all models for ease of interpreting and evaluating, though it is generally easy for video models to unconditionally learn these discrete actions.
Habitat Habitat is a simulator for rendering trajectories through scans of real 3D scenes.
We compile ∼ 1400 indoor scans from HM3D (Ramakrishnan et al., 2021), MatterPort3D (Chang et al., 2017), and Gibson (Xia et al., 2018) to generate 200k action-conditioned videos of 300 frames at a resolution of 128 × 128 pixels.
We use Habitat’s in-built path traversal algorithm to construct action trajectories that move our agent between randomly sampled locations.
Similar to DMLab, we train all video models to perform both unconditional and action-conditioned prediction.
Kinetics-600 Kinetics-600 (Carreira & Zisserman, 2017) is a highly complex real-world video dataset, originally proposed for action recognition.
The dataset contains ∼ 400k videos of varying length of up to 300 frames.
We evaluate our method in the video prediction without actions (as they do not exist), generating 80 future frames conditioned on 20.
In addition, we filter out videos shorter than 100 frames, leaving 392k videos that are split for training and evaluation.
We use a resolution of 128 × 128 pixels.
Although Kinetics-600 does not have many long-range dependencies, we evaluate our method on this dataset to show that it can scale to complex, natural video.
4. B ASELINES
We compare against SOTA baselines selected from several different families of models: latentvariable-based variational models, autoregressive likelihood models, and diffusion models.
In addition, for more fair comparisons, we train all models on VQ codes using the same VQ-GAN as our method.
For our diffusion baseline, we follow Rombach et al.
and use a pretrained
VAE instead of a VQ-GAN.
Note that we do not have any GANs for our baselines, since to the best of our knowledge, there does not exist a GAN that trains on latent space instead of raw pixels, an important aspect for properly scaling to long video sequences.
FitVid FitVid (Babaeizadeh et al., 2021) is a state-of-the-art variational video prediction model based on CNNs and LSTMs that scales to complex video by leveraging efficient architectural design choices in its encoder and decoder.
Clockwork VAE CW-VAE (Saxena et al., 2021) is also a variational video prediction model that is designed to better learn long-range dependencies through a hierarchies of latent variables with exponentially slower tick speeds for each new level.
Perceiver AR
We use Perceiver AR (Hawthorne et al., 2022) as our AR baseline over VQGAN discrete latents, which has been show to be an effective generative model that can efficiently incorporate long-range sequential dependencies.
Conceptually, this baseline is similar to HARP (Seo et al., 2022) with a Perceiver AR as the prior instead of a sparse transformer (Child et al., 2019).
We choose Perceiver AR over other autoregressive baselines such as VideoGPT (Yan et al., 2021) or TATS (Ge et al., 2022) primarily due to the prohibitive costs of transformers when applied to tens of thousands of tokens.
Latent FDM For our diffusion baseline, we train a Latent FDM model with frame-wise autoregressive sampling.
Although FDM (Harvey et al., 2022) is originally trained on pixel observations, we also train in latent space for a more fair comparison with our method and other baselines, as training on long sequences in pixel space is too expensive.
We follow LDM (Rombach et al., 2022) to separately train an autoencoder to encode each frame into a set of continuous latents.
4. E XPERIMENTAL S ETUP
Training All of our models are trained for 1 million iterations under fixed compute budget (measured in TPU v3 days) allocated for each dataset.
Models are trained on TPU-v3 instances, ranging from v3-8 to v3-128 TPU pods (similar to 4 V100s to 64 V100s) with training times of roughly 3-5 days.
For DMLab, Minecraft, and Habitat we train all models on full 300 frames videos, and 100 frames for Kinetics-600.
Our VQ-GANs are trained on 8 A5000 GPUs, taking about 2-4 days for each dataset, and downsample all videos to 16 × 16 grids of discrete latents per frame regardless of original video resolution.
More details on exact hyperparameters and compute budgets for each dataset can be found in Appendix O.
Evaluation We evaluate our models using a combination of standard video prediction metrics such as PSNR (Huynh-Thu & Ghanbari, 2008), SSIM (Wang et al., 2004), LPIPS (Zhang et al., 2012), and FVD (Unterthiner et al., 2019).
For DMLab, Minecraft, and Habitat, we measure FVD on 300 frame videos, conditioned on 36 frames (264 predicted frames).
For Kinetics-600, we evaluate
FVD on 100 frame videos, conditioned on 20 frames (80 predicted frames).
To evaluate temporal consistency, we measure PSNR, SSIM, and LPIPS on video predictions conditioned on 144 frames (156 predicted frames), and action condition for all models.
Conditioning on a large portion of the video ensures that the model can observe a large part of the scene, and combined with actionconditioning, the model with temporally-consistent predictions should generate future frames close to the ground truth.
Due to this reduced stochasticity, we only sample one prediction for computing
PSNR, SSIM, and LPIPS.
We compute all metrics over batches of 256 examples, averaged overruns to make 1024 total samples.
4. B ENCHMARK R ESULTS
DMLab & Minecraft Table 1 shows quantitative results on the DMLab and Minecraft datasets.
TECO performs the best across all metrics for both datasets when training on the full 300 frame videos.
Figure 4 shows sample trajectories and 3D visualizations of the generated DMLab mazes, where TECO is able to generate more stable and consistent 3D mazes.
For both datasets, CW-VAE,
FitVid, and Perceiver AR can produce sharp predictions, but do not model long-horizon context well, with per-frame metrics sharply dropping as the future prediction horizon increases as seen in
Figure C.1.
Latent FDM has consistent predictions, but high FVD most likely due to FVD being sensitive to high frequency errors.
[Figure]
In order to better investigate scaling properties of our models, Figure D.1 and Figure D.2 compare
TECO and Latent FDM on different training sequence lengths.
Intuitively, under a fixed computation budget and batch size, models that train on shorter sequence lengths can scale larger, with more
FLOPs allocated per frame.
In general, this is reflected in model architectures through computations at higher spatial resolutions (e.g. less downsampling).
For DMLab, we see that in terms of perframe metrics, models generally benefit from training on longer videos, where more computation per image has less of an effect due to saturation in image quality because of relatively simple visual complexity.
For Minecraft, we observe that models generally perform best when training withframes of context, which have better per-image sample quality compared to training on 300 frames due to higher downsampling required for longer sequences.
Models trained on 300 frames generally have more distortion in predictions compared to 100 frames.
Theoretically, as the compute budget is increased, training on 300 frames would eventually outperform models trained on 100 frames.
Habitat Table 1 shows results for our Habitat dataset.
We only evaluate our strongest baselines,
Perceiver AR and Latent FDM due to the need to implement model parallelism.
Because of high complexity of Habitat videos, all models generally perform equally as bad in per-frame metrics.
However, TECO has significantly better FVD.
Qualitatively, Latent FDM quickly collapses to blurred predictions with poor sample quality, and Perceiver AR can generate high quality frames, though less temporally consistent than TECO:
agents in Habitat videos navigate to far points in the scene and back whereas Perceiver AR tends to generate samples where the agent is constantly turning.
TECO generates traversals of a scene that match the data distribution more closely.
Kinetics-600 Table 1 shows FVD for predicting 80 128 × 128 frames conditioned on 20 for
Kinetics-600.
Although Kinetics-600 does not have many long-range dependencies, we found that
TECO is able to produce more stable generations that degrade slower by incorporating longer contexts.
In contrast, Perceiver AR tends to degrade quickly, with Latent FDM performing in between.
Figure K.1 and Table K.4 include further investigations using top-k sampling for Perceiver
AR and TECO.
Table 1 does not use top-k sampling for a fair comparison against Latent FDM.
With top-k sampling, Perceiver AR outperforms our method at k = 8 .
However, resulting videos tend to be uninteresting with little to no dynamics movement.
Sampling Speed Figure 3 compares sampling speed for all models.
We report sampling speed on
Minecraft and observed similar results for the different model sizes used on other datasets.
FitVid and CW-VAE are both significantly faster that other methods, but have poor sample quality.
On the other end, Perceiver AR and Latent FDM can produce high quality samples, but are 20-60x slower than TECO, which has comparably fast sampling speed while retaining high sample quality.
4. A BLATIONS
In this section, we perform ablations on various architectural decisions of our model.
For simplicity, we evaluate our methods on short sequences of 16 frames from Something-Something-v2 (SSv2).
We choose SSv2 as it provides insight into scaling our method on complex real-world data more similar to Kinetics-600 while being computationally cheaper to run.
Table F.1 shows several ablations comparing posterior, prior, and various architectural design choices.
We demonstrate that using VQ-latent dynamics with a MaskGit prior proves better compared to alternative formulations for latent dynamics models, such as popular variational methods.
In addition, we show that conditional encodings learn better representations for video predictions.
We also ablate the codebook size, showing that although there exists an optimal codebook size, it does not matter too much as along as there are not too many codes, which may make it more difficult for the prior to learn.
Lastly, we show the benefits of DropLoss, with up to 60% faster training and a minimal increase in FVD.
The benefits are greater for longer sequences, and allow video models to better account for long horizon context with little cost in performance.
Table F.2 shows ablations on scaling different parts of our model, such as the encoder, decoder, temporal transformer, and prior.
In general, it is more beneficial to have an imbalanced encoder decoder architecture, with more parameters in the decoder.
For the temporal transformer, it is more beneficial to have larger resolution features ( 4 × 4 ), especially for more complex data like SSv2, and less useful for visually simpler datasets such as DMLab or Minecraft.
Similarly, having a larger width is more beneficial than more layers due to increased capacity to represent each frame.
Lastly, for scaling the MaskGit prior, more layers is better than larger width networks.
D ISCUSSION
We introduced TECO, an efficient video prediction model that leverages hundreds of frames of temporal context.
Our evaluation demonstrated that TECO accurately incorporates long-range context, outperforming SOTA baselines across a wide range of datasets.
In addition, we introduce several difficult video datasets, which we hope make it easier to evaluate temporal consistency in future video prediction models.
We identify several limitations as directions for future work:
• Although we show that PSNR, SSIM, and LPIPS can be reliable metrics to measure consistency when video models are properly conditioned, there remains room for better evaluation metrics that provide a reliable signal as the prediction horizon grows, since new parts of a scene that are generated are unlikely to correlate with ground truth.
• Our focus was on learning a compressed tokens and an expressive prior, which we combined with a simple full attention transformer as the sequence model.
Leveraging prior work on efficient sequence models (Choromanski et al., 2020; Wang et al., 2020; Zhai et al., 2021; Gu et al., 2021; Hawthorne et al., 2022) would likely allow for further scaling.
• We trained all models on top of pretrained VQ-GAN codes to reduce the data dimensionality.
This compression step lets us train on longer sequences at a cost of reconstruction error, which causes noticeable artifacts in
Kinetics-600, such as corrupted text and incoherent faces.
Although
TECO can train directly on pixels, a ℓ 2 loss results in slightly blurry predictions.
Training directly on pixels with diffusion or GAN losses would be promising.
R EPRODUCIBILITY
We provide several resources in order to aim for better reproducilbity.
We include anonymized code in the supplementary materials for our models, baselines and datasets.
In addition, Appendix O details hyperparameters and compute requirements for all models
A S AMPLING P ROCESS
Given a sequence of conditioning frames, o 1 , . . .
, o t , we encode each frame using the pretrained VQGAN to produce x 1 , . . .
, x t , and then use the conditional encoder to compute z 1 , . .
. , z t .
In order to generate the next frame, we use the temporal transformer to compute h t , and feed it into the MaskGit dynamics prior to predict ˆ z t +1 .
Let z t +1 =
ˆ z t +1 and feed it through the temporal tranformer and
MaskGit to predict ˆ z t +2 .
We repeat this process until the entire trajectory is predicted, ˆ z t +1 , . . .
, ˆ z T .
In order to decode back into frames, we first decode into the VQ-GAN latents, and then decode to RGB using the VQ-GAN decoder.
Note that generation can be completely done in latent space, and rendering back to RGB can be done in parallel over time once the latents for all timesteps are computed.
[Table]
[Figure]
[Table]
[Figure] [Figure]
[Table]
[Figure]
[Table]
(cid:51)(cid:85)(cid:72)(cid:71)(cid:76)(cid:70)(cid:87)(cid:72)(cid:71)(cid:3)(cid:41)(cid:85)(cid:68)(cid:80)(cid:72)(cid:86)
[Figure]
H ABITAT
[Figure] [Figure]
[Table]
[Figure]
(cid:20)(cid:28) (cid:21)(cid:19) (cid:21)(cid:28) (cid:3)(cid:22)(cid:28) (cid:3)(cid:23)(cid:28) (cid:3)(cid:24)(cid:28) (cid:3)(cid:25)(cid:28) (cid:3)(cid:26)(cid:28) (cid:3)(cid:27)(cid:28) (cid:3)(cid:28)(cid:28)
[Figure]
C P ERFORMANCE VERSUS H ORIZON
[Figure]
Figure C.1 shows PSNR, SSIM, and LPIPS as a function of prediction horizon for each dataset.
Generally, each plot reflected the corresponding aggregated metrics in Table 1.
For DMLab, TECO shows much better temporal consistency for the full trajectory, with Latent FDM coming in second.
CW-VAE is able retain some consistency but drops fairly quickly.
Lastly, FitVid and Perceiver
AR lose consistency very quickly.
We see a similar trend in Minecraft, with Latent FDM coming closer in matching TECO.
For Habitat, all methods generally have trouble producing consistent predictions, primarily due to the difficulty of the environment.
D P ERFORMANCE VERSUS T RAINING S EQUENCE L ENGTH
[Figure]
[Figure]
Figure D.1 and Figure D.2 show plots comparing performance with training models on different sequence lengths.
Under a fixed compute budget and batch size, training on shorter videos enables us to scale to larger models.
This can also be interpreted as model capacity or FLOPs allocated per image.
In general, training on shorter videos enables higher quality frames (per-image) but at a cost of worse temporal consistency due to reduced context length.
We can see a very clear trend in DMLab, in that TECO is able to better scale on longer sequences, and correspondingly benefits from it.
Latent FDM has trouble when training on full sequences.
We hypothesize that this may be due to diffusion models being less amenable towards downsamples, it it needs to model and predict noise.
In Minecraft, we see the best performance at around 50-100 training frames, where a model has higher fidelity image predictions, and also has sufficient context.
E S AMPLING
[Figure]
Sampling Time per Frame (ms)
TECO (ours)
Latent FDM
Perceiver
[Figure]
AR
CW
[Table]
VAE
[Figure]
[Table]
FitVid
[Table]
F A BLATIONS
DropLoss Rate
FVD
Train Step (ms) 0.
[Table] [Table]
Rates
Posteriors
FVD
VQ (+ MaskGit prior) (ours)
OneHot (+ MaskGit prior)
OneHot (+ Block AR prior)
[Table] [Table]
[Table]
Table F.3 shows comparisons between TECO and alternative architectures that do not use latent dynamics.
Architecturally, MaskGit and Autoregressive are very similar to TECO, with a few small changes: (1) there is no CNN decoder and (2) MaskGit and AR directly predict the VQ-GAN latents (as opposed to the learned VQ latents in TECO).
In terms of training time, MaskGit and AR are a little slower since they operate on 16 × 16 latents instead of 8 × 8 latents for TECO.
In addition, conditioning for the AR model is done using cross attention, as channel-wise concatenation does not work well due to unidirectioal masking.
Both models without latent dynamics have worse temporal consistency, as well as overall sample quality.
We hypothesize that TECO has better temporal consistency due to weak bottlenecking of latent representation, as a lot of time can be spent modeling likelihood of imperceptible image / video statistics.
MaskGit shows very high FVD due to a tendency to collapse in later frames of prediction, which FVD is sensitive to.
G
M ETRICS D URING T RAINING
Figure G.1 shows plots of FVD (over chunks of generatd 16 frame video) and LPIPS during training, evaluated at saved model checkpoints every 50k iterations over 1M iterations.
We can see that although FVD (measuring frame fidelity) tends to saturate early on during training (at around 200k iterations), the long-term consistency metric (LPIPS) continues to improve until the end of training.
We hypothesize that this may be due to the model first learning the ”easier bits” more local in time, and then learning long-horizon bits once the easier bits have learned.
H P ROGRESSION FROM EXISTING WORK
Model Architecture
Time per
Training Step (s)
FVD ↓
PSNR ↑
SSIM ↑
LPIPS ↓
VideoGPT / TATS 3D VQ-VAE + Autoregressive (time + space) 0.
Phenaki 3D VQ-VAE + MaskGit (time + space) 0.
TECO w/o latent dynamics 2D VQ-VAE + CNN encoder + Autoregressive (time) + MaskGit (space) 0.
TECO (ours) 2D VQ-VAE + CNN encoder + Autoregressive (time) + MaskGit (latent) + CNN decoder (space) 0.
Table H
1 shows the progressive improvement from existing work (TATS, Phenaki) and TECO is able to scale far better on all metrics with our proposed architectural improvements. I H IGH
[Table]
Table I.1 compares reconstruction FVD between TECO and TATS.
At the same compression rate (same number of discrete codes), TECO learns far better spatio-temporal codes that TATS, with more of a different on more visually complex scenes (Minecraft vs DMLab).
J T RADE - OFF BETWEEN FIDELITY AND LEARNING LONG - RANGE DEPENDENCIES
[Table]
[Table]
More downsampling + lower resolution computations
[Table]
Less downsample + higher resolution computations
[Table]
Table J.1 and Table J.2 show a trade-off between fidelity (frame or image quality) and temporal consistency (long-range dependencies) for video prediction architectures (both TECO, and Latent
FDM).
[Table]
[Table] [Table]
[Table] [Table]
[Figure]
L S CALING R ESULTS
[Table] [Table]
M R ELATED W ORK
Video Generation
Prior video generation methods can be divided into a few classes of models: variational models, exact likelihood models, and GANs.
SV2P (Babaeizadeh et al., 2017),
SVP (Denton & Fergus, 2018), SVG (Villegas et al., 2019), and FitVid Babaeizadeh et al.
(2021) are variational video generation methods models videos through stochastic latent dynamics, optimized using the ELBO (Kingma & Welling, 2013) objective extended in time.
SAVP (Lee et al., 2018) adds an adversarial (Goodfellow et al., 2014) loss to encourage more realistic and high-fidelity generation quality.
Diffusion models (Ho et al., 2020; Sohl-Dickstein et al., 2014) have recently emerged as a powerful class of variational generative models which learn to iteratively denoise an initial noise sample to generate high-quality images.
There have been several recent works that extend diffusion models to video, through temporal attention (Ho et al., 2022; Harvey et al., 2022), 3D convolutions (H¨oppe et al., 2022), or channel stacking (Voleti et al., 2022).
Unlike variational models, autoregressive models (AR) and flows (Kumar et al., 2019) model videos by optimizing exact likelihood.
Video Pixel Networks (Kalchbrenner et al., 2017) and Subscale Video
Transformers (Weissenborn et al., 2019) autoregressively model each pixel.
For more compute efficient training, some prior methods (Yan et al., 2021; Le Moing et al., 2021; Seo et al., 2022;
Rakhimov et al., 2020; Walker et al., 2021) propose to learn an AR model in a spatio-temporally compressed latent space of a discrete autoencoder, which has shown to be orders of magnitudes more efficient compared to pixel-based methods.
Instead of a VQ-GAN, Le Moing et al.
(2021), learns a frame conditional autoencoder through a flow mechanism.
Lastly, GANs (Goodfellow et al., 2014) offer an alternative method to training video models.
MoCoGAN (Tulyakov et al., 2018) generates videos by disentangling style and motion.
MoCoGAN-HD (Tian et al., 2021) can efficiently extend to larger resolutions by learning to navigate the latent space of a pretrained image generator.
TGANv2 (Saito & Saito, 2018), DVD-GAN (Clark et al., 2019), StyleGANV (Skorokhodov et al., 2021), and TrIVD-GAN (Luc et al., 2020) introduce various methods to scale to complex video, such as proposing sparse training, or more efficient discriminator design.
The main focus of this work lies with video prediction, a specific interpretation of conditional video generation.
Most prior methods are trained autoregressive in time, so they can be easily extended to video prediction.
Video Diffusion, although trained unconditionally proposes reconstruction guidance for prediction.
GANs generally require training a separate model for video prediction.
However, some methods such as MoCoGAN-HD and DI-GAN can approximate frame conditioning by inverting the generator to compute a corresponding latent for a frame.
Long-Horizon Video Generation CW-VAE (Saxena et al., 2021) learns a hierarchy of stochastic latents to better model long term temporal dynamics, and is able to generate videos with long-term consistency for hundreds of frames.
TATS (Ge et al., 2022) extends VideoGPT which allows for sampling of arbitrarily long videos using a sliding window.
In addition, TATs and CogVideo (Hong et al., 2022) propose strided sampling as a simple method to incorporate longer horizon contexts.
StyleGAN-V (Skorokhodov et al., 2021) and DI-GAN (Yu et al., 2022) learn continuous-time representations for videos which allow for sampling of arbitrary long videos as well.
Brooks et al.
(2022) proposes an efficient video GAN architecture that is able to generate high resolution videos of 128 frames on complex video data for dynamic scenes and horseback riding.
FDM (Harvey et al., 2022) proposes a diffusion model that is trained to be able to flexibly condition on a wide range of sampled frames to better incorporate context of arbitrarily long videos.
Lee et al.
(2021) is able to leverage a hierarchical prediction framework using semantic segmentations to generate long videos.
Long-Horizon Video Understanding Outside of generative modeling, prior work such as
MeMViT (Wu et al., 2022) and Vis4mer (Mohaiminul Islam & Bertasius, 2022) introduce architectures for modeling long-horizon dependencies in videos.
N D ATASET D ETAILS N. DML AB
We generate random 7 × 7 mazes split into four quadrants, with each quadrant containing a random combination of wall and floor textures.
We generate 40k trajectories of 300 frames, each 64 ×images.
Actions in this environment consist of 20 ◦ left turn, 20 ◦ right turn, and walk forward.
In order to maximally traverse the maze, we code an agent that traverses to the furthest unvisited point in the maze, with some added noise for stochasticity.
Since the maze is a grid, we can easily hard-code a navigation policy to move to any specified point in the maze.
For 3D visualizations, we also collect depth, camera intrinsics and camera extrinsics (pose) for each timestep.
Given this information, we can project RGB points into a 3D coordinate space and reconstruct the maze as a 3D pointcloud.
Note that since videos are generated only using RGB as input, they do not have groundtruth depth and pose.
Therefore, we train depth and pose estimators that are used during evaluation.
Specifically, we train a depth estimator to map from RGB frame to depth, and a pose estimator that takes in two adjacent RGB frames and predicts the relative change in orientation.
During evaluation, we are given an initial ground truth orientation that we apply sequentially to predicted frames.
Although the GQN Mazes (Eslami et al., 2018) already exists as a video prediction dataset, it is difficult to properly measure temporal consistency.
The 3D scenes are relatively simple, and it does not have actions to help reduce stochasticity in using metrics such as PSNR, SSIM, and LPIPS.
As a result, FVD is the reliable metric used in GQN Mazes, but tends to be sensitive to noise in video predictions.
In addition, we perform 3D visualizations using our dataset that are not possible with
GQN Mazes.
N. M INECRAFT
We generate 200k trajectories (each of a different Minecraft world) of 300 128 × 128 frames in the
Minecraft marsh biome.
We hardcode an agent to randomly traverse the surroundings by taking left, right, and forward actions with different probabilities.
In addition, we let the agent constantly jump, which we found to help traverse simple hills, and prevent itself from drowning.
We specifically chose the marsh biome, as it contains hilly turns with sparse collections of trees that act as clear landmarks for consistent generation.
Forest and jungle biomes tend to be too dense for any meanginfully clear consistency, as all surroundings look nearly identical.
On the other hand, plains biomes had the opposite issue where the surroundings were completely flat.
Mountain biomes were too hilly and difficult to traverse.
We opt to introduce an alternative to the MineRL Navigate
(Guss et al., 2019) since this dataset primarily consists of human demonstrations of people navigating to specific points.
This means that trajectories usually follow a relatively straight line, so there are not many long-term dependencies in this dataset, as only a few past frames of context are necessary for prediction.
N. H ABITAT
Habitat is a 3D simulator that can render realistic trajectories in scans of 3D scenes.
We compile roughly 1400 3D scans from HM3D (Ramakrishnan et al., 2021), MatterPort3D (Chang et al., 2017) and Gibson (Xia et al., 2018), and generate a total of 200k trajectories of 300 128 × 128 frames.
We use the in-built path traversal algorithm provided in Habitat to construct action trajectories that allow our agent to move between randomly sampled locations in the 3D scene.
Similar to Minecraft and DMLab, the agent action space consists of left turn, right turn, and move forward.
O H YPERPARAMETERS
O.
VQ-GAN & VAE
DMLab / Minecraft
Habitat / KineticsGPU Days
Resolution 64 /
Batch Size
LR 3 × 10 −3 × 10 −
Num Res Blocks
Attention Resolutions
Channel Mult 1,2,2, 1,2,3,
Base Channels
Latent Size (VQ-GAN) 16 ×16 ×
Embedding Dim (VQ-GAN)
Codebook Size (VQ-GAN)
Latent Size (VAE)
× 16 ×16 × 16 ×
O.
TECO
Hyperparameters
DMLab
Minecraft
Habitat
KineticsTPU-v3 Days
Params 169M 274M 386M 1.09B
Resolution
Batch Size
Sequence Length
LR
[Table]
10 −1 × 10 −1 × 10 −1 × 10 −
LR Schedule cosine cosine cosine cosine
Warmup Steps 10k 10k 10k 10k
Total Training Steps 1M 1M 1M 1M
DropLoss Rate 0.
Encoder
Depths 256,256,256,256,
Blocks
Codebook
Size
Embedding Dim
Decoder
Depths 256,256,256,256,
Blocks
TemporalTransformer
Downsample Factor
Hidden Dim
Feedforward Dim
Heads
Layers
Dropout
MaskGit
Mask Schedule cosine cosine cosine cosine
Hidden Dim
Feedforward Dim
Heads
Layers
Dropout
Train Sequence Length (Fewer
[Table]
per
[Table]
Hyperparameters
TPU-v3 Days
Params 169M 169M 86M 195M
Resolution
Batch Size
LR 1 × 10 −1 × 10 −1 × 10 −1 × 10 −
LR Schedule cosine cosine cosine cosine
Warmup Steps 10k 10k 10k 10k
Total Training Steps 1M 1M 1M 1M
DropLoss Rate 0.
Encoder
Depths 256,256,256,256,
Blocks
Codebook
Size
Embedding Dim
Decoder
Depths 256,256,256,256,
Blocks
Temporal
Transformer
Downsample Factor
Hidden Dim
Feedforward Dim
Heads
Layers
Dropout
MaskGit
Mask Schedule cosine cosine cosine cosine
Hidden Dim
Feedforward Dim
Heads
Layers
Dropout
[Table]
Hyperparameters
[Table]
Resolution
[Table]
Batch Size
LR 1 ×
[Table]
−
[Table] [Table]
10 −1 ×
[Table]
−1 × 10 −
LR Schedule cosine
[Table]
cosine
Warmup Steps
[Table]
Total Training Steps
[Table]
Rate
[Table] [Table]
[Table] [Table]
Encoder
Depths
[Table] [Table]
[Table] [Table]
Blocks
Codebook
Size
[Table]
Decoder
Depths
[Table] [Table]
[Table] [Table]
Blocks
Temporal
Transformer
Downsample
[Table]
Hidden Dim
[Table]
Feedforward Dim
[Table]
Heads
Layers
Dropout
MaskGit
Mask Schedule cosine
[Table]
Dim
Feedforward Dim
Heads
Layers
Dropout
[Table]
DMLab
Minecraft
Habitat
Kinetics-
[Table] [Table]
[Table] [Table]
[Table] [Table]