SELFLEARNReal-Time Loop OperationVERIFIEDStg 1Stg 2

Cascaded Online Self-Learning Residual Refiner

Cascaded Global Online Adaptive Filter (single-model RLS) and Clustered State-Dependent Self-Learning (libgric) on top of Fixed-Basis Block-EOF.

Overview & Role

Runs strictly as a bounded residual refiner cascaded on top of Fixed-Basis Block-EOF (u_total = u_EOF + delta_u_global + delta_u_cluster) inside cacao-fpsexec-cacaopc-selflearn. Layer 1 (SL/GLOBAL, Global Online Adaptive Filter) learns a single continuously updated per-mode RLS residual model shared across all operating states; Layer 2 (SL/CLUST, Clustered State-Dependent Self-Learning) uses online libgric clustering (K <= 12 state clusters) to track regime-dependent nonlinear optical-gain distortion (unmodulated PyWFS) and changing vibrations without forgetting prior regimes.

Every residual layer is guarded by an independent causal James-Stein shrinkage gate computed from rolling out-of-sample prediction error. On the 40 nm pure white-noise null test, both gates close to 0.00 / 0.00, leaking only 1.43 nm RMS DM noise (1.000x null amplification) — in stark contrast to standalone self-learning without Block-EOF, which degrades pure turbulence (33.5 vs 19.2 nm) and leaks 18.35 nm (1.10x noise amplification). Must remain in the fixed outer modal basis.

Compute Units / Entry Points: cacao-fpsexec-cacaopc-selflearnselflearn_core.clibgric

Verified Highlights:

Option Variants (CODE/OPT)

Option CodeBehavior & UsageMain Flags
SL/GLOBALGlobal Online Adaptive Filter (single-model K=1 RLS + causal Stein gate) cascaded on Block-EOF for fast tracking of global gain drift and shared dynamics.--predictive --pf-mode
SL/CLUSTClustered State-Dependent Self-Learning (libgric K<=12 clusters + per-cluster RLS + causal Stein gates) cascaded on top of Global Online Adaptive Filter.--predictive --pf-mode

Dependencies & Calibration Chain

Selected Algorithm
★ Current Entry
SELFLEARNRT Operation
Cascaded Online Self-Learning Residual Refiner
Feeds & Enables Downstream
Interaction / Exclusion Note: Do NOT run self-learning standalone (without Block-EOF): standalone RLS leaks 18.35 nm (1.10x) on pure white noise and degrades pure turbulence (33.5 vs 19.2 nm). Always cascade SELFLEARN on Fixed-Basis Block-EOF and keep inner CMODES basis rotations strictly decoupled inside modalfilter.

CLI Flags, Environment Variables & FPS Parameters

LayerOption (Links to Reference)DefaultDescription
CLI Flag--predictiveOFFEnable PSOL predictive control on Stage 1 (AO3k) and Stage 2 (SCExAO)
CLI Flag--pf-modearPredictive filter architecture: ar (diagonal) or eof (block cross-mode)
CACAO_* EnvCACAO_SELFLEARN_ENABLE0Cascade cacaopc-selflearn (Global + Clustered libgric RLS) downstream of applyEOFPF (0/1)
CACAO_* EnvCACAO_SELFLEARN_MODES128Maximum modal dimension tweaked by cacaopc-selflearn
CACAO_* EnvCACAO_SELFLEARN_KMAX16Maximum libgric cluster anchors maintained by cacaopc-selflearn
CACAO_* EnvCACAO_SELFLEARN_KEYMODE0GRIC state key mode (0=TT2_E2, 1=E1, 2=WFS_LO4, 3=TT2_DM2_E2, 4=REGIME)
CACAO_* EnvCACAO_SELFLEARN_QSHARED2Shared low-order cross-mode feature count in cacaopc-selflearn (0..8)
CACAO_* EnvCACAO_SELFLEARN_RLIM2.0GRIC cluster spawn radius in standardized key space
CACAO_* EnvCACAO_SELFLEARN_MAX_WFS_GAIN0.40Physical stability cap on learned WFS optical-gain weight
CACAO_* EnvCACAO_SELFLEARN_LAM020.0Level-0 global online RLS ridge regularization in cacaopc-selflearn
CACAO_* EnvCACAO_SELFLEARN_LAM1200.0Level-1 per-cluster RLS shrinkage ridge in cacaopc-selflearn
CACAO_* EnvCACAO_SELFLEARN_MAX_TWEAK0.25Hard per-mode absolute tweak clamp [modal units] in cacaopc-selflearn
CACAO_* EnvCACAO_SELFLEARN_NWARMUP40Per-cluster shrinkage warmup frame count in cacaopc-selflearn
CACAO_* EnvCACAO_SELFLEARN_KEYWARMUP200Key standardization warmup frame count in cacaopc-selflearn
CACAO_* EnvCACAO_SELFLEARN_NL_MODE0Nonlinear PyWFS basis (0=linear, 1=+odd sat/OG/TT, 2=+shared WFS xtalk)
CACAO_* EnvCACAO_PF_MODEarPredictive filter mode: 'ar' (diagonal AR) or 'eof' (block cross-mode EOF)
CACAO_* EnvCACAO_PF_BLOCKSIZE128Block-EOF coupled modal block size B
CACAO_* EnvCACAO_PF_ORDER8Predictive filter temporal tap lookback order P
FPS (cacao)selflearn.inbasePF—optional external Stage-1 PF prediction stream
FPS (cacao)selflearn.nl_mode00=linear phi, 1=+odd PyWFS NL terms, 2=+shared WFS xtalk
FPS (cacao)selflearn.key_mode00=TT2_E2, 1=E1, 2=WFS_LO4, 3=TT2_DM2_E2, 4=REGIME, 5=EXT
FPS (cacao)selflearn.NBmodeMax64max modal dimension tweaked
FPS (cacao)selflearn.kmax16max GRIC cluster anchors (1..64)
FPS (cacao)selflearn.rlim2.0GRIC cluster spawn radius in standardized key space
FPS (cacao)selflearn.lam020.0Level-0 global RLS prior ridge
FPS (cacao)selflearn.lam1200.0Level-1 per-cluster RLS prior ridge
FPS (cacao)selflearn.gamma00.998Level-0 RLS exponential forgetting factor
FPS (cacao)selflearn.gamma10.995Level-1 RLS exponential forgetting factor
FPS (cacao)selflearn.gate_eta0.995causal OOS Stein gate EMA decay
FPS (cacao)selflearn.max_wfs_gain0.5physical stability cap on WFS weight
FPS (cacao)selflearn.max_tweak0.25hard per-mode absolute tweak clamp [modal units]
FPS (cacao)selflearn.shadowOFFshadow mode: learn & score OOS without applying tweak
FPS (cacao)selflearn.enable_l0ONapply Level-0 global online RLS correction
FPS (cacao)selflearn.enable_l1ONapply Level-1 GRIC cluster-specific correction
FPS (cacao)selflearn.apply_gain1.0live scalar blend multiplier [0..1] on tweak
FPS (cacao)selflearn.out.alpha_l00.0live causal OOS Stein gate for Level 0 [0..1]
FPS (cacao)selflearn.out.alpha_l10.0live causal OOS Stein gate for Level 1 [0..1]

Implementation, Tests & Related Reports

Source Files

Verification Tests

Related Staged Technical Reports