Command Palette

Search for a command to run...

Hierarchical Resonance Foundation Model

A hierarchical System 1 model with per-example resonance, trained feedback, and bounded adaptation.

Overview

The HierarchicalResonanceFoundationModel organizes ResonantGSER layers into a feedback-driven sequence model. During resonance prediction, every example carries its own top-down target through the hierarchy. Feedback training and test-time adaptation remain separate, measurable operations with clear reset semantics.

Usage

foundation-model.py
from gpbacay_arcane import HierarchicalResonanceFoundationModelmodel = HierarchicalResonanceFoundationModel(    vocab_size=5000,    seq_len=32,    hidden_dim=128,    num_resonance_levels=4,    enable_inference_plasticity=True,    use_hierarchical_homeostasis=True,    homeostasis_config={        "homeostasis_mode": "hybrid",        "homeostatic_window_size": 32,        "slow_bcm_tau": 4000.0,        "adaptive_target_rate": 0.05,        "resonance_coupling": 0.5,        "hierarchy_target_slope": 0.1,    },)model.build_model()model.compile_model()# Ordinary supervised trainingmodel.model.fit(X_train, y_train)# Train task weights and feedback projections end to endmetrics = model.train_feedback_step(    X_train[:32], labels=y_train[:32], alignment_weight=0.1)# Refine the current batch with isolated per-example resonance statepredictions = model.predict_with_resonance(X_test, resonance_cycles=4)# Optional bounded adaptation; episodic=True restores the checkpoint afterwardresult = model.adapt_at_inference(    X_test,    variables="all",    objective="entropy",    steps=2,    max_update_norm=1e-3,    episodic=True,)

Key Features

  • Per-example resonance: explicit batch-shaped targets avoid co-batching contamination during current-input refinement.
  • Trainable feedback: alignment and reconstruction losses provide a gradient path to feedback projections.
  • Bounded adaptation: optional entropy or consistency objectives support snapshots, update limits, rollback, and episodic reset.
  • Temporal Coherence: Distills temporal dynamics into coherence vectors.
  • Attention Fusion: Aggregates multi-pathway information with self-attention.

Choose the resonance depth with a controlled ablation of the same checkpoint at 0, 1, 2, 4, and 8 cycles. This reveals the best accuracy, calibration, and latency trade-off for your task.