perf(serve): prompt-routing seed is on by default when the tier config is read from the environment (LELEKA_ORIGINAL_SERVE_SEED=off disables)

Operator decision: long-running agent sessions; a fresh process starts from the prompt's own routing. Measured first-request gain: docs/original-serve.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Pavlo Ratushnyi
2026-10-17 18:31:11 +02:00
co-authored by Claude Sonnet 5.5
parent 0b0d128fe2
commit 6b94e7c14f
2 changed files with 5 additions and 2 deletions
@@ -97,7 +97,7 @@ pub(crate) struct ExpertTierConfig {
pub(crate) resident_budget_gib: f64,
/// EXPERIMENTAL, port-only (`LELEKA_ORIGINAL_SERVE_SEED`): at the end of each request's prompt phase the experts the
/// prompt's own prefill routed to replace the least-routed resident ones, in one batch of at most this many swaps
/// (0: off, the default). See `original_serve_seed`.
/// (0: off). Default when the configuration comes from the environment: `DEFAULT_SEED_SWAPS` (on); `ExpertTierConfig::off()` keeps 0. See `original_serve_seed`.
pub(crate) seed_swaps: usize,
/// `_SEED_KEEP`: routed-row credit given to every resident expert when ranking the seed's swaps (the blend with the
/// starting profile; 0 = the prompt's counts alone).
@@ -206,6 +206,9 @@ impl ExpertTierConfig {
if let Some(v) = var("RESIDENT_BUDGET_GIB") {
config.resident_budget_gib = v.parse().map_err(|_| Error::InvalidDimension)?;
}
// 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.
config.seed_swaps = super::original_serve_seed::DEFAULT_SEED_SWAPS;
if let Some(v) = var("SEED") {
config.seed_swaps = match v.as_str() {
"off" | "no" | "0" => 0,
@@ -1,4 +1,4 @@
//! EXPERIMENTAL, off by default (`LELEKA_ORIGINAL_SERVE_SEED`): residency seeded from the prompt's own routing.
//! ON by default when the configuration is read from the environment (`LELEKA_ORIGINAL_SERVE_SEED=off` disables; formerly experimental): residency seeded from the prompt's own routing.
//!
//! The Original's adaptive tier learns which experts to keep in VRAM from the verified windows, a few rounds at a time
//! (`ADAPT_EVERY` rounds, at most `ADAPT_SWAPS` swaps), so a first request decodes on the starting profile's placement