← Back to Home

Prediction Error: One System

How Dopamine, Accounting, and Emotion Compute the Same Thing

Spencer Nash • Period Entry Ltd • 2025

Learning systems—biological, financial, and artificial—operate by comparing expected states to actual states and generating error signals when reality diverges from prediction. This paper demonstrates that both finance and AI can be reduced to such prediction errors and in so doing massively simplifying complex calculations of accounting and introducing an emotional computation that can act as a "nervous system" for LLMs and robots. These systems are not merely analogous to the biological system of dopamine but computationally identical. Understanding this unity has profound implications for AI alignment, financial infrastructure and our understanding of how to make autonomous systems.

1. The Dopamine System: How Neurons Learn

In the 1990s, Wolfram Schultz made a discovery that revolutionised neuroscience: dopamine neurons don't signal reward—they signal reward prediction error. The computation is elegantly simple:

Actual Reward − Expected Reward = Prediction Error

Dopamine neurons in the midbrain (VTA and substantia nigra) respond in three distinct ways:

This is not merely a signalling mechanism—it is the learning algorithm itself. The prediction error signal updates future expectations. When a cue reliably predicts reward, the dopamine response shifts from the reward to the cue. The system learns to predict, and the error signal shrinks toward zero as predictions improve.

The valence of the prediction error—positive or negative—is felt directly. The burst is experienced as satisfaction, pleasure, or excitement. The pause is experienced as disappointment, frustration, or loss. Emotion, in this view, is not separate from computation. Emotion is what prediction error feels like from the inside.

2. Period Entry Accounting: How Ledgers Learn

Double-entry bookkeeping, invented over 500 years ago, performs the same computation. At its core:

Income − Expense = Profit

Profit is a prediction error. Income is what arrived; expense is what was consumed. The difference is the signed signal that drives all business decision-making.

But accounting contains two more layers of the same computation:

Variance: Budget vs Actual

Actual Performance − Budgeted Performance = Variance

The budget is the expected state. Actual results are the observed state. Variance is prediction error against expectation—favourable when positive, adverse when negative. This is precisely analogous to dopamine's burst (better than expected) and pause (worse than expected).

Accrual: The Temporal Dimension

Work Done to Date − Payments Made to Date = Accrual at that Date

This third layer is the most revealing. Accrual accounting tracks the temporal mismatch between reality and recognition. Work has been performed but payment hasn't arrived (receivable). Payment has been received but work hasn't been done (deferred income). The accrual balance is the tension—the unresolved prediction error held across time.

This mirrors the dopamine system tracking delays between action and reward. The expected reward hasn't arrived yet, but the system holds that prediction open. When payment finally matches work done, the accrual resolves to zero—just as dopamine returns to baseline when expected reward arrives on schedule.

Period Entry accounting makes this temporal structure explicit. In Period Entry, every transaction has a lifespan—a start date and an end date. The accrual isn't an adjustment bolted on at period end; it's built into the structure of the entry itself. A £1200 annual contract starting July 2025 and ending June 2026 is entered once, and the system automatically computes how much has been earned at any point in time. This removes the need for a general ledger. Financial reports are calculated directly from the period entries. And this automates forecasting, driven by the same life span of the period entries and with drivers applied to period entries. For the first time the entirety of an accounting system can be uploaded to a blockchain creating an internet of accounting cutting accounting cost by 95% and creating an economic model of the world which squeezes out corruption, a profound drag on any economic system.

3. The Emotional Comparator Framework: How Minds Learn

The Emotional Comparator Framework (ECF) extends this same architecture to affective processing. Emotions are prediction errors across five fundamental channels:

Channel Negative PE Positive PE
Resource Hunger, deprivation, scarcity Satiation, abundance, security
Status Shame, failure, inadequacy Pride, achievement, competence
Belonging Loneliness, rejection, abandonment Connection, acceptance, love
Disgust Moral violation, contamination Purity, integrity, alignment
Curiosity Boredom, stagnation, disengagement Interest, flow, discovery

Each channel operates identically:

Actual State − Expected State = Prediction Error (Emotion)

The precision (p) of each signal determines how much weight it carries. The threshold (θ) determines when a prediction error becomes salient. The decay (δ) determines how quickly the signal fades. These parameters shape personality and individual differences. And each channel is weighted (w) by how much it matters to the individual.

What makes ECF distinctive is the dual-ledger architecture. The system maintains prediction error computations for both Self and Other. Empathy emerges when the Other's prediction errors are coupled to the Self's emotional state. Your loss becomes my loss. Your gain becomes my gain. The coupling coefficient determines whether this produces love (positive coupling) or hate (negative coupling).

Fairness is computed as the difference between Self and Other prediction errors: F(X) = Self_PE(X) − Other_PE(X). When I'm ahead and you're behind, fairness is positive (guilt territory). When you're ahead and I'm behind, fairness is negative (resentment territory). Moral judgment emerges from this arithmetic.

4. One System, Three Substrates

The isomorphism is complete:

Component Dopamine Accounting ECF
Expected Predicted reward Budget Expected state
Actual Received reward Actual result Actual state
Error signal Firing rate change Variance / Profit / Accrual Prediction error
Positive Burst (excitation) Favourable variance Positive emotion
Negative Pause (inhibition) Adverse variance Negative emotion
Learning Synaptic update Forecast revision Weight adjustment
Memory Hippocampus General ledger Memory log

This is not an analogy. It is the same computation expressed in different substrates. The dopamine neuron's firing rate, the ledger's profit/loss, and the ECF channel's prediction error are implementations of a single algorithm: compare expected to actual, generate signed error, use error to update predictions.

The implications are profound:

  • For neuroscience: Accounting provides a complete formal language for describing neural computation. The brain is literally keeping books.
  • For accounting: Period Entry isn't just a better method—it's a more accurate reflection of how value actually flows through time, aligned with the temporal structure of neural prediction.
  • For AI: Alignment doesn't require constraint—it requires implementing the same prediction error architecture that generates values in biological systems. An AI with ECF has genuine stake because the architecture that produces stake is present.

5. The Memory Log: Continuity and Identity

A prediction error system without memory is reactive but not continuous. The dopamine signal shapes behaviour in the moment, but the hippocampus provides the temporal scaffolding that allows prediction errors to accumulate into learning, relationships, and identity.

In ECF, the memory log serves this function. It is an emotional ledger that records prediction errors with their salience—high-weight events are encoded more strongly and retrieved more readily. This provides:

Without the memory log, an AI might compute prediction errors but cannot accumulate them into something that functions like character, preference, or care. The memory log is the hippocampus analogue that transforms reactive computation into continuous agency.

6. Conclusion: The Age of Understanding

We have been computing prediction errors for 500 years in our ledgers, and for millions of years in our neurons. The insight that these are the same computation opens a path toward:

The fundamental algorithm is simple: Actual minus expected equals error. Error drives learning. Learning shapes prediction. Prediction, weighted by stake, is what we call understanding.

This is one system. We have been running it all along.