Skip to main content

Edit‑agnostic robustness evaluation reports for weight edits (InvarLock framework)

Project description

InvarLock

Edit‑agnostic robustness reports for weight edits

CI OpenSSF Scorecard PyPI Docs License: Apache-2.0 Python 3.12+

Catch silent quality regressions from quantization, pruning, and weight edits before they ship.

Quantizing, pruning, or otherwise editing a model’s weights can silently degrade quality. InvarLock compares an edited subject checkpoint against a fixed baseline with paired evaluation windows, enforces the canonical guard chain (invariantsspectralRMTvarianceinvariants), and produces a machine-readable evaluation report you can gate in CI.

Why InvarLock?

  • Quality gates for edited checkpoints: catch regressions before deployment.
  • Statistical guarantees: paired primary metrics with confidence intervals.
  • Auditable evidence: deterministic pairing metadata + policy digests in evaluation.report.json.
  • CI/CD-friendly: stable exit codes, --json outputs, and portable “proof packs”.
  • Offline-first: network is disabled by default; enable downloads per command.

Who is this for?

  • ML engineers shipping edited model checkpoints, including quantized, pruned, fine-tuned, or otherwise weight-modified variants.
  • MLOps and platform teams building CI gates, attested verification, and reviewable evaluation artifacts.
  • Researchers validating weight-edit, compression, and model-comparison methods with reproducible paired evaluation across text and image-text workflows supported here.

How it works

┌───────────────────────┐     ┌────────────────────────────────────────────┐
│ Baseline (checkpoint) │────►│                                            │
└───────────────────────┘     │  invarlock evaluate                        │
                              │  ├─► Paired windows (deterministic)        │
┌───────────────────────┐     │  ├─► GuardChain pipeline                   │
│ Subject  (checkpoint) │────►│  │   └─► invariants → spectral → RMT → VE  │
└───────────────────────┘     │  └─► Emit: evaluation.report.json          │
                              │                                            │
                              └────────────────────────────────────────────┘
                                                     │
                                     ┌───────────────┴───────────────┐
                                     ▼                               ▼
                                 ✅ PASS                          ❌ FAIL
                                 (ship)                          (rollback)

Quick start

Colab (CPU-friendly): Open in Colab

The minimal install (pip install invarlock) is enough for doctor, verify, report html, and proof-pack verification from an installed wheel. Install invarlock[hf] only when you need evaluate to load Hugging Face models. The secure-default CLI path runs model-loading commands inside the runtime container and expects an OCI container engine such as podman or docker. In a repo checkout, build the local runtime image once with make runtime-image; InvarLock automatically prefers invarlock-runtime:local when it is present. Trusted local workflows can opt into host execution explicitly with --assurance trusted-local on invarlock evaluate, but the attested verification step below expects container execution. The quickstart block below assumes a repo checkout; do not skip make runtime-image if you want the attested container path.

# Repo-checkout quickstart for the attested container path
# HF adapter stack (torch/transformers)
pip install "invarlock[hf]"

# Required in a repo checkout for the attested path; do not skip this step.
make runtime-image

# Version + report schema (when available)
invarlock --version

# Compare baseline vs subject (downloads require explicit network enable)
# Secure-default execution uses the runtime container and writes
# reports/eval/runtime.manifest.json next to evaluation.report.json.
invarlock evaluate --allow-network \
  --baseline gpt2 \
  --subject  distilgpt2 \
  --adapter auto \
  --profile ci \
  --report-out reports/eval \
  --quiet

# Validate the attested evaluation report
test -f reports/eval/runtime.manifest.json
invarlock verify --json reports/eval/evaluation.report.json

# Render HTML for sharing
invarlock report html -i reports/eval/evaluation.report.json -o reports/eval/evaluation.html

If you pass a directory to invarlock report generate or invarlock report explain, it must contain canonical report.json. invarlock report html expects canonical evaluation.report.json. invarlock verify accepts directories with canonical report files, but a directory containing both report.json and evaluation.report.json is ambiguous and rejected; pass the exact file path instead.

Example output (abridged; counts vary by profile/config):

INVARLOCK v<version> · EVALUATE
Baseline: gpt2 -> Subject: gpt2 · Profile: dev
Status: PASS · Gates: <passed>/<total> passed
Primary metric ratio: <ratio>
Output: reports/eval/evaluation.report.json
Attestation: reports/eval/runtime.manifest.json

Command Surface

  • Core workflow: invarlock evaluateinvarlock verifyinvarlock report html.
  • Report inspection and validation: invarlock report generate, invarlock report explain, and invarlock report validate.
  • Environment and release checks: invarlock doctor plus the JSON surfaces emitted by doctor --json and advanced plugins ... --json.
  • The public contract catalog exposed by those JSON surfaces includes validation_keys, console_labels, and metric_kinds.
  • Advanced workflows: invarlock advanced proof-pack, invarlock advanced policy, invarlock advanced plugins, and invarlock advanced calibrate.
  • Trusted host execution for the core evaluate path uses --assurance trusted-local.
  • Optional adapter/backend installs use normal Python extras such as pip install "invarlock[hf]" rather than CLI install commands.

Proof packs (portable evidence bundles)

Proof packs bundle reports + verification metadata into a distributable artifact.

Note: configs/ and most scripts/ remain repo resources and are not included in wheels. Installed wheels include the public contracts and the invarlock advanced proof-pack verify verifier, so downstream users can check bundles without cloning the repository.

Installation

# Minimal CLI (no torch/transformers)
pip install invarlock

# HF workflows (torch/transformers)
pip install "invarlock[hf]"

Optional extras: invarlock[probes], invarlock[gpu], invarlock[awq,gptq]. On Python 3.13+ stacks, gptq may still require a vendor wheel or a supported older interpreter because upstream auto-gptq packaging is narrower than the core InvarLock support matrix. Full setup: https://github.com/invarlock/invarlock/blob/main/docs/user-guide/getting-started.md.

The minimal install covers the core verification and reporting flows. Add invarlock[hf] only for model-loading evaluate runs, and use the installed wheel's proof-pack verifier when you need to inspect a bundle without cloning the repository.

Documentation

Community

Citation

If you use InvarLock in scientific work, please cite it (canonical metadata is in CITATION.cff):

@software{invarlock,
  title  = {InvarLock: Edit-agnostic robustness evaluation reports for weight edits},
  author = {{InvarLock}},
  url    = {https://github.com/invarlock/invarlock},
}

Limitations

  • InvarLock evaluates an edited model relative to a baseline under a specific configuration; results are not “global” guarantees.
  • Not a content-safety/alignment tool.
  • Native Windows is not supported (use WSL2 or Linux).

Support matrix

Platform Status Notes
Python 3.12+ ✅ Required
Linux ✅ Full Primary dev target
macOS (Intel/M-series) ✅ Full MPS supported (default on Apple Silicon)
Windows ❌ Not supported Use WSL2 or a Linux container if required
CUDA ✅ Recommended For larger models
CPU ✅ Fallback Slower but functional

Project status

InvarLock is pre‑1.0. Until 1.0, minor releases may include breaking changes. See CHANGELOG.md.

For guidance on where to ask questions, how to report bugs, and what to expect in terms of response times, see SUPPORT.md.

Contributing

License

Apache-2.0 — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

invarlock-0.7.2.tar.gz (600.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

invarlock-0.7.2-py3-none-any.whl (749.5 kB view details)

Uploaded Python 3

File details

Details for the file invarlock-0.7.2.tar.gz.

File metadata

  • Download URL: invarlock-0.7.2.tar.gz
  • Upload date:
  • Size: 600.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for invarlock-0.7.2.tar.gz
Algorithm Hash digest
SHA256 3fcf4ceba29fb37da0de8dacf45cfa7236347dc01782a62713014782b70b7db4
MD5 17b9a89f706e0e7a13c45de6d1cb4458
BLAKE2b-256 3f76f2fb20fb3354541f6f521257dcd0b9d14c43a4c17f909f8f4797903a80cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for invarlock-0.7.2.tar.gz:

Publisher: release.yml on invarlock/invarlock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file invarlock-0.7.2-py3-none-any.whl.

File metadata

  • Download URL: invarlock-0.7.2-py3-none-any.whl
  • Upload date:
  • Size: 749.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for invarlock-0.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5fe194a15be8bc600196e7116a4cfd68e8c294d17d26a35a52c3e9dcfe49ba84
MD5 5fdb27e1d5389795d870dae82662fb3e
BLAKE2b-256 6eb343e452390610ede481a71bee1223b386896eee0f7bb5f6fe924d2f7f7fb4

See more details on using hashes here.

Provenance

The following attestation bundles were made for invarlock-0.7.2-py3-none-any.whl:

Publisher: release.yml on invarlock/invarlock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page