This page summarizes the current unstaged refactor across model verification, masked-layer constraint enforcement, and training/serialization behavior.
The unstaged changes touch:
src/embkit/commands/model.pysrc/embkit/factory/core.pysrc/embkit/models/vae/base_vae.pysrc/embkit/models/vae/net_vae.pysrc/embkit/models/vae/rna_vae.pysrc/embkit/models/vae/vae.pysrc/embkit/models/ffnn.pysrc/embkit/modules/masked_linear.pysrc/embkit/optimize/__init__.py- tests for command and verification behavior
embkit model verify now supports:
--jsonfor machine-readable output--cifor CI-safe behavior (--json+ fail on unhealthy)--fail-on-unhealthy- strict identity checks:
--strict--expected-feature-count--expected-latent-dim--expected-features-file
The command wording was updated from “authenticity/paranoid” framing to “integrity/sanity” framing.
Pathway masking is now enforced at three points:
- Forward pass: use effective masked weights (
weight * mask). - Post-optimizer step: clamp masked entries back to zero.
- Save-time safety net: clamp again before serialization.
Reason:
- Forward masking alone guarantees functional behavior, but raw masked parameters can still drift from zero due to optimizer state.
- Post-step clamping preserves parameter-level invariants and prevents leakage in saved checkpoints.
- Save-time clamping guarantees serialized artifacts remain constraint-consistent.
- Optimizer loops now enforce mask clamping after every step.
factory.save(...)clamps constrained weights before writing checkpoints.- Model
historyfields are normalized to dictionaries for stable serialization/deserialization ({}fallback instead ofNone).
Verification now includes identity metadata when available:
feature_namesfeatures_countdeclared_latent_dim
This enables strict identity checks from CLI and CI workflows.
NetVAE verification snapshots constrained layer weights before deep audit forwards run. This prevents false negatives where a later forward pass could zero leaked raw entries before the audit reads them.
- Models trained and saved with this refactor should no longer show large masked-edge leakage in verification reports.
- Verification output is more actionable for both interactive usage and CI enforcement.