Close Menu
AI News TodayAI News Today

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    10 Things I’m Learning Beyond AI to Become More Technologically Fluent

    Northern Gannet, Great Blue Heron, California Brown Pelican

    Sony and UMG are suing Suno again

    Facebook X (Twitter) Instagram
    • About Us
    • Contact Us
    Facebook X (Twitter) Instagram Pinterest Vimeo
    AI News TodayAI News Today
    • Home
    • AI News
    • AI Reviews
    • AI Tools
    • AI Tutorials
    • Chatbots
    • Free AI Tools
    • Artificial Intelligence
    AI News TodayAI News Today
    Home»AI Tools»Your Model’s MSE Is Lying to You: Part II
    AI Tools

    Your Model’s MSE Is Lying to You: Part II

    By No Comments24 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Your Model's MSE Is Lying to You: Part II
    Share
    Facebook Twitter LinkedIn Pinterest Email

    In a previous article, we saw why training with MSE forces a model to report only the conditional mean, and how Gaussian NLL lets it learn an honest per-step uncertainty σsigmaσ as well. That was the one-step story. This post picks up where that left off.

    Everything we built in Part I — the Gaussian NLL, the two-term loss, the proof that the model learns both the conditional mean and the conditional variance — was about one-step-ahead prediction: given a context window of TTT observed values, predict the distribution of the very next value xT+1x_{T+1}xT+1​.

    At inference time, in any real application, this is rarely enough. You want to know what happens over the next 10, 100, or 1000 steps. You want a forecast, not a single prediction. And if your model is probabilistic, you want that forecast to carry honest uncertainty all the way to the end of the horizon.

    This post is about how to do this correctly. One could think immediately of the naive approach, that is applying the model repeatedly, feeding its predictions back as inputs is secretly a deterministic operation that discards the uncertainty the model spent so much effort learning. Fixing this requires thinking carefully about what a joint distribution over future values actually is, and how to approximate it with Monte Carlo sampling. The fix is barely more code than the naive version, but it gives a fundamentally different and fundamentally better forecast.

    Everything here is built and checked in the companion notebook: the two rollout approaches, applied to the same trained model, on the same signal, with coverage and PIT diagnostics (all explained in this post).

    ···

    Recapping the one-step setting

    In Part I, we trained a model that takes a context window of TTT observed values and outputs two numbers:

    (μT+1,  σT+1)=fθ(x1,x2,…,xT)(mu_{T+1},; sigma_{T+1}) = f_theta(x_1, x_2, ldots, x_T)(μT+1​,σT+1​)=fθ​(x1​,x2​,…,xT​)

    These parameterise a Gaussian distribution over the next time step T+1T+1T+1:

    xT+1∣x1:T  ∼  N(μT+1,  σT+12)x_{T+1} mid mathbf{x}_{1:T} ;sim; mathcal{N}(mu_{T+1},; sigma_{T+1}^2)xT+1​∣x1:T​∼N(μT+1​,σT+12​)

    This is a conditional distribution, it tells us everything about xT+1x_{T+1}xT+1​ given that we know x1x_1x1​ through xTx_TxT​ exactly. The uncertainty σT+1sigma_{T+1}σT+1​ captures the irreducible randomness at that one step: the noise we cannot predict no matter how good the model is. The Gaussian NLL loss trained the model to get both μmuμ and σsigmaσ right, that is the conditional mean and the conditional variance at each individual step.

    Clean, well-defined, and exactly what the loss was designed to learn. The problem starts the moment someone asks: okay, but what happens over the next 50 steps?

    ···

    The multi-step inference problem

    In any real application, you don’t just need the next value. You need a forecast, a prediction over an extended horizon. “Will this signal cross the alarm threshold sometime in the next hour?” “What does the load profile look like for the rest of the day?” These questions require predicting not one step but many.

    Suppose we want to forecast the next HHH steps: xT+1,xT+2,…,xT+Hx_{T+1}, x_{T+2}, ldots, x_{T+H}xT+1​,xT+2​,…,xT+H​. The quantity we want is the joint predictive distribution:

    p(xT+1, xT+2, …, xT+H∣x1:T)p(x_{T+1},, x_{T+2},, ldots,, x_{T+H} mid mathbf{x}_{1:T})p(xT+1​,xT+2​,…,xT+H​∣x1:T​)

    Notice what this is. It’s not HHH separate distributions. It’s one distribution over HHH-dimensional space, a distribution over entire sequences. The value at step T+3T+3T+3 depends on what happened at steps T+1T+1T+1 and T+2T+2T+2. The future values are correlated with each other because each one feeds into the next.

    There’s a standard tool from probability theory, which is the chain rule that factors any joint distribution into a product of conditionals:

    p(xT+1:T+H∣x1:T)=∏h=1Hp(xT+h∣x1:T+h−1)p(x_{T+1:T+H} mid mathbf{x}_{1:T}) = prod_{h=1}^{H} p(x_{T+h} mid mathbf{x}_{1:T+h-1})p(xT+1:T+H​∣x1:T​)=∏h=1H​p(xT+h​∣x1:T+h−1​)

    Each factor is a one-step conditional distribution: “what’s the distribution of the next value given everything before it?”, which is exactly what the model was trained to produce.

    So in principle, you can build the joint distribution one step at a time: predict step T+1T+1T+1 given the observed history, then predict step T+2T+2T+2 given the observed history plus step T+1T+1T+1, then step T+3T+3T+3 given all of the above, and so on.

    But here’s the catch. For step T+2T+2T+2, the conditioning includes xT+1x_{T+1}xT+1​, a value you don’t actually have. You only observed up to xTx_TxT​. Everything beyond that is the model’s own prediction. And that prediction is uncertain, it’s a distribution, not a number.

    How you handle this unknown is the entire story of this post. There are two strategies that look similar in code but are conceptually and statistically very different.

    Figure 1: The two approaches of probablistic forecasting. Option A: Deterministic rollout feeds only μmuμ forward, so later σsigmaσ predictions assume the previous value was known exactly. Option B: Stochastic rollout samplesx~tilde{x}x~ from the predicted Gaussian so uncertainty propagates; aggregating many trajectories yields calibrated uncertainty at long horizons. Image by author.

    Two approaches for probabilistic autoregressive forecasting.

    Strategy A: The deterministic rollout: feed μmuμ back

    The simplest thing you could do: at each step, predict (μ,σ)(mu, sigma)(μ,σ), take only theμmuμ, plug it into the context as if it were an observed value, and move on. The recursion looks like this:

    x^1:T+1=[x1:T,  μT+1](append μ, discard σ)hat{mathbf{x}}_{1:T+1} = [mathbf{x}_{1:T},; mu_{T+1}] qquad text{(append } mutext{, discard } sigmatext{)}x^1:T+1​=[x1:T​,μT+1​](append μ, discard σ)

    (μT+2, σT+2)=fθ(x^1:T+1)(mu_{T+2},, sigma_{T+2}) = f_theta(hat{mathbf{x}}_{1:T+1})(μT+2​,σT+2​)=fθ​(x^1:T+1​)

    x^1:T+2=[x^1:T+1,  μT+2]hat{mathbf{x}}_{1:T+2} = [hat{mathbf{x}}_{1:T+1},; mu_{T+2}]x^1:T+2​=[x^1:T+1​,μT+2​]

    ⋮vdots⋮

    You get a sequence of means μT+1,μT+2,…,μT+Hmu_{T+1}, mu_{T+2}, ldots, mu_{T+H}μT+1​,μT+2​,…,μT+H​ and a parallel sequence of sigmas σT+1,…,σT+Hsigma_{T+1}, ldots, sigma_{T+H}σT+1​,…,σT+H​. Looks like a complete probabilistic forecast. In code, it’s very straightforward:

    def deterministic_rollout(model, context, horizon):    mus, sigmas = [], []    for h in range(horizon):        mu, log_sigma = model(context)        sigma = torch.exp(log_sigma)        mus.append(mu.item())        sigmas.append(sigma.item())        # slide the window: drop the oldest value, append mu        ctx = torch.cat([ctx[1:], mu.reshape(1)])    return np.array(mus), np.array(sigmas)

    Simple and clean, but, unfortunately wrong in a way that actually matters.

    Think about what the model is being asked at step T+2T+2T+2. It receives a context that ends with μT+1mu_{T+1}μT+1​, a specific, exact number. The model treats it as if that value actually happened. So when it produces σT+2sigma_{T+2}σT+2​, it’s answering the question: “Given that the previous value was exactly μT+1mu_{T+1}μT+1​, how uncertain am I about the next step?”

    But, this is the wrong question. The previous value was not exactly μT+1mu_{T+1}μT+1​. It was drawn from a distribution N(μT+1,σT+12)mathcal{N}(mu_{T+1}, sigma_{T+1}^2)N(μT+1​,σT+12​). It could have been higher or lower. The correct question is: “Given that the previous value was somewhere around μT+1mu_{T+1}μT+1​ with spread σT+1sigma_{T+1}σT+1​, how uncertain am I about the next step?”

    The second question always has a strictly larger answer. Always. Because it has to account for two sources of randomness: the noise at the current step plus the uncertainty inherited from the previous step.

    By feeding μmuμ back, you’re pretending the previous prediction was perfect. The σsigmaσ values you get capture only the local noise at each step in isolation, the irreducible randomness if the input were known exactly. They completely miss the propagated uncertainty, the fact that every input from step T+1T+1T+1 onward was itself uncertain. The consequence: deterministic rollout systematically underestimates forecast uncertainty, and the underestimation gets worse the further out you go. At step T+2T+2T+2, you’re ignoring one step of propagated uncertainty. At step T+50T+50T+50, you’re ignoring 49 steps of it.

    Imagine you’re navigating by compass, and each reading has a small error. One step off course is fine, that’s σT+1sigma_{T+1}σT+1​. But if you take 50 steps, each slightly off, the errors accumulate. You could be very far from where you think you are.

    Now here’s the key: if you recalculate your position at each step assuming you’re exactly where you planned to be, not where you actually are, your navigation uncertainty stays small on paper even though you’re actually drifting. After 50 steps, your map says “uncertainty: 2 meters.” Reality says you might be 200 meters off. The map isn’t lying about any single step’s compass error. It’s lying by pretending that every previous step landed perfectly, which none of them did.

    The multi-step inference problem. At each step , the model produces a predictive distribution (shown sideways at each forecast point). The conditions shift at every step, where the model needs the previous predictions as context and uncertainty accumulates over the horizon.
    Figure 2: The multi-step inference problem. At each step T+hT+hT+h, the model produces a predictive distribution (shown sideways at each forecast point). The conditions shift at every step, where the model needs the previous predictions as context and uncertainty accumulates over the horizon. Image by author.

    Probabilistic multi-step inference problem.

    That’s exactly what deterministic rollout does. Each σT+hsigma_{T+h}σT+h​is an honest answer to a dishonest question. The model is asked “how uncertain are you about the next step, given that the last step was exactly μmuμ?” and it answers correctly. But the premise is false. The last step wasn’t exactly μmuμ. It was drawn from a spread. And by the time you’re 50 steps out, you’ve told 49 lies about perfect inputs, and the accumulated dishonesty shows up as a confidence band that’s far too narrow.

    Strategy B: The stochastic rollout: sample and feed back

    The fix is simple: instead of feeding μmuμ back, draw a random sample from the predicted distribution and feed that back. Run this MMM times to get MMM plausible futures.

    Step by step, for one trajectory (labeled mmm):

    xT+1(m)∼N(μT+1,  σT+12)x_{T+1}^{(m)} sim mathcal{N}(mu_{T+1},; sigma_{T+1}^2)xT+1(m)​∼N(μT+1​,σT+12​)

    (μT+2(m), σT+2(m))=fθ(x1:T, xT+1(m))(mu_{T+2}^{(m)},, sigma_{T+2}^{(m)}) = f_theta(mathbf{x}_{1:T},, x_{T+1}^{(m)})(μT+2(m)​,σT+2(m)​)=fθ​(x1:T​,xT+1(m)​)

    xT+2(m)∼N(μT+2(m),  σT+2(m) 2)x_{T+2}^{(m)} sim mathcal{N}(mu_{T+2}^{(m)},; sigma_{T+2}^{(m),2})xT+2(m)​∼N(μT+2(m)​,σT+2(m)2​)

    ⋮vdots⋮

    The superscript (m)(m)(m) marks one trajectory, one possible future. Because step 1 was a random draw, the value xT+1(m)x_{T+1}^{(m)}xT+1(m)​ differs from μT+1mu_{T+1}μT+1​. This means the model sees a different context at step 2, producing different (μT+2(m),σT+2(m))(mu_{T+2}^{(m)}, sigma_{T+2}^{(m)})(μT+2(m)​,σT+2(m)​), leading to a different samplexT+2(m)x_{T+2}^{(m)}xT+2(m)​, and so on. Every downstream step is affected by the randomness at every upstream step. Uncertainty propagates through the chain, compounding naturally.

    But one trajectory is just one possible future, a single random path through the space of sequences. To approximate the full joint distribution, you runMMM independent trajectories, each from the same observed history x1:Tmathbf{x}_{1:T}x1:T​, each diverging because of fresh random draws.

    In code, the key trick is to process all MMM trajectories as a single batch, one forward pass per horizon step, not MMM separate passes:

    def stochastic_rollout(model, context, horizon, M=500):    # copy the context M times: (M, T)    ctx = context.unsqueeze(0).expand(M, -1).clone()    trajectories = torch.zeros(M, horizon)    for h in range(horizon):        mu, log_sigma = model(ctx)               # (M,) each        sigma = torch.exp(log_sigma)        # each trajectory draws its own random sample        sample = mu + sigma * torch.randn(M)        trajectories[:, h] = sample        # slide each window: drop oldest, append this trajectory's sample        ctx = torch.cat([ctx[:, 1:], sample.unsqueeze(1)], dim=1)    return trajectories 

    Take a minute to compare the two functions. The structure is identical, a loop over horizon steps, with a sliding context window. The only difference is one line: deterministic rollout appends mu, stochastic rollout appends sample. That one-line change is the difference between throwing away uncertainty and propagating it correctly.

    Why uncertainty must grow: the law of total variance

    The intuition above, propagated uncertainty makes things wider can be made precise with a single theorem: the law of total variance:

    Var(X)=E[Var(X∣Y)]⏟average local noise+Var(E[X∣Y])⏟uncertainty about the inputtext{Var}(X) = underbrace{mathbb{E}[text{Var}(X mid Y)]}_{text{average local noise}} + underbrace{text{Var}(mathbb{E}[X mid Y])}_{text{uncertainty about the input}}Var(X)=average local noiseE[Var(X∣Y)]​​+uncertainty about the inputVar(E[X∣Y])​​

    In plain language: the total uncertainty about XXX is the sum of two parts. First, the average noise you’d see even if you knew YYY exactly. Second, the extra spread caused by the fact that different values of YYY lead to different predictions for XXX. Since variances can’t be negative, the total is always at least as large as either part alone.

    Apply this to forecasting. Let X=xT+2X = x_{T+2}X=xT+2​ and Y=xT+1Y = x_{T+1}Y=xT+1​:

    Var(xT+2∣x1:T)=E[Var(xT+2∣x1:T,xT+1)]⏟Term I: aleatoric+Var(E[xT+2∣x1:T,xT+1])⏟Term II: propagatedtext{Var}(x_{T+2} mid mathbf{x}_{1:T}) = underbrace{mathbb{E}[text{Var}(x_{T+2} mid mathbf{x}_{1:T}, x_{T+1})]}_{text{Term I: aleatoric}} + underbrace{text{Var}(mathbb{E}[x_{T+2} mid mathbf{x}_{1:T}, x_{T+1}])}_{text{Term II: propagated}}Var(xT+2​∣x1:T​)=Term I: aleatoricE[Var(xT+2​∣x1:T​,xT+1​)]​​+Term II: propagatedVar(E[xT+2​∣x1:T​,xT+1​])​​

    Term I is the expected one-step noise at step T+2T+2T+2, averaged over possible values of xT+1x_{T+1}xT+1​. Even if we knew xT+1x_{T+1}xT+1​ exactly, the model would still be uncertain about xT+2x_{T+2}xT+2​. This is what deterministic rollout captures.

    Term II is the variance of the conditional mean μ2(xT+1)mu_2(x_{T+1})μ2​(xT+1​) caused by the randomness in xT+1x_{T+1}xT+1​. Since xT+1x_{T+1}xT+1​ is uncertain and the prediction for xT+2x_{T+2}xT+2​ depends on it, the center of the step-2 prediction is itself a random variable. This term is zero in deterministic rollout, because feeding μ1mu_1μ1​ back treats xT+1x_{T+1}xT+1​ as fixed, making μ2mu_2μ2​ a constant rather than a random variable. Let’s spell it out to see exactly where the gap is. Assume the model is a perfect one-step predictor and define:

    • μ1=E[xT+1∣x1:T]mu_1 = mathbb{E}[x_{T+1} mid mathbf{x}_{1:T}]μ1​=E[xT+1​∣x1:T​], σ12=Var(xT+1∣x1:T)sigma_1^2 = text{Var}(x_{T+1} mid mathbf{x}_{1:T})σ12​=Var(xT+1​∣x1:T​)

    • μ2(xT+1)=E[xT+2∣x1:T+1]mu_2(x_{T+1}) = mathbb{E}[x_{T+2} mid mathbf{x}_{1:T+1}]μ2​(xT+1​)=E[xT+2​∣x1:T+1​], which depends on what xT+1x_{T+1}xT+1​ was

    • σ22(xT+1)=Var(xT+2∣x1:T+1)sigma_2^2(x_{T+1}) = text{Var}(x_{T+2} mid mathbf{x}_{1:T+1})σ22​(xT+1​)=Var(xT+2​∣x1:T+1​), also a function of xT+1x_{T+1}xT+1​

    Note the key thing: μ2mu_2μ2​ and σ22sigma_2^2σ22​ are written as functions of xT+1x_{T+1}xT+1​ because the prediction at step 2 changes depending on what happened at step 1. If xT+1x_{T+1}xT+1​ is high, μ2mu_2μ2​ shifts one way. If xT+1x_{T+1}xT+1​ is low, it shifts another.

    Deterministic rollout evaluates σ22sigma_2^2σ22​ at one specific input: xT+1=μ1x_{T+1} = mu_1xT+1​=μ1​. It gets:

    Vardet(xT+2)=σ22(μ1)text{Var}_{text{det}}(x_{T+2}) = sigma_2^2(mu_1)Vardet​(xT+2​)=σ22​(μ1​)

    While stochastic rollout, through its many trajectories, captures both terms of the law of total variance:

    Varsto(xT+2)=E[σ22(xT+1)]+Var(μ2(xT+1))text{Var}_{text{sto}}(x_{T+2}) = mathbb{E}[sigma_2^2(x_{T+1})] + text{Var}(mu_2(x_{T+1}))Varsto​(xT+2​)=E[σ22​(xT+1​)]+Var(μ2​(xT+1​))

    Therefore:

    Varstochastic=E[σ22]⏟average noise+Var(μ2)⏟propagated  ≥  σ22(μ1)⏟deterministicboxed{text{Var}_{text{stochastic}} = underbrace{mathbb{E}[sigma_2^2]}_{text{average noise}} + underbrace{text{Var}(mu_2)}_{text{propagated}} ;geq; underbrace{sigma_2^2(mu_1)}_{text{deterministic}}}Varstochastic​=average noiseE[σ22​]​​+propagatedVar(μ2​)​​≥deterministicσ22​(μ1​)​​​

    The inequality holds because Var(μ2)≥0text{Var}(mu_2) geq 0Var(μ2​)≥0. And it’s strictly positive whenever μ2mu_2μ2​ actually varies with xT+1x_{T+1}xT+1​, which is true for any signal with structure. The gap is the propagated uncertainty that deterministic rollout misses entirely.

    Forecast variance as a function of horizon  under the two rollout strategies. Both coincide at . Option A captures only the aleatoric noise at each step (approximately constant). Option B captures the full variance via the law of total variance, aleatoric plus propagated, which grows with the horizon. The red shaded gap is the uncertainty that Option A silently discards.
    Figure 3: Illustration of the forecast variance as a function of horizon hhh under the two rollout strategies. Both coincide at h=1h=1h=1. Option A captures only the aleatoric noise at each step (approximately constant). Option B captures the full variance via the law of total variance, aleatoric plus propagated, which grows with the horizon. The red shaded gap is the uncertainty that Option A silently discards. Image by author.

    Law of total variance in probabilistic autoregressive forecasting

    At step T+3T+3T+3, the same decomposition applies again. The model needs xT+2x_{T+2}xT+2​ as input, but xT+2x_{T+2}xT+2​ is itself uncertain and its uncertainty already includes one layer of propagation from step T+1T+1T+1. So step T+3T+3T+3 inherits an even larger input uncertainty, which generates an even larger propagation term, which feeds into step T+4T+4T+4, and so on.

    Each step adds its own layer on top of everything accumulated before. Deterministic rollout misses every one and the gap doesn’t just exist, it grows at every step.

    ···

    Monte Carlo Approximation: MMM parallel trajectories

    The stochastic rollout captures the right uncertainty, but one trajectory is just one sample from the joint distribution. To approximate the full distribution, you run MMM independent trajectories.

    Imagine 500 people in a room, each holding a copy of the same observed history on a piece of paper. At this moment, all 500 papers are identical.

    Round 1: everyone feeds the same history into the model. Since the inputs are identical, everyone gets the same (μ1,σ1)(mu_1, sigma_1)(μ1​,σ1​). Now each person rolls their own dice, drawing a random sample from N(μ1,σ12)mathcal{N}(mu_1, sigma_1^2)N(μ1​,σ12​). Person 1 gets 0.41. Person 2 gets 0.62. Person 3 gets 0.55. All different numbers, because each is a separate random draw from the same bell curve. Each person writes their number at the end of their paper. The papers are no longer identical.

    Round 2: each person feeds their own paper into the model. Person 1’s paper ends in 0.41, person 2’s ends in 0.62, just different inputs produce different (μ2,σ2)(mu_2, sigma_2)(μ2​,σ2​) for each person. Each rolls their dice again. The papers now differ in the last two values.

    Round 3, 4, 5, … HHH: same thing. At every round, the papers diverge further because each person’s context is shaped by all their previous random draws.

    After HHH rounds, you have 500 different possible futures. They started identical (same real history) and diverged because each person rolled their own dice at every step. This divergence is the uncertainty propagation and the amount they’ve spread apart by round HHH is the honest forecast uncertainty at that horizon.

    Illustration of Monte Carlo approximation. Five trajectories starting from the same context. They diverge progressively as each trajectory conditions on its own samples. The dashed red envelope is the quantile band (e.g., 10th–90th percentile across all  trajectories). The solid black line is the median. The fan naturally widens with the horizon.
    Figure 4: Five Monte Carlo trajectories starting from the same context. They diverge progressively as each trajectory conditions on its own samples. The dashed red envelope is the quantile band (e.g., 10th–90th percentile across all MMM trajectories). The solid black line is the median. The fan naturally widens with the horizon. Image by author.

    Monte Carlo approximation of stochastic rollout.

    This procedure is the Monte Carlo approximation of the joint distribution. You can’t write that distribution down in closed form, since the model is a nonlinear neural network, but you can sample from it exactly through the stochastic rollout. Each trajectory follows the chain rule factorisation we wrote earlier, sampling from the correct one-step conditional at every step. With enough samples, you can estimate any property of the joint distribution you want: means, quantiles, exceedance probabilities, whatever.

    How many is enough?

    The estimation error shrinks as O(1/M)O(1/sqrt{M})O(1/M​). In practice:

    • For the median (central forecast): M=20M = 20M=20 to 505050 is usually enough. The median converges fast because it only needs the rough middle of the distribution.

    • For the 5th or 95th percentile (tail behaviour): you need more. At M=50M = 50M=50, the 5th percentile is approximately the 2nd or 3rd smallest value out of 50 one different random draw shifts it a lot. For reliable tail estimates, M=200M = 200M=200 to 500500500 is safer.

    • For coverage checks across many test examples: moderate MMM per example 505050–100100100) is fine, because averaging across test cases smooths the noise.

    The cost is linear: MMM trajectories meansMMM forward passes per horizon step. But with batching, processing all MMM contexts as a single batch, as in the code above, this is one GPU kernel launch per step, not MMM separate calls. On the synthetic signal from Part I, 500 trajectories over 50 steps runs in seconds on a CPU.

    ···

    From trajectories to a forecast

    You have a matrix of shape M×HM times HM×H: row mmm is one trajectory, columnhhh is one horizon step. How do you turn this into a usable forecast?

    The central forecast: the median. At each horizon step, take the median across trajectories:

    x^T+h=median(x~h(1), x~h(2), …, x~h(M))hat{x}_{T+h} = text{median}(tilde{x}_h^{(1)},, tilde{x}_h^{(2)},, ldots,, tilde{x}_h^{(M)})x^T+h​=median(x~h(1)​,x~h(2)​,…,x~h(M)​)

    Why median and not mean? If a few trajectories wander off to extreme values (it happens, especially at long horizons), the mean gets pulled toward them. The median doesn’t care, it just looks at the middle. For symmetric distributions both are equivalent, so there’s no cost in switching.

    Uncertainty bands: quantiles. Sort the MMM values at each step. The band between the (α/2)(alpha/2)(α/2)-th and (1−α/2)(1 – alpha/2)(1−α/2)-th percentiles is a prediction interval at level 1−α1 – alpha1−α. For a 90% band, take the 5th and 95th percentiles.

    median_forecast = np.median(trajectories, axis=0)     # (H,)lower_90 = np.percentile(trajectories, 5, axis=0)     # (H,)upper_90 = np.percentile(trajectories, 95, axis=0)    # (H,)

    No Gaussian assumption here. You’re not computing μ±1.645σmu pm 1.645sigmaμ±1.645σ. You’re reading directly from where the trajectories actually went. If the distribution at some horizon step is skewed or heavy-tailed, the quantile band reflects that automatically.

    Left: at one horizon , the  simulated values of  form an empirical histogram; red dashed lines mark the 10th and 90th percentiles (shaded: central 80%) and the black line the median. Right: the same construction at every future step yields the median path (black) and nested bands; the dotted purple line marks the horizon shown on the left. Edge labels are percentiles for an illustrative symmetric ensemble.
    Figure 5: Left: at one horizon hhh, the MMM simulated values of xT+hx_{T+h}xT+h​ form an empirical histogram; red dashed lines mark the 10th and 90th percentiles (shaded: central 80%) and the black line the median. Right: the same construction at every future step yields the median path (black) and nested bands; the dotted purple line marks the horizon shown on the left. Edge labels are percentiles for an illustrative symmetric ensemble (central 68% lies between 16% and 84%; central 95% between 2.5% and 97.5%). Image by author.

    Exceedance probabilities. Remember the alarm threshold τtauτ from Part I? With MMM trajectories, estimating the probability of crossing it is trivial: count how many cross it, divide by MMM. If 35 out of 500 cross τtauτ at some point during the horizon, your estimated exceedance probability is 7%. No closed-form integral needed.

    The key property of all these summaries: at early horizon steps, the trajectories cluster tightly, so bands are narrow. At late horizon steps, the trajectories have fanned out, so bands are wide. The widening happened naturally from the compounding randomness, you didn’t tune anything, you just sampled honestly.

    ···

    QA the forecast I: the coverage-horizon plot

    One example is anecdotal. The real test: run both rollout strategies from many starting points in the test set, and check whether the 90% band actually contains the true value about 90% of the time, at every horizon step.

    For each test window iii with true future xT+1(i),…,xT+H(i)x_{T+1}^{(i)}, ldots, x_{T+H}^{(i)}xT+1(i)​,…,xT+H(i)​, compute the band from each strategy and check:

    insideh(i)=1 ⁣[q^0.05(h,i)  ≤  xT+h(i)  ≤  q^0.95(h,i)]text{inside}_{h}^{(i)} = mathbf{1}!left[hat{q}_{0.05}^{(h,i)} ;leq; x_{T+h}^{(i)} ;leq; hat{q}_{0.95}^{(h,i)}right]insideh(i)​=1[q^​0.05(h,i)​≤xT+h(i)​≤q^​0.95(h,i)​]

    Average over all test windows:

    cov^(h)=1Ntest∑i=1Ntestinsideh(i)widehat{text{cov}}^{(h)} = frac{1}{N_text{test}}sum_{i=1}^{N_text{test}} text{inside}_{h}^{(i)}cov(h)=Ntest​1​∑i=1Ntest​​insideh(i)​

    For a calibrated forecast, cov^(h)≈90%widehat{text{cov}}^{(h)} approx 90%cov(h)≈90% at every horizon hhh.

    Now plot cov^(h)widehat{text{cov}}^{(h)}cov(h) as a function of hhh coverage on the yyy-axis, horizon on the xxx-axis. This single plot tells you almost everything:

    • Flat line near 90%: the rollout is well calibrated. The bands are honest at every horizon. This is what you want.

    • Line that drops as hhh grows: the bands are too narrow at long horizons. The model is overconfident about the distant future. This is the classic signature of deterministic rollout, it misses the propagated uncertainty, so even by step 50 the band is far too tight.

    • Line that rises as hhh grows: the bands are too wide. The model is overly cautious.

    In the companion notebook, the contrast is stark. The deterministic rollout’s coverage crashes below 50% within a few steps and keeps falling, by step 50, it’s barely above chance. The stochastic rollout holds roughly stable across the full horizon. Same model, same context, same trained weights, one line of code changed. That one line, replacing mu with sample in the context append is the difference between a forecast you can trust and one that’s silently lying about its confidence.

    QA the forecast II: the PIT histogram

    The coverage plot tells you “are the bands the right width?” The Probability Integral Transform (PIT) tells you something richer: is the entire predicted distribution correct, not just the width?

    For each test window iii and horizon step hhh, compute the fraction of trajectories that fell below the true value:

    uh(i)=1M∑m=1M1 ⁣[x~h(m,i)≤xT+h(i)]u_h^{(i)} = frac{1}{M}sum_{m=1}^{M} mathbf{1}!left[tilde{x}_h^{(m,i)} leq x_{T+h}^{(i)}right]uh(i)​=M1​∑m=1M​1[x~h(m,i)​≤xT+h(i)​]

    This is the empirical quantile of the truth within the ensemble. If the truth landed right in the middle, u≈0.5u approx 0.5u≈0.5. If almost all trajectories were below the truth, u≈1.0u approx 1.0u≈1.0.

    Key property: if the ensemble is perfectly calibrated, uuu should be uniformly distributed on [0,1][0, 1][0,1]. The truth should land in the bottom 10% of trajectories about 10% of the time, in the middle 10% about 10% of the time, in the top 10% about 10% of the time. Collect uuu values across all test windows and all horizons, and plot a histogram. The shape is the diagnosis:

    illustration of the four PIT histogram shapes. The dashed green line marks the expected uniform density. Deviations from flat identify specific failure modes without any threshold parameters.
    Figure 6: The four PIT histogram shapes. The dashed green line marks the expected uniform density. Deviations from flat identify specific failure modes without any threshold parameters. Image by author.

    PIT histogram shapes

    One histogram, four possible diagnoses. In the accompanying notebook, the deterministic rollout produces a dramatic U-shape, the truth is in the extreme tails far more often than it should be, because the bands are too narrow. The stochastic rollout is much flatter.

    ···

    Practical Considerations

    Keep the clamp during rollout

    During rollout, the model feeds on its own outputs, data it never saw during training. This is distribution shift: the inputs look different from training data because they’re the model’s own predictions, not real observations.

    In this unfamiliar setting, σsigmaσ can drift to extreme values. Without the same log⁡σlogsigmalogσ clamp used during training, a single unlucky trajectory might produce a wild sample that drives σsigmaσ to zero (infinite confidence, gradient explosion) or infinity (total ignorance) at the next step. That corrupts the trajectory, and if it happens early, every subsequent step is garbage. The fix is actually trivial, just apply the same clamp you used during training:

    log_sigma = torch.clamp(log_sigma, min=-5.0, max=2.0)

    If this clamp is already in your model’s forward() method (as it should be from Part I), you don’t need to change anything. Just don’t remove it for inference.

    Single-step head vs multi-step heads

    Some architectures include multi-step prediction heads (such as DeepSeek or SeismoGPT), auxiliary outputs that directly predict the distribution at horizons 2, 3, …, HHH from the current context, without rolling out. These are useful during training as regularisers and give fast marginal distributions at each horizon. But marginal is the key word. A marginal distribution at step hhh tells you the spread of xT+hx_{T+h}xT+h​ by itself. It does not tell you how xT+3x_{T+3}xT+3​ relates to xT+2x_{T+2}xT+2​, or how they move together. There’s no joint distribution, no coherent trajectories.

    Only the autoregressive stochastic rollout produces a joint distribution, actual sequences where each step depends on the previous one. That’s what you need for:

    • Coherent trajectory sampling (a single plausible future)

    • Exceedance probabilities over windows of time (“will the threshold be crossed sometime in the next hour?”)

    • Correct quantile bands that account for compounding uncertainty

    The right approach: use the single-step head plus Monte Carlo rollout for inference. Treat multi-step heads as training auxiliaries, not inference tools.

    Batching is key for speed

    The stochastic rollout processes all MMM trajectories as a single batch of shape (M,T)(M, T)(M,T) one forward pass per horizon step. This is important. MMM separate forward passes of shape (1,T)(1, T)(1,T) would give the same result but be dramatically slower, especially on a GPU where the kernel launch overhead dominates for small models.

    On the synthetic signal from Part I (transformer with 32-dimensional embeddings, 2 layers, 4 heads), 500 trajectories over 50 steps runs in about 2 seconds on a CPU. Scaling to real models and longer horizons, the batched approach stays efficient.

    ···

    What this does not guarantee

    The stochastic rollout propagates uncertainty correctly, but only the uncertainty the model has learned to express. If the one-step model is miscalibrated (its σsigmaσ is systematically too small or too large), the rollout faithfully propagates that miscalibration. Garbage in, garbage out.

    This is why the diagnostics from Part I still matter. The one-step model must be well calibrated first, honest σsigmaσ at every individual step, before rolling it forward. The coverage-horizon plot and PIT histogram then tell you whether the rollout introduced additional problems on top of that.

    There’s also the question of distribution shift during rollout: the model was trained on windows of real data, but during multi-step inference it’s feeding on its own predictions. If the model’s predictions drift for example, if the mean trajectory slowly diverges from the true signal dynamics, the later context windows look increasingly unlike anything the model saw during training. The model might still output reasonable-looking (μ,σ)(mu, sigma)(μ,σ), but the quality degrades. This is a real problem, especially at very long horizons, and it’s why multi-step training losses (training the model on its own rollout outputs, not just on real data) can help.

    There’s also a deeper assumption we haven’t questioned: the predictive distribution at each step is Gaussian. The rollout propagates whatever the one-step model outputs, but if the true noise is skewed, heavy-tailed, or multimodal, even a perfectly calibrated Gaussian is fitting the closest bell curve to a non-bell-curve reality. The mean and variance might be right, but the shape is wrong and shape matters for tail probabilities and threshold crossings.

    We’ll revisit these concerns in future articles.

    ···

    Conclusion

    One-step prediction gives you a distribution over one value. Multi-step prediction needs a distribution over entire sequences. The chain rule says you can build it one step at a time, but only if you propagate uncertainty correctly through the chain.

    Deterministic rollout (feed μmuμ back) treats each intermediate prediction as certain. This captures only the local noise at each step and ignores the inherited uncertainty from all previous steps. The law of total variance guarantees that this underestimates the true forecast variance, and the underestimation compounds at every step. Coverage degrades with horizon.

    Stochastic rollout (sample and feed back, MMM times) lets uncertainty compound naturally through the autoregressive loop. Different trajectories diverge because of the randomness at each step, and the spread of the ensemble at any horizon step reflects both the local noise and all the accumulated propagation. Coverage stays honest.

    The difference in code is one line. The difference in forecast quality is fundamental.

    The coverage-horizon plot and the PIT histogram are the tools that tell you whether your multi-step forecast is calibrated. They apply regardless of the model architecture, the distribution family, or the signal domain. If you’re producing probabilistic forecasts at any horizon longer than one step, you need both.

    And there’s a deeper point here. We started this series asking “should I worry about this prediction?” Part I gave the model a voice, a way to express uncertainty at a single step, through σsigmaσ. Part II gave that voice a memory, a way to carry uncertainty forward over an extended future, through stochastic sampling. But listen to what that voice is actually saying. At every step it says: “I think the next value is drawn from a bell curve with this center and this width.” A bell curve. Symmetric, unimodal, light-tailed.

    Some signals don’t fit that shape. For instance, a seismic signal can have sudden regime changes that create multimodal futures. For all of these, a single Gaussian per step is too rigid, no matter how well you propagate it. That’s where richer predictive distributions, quantized tokens, mixture models, flow matching become essential. The rollout machinery stays exactly the same (sample and feed back, MMM times), but the one-step distribution becomes expressive enough to capture the full complexity of what might happen next. That’s where the next part of this series begins.

    ···

    References

    [1] M. Seitzer, A. Tesch, N. Rasiwasia and G. Martius, On the Pitfalls of Heteroscedastic Uncertainty Estimation with Probabilistic Neural Networks (2022), ICLR 2022

    [2] W. Esmail, S. Russell, J. Klinge, A. Kappes and C. Thomas, Data-Driven Forecasting of three-Component Seismograms Using Transformer Architectures (2026), arXiv:2606.02912

    Lying Models MSE Part
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleDisrupt 2026 Layoff Expo+ Passes available for $75
    Next Article Tesla finally moves to electrify trucking after a decade of work and delays
    • Website

    Related Posts

    AI Tools

    10 Things I’m Learning Beyond AI to Become More Technologically Fluent

    AI Tools

    Jev vs. LLMs: When AI moves from Generation to Decision-making

    Chatbots

    Nexterity wants to automate the hard, dangerous part of pipefitting

    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    10 Things I’m Learning Beyond AI to Become More Technologically Fluent

    0 Views

    Northern Gannet, Great Blue Heron, California Brown Pelican

    0 Views

    Sony and UMG are suing Suno again

    0 Views
    Stay In Touch
    • Facebook
    • YouTube
    • TikTok
    • WhatsApp
    • Twitter
    • Instagram
    Latest Reviews
    AI Tutorials

    Quantization from the ground up

    AI Tools

    David Sacks is done as AI czar — here’s what he’s doing instead

    AI Reviews

    Judge sides with Anthropic to temporarily block the Pentagon’s ban

    Subscribe to Updates

    Get the latest tech news from FooBar about tech, design and biz.

    Most Popular

    10 Things I’m Learning Beyond AI to Become More Technologically Fluent

    0 Views

    Northern Gannet, Great Blue Heron, California Brown Pelican

    0 Views

    Sony and UMG are suing Suno again

    0 Views
    Our Picks

    Quantization from the ground up

    David Sacks is done as AI czar — here’s what he’s doing instead

    Judge sides with Anthropic to temporarily block the Pentagon’s ban

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    Facebook X (Twitter) Instagram Pinterest
    • About Us
    • Contact Us
    • Terms & Conditions
    • Privacy Policy
    • Disclaimer

    © 2026 ainewstoday.co. All rights reserved. Designed by DD.

    Type above and press Enter to search. Press Esc to cancel.