Files
M1kep-KepPromptLang/lib/actions
Claude 3dddbe1671 Add proj, reject, renorm, noise, nearest actions and lerp alias
proj(a|b)    - project a onto the (mean, unit) direction of b
reject(a|b)  - a minus that projection (orthogonal component)
renorm(a|ref)- rescale a so each token's L2 norm matches ref's mean L2
noise(a|std) - a + N(0, std)
nearest(e|k) - snap mean(e) to its k nearest vocab tokens (cosine sim)
lerp(a|b|t)  - alias for avg(a|b|t)

All follow the existing MultiArgAction pattern; nearest reuses the
embedding-weight cosine machinery the Inspect node uses. Nine new
tests cover the math invariants (proj+reject reconstructs input,
reject is orthogonal to b, renorm matches ref norm, noise(_, 0) is
identity, nearest of a single token returns that token).

Relax MultiArgAction/SingleArgAction __init__ type hints to List
since SegOrAction now includes WeightedGroup and the Union isn't
importable in base.py without a cycle.
2026-04-12 06:02:00 +00:00
..