Skip to content

Conversation

@mattjj
Copy link
Collaborator

@mattjj mattjj commented Dec 12, 2025

dead weight at this point

@mattjj mattjj requested review from dougalm and yashk2810 December 12, 2025 22:54
@mattjj mattjj self-assigned this Dec 12, 2025
@mattjj mattjj added the pull ready Ready for copybara import and testing label Dec 12, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @mattjj, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request represents a significant internal refactoring within JAX's automatic differentiation system, specifically targeting the vjp3 (third version of vector-Jacobian product) implementation. It removes the older ad.backward_pass and ad.closed_backward_pass functions, consolidating all primitive transpose rules under the more modern and flexible ad.fancy_transposes mechanism. This change streamlines the AD backend, eliminating redundant "non-fancy" transpose implementations and moving towards a unified approach that leverages backward_pass3 and ValAccum for improved gradient computation.

Highlights

  • Deprecation of ad.backward_pass: The core backward_pass and closed_backward_pass functions, which were central to JAX's automatic differentiation, have been removed from their primary implementation and replaced with a compatibility shim that delegates to backward_pass3.
  • Transition to fancy_transposes: All primitive transpose rules (for remat_p, custom_jvp_call_p, core.call_p, core.closed_call_p, cond_p, scan_p, jit_p) have been migrated from ad.primitive_transposes to ad.fancy_transposes, leveraging backward_pass3 and ValAccum for a more advanced VJP implementation.
  • Cleanup of legacy transpose implementations: Several 'non-fancy' transpose functions and their associated helper functions (e.g., _custom_jvp_call_transpose, _transpose_cond_jaxpr, _scan_transpose, _pjit_transpose) have been entirely removed from the codebase, simplifying the AD backend.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mattjj mattjj force-pushed the remove-backward-pass branch from 3002988 to 84f73ad Compare December 12, 2025 22:55
Copy link
Collaborator

@yashk2810 yashk2810 left a comment

Choose a reason for hiding this comment

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

Woohoo

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a good step towards simplifying the automatic differentiation internals by removing the deprecated ad.backward_pass and non-fancy transpose rules. The changes are consistent with the goal of migrating to the vjp3 infrastructure. I've identified a potential bug in the updated _closed_call_transpose implementation and some leftover debugging code that should be removed.

@mattjj mattjj force-pushed the remove-backward-pass branch 3 times, most recently from dd32ce1 to 7e5a392 Compare December 12, 2025 23:10
@mattjj mattjj force-pushed the remove-backward-pass branch from 7e5a392 to 6ea96b5 Compare December 13, 2025 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kokoro:force-run pull ready Ready for copybara import and testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants