diff options
Diffstat (limited to 'ep_run/lt_ep_train.py')
| -rw-r--r-- | ep_run/lt_ep_train.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ep_run/lt_ep_train.py b/ep_run/lt_ep_train.py index 9974bd8..4e7b8b1 100644 --- a/ep_run/lt_ep_train.py +++ b/ep_run/lt_ep_train.py @@ -229,9 +229,10 @@ def ep_step(blk, idx, y, T1, T2, eps, beta, jacreg=0.0, holo=0, hr=0.02, t1max=0 for p, g in zip(blk.block, grr): if g is not None: grads[id(p)] = g * lam if grads.get(id(p)) is None else grads[id(p)] + lam * g - if eigreg > 0: # #2: leading-abscissa control (surgical, one-sided; alt to jacreg) - from eig_control import eig_penalty - ge, _om = eig_penalty(blk, zs, eigreg, eig_margin, blk.__dict__.setdefault('_eigcache', {})) + if eigreg > 0: # #2 v2: TRUE leading map-eigenvalue control (aep 'spectral', soft one-sided) + from eig_control import spec_penalty # (omega/numerical-abscissa version refuted 2026-07-03, eig_recheck) + ge, _rho, _mu = spec_penalty(blk, zs, eps, blk.c, eigreg, eig_margin, + blk.__dict__.setdefault('_eigcache', {})) for pid, g in ge.items(): grads[pid] = g if grads.get(pid) is None else grads[pid] + g return grads, res @@ -375,8 +376,8 @@ def main(): ap.add_argument('--res_gate', type=float, default=0.0) # validity gate: skip task grads above this res ap.add_argument('--wsd', type=float, default=0.0) # WSD: hold peak lr, cosine-decay only the last wsd fraction ap.add_argument('--resreg', type=float, default=0.0) # T1-residual penalty: defend z_T1 (cap ratio vs task grad); run res_gate=0 - ap.add_argument('--eigreg', type=float, default=0.0) # #2: leading-abscissa (numerical-abscissa) control — surgical alt to jacreg - ap.add_argument('--eig_margin', type=float, default=1.0) # penalize omega(J_nc) above this (free-phase Hopf boundary ~ 1+c) + ap.add_argument('--eigreg', type=float, default=0.0) # #2 v2: soft penalty on TRUE |lam|_lead(I+eps*J_F) — aep 'spectral' at C512 + ap.add_argument('--eig_margin', type=float, default=0.995) # rho target: penalize |lam|_lead above this (<1 = contracting relaxation map) ap.add_argument('--diag_cos', type=int, default=0) # #1: every N steps, log cos(EP grad, exact BPTT grad) + res ap.add_argument('--fingerprint', action='store_true') # load --init_ckpt, print (res,cos,abscissa,val) fingerprint, exit ap.add_argument('--opt', choices=['adamw', 'lion', 'lionlars', 'sgdm', 'sgdsai'], default='adamw') @@ -522,7 +523,7 @@ def main(): from diag_cos import fingerprint fp = fingerprint(blk, cfg.T1, cfg.T2, cfg.eps, cfg.beta, cfg.holo, cfg.hr, cfg.t1max, cfg.res_est, cfg.t2sel) print(f"[fingerprint] ckpt={cfg.init_ckpt or 'scratch'} | res={fp['res']:.2e} cos(EP,BPTT)={fp['cos']:.4f} " - f"num_abscissa={fp['num_abscissa']:+.4f} val={fp['val']:.4f}", flush=True) + f"rho={fp['rho']:.5f} Re_mu={fp['mu_re']:+.4f} val={fp['val']:.4f}", flush=True) return for step in range(start_step, cfg.steps + 1): idx, y = get_batch('train', cfg.B, cfg.T) |
