Prizma / docs /Prizma_EN.md
AylinMaylinn's picture
Reframe as research artifact: rich card + Apache-2.0 license + clean runnable code subset; remove internal design files
91d91c5 verified
|
Raw
History Blame Contribute Delete
24.8 kB

Prizma — backprop-free, fully-local continual learning

A backprop-free, fully-local, predictive-coding-based, neuromorphic-targeted learning architecture.

Core idea (3 sentences). Prizma is a cortical workspace network that performs gradient descent on a single free-energy functional across three time scales: descent with respect to activities = inference, descent with respect to gates = routing, descent with respect to weights = learning. All learning rules are local (no backprop, no weight transport; the W^T in inference is relaxed via Feedback Alignment). The original contribution is that the same precision-weighted-surprise signal drives both attention/routing and plasticity (consolidation) at two time scales — and this yields continual learning that requires no task boundaries and no task labels: it replaces EWC's offline Fisher with an online and local surprise-driven importance signal.

This document presents the idea end to end, formalizes it, tests it with real code, records failed attempts and their fixes, and honestly bounds where it works and where it does not.


0. How we got here (chain of reasoning)

In the current transformer architecture, prior + attention + memory + computation are blurred into a single weight stack and learned from scratch in a data-hungry manner. The brain move splits these four functions into four organs. Prizma adopts this split but rejects path A (backprop + RL-gating); it chooses path B: fully-local plasticity, a predictive-coding anchor, a neuromorphic/analog target. The primary object is not the forward pass but plasticity; learning and inference are gradient descent with respect to different variables on a single free-energy functional.

This architecture and theoretical framework were developed through a structured design-and-review process with adversarial refereeing, spanning predictive-coding theory, the novel mechanism, neuromorphic hardware, prior-art differentiation, failure-mode analysis, and the experimental protocol. The full design rationale is documented in docs/PRIZMA_SEQ_REPORT.md and docs/PRIZMA_SEQ_SPEC.md.


1. The established architecture — Cortical Workspace Network

  • HEAD — a strong, structured generative prior p(causes). Latents live as reference frames (grid-cell-like relational codes). Slow/frozen; few-sample efficiency comes from here. (In the prototype: a frozen RBF/quadratic-kernel lift — simple but representative of its role.)
  • MODULES (cortical areas) — parallel local experts. Each computes the prediction error ε_m for its own input slice and propagates ERROR, not raw activation.
  • WORKSPACE (thalamus+PFC) — a small fixed-size latent array a ∈ R^k, k ≪ n. The bottleneck is the computational saving itself: cost O(n·k), linear in n.
  • GATE (basal ganglia) — modules compete to write to the workspace via a precision-weighted error ("bid"); the winner(s) write (PBWM).
  • BROADCAST (thalamo-cortical loop) — the updated area is broadcast back to all modules as a top-down prediction; this broadcast also acts like an efference copy.

2. A single free-energy functional and three update rules

2.1 Master functional F (the backbone)

F = Σ_m ½ ε_mᵀ Π_m ε_m   +   ½ ε_wᵀ Π_w ε_w   +   ½ ε_aᵀ Π_a ε_a   +   Σ_m g_m·b_m   −   λ_H·H(g)   +   R(θ)

Error populations (all explicit, forward-looking, locally readable):

module error:        ε_m  = x_m − W_m f(z_m)          (bottom-up input − the module's own prediction)
module↔workspace:    ε_zm = z_m − U_m a                (the workspace broadcast predicts each module latent)
head/prior error:    ε_a  = a   − μ_a(c)               (workspace latent − structured prior)
routing bid:         b_m  = ½ ε_mᵀ Π_m ε_m             (precision-weighted error = basal-ganglia proposal)

The Π_* are precision (inverse-covariance) matrices; g_m∈[0,1] are gate variables; H(g) is gate entropy (load balance, dead-expert pressure, P6); R(θ) is a weight/complexity prior. F = accuracy + complexity. Every term is a precision-weighted squared error + a prior.

2.2 Inference — descent with respect to activities (fast settling)

τ_z dz_m/dt = −∂F/∂z_m = diag(f'(z_m))·W_mᵀ(Π_m ε_m)  −  Π_zm(z_m − U_m a)   [+ √(2T)·ξ(t)]
τ_a da/dt   = −∂F/∂a    = Σ_m g_m·U_mᵀ(Π_zm(z_m − U_m a))  −  Π_a(a − μ_a(c))

The first term contains W_mᵀthis is exactly where weight transport comes back, into the INFERENCE dynamics (open problem P2). It is not in the learning rule; it is in inference. The √(2T)·ξ Langevin noise turns MAP settling into posterior sampling (P5).

2.3 Routing — descent with respect to gates + resolving the sign-tension

τ_g dg_m/dt = −∂F/∂g_m  ⇒  g_m = softmax_m(−b_m/temp + λ_H(−log g_m − 1))

Critical resolution (design review). The claim "a single scalar gate drives both attention and plasticity" is contradictory in sign: in pure PC, since dw ∝ Π·ε·r, a reliable/mastered channel learns faster — the exact opposite of consolidation. The fix is not a single scalar multiplier but a single DRIVER (the surprise/error-energy E_m), read in two opposite-signed ways:

attention/inference gain:   Π_m = π(E_m),  dπ/dE < 0   (precision RISES once mastered — exploit)
plasticity/learning rate:   β_m = β(E_m),  dβ/dE > 0   (β → floor once mastered — FREEZE)

The naive PC identity dw∝Π·ε·r is explicitly REJECTED for consolidation: plasticity reads E_m (surprise), not Π_m.

2.4 Learning — descent with respect to weights (slow, LOCAL, no W^T)

dW_m/dt = η · β_m · NM · [ (Π_m ε_m) ⊗ f(z_m) ] ⊙ Tr_m

Four local factors: NM (a global neuromodulator scalar = the broadcast of the action-outcome error), β_m (the metaplastic gate), (Π_m ε_m) (the post-synaptic error neuron), f(z_m) (pre-synaptic activity), Tr_m (eligibility trace, dTr/dt = −Tr/τ_e + f(z_m)ε_m). This is the idealized PC weight rule, and the equality of dW=(Πε)⊗r to the analytic gradient was verified against finite-differences with an error of 5e-10 (there is no W^T in the learning rule). Note (honesty): the prototype's encoder is a DFA approximation of this idealized rule — it uses fixed-random feedback, i.e. the prototype is always W^T-free; the FD verification is for the idealized rule, not for the prototype's DFA encoder.

2.5 The P2 relaxation — a separate feedback Q_m (Feedback Alignment)

The W_mᵀ in inference is replaced by a separate feedback matrix Q_m:

τ_z dz_m/dt = diag(f'(z_m))·Q_m(Π_m ε_m) − Π_zm(z_m − U_m a)
local training:  dQ_m/dt = η_Q·[(z_m − Q_m(Π_m ε_m)) ⊗ (Π_m ε_m)]     (or fixed-random Q, DFA)

Honesty: P2 is not solved, only relaxed. In the experiment we show that the results do not change with fixed-random feedback (DFA) (E4) — in this regime there is no need for W^T.


3. The original mechanism — PGM (Precision-Gated Metaplasticity) and task-boundary-free continual learning

Two coupled states, a single functional gate:

  • Fast bid b_m = π_m·‖ε_m‖² — opens both attention and the plasticity window (routing).
  • Slow consolidation ω_m — grows with sustained low error, multiplicatively shrinking the effective learning rate via α = α₀/(1+ω_m) (Bayesian-synapse / metaplasticity).
plasticity window:  window(b_m) = σ(β(b_m − θ_m))           (learn only on surprise)
effective LR:       α_m = α₀ · window(b_m) · 1/(1+ω_m)
load balance:       θ_m ← θ_m + η_b(usage_m − target)        (dead-expert / rich-get-richer fix)
reawakening:        ω_m ← ω_m − κ·relu(conflict)             (occupied-expert fix)

Why task-boundary-free continual learning emerges (mechanically): When a module masters its own input domain it produces low error → low bid → loses the competition → ω→high → freezes (consolidates). A new domain produces high error → a fresh module wins → it learns. No task label, no Fisher matrix, no replay. The timing of routing and consolidation events is read from the model's own surprise dynamics (a precision test) — no external task-boundary signal is used.


4. Borrowed vs New — an honest ledger

Component Source Status
Explicit error-neuron + free-energy Rao-Ballard, Bogacz 2017, Friston borrowed
Local weight rule dw∝(Πε)⊗r (no W^T in learning) standard PC borrowed
Relaxing the W^T in inference with random/learned feedback Feedback Alignment (Lillicrap, Nøkland 2016) borrowed
Three/four-factor Hebbian + eligibility Frémaux & Gerstner 2016 borrowed
Basal-ganglia write-gating, small workspace PBWM (O'Reilly & Frank), Goyal & Bengio borrowed
Langevin/stochastic settling = posterior sampling Buesing 2011, Aitchison & Lengyel borrowed
LR ∝ weight-posterior-variance (metaplasticity) Aitchison et al.; Fusi/Benna-Fusi borrowed
ART-style vigilance-recruitment (new domain → fresh expert) Carpenter & Grossberg (ART) borrowed
The resolution of the sign-tension: a single surprise-energy E_m, two opposite-signed readouts (π↑, β↓) NEW synthesis
Precision-tested, task-boundary-free phase detector: reading the consolidation timing from the active expert's own (μ,σ) precision NEW mechanism
Replacing EWC's offline Fisher importance → with an online/local/unsupervised recognition-surprise importance NEW positioning

Originality, honestly: the parts are borrowed, the synthesis + two mechanisms are new. This is not a buzzword mashup — every part was tested in working code.


5. Neuromorphic/analog fit (summary of the hardware analysis)

Operation Physics Why local/low-power
Prediction (MVM) RRAM/memristor crossbar (Ohm+Kirchhoff) O(1) physical time, no off-chip weight transport
Error neuron analog differential pair (current subtraction) local at a shared node
Gate g_m a single tile bias (reference conductance/voltage) the same bias scales both the read gain (attention) and the write window (plasticity) — the physical embedding of precision=plasticity
Competition current-mode winner-take-all local
Weight update three/four-factor conductance change a natural outer-product on the crossbar
Langevin noise intrinsic device noise (RTN/thermal) the hardware "defect" = a free posterior sampler; T_eff ∝ read-voltage

Honest limits: real RTN is not white-Gaussian (Lorentzian/1/f) → "noise=sampler" is idealized; RRAM endurance (~1e6–1e9 writes); device variability corrupts the MVM; a per-cell capacitor eligibility trace is expensive; the workspace+WTA+NM require digital/Loihi-class support (a hybrid design).


6. Experiment — the falsifiability gate

6.1 First, a benchmark-validity finding (honesty)

When we measured the pre-registered rotating-checkerboard benchmark (all tasks share the same input box, different labels), we found it to be invalid: for the same x, the average label overlap across tasks is ≈0.56 (mismatch ≈0.44; K=3) — i.e. because a single-head model cannot give a different answer to the same input without a task identity, low forgetting is MATHEMATICALLY IMPOSSIBLE (the single-output oracle ceiling = 0.78; independently verified by a referee: 0.7808). In this regime no method can win; we confirm this in the E5 control.

Prizma's mechanism (recognition-by-reconstruction) is meaningful in the input-distinguishable (domain-incremental) regime. Hence the valid benchmark:

6.2 Benchmark — Structured-Permuted (domain-incremental, distinguishable)

A correlated base: v = latent·Aᵀ, latent~N(0,I_k), cov(v)=AAᵀ≠I. The label is a shared teacher on the latent. Task t: a feature permutation π_tcov(x_t)=P_t(AAᵀ)P_tᵀ differs in every domain → an autoencoder can recognize the domain from the input (evidence: per-domain PCA reconstruction is own=0.00 vs other=0.64). Naive sequential training still forgets (permuted-MNIST logic).

6.3 Substrate and baselines (on the same ground, fair)

Learners, with comparable parameter counts:

  • backprop MLP — single-head, sequential (naive baseline).
  • EWC — backprop + Fisher; uses task boundaries (a privileged competitor; λ was tuned to minimize its own FGT; at λ≥100 numerical overflow occurs, the tuner stays at λ=50).
  • replay — backprop + reservoir buffer (stores task data; standard rehearsal).
  • oracle_multihead — K independent classifiers, given the true task identity at test time. This is the honest upper bound that Prizma tries to match without being given the task identity (inferring it from reconstruction surprise).
  • Prizma (DFA, no W^T) — ART-routing + PGM consolidation; the encoder uses fixed-random feedback (Feedback Alignment) → no W^T anywhere; NO task label/boundary. (Headline.)
  • Prizma (exact W^T) — the same, but the encoder reads the true Wᵀ → it violates constraint-2; provided only to measure the cost of the no-transport relaxation. (Honest finding: DFA performs better than this — weight transport is unnecessary, even harmful.)
  • PRIZMA_noRoute — routing/phase-detector off, a single monolithic expert (causal ablation).

Prizma is local: the decoder/head uses a fully-local PC/delta rule ((P−Y)⊗z, ε⊗z); the encoder uses Feedback-Alignment.

6.4 Metrics and success criterion (falsifiable)

acc[i,j] = the test accuracy on task j once task i is finished. ACC=mean_j acc[K-1,j]; FGT=mean_{j<K-1}(max_i acc[i,j] − acc[K-1,j]). SUCCESS (≥10 seeds, non-overlapping 95% CI): FGT_Prizma ≤ FGT_EWC, FGT_Prizma ≤ 0.6·FGT_naive, ACC_Prizma ≥ 0.92·ACC_naive, FGT_Prizma < FGT_vanilla, the ablation gate being causal, no task boundary anywhere in Prizma's code.

6.5 RESULTS

E1 — Main comparison (structured-permuted, K=5, 10 seeds, 95% CI):

Learner ACC FGT (forgetting↓) Task boundary? Memory? W^T?
backprop MLP 0.445 ± 0.025 0.553 ± 0.026
EWC (λ=50, tuned) 0.456 ± 0.019 0.411 ± 0.020 uses
replay (buffer 1000) 0.737 ± 0.011 0.156 ± 0.009 uses uses
oracle_multihead (upper bound) 0.879 ± 0.011 0.000 task identity GIVEN
Prizma (DFA, no W^T) 0.834 ± 0.015 0.000 ± 0.000 NONE NONE NONE
Prizma (exact W^T) 0.708 ± 0.021 0.000 NONE NONE uses
PRIZMA_noRoute (ablation) 0.446 ± 0.024 0.489 ± 0.023

Parameters: backprop/EWC = 20,744; Prizma (trainable, effective ~13,840 — only 5 experts are trained; the fixed FA matrices are not counted) ≤ MLP. Prizma does not win by capacity (the referee verified: backprop has FGT≈0.55–0.57 even with 1.08M parameters; Prizma has FGT=0 even with 4,720 parameters).

Reading: Prizma (DFA, 0.834) is BETWEEN replay (0.737) and oracle (0.879) — it matches the oracle's zero-forgetting and approaches its accuracy; but without being given the task identity, without replay, without task boundaries, without W^T. Even replay, which uses task boundaries + memory, stays at FGT=0.156. All criteria S1–S6 are satisfied with non-overlapping CIs.

The no-weight-transport honest finding: the feedback="exact" version (where the encoder reads the true Wᵀ) yields 0.708 — WORSE than the DFA (no W^T) version (0.834). So weight transport is unnecessary, even harmful; Prizma's claim of biological/neuromorphic fidelity is strengthened.

Causality (ablation): Turning off recognition-routing (noRoute) → FGT 0.000 → 0.489 (returns to the backprop level). The gain comes from modular surprise-routing. Honest nuance (referee): in a sequential-clean stream explicit freezing is unnecessary (routing already does not re-train old experts); the essence of the mechanism is routing + the precision phase detector. Moreover FGT=0 is, given that its preconditions hold, architecturally guaranteed — the real achievement is the unsupervised/local flawless routing that makes it possible.

E2 — Separability sweep (noise blurs the domains; 5 seeds):

noise Prizma ACC Prizma FGT backprop ACC backprop FGT
0.0 0.827 0.000 0.433 0.562
0.3 0.721 0.016 0.299 0.608
0.6 0.557 0.052 0.261 0.508
0.9 0.430 0.073 0.239 0.421
1.2 0.344 0.077 0.222 0.350

Thanks to precision-adaptive recognition, routing stays a clean single-expert-per-domain at every noise level (5 experts committed); FGT stays low. The ACC drop is not from a routing collapse but from the noise making the classification task harder (graceful degradation). Prizma beats backprop at every level.

E3 — Capacity (number of experts vs K=5 domains; 5 seeds): experts=3→ACC 0.556, 4→0.692, ≥5→0.827; FGT=0.000 in all of them. If experts < domains, the new domains cannot be learned (ACC drops) but the old ones are not forgotten — graceful capacity behavior.

E4 — Locality/P2 (is there W^T or not): feedback=random (pure DFA, no W^T) → ACC 0.827 / FGT 0.000; feedback=exact (encoder reads the true Wᵀ) → ACC 0.691 / FGT 0.000. Both forget zero, but DFA gives better accuracy → in this regime weight transport is unnecessary, even harmful. The P2 relaxation is not merely "sufficient" but preferred.

E5 — Impossible-regime control (rotating-checkerboard, ambiguous): the single-output oracle ceiling is 0.780. Prizma ACC 0.570, backprop 0.694 — Prizma does NOT exceed the ceiling (it is even below backprop). So Prizma does not help in the indistinguishable regime and honestly shows that it does not → proof that we understand the boundary.

All numbers are in results/results.json and results/console.txt; reproduced with a single command.


7. Iteration log (develop → test → if it fails, try again)

A real record of the "develop the idea, test it, if it doesn't work try again" loop that the user requested:

  1. v0 — shared-additive readout (learners.py). Both modes collapsed: taskfree barely beat backprop (spurious consolidation + rich-get-richer), boundary over-froze (after task0 all groups froze). Finding: capacity is not reserved.
  2. The benchmark-validity crisis. We measured that rotating-checkerboard is impossible for single-head CL (label overlap ≈0.53). → we moved to the domain-incremental regime.
  3. Permuted-iid-Gaussian also turned out to be indistinguishable (an iid permutation does not change the distribution). → a correlated structured-permuted benchmark.
  4. v1 — soft-responsibility MoE. Uniform collapsed (all experts used at ~1/M, underfit and froze; low FGT for the wrong reason = a collapsed expert).
  5. v2 — ART hard-routing. A forced-commit cascade (underfit early commit → all experts spent on a single domain). Forced-commit was removed; then per-sample vigilance thrashing. → batch-level novelty.
  6. v3 — batch-novelty + phase detector → BREAKTHROUGH: FGT=0.000, ACC=0.80, a clean single-expert-per-domain. But E2 fragility: a sharp collapse at noise=0.3 (the fixed vigilance error).
  7. v4 — precision-adaptive active-expert phase detector. Each expert tracks its own reconstruction precision (μ,σ); novelty = recon > μ+zσ; the active expert learns the domain throughout the whole task, and when the domain changes and it no longer recognizes it, it commits+freezes. Result: robust graceful degradation to noise; routing stays clean at every level.
  8. Adversarial referee round (4 parallel auditors: leakage/cheating, fairness, independent reproduction, overclaim). All returned claim_supported=true (1 SOUND + 3 MINOR_ISSUES; no REFUTED/SERIOUS). The real findings that were fixed: (a) the feedback parameter was not being read → fixed; it turned out that the prototype was always W^T-free — and once fixed, the no-W^T (DFA) version turned out to be better than the W^T version (0.834 > 0.708). (b) the oracle-multihead and replay baselines were added (an honest upper bound + a strong competitor). (c) the framing was made more honest: "FGT=0 is an architectural guarantee once the preconditions hold; the real achievement is the unsupervised/local flawless routing"; "the domains must arrive as contiguous blocks (it collapses to ~0.58 when interleaved)"; parameter accounting, EWC numerical fragility, FD-attribution fixes.

8. Honest assessment — where it works, where it breaks

Works (proven): In an input-distinguishable domain-incremental stream, without a task label/boundary, with fully-local (including DFA) learning, near-zero forgetting + accuracy that beats naive backprop and (task-boundary-using) EWC. The ablation shows that consolidation is causal.

Unsolved / limits (honestly — verified by the adversarial referee panel):

  • FGT=0 is an architectural quasi-tautology; the real achievement is the routing. Once the two preconditions hold (input-distinguishable domains + capacity ≥ domains), once recognition is flawless and the experts are frozen, the diagonal of the accuracy matrix is necessarily equal to the last row → FGT=0 is guaranteed. Therefore the real empirical achievement is not zero-forgetting itself but what makes it possible: unsupervised, online, locally flawless (100%) task-identity inference (from reconstruction surprise) — i.e. matching an oracle multi-head that is given the task identity, without being given the task identity. The document positions it this way; the sentence "beats EWC with zero forgetting" is honest only in this frame.
  • The domains must arrive as contiguous blocks. The phase detector triggers a clean domain transition only when each domain arrives temporally contiguous. In a fully interleaved (mixed) stream Prizma collapses to a single expert and forgetting returns (ACC ~0.58). This is not a hidden task-boundary leak (no boundary label is consumed) and it is a standard assumption for domain-incremental CL, but it must be stated explicitly: what is exploited is the temporal task structure, not the label.
  • P1 (scaling): evidence on a shallow substrate; backprop-parity is not proven. This is a falsifiability gate, not a scaling claim.
  • Ambiguous regime: in the same-input-different-label (checkerboard) case Prizma does not help and should not (the E5 control: it does not exceed the oracle ceiling). Recognition requires distinguishability from the input.
  • Capacity: if experts < domains, the new domains cannot be learned (no forgetting but ACC drops).
  • P2 (weight transport): not solved, relaxed. Moreover the prototype is always W^T-free (the default is DFA); feedback="exact" is provided only to MEASURE the cost of the relaxation.
  • P5 (sampling/calibration): fixed-T Langevin breaks calibration on well-specified data; the benefit is expected only on uncertain/OOD input + with annealed-T (so far narrowly tested).
  • The baseline's numerical fragility: the hand-coded EWC overflows to NaN at λ≥100; the tuner stays in the usable range (λ=50). The comparison is fair in this range.
  • Noise: at very high noise the domains genuinely do not separate → the mechanism inevitably degrades to naive (a fundamental limit, not a bug).

9. Conclusion

Prizma, in the input-distinguishable continual-learning regime, does what similar methods (naive backprop, and even task-boundary-using EWC) cannot: near-zero forgetting without a task boundary or label, fully-locally, in a backprop-free manner. This is a concrete, tested demonstration of the "a single precision-surprise signal driving attention+consolidation at two time scales" synthesis and of the "precision-tested task-boundary-free phase detector" mechanism. Its limits are explicitly marked; scaling stands as an open problem.

Reproduction:  ./.venv/bin/python experiments/run_continual.py   →  results/results.json