Skip to content

benchmarks: move adaptive prefill calibration to Examples - #1018

Open
SuperGoodGame wants to merge 5 commits into
deepspeedai:masterfrom
SuperGoodGame:benchmarks/adaptive-prefill-calibration
Open

SuperGoodGame wants to merge 5 commits into
deepspeedai:masterfrom
SuperGoodGame:benchmarks/adaptive-prefill-calibration

Conversation

@SuperGoodGame

@SuperGoodGame SuperGoodGame commented Oct 10, 2026 •

Copy link
Copy Markdown

Adds adaptive prefill calibration and evaluation tooling alongside the existing rollout benchmark in benchmarks/opsd. Requires Transformers >=4.56 and DeepSpeed PR #8786; the README explains configuration loading, the short-context calibration range and deployment validation.

Calibration derives ordinary MHA KV heads from query heads when the dedicated field is absent. The CLI requires a complete metadata object for supplied calibration files; cost-only artifacts are rejected, while applications can still pass hand-tuned coefficients directly to the rollout configuration. Saved configurations are checked against the model/device/library metadata and a combined source hash of rollout, bucket planning and static-cache implementations; stale or missing hashes require recalibration.

Validation: three regression tests pass, covering non-negative fitting, real tiny-OPT calibration on a GPU, and CLI acceptance/rejection of matching, changed, missing and cache-only-changed source hashes. Six targeted GPU oracle checks in the DeepSpeed companion validate OPT/Qwen generation through the static cache. Python lint and diff checks pass. The original seeded tiny-Qwen2 calibration/sweep smoke check also completed all four workloads with matching output IDs on every path.

Signed-off-by: SuperGoodGame <985236470@qq.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-05T05:42:09.433651Z
We couldn’t complete this review. Comment @codex review to try again.
8c73cbd New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dcdde0bf7f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread benchmarks/opsd/rollout_prefill.py Resolved
Comment thread benchmarks/opsd/rollout_prefill.py Resolved
Signed-off-by: SuperGoodGame <985236470@qq.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 79b2140eaf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread benchmarks/opsd/rollout_prefill.py Resolved
Comment thread benchmarks/opsd/rollout_prefill.py Resolved
Signed-off-by: SuperGoodGame <985236470@qq.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: beb3401dce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread benchmarks/opsd/rollout_prefill.py Resolved
Signed-off-by: SuperGoodGame <985236470@qq.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3fd685fc55

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

'allow_tf32', 'source_sha256'):
if calibration['metadata'].get(key) != metadata[key]:
parser.error(f'calibration differs in {key}; recalibrate for this configuration')
costs = calibration.get('costs', {})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject incomplete saved cost maps

When --cost-config points to an otherwise matching calibration artifact whose costs member is absent or has lost one of the five emitted coefficients, this fallback silently supplies HybridEngineRolloutConfig defaults for the missing values and the sweep completes with current metadata as though the calibrated policy was evaluated. Since --calibrate always emits the complete map (and hand-tuned partial configurations are documented for direct application use), validate the required cost keys before running the sweep.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

A supplied calibration file must provide all five cost coefficients. A
missing cost map, or any missing coefficient, now fails the CLI instead
of silently falling back to defaults for that term.

The CLI regression checks a missing cost map and each missing key.

Signed-off-by: SuperGoodGame <985236470@qq.com>
@SuperGoodGame
SuperGoodGame force-pushed the benchmarks/adaptive-prefill-calibration branch from ba438e5 to 8c73cbd Compare November 5, 2026 05:42
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@SuperGoodGame

Copy link
Copy Markdown
Author

Added 8c73cbd, which closes the remaining gap in the saved-calibration check: a supplied cost map must now carry all five coefficients. A missing costs object, or any missing key, fails the CLI instead of silently keeping the library default for that term.

Validation: benchmarks/opsd/test_rollout_prefill.py — 3 passed. The regression covers an absent cost map and each of the five missing keys individually, and asserts the sweep is not run in the rejected cases. py_compile, diff --check and flake8 (no new findings) pass. Repository pre-commit hooks exclude benchmarks/opsd, so the direct checks were used.

Companion DeepSpeed PR #8786 was refreshed to current master and is mergeable; its full rollout/cache suite passes on an H20Z GPU (159 passed, 3 skipped).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant