[Proto] DSpark n_draft tuned to measured optimum (2) + VETTA_SPEC_ND A/B override
Federico hypothesis 'fix drafter at 5, see if it rises' -> MEASURED NO. Sweep on real capital prompt GEN 96 (gfx1150), decode tok/s: nd=1 5.25, nd=2 6.09, nd=3 5.78, nd=4 5.54, nd=5 4.58, nd=7 5.15. At ~30-50% acceptance a larger verify batch (B=nd+1) wastes compute on rejected drafts; nd=2 is the optimum. Retune the EMA governor to start at n_draft=2 and escalate only at very high acceptance (>=0.75 -> 4, >=0.9 -> 7). Adaptive run now lands nd=2: decode 6.10 tok/s, ON 4.59 vs OFF 3.97 tok/s total (~1.16x). VETTA_SPEC_ND fixes n_draft for A/B measurement. serve_gen_spec_multi_token_parity still EXACT (16 reference tokens). CPU -D warnings clean, gw GPU 22/22.
This commit is contained in:
1 parent
df537bf84f
commit
ba5149956e
1 file changed
+9
-3
@@ -568,7 +568,13 @@ pub fn serve_gen(
|
||||
return;
|
||||
}
|
||||
let mut cur_pos = pos; let mut next_tok = tok0;
|
||||
let mut ema = 0.5f32; let mut n_draft = 7usize;
|
||||
// Measured optimum on real text (gfx1150, GEN 96): n_draft=2 gives the best
|
||||
// decode tok/s (6.09) vs 3=5.78, 4=5.54, 5=4.58, 7=5.15, 1=5.25 — at ~30-50%
|
||||
// acceptance a larger verify batch wastes compute on rejected drafts. Start
|
||||
// at 2 and escalate only when acceptance is very high (cost-aware governor).
|
||||
let mut ema = 0.5f32; let mut n_draft = 2usize;
|
||||
// VETTA_SPEC_ND fixes n_draft (bypasses the EMA) for A/B measurement.
|
||||
let nd_override = std::env::var("VETTA_SPEC_ND").ok().and_then(|v| v.parse::<usize>().ok());
|
||||
let mut offered = 0usize; let mut accepted = 0usize; let mut rounds = 0usize;
|
||||
if tok0 == eng.eos {
|
||||
finish = "stop";
|
||||
@@ -582,7 +588,7 @@ pub fn serve_gen(
|
||||
return;
|
||||
}
|
||||
let left = effective_max_new - generated;
|
||||
let nd = n_draft.min(left.saturating_sub(1));
|
||||
let nd = nd_override.unwrap_or(n_draft).min(left.saturating_sub(1));
|
||||
let (em, nc, nt, done) = match spec_round(&eng.cache, &eng.d, dw, &mut dc, &mut states[..], cur_pos, next_tok, nd, eng.vocab, cap, left, |t| t == eng.eos) {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
@@ -603,7 +609,7 @@ pub fn serve_gen(
|
||||
if nd > 0 {
|
||||
let acc = (em.len().saturating_sub(1)) as f32 / nd as f32;
|
||||
ema = 0.9 * ema + 0.1 * acc;
|
||||
n_draft = if ema >= 0.5 { 7 } else if ema >= 0.3 { 4 } else { 2 };
|
||||
n_draft = if ema >= 0.9 { 7 } else if ema >= 0.75 { 4 } else { 2 };
|
||||
offered += nd; accepted += em.len().saturating_sub(1);
|
||||
}
|
||||
rounds += 1;
|
||||
|
||||
Reference in new issue
Block a user