Video generation: motion lives between frames
视频生成
Fit finite moving-pixel sequences and test what correct frame marginals miss.
video-generationA good frame does not tell you where the dot goes next
Imagine four frames containing one bright dot. Each frame looks equally plausible, but the dot may move steadily, reverse direction or jump around. An image model can get every frame’s distribution right while missing the relationship that makes the sequence a video.
Video generation models a distribution over sequences, possibly conditioned on text, initial frames or other signals. Ho and colleagues extend image diffusion with spatial and temporal processing. Their selected architecture uses spatial convolutions and separate spatial and temporal attention; it is one approach, not the definition of video generation. Read autoregressive models and video understanding first.
Factor the sequence, then ask what memory loses
Let X₁,…,XT be frames and c a supplied condition. The probability chain rule is exact:
It does not require a model to sample frames autoregressively. A diffusion model may denoise a whole block jointly. Our small example instead uses explicit finite probabilities to isolate temporal dependence.
A dot lives on a five-cell ring. A clip has four positions. Choose a start uniformly and a direction, clockwise or counterclockwise, with equal probability; keep that direction for the entire clip. There are ten valid clips among 5⁴ possible position sequences. Each frame is uniform over the five cells. The independent approximation is therefore:
A count-fitted first-order chain learns that either adjacent cell is equally likely. It forgets which direction was chosen earlier:
This model produces valid individual steps but can reverse direction between them. Two consecutive positions identify direction on this ring. A second-order chain can retain it:
The fitted next position is then deterministic on observed pairs. Unobserved contexts receive a declared uniform fallback; they are unreachable under the fitted initial-pair distribution. If V is the ten-clip valid set, counting gives:
All three models still have identical frame marginals. Their expected negative log-likelihood on the true ten-clip distribution differs:
These are natural-log values per four-frame clip, not per pixel or per second. The second-order result follows from this deliberately small constant-direction process; it does not prove that two frames determine real motion.
Fit counts and enumerate every possible clip
Save as video_generation.py; use Python 3.12 and NumPy 1.26.4. The ten constructed clips are the training set. The program fits marginal, one-step and two-step conditional tables, evaluates all 625 sequences, and samples with a fixed seed. It learns counts rather than neural weights and does not train a diffusion model.
For S positions, T frames and M training clips, table fitting costs O(MT); first- and second-order storage costs O(S²) and O(S³). The exact enumeration here costs O(S^T T), so it is a verification device for tiny state spaces, not a scalable video sampler. The categorical sampler uses that enumerated distribution explicitly.
"""Original finite video model: one moving pixel on a five-cell ring."""
import itertools
import json
import numpy as np
def clips(direction=None):
if direction is not None and (type(direction) is not int or direction not in (-1, 1)):
raise ValueError('Direction must be None, -1 or 1')
return np.array([[(s + d*t) % 5 for t in range(4)]
for s in range(5) for d in ((-1, 1) if direction is None else (direction,))])
def sequences():
return np.array(list(itertools.product(range(5), repeat=4)))
def validate(x):
x = np.asarray(x)
if x.ndim != 2 or x.shape[1] != 4 or not 1 <= len(x) <= 10000:
raise ValueError('Expected 1..10000 clips with four positions')
if x.dtype.kind not in 'iu' or np.any((x < 0) | (x >= 5)):
raise ValueError('Positions must be integers 0..4')
return x
def normalize_rows(a):
totals = a.sum(axis=-1, keepdims=True)
return np.divide(a, totals, out=np.full_like(a, 1/a.shape[-1]), where=totals > 0)
def fit(x):
x = validate(x)
marginal = np.stack([np.bincount(x[:, t], minlength=5)/len(x) for t in range(4)])
one = np.zeros((5, 5)); two = np.zeros((5, 5, 5)); initial = np.zeros((5, 5))
np.add.at(initial, (x[:, 0], x[:, 1]), 1)
for t in range(1, 4): np.add.at(one, (x[:, t-1], x[:, t]), 1)
for t in range(2, 4): np.add.at(two, (x[:, t-2], x[:, t-1], x[:, t]), 1)
return marginal, normalize_rows(one), normalize_rows(two), initial/len(x)
def distribution(x, model, learned):
x = validate(x); marginal, one, two, initial = learned
if model == 'independent': return np.prod(marginal[np.arange(4), x], axis=1)
if model == 'first':
return marginal[0, x[:, 0]] * np.prod(one[x[:, :-1], x[:, 1:]], axis=1)
if model == 'second':
return initial[x[:, 0], x[:, 1]] * np.prod(two[x[:, :-2], x[:, 1:-1], x[:, 2:]], axis=1)
raise ValueError('Unknown model')
def coherent(x):
delta = np.diff(validate(x), axis=1) % 5
return np.all(delta == 1, axis=1) | np.all(delta == 4, axis=1)
def sample(model='second', count=1000, seed=23):
if type(count) is not int or not 1 <= count <= 10000: raise ValueError('Invalid count')
x = sequences(); p = distribution(x, model, fit(clips()))
return x[np.random.default_rng(seed).choice(len(x), size=count, p=p)]
def demo():
x = sequences(); learned = fit(clips()); valid = coherent(x); models = {}
for name in ['independent', 'first', 'second']:
q = distribution(x, name, learned)
marginals = [[float(q[x[:, t] == j].sum()) for j in range(5)] for t in range(4)]
models[name] = dict(total=float(q.sum()), coherent_mass=float(q[valid].sum()),
nll=float(-np.log(distribution(clips(), name, learned)).mean()),
marginals=marginals, sample_coherence=float(coherent(sample(name)).mean()))
model = distribution(x, 'second', learned)
reversed_q = distribution(x[:, ::-1], 'second', learned)
return dict(clips=clips().tolist(), models=models,
reverse_tv=float(abs(model-reversed_q).sum()/2),
given_start_mean=np.eye(5)[clips()[0:2]].mean(axis=0).tolist(),
scope='Finite count-fitted position chains; no video diffusion network or FVD computation.')
if __name__ == '__main__': print(json.dumps(demo(), indent=2))
The three coherent masses are .016, .25 and 1; their NLLs are approximately 6.43775, 3.68888 and 2.30259. The 1,000 seeded samples give coherent fractions .017, .258 and 1. Sampling error is separate from the exact enumeration. Averaging the two possible continuations of a given start creates two half-bright dots in later frames, not one sampled future.
Measure a sequence with a sequence-aware protocol
Fréchet Video Distance compares moments in a learned video feature space; its paper studies I3D representations. The fixed reference implementation scales frames, extracts I3D activations and calls a distribution-distance routine. None of those networks runs in our example. Coherent-path mass is a metric defined for this artificial task, not FVD.
Specify resolution, frame rate, duration, conditioning, sample count and the feature extractor before comparing systems. A plausible short clip does not establish long-term consistency. In the selected video-diffusion method, extending or interpolating clips is a conditional-generation problem; the architecture alone does not guarantee correct extension.
Our balanced clockwise/counterclockwise distribution is unchanged by reversing every clip. Even a perfect distribution comparison should report equality there. If only clockwise clips are allowed, reversal instead yields disjoint support. Whether a temporal change counts as an error depends on the task distribution, not merely on its name.
Predict the sequence before running it
- Calculate. Why is independent coherent mass 10/625? Answer: Five starting cells and two fixed directions give ten clips; all 625 sequences receive probability 1/625.
- Diagnose. Why can
[0,1,0,1]occur under the first-order model? Answer: Each step moves to a neighbor, which is all that model checks. It has forgotten the initial direction; the second-order model assigns this clip zero probability. - Interpret. Does identical frame quality imply identical video likelihood? Answer: No. Every model has uniform frame marginals, while their clip NLLs differ because they allocate different joint probability to motion.
- Transfer. Is reversing a clip always a detectable distribution error? Answer: No. Reversal preserves the balanced direction distribution here. Under a clockwise-only target it changes the distribution completely.
Separate architecture, sampling and evaluation
The selected papers address different problems: video diffusion supplies an architecture and conditional sampling setting, while FVD proposes a sequence-feature evaluation. The small count model is an original explanation of dependence, not their reproduction. Continue with generative evaluation for the limitations of moment-based comparison.
Make a prediction, then check
Do uniform frame marginals guarantee coherent motion?
Learning objectives
- Factor a video distribution over time.
- Count coherent paths under different memories.
- Separate frame and video evaluation.
Prerequisites & connections
Explore related knowledge →References
- Video Diffusion Models (v1)
Jonathan Ho; Tim Salimans; Alexey Gritsenko; William Chan; Mohammad Norouzi; David J. Fleet · 2022 - Towards Accurate Generative Models of Video: A New Metric & Challenges (v1)
Thomas Unterthiner; Sjoerd van Steenkiste; Karol Kurach; Raphael Marinier; Marcin Michalski; Sylvain Gelly · 2018 - google-research/google-research: frechet_video_distance/frechet_video_distance.py @932d468
google-research/google-research contributors
Version1 · Editorial status: Recorded technical checks completed
View technical check record (AI)
Codex · 2026-09-20 · Single AI author checked Video Diffusion v1 section3/opening3.1, FVD v1 section2/I3D discussion and fixed FVD preprocessing code. Six paired equations and four explained exercises; original five-cell four-frame count fits, exhaustive625 sequences, coherence masses, clip NLL and reversal scope. No video diffusion training or FVD network execution.
- Single AI author checked Video Diffusion v1 section3/opening3.1, FVD v1 section2/I3D discussion and fixed FVD preprocessing code. Six paired equations and four explained exercises; original five-cell four-frame count fits, exhaustive625 sequences, coherence masses, clip NLL and reversal scope. No video diffusion training or FVD network execution.
- Four computed SVG variants per topic. Fifteen numeric/geometry tests and36 responsive cases passed; twelve final Chinese-mobile/English-desktop screenshots actually inspected. Initial label polish and English mobile-title clipping correction preserved. Full article acceptance recorded separately.
Source locations checked:
- Video Diffusion Models (v1) · Read section3 and opening3.1; PDF3 viewed. Factorized architecture and extension setup only, not full reconstruction-guidance algorithm or benchmark reproduction.
- Towards Accurate Generative Models of Video: A New Metric & Challenges (v1) · Read section2 and I3D representation paragraphs; PDF2 viewed. No metric-network execution or human-study replication.
- google-research/google-research: frechet_video_distance/frechet_video_distance.py @932d468 · Read34-55,65-88,125-146: scaling, I3D and activation-distance call. Apache2 heading/opening only; no upstream execution.
Related topics