Repository navigation
Keep scaled continuation means finite near float max - #628
Open
hmgaudecker wants to merge 29 commits into
Open
hmgaudecker wants to merge 29 commits into
hmgaudecker wants to merge 29 commits into
Conversation
Reuse the existing scaled-lottery reduction so a weighted mean reserves numerator headroom and scales its denominator consistently. Preserve the ordinary unscaled reduction and assert both the public continuation value and axis/sign variants.
Documentation build overview
38 files changed ·
|
# Conflicts: # tests/candidate_certificate/sources.json
The ci-workload-weights hook filled the missing weights of test files that arrived through the stack merge and rebalanced the shards accordingly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LAZ63AjbZFLweWuJyPUs6S
A scaled lottery mean lowered each normalized coefficient before multiplying it into its value. With values near the bottom of the normal range, a product with a coefficient below one became subnormal and a flushing backend dropped it, so a normal, well-conditioned mean such as values [1.5 tiny, 1.5 tiny] under the probability row [3/4, 1/4] came back 25% low. Replace the formation shared by zero_safe_average and both aggregate_scaled routes. Every node's weighted value is now the product of two normal significands, carried with the integer exponent coefficient - shift + value. The numerator is placed so its largest term sits in [1, 4) and the mass so its likeliest node sits in [1, 2); each term is lowered only by its distance to the largest one. A term lost on the way down is below the largest by the whole normal range, so absent cancellation it cannot be material at any scale. Neither sum can overflow, and the two exponents meet once in the final ratio. Poison rows, null events against infinite values, the eager zero-mass guard, the centered-residual JVP and the aggregate_scaled AD refusal are unchanged. The certificate pins for zero_safe.py are resealed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LAZ63AjbZFLweWuJyPUs6S
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LAZ63AjbZFLweWuJyPUs6S
… into codex/514-continuation-overflow
…ation-overflow # Conflicts: # tests/candidate_certificate/direct_flow.py # tests/candidate_certificate/sources.json
…ation-overflow # Conflicts: # tests/candidate_certificate/sources.json
A Tauchen-family process reads its law's own transition row at the actual current value (the tabulated row at a node), so a value between or beyond the nodes, in a solve or a simulation, prices a genuine lottery. Rouwenhorst rows exist at nodes only: between nodes the two neighbouring rows are blended; beyond them clip_lookup/clip_state read the edge row and "extrapolate" extends the continuation linearly from the edge row's and its neighbour's continuations, linear in the certainty equivalent. A carried Rouwenhorst state whose fixed nodes differ between regimes is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hs8mfXPYyEa24KaAp6BwCW
Tauchen panels move where a simulated state lies between nodes, because its transition row is now the law's row at that value rather than an interpolation of node rows. The uniform and Rouwenhorst panels differ in the last bit only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hs8mfXPYyEa24KaAp6BwCW
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## codex/on-nodes-transition-rules #628 +/- ##
===================================================================
+ Coverage 94.06% 94.10% +0.03%
===================================================================
Files 660 660
Lines 109752 110569 +817
===================================================================
+ Hits 103240 104052 +812
- Misses 6512 6517 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…20261103 # Conflicts: # tests/candidate_certificate/direct_flow.py # tests/candidate_certificate/sources.json
This branch has not been deployed
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.
Scaled continuation expectations can overflow before normalization when values are near the floating-point limit. Small coefficients and small values can also underflow before their finite normalized mean is formed. This change normalizes coefficient mantissas and tracks binary scales so these intermediate operations preserve the represented contributions.
The derivative rule forms normalized finite slopes and transports the centered residual separately. This preserves finite coefficient derivatives when the rounded mean equals a neighboring value, while retaining zero-weight and nonfinite-input conventions. The implementation uses existing JAX binary scaling; it adds no runtime accuracy certificate or exact-arithmetic fallback.
Validation covers float32 and float64 eager, JIT, mapped, forward- and reverse-mode paths with exact-rational references, public continuation/policy examples, and existing CE controls. Tests also check equivalent coefficient/shift representations and the physical scale returned by the shared helper.
The added arithmetic has a measured cost. Relative to the prior revision, the bounded CPU kernel is about 1.5–1.8 times slower for primal evaluation and 1.17–1.20 times slower for coefficient gradients. A matched bounded Eichenbaum A100 solve showed no measurable slowdown: warm solves were 6.16 seconds, within the repeated baseline's 0.44% spread, with unchanged device peak memory and bitwise-identical values and sampled policies. This covers the tested profile; whole-model differentiation and larger calibration grids remain unmeasured. CPU kernel and differentiation cost acceptance remains open.
Process-edge continuation now uses one shared corner program. The loop keeps the certainty equivalent inside each joint corner and retains the original corner order. This removes exponential copies of the continuation graph without changing the economic rule. A regression test limits program construction to two continuation programs.
The additional checks cover 202 native mathematical cases and 1,106 source mutations. On the benchmark runner's V100, the selected ACA simulation program built in 2.13 seconds; both old-code arms exceeded 82 seconds in that phase before the 120-second process cap. The repaired replay matched the captured outputs and layouts exactly, rejected output mutations, and ran three warm calls in 2.412–2.414 seconds. Baseline warm time and a full-model speedup remain unmeasured.
The normal ACA benchmark class completed on the V100 with a fresh JAX cache and configured FP64: cold automatic solve and simulation took 1,803.34 seconds, the following warm call took 250.28 seconds, and the measured CPU-memory peak was 11.14 GiB. Total benchmark-cache setup took 36 minutes 44 seconds. These are one cold and one warm observation on eight CPU cores; a source-only certificate used separate cores during part of the run. There is no controlled full-baseline or A/A comparison. The earlier graph-construction hang is repaired; the remaining full-model cost needs review. This direct invocation used the original benchmark class and measurement subprocess; it does not establish a successful GitHub ASV CLI run.