Optimize chunked delta rule inversion.#4577
Open
h1t35h wants to merge 1 commit into
Open
Conversation
h1t35h
requested review from
A9isha,
NuojCheng,
RissyRan,
SurbhiJainUSC,
abhinavclemson,
aireenmei,
bvandermoon,
darisoy,
dipannita08,
gagika,
gobbleturk,
hengtaoguo,
huytransformer,
igorts-git,
jiangjy1982,
khatwanimohit,
parambole,
richjames0,
shralex,
shuningjin,
suexu1025,
vipannalla and
xibinliu
as code owners
July 23, 2026 15:40
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
h1t35h
force-pushed
the
qwen3-gdn-jax-optim
branch
from
July 23, 2026 17:40
46c0327 to
9478160
Compare
gobbleturk
reviewed
Jul 23, 2026
| def test_invert_unit_lower_triangular_log_depth(self): | ||
| """Test for loss across chunk_size in the following range [16, 32, 64, 128, 256].""" | ||
| jax.config.update('jax_enable_x64', True) # Use float64 for precise testing | ||
| chunk_sizes = [16, 32, 64, 128, 256] |
Collaborator
There was a problem hiding this comment.
I don't think its valuable to protect multiple chunk sizes, I would just pick one for this test
h1t35h
force-pushed
the
qwen3-gdn-jax-optim
branch
from
July 23, 2026 17:52
9478160 to
88c8a4a
Compare
- Replaced `jax.scipy.linalg.solve_triangular` with `invert_unit_lower_triangular_log_depth`, a highly optimized log-depth Newton-Schulz iteration implementation with a custom VJP for computing `(I+S)^-1`. - Updated `jax.lax.scan` unroll parameters in the naive implementation.
h1t35h
force-pushed
the
qwen3-gdn-jax-optim
branch
from
July 24, 2026 04:17
88c8a4a to
6fd8896
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
jax.scipy.linalg.solve_triangularwithinvert_unit_lower_triangular_log_depth, a highly optimized log-depth Newton-Schulz iteration implementation with a custom VJP for computing(I+S)^-1.jax.lax.scanunroll parameters in the naive implementation.Description
Tests
Tested manually attached xprof results.

Before Optimization
For chunk_size: 128
fwd : 96.96 ms
bwd: 127 ms
xprof:
After Optimization

fwd: 23 ms
bwd: 52 ms
xprof:
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.