Perceptual and Generative Evaluation › Reconstruction and Predictive Accuracy
World Models HandbookAll chapters Perceptual and Generative Evaluation › Reconstruction and Predictive AccuracyOne section · Sections in this chapter2 / 8 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Reconstruction scoring and future-prediction scoring agree on the math and disagree on the story. In reconstruction the model sees , produces , and we compare to . In future prediction the model sees and and produces , and we compare the predicted sequence to the realized sequence . Pixel-wise mean squared error (MSE) and peak signal-to-noise ratio (PSNR) are the two workhorses of both. Frame MSE averages squared pixel residuals; frame PSNR applies a logarithm to that spatially averaged MSE. For sequences, averaging frame PSNR is not the same as applying the logarithm to a pooled MSE. The averaging conventions matter and are the subject of the next formulas.
The reference changes meaning between tasks. Ordinary reconstruction compares against the fixed input observation; zero pixel MSE requires reproducing that array, but reconstruction quality alone does not establish useful internal state. Future prediction compares against a realized outcome, potentially one of several possible futures. The same distance therefore has a different interpretation.
The mean squared error (MSE) between a prediction and a target , both of shape with pixel values in , is
where:
- : the predicted pixel value at spatial position
- : the target pixel value at the same position
- : the height and width of the frame in pixels
- : normalization by the pixel count, making the result an average rather than a sum
The subtraction is the signed per-pixel error. Squaring removes its sign and heavily penalizes large deviations.
The square grows quadratically with error magnitude. Uniform error of 0.1 gives MSE 0.01. Error of 0.3 on 10 percent of pixels, with zero error elsewhere, gives MSE . These close averages do not describe where the errors occur. The perceptual importance of a localized error depends on the scene and viewing task; we have not measured it in this calculation.
The quadratic penalty is easiest to see as a curve. The same squared-error contribution can come from a small error everywhere or a larger error in a small region.
import numpy as np
error_magnitude = np.linspace(0.0, 0.35, 200)
squared_error = error_magnitude**2
uniform_error = 0.1
localized_error = 0.3
uniform_contribution = uniform_error**2
localized_contribution = localized_error**2
# The prose claim is that a localized 0.3 error on 10% of pixels scores comparably to
# a uniform 0.1 error on all pixels: 0.09 * 0.1 = 0.009 vs 0.01. Verify the contest is
# actually close enough that the plot supports the prose rather than showing a trivial gap.
uniform_total = uniform_contribution
localized_total = localized_contribution * 0.1
assert abs(uniform_total - localized_total) / uniform_total < 0.2
For a multi-step prediction, we first compute the per-frame MSE for each horizon step and then average those per-frame values over time. The sequence MSE is
where:
- : the predicted frame at horizon step
- : the realized frame at the same horizon step
- : the number of future frames being averaged
- : the per-frame MSE defined above
Notice the two averaging decisions: how to combine spatial and channel dimensions into a per-frame value, and how to combine frames into a per-rollout value. Do not compare two numbers from different conventions. Always specify the pixel range (here in ) and the tensor layout, and state whether frames of different length are padded and excluded via a valid mask :
where:
- : a validity indicator for frame , where includes the frame and excludes it (e.g., padding)
- : the prediction horizon, as before
- : the valid-frame count, which must be positive. An all-padding sequence has no defined score under this formula and must be excluded or handled by a declared convention.
The valid mask is not a cosmetic detail. Suppose a model is trained to predict up to 64 frames, but two datasets provide rollouts of length 32 and 48 respectively. If the evaluation pads all rollouts to length 64 and averages the padded MSE without masking, the shorter dataset will be artificially penalized or rewarded depending on what value padded frames take. A mask removes this artifact by restricting the average to the frames the data actually contains. The same averaging convention question also arises when sequences are grouped into batches: the natural convention is to compute a per-sequence score and then average over sequences, rather than pooling all frames across the batch, because the latter weights long sequences more heavily.
Peak signal-to-noise ratio (PSNR) is MSE expressed on a logarithmic scale. It answers the question: how large is the squared peak signal relative to the squared reconstruction error? Given a declared peak value (usually the maximum representable pixel value, so for a range and for 8-bit images), PSNR is
where:
- : the declared peak value of the pixel range, i.e. the maximum representable pixel value
- : the pixel MSE between prediction and target, defined above
- : a logarithmic rescaling of the ratio into decibels (dB). At fixed , lower MSE means higher PSNR, so the preference ordering is equivalent with opposite score directions.
When , PSNR is in the mathematical definition. If a report clips exact matches to a finite cap, it must state that choice. Declare and keep it consistent with the pixel units. Rescaling both images by 255 multiplies MSE by and changes from 1 to 255, leaving PSNR unchanged. Changing only while keeping the same numerical errors adds dB, an inconsistent protocol rather than a model improvement. At fixed , PSNR is a strictly convex function of positive MSE: a constant minus .
For positive frame errors and the same , Jensen's inequality gives mean frame PSNR greater than or equal to PSNR of mean MSE, with equality when all errors agree. Their gap is , the logarithm of the arithmetic-to-geometric mean ratio. It increases under a mean-preserving spread of the errors; variance alone does not determine it. State which averaging convention the table uses. Exact-zero errors need an explicit infinity or clipping convention.
The next bar chart applies both averaging conventions to the same eight positive frame errors. Its difference measures the averaging gap for this fixed set, not a comparison between two predictors.
import numpy as np
frame_mse = np.array([0.002, 0.003, 0.004, 0.006, 0.010, 0.018, 0.030, 0.050])
mean_psnr = float(np.mean(10.0 * np.log10(1.0 / frame_mse)))
psnr_of_mean = float(10.0 * np.log10(1.0 / np.mean(frame_mse)))
Expected MSE is minimized by the conditional mean. Suppose is a real-valued target with finite second moment, contains the conditioning information, and is an unrestricted measurable predictor with finite squared error. The expectation is over the joint distribution . The squared error decomposes into an irreducible term plus the squared gap between and the conditional mean:
Expanding the square and conditioning on eliminates the cross term: the conditional mean of is zero almost surely. The irreducible first term does not depend on ; the second is nonnegative and is zero exactly when almost surely. Thus the conditional mean minimizes expected squared error under the stated integrability assumptions.
For a finite-dimensional image vector, apply the same decomposition to each coordinate and average. The conditional mean still minimizes expected pixel MSE. If possible images place an object at separated locations, averaging their pixels can produce a faded overlay rather than an image from either mode. This is a possible consequence of the geometry, not a claim that every multimodal distribution has an implausible mean.
In our separated-object example, an MSE-optimal point estimate need not be a plausible sample. That is a mismatch between the prediction target and the sample-quality question, not a contradiction in the theorem. Blur can also reflect limited decoder resolution or capacity; the image alone does not identify its cause.
Structural similarity (SSIM), introduced by Wang, Bovik, Sheikh, and Simoncelli (2004), compares local luminance, contrast, and structure rather than uniformly weighting pixel-coordinate squared errors. For each sliding-window position, it summarizes corresponding patches by weighted means, variances, and covariance. With normalized Gaussian window weights , these statistics are defined as:
where:
- : the window weight at position (Gaussian or uniform), summing to 1
- : pixel values of the two images within the window
- : the weighted local means
- : the weighted local variances
- : the weighted local covariance between the two patches, computed as
The SSIM score for that window is
where:
- : the numerator of the luminance term, comparing the two local means
- : the denominator of the luminance term, normalizing that comparison
- : the numerator of the combined contrast-and-structure term
- : its denominator; together the factors compare covariance and local variance, not a squared correlation alone
- , : small stabilizing constants using the reference defaults and , where is the declared dynamic range
The first ratio measures luminance agreement and the second measures structural (contrast and correlation) agreement; the constants keep the ratio finite when the local variances or means are near zero. The per-window scores are averaged over all window positions, giving the mean SSIM (MSSIM) that is reported for image-quality benchmarking.
The second ratio is not squared Pearson correlation. Without stabilizers and with positive local standard deviations, it equals the correlation multiplied by , a contrast-agreement factor. A positive gain can preserve correlation while reducing contrast agreement; an offset can reduce luminance agreement. SSIM does not ignore brightness shifts. Rescaling both images and the declared range together preserves this formula, but that change of units is not invariance to a physical gain or offset applied to just one image.
SSIM depends on the window size, whether the window is Gaussian or uniform, the standard deviation of the Gaussian, border-handling, whether the input is color or grayscale, and the declared . Two papers calling their metric "SSIM" may be computing different numbers. And, more importantly, SSIM is a proxy for human similarity judgments on natural images; it is not a semantic or physical truth classifier. A prediction with high SSIM can still place an object on the wrong side of a wall.
SSIM's agreement with human ratings was evaluated on specified image-distortion datasets. Agreement on a new domain or task is not guaranteed, but domain change does not necessarily reduce it. Validate the score against the distinctions that matter for the target task.
MSE, PSNR, and SSIM are full-reference metrics: they require a specified, aligned reference. That reference need not be physical ground truth; an evaluation should state its source. For stochastic prediction, the realized future is one draw from the true conditional, so an alternative valid mode may score poorly against it. Comparing sample distributions changes the evaluation unit but introduces other limitations.
Consider a grayscale canvas with a Gaussian blob of width pixels. We prescribe two equally likely future locations under the same action, which could represent unobserved friction or contact variation. The code renders the two endpoints; it does not simulate that physical mechanism. The realized reference is the short-step endpoint. We compare a sharp match, a sharp alternative, and their pixel-wise mean using MSE and PSNR. At a fixed range on a single pair, PSNR gives exactly the reverse numerical ordering of MSE, so their preferences agree. We discuss SSIM separately rather than pretending to have computed it here.
The soft rendering makes the pixel-wise average visible as a faded superposition. Gaussian blobs have overlapping tails, so they are separated rather than strictly disjoint. This particular average is neither sharp endpoint; the conditional-mean theorem does not assert that every mean of separated modes lies in a low-density region.
import matplotlib.pyplot as plt
import numpy as np
SIZE = 48
BLOB_SIGMA = 2.5
def render_object(x, y=None, sigma=BLOB_SIGMA, size=SIZE):
"""Render a soft Gaussian blob centered at (x, y) on a size x size canvas."""
if y is None:
y = size / 2.0
yy, xx = np.mgrid[0:size, 0:size].astype(float)
return np.exp(-(((xx - x) ** 2 + (yy - y) ** 2) / (2.0 * sigma**2)))
def mse(a, b):
return float(np.mean((a - b) ** 2))
def psnr(a, b, peak=1.0):
m = mse(a, b)
if m == 0.0:
return float("inf")
return 10.0 * np.log10(peak**2 / m)Now we build a single realized future and three candidate predictions. The realized future is mode A. The candidates are mode A (Sharp-A), mode B (Sharp-B), and the pixel-wise conditional mean. The mean under a two-mode conditional with equal weights is the average of the two mode images.
MODE_A_X = 20.0 # small step to the right under action a_t = +1
MODE_B_X = 28.0 # large step to the right under the same action
REALIZED_X = MODE_A_X # the future that actually happened
observed = render_object(REALIZED_X)
pred_sharp_A = render_object(MODE_A_X)
pred_sharp_B = render_object(MODE_B_X)
pred_mean = 0.5 * (render_object(MODE_A_X) + render_object(MODE_B_X))
assert observed.shape == (SIZE, SIZE)
assert observed.min() >= 0.0 and observed.max() <= 1.0Now score the predictions against the realized future. The mean averages two separated blobs with overlapping tails. Its maximum intensity is approximately 0.503 in this discretized example, close to half the peak of either endpoint, so it looks faded.
Sharp-A MSE=0.000000 PSNR=inf Sharp-B MSE=0.015727 PSNR=18.03 dB Mean MSE=0.003932 PSNR=24.05 dB





The bar chart makes the first-class concern of this chapter concrete. Pixel error rewards the model that got lucky on this particular draw, not the model that captured the conditional. Sharp-B is a mode the ground-truth process itself can produce; if the realized future had been Sharp-B instead, the ranking would flip. And the conditional mean, which is MSE-optimal on average, looks neither like Sharp-A nor Sharp-B in this particular draw.
One paired score evaluates one prediction against one realized future. Repeated paired MSE estimates expected squared error, but even that expectation does not characterize the full conditional distribution: the conditional mean is optimal without representing its modes or probabilities. Distributional tests with explicit conditioning or proper probabilistic scores answer a different question.
MSE remains useful for measuring paired accuracy. To assess the forecast distribution, use a declared probabilistic scoring rule or conditional distributional diagnostic over enough held-out cases. Merely averaging more paired MSE values does not turn MSE into a complete distributional test.