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
| Feature | ResonantGSER | PredictiveResonantLayer |
|---|---|---|
| Resonance Type | Hierarchical (Top-Down) | Local (Self-Contained) |
| Alignment Target | Provided by higher layer | Generated internally |
| State Scope | Global/Batch-wide | Per-Example |
| Complexity | High (Requires connectivity) | Moderate (Drop-in replacement) |
How It Works
The PredictiveResonantLayer operates through a four-stage process during each forward step:
- Base Dynamics: A standard gated recurrent update (LSTM-based) produces a raw candidate state (analogous to Feedforward Sensory Input).
- Harmonization: a closed-form -step EMA moves the candidate toward the current alignment vector (equivalent to the old iterative loop).
- Spiking & Modulation: graded spikes against a self-scaling threshold, with a learned per-unit threshold and leak.
- Predictive Update: a linear head updates the alignment vector with a slow EMA ().
Process Flow
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
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
steps of with clipped to equal
The cell evaluates this closed form. Spikes use a straight-through estimator; the hidden state is then .
Predictive Update
The alignment vector is updated using an exponential moving average toward a predicted future state : Where is a learned linear transformation and is a fixed slow-update rate (typically 0.1).
Benefits
- Temporal Coherence: By harmonizing toward a moving average of its own predictions, the layer resists noise and sudden fluctuations in sequential data.
- Autonomy: It does not require complex model-wide wiring or top-down feedback loops to benefit from resonance principles.
- 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.