Repository navigation
Standardize golden AL curve names and selection / 规范黄金 AL 曲线命名与选择 - #4661
Conversation
|
Thanks for the contribution!
中文感谢你的贡献!
|
|
Generally most InferenceX submissions don't need to add changes to the infx package. On the off chance they do, generally the diff is small. Please prompt your agent to clean your PR to keep your diff to only necessary & minimal changes too. We have an increased code quality bar for changes to the infx package. 中文大多数 InferenceX 提交通常不需要修改 infx 包。即使确实需要,改动通常也很小。请让你的 agent 清理 PR,使改动只包含必要且最小的内容。infx 包的改动有更高的代码质量要求。 |
| @@ -0,0 +1,156 @@ | |||
| # The identity of every committed golden curve: which runs select it, and how it was collected. | |||
| # | |||
| # Curve files are named <model>__<method>__<draft>__<draft_sample>-<verify>.yaml, built from the | |||
There was a problem hiding this comment.
can this be in docs and de-sloppified instead of inline
There was a problem hiding this comment.
[by Claude Code] Thanks, good call. In 2db10e6 the header is gone from identities.yaml. The naming rule, the select keys, the fact sources and the value vocabulary now live in the golden AL README (English and Chinese), as two short tables.
| @@ -0,0 +1,239 @@ | |||
| """Curve identities, identity-based selection, run normalization and the audit snapshot.""" | |||
|
|
|||
| import itertools | |||
There was a problem hiding this comment.
@claude please audit this PR and remove any tautological tests or tests that aren't useful for any practical branc hof logic
There was a problem hiding this comment.
[by Claude Code] Done in 2db10e6. I removed the snapshot test and its fixture, the hard-coded curve list and the copied legacy selector. What's left in this file is one test per real branch: identity/file-name agreement, overlapping selectors, malformed facts, the vLLM/SGLang/TRT-LLM/ATOM readings, a verifier mismatch, adaptive, and the precision/KV readers. The renamed curve-selection expectations stay in the existing golden AL tests. Happy to trim further if any of these still look redundant.
There was a problem hiding this comment.
Findings marked 🟡 are optional suggestions and need no follow-up push.
Additional findings (outside the current diff — GitHub can't attach inline comments there):
-
🟡
inferencex-e2e/infx/golden_al_distribution/__main__.py— nit: with --golden-dir,lookup --jsoncan now report a curve name from a different directory than its AL value. Since curve_name selects through each directory's identities.yaml, line 103 should pass args.golden_dir, as golden_length does on line 98. Fix: call curve_name(args.model, spec, args.golden_dir).Why this was flagged
The diff makes curve_name depend on golden_dir (curves.py:46, through select_curve reading golden_dir/identities.yaml). In lookup_command, line 98 calls golden_length with args.golden_dir, but line 103 calls curve_name(args.model, spec) with the default GOLDEN_DIR. With a non-default --golden-dir, the JSON "curve" field comes from the committed identities while "acceptance_length" comes from the given directory. It can also raise if the default identities do not match. On base, curve_name ignored the directory, so the two always agreed.
Verification: Trigger:
lookup --jsonrun with a non-default--golden-dir. Inlookup_command, line 103 is still"curve": curve_name(args.model, spec), so it uses the committed default directory. On the base, curve_name was a pure function of model and spec and did not depend on any directory, so this inconsistency is new.
| Regenerate after a deliberate change, then review the diff: | ||
| python -m infx.matrix.generate full-sweep --config-files configs/nvidia-master.yaml | ||
| configs/amd-master.yaml --scenario-type agentic-coding > matrix.json | ||
| python -m infx.srt_slurm.spec_identity snapshot matrix.json --root . > <this fixture> | ||
| """ | ||
| for case in json.loads(SNAPSHOT.read_text()): | ||
| role = {"args": case["args"]} | ||
| assert audit(case["model_prefix"], role, case["framework"]) == case["expected"], case | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("algorithm", ["EAGLE", "NEXTN"]) | ||
| def test_sglang_native_heads_select_the_model_mtp_curve(algorithm) -> None: |
There was a problem hiding this comment.
🔴 After merging, a SpeedBench auto-PR that re-measures any committed curve fails CI until someone regenerates a 3,609-line fixture. test_snapshot_pins_every_current_speculative_role compares live audit output to current_spec_roles.json. That fixture stores the golden AL, curve name and findings for all 118 roles in the master configs. This pins checked-in data, which CONTRIBUTING.md:239 forbids. Fix: delete the snapshot test and its fixture. The other tests in this file already run audit/run_collection on controlled inputs. Keep any parity evidence in the PR description, not in the suite.
Why this was flagged
The test at test_spec_identity.py:132-143 runs audit() against the real GOLDEN_DIR and identities.yaml. It then asserts equality with the expected block in current_spec_roles.json, for example "golden": 3.77 for the dsv4 atom role. speedbench-al.yml (line 334) rewrites infx/golden_al_distribution/${GOLDEN_CURVE}.yaml with freshly measured values and opens an auto-PR. Any changed value breaks this test for every role on that curve. Editing a collection fact in identities.yaml breaks it the same way. The fix is to regenerate the fixture via full-sweep matrix generation plus spec_identity snapshot. The base branch has no such test, so curve refreshes pass there. CONTRIBUTING.md:239 and the four-question check (CONTRIBUTING.md:258) forbid tests that pin checked-in config or data.
Verification: test_snapshot_pins_every_current_speculative_role (test_spec_identity.py:129-139) asserts audit(...) == case["expected"] over current_spec_roles.json, while audit (spec_identity.py:139-144) reads the real curve YAML and identities.yaml. speedbench-al.yml:334 rewrites curves with fresh measurements, so the test fails until the fixture is regenerated by hand. CONTRIBUTING.md:239 forbids this.
There was a problem hiding this comment.
[by Claude Code] Agreed. 2db10e6 deletes the snapshot test and current_spec_roles.json. The parity evidence (same curve and golden AL for all 1,453 agentic spec-decode rows) is in the PR description as a one-off check, and python -m infx.srt_slurm.spec_identity snapshot remains for running the audit by hand.
| # Curve files before the canonical names; the parity test maps the old selection through it. | ||
| LEGACY_NAMES = { | ||
| "dsv4_mtp": "deepseek-v4-pro__mtp__native__default-default", | ||
| "dsv4-pro-0813-dspark": "deepseek-v4-pro-0813__dspark__native__probabilistic-default", | ||
| "dsv41flash_dspark": "deepseek-v4.1-flash__dspark__native__probabilistic-block", | ||
| "glm5.2_mtp": "glm-5.2-fp8__mtp__native__default-default", | ||
| "glm5.3_mtp": "glm-5.3-fp8__mtp__native__default-default", | ||
| "kimik3_dspark": "kimi-k3__dspark__kimi-k3-dspark__default-default", | ||
| "kimik3_dspark_probabilistic_sample_method_block_rejection_sample_method": ( | ||
| "kimi-k3__dspark__kimi-k3-dspark__probabilistic-block" | ||
| ), | ||
| "minimaxm3_eagle3": "minimax-m3__eagle3__minimax-m3-eagle3__default-default", | ||
| "minimaxm3_eagle3_gqa": "minimax-m3__eagle3__minimax-m3-eagle3-gqa__default-default", | ||
| "minimaxm31flash_dspark": "minimax-m3.1-flash__dspark__native__probabilistic-block", | ||
| "musespark_dflash": ( | ||
| "muse-spark-open-816b-a42b-nvfp4__dflash__muse-spark-open-dflash2__default-default" | ||
| ), | ||
| "qwen3.5_mtp": "qwen3.5-397b-a17b-nvfp4__mtp__native__default-default", | ||
| "qwen3.8next_mtp": "qwen3.8-flash-next-fp8__mtp__native__default-default", | ||
| } | ||
|
|
||
|
|
||
| def legacy_curve_name(model: str, spec: dict) -> str: | ||
| """The selection curve_name made before identities.yaml, kept to prove they agree.""" | ||
| method = str(spec.get("method", "")).lower() | ||
| if method in ("eagle", "nextn"): | ||
| method = "eagle3" if model == "minimaxm3" else "mtp" | ||
| curve = f"{model}_{method}" | ||
| if model in ("dsv4", "dsv4dspark", "dsv4dsparkprob") and method == "dspark": | ||
| curve = "dsv4-pro-0813-dspark" | ||
| elif model == "minimaxm3" and method == "eagle3": | ||
| if "gqa" in str(spec.get("model", "")).lower(): | ||
| curve += "_gqa" | ||
| elif model == "kimik3" and method == "dspark": | ||
| sampling = spec.get("draft_sample_method") | ||
| if sampling == "probabilistic": | ||
| curve += "_probabilistic_sample_method_block_rejection_sample_method" | ||
| elif sampling != "greedy": | ||
| raise ValueError(f"No Kimi DSpark golden curve for draft sampling {sampling!r}") | ||
| if curve not in LEGACY_NAMES: | ||
| raise ValueError(f"No committed golden curve {curve}.yaml") | ||
| return LEGACY_NAMES[curve] | ||
|
|
||
|
|
||
| def _role(**args): | ||
| return {"args": args} | ||
|
|
||
|
|
||
| def test_every_curve_has_one_identity_and_its_canonical_name() -> None: | ||
| identities = load_identities() | ||
| stems = {path.stem for path in GOLDEN_DIR.glob("*.yaml")} - {"identities"} | ||
| assert set(identities) == stems == set(LEGACY_NAMES.values()) |
There was a problem hiding this comment.
🟡 (optional) Adding any new golden curve, which the speedbench-al auto-PR now asks for, fails CI even with a correct identity, because the test pins a fixed list of curve names. test_every_curve_has_one_identity_and_its_canonical_name asserts the curve stems equal set(LEGACY_NAMES.values()). legacy_curve_name copies the old curve_name into the test ("mirror", CONTRIBUTING rule 6). Its comments are history notes, which AGENTS.md:57 forbids. Fix: assert only that identities match the stems and that names are canonical. Replace the legacy mirror with explicit expected curves for the tricky inputs, and drop the history comments. [also at: inferencex-e2e/infx/tests/golden_al_distribution/test_spec_identity.py:73 - After merging, adding any new golden curve (which the auto-PR body now asks for) fails test_every_curve_has_one_identity_and_its_canonical_name until a test registry is edited.]
Why this was flagged
test_spec_identity.py:72 asserts set(identities) == stems == set(LEGACY_NAMES.values()), and LEGACY_NAMES (lines 22-40) hard-codes today's 13 curves. When the speedbench-al open-pr flow adds a new curve file plus its identities.yaml entry, as the updated PR body asks, the stems no longer equal LEGACY_NAMES and the test fails. CONTRIBUTING.md:239 rule 4 forbids pinning checked-in data or counts. legacy_curve_name (lines 43-62) is a second implementation copied into the test, forbidden by CONTRIBUTING.md:241 rule 6. Its comment "Curve files before the canonical names" and the docstring "made before identities.yaml" are history comments, which AGENTS.md:57 forbids. Base had no such test.
Verification: normal: triggers whenever a new golden curve is committed, for example through the speedbench-al open-pr flow. test_spec_identity.py:71-72 asserts set(identities) == stems == set(LEGACY_NAMES.values()). LEGACY_NAMES at lines 22-40 hard-codes exactly the 13 curve stems that exist today.
There was a problem hiding this comment.
[by Claude Code] Fixed in 2db10e6. The test now only checks that every curve file has an identity and that its name is canonical, so adding a curve needs no test edit. The legacy mirror and its history comments are removed.
| if [[ ! "$GOLDEN_CURVE" =~ ^[a-z0-9_.-]+$ ]]; then | ||
| echo "::error::open-pr needs golden-curve, a curve file stem such as dsv4_mtp (got '$GOLDEN_CURVE')." >&2 | ||
| echo "::error::open-pr needs golden-curve, a curve file stem such as deepseek-v4-pro__mtp__native__default-default (got '$GOLDEN_CURVE')." >&2 | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
🟡 nit (optional): an operator who passes golden-curve identities gets past the setup check, but the run fails only after the full GPU collection. The check at speedbench-al.yml:131 still allows any ^[a-z0-9_.-]+$ stem, and this change now reserves the identities stem for the selector file. Fix: reject identities (the IDENTITIES_STEM that load_curve already refuses) in the setup check, so the run fails before any GPU time is spent.
Why this was flagged
The open-pr step writes infx/golden_al_distribution/${GOLDEN_CURVE}.yaml (speedbench-al.yml:334-338). In the same directory, this change adds identities.yaml, which select_curve reads for every golden lookup. The setup-job check (speedbench-al.yml:131) only matches the regex, so golden-curve=identities passes it. After the multi-hour SPEED-Bench collection, the step overwrites identities.yaml in the runner checkout with the AL matrix. Then python -m infx.golden_al_distribution show identities raises "Invalid golden curve identity" because curves.py now rejects name == IDENTITIES_STEM, so the job fails and no PR is opened. Before this change no committed stem was reserved, so the setup check was the only gate needed. Nothing reaches main, so the cost is the wasted GPU allocation and a late, confusing error.
Verification: Trigger: an operator dispatches the workflow with open-pr=true and golden-curve=identities. The only gate is if [[ ! "$GOLDEN_CURVE" =~ ^[a-z0-9_.-]+$ ]] (speedbench-al.yml:131), and identities matches it. The PR adds IDENTITIES_STEM = "identities" (identity.py:19), which load_curve now rejects. After the full infx.launch run collection, show "$GOLDEN_CURVE" raises ValueError and no PR is opened.
There was a problem hiding this comment.
[by Claude Code] Fixed in 2db10e6. The setup check now rejects golden-curve=identities, so the run fails before any GPU time is spent.
| # The identity of every committed golden curve: which runs select it, and how it was collected. | ||
| # | ||
| # Curve files are named <model>__<method>__<draft>__<draft_sample>-<verify>.yaml, built from the | ||
| # curve's model key and its collection below ("default" for a setting the collector did not set). curves.curve_name selects the one curve whose `select` block matches a run: | ||
| # | ||
| # model_prefixes InferenceX model prefixes that use the curve | ||
| # method mtp (model-native head), eagle3, dspark or dflash; see curves.normalize_method | ||
| # draft_family when set, "gqa" or "default" by whether the draft model id contains "gqa" | ||
| # draft_sample when set, the run's draft_sample_method must equal it | ||
| # | ||
| # `collection` records how the curve was measured. The audit (infx.srt_slurm.spec_identity) | ||
| # compares it with each run and reports differences; it never changes the selected curve. | ||
| # Each fact is {value, source}: | ||
| # | ||
| # explicit set by the collector or recipe | ||
| # documented fixed by the connector or engine: a recipe's synthetic sampler becomes block, and | ||
| # block, relaxed and adaptive verification are opt-in, so unset means standard and | ||
| # not adaptive | ||
| # assumed the connector's own reading, e.g. ATOM DSpark drafts probabilistically | ||
| # default unset; whatever the engine's default was (value null) | ||
| # unknown not readable (value null) | ||
| # | ||
| # draft_sample: greedy | probabilistic verify: standard | block | relaxed | ||
| # adaptive: true | false topology: chain | tree-topk<N> | ||
| # A curve marked provisional was not measured for its model. |
There was a problem hiding this comment.
🟡 nit (optional): identities.yaml opens with a 25-line header comment that describes the file, its naming scheme and the field vocabulary. AGENTS.md:56 forbids header comments describing a file or config. Fix: move this documentation to the golden_al_distribution README. Keep only short comments that give the reason for a specific line.
Why this was flagged
Lines 1-25 of the new identities.yaml are a header comment covering the file name scheme, the select keys, the fact sources and the value vocabulary. AGENTS.md:56 says "No header comments describing a file, topology, config, recipe, override, or section." The PR already rewrites README.md and README_zh.md, which are the natural home for this text. This is a convention violation with no runtime effect.
Verification: nit. Trigger: always; the new file ships a file-level header comment. identities.yaml lines 1-25 document the file naming scheme, the select keys, the collection fact sources and the value vocabulary. AGENTS.md:56 says "No header comments describing a file, topology, config, recipe, override, or section." Nothing breaks at runtime.
There was a problem hiding this comment.
[by Claude Code] Fixed in 2db10e6. The header moved to the README (same change as cquil11's thread above).
|
[by Claude Code] Thanks for the reviews. 2db10e6 addresses them:
Curve selection is unchanged: every current agentic config still selects the same curve and golden AL. |
Name every golden curve <model>__<method>__<draft>__<draft_sample>-<verify>.yaml and describe it once in identities.yaml: a select block that curve_name matches (model prefixes, method, and the draft family or draft sampler only where one model's curves differ by them) and a collection block recording how the curve was measured. Every current agentic config selects the same curve and golden AL as before. infx.srt_slurm.spec_identity describes a run's generation role in the same vocabulary and reports where it differs from its curve's collection, without changing the selection. A snapshot test pins the curve, golden AL and findings of every speculative role in the agentic sweep matrix, and a parity test checks identity selection against the previous rules.
…identities Each curve's collection and each run's description now carry the draft's weight quantization and the draft and target KV cache dtypes (fp8_e4m3 counts as fp8, bfloat16 as bf16, auto as the engine default). They are audited only; curve selection and names are unchanged.
Move the identities.yaml vocabulary into the README, drop the snapshot test and its fixture, and keep only identity tests that exercise a selection or normalization branch. lookup --json now names the curve from --golden-dir, and speedbench-al rejects the reserved identities stem before collecting.
…将 AL 门禁迁移到规范化的曲线名称 #4654 landed the acceptance gate against the old curve file names. The gate now resolves its curve from the same golden directory it reads values from, and its tests, the curve READMEs' collection-settings notes and the launch fixtures use the standardized names.
7ebc1dd to
cd8624d
Compare
[by Claude Code]
Cleanup of the golden AL curves: one naming scheme, one identity per curve, and curve selection driven by that identity instead of per-model special cases. Every current agentic config selects the same curve and the same golden AL as before.
Naming. Curve files are
<model>__<method>__<draft>__<draft_sample>-<verify>.yaml, derived from the identity (defaultfor a setting the collector did not set). A test checks every file name against its identity. For example,kimik3_dspark_probabilistic_sample_method_block_rejection_sample_method.yaml→kimi-k3__dspark__kimi-k3-dspark__probabilistic-block.yaml, andqwen3.5_mtp.yaml→qwen3.5-397b-a17b-nvfp4__mtp__native__default-default.yaml. References in the master configs, recipes, collectors, the sign-off prompt,speedbench-al.ymland the docs are updated.perf-changelog.yamlis left as history.Selection (
golden_al_distribution/identities.yaml,identity.py). Each curve has aselectblock:model_prefixes,method, anddraft_family(MiniMax-M3 GQA) ordraft_sample(Kimi K3 DSpark) only where one model's curves differ by them.curve_namereturns the one matching curve and fails when none or several match. The non-obvious rules are now explicit and tested:EAGLE/NEXTN→ the model's nativemtpcurve; MiniMax-M3EAGLE→eagle3.dsv4,dsv4dsparkanddsv4dsparkprobshare the DSV4-0813 DSpark curve.greedyorprobabilisticsampler.Audit (
srt_slurm/spec_identity.py). Each curve'scollectionblock records engine, draft,draft_sample,verify,adaptive,topology,draft_precision,draft_kv_cache_dtypeand the target'skv_cache_dtype, each as{value, source}with sourceexplicit,documented,assumed,defaultorunknown. A run's generation role is described the same way and compared with its curve; the audit never changes the selection.unknown, so it is reported asunverified, never as a pass.assumed.standardand not adaptive (documented).blockon real runs (documented).fp8_e4m3=fp8,bfloat16=bf16,auto= engine default).Parity.
curve_nametests keep their expected curves (renamed), including the Kimi sampler and MiniMax GQA cases.python -m infx.srt_slurm.spec_identity snapshotover the agentic matrix of the NVIDIA and AMD master configs (1,453 spec-decode rows) gives the same curve and golden AL for every row before and after this change. This is a one-off check, not a committed fixture.infx.matrix.changedreports 0 config keys changed.Findings in today's matrix (rows):
verifymismatch: Kimi K3 DSpark without block (33), MiniMax-M3 with block (17), DSV4-0813 with block (13), DSV4.1 Flash without block (83), Muse Spark SGLang with block (26)kv_cache_dtypemismatch: MiniMax-M3.1-Flash vLLM fp8 vs collected nvfp4 (19), GLM-5.2 SGLang bf16 vs fp8 (7), GLM-5.3 TileRT bf16 vs fp8 (1)adaptive(no fixed-k curve applies)unverifiedverify / adaptive (ATOM, TileRT)unverifieddraft sampler / draft precision / draft KV dtype / target KV dtype (engine default or unknown on either side)provisionalcurve (GLM-5.3)Follow-ups: collect the curves the mismatches need (Kimi K3 probabilistic without block, MiniMax-M3 EAGLE3 GQA with block, DSV4-0813 DSpark with block, GLM-5.3), or align those recipes with their curve's collection.
中文
[by Claude Code]
清理黄金 AL 曲线:统一命名方式,每条曲线一个身份描述,曲线选择由身份驱动,而不再依赖逐模型的特殊处理。所有现有 agentic 配置选择的曲线和黄金 AL 与之前完全相同。
命名。 曲线文件命名为
<model>__<method>__<draft>__<draft_sample>-<verify>.yaml,由身份推导(收集脚本未设置的项为default),测试会逐一校验文件名与身份是否一致。例如kimik3_dspark_probabilistic_sample_method_block_rejection_sample_method.yaml→kimi-k3__dspark__kimi-k3-dspark__probabilistic-block.yaml。master 配置、配方、收集脚本、签核提示、speedbench-al.yml和文档中的引用均已更新;perf-changelog.yaml作为历史保持不变。选择(
golden_al_distribution/identities.yaml、identity.py)。每条曲线有一个select块:model_prefixes、method,以及仅在同一模型的曲线因其而不同时才设置的draft_family(MiniMax-M3 GQA)或draft_sample(Kimi K3 DSpark)。curve_name返回唯一匹配的曲线,没有或有多条匹配时报错。不明显的规则均已显式化并有测试:EAGLE/NEXTN→ 模型原生mtp曲线;MiniMax-M3EAGLE→eagle3。dsv4、dsv4dspark、dsv4dsparkprob共用 DSV4-0813 DSpark 曲线。greedy或probabilistic。审计(
srt_slurm/spec_identity.py)。每条曲线的collection块记录 engine、draft、draft_sample、verify、adaptive、topology、draft_precision、draft_kv_cache_dtype和目标模型的kv_cache_dtype,每项为{value, source},source 为explicit、documented、assumed、default或unknown。运行的生成角色以同样方式描述并与其曲线比较;审计不会改变选择结果。unknown,报告为unverified,绝不视为通过。assumed。standard且非自适应(documented)。block(documented)。fp8_e4m3=fp8,bfloat16=bf16,auto= 引擎默认值)。一致性。
curve_name测试保留其预期曲线(已更名),包括 Kimi 采样器和 MiniMax GQA 的情况。python -m infx.srt_slurm.spec_identity snapshot,改动前后每一行的曲线和黄金 AL 均相同。这是一次性检查,不提交为固定数据。infx.matrix.changed报告 0 个配置键变化。后续工作:为上述不一致收集所需曲线(Kimi K3 probabilistic 无 block、MiniMax-M3 EAGLE3 GQA 使用 block、DSV4-0813 DSpark 使用 block、GLM-5.3),或将这些配方与曲线的收集方式对齐。