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 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 a guard pipeline (invariants → spectral → RMT → variance), and produces a machine‑readable Evaluation Report you can gate in CI.

Why InvarLock?

  • Quality gates for weight edits: 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 quantized/pruned checkpoints.
  • MLOps teams building CI quality gates and reviewable artifacts.
  • Researchers validating compression/edit methods with reproducible, paired eval.

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

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

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

# Compare baseline vs subject (downloads require explicit network enable)
INVARLOCK_ALLOW_NETWORK=1 invarlock evaluate \
  --baseline gpt2 \
  --subject  gpt2 \
  --adapter auto \
  --profile dev \
  --quiet

# Validate the evaluation report
invarlock verify reports/eval/evaluation.report.json

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

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

Proof packs (portable evidence bundles)

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

Note: configs/ and scripts/ are repo resources and are not shipped in wheels; clone the repo to use presets and proof-pack helpers.

Installation

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

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

Optional extras: invarlock[gpu], invarlock[awq,gptq]. Full setup: https://github.com/invarlock/invarlock/blob/main/docs/user-guide/getting-started.md.

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 Maintainers}},
  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.3.9.tar.gz (482.5 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.3.9-py3-none-any.whl (534.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: invarlock-0.3.9.tar.gz
  • Upload date:
  • Size: 482.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for invarlock-0.3.9.tar.gz
Algorithm Hash digest
SHA256 fd549ccb438d0d9fe807b3d0cd539867441180fc88b157fd03414cab445730f5
MD5 da15a6c3c17e8891af196137a853ab79
BLAKE2b-256 e9c454bc583e035df181302e9fa080c418c9c05e814a0776e730958dd33e5278

See more details on using hashes here.

File details

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

File metadata

  • Download URL: invarlock-0.3.9-py3-none-any.whl
  • Upload date:
  • Size: 534.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for invarlock-0.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 12606eba8006f06a4294f18bade7c37d6d4a82ded82a99fb3b583b0f17c5496e
MD5 05d2a9a489b99e364267ae9bc15390e5
BLAKE2b-256 13d3e75ecd92a84c68e8218fa329fc40111912f27716be626cf2b22f6bc463dd

See more details on using hashes here.

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