Repository navigation
Keep half-precision Q-value normalization finite - #126
Open
sylvesterkaczmarek wants to merge 1 commit into
Open
sylvesterkaczmarek wants to merge 1 commit into
sylvesterkaczmarek wants to merge 1 commit into
Conversation
Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
This was referenced Oct 7, 2026
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.
Summary
Fixes #125.
Promote Q-range calculations and supplied bounds to at least float32, then restore the established result dtype. This avoids a float16 zero-epsilon division and overflowing differences between finite bounds. The public half-precision MuZero regression now selects the same action as float32.
Unvisited-action semantics, explicit wider dtypes and ordinary float32 results are preserved. The mixed-value calculation from PR #120 is untouched. Already-overflowed Q-values and explicit zero denominators are outside the correction.
Validation
python -m pytest -q --pyargs mctx (from a temporary child of the repository)39 tests passed, covering the complete MCTX test suite. Fifteen new tests check equal/wide ranges, float16/bfloat16/float32 inputs, explicit half and wider bounds, JIT, unvisited actions, and a real 16-simulation MuZero search. Existing JSON tree fixtures also pass.
The full suite ran from an isolated temporary child directory of the checkout using
--pyargs mctx, as required by the repository's relative tree-fixture paths. No GPU/TPU or trained-model evaluation was run. No changes to general search, visit accounting or action masking are included.Tested locally on macOS CPU using real module imports. New test formatting, scoped static checks, syntax checks and
git diff --checkpass. No dependency or workflow changes.