Hierarchical Prediction-Error Loop¶
Layered predict-and-correct process — instantiates Predictive Residual Processing
Stacks predictors in layers where each sends its neighbour a prediction and returns only the error it can't explain, so routine structure is cancelled at the lowest level that accounts for it and only genuine surprise climbs.
A Hierarchical Prediction-Error Loop arranges predictors into a stack of layers and makes every layer do two jobs at once: it sends a prediction down or outward to the layer nearer the raw signal, and it forwards up or inward only the part of that signal its prediction failed to account for. The defining move — the thing no flat single-model scheme does — is that a residual is explained away at the lowest layer that can predict it, so it never reaches a higher layer at all. Each layer's leftover error becomes the next layer's input, and only surprise that survives every level below arrives at the top. This is the architecture behind predictive coding in the cortex: sensory areas pass upward not what they saw but what they didn't expect.[1]
Example¶
A retail chain runs three forecasting layers: store models predict each store's daily sales, regional models predict each region, and a corporate model predicts national demand. Rather than stream every store's full sales feed up the chain each night, each store forwards only where actuals diverge from what its own model already predicted; each region reconciles those store-level surprises and forwards only where the regional aggregate diverges from the regional model; corporate sees just the national residual. An ordinary Tuesday dip that every layer already predicts travels nowhere. But when a flash promotion lifts Southwest sales ≈30% above what the store models expected, that surprise is not explained away locally — it climbs to the region, and because the regional model didn't expect it either, onward to corporate as a live signal worth acting on. The twist: if corporate itself launched that promotion and its model already priced the lift in, the surprise is explained away at the top and the loop stays quiet — exactly as it should.
How it works¶
The loop's logic is what separates it from a single predictor with a residual:
- Two-way traffic on every link. Predictions flow toward the signal; unexplained error flows back toward the top. The message on the wire is the residual, never the raw signal.
- Explaining-away. Before a layer forwards anything, it subtracts what its own prediction covers. Structure that a layer can generate is absorbed there and stops.
- Each layer's error is the next layer's input. The stack composes: high layers never see raw data, only the concentrated surprise that lower layers couldn't handle.
- Only unresolved, precision-weighted error rises. How strongly a layer trusts its own prediction versus the incoming residual sets what survives — the weighting itself is supplied by a Precision-Weighted Error Gate.
Tuning parameters¶
- Depth (number of layers) — more layers absorb more structure locally and quiet the top further, but add latency and more places for a bad prediction to hide a real signal.
- Per-layer scope and horizon — how much of space and time each layer is responsible for predicting; wide scopes compress more but blur where a surprise originated.
- Top-down gain — how forcefully higher-layer predictions suppress lower layers. Turn it up and the system is confident and cheap; turn it too far and strong priors erase real evidence.
- Explaining-away threshold — how close an actual must sit to a prediction before it counts as "explained." Loose thresholds save bandwidth but swallow small anomalies.
When it helps, and when it misleads¶
Its strength shows when the signal genuinely has nested, compositional structure: the loop concentrates scarce attention at the top on true novelty and lets each level pay only for what it alone can explain. It is the natural spine for any system where surprise, not volume, is what deserves escalation.
Its signature failure is the mirror of its strength: an over-confident prediction at a low layer can explain away a real signal and suppress it before it ever climbs — the predictive-coding pathology where strong priors quietly manufacture a calm picture the world doesn't support.[1] A quiet top can mean "nothing happened" or "the bottom stopped telling us," and the loop alone can't distinguish them. The classic misuse is tuning top-down gain until the summit is reassuringly silent and then reading that silence as safety. The discipline is to periodically audit what is being explained away — via raw-signal sampling — rather than trusting that an empty channel means an uneventful world.
How it implements the components¶
This mechanism supplies the archetype's architecture — the layered plumbing through which residuals travel:
hierarchical_prediction_stack— the explicit multi-layer arrangement of predictors is this mechanism's spine; it is the stack.prediction_error_signal— each layer emits the residual its prediction cannot account for; that error is the loop's only currency.residual_propagation_channel— the paired links that carry predictions one way and unexplained error the other, level to level.model_scope_and_horizon— each layer owns a breadth and time-horizon of responsibility, which fixes what it must predict and therefore what it can absorb.
It does not implement the single-estimator update math — prediction_comparator, confidence_and_uncertainty_state, generative_model_state belong to the Innovation Residual Filter — nor the rule that ranks which errors are worth forwarding, which is the Precision-Weighted Error Gate.
Related¶
- Instantiates: Predictive Residual Processing — the loop is the archetype's layered backbone, deciding where surprise is absorbed and where it must rise.
- Consumes: Precision-Weighted Error Gate supplies the weighting that decides which residuals survive to climb.
- Sibling mechanisms: Innovation Residual Filter · Precision-Weighted Error Gate · Predictive Codec · Efference-Copy Cancellation · Bayesian Model Update · Anomaly Detection Model
Notes¶
The loop's power to explain away is exactly why the archetype never lets it stand alone: a layered predictor that silences expected input is also a layered predictor that can silence a real event it mistakenly expected. Pairing it with a raw-signal audit (Shadow Raw-Channel Sampling) is not optional polish but the structural counterweight to its one dangerous move.
References¶
[1] In predictive coding (Rao & Ballard, 1999; later the free-energy principle), cortical hierarchies propagate prediction errors upward rather than raw input, and higher levels send predictions down that "explain away" lower activity. The same account explains its failure mode: when priors are weighted too strongly relative to sensory evidence, the hierarchy can suppress or even fabricate signal — the mechanistic story often invoked for hallucination. ↩