You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Redesign PosEncoding: counter in its own column, exact 1.0 query constant
Move the raw position counter out of the slowest-sin slot into its own
last column (counter_col = d_pos-1), leaving a complete sin/cos block
(trig_width = d_pos-1) and requiring odd d_pos. This decouples the
encoding width from d_head and removes the slow-cosine "almost one"
that several attention primitives leaned on.
- pos_encoding: add trig_width/trig_slice/counter_col; reject even d_pos;
rename get_pos_delta_matrix -> trig_shift_matrix (row convention, key
matrix numerically identical to before); drop slow_sin_freq and the
dead get_position_scalar max_pos arg.
- get_prev_value: rebuild on an exact LiteralValue([1.0]) query plus
raw-counter recency, documenting the TF32 max_pos=256 budget. The old
query "constant" was the sum of every sinusoid at the query position,
which is negative at ~19% of the first 2048 positions and inverted the
recency ordering there.
- attention_ops: switch all query-side constants from the slow cosine
(now overwritten by the counter) to LiteralValue([1.0]); shrink the
selection heads' d_qk to 1-2 so it no longer scales with d_pos, and
auto-split value pass-through (drop the len(value) <= d_pos cap).
- compiler: auto-create PosEncoding(17); validate d_head >= trig_width
early with an actionable error; copy heads zero the counter column
explicitly (trig-only self-match); affine rule reads counter_col.
create_pos_encoding now returns PosEncoding(17) (16 trig columns + 1
counter), whose trig_width matches the default d_head=16.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments