Fix flaky decode cache-hit check in Inkling test (#34405)

This commit is contained in:
Ke Bao
2026-08-11 21:47:01 +08:00
committed by GitHub
parent f148eb6e6e
commit b20c375c10
2 changed files with 18 additions and 3 deletions
+5 -1
View File
@@ -308,6 +308,7 @@ def test_input_output_logprobs_match_decode_cache_hit_helper(
max_samples=None,
max_new_tokens=8192,
trust_remote_code=False,
min_cache_hit_ratio=0.5,
):
server_info = requests.get(base_url + "/server_info").json()
if server_info["disable_radix_cache"]:
@@ -363,7 +364,10 @@ def test_input_output_logprobs_match_decode_cache_hit_helper(
output_logprobs.append(_extract_output_logprobs(result))
if not os.environ.get("SGLANG_TEST_SKIP_CACHE_HIT_ASSERT"):
assert len(new_input_ids) > 0.5 * len(
# Page-aligned SWA retention decides which prompts hit at all, so the default
# only screens out a vacuous run. A caller whose checkpoint interval makes
# every prompt hit raises this to pin that down.
assert len(new_input_ids) > min_cache_hit_ratio * len(
second_turn_input_ids
), f"Too few decode cache hits: {len(new_input_ids)}/{len(second_turn_input_ids)}"