dflash2 coupled walk: Q at temperature 0.6 by default

Q's temperature (RADIANCE_DFLASH_Q_TEMP) only moves acceptance, never the
output law. Held-out tokens per verify step at request temperature 1, x4,
32 rows of the eval set, Qwen3.8-27B MXFP4 with a DFlash2 drafter fine-tuned on our traffic, our serving flags:
ordinary rule 3.52; coupled with Q at 1.0 3.71, 0.7 3.88, 0.5 3.85,
0.35 3.77. The walk's scores are flatter than the target's law, so a
sharper Q puts its mass where the target's is; 0.6 is the default now.

At 0.6, 3 interleaved rounds against the ordinary rule (64 held-out rows
at x4, and three requests at x1 and x4, 1500 tokens, T 1):
- tokens per step 3.53 -> 3.82 (+8.2 %), every round apart
  (3.50/3.49/3.61 vs 3.82/3.79/3.86); time-weighted decode +5.4 %;
- decode per stream: 0.7k prompt x1 174.1 -> 181.7 (+4.4 %), x4 144.6 -> 153.8
  (+6.4 %); 22k prompt x1 186.6 -> 191.0 (+2.3 %), x4 135.1 -> 146.2 (+8.2 %);
  41k prompt x1 186.9 -> 196.8 (+5.3 %), x4 125.8 -> 135.0 (+7.3 %);
  aggregate at x4 +5.3..+5.5 %.
Coupled at 0.6 against the ordinary rule, 5000-6000 samples of tokens 1-4
of two chat prompts: chi-square p 0.62..0.99.

The walk's kernel issues each candidate's successor slice and unary score
before the predecessor's codebook row (both are independent of it). This is
the build measured above; it moved the pass time within noise (91.3 -> 90.8
us at M 16, steps 7), and tokens, ids, x and status still match the host
oracle on all 40 random lattices (q by FP64 exp ulps, <= 4.3e-16).

ctest (the environment-only tests excluded) 105/105.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
mici81andClaude Opus 5.5 authored and StillDeadcode committed 2026-10-27 18:37:28 +01:00
1 parent cb0abe9ac7
commit ce79b12126
3 files changed
+26 -16

No files matched your search

+19 -13
View File
@@ -199,6 +199,20 @@ __global__ __launch_bounds__(kDfThreads) void dflash_couple(
const int c = tid / RAD_DFLASH_EDGE_PARTS, j = tid % RAD_DFLASH_EDGE_PARTS;
for (int64_t l = 0; l < steps; ++l) {
const int64_t row = s * steps + l;
/* What does not depend on the predecessor is loaded first, so its latency overlaps the
* predecessor's codebook row: the candidate, its successor slice and its unary score. */
const int32_t id = c < K ? cand[row * ld_cand + c] : -1;
const bool id_ok = id >= 0 && id < vocab;
const bool wide = R == 32 * RAD_DFLASH_EDGE_PARTS;
uint4 v[4] = {};
if (id_ok && wide) {
/* DFlash2's rank 256: the slice's 32 values in four 16-byte loads issued together. A
* load inside the fmaf chain would wait out one memory latency per element. */
const uint4* src = reinterpret_cast<const uint4*>(succ + (int64_t)id * R + j * 32);
#pragma unroll
for (int i = 0; i < 4; ++i) v[i] = src[i];
}
const float un = tid < K ? unary[row * ld_unary + tid] : 0.0f;
const int32_t pid = spid;
const bool ok = pid >= 0 && pid < vocab;
for (int64_t r = tid; r < R; r += kDfThreads)
@@ -207,24 +221,16 @@ __global__ __launch_bounds__(kDfThreads) void dflash_couple(
: 0.0f;
__syncthreads();
if (c < K) {
const int32_t id = cand[row * ld_cand + c];
float pv = 0.0f;
if (id >= 0 && id < vocab) {
const uint16_t* srow = succ + (int64_t)id * R;
if (R == 32 * RAD_DFLASH_EDGE_PARTS) {
/* DFlash2's rank 256: the slice's 32 values in four 16-byte loads issued
* together, then rad_dflash_edge_part's fmaf chain over them in its order. A
* load inside the chain would wait out one memory latency per element. */
const uint4* src = reinterpret_cast<const uint4*>(srow + j * 32);
uint4 v[4];
#pragma unroll
for (int i = 0; i < 4; ++i) v[i] = src[i];
if (id_ok) {
if (wide) {
/* rad_dflash_edge_part's fmaf chain over the slice, in its order. */
const uint16_t* h = reinterpret_cast<const uint16_t*>(v);
const float* a = sa + j * 32;
#pragma unroll
for (int r = 0; r < 32; ++r) pv = fmaf(a[r], rad_dflash_bf2f(h[r]), pv);
} else {
pv = rad_dflash_edge_part(sa, srow, R, j);
pv = rad_dflash_edge_part(sa, succ + (int64_t)id * R, R, j);
}
}
part[tid] = pv;
@@ -237,7 +243,7 @@ __global__ __launch_bounds__(kDfThreads) void dflash_couple(
if (sid[tid] >= 0 && sid[tid] < vocab)
for (int q = 0; q < RAD_DFLASH_EDGE_PARTS; ++q)
acc += part[tid * RAD_DFLASH_EDGE_PARTS + q];
sc[tid] = unary[row * ld_unary + tid] + acc;
sc[tid] = un + acc;
}
if (tid < 8) slot_id[tid] = -2;
__syncthreads();