Repository navigation
fix(assets): reject Q4_1 blocks with nonfinite stored metadata - #172
Merged
Merged
Conversation
2 of 3 tasks
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.
What & why
Checking that source weights are finite is not enough for Q4_1: the block scale and minimum are stored in F16. Finite float32 values can overflow either stored field to infinity, yielding unusable quantized weights.
Validate the actual F16 metadata before producing the payload and return a clear conversion error when it cannot represent finite values. Reuse the validated arrays when serializing the block.
Area
edge0-infer/tools/assets/)How was it tested?
uv run --project edge0-infer/tools/assets --no-sync python -m pytest edge0-infer/tools/assets/tests/test_gguf_lite.py -q9 passed with no warnings. Four regression inputs fail on the base revision: positive/negative minima just beyond the F16 range, an overflowing block scale, and extreme finite float32 weights. The finite F16 boundary and existing hand-computed payloads remain exact.
The complete offline asset L1 suite also passes:
uv run --project edge0-infer/tools/assets --no-sync python -m pytest edge0-infer/tools/assets/tests -m l1 -q --basetemp=../tooling-five/edge0/pytest— 90 passed, 6 deselected.Checklist