Skip to content

Video understanding, tracking, generation, and world models · Video self-supervision · VID027 · Training method

VideoMAE V2

Extends video masked autoencoding with dual masking: the encoder sees a sparse visible subset, and the decoder processes a selected subset rather than every possible token.

Explained here Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

Documented in the Academy only. There's no Set up button.

Availability
Explained here
Code example
Component demo, not a trained model
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Extends video masked autoencoding with dual masking: the encoder sees a sparse visible subset, and the decoder processes a selected subset rather than every possible token. Its distinct contribution is reducing decoder burden while scaling video pretraining.

Question / objective

Learn transferable video representations from automatically constructed targets or weak cross-modal supervision. This is a learning or inference objective, not a test of a statistical null hypothesis.

Method type and supervision

training-method · Video self-supervision. Self-supervised pretraining; cross-modal variants also use weak paired language supervision.

Architecture / computational structure

Sparse visible-token encoder with a separately masked decoder processing selected targets.

Assumptions

Inputs must satisfy the temporal, modality and annotation protocol described below. It is not merely a larger VideoMAE checkpoint. Efficient masking changes which reconstruction targets are observed; comparisons should match both data and total training compute.

Formula / computational definition

L=∣MD∣−1∑i∈MD∥x^i−xi∥2L=|M_D|^{-1}\sum_{i\in M_D}\|\hat x_i-x_i\|^2, with visible encoder set VEV_E and selected reconstruction targets MDM_D determined by the dual-mask design. This is a schematic loss, not the full masking algorithm.

Parameters and notation

Learned/estimated quantities: Encoder and predictor/projection weights are learned; target-network EMA values are state updates, and masks/negative policies are design choices. Symbols specific to the objective are defined with the equation. Hyperparameters and design choices: Encoder mask ratio, decoder token budget, independent mask construction, model scale and data mixture require separate documentation.

Fitting, fine-tuning, and adaptation

Use the pretrained encoder for task heads, then tune late blocks. Preserve the dual-mask implementation when extending pretraining; changing mask ratios affects both optimization and compute. Use a separate adaptation validation split, monitor the target metric and retention of previously useful behavior, and save the exact preprocessing and training configuration.

How to use and calibrate

Fix the input protocol and target before fitting; choose design settings on held-out source videos, then freeze the evaluation procedure. Report action transfer, peak memory and throughput, with ablations separating dual masking from scale and dataset expansion.

Example application

Scale masked video pretraining while restricting decoder memory.

Interpretation / pitfalls

Watch out

An optimized training objective or a favorable example does not establish generalization. Report action transfer, peak memory and throughput, with ablations separating dual masking from scale and dataset expansion. The example below isolates one mechanism and cannot substantiate a full-model benchmark claim.

Python and R code examples

Component: Distinguish sparse encoder tokens from decoder target selection. Dependencies: NumPy in Python; base R in R; run the shared setup above. Python component: executed successfully. R component: unexecuted. No complete model training or pretrained inference was executed.

Full implementation route — Python: Reproduce the authors' dual-mask construction and index mapping between encoder and decoder tokens. R: Prototype the two index sets and masked loss in R; use a Python bridge for the scaled transformer training.

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — Distinguish sparse encoder tokens from decoder target selection.

Shared setup for this chapter
import numpy as np

def softmax(x):
    z = np.asarray(x, dtype=float)
    e = np.exp(z - z.max())
    return e / e.sum()
tokens = np.arange(12)
encoder_visible = np.array([0,4,8])
decoder_targets = np.array([1,3,6,10])
assert len(set(encoder_visible)&set(decoder_targets)) == 0
print("encoder",tokens[encoder_visible],"targets",tokens[decoder_targets])
# Illustrative subsets; the full method specifies its sampling design.
R

Component demo, not a trained model — Distinguish sparse encoder tokens from decoder target selection.

Shared setup for this chapter
softmax <- function(x) {
  e <- exp(x - max(x))
  e / sum(e)
}
tokens <- 0:11
encoder_visible <- c(1L,5L,9L); decoder_targets <- c(2L,4L,7L,11L)
stopifnot(length(intersect(encoder_visible,decoder_targets))==0)
print(list(encoder=tokens[encoder_visible],targets=tokens[decoder_targets]))
# Illustrative subsets, not the full published masking sampler.

Sources

From the CodeSplash reference, entry VID027.