Files
agentic-kvc/microbench/connector_tax/layerwise/run_ablation_es.sh
Gahow Wang 5b26c345f4 P2: all routing policies read real state via eff_ accessors + ablation harness
InstanceState.eff_{num_requests,pending_prefill,ongoing_decode,ongoing_tokens}
= max(shadow, real) when feed fresh (fixes 30s-stale under-count, keeps
in-flight RaceFix), plus real-only r_max_prefill_remaining / r_kv_used_frac.
Wired into load_only, lmetric, sticky, unified(_kv_both), unified_v3, and
snapshot logging. Feed off => identical to before. run_v3_trace.sh gains ES=1
toggle (always deploys enhanced proxy); run_ablation_es.sh runs each config
ES0-vs-ES1 to test whether real state changes policy performance/ranking.
All unit-tested without GPU.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 20:21:12 +08:00

43 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Ablation: does the REAL engine-state feed (P2) change each policy's
# performance and ranking vs the stale-shadow baseline?
#
# Each config is run twice (ES=0 shadow-only, ES=1 real-state feed) so the
# ONLY difference is the state source. Sequential, ~47 min each.
#
# Default = the 4 decisive runs (champion + migration, with/without feed).
# Extend CONFIGS for the full sweep (lmetric / unified_kv_both / load_only).
set -uo pipefail
PROJ_DIR="${PROJ_DIR:-/home/admin/cpfs/wjh/agentic-kv}"
R="$PROJ_DIR/microbench/connector_tax/layerwise/run_v3_trace.sh"
AB="--overload-factor 1.3 --lmetric-decode-weight 0.01"
LOGD=/tmp/dst_break_logs; mkdir -p "$LOGD"
# CONFIG format: "TAG|POLICY|MODE|AB?|ES"
CONFIGS=(
"unified_AB_es0|unified|baseline|AB|0"
"unified_AB_es1|unified|baseline|AB|1"
"v3_AB_lw_es0|unified_v3|layerwise|AB|0"
"v3_AB_lw_es1|unified_v3|layerwise|AB|1"
# --- extend for the full sweep ---
# "lmetric_es0|lmetric|baseline|noAB|0"
# "lmetric_es1|lmetric|baseline|noAB|1"
# "ukvboth_AB_es0|unified_kv_both|baseline|AB|0"
# "ukvboth_AB_es1|unified_kv_both|baseline|AB|1"
)
for cfg in "${CONFIGS[@]}"; do
IFS='|' read -r tag policy mode ab es <<< "$cfg"
ab_flags=""; [ "$ab" = "AB" ] && ab_flags="$AB"
echo "########## $tag (policy=$policy mode=$mode ab=$ab es=$es) ##########"
TAG="$tag" POLICY="$policy" MODE="$mode" AB_FLAGS="$ab_flags" ES="$es" \
bash "$R" 2>&1 | tee "$LOGD/abl_${tag}.log" | tail -6
done
echo "########## ABLATION DONE — summary ##########"
for cfg in "${CONFIGS[@]}"; do
IFS='|' read -r tag _ _ _ _ <<< "$cfg"
echo "=== $tag ==="
grep -E "requests:|TTFT|migrations:" "$LOGD/abl_${tag}.log" 2>/dev/null || true
done