test(bring-up): parity corpus and per-row head logprob trace for the Original serve smoke
- backend_original_serve_smoke.rs: LELEKA_SMOKE_PROMPTS (one text prompt per line) is tokenized with the verified tokenizer, served greedily for LELEKA_SMOKE_MAX_NEW tokens (LELEKA_SMOKE_MIN_P sets spec_min_p) and printed as ids so the Original (strata --tokens-file ...) can be run on the same ids. - original_serve_native.rs: LELEKA_TRACE_LOGPROBS=<k> prints the top-k head logprobs of every row of each completed verify window through OriginalVerifier::window_logprobs_topk (same format as the Original's STRATA_LOGPOS/STRATA_LOGPOS_TOPK). First measurements against the Original (5 prompts, 64 greedy tokens, same settings): identical on 1 prompt, divergences on the others after 4..28 tokens; per-row top-8 logprobs differ by a median of about 0.4 (max 2.3). Not parity; investigation continues. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
b83aa347ea
commit
aae33d8b5e
@@ -148,6 +148,23 @@ fn original_serve_smoke_prompt_decode_mtp_verify_commit_reset_cancel_sample() {
|
||||
.unwrap_or_else(|e| panic!("request after a cancellation failed: {e:?}"));
|
||||
assert_eq!(after, runs[0], "a cancelled request must not disturb the next one");
|
||||
|
||||
// 3b. parity corpus: every line of LELEKA_SMOKE_PROMPTS (text) is tokenized with the verified tokenizer, served greedily
|
||||
// for LELEKA_SMOKE_MAX_NEW tokens (default 64) and printed as ids so the Original can be run on the same ids.
|
||||
if let Some(path) = env::var_os("LELEKA_SMOKE_PROMPTS") {
|
||||
let max_new: usize = env::var("LELEKA_SMOKE_MAX_NEW").ok().and_then(|v| v.parse().ok()).unwrap_or(64);
|
||||
let text = std::fs::read_to_string(path).expect("prompt corpus unreadable");
|
||||
for (index, line) in text.lines().filter(|l| !l.trim().is_empty()).enumerate() {
|
||||
let ids = tokenizer.encode(line, true).expect("corpus tokenization failed");
|
||||
eprintln!("DBG corpus {index} prompt_ids ({}): {}", ids.len(), ids.iter().map(|t| t.to_string()).collect::<Vec<_>>().join(","));
|
||||
let mut out = Vec::new();
|
||||
let min_p: f32 = env::var("LELEKA_SMOKE_MIN_P").ok().and_then(|v| v.parse().ok()).unwrap_or(0.0);
|
||||
let corpus_request = ServeRequest::new(ids.iter().map(|&t| t as i32).collect(), max_new, None, 7, min_p, vec![eos as i32]);
|
||||
match stack.serve(&corpus_request, &mut |round| { out.extend_from_slice(round); Ok(()) }, &mut || false) {
|
||||
Ok(outcome) => eprintln!("DBG corpus {index} output ({} tokens, rounds {}): {}", out.len(), outcome.rounds, out.iter().map(|t| t.to_string()).collect::<Vec<_>>().join(" ")),
|
||||
Err(e) => eprintln!("DBG corpus {index} FAILED {e:?} health={:?}", stack.health()),
|
||||
}
|
||||
}
|
||||
}
|
||||
// 4. a short prompt (<= 64 tokens) takes the scalar draft-KV path of the Original; report instead of asserting
|
||||
eprintln!("DBG[{:.0}s] smoke: short-prompt request ({} tokens)", dbg_el(), short_prompt.len());
|
||||
let mut short_out = Vec::new();
|
||||
|
||||
@@ -128,6 +128,15 @@ where R:OriginalVerifyGraphResources<'ctx>+OriginalNativeHeadGraphResources<'ctx
|
||||
&&result.selection.position()==position as u64;
|
||||
if !ok {self.failed=true;return Err(Error::IdentityMismatch);}
|
||||
let ids=result.selection.ids().to_vec();
|
||||
// Bring-up diagnostic (LELEKA_TRACE_LOGPROBS=<topk>): top-k head logprobs of every row of the completed window.
|
||||
if let Some(k)=std::env::var("LELEKA_TRACE_LOGPROBS").ok().and_then(|v|v.parse::<usize>().ok()).filter(|k|*k>0) {
|
||||
let mut line:Vec<u8>=Vec::new();
|
||||
eprintln!("DBG logprobs window position={position} inputs={inputs:?} argmax_ids={ids:?}");
|
||||
match self.verifier.window_logprobs_topk(&ids,-1,k,&mut line) {
|
||||
Ok(())=>eprintln!("{}",String::from_utf8_lossy(&line).trim_end()),
|
||||
Err(e)=>eprintln!("DBG logprobs err {e:?}"),
|
||||
}
|
||||
}
|
||||
Ok(NativeWindow{generation:result.generation,position,rows:t,ids,inputs:inputs.to_vec(),
|
||||
selection:RefCell::new(Some(result.selection)),keep:None})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user