Skip to content

feat(weight-custody-manifest): add load_guard, verify weights before loading - #67

Merged
imran-siddique merged 1 commit into
mainfrom
feat/load-guard
Jul 29, 2026
Merged

feat(weight-custody-manifest): add load_guard, verify weights before loading#67
imran-siddique merged 1 commit into
mainfrom
feat/load-guard

Conversation

@imran-siddique

Copy link
Copy Markdown
Contributor

What

load_guard.py, the smallest useful WCM integration: verify the checkpoint before your loader ever touches it.

guarded_load() checks two things before a single byte reaches the loader:

  1. the manifest's joint signature (builder + custodian) is valid, and
  2. the bytes on disk hash to exactly what the manifest binds.

Either mismatch raises RefusedToLoad before the load. Drop it in front of an existing safetensors / transformers load.

python load_guard.py                                   # offline: certified loads, tampered refused
python load_guard.py --load --model model.safetensors  # gate + actually load a real file (run-local)

Verified

Ran against the published weight-custody-manifest 0.22.1: exit 0, certified checkpoint loads, a one-byte-flipped fork is refused with the hash mismatch shown. Wired into the CI feature-examples step (offline path) and documented under a new "Gate your model load" section in the README. Real-load path (--load) uses the lazily-imported infer extras and is run-local, not in CI. No em dashes.

🤖 Generated with Claude Code

…loading

load_guard.py is the smallest useful integration: a drop-in guard that
verifies the checkpoint before the loader touches it. It checks the
manifest's joint signature and that the bytes on disk hash to exactly
what the builder bound, and refuses a tampered or swapped fork before
the load. guarded_load() drops in front of an existing safetensors /
transformers load; --load --model gates and loads a real file
(run-local). Offline demo (certified loads, one-byte-flipped fork
refused) runs in CI.

Wired into the CI feature-examples step and documented in the README.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@imran-siddique
imran-siddique merged commit 8723146 into main Jul 29, 2026
17 checks passed
@imran-siddique
imran-siddique deleted the feat/load-guard branch July 29, 2026 22:10
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.

1 participant