Skip to content

fix(assets): reject Q4_1 blocks with nonfinite stored metadata - #172

Merged
shuk777 merged 1 commit into
Edge0-AI:mainfrom
Afloat16:fix/20261111-q41-finite-metadata
Nov 16, 2026
Merged

shuk777 merged 1 commit into
Edge0-AI:mainfrom
Afloat16:fix/20261111-q41-finite-metadata

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

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

  • Model asset tools (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 -q

9 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

  • Added numerical regression tests
  • Existing GGUF roundtrip and Q4_1 known-answer tests pass

@shuk777 shuk777 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shuk777
shuk777 merged commit 546e401 into Edge0-AI:main Nov 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants