Expand description
Prism/Bonsai signed FWHT activation boundary.
Prism matrices carry an explicit signed-Hadamard activation boundary: the
source checkpoint folds D·H into every forward matrix and stores the
embedding twin in the inverse basis. Keep the transform in one small
module so CPU fallback, tests, and GPU paths share one typed header.
Functions§
- forward
- Transform an activation row before a forward Prism matrix:
x·D·H. The source contract requests an f16 boundary after the FWHT; keeping that cast here makes the CPU implementation agree with the trained MLX path. - forward_
weight - Apply the forward basis only to a manifest-listed matrix. This is the
mixed-profile counterpart of
forward: ordinary q2tp may retain q4tp for attention/down projections, but those matrices are still stored in the same signed-Hadamard basis as the production Prism profile. - has_
contract - True when this tensor belongs to a Prism header, regardless of whether it is a forward or inverse matrix. GPU graph/device paths use this as a conservative safety gate because they do not carry the transform descriptor yet.
- inverse_
embedding - Transform a decoded embedding row back to the caller basis:
z·H·D. - is_
affine_ target - Whether this exact canonical matrix carries the production affine
correction. Ordinary Prism q2tp and non-Prism dtype16 remain the raw
(c - 1.5) * scodec; no correction is inferred from the architecture name or from the tensor dtype alone. - is_
forward_ weight - Whether this named matrix is one of the source’s forward-basis weights. Vision tensors and auxiliary projections are intentionally not included.
- is_
inverse_ embedding - The source manifest names are wrapper-qualified, while CMF stores the
canonical runtime name. The embedding is the only inverse matrix in the
Prism checkpoint; all other projections use
forwardactivations. - perf_
report - Aggregate the CPU-side signed-Hadamard work for one bounded benchmark. This is deliberately opt-in and does not sample or print in the hot path.
- profile_
report - Print cache/validation counters for a bounded benchmark. The report is opt-in so normal CLI output and production hot paths remain unchanged.