Experiments #167
A fused top-64 select for the 2-bit head shortlist: row 67c's `r67cScores` (`src/transformer.zig:4564`)...
done
What was tested
A fused top-64 select for the 2-bit head shortlist: row 67c's `r67cScores` (`src/transformer.zig:4564`) negates the 162,489 2-bit scores and calls `mlx_argpartition_axis`, which runs as MLX's multi-block Folding the adapter's changes into the base weights to get one ordinary model. sort (`merge_mbsort`, `partition_mbsort`, 131 us a step), then builds a 162,489-wide -1e30 row with `mlx_full` and `mlx_put_along_axis` that the head argmax reads whole (58 us); a Lesto kernel that keeps each threadgroup's 64 largest and merges them once, and an argmax over the 64 rescored values only, with the argpartition's own tie order (read from MLX's sort, then checked against it on captured rows), so the reply is unchanged; step 1 a kernel test against `mlx_argpartition` on captured 2-bit rows, then the 50-session identity count, then a pair
Model and setup
the best
Expected gain
about +1.0% to +1.8% The writing phase: the model produces the reply one token at a time. Read more (0.10 to 0.19 ms of 10.4 ms at 8k; **measured** cost, **estimate** of the kernel's own time)
Where the idea came from
rows 67c, 165
Outcome
done 2026-11-19: A valid experiment that did not beat the best score by more than the noise.; lossless (150 of 150), decode +0.59% [+0.57, +0.62] against the 0.7% line (`mac/167/1`), about 61 us a step of the 100 to 190 estimated; `row/167` kept for a stacked lossless pair; shortfall split in row 167p (`2026-11-19-mac-r167-topk-select/README.md` ยง Result, row 167)
Lesson
replacing the shortlist's full merge sort and full-row argmax with a fused top-64 select and a 64-wide argmax keeps every reply and shortens the decode step by about 61 us (+0.59% [+0.57, +0.62]), a third to two thirds of the estimate, because the fused select's first pass (80 threadgroups each bitonic-sorting 2,048 scores) runs 106 us by itself.
Adopted
no (no-gain under the pre-registered +0.7%; lossless and measured, so `row/167` stays for the next stacked lossless pair, beside rows 159z and 156g)