# Predictive Coding

URL: https://mechanisticmindset.com/wiki/predictive-coding
Tags: cross-disciplinary, computational-lens

# Predictive Coding

#cross-disciplinary #computational-lens

## What It Is

Someone can know that a reward was deliberately paired with going to the gym and still learn to anticipate that reward. Their conscious explanation of the arrangement and their learned response to it operate through different parts of the brain.

Predictive coding describes the computation behind that learning. The brain predicts sensory input, compares the prediction with what arrives, and uses the mismatch to update its model. The cortex's physical wiring necessarily performs this algorithm through its 6-layer structure and hierarchical connections in both directions. The architecture is identical across brain regions.

Higher areas send predictions downward before the sensory data arrives. Around ~50ms later, the arriving input is compared with that prediction. A match suppresses error neurons; a mismatch makes them fire strongly and prompts an update. The cycle operates automatically, billions of times per second across cortical regions.

Conscious perception is the prediction that best explains the sensory evidence across those layers. Error correction refines the brain's model until it minimizes the mismatch. What you experience is that best-fitting prediction rather than unprocessed sensory input.

## The Physical Architecture

The cortex is ~2-3mm thick. Its 6 layers are physical structures stacked horizontally and visible under a microscope, rather than abstract categories assigned to functions.

| Layer | Depth | Function | Cell Type | Connectivity |
|-------|-------|----------|-----------|--------------|
| **Layer 1** | 0-0.3mm | Axons/dendrites, integration | Few cell bodies | Long-range connections |
| **Layers 2/3** | 0.3-0.7mm | Representation/perception | Pyramidal neurons | Local + inter-area |
| **Layer 4** | 0.7-1.0mm | Sensory input reception | Granular cells | Receives thalamic input |
| **Layer 5** | 1.0-1.5mm | Motor output, predictions down | Large pyramidal | Projects to subcortex |
| **Layer 6** | 1.5-2.3mm | Feedback to thalamus | Pyramidal neurons | Projects to thalamus |

Predictions and incoming sensory signals travel through the layers in different directions:

```
Top-down (predictions):
  Layers 5/6 → Lower cortical areas → Layer 1 → Layers 2/3

Bottom-up (sensory + errors):
  Sensory organs → Thalamus → Layer 4 → Layers 2/3

Error computation:
  Layer 4: Compare top-down prediction with bottom-up input
  Mismatch → Error neurons fire → Signal propagates up
```

Genetic programs specify this architecture during development. The same 6-layer "canonical microcircuit" processes vision, sound, touch, motor control, and abstract thought, applying the same hardware to different data.

## The Critical Timing

A prediction has to arrive before the input it predicts. The 50ms gap establishes an expected pattern against which the later signal can be compared:

```
t = 0ms:    Top-down prediction arrives in layer 2/3
            Sets expected pattern

t = 50ms:   Bottom-up sensory input arrives in layer 4
            Actual data about reality

t = 51ms:   Comparison circuits compute mismatch
            If match → suppress error neurons
            If mismatch → fire error neurons strongly

t = 55ms:   Error signal propagates upward
            Higher areas update their predictions
```

Simultaneous streams would provide parallel information without that predictive relationship. The temporal offset makes one signal a prediction about the other and creates the causal structure.

Touching a hot stove at t=0 and receiving a pain signal at t=50ms allows a temporal association to form. Opening DoorDash at t=0 and seeing a redirect at t=50ms provides another pairing through which a new association can be learned. The interval supplies the "X CAUSES Y" relationship in the neural wiring.

## Conscious Knowledge vs Subcortical Circuits

Conscious reasoning occurs in high-level cortex, while learned associations reside in layer 4, lower layers, and subcortical structures. The prefrontal cortex can therefore hold an intellectual account that differs from the learned patterns in the striatum or amygdala.

| What Conscious Mind Knows | What Subcortical Circuits Know | Which Controls Behavior? |
|--------------------------|-------------------------------|------------------------|
| "This is just a redirect screen" | DoorDash icon → dopamine spike (1000+ reps) | Circuits (initially) |
| "The reward is artificial" | Gym completion → jello → dopamine (if paired) | Circuits (after 30 reps) |
| "I shouldn't want this" | Cocaine → massive dopamine (hardwired) | Circuits (always) |

Recognizing a redirect screen does not remove the association created by 1000+ encounters with the DoorDash icon. Knowing that jello is an artificial gym reward does not prevent the pairing from forming after 30 repetitions.

Conscious reasoning can change the circumstances in which those circuits operate. It can select an environment that avoids the stimulus or arrange a new sequence of cues and rewards. It can also override the response momentarily through substantial prefrontal effort, but that effort is expensive and cannot be sustained.

[Prevention architecture](/wiki/prevention-architecture) uses the first option. Altering the environment prevents exposure to the stimulus, allowing an old circuit to weaken through disuse while alternative pairings strengthen a new one.

## Circuit Formation Through Temporal Pairing

Synaptic strengthening depends on repeated exposure within a timing window. Understanding an association intellectually does not perform those repetitions:

```
Synapse_strength ∝ ∑(Stimulus_i × Reward_i × δ(t_delay < 5min)) over 30+ repetitions

Where:
  δ = 1 if delay < 5 minutes, 0 otherwise
  30+ reps = physical strengthening threshold
```

The requirements concern the actual sequence and response:

| Requirement | Specification | Why It Matters |
|------------|---------------|----------------|
| **Temporal proximity** | Reward within ~5 minutes of behavior | Beyond 5 min, temporal association weakens |
| **Consistency** | Every instance paired | Intermittent pairing forms weak unreliable circuit |
| **Genuine reward** | Actual dopamine release (striatum decides) | Intellectual "should be rewarding" doesn't work |
| **Repetition threshold** | 30+ pairings | Physical synapse strengthening takes time |

A gym-and-jello pairing during Days 1-30 supplies the repeated temporal association:

```
Gym completion (t=0) → Jello reward (t=2min) → Dopamine spike (t=3min)
Repeat daily × 30 → Physical synaptic strengthening
Result: Gym completion neurons → Reward prediction neurons (wired)
```

During Days 31-70, visible progress can begin supplying a natural reward:

```
Gym completion → Visual progress (mirror) → Dopamine spike
Old circuit: gym → jello → dopamine (still present)
New circuit: gym → visual → dopamine (forming)
Result: Can phase out artificial reward
```

The original jello association remains while the visual-progress association forms, allowing the artificial reward to be phased out. Conscious awareness that "I'm engineering my reward circuit" does not change the operation in layer 4 or the striatum. Those structures update through the temporal statistics of the encounters.

## Why You Can't Think Your Way Out

Thinking and learned associations occur in physically different structures, with different ways of updating:

| System | Location | Update Mechanism | Conscious Access | Speed |
|--------|----------|------------------|------------------|-------|
| **Conscious reasoning** | Prefrontal cortex, layers 2/3 | Language, logic, abstraction | Full (this IS consciousness) | Slow (~seconds) |
| **Learned associations** | Layer 4, striatum, amygdala | Temporal pairing, prediction error | None (below consciousness) | Fast (~50ms) |
| **Motor control** | Motor cortex, basal ganglia | Repetition, reward | Partial (can initiate, not control details) | Very fast (~10ms) |

Knowing that phone checking is undesirable changes the prefrontal account. The striatum can still retain the phone-to-dopamine association and select the action, because it is faster and controls action selection. The conflict reflects that separation rather than a failure to articulate the right conclusion.

Awareness does not protect anyone from conditioning through controlled stimulus-reward timing. Rewiring is possible, but it requires actual repeated exposure to the new temporal pairing. An AI can explain the mechanism; it cannot form the synapses on someone's behalf. Repeating the new sequence is the process that changes the wiring.

## Known vs Unknown Unknowns

A model can represent a domain without knowing much about it. That provides a place for uncertainty: prediction errors have high variance, confidence intervals are wide, and questions such as "What is X?" or "How does Y work?" can be formed. This known unknown produces an active uncertainty signal.

An unknown unknown has no representation in the model at all. There is no parameter slot in which to express uncertainty and no domain from which to generate a question. The absence produces no error signal, making it as close to absence as the brain gets.

| Type | Model State | Can Ask Questions? | Error Signals? | Discovery Method |
|------|-------------|-------------------|----------------|------------------|
| **Known known** | Trained circuits, low error | Yes (refinement) | Low (confirmed predictions) | Direct use |
| **Known unknown** | Representation exists, high error | Yes (directed learning) | High (active uncertainty) | Active learning |
| **Unknown unknown** | No representation | No (don't know domain exists) | None (invisible) | External perturbation required |

Search queries come from the model already available. A person cannot deliberately search for a domain whose existence they do not know. Mentors, communities, and customers provide external models that can expose those missing domains.

Isolation therefore narrows the space of hypotheses the person can form. [Customer development](/wiki/startup-as-a-bug) supplies encounters with gaps that introspection cannot reveal, because the customer's observation introduces something the founder had no representation for.

## Related Concepts

- [Neural Positivism](/wiki/neural-positivism) describes the brain's use of positive signals.
- [Computation as Core Language](/wiki/computation-as-core-language) places predictive coding among the brain's computational operations.
- [30x30 Pattern](/wiki/30x30-pattern) describes the repetition threshold for forming a circuit.
- [Prevention Architecture](/wiki/prevention-architecture) replaces signals through environmental design.
- [Nature Alignment](/wiki/nature-alignment) addresses the limits of consciously overriding circuits.
- [Information Theory](/wiki/information-theory) describes prediction error as an information signal.
- [Startup as a Bug](/wiki/startup-as-a-bug) explains why discovering unknown unknowns requires external contact.

## Key Principle

An explanation of a learned association and the experiences that change the association do different work. Deliberately arranging a cue and reward changes what can be learned from the next encounter; repeating that encounter within the required timing window supplies the process that an intellectual explanation alone cannot perform.
