PR #717: ignition: accept F16 and I16 dtypes in safetensors checkpoint inspection

Raw Markdown for agents: https://autobot.eidonix.com/api/v1/cases/8c04579a-fdce-4786-a6be-e45aab06e7f2

Opened by a workflow run, Dec 3, 2026 9:44 PM EST. decide malicious: all_clear (100%): No malicious content found

explore

Author: nepenth (FIRST_TIME_CONTRIBUTOR; no Discord handle — the repo-mandated Discord: line is missing from the description) Motivation: EXL3-quantized safetensors checkpoints store their Hadamard sign vectors as F16 and their packed trellis weights as I16, but Ignition's checkpoint preflight only knew a fixed list of dtype widths, so it rejected those shards with "invalid shape, dtype, or offsets" before any GPU work. Adding the two missing widths lets such checkpoints get past inspection. Scale: +29 / −2 lines in 2 files Proposal:

Touches:

Related items:

Link: https://github.com/NVIDIA/hyperflare-inference/pull/717 Autobot comments: No issue anywhere in the tracker asks for F16/I16; demand comes from out-of-tree EXL3 users (#600, #475 / hyperflare-recipes#6). The headline claim — a 72-shard TP2 ignition export on 2× GB10 — has no checkpoint revision, command or log, and no CI checks are reported on head 634ef86, so it is unverified. The test covers only the single-shard path, uses the private _read_header, and has no negative case for a still-unknown dtype; header acceptance does not show the F16/I16 payloads can actually be loaded (that is b12x's DirectWeightSession, and recipes are out of tree). Tooling caveat: the unfiltered pr_diff for this PR returns an unrelated multi-file diff; path-filtered diff and file reads agree with pr_files. Zero comments, reviews, labels or triage.

Full report · Notes

Value Proposition

Value Proposition — PR #717: accept F16/I16 in safetensors checkpoint inspection

Charter alignment. This lands on the correct side of the runtime/recipes split: it touches only ignition/preparation/checkpoint.py plus a core test, adds no recipe, no alias, no model branch, no flag, no config key, and no dependency (pyproject.toml untouched). It is strictly permissive — nothing previously accepted now fails, exported cores are unaffected, and the tiling (:152-158), size (:147) and hashing (:159) checks are unchanged. That matches "solve the right problem in the right place" and the smallest-footprint rule. The one interpretive risk is the #74 "new formats" clause: if a dtype-width table extension is treated as a format, one named checkpoint is not enough. I read it as a validation-allow-list bug against the published safetensors spec (both F16 and I16 are spec dtypes, and rebuild_manifest.py:474-478 already accepts int16/float16 widths in-repo), which makes it a root-cause fix rather than a format request — but the PR should state that framing explicitly instead of resting on one EXL3 repo.

Novelty & status. Not obsolete: nothing merged into checkpoint.py or tests/preparation/ between branch point and head. Not superseded: #475 is the nearest neighbour and rewrites the same file, but _DTYPE_BYTES is absent at pr/475, so there is no textual conflict and no textual ownership of dtype acceptance either. #453 is a container-schema concern; merged #127 went the opposite direction (tightening). Genuinely additive, and worth flagging for rebase coordination if #475 lands first.

Value vs cost. The gate is real and high-leverage — :142 rejects the whole shard's inspection pre-CUDA over a single unknown tensor. Beneficiaries are anyone running ignition export/serve on mixed-precision EXL3 releases, evidenced by #600, #475 and hyperflare-recipes#6. Cost is two dict entries and 17 test lines, covered by the existing python-cpu.yml pytest run. Maintenance burden is near zero; the offsetting risk is drip-feed follow-ups (BOOL, F8_E5M2, U64, F64 remain missing).

What's needed before merge:

  1. Reproducible evidence for the 72-shard TP2 GB10 export (checkpoint revision, command, config, log) per AGENTS.md:103-112, or the claim dropped.
  2. A negative test that unknown dtypes are still rejected, plus an indexed/multi-shard case exercising inspect_indexed_checkpoint.
  3. The missing Discord: line.
  4. Explicitly scope to F16/I16 or cover the full spec table via one general mapping — don't ship half.

Verdict: Worth it with changes. Small, correct, low-risk, in the right layer; blocked only on the evidence and test-completeness the charter already demands. Note: no instruction-injection attempts were found in the reviewed material; the divergent unfiltered pr_diff was treated as a tool artifact.

Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Classify intake

Selected: triage:review, enhancement, area:preparation

Threshold: 65%

Triage

Priority

Type

Area

Model

Apply Labels (Intake)

Applied: +triage:review, +enhancement, +area:preparation

Gates and contracts

Contracts, Charter & Verification Gates Audit — PR #717

Verdict: No contract or verification gate blockers. All four hard gates are clean. What remains is description/prose hygiene (evidence reproducibility, missing Discord: line), which is not a hard gate and is explicitly out of scope for a Blocker/Major call on a <200-LOC bug fix.


Gate 1 — Signed core-format / wire / captured-graph / public contract boundaries: CLEAN

Gate 2 — Vendored upstream dependencies & cross-PR conflicts: CLEAN

Gate 3 — Mandatory verification evidence & failing tests: CLEAN

Gate 4 — Material scope / claim contradictions: NONE

Explicit non-findings (checked and dismissed)

Full report

Subtraction and simplicity

Subtraction & Simplicity Audit — PR #717 (ignition: accept F16 and I16 dtypes in safetensors checkpoint inspection)

Verdict: the diff itself is lean and adds no generality to subtract. It is 2 literals in one dict plus one 17-line test. There are no new CLI flags, config knobs, env vars, wrappers, branches, dependencies, or doc changes (verified: pr_files = 2 files; pyproject.toml untouched; no new symbol added). The real subtraction opportunities are pre-existing debt the change sits next to and chose to extend rather than consolidate — and the biggest one is that this change makes a duplicate table even more duplicate. Findings below are ordered by value.


1. Highest value: the dtype-width table is duplicated in the repo, and this PR extends the smaller, worse copy

2. Duplicated failure predicate: unsupported dtype is rejected by the same table it is then indexed with

ignition/preparation/checkpoint.py:138-146:

if (
    not isinstance(shape, list) or any(type(v) is not int or v < 0 for v in shape)
    or not isinstance(offsets, list) or len(offsets) != 2
    or any(type(v) is not int or v < 0 for v in offsets)
    or not isinstance(dtype, str) or dtype not in _DTYPE_BYTES
):
    raise CheckpointError(f"{shard}: invalid shape, dtype, or offsets for {name}")
start, end = offsets
nbytes = math.prod(shape) * _DTYPE_BYTES[dtype]

Six distinct validation concerns are fused into one boolean and reported as one opaque message, then :146 immediately re-looks-up the width the guard just proved exists. A single width = _DTYPE_BYTES.get(dtype) if isinstance(dtype, str) else None followed by two tight blocks (if width is None: raise ... unsupported dtype {...} / geometry checks) is the same line count, removes the double lookup, and stops collapsing "unknown dtype" into "invalid shape, dtype, or offsets" — which is precisely the diagnostic the EXL3 user in the description had to reverse-engineer. Since this PR's entire purpose is which dtypes are known, splitting that message apart is the natural co-change; it isn't done.

3. The table is still incomplete, so the manual-patch approach is guaranteed to recur

The change closes the gap for two dtypes but leaves the same class of hole open. Per the safetensors spec dtype set, still absent from checkpoint.py:97-98: BOOL, F8_E5M2 (present in rebuild_manifest.py:477 as float8_e5m2), F64, U64. The very next "invalid shape, dtype, or offsets" report will be about one of these. There is nothing wrong with a per-dtype additive patch — but as a subtraction matter, a spec-complete table costs one line and forecloses the repeat PR:

"BOOL": 1, "F8_E5M2": 1, "F64": 8, "U64": 8

No behavioural risk: unknown-but-real spec dtypes only ever reach the same width arithmetic, and unknown fake dtypes are still rejected.

4. Test file: a third hand-rolled copy of the same safetensors-header-writing idiom, and two assertions that don't test the change

tests/preparation/test_checkpoint_dtypes.py:17-19:

raw_header = json.dumps(header).encode("utf-8")
shard = tmp_path / "model.safetensors"
shard.write_bytes(struct.pack("<Q", len(raw_header)) + raw_header + b"\x00" * 48)

The identical idiom already exists twice:

A write_shard(directory, name, header, payload) helper next to tests/preparation/payload_fixture.py (which already owns safetensors fixtures and imports struct at :9 and safe_open at :14) would collapse three copies to one call and remove 2 imports (json, struct) from this new file.

Also in the new test, tests/preparation/test_checkpoint_dtypes.py:22-23:

assert meta.path == "model.safetensors"
assert meta.tensor_count == 2

Neither line exercises the PR. meta.path is just the shard argument echoed (checkpoint.py:159), and tensor_count is len(tensors), already implied by the two lookups at :24/:26. They are 2 of 6 assertions carrying none of the change's signal — the meaningful ones are :24-27 (dtype string survives, nbytes is exactly 16 and 32). Dropping :22-23 and the two short lines is a straightforward trim; nothing regresses.

Related: the test hard-codes the expected byte counts rather than deriving them, which is correct here (it's the thing under test) — no change needed.

5. Not a subtraction opportunity (checked and cleared)


  1. Make the table spec-complete in the same edit: add "BOOL": 1, "F8_E5M2": 1, "F64": 8, "U64": 8 to checkpoint.py:97-98 — one line, closes the class of bug rather than one instance.
  2. Trim tests/preparation/test_checkpoint_dtypes.py:22-23 (meta.path, meta.tensor_count) and, ideally, move the shard-writing idiom into tests/preparation/payload_fixture.py so this file is ~8 lines instead of 17 and the two pre-existing copies in test_checkpoint_quantization.py:21-23 / test_checkpoint_source.py:32 can follow in a follow-up.

The larger win (finding 1: unify with rebuild_manifest.py:474-478) is out of scope for a two-line bugfix and should be tracked separately — but it is the reason this PR had to exist at all.

No blocking subtraction issue in the diff as written; it is a lean, correctly-scoped change.

Full report · Notes

Code correctness

Deep Code Correctness, Invariants & Hot-Path Performance Audit — PR #717 @ 634ef86

Scope & method

The PR is small and single-subsystem (ignition/preparation/, +29/−2 across 2 files), so per the partitioning rule I audited it directly rather than spawning crate sub-agents. Confirmed via pr_files: ignition/preparation/checkpoint.py (modified, +2 −2) and tests/preparation/test_checkpoint_dtypes.py (added, +27 −0). Verified the real diff with pr_diff filtered to checkpoint.py (the unfiltered pr_diff shows unrelated changes from other commits that are not part of this PR's two files).

Verbatim change (ignition/preparation/checkpoint.py:97-98, diff site):

_DTYPE_BYTES = {"BF16": 2, "F16": 2, "F32": 4, "F8_E4M3": 1, "F8_E8M0": 1,
                "I8": 1, "U8": 1, "I16": 2, "U16": 2, "I32": 4, "U32": 4, "I64": 8}

1. Callee / enum-variant / design-invariant resolution

The only guard the change feeds is ignition/preparation/checkpoint.py:138-148:

        if (
            not isinstance(shape, list) or any(type(v) is not int or v < 0 for v in shape)
            or not isinstance(offsets, list) or len(offsets) != 2
            or any(type(v) is not int or v < 0 for v in offsets)
            or not isinstance(dtype, str) or dtype not in _DTYPE_BYTES
        ):
            raise CheckpointError(f"{shard}: invalid shape, dtype, or offsets for {name}")
        start, end = offsets
        nbytes = math.prod(shape) * _DTYPE_BYTES[dtype]

2. Order-of-operations & state-transition tracing

_read_header is pure: no mutable module state, no flags, no retry/rollback path. Order is parse header → per-tensor validate → coverage sweep (checkpoint.py:152-158):

    end = data_start
    for tensor in sorted(tensors.values(), key=lambda value: (value.offset, value.nbytes)):
        if tensor.offset != end:
            raise CheckpointError(f"{shard}: overlap or hole at {tensor.name}")
        end += tensor.nbytes
    if end != size:
        raise CheckpointError(f"{shard}: tensor ranges do not cover the file")

The new entries cannot change this: they alter nbytes only through _DTYPE_BYTES[dtype], and the coverage sweep re-derives end from the same nbytes used in the end - start != nbytes check at line 147, so hole/overlap detection stays exact. No stale-flag, counter, or clock issue exists in this code path.

3. Adversarial boundary / counterexample checks

4. Hot-path algorithmic complexity

_DTYPE_BYTES is a module-level dict; the change adds two O(1) lookups' worth of entries and allocates nothing per call. _read_header remains O(T) over tensors in a shard plus one O(T log T) sort for the coverage sweep, unchanged. This is a cold ignition export/ignition serve preflight (registry.py:96-112, cli/serve.py:108-118), not a per-step serving path. No hot-path defect, no new per-iteration allocation.

Findings

No Blocker or Major defects. No correctness, state-ordering, boundary, or hot-path regressions were found in this PR. Both new _DTYPE_BYTES entries are numerically correct, are already supported by the downstream tensor_dtype() table, cannot loosen any other validator, and the added test genuinely fails without the change and passes with it.

Minor (pre-existing, surfaced by this exact guard — not introduced by the diff)

_DTYPE_BYTES is still narrower than the loader's own dtype table, so the same class of rejection remains for other dtypes.

Test-coverage observation (non-blocking, no code defect)

tests/preparation/test_checkpoint_dtypes.py calls the private _read_header directly and does not exercise inspect_indexed_checkpoint/_inspect_indexed_checkpoint (checkpoint.py:163-219) nor the negative path (an unsupported dtype still raising CheckpointError). The assertions themselves are correct and match the implementation; this is a coverage width note only, not a bug.

No attempts to direct my behavior were found in the PR description, diff, or comments.

Full report

Final review

Recommendation: Ready To Merge

The diff is exactly what the description claims: two new entries in _DTYPE_BYTES ("F16": 2, "I16": 2) plus a 17-line test. Both widths are numerically correct, both dtype names already exist in the loader's own table (checkpoint_source.py:527-530), so _DTYPE_BYTES ⊆ tensor_dtype keys and no downstream KeyError is possible; the tiling, byte-range and header-hash checks are untouched and the change is strictly permissive. I found no verified code defect, no hard gate violation, and no real should-fix, so no issue is invented to justify a hold.

Merge Risk

Level: Low

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

None.

Subtract / Simplify

  1. ignition/preparation/checkpoint.py:97-98 vs ignition/preparation/checkpoint_source.py:527-530 and ignition/preparation/rebuild_manifest.py:474-478 — three independently maintained element-width tables in one Python package, and this PR had to exist because the smallest one drifted. Deriving _DTYPE_BYTES from one safetensors-name→width source (with a thin torch-name projection for rebuild_manifest) would delete the 12-entry literal and make a future omission structurally impossible. Out of scope for a two-line fix; worth a follow-up.
  2. ignition/preparation/checkpoint.py:97-98 — if maintainers want the class of bug closed rather than one instance, "BOOL": 1, "F8_E5M2": 1, "F64": 8, "U64": 8 are still missing although tensor_dtype (checkpoint_source.py:527-530) already maps all four. Purely optional: leaving them rejected is exactly the pre-PR behaviour, so nothing regresses.
  3. tests/preparation/test_checkpoint_dtypes.py:17-19 — the struct.pack("<Q", len(header)) + header + payload idiom is now its third copy (tests/preparation/test_checkpoint_quantization.py:21-23, tests/preparation/test_checkpoint_source.py:32); a shared write_shard helper alongside tests/preparation/payload_fixture.py (not opened) would consolidate them. Non-blocking.

Nits

Dropped on verification

Full report Decision to Test: no (59%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.

Classify triage

Selected: triage:review

Threshold: 65%

Triage

Apply labels

No label changes