residency: no prompt-routing seed for a prefill that routed more than 4096 rows (LELEKA_ORIGINAL_SERVE_SEED_MAX_ROWS, 0 = no cap)
At 45k-247k prompt tokens the seed (default on, keep 0) replaced the ranked profile's resident set by the prompt's top experts and cost 25-35 % of decode on the frozen 245k session: VRAM share 80-85 % against 93-96 % with the seed off, windows 0-20 serving ~240 CPU + ~245 PCIe experts against 23-79 + 13-60, 17.5-20 against 13.4-15.4 ms per round, 107-110 against 132-149 tok/s (turns 1-4; one run each, bin-e2e4, upstream profile). Behaviour for prompts up to 4096 routed rows is unchanged. Placement-only; greedy ids can differ (GPU/CPU rounding). Not yet measured with this binary; the paired evidence is the env switch run of the same code path. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
0a3cda3769
commit
5ef2c6eb7a
@@ -155,6 +155,10 @@ pub(crate) struct ExpertTierConfig {
|
|||||||
/// `_SEED_DECAY`: at each prompt chunk the earlier chunks' counts are multiplied by this (1 = a plain sum over the
|
/// `_SEED_DECAY`: at each prompt chunk the earlier chunks' counts are multiplied by this (1 = a plain sum over the
|
||||||
/// prompt, 0 = the last chunk alone): the end of a long prompt predicts the answer better than its beginning.
|
/// prompt, 0 = the last chunk alone): the end of a long prompt predicts the answer better than its beginning.
|
||||||
pub(crate) seed_decay: f32,
|
pub(crate) seed_decay: f32,
|
||||||
|
/// `_SEED_MAX_ROWS`: no seed for a prompt whose prefill routed more than this many rows through the experts (0 = no cap). The
|
||||||
|
/// prompt's top experts cover only 9-10 % of the decode routing at 16k tokens (docs/original-serve.md), and a 100k+ prompt
|
||||||
|
/// replaces a good starting set with a worse one.
|
||||||
|
pub(crate) seed_max_rows: usize,
|
||||||
}
|
}
|
||||||
impl ExpertTierConfig {
|
impl ExpertTierConfig {
|
||||||
pub(crate) fn off() -> Self {
|
pub(crate) fn off() -> Self {
|
||||||
@@ -179,6 +183,7 @@ impl ExpertTierConfig {
|
|||||||
seed_keep: 0.0,
|
seed_keep: 0.0,
|
||||||
seed_usage: 0.0,
|
seed_usage: 0.0,
|
||||||
seed_decay: 1.0,
|
seed_decay: 1.0,
|
||||||
|
seed_max_rows: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// The tier is on with a slot count or a profile.
|
/// The tier is on with a slot count or a profile.
|
||||||
@@ -260,6 +265,10 @@ impl ExpertTierConfig {
|
|||||||
// Default ON (operator decision: long-running agent sessions; a fresh process starts from the prompt's own
|
// Default ON (operator decision: long-running agent sessions; a fresh process starts from the prompt's own
|
||||||
// routing). `LELEKA_ORIGINAL_SERVE_SEED=off` restores the plain profile start.
|
// routing). `LELEKA_ORIGINAL_SERVE_SEED=off` restores the plain profile start.
|
||||||
config.seed_swaps = super::original_serve_seed::DEFAULT_SEED_SWAPS;
|
config.seed_swaps = super::original_serve_seed::DEFAULT_SEED_SWAPS;
|
||||||
|
// ... but not for a long prompt: at 45k-247k tokens the seed replaced the ranked profile's set by the prompt's top experts and cost 25-35 % of
|
||||||
|
// decode (STRA-245 decode gap, `r-prof` against `r-prof-noseed`: VRAM share 80-85 % against 93-96 %, 107-110 against 135-149 tok/s). Up to
|
||||||
|
// `DEFAULT_SEED_MAX_ROWS` prompt rows the seed behaves as before; `LELEKA_ORIGINAL_SERVE_SEED_MAX_ROWS=0` removes the cap.
|
||||||
|
config.seed_max_rows = super::original_serve_seed::DEFAULT_SEED_MAX_ROWS;
|
||||||
if let Some(v) = var("SEED") {
|
if let Some(v) = var("SEED") {
|
||||||
config.seed_swaps = match v.as_str() {
|
config.seed_swaps = match v.as_str() {
|
||||||
"off" | "no" | "0" => 0,
|
"off" | "no" | "0" => 0,
|
||||||
@@ -276,6 +285,9 @@ impl ExpertTierConfig {
|
|||||||
if let Some(v) = var("SEED_DECAY") {
|
if let Some(v) = var("SEED_DECAY") {
|
||||||
config.seed_decay = v.parse().map_err(|_| Error::InvalidDimension)?;
|
config.seed_decay = v.parse().map_err(|_| Error::InvalidDimension)?;
|
||||||
}
|
}
|
||||||
|
if let Some(v) = var("SEED_MAX_ROWS") {
|
||||||
|
config.seed_max_rows = v.parse().map_err(|_| Error::InvalidDimension)?;
|
||||||
|
}
|
||||||
config.validate()?;
|
config.validate()?;
|
||||||
Ok(config)
|
Ok(config)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ const EXPERTS: usize = 512;
|
|||||||
/// What `LELEKA_ORIGINAL_SERVE_SEED=on` allows: every slot may change (the ranking's own gain floor decides).
|
/// What `LELEKA_ORIGINAL_SERVE_SEED=on` allows: every slot may change (the ranking's own gain floor decides).
|
||||||
pub(crate) const DEFAULT_SEED_SWAPS: usize = 4096;
|
pub(crate) const DEFAULT_SEED_SWAPS: usize = 4096;
|
||||||
|
|
||||||
|
/// The longest prompt (rows routed through the experts by this request's prefill) that is still seeded by default: the "agent-sized prompts up to a few
|
||||||
|
/// thousand tokens" of docs/original-serve.md. Longer prompts measured worse than no seed on the ranked upstream profile.
|
||||||
|
pub(crate) const DEFAULT_SEED_MAX_ROWS: usize = 4096;
|
||||||
|
|
||||||
/// One request's seed, for the operator's lines and the experiments.
|
/// One request's seed, for the operator's lines and the experiments.
|
||||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||||
pub(crate) struct SeedReport {
|
pub(crate) struct SeedReport {
|
||||||
|
|||||||
@@ -1243,6 +1243,16 @@ impl<'a, 'ctx> OriginalServeStack<'a, 'ctx> {
|
|||||||
let (max, keep, usage) = (tier.seed_swaps, tier.seed_keep, tier.seed_usage);
|
let (max, keep, usage) = (tier.seed_swaps, tier.seed_keep, tier.seed_usage);
|
||||||
let Some(cache) = self.expert_cache.as_mut() else { return Ok(()) };
|
let Some(cache) = self.expert_cache.as_mut() else { return Ok(()) };
|
||||||
let started = Instant::now();
|
let started = Instant::now();
|
||||||
|
let max_rows = tier.seed_max_rows;
|
||||||
|
if max_rows > 0 {
|
||||||
|
let rows = original_serve_seed::summarize(counts, &[]).rows;
|
||||||
|
if rows > max_rows as u64 {
|
||||||
|
if std::env::var_os("LELEKA_SEED_TRACE").is_some() {
|
||||||
|
eprintln!("DBG seed: skipped, the prompt routed {rows} rows (cap {max_rows})");
|
||||||
|
}
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
}
|
||||||
let swaps = original_serve_seed::plan(counts, cache, max, keep);
|
let swaps = original_serve_seed::plan(counts, cache, max, keep);
|
||||||
let planned = started.elapsed();
|
let planned = started.elapsed();
|
||||||
let mut report = original_serve_seed::summarize(counts, &swaps);
|
let mut report = original_serve_seed::summarize(counts, &swaps);
|
||||||
|
|||||||
@@ -419,3 +419,8 @@ Recommendation: keep it off by default; enable it (`=on`) for chat- and agent-si
|
|||||||
where the answer continues the prompt's domain, on both machines; it is a loss-free no-op (+0.1 s) on long prompts, so a
|
where the answer continues the prompt's domain, on both machines; it is a loss-free no-op (+0.1 s) on long prompts, so a
|
||||||
length cap is a choice, not a need. Not measured: a real multi-turn agent loop, where the conversation cache already skips
|
length cap is a choice, not a need. Not measured: a real multi-turn agent loop, where the conversation cache already skips
|
||||||
most of the prefill (the seed then sees only the new rows).
|
most of the prefill (the seed then sees only the new rows).
|
||||||
|
|
||||||
|
**Long prompts (STRA-245 decode gap, 2026-10-29, `claude/decode-tail`).** On the frozen 5-turn 245k session (prompts 45,766 / 105k / 153k / 199k / 247k tokens, RTX 5090, upstream ranked profile sha256 `8f59b4aa...`, 11,280 slots, `bin-e2e4`, 300 greedy tokens per turn) the seed
|
||||||
|
hurt: with the seed (default) the VRAM share of routed entries was 80-85 %, windows 0-20 of every request served about 230-250 CPU and 230-255 PCIe experts, 17.5-20 ms per round, 107-110 tok/s; with `LELEKA_ORIGINAL_SERVE_SEED=off`
|
||||||
|
93-96 %, 23-79 CPU experts in windows 0-20, 13.4-15.4 ms per round, 132-149 tok/s (turn 5 of both arms stalled on the PLE reads, a host-memory artifact, and is not counted). The seed keeps `keep=0`, so at 45k+ rows it replaces the profile's good set by the prompt's top experts (9-10 % of the decode routing, as measured at 16k above).
|
||||||
|
`LELEKA_ORIGINAL_SERVE_SEED_MAX_ROWS` (default 4096; 0 = no cap) now skips the seed for a prefill that routed more rows than that; below it nothing changes. Placement-only change: GPU and CPU round differently, so greedy ids are not invariant to it (see Quality above).
|
||||||
|
|||||||
Reference in New Issue
Block a user