Skip to content

aliuyar1234/certipatch

Repository files navigation

CertiPatch

Python License DOI Paper PDF Reproducibility

CertiPatch is a reproducible research framework for specification repair of frozen language models with a deterministic train -> certify -> verify pipeline.

Author: Ali Uyar (Independent Researcher)

Citation DOI (latest release archive): 10.5281/zenodo.18541322

Release note: Keep citing the existing archived release DOI above; metadata or manuscript edits on main do not require minting a new DOI.

Description

This project studies reliable post-hoc repair of model behavior under explicit, machine-checkable constraints. CertiPatch learns localized inference-time patches, certifies behavior over declared evaluation scope, and verifies artifact integrity via replayable certificates with fail-closed semantics.

This repository provides:

  • gated low-rank hookpoint patches (GLR-HP),
  • constrained optimization (augmented Lagrangian + CEGIS),
  • replayable empirical certificates with fail-closed verification semantics,
  • end-to-end generation of paper artifacts (figures, tables, and LaTeX).

Why CertiPatch

  • Deterministic spec/domain generators for reproducible evaluation.
  • Constraint-first repair objective: satisfy in-scope spec constraints while quantifying collateral drift.
  • Artifact-locked certificates with explicit scope and coverage semantics.
  • End-to-end workflow from training through verification to publication assets.

Repository layout

  • certipatch/: library code (specs/, models/, cegis/, eval/, artifacts/)
  • scripts/: runnable entrypoints (scripts/reproduce_paper.py)
  • configs/: YAML overlays merged with configs/default.yaml
  • schemas/: JSON schemas for config/artifacts/certificates/metrics
  • tests/: deterministic pytest suite
  • paper/latex/: manuscript, figures, tables

Installation

python -m venv .venv
.\.venv\Scripts\activate
python -m pip install -e ".[dev,torch,hf,tl,viz]"

Quick start

Run a toy tier:

python scripts/reproduce_paper.py --config configs/compare2d_certipatch.yaml --tier toy

Run the paper profile:

python scripts/reproduce_paper.py --config configs/paper_full.yaml --tier full

Results and paper

  • Download paper PDF: paper/latex/main.pdf
  • Build paper locally:
cd paper/latex
latexmk -pdf -interaction=nonstopmode -halt-on-error main.tex

Reproducibility contract

The reproduction workflow is fail-closed. A valid run must:

  • validate config against schemas/config_schema.json,
  • write artifacts to runs/<run_id>/,
  • generate paper assets under paper/latex/figures/ and paper/latex/tables/,
  • pass manifest and certificate verification.

If verification fails, outputs are not considered valid.

Development checks

python -m pytest -q
python -m ruff format . && python -m ruff check .
python -m mypy certipatch
python scripts/update_manifest_sha256.py

Reproduction reference

See REPRODUCE.md for expected outputs and validation behavior.

About

Reproducible framework for specification repair of frozen language models with replayable empirical certificates.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors