Skip to content
ResearchAISpecification

Precision-Weighted Predictive Coding with Adaptive Re-entrant Inference in Neural Networks

Krrish Choudhary·March 31, 2026

Capabilities

  • 01 / 06
    Linearquadratic

    Content-Dependent Precision Estimation Module

    Per-token σ2=softplus(Wσ⋅RMSNorm(h)+bσ)+ϵ\sigma^2 = \text{softplus}(W_\sigma \cdot \text{RMSNorm}(h) + b_\sigma) + \epsilon computed in each processing unit.

  • 02 / 06

    Re-entrant Predictive Coding Inference Loop

    After a bottom-up pass, iterates top-down prediction and error correction with convergence test (Kmin⁡=2K_{\min} = 2, Kmax⁡=5K_{\max} = 5, τ=0.01\tau = 0.01).

  • 03 / 06

    Analytical Precision Learning

    Closed-form gradient dL/dz=(−∥ϵ∥2/(2σ4)+1/(2σ2))⋅sigmoid(z)dL/dz = \left(-\|\epsilon\|^2/(2\sigma^4) + 1/(2\sigma^2)\right) \cdot \text{sigmoid}(z), clamped to [0.01,0.99][0.01, 0.99], giving ΔWσ=(1/N) GTH\Delta W_\sigma = (1/N)\, G^{T} H without autodiff.

  • 04 / 06

    Conflict-Driven Adaptive Depth

    Conflict CC = variance of unit mean outputs; if above τC\tau_C, Kextra=min⁡(Kextramax⁡, ⌊(C−τC)/τC⋅Kextramax⁡⌋)K_{\text{extra}} = \min(K_{\text{extra}}^{\max},\, \lfloor (C - \tau_C)/\tau_C \cdot K_{\text{extra}}^{\max} \rfloor).

  • 05 / 06

    Precision-Weighted Prediction Error Loss

    L=∥ϵ∥2/(2σ2)+0.5ln⁡(σ2)L = \|\epsilon\|^2/(2\sigma^2) + 0.5 \ln(\sigma^2), the Gaussian negative log-likelihood; optimal σ2\sigma^2 equals mean squared error.

  • 06 / 06

    Non-Zero WσW_\sigma Initialisation

    WσW_\sigma sampled from N(0,0.012)\mathcal{N}(0, 0.01^2) so precision varies with content from the first forward pass.

Abstract

This document describes a system and method for precision-weighted predictive coding in hierarchical neural networks, wherein each processing unit in a multi-level hierarchy generates both a prediction of its input and a content-dependent precision estimate (σ2\sigma^2) quantifying the certainty of said prediction. The precision estimate is computed by a learned linear transformation (Wσ\mathbf{W}_{\sigma}) applied to the normalised hidden state, passed through a positivity-preserving softplus activation, yielding a per-token, per-level scalar that varies with input content. The system implements depth-scaled initialisation of precision parameters following cortical maturation gradients, wherein shallow processing units begin with lower initial uncertainty than deep processing units. A multi-scale precision band architecture partitions the processing hierarchy into token-level, phrase-level, sentence-level, and discourse-level bands, each feeding distinct downstream subsystems. The system further comprises a re-entrant predictive coding inference loop that iteratively refines representations through top-down prediction and bottom-up error correction under a gradient-free regime, with conflict-driven adaptive depth control that allocates additional inference iterations when inter-unit disagreement exceeds a threshold. All precision parameters are learned via analytical derivative computation without automatic differentiation, using closed-form expressions for the gradient of a precision-weighted prediction error loss through the softplus nonlinearity.

Status

Open research. This document was first drafted in the form of a patent specification, which is why it speaks of an invention and of claims. No patent application was filed and the lab does not intend to file one: where the text mentions a related or co-pending patent application, it means a companion document in this set, and none of them was filed. The work is published here as open research.

1. Field

The present invention relates generally to the field of artificial neural networks and machine learning systems. More particularly, the invention relates to systems and methods for uncertainty estimation and predictive coding in hierarchical neural network architectures, including methods for computing content-dependent precision weights, depth-scaled initialisation thereof, multi-scale precision band organisation, iterative re-entrant inference with adaptive computational depth, and analytical learning rules for precision parameters without automatic differentiation.

2. Background

Prior Art in Neural Network Uncertainty

Contemporary deep neural networks, including transformer-based language models as described by Vaswani et al. (2017), produce point estimates without any measure of certainty or uncertainty associated with their predictions. When a transformer model produces a next-token probability distribution, there is no mechanism by which the model internally represents how confident it is in that distribution, nor can different layers of the model communicate their respective levels of certainty to one another.

This absence of uncertainty estimation creates several fundamental limitations:

  1. Uniform treatment of predictions. All predictions from all layers are treated with equal weight regardless of whether the model is processing familiar or novel content. A layer processing a common grammatical pattern and a layer processing a rare technical term contribute identically to downstream computation.

  2. Fixed computational depth. Standard neural networks apply the same number of processing steps to every input regardless of difficulty. An unambiguous sentence and a deeply ambiguous sentence receive identical computational resources.

  3. No per-token precision. Existing approaches that attempt uncertainty estimation, such as Monte Carlo dropout (Gal & Ghahramani, 2016) or deep ensembles (Lakshminarayanan et al., 2017), compute uncertainty as a post-hoc aggregate over the entire model output rather than as an intrinsic per-token, per-layer signal available during forward computation.

  4. No depth-dependent initialisation. In all known neural network architectures, uncertainty parameters (when present) are initialised uniformly across all layers. There is no mechanism by which shallow layers, which process lower-level features, begin with different uncertainty characteristics than deep layers, which process higher-level abstractions.

Prior Art in Predictive Coding

Rao and Ballard (1999) introduced predictive coding as a computational theory of visual cortex processing, wherein each cortical area generates predictions of the activity in the area below and computes prediction errors. Friston (2005) generalised this into the free energy principle, proposing that the brain minimises a variational free energy bound.

However, existing computational implementations of predictive coding for artificial neural networks suffer from several deficiencies:

  1. Constant precision. Prior implementations of predictive coding in neural networks use a fixed, scalar precision term that does not vary with input content. The precision is either a global hyperparameter or a per-layer constant that is the same for every token in a sequence.

  2. No multi-scale organisation. Prior predictive coding implementations treat all levels of the hierarchy identically with respect to temporal scale. There is no mechanism by which different bands of the hierarchy specialise for different temporal receptive fields (token-level versus discourse-level).

  3. Fixed inference depth. Prior predictive coding implementations run a fixed number of inference iterations regardless of the difficulty or ambiguity of the input, wasting computation on easy inputs and under-allocating on difficult inputs.

  4. Reliance on automatic differentiation. Prior implementations of learned precision parameters require backpropagation through the computational graph, which conflicts with the local learning principle of predictive coding and incurs substantial memory overhead from storing activations for the backward pass.

Need for the Present Invention

There exists a need for a neural network architecture that:

  1. computes content-dependent precision estimates that vary with input;

  2. initialises precision parameters with a depth-dependent gradient reflecting the principle that shallow processing units should start less uncertain than deep ones;

  3. organises precision into multi-scale bands aligned with different temporal receptive fields;

  4. employs iterative re-entrant inference whose depth adapts to input difficulty;

  5. learns all precision parameters via analytical derivatives without automatic differentiation.

The present invention addresses all of the foregoing limitations.

3. Summary

The present invention provides a system and method for precision-weighted predictive coding with adaptive re-entrant inference in hierarchical neural networks. The invention comprises six interrelated innovations that collectively enable content-dependent uncertainty estimation, biologically-informed initialisation, multi-scale precision organisation, adaptive inference depth, and autograd-free precision learning.

Content-Dependent Precision Estimation

A first aspect of the invention provides a precision estimation module within each processing unit of a hierarchical neural network. Unlike prior art systems that employ a fixed or constant precision value, the present invention computes a content-dependent precision estimate σ2\sigma^2 for each token at each hierarchical level by applying a learned linear transformation Wσ\mathbf{W}_{\sigma} to the normalised hidden state:

z=Wσ⋅RMSNorm⁡(h)+bσz = {\mathbf{W}_{\sigma}}\cdot \operatorname{RMSNorm}(h) + b_\sigma
σ2=softplus⁡(z)+ϵ{\sigma^2}= \operatorname{softplus}(z) + \epsilon

where hh is the hidden state of the processing unit, RMSNorm⁡\operatorname{RMSNorm} is root-mean-square layer normalisation, bσb_\sigma is a bias term, softplus⁡(x)=ln⁡(1+ex)\operatorname{softplus}(x) = \ln(1 + e^x) is a positivity-preserving activation function, and ϵ\epsilon is a small constant (e.g., 10−610^{-6}) preventing numerical degeneracy. The weight matrix Wσ{\mathbf{W}_{\sigma}} is initialised with small non-zero random values (standard deviation ≈0.01\approx 0.01), ensuring that σ2\sigma^2 is content-dependent from the first forward pass. A zero-initialised Wσ\mathbf{W}_{\sigma} would render σ2\sigma^2 equal to softplus⁡(bσ)\operatorname{softplus}(b_\sigma) for all inputs, a constant precision, analogous to the neurological condition of anosognosia wherein a patient cannot distinguish between states of certainty and uncertainty.

Depth-Scaled Precision Initialisation

A second aspect of the invention provides a depth-dependent initialisation scheme for the precision bias term bσb_\sigma. For a hierarchy of NN processing units indexed i=0,1,…,N−1i = 0, 1, \ldots, N-1, the initial precision value for unit ii is:

σ2init,i=σ2init×(1+αdepth×imax⁡(N−1,1)){\sigma^2}_{\text{init},i} = {\sigma^2}_{\text{init}} \times \left(1 + \alpha_{\text{depth}} \times \frac{i}{\max(N-1, 1)}\right)

where σ2init{\sigma^2}_{\text{init}} is a base initial precision (e.g., 1.0) and αdepth\alpha_{\text{depth}} is a depth scaling factor (e.g., 1.0). The bias bσb_\sigma is then set to softplus⁡−1(σ2init,i)=ln⁡(eσ2init,i−1)\operatorname{softplus}^{-1}({\sigma^2}_{\text{init},i}) = \ln(e^{{\sigma^2}_{\text{init},i}} - 1). This produces a monotonically increasing initial uncertainty from shallow to deep units, reflecting the empirically observed cortical maturation gradient (Huttenlocher, 1990): primary sensory areas mature earlier and operate with lower initial uncertainty, while associative areas mature later and begin with greater uncertainty.

Multi-Scale Precision Bands

A third aspect of the invention organises the NN processing units into four precision bands, each specialising for a different temporal receptive field:

  • Token band (units 00 to q−1q-1): σ2token{\sigma^2}_{\text{token}}, precision over individual tokens.

  • Phrase band (units qq to 2q−12q-1): σ2phrase{\sigma^2}_{\text{phrase}}, precision over local phrases.

  • Sentence band (units 2q2q to 3q−13q-1): σ2sentence{\sigma^2}_{\text{sentence}}, precision over sentence-level context.

  • Discourse band (units 3q3q to N−1N-1): σ2discourse{\sigma^2}_{\text{discourse}}, precision over discourse-level coherence.

where q=max⁡(1,⌊N/4⌋)q = \max(1, \lfloor N/4 \rfloor). Each band’s aggregate precision feeds a distinct downstream subsystem: the token band informs local prediction, the sentence band modulates episodic memory encoding, and the discourse band guides global workspace broadcasting. This multi-scale organisation mirrors the hierarchy of temporal receptive fields observed in the human cortex (Hasson et al., 2008).

Re-entrant Predictive Coding Inference

A fourth aspect of the invention provides an iterative re-entrant inference loop that refines representations through top-down prediction and bottom-up error correction. After an initial bottom-up pass through the hierarchy, the system performs KK additional inference iterations (where KK ranges from a configurable minimum to a configurable maximum), each comprising:

  1. top-down prediction generation from each unit to the unit below;

  2. bottom-up error computation: ϵl=targetl−predictionl\epsilon_l = \text{target}_l - \text{prediction}_l;

  3. re-computation of lateral and global workspace signals;

  4. convergence testing: ∣ΔE∣/(Eprev+ϵ)<τconv|\Delta E| / (E_{\text{prev}} + \epsilon) < \tau_{\text{conv}}.

All inference iterations execute under a gradient-free regime (no computational graph is constructed), consistent with the biological principle that inference (perception) and learning (synaptic modification) are separate processes.

Conflict-Driven Adaptive Depth

A fifth aspect of the invention provides an adaptive depth mechanism that allocates additional inference iterations based on inter-unit conflict. A metacognitive monitoring module computes the variance across the output representations of all processing units:

C=Vari∈{0,…,N−1}[hˉi]C = \text{Var}_{i \in \{0,\ldots,N-1\}}\left[\bar{h}_i\right]

where hˉi\bar{h}_i is the mean output of unit ii across the batch and sequence dimensions. When CC exceeds a conflict threshold τC\tau_C, additional inference steps are allocated:

Kextra=min⁡(Kmax⁡,extra,  ⌊C−τCτC×Kmax⁡,extra⌋)K_{\text{extra}} = \min\left(K_{\max,\text{extra}},\; \left\lfloor \frac{C - \tau_C}{\tau_C} \times K_{\max,\text{extra}} \right\rfloor\right)

This implements a form of metacognitive resource allocation: the system “thinks harder” when its processing units disagree, analogous to the function of the anterior cingulate cortex in conflict monitoring (Botvinick et al., 2001). Removal of this mechanism yields a system that applies uniform computation to all inputs regardless of difficulty, analogous to the neurological condition of anosognosia.

Analytical Precision Learning

A sixth aspect of the invention provides a method for updating the precision parameters Wσ\mathbf{W}_{\sigma} and bσb_\sigma using analytically derived gradients, without invoking automatic differentiation. The precision-weighted prediction error loss for a single level is:

Ll=∥ϵl∥22⋅σ2l+12ln⁡(σ2l)\mathcal{L}_l = \frac{\|\epsilon_l\|^2}{2 \cdot {\sigma^2}_l} + \frac{1}{2} \ln({\sigma^2}_l)

The derivative with respect to σ2\sigma^2 is:

∂L∂σ2=−∥ϵ∥22⋅(σ2)2+12⋅σ2\frac{\partial \mathcal{L}}{\partial {\sigma^2}} = \frac{-\|\epsilon\|^2}{2 \cdot ({\sigma^2})^2} + \frac{1}{2 \cdot {\sigma^2}}

The chain rule through the softplus activation yields the derivative with respect to the pre-activation zz:

∂L∂z=∂L∂σ2×sigmoid⁡(z)\frac{\partial \mathcal{L}}{\partial z} = \frac{\partial \mathcal{L}}{\partial {\sigma^2}} \times \operatorname{sigmoid}(z)

where sigmoid⁡(z)=1/(1+e−z)\operatorname{sigmoid}(z) = 1/(1+e^{-z}) is the derivative of softplus. The weight update is then:

ΔWσ=1N∑n=1N∂Ln∂zn⋅RMSNorm⁡(hn)⊤\Delta {\mathbf{W}_{\sigma}}= \frac{1}{N} \sum_{n=1}^{N} \frac{\partial \mathcal{L}_n}{\partial z_n} \cdot \operatorname{RMSNorm}(h_n)^\top
Δbσ=1N∑n=1N∂Ln∂zn\Delta b_\sigma = \frac{1}{N} \sum_{n=1}^{N} \frac{\partial \mathcal{L}_n}{\partial z_n}

All computations are performed under a no-gradient regime, eliminating the memory overhead of storing activations for backpropagation and reducing the computational cost of the learning step.

4. Detailed Description

The following detailed description, taken in conjunction with the accompanying drawings, describes preferred embodiments of the present invention. It is to be understood that the invention is not limited to these specific embodiments but extends to all alternatives, modifications, and equivalents as defined by the appended claims.

System Overview

Referring to Figure 1, the system of the present invention comprises a hierarchical neural network (100) having a plurality of processing units (110-1, 110-2, …, 110-N) arranged in a feedforward hierarchy. Each processing unit receives input from the unit below and produces output for the unit above. In a preferred embodiment, the processing units are cortical column modules as described in a co-pending patent application by the same applicant. However, the precision-weighted predictive coding system described herein is applicable to any hierarchical neural network architecture, including transformer layers, recurrent modules, or convolutional stages.

The system further comprises:

  • a precision estimation module (120) within each processing unit;

  • a prediction generation module (130) within each processing unit;

  • a re-entrant inference controller (140) that orchestrates iterative refinement;

  • a conflict detection module (150) that monitors inter-unit agreement;

  • an analytical precision learning module (160) that updates precision parameters.

Precision Estimation Module

Referring to Figure 2, the precision estimation module (120) resides within each processing unit (110-ii) and computes a per-token precision estimate σ2i(t){\sigma^2}_i(t) for each position tt in the input sequence.

Architecture

The precision estimation module comprises:

  1. A normalisation layer (121), specifically a root-mean-square normalisation (RMSNorm) operation, that normalises the hidden state hi∈RB×T×Dcolh_i \in \mathbb{R}^{B \times T \times D_{\text{col}}} to produce h^i=RMSNorm⁡(hi)\hat{h}_i = \operatorname{RMSNorm}(h_i).

  2. A learned linear projection (122), denoted Wσ∈R1×Dcol{\mathbf{W}_{\sigma}}\in \mathbb{R}^{1 \times D_{\text{col}}} with bias bσ∈R1b_\sigma \in \mathbb{R}^{1}, that maps the normalised hidden state to a scalar pre-activation:

    zi(t)=Wσ⋅h^i(t)+bσz_i(t) = {\mathbf{W}_{\sigma}}\cdot \hat{h}_i(t) + b_\sigma
  3. A positivity-preserving activation (123), specifically the softplus function softplus⁡(z)=ln⁡(1+ez)\operatorname{softplus}(z) = \ln(1 + e^z), that ensures the output is strictly positive:

    σ2i(t)=softplus⁡(zi(t))+ϵ{\sigma^2}_i(t) = \operatorname{softplus}(z_i(t)) + \epsilon

    where ϵ=10−6\epsilon = 10^{-6} prevents numerical degeneracy.

Initialisation of the Weight Matrix

The weight matrix Wσ{\mathbf{W}_{\sigma}} is initialised by sampling from a zero-mean Gaussian distribution with standard deviation σinit=0.01\sigma_{\text{init}} = 0.01:

Wσ[j]∼N(0,σinit2),j=1,…,Dcol{\mathbf{W}_{\sigma}}[j] \sim \mathcal{N}(0, \sigma_{\text{init}}^2), \quad j = 1, \ldots, D_{\text{col}}

This non-zero initialisation is critical. If Wσ{\mathbf{W}_{\sigma}} were initialised to zero, the precision estimate would reduce to σ2=softplus⁡(bσ)+ϵ{\sigma^2}= \operatorname{softplus}(b_\sigma) + \epsilon for all inputs, rendering precision content-independent. The small but non-zero initialisation ensures that different hidden states produce different precision values from the first forward pass, enabling the system to distinguish between inputs it finds familiar (low σ2\sigma^2) and inputs it finds novel (high σ2\sigma^2).

Depth-Scaled Bias Initialisation

The bias term bσb_\sigma is initialised differently for each processing unit in the hierarchy. For unit ii in a hierarchy of NN units:

ri=imax⁡(N−1,1)r_i = \frac{i}{\max(N-1, 1)}
σ2init,i=σ2base×(1+αdepth×ri){\sigma^2}_{\text{init},i} = {\sigma^2}_{\text{base}} \times (1 + \alpha_{\text{depth}} \times r_i)
bσ,i={ln⁡(eσ2init,i−1)if σ2init,i>0.010.0otherwiseb_{\sigma,i} = \begin{cases} \ln(e^{{\sigma^2}_{\text{init},i}} - 1) & \text{if } {\sigma^2}_{\text{init},i} > 0.01 \\ 0.0 & \text{otherwise} \end{cases}

In a preferred embodiment, σ2base=1.0{\sigma^2}_{\text{base}} = 1.0 and αdepth=1.0\alpha_{\text{depth}} = 1.0, yielding:

  • Unit 0 (shallowest): σ2init,0=1.0{\sigma^2}_{\text{init},0} = 1.0, bσ,0≈0.541b_{\sigma,0} \approx 0.541

  • Unit N−1N-1 (deepest): σ2init,N−1=2.0{\sigma^2}_{\text{init},N-1} = 2.0, bσ,N−1≈1.313b_{\sigma,N-1} \approx 1.313

This depth-dependent initialisation reflects the principle that shallow processing units, which operate on lower-level features (analogous to primary sensory cortex), should begin with lower uncertainty, while deep processing units, which operate on higher-level abstractions (analogous to prefrontal cortex), should begin with higher uncertainty. This mirrors the empirically observed cortical maturation timeline described by Huttenlocher (1990), wherein primary sensory areas achieve adult-level synaptic density before associative areas.

Sigma-Squared Adaptive Dendritic Modulation

In a preferred embodiment, the precision estimate from a preceding processing unit is used to modulate the dendritic computation of the current processing unit. A linear projection Wσ-adapt∈RDff×1\mathbf{W}_{\sigma\text{-adapt}} \in \mathbb{R}^{D_{\text{ff}} \times 1} maps the preceding unit’s σ2\sigma^2 into the feedforward dimension, where it additively modulates the dendritic gate logit:

gdend=gdend+Wσ-adapt⋅σ2prevg_{\text{dend}} = g_{\text{dend}} + \mathbf{W}_{\sigma\text{-adapt}} \cdot {\sigma^2}_{\text{prev}}

This enables a processing unit to adjust its computation based on how certain the preceding unit is, high preceding uncertainty loosens the dendritic gate, allowing more information through; low preceding uncertainty tightens it.

Multi-Scale Precision Bands

Referring to Figure 3, the NN processing units of the hierarchy are organised into four precision bands, each corresponding to a different temporal receptive field:

q=max⁡(1,⌊N4⌋)q = \max\left(1, \left\lfloor \frac{N}{4} \right\rfloor\right)
BandUnitsTemporal Scale
Token00 to q−1q-1Individual token features
Phraseqq to 2q−12q-1Local phrase structure
Sentence2q2q to 3q−13q-1Sentence-level context
Discourse3q3q to N−1N-1Discourse-level coherence

The aggregate precision for each band is the mean σ2\sigma^2 across all units in that band:

σ2band=1∣band∣∑i∈bandσ2i{\sigma^2}_{\text{band}} = \frac{1}{|\text{band}|} \sum_{i \in \text{band}} {\sigma^2}_i

Each band’s aggregate precision feeds a distinct downstream subsystem:

  1. The token band precision modulates local next-token prediction confidence, influencing how strongly the model’s immediate prediction is weighted.

  2. The phrase band precision modulates lateral column communication, controlling the strength of horizontal information flow between processing units.

  3. The sentence band precision modulates episodic memory encoding thresholds, determining which representations are sufficiently surprising (high σ2\sigma^2) or sufficiently certain (low σ2\sigma^2) to be committed to episodic memory.

  4. The discourse band precision modulates global workspace broadcasting, controlling which processing units gain access to the shared global workspace based on their discourse-level certainty.

In a preferred embodiment with N=12N = 12 processing units, q=3q = 3, yielding bands of 3 units each.

Prediction Generation Module

Each processing unit (110-ii) contains a prediction generation module (130) comprising a learned linear projection:

x^i=Wpredict⋅h^i\hat{x}_i = {\mathbf{W}_{\text{predict}}}\cdot \hat{h}_i

where Wpredict∈RDmodel×Dcol{\mathbf{W}_{\text{predict}}}\in \mathbb{R}^{D_{\text{model}} \times D_{\text{col}}} maps the normalised hidden state to the inter-unit dimension. This prediction represents unit ii’s expectation of the input it will receive from unit i−1i-1 (or from the embedding layer for unit 0).

Wpredict{\mathbf{W}_{\text{predict}}} is initialised to zero, meaning that at initialisation no unit generates any prediction. This ensures that prediction errors are maximal at the start of training, driving rapid initial learning.

The prediction error at each level is:

ϵl=targetl−x^l\epsilon_l = \text{target}_l - \hat{x}_l

where targetl\text{target}_l is the actual output of unit l−1l-1 (detached from the computational graph) for l>0l > 0, or the embedding output for l=0l = 0.

Precision-Weighted Prediction Error Loss

The precision-weighted prediction error loss for a single level ll is:

Ll=12⋅σ2l∥ϵl∥2+12ln⁡(σ2l)\mathcal{L}_l = \frac{1}{2 \cdot {\sigma^2}_l} \|\epsilon_l\|^2 + \frac{1}{2} \ln({\sigma^2}_l)
(22)

This loss has a natural Bayesian interpretation as the negative log-likelihood of a Gaussian distribution with mean equal to the prediction and variance equal to σ2\sigma^2. The first term penalises large prediction errors, weighted inversely by precision. The second term penalises over-confidence (low σ2\sigma^2 when errors are large), preventing the trivial solution of setting σ2→∞{\sigma^2}\rightarrow \infty to minimise the first term.

The total predictive coding loss across all NN levels is:

LPC=∑l=0N−1Ll\mathcal{L}_{\text{PC}} = \sum_{l=0}^{N-1} \mathcal{L}_l

At equilibrium, the optimal σ2\sigma^2 for each level equals the mean squared prediction error at that level:

σ2l∗=E[∥ϵl∥2]{{\sigma^2}}_{l}^{*} = \mathbb{E}\left[\|\epsilon_l\|^2\right]

This means the precision naturally calibrates itself: levels with large errors develop high σ2\sigma^2 (low precision, low influence), while levels with small errors develop low σ2\sigma^2 (high precision, high influence).

Re-entrant Predictive Coding Inference Loop

Referring to Figure 4, the re-entrant inference controller (140) orchestrates an iterative refinement process after the initial bottom-up forward pass.

Initial Bottom-Up Pass

The initial bottom-up pass propagates input through all NN processing units sequentially:

h0=f0(x),hi=fi(hi−1),i=1,…,N−1h_0 = f_0(x), \quad h_i = f_i(h_{i-1}), \quad i = 1, \ldots, N-1

where fif_i denotes the forward function of unit ii. During this pass, each unit produces:

  • an output hih_i for the next unit;

  • a prediction x^i\hat{x}_i of its input from the unit below;

  • a precision estimate σ2i{\sigma^2}_i of its prediction certainty.

Prediction Error Computation

After the bottom-up pass, prediction errors are computed for all levels:

ϵl=targetl−x^l,l=0,1,…,N−1\epsilon_l = \text{target}_l - \hat{x}_l, \quad l = 0, 1, \ldots, N-1

Re-entrant Iterations

The system then performs up to Kmax⁡−1K_{\max} - 1 additional inference iterations (one pass having already been completed). Each iteration proceeds as follows:

  1. Top-down context assembly. For each unit ii, a top-down context signal is assembled from:

    • the global workspace modulation signal;

    • the lateral inter-unit communication signal;

    • the prediction from unit i+1i+1 (for i<N−1i < N-1).

  2. Forward pass with top-down context. Each unit re-processes its input with both the bottom-up input (routed through a thalamic relay module) and the assembled top-down context:

    hi(k)=fi(thal(hi−1(k)),  td_ctxi(k−1))h_i^{(k)} = f_i\left(\text{thal}(h_{i-1}^{(k)}), \; \text{td\_ctx}_i^{(k-1)}\right)
  3. Error recomputation. Prediction errors are recomputed with the updated representations.

  4. Lateral and workspace recomputation. Lateral inter-unit signals and global workspace broadcast signals are recomputed from the updated outputs and errors.

  5. Convergence test. The total squared error is compared to the previous iteration:

    E(k)=∑l=0N−1∥ϵl(k)∥2E^{(k)} = \sum_{l=0}^{N-1} \|\epsilon_l^{(k)}\|^2
    δ(k)=∣E(k)−E(k−1)∣E(k−1)+ϵ\delta^{(k)} = \frac{|E^{(k)} - E^{(k-1)}|}{E^{(k-1)} + \epsilon}

    If k≥Kmin⁡k \geq K_{\min} and δ(k)<τconv\delta^{(k)} < \tau_{\text{conv}}, the iteration terminates.

In a preferred embodiment, Kmin⁡=2K_{\min} = 2, Kmax⁡=5K_{\max} = 5, and τconv=0.01\tau_{\text{conv}} = 0.01.

Gradient-Free Inference

A critical aspect of the re-entrant inference loop is that all iterations after the initial bottom-up pass execute under a gradient-free regime (e.g., torch.no_grad() in PyTorch). No computational graph is constructed during inference iterations. This has two important consequences:

  1. Memory efficiency. No intermediate activations are stored for backpropagation, reducing memory consumption by approximately the factor of inference iterations.

  2. Biological plausibility. Inference (representation settling) and learning (synaptic modification) are separated, consistent with the biological principle that neural computation and synaptic plasticity operate on different timescales.

Conflict-Driven Adaptive Depth

Referring to Figure 5, the conflict detection module (150) implements a metacognitive monitoring function that adjusts the number of inference iterations based on the degree of inter-unit disagreement.

Conflict Computation

The conflict score CC is computed as the variance of the mean output representations across all processing units:

hˉi=1B⋅T∑b=1B∑t=1Thi(b,t),i=0,…,N−1\bar{h}_i = \frac{1}{B \cdot T} \sum_{b=1}^{B} \sum_{t=1}^{T} h_i(b, t), \quad i = 0, \ldots, N-1
C=1D∑d=1DVari[hˉi[d]]C = \frac{1}{D} \sum_{d=1}^{D} \text{Var}_{i}\left[\bar{h}_i[d]\right]

where BB is the batch size, TT is the sequence length, DD is the representation dimension, and Vari\text{Var}_i denotes variance across the NN processing units.

Adaptive Step Allocation

The number of extra inference steps is computed as:

Kextra={0if C<τC or C is non-finitemin⁡(Kmax⁡,extra,⌊C−τCmax⁡(τC,10−6)×Kmax⁡,extra⌋)otherwiseK_{\text{extra}} = \begin{cases} 0 & \text{if } C < \tau_C \text{ or } C \text{ is non-finite} \\ \min\left(K_{\max,\text{extra}}, \left\lfloor \frac{C - \tau_C}{\max(\tau_C, 10^{-6})} \times K_{\max,\text{extra}} \right\rfloor\right) & \text{otherwise} \end{cases}

The total maximum inference steps becomes Kmax⁡+KextraK_{\max} + K_{\text{extra}}.

In a preferred embodiment, τC=0.5\tau_C = 0.5 and Kmax⁡,extra=2K_{\max,\text{extra}} = 2, meaning the system can allocate up to 2 additional inference iterations (for a total of 7) when processing highly ambiguous or conflicting inputs.

Health Monitoring

The conflict detection module further maintains exponential moving averages of per-unit σ2\sigma^2 and convergence rates:

σ2EMA,i(t)=(1−α)⋅σ2EMA,i(t−1)+α⋅σ2i(t)‾{{\sigma^2}}_{\text{EMA},i}^{(t)} = (1 - \alpha) \cdot {{\sigma^2}}_{\text{EMA},i}^{(t-1)} + \alpha \cdot \overline{{{\sigma^2}}_{i}^{(t)}}

where α=0.01\alpha = 0.01 is a slow averaging coefficient. The module monitors for:

  • Precision divergence: σ2EMA,i>τmax⁡{\sigma^2}_{\text{EMA},i} > \tau_{\max} (e.g., 100.0), indicating the unit’s uncertainty is growing without bound. Corrective action: scale down the unit’s output weights.

  • Precision collapse: σ2EMA,i<τmin⁡{\sigma^2}_{\text{EMA},i} < \tau_{\min} (e.g., 0.001), indicating the unit has become pathologically overconfident. Corrective action: increase the bias bσb_\sigma.

  • Persistent non-convergence: convergence rate exceeding 0.8, indicating the inference loop consistently hits the maximum step count.

Analytical Precision Learning

Referring to Figure 6, the analytical precision learning module (160) updates the precision parameters Wσ{\mathbf{W}_{\sigma}} and bσb_\sigma using closed-form gradient expressions, without invoking automatic differentiation.

Derivation of the Analytical Gradient

Starting from the precision-weighted loss (Equation 22):

L=∥ϵ∥22⋅σ2+12ln⁡(σ2)\mathcal{L} = \frac{\|\epsilon\|^2}{2 \cdot {\sigma^2}} + \frac{1}{2} \ln({\sigma^2})

Step 1: Derivative with respect to σ2\sigma^2.

∂L∂σ2=−∥ϵ∥22⋅(σ2)2+12⋅σ2\frac{\partial \mathcal{L}}{\partial {\sigma^2}} = \frac{-\|\epsilon\|^2}{2 \cdot ({\sigma^2})^2} + \frac{1}{2 \cdot {\sigma^2}}

Note that the error norm ∥ϵ∥2\|\epsilon\|^2 is computed as the mean squared error across the model dimension (i.e., 1D∑d=1Dϵd2\frac{1}{D} \sum_{d=1}^{D} \epsilon_d^2) to ensure the gradient magnitude is independent of the dimensionality DD.

Step 2: Chain rule through softplus.

Since σ2=softplus⁡(z)+ϵ{\sigma^2}= \operatorname{softplus}(z) + \epsilon and ddzsoftplus⁡(z)=sigmoid⁡(z)\frac{d}{dz}\operatorname{softplus}(z) = \operatorname{sigmoid}(z):

∂L∂z=∂L∂σ2×sigmoid⁡(z)\frac{\partial \mathcal{L}}{\partial z} = \frac{\partial \mathcal{L}}{\partial {\sigma^2}} \times \operatorname{sigmoid}(z)

The sigmoid value is clamped to [0.01,0.99][0.01, 0.99] to prevent numerical instability at extreme pre-activations.

Step 3: Outer product for weight gradient.

Since z=Wσ⋅h^+bσz = {\mathbf{W}_{\sigma}}\cdot \hat{h} + b_\sigma:

∂L∂Wσ=1N∑n=1N∂Ln∂zn⋅h^n⊤\frac{\partial \mathcal{L}}{\partial {\mathbf{W}_{\sigma}}} = \frac{1}{N} \sum_{n=1}^{N} \frac{\partial \mathcal{L}_n}{\partial z_n} \cdot \hat{h}_n^\top
∂L∂bσ=1N∑n=1N∂Ln∂zn\frac{\partial \mathcal{L}}{\partial b_\sigma} = \frac{1}{N} \sum_{n=1}^{N} \frac{\partial \mathcal{L}_n}{\partial z_n}

where N=B×TN = B \times T is the total number of tokens.

Computational Form

In matrix notation, let Z∈RN×1\mathbf{Z} \in \mathbb{R}^{N \times 1} denote the flattened pre-activations and H^∈RN×Dcol\hat{\mathbf{H}} \in \mathbb{R}^{N \times D_{\text{col}}} denote the flattened normalised hidden states. The updates are:

ΔWσ=1NG⊤H^\Delta{\mathbf{W}_{\sigma}}= \frac{1}{N} \mathbf{G}^\top \hat{\mathbf{H}}
Δbσ=1N∑n=1NGn\Delta b_\sigma = \frac{1}{N} \sum_{n=1}^{N} G_n

where G∈RN×1\mathbf{G} \in \mathbb{R}^{N \times 1} is the vector of per-token gradient scalars ∂Ln/∂zn\partial \mathcal{L}_n / \partial z_n.

The gradient norm ∥ΔWσ∥\|\Delta{\mathbf{W}_{\sigma}}\| is clipped to a maximum value (e.g., 1.0) to prevent destabilising updates. The weight update is then:

Wσ←Wσ−η⋅ΔWσ{\mathbf{W}_{\sigma}}\leftarrow {\mathbf{W}_{\sigma}}- \eta \cdot \Delta{\mathbf{W}_{\sigma}}
bσ←bσ−η⋅Δbσb_\sigma \leftarrow b_\sigma - \eta \cdot \Delta b_\sigma

where η\eta is the learning rate, optionally modulated by a neuromodulatory plasticity gate.

Advantages Over Automatic Differentiation

The analytical gradient computation offers the following advantages:

  1. No activation storage. Automatic differentiation requires storing all intermediate activations for the backward pass. The analytical method requires only the pre-activation zz (cached from the forward pass), the hidden state h^\hat{h} (already available), the prediction error ϵ\epsilon, and the current σ2\sigma^2 value.

  2. Reduced computational cost. The gradient computation requires two matrix multiplications (one for the weight gradient, one for the bias gradient) and element-wise operations on vectors of length NN, versus the full backward pass through the softplus, linear projection, and normalisation layers.

  3. Compatibility with no-gradient inference. Since the inference loop runs without gradient tracking, the precision parameters can be updated immediately after inference settles, without requiring a separate backward pass.

  4. Numerical stability. The analytical form allows explicit clamping of intermediate quantities (sigmoid clamping, precision floor) at precise points in the computation, providing finer control over numerical stability than automatic differentiation.

Prediction Weight Update

The prediction generation weights Wpredict{\mathbf{W}_{\text{predict}}} are updated via a similar analytical rule. The gradient of the precision-weighted loss with respect to Wpredict{\mathbf{W}_{\text{predict}}} is:

ΔWpredict=−1N(ϵσ2)⊤H^\Delta{\mathbf{W}_{\text{predict}}}= -\frac{1}{N} \left(\frac{\epsilon}{{\sigma^2}}\right)^\top \hat{\mathbf{H}}

where ϵ/σ2\epsilon / {\sigma^2} denotes element-wise division of the prediction error by the precision, broadcasting the scalar σ2\sigma^2 across the model dimension. This is a precision-weighted outer product: predictions from high-precision (low σ2\sigma^2) units receive larger gradient updates, accelerating learning where the unit is confident, and smaller updates where the unit is uncertain.

Integration with Hierarchical Neural Network

In a preferred embodiment, the precision-weighted predictive coding system is integrated into a hierarchical neural network as follows:

  1. Embedding. Input tokens are converted to continuous representations via an embedding module.

  2. Bottom-up pass. The embedded input propagates through all NN processing units. Each unit produces an output, a prediction, and a precision estimate. The precision from unit ii is passed to unit i+1i+1’s dendritic modulation.

  3. Prediction error computation. Top-down predictions are compared against bottom-up targets at each level.

  4. Conflict assessment. The metacognitive module computes inter-unit conflict and determines the number of additional inference steps.

  5. Re-entrant inference. The system iterates, refining representations through top-down predictions and bottom-up error correction, until convergence or the maximum step count.

  6. Output generation. The final representation from the top of the hierarchy is passed through a language model head to produce a probability distribution over the vocabulary.

  7. Precision learning. After the forward pass, the analytical precision learning module updates Wσ{\mathbf{W}_{\sigma}}, bσb_\sigma, and Wpredict{\mathbf{W}_{\text{predict}}} for each processing unit using the cached errors, precisions, and hidden states.

The precision estimates from different bands feed into downstream subsystems:

  • The sentence-band σ2\sigma^2 modulates the episodic memory encoding threshold, controlling which experiences are stored.

  • The discourse-band σ2\sigma^2 modulates global workspace access, controlling which units broadcast to the shared workspace.

  • The aggregate σ2\sigma^2 across all units feeds into the neuromodulatory brainstem module, where it influences dopamine, norepinephrine, serotonin, and acetylcholine production levels.

Embodiment Parameters

Table 1 lists the configurable parameters of a preferred embodiment.

Table 1. Preferred embodiment parameters.
ParameterValueDescription
σ2base{\sigma^2}_{\text{base}}1.0Base initial precision
αdepth\alpha_{\text{depth}}1.0Depth scaling factor
σinit\sigma_{\text{init}}0.01Weight init standard deviation
Kmin⁡K_{\min}2Minimum inference steps
Kmax⁡K_{\max}5Maximum inference steps (before adaptive)
τconv\tau_{\text{conv}}0.01Convergence threshold
τC\tau_C0.5Conflict threshold
Kmax⁡,extraK_{\max,\text{extra}}2Maximum additional adaptive steps
ηPC\eta_{\text{PC}}3×10−43 \times 10^{-4}PC learning rate
τmax⁡\tau_{\max}100.0Precision divergence threshold
τmin⁡\tau_{\min}0.001Precision collapse threshold
ϵ\epsilon10−610^{-6}Numerical stability constant

5. Description of the Figures

The accompanying drawings, which are incorporated herein and constitute a part of this specification, illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.

is a system block diagram showing the overall architecture of the precision-weighted predictive coding system (Claim 1), including the hierarchical arrangement of processing units with precision estimation modules, prediction generation modules, the re-entrant inference controller, the conflict detection module, and the analytical precision learning module.

is a diagram showing the multi-scale precision band organisation, with the NN processing units divided into four bands (token, phrase, sentence, discourse) and arrows showing how each band’s aggregate precision feeds a distinct downstream subsystem.

is a computational graph of the analytical precision learning module, showing the step-by-step derivation from the precision-weighted loss through the derivative with respect to σ2\sigma^2, the chain rule through softplus (yielding the sigmoid factor), and the outer product with the normalised hidden state to produce the weight gradient ΔWσ\Delta{\mathbf{W}_{\sigma}} and bias gradient Δbσ\Delta b_\sigma.

is a detailed system block diagram of the complete precision-weighted predictive coding system (Claim 1), showing (a) hierarchical processing units, (b) precision estimation pipeline, (c) prediction generation, (d) re-entrant inference controller, (e) conflict detection module, and (f) analytical precision learning module.

is a detailed block diagram of the depth-dependent bias initialisation (Claim 2), showing the initialisation formula and resulting bias values across the hierarchy.

is a diagram of the multi-scale precision band organisation (Claim 3), showing four bands (token, phrase, sentence, discourse) with downstream routing.

is a timeline diagram of the re-entrant inference iteration control (Claim 4), showing mandatory iterations, convergence testing, and extra conflict-allocated iterations.

is a diagram of the conflict score computation and adaptive step allocation (Claim 5), showing inter-unit variance computation and KextraK_{\text{extra}} determination.

is a computational graph of the analytical precision learning (Claim 6), showing the four-step closed-form gradient derivation.

is a diagram of the dendritic modulation mechanism (Claim 7), showing how σ2\sigma^2 from a preceding unit modulates the dendritic gate of the current unit.

is a diagram of the precision health monitoring system (Claim 8), showing EMA tracking, divergence detection, collapse detection, and persistent non-convergence monitoring.

is a complete method flowchart of the PWPC inference method (Claim 9), showing all steps from bottom-up pass through analytical gradient update.

is a bar chart of the depth-dependent bias initialisation (Claim 10), showing bσb_\sigma values across a hierarchy of N=12N=12 processing units.

is a diagram of precision band routing to downstream subsystems (Claim 11), showing sentence-band routing to episodic memory and discourse-band routing to global workspace.

is a state machine diagram of the re-entrant iteration control (Claim 12), showing the MANDATORY, TEST, EXTRA, and SETTLED states.

is a detailed four-step pipeline of the analytical gradient computation (Claim 13), showing mean squared error, derivative w.r.t. σ2\sigma^2, sigmoid clamping, and outer product averaging.

is a diagram of the precision-weighted prediction update (Claim 14), contrasting high-precision and low-precision units to illustrate how σ2\sigma^2 acts as a per-unit adaptive learning rate.

is a chain diagram of inter-unit precision propagation (Claim 15), showing how σ2\sigma^2 propagates through the hierarchy modulating dendritic gates.

is a block diagram of the complete PWPC computer-readable medium instruction set (Claim 16), showing all stored instructions from instantiation through band routing.

is a diagram of the four precision bands with mean aggregation (Claim 17), showing example σ2\sigma^2 values and aggregates for N=12N=12 units.

is a diagram of the EMA precision monitoring and corrective actions (Claim 18), showing divergence and collapse detection with time-series graphs.

is a side-by-side comparison diagram of the gradient-free inference regime (Claim 19), contrasting standard autodiff memory usage with the gradient-free approach.

is a diagram of the depth-dependent initialisation boundary values (Claim 20), showing the linear interpolation from σ2base{\sigma^2}_{\text{base}} at the shallowest unit to σ2base×(1+αdepth){\sigma^2}_{\text{base}} \times (1 + \alpha_{\text{depth}}) at the deepest unit.

Note: The drawings described above are schematic representations of the system architecture and data flow. Actual implementation may vary in specific arrangement and connectivity without departing from the scope of the invention.

6. Figures

FIG. 1, Precision-Weighted Predictive Coding Loop
Figure 1. Precision-Weighted Predictive Coding Loop
FIG. 2, Multi-Scale σ^2 Band Organisation
Figure 2. Multi-Scale σ2\sigma^2 Band Organisation
FIG. 3, Analytical Precision (σ^2) Learning Rule
Figure 3. Analytical Precision (σ2\sigma^2) Learning Rule

7. Claim Illustration Sheets

FIG. P2-1, Precision-Weighted Predictive Coding System (Claim 1). Complete system with (a) hierarchical processing units, (b) precision estimation (RMSNorm to W_σ to softplus), (c) prediction generation (W_predict), (d) re-entrant inference controller (gradient-free), (e) conflict detection (inter-unit variance), and (f) analytical precision learning (closed-form gradients).
Figure P2-1. Precision-Weighted Predictive Coding System (Claim 1). Complete system with (a) hierarchical processing units, (b) precision estimation (RMSNorm →\to Wσ{\mathbf{W}_{\sigma}} →\to softplus), (c) prediction generation (Wpredict{\mathbf{W}_{\text{predict}}}), (d) re-entrant inference controller (gradient-free), (e) conflict detection (inter-unit variance), and (f) analytical precision learning (closed-form gradients).
FIG. P2-2, Depth-Dependent Bias Initialisation (Claim 2). Bias b_σ,i = ln(exp(σ^2_base times (1 + α_depth times i/max(N-1,1))) - 1); shallow units receive lower initial bias (lower uncertainty), deep units receive higher initial bias (higher uncertainty).
Figure P2-2. Depth-Dependent Bias Initialisation (Claim 2). Bias bσ,i=ln⁡(exp⁡(σ2base×(1+αdepth×i/max⁡(N−1,1)))−1)b_{\sigma,i} = \ln(\exp({\sigma^2}_{\text{base}} \times (1 + \alpha_{\text{depth}} \times i/\max(N-1,1))) - 1); shallow units receive lower initial bias (lower uncertainty), deep units receive higher initial bias (higher uncertainty).
FIG. P2-3, Multi-Scale Precision Bands (Claim 3). Four bands (token, phrase, sentence, discourse) with aggregate precision routing: token to NTP, phrase to lateral coupling, sentence to episodic memory, discourse to global workspace.
Figure P2-3. Multi-Scale Precision Bands (Claim 3). Four bands (token, phrase, sentence, discourse) with aggregate precision routing: token →\to NTP, phrase →\to lateral coupling, sentence →\to episodic memory, discourse →\to global workspace.
FIG. P2-4, Re-entrant Inference Iteration Control (Claim 4). Timeline showing K_min mandatory iterations, convergence testing (δ < τ_conv) from K_min to K_max, and K_extra conflict-allocated additional iterations.
Figure P2-4. Re-entrant Inference Iteration Control (Claim 4). Timeline showing Kmin⁡K_{\min} mandatory iterations, convergence testing (δ<τconv\delta < \tau_{\text{conv}}) from Kmin⁡K_{\min} to Kmax⁡K_{\max}, and KextraK_{\text{extra}} conflict-allocated additional iterations.
FIG. P2-5, Conflict Score Computation (Claim 5). Inter-unit output variance C = (1/D)sum_d Var_i[barh_i[d]]; extra iterations K_extra = min(K_max,extra, lfloor (C-τ_C)/τ_C times K_max,extra rfloor).
Figure P2-5. Conflict Score Computation (Claim 5). Inter-unit output variance C=(1/D)∑dVari[hˉi[d]]C = (1/D)\sum_d \text{Var}_i[\bar{h}_i[d]]; extra iterations Kextra=min⁡(Kmax⁡,extra,⌊(C−τC)/τC×Kmax⁡,extra⌋)K_{\text{extra}} = \min(K_{\max,\text{extra}}, \lfloor (C-\tau_C)/\tau_C \times K_{\max,\text{extra}} \rfloor).
FIG. P2-6, Analytical Precision Learning (Claim 6). Closed-form gradient: partialL/partial z = (-|ε|^2/(2(σ^2)^2) + 1/(2σ^2)) times sigmoid(z); weight update ΔW_σ= (1/N)(partialL/partial z)^top hatH.
Figure P2-6. Analytical Precision Learning (Claim 6). Closed-form gradient: ∂L/∂z=(−∥ϵ∥2/(2(σ2)2)+1/(2σ2))×sigmoid⁡(z)\partial\mathcal{L}/\partial z = (-\|\epsilon\|^2/(2({\sigma^2})^2) + 1/(2{\sigma^2})) \times \operatorname{sigmoid}(z); weight update ΔWσ=(1/N)(∂L/∂z)⊤H^\Delta{\mathbf{W}_{\sigma}}= (1/N)(\partial\mathcal{L}/\partial z)^\top \hat{\mathbf{H}}.
FIG. P2-7, Dendritic Modulation by Preceding Precision (Claim 7). σ^2 from unit l modulates dendritic gate of unit l+1 via W_σ-adapt: high preceding σ^2 loosens gate, low preceding σ^2 tightens gate.
Figure P2-7. Dendritic Modulation by Preceding Precision (Claim 7). σ2{\sigma^2} from unit ll modulates dendritic gate of unit l+1l+1 via Wσ-adapt\mathbf{W}_{\sigma\text{-adapt}}: high preceding σ2{\sigma^2} loosens gate, low preceding σ2{\sigma^2} tightens gate.
FIG. P2-8, Precision Health Monitoring (Claim 8). EMA tracking with three monitoring conditions: (i) divergence (EMA > upper threshold to scale output weights), (ii) collapse (EMA < lower threshold to increase b_σ), (iii) persistent non-convergence.
Figure P2-8. Precision Health Monitoring (Claim 8). EMA tracking with three monitoring conditions: (i) divergence (EMA >> upper threshold →\to scale output weights), (ii) collapse (EMA << lower threshold →\to increase bσb_\sigma), (iii) persistent non-convergence.
FIG. P2-9, PWPC Inference Method (Claim 9, independent). Complete method: (a) bottom-up pass, (b) prediction errors, (c) conflict score, (d) extra iterations, (e) re-entrant inference (gradient-free), (f) analytical gradients, (g) parameter update.
Figure P2-9. PWPC Inference Method (Claim 9, independent). Complete method: (a) bottom-up pass, (b) prediction errors, (c) conflict score, (d) extra iterations, (e) re-entrant inference (gradient-free), (f) analytical gradients, (g) parameter update.
FIG. P2-10, Depth-Dependent Bias Initialisation (Claim 10). Bar chart of b_σ values for N=12 units with σ^2_base = 0.5, α_depth = 1.0: values increase monotonically from 0.198 (shallowest) to 0.541 (deepest).
Figure P2-10. Depth-Dependent Bias Initialisation (Claim 10). Bar chart of bσb_\sigma values for N=12N=12 units with σ2base=0.5{\sigma^2}_{\text{base}} = 0.5, αdepth=1.0\alpha_{\text{depth}} = 1.0: values increase monotonically from 0.198 (shallowest) to 0.541 (deepest).
FIG. P2-11, Precision Band Routing to Subsystems (Claim 11). Sentence-band aggregate σ^2 modulates episodic memory encoding threshold; discourse-band aggregate σ^2 modulates global workspace broadcasting access.
Figure P2-11. Precision Band Routing to Subsystems (Claim 11). Sentence-band aggregate σ2{\sigma^2} modulates episodic memory encoding threshold; discourse-band aggregate σ2{\sigma^2} modulates global workspace broadcasting access.
FIG. P2-12, Re-entrant Iteration Control State Machine (Claim 12). States: START to MANDATORY (k < K_min) to TEST (δ_err < τ_conv?) to EXTRA (K_max..K_max+K_extra) to SETTLED.
Figure P2-12. Re-entrant Iteration Control State Machine (Claim 12). States: START →\to MANDATORY (k<Kmin⁡k < K_{\min}) →\to TEST (δerr<τconv\delta_{\text{err}} < \tau_{\text{conv}}?) →\to EXTRA (Kmax⁡..Kmax⁡+KextraK_{\max}..K_{\max}+K_{\text{extra}}) →\to SETTLED.
FIG. P2-13, Analytical Gradient Computation Details (Claim 13). Four-step pipeline: (i) mean MSE, (ii) partialL/partialσ^2, (iii) sigmoid clamping [0.01, 0.99], (iv) outer product weight gradient ΔW_σ.
Figure P2-13. Analytical Gradient Computation Details (Claim 13). Four-step pipeline: (i) mean MSE, (ii) ∂L/∂σ2\partial\mathcal{L}/\partial{\sigma^2}, (iii) sigmoid clamping [0.01,0.99][0.01, 0.99], (iv) outer product weight gradient ΔWσ\Delta{\mathbf{W}_{\sigma}}.
FIG. P2-14, Precision-Weighted Prediction Update (Claim 14). ΔW_predict= -(1/N)(ε/σ^2)^top hatH: high-precision units (low σ^2) receive large updates, low-precision units (high σ^2) receive small updates.
Figure P2-14. Precision-Weighted Prediction Update (Claim 14). ΔWpredict=−(1/N)(ϵ/σ2)⊤H^\Delta{\mathbf{W}_{\text{predict}}}= -(1/N)(\epsilon/{\sigma^2})^\top \hat{\mathbf{H}}: high-precision units (low σ2{\sigma^2}) receive large updates, low-precision units (high σ2{\sigma^2}) receive small updates.
FIG. P2-15, Inter-Unit Precision Propagation (Claim 15). Chain showing σ^2 passed from each unit to the next, modulating the receiving unit’s dendritic gate via learned projection W_σ-adapt.
Figure P2-15. Inter-Unit Precision Propagation (Claim 15). Chain showing σ2{\sigma^2} passed from each unit to the next, modulating the receiving unit’s dendritic gate via learned projection Wσ-adapt\mathbf{W}_{\sigma\text{-adapt}}.
FIG. P2-16, PWPC Computer-Readable Medium (Claim 16, independent). Stored instructions: (a) instantiate, (b) bottom-up pass, (c) prediction errors, (d) conflict + extra iterations, (e) re-entrant inference (gradient-free), (f) analytical update, (g) band routing.
Figure P2-16. PWPC Computer-Readable Medium (Claim 16, independent). Stored instructions: (a) instantiate, (b) bottom-up pass, (c) prediction errors, (d) conflict + extra iterations, (e) re-entrant inference (gradient-free), (f) analytical update, (g) band routing.
FIG. P2-17, Four Precision Bands (Claim 17). N=12 units in four bands (token, phrase, sentence, discourse) with mean aggregation per band. Example aggregates: token 0.547, phrase 0.683, sentence 0.817, discourse 0.953.
Figure P2-17. Four Precision Bands (Claim 17). N=12N=12 units in four bands (token, phrase, sentence, discourse) with mean aggregation per band. Example aggregates: token 0.547, phrase 0.683, sentence 0.817, discourse 0.953.
FIG. P2-18, EMA Precision Monitoring and Correction (Claim 18). Divergence (EMA > upper to scale output weights) and collapse (EMA < lower to increase b_σ) with time-series graphs.
Figure P2-18. EMA Precision Monitoring and Correction (Claim 18). Divergence (EMA >> upper →\to scale output weights) and collapse (EMA << lower →\to increase bσb_\sigma) with time-series graphs.
FIG. P2-19, Gradient-Free Inference Regime (Claim 19). Comparison: standard autodiff (O(N times B times T times D) VRAM) vs. gradient-free (O(B times T times D) VRAM), saving sim3 GiB for the 106M model at batch 96.
Figure P2-19. Gradient-Free Inference Regime (Claim 19). Comparison: standard autodiff (O(N×B×T×D)O(N \times B \times T \times D) VRAM) vs. gradient-free (O(B×T×D)O(B \times T \times D) VRAM), saving ∼3{\sim}3 GiB for the 106M model at batch 96.
FIG. P2-20, Depth-Dependent Init Boundary Values (Claim 20). Shallowest unit: σ^2_init,0 = σ^2_base; deepest unit: σ^2_init,N-1 = σ^2_base times (1 + α_depth). Linear interpolation with example: base=0.5, α=1.0 gives range [0.5, 1.0].
Figure P2-20. Depth-Dependent Init Boundary Values (Claim 20). Shallowest unit: σ2init,0=σ2base{\sigma^2}_{\text{init},0} = {\sigma^2}_{\text{base}}; deepest unit: σ2init,N−1=σ2base×(1+αdepth){\sigma^2}_{\text{init},N-1} = {\sigma^2}_{\text{base}} \times (1 + \alpha_{\text{depth}}). Linear interpolation with example: base=0.5=0.5, α=1.0\alpha=1.0 gives range [0.5,1.0][0.5, 1.0].

Note: In the actual patent filing, each figure described above shall be provided as a separate drawing sheet conforming to Rule 15 of the Patents Rules, 2003. The drawings are schematic representations of the system architecture, data flow, and computational methods. Actual implementation may vary in specific arrangement and connectivity without departing from the scope of the invention.

8. Claims

We claim:

Claim 1

A precision-weighted predictive coding system for a hierarchical neural network, the system comprising:

  1. a plurality of processing units arranged in a feedforward hierarchy, each processing unit configured to receive an input representation and produce an output representation;

  2. a precision estimation module within each processing unit, comprising:

    1. a normalisation layer configured to normalise the hidden state of the processing unit;

    2. a learned linear projection having a weight matrix Wσ{\mathbf{W}_{\sigma}} and a bias term bσb_\sigma, configured to map the normalised hidden state to a scalar pre-activation value; and

    3. a positivity-preserving activation function, specifically a softplus function, configured to transform the scalar pre-activation into a per-token precision estimate σ2{\sigma^2} that is strictly positive

    wherein the weight matrix Wσ{\mathbf{W}_{\sigma}} is initialised with non-zero random values such that the precision estimate varies with input content from the first forward pass;

  3. a prediction generation module within each processing unit, comprising a learned linear projection Wpredict{\mathbf{W}_{\text{predict}}} configured to generate a top-down prediction of the input to the next lower processing unit in the hierarchy;

  4. a re-entrant inference controller configured to iteratively refine the representations of the processing units by:

    1. assembling a top-down context signal for each processing unit from predictions of higher units;

    2. re-processing each processing unit with the assembled top-down context under a gradient-free computational regime; and

    3. testing for convergence by computing a relative change in total prediction error across the hierarchy;

  5. a conflict detection module configured to compute a conflict score as the variance of mean output representations across the processing units, and to allocate additional inference iterations to the re-entrant inference controller when the conflict score exceeds a predetermined threshold; and

  6. an analytical precision learning module configured to update the weight matrix Wσ{\mathbf{W}_{\sigma}} and bias bσb_\sigma of each precision estimation module using closed-form gradient expressions derived from a precision-weighted prediction error loss, without invoking automatic differentiation.

Claim 2

The system of Claim 1, wherein the bias term bσb_\sigma of each precision estimation module is initialised according to a depth-dependent initialisation scheme, such that for a processing unit at index ii in a hierarchy of NN units:

σ2init,i=σ2base×(1+αdepth×imax⁡(N−1,1)){\sigma^2}_{\text{init},i} = {\sigma^2}_{\text{base}} \times \left(1 + \alpha_{\text{depth}} \times \frac{i}{\max(N-1, 1)}\right)
bσ,i=ln⁡(eσ2init,i−1)b_{\sigma,i} = \ln\left(e^{{\sigma^2}_{\text{init},i}} - 1\right)

wherein σ2base{\sigma^2}_{\text{base}} is a base initial precision value and αdepth\alpha_{\text{depth}} is a depth scaling factor, such that shallow processing units are initialised with lower uncertainty than deep processing units.

Claim 3

The system of Claim 1, wherein the plurality of processing units are organised into a plurality of precision bands, each precision band corresponding to a different temporal receptive field scale, comprising:

  1. a token band comprising shallow processing units, whose aggregate precision modulates local next-token prediction;

  2. a phrase band comprising intermediate-shallow processing units, whose aggregate precision modulates lateral inter-unit communication;

  3. a sentence band comprising intermediate-deep processing units, whose aggregate precision modulates episodic memory encoding thresholds; and

  4. a discourse band comprising deep processing units, whose aggregate precision modulates global workspace broadcasting access.

Claim 4

The system of Claim 1, wherein the re-entrant inference controller is configured to:

  1. perform a minimum of Kmin⁡K_{\min} inference iterations before testing for convergence;

  2. terminate inference iterations when a relative change in total prediction error falls below a convergence threshold τconv\tau_{\text{conv}}; and

  3. enforce a maximum of Kmax⁡+KextraK_{\max} + K_{\text{extra}} inference iterations, where KextraK_{\text{extra}} is determined by the conflict detection module.

Claim 5

The system of Claim 1, wherein the conflict detection module computes the conflict score as:

C=1D∑d=1DVari∈{0,…,N−1}[hˉi[d]]C = \frac{1}{D} \sum_{d=1}^{D} \text{Var}_{i \in \{0,\ldots,N-1\}}\left[\bar{h}_i[d]\right]

where hˉi\bar{h}_i is the mean output of processing unit ii across batch and sequence dimensions, and allocates extra inference steps according to:

Kextra=min⁡(Kmax⁡,extra,  ⌊C−τCτC×Kmax⁡,extra⌋)K_{\text{extra}} = \min\left(K_{\max,\text{extra}},\; \left\lfloor \frac{C - \tau_C}{\tau_C} \times K_{\max,\text{extra}} \right\rfloor\right)

where τC\tau_C is the conflict threshold and Kmax⁡,extraK_{\max,\text{extra}} is the maximum number of additional steps.

Claim 6

The system of Claim 1, wherein the analytical precision learning module computes the gradient of the precision-weighted prediction error loss with respect to the pre-activation zz as:

∂L∂z=(−∥ϵ∥22⋅(σ2)2+12⋅σ2)×sigmoid⁡(z)\frac{\partial \mathcal{L}}{\partial z} = \left(\frac{-\|\epsilon\|^2}{2 \cdot ({\sigma^2})^2} + \frac{1}{2 \cdot {\sigma^2}}\right) \times \operatorname{sigmoid}(z)

and updates the weight matrix as:

ΔWσ=1N(∂L∂z)⊤H^\Delta{\mathbf{W}_{\sigma}}= \frac{1}{N} \left(\frac{\partial \mathcal{L}}{\partial z}\right)^\top \hat{\mathbf{H}}

where H^\hat{\mathbf{H}} is the matrix of normalised hidden states, ϵ\epsilon is the prediction error, σ2{\sigma^2} is the current precision estimate, and sigmoid⁡(z)\operatorname{sigmoid}(z) is the derivative of the softplus function.

Claim 7

The system of Claim 1, further comprising a dendritic modulation mechanism within each processing unit, wherein the precision estimate σ2{\sigma^2} from a preceding processing unit modulates the dendritic gate logit of the current processing unit via a learned linear projection, such that high preceding uncertainty loosens the dendritic gate and low preceding uncertainty tightens it.

Claim 8

The system of Claim 1, wherein the conflict detection module further maintains exponential moving averages of per-unit precision estimates and monitors for:

  1. precision divergence, wherein a unit’s exponential moving average of σ2{\sigma^2} exceeds an upper threshold, triggering scaling of the unit’s output weights;

  2. precision collapse, wherein a unit’s exponential moving average of σ2{\sigma^2} falls below a lower threshold, triggering an increase in the unit’s bias term bσb_\sigma; and

  3. persistent non-convergence, wherein the inference loop consistently reaches the maximum step count.

Claim 9

A method for performing precision-weighted predictive coding inference in a hierarchical neural network comprising a plurality of processing units, the method comprising:

  1. performing an initial bottom-up pass through the plurality of processing units, wherein each processing unit:

    1. computes an output representation from its input;

    2. generates a top-down prediction of the input to the next lower processing unit via a learned linear projection Wpredict{\mathbf{W}_{\text{predict}}}; and

    3. computes a content-dependent precision estimate σ2{\sigma^2} by applying a learned linear projection Wσ{\mathbf{W}_{\sigma}} to a normalised hidden state and passing the result through a softplus activation function, wherein the weight matrix Wσ{\mathbf{W}_{\sigma}} is initialised with non-zero random values;

  2. computing prediction errors at each level of the hierarchy as the difference between actual inputs and generated predictions;

  3. computing a conflict score as the variance of mean output representations across the processing units;

  4. determining a number of additional inference iterations based on whether the conflict score exceeds a predetermined threshold;

  5. performing a plurality of re-entrant inference iterations under a gradient-free computational regime, each iteration comprising:

    1. assembling a top-down context signal for each processing unit;

    2. re-processing each processing unit with both bottom-up input and the top-down context signal;

    3. recomputing prediction errors; and

    4. testing for convergence based on relative change in total prediction error;

  6. computing analytical gradients of a precision-weighted prediction error loss with respect to the parameters Wσ{\mathbf{W}_{\sigma}} and bσb_\sigma without invoking automatic differentiation, using the closed-form expression:

    ∂L∂z=(−∥ϵ∥22⋅(σ2)2+12⋅σ2)×sigmoid⁡(z)\frac{\partial \mathcal{L}}{\partial z} = \left(\frac{-\|\epsilon\|^2}{2 \cdot ({\sigma^2})^2} + \frac{1}{2 \cdot {\sigma^2}}\right) \times \operatorname{sigmoid}(z)

    where zz is the pre-activation, ϵ\epsilon is the prediction error, and σ2=softplus⁡(z)+ϵ{\sigma^2}= \operatorname{softplus}(z) + \epsilon; and

  7. updating Wσ{\mathbf{W}_{\sigma}} and bσb_\sigma using the computed analytical gradients.

Claim 10

The method of Claim 9, further comprising initialising the bias term bσb_\sigma of each processing unit according to a depth-dependent scheme wherein shallow processing units receive a lower initial bias value corresponding to lower initial uncertainty and deep processing units receive a higher initial bias value corresponding to higher initial uncertainty, according to:

bσ,i=ln⁡(exp⁡(σ2base×(1+αdepth×imax⁡(N−1,1)))−1)b_{\sigma,i} = \ln\left(\exp\left({\sigma^2}_{\text{base}} \times \left(1 + \alpha_{\text{depth}} \times \frac{i}{\max(N-1, 1)}\right)\right) - 1\right)

where ii is the index of the processing unit in the hierarchy and NN is the total number of processing units.

Claim 11

The method of Claim 9, further comprising organising the plurality of processing units into a plurality of precision bands and routing the aggregate precision of each band to a distinct downstream subsystem, wherein:

  1. a sentence-level precision band modulates a threshold for episodic memory encoding; and

  2. a discourse-level precision band modulates access to a global workspace broadcasting mechanism.

Claim 12

The method of Claim 9, wherein performing the plurality of re-entrant inference iterations comprises:

  1. performing at least Kmin⁡K_{\min} iterations before evaluating the convergence criterion;

  2. terminating iterations when the relative change in total prediction error falls below a threshold τconv\tau_{\text{conv}}; and

  3. limiting the total number of iterations to Kmax⁡+KextraK_{\max} + K_{\text{extra}}, where KextraK_{\text{extra}} is determined by the conflict score.

Claim 13

The method of Claim 9, wherein computing the analytical gradients comprises:

  1. computing the mean squared prediction error ∥ϵ∥2\|\epsilon\|^2 as the mean over the model dimension to ensure gradient scale invariance with respect to model dimensionality;

  2. computing the derivative of the loss with respect to σ2{\sigma^2} as −∥ϵ∥2/(2⋅(σ2)2)+1/(2⋅σ2)-\|\epsilon\|^2 / (2 \cdot ({\sigma^2})^2) + 1 / (2 \cdot {\sigma^2});

  3. multiplying by sigmoid⁡(z)\operatorname{sigmoid}(z), clamped to the interval [0.01,0.99][0.01, 0.99], to obtain the derivative with respect to the pre-activation; and

  4. computing the weight gradient as the outer product of the per-token gradient scalars with the normalised hidden states, averaged over all tokens.

Claim 14

The method of Claim 9, further comprising updating the prediction weights Wpredict{\mathbf{W}_{\text{predict}}} of each processing unit via an analytical precision-weighted gradient:

ΔWpredict=−1N(ϵσ2)⊤H^\Delta{\mathbf{W}_{\text{predict}}}= -\frac{1}{N} \left(\frac{\epsilon}{{\sigma^2}}\right)^\top \hat{\mathbf{H}}

wherein predictions from high-precision units receive proportionally larger gradient updates than predictions from low-precision units.

Claim 15

The method of Claim 9, further comprising passing the precision estimate σ2{\sigma^2} from each processing unit to the next processing unit in the hierarchy, wherein the precision estimate modulates a dendritic gate of the receiving processing unit via a learned linear projection, enabling computation to adapt based on the certainty of the preceding unit.

Claim 16

A non-transitory computer-readable medium storing instructions that, when executed by one or more processors, cause the one or more processors to:

  1. instantiate a hierarchical neural network comprising a plurality of processing units, each processing unit including:

    1. a precision estimation module comprising a learned linear projection Wσ{\mathbf{W}_{\sigma}} with non-zero initialised weights and a softplus activation, configured to compute a content-dependent per-token precision estimate σ2{\sigma^2}; and

    2. a prediction generation module comprising a learned linear projection Wpredict{\mathbf{W}_{\text{predict}}} configured to generate top-down predictions;

    wherein the bias term bσb_\sigma of each precision estimation module is initialised according to a depth-dependent scheme producing monotonically increasing initial uncertainty from shallow to deep processing units;

  2. perform a bottom-up forward pass through the processing units, computing output representations, predictions, and precision estimates;

  3. compute prediction errors at each hierarchical level;

  4. compute a conflict score based on inter-unit output variance and determine additional inference iterations;

  5. perform re-entrant inference iterations under a gradient-free regime, refining representations through top-down prediction and bottom-up error correction, until convergence or a maximum step count;

  6. update the precision parameters Wσ{\mathbf{W}_{\sigma}} and bσb_\sigma using analytical gradient expressions computed as:

    ∂L∂z=(−∥ϵ∥22⋅(σ2)2+12⋅σ2)×sigmoid⁡(z)\frac{\partial \mathcal{L}}{\partial z} = \left(\frac{-\|\epsilon\|^2}{2 \cdot ({\sigma^2})^2} + \frac{1}{2 \cdot {\sigma^2}}\right) \times \operatorname{sigmoid}(z)

    without constructing or traversing an automatic differentiation graph; and

  7. route aggregate precision values from different hierarchical bands to distinct downstream subsystems, including episodic memory encoding and global workspace broadcasting.

Claim 17

The non-transitory computer-readable medium of Claim 16, wherein the instructions further cause the one or more processors to organise the processing units into four precision bands corresponding to token-level, phrase-level, sentence-level, and discourse-level temporal receptive fields, wherein each band’s aggregate precision is computed as the mean σ2{\sigma^2} across all units in that band.

Claim 18

The non-transitory computer-readable medium of Claim 16, wherein the instructions further cause the one or more processors to maintain exponential moving averages of per-unit precision estimates and to take corrective action when a unit’s precision diverges above an upper threshold or collapses below a lower threshold.

Claim 19

The non-transitory computer-readable medium of Claim 16, wherein the gradient-free regime for re-entrant inference iterations comprises executing all computations within the iterative loop without constructing a computational graph for automatic differentiation, such that no intermediate activations are stored for a backward pass during the inference iterations.

Claim 20

The non-transitory computer-readable medium of Claim 16, wherein the depth-dependent initialisation scheme sets the initial precision value for processing unit ii in a hierarchy of NN units to:

σ2init,i=σ2base×(1+αdepth×imax⁡(N−1,1)){\sigma^2}_{\text{init},i} = {\sigma^2}_{\text{base}} \times \left(1 + \alpha_{\text{depth}} \times \frac{i}{\max(N-1, 1)}\right)

such that the shallowest processing unit has initial precision σ2base{\sigma^2}_{\text{base}} and the deepest processing unit has initial precision σ2base×(1+αdepth){\sigma^2}_{\text{base}} \times (1 + \alpha_{\text{depth}}).

License

PolyForm Noncommercial License 1.0.0

This work is open research. Free for any noncommercial use: research, education, personal projects, evaluation, and nonprofit or public-sector use. Commercial use requires a separate license, available by contacting krrish@verace.in.