Monday, September 14, 2026

Modeling Cognitive Dissonance via Clamped Perceptual Plasticity in Active Inference Frameworks

For a list of all posts go here.

Abstract

Cognitive dissonance—the psychological distress arising from a persistent conflict between internal mental models and external reality—remains a foundational concept in social psychology and computational psychiatry. This paper presents a neurocomputational formulation of cognitive dissonance grounded in Active Inference and Variational Free Energy (VFE) minimization. 

We model a dual-channel agent navigating a dynamic spatial environment under two experimental paradigms: 

  • (1) Flexible Adaptation, where sensory prediction errors drive both perceptual inference (synaptic weight updates) and active inference (motor action); and 

  • (2) Clamped Plasticity / Cognitive Dissonance, where perceptual learning is paralyzed, forcing the agent to resolve sensory prediction errors solely through motor behavior. 

Our empirical logs reveal that clamping generative weight plasticity prevents structural alignment, causing steady-state VFE to remain elevated —more than 56 times higher than the baseline convergence level. This chronic prediction error triggers an allostatic cascade, transitioning the agent from a baseline affective state, into states of sustained distress. 


These findings establish a formal mathematical bridge between clamped synaptic adaptation, unresolved VFE, and psychological rigidity.


1. Introduction

Festinger’s classical theory of cognitive dissonance asserts that human agents experience affective discomfort when confronted with sensory evidence or environmental feedback that contradicts held beliefs or generative assumptions. To resolve this tension, an agent must either adapt its internal beliefs to match reality or act upon the world to align environment feedback with expectations.

In computational neuroscience, Active Inference—derived from the Free Energy Principle (FEP)—formalizes brain function as a continuous minimization of Variational Free Energy. Minimization occurs through two distinct, complementary pathways:

  • Perceptual Inference (Mind Updating): Adjusting internal generative parameters/weights to better predict sensory observations.

  • Active Inference (World Updating): Executing motor actions to alter sensory inputs such that they conform to internal predictions.

When an agent encounters a structural mismatch between its internal model and physical environment, both pathways typically operate concurrently to restore sensory predictions. However, when psychological dogma, ideological rigidity, or neurological trauma clamps synaptic plasticity, the perceptual adaptation route is blocked.

This paper investigates the computational consequences of such clamped plasticity. We demonstrate that blocking perceptual inference under structural mismatch directly generates the mathematical and affective hallmarks of cognitive dissonance: persistent prediction error spikes, erratic motor compensation, and a systematic cascade through negative allostatic affective states.


2. Mathematical Framework & Generative Architecture

2.1 Dual-Channel Generative Model

The agent operates in a two-dimensional continuous spatial domain, tracking a preferred target position 


 
and avoiding an environmental threat.


The subjective internal belief state:


maps to predicted physical space via a generative synaptic weight vector:


by the following:



The total Variational Free Energy of the Neural Network is decomposed into target and threat sub-losses parameterized by target and threat precisions:


For a visible target within visibility range rvis, the sensory prediction error and corresponding sub-loss are given by:



2.2 Synaptic Plasticity & Perceptual Learning

Under standard operating conditions, generative weights adapt via gradient descent on the Variational Free Energy of the Neural Network:







2.3 Active Inference & Motor Action

Motor commands a modulate the physical agent state to directly reduce prediction error:




2.4 Allostatic Accumulation Engine

To capture physiological stress caused by unmitigated prediction error, we implement an Allostatic Accumulation Engine. The engine tracks the target and threat related VFEs, alongside their derivatives. 



3. Experimental Setup & Methodology

We evaluate two primary conditions across approximately 950 simulation frames:

1- Baseline Condition (Flexible Adaptation), shown in Figure 1:

  • Synaptic learning rate larger than zero.

  • Initial generative weights initialized with structural error.

  • Perceptual weights update freely to minimize VFE.


    Figure 1


2- Cognitive Dissonance Condition (Clamped Plasticity), shown in Figure 2:

  • Learning rate clamped to zero.

  • Generative weights fixed at distorted baseline.

  • Perceptual updating blocked entirely due to zero learning rate.


    Figure 2


4. Empirical Results

4.1 Synaptic Convergence & VFE Minimization

In the Flexible Adaptation baseline, sensory prediction errors drives synaptic weight convergence. Over 969 iterations, weights update from initial values toward optimal alignment. As a result of this dual perceptual-active minimization, steady-state Neural Network VFE drops to nearly zero.

In contrast, under Cognitive Dissonance, weights remain frozen at initial values. Because the generative model cannot correct its spatial projection bias, active motor commands continuously overshoot or undershoot real-world spatial coordinates. Consequently, steady-state Neural Network VFE remains chronically trapped at an average of 56.5 times higher than baseline:





4.2 Affective State Distribution & Allostatic Cascades

The chronic presence of unresolvable VFE under clamped plasticity alters the agent's emotional trajectory.

  • Baseline Scenario: The agent maintains baseline affective equilibrium.

  • Cognitive Dissonance Scenario: As chronic prediction errors persist without resolution, VFE metrics continually accumulate, producing a clear affective cascade from baseline equilibrium towards affective states denoting distress.

Cumulatively, the clamped agent spends 37.82% of its operational lifespan in negative allostatic affective states, whereas the baseline agent spends 0.00% in these states.


5. Discussion & Neurocomputational Implications

5.1 Psychological Mechanism of Cognitive Dissonance

Our simulation demonstrates that cognitive dissonance can be formalized as an intractable Active Inference trap. When an agent's internal model makes incorrect predictions about the world, it experiences Variational Free Energy. Under normal conditions, the agent reduces this energy by either updating its beliefs or acting upon the environment.

When learning rates are clamped, perceptual inference is disabled. The agent cannot update its beliefs. It is forced to rely entirely on active inference (motor behavior) to resolve the error. However, because its motor actions are driven by a initially flawed internal model, its movements consistently fail to eliminate the prediction error.

This creates a self-reinforcing loop:





5.2 Clinical & Psychiatric Extensions

This formulation provides a clear framework for modeling several psychological phenomena:

  • Dogmatism & Ideological Rigidity: Individuals who refuse to adjust core beliefs when presented with contradicting facts experience elevated chronic distress and often respond with heightened behavioral aggression (represented by the transition into anger states).

  • Trauma & Rigid Schema: In conditions like PTSD, cognitive schema remain locked, preventing sensory updates and leaving the individual in a state of hyper-arousal and chronic distress.

  • Anhedonia & Learned Helplessness: Extended exposure to unresolvable VFE eventually depletes active motor responses, causing the agent to cease exploratory behavior altogether.


6. Conclusion

By integrating Active Inference with an Allostatic Accumulation Engine, we have demonstrated that clamping perceptual learning rates under structural prediction errors reproduces the core dynamics of cognitive dissonance. Without synaptic weight adaptation, agents are unable to resolve Variational Free Energy, driving steady-state error levels up by 56.5 times and triggering a systematic emotional cascade into stress, frustration, and anger. This computational architecture offers a quantitative framework for studying psychological rigidity, affective disorders, and decision-making under unresolvable conflict.



References

Festinger, L. (1957). A Theory of Cognitive Dissonance. Stanford University Press.

Friston, K. (2010). The free-energy principle: a unified brain theory?. Nature Reviews Neuroscience, 11(2), 127-138.

Parr, T., Pezzulo, G., & Friston, K. J. (2022). Active Inference: The Free Energy Principle in Mind, Brain, and Behavior. MIT Press.

Badcock, P. B., Friston, K. J., & Ramstead, M. J. (2019). The hierarchically mechanics of the brain: An active inference hypothesis for evolutionary systems biology. Physics of Life Reviews, 31, 219-258.

Friday, August 7, 2026

Breaking the Coordinates: Why Biological AI Infers Velocity, Not Location

For a list of all posts go here.

Abstract / Introduction

In standard agentic AI development, artificial agents are treated like omniscient machines: they read their exact X, Y, Z Cartesian coordinates from a front-end engine, compute a path vector, and move. However, when building biologically inspired AI using Active Inference—the framework where agents act to minimize Variational Free Energy (VFE)—this absolute coordinate paradigm breaks down catastrophically.

In this post, we explore a crucial architectural pivot discovered during the development of an allostatic, emotion-driven agent chasing an evasive target. We demonstrate how shifting an agent’s neural network from inferring absolute coordinates to predicting relative updates (velocity-based integration) resolves critical training instabilities, uncouples learning from environmental scale, and unlocks realistic emotional dynamics.


The Simulation: Chasing the Evasive Target

Our setup involves a dual-channel Active Inference Neural Network. The agent must balance two competing drives: maximizing target proximity (foraging/motivation) while remaining clear of a hazardous threat zone (survival).

To test the resilience of the agent's generative model, we introduce a "Rabbit Run" phase. At a specific tick, the target ceases to be stationary and actively flees, continuously shifting positions to remain just out of the agent’s reach.

In previous versions of the algorithm, this sudden environmental shift has caused a profound algorithmic crisis depending entirely on the physical size of the map boundary.


The Absolute Coordinate Pitfall

In early iterations of our network, the state prediction for the internal belief was represented multiplicatively against absolute coordinate space:




When the arena boundaries were tightly constrained, the agent successfully tracked the fleeing target. However, when the environment expanded to accommodate the fleeing target, the agent suffered catastrophic destabilization. The tracking dots vanished from the viewport, the trail became erratic, and Variational Free Energy exploded.


Why Does It Explode?

In an absolute coordinate framework, synaptic weights act as a massive amplifier for distance belief.

  • When an agent is near the origin, a micro-adjustment to a weight has a negligible effect.

  • When the agent chases a target out to larger distances, that same minor weight adjustment is multiplied. The error gradients fluctuate wildly, throwing the motor output into an unrecoverable feedback loop.


The Biological Solution: Relative Interative Movement

Biological nervous systems do not possess internal GPS trackers mapping absolute grid lines across the planet. The motor cortex does not issue coordinates; it issues commands for torque, velocity, and spatial shifts.


Inspired by this biological truth, we restructured the state estimation of our Active Inference engine. Instead of predicting absolute map location, the network was modified to predict the transition shift relative to its current baseline, scaling the incoming velocity command by the synaptic weights:






Accordingly, the synaptic weight updates were decoupled from absolute values and tied strictly to the velocity vectors driving the change:





The Mathematical Result

By switching to relative updates, the magnitude of the coordinate system ceases to matter. Whether the agent is calculating a trajectory step at (1.0, 1.0) or navigating deep into an open-world map at (1500.0, 1500.0), the matrix operations remain perfectly bounded. The learning dynamics become scale-invariant.


Cascading Benefits: Unlocking Emotional Intelligence

The most profound side-effect of moving to a relative-movement architecture was the stabilization of the agent's Allostatic Accumulation Engine—the subsystem responsible for tracking emotional states like Stress, Frustration, and Anger.

The engine tracks chronic free-energy distress by looking at the moving average of error velocity:





When the absolute coordinate bug was present, wild fluctuations in raw map values created false micro-jitters in the error velocity metric, tricking the system into thinking it was making meaningful learning progress.


Once the relative integration fix was deployed, the noise vanished. As seen in our latest empirical logs, the agent successfully registered the psychological weight of the unyielding chase. It escalated smoothly from Surprised (handling novelty) to Stressed (high VFE accumulation), to Frustrated (unresolved error over 150 frames), and finally full allostatic entrenchment: Angry (at 300+ frames).


Conclusion & Takeaways for Developers

When designing the next generation of agentic AI, moving past simple pathfinding toward cognitive architectures requires respecting biological constraints.


  1. Never let learned weights multiply absolute coordinates. It couples the brain of your agent directly to the dimensions of your 3D asset maps.

  2. Predict the delta, not the destination. Inferring relative velocity makes an agent's internal logic robust against sprawling open worlds.

  3. True emotion requires clean tracking. Complex cognitive traits like frustration cannot emerge if your emotional metrics are constantly drowned out by numerical coordinate noise.


By grounding your generative models in relative mechanics, you create agents that don't just navigate worlds smoothly—they react to them with genuine behavioral depth.


Monday, July 13, 2026

Dissociating Perception and Reality: A Predictive Coding Framework for State Estimation, Synaptic Plasticity, and Emotional Valence Under Non-Optimal Generative Weights

For a list of all posts go here.

Abstract

Active Inference models biological agents as self-organizing systems that maintain structural integrity by minimizing Variational Free Energy (VFE). This paper explores the epistemological and mechanical boundaries between physical ground-truth reality and an agent’s internal subjective reconstruction. We implement an online Predictive Coding Neural Network (PCNN) navigating an environment containing dynamic target attractors and localized threat obstacles. Critically, we examine the behavioral and affective distortions—termed here "cognitive illusions"—that arise when an agent's top-down generative weights are miscalibrated or non-optimal.

Furthermore, we formalize an emotional mapping layer where affective valence is modeled as the second-order rate of change of VFE. Our empirical results, derived from continuous time-series simulation logs across 2,480 iterations, reveal that mismatched weights induce stable spatial tracking offsets that prematurely paralyze the agent. When online synaptic plasticity is re-engaged via gradient descent on the Neural Network VFE, the agent dynamically re-calibrates its generative model. This structural learning process reduces subjective free energy by over 99.5%, collapses the perceptual divergence, triggers predictable transitions in emotional states from anxiety to homeostatic motivation, and restores objective goal tracking.


1. Introduction

A foundational premise of theoretical biology and computational neuroscience is that living organisms must resist the natural tendency toward thermodynamic decay and informational entropy. Active Inference, formalized via the Free Energy Principle (FEP), posits that agents achieve this existential imperative by executing actions that minimize an upper bound on sensory surprise, known as Variational Free Energy (VFE). Under this paradigm, the brain does not passively register environmental impressions; instead, it operates as a hierarchical prediction engine, constantly projecting top-down hypotheses about the hidden causes of its sensory streams.

However, a deep conceptual vulnerability emerges when an agent's internal map of the world—its generative model—diverges structurally from the actual laws governing the environment—the generative process. If the internal synaptic pathways that translate beliefs into expected sensations are miscalibrated, the agent’s perceptual apparatus will distort reality.

While existing literature frequently evaluates Active Inference under idealized, perfectly matched models, this paper systematically investigates the mechanics of model miscalibration. We decouple physical ground-truth coordinates from internal network beliefs to study three interconnected phenomena:

  1. The temporal alignment between physical trajectories and inferred beliefs under an asymmetric sensory integration architecture.

  2. The genesis of stable spatial "cognitive illusions" driven by non-optimal generative weights.

  3. The mathematical and empirical divergence between the true analytical free energy of the environment and the subjective free energy computed by the agent’s neural architecture.

  4. The formal computational modeling of affective valence and emotional states as a reflection of the second-order rate of change of free energy over time.

By analyzing the comprehensive data profiles of an active inference agent across 2,480 iterations of simulated environmental interaction, we chart the exact journey of an uncalibrated mind discovering, suffering from, and ultimately resolving its own structural illusions through synaptic learning.


2. Mathematical Foundations & Generative Architecture

To mathematically parse the boundary between objective nature and subjective mind, we establish a rigid dual-space architecture.

2.1 The Generative Process (Physical Reality)

Let (1) define the absolute, omniscient ground-truth coordinates of the physical agent in a bounded two-dimensional arena. The agent moves through space based on an applied physical velocity vector v actual (2). 

The environment contains a static target attractor and a localized threat obstacle. The agent possesses no direct, unmediated access to its ground-truth coordinates. It must observe itself through a noisy sensory channel (3), where (4) represents high-frequency environmental and sensory measurement noise.




2.2 The Generative Model (Subjective Neural Network)

The agent possesses an internal network parameterized by internal state beliefs (5) and top-down generative weights (6). The network's sensory prediction is defined as (7)

When the agent can perceive environmental features (governed by visibility thresholds), it computes sensory prediction errors. The total spatial prediction error (11) is divided into target-directed attraction (9) and threat-directed repulsion (10) components, weighted by their respective sensory precisions (8).




The system’s Variational Free Energy is mathematically represented as the squared sum of these precision-weighted prediction errors (12).

Action in Active Inference proceeds via the changing of states to fulfill predictions. The motor velocity command executed by the physical body is driven directly by the reflex-like minimization of this error gradient (13).




3. Core Structural Analyses

3.1 Ground Truth Trajectory vs. Inferred Belief State

A critical development in our model involves how the agent integrates time. The agent updates its subjective position belief by adding its internal inferred velocity command (14).



Our refined architecture enforces strict asymmetric sensory integration. The internal states (5) are determined strictly by filtering incoming observations. As demonstrated in the empirical logs, the inferred belief trail binds tightly to the ground-truth trajectory. The belief state hovers directly over the physical agent, experiencing only a high-frequency jitter bounded directly by the sensory noise variance (4).


Figure 1: Perceptual Trajectory Tracking Map

  • Caption: Figure 1: Spatial trajectory mapping within the agent´s arena. The solid blue line tracks the physical agent's ground-truth path, while the dotted trail tracks the internal self-belief state.

3.2 Cognitive Illusions Induced by Non-Optimal Weights

When the generative weights are frozen away from unity, the network experiences a profound cognitive distortion. We simulated this state by initializing weights at (15)

Under these non-optimal weights, the agent develops a structural blind spot. As it approaches the target, its internal network calculates that it has arrived at the correct position, because the distorted top-down prediction perfectly cancels out the incoming sensory observations (16). Subjectively, the agent believes its free energy is minimized, causing its motor commands to ramp down to zero. Objectively, however, the agent is paralyzed several units away from the target star, frozen in space by an uncorrected perceptual bias.





3.3 Analytical VFE vs. Neural Network VFE Profiles

To map this discrepancy, we track two distinct energy metrics:

  1. Analytical VFE: The absolute error function calculated using omniscient ground-truth coordinates.

  2. Neural Network VFE: The internal error calculated strictly through the agent's distorted generative model (17).






When weights are static and non-optimal, Neural Network VFE drops to zero as the agent experiences its illusion of arrival, while Analytical VFE remains high. This divergence proves that an agent can optimize its internal universe perfectly while remaining completely uncalibrated with the physical world.

To bridge this gap, we re-engage synaptic plasticity by allowing the prediction error to flow back into the weights via online gradient descent (18), (19) e (20):




Under this configuration, the lingering prediction error actively rewires the network's parameters (as seen in Figure 1´s right graphic) as the agent sits for a moment in its illusion zone, before converging to the target´s true position.

3.4 Mathematical Formalization of Affective Valence (Emotional States)

Following the mathematical models of Smith, Friston, and Kirsch (2019), we formalize the agent's emotional state as the second-order rate of change of free energy over time. Let (21) define the emotional valence metric:




We map three explicit computational thresholds based on the dynamics of (21) and the presence of contextual precision indicators:

  1. Epistemic Exploration / Curiosity: Occurs when VFE is flat or gently fluctuating near zero under low contextual precision. The agent experiences low error gradients and engages in unconstrained search.

  2. Threat Repulsion / Anxiety: Characterized by highly unpredictable, positive acceleration spikes in VFE paired with high-precision threat inputs. The agent registers a rapid expansion of surprise, manifesting behaviorally as avoidant repulsion.

  3. Target Attractor Lock / Motivation: Initiated when VFE begins dropping significantly faster than a baseline expectation. The rapid minimization of prediction error yields positive emotional valence, driving sustained, focused motor action until satiation homeostasis (VFE approaches 0, (21) approaches 0) is achieved.


4. Empirical Results & Data-Driven Discussion

The model was evaluated over a continuous run of 2,480 iterations. Telemetry logs captured the exact behavioral and emotional state transitions of the agent, divided across three distinct phases.

4.1 Phase 1: Epistemic Foraging (66.73% of Lifetime)

For the first 1,655 steps, the agent was placed outside the visibility horizon of both the target and the threat. Operating under zero environmental information, the system engaged in epistemic exploration. The physical coordinates moved via a bounded random walk, search-foraging through the environment. The logs recorded this baseline state as "Epistemic Exploration. I am curious.". Because spatial prediction errors were absent outside visibility zones, the weights remained unchanged at their initial values.

4.2 Phase 2: Threat Repulsion and Anxiety (18.27% of Lifetime)

During its random walk, the agent repeatedly breached the perimeter of the threat zone. Entering this sector triggered an immediate spike in precision-weighted threat prediction errors, causing the free energy to rise sharply.

The system logged this state as "Threat Repulsion. I am anxious.". This computational anxiety generated a powerful repulsive motor command vector that successfully drove the agent out of harm's way, illustrating how affective valences function as rapid protective mechanisms in cybernetic systems.

4.3 Phase 3: Attractor Lock and Plasticity Convergence (15.00% of Lifetime)

At iteration 2,108, the agent crossed the visibility threshold of the target. It moved forward but halted prematurely due to its weight-induced illusion. At step 2,108, the weights stood heavily biased, causing an internal network loss of 1.9858 .

As the agent stagnated, online synaptic plasticity began resolving the mismatch. The prediction errors actively re-tuned the synaptic paths over the remaining 372 steps of the simulation.

Simulation Step

Weight X 

Weight Y 

Neural Net VFE

Physical X 

Physical Y 

Affective Mood State

2,108 (Target Encounter)

1.2615

0.8135

1.9858

1.5933

6.2920

Target Lock. I feel motivated.

2,115 (Learning Intercept)

1.2793

0.8430

0.6771

2.1104

6.8410

Target Lock. I feel motivated.

2,470 (Near Convergence)

1.0001

1.0008

0.0174

8.0095

7.9972

Target Lock. I feel motivated.

2,479 (Satiation Homeostasis)

1.0006

1.0008

0.0102

8.0053

8.0012

Target Lock. I feel motivated.



As shown in the data table, the gradient descent update pulled both weights back to near-unity. As the internal structural map aligned with reality, the internal network loss plummeted by 99.48%, dropping from 1.9858 to a baseline of 0.0102 .

Because the free energy was dropping consistently faster than the baseline expectations, the system sustained its high-motivation valence ("Target Attractor Lock. I feel motivated."). With its perceptual illusion dissolved, the agent resumed its trajectory, executing accurate motor commands that brought its physical body to rest directly on the true target coordinates, achieving full homeostatic stability and emotional satiation.



Figure 2: Synaptic Weight and Free Energy Convergence Profile

  • Caption: Figure 2: Multi-panel time-series analysis of the phase-three learning intercept. The top panel illustrates the dynamic adaptation of generative weights as they converge toward unity (1.0) upon encountering the target at iteration 2,108. The bottom panel displays the matching exponential decay of Variational Free Energy, which drops by over 99.5% as the structural illusion dissolves, maintaining a positive affective motivation state.


5. Conclusion

This paper demonstrates that Active Inference loops are highly vulnerable to systematic spatial offsets and behavioral stagnation when their top-down generative components are miscalibrated. An agent can optimize its internal neural network parameters to experience a subjective illusion of target arrival, while remaining objectively stranded short of its physical destination.

By separating the system into a dual-space architecture—objective physical truth versus subjective inferred belief—we successfully tracked this divergence. Furthermore, by framing emotional states as the second-order rate of change of free energy, we show how cognitive illusions and threats project distinct affective signatures onto the agent's internal state.

Crucially, our results show that introducing online synaptic plasticity driven by prediction errors allows the agent to break its own perceptual illusions. Over time, the network updates its generative weights, aligns its subjective free energy with absolute environmental free energy, and guides the physical chassis to its true target destination.





Modeling Cognitive Dissonance via Clamped Perceptual Plasticity in Active Inference Frameworks

For a list of all posts go here . Abstract Cognitive dissonance—the psychological distress arising from a persistent conflict between intern...