Skip to content

feat(guidance): add --alignment-reverse-diffusion arg#264

Merged
marcuscollins merged 2 commits into
mainfrom
kmc/alignment-reverse-diffusion
Jun 23, 2026
Merged

feat(guidance): add --alignment-reverse-diffusion arg#264
marcuscollins merged 2 commits into
mainfrom
kmc/alignment-reverse-diffusion

Conversation

@k-chrispens

@k-chrispens k-chrispens commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Pass through the alignment reverse diffusion arg.

Summary by CodeRabbit

  • New Features
    • Added a new command-line flag to enable user control over reverse-diffusion alignment behavior in model inference operations.
    • Configuration is optional with intelligent fallback to model-specific defaults, providing flexibility for advanced use cases requiring alignment adjustments.

Copilot AI review requested due to automatic review settings June 16, 2026 23:45
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@k-chrispens, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 59 minutes and 28 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 41a11e53-8d61-4c19-8ed2-732eb836059d

📥 Commits

Reviewing files that changed from the base of the PR and between 9c1b278 and 578c8d2.

📒 Files selected for processing (4)
  • src/sampleworks/utils/guidance_script_arguments.py
  • src/sampleworks/utils/guidance_script_utils.py
  • tests/cli/test_guidance_cli.py
  • tests/utils/test_guidance_script_utils.py
📝 Walkthrough

Walkthrough

Adds a new optional boolean field alignment_reverse_diffusion to GuidanceConfig, wires it to a new --alignment-reverse-diffusion CLI flag in add_generic_args, populates it through from_cli, and updates _run_guidance to use the override when set, falling back to is_boltz when not provided.

Changes

Alignment Reverse Diffusion Toggle

Layer / File(s) Summary
GuidanceConfig field, CLI flag, and _run_guidance override
src/sampleworks/utils/guidance_script_arguments.py, src/sampleworks/utils/guidance_script_utils.py
GuidanceConfig gains alignment_reverse_diffusion: bool | None; add_generic_args registers --alignment-reverse-diffusion as store_const=True with default=None; from_cli populates the field; _run_guidance assigns use_alignment_for_reverse_diffusion from the override when non-None, otherwise from is_boltz.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related PRs

  • diff-use/sampleworks#207: Introduced the same GuidanceConfig.from_cli() and _run_guidance wiring pattern that this PR extends with the new --alignment-reverse-diffusion option.

Suggested reviewers

  • saada
  • marcuscollins

Poem

🐇 A flag for the diffusion, reversed if you please,
--alignment-reverse-diffusion set with ease!
If None, fall back to is_boltz we say,
else use what the user has passed along the way.
The config grows richer, one field at a time — hooray! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a new CLI argument --alignment-reverse-diffusion to the guidance feature, which matches the primary objective and code modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kmc/alignment-reverse-diffusion

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new CLI/config knob to control whether the EDM sampler performs “reverse diffusion” alignment (align noisy state to denoised prediction), defaulting to enabled for Boltz wrappers while allowing non-Boltz models to opt in.

Changes:

  • Add alignment_reverse_diffusion: bool | None to GuidanceConfig and plumb it through GuidanceConfig.from_cli().
  • Add --alignment-reverse-diffusion CLI flag and use it in _run_guidance() to override the per-model default.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/sampleworks/utils/guidance_script_utils.py Computes the effective alignment_reverse_diffusion setting (model default vs. user override) and passes it into EDMSamplerConfig.
src/sampleworks/utils/guidance_script_arguments.py Adds the new config field and CLI argument, and forwards it into the constructed GuidanceConfig.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/sampleworks/utils/guidance_script_arguments.py
Comment on lines +458 to +462
"--alignment-reverse-diffusion",
action="store_const",
const=True,
default=None,
help=(

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/sampleworks/utils/guidance_script_arguments.py`:
- Around line 457-467: The --alignment-reverse-diffusion argument uses
action="store_const" with const=True, which only allows users to set the value
to True (when the flag is provided) or None (default), preventing explicit
disabling of the feature. Replace the action="store_const" with const=True
approach with a mechanism that supports both enabling and disabling the feature,
such as using action="store_true" and "store_false" for separate flags
(--alignment-reverse-diffusion to enable and --no-alignment-reverse-diffusion to
disable), or use argparse.BooleanOptionalAction if available, ensuring users can
explicitly override the default behavior in both directions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bae053c9-ede6-4852-a105-98f9a7f1c618

📥 Commits

Reviewing files that changed from the base of the PR and between 3e6aba6 and 9c1b278.

📒 Files selected for processing (2)
  • src/sampleworks/utils/guidance_script_arguments.py
  • src/sampleworks/utils/guidance_script_utils.py

Comment thread src/sampleworks/utils/guidance_script_arguments.py

@marcuscollins marcuscollins left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd make a couple changes, and it probably does make sense to add some tests for these arguments to make sure they propagate correctly.

Comment thread src/sampleworks/utils/guidance_script_arguments.py
use_alignment_for_reverse_diffusion = is_boltz
# Boltz was trained with this, other models default to disabled, but the user
# can opt in via --alignment-reverse-diffusion.
override = getattr(args, "alignment_reverse_diffusion", None)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No reason to use getattr here. The code explicitly constructs args.alignment_reverse_direction, its default is None anyway, and it should raise an error if that attribute doesn't exist. I would change the default to False and then the next like can just be use_alignment_for_reverse_diffusion = override | is_boltz

@marcuscollins marcuscollins left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the changes.

@marcuscollins marcuscollins merged commit 0cb0ba2 into main Jun 23, 2026
8 of 11 checks passed
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.

3 participants