Context
AGENTS.md step 4 asks for deterministic argmax, then seeded
sampling, then KV-cache. Section 17 locked greedy index
selection. Randomness is a Phase 2 effect. A sample primitive
would invent an in-graph PRNG that Phase 0 does not define.
Top-k / top-p need sort, which is also unspecified.
Tensor-literal payloads are discarded, so uniforms and temperature must be host tensors.
Decision
Specify categorical sampling as the existing composition in
18-seeded-sampling.md:
host-provided Uniform(0, 1) noise, host temperature, Gumbel-max
(-log(-log(u))), then Section 17 argmax. No new operator.
The seed lives on the host. Do not add top-k, top-p, or a
Random effect in this slice.
Consequences
storylm0_sample.kinaand a.sonumeric check land. Host padded broadcast now maps size-1 source dims to affine0so the[1, 1]temperature stand-in lowers to[1, 4, 8].- Visitors can see a typed seeded sample; they still cannot draw uniforms inside Kina.
- The 32-token sampled loop is
Section 23.
Top-k / top-p and Phase 2
Randomremain follow-on work.