Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply gradient transforms after user transforms #6590

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andrijapau
Copy link
Contributor

@andrijapau andrijapau commented Nov 14, 2024

Context:

Currently, user-defined transforms are applied after gradient preprocessing. This ordering is unintuitive and introduces several issues,

  • tapes may contain unsupported operations for gradient transforms
  • user transforms cannot act on initial higher-order tape structures, as these are decomposed away during preprocessing

Description of the Change:

This change proposes applying gradient preprocessing after user transforms.

This will ensure that user transforms can work on the initial tape structure without decomposition interference and that gradient transforms only receive preprocessed tapes with supported operations.

Benefits:

  • Logical Transform Flow: Ensures user transforms work as expected on initial structures, like embeddings or entangling layers.
  • Operation Compatibility: Guarantees that gradient transforms only process compatible operations.
  • Improved User Experience: Aligns transform order with user expectations and avoids confusion.

Possible Drawbacks:

  • Breaking Change: This change could disrupt existing setups. We’ll need to:
    • Issue a breaking change alert and be prepared to revert if needed.
    • Coordinate across teams to validate against potential issues with Lightning and Catalyst.
    • Update affected functions (construct_batch, get_transform_program) and resolve any failing tests or cross-project dependencies.

[sc-72075]

Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.29%. Comparing base (51c1436) to head (3987015).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6590   +/-   ##
=======================================
  Coverage   99.29%   99.29%           
=======================================
  Files         454      454           
  Lines       43262    43264    +2     
=======================================
+ Hits        42959    42961    +2     
  Misses        303      303           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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