mirror of
https://github.com/elder-plinius/OBLITERATUS.git
synced 2026-12-05 18:44:41 +01:00
Start milestone 4 (F16): turn a confirmed temporary intervention into the smallest persistent representation that expresses it, as a separate artifact, and verify the saved candidate itself after a fresh load. - Builds only for registry keys computed as persistent-pilot eligible (fixture models only with a test-only allowance marking outputs software-contract). The reference model is never written to; its digests are checked before and after. - Forms: a removable hook-free activation adapter (all operations), a LoRA adapter through the existing PEFT exporter (all-token ablation on a plain linear site), or a separate weight-edited copy (projection or bias shift). Auto picks the feasible form with the fewest stored elements. - A write-once, content-addressed manifest records parent identity and fingerprints, recipe and direction binding, every edited parameter with before/after digests, compatibility checks, artifact digests and build-time tolerances. - Verification reloads the candidate from disk and compares reference, temporary hook and candidate arms on independent rows: the edit must match the registered recipe, effects and outputs must agree with the temporary intervention, the useful-effect threshold and every collateral endpoint must hold. Failures are permanent and never selected. - `obliteratus experiments candidate build|verify|show`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
72 lines
4.6 KiB
Python
72 lines
4.6 KiB
Python
"""``obliteratus experiments candidate build|verify|show``."""
|
|
|
|
|
|
def add_candidate(commands):
|
|
parser = commands.add_parser(
|
|
"candidate", help="Persistent candidates: build the smallest saved form of a "
|
|
"persistent-pilot eligible intervention and verify it after reload")
|
|
sub = parser.add_subparsers(dest="candidate_command", required=True)
|
|
build = sub.add_parser("build", help="Build a candidate from an unlocked confirmation "
|
|
"registration (refused below persistent-pilot eligible)")
|
|
build.add_argument("registration", help="Confirmation registration id (sha256:...)")
|
|
build.add_argument("--run", required=True, help="Run directory holding the registry")
|
|
build.add_argument("--source", required=True,
|
|
help="Local reference model directory (read only; digests checked)")
|
|
build.add_argument("--representation", default="auto",
|
|
choices=("auto", "activation_adapter", "lora", "weight_edit"))
|
|
build.add_argument("--target-rate-tolerance", type=float,
|
|
help="Allowed |candidate - temporary| target success rate (default 0.05)")
|
|
build.add_argument("--agreement", type=float,
|
|
help="Minimum completion agreement with the temporary arm (default 0.95)")
|
|
build.add_argument("--logit-atol", type=float,
|
|
help="Allowed final-token probe logit difference (default 1e-4)")
|
|
build.add_argument("--allow-fixture-results", action="store_true",
|
|
help="Count software-contract (fixture model) results and mark the "
|
|
"candidate software-contract; testing only")
|
|
build.add_argument("--actor", help="Who builds (default: the login name)")
|
|
verify = sub.add_parser("verify", help="Reload a candidate and measure it on independent rows")
|
|
verify.add_argument("candidate", help="Candidate id (sha256:...)")
|
|
verify.add_argument("--run", required=True)
|
|
verify.add_argument("--pack", required=True, help="Verification dataset pack")
|
|
verify.add_argument("--revision", required=True, help="Verification dataset revision")
|
|
verify.add_argument("--role", required=True, choices=("select", "calibrate", "test"))
|
|
verify.add_argument("--allow-locked-test", action="store_true")
|
|
verify.add_argument("--attach", action="store_true",
|
|
help="Attach a passing candidate as persistent-pilot evidence")
|
|
verify.add_argument("--actor", help="Who verifies (default: the login name)")
|
|
show = sub.add_parser("show", help="One candidate, or every candidate of a run")
|
|
show.add_argument("candidate", nargs="?")
|
|
show.add_argument("--run", required=True)
|
|
|
|
|
|
def run_candidate_command(args):
|
|
from obliteratus.experiments import candidate
|
|
if args.candidate_command == "build":
|
|
tolerances = {k: v for k, v in (("target_rate", args.target_rate_tolerance),
|
|
("agreement", args.agreement),
|
|
("logit_atol", args.logit_atol)) if v is not None}
|
|
manifest = candidate.build_candidate(args.run, args.registration, args.source,
|
|
representation=args.representation,
|
|
tolerances=tolerances, actor=args.actor,
|
|
allow_fixture_results=args.allow_fixture_results)
|
|
return {k: manifest[k] for k in ("id", "location", "scope", "artifact", "tolerances")} | {
|
|
"representation": manifest["edit"]["representation"]}
|
|
if args.candidate_command == "verify":
|
|
from obliteratus.experiments.candidate_verify import verify_candidate
|
|
from obliteratus.experiments.inputs import default_pack_resolver
|
|
dataset = {"pack": args.pack, "revision": args.revision, "role": args.role,
|
|
"allow_locked_test": args.allow_locked_test}
|
|
record = verify_candidate(args.run, args.candidate, dataset,
|
|
pack_resolver=default_pack_resolver, actor=args.actor)
|
|
summary = {k: record[k] for k in ("candidate", "attempt", "outcome", "selected",
|
|
"comparison", "checks", "maturity_note")}
|
|
if args.attach and record["selected"]:
|
|
from obliteratus.experiments.candidate_status import attach
|
|
summary["attachment"] = attach(args.run, args.candidate, actor=args.actor)
|
|
return summary
|
|
from obliteratus.experiments.candidate_status import show
|
|
return show(args.run, args.candidate)
|
|
|
|
|
|
__all__ = ["add_candidate", "run_candidate_command"]
|