Refactor Diamond injector to per-state B checkpoints#127
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b195ab435
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| assert_eq!( | ||
| self.read_bytes(dir_path, self.preprocess_hash_key_id()).as_slice(), | ||
| &preprocess_out.hash_key, | ||
| "DiamondInjector online_eval preprocess hash key mismatch" | ||
| preprocess_out.final_state_count(), | ||
| self.state_count_at_level(self.input_count), | ||
| "DiamondInjector final checkpoint count mismatch" | ||
| ); |
There was a problem hiding this comment.
Restore artifact identity check in online_eval
online_eval now only verifies the final checkpoint count and static metadata, so a preprocess_out from a different preprocessing run (or different artifact directory) with the same input_count/base/batch_bits will pass validation. In that case, state transitions are read from dir_path but final projection preimages are later sampled from mismatched final checkpoints, which can silently break DiamondWE/DiamondIO correctness (wrong decryptions/outputs) instead of failing fast. The previous hash-key binding check prevented this cross-artifact mix-up.
Useful? React with 👍 / 👎.
Summary
W-based Diamond injector paths and switch transitions/final projections to per-(level, state)Bcheckpointspreimage_extendusage withpreimageacross Diamond injector, DiamondWE, and DiamondIO flowsTesting
cargo +nightly fmt --allcargo test diamond_injectorcargo test diamond_wecargo test diamond_iocargo check --lib --features gpu