Command Palette

Search for a command to run...

PredictiveResonantLayer

Local predictive alignment for fast, stateful sequence processing.

Design Philosophy

“Self-Contained Intelligence”

The PredictiveResonantLayer functions as an autonomous unit, generating its own internal expectations without requiring external guidance. This creates a resilient, high-fidelity neural component capable of stable integration into any architecture.

Overview

The PredictiveResonantLayer is a specialized RNN layer within the ARCANE framework that implements Local Predictive Resonance, directly inspired by Predictive Coding theory in Neuroscience. It mimics the brain's ability to constantly generate internal predictions about future sensory inputs and adjust its neural state to minimize "prediction error" (divergence).

Unlike the hierarchical resonance seen in ResonantGSER, this layer models the local homeostatic alignment of individual neural clusters, making it fully autonomous in maintaining its own internal world model on a per-sample basis.

Core Philosophical Difference

FeatureResonantGSERPredictiveResonantLayer
Resonance TypeHierarchical (Top-Down)Local (Self-Contained)
Alignment TargetProvided by higher layerGenerated internally
State ScopeGlobal/Batch-widePer-Example
ComplexityHigh (Requires connectivity)Moderate (Drop-in replacement)

How It Works

The PredictiveResonantLayer operates through a four-stage process during each forward step:

  1. Base Dynamics: A standard gated recurrent update (LSTM-based) produces a raw candidate state (analogous to Feedforward Sensory Input).
  2. Harmonization: a closed-form NN-step EMA moves the candidate toward the current alignment vector (equivalent to the old iterative loop).
  3. Spiking & Modulation: graded spikes against a self-scaling threshold, with a learned per-unit threshold and leak.
  4. Predictive Update: a linear head updates the alignment vector with a slow EMA (α=0.1\alpha = 0.1).

Process Flow

Loading diagram...

The Alignment Vector

The Alignment Vector acts as the layer's internal expectation. It is a slow-moving target that represents where the layer "believes" its latent state should be based on perceived temporal patterns.

Implementation Details

Configuration

python
from gpbacay_arcane.layers import PredictiveResonantLayerlayer = PredictiveResonantLayer(    units=128,    resonance_cycles=3,        # Number of harmonization iterations    resonance_step_size=0.2,   # Alpha for state adjustment    persist_alignment=True,    # Carry alignment across sequences    return_sequences=True)

Parameters

  • units: Dimensionality of the latent space.
  • resonance_cycles: How many times the state is refined toward the alignment target per step.
  • resonance_step_size: The magnitude of adjustment in each resonance cycle.
  • persist_alignment: If enabled, the layer stores a "global memory" of its alignment state, allowing it to maintain semantic continuity even across independent calls or batch reshuffles.

Mathematical Mechanism

State Harmonization

NN steps of h←h−η(h−A)h \leftarrow h - \eta (h - A) with η\eta clipped to (0,0.99)(0, 0.99) equal

hN=(1−η)Nh0+(1−(1−η)N)Ah_N = (1-\eta)^N h_0 + \bigl(1-(1-\eta)^N\bigr) A

The cell evaluates this closed form. Spikes use a straight-through estimator; the hidden state is then h−s⋅θh - s\cdot\theta.

Predictive Update

The alignment vector AA is updated using an exponential moving average toward a predicted future state PP: At+1=(1−α)⋅At+α⋅P(ht)A_{t+1} = (1 - \alpha) \cdot A_t + \alpha \cdot P(h_t) Where PP is a learned linear transformation and α\alpha is a fixed slow-update rate (typically 0.1).

Benefits

  1. Temporal Coherence: By harmonizing toward a moving average of its own predictions, the layer resists noise and sudden fluctuations in sequential data.
  2. Autonomy: It does not require complex model-wide wiring or top-down feedback loops to benefit from resonance principles.
  3. Stateful Resonance: With persist_alignment, the layer can develop a long-term "bias" or "worldview" that helps it process new information more efficiently.

Use Cases

  • Noisy Sequence Processing: Where temporal stability is more important than immediate reactive changes.
  • Autonomous Agents: Where a layer needs to maintain internal consistency without external supervision.
  • Streaming Inference: Where the model must handle continuous data streams with high temporal correlation.

This documentation covers the PredictiveResonantLayer mechanism as implemented in ARCANE v3.1.0.