Record structured attention experiment verdict

This commit is contained in:
2026-07-23 18:09:24 +08:00
parent 4f22688bfd
commit 08921193a1
13 changed files with 4080 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
__pycache__/
cache/
replay/

View File

@@ -0,0 +1,249 @@
From 1f8900a4ac64e45754b03d0aa7c1dddab65785cf Mon Sep 17 00:00:00 2001
From: Gahow Wang <gahow.wang@gmail.com>
Date: Thu, 23 Jul 2026 15:27:40 +0800
Subject: [PATCH] Experiment with structured attention prefill predictor
---
.../shared_prediction_model_manager.py | 16 +++-
.../sklearn_execution_time_predictor.py | 16 +++-
.../structured_attention_prefill.py | 79 +++++++++++++++++++
.../unit/test_structured_attention_prefill.py | 59 ++++++++++++++
4 files changed, 165 insertions(+), 5 deletions(-)
create mode 100644 frontier/execution_time_predictor/structured_attention_prefill.py
create mode 100644 tests/unit/test_structured_attention_prefill.py
diff --git a/frontier/execution_time_predictor/shared_prediction_model_manager.py b/frontier/execution_time_predictor/shared_prediction_model_manager.py
index 8a65a49..4a21165 100644
--- a/frontier/execution_time_predictor/shared_prediction_model_manager.py
+++ b/frontier/execution_time_predictor/shared_prediction_model_manager.py
@@ -19,6 +19,9 @@ from frontier.execution_time_predictor.attention_tp_policy import (
from frontier.execution_time_predictor.attention_dataset_contract import (
enforce_mixed_attention_input_contract,
)
+from frontier.execution_time_predictor.structured_attention_prefill import (
+ StructuredAttentionPrefillRegressor,
+)
from frontier.logger import init_logger
from frontier.moe_gating_runtime import (
DEFAULT_MOE_GATING_RUNTIME_CONTEXT,
@@ -1254,7 +1257,10 @@ class ExecutionTimePredictionModelManager:
raise ValueError(
"Missing required column 'prefill_chunk_size' in attention profiling data."
)
- standard_prefill_df = prefill_df[prefill_df["prefill_chunk_size"] > 0].copy()
+ standard_prefill_df = prefill_df[
+ (prefill_df["prefill_chunk_size"] > 0)
+ & (prefill_df["batch_size"] == 1)
+ ].copy()
prefill_model_signature = f"attn_prefill_{attention_signature}"
if prefill_model_signature not in trained_model_signatures:
@@ -1742,7 +1748,13 @@ class ExecutionTimePredictionModelManager:
# initialization to generate missing cache files.
# ============================================================
- estimator, grid_search_params = self._create_estimator_and_params(execution_time_predictor_config)
+ if model_name == "attn_prefill":
+ estimator = StructuredAttentionPrefillRegressor()
+ grid_search_params = {}
+ else:
+ estimator, grid_search_params = self._create_estimator_and_params(
+ execution_time_predictor_config
+ )
cv = min(execution_time_predictor_config.k_fold_cv_splits, len(df)) if len(df) >= 2 else 2
diff --git a/frontier/execution_time_predictor/sklearn_execution_time_predictor.py b/frontier/execution_time_predictor/sklearn_execution_time_predictor.py
index 27b62bf..b7f5350 100644
--- a/frontier/execution_time_predictor/sklearn_execution_time_predictor.py
+++ b/frontier/execution_time_predictor/sklearn_execution_time_predictor.py
@@ -45,6 +45,9 @@ from frontier.execution_time_predictor.attention_tp_policy import (
from frontier.execution_time_predictor.attention_dataset_contract import (
enforce_mixed_attention_input_contract,
)
+from frontier.execution_time_predictor.structured_attention_prefill import (
+ StructuredAttentionPrefillRegressor,
+)
from frontier.logger import init_logger
from frontier.moe_gating_runtime import get_moe_gating_base_model_name
from frontier.profiling.cpu_overhead.schema import (
@@ -2573,8 +2576,12 @@ class SklearnExecutionTimePredictor(BaseExecutionTimePredictor):
if cached_model:
return cached_model
- model = self._get_estimator()
- grid_search_params = self._get_grid_search_params()
+ if model_name == "attn_prefill":
+ model = StructuredAttentionPrefillRegressor()
+ grid_search_params = {}
+ else:
+ model = self._get_estimator()
+ grid_search_params = self._get_grid_search_params()
if len(df) < self._config.k_fold_cv_splits:
cv = 2
@@ -2869,7 +2876,10 @@ class SklearnExecutionTimePredictor(BaseExecutionTimePredictor):
raise ValueError(
"Missing required column 'prefill_chunk_size' in attention profiling data."
)
- standard_prefill_df = prefill_df[prefill_df["prefill_chunk_size"] > 0].copy()
+ standard_prefill_df = prefill_df[
+ (prefill_df["prefill_chunk_size"] > 0)
+ & (prefill_df["batch_size"] == 1)
+ ].copy()
if len(standard_prefill_df) == 0:
raise ValueError(
"No standard prefill rows (prefill_chunk_size > 0) found in eager attention profiling data."
diff --git a/frontier/execution_time_predictor/structured_attention_prefill.py b/frontier/execution_time_predictor/structured_attention_prefill.py
new file mode 100644
index 0000000..1829047
--- /dev/null
+++ b/frontier/execution_time_predictor/structured_attention_prefill.py
@@ -0,0 +1,79 @@
+"""Structured latency model for single-request chunked prefill attention."""
+
+from typing import Any
+
+import numpy as np
+from sklearn.base import BaseEstimator, RegressorMixin
+from sklearn.isotonic import IsotonicRegression
+from sklearn.linear_model import LinearRegression
+
+
+class StructuredAttentionPrefillRegressor(RegressorMixin, BaseEstimator):
+ """Model attention as a monotone base curve plus continuous KV growth.
+
+ Input columns retain the existing Frontier contract:
+ ``[kv_cache_size, prefill_chunk_size_squared]``.
+ """
+
+ def fit(self, X: Any, y: Any) -> "StructuredAttentionPrefillRegressor":
+ values = self._as_feature_array(X)
+ target = np.asarray(y, dtype=float)
+ kv_cache_size = values[:, 0]
+ prefill_chunk_size = np.sqrt(np.maximum(values[:, 1], 0.0))
+
+ base_mask = np.isclose(kv_cache_size, 0.0)
+ growth_mask = kv_cache_size > 0.0
+ if not np.any(base_mask) or not np.any(growth_mask):
+ raise ValueError(
+ "structured attn_prefill training requires both KV=0 base rows "
+ "and KV>0 growth rows"
+ )
+
+ base_q = prefill_chunk_size[base_mask]
+ base_y = target[base_mask]
+ unique_q = np.unique(base_q)
+ grouped_y = np.asarray(
+ [np.mean(base_y[np.isclose(base_q, q)]) for q in unique_q],
+ dtype=float,
+ )
+ self._base_model = IsotonicRegression(
+ increasing=True,
+ out_of_bounds="clip",
+ ).fit(unique_q, grouped_y)
+
+ growth_q = prefill_chunk_size[growth_mask]
+ growth_kv = kv_cache_size[growth_mask]
+ growth_base = self._base_model.predict(growth_q)
+ growth_features = np.column_stack(
+ (growth_kv, growth_q * growth_kv)
+ )
+ self._growth_model = LinearRegression(
+ fit_intercept=False,
+ positive=True,
+ ).fit(growth_features, target[growth_mask] - growth_base)
+
+ self.n_features_in_ = 2
+ self._frontier_base_q_min = float(unique_q.min())
+ self._frontier_base_q_max = float(unique_q.max())
+ self._frontier_growth_kv_max = float(growth_kv.max())
+ return self
+
+ def predict(self, X: Any) -> np.ndarray:
+ values = self._as_feature_array(X)
+ kv_cache_size = values[:, 0]
+ prefill_chunk_size = np.sqrt(np.maximum(values[:, 1], 0.0))
+ base = self._base_model.predict(prefill_chunk_size)
+ growth_features = np.column_stack(
+ (kv_cache_size, prefill_chunk_size * kv_cache_size)
+ )
+ return np.maximum(base + self._growth_model.predict(growth_features), 0.0)
+
+ @staticmethod
+ def _as_feature_array(X: Any) -> np.ndarray:
+ values = np.asarray(X, dtype=float)
+ if values.ndim != 2 or values.shape[1] != 2:
+ raise ValueError(
+ "structured attn_prefill expects exactly two features: "
+ "kv_cache_size and prefill_chunk_size_squared"
+ )
+ return values
diff --git a/tests/unit/test_structured_attention_prefill.py b/tests/unit/test_structured_attention_prefill.py
new file mode 100644
index 0000000..12c4247
--- /dev/null
+++ b/tests/unit/test_structured_attention_prefill.py
@@ -0,0 +1,59 @@
+import pickle
+import unittest
+
+import numpy as np
+
+from frontier.execution_time_predictor.structured_attention_prefill import (
+ StructuredAttentionPrefillRegressor,
+)
+
+
+class StructuredAttentionPrefillRegressorTest(unittest.TestCase):
+ def setUp(self) -> None:
+ q = np.asarray([64, 128, 256, 512, 1024, 2048, 4096, 8192], dtype=float)
+ base = 0.05 + 1e-4 * q + 4e-8 * q**2
+ context_q = np.asarray([2048, 4096, 8192] * 3, dtype=float)
+ context_kv = np.repeat([8192, 16384, 24576], 3).astype(float)
+ context_y = (
+ np.interp(context_q, q, base)
+ + 1.5e-5 * context_kv
+ + 3e-8 * context_q * context_kv
+ )
+ self.X = np.column_stack(
+ (
+ np.concatenate((np.zeros_like(q), context_kv)),
+ np.concatenate((q**2, context_q**2)),
+ )
+ )
+ self.y = np.concatenate((base, context_y))
+
+ def test_recovers_structured_curve(self) -> None:
+ model = StructuredAttentionPrefillRegressor().fit(self.X, self.y)
+ np.testing.assert_allclose(model.predict(self.X), self.y, rtol=1e-6)
+
+ def test_prediction_is_nonnegative_and_monotone(self) -> None:
+ model = StructuredAttentionPrefillRegressor().fit(self.X, self.y)
+ q = np.arange(1, 8193, dtype=float)
+ for kv in (0, 8192, 32768, 40912):
+ X = np.column_stack((np.full_like(q, kv), q**2))
+ prediction = model.predict(X)
+ self.assertTrue(np.all(prediction >= 0))
+ self.assertTrue(np.all(np.diff(prediction) >= -1e-12))
+
+ kv = np.arange(0, 40913, 64, dtype=float)
+ for q_value in (64, 2048, 8192):
+ X = np.column_stack((kv, np.full_like(kv, q_value**2)))
+ self.assertTrue(np.all(np.diff(model.predict(X)) >= -1e-12))
+
+ def test_pickle_round_trip(self) -> None:
+ model = StructuredAttentionPrefillRegressor().fit(self.X, self.y)
+ restored = pickle.loads(pickle.dumps(model))
+ np.testing.assert_allclose(restored.predict(self.X), self.y, rtol=1e-6)
+
+ def test_requires_base_and_growth_rows(self) -> None:
+ with self.assertRaisesRegex(ValueError, "KV=0 base rows"):
+ StructuredAttentionPrefillRegressor().fit(self.X[:8], self.y[:8])
+
+
+if __name__ == "__main__":
+ unittest.main()
--
2.43.0

View File

@@ -0,0 +1,256 @@
#!/usr/bin/env python3
"""Offline predictor ablation for EXP-ATTN-STRUCTURED.
This is deliberately profile-only: it decides whether the structured model is
good enough to justify the expensive 7-cell trace replay.
"""
from __future__ import annotations
import argparse
import csv
import json
import sys
from pathlib import Path
from typing import Any
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
ROOT = Path(__file__).resolve().parent
REPO = ROOT.parents[1]
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser()
parser.add_argument(
"--profile",
type=Path,
default=REPO
/ "runs/frontier-prefill-kvgrowth-fix-v0/profiles/"
"profile-v5-kvgrowth/attention.csv",
)
parser.add_argument(
"--frontier-checkout",
type=Path,
default=Path("/tmp/frontier-attn-structured-v0"),
)
parser.add_argument("--output-root", type=Path, default=ROOT / "results")
return parser.parse_args()
def normalize_bool(series: pd.Series) -> pd.Series:
return series.astype(str).str.strip().str.lower().isin(
{"1", "true", "t", "yes", "y"}
)
def load_profile(path: Path) -> pd.DataFrame:
df = pd.read_csv(path).drop_duplicates()
for column in ("is_prefill", "is_true_mixed_batch"):
df[column] = normalize_bool(df[column])
df = df[
(df["n_embd"] == 2048)
& (df["n_q_head"] == 32)
& (df["n_kv_head"] == 4)
& (df["block_size"] == 16)
& df["is_prefill"]
& ~df["is_true_mixed_batch"]
& (df["prefill_chunk_size"] > 0)
].copy()
df["prefill_chunk_size_squared"] = df["prefill_chunk_size"] ** 2
return df
def mape(actual: np.ndarray, predicted: np.ndarray) -> float:
return float(np.mean(np.abs((predicted - actual) / actual)) * 100)
def make_rf() -> RandomForestRegressor:
# Exact best parameters selected by the current profile-v5 GridSearchCV.
return RandomForestRegressor(
random_state=0,
n_estimators=250,
max_depth=8,
min_samples_split=2,
)
def features(df: pd.DataFrame) -> pd.DataFrame:
return df[["kv_cache_size", "prefill_chunk_size_squared"]]
def score_model(
name: str,
estimator: Any,
train: pd.DataFrame,
single: pd.DataFrame,
grid: pd.DataFrame,
) -> dict[str, Any]:
target = "time_stats.attn_prefill.median"
estimator.fit(features(train), train[target])
grid_prediction = estimator.predict(features(grid))
single_prediction = estimator.predict(features(single))
heldout_actual: list[float] = []
heldout_prediction: list[float] = []
for context in sorted(grid["kv_cache_size"].unique()):
test = grid[grid["kv_cache_size"] == context]
fold_train = train.drop(index=test.index, errors="ignore")
fold_model = (
make_rf()
if name.startswith("rf")
else estimator.__class__()
)
fold_model.fit(features(fold_train), fold_train[target])
heldout_actual.extend(test[target].astype(float))
heldout_prediction.extend(fold_model.predict(features(test)))
q = np.arange(1, 8193, dtype=float)
q_deltas: list[float] = []
prediction_min: list[float] = []
for context in (0, 8192, 16384, 24576, 32768, 40912):
X = pd.DataFrame(
{
"kv_cache_size": np.full_like(q, context),
"prefill_chunk_size_squared": q**2,
}
)
prediction = estimator.predict(X)
prediction_min.append(float(prediction.min()))
q_deltas.append(float(np.diff(prediction).min()))
kv = np.arange(0, 40913, 64, dtype=float)
kv_deltas: list[float] = []
for query in (64, 512, 2048, 4096, 8192):
X = pd.DataFrame(
{
"kv_cache_size": kv,
"prefill_chunk_size_squared": np.full_like(kv, query**2),
}
)
kv_deltas.append(float(np.diff(estimator.predict(X)).min()))
heldout_actual_array = np.asarray(heldout_actual)
heldout_prediction_array = np.asarray(heldout_prediction)
return {
"candidate": name,
"training_rows": len(train),
"grid_fit_mape_pct": mape(
grid[target].to_numpy(), np.asarray(grid_prediction)
),
"single_fit_mape_pct": mape(
single[target].to_numpy(), np.asarray(single_prediction)
),
"heldout_context_mape_pct": mape(
heldout_actual_array, heldout_prediction_array
),
"heldout_context_max_abs_error_pct": float(
np.max(
np.abs(
(heldout_prediction_array - heldout_actual_array)
/ heldout_actual_array
)
)
* 100
),
"prediction_min_ms": min(prediction_min),
"q_min_delta_ms": min(q_deltas),
"kv_min_delta_ms": min(kv_deltas),
"monotone_and_nonnegative": (
min(prediction_min) >= 0
and min(q_deltas) >= -1e-12
and min(kv_deltas) >= -1e-12
),
}
def main() -> None:
args = parse_args()
sys.path.insert(0, str(args.frontier_checkout))
from frontier.execution_time_predictor.structured_attention_prefill import (
StructuredAttentionPrefillRegressor,
)
df = load_profile(args.profile)
records: list[dict[str, Any]] = []
data_audit: dict[str, Any] = {}
for tp in (1, 2, 4):
tp_df = df[df["num_tensor_parallel_workers"] == tp].copy()
single = tp_df[tp_df["batch_size"] == 1].copy()
grid = single[
single["prefill_chunk_size"].isin((2048, 4096, 8192))
& (single["kv_cache_size"] > 0)
].copy()
duplicate_groups = (
tp_df.groupby(
["kv_cache_size", "prefill_chunk_size_squared"]
)
.size()
.gt(1)
.sum()
)
data_audit[f"tp{tp}"] = {
"standard_rows": len(tp_df),
"single_request_rows": len(single),
"target_grid_rows": len(grid),
"duplicate_feature_groups": int(duplicate_groups),
}
candidates = (
("rf_all", make_rf(), tp_df),
("rf_single", make_rf(), single),
(
"structured_single",
StructuredAttentionPrefillRegressor(),
single,
),
)
for name, model, train in candidates:
result = score_model(name, model, train, single, grid)
result["tp"] = tp
records.append(result)
structured = [r for r in records if r["candidate"] == "structured_single"]
checks = {
"heldout_context_mape_le_5pct": all(
r["heldout_context_mape_pct"] <= 5 for r in structured
),
"monotone_and_nonnegative": all(
r["monotone_and_nonnegative"] for r in structured
),
}
checks["profile_gate"] = all(checks.values())
payload = {
"schema": "frontier-attn-structured-ablation-v1",
"profile": str(args.profile.resolve()),
"frontier_checkout": str(args.frontier_checkout.resolve()),
"data_audit": data_audit,
"results": records,
"checks": checks,
}
args.output_root.mkdir(parents=True, exist_ok=True)
(args.output_root / "predictor-ablation.json").write_text(
json.dumps(payload, indent=2)
)
with (args.output_root / "predictor-ablation.csv").open(
"w", newline=""
) as stream:
writer = csv.DictWriter(stream, fieldnames=list(records[0]))
writer.writeheader()
writer.writerows(records)
print(json.dumps(checks, indent=2))
for row in records:
print(
f"TP{row['tp']} {row['candidate']:18s} "
f"grid={row['grid_fit_mape_pct']:.2f}% "
f"heldout={row['heldout_context_mape_pct']:.2f}% "
f"max={row['heldout_context_max_abs_error_pct']:.2f}% "
f"monotone={row['monotone_and_nonnegative']}"
)
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,304 @@
#!/usr/bin/env python3
"""Trial-aware verdict for the seven structured-attention trace replays."""
from __future__ import annotations
import csv
import json
import math
from pathlib import Path
from typing import Any
ROOT = Path(__file__).resolve().parent
REPO = ROOT.parents[1]
S3_REAL = REPO / "runs/frontier-s3-real-v0"
V5 = REPO / "runs/frontier-prefill-kvgrowth-fix-v0"
CELLS = {
"tp1_rho0p00125": {
"real": "frontier-tp1-real-r0p00125-t*",
"old": V5 / "sim-replay-tp1/v5/tp1_rho0p00125",
},
"tp1_rho0p0025": {
"real": "frontier-tp1-real-r0p0025-t*",
"old": V5 / "sim-replay-tp1/v5/tp1_rho0p0025",
},
"tp2_rho0p0025": {
"real": "frontier-s3-real-full-r0p0025-tp2-t*",
"old": V5 / "sim-replay/tp2_rho0p0025",
},
"tp2_rho0p005": {
"real": "frontier-s3-real-full-r0p005-tp2-t*",
"old": V5 / "sim-replay/tp2_rho0p005",
},
"tp4_rho0p0025": {
"real": "frontier-s3-real-full-r0p0025-tp4-t*",
"old": V5 / "sim-replay/tp4_rho0p0025",
},
"tp4_rho0p005": {
"real": "frontier-s3-real-full-r0p005-tp4-t*",
"old": V5 / "sim-replay/tp4_rho0p005",
},
"tp4_rho0p01": {
"real": "frontier-s3-real-full-r0p01-tp4-t*",
"old": V5 / "sim-replay/tp4_rho0p01",
},
}
METRICS = {
"ttft": ("ttft_ms", "ttft"),
"tpot": ("tpot_ms", "tpot"),
"e2e": ("e2e_ms", "request_e2e_time"),
}
QUANTILES = {"mean": None, "p50": 0.5, "p90": 0.9, "p99": 0.99}
def percentile(values: list[float], quantile: float) -> float:
ordered = sorted(values)
position = (len(ordered) - 1) * quantile
lower, upper = math.floor(position), math.ceil(position)
if lower == upper:
return ordered[lower]
return (
ordered[lower] * (upper - position)
+ ordered[upper] * (position - lower)
)
def summarize(values: list[float]) -> dict[str, float]:
return {
name: (
sum(values) / len(values)
if quantile is None
else percentile(values, quantile)
)
for name, quantile in QUANTILES.items()
}
def load_real_trials(pattern: str) -> list[list[dict[str, Any]]]:
trials = []
for run_root in sorted((S3_REAL / "fleet-artifacts").glob(pattern)):
results = list(
run_root.glob(
"artifacts/outputs/full-real/*/*/trial-*/results/result.json"
)
)
if len(results) != 1:
raise ValueError(f"expected one result in {run_root}, got {results}")
trials.append(json.loads(results[0].read_text())["requests"])
if len(trials) != 2:
raise ValueError(f"expected two real trials for {pattern}, got {len(trials)}")
return trials
def load_sim(root: Path) -> list[dict[str, str]]:
matches = list((root / "metrics").rglob("request_metrics.csv"))
if len(matches) != 1:
raise ValueError(f"expected one request_metrics.csv below {root}: {matches}")
rows = list(csv.DictReader(matches[0].open()))
rows.sort(key=lambda row: int(float(row["Request Id"])))
return rows
def distribution_bias(
real_rows: list[dict[str, Any]],
sim_rows: list[dict[str, str]],
) -> dict[str, dict[str, float]]:
output: dict[str, dict[str, float]] = {}
for metric, (real_key, sim_key) in METRICS.items():
pairs = [
(float(real[real_key]), float(sim[sim_key]))
for real, sim in zip(real_rows, sim_rows)
if real.get("success")
]
real_summary = summarize([pair[0] for pair in pairs])
sim_summary = summarize([pair[1] for pair in pairs])
output[metric] = {
name: (sim_summary[name] - real_summary[name]) / real_summary[name]
for name in QUANTILES
}
return output
def paired_relative_error(
real_rows: list[dict[str, Any]],
sim_rows: list[dict[str, str]],
) -> dict[str, dict[str, float]]:
output: dict[str, dict[str, float]] = {}
for metric, (real_key, sim_key) in METRICS.items():
errors = [
(float(sim[sim_key]) - float(real[real_key])) / float(real[real_key])
for real, sim in zip(real_rows, sim_rows)
if real.get("success") and float(real[real_key]) != 0
]
output[metric] = summarize(errors)
return output
def aggregate_trial_bias(
trial_biases: list[dict[str, dict[str, float]]],
) -> dict[str, dict[str, dict[str, float]]]:
return {
metric: {
quantile: {
"mean": sum(values) / len(values),
"min": min(values),
"max": max(values),
}
for quantile in QUANTILES
for values in [
[trial[metric][quantile] for trial in trial_biases]
]
}
for metric in METRICS
}
def legacy_pooled_bias(
real_trials: list[list[dict[str, Any]]],
sim_rows: list[dict[str, str]],
) -> dict[str, dict[str, float]]:
output: dict[str, dict[str, float]] = {}
for metric, (real_key, sim_key) in METRICS.items():
real_values = [
float(row[real_key])
for trial in real_trials
for row in trial[: len(sim_rows)]
if row.get("success")
]
sim_values = [float(row[sim_key]) for row in sim_rows]
real_summary = summarize(real_values)
sim_summary = summarize(sim_values)
output[metric] = {
name: (sim_summary[name] - real_summary[name]) / real_summary[name]
for name in QUANTILES
}
return output
def waiting_p99(sim_rows: list[dict[str, str]]) -> float:
return percentile(
[float(row["request_waiting_time_total"]) for row in sim_rows], 0.99
)
def main() -> None:
results: dict[str, Any] = {}
flat_rows: list[dict[str, Any]] = []
for label, paths in CELLS.items():
real_trials = load_real_trials(paths["real"])
old_sim = load_sim(paths["old"])
new_sim = load_sim(ROOT / "replay" / label)
old_trial_bias = [
distribution_bias(trial, old_sim) for trial in real_trials
]
new_trial_bias = [
distribution_bias(trial, new_sim) for trial in real_trials
]
old_legacy = legacy_pooled_bias(real_trials, old_sim)
new_legacy = legacy_pooled_bias(real_trials, new_sim)
wait_p99 = waiting_p99(new_sim)
results[label] = {
"old": {
"trialwise_distribution_bias": old_trial_bias,
"trialwise_distribution_bias_summary": aggregate_trial_bias(
old_trial_bias
),
"legacy_pooled_distribution_bias": old_legacy,
},
"new": {
"trialwise_distribution_bias": new_trial_bias,
"trialwise_distribution_bias_summary": aggregate_trial_bias(
new_trial_bias
),
"paired_relative_error": [
paired_relative_error(trial, new_sim)
for trial in real_trials
],
"legacy_pooled_distribution_bias": new_legacy,
"waiting_p99_ms": wait_p99,
"validity": (
"PASS_SUBCRITICAL"
if wait_p99 < 1000
else "GATE_FAIL_DIAGNOSTIC"
),
},
}
for metric in METRICS:
for quantile in QUANTILES:
flat_rows.append(
{
"cell": label,
"metric": metric,
"quantile": quantile,
"old_bias": old_legacy[metric][quantile],
"new_bias": new_legacy[metric][quantile],
"abs_bias_delta_pp": 100
* (
abs(new_legacy[metric][quantile])
- abs(old_legacy[metric][quantile])
),
"validity": results[label]["new"]["validity"],
}
)
tp1_checks = []
for cell in ("tp1_rho0p00125", "tp1_rho0p0025"):
for quantile in ("mean", "p99"):
old = results[cell]["old"]["legacy_pooled_distribution_bias"]["ttft"][
quantile
]
new = results[cell]["new"]["legacy_pooled_distribution_bias"]["ttft"][
quantile
]
tp1_checks.append(abs(old) - abs(new) >= 0.05)
regressions = [
row
for row in flat_rows
if row["cell"].startswith(("tp2", "tp4"))
and row["metric"] in ("ttft", "e2e")
and row["abs_bias_delta_pp"] > 5
]
checks = {
"tp1_ttft_mean_p99_improve_ge_5pp": all(tp1_checks),
"tp2_tp4_ttft_e2e_no_abs_regression_gt_5pp": not regressions,
"regressions": regressions,
}
checks["trace_gate"] = (
checks["tp1_ttft_mean_p99_improve_ge_5pp"]
and checks["tp2_tp4_ttft_e2e_no_abs_regression_gt_5pp"]
)
payload = {
"schema": "frontier-attn-structured-trial-aware-verdict-v1",
"metric_note": (
"Primary values are per-real-trial distribution biases with request "
"alignment by index. legacy_pooled reproduces the old milestone "
"quantile convention only for direct comparison."
),
"cells": results,
"checks": checks,
}
output = ROOT / "results"
output.mkdir(parents=True, exist_ok=True)
(output / "trace-verdict.json").write_text(json.dumps(payload, indent=2))
with (output / "trace-verdict.csv").open("w", newline="") as stream:
writer = csv.DictWriter(stream, fieldnames=list(flat_rows[0]))
writer.writeheader()
writer.writerows(flat_rows)
print(json.dumps(checks, indent=2))
for label, result in results.items():
old = result["old"]["legacy_pooled_distribution_bias"]["ttft"]
new = result["new"]["legacy_pooled_distribution_bias"]["ttft"]
print(
f"{label}: TTFT mean {old['mean']:+.1%}->{new['mean']:+.1%}, "
f"p99 {old['p99']:+.1%}->{new['p99']:+.1%}, "
f"waiting_p99={result['new']['waiting_p99_ms']:.0f}ms "
f"{result['new']['validity']}"
)
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,82 @@
# 实验 EXP-ATTN-STRUCTURED结构化 predictor 能否关闭大 KV 端的 RF 欠拟合
> **状态:** 已完成profile gate PASSglobal merge gate FAIL
>
> Parent campaign[`../frontier-simulator-gap-campaign-v0/README.md`](../frontier-simulator-gap-campaign-v0/README.md)
## Claim 与决策
- **Parent claim** profile-v5 已补齐 chunked-prefill KV-context 测量,但当前 RF 仍在 TP1/2/4 的新网格上产生约 12%--14% self-fit MAPE并在 TP1 真实 trace 中留下 13% 到 22% TTFT 偏差。
- **目的:** 检查该 residual 是否来自可工程修复的 predictor representation而不是 profile 数据或 serving path。
- **Competing hypotheses**
- H1standard prefill 模型错误混入 pure multi-request rows且 RF 对连续 attention scaling 作阶梯平滑;使用单请求数据和结构化 `base(q)+KV×(a+bq)` 可关闭残余。
- H2残余主要来自未建模的 serving-path 组件;替换 predictor 不会改善 7-cell trace fidelity。
- **事前预测:**
- H1held-out context MAPE ≤5%TP1 TTFT mean/p99 绝对偏差至少改善 5 pp。
- H2profile gate 失败,或 profile gate 通过但 trace TTFT 几乎不动。
- **判定规则:**
- profile gateTP1/2/4 held-out context MAPE 均 ≤5%q/KV 单调且预测非负。
- trace gate两个 TP1 cell 的 TTFT mean/p99 |bias| 各改善 ≥5 ppTP2/TP4 任一 TTFT/E2E quantile 不恶化 >5 pp。
- profile gate 失败即停止trace gate 失败则回退 patch不进入 EXP-2。
## Setup
- **自变量:**
- A现有 RFstandard prefill 全部非 true-mixed rows。
- B现有 RF但仅 `batch_size=1`
- C`batch_size=1` 的 structured predictor
- `base(q)`KV=0 profile 的单调分段线性插值;
- growth非负 least-squares `KV×(a+bq)`
- **控制变量:** attention/linear/MoE/collective profile、trace、prefix cache、scheduler、graph mode、KV blocks、MNS、全部 argv。
- **System context** Qwen3-30B-A3B BF16H20Frontier `deadc4a3`TP1/2/4MNS16chunk 8192prefix caching。
- **Workload 或 trace** 现有 7-cell 60-min production chat trace matrixreal 侧每 cell 两个 trial。
- **Baselines** `docs/assets/frontier-fidelity/full-matrix.csv` 的 sim-v5。
- **Metrics**
- profilegrid fit MAPE、leave-one-context MAPE/max error、q/KV monotonicity
- tracerequest-ID paired bias每个 real trial 单独计算后报告 mean 与 trial interval
- queue validitywaiting p99TP1 超过 1 s 的 cell 标为 diagnostic。
## 预期产物与 review
- **预期数据:** `results/predictor-ablation.{json,csv}``replay/<cell>/``results/paired-verdict.json`
- **Figure prototype** `figure-prototype.png`;左图为 q8k 随 KV 增长的 actual/RF/structured右图为 7-cell TTFT bias 的事前期望。
- **人工 review** 已按 campaign 顺序批准执行。
- **Review 意见:** 只改 standard single-request predictor不得改 mixed predictor 或任何 profile row。
## 复现信息
- **Code** Frontier base `deadc4a321f0baaa534c6ebd17f974123733cdc2`;实验 patch 将保存为 `frontier-structured-attn.patch` 并记录 SHA256。
- **Environment** 本地 CPU replayPython dependency roots 复用 `runs/frontier-collective-joint-v0/counterfactual/joint-r2/manifest.json`
- **产物路径:** 本目录。
- **已知 deviation** milestone 文档将 7-cell 口径称为“逐 request paired”但旧脚本实际 pool 两个 real trial 后比较 quantile本实验会修正分析口径不改旧结果文件。
## 预分析事实
- 现有训练代码使用 `["kv_cache_size", "prefill_chunk_size_squared"]` 与 RF grid search。
- runtime cache 注释明确 standard model 是 per-request多请求 prefill 在模型存在时走 `attn_prefill_mixed`
- profile-v5 的 standard 训练集每 TP 有 29 行,其中单请求 23 行;有 4 组相同 `(KV,q²)` feature 对应多个 pure-batch 标签。
- 初步 structured candidate 的 leave-one-context MAPETP1 0.84%、TP2 1.61%、TP4 3.01%max error 分别 2.04%、3.47%、5.49%。这些是实现前的临时计算,须由版本化脚本复现后才进入结果。
## 结果
- **观察事实:**
- structured held-out-context MAPE 为 TP1/2/4=`0.84%/1.60%/3.01%`
当前 RF 为 `44.40%/44.20%/43.54%`。单调/非负 gate 通过。
- TP1 两点 TTFT mean bias `13.5/17.7% → 6.3/9.5%`p99
`16.8/22.1% → 8.6/14.4%`
- TP2 两点 TTFT mean bias `11.2/14.1% → 4.5/7.1%`p99
`17.3/19.4% → 7.7/9.0%`
- TP4 三点 TTFT mean bias `+2.5/+2.9/0.1% → +7.8/+8.4/+6.0%`
三点均使绝对误差恶化 `5.3--5.8 pp`,触发预设回归 gate。
- validity 重新审计TP1 两点 waiting p99=`1.34/1.89 s`TP2
ρ=.005=`1.17 s`,均标为 `GATE_FAIL_DIAGNOSTIC`。其余四点通过。
- **异常:** TP4 ρ=.005 的 TPOT p99 从 `+31.2%` 变为 `+36.6%`
表明该 tail 对 prefill/mixed-decode 相位敏感,不是本 patch 能关闭的稳定
decode predictor 偏差。
- **含义:** H1 的 representation 机制得到支持,但“全局替换 RF 可直接提升
7-cell fidelity”被反驳。TP4 原先接近零的 mean TTFT 含有 predictor
欠拟合与其它正向 residual 的误差抵消;单独修正 attention 会揭开后者。
- **Claim update** structured predictor 是明确的工程候选,但必须与 TP4
residual 联合收敛后才可 merge当前 patch 只保留为 ablation。
- **下一步:** EXP-2 先重算 structured 分支的 TP2 chunk-level residual
仅 residual ≥10% 才运行 GPU serving-path 三臂 profile。

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

View File

@@ -0,0 +1,525 @@
{
"cc_cache": "/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/cc-cache",
"cells": {
"tp1_mns16": {
"argv": [
"/usr/bin/python3",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/run_frontier_with_curves.py",
"--simulation_mode",
"online",
"--sys_arch",
"co-location",
"--cc_backend_config_type",
"vidur",
"--cluster_config_num_replicas",
"1",
"--cluster_scheduler_config_type",
"sticky_round_robin",
"--replica_config_model_name",
"qwen3-a3b-30b-moe",
"--replica_config_device",
"h20",
"--replica_config_network_device",
"h20_dgx",
"--replica_config_attn_tensor_parallel_size",
"1",
"--replica_config_attn_data_parallel_size",
"1",
"--replica_config_moe_tensor_parallel_size",
"1",
"--replica_config_moe_expert_parallel_size",
"1",
"--replica_config_num_pipeline_stages",
"1",
"--replica_scheduler_config_type",
"vllm_v1",
"--decode_cuda_graph_mode",
"piecewise",
"--vllm_v1_scheduler_config_batch_size_cap",
"16",
"--vllm_v1_scheduler_config_max_tokens_in_batch",
"8192",
"--vllm_v1_scheduler_config_long_prefill_token_threshold",
"0",
"--vllm_v1_scheduler_config_block_size",
"16",
"--vllm_v1_scheduler_config_num_blocks_mode",
"explicit",
"--vllm_v1_scheduler_config_gpu_memory_utilization",
"0.92",
"--vllm_v1_scheduler_config_non_kv_cache_overhead_bytes",
"0",
"--request_generator_config_type",
"trace_replay",
"--trace_request_generator_config_trace_file",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/inputs/tp1-frontier.csv",
"--trace_request_generator_config_max_tokens",
"40960",
"--metrics_config_output_dir",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/sim/tp1_mns16/metrics",
"--metrics_config_run_id",
"joint_tp1_mns16",
"--metrics_config_write_metrics",
"--metrics_config_store_request_metrics",
"--metrics_config_store_batch_metrics",
"--metrics_config_store_token_completion_metrics",
"--metrics_config_store_utilization_metrics",
"--no-metrics_config_store_plots",
"--no-metrics_config_enable_chrome_trace",
"--no-metrics_config_write_json_trace",
"--metrics_config_store_frontier_stage_batch_ledger",
"--no-random_forrest_execution_time_predictor_config_enable_dummy_mode",
"--random_forrest_execution_time_predictor_config_linear_op_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/profile-v4-trace-final/linear_op.csv",
"--random_forrest_execution_time_predictor_config_atten_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/profile-v4-trace-final/attention.csv",
"--random_forrest_execution_time_predictor_config_moe_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/profile-v4-trace-final/moe.csv",
"--random_forrest_execution_time_predictor_config_linear_op_kernel_only_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/frozen-kernel-only/linear_op.csv",
"--random_forrest_execution_time_predictor_config_atten_kernel_only_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/frozen-kernel-only/attention.csv",
"--random_forrest_execution_time_predictor_config_moe_kernel_only_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/frozen-kernel-only/moe.csv",
"--random_forrest_execution_time_predictor_config_prediction_max_prefill_chunk_size",
"8192",
"--random_forrest_execution_time_predictor_config_prediction_max_batch_size",
"32",
"--random_forrest_execution_time_predictor_config_prediction_max_tokens_per_request",
"40960",
"--random_forrest_execution_time_predictor_config_no_cache",
"--random_forrest_execution_time_predictor_config_skip_cpu_overhead_modeling",
"--vllm_v1_scheduler_config_num_blocks",
"20128",
"--vllm_v1_scheduler_config_enable_chunked_prefill",
"--random_forrest_execution_time_predictor_config_num_training_job_threads",
"4",
"--cudagraph_capture_sizes",
"1",
"2",
"4",
"8",
"16",
"24",
"32",
"--vidur_cc_backend_config_all_reduce_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/measured-allreduce.csv",
"--vidur_cc_backend_config_cache_dir",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/cc-cache",
"--vidur_cc_backend_config_k_fold_cv_splits",
"6",
"--vidur_cc_backend_config_num_training_job_threads",
"1",
"--metrics_config_cache_dir",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/model-cache"
],
"log": "/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/logs/tp1_mns16.log",
"source_command": "/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-lo-fixed-pd-cells/sim/fixed-pd/runs/tp1_mns16/tp1/command.json",
"source_command_sha256": "a9815797b1601bf6f6cdf0269e84acb376a84945609e338868dc8347aab650e6",
"usage": "/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/usage/tp1_mns16.json"
},
"tp2_mns16": {
"argv": [
"/usr/bin/python3",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/run_frontier_with_curves.py",
"--simulation_mode",
"online",
"--sys_arch",
"co-location",
"--cc_backend_config_type",
"vidur",
"--cluster_config_num_replicas",
"1",
"--cluster_scheduler_config_type",
"sticky_round_robin",
"--replica_config_model_name",
"qwen3-a3b-30b-moe",
"--replica_config_device",
"h20",
"--replica_config_network_device",
"h20_dgx",
"--replica_config_attn_tensor_parallel_size",
"2",
"--replica_config_attn_data_parallel_size",
"1",
"--replica_config_moe_tensor_parallel_size",
"2",
"--replica_config_moe_expert_parallel_size",
"1",
"--replica_config_num_pipeline_stages",
"1",
"--replica_scheduler_config_type",
"vllm_v1",
"--decode_cuda_graph_mode",
"piecewise",
"--vllm_v1_scheduler_config_batch_size_cap",
"16",
"--vllm_v1_scheduler_config_max_tokens_in_batch",
"8192",
"--vllm_v1_scheduler_config_long_prefill_token_threshold",
"0",
"--vllm_v1_scheduler_config_block_size",
"16",
"--vllm_v1_scheduler_config_num_blocks_mode",
"explicit",
"--vllm_v1_scheduler_config_gpu_memory_utilization",
"0.92",
"--vllm_v1_scheduler_config_non_kv_cache_overhead_bytes",
"0",
"--request_generator_config_type",
"trace_replay",
"--trace_request_generator_config_trace_file",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/inputs/tp2-frontier.csv",
"--trace_request_generator_config_max_tokens",
"40960",
"--metrics_config_output_dir",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/sim/tp2_mns16/metrics",
"--metrics_config_run_id",
"joint_tp2_mns16",
"--metrics_config_write_metrics",
"--metrics_config_store_request_metrics",
"--metrics_config_store_batch_metrics",
"--metrics_config_store_token_completion_metrics",
"--metrics_config_store_utilization_metrics",
"--no-metrics_config_store_plots",
"--no-metrics_config_enable_chrome_trace",
"--no-metrics_config_write_json_trace",
"--metrics_config_store_frontier_stage_batch_ledger",
"--no-random_forrest_execution_time_predictor_config_enable_dummy_mode",
"--random_forrest_execution_time_predictor_config_linear_op_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/profile-v4-trace-final/linear_op.csv",
"--random_forrest_execution_time_predictor_config_atten_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/profile-v4-trace-final/attention.csv",
"--random_forrest_execution_time_predictor_config_moe_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/profile-v4-trace-final/moe.csv",
"--random_forrest_execution_time_predictor_config_linear_op_kernel_only_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/frozen-kernel-only/linear_op.csv",
"--random_forrest_execution_time_predictor_config_atten_kernel_only_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/frozen-kernel-only/attention.csv",
"--random_forrest_execution_time_predictor_config_moe_kernel_only_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/frozen-kernel-only/moe.csv",
"--random_forrest_execution_time_predictor_config_prediction_max_prefill_chunk_size",
"8192",
"--random_forrest_execution_time_predictor_config_prediction_max_batch_size",
"32",
"--random_forrest_execution_time_predictor_config_prediction_max_tokens_per_request",
"40960",
"--random_forrest_execution_time_predictor_config_no_cache",
"--random_forrest_execution_time_predictor_config_skip_cpu_overhead_modeling",
"--vllm_v1_scheduler_config_num_blocks",
"76620",
"--vllm_v1_scheduler_config_enable_chunked_prefill",
"--random_forrest_execution_time_predictor_config_num_training_job_threads",
"4",
"--cudagraph_capture_sizes",
"1",
"2",
"4",
"8",
"16",
"24",
"32",
"--vidur_cc_backend_config_all_reduce_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/measured-allreduce.csv",
"--vidur_cc_backend_config_cache_dir",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/cc-cache",
"--vidur_cc_backend_config_k_fold_cv_splits",
"6",
"--vidur_cc_backend_config_num_training_job_threads",
"1",
"--metrics_config_cache_dir",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/model-cache"
],
"log": "/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/logs/tp2_mns16.log",
"source_command": "/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-lo-fixed-pd-cells/sim/fixed-pd/runs/tp2_mns16/tp2/command.json",
"source_command_sha256": "61788a8810be301c9dbc006624aa19b6a932bc44d341b836861087833cffc3df",
"usage": "/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/usage/tp2_mns16.json"
},
"tp4_mns16": {
"argv": [
"/usr/bin/python3",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/run_frontier_with_curves.py",
"--simulation_mode",
"online",
"--sys_arch",
"co-location",
"--cc_backend_config_type",
"vidur",
"--cluster_config_num_replicas",
"1",
"--cluster_scheduler_config_type",
"sticky_round_robin",
"--replica_config_model_name",
"qwen3-a3b-30b-moe",
"--replica_config_device",
"h20",
"--replica_config_network_device",
"h20_dgx",
"--replica_config_attn_tensor_parallel_size",
"4",
"--replica_config_attn_data_parallel_size",
"1",
"--replica_config_moe_tensor_parallel_size",
"4",
"--replica_config_moe_expert_parallel_size",
"1",
"--replica_config_num_pipeline_stages",
"1",
"--replica_scheduler_config_type",
"vllm_v1",
"--decode_cuda_graph_mode",
"piecewise",
"--vllm_v1_scheduler_config_batch_size_cap",
"16",
"--vllm_v1_scheduler_config_max_tokens_in_batch",
"8192",
"--vllm_v1_scheduler_config_long_prefill_token_threshold",
"0",
"--vllm_v1_scheduler_config_block_size",
"16",
"--vllm_v1_scheduler_config_num_blocks_mode",
"explicit",
"--vllm_v1_scheduler_config_gpu_memory_utilization",
"0.92",
"--vllm_v1_scheduler_config_non_kv_cache_overhead_bytes",
"0",
"--request_generator_config_type",
"trace_replay",
"--trace_request_generator_config_trace_file",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/inputs/tp4-frontier.csv",
"--trace_request_generator_config_max_tokens",
"40960",
"--metrics_config_output_dir",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/sim/tp4_mns16/metrics",
"--metrics_config_run_id",
"joint_tp4_mns16",
"--metrics_config_write_metrics",
"--metrics_config_store_request_metrics",
"--metrics_config_store_batch_metrics",
"--metrics_config_store_token_completion_metrics",
"--metrics_config_store_utilization_metrics",
"--no-metrics_config_store_plots",
"--no-metrics_config_enable_chrome_trace",
"--no-metrics_config_write_json_trace",
"--metrics_config_store_frontier_stage_batch_ledger",
"--no-random_forrest_execution_time_predictor_config_enable_dummy_mode",
"--random_forrest_execution_time_predictor_config_linear_op_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/profile-v4-trace-final/linear_op.csv",
"--random_forrest_execution_time_predictor_config_atten_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/profile-v4-trace-final/attention.csv",
"--random_forrest_execution_time_predictor_config_moe_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/profile-v4-trace-final/moe.csv",
"--random_forrest_execution_time_predictor_config_linear_op_kernel_only_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/frozen-kernel-only/linear_op.csv",
"--random_forrest_execution_time_predictor_config_atten_kernel_only_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/frozen-kernel-only/attention.csv",
"--random_forrest_execution_time_predictor_config_moe_kernel_only_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/frozen-kernel-only/moe.csv",
"--random_forrest_execution_time_predictor_config_prediction_max_prefill_chunk_size",
"8192",
"--random_forrest_execution_time_predictor_config_prediction_max_batch_size",
"32",
"--random_forrest_execution_time_predictor_config_prediction_max_tokens_per_request",
"40960",
"--random_forrest_execution_time_predictor_config_no_cache",
"--random_forrest_execution_time_predictor_config_skip_cpu_overhead_modeling",
"--vllm_v1_scheduler_config_num_blocks",
"191882",
"--vllm_v1_scheduler_config_enable_chunked_prefill",
"--random_forrest_execution_time_predictor_config_num_training_job_threads",
"4",
"--cudagraph_capture_sizes",
"1",
"2",
"4",
"8",
"16",
"24",
"32",
"--vidur_cc_backend_config_all_reduce_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/measured-allreduce.csv",
"--vidur_cc_backend_config_cache_dir",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/cc-cache",
"--vidur_cc_backend_config_k_fold_cv_splits",
"6",
"--vidur_cc_backend_config_num_training_job_threads",
"1",
"--metrics_config_cache_dir",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/model-cache"
],
"log": "/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/logs/tp4_mns16.log",
"source_command": "/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-lo-fixed-pd-cells/sim/fixed-pd/runs/tp4_mns16/tp4/command.json",
"source_command_sha256": "9bbcf10446336ba5885193f391dd628cd18ff64d91a51ebcd463ffd24be95532",
"usage": "/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/usage/tp4_mns16.json"
},
"tp4_mns32": {
"argv": [
"/usr/bin/python3",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/run_frontier_with_curves.py",
"--simulation_mode",
"online",
"--sys_arch",
"co-location",
"--cc_backend_config_type",
"vidur",
"--cluster_config_num_replicas",
"1",
"--cluster_scheduler_config_type",
"sticky_round_robin",
"--replica_config_model_name",
"qwen3-a3b-30b-moe",
"--replica_config_device",
"h20",
"--replica_config_network_device",
"h20_dgx",
"--replica_config_attn_tensor_parallel_size",
"4",
"--replica_config_attn_data_parallel_size",
"1",
"--replica_config_moe_tensor_parallel_size",
"4",
"--replica_config_moe_expert_parallel_size",
"1",
"--replica_config_num_pipeline_stages",
"1",
"--replica_scheduler_config_type",
"vllm_v1",
"--decode_cuda_graph_mode",
"piecewise",
"--vllm_v1_scheduler_config_batch_size_cap",
"32",
"--vllm_v1_scheduler_config_max_tokens_in_batch",
"8192",
"--vllm_v1_scheduler_config_long_prefill_token_threshold",
"0",
"--vllm_v1_scheduler_config_block_size",
"16",
"--vllm_v1_scheduler_config_num_blocks_mode",
"explicit",
"--vllm_v1_scheduler_config_gpu_memory_utilization",
"0.92",
"--vllm_v1_scheduler_config_non_kv_cache_overhead_bytes",
"0",
"--request_generator_config_type",
"trace_replay",
"--trace_request_generator_config_trace_file",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/inputs/tp4-frontier.csv",
"--trace_request_generator_config_max_tokens",
"40960",
"--metrics_config_output_dir",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/sim/tp4_mns32/metrics",
"--metrics_config_run_id",
"joint_tp4_mns32",
"--metrics_config_write_metrics",
"--metrics_config_store_request_metrics",
"--metrics_config_store_batch_metrics",
"--metrics_config_store_token_completion_metrics",
"--metrics_config_store_utilization_metrics",
"--no-metrics_config_store_plots",
"--no-metrics_config_enable_chrome_trace",
"--no-metrics_config_write_json_trace",
"--metrics_config_store_frontier_stage_batch_ledger",
"--no-random_forrest_execution_time_predictor_config_enable_dummy_mode",
"--random_forrest_execution_time_predictor_config_linear_op_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/profile-v4-trace-final/linear_op.csv",
"--random_forrest_execution_time_predictor_config_atten_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/profile-v4-trace-final/attention.csv",
"--random_forrest_execution_time_predictor_config_moe_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/profile-v4-trace-final/moe.csv",
"--random_forrest_execution_time_predictor_config_linear_op_kernel_only_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/frozen-kernel-only/linear_op.csv",
"--random_forrest_execution_time_predictor_config_atten_kernel_only_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/frozen-kernel-only/attention.csv",
"--random_forrest_execution_time_predictor_config_moe_kernel_only_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/frozen-kernel-only/moe.csv",
"--random_forrest_execution_time_predictor_config_prediction_max_prefill_chunk_size",
"8192",
"--random_forrest_execution_time_predictor_config_prediction_max_batch_size",
"64",
"--random_forrest_execution_time_predictor_config_prediction_max_tokens_per_request",
"40960",
"--random_forrest_execution_time_predictor_config_no_cache",
"--random_forrest_execution_time_predictor_config_skip_cpu_overhead_modeling",
"--vllm_v1_scheduler_config_num_blocks",
"191786",
"--vllm_v1_scheduler_config_enable_chunked_prefill",
"--random_forrest_execution_time_predictor_config_num_training_job_threads",
"4",
"--cudagraph_capture_sizes",
"1",
"2",
"4",
"8",
"16",
"24",
"32",
"40",
"48",
"56",
"64",
"--vidur_cc_backend_config_all_reduce_input_file",
"/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-profiles/measured-allreduce.csv",
"--vidur_cc_backend_config_cache_dir",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/cc-cache",
"--vidur_cc_backend_config_k_fold_cv_splits",
"6",
"--vidur_cc_backend_config_num_training_job_threads",
"1",
"--metrics_config_cache_dir",
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/model-cache"
],
"log": "/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/logs/tp4_mns32.log",
"source_command": "/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-lo-fixed-pd-cells/sim/fixed-pd/runs/tp4_mns32/tp4/command.json",
"source_command_sha256": "fbc7dee55590b415ed1cde8072de835ed155a0c20ba0eb305c3cb22aa8065a51",
"usage": "/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/usage/tp4_mns32.json"
}
},
"collective_curve": "/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/results/collective-curve.json",
"collective_curve_sha256": "f9543649d4ea78f08240bf1284ab74083aa5cf5671ed47e386047f1453300b36",
"collective_curve_variant": "drop_mean",
"frontier_checkout": "/tmp/frontier-attn-structured-v0",
"frontier_commit": "1f8900a4ac64e45754b03d0aa7c1dddab65785cf",
"mode": "joint",
"model_cache": "/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/model-cache",
"moe_curve": "/home/gahow/phd/aituner/runs/frontier-fused-moe-profile-v0/results/fused-moe-curve.json",
"moe_curve_sha256": "b94d65d9d581adefcc6c14ed4920cce6a1136f74f1014737dc3e4249bc8250d2",
"python": "/usr/bin/python3",
"python_dependency_roots": [
"/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/python-deps",
"/home/gahow/.cache/uv/archive-v0/-_kzErLcPO5nASZFX8b9k",
"/home/gahow/.cache/uv/archive-v0/FbaBs_QJ9QKEbQ9V_4aIR",
"/home/gahow/.cache/uv/archive-v0/fuHsGXD0Lv_UjFC8yI4-7",
"/home/gahow/.cache/uv/archive-v0/jFGdqQLpB1eopfm9VxT3j",
"/home/gahow/.cache/uv/archive-v0/YWW6ExSJuPVvv4-qYQTin",
"/home/gahow/.cache/uv/archive-v0/3_qxZ5Ll-EpVAGZfbksfe"
],
"traces": {
"1": {
"first_arrival_s": 0.0,
"last_arrival_s": 595.348837209302,
"requests": 129,
"source_request_metrics": "/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-lo-fixed-pd-cells/sim/fixed-pd/runs/tp1_mns16/tp1/metrics/qwen3_a3b_30b_moe/online_serving/qwen30_trace_tp1_mns16_tp1/request_metrics.csv",
"source_sha256": "0b82e09644a5884fcd10d894b68495daefdabb32b770146c2f9ece37b8469f4f",
"trace": "/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/inputs/tp1-frontier.csv",
"trace_sha256": "59dd8996ff879ef94330004104dfdf515b791bce4036576eccc93290e9206dad"
},
"2": {
"first_arrival_s": 0.0,
"last_arrival_s": 297.674418604651,
"requests": 129,
"source_request_metrics": "/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-lo-fixed-pd-cells/sim/fixed-pd/runs/tp2_mns16/tp2/metrics/qwen3_a3b_30b_moe/online_serving/qwen30_trace_tp2_mns16_tp2/request_metrics.csv",
"source_sha256": "33983081bb20dd5e2053e9e3d13def8732e958150c9b47a8609ba345123f2316",
"trace": "/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/inputs/tp2-frontier.csv",
"trace_sha256": "64fc077b38274a76a8279884ac4115836cd1157c95119c64fabac50d81124f69"
},
"4": {
"first_arrival_s": 0.0,
"last_arrival_s": 148.837209302326,
"requests": 129,
"source_request_metrics": "/home/gahow/phd/aituner/runs/frontier-split-rootcause-v0/frozen-inputs/q30-lo-fixed-pd-cells/sim/fixed-pd/runs/tp4_mns16/tp4/metrics/qwen3_a3b_30b_moe/online_serving/qwen30_trace_tp4_mns16_tp4/request_metrics.csv",
"source_sha256": "b36cd383c07b546d2c1f2fac754d5dbb92efd6880316b4233a7aef9fa1115a36",
"trace": "/home/gahow/phd/aituner/runs/frontier-collective-joint-v0/counterfactual/joint-r2/inputs/tp4-frontier.csv",
"trace_sha256": "adb3d6f3932a44c86c3d9e7cf1e57739594e8c48d19a26b5aa54b37dce0e0c19"
}
}
}

View File

@@ -0,0 +1,72 @@
#!/usr/bin/env python3
"""Schematic figure frozen before EXP-ATTN-STRUCTURED execution."""
from pathlib import Path
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
ROOT = Path(__file__).resolve().parent
SURFACE = "#fcfcfb"
INK = "#111111"
MUTED = "#77736c"
GRID = "#dedbd2"
RF = "#d95f02"
STRUCTURED = "#1b75bc"
fig, axes = plt.subplots(1, 2, figsize=(10.8, 4.2), dpi=160)
fig.patch.set_facecolor(SURFACE)
for ax in axes:
ax.set_facecolor(SURFACE)
ax.grid(axis="y", color=GRID, linewidth=0.8)
ax.set_axisbelow(True)
ax.spines[["top", "right"]].set_visible(False)
ax.tick_params(colors=MUTED, labelsize=8)
kv = np.array([8, 16, 24], dtype=float)
actual = np.array([11.97, 19.92, 27.84])
rf = np.array([9.46, 16.40, 24.52])
structured_expected = np.array([12.0, 19.9, 27.9])
axes[0].plot(kv, actual, "o-", color=INK, label="profile actual")
axes[0].plot(kv, rf, "s--", color=RF, label="current RF")
axes[0].plot(
kv,
structured_expected,
"^:",
color=STRUCTURED,
label="structured (expected)",
)
axes[0].set_xlabel("KV context (ktok)")
axes[0].set_ylabel("TP1 q8k attention time (ms)")
axes[0].set_title("(a) Continuous KV growth", loc="left", fontsize=10)
axes[0].legend(frameon=False, fontsize=8)
labels = ["TP1\n.00125", "TP1\n.0025", "TP2\n.0025", "TP2\n.005",
"TP4\n.0025", "TP4\n.005", "TP4\n.01"]
x = np.arange(len(labels))
v5_mean = np.array([-13.5, -17.7, -11.2, -14.1, 2.5, 2.9, -0.2])
expected = np.array([-5, -8, -9, -11, 3, 3, 0])
axes[1].axhspan(-15, 15, color=GRID, alpha=0.5)
axes[1].axhline(0, color=MUTED, linewidth=0.8)
axes[1].plot(x, v5_mean, "o-", color=RF, label="sim-v5 measured")
axes[1].plot(x, expected, "s--", color=STRUCTURED, label="H1 expected")
axes[1].set_xticks(x, labels)
axes[1].set_ylabel("TTFT mean bias (%)")
axes[1].set_title("(b) 7-cell trace gate", loc="left", fontsize=10)
axes[1].legend(frameon=False, fontsize=8)
fig.suptitle(
"MOCK / schematic — EXP-ATTN-STRUCTURED (not measured results)",
x=0.01,
ha="left",
color=RF,
fontsize=9,
)
fig.tight_layout(rect=(0, 0, 1, 0.95))
fig.savefig(ROOT / "figure-prototype.png", facecolor=SURFACE)
fig.savefig(ROOT / "figure-prototype.svg", facecolor=SURFACE)
print(ROOT / "figure-prototype.png")

View File

@@ -0,0 +1,10 @@
candidate,training_rows,grid_fit_mape_pct,single_fit_mape_pct,heldout_context_mape_pct,heldout_context_max_abs_error_pct,prediction_min_ms,q_min_delta_ms,kv_min_delta_ms,monotone_and_nonnegative,tp
rf_all,29,15.074275515235467,19.842994757611535,44.40139318281943,82.78279487156401,0.06029164119272453,0.0,-4.2841601371801374e-05,False,1
rf_single,23,11.834992526698676,22.893412972496023,34.45356428541224,62.49334437588834,0.059327708247725125,-0.00022153525203457564,-1.4336001873005433e-05,False,1
structured_single,23,0.8432511364168856,2.227110646811972,0.841926169535806,2.0408978739639134,0.05679146709541477,0.0,0.0016745062683911627,True,1
rf_all,29,13.812689689573157,17.879870012606048,44.20143320278334,82.0656368501208,0.06000113548192927,-0.004361070463210395,-0.009949388915300408,False,2
rf_single,23,10.738962684891058,20.818820413545826,34.84360402100271,66.67253880294443,0.059971319361210015,-0.003811210796127021,-0.009949388915300408,False,2
structured_single,23,1.518412258922364,6.226292654776418,1.6047958673086566,3.464671475193195,0.05767893331746252,0.0,0.0013929374121726124,True,2
rf_all,29,14.117015331381916,15.49366794487052,43.53650868837558,81.33508178007524,0.05866772018640992,-0.0009967416035880083,-5.5955198407176e-05,False,4
rf_single,23,12.07517666989496,17.672692652721008,34.14562332866605,62.31478818862995,0.058213693721655094,-0.0012244979345549661,-8.259841203689389e-05,False,4
structured_single,23,3.088740104976349,5.969109476280061,3.0103379904473164,5.490598706238697,0.05747733327249683,0.0,0.0012048051417407057,True,4
1 candidate training_rows grid_fit_mape_pct single_fit_mape_pct heldout_context_mape_pct heldout_context_max_abs_error_pct prediction_min_ms q_min_delta_ms kv_min_delta_ms monotone_and_nonnegative tp
2 rf_all 29 15.074275515235467 19.842994757611535 44.40139318281943 82.78279487156401 0.06029164119272453 0.0 -4.2841601371801374e-05 False 1
3 rf_single 23 11.834992526698676 22.893412972496023 34.45356428541224 62.49334437588834 0.059327708247725125 -0.00022153525203457564 -1.4336001873005433e-05 False 1
4 structured_single 23 0.8432511364168856 2.227110646811972 0.841926169535806 2.0408978739639134 0.05679146709541477 0.0 0.0016745062683911627 True 1
5 rf_all 29 13.812689689573157 17.879870012606048 44.20143320278334 82.0656368501208 0.06000113548192927 -0.004361070463210395 -0.009949388915300408 False 2
6 rf_single 23 10.738962684891058 20.818820413545826 34.84360402100271 66.67253880294443 0.059971319361210015 -0.003811210796127021 -0.009949388915300408 False 2
7 structured_single 23 1.518412258922364 6.226292654776418 1.6047958673086566 3.464671475193195 0.05767893331746252 0.0 0.0013929374121726124 True 2
8 rf_all 29 14.117015331381916 15.49366794487052 43.53650868837558 81.33508178007524 0.05866772018640992 -0.0009967416035880083 -5.5955198407176e-05 False 4
9 rf_single 23 12.07517666989496 17.672692652721008 34.14562332866605 62.31478818862995 0.058213693721655094 -0.0012244979345549661 -8.259841203689389e-05 False 4
10 structured_single 23 3.088740104976349 5.969109476280061 3.0103379904473164 5.490598706238697 0.05747733327249683 0.0 0.0012048051417407057 True 4

View File

@@ -0,0 +1,149 @@
{
"schema": "frontier-attn-structured-ablation-v1",
"profile": "/home/gahow/phd/aituner/runs/frontier-prefill-kvgrowth-fix-v0/profiles/profile-v5-kvgrowth/attention.csv",
"frontier_checkout": "/tmp/frontier-attn-structured-v0",
"data_audit": {
"tp1": {
"standard_rows": 29,
"single_request_rows": 23,
"target_grid_rows": 10,
"duplicate_feature_groups": 4
},
"tp2": {
"standard_rows": 29,
"single_request_rows": 23,
"target_grid_rows": 10,
"duplicate_feature_groups": 4
},
"tp4": {
"standard_rows": 29,
"single_request_rows": 23,
"target_grid_rows": 10,
"duplicate_feature_groups": 4
}
},
"results": [
{
"candidate": "rf_all",
"training_rows": 29,
"grid_fit_mape_pct": 15.074275515235467,
"single_fit_mape_pct": 19.842994757611535,
"heldout_context_mape_pct": 44.40139318281943,
"heldout_context_max_abs_error_pct": 82.78279487156401,
"prediction_min_ms": 0.06029164119272453,
"q_min_delta_ms": 0.0,
"kv_min_delta_ms": -4.2841601371801374e-05,
"monotone_and_nonnegative": false,
"tp": 1
},
{
"candidate": "rf_single",
"training_rows": 23,
"grid_fit_mape_pct": 11.834992526698676,
"single_fit_mape_pct": 22.893412972496023,
"heldout_context_mape_pct": 34.45356428541224,
"heldout_context_max_abs_error_pct": 62.49334437588834,
"prediction_min_ms": 0.059327708247725125,
"q_min_delta_ms": -0.00022153525203457564,
"kv_min_delta_ms": -1.4336001873005433e-05,
"monotone_and_nonnegative": false,
"tp": 1
},
{
"candidate": "structured_single",
"training_rows": 23,
"grid_fit_mape_pct": 0.8432511364168856,
"single_fit_mape_pct": 2.227110646811972,
"heldout_context_mape_pct": 0.841926169535806,
"heldout_context_max_abs_error_pct": 2.0408978739639134,
"prediction_min_ms": 0.05679146709541477,
"q_min_delta_ms": 0.0,
"kv_min_delta_ms": 0.0016745062683911627,
"monotone_and_nonnegative": true,
"tp": 1
},
{
"candidate": "rf_all",
"training_rows": 29,
"grid_fit_mape_pct": 13.812689689573157,
"single_fit_mape_pct": 17.879870012606048,
"heldout_context_mape_pct": 44.20143320278334,
"heldout_context_max_abs_error_pct": 82.0656368501208,
"prediction_min_ms": 0.06000113548192927,
"q_min_delta_ms": -0.004361070463210395,
"kv_min_delta_ms": -0.009949388915300408,
"monotone_and_nonnegative": false,
"tp": 2
},
{
"candidate": "rf_single",
"training_rows": 23,
"grid_fit_mape_pct": 10.738962684891058,
"single_fit_mape_pct": 20.818820413545826,
"heldout_context_mape_pct": 34.84360402100271,
"heldout_context_max_abs_error_pct": 66.67253880294443,
"prediction_min_ms": 0.059971319361210015,
"q_min_delta_ms": -0.003811210796127021,
"kv_min_delta_ms": -0.009949388915300408,
"monotone_and_nonnegative": false,
"tp": 2
},
{
"candidate": "structured_single",
"training_rows": 23,
"grid_fit_mape_pct": 1.518412258922364,
"single_fit_mape_pct": 6.226292654776418,
"heldout_context_mape_pct": 1.6047958673086566,
"heldout_context_max_abs_error_pct": 3.464671475193195,
"prediction_min_ms": 0.05767893331746252,
"q_min_delta_ms": 0.0,
"kv_min_delta_ms": 0.0013929374121726124,
"monotone_and_nonnegative": true,
"tp": 2
},
{
"candidate": "rf_all",
"training_rows": 29,
"grid_fit_mape_pct": 14.117015331381916,
"single_fit_mape_pct": 15.49366794487052,
"heldout_context_mape_pct": 43.53650868837558,
"heldout_context_max_abs_error_pct": 81.33508178007524,
"prediction_min_ms": 0.05866772018640992,
"q_min_delta_ms": -0.0009967416035880083,
"kv_min_delta_ms": -5.5955198407176e-05,
"monotone_and_nonnegative": false,
"tp": 4
},
{
"candidate": "rf_single",
"training_rows": 23,
"grid_fit_mape_pct": 12.07517666989496,
"single_fit_mape_pct": 17.672692652721008,
"heldout_context_mape_pct": 34.14562332866605,
"heldout_context_max_abs_error_pct": 62.31478818862995,
"prediction_min_ms": 0.058213693721655094,
"q_min_delta_ms": -0.0012244979345549661,
"kv_min_delta_ms": -8.259841203689389e-05,
"monotone_and_nonnegative": false,
"tp": 4
},
{
"candidate": "structured_single",
"training_rows": 23,
"grid_fit_mape_pct": 3.088740104976349,
"single_fit_mape_pct": 5.969109476280061,
"heldout_context_mape_pct": 3.0103379904473164,
"heldout_context_max_abs_error_pct": 5.490598706238697,
"prediction_min_ms": 0.05747733327249683,
"q_min_delta_ms": 0.0,
"kv_min_delta_ms": 0.0012048051417407057,
"monotone_and_nonnegative": true,
"tp": 4
}
],
"checks": {
"heldout_context_mape_le_5pct": true,
"monotone_and_nonnegative": true,
"profile_gate": true
}
}

View File

@@ -0,0 +1,85 @@
cell,metric,quantile,old_bias,new_bias,abs_bias_delta_pp,validity
tp1_rho0p00125,ttft,mean,-0.13461915993830945,-0.06328385143753473,-7.133530850077471,GATE_FAIL_DIAGNOSTIC
tp1_rho0p00125,ttft,p50,-0.1888032883165517,-0.1117698463137391,-7.7033442002812595,GATE_FAIL_DIAGNOSTIC
tp1_rho0p00125,ttft,p90,-0.23223319000679374,-0.0884727580604037,-14.376043194639005,GATE_FAIL_DIAGNOSTIC
tp1_rho0p00125,ttft,p99,-0.16824856840168442,-0.08585570369326061,-8.239286470842382,GATE_FAIL_DIAGNOSTIC
tp1_rho0p00125,tpot,mean,0.1305653876178269,0.14303898259628217,1.2473594978455265,GATE_FAIL_DIAGNOSTIC
tp1_rho0p00125,tpot,p50,0.16837991778063455,0.1688780144991309,0.04980967184963492,GATE_FAIL_DIAGNOSTIC
tp1_rho0p00125,tpot,p90,0.012855564422932954,0.02293841255516459,1.0082848132231637,GATE_FAIL_DIAGNOSTIC
tp1_rho0p00125,tpot,p99,-0.08151080694091946,-0.06480973978913974,-1.6701067151779714,GATE_FAIL_DIAGNOSTIC
tp1_rho0p00125,e2e,mean,0.06539157436639341,0.0838094906426525,1.8417916276259092,GATE_FAIL_DIAGNOSTIC
tp1_rho0p00125,e2e,p50,0.10867934171755954,0.11142188099086506,0.2742539273305519,GATE_FAIL_DIAGNOSTIC
tp1_rho0p00125,e2e,p90,0.10946179160934073,0.11872607178176105,0.9264280172420314,GATE_FAIL_DIAGNOSTIC
tp1_rho0p00125,e2e,p99,-0.0657146472433028,-0.04585643943465822,-1.9858207808644577,GATE_FAIL_DIAGNOSTIC
tp1_rho0p0025,ttft,mean,-0.17677087458166194,-0.09487906467830536,-8.189180990335657,GATE_FAIL_DIAGNOSTIC
tp1_rho0p0025,ttft,p50,0.008311436147272566,0.015508635458377175,0.7197199311104608,GATE_FAIL_DIAGNOSTIC
tp1_rho0p0025,ttft,p90,-0.2608553178054708,-0.129865645852306,-13.098967195316478,GATE_FAIL_DIAGNOSTIC
tp1_rho0p0025,ttft,p99,-0.22116442296103195,-0.14410151018893788,-7.706291277209407,GATE_FAIL_DIAGNOSTIC
tp1_rho0p0025,tpot,mean,0.014380733682430142,0.052302860177306544,3.7922126494876403,GATE_FAIL_DIAGNOSTIC
tp1_rho0p0025,tpot,p50,0.13351145963877706,0.14244154194999165,0.8930082311214588,GATE_FAIL_DIAGNOSTIC
tp1_rho0p0025,tpot,p90,-0.05456950130438105,0.018069551387063856,-3.649994991731719,GATE_FAIL_DIAGNOSTIC
tp1_rho0p0025,tpot,p99,-0.23635406197836167,-0.1790206784227079,-5.733338355565376,GATE_FAIL_DIAGNOSTIC
tp1_rho0p0025,e2e,mean,-0.020164189983441452,0.01563919326555167,-0.4524996717889782,GATE_FAIL_DIAGNOSTIC
tp1_rho0p0025,e2e,p50,0.07632815851795742,0.10505951594320918,2.8731357425251765,GATE_FAIL_DIAGNOSTIC
tp1_rho0p0025,e2e,p90,0.049809009042946335,0.08165607475145953,3.1847065708513194,GATE_FAIL_DIAGNOSTIC
tp1_rho0p0025,e2e,p99,-0.18303183751478602,-0.15333409130015813,-2.96977462146279,GATE_FAIL_DIAGNOSTIC
tp2_rho0p0025,ttft,mean,-0.11161154024124531,-0.045433491316312524,-6.617804892493279,PASS_SUBCRITICAL
tp2_rho0p0025,ttft,p50,-0.18420934047220774,-0.0875990583320057,-9.661028214020204,PASS_SUBCRITICAL
tp2_rho0p0025,ttft,p90,-0.21836264490202395,-0.1142200855839675,-10.414255931805645,PASS_SUBCRITICAL
tp2_rho0p0025,ttft,p99,-0.17283197594971011,-0.07674087497700505,-9.609110097270507,PASS_SUBCRITICAL
tp2_rho0p0025,tpot,mean,0.13711499081487563,0.15073709978689778,1.362210897202215,PASS_SUBCRITICAL
tp2_rho0p0025,tpot,p50,0.17555321305308488,0.18527285925405948,0.9719646200974597,PASS_SUBCRITICAL
tp2_rho0p0025,tpot,p90,0.0591579975137338,0.07863996768588354,1.9481970172149734,PASS_SUBCRITICAL
tp2_rho0p0025,tpot,p99,0.1300483675091633,0.1661995397125918,3.6151172203428503,PASS_SUBCRITICAL
tp2_rho0p0025,e2e,mean,0.10925353865257875,0.12696146154030977,1.7707922887731016,PASS_SUBCRITICAL
tp2_rho0p0025,e2e,p50,0.1339165600755408,0.14796251184179712,1.404595176625631,PASS_SUBCRITICAL
tp2_rho0p0025,e2e,p90,0.10666828724664539,0.12767235986604622,2.1004072619400835,PASS_SUBCRITICAL
tp2_rho0p0025,e2e,p99,-0.07437942975605877,-0.03965040123988098,-3.472902851617779,PASS_SUBCRITICAL
tp2_rho0p005,ttft,mean,-0.14129871969878843,-0.07082500585057615,-7.047371384821228,GATE_FAIL_DIAGNOSTIC
tp2_rho0p005,ttft,p50,-0.2042045530944649,-0.1284088888361358,-7.579566425832909,GATE_FAIL_DIAGNOSTIC
tp2_rho0p005,ttft,p90,-0.19003454588767263,-0.111136573344055,-7.889797254361763,GATE_FAIL_DIAGNOSTIC
tp2_rho0p005,ttft,p99,-0.19373351009539902,-0.09012556161973535,-10.360794847566366,GATE_FAIL_DIAGNOSTIC
tp2_rho0p005,tpot,mean,0.03117337438562004,0.05457336599027876,2.3399991604658723,GATE_FAIL_DIAGNOSTIC
tp2_rho0p005,tpot,p50,0.07668249597302182,0.0872512146277895,1.0568718654767675,GATE_FAIL_DIAGNOSTIC
tp2_rho0p005,tpot,p90,-0.03724827658429621,0.01132352325010614,-2.5924753334190074,GATE_FAIL_DIAGNOSTIC
tp2_rho0p005,tpot,p99,-0.10050436157089844,-0.05948329733667248,-4.102106423422596,GATE_FAIL_DIAGNOSTIC
tp2_rho0p005,e2e,mean,0.023867807624916495,0.050164236759908075,2.629642913499158,GATE_FAIL_DIAGNOSTIC
tp2_rho0p005,e2e,p50,0.07536668131278851,0.0912493994395978,1.588271812680929,GATE_FAIL_DIAGNOSTIC
tp2_rho0p005,e2e,p90,-0.03100470462321266,-0.0004979191794830456,-3.0506785443729614,GATE_FAIL_DIAGNOSTIC
tp2_rho0p005,e2e,p99,-0.04909581632382212,-0.0014369075488634014,-4.765890877495872,GATE_FAIL_DIAGNOSTIC
tp4_rho0p0025,ttft,mean,0.025022574738277282,0.07766646565061346,5.2643890912336175,PASS_SUBCRITICAL
tp4_rho0p0025,ttft,p50,-0.040042171846277425,0.029153379043297147,-1.0888792802980278,PASS_SUBCRITICAL
tp4_rho0p0025,ttft,p90,-0.056230097634382616,0.025222989748299444,-3.100710788608317,PASS_SUBCRITICAL
tp4_rho0p0025,ttft,p99,-0.07535478089127973,0.0205549324689376,-5.479984842234213,PASS_SUBCRITICAL
tp4_rho0p0025,tpot,mean,0.2170232618103144,0.2295170016795841,1.2493739869269715,PASS_SUBCRITICAL
tp4_rho0p0025,tpot,p50,0.22406751004936917,0.22406940610958842,0.00018960602192474862,PASS_SUBCRITICAL
tp4_rho0p0025,tpot,p90,0.1725668492041552,0.1795965483385546,0.7029699134399409,PASS_SUBCRITICAL
tp4_rho0p0025,tpot,p99,0.1603764334794579,0.254199450927048,9.382301744759008,PASS_SUBCRITICAL
tp4_rho0p0025,e2e,mean,0.18328079455378776,0.19190660476104554,0.8625810207257778,PASS_SUBCRITICAL
tp4_rho0p0025,e2e,p50,0.2057109615696404,0.21253242300694286,0.6821461437302473,PASS_SUBCRITICAL
tp4_rho0p0025,e2e,p90,0.1869703879211648,0.19279855916666536,0.5828171245500557,PASS_SUBCRITICAL
tp4_rho0p0025,e2e,p99,0.14838304065885655,0.15160588346499027,0.3222842806133719,PASS_SUBCRITICAL
tp4_rho0p005,ttft,mean,0.028648879997638963,0.08356973519379125,5.492085519615229,PASS_SUBCRITICAL
tp4_rho0p005,ttft,p50,0.028237979190582876,0.09021324737193111,6.197526818134823,PASS_SUBCRITICAL
tp4_rho0p005,ttft,p90,-0.055961238578361966,-0.0006012940489499138,-5.535994452941205,PASS_SUBCRITICAL
tp4_rho0p005,ttft,p99,-0.045491187615110146,0.05253708684194205,0.7045899226831902,PASS_SUBCRITICAL
tp4_rho0p005,tpot,mean,0.1707193936623511,0.1813506819061229,1.0631288243771824,PASS_SUBCRITICAL
tp4_rho0p005,tpot,p50,0.16851374859025317,0.1743324539248605,0.5818705334607321,PASS_SUBCRITICAL
tp4_rho0p005,tpot,p90,0.10492621353626864,0.11816822907155744,1.3242015535288796,PASS_SUBCRITICAL
tp4_rho0p005,tpot,p99,0.31231888769471766,0.3662267201704473,5.390783247572961,PASS_SUBCRITICAL
tp4_rho0p005,e2e,mean,0.151102823467785,0.1630793421767109,1.197651870892591,PASS_SUBCRITICAL
tp4_rho0p005,e2e,p50,0.1594213531394918,0.17360527090575292,1.418391776626113,PASS_SUBCRITICAL
tp4_rho0p005,e2e,p90,0.1266352410718406,0.13652104764058856,0.9885806568747962,PASS_SUBCRITICAL
tp4_rho0p005,e2e,p99,0.15576537699445703,0.17677450343779522,2.100912644333819,PASS_SUBCRITICAL
tp4_rho0p01,ttft,mean,-0.0014652143973501086,0.059650620031540064,5.8185405634189955,PASS_SUBCRITICAL
tp4_rho0p01,ttft,p50,0.22936601881498542,0.24159106387124998,1.2225045056264565,PASS_SUBCRITICAL
tp4_rho0p01,ttft,p90,-0.0646093465409875,-0.011548419893895705,-5.30609266470918,PASS_SUBCRITICAL
tp4_rho0p01,ttft,p99,-0.09621678853313553,-0.015475807392170575,-8.074098114096495,PASS_SUBCRITICAL
tp4_rho0p01,tpot,mean,0.06675609059150077,0.10596101263201793,3.9204922040517163,PASS_SUBCRITICAL
tp4_rho0p01,tpot,p50,0.08477302587551214,0.09703754188844527,1.2264516012933129,PASS_SUBCRITICAL
tp4_rho0p01,tpot,p90,0.0379183273767328,0.08369800201750718,4.577967464077439,PASS_SUBCRITICAL
tp4_rho0p01,tpot,p99,-0.010663954751357074,0.06667813160571406,5.601417685435699,PASS_SUBCRITICAL
tp4_rho0p01,e2e,mean,0.07212904317306096,0.09777288053702092,2.564383736395996,PASS_SUBCRITICAL
tp4_rho0p01,e2e,p50,0.12069215463307655,0.1388377217196832,1.8145567086606653,PASS_SUBCRITICAL
tp4_rho0p01,e2e,p90,0.03317293927357903,0.058060760567474216,2.4887821293895183,PASS_SUBCRITICAL
tp4_rho0p01,e2e,p99,0.0338378271163308,0.06380410696893425,2.996627985260345,PASS_SUBCRITICAL
1 cell metric quantile old_bias new_bias abs_bias_delta_pp validity
2 tp1_rho0p00125 ttft mean -0.13461915993830945 -0.06328385143753473 -7.133530850077471 GATE_FAIL_DIAGNOSTIC
3 tp1_rho0p00125 ttft p50 -0.1888032883165517 -0.1117698463137391 -7.7033442002812595 GATE_FAIL_DIAGNOSTIC
4 tp1_rho0p00125 ttft p90 -0.23223319000679374 -0.0884727580604037 -14.376043194639005 GATE_FAIL_DIAGNOSTIC
5 tp1_rho0p00125 ttft p99 -0.16824856840168442 -0.08585570369326061 -8.239286470842382 GATE_FAIL_DIAGNOSTIC
6 tp1_rho0p00125 tpot mean 0.1305653876178269 0.14303898259628217 1.2473594978455265 GATE_FAIL_DIAGNOSTIC
7 tp1_rho0p00125 tpot p50 0.16837991778063455 0.1688780144991309 0.04980967184963492 GATE_FAIL_DIAGNOSTIC
8 tp1_rho0p00125 tpot p90 0.012855564422932954 0.02293841255516459 1.0082848132231637 GATE_FAIL_DIAGNOSTIC
9 tp1_rho0p00125 tpot p99 -0.08151080694091946 -0.06480973978913974 -1.6701067151779714 GATE_FAIL_DIAGNOSTIC
10 tp1_rho0p00125 e2e mean 0.06539157436639341 0.0838094906426525 1.8417916276259092 GATE_FAIL_DIAGNOSTIC
11 tp1_rho0p00125 e2e p50 0.10867934171755954 0.11142188099086506 0.2742539273305519 GATE_FAIL_DIAGNOSTIC
12 tp1_rho0p00125 e2e p90 0.10946179160934073 0.11872607178176105 0.9264280172420314 GATE_FAIL_DIAGNOSTIC
13 tp1_rho0p00125 e2e p99 -0.0657146472433028 -0.04585643943465822 -1.9858207808644577 GATE_FAIL_DIAGNOSTIC
14 tp1_rho0p0025 ttft mean -0.17677087458166194 -0.09487906467830536 -8.189180990335657 GATE_FAIL_DIAGNOSTIC
15 tp1_rho0p0025 ttft p50 0.008311436147272566 0.015508635458377175 0.7197199311104608 GATE_FAIL_DIAGNOSTIC
16 tp1_rho0p0025 ttft p90 -0.2608553178054708 -0.129865645852306 -13.098967195316478 GATE_FAIL_DIAGNOSTIC
17 tp1_rho0p0025 ttft p99 -0.22116442296103195 -0.14410151018893788 -7.706291277209407 GATE_FAIL_DIAGNOSTIC
18 tp1_rho0p0025 tpot mean 0.014380733682430142 0.052302860177306544 3.7922126494876403 GATE_FAIL_DIAGNOSTIC
19 tp1_rho0p0025 tpot p50 0.13351145963877706 0.14244154194999165 0.8930082311214588 GATE_FAIL_DIAGNOSTIC
20 tp1_rho0p0025 tpot p90 -0.05456950130438105 0.018069551387063856 -3.649994991731719 GATE_FAIL_DIAGNOSTIC
21 tp1_rho0p0025 tpot p99 -0.23635406197836167 -0.1790206784227079 -5.733338355565376 GATE_FAIL_DIAGNOSTIC
22 tp1_rho0p0025 e2e mean -0.020164189983441452 0.01563919326555167 -0.4524996717889782 GATE_FAIL_DIAGNOSTIC
23 tp1_rho0p0025 e2e p50 0.07632815851795742 0.10505951594320918 2.8731357425251765 GATE_FAIL_DIAGNOSTIC
24 tp1_rho0p0025 e2e p90 0.049809009042946335 0.08165607475145953 3.1847065708513194 GATE_FAIL_DIAGNOSTIC
25 tp1_rho0p0025 e2e p99 -0.18303183751478602 -0.15333409130015813 -2.96977462146279 GATE_FAIL_DIAGNOSTIC
26 tp2_rho0p0025 ttft mean -0.11161154024124531 -0.045433491316312524 -6.617804892493279 PASS_SUBCRITICAL
27 tp2_rho0p0025 ttft p50 -0.18420934047220774 -0.0875990583320057 -9.661028214020204 PASS_SUBCRITICAL
28 tp2_rho0p0025 ttft p90 -0.21836264490202395 -0.1142200855839675 -10.414255931805645 PASS_SUBCRITICAL
29 tp2_rho0p0025 ttft p99 -0.17283197594971011 -0.07674087497700505 -9.609110097270507 PASS_SUBCRITICAL
30 tp2_rho0p0025 tpot mean 0.13711499081487563 0.15073709978689778 1.362210897202215 PASS_SUBCRITICAL
31 tp2_rho0p0025 tpot p50 0.17555321305308488 0.18527285925405948 0.9719646200974597 PASS_SUBCRITICAL
32 tp2_rho0p0025 tpot p90 0.0591579975137338 0.07863996768588354 1.9481970172149734 PASS_SUBCRITICAL
33 tp2_rho0p0025 tpot p99 0.1300483675091633 0.1661995397125918 3.6151172203428503 PASS_SUBCRITICAL
34 tp2_rho0p0025 e2e mean 0.10925353865257875 0.12696146154030977 1.7707922887731016 PASS_SUBCRITICAL
35 tp2_rho0p0025 e2e p50 0.1339165600755408 0.14796251184179712 1.404595176625631 PASS_SUBCRITICAL
36 tp2_rho0p0025 e2e p90 0.10666828724664539 0.12767235986604622 2.1004072619400835 PASS_SUBCRITICAL
37 tp2_rho0p0025 e2e p99 -0.07437942975605877 -0.03965040123988098 -3.472902851617779 PASS_SUBCRITICAL
38 tp2_rho0p005 ttft mean -0.14129871969878843 -0.07082500585057615 -7.047371384821228 GATE_FAIL_DIAGNOSTIC
39 tp2_rho0p005 ttft p50 -0.2042045530944649 -0.1284088888361358 -7.579566425832909 GATE_FAIL_DIAGNOSTIC
40 tp2_rho0p005 ttft p90 -0.19003454588767263 -0.111136573344055 -7.889797254361763 GATE_FAIL_DIAGNOSTIC
41 tp2_rho0p005 ttft p99 -0.19373351009539902 -0.09012556161973535 -10.360794847566366 GATE_FAIL_DIAGNOSTIC
42 tp2_rho0p005 tpot mean 0.03117337438562004 0.05457336599027876 2.3399991604658723 GATE_FAIL_DIAGNOSTIC
43 tp2_rho0p005 tpot p50 0.07668249597302182 0.0872512146277895 1.0568718654767675 GATE_FAIL_DIAGNOSTIC
44 tp2_rho0p005 tpot p90 -0.03724827658429621 0.01132352325010614 -2.5924753334190074 GATE_FAIL_DIAGNOSTIC
45 tp2_rho0p005 tpot p99 -0.10050436157089844 -0.05948329733667248 -4.102106423422596 GATE_FAIL_DIAGNOSTIC
46 tp2_rho0p005 e2e mean 0.023867807624916495 0.050164236759908075 2.629642913499158 GATE_FAIL_DIAGNOSTIC
47 tp2_rho0p005 e2e p50 0.07536668131278851 0.0912493994395978 1.588271812680929 GATE_FAIL_DIAGNOSTIC
48 tp2_rho0p005 e2e p90 -0.03100470462321266 -0.0004979191794830456 -3.0506785443729614 GATE_FAIL_DIAGNOSTIC
49 tp2_rho0p005 e2e p99 -0.04909581632382212 -0.0014369075488634014 -4.765890877495872 GATE_FAIL_DIAGNOSTIC
50 tp4_rho0p0025 ttft mean 0.025022574738277282 0.07766646565061346 5.2643890912336175 PASS_SUBCRITICAL
51 tp4_rho0p0025 ttft p50 -0.040042171846277425 0.029153379043297147 -1.0888792802980278 PASS_SUBCRITICAL
52 tp4_rho0p0025 ttft p90 -0.056230097634382616 0.025222989748299444 -3.100710788608317 PASS_SUBCRITICAL
53 tp4_rho0p0025 ttft p99 -0.07535478089127973 0.0205549324689376 -5.479984842234213 PASS_SUBCRITICAL
54 tp4_rho0p0025 tpot mean 0.2170232618103144 0.2295170016795841 1.2493739869269715 PASS_SUBCRITICAL
55 tp4_rho0p0025 tpot p50 0.22406751004936917 0.22406940610958842 0.00018960602192474862 PASS_SUBCRITICAL
56 tp4_rho0p0025 tpot p90 0.1725668492041552 0.1795965483385546 0.7029699134399409 PASS_SUBCRITICAL
57 tp4_rho0p0025 tpot p99 0.1603764334794579 0.254199450927048 9.382301744759008 PASS_SUBCRITICAL
58 tp4_rho0p0025 e2e mean 0.18328079455378776 0.19190660476104554 0.8625810207257778 PASS_SUBCRITICAL
59 tp4_rho0p0025 e2e p50 0.2057109615696404 0.21253242300694286 0.6821461437302473 PASS_SUBCRITICAL
60 tp4_rho0p0025 e2e p90 0.1869703879211648 0.19279855916666536 0.5828171245500557 PASS_SUBCRITICAL
61 tp4_rho0p0025 e2e p99 0.14838304065885655 0.15160588346499027 0.3222842806133719 PASS_SUBCRITICAL
62 tp4_rho0p005 ttft mean 0.028648879997638963 0.08356973519379125 5.492085519615229 PASS_SUBCRITICAL
63 tp4_rho0p005 ttft p50 0.028237979190582876 0.09021324737193111 6.197526818134823 PASS_SUBCRITICAL
64 tp4_rho0p005 ttft p90 -0.055961238578361966 -0.0006012940489499138 -5.535994452941205 PASS_SUBCRITICAL
65 tp4_rho0p005 ttft p99 -0.045491187615110146 0.05253708684194205 0.7045899226831902 PASS_SUBCRITICAL
66 tp4_rho0p005 tpot mean 0.1707193936623511 0.1813506819061229 1.0631288243771824 PASS_SUBCRITICAL
67 tp4_rho0p005 tpot p50 0.16851374859025317 0.1743324539248605 0.5818705334607321 PASS_SUBCRITICAL
68 tp4_rho0p005 tpot p90 0.10492621353626864 0.11816822907155744 1.3242015535288796 PASS_SUBCRITICAL
69 tp4_rho0p005 tpot p99 0.31231888769471766 0.3662267201704473 5.390783247572961 PASS_SUBCRITICAL
70 tp4_rho0p005 e2e mean 0.151102823467785 0.1630793421767109 1.197651870892591 PASS_SUBCRITICAL
71 tp4_rho0p005 e2e p50 0.1594213531394918 0.17360527090575292 1.418391776626113 PASS_SUBCRITICAL
72 tp4_rho0p005 e2e p90 0.1266352410718406 0.13652104764058856 0.9885806568747962 PASS_SUBCRITICAL
73 tp4_rho0p005 e2e p99 0.15576537699445703 0.17677450343779522 2.100912644333819 PASS_SUBCRITICAL
74 tp4_rho0p01 ttft mean -0.0014652143973501086 0.059650620031540064 5.8185405634189955 PASS_SUBCRITICAL
75 tp4_rho0p01 ttft p50 0.22936601881498542 0.24159106387124998 1.2225045056264565 PASS_SUBCRITICAL
76 tp4_rho0p01 ttft p90 -0.0646093465409875 -0.011548419893895705 -5.30609266470918 PASS_SUBCRITICAL
77 tp4_rho0p01 ttft p99 -0.09621678853313553 -0.015475807392170575 -8.074098114096495 PASS_SUBCRITICAL
78 tp4_rho0p01 tpot mean 0.06675609059150077 0.10596101263201793 3.9204922040517163 PASS_SUBCRITICAL
79 tp4_rho0p01 tpot p50 0.08477302587551214 0.09703754188844527 1.2264516012933129 PASS_SUBCRITICAL
80 tp4_rho0p01 tpot p90 0.0379183273767328 0.08369800201750718 4.577967464077439 PASS_SUBCRITICAL
81 tp4_rho0p01 tpot p99 -0.010663954751357074 0.06667813160571406 5.601417685435699 PASS_SUBCRITICAL
82 tp4_rho0p01 e2e mean 0.07212904317306096 0.09777288053702092 2.564383736395996 PASS_SUBCRITICAL
83 tp4_rho0p01 e2e p50 0.12069215463307655 0.1388377217196832 1.8145567086606653 PASS_SUBCRITICAL
84 tp4_rho0p01 e2e p90 0.03317293927357903 0.058060760567474216 2.4887821293895183 PASS_SUBCRITICAL
85 tp4_rho0p01 e2e p99 0.0338378271163308 0.06380410696893425 2.996627985260345 PASS_SUBCRITICAL

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,126 @@
#!/usr/bin/env python3
"""Replay one real-trace cell with the structured-attention experiment commit."""
from __future__ import annotations
import argparse
import importlib.util
import json
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent
REPO = ROOT.parents[1]
S3_REAL = REPO / "runs/frontier-s3-real-v0"
BASE_REFERENCE = (
REPO
/ "runs/frontier-collective-joint-v0/counterfactual/joint-r2/manifest.json"
)
BASE_COMMIT = "deadc4a321f0baaa534c6ebd17f974123733cdc2"
EXPERIMENT_COMMIT = "1f8900a4ac64e45754b03d0aa7c1dddab65785cf"
PATCH = ROOT / "0001-Experiment-with-structured-attention-prefill-predict.patch"
def load_s3_module():
spec = importlib.util.spec_from_file_location(
"s3_prefix_replay", S3_REAL / "run_frontier_prefix_replay.py"
)
module = importlib.util.module_from_spec(spec)
sys.path.insert(0, str(S3_REAL))
spec.loader.exec_module(module)
return module
def git(checkout: Path, *args: str) -> str:
return subprocess.check_output(
["git", "-C", str(checkout), *args], text=True
).strip()
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--trace", type=Path, required=True)
parser.add_argument("--output-root", type=Path, required=True)
parser.add_argument(
"--config",
choices=("tp4_mns16", "tp2_mns16", "tp1_mns16"),
required=True,
)
parser.add_argument("--label", required=True)
parser.add_argument("--max-tokens", type=int, required=True)
parser.add_argument("--duration-s", type=float)
parser.add_argument("--cache-root", type=Path, required=True)
parser.add_argument(
"--frontier-checkout",
type=Path,
default=Path("/tmp/frontier-attn-structured-v0"),
)
parser.add_argument(
"--attention-profile",
type=Path,
default=REPO
/ "runs/frontier-prefill-kvgrowth-fix-v0/profiles/"
"profile-v5-kvgrowth/attention.csv",
)
args = parser.parse_args()
frontier = args.frontier_checkout.resolve()
profile = args.attention_profile.resolve()
if git(frontier, "rev-parse", "HEAD") != EXPERIMENT_COMMIT:
raise SystemExit(f"unexpected experiment checkout HEAD: {frontier}")
if git(frontier, "rev-parse", "HEAD^") != BASE_COMMIT:
raise SystemExit("experiment commit is not directly based on frozen Frontier")
if git(frontier, "status", "--porcelain"):
raise SystemExit("experiment Frontier checkout must be clean")
if not profile.is_file():
raise SystemExit(f"attention profile missing: {profile}")
reference = json.loads(BASE_REFERENCE.read_text())
reference["frontier_checkout"] = str(frontier)
reference["frontier_commit"] = EXPERIMENT_COMMIT
generated_reference = ROOT / "frontier-reference.json"
generated_reference.write_text(json.dumps(reference, indent=2))
module = load_s3_module()
module.REFERENCE = generated_reference
module.EXPECTED_FRONTIER_COMMIT = EXPERIMENT_COMMIT
original_replace = module.replace_flag
def replace_and_override(argv: list[str], flag: str, value: str) -> None:
original_replace(argv, flag, value)
if flag.endswith("trace_file"):
atten_flag = (
"--random_forrest_execution_time_predictor_config_atten_input_file"
)
original_replace(argv, atten_flag, str(profile))
no_cache = (
"--random_forrest_execution_time_predictor_config_no_cache"
)
if no_cache in argv:
argv.remove(no_cache)
module.replace_flag = replace_and_override
module.parse_args = lambda: args
module.main()
manifest_path = args.output_root / "manifest.json"
manifest = json.loads(manifest_path.read_text())
manifest.update(
{
"schema": "frontier-attn-structured-replay-v1",
"frontier_base_commit": BASE_COMMIT,
"frontier_experiment_commit": EXPERIMENT_COMMIT,
"frontier_patch": str(PATCH.resolve()),
"frontier_patch_sha256": module.sha256(PATCH),
"attention_profile_override": str(profile),
"attention_profile_sha256": module.sha256(profile),
"model_cache_enabled": True,
}
)
manifest_path.write_text(json.dumps(manifest, indent=2))
print(f"structured replay done: {args.output_root}")
if __name__ == "__main__":
main()