Probe coupled prefill runtime knobs before stop

This commit is contained in:
2026-06-22 19:30:23 +08:00
parent fd94ab9f3b
commit e67bc86240
2 changed files with 182 additions and 0 deletions

View File

@@ -1319,6 +1319,57 @@ def _runtime_candidate_actions(
)
)
if (
top_bottleneck == "ttft_prefill"
and topology_settled
and "max-num-batched-tokens" in tunable
and "max-num-seqs" in tunable
and max_num_seqs_tested
):
current_mbt = _parse_int_like(anchor_flags.get("max-num-batched-tokens"), default=0)
current_mns = _parse_int_like(anchor_flags.get("max-num-seqs"), default=0)
if current_mbt > 0:
window_target = _initial_mbt_from_window(window_summary)
step_target = _next_mbt_step(current_mbt) or current_mbt
mbt_target = min(
32768,
max(
step_target,
min(window_target, _round_up_to_multiple(current_mbt * 2, 1024)),
),
)
else:
mbt_target = _initial_mbt_from_window(window_summary)
mns_target = _round_up_to_multiple(
max(16, int(current_mns * 1.5)) if current_mns > 0 else 64, 8
)
if mbt_target > 0 and (mbt_target != current_mbt or mns_target != current_mns):
patch = {
**runtime_base_patch,
"max-num-batched-tokens": mbt_target,
"max-num-seqs": mns_target,
}
signature = _config_signature({"env_patch": {}, "flag_patch": patch})
if signature not in tested_signatures:
actions.append(
_runtime_action(
action_id="raise_mbt_and_max_num_seqs",
knob_family="prefill-runtime-interaction",
score=0.38
+ _information_gain(bottleneck_hypotheses, "runtime"),
patch=patch,
hypothesis=(
"Jointly raise max-num-batched-tokens and max-num-seqs to test "
"whether prefill batching headroom and admission concurrency only "
"help when adjusted together."
),
expected_effects=[
"preserve the incumbent topology while changing coupled prefill runtime limits",
"confirm whether separate MBT or sequence-cap probes masked an interaction",
],
)
)
if "enable-chunked-prefill" in tunable and top_bottleneck == "ttft_prefill":
current = bool(anchor_flags.get("enable-chunked-prefill", False))
if not current: