Repository navigation
TV ball: z_gamma without underflow in float32 - #166
Merged
Merged
Conversation
The nightly fuzz run of 2026-11-14 failed on tv1d_ball in float32 with a jump weight of 2.6e-43: the projection's Jacobian was 1 v^T with v off uniform by 1%, not symmetric. z_gamma, about w / |B| on a segment, was formed in the row's dtype, where it was subnormal with ~5 bits left; the power-of-two scale omega (1.0.2) was applied only afterwards. At float32 weights beyond ~1e38 it was inf and the derivatives NaN. structure, jvp and vjp now take omega z_gamma from the 1D TV JVP at dgamma = omega, formed in double. Where z_gamma was normal the bits are unchanged (148k jvp/vjp outputs against master, both dtypes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes the nightly fuzz failure of 2026-11-14 (run 43585666004):
invariant violated: dense J: not symmetric on a unitontv1d_ball, float32, conjugate, weights[0.45, 0.03, 1.6, 2.6e-43, 5.7e152].Cause
The projection's Jacobian on one row came out as
1·vᵀwithvoff uniform by 1% (0.16607 vs 0.16786) instead of11ᵀ/6. The derivative of z in γ, about w/|B| on a segment B, was formed in the row's dtype. With the jump on the 2.6e-43 edge it was subnormal in float32, with ~5 bits left. The power-of-two scaleomegafrom 1.0.2 was applied only afterwards. At float32 weights beyond ~1e38 the same value was inf and the derivatives NaN.Fix
structure,jvpandvjpinsrc/ops/tv_ball.cppnow takeomega·z_gammafrom 1D TV's JVP atdgamma = omega, which forms it in double.Testing
test_core,test_header, full pytest (2475 passed).test_tv_ball_derivatives_at_extreme_weights: float32 with w and α scaled by 2^±140. On master it fails at 2^-140 (0.45% error) and gives NaN at 2^+140.🤖 Generated with Claude Code