From 359b4b5a6a6b9953561069b5ca94e6fb7b592ae0 Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Thu, 29 Oct 2026 02:10:28 +0100 Subject: [PATCH] residency: the seed row cap is an experimental setting, not a default (orchestrator: placement-class change, no quality gate yet) LELEKA_ORIGINAL_SERVE_SEED_MAX_ROWS stays available (default 0 = no cap, behaviour unchanged); the earlier commit's default of 4096 is removed and the docs say so. Co-Authored-By: Claude Sonnet 5.5 --- .../src/qwen_forward/original_serve_residency.rs | 6 +----- .../leleka-runtime/src/qwen_forward/original_serve_seed.rs | 7 ++++--- docs/original-serve.md | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/crates/leleka-runtime/src/qwen_forward/original_serve_residency.rs b/crates/leleka-runtime/src/qwen_forward/original_serve_residency.rs index 5ac09933..3fea17bb 100644 --- a/crates/leleka-runtime/src/qwen_forward/original_serve_residency.rs +++ b/crates/leleka-runtime/src/qwen_forward/original_serve_residency.rs @@ -155,7 +155,7 @@ pub(crate) struct ExpertTierConfig { /// `_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. 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 + /// EXPERIMENTAL, off by default (0 = no cap; placement-class change, no quality gate yet). `_SEED_MAX_ROWS`: no seed for a prompt whose prefill routed more than this many rows through the experts. 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, @@ -265,10 +265,6 @@ impl ExpertTierConfig { // 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; - // ... 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") { config.seed_swaps = match v.as_str() { "off" | "no" | "0" => 0, diff --git a/crates/leleka-runtime/src/qwen_forward/original_serve_seed.rs b/crates/leleka-runtime/src/qwen_forward/original_serve_seed.rs index 185adbf6..e695180d 100644 --- a/crates/leleka-runtime/src/qwen_forward/original_serve_seed.rs +++ b/crates/leleka-runtime/src/qwen_forward/original_serve_seed.rs @@ -29,9 +29,10 @@ const EXPERTS: usize = 512; /// 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; -/// 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; +/// A suggested cap for `LELEKA_ORIGINAL_SERVE_SEED_MAX_ROWS` (EXPERIMENTAL, not a default): the "agent-sized prompts up to a few thousand tokens" of +/// docs/original-serve.md. Prompts of 45k-247k tokens measured worse than no seed on the ranked upstream profile. +#[allow(dead_code)] +pub(crate) const SUGGESTED_SEED_MAX_ROWS: usize = 4096; /// One request's seed, for the operator's lines and the experiments. #[derive(Clone, Copy, Debug, Default, PartialEq)] diff --git a/docs/original-serve.md b/docs/original-serve.md index 573af209..1c24d602 100644 --- a/docs/original-serve.md +++ b/docs/original-serve.md @@ -423,4 +423,4 @@ 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). +`LELEKA_ORIGINAL_SERVE_SEED_MAX_ROWS` (EXPERIMENTAL, default 0 = no cap, so the seed stays on for every prompt as before) skips the seed for a prefill that routed more rows than that; `LELEKA_ORIGINAL_SERVE_SEED=off` is the other way to remove it. Both are placement-class changes: GPU and CPU round differently, so greedy ids are not invariant to them (see Quality above), and neither is a default until a quality gate has passed.